From 6ebdde3c689598226f4030d3cfe813d885d31f34 Mon Sep 17 00:00:00 2001 From: kimorkim Date: Wed, 27 Apr 2016 13:37:45 +0900 Subject: [PATCH 01/15] add ev3 block --- dist/entry.js | 153 +-- dist/entry.min.js | 2207 ++++++++++++++++++++------------------- extern/util/static.js | 19 +- src/blocks/block_ev3.js | 103 ++ src/hw.js | 3 +- 5 files changed, 1317 insertions(+), 1168 deletions(-) create mode 100644 src/blocks/block_ev3.js diff --git a/dist/entry.js b/dist/entry.js index d4f5ce829c..321d483f77 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -355,7 +355,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(); }; @@ -666,7 +666,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(); }; @@ -764,7 +764,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"); @@ -846,8 +846,8 @@ Blockly.Blocks.arduino_toggle_led = {init:function() { this.setNextStatement(!0); }}; Entry.block.arduino_toggle_led = function(b, a) { - var c = a.getNumberValue("VALUE"), d = a.getField("OPERATOR"); - Entry.hw.setDigitalPortValue(c, "on" == d ? 255 : 0); + var c = a.getNumberValue("VALUE"), d = "on" == a.getField("OPERATOR") ? 255 : 0; + Entry.hw.setDigitalPortValue(c, d); return a.callReturn(); }; Blockly.Blocks.arduino_toggle_pwm = {init:function() { @@ -1496,7 +1496,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); @@ -1520,7 +1520,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; } @@ -1904,6 +1904,40 @@ Entry.block.choose_project_timer_action = function(b, a) { "START" == c ? e.isInit ? e.isInit && e.isPaused && (e.pauseStart && (e.pausedTime += (new Date).getTime() - e.pauseStart), delete e.pauseStart, e.isPaused = !1) : d.startProjectTimer() : "STOP" == c ? e.isInit && !e.isPaused && (e.isPaused = !0, e.pauseStart = (new Date).getTime()) : "RESET" == c && e.isInit && (e.setValue(0), e.start = (new Date).getTime(), e.pausedTime = 0, delete e.pauseStart); return a.callReturn(); }; +Entry.EV3 = {PORT_MAP:{A:0, B:0, C:0, D:0, 1:void 0, 2:void 0, 3:void 0, 4:void 0}, deviceType:{NxtTouch:1, NxtLight:2, NxtSound:3, NxtColor:4, NxtUltrasonic:5, NxtTemperature:6, LMotor:7, MMotor:8, Touch:16, Color:29, Ultrasonic:30, Gyroscope:32, Infrared:33, Initializing:125, Empty:126, WrongPort:127, Unknown:255}, setZero:function() { + var b = this.PORT_MAP; + Object.keys(b).forEach(function(a) { + Entry.hw.sendQueue[a] = b[a]; + }); + Entry.hw.update(); +}, name:"EV3"}; +Blockly.Blocks.ev3_port_out = {init:function() { + this.setColour("#00979D"); + this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["A", "A"], ["B", "B"], ["C", "C"], ["D", "D"]]), "PORT").appendField("\uc758 \uac12\uc744"); + this.appendValueInput("VALUE").setCheck(["Number", "String", null]); + this.appendDummyInput().appendField("\uc73c\ub85c \ubcc0\ud658"); + this.setInputsInline(!0); + this.setPreviousStatement(!0); + this.setNextStatement(!0); +}}; +Entry.block.ev3_port_out = function(b, a) { + var c = a.getStringField("PORT", a), d = a.getValue("VALUE", a); + Entry.hw.sendQueue[c] = d; + return a.callReturn(); +}; +Blockly.Blocks.ev3_touch_sensor = {init:function() { + this.setColour("#00979D"); + this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"]]), "PORT").appendField("\uc758 \ud130\uce58\uc13c\uc11c\uac00 \uc791\ub3d9\ub418\uc5c8\ub294\uac00?"); + this.setOutput(!0, "Boolean"); + this.setInputsInline(!0); +}}; +Entry.block.ev3_touch_sensor = function(b, a) { + a.getStringField("PORT", a); + var c = Entry.hw.getDigitalPortValue(a.getNumberField("PORT", a)); + result = !1; + c.type == Entry.EV3.deviceType.Touch && 1 <= +c.siValue && (result = !0); + return result; +}; Blockly.Blocks.wait_second = {init:function() { this.setColour("#498deb"); this.appendDummyInput().appendField(Lang.Blocks.FLOW_wait_second_1); @@ -1925,10 +1959,10 @@ Entry.block.wait_second = function(b, a) { } a.isStart = !0; a.timeFlag = 1; - var c = a.getNumberValue("SECOND", a); + var c = a.getNumberValue("SECOND", a), c = 60 / (Entry.FPS || 60) * c * 1E3; setTimeout(function() { a.timeFlag = 0; - }, 60 / (Entry.FPS || 60) * c * 1E3); + }, c); return a; }; Blockly.Blocks.repeat_basic = {init:function() { @@ -2651,7 +2685,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() { @@ -2677,7 +2711,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(); }; @@ -2876,7 +2910,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(); }; @@ -2925,7 +2959,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.engine.pressedKeys.indexOf(c); }; Blockly.Blocks.reach_something = {init:function() { @@ -3139,13 +3173,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() { @@ -3627,7 +3661,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() { @@ -3719,8 +3753,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(); }; @@ -3916,7 +3950,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) { @@ -7732,7 +7766,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(); }; @@ -7740,7 +7774,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(); }; @@ -7748,7 +7782,7 @@ Entry.EntryObject.prototype.generateView = function() { 13 == a.keyCode && c.editObjectValues(!1); }; q.onblur = function(a) { - isNaN(q.value) || c.entity.setSize(Number(q.value)); + isNaN(q.value) || c.entity.setSize(+q.value); c.updateCoordinateView(); Entry.stage.updateObject(); }; @@ -7792,7 +7826,7 @@ Entry.EntryObject.prototype.generateView = function() { n.onblur = function(a) { a = n.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(); }; @@ -7802,7 +7836,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.setDirection(Number(a)); + isNaN(a) || c.entity.setDirection(+a); c.updateRotationView(); Entry.stage.updateObject(); }; @@ -7874,24 +7908,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 + " : ", n = Entry.createElement("input"), n.addClass("entryObjectRotateInputWorkspace"), this.rotateSpan_ = e, this.rotateInput_ = n, h = Entry.createElement("span"), h.addClass("entryObjectDirectionSpanWorkspace"), h.innerHTML = Lang.Workspace.direction + " : ", m = Entry.createElement("input"), m.addClass("entryObjectDirectionInputWorkspace"), this.directionInput_ = m, d.appendChild(e), d.appendChild(n), d.appendChild(h), d.appendChild(m), d.rotateInput_ = n, d.directionInput_ = m, c = this, n.onkeypress = function(a) { - 13 == a.keyCode && (a = n.value, -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))), isNaN(a) || c.entity.setRotation(Number(a)), c.updateRotationView(), n.blur()); + 13 == a.keyCode && (a = n.value, -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))), isNaN(a) || c.entity.setRotation(+a), c.updateRotationView(), n.blur()); }, n.onblur = function(a) { c.entity.setRotation(c.entity.getRotation()); Entry.stage.updateObject(); }, 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.setDirection(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.setDirection(+a), c.updateRotationView(), m.blur()); }, m.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, q = Entry.createElement("input"), q.addClass("entryObjectCoordinateInputWorkspace", "entryObjectCoordinateInputWorkspace_size"), d.appendChild(e), d.appendChild(g), d.appendChild(h), d.appendChild(k), d.appendChild(l), d.appendChild(q), d.xInput_ = g, d.yInput_ = k, d.sizeInput_ = q, 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(); @@ -9969,13 +10003,13 @@ Entry.Playground.prototype.injectCode = function() { Blockly.Xml.domToWorkspace(Blockly.mainWorkspace, b.script); var a = 0, c = 0, d = null; $(b.script).children("block").each(function(b) { - var e = Number($(this).attr("x")), f = Number($(this).attr("y")); + var e = +$(this).attr("x"), f = +$(this).attr("y"); 0 == b && (a = e, c = f, d = this); e < a && (a = e, d = this); f < c && (varyTopY = f); }); if (null != d) { - var b = Number($(d).attr("x")), e = Number($(d).attr("y")), f = Blockly.mainWorkspace.getMetrics(), g = (.1 * f.viewWidth).toFixed(1), h = (.4 * f.viewHeight).toFixed(1); + var b = +$(d).attr("x"), e = +$(d).attr("y"), f = Blockly.mainWorkspace.getMetrics(), g = (.1 * f.viewWidth).toFixed(1), h = (.4 * f.viewHeight).toFixed(1); e == c && (h = (.1 * f.viewHeight).toFixed(1)); Blockly.mainWorkspace.scrollbar.set(b - f.contentLeft - g, e - f.contentTop - h); } @@ -11052,7 +11086,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)); @@ -11116,7 +11150,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()); @@ -11131,7 +11165,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; @@ -11968,7 +12002,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; @@ -12034,7 +12068,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); @@ -12199,7 +12233,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() { @@ -12639,36 +12673,37 @@ Entry.Func.generateWsBlock = function(b, a, c) { e.init(d); d = e; d.values && (d = e.values.FIELD); - c = ''; - a = e = ""; + e = ''; + c = a = ""; var f = 0, g = 0; b.stringHash = {}; for (b.booleanHash = {};;) { switch(d.type) { case "function_field_label": - c += '", ">") + '">'; - a += d.fields.NAME; + e += '", ">") + '">'; + c += d.fields.NAME; break; case "function_field_boolean": var h = d.values.PARAM.hashId; - c += ''; - e += ''; + e += ''; + a += ''; b.booleanHash[h] = g; g++; - a += "\ub17c\ub9ac\uac12" + g; + c += "\ub17c\ub9ac\uac12" + g; break; case "function_field_string": - h = d.values.PARAM.hashId, c += '', e += '', b.stringHash[h] = f, f++, a += "\ubb38\uc790\uac12" + f; + h = d.values.PARAM.hashId, e += '', a += '', b.stringHash[h] = f, f++, c += "\ubb38\uc790\uac12" + f; } if (d.values && d.values.NEXT) { d = d.values.NEXT; } else { break; } - a += " "; + c += " "; } - a || (a = "\ud568\uc218"); - return {block:Blockly.Xml.textToDom('' + (c + "") + e + "").childNodes[0], description:a}; + b = '' + (e + "") + a + ""; + c || (c = "\ud568\uc218"); + return {block:Blockly.Xml.textToDom(b).childNodes[0], description:c}; }; Entry.HWMontior = {}; Entry.HWMonitor = function(b) { @@ -12904,7 +12939,7 @@ Entry.HW = function() { this.settingQueue = {}; this.socketType = this.hwModule = this.selectedDevice = null; Entry.addEventListener("stop", this.setZero); - this.hwInfo = {11:Entry.Arduino, 12:Entry.SensorBoard, 13:Entry.CODEino, 15:Entry.dplay, 17:Entry.Xbot, 24:Entry.Hamster, 25:Entry.Albert, 31:Entry.Bitbrick, 42:Entry.Arduino, 51:Entry.Neobot, 71:Entry.Robotis_carCont, 72:Entry.Robotis_openCM70}; + this.hwInfo = {11:Entry.Arduino, 12:Entry.SensorBoard, 13:Entry.CODEino, 15:Entry.dplay, 17:Entry.Xbot, 24:Entry.Hamster, 25:Entry.Albert, 31:Entry.Bitbrick, 42:Entry.Arduino, 51:Entry.Neobot, 71:Entry.Robotis_carCont, 72:Entry.Robotis_openCM70, 81:Entry.EV3}; }; Entry.HW.TRIAL_LIMIT = 1; p = Entry.HW.prototype; @@ -13000,7 +13035,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; } } @@ -13235,7 +13270,7 @@ 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; @@ -13348,7 +13383,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 ? this.setValue(this.minValue_) : b > c ? this.setValue(this.maxValue_) : this.setValue(b); }; Entry.Variable.prototype.getMinValue = function() { @@ -13509,7 +13544,7 @@ Entry.VariableContainer.prototype.renderMessageReference = function(b) { Entry.playground.object != this.caller.object && (Entry.container.selectObject(), Entry.container.selectObject(this.caller.object.id, !0), a.select(null), a.select(this.message)); b = this.caller; b = b.funcBlock ? b.funcBlock.getAttribute("id") : b.block.getAttribute("id"); - Blockly.mainWorkspace.activatePreviousBlock(Number(b)); + Blockly.mainWorkspace.activatePreviousBlock(+b); Entry.playground.toggleOnVariableView(); Entry.playground.changeViewMode("variable"); }), f.appendChild(d); @@ -13548,7 +13583,7 @@ Entry.VariableContainer.prototype.renderVariableReference = function(b) { Entry.playground.object != this.caller.object && (Entry.container.selectObject(), Entry.container.selectObject(this.caller.object.id, !0), a.select(null)); b = this.caller; b = b.funcBlock ? b.funcBlock.getAttribute("id") : b.block.getAttribute("id"); - Blockly.mainWorkspace.activatePreviousBlock(Number(b)); + Blockly.mainWorkspace.activatePreviousBlock(+b); Entry.playground.toggleOnVariableView(); Entry.playground.changeViewMode("variable"); }), f.appendChild(d); @@ -13571,7 +13606,7 @@ Entry.VariableContainer.prototype.renderFunctionReference = function(b) { c = d[f], g = Entry.createElement("li"), g.addClass("entryVariableListCallerWorkspace"), g.appendChild(c.object.thumbnailView_.cloneNode()), h = Entry.createElement("div"), h.addClass("entryVariableListCallerNameWorkspace"), h.innerHTML = c.object.name, g.appendChild(h), g.caller = c, g.bindOnClick(function(c) { Entry.playground.object != this.caller.object && (Entry.container.selectObject(), Entry.container.selectObject(this.caller.object.id, !0), a.select(null), a.select(b)); c = this.caller.block.getAttribute("id"); - Blockly.mainWorkspace.activatePreviousBlock(Number(c)); + Blockly.mainWorkspace.activatePreviousBlock(+c); Entry.playground.toggleOnVariableView(); Entry.playground.changeViewMode("variable"); }), e.appendChild(g); @@ -14538,7 +14573,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; @@ -16512,7 +16547,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; @@ -16535,7 +16570,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 efddd8f201..8fd409a928 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -1,479 +1,480 @@ -var Entry={block:{},TEXT_ALIGN_CENTER:0,TEXT_ALIGN_LEFT:1,TEXT_ALIGN_RIGHT:2,TEXT_ALIGNS:["center","left","right"],loadProject:function(b){b||(b=Entry.getStartProject(Entry.mediaFilePath));"workspace"==this.type&&Entry.stateManager.startIgnore();Entry.projectId=b._id;Entry.variableContainer.setVariables(b.variables);Entry.variableContainer.setMessages(b.messages);Entry.variableContainer.setFunctions(b.functions);Entry.scene.addScenes(b.scenes);Entry.stage.initObjectContainers();Entry.container.setObjects(b.objects); -Entry.FPS=b.speed?b.speed:60;createjs.Ticker.setFPS(Entry.FPS);"workspace"==this.type&&Entry.stateManager.endIgnore();Entry.engine.projectTimer||Entry.variableContainer.generateTimer();0===Object.keys(Entry.container.inputValue).length&&Entry.variableContainer.generateAnswer();Entry.start();return b},exportProject:function(b){b||(b={});Entry.engine.isState("stop")||Entry.engine.toggleStop();Entry.Func&&Entry.Func.workspace&&Entry.Func.workspace.visible&&Entry.Func.cancelEdit();b.objects=Entry.container.toJSON(); -b.scenes=Entry.scene.toJSON();b.variables=Entry.variableContainer.getVariableJSON();b.messages=Entry.variableContainer.getMessageJSON();b.functions=Entry.variableContainer.getFunctionJSON();b.scenes=Entry.scene.toJSON();b.speed=Entry.FPS;return b},setBlockByText:function(b,a){for(var c=[],d=jQuery.parseXML(a).getElementsByTagName("category"),e=0;ea?a=325:720a?a=244:400svg").css({width:a-64+"px"});$(".entryBlocklyWorkspace").css({left:a+ -"px"});Entry.playground.resizeHandle_.style.left=a+"px";Entry.playground.variableViewWrapper_.style.width=a+"px";this.interfaceState=b}Blockly.fireUiEvent(window,"resize")},getUpTime:function(){return(new Date).getTime()-this.startTime},addActivity:function(b){Entry.stateManager&&Entry.stateManager.addActivity(b)},startActivityLogging:function(){Entry.reporter&&Entry.reporter.start(Entry.projectId,window.user?window.user._id:null,Entry.startTime)},getActivityLog:function(){var b={};Entry.stateManager&& -(b.activityLog=Entry.stateManager.activityLog_);return b},DRAG_MODE_NONE:0,DRAG_MODE_MOUSEDOWN:1,DRAG_MODE_DRAG:2,cancelObjectEdit:function(b){var a=Entry.playground.object;if(a){var c=b.target;b=0!==$(a.view_).find(c).length;c=c.tagName.toUpperCase();!a.isEditing||"INPUT"===c&&b||a.editObjectValues(!1)}}};window.Entry=Entry;Entry.Albert={PORT_MAP:{leftWheel:0,rightWheel:0,buzzer:0,leftEye:0,rightEye:0,note:0,bodyLed:0,frontLed:0,padWidth:0,padHeight:0},setZero:function(){var b=Entry.Albert.PORT_MAP,a=Entry.hw.sendQueue,c;for(c in b)a[c]=b[c];Entry.hw.update();b=Entry.Albert;b.tempo=60;b.removeAllTimeouts()},monitorTemplate:{imgPath:"hw/albert.png",width:387,height:503,listPorts:{oid:{name:"OID",type:"input",pos:{x:0,y:0}},buzzer:{name:Lang.Hw.buzzer,type:"output",pos:{x:0,y:0}},note:{name:Lang.Hw.note,type:"output", +var Entry={block:{},TEXT_ALIGN_CENTER:0,TEXT_ALIGN_LEFT:1,TEXT_ALIGN_RIGHT:2,TEXT_ALIGNS:["center","left","right"],loadProject:function(a){a||(a=Entry.getStartProject(Entry.mediaFilePath));"workspace"==this.type&&Entry.stateManager.startIgnore();Entry.projectId=a._id;Entry.variableContainer.setVariables(a.variables);Entry.variableContainer.setMessages(a.messages);Entry.variableContainer.setFunctions(a.functions);Entry.scene.addScenes(a.scenes);Entry.stage.initObjectContainers();Entry.container.setObjects(a.objects); +Entry.FPS=a.speed?a.speed:60;createjs.Ticker.setFPS(Entry.FPS);"workspace"==this.type&&Entry.stateManager.endIgnore();Entry.engine.projectTimer||Entry.variableContainer.generateTimer();0===Object.keys(Entry.container.inputValue).length&&Entry.variableContainer.generateAnswer();Entry.start();return a},exportProject:function(a){a||(a={});Entry.engine.isState("stop")||Entry.engine.toggleStop();Entry.Func&&Entry.Func.workspace&&Entry.Func.workspace.visible&&Entry.Func.cancelEdit();a.objects=Entry.container.toJSON(); +a.scenes=Entry.scene.toJSON();a.variables=Entry.variableContainer.getVariableJSON();a.messages=Entry.variableContainer.getMessageJSON();a.functions=Entry.variableContainer.getFunctionJSON();a.scenes=Entry.scene.toJSON();a.speed=Entry.FPS;return a},setBlockByText:function(a,b){for(var c=[],d=jQuery.parseXML(b).getElementsByTagName("category"),e=0;eb?b=325:720b?b=244:400svg").css({width:b-64+"px"});$(".entryBlocklyWorkspace").css({left:b+ +"px"});Entry.playground.resizeHandle_.style.left=b+"px";Entry.playground.variableViewWrapper_.style.width=b+"px";this.interfaceState=a}Blockly.fireUiEvent(window,"resize")},getUpTime:function(){return(new Date).getTime()-this.startTime},addActivity:function(a){Entry.stateManager&&Entry.stateManager.addActivity(a)},startActivityLogging:function(){Entry.reporter&&Entry.reporter.start(Entry.projectId,window.user?window.user._id:null,Entry.startTime)},getActivityLog:function(){var a={};Entry.stateManager&& +(a.activityLog=Entry.stateManager.activityLog_);return a},DRAG_MODE_NONE:0,DRAG_MODE_MOUSEDOWN:1,DRAG_MODE_DRAG:2,cancelObjectEdit:function(a){var b=Entry.playground.object;if(b){var c=a.target;a=0!==$(b.view_).find(c).length;c=c.tagName.toUpperCase();!b.isEditing||"INPUT"===c&&a||b.editObjectValues(!1)}}};window.Entry=Entry;Entry.Albert={PORT_MAP:{leftWheel:0,rightWheel:0,buzzer:0,leftEye:0,rightEye:0,note:0,bodyLed:0,frontLed:0,padWidth:0,padHeight:0},setZero:function(){var a=Entry.Albert.PORT_MAP,b=Entry.hw.sendQueue,c;for(c in a)b[c]=a[c];Entry.hw.update();a=Entry.Albert;a.tempo=60;a.removeAllTimeouts()},monitorTemplate:{imgPath:"hw/albert.png",width:387,height:503,listPorts:{oid:{name:"OID",type:"input",pos:{x:0,y:0}},buzzer:{name:Lang.Hw.buzzer,type:"output",pos:{x:0,y:0}},note:{name:Lang.Hw.note,type:"output", pos:{x:0,y:0}}},ports:{leftProximity:{name:Lang.Blocks.ALBERT_sensor_leftProximity,type:"input",pos:{x:178,y:401}},rightProximity:{name:Lang.Blocks.ALBERT_sensor_rightProximity,type:"input",pos:{x:66,y:359}},battery:{name:Lang.Blocks.ALBERT_sensor_battery,type:"input",pos:{x:88,y:368}},light:{name:Lang.Blocks.ALBERT_sensor_light,type:"input",pos:{x:127,y:391}},leftWheel:{name:Lang.Hw.leftWheel,type:"output",pos:{x:299,y:406}},rightWheel:{name:Lang.Hw.rightWheel,type:"output",pos:{x:22,y:325}},leftEye:{name:Lang.Hw.leftEye, -type:"output",pos:{x:260,y:26}},rightEye:{name:Lang.Hw.rightEye,type:"output",pos:{x:164,y:13}},bodyLed:{name:Lang.Hw.body+" "+Lang.Hw.led,type:"output",pos:{x:367,y:308}},frontLed:{name:Lang.Hw.front+" "+Lang.Hw.led,pos:{x:117,y:410}}},mode:"both"},tempo:60,timeouts:[],removeTimeout:function(b){clearTimeout(b);var a=this.timeouts;b=a.indexOf(b);0<=b&&a.splice(b,1)},removeAllTimeouts:function(){var b=this.timeouts,a;for(a in b)clearTimeout(b[a]);this.timeouts=[]},name:"albert"}; -Blockly.Blocks.albert_hand_found={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_hand_found);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.albert_hand_found=function(b,a){var c=Entry.hw.portData;return 40Entry.Albert.tempo&&(Entry.Albert.tempo=1);return a.callReturn()}; +Entry.block.albert_change_tempo_by=function(a,b){Entry.Albert.tempo+=b.getNumberValue("VALUE");1>Entry.Albert.tempo&&(Entry.Albert.tempo=1);return b.callReturn()}; Blockly.Blocks.albert_set_tempo_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_tempo_to_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ALBERT_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.albert_set_tempo_to=function(b,a){Entry.Albert.tempo=a.getNumberValue("VALUE");1>Entry.Albert.tempo&&(Entry.Albert.tempo=1);return a.callReturn()};Blockly.Blocks.albert_move_forward={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_move_forward).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.albert_move_forward=function(b,a){var c=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return 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;c.leftWheel=30;c.rightWheel=30;setTimeout(function(){a.timeFlag=0},1E3);return a}; +Entry.block.albert_set_tempo_to=function(a,b){Entry.Albert.tempo=b.getNumberValue("VALUE");1>Entry.Albert.tempo&&(Entry.Albert.tempo=1);return b.callReturn()};Blockly.Blocks.albert_move_forward={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_move_forward).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; +Entry.block.albert_move_forward=function(a,b){var c=Entry.hw.sendQueue;if(b.isStart){if(1==b.timeFlag)return b;delete b.timeFlag;delete b.isStart;Entry.engine.isContinue=!1;c.leftWheel=0;c.rightWheel=0;return b.callReturn()}b.isStart=!0;b.timeFlag=1;c.leftWheel=30;c.rightWheel=30;setTimeout(function(){b.timeFlag=0},1E3);return b}; Blockly.Blocks.albert_move_backward={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_move_backward).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.albert_move_backward=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}; +Entry.block.albert_move_backward=function(a,b){var c=Entry.hw.sendQueue;if(b.isStart){if(1==b.timeFlag)return c.leftWheel=-30,c.rightWheel=-30,b;delete b.timeFlag;delete b.isStart;Entry.engine.isContinue=!1;c.leftWheel=0;c.rightWheel=0;return b.callReturn()}b.isStart=!0;b.timeFlag=1;setTimeout(function(){b.timeFlag=0},1E3);return b}; 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}; +Entry.block.albert_turn_around=function(a,b){var c=Entry.hw.sendQueue;if(b.isStart){if(1==b.timeFlag)return c.leftWheel=b.leftValue,c.rightWheel=b.rightValue,b;delete b.timeFlag;delete b.isStart;delete b.leftValue;delete b.rightValue;Entry.engine.isContinue=!1;c.leftWheel=0;c.rightWheel=0;return b.callReturn()}c="LEFT"==b.getField("DIRECTION",b);b.leftValue=c?-30:30;b.rightValue=c?30:-30;b.isStart=!0;b.timeFlag=1;setTimeout(function(){b.timeFlag=0},1E3);return b}; 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(a,b){var c=Entry.hw.sendQueue,d=b.getField("DIRECTION",b),e=+b.getField("COLOR",b);"FRONT"==d?(c.leftEye=e,c.rightEye=e):"LEFT"==d?c.leftEye=e:c.rightEye=e;return b.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()}; +Entry.block.albert_clear_led=function(a,b){var c=Entry.hw.sendQueue,d=b.getField("DIRECTION",b);"FRONT"==d?(c.leftEye=0,c.rightEye=0):"LEFT"==d?c.leftEye=0:c.rightEye=0;return b.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+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.albert_change_wheels_by=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()}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.albert_change_wheels_by=function(a,b){var c=Entry.hw.sendQueue,d=Entry.hw.portData,e=b.getField("DIRECTION"),f=b.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 b.callReturn()}; Blockly.Blocks.albert_set_wheels_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_wheels_to_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"FRONT"]]),"DIRECTION").appendField(Lang.Blocks.HAMSTER_set_wheels_to_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_wheels_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_wheels_to=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()};Entry.Arduino={name:"arduino",setZero:function(){Entry.hw.sendQueue.readablePorts=[];for(var b=0;20>b;b++)Entry.hw.sendQueue[b]=0,Entry.hw.sendQueue.readablePorts.push(b);Entry.hw.update()},monitorTemplate:{imgPath:"hw/arduino.png",width:605,height:434,listPorts:{2:{name:Lang.Hw.port_en+" 2 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},3:{name:Lang.Hw.port_en+" 3 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},4:{name:Lang.Hw.port_en+" 4 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},5:{name:Lang.Hw.port_en+ +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.albert_set_wheels_to=function(a,b){var c=Entry.hw.sendQueue,d=b.getField("DIRECTION"),e=b.getNumberValue("VALUE");"LEFT"==d?c.leftWheel=e:("RIGHT"!=d&&(c.leftWheel=e),c.rightWheel=e);return b.callReturn()};Entry.Arduino={name:"arduino",setZero:function(){Entry.hw.sendQueue.readablePorts=[];for(var a=0;20>a;a++)Entry.hw.sendQueue[a]=0,Entry.hw.sendQueue.readablePorts.push(a);Entry.hw.update()},monitorTemplate:{imgPath:"hw/arduino.png",width:605,height:434,listPorts:{2:{name:Lang.Hw.port_en+" 2 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},3:{name:Lang.Hw.port_en+" 3 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},4:{name:Lang.Hw.port_en+" 4 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},5:{name:Lang.Hw.port_en+ " 5 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},6:{name:Lang.Hw.port_en+" 6 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},7:{name:Lang.Hw.port_en+" 7 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},8:{name:Lang.Hw.port_en+" 8 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},9:{name:Lang.Hw.port_en+" 9 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},10:{name:Lang.Hw.port_en+" 10 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},11:{name:Lang.Hw.port_en+" 11 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},12:{name:Lang.Hw.port_en+ " 12 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},13:{name:Lang.Hw.port_en+" 13 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},a0:{name:Lang.Hw.port_en+" A0 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},a1:{name:Lang.Hw.port_en+" A1 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},a2:{name:Lang.Hw.port_en+" A2 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},a3:{name:Lang.Hw.port_en+" A3 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},a4:{name:Lang.Hw.port_en+" A4 "+Lang.Hw.port_ko,type:"input",pos:{x:0, y:0}},a5:{name:Lang.Hw.port_en+" A5 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}}},mode:"both"}}; Entry.SensorBoard={name:"sensorBoard",setZero:Entry.Arduino.setZero,monitorTemplate:{imgPath:"hw/sensorBoard.png",width:400,height:400,listPorts:{2:{name:Lang.Hw.port_en+" 2 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},3:{name:Lang.Hw.port_en+" 3 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},4:{name:Lang.Hw.port_en+" 4 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},5:{name:Lang.Hw.port_en+" 5 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},a3:{name:Lang.Hw.port_en+" A3 "+Lang.Hw.port_ko,type:"input", pos:{x:0,y:0}},a4:{name:Lang.Hw.port_en+" A4 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},a5:{name:Lang.Hw.port_en+" A5 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},6:{name:Lang.Hw.port_en+" 6 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},7:{name:Lang.Hw.port_en+" 7 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},12:{name:Lang.Hw.port_en+" 12 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},13:{name:Lang.Hw.port_en+" 13 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}}},ports:{0:{name:Lang.Hw.light+" "+ Lang.Hw.sensor+"2",type:"input",pos:{x:116,y:330}},slider:{name:Lang.Blocks.CODEino_sensor_name_2,type:"input",pos:{x:230,y:47}},1:{name:Lang.Hw.temp,type:"input",pos:{x:310,y:332}},8:{name:Lang.Hw.right_ko+Lang.Hw.switch_+Lang.Hw.right_en,type:"input",pos:{x:273,y:205}},9:{name:Lang.Hw.left_ko+Lang.Hw.switch_+Lang.Hw.left_en,type:"input",pos:{x:112,y:155}},10:{name:Lang.Hw.up_ko+Lang.Hw.switch_+Lang.Hw.up_en,type:"input",pos:{x:188,y:83}},11:{name:Lang.Hw.down_ko+Lang.Hw.switch_+Lang.Hw.down_en, -type:"input",pos:{x:196,y:281}}},mode:"both"}};Entry.dplay={name:"dplay",setZero:Entry.Arduino.setZero};Entry.CODEino={name:"CODEino",setZero:Entry.Arduino.setZero,monitorTemplate:Entry.Arduino.monitorTemplate};Blockly.Blocks.arduino_text={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldTextInput("Arduino"),"NAME");this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.arduino_text=function(b,a){return a.getStringField("NAME")}; +type:"input",pos:{x:196,y:281}}},mode:"both"}};Entry.dplay={name:"dplay",setZero:Entry.Arduino.setZero};Entry.CODEino={name:"CODEino",setZero:Entry.Arduino.setZero,monitorTemplate:Entry.Arduino.monitorTemplate};Blockly.Blocks.arduino_text={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldTextInput("Arduino"),"NAME");this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.arduino_text=function(a,b){return b.getStringField("NAME")}; 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()}; +Entry.block.arduino_send=function(a,b){var c=b.getValue("VALUE",b),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 b.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(a,b){var c=b.getValue("VALUE",b),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}; +Entry.block.arduino_get_string=function(a,b){var c=b.getValue("VALUE",b),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(" "); -this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.arduino_get_sensor_number=function(b,a){return a.getStringField("PORT")}; -Blockly.Blocks.arduino_get_port_number={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["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"]]),"PORT");this.appendDummyInput().appendField(" ");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.arduino_get_port_number=function(b,a){return a.getStringField("PORT")}; -Blockly.Blocks.arduino_get_pwm_port_number={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["3","3"],["5","5"],["6","6"],["9","9"],["10","10"],["11","11"]]),"PORT");this.appendDummyInput().appendField(" ");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.arduino_get_pwm_port_number=function(b,a){return a.getStringField("PORT")}; -Blockly.Blocks.arduino_get_number_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_sensor_value_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_sensor_value_2).appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.arduino_get_number_sensor_value=function(b,a){var c=a.getValue("VALUE",a);return Entry.hw.getAnalogPortValue(c[1])}; -Blockly.Blocks.arduino_get_digital_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_get_digital_value_1);this.appendValueInput("VALUE").setCheck("Number");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_sensor_value_2).appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}};Entry.block.arduino_get_digital_value=function(b,a){var c=a.getNumberValue("VALUE",a);return Entry.hw.getDigitalPortValue(c)}; +this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.arduino_get_sensor_number=function(a,b){return b.getStringField("PORT")}; +Blockly.Blocks.arduino_get_port_number={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["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"]]),"PORT");this.appendDummyInput().appendField(" ");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.arduino_get_port_number=function(a,b){return b.getStringField("PORT")}; +Blockly.Blocks.arduino_get_pwm_port_number={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["3","3"],["5","5"],["6","6"],["9","9"],["10","10"],["11","11"]]),"PORT");this.appendDummyInput().appendField(" ");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.arduino_get_pwm_port_number=function(a,b){return b.getStringField("PORT")}; +Blockly.Blocks.arduino_get_number_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_sensor_value_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_sensor_value_2).appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.arduino_get_number_sensor_value=function(a,b){var c=b.getValue("VALUE",b);return Entry.hw.getAnalogPortValue(c[1])}; +Blockly.Blocks.arduino_get_digital_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_get_digital_value_1);this.appendValueInput("VALUE").setCheck("Number");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_sensor_value_2).appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}};Entry.block.arduino_get_digital_value=function(a,b){var c=b.getNumberValue("VALUE",b);return Entry.hw.getDigitalPortValue(c)}; Blockly.Blocks.arduino_toggle_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_pin_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_pin_2);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.ARDUINO_on,"on"],[Lang.Blocks.ARDUINO_off,"off"]]),"OPERATOR").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*")); -this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.arduino_toggle_led=function(b,a){var c=a.getNumberValue("VALUE"),d=a.getField("OPERATOR");Entry.hw.setDigitalPortValue(c,"on"==d?255:0);return a.callReturn()}; +this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.arduino_toggle_led=function(a,b){var c=b.getNumberValue("VALUE"),d="on"==b.getField("OPERATOR")?255:0;Entry.hw.setDigitalPortValue(c,d);return b.callReturn()}; Blockly.Blocks.arduino_toggle_pwm={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_toggle_pwm_1);this.appendValueInput("PORT").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_toggle_pwm_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_toggle_pwm_3);this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png", -"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.arduino_toggle_pwm=function(b,a){var c=a.getNumberValue("PORT"),d=a.getNumberValue("VALUE"),d=Math.round(d),d=Math.max(d,0),d=Math.min(d,255);Entry.hw.setDigitalPortValue(c,d);return a.callReturn()}; +"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.arduino_toggle_pwm=function(a,b){var c=b.getNumberValue("PORT"),d=b.getNumberValue("VALUE"),d=Math.round(d),d=Math.max(d,0),d=Math.min(d,255);Entry.hw.setDigitalPortValue(c,d);return b.callReturn()}; Blockly.Blocks.arduino_convert_scale={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_1);this.appendValueInput("VALUE1").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_2);this.appendValueInput("VALUE2").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_3);this.appendValueInput("VALUE3").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_4); this.appendValueInput("VALUE4").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_5);this.appendValueInput("VALUE5").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_6);this.appendDummyInput().appendField(" ");this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.arduino_convert_scale=function(b,a){var c=a.getNumberValue("VALUE1",a),d=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a),f=a.getNumberValue("VALUE4",a),g=a.getNumberValue("VALUE5",a);if(d>e)var h=d,d=e,e=h;f>g&&(h=f,f=g,g=h);c-=d;c*=(g-f)/(e-d);c+=f;c=Math.min(g,c);c=Math.max(f,c);return Math.round(c)}; -Blockly.Blocks.sensorBoard_get_named_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["\uc18c\ub9ac","0"],["\ube5b \uac10\uc9c0","1"],["\uc2ac\ub77c\uc774\ub354","2"],["\uc628\ub3c4","3"]]),"PORT").appendField(" \uc13c\uc11c\uac12");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.sensorBoard_get_named_sensor_value=function(b,a){return Entry.hw.getAnalogPortValue(a.getField("PORT",a))}; +Entry.block.arduino_convert_scale=function(a,b){var c=b.getNumberValue("VALUE1",b),d=b.getNumberValue("VALUE2",b),e=b.getNumberValue("VALUE3",b),f=b.getNumberValue("VALUE4",b),g=b.getNumberValue("VALUE5",b);if(d>e)var h=d,d=e,e=h;f>g&&(h=f,f=g,g=h);c-=d;c*=(g-f)/(e-d);c+=f;c=Math.min(g,c);c=Math.max(f,c);return Math.round(c)}; +Blockly.Blocks.sensorBoard_get_named_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["\uc18c\ub9ac","0"],["\ube5b \uac10\uc9c0","1"],["\uc2ac\ub77c\uc774\ub354","2"],["\uc628\ub3c4","3"]]),"PORT").appendField(" \uc13c\uc11c\uac12");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.sensorBoard_get_named_sensor_value=function(a,b){return Entry.hw.getAnalogPortValue(b.getField("PORT",b))}; Blockly.Blocks.sensorBoard_is_button_pressed={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["\ube68\uac04","8"],["\ud30c\ub780","9"],["\ub178\ub780","10"],["\ucd08\ub85d","11"]]),"PORT");this.appendDummyInput().appendField(" \ubc84\ud2bc\uc744 \ub20c\ub800\ub294\uac00?");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}}; -Entry.block.sensorBoard_is_button_pressed=function(b,a){return Entry.hw.getDigitalPortValue(a.getNumberField("PORT",a))}; +Entry.block.sensorBoard_is_button_pressed=function(a,b){return Entry.hw.getDigitalPortValue(b.getNumberField("PORT",b))}; Blockly.Blocks.sensorBoard_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["\ube68\uac04","2"],["\ucd08\ub85d","3"],["\ud30c\ub780","4"],["\ud770\uc0c9","5"]]),"PORT").appendField(" LED").appendField(new Blockly.FieldDropdown([["\ucf1c\uae30","255"],["\ub044\uae30","0"]]),"OPERATOR").appendField(" ").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0); -this.setNextStatement(!0)}};Entry.block.sensorBoard_led=function(b,a){Entry.hw.setDigitalPortValue(a.getField("PORT"),a.getNumberField("OPERATOR"));return a.callReturn()}; +this.setNextStatement(!0)}};Entry.block.sensorBoard_led=function(a,b){Entry.hw.setDigitalPortValue(b.getField("PORT"),b.getNumberField("OPERATOR"));return b.callReturn()}; Blockly.Blocks.CODEino_get_sensor_number={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.CODEino_get_sensor_number_0,"A0"],[Lang.Blocks.CODEino_get_sensor_number_1,"A1"],[Lang.Blocks.CODEino_get_sensor_number_2,"A2"],[Lang.Blocks.CODEino_get_sensor_number_3,"A3"],[Lang.Blocks.CODEino_get_sensor_number_4,"A4"],[Lang.Blocks.CODEino_get_sensor_number_5,"A5"],[Lang.Blocks.CODEino_get_sensor_number_6,"A6"]]),"PORT");this.appendDummyInput().appendField(" "); -this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.CODEino_get_sensor_number=function(b,a){return a.getStringField("PORT")}; +this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.CODEino_get_sensor_number=function(a,b){return b.getStringField("PORT")}; Blockly.Blocks.CODEino_get_named_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(" ").appendField(new Blockly.FieldDropdown([[Lang.Blocks.CODEino_sensor_name_0,"0"],[Lang.Blocks.CODEino_sensor_name_1,"1"],[Lang.Blocks.CODEino_sensor_name_2,"2"],[Lang.Blocks.CODEino_sensor_name_3,"3"],[Lang.Blocks.CODEino_sensor_name_4,"4"],[Lang.Blocks.CODEino_sensor_name_5,"5"],[Lang.Blocks.CODEino_sensor_name_6,"6"]]),"PORT").appendField(Lang.Blocks.CODEino_string_1); -this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.CODEino_get_named_sensor_value=function(b,a){return Entry.hw.getAnalogPortValue(a.getField("PORT",a))}; +this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.CODEino_get_named_sensor_value=function(a,b){return Entry.hw.getAnalogPortValue(b.getField("PORT",b))}; Blockly.Blocks.CODEino_get_sound_status={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.CODEino_string_10).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CODEino_string_11,"GREAT"],[Lang.Blocks.CODEino_string_12,"SMALL"]]),"STATUS").appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}}; -Entry.block.CODEino_get_sound_status=function(b,a){return"GREAT"==a.getField("STATUS",a)?600Entry.hw.getAnalogPortValue(0)?1:0}; +Entry.block.CODEino_get_sound_status=function(a,b){return"GREAT"==b.getField("STATUS",b)?600Entry.hw.getAnalogPortValue(0)?1:0}; Blockly.Blocks.CODEino_get_light_status={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.CODEino_string_13).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CODEino_string_14,"BRIGHT"],[Lang.Blocks.CODEino_string_15,"DARK"]]),"STATUS").appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}}; -Entry.block.CODEino_get_light_status=function(b,a){return"DARK"==a.getField("STATUS",a)?800Entry.hw.getAnalogPortValue(1)?1:0}; +Entry.block.CODEino_get_light_status=function(a,b){return"DARK"==b.getField("STATUS",b)?800Entry.hw.getAnalogPortValue(1)?1:0}; Blockly.Blocks.CODEino_is_button_pressed={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.CODEino_string_2).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CODEino_string_3,"4"],[Lang.Blocks.CODEino_string_4,"17"],[Lang.Blocks.CODEino_string_5,"18"],[Lang.Blocks.CODEino_string_6,"19"],[Lang.Blocks.CODEino_string_7,"20"]]),"PORT").appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}}; -Entry.block.CODEino_is_button_pressed=function(b,a){var c=a.getNumberField("PORT",a);return 14d?1:0;if("RIGHT"==c||"FRONT"==c)return 30d?1:0}; +Entry.block.CODEino_get_accelerometer_direction=function(a,b){var c=b.getField("DIRECTION",b),d=0;"LEFT"==c||"RIGHT"==c?d=3:"FRONT"==c||"REAR"==c?d=4:"REVERSE"==c&&(d=5);d=Entry.hw.getAnalogPortValue(d);d=180/137*(d-265);d+=-90;d=Math.min(90,d);d=Math.max(-90,d);d=Math.round(d);if("LEFT"==c||"REAR"==c)return-30>d?1:0;if("RIGHT"==c||"FRONT"==c)return 30d?1:0}; Blockly.Blocks.CODEino_get_accelerometer_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.CODEino_string_8).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CODEino_accelerometer_X,"3"],[Lang.Blocks.CODEino_accelerometer_Y,"4"],[Lang.Blocks.CODEino_accelerometer_Z,"5"]]),"PORT").appendField(Lang.Blocks.CODEino_string_9);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.CODEino_get_accelerometer_value=function(b,a){var c=265,d=402,e=-90,f=90,g=Entry.hw.getAnalogPortValue(a.getField("PORT",a));if(c>d)var h=c,c=d,d=h;e>f&&(h=e,e=f,f=h);g=(f-e)/(d-c)*(g-c);g+=e;g=Math.min(f,g);g=Math.max(e,g);return Math.round(g)};Entry.Bitbrick={SENSOR_MAP:{1:"light",2:"IR",3:"touch",4:"potentiometer",5:"MIC",21:"UserSensor",11:"USER INPUT",20:"LED",19:"SERVO",18:"DC"},PORT_MAP:{buzzer:2,5:4,6:6,7:8,8:10,LEDR:12,LEDG:14,LEDB:16},sensorList:function(){for(var b=[],a=Entry.hw.portData,c=1;5>c;c++){var d=a[c];d&&(d.value||0===d.value)&&b.push([c+" - "+Lang.Blocks["BITBRICK_"+d.type],c.toString()])}return 0==b.length?[[Lang.Blocks.no_target,"null"]]:b},touchList:function(){for(var b=[],a=Entry.hw.portData,c=1;5>c;c++){var d=a[c]; -d&&"touch"===d.type&&b.push([c.toString(),c.toString()])}return 0==b.length?[[Lang.Blocks.no_target,"null"]]:b},servoList:function(){for(var b=[],a=Entry.hw.portData,c=5;9>c;c++){var d=a[c];d&&"SERVO"===d.type&&b.push(["ABCD"[c-5],c.toString()])}return 0==b.length?[[Lang.Blocks.no_target,"null"]]:b},dcList:function(){for(var b=[],a=Entry.hw.portData,c=5;9>c;c++){var d=a[c];d&&"DC"===d.type&&b.push(["ABCD"[c-5],c.toString()])}return 0==b.length?[[Lang.Blocks.no_target,"null"]]:b},setZero:function(){var b= -Entry.hw.sendQueue,a;for(a in Entry.Bitbrick.PORT_MAP)b[a]=0;Entry.hw.update()},name:"bitbrick",servoMaxValue:181,servoMinValue:1,dcMaxValue:100,dcMinValue:-100,monitorTemplate:{imgPath:"hw/bitbrick.png",width:400,height:400,listPorts:{1:{name:Lang.Hw.port_en+" 1 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},2:{name:Lang.Hw.port_en+" 2 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},3:{name:Lang.Hw.port_en+" 3 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},4:{name:Lang.Hw.port_en+" 4 "+Lang.Hw.port_ko, +Entry.block.CODEino_get_accelerometer_value=function(a,b){var c=265,d=402,e=-90,f=90,g=Entry.hw.getAnalogPortValue(b.getField("PORT",b));if(c>d)var h=c,c=d,d=h;e>f&&(h=e,e=f,f=h);g=(f-e)/(d-c)*(g-c);g+=e;g=Math.min(f,g);g=Math.max(e,g);return Math.round(g)};Entry.Bitbrick={SENSOR_MAP:{1:"light",2:"IR",3:"touch",4:"potentiometer",5:"MIC",21:"UserSensor",11:"USER INPUT",20:"LED",19:"SERVO",18:"DC"},PORT_MAP:{buzzer:2,5:4,6:6,7:8,8:10,LEDR:12,LEDG:14,LEDB:16},sensorList:function(){for(var a=[],b=Entry.hw.portData,c=1;5>c;c++){var d=b[c];d&&(d.value||0===d.value)&&a.push([c+" - "+Lang.Blocks["BITBRICK_"+d.type],c.toString()])}return 0==a.length?[[Lang.Blocks.no_target,"null"]]:a},touchList:function(){for(var a=[],b=Entry.hw.portData,c=1;5>c;c++){var d=b[c]; +d&&"touch"===d.type&&a.push([c.toString(),c.toString()])}return 0==a.length?[[Lang.Blocks.no_target,"null"]]:a},servoList:function(){for(var a=[],b=Entry.hw.portData,c=5;9>c;c++){var d=b[c];d&&"SERVO"===d.type&&a.push(["ABCD"[c-5],c.toString()])}return 0==a.length?[[Lang.Blocks.no_target,"null"]]:a},dcList:function(){for(var a=[],b=Entry.hw.portData,c=5;9>c;c++){var d=b[c];d&&"DC"===d.type&&a.push(["ABCD"[c-5],c.toString()])}return 0==a.length?[[Lang.Blocks.no_target,"null"]]:a},setZero:function(){var a= +Entry.hw.sendQueue,b;for(b in Entry.Bitbrick.PORT_MAP)a[b]=0;Entry.hw.update()},name:"bitbrick",servoMaxValue:181,servoMinValue:1,dcMaxValue:100,dcMinValue:-100,monitorTemplate:{imgPath:"hw/bitbrick.png",width:400,height:400,listPorts:{1:{name:Lang.Hw.port_en+" 1 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},2:{name:Lang.Hw.port_en+" 2 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},3:{name:Lang.Hw.port_en+" 3 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},4:{name:Lang.Hw.port_en+" 4 "+Lang.Hw.port_ko, type:"input",pos:{x:0,y:0}},A:{name:Lang.Hw.port_en+" A "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},B:{name:Lang.Hw.port_en+" B "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},C:{name:Lang.Hw.port_en+" C "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},D:{name:Lang.Hw.port_en+" D "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}}},mode:"both"}}; -Blockly.Blocks.bitbrick_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.sensorList),"PORT").appendField(" \uac12");this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.bitbrick_sensor_value=function(b,a){var c=a.getStringField("PORT");return Entry.hw.portData[c].value}; -Blockly.Blocks.bitbrick_is_touch_pressed={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.BITBRICK_touch).appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.touchList),"PORT").appendField("\uc774(\uac00) \ub20c\ub838\ub294\uac00?");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.bitbrick_is_touch_pressed=function(b,a){return 0===Entry.hw.portData[a.getStringField("PORT")].value}; -Blockly.Blocks.bitbrick_turn_off_color_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uceec\ub7ec LED \ub044\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.bitbrick_turn_off_color_led=function(b,a){Entry.hw.sendQueue.LEDR=0;Entry.hw.sendQueue.LEDG=0;Entry.hw.sendQueue.LEDB=0;return a.callReturn()}; +Blockly.Blocks.bitbrick_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.sensorList),"PORT").appendField(" \uac12");this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.bitbrick_sensor_value=function(a,b){var c=b.getStringField("PORT");return Entry.hw.portData[c].value}; +Blockly.Blocks.bitbrick_is_touch_pressed={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.BITBRICK_touch).appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.touchList),"PORT").appendField("\uc774(\uac00) \ub20c\ub838\ub294\uac00?");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.bitbrick_is_touch_pressed=function(a,b){return 0===Entry.hw.portData[b.getStringField("PORT")].value}; +Blockly.Blocks.bitbrick_turn_off_color_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uceec\ub7ec LED \ub044\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.bitbrick_turn_off_color_led=function(a,b){Entry.hw.sendQueue.LEDR=0;Entry.hw.sendQueue.LEDG=0;Entry.hw.sendQueue.LEDB=0;return b.callReturn()}; Blockly.Blocks.bitbrick_turn_on_color_led_by_rgb={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uceec\ub7ec LED \ucf1c\uae30 R");this.appendValueInput("rValue").setCheck(["Number","String"]);this.appendDummyInput().appendField("G");this.appendValueInput("gValue").setCheck(["Number","String"]);this.appendDummyInput().appendField("B");this.appendValueInput("bValue").setCheck(["Number","String"]);this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.bitbrick_turn_on_color_led_by_rgb=function(b,a){var c=a.getNumberValue("rValue"),d=a.getNumberValue("gValue"),e=a.getNumberValue("bValue"),f=Entry.adjustValueWithMaxMin,g=Entry.hw.sendQueue;g.LEDR=f(c,0,255);g.LEDG=f(d,0,255);g.LEDB=f(e,0,255);return a.callReturn()}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.bitbrick_turn_on_color_led_by_rgb=function(a,b){var c=b.getNumberValue("rValue"),d=b.getNumberValue("gValue"),e=b.getNumberValue("bValue"),f=Entry.adjustValueWithMaxMin,g=Entry.hw.sendQueue;g.LEDR=f(c,0,255);g.LEDG=f(d,0,255);g.LEDB=f(e,0,255);return b.callReturn()}; Blockly.Blocks.bitbrick_turn_on_color_led_by_picker={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uceec\ub7ec LED \uc0c9 ").appendField(new Blockly.FieldColour("#ff0000"),"VALUE").appendField("\ub85c \uc815\ud558\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.bitbrick_turn_on_color_led_by_picker=function(b,a){var c=a.getStringField("VALUE");Entry.hw.sendQueue.LEDR=parseInt(c.substr(1,2),16);Entry.hw.sendQueue.LEDG=parseInt(c.substr(3,2),16);Entry.hw.sendQueue.LEDB=parseInt(c.substr(5,2),16);return a.callReturn()}; +Entry.block.bitbrick_turn_on_color_led_by_picker=function(a,b){var c=b.getStringField("VALUE");Entry.hw.sendQueue.LEDR=parseInt(c.substr(1,2),16);Entry.hw.sendQueue.LEDG=parseInt(c.substr(3,2),16);Entry.hw.sendQueue.LEDB=parseInt(c.substr(5,2),16);return b.callReturn()}; Blockly.Blocks.bitbrick_turn_on_color_led_by_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uceec\ub7ec LED \ucf1c\uae30 \uc0c9");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("\ub85c \uc815\ud558\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.bitbrick_turn_on_color_led_by_value=function(b,a){var c=a.getNumberValue("VALUE"),d,e,f,c=c%200;67>c?(d=200-3*c,e=3*c,f=0):134>c?(c-=67,d=0,e=200-3*c,f=3*c):201>c&&(c-=134,d=3*c,e=0,f=200-3*c);Entry.hw.sendQueue.LEDR=d;Entry.hw.sendQueue.LEDG=e;Entry.hw.sendQueue.LEDB=f;return a.callReturn()}; +Entry.block.bitbrick_turn_on_color_led_by_value=function(a,b){var c=b.getNumberValue("VALUE"),d,e,f,c=c%200;67>c?(d=200-3*c,e=3*c,f=0):134>c?(c-=67,d=0,e=200-3*c,f=3*c):201>c&&(c-=134,d=3*c,e=0,f=200-3*c);Entry.hw.sendQueue.LEDR=d;Entry.hw.sendQueue.LEDG=e;Entry.hw.sendQueue.LEDB=f;return b.callReturn()}; Blockly.Blocks.bitbrick_buzzer={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ubc84\uc800\uc74c ");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("\ub0b4\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.bitbrick_buzzer=function(b,a){if(a.isStart)return Entry.hw.sendQueue.buzzer=0,delete a.isStart,a.callReturn();var c=a.getNumberValue("VALUE");Entry.hw.sendQueue.buzzer=c;a.isStart=!0;return a}; +Entry.block.bitbrick_buzzer=function(a,b){if(b.isStart)return Entry.hw.sendQueue.buzzer=0,delete b.isStart,b.callReturn();var c=b.getNumberValue("VALUE");Entry.hw.sendQueue.buzzer=c;b.isStart=!0;return b}; Blockly.Blocks.bitbrick_turn_off_all_motors={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ubaa8\ub4e0 \ubaa8\ud130 \ub044\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.bitbrick_turn_off_all_motors=function(b,a){var c=Entry.hw.sendQueue,d=Entry.Bitbrick;d.servoList().map(function(a){c[a[1]]=0});d.dcList().map(function(a){c[a[1]]=128});return a.callReturn()}; +Entry.block.bitbrick_turn_off_all_motors=function(a,b){var c=Entry.hw.sendQueue,d=Entry.Bitbrick;d.servoList().map(function(b){c[b[1]]=0});d.dcList().map(function(b){c[b[1]]=128});return b.callReturn()}; Blockly.Blocks.bitbrick_dc_speed={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("DC \ubaa8\ud130").appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.dcList),"PORT").appendField(" \uc18d\ub3c4");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setPreviousStatement(!0);this.setNextStatement(!0);this.setInputsInline(!0)}}; -Entry.block.bitbrick_dc_speed=function(b,a){var c=a.getNumberValue("VALUE"),c=Math.min(c,Entry.Bitbrick.dcMaxValue),c=Math.max(c,Entry.Bitbrick.dcMinValue);Entry.hw.sendQueue[a.getStringField("PORT")]=c+128;return a.callReturn()}; +Entry.block.bitbrick_dc_speed=function(a,b){var c=b.getNumberValue("VALUE"),c=Math.min(c,Entry.Bitbrick.dcMaxValue),c=Math.max(c,Entry.Bitbrick.dcMinValue);Entry.hw.sendQueue[b.getStringField("PORT")]=c+128;return b.callReturn()}; Blockly.Blocks.bitbrick_dc_direction_speed={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("DC \ubaa8\ud130").appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.dcList),"PORT").appendField(" ").appendField(new Blockly.FieldDropdown([[Lang.Blocks.BITBRICK_dc_direction_cw,"CW"],[Lang.Blocks.BITBRICK_dc_direction_ccw,"CCW"]]),"DIRECTION").appendField(" \ubc29\ud5a5").appendField(" \uc18d\ub825");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setPreviousStatement(!0);this.setNextStatement(!0);this.setInputsInline(!0)}};Entry.block.bitbrick_dc_direction_speed=function(b,a){var c="CW"===a.getStringField("DIRECTION"),d=a.getNumberValue("VALUE"),d=Math.min(d,Entry.Bitbrick.dcMaxValue),d=Math.max(d,0);Entry.hw.sendQueue[a.getStringField("PORT")]=c?d+128:128-d;return a.callReturn()}; +"block_icon/hardware_03.png","*"));this.setPreviousStatement(!0);this.setNextStatement(!0);this.setInputsInline(!0)}};Entry.block.bitbrick_dc_direction_speed=function(a,b){var c="CW"===b.getStringField("DIRECTION"),d=b.getNumberValue("VALUE"),d=Math.min(d,Entry.Bitbrick.dcMaxValue),d=Math.max(d,0);Entry.hw.sendQueue[b.getStringField("PORT")]=c?d+128:128-d;return b.callReturn()}; Blockly.Blocks.bitbrick_servomotor_angle={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc11c\ubcf4 \ubaa8\ud130").appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.servoList),"PORT").appendField(" \uac01\ub3c4");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setPreviousStatement(!0);this.setNextStatement(!0); -this.setInputsInline(!0)}};Entry.block.bitbrick_servomotor_angle=function(b,a){var c=a.getNumberValue("VALUE")+1,c=Math.min(c,Entry.Bitbrick.servoMaxValue),c=Math.max(c,Entry.Bitbrick.servoMinValue);Entry.hw.sendQueue[a.getStringField("PORT")]=c;return a.callReturn()}; +this.setInputsInline(!0)}};Entry.block.bitbrick_servomotor_angle=function(a,b){var c=b.getNumberValue("VALUE")+1,c=Math.min(c,Entry.Bitbrick.servoMaxValue),c=Math.max(c,Entry.Bitbrick.servoMinValue);Entry.hw.sendQueue[b.getStringField("PORT")]=c;return b.callReturn()}; Blockly.Blocks.bitbrick_convert_scale={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ubcc0\ud658");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.sensorList),"PORT");this.appendDummyInput().appendField("\uac12");this.appendValueInput("VALUE2").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_3);this.appendValueInput("VALUE3").setCheck(["Number","String",null]); this.appendDummyInput().appendField("\uc5d0\uc11c");this.appendValueInput("VALUE4").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_5);this.appendValueInput("VALUE5").setCheck(["Number","String",null]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.bitbrick_convert_scale=function(b,a){var c=a.getNumberField("PORT"),d=Entry.hw.portData[c].value,c=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a),f=a.getNumberValue("VALUE4",a),g=a.getNumberValue("VALUE5",a);if(f>g)var h=f,f=g,g=h;d-=c;d*=(g-f)/(e-c);d+=f;d=Math.min(g,d);d=Math.max(f,d);return Math.round(d)};var categoryColor="#FF9E20";Blockly.Blocks.start_drawing={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_start_drawing).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.start_drawing=function(b,a){b.brush?b.brush.stop=!1:Entry.setBasicBrush(b);Entry.stage.sortZorder();b.brush.moveTo(b.getX(),-1*b.getY());return a.callReturn()}; -Blockly.Blocks.stop_drawing={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_stop_drawing).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.stop_drawing=function(b,a){b.brush&&b.shape&&(b.brush.stop=!0);return a.callReturn()}; +Entry.block.bitbrick_convert_scale=function(a,b){var c=b.getNumberField("PORT"),d=Entry.hw.portData[c].value,c=b.getNumberValue("VALUE2",b),e=b.getNumberValue("VALUE3",b),f=b.getNumberValue("VALUE4",b),g=b.getNumberValue("VALUE5",b);if(f>g)var h=f,f=g,g=h;d-=c;d*=(g-f)/(e-c);d+=f;d=Math.min(g,d);d=Math.max(f,d);return Math.round(d)};var categoryColor="#FF9E20";Blockly.Blocks.start_drawing={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_start_drawing).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.start_drawing=function(a,b){a.brush?a.brush.stop=!1:Entry.setBasicBrush(a);Entry.stage.sortZorder();a.brush.moveTo(a.getX(),-1*a.getY());return b.callReturn()}; +Blockly.Blocks.stop_drawing={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_stop_drawing).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.stop_drawing=function(a,b){a.brush&&a.shape&&(a.brush.stop=!0);return b.callReturn()}; Blockly.Blocks.set_color={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_color_1);this.appendDummyInput().appendField(new Blockly.FieldColour("#ff0000"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_color_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_color=function(b,a){var c=a.getField("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(c=Entry.hex2rgb(c),b.brush.rgb=c,b.brush.endStroke(),b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; +Entry.block.set_color=function(a,b){var c=b.getField("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(c=Entry.hex2rgb(c),a.brush.rgb=c,a.brush.endStroke(),a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}; Blockly.Blocks.set_random_color={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_random_color).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_random_color=function(b,a){b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);if(b.brush){var c=Entry.generateRgb();b.brush.rgb=c;b.brush.endStroke();b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")");b.brush.moveTo(b.getX(),-1*b.getY())}return a.callReturn()}; +Entry.block.set_random_color=function(a,b){a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);if(a.brush){var c=Entry.generateRgb();a.brush.rgb=c;a.brush.endStroke();a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")");a.brush.moveTo(a.getX(),-1*a.getY())}return b.callReturn()}; Blockly.Blocks.change_thickness={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_change_thickness_1);this.appendValueInput("VALUE").setCheck(["Number","Boolean"]);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_change_thickness_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_thickness=function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.thickness+=c,1>b.brush.thickness&&(b.brush.thickness=1),b.brush.setStrokeStyle(b.brush.thickness),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; +Entry.block.change_thickness=function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(a.brush.thickness+=c,1>a.brush.thickness&&(a.brush.thickness=1),a.brush.setStrokeStyle(a.brush.thickness),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}; Blockly.Blocks.set_thickness={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_thickness_1);this.appendValueInput("VALUE").setCheck(["Number","Boolean"]);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_thickness_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_thickness=function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.thickness=c,b.brush.setStrokeStyle(b.brush.thickness),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; +Entry.block.set_thickness=function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(a.brush.thickness=c,a.brush.setStrokeStyle(a.brush.thickness),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}; Blockly.Blocks.change_opacity={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_change_opacity_1);this.appendValueInput("VALUE").setCheck(["Number","Boolean"]);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_change_opacity_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_opacity=function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);c=Entry.adjustValueWithMaxMin(b.brush.opacity+c,0,100);b.brush&&(b.brush.opacity=c,b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; +Entry.block.change_opacity=function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);c=Entry.adjustValueWithMaxMin(a.brush.opacity+c,0,100);a.brush&&(a.brush.opacity=c,a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}; Blockly.Blocks.set_opacity={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_opacity_1);this.appendValueInput("VALUE").setCheck(["Number","Boolean"]);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_opacity_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_opacity=function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; +Entry.block.set_opacity=function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(a.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}; Blockly.Blocks.brush_erase_all={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_brush_erase_all).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.brush_erase_all=function(b,a){var c=b.brush;if(c){var d=c._stroke.style,e=c._strokeStyle.width;c.clear().setStrokeStyle(e).beginStroke(d);c.moveTo(b.getX(),-1*b.getY())}c=b.parent.getStampEntities();c.map(function(a){a.removeClone()});c=null;return a.callReturn()}; -Blockly.Blocks.brush_stamp={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_stamp).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.brush_stamp=function(b,a){b.parent.addStampEntity(b);return a.callReturn()}; +Entry.block.brush_erase_all=function(a,b){var c=a.brush;if(c){var d=c._stroke.style,e=c._strokeStyle.width;c.clear().setStrokeStyle(e).beginStroke(d);c.moveTo(a.getX(),-1*a.getY())}c=a.parent.getStampEntities();c.map(function(b){b.removeClone()});c=null;return b.callReturn()}; +Blockly.Blocks.brush_stamp={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_stamp).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.brush_stamp=function(a,b){a.parent.addStampEntity(a);return b.callReturn()}; Blockly.Blocks.change_brush_transparency={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_change_brush_transparency_1);this.appendValueInput("VALUE").setCheck(["Number","Boolean"]);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_change_brush_transparency_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_brush_transparency=function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);c=Entry.adjustValueWithMaxMin(b.brush.opacity-c,0,100);b.brush&&(b.brush.opacity=c,b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; +Entry.block.change_brush_transparency=function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);c=Entry.adjustValueWithMaxMin(a.brush.opacity-c,0,100);a.brush&&(a.brush.opacity=c,a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}; Blockly.Blocks.set_brush_tranparency={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_brush_transparency_1);this.appendValueInput("VALUE").setCheck(["Number","Boolean"]);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_brush_transparency_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_brush_tranparency=function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+(1-b.brush.opacity/100)+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()};var calcArrowColor="#e8b349",calcBlockColor="#FFD974",calcFontColor="#3D3D3D";Blockly.Blocks.number={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(new Blockly.FieldTextInput(""),"NUM");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.number=function(b,a){return a.fields.NUM}; -Blockly.Blocks.angle={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(new Blockly.FieldAngle("90"),"ANGLE");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.angle=function(b,a){return a.getNumberField("ANGLE")};Blockly.Blocks.get_x_coordinate={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_x_coordinate,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.get_x_coordinate=function(b,a){return b.getX()};Blockly.Blocks.get_y_coordinate={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_y_coordinate,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.get_y_coordinate=function(b,a){return b.getY()}; -Blockly.Blocks.get_angle={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_angle,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.get_angle=function(b,a){return parseFloat(b.getRotation().toFixed(1))}; +Entry.block.set_brush_tranparency=function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(a.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+(1-a.brush.opacity/100)+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()};var calcArrowColor="#e8b349",calcBlockColor="#FFD974",calcFontColor="#3D3D3D";Blockly.Blocks.number={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(new Blockly.FieldTextInput(""),"NUM");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.number=function(a,b){return b.fields.NUM}; +Blockly.Blocks.angle={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(new Blockly.FieldAngle("90"),"ANGLE");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.angle=function(a,b){return b.getNumberField("ANGLE")};Blockly.Blocks.get_x_coordinate={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_x_coordinate,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; +Entry.block.get_x_coordinate=function(a,b){return a.getX()};Blockly.Blocks.get_y_coordinate={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_y_coordinate,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.get_y_coordinate=function(a,b){return a.getY()}; +Blockly.Blocks.get_angle={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_angle,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.get_angle=function(a,b){return parseFloat(a.getRotation().toFixed(1))}; Blockly.Blocks.get_rotation_direction={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.CALC_rotation_value,"ROTATION"],[Lang.Blocks.CALC_direction_value,"DIRECTION"]],null,!0,calcArrowColor),"OPERATOR");this.appendDummyInput().appendField(" ");this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -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))}; +Entry.block.get_rotation_direction=function(a,b){return"DIRECTION"==b.getField("OPERATOR",b).toUpperCase()?parseFloat(a.getDirection().toFixed(1)):parseFloat(a.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)}; +Entry.block.distance_something=function(a,b){var c=b.getField("VALUE",b);if("mouse"==c)return c=Entry.stage.mouseCoordinate,Math.sqrt(Math.pow(a.getX()-c.x,2)+Math.pow(a.getY()-c.y,2));c=Entry.container.getEntity(c);return Math.sqrt(Math.pow(a.getX()-c.getX(),2)+Math.pow(a.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(a,b){return"x"===b.getField("VALUE",b)?+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(a,b){var c=b.getField("VALUE",b),c="self"==c?a:Entry.container.getEntity(c);switch(b.getField("COORDINATE",b)){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)}}; -Entry.block.calc_minus=function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c-d};Blockly.Blocks.calc_times={init:function(){this.setColour(calcBlockColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("x",calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.calc_times=function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c*d};Blockly.Blocks.calc_divide={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_divide=function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c/d}; +Entry.block.calc_basic=function(a,b){var c=b.getField("OPERATOR",b),d=b.getNumberValue("LEFTHAND",b),e=b.getNumberValue("RIGHTHAND",b);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(a,b){var c=b.getNumberValue("LEFTHAND",b),d=b.getNumberValue("RIGHTHAND",b);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)}}; +Entry.block.calc_minus=function(a,b){var c=b.getNumberValue("LEFTHAND",b),d=b.getNumberValue("RIGHTHAND",b);return c-d};Blockly.Blocks.calc_times={init:function(){this.setColour(calcBlockColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("x",calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; +Entry.block.calc_times=function(a,b){var c=b.getNumberValue("LEFTHAND",b),d=b.getNumberValue("RIGHTHAND",b);return c*d};Blockly.Blocks.calc_divide={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_divide=function(a,b){var c=b.getNumberValue("LEFTHAND",b),d=b.getNumberValue("RIGHTHAND",b);return c/d}; Blockly.Blocks.calc_mod={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_calc_mod_1,calcFontColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_mod_2,calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_mod_3,calcFontColor);this.setInputsInline(!0)}}; -Entry.block.calc_mod=function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c%d}; +Entry.block.calc_mod=function(a,b){var c=b.getNumberValue("LEFTHAND",b),d=b.getNumberValue("RIGHTHAND",b);return c%d}; Blockly.Blocks.calc_share={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_calc_share_1,calcFontColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.CALC_calc_share_2,calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_share_3,calcFontColor);this.setInputsInline(!0)}}; -Entry.block.calc_share=function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return Math.floor(c/d)}; +Entry.block.calc_share=function(a,b){var c=b.getNumberValue("LEFTHAND",b),d=b.getNumberValue("RIGHTHAND",b);return Math.floor(c/d)}; Blockly.Blocks.calc_operation={init:function(){this.setColour(calcBlockColor);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_operation_of_1,calcFontColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_operation_of_2,calcFontColor);this.appendDummyInput("VALUE").appendField(new Blockly.FieldDropdown([[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"]],null,!0,calcArrowColor),"VALUE");this.setOutput(!0,"Number");this.appendDummyInput().appendField(" ");this.setInputsInline(!0)}}; -Entry.block.calc_operation=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.block.calc_operation=function(a,b){var c=b.getNumberValue("LEFTHAND",b),d=b.getField("VALUE",b);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}; Blockly.Blocks.calc_rand={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_calc_rand_1,calcFontColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_rand_2,calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_rand_3,calcFontColor);this.setInputsInline(!0)}}; -Entry.block.calc_rand=function(b,a){var c=a.getStringValue("LEFTHAND",a),d=a.getStringValue("RIGHTHAND",a),e=Math.min(c,d),f=Math.max(c,d),c=Entry.isFloat(c);return Entry.isFloat(d)||c?(Math.random()*(f-e)+e).toFixed(2):Math.floor(Math.random()*(f-e+1)+e)}; +Entry.block.calc_rand=function(a,b){var c=b.getStringValue("LEFTHAND",b),d=b.getStringValue("RIGHTHAND",b),e=Math.min(c,d),f=Math.max(c,d),c=Entry.isFloat(c);return Entry.isFloat(d)||c?(Math.random()*(f-e)+e).toFixed(2):Math.floor(Math.random()*(f-e+1)+e)}; Blockly.Blocks.get_date={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_date_1,calcFontColor).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CALC_get_date_year,"YEAR"],[Lang.Blocks.CALC_get_date_month,"MONTH"],[Lang.Blocks.CALC_get_date_day,"DAY"],[Lang.Blocks.CALC_get_date_hour,"HOUR"],[Lang.Blocks.CALC_get_date_minute,"MINUTE"],[Lang.Blocks.CALC_get_date_second,"SECOND"]],null,!0,calcArrowColor),"VALUE");this.appendDummyInput().appendField(" ").appendField(Lang.Blocks.CALC_get_date_2, -calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.get_date=function(b,a){var c=a.getField("VALUE",a),d=new Date;return"YEAR"==c?d.getFullYear():"MONTH"==c?d.getMonth()+1:"DAY"==c?d.getDate():"HOUR"==c?d.getHours():"MINUTE"==c?d.getMinutes():d.getSeconds()}; +calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.get_date=function(a,b){var c=b.getField("VALUE",b),d=new Date;return"YEAR"==c?d.getFullYear():"MONTH"==c?d.getMonth()+1:"DAY"==c?d.getDate():"HOUR"==c?d.getHours():"MINUTE"==c?d.getMinutes():d.getSeconds()}; Blockly.Blocks.get_sound_duration={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_sound_duration_1,calcFontColor);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("sounds",null,!0,calcArrowColor),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.CALC_get_sound_duration_2,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.get_sound_duration=function(b,a){for(var c=a.getField("VALUE",a),d=b.parent.sounds,e=0;ed||d>c.length-1)throw Error();return c[d]}; -Blockly.Blocks.length_of_string={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_length_of_string_1,calcFontColor);this.appendValueInput("STRING").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_length_of_string_2,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.length_of_string=function(b,a){return a.getStringValue("STRING",a).length}; +Entry.block.char_at=function(a,b){var c=b.getStringValue("LEFTHAND",b),d=b.getNumberValue("RIGHTHAND",b)-1;if(0>d||d>c.length-1)throw Error();return c[d]}; +Blockly.Blocks.length_of_string={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_length_of_string_1,calcFontColor);this.appendValueInput("STRING").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_length_of_string_2,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.length_of_string=function(a,b){return b.getStringValue("STRING",b).length}; Blockly.Blocks.substring={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_substring_1,calcFontColor);this.appendValueInput("STRING").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_substring_2,calcFontColor);this.appendValueInput("START").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_substring_3,calcFontColor);this.appendValueInput("END").setCheck(["Number","String"]); -this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_substring_4,calcFontColor);this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.substring=function(b,a){var c=a.getStringValue("STRING",a),d=a.getNumberValue("START",a)-1,e=a.getNumberValue("END",a)-1,f=c.length-1;if(0>d||0>e||d>f||e>f)throw Error();return c.substring(Math.min(d,e),Math.max(d,e)+1)}; +this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_substring_4,calcFontColor);this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.substring=function(a,b){var c=b.getStringValue("STRING",b),d=b.getNumberValue("START",b)-1,e=b.getNumberValue("END",b)-1,f=c.length-1;if(0>d||0>e||d>f||e>f)throw Error();return c.substring(Math.min(d,e),Math.max(d,e)+1)}; Blockly.Blocks.replace_string={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_replace_string_1,calcFontColor);this.appendValueInput("STRING").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_replace_string_2,calcFontColor);this.appendValueInput("OLD_WORD").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_replace_string_3,calcFontColor);this.appendValueInput("NEW_WORD").setCheck(["Number", -"String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_replace_string_4,calcFontColor);this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.replace_string=function(b,a){return a.getStringValue("STRING",a).replace(new RegExp(a.getStringValue("OLD_WORD",a),"gm"),a.getStringValue("NEW_WORD",a))}; +"String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_replace_string_4,calcFontColor);this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.replace_string=function(a,b){return b.getStringValue("STRING",b).replace(new RegExp(b.getStringValue("OLD_WORD",b),"gm"),b.getStringValue("NEW_WORD",b))}; Blockly.Blocks.change_string_case={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_change_string_case_1,calcFontColor);this.appendValueInput("STRING").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.CALC_change_string_case_2,calcFontColor);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.CALC_change_string_case_sub_1,"toUpperCase"],[Lang.Blocks.CALC_change_string_case_sub_2,"toLowerCase"]], -null,!0,calcArrowColor),"CASE");this.appendDummyInput().appendField(Lang.Blocks.CALC_change_string_case_3,calcFontColor);this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.change_string_case=function(b,a){return a.getStringValue("STRING",a)[a.getField("CASE",a)]()}; +null,!0,calcArrowColor),"CASE");this.appendDummyInput().appendField(Lang.Blocks.CALC_change_string_case_3,calcFontColor);this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.change_string_case=function(a,b){return b.getStringValue("STRING",b)[b.getField("CASE",b)]()}; Blockly.Blocks.index_of_string={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_index_of_string_1,calcFontColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_index_of_string_2,calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_index_of_string_3,calcFontColor); -this.setInputsInline(!0)}};Entry.block.index_of_string=function(b,a){var c=a.getStringValue("LEFTHAND",a),d=a.getStringValue("RIGHTHAND",a),c=c.indexOf(d);return-1c)throw Error(Lang.Blocks.FLOW_repeat_basic_errorMsg);a.iterCount=Math.floor(c)}if(0==a.iterCount||0>a.iterCount)return delete a.isLooped,delete a.iterCount,a.callReturn();a.iterCount--;return a.getStatement("DO",a)}; -Blockly.Blocks.repeat_inf={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_inf).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.appendStatementInput("DO");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.repeat_inf=function(b,a){a.isLooped=!0;return a.getStatement("DO")}; +Entry.block.repeat_basic=function(a,b){var c;if(!b.isLooped){b.isLooped=!0;c=b.getNumberValue("VALUE",b);if(0>c)throw Error(Lang.Blocks.FLOW_repeat_basic_errorMsg);b.iterCount=Math.floor(c)}if(0==b.iterCount||0>b.iterCount)return delete b.isLooped,delete b.iterCount,b.callReturn();b.iterCount--;return b.getStatement("DO",b)}; +Blockly.Blocks.repeat_inf={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_inf).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.appendStatementInput("DO");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.repeat_inf=function(a,b){b.isLooped=!0;return b.getStatement("DO")}; Blockly.Blocks.stop_repeat={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_stop_repeat).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.stop_repeat=function(b,a){for(var c=a;"REPEAT"!=c.type.substr(0,6).toUpperCase()&&c.parentScript;)c=c.parentScript,delete c.isLooped,delete c.iterCount;var d=c.callReturn();return c.statements&&d?d:c?null:a.callReturn()}; +Entry.block.stop_repeat=function(a,b){for(var c=b;"REPEAT"!=c.type.substr(0,6).toUpperCase()&&c.parentScript;)c=c.parentScript,delete c.isLooped,delete c.iterCount;var d=c.callReturn();return c.statements&&d?d:c?null:b.callReturn()}; Blockly.Blocks.wait_until_true={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_wait_until_true_1);this.appendValueInput("BOOL").setCheck("Boolean");this.appendDummyInput().appendField(Lang.Blocks.FLOW_wait_until_true_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.wait_until_true=function(b,a){return a.getBooleanValue("BOOL",a)?a.callReturn():a}; +Entry.block.wait_until_true=function(a,b){return b.getBooleanValue("BOOL",b)?b.callReturn():b}; Blockly.Blocks._if={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW__if_1);this.appendValueInput("BOOL").setCheck("Boolean");this.appendDummyInput().appendField(Lang.Blocks.FLOW__if_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.appendStatementInput("STACK");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block._if=function(b,a){return a.isLooped?(delete a.isLooped,a.callReturn()):a.getBooleanValue("BOOL",a)?(a.isLooped=!0,a.getStatement("STACK",a)):a.callReturn()}; +Entry.block._if=function(a,b){return b.isLooped?(delete b.isLooped,b.callReturn()):b.getBooleanValue("BOOL",b)?(b.isLooped=!0,b.getStatement("STACK",b)):b.callReturn()}; Blockly.Blocks.if_else={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_if_else_1);this.appendValueInput("BOOL").setCheck("Boolean");this.appendDummyInput().appendField(Lang.Blocks.FLOW_if_else_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.appendStatementInput("STACK_IF");this.appendDummyInput().appendField(Lang.Blocks.FLOW_if_else_3);this.appendStatementInput("STACK_ELSE");this.setInputsInline(!0);this.setPreviousStatement(!0); -this.setNextStatement(!0)}};Entry.block.if_else=function(b,a){if(a.isLooped)return delete a.isLooped,a.callReturn();var c=a.getBooleanValue("BOOL",a);a.isLooped=!0;return c?a.getStatement("STACK_IF",a):a.getStatement("STACK_ELSE",a)}; +this.setNextStatement(!0)}};Entry.block.if_else=function(a,b){if(b.isLooped)return delete b.isLooped,b.callReturn();var c=b.getBooleanValue("BOOL",b);b.isLooped=!0;return c?b.getStatement("STACK_IF",b):b.getStatement("STACK_ELSE",b)}; Blockly.Blocks.create_clone={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_create_clone_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("clone"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.FLOW_create_clone_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.create_clone=function(b,a){var c=a.getField("VALUE",a),d=a.callReturn();"self"==c?b.parent.addCloneEntity(b.parent,b,null):Entry.container.getObject(c).addCloneEntity(b.parent,null,null);return d};Blockly.Blocks.delete_clone={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_delete_clone).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0)}}; -Entry.block.delete_clone=function(b,a){if(!b.isClone)return a.callReturn();b.removeClone()};Blockly.Blocks.when_clone_start={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_clone.png","*","start")).appendField(Lang.Blocks.FLOW_when_clone_start);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_clone_start=function(b,a){return a.callReturn()}; -Blockly.Blocks.stop_run={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_stop_run).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.stop_run=function(b,a){return Entry.engine.toggleStop()}; +Entry.block.create_clone=function(a,b){var c=b.getField("VALUE",b),d=b.callReturn();"self"==c?a.parent.addCloneEntity(a.parent,a,null):Entry.container.getObject(c).addCloneEntity(a.parent,null,null);return d};Blockly.Blocks.delete_clone={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_delete_clone).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0)}}; +Entry.block.delete_clone=function(a,b){if(!a.isClone)return b.callReturn();a.removeClone()};Blockly.Blocks.when_clone_start={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_clone.png","*","start")).appendField(Lang.Blocks.FLOW_when_clone_start);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_clone_start=function(a,b){return b.callReturn()}; +Blockly.Blocks.stop_run={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_stop_run).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.stop_run=function(a,b){return Entry.engine.toggleStop()}; Blockly.Blocks.repeat_while_true={init:function(){this.setColour("#498deb");"ko"==Lang.type?(this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_while_true_1),this.appendValueInput("BOOL").setCheck("Boolean"),this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.FLOW_repeat_while_true_until,"until"],[Lang.Blocks.FLOW_repeat_while_true_while,"while"]]),"OPTION").appendField(Lang.Blocks.FLOW_repeat_while_true_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png", "*"))):(this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_while_true_1),this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.FLOW_repeat_while_true_until,"until"],[Lang.Blocks.FLOW_repeat_while_true_while,"while"]]),"OPTION"),this.appendValueInput("BOOL").setCheck("Boolean"),this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_while_true_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*")));this.appendStatementInput("DO"); -this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.repeat_while_true=function(b,a){var c=a.getBooleanValue("BOOL",a);"until"==a.getField("OPTION",a)&&(c=!c);return(a.isLooped=c)?a.getStatement("DO",a):a.callReturn()}; +this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.repeat_while_true=function(a,b){var c=b.getBooleanValue("BOOL",b);"until"==b.getField("OPTION",b)&&(c=!c);return(b.isLooped=c)?b.getStatement("DO",b):b.callReturn()}; Blockly.Blocks.stop_object={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_stop_object_1);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.FLOW_stop_object_all,"all"],[Lang.Blocks.FLOW_stop_object_this_object,"thisOnly"],[Lang.Blocks.FLOW_stop_object_this_thread,"thisThread"],[Lang.Blocks.FLOW_stop_object_other_thread,"otherThread"]]),"TARGET");this.appendDummyInput().appendField(Lang.Blocks.FLOW_stop_object_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ "block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.stop_object=function(b,a){var c=a.getField("TARGET",a),d=Entry.container;switch(c){case "all":d.mapEntityIncludeCloneOnScene(function(a){a.clearScript()});break;case "thisObject":b.clearScript();c=b.parent.clonedEntities;c.map(function(a){a.clearScript()});break;case "thisOnly":b.clearScript();break;case "otherThread":return b.clearScript(),c=b.parent.clonedEntities,c.map(function(a){a.clearScript()}),a.callReturn()}return null}; -Blockly.Blocks.restart_project={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_restart).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0)}};Entry.block.restart_project=function(b,a){Entry.engine.toggleStop();Entry.engine.toggleRun()}; -Blockly.Blocks.remove_all_clones={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_delete_clone_all).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.remove_all_clones=function(b,a){var c=b.parent.getClonedEntities();c.map(function(a){a.removeClone()});c=null;return a.callReturn()};Blockly.Blocks.function_field_label={init:function(){this.setColour("#f9c535");this.appendDummyInput().appendField(new Blockly.FieldTextInput(Lang.Blocks.FUNCTION_explanation_1),"NAME");this.appendValueInput("NEXT").setCheck(["Param"]);this.setOutput(!0,"Param");this.setInputsInline(!0)}};Blockly.Blocks.function_field_string={init:function(){this.setColour("#FFD974");this.appendValueInput("PARAM").setCheck(["String"]);this.appendValueInput("NEXT").setCheck(["Param"]);this.setOutput(!0,"Param");this.setInputsInline(!0)}}; +Entry.block.stop_object=function(a,b){var c=b.getField("TARGET",b),d=Entry.container;switch(c){case "all":d.mapEntityIncludeCloneOnScene(function(b){b.clearScript()});break;case "thisObject":a.clearScript();c=a.parent.clonedEntities;c.map(function(b){b.clearScript()});break;case "thisOnly":a.clearScript();break;case "otherThread":return a.clearScript(),c=a.parent.clonedEntities,c.map(function(b){b.clearScript()}),b.callReturn()}return null}; +Blockly.Blocks.restart_project={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_restart).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0)}};Entry.block.restart_project=function(a,b){Entry.engine.toggleStop();Entry.engine.toggleRun()}; +Blockly.Blocks.remove_all_clones={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_delete_clone_all).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.remove_all_clones=function(a,b){var c=a.parent.getClonedEntities();c.map(function(b){b.removeClone()});c=null;return b.callReturn()};Blockly.Blocks.function_field_label={init:function(){this.setColour("#f9c535");this.appendDummyInput().appendField(new Blockly.FieldTextInput(Lang.Blocks.FUNCTION_explanation_1),"NAME");this.appendValueInput("NEXT").setCheck(["Param"]);this.setOutput(!0,"Param");this.setInputsInline(!0)}};Blockly.Blocks.function_field_string={init:function(){this.setColour("#FFD974");this.appendValueInput("PARAM").setCheck(["String"]);this.appendValueInput("NEXT").setCheck(["Param"]);this.setOutput(!0,"Param");this.setInputsInline(!0)}}; Blockly.Blocks.function_field_boolean={init:function(){this.setColour("#AEB8FF");this.appendValueInput("PARAM").setCheck(["Boolean"]);this.appendValueInput("NEXT").setCheck(["Param"]);this.setOutput(!0,"Param");this.setInputsInline(!0)}}; -Blockly.Blocks.function_param_string={init:function(){this.setEditable(!1);this.setColour("#FFD974");this.setOutput(!0,["String","Number"]);this.setInputsInline(!0)},domToMutation:function(b){b.getElementsByTagName("field");this.hashId=b.getAttribute("hashid");(b=Entry.Func.targetFunc.stringHash[this.hashId])||(b="");this.appendDummyInput().appendField(new Blockly.FieldTextInput(Lang.Blocks.FUNCTION_character_variable+b),"")},mutationToDom:function(){var b=document.createElement("mutation");b.setAttribute("hashid", -this.hashId);return b}};Entry.block.function_param_string=function(b,a,c){return a.register[a.hashId].run()}; -Blockly.Blocks.function_param_boolean={init:function(){this.setEditable(!1);this.setColour("#AEB8FF");this.setOutput(!0,"Boolean");this.setInputsInline(!0)},domToMutation:function(b){b.getElementsByTagName("field");this.hashId=b.getAttribute("hashid");(b=Entry.Func.targetFunc.booleanHash[this.hashId])||(b="");this.appendDummyInput().appendField(new Blockly.FieldTextInput(Lang.Blocks.FUNCTION_logical_variable+b),"")},mutationToDom:function(){var b=document.createElement("mutation");b.setAttribute("hashid", -this.hashId);return b}};Entry.block.function_param_boolean=function(b,a,c){return a.register[a.hashId].run()};Blockly.Blocks.function_create={init:function(){this.appendDummyInput().appendField(Lang.Blocks.FUNCTION_define);this.setColour("#cc7337");this.appendValueInput("FIELD").setCheck(["Param"]);this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/function_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0)}}; -Entry.block.function_create=function(b,a){return a.callReturn()}; -Blockly.Blocks.function_general={init:function(){this.setColour("#cc7337");this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)},domToMutation:function(b){var a=b.getElementsByTagName("field");this.appendDummyInput().appendField("");a.length||this.appendDummyInput().appendField(Lang.Blocks.FUNCTION_function);for(var c=0;ca.count?(50>d.leftFloor&&50>d.rightFloor?a.count++:a.count=0,d=d.leftFloor-d.rightFloor,c.leftWheel=45+.25*d,c.rightWheel=45-.25*d):(a.count=0,a.boardState=2);break;case 2:d=d.leftFloor-d.rightFloor;c.leftWheel=45+.25*d;c.rightWheel=45-.25*d;a.boardState=3;var e=setTimeout(function(){a.boardState=4;Entry.Hamster.removeTimeout(e)},250);Entry.Hamster.timeouts.push(e); -break;case 3:d=d.leftFloor-d.rightFloor;c.leftWheel=45+.25*d;c.rightWheel=45-.25*d;break;case 4:c.leftWheel=0,c.rightWheel=0,a.boardState=0,a.isMoving=!1}return a}delete a.isStart;delete a.isMoving;delete a.count;delete a.boardState;Entry.engine.isContinue=!1;c.leftWheel=0;c.rightWheel=0;return a.callReturn()}a.isStart=!0;a.isMoving=!0;a.count=0;a.boardState=1;c.leftWheel=45;c.rightWheel=45;Entry.Hamster.setLineTracerMode(c,0);return a}; +Entry.block.hamster_move_forward_once=function(a,b){var c=Entry.hw.sendQueue,d=Entry.hw.portData;if(b.isStart){if(b.isMoving){switch(b.boardState){case 1:2>b.count?(50>d.leftFloor&&50>d.rightFloor?b.count++:b.count=0,d=d.leftFloor-d.rightFloor,c.leftWheel=45+.25*d,c.rightWheel=45-.25*d):(b.count=0,b.boardState=2);break;case 2:d=d.leftFloor-d.rightFloor;c.leftWheel=45+.25*d;c.rightWheel=45-.25*d;b.boardState=3;var e=setTimeout(function(){b.boardState=4;Entry.Hamster.removeTimeout(e)},250);Entry.Hamster.timeouts.push(e); +break;case 3:d=d.leftFloor-d.rightFloor;c.leftWheel=45+.25*d;c.rightWheel=45-.25*d;break;case 4:c.leftWheel=0,c.rightWheel=0,b.boardState=0,b.isMoving=!1}return b}delete b.isStart;delete b.isMoving;delete b.count;delete b.boardState;Entry.engine.isContinue=!1;c.leftWheel=0;c.rightWheel=0;return b.callReturn()}b.isStart=!0;b.isMoving=!0;b.count=0;b.boardState=1;c.leftWheel=45;c.rightWheel=45;Entry.Hamster.setLineTracerMode(c,0);return b}; Blockly.Blocks.hamster_turn_once={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_turn_once_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"]]),"DIRECTION").appendField(Lang.Blocks.HAMSTER_turn_once_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.hamster_turn_once=function(b,a){var c=Entry.hw.sendQueue,d=Entry.hw.portData;if(a.isStart){if(a.isMoving){if(a.isLeft)switch(a.boardState){case 1:2>a.count?50d.leftFloor&&(a.boardState=3);break;case 3:2>a.count?20>d.leftFloor&&a.count++:(a.count=0,a.boardState=4);break;case 4:50a.count?50d.rightFloor&&(a.boardState=3);break;case 3:2>a.count?20>d.rightFloor&&a.count++:(a.count=0,a.boardState=4);break;case 4:50b.count?50d.leftFloor&&(b.boardState=3);break;case 3:2>b.count?20>d.leftFloor&&b.count++:(b.count=0,b.boardState=4);break;case 4:50b.count?50d.rightFloor&&(b.boardState=3);break;case 3:2>b.count?20>d.rightFloor&&b.count++:(b.count=0,b.boardState=4);break;case 4:50Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return a.callReturn()}; +Entry.block.hamster_change_tempo_by=function(a,b){Entry.Hamster.tempo+=b.getNumberValue("VALUE");1>Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return b.callReturn()}; 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()}; +Entry.block.hamster_set_tempo_to=function(a,b){Entry.Hamster.tempo=b.getNumberValue("VALUE");1>Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return b.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(a,b){var c=Entry.hw.sendQueue,d=b.getField("PORT",b),e=+b.getField("MODE",b);"A"==d?c.ioModeA=e:("B"!=d&&(c.ioModeA=e),c.ioModeB=e);return b.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()}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_change_output_by=function(a,b){var c=Entry.hw.sendQueue,d=b.getField("PORT"),e=b.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 b.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.engine.pressedKeys.indexOf(c)}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_set_output_to=function(a,b){var c=Entry.hw.sendQueue,d=b.getField("PORT"),e=b.getNumberValue("VALUE");"A"==d?c.outputA=e:("B"!=d&&(c.outputA=e),c.outputB=e);return b.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(a,b){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(a,b){var c=+b.getField("VALUE",b);return 0<=Entry.engine.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","BIGGER"]]),"OPERATOR");this.appendValueInput("RIGHTHAND").setCheck(["String","Number"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; -Entry.block.boolean_comparison=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","#3D3D3D");this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; -Entry.block.boolean_bigger=function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c>d};Blockly.Blocks.boolean_smaller={init:function(){this.setColour("#AEB8FF");this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("<","#3D3D3D");this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; -Entry.block.boolean_smaller=function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return ce:d","#3D3D3D");this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; +Entry.block.boolean_bigger=function(a,b){var c=b.getNumberValue("LEFTHAND",b),d=b.getNumberValue("RIGHTHAND",b);return c>d};Blockly.Blocks.boolean_smaller={init:function(){this.setColour("#AEB8FF");this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("<","#3D3D3D");this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; +Entry.block.boolean_smaller=function(a,b){var c=b.getNumberValue("LEFTHAND",b),d=b.getNumberValue("RIGHTHAND",b);return c","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()}; -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()}; +Entry.block.boolean_basic_operator=function(a,b){var c=b.getField("OPERATOR",b),d=b.getStringValue("LEFTHAND",b),e=b.getStringValue("RIGHTHAND",b);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(a,b){a.setVisible(!0);return b.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(a,b){a.setVisible(!1);return b.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)}}; -Entry.block.dialog_time=function(b,a){if(!a.isStart){var c=a.getNumberValue("SECOND",a),d=a.getStringValue("VALUE",a),e=a.getField("OPTION",a);a.isStart=!0;a.timeFlag=1;d||"number"==typeof d||(d=" ");d=Entry.convertToRoundedDecimals(d,3);new Entry.Dialog(b,d,e);b.syncDialogVisible(b.getVisible());setTimeout(function(){a.timeFlag=0},1E3*c)}return 0==a.timeFlag?(delete a.timeFlag,delete a.isStart,b.dialog&&b.dialog.remove(),a.callReturn()):a}; +Entry.block.dialog_time=function(a,b){if(!b.isStart){var c=b.getNumberValue("SECOND",b),d=b.getStringValue("VALUE",b),e=b.getField("OPTION",b);b.isStart=!0;b.timeFlag=1;d||"number"==typeof d||(d=" ");d=Entry.convertToRoundedDecimals(d,3);new Entry.Dialog(a,d,e);a.syncDialogVisible(a.getVisible());setTimeout(function(){b.timeFlag=0},1E3*c)}return 0==b.timeFlag?(delete b.timeFlag,delete b.isStart,a.dialog&&a.dialog.remove(),b.callReturn()):b}; Blockly.Blocks.dialog={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_1);this.appendValueInput("VALUE").setCheck(["String","Number",null]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_2);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.speak,"speak"]]),"OPTION");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png", -"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dialog=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()}; -Blockly.Blocks.remove_dialog={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_remove_dialog).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.remove_dialog=function(b,a){b.dialog&&b.dialog.remove();return a.callReturn()}; +"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dialog=function(a,b){var c=b.getStringValue("VALUE",b);c||"number"==typeof c||(c=" ");var d=b.getField("OPTION",b),c=Entry.convertToRoundedDecimals(c,3);new Entry.Dialog(a,c,d);a.syncDialogVisible(a.getVisible());return b.callReturn()}; +Blockly.Blocks.remove_dialog={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_remove_dialog).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.remove_dialog=function(a,b){a.dialog&&a.dialog.remove();return b.callReturn()}; Blockly.Blocks.change_to_nth_shape={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_to_nth_shape_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("pictures"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_to_nth_shape_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_to_nth_shape=function(b,a){var c=a.getField("VALUE",a),c=b.parent.getPicture(c);b.setImage(c);return a.callReturn()}; +Entry.block.change_to_nth_shape=function(a,b){var c=b.getField("VALUE",b),c=a.parent.getPicture(c);a.setImage(c);return b.callReturn()}; Blockly.Blocks.change_to_next_shape={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_to_near_shape_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.LOOKS_change_shape_next,"next"],[Lang.Blocks.LOOKS_change_shape_prev,"prev"]]),"DRIECTION").appendField(Lang.Blocks.LOOKS_change_to_near_shape_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_to_next_shape=function(b,a){var c;c=a.fields&&"prev"===a.getStringField("DRIECTION")?b.parent.getPrevPicture(b.picture.id):b.parent.getNextPicture(b.picture.id);b.setImage(c);return a.callReturn()}; +Entry.block.change_to_next_shape=function(a,b){var c;c=b.fields&&"prev"===b.getStringField("DRIECTION")?a.parent.getPrevPicture(a.picture.id):a.parent.getNextPicture(a.picture.id);a.setImage(c);return b.callReturn()}; Blockly.Blocks.set_effect_volume={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_effect_volume_1);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity,"opacity"]]),"EFFECT");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_effect_volume_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_effect_volume_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.set_effect_volume=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()}; +"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.set_effect_volume=function(a,b){var c=b.getField("EFFECT",b),d=b.getNumberValue("VALUE",b);"color"==c?a.effect.hue=d+a.effect.hue:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?a.effect.brightness=d+a.effect.brightness:"blur"!=c&&"opacity"==c&&(a.effect.alpha+=d/100));a.applyFilter();return b.callReturn()}; Blockly.Blocks.set_effect={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_effect_1);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity,"opacity"]]),"EFFECT");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_effect_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_effect_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.set_effect=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()}; -Blockly.Blocks.erase_all_effects={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_erase_all_effects).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.erase_all_effects=function(b,a){b.resetFilter();return a.callReturn()}; +"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.set_effect=function(a,b){var c=b.getField("EFFECT",b),d=b.getNumberValue("VALUE",b);"color"==c?a.effect.hue=d:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?a.effect.brightness=d:"blur"!=c&&"opacity"==c&&(a.effect.alpha=d/100));a.applyFilter();return b.callReturn()}; +Blockly.Blocks.erase_all_effects={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_erase_all_effects).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.erase_all_effects=function(a,b){a.resetFilter();return b.callReturn()}; Blockly.Blocks.change_scale_percent={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_scale_percent_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_scale_percent_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_scale_percent=function(b,a){var c=(a.getNumberValue("VALUE",a)+100)/100;b.setScaleX(b.getScaleX()*c);b.setScaleY(b.getScaleY()*c);return a.callReturn()}; +Entry.block.change_scale_percent=function(a,b){var c=(b.getNumberValue("VALUE",b)+100)/100;a.setScaleX(a.getScaleX()*c);a.setScaleY(a.getScaleY()*c);return b.callReturn()}; Blockly.Blocks.set_scale_percent={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_scale_percent_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_scale_percent_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_scale_percent=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()}; +Entry.block.set_scale_percent=function(a,b){var c=b.getNumberValue("VALUE",b)/100,d=a.snapshot_;a.setScaleX(c*d.scaleX);a.setScaleY(c*d.scaleY);return b.callReturn()}; Blockly.Blocks.change_scale_size={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_scale_percent_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_scale_percent_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_scale_size=function(b,a){var c=a.getNumberValue("VALUE",a);b.setSize(b.getSize()+c);return a.callReturn()}; +Entry.block.change_scale_size=function(a,b){var c=b.getNumberValue("VALUE",b);a.setSize(a.getSize()+c);return b.callReturn()}; Blockly.Blocks.set_scale_size={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_scale_percent_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_scale_percent_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_scale_size=function(b,a){var c=a.getNumberValue("VALUE",a);b.setSize(c);return a.callReturn()};Blockly.Blocks.flip_y={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_flip_y).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_y=function(b,a){b.setScaleX(-1*b.getScaleX());return a.callReturn()}; -Blockly.Blocks.flip_x={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_flip_x).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_x=function(b,a){b.setScaleY(-1*b.getScaleY());return a.callReturn()}; +Entry.block.set_scale_size=function(a,b){var c=b.getNumberValue("VALUE",b);a.setSize(c);return b.callReturn()};Blockly.Blocks.flip_y={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_flip_y).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_y=function(a,b){a.setScaleX(-1*a.getScaleX());return b.callReturn()}; +Blockly.Blocks.flip_x={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_flip_x).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_x=function(a,b){a.setScaleY(-1*a.getScaleY());return b.callReturn()}; Blockly.Blocks.set_object_order={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_object_order_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("objectSequence"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_object_order_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_object_order=function(b,a){var c=a.getField("VALUE",a),d=Entry.container.getCurrentObjects().indexOf(b.parent);if(-1f)throw Error("object is not available for current scene");switch(d){case "FRONT":c=0;break;case "FORWARD":c=Math.max(0,f-1);break;case "BACKWARD":c=Math.min(e,f+1);break;case "BACK":c=e}Entry.container.moveElementByBlock(f,c);return a.callReturn()};Blockly.Blocks.move_direction={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.move_direction=function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(b.getX()+c*Math.cos((b.getRotation()+b.getDirection()-90)/180*Math.PI));b.setY(b.getY()-c*Math.sin((b.getRotation()+b.getDirection()-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; +"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.change_object_index=function(a,b){var c,d=b.getField("LOCATION",b),e=Entry.container.getCurrentObjects(),f=e.indexOf(a.parent),e=e.length-1;if(0>f)throw Error("object is not available for current scene");switch(d){case "FRONT":c=0;break;case "FORWARD":c=Math.max(0,f-1);break;case "BACKWARD":c=Math.min(e,f+1);break;case "BACK":c=e}Entry.container.moveElementByBlock(f,c);return b.callReturn()};Blockly.Blocks.move_direction={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; +Entry.block.move_direction=function(a,b){var c=b.getNumberValue("VALUE",b);a.setX(a.getX()+c*Math.cos((a.getRotation()+a.getDirection()-90)/180*Math.PI));a.setY(a.getY()-c*Math.sin((a.getRotation()+a.getDirection()-90)/180*Math.PI));a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}; Blockly.Blocks.move_x={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_x_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_x_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.move_x=function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(b.getX()+c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; +Entry.block.move_x=function(a,b){var c=b.getNumberValue("VALUE",b);a.setX(a.getX()+c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}; Blockly.Blocks.move_y={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_y_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_y_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.move_y=function(b,a){var c=a.getNumberValue("VALUE",a);b.setY(b.getY()+c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; +Entry.block.move_y=function(a,b){var c=b.getNumberValue("VALUE",b);a.setY(a.getY()+c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}; Blockly.Blocks.locate_xy_time={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_xy_time_1);this.appendValueInput("VALUE1").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_xy_time_2);this.appendValueInput("VALUE2").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_xy_time_3);this.appendValueInput("VALUE3").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_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.locate_xy_time=function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE1",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.x=a.getNumberValue("VALUE2",a);a.y=a.getNumberValue("VALUE3",a)}if(0!=a.frameCount){c=a.x-b.getX();var d=a.y-b.getY();c/=a.frameCount;d/=a.frameCount;b.setX(b.getX()+c);b.setY(b.getY()+d);a.frameCount--;b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a}delete a.isStart;delete a.frameCount;return a.callReturn()}; +Entry.block.locate_xy_time=function(a,b){if(!b.isStart){var c;c=b.getNumberValue("VALUE1",b);b.isStart=!0;b.frameCount=Math.floor(c*Entry.FPS);b.x=b.getNumberValue("VALUE2",b);b.y=b.getNumberValue("VALUE3",b)}if(0!=b.frameCount){c=b.x-a.getX();var d=b.y-a.getY();c/=b.frameCount;d/=b.frameCount;a.setX(a.getX()+c);a.setY(a.getY()+d);b.frameCount--;a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b}delete b.isStart;delete b.frameCount;return b.callReturn()}; 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()}; +Entry.block.rotate_by_angle=function(a,b){var c=b.getNumberValue("VALUE",b);a.setRotation(a.getRotation()+c);return b.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(a,b){var c=b.getField("VALUE",b);a.setRotation(a.getRotation()+ +c);return b.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()}; +Entry.block.see_angle=function(a,b){var c=b.getNumberValue("VALUE",b);a.setDirection(c);return b.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)}}; -Entry.block.see_direction=function(b,a){var c=a.getField("VALUE",a),d=Entry.container.getEntity(c),c=d.getX()-b.getX(),d=d.getY()-b.getY();0<=c?b.setRotation(Math.atan(d/c)/Math.PI*180+90):b.setRotation(Math.atan(d/c)/Math.PI*180+270);return a.callReturn()}; +Entry.block.see_direction=function(a,b){var c=b.getField("VALUE",b),d=Entry.container.getEntity(c),c=d.getX()-a.getX(),d=d.getY()-a.getY();0<=c?a.setRotation(Math.atan(d/c)/Math.PI*180+90):a.setRotation(Math.atan(d/c)/Math.PI*180+270);return b.callReturn()}; Blockly.Blocks.locate_xy={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_xy_1);this.appendValueInput("VALUE1").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_xy_2);this.appendValueInput("VALUE2").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_xy_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0); -this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.locate_xy=function(b,a){var c=a.getNumberValue("VALUE1",a);b.setX(c);c=a.getNumberValue("VALUE2",a);b.setY(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; +this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.locate_xy=function(a,b){var c=b.getNumberValue("VALUE1",b);a.setX(c);c=b.getNumberValue("VALUE2",b);a.setY(c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}; Blockly.Blocks.locate_x={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_x_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_x_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.locate_x=function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; +Entry.block.locate_x=function(a,b){var c=b.getNumberValue("VALUE",b);a.setX(c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}; 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()}; +Entry.block.locate_y=function(a,b){var c=b.getNumberValue("VALUE",b);a.setY(c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.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(a,b){var c=b.getField("VALUE",b),d;"mouse"==c?(c=Entry.stage.mouseCoordinate.x,d=Entry.stage.mouseCoordinate.y):(d=Entry.container.getEntity(c),c=d.getX(),d=d.getY());a.setX(+c);a.setY(+d);a.brush&&!a.brush.stop&&a.brush.lineTo(c,-1*d);return b.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()}; +Entry.block.move_xy_time=function(a,b){if(!b.isStart){var c;c=b.getNumberValue("VALUE1",b);var d=b.getNumberValue("VALUE2",b),e=b.getNumberValue("VALUE3",b);b.isStart=!0;b.frameCount=Math.floor(c*Entry.FPS);b.dX=d/b.frameCount;b.dY=e/b.frameCount}if(0!=b.frameCount)return a.setX(a.getX()+b.dX),a.setY(a.getY()+b.dY),b.frameCount--,a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY()),b;delete b.isStart;delete b.frameCount;return b.callReturn()}; Blockly.Blocks.locate_time={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_time_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_time_2);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("sprites"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_time_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png", "*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Blockly.Blocks.rotate_by_angle_time={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_time_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_time_2);this.appendDummyInput().appendField(new Blockly.FieldAngle("90"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_time_3).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_time=function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE",a);var d=a.getNumberField("VALUE",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dAngle=d/a.frameCount}if(0!=a.frameCount)return b.setRotation(b.getRotation()+a.dAngle),a.frameCount--,a;delete a.isStart;delete a.frameCount;return a.callReturn()}; +"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.rotate_by_angle_time=function(a,b){if(!b.isStart){var c;c=b.getNumberValue("VALUE",b);var d=b.getNumberField("VALUE",b);b.isStart=!0;b.frameCount=Math.floor(c*Entry.FPS);b.dAngle=d/b.frameCount}if(0!=b.frameCount)return a.setRotation(a.getRotation()+b.dAngle),b.frameCount--,b;delete b.isStart;delete b.frameCount;return b.callReturn()}; Blockly.Blocks.bounce_when={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_bounce_when_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("bounce"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.MOVING_bounce_when_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setPreviousStatement(!0);this.setInputsInline(!0);this.setNextStatement(!0)}}; Blockly.Blocks.bounce_wall={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_bounce_wall).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.bounce_wall=function(b,a){var c=b.parent.getRotateMethod(),d="free"==c?(b.getRotation()+b.getDirection()).mod(360):b.getDirection(),e=Entry.Utils.COLLISION.NONE;if(90>d&&0<=d||360>d&&270<=d){var e=b.collision==Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,b.object,0,!1);!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE);f&&e&&(f=!1);f?("free"==c?b.setRotation(-b.getRotation()-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&&e&&(f=!1),f&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN))}else 270>d&&90<=d&&(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&&e&&(f= -!1),f?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN):(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)));360>d&&180<=d?(e=b.collision==Entry.Utils.COLLISION.LEFT, -d=ndgmr.checkPixelCollision(Entry.stage.wall.left,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.LEFT):(e=b.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()): -b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.RIGHT))):180>d&&0<=d&&(e=b.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.RIGHT):(e=b.collision==Entry.Utils.COLLISION.LEFT,d=ndgmr.checkPixelCollision(Entry.stage.wall.left, -b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.LEFT)));return a.callReturn()}; -Blockly.Blocks.flip_arrow_horizontal={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_flip_arrow_horizontal).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_arrow_horizontal=function(b,a){b.setDirection(b.getDirection()+180);return a.callReturn()}; -Blockly.Blocks.flip_arrow_vertical={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_flip_arrow_vertical).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_arrow_vertical=function(b,a){b.setDirection(b.getDirection()+180);return a.callReturn()}; +Entry.block.bounce_wall=function(a,b){var c=a.parent.getRotateMethod(),d="free"==c?(a.getRotation()+a.getDirection()).mod(360):a.getDirection(),e=Entry.Utils.COLLISION.NONE;if(90>d&&0<=d||360>d&&270<=d){var e=a.collision==Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,a.object,0,!1);!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE);f&&e&&(f=!1);f?("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+180),a.collision=Entry.Utils.COLLISION.UP): +(e=a.collision==Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,a.object,0,!1),!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+180),a.collision=Entry.Utils.COLLISION.DOWN))}else 270>d&&90<=d&&(e=a.collision==Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,a.object,0,!1),!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f= +!1),f?("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+180),a.collision=Entry.Utils.COLLISION.DOWN):(e=a.collision==Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,a.object,0,!1),!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+180),a.collision=Entry.Utils.COLLISION.UP)));360>d&&180<=d?(e=a.collision==Entry.Utils.COLLISION.LEFT, +d=ndgmr.checkPixelCollision(Entry.stage.wall.left,a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()):a.setDirection(-a.getDirection()+360),a.collision=Entry.Utils.COLLISION.LEFT):(e=a.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()): +a.setDirection(-a.getDirection()+360),a.collision=Entry.Utils.COLLISION.RIGHT))):180>d&&0<=d&&(e=a.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()):a.setDirection(-a.getDirection()+360),a.collision=Entry.Utils.COLLISION.RIGHT):(e=a.collision==Entry.Utils.COLLISION.LEFT,d=ndgmr.checkPixelCollision(Entry.stage.wall.left, +a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()):a.setDirection(-a.getDirection()+360),a.collision=Entry.Utils.COLLISION.LEFT)));return b.callReturn()}; +Blockly.Blocks.flip_arrow_horizontal={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_flip_arrow_horizontal).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_arrow_horizontal=function(a,b){a.setDirection(a.getDirection()+180);return b.callReturn()}; +Blockly.Blocks.flip_arrow_vertical={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_flip_arrow_vertical).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_arrow_vertical=function(a,b){a.setDirection(a.getDirection()+180);return b.callReturn()}; Blockly.Blocks.see_angle_object={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_object_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("spritesWithMouse"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_object_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_object=function(b,a){var c=a.getField("VALUE",a),d=b.getX(),e=b.getY();if(b.parent.id==c)return a.callReturn();"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()}; +Entry.block.see_angle_object=function(a,b){var c=b.getField("VALUE",b),d=a.getX(),e=a.getY();if(a.parent.id==c)return b.callReturn();"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?a.getDirection()+a.getRotation():0<=d?-Math.atan(e/d)/Math.PI*180+90:-Math.atan(e/d)/Math.PI*180+270;d=a.getDirection()+a.getRotation();a.setRotation(a.getRotation()+e-d);return b.callReturn()}; Blockly.Blocks.see_angle_direction={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_direction_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_direction_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_direction=function(b,a){var c=a.getNumberValue("VALUE",a),d=b.getDirection()+b.getRotation();b.setRotation(b.getRotation()+c-d);return a.callReturn()}; +Entry.block.see_angle_direction=function(a,b){var c=b.getNumberValue("VALUE",b),d=a.getDirection()+a.getRotation();a.setRotation(a.getRotation()+c-d);return b.callReturn()}; Blockly.Blocks.rotate_direction={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_direction_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_direction_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.rotate_direction=function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c+b.getDirection());return a.callReturn()}; +Entry.block.rotate_direction=function(a,b){var c=b.getNumberValue("VALUE",b);a.setDirection(c+a.getDirection());return b.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(a,b){if(!b.isStart){var c,d,e;d=b.getField("TARGET",b);c=b.getNumberValue("VALUE",b);c=Math.floor(c*Entry.FPS);e=Entry.stage.mouseCoordinate;if(0!=c)"mouse"==d?(d=e.x-a.getX(),e=e.y-a.getY()):(e=Entry.container.getEntity(d),d=e.getX()-a.getX(),e=e.getY()-a.getY()),b.isStart=!0,b.frameCount=c,b.dX=d/b.frameCount,b.dY=e/b.frameCount;else return"mouse"==d?(d=+e.x,e=+e.y):(e=Entry.container.getEntity(d),d=e.getX(),e=e.getY()),a.setX(d),a.setY(e),a.brush&&!a.brush.stop&& +a.brush.lineTo(a.getX(),-1*a.getY()),b.callReturn()}if(0!=b.frameCount)return a.setX(a.getX()+b.dX),a.setY(a.getY()+b.dY),b.frameCount--,a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY()),b;delete b.isStart;delete b.frameCount;return b.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()}; +Entry.block.rotate_absolute=function(a,b){var c=b.getNumberValue("VALUE",b);a.setRotation(c);return b.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)}}; -Entry.block.rotate_relative=function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c+b.getRotation());return a.callReturn()}; +Entry.block.rotate_relative=function(a,b){var c=b.getNumberValue("VALUE",b);a.setRotation(c+a.getRotation());return b.callReturn()}; Blockly.Blocks.direction_absolute={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.direction_absolute=function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}; +Entry.block.direction_absolute=function(a,b){var c=b.getNumberValue("VALUE",b);a.setDirection(c);return b.callReturn()}; Blockly.Blocks.direction_relative={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_direction_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_direction_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.direction_relative=function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c+b.getDirection());return a.callReturn()}; +Entry.block.direction_relative=function(a,b){var c=b.getNumberValue("VALUE",b);a.setDirection(c+a.getDirection());return b.callReturn()}; Blockly.Blocks.move_to_angle={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_angle_1);this.appendValueInput("ANGLE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_angle_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_angle_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png", -"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.move_to_angle=function(b,a){var c=a.getNumberValue("VALUE",a),d=a.getNumberValue("ANGLE",a);b.setX(b.getX()+c*Math.cos((d-90)/180*Math.PI));b.setY(b.getY()-c*Math.sin((d-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; +"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.move_to_angle=function(a,b){var c=b.getNumberValue("VALUE",b),d=b.getNumberValue("ANGLE",b);a.setX(a.getX()+c*Math.cos((d-90)/180*Math.PI));a.setY(a.getY()-c*Math.sin((d-90)/180*Math.PI));a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}; Blockly.Blocks.rotate_by_time={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_add_direction_by_angle_time_explain_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_add_direction_by_angle_time_2);this.appendDummyInput().appendField(Lang.Blocks.MOVING_add_direction_by_angle_time_1);this.appendValueInput("ANGLE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_add_direction_by_angle_time_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.rotate_by_time=function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE",a);var d=a.getNumberValue("ANGLE",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dAngle=d/a.frameCount}if(0!=a.frameCount)return b.setRotation(b.getRotation()+a.dAngle),a.frameCount--,a;delete a.isStart;delete a.frameCount;return a.callReturn()}; +"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.rotate_by_time=function(a,b){if(!b.isStart){var c;c=b.getNumberValue("VALUE",b);var d=b.getNumberValue("ANGLE",b);b.isStart=!0;b.frameCount=Math.floor(c*Entry.FPS);b.dAngle=d/b.frameCount}if(0!=b.frameCount)return a.setRotation(a.getRotation()+b.dAngle),b.frameCount--,b;delete b.isStart;delete b.frameCount;return b.callReturn()}; Blockly.Blocks.direction_relative_duration={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_direction_relative_duration_1);this.appendValueInput("DURATION").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_direction_relative_duration_2);this.appendValueInput("AMOUNT").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_direction_relative_duration_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.direction_relative_duration=function(b,a){if(!a.isStart){var c;c=a.getNumberValue("DURATION",a);var d=a.getNumberValue("AMOUNT",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dDirection=d/a.frameCount}if(0!=a.frameCount)return b.setDirection(b.getDirection()+a.dDirection),a.frameCount--,a;delete a.isStart;delete a.frameCount;delete a.dDirection;return a.callReturn()};Entry.Neobot={name:"neobot",PORT_MAP:{1:0,2:0,3:0,SERVO1:0,SERVO2:0,SERVO1_SPEED:3,SERVO2_SPEED:3,LMOT:0,RMOT:0,note:0,octave:0,duration:0,sound_check:0,O_1:0,O_2:0},setZero:function(){for(var b in Entry.Neobot.PORT_MAP)Entry.hw.sendQueue[b]=Entry.Neobot.PORT_MAP[b];Entry.hw.update()},name:"neobot",monitorTemplate:{imgPath:"hw/neobot.png",width:268,height:270,ports:{1:{name:Lang.Hw.port_en+" 1 "+Lang.Hw.port_ko,type:"input",pos:{x:78,y:9}},2:{name:Lang.Hw.port_en+" 2 "+Lang.Hw.port_ko,type:"input", +"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.direction_relative_duration=function(a,b){if(!b.isStart){var c;c=b.getNumberValue("DURATION",b);var d=b.getNumberValue("AMOUNT",b);b.isStart=!0;b.frameCount=Math.floor(c*Entry.FPS);b.dDirection=d/b.frameCount}if(0!=b.frameCount)return a.setDirection(a.getDirection()+b.dDirection),b.frameCount--,b;delete b.isStart;delete b.frameCount;delete b.dDirection;return b.callReturn()};Entry.Neobot={name:"neobot",PORT_MAP:{1:0,2:0,3:0,SERVO1:0,SERVO2:0,SERVO1_SPEED:3,SERVO2_SPEED:3,LMOT:0,RMOT:0,note:0,octave:0,duration:0,sound_check:0,O_1:0,O_2:0},setZero:function(){for(var a in Entry.Neobot.PORT_MAP)Entry.hw.sendQueue[a]=Entry.Neobot.PORT_MAP[a];Entry.hw.update()},name:"neobot",monitorTemplate:{imgPath:"hw/neobot.png",width:268,height:270,ports:{1:{name:Lang.Hw.port_en+" 1 "+Lang.Hw.port_ko,type:"input",pos:{x:78,y:9}},2:{name:Lang.Hw.port_en+" 2 "+Lang.Hw.port_ko,type:"input", pos:{x:115,y:9}},3:{name:Lang.Hw.port_en+" 3 "+Lang.Hw.port_ko,type:"input",pos:{x:153,y:9}},LMOT:{name:Lang.Hw.left+" "+Lang.Hw.motor,type:"output",pos:{x:78,y:259}},RMOT:{name:Lang.Hw.right+" "+Lang.Hw.motor,type:"output",pos:{x:191,y:259}},note:{name:Lang.Hw.buzzer,type:"output",pos:{x:98,y:184}},SERVO1:{name:Lang.Hw.sub+" "+Lang.Hw.motor+" 1",type:"output",pos:{x:115,y:259}},SERVO2:{name:Lang.Hw.sub+" "+Lang.Hw.motor+" 2",type:"output",pos:{x:191,y:9}}}}}; -Blockly.Blocks.neobot_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["1\ubc88 \ud3ec\ud2b8","1"],["2\ubc88 \ud3ec\ud2b8","2"],["3\ubc88 \ud3ec\ud2b8","3"],["\ub9ac\ubaa8\ucee8","4"]]),"PORT").appendField(" \uac12");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.neobot_sensor_value=function(b,a){var c=a.getStringField("PORT");return Entry.hw.portData[c]}; +Blockly.Blocks.neobot_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["1\ubc88 \ud3ec\ud2b8","1"],["2\ubc88 \ud3ec\ud2b8","2"],["3\ubc88 \ud3ec\ud2b8","3"],["\ub9ac\ubaa8\ucee8","4"]]),"PORT").appendField(" \uac12");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.neobot_sensor_value=function(a,b){var c=b.getStringField("PORT");return Entry.hw.portData[c]}; Blockly.Blocks.neobot_turn_left={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc67c\ucabd\ubaa8\ud130\ub97c").appendField(new Blockly.FieldDropdown([["\uc55e\uc73c\ub85c","1"],["\ub4a4\ub85c","-1"]]),"DIRECTION").appendField(new Blockly.FieldDropdown([["\ub290\ub9ac\uac8c","1"],["\ubcf4\ud1b5","2"],["\ube60\ub974\uac8c","3"]]),"VALUE").appendField("\ud68c\uc804").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0); -this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_turn_left=function(b,a){var c=a.getNumberField("VALUE"),d=a.getNumberField("DIRECTION");Entry.hw.sendQueue.LMOT=c*d;return a.callReturn()}; -Blockly.Blocks.neobot_stop_left={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc67c\ucabd\ubaa8\ud130 \uc815\uc9c0").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_stop_left=function(b,a){Entry.hw.sendQueue.LMOT=0;return a.callReturn()}; +this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_turn_left=function(a,b){var c=b.getNumberField("VALUE"),d=b.getNumberField("DIRECTION");Entry.hw.sendQueue.LMOT=c*d;return b.callReturn()}; +Blockly.Blocks.neobot_stop_left={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc67c\ucabd\ubaa8\ud130 \uc815\uc9c0").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_stop_left=function(a,b){Entry.hw.sendQueue.LMOT=0;return b.callReturn()}; Blockly.Blocks.neobot_turn_right={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc624\ub978\ucabd\ubaa8\ud130\ub97c").appendField(new Blockly.FieldDropdown([["\uc55e\uc73c\ub85c","1"],["\ub4a4\ub85c","-1"]]),"DIRECTION").appendField(new Blockly.FieldDropdown([["\ub290\ub9ac\uac8c","1"],["\ubcf4\ud1b5","2"],["\ube60\ub974\uac8c","3"]]),"VALUE").appendField("\ud68c\uc804").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0); -this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_turn_right=function(b,a){var c=a.getNumberField("VALUE"),d=a.getNumberField("DIRECTION");Entry.hw.sendQueue.RMOT=c*d;return a.callReturn()}; -Blockly.Blocks.neobot_stop_right={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc624\ub978\ucabd\ubaa8\ud130 \uc815\uc9c0").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_stop_right=function(b,a){Entry.hw.sendQueue.RMOT=0;return a.callReturn()}; +this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_turn_right=function(a,b){var c=b.getNumberField("VALUE"),d=b.getNumberField("DIRECTION");Entry.hw.sendQueue.RMOT=c*d;return b.callReturn()}; +Blockly.Blocks.neobot_stop_right={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc624\ub978\ucabd\ubaa8\ud130 \uc815\uc9c0").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_stop_right=function(a,b){Entry.hw.sendQueue.RMOT=0;return b.callReturn()}; Blockly.Blocks.neobot_run_motor={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["\uc591\ucabd","1"],["\uc67c\ucabd","2"],["\uc624\ub978\ucabd","3"]]),"TYPE").appendField("\ubaa8\ud130\ub97c ");this.appendValueInput("DURATION").setCheck(["Number","String"]);this.appendDummyInput().appendField("\ucd08\uac04").appendField(new Blockly.FieldDropdown([["\ub290\ub9ac\uac8c","1"],["\ubcf4\ud1b5","2"],["\ube60\ub974\uac8c","3"]]),"VALUE").appendField(new Blockly.FieldDropdown([["\uc804\uc9c4", "1"],["\ud6c4\uc9c4","2"],["\uc88c\ud68c\uc804","3"],["\uc6b0\ud68c\uc804","4"]]),"DIRECTION").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.neobot_run_motor=function(b,a){if(a.isStart){if(1==a.timeFlag){var c=a.getNumberField("TYPE"),d=a.getNumberField("VALUE");switch(a.getNumberField("DIRECTION")){case 1:Entry.hw.sendQueue.LMOT=d;Entry.hw.sendQueue.RMOT=d;break;case 2:Entry.hw.sendQueue.LMOT=-1*d;Entry.hw.sendQueue.RMOT=-1*d;break;case 3:Entry.hw.sendQueue.LMOT=d;Entry.hw.sendQueue.RMOT=-1*d;break;case 4:Entry.hw.sendQueue.LMOT=-1*d,Entry.hw.sendQueue.RMOT=d}2===c?Entry.hw.sendQueue.RMOT=0:3===c&&(Entry.hw.sendQueue.LMOT= -0);return a}delete a.timeFlag;delete a.isStart;Entry.engine.isContinue=!1;Entry.hw.sendQueue.LMOT=0;Entry.hw.sendQueue.RMOT=0;return a.callReturn()}a.isStart=!0;a.timeFlag=1;c=1E3*a.getNumberValue("DURATION");setTimeout(function(){a.timeFlag=0},c);return a}; +Entry.block.neobot_run_motor=function(a,b){if(b.isStart){if(1==b.timeFlag){var c=b.getNumberField("TYPE"),d=b.getNumberField("VALUE");switch(b.getNumberField("DIRECTION")){case 1:Entry.hw.sendQueue.LMOT=d;Entry.hw.sendQueue.RMOT=d;break;case 2:Entry.hw.sendQueue.LMOT=-1*d;Entry.hw.sendQueue.RMOT=-1*d;break;case 3:Entry.hw.sendQueue.LMOT=d;Entry.hw.sendQueue.RMOT=-1*d;break;case 4:Entry.hw.sendQueue.LMOT=-1*d,Entry.hw.sendQueue.RMOT=d}2===c?Entry.hw.sendQueue.RMOT=0:3===c&&(Entry.hw.sendQueue.LMOT= +0);return b}delete b.timeFlag;delete b.isStart;Entry.engine.isContinue=!1;Entry.hw.sendQueue.LMOT=0;Entry.hw.sendQueue.RMOT=0;return b.callReturn()}b.isStart=!0;b.timeFlag=1;c=1E3*b.getNumberValue("DURATION");setTimeout(function(){b.timeFlag=0},c);return b}; Blockly.Blocks.neobot_servo_1={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("SERVO1\uc5d0 \uc5f0\uacb0\ub41c \uc11c\ubcf4\ubaa8\ud130\ub97c").appendField(new Blockly.FieldDropdown([["\ube60\ub978","3"],["\ubcf4\ud1b5","2"],["\ub290\ub9b0","1"]]),"SPEED").appendField("\uc18d\ub3c4\ub85c").appendField(new Blockly.FieldDropdown([["0\ub3c4","0"],["10\ub3c4","1"],["20\ub3c4","2"],["30\ub3c4","3"],["40\ub3c4","4"],["50\ub3c4","5"],["60\ub3c4","6"],["70\ub3c4","7"],["80\ub3c4", "8"],["90\ub3c4","9"],["100\ub3c4","10"],["110\ub3c4","11"],["120\ub3c4","12"],["130\ub3c4","13"],["140\ub3c4","14"],["150\ub3c4","15"],["160\ub3c4","16"]]),"VALUE").appendField("\ub85c \uc774\ub3d9").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.neobot_servo_1=function(b,a){var c=a.getNumberField("VALUE"),d=a.getNumberField("SPEED");Entry.hw.sendQueue.SERVO1=c;Entry.hw.sendQueue.SERVO1_SPEED=d;return a.callReturn()}; +Entry.block.neobot_servo_1=function(a,b){var c=b.getNumberField("VALUE"),d=b.getNumberField("SPEED");Entry.hw.sendQueue.SERVO1=c;Entry.hw.sendQueue.SERVO1_SPEED=d;return b.callReturn()}; Blockly.Blocks.neobot_servo_2={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("SERVO2\uc5d0 \uc5f0\uacb0\ub41c \uc11c\ubcf4\ubaa8\ud130\ub97c").appendField(new Blockly.FieldDropdown([["\ube60\ub978","3"],["\ubcf4\ud1b5","2"],["\ub290\ub9b0","1"]]),"SPEED").appendField("\uc18d\ub3c4\ub85c").appendField(new Blockly.FieldDropdown([["0\ub3c4","0"],["10\ub3c4","1"],["20\ub3c4","2"],["30\ub3c4","3"],["40\ub3c4","4"],["50\ub3c4","5"],["60\ub3c4","6"],["70\ub3c4","7"],["80\ub3c4", "8"],["90\ub3c4","9"],["100\ub3c4","10"],["110\ub3c4","11"],["120\ub3c4","12"],["130\ub3c4","13"],["140\ub3c4","14"],["150\ub3c4","15"],["160\ub3c4","16"]]),"VALUE").appendField("\ub85c \uc774\ub3d9").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.neobot_servo_2=function(b,a){var c=a.getNumberField("VALUE"),d=a.getNumberField("SPEED");Entry.hw.sendQueue.SERVO2=c;Entry.hw.sendQueue.SERVO2_SPEED=d;return a.callReturn()}; +Entry.block.neobot_servo_2=function(a,b){var c=b.getNumberField("VALUE"),d=b.getNumberField("SPEED");Entry.hw.sendQueue.SERVO2=c;Entry.hw.sendQueue.SERVO2_SPEED=d;return b.callReturn()}; Blockly.Blocks.neobot_play_note_for={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uba5c\ub85c\ub514").appendField(new Blockly.FieldDropdown([[Lang.General.note_c+"","1"],[Lang.General.note_d+"","2"],[Lang.General.note_e+"","3"],[Lang.General.note_f+"","4"],[Lang.General.note_g+"","5"],[Lang.General.note_a+"","6"],[Lang.General.note_b+"","7"],[Lang.General.note_c+"","8"]]),"NOTE").appendField("\uc744(\ub97c)").appendField(new Blockly.FieldDropdown([["1","0"],["2", "1"],["3","2"]]),"OCTAVE").appendField("\uc625\ud0c0\ube0c\ub85c").appendField(new Blockly.FieldDropdown([["2\ubd84\uc74c\ud45c","2"],["4\ubd84\uc74c\ud45c","4"],["8\ubd84\uc74c\ud45c","8"]]),"DURATION");this.appendDummyInput().appendField("\uae38\uc774\ub9cc\ud07c \uc18c\ub9ac\ub0b4\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.neobot_play_note_for=function(b,a){var c=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return a;delete a.timeFlag;delete a.isStart;Entry.engine.isContinue=!1;return a.callReturn()}var d=a.getNumberField("NOTE",a),e=a.getNumberField("OCTAVE",a),f=a.getNumberField("DURATION",a);a.note=d;a.isStart=!0;a.timeFlag=1;c.note=d;c.octave=e;c.duration=f;c.sound_check=(1E5*Math.random()).toFixed(0);setTimeout(function(){a.timeFlag=0},1/f*2E3);return a}; +Entry.block.neobot_play_note_for=function(a,b){var c=Entry.hw.sendQueue;if(b.isStart){if(1==b.timeFlag)return b;delete b.timeFlag;delete b.isStart;Entry.engine.isContinue=!1;return b.callReturn()}var d=b.getNumberField("NOTE",b),e=b.getNumberField("OCTAVE",b),f=b.getNumberField("DURATION",b);b.note=d;b.isStart=!0;b.timeFlag=1;c.note=d;c.octave=e;c.duration=f;c.sound_check=(1E5*Math.random()).toFixed(0);setTimeout(function(){b.timeFlag=0},1/f*2E3);return b}; Blockly.Blocks.neobot_set_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1","O_1"],["2","O_2"]]),"PORT").appendField("\ubc88 \ud3ec\ud2b8\uc758 \uac12\uc744").appendField(new Blockly.FieldDropdown([["\ucf1c\uae30","1"],["\ub044\uae30","0"]]),"VALUE");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.neobot_set_sensor_value=function(b,a){var c=Entry.hw.sendQueue,d=a.getStringField("PORT",a),e=a.getNumberField("VALUE",a);c[d]=e;return a.callReturn()};Entry.Robotis_carCont={INSTRUCTION:{NONE:0,WRITE:3,READ:2},CONTROL_TABLE:{CM_LED:[67,1],CM_SPRING_RIGHT:[69,1,69,2],CM_SPRING_LEFT:[70,1,69,2],CM_SWITCH:[71,1],CM_SOUND_DETECTED:[86,1],CM_SOUND_DETECTING:[87,1],CM_IR_LEFT:[91,2,91,4],CM_IR_RIGHT:[93,2,91,4],CM_CALIBRATION_LEFT:[95,2],CM_CALIBRATION_RIGHT:[97,2],AUX_MOTOR_SPEED_LEFT:[152,2],AUX_MOTOR_SPEED_RIGHT:[154,2]},setZero:function(){this.setRobotisData([[Entry.Robotis_carCont.INSTRUCTION.WRITE,152,2,0],[Entry.Robotis_carCont.INSTRUCTION.WRITE, -154,2,0]]);Entry.hw.sendQueue.setZero=[1];this.update();this.setRobotisData(null);Entry.hw.sendQueue.setZero=null;this.update()},name:"robotis_carCont",delay:40,postCallReturn:function(b,a,c){if(0>=c)return this.setRobotisData(a),this.update(),b.callReturn();if(b.isStart){if(1==b.timeFlag)return this.setRobotisData(null),b;delete b.timeFlag;delete b.isStart;Entry.engine.isContinue=!1;this.update();return b.callReturn()}b.isStart=!0;b.timeFlag=1;this.setRobotisData(a);setTimeout(function(){b.timeFlag= -0},c);return b},wait:function(b,a){Entry.hw.socket.send(JSON.stringify(b));for(var c=(new Date).getTime(),d=c;d=c)return this.setRobotisData(b),this.update(),a.callReturn();if(a.isStart){if(1==a.timeFlag)return this.setRobotisData(null),a;delete a.timeFlag;delete a.isStart;Entry.engine.isContinue=!1;this.update();return a.callReturn()}a.isStart=!0;a.timeFlag=1;this.setRobotisData(b);setTimeout(function(){a.timeFlag= +0},c);return a},wait:function(a,b){Entry.hw.socket.send(JSON.stringify(a));for(var c=(new Date).getTime(),d=c;dd&&(d=0);return Entry.Robotis_carCont.postCallReturn(a,[[e,f+(c-1)*g,g,d]],Entry.Robotis_openCM70.delay)}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.robotis_openCM70_aux_servo_position=function(a,b){var c=b.getField("PORT",b),d=b.getNumberValue("VALUE"),e=Entry.Robotis_openCM70.INSTRUCTION.WRITE,f=0,g=0,f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1];1023d&&(d=0);return Entry.Robotis_carCont.postCallReturn(b,[[e,f+(c-1)*g,g,d]],Entry.Robotis_openCM70.delay)}; Blockly.Blocks.robotis_openCM70_aux_led_module={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.robotis_common_port_3,"3"],[Lang.Blocks.robotis_common_port_4,"4"],[Lang.Blocks.robotis_common_port_5,"5"],[Lang.Blocks.robotis_common_port_6,"6"]]),"PORT").appendField(Lang.Blocks.robotis_openCM70_aux_led_module_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.robotis_cm_led_both+Lang.Blocks.robotis_common_off,"0"],[Lang.Blocks.robotis_cm_led_right+ Lang.Blocks.robotis_common_on,"1"],[Lang.Blocks.robotis_cm_led_left+Lang.Blocks.robotis_common_on,"2"],[Lang.Blocks.robotis_cm_led_both+Lang.Blocks.robotis_common_on,"3"]]),"LED_MODULE");this.appendDummyInput().appendField(Lang.Blocks.robotis_common_set).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.robotis_openCM70_aux_led_module=function(b,a){var c=a.getField("PORT",a),d=a.getField("LED_MODULE",a),e=Entry.Robotis_openCM70.INSTRUCTION.WRITE,f=0,g=0,f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[1];return Entry.Robotis_carCont.postCallReturn(a,[[e,f+(c-1)*g,g,d]],Entry.Robotis_openCM70.delay)}; +Entry.block.robotis_openCM70_aux_led_module=function(a,b){var c=b.getField("PORT",b),d=b.getField("LED_MODULE",b),e=Entry.Robotis_openCM70.INSTRUCTION.WRITE,f=0,g=0,f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[1];return Entry.Robotis_carCont.postCallReturn(b,[[e,f+(c-1)*g,g,d]],Entry.Robotis_openCM70.delay)}; Blockly.Blocks.robotis_openCM70_aux_custom={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.robotis_common_port_3,"3"],[Lang.Blocks.robotis_common_port_4,"4"],[Lang.Blocks.robotis_common_port_5,"5"],[Lang.Blocks.robotis_common_port_6,"6"]]),"PORT").appendField(Lang.Blocks.robotis_openCM70_aux_custom_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.robotis_common_set).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.robotis_openCM70_aux_custom=function(b,a){var c=a.getField("PORT",a),d=a.getNumberValue("VALUE"),e=Entry.Robotis_openCM70.INSTRUCTION.WRITE,f=0,g=0,f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1];return Entry.Robotis_carCont.postCallReturn(a,[[e,f+(c-1)*g,g,d]],Entry.Robotis_openCM70.delay)}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.robotis_openCM70_aux_custom=function(a,b){var c=b.getField("PORT",b),d=b.getNumberValue("VALUE"),e=Entry.Robotis_openCM70.INSTRUCTION.WRITE,f=0,g=0,f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1];return Entry.Robotis_carCont.postCallReturn(b,[[e,f+(c-1)*g,g,d]],Entry.Robotis_openCM70.delay)}; Blockly.Blocks.robotis_openCM70_cm_custom={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.robotis_cm_custom);this.appendDummyInput().appendField("(");this.appendValueInput("ADDRESS").setCheck(["Number","String"]);this.appendDummyInput().appendField(")");this.appendDummyInput().appendField(Lang.Blocks.robotis_common_case_01);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.robotis_common_set).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.robotis_openCM70_cm_custom=function(b,a){var c=Entry.Robotis_openCM70.INSTRUCTION.WRITE,d=0,e=0,d=a.getNumberValue("ADDRESS"),e=a.getNumberValue("VALUE");return Entry.Robotis_carCont.postCallReturn(a,[[c,d,65535c&&(c=0);createjs.Sound.setVolume(c);return a.callReturn()}; +Entry.block.sound_volume_change=function(a,b){var c=b.getNumberValue("VALUE",b)/100,c=c+createjs.Sound.getVolume();1c&&(c=0);createjs.Sound.setVolume(c);return b.callReturn()}; Blockly.Blocks.sound_volume_set={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_volume_set_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_volume_set_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; -Entry.block.sound_volume_set=function(b,a){var c=a.getNumberValue("VALUE",a)/100;1c&&(c=0);createjs.Sound.setVolume(c);return a.callReturn()};Blockly.Blocks.sound_silent_all={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_silent_all).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; -Entry.block.sound_silent_all=function(b,a){createjs.Sound.stop();return a.callReturn()};Blockly.Blocks.get_sounds={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField("");this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("sounds"),"VALUE");this.appendDummyInput().appendField(" ");this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.get_sounds=function(b,a){return a.getStringField("VALUE")}; +Entry.block.sound_volume_set=function(a,b){var c=b.getNumberValue("VALUE",b)/100;1c&&(c=0);createjs.Sound.setVolume(c);return b.callReturn()};Blockly.Blocks.sound_silent_all={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_silent_all).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; +Entry.block.sound_silent_all=function(a,b){createjs.Sound.stop();return b.callReturn()};Blockly.Blocks.get_sounds={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField("");this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("sounds"),"VALUE");this.appendDummyInput().appendField(" ");this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.get_sounds=function(a,b){return b.getStringField("VALUE")}; Blockly.Blocks.sound_something_with_block={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_1);this.appendValueInput("VALUE").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; -Entry.block.sound_something_with_block=function(b,a){var c=a.getStringValue("VALUE",a);(c=b.parent.getSound(c))&&createjs.Sound.play(c.id);return a.callReturn()}; +Entry.block.sound_something_with_block=function(a,b){var c=b.getStringValue("VALUE",b);(c=a.parent.getSound(c))&&createjs.Sound.play(c.id);return b.callReturn()}; Blockly.Blocks.sound_something_second_with_block={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_second_1);this.appendValueInput("VALUE").setCheck(["String","Number"]);this.appendDummyInput().appendField(" ").appendField(Lang.Blocks.SOUND_sound_something_second_2);this.appendValueInput("SECOND").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_second_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}};Entry.block.sound_something_second_with_block=function(b,a){var c=a.getStringValue("VALUE",a),d=a.getNumberValue("SECOND",a);(c=b.parent.getSound(c))&&createjs.Sound.play(c.id,{startTime:0,duration:1E3*d});return a.callReturn()}; +"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}};Entry.block.sound_something_second_with_block=function(a,b){var c=b.getStringValue("VALUE",b),d=b.getNumberValue("SECOND",b);(c=a.parent.getSound(c))&&createjs.Sound.play(c.id,{startTime:0,duration:1E3*d});return b.callReturn()}; Blockly.Blocks.sound_something_wait_with_block={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_wait_1);this.appendValueInput("VALUE").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_wait_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; -Entry.block.sound_something_wait_with_block=function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.playState;delete a.isPlay;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(c=b.parent.getSound(c))createjs.Sound.play(c.id),setTimeout(function(){a.playState=0},1E3*c.duration);return a}; +Entry.block.sound_something_wait_with_block=function(a,b){if(b.isPlay){if(1==b.playState)return b;delete b.playState;delete b.isPlay;return b.callReturn()}b.isPlay=!0;b.playState=1;var c=b.getStringValue("VALUE",b);if(c=a.parent.getSound(c))createjs.Sound.play(c.id),setTimeout(function(){b.playState=0},1E3*c.duration);return b}; Blockly.Blocks.sound_something_second_wait_with_block={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_second_wait_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_second_wait_2).appendField(" ");this.appendValueInput("SECOND").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_second_wait_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ "block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; -Entry.block.sound_something_second_wait_with_block=function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.isPlay;delete a.playState;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(c=b.parent.getSound(c)){var d=createjs.Sound.play(c.id),c=a.getNumberValue("SECOND",a);setTimeout(function(){d.stop();a.playState=0},1E3*c);d.addEventListener("complete",function(a){})}return a}; +Entry.block.sound_something_second_wait_with_block=function(a,b){if(b.isPlay){if(1==b.playState)return b;delete b.isPlay;delete b.playState;return b.callReturn()}b.isPlay=!0;b.playState=1;var c=b.getStringValue("VALUE",b);if(c=a.parent.getSound(c)){var d=createjs.Sound.play(c.id),c=b.getNumberValue("SECOND",b);setTimeout(function(){d.stop();b.playState=0},1E3*c);d.addEventListener("complete",function(b){})}return b}; Blockly.Blocks.sound_from_to={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_2);this.appendValueInput("START").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_3);this.appendValueInput("END").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}};Entry.block.sound_from_to=function(b,a){var c=a.getStringValue("VALUE",a);if(c=b.parent.getSound(c)){var d=1E3*a.getNumberValue("START",a),e=1E3*a.getNumberValue("END",a);createjs.Sound.play(c.id,{startTime:Math.min(d,e),duration:Math.max(d,e)-Math.min(d,e)})}return a.callReturn()}; +"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}};Entry.block.sound_from_to=function(a,b){var c=b.getStringValue("VALUE",b);if(c=a.parent.getSound(c)){var d=1E3*b.getNumberValue("START",b),e=1E3*b.getNumberValue("END",b);createjs.Sound.play(c.id,{startTime:Math.min(d,e),duration:Math.max(d,e)-Math.min(d,e)})}return b.callReturn()}; Blockly.Blocks.sound_from_to_and_wait={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_and_wait_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_and_wait_2);this.appendValueInput("START").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_and_wait_3);this.appendValueInput("END").setCheck(["String","Number"]); this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_and_wait_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; -Entry.block.sound_from_to_and_wait=function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.isPlay;delete a.playState;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(c=b.parent.getSound(c)){var d=1E3*a.getNumberValue("START",a),e=1E3*a.getNumberValue("END",a),f=Math.min(d,e),d=Math.max(d,e)-f;createjs.Sound.play(c.id,{startTime:f,duration:d});setTimeout(function(){a.playState=0},d)}return a};Blockly.Blocks.when_run_button_click={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_play.png","*","start")).appendField(Lang.Blocks.START_when_run_button_click);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_run_button_click=function(b,a){return a.callReturn()}; +Entry.block.sound_from_to_and_wait=function(a,b){if(b.isPlay){if(1==b.playState)return b;delete b.isPlay;delete b.playState;return b.callReturn()}b.isPlay=!0;b.playState=1;var c=b.getStringValue("VALUE",b);if(c=a.parent.getSound(c)){var d=1E3*b.getNumberValue("START",b),e=1E3*b.getNumberValue("END",b),f=Math.min(d,e),d=Math.max(d,e)-f;createjs.Sound.play(c.id,{startTime:f,duration:d});setTimeout(function(){b.playState=0},d)}return b};Blockly.Blocks.when_run_button_click={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_play.png","*","start")).appendField(Lang.Blocks.START_when_run_button_click);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_run_button_click=function(a,b){return b.callReturn()}; Blockly.Blocks.press_some_key={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_keyboard.png","*","start")).appendField(Lang.Blocks.START_press_some_key_1).appendField(new Blockly.FieldDropdown([["q","81"],["w","87"],["e","69"],["r","82"],["a","65"],["s","83"],["d","68"],[Lang.Blocks.START_press_some_key_up,"38"],[Lang.Blocks.START_press_some_key_down,"40"],[Lang.Blocks.START_press_some_key_left,"37"],[Lang.Blocks.START_press_some_key_right, -"39"],[Lang.Blocks.START_press_some_key_enter,"13"],[Lang.Blocks.START_press_some_key_space,"32"]]),"VALUE").appendField(Lang.Blocks.START_press_some_key_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.press_some_key=function(b,a){return a.callReturn()}; -Blockly.Blocks.when_some_key_pressed={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_keyboard.png","*","start")).appendField(Lang.Blocks.START_press_some_key_1).appendField(new Blockly.FieldKeydownInput("81"),"VALUE").appendField(Lang.Blocks.START_press_some_key_2);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_some_key_pressed=function(b,a){return a.callReturn()}; -Blockly.Blocks.mouse_clicked={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_mouse.png","*","start")).appendField(Lang.Blocks.START_mouse_clicked);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.mouse_clicked=function(b,a){return a.callReturn()}; -Blockly.Blocks.mouse_click_cancled={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_mouse.png","*","start")).appendField(Lang.Blocks.START_mouse_click_cancled);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.mouse_click_cancled=function(b,a){return a.callReturn()}; -Blockly.Blocks.when_object_click={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_mouse.png","*","start")).appendField(Lang.Blocks.START_when_object_click);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_object_click=function(b,a){return a.callReturn()}; -Blockly.Blocks.when_object_click_canceled={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_mouse.png","*","start")).appendField(Lang.Blocks.START_when_object_click_canceled);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_object_click_canceled=function(b,a){return a.callReturn()}; -Blockly.Blocks.when_some_key_click={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_keyboard.png","*","start")).appendField(Lang.Blocks.START_when_some_key_click);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_some_key_click=function(b,a){return a.callReturn()}; -Blockly.Blocks.when_message_cast={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_signal.png","*","start")).appendField(Lang.Blocks.START_when_message_cast_1).appendField(new Blockly.FieldDropdownDynamic("messages"),"VALUE").appendField(Lang.Blocks.START_when_message_cast_2);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_message_cast=function(b,a){return a.callReturn()}; +"39"],[Lang.Blocks.START_press_some_key_enter,"13"],[Lang.Blocks.START_press_some_key_space,"32"]]),"VALUE").appendField(Lang.Blocks.START_press_some_key_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.press_some_key=function(a,b){return b.callReturn()}; +Blockly.Blocks.when_some_key_pressed={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_keyboard.png","*","start")).appendField(Lang.Blocks.START_press_some_key_1).appendField(new Blockly.FieldKeydownInput("81"),"VALUE").appendField(Lang.Blocks.START_press_some_key_2);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_some_key_pressed=function(a,b){return b.callReturn()}; +Blockly.Blocks.mouse_clicked={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_mouse.png","*","start")).appendField(Lang.Blocks.START_mouse_clicked);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.mouse_clicked=function(a,b){return b.callReturn()}; +Blockly.Blocks.mouse_click_cancled={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_mouse.png","*","start")).appendField(Lang.Blocks.START_mouse_click_cancled);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.mouse_click_cancled=function(a,b){return b.callReturn()}; +Blockly.Blocks.when_object_click={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_mouse.png","*","start")).appendField(Lang.Blocks.START_when_object_click);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_object_click=function(a,b){return b.callReturn()}; +Blockly.Blocks.when_object_click_canceled={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_mouse.png","*","start")).appendField(Lang.Blocks.START_when_object_click_canceled);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_object_click_canceled=function(a,b){return b.callReturn()}; +Blockly.Blocks.when_some_key_click={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_keyboard.png","*","start")).appendField(Lang.Blocks.START_when_some_key_click);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_some_key_click=function(a,b){return b.callReturn()}; +Blockly.Blocks.when_message_cast={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_signal.png","*","start")).appendField(Lang.Blocks.START_when_message_cast_1).appendField(new Blockly.FieldDropdownDynamic("messages"),"VALUE").appendField(Lang.Blocks.START_when_message_cast_2);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_message_cast=function(a,b){return b.callReturn()}; Blockly.Blocks.message_cast={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(Lang.Blocks.START_message_cast_1).appendField(new Blockly.FieldDropdownDynamic("messages"),"VALUE").appendField(Lang.Blocks.START_message_cast_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_03.png","*"));this.setInputsInline(!0);this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; -Entry.block.message_cast=function(b,a){var c=a.getField("VALUE",a),d=Entry.isExist(c,"id",Entry.variableContainer.messages_);if("null"==c||!d)throw Error("value can not be null or undefined");Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent,["when_message_cast",c]);return a.callReturn()}; -Blockly.Blocks.add_message={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(Lang.Blocks.START_add_message).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_03.png","*"));this.setInputsInline(!0)}};Entry.block.add_massage=function(b,a){return a.callReturn()}; +Entry.block.message_cast=function(a,b){var c=b.getField("VALUE",b),d=Entry.isExist(c,"id",Entry.variableContainer.messages_);if("null"==c||!d)throw Error("value can not be null or undefined");Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent,["when_message_cast",c]);return b.callReturn()}; +Blockly.Blocks.add_message={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(Lang.Blocks.START_add_message).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_03.png","*"));this.setInputsInline(!0)}};Entry.block.add_massage=function(a,b){return b.callReturn()}; Blockly.Blocks.message_cast_wait={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(Lang.Blocks.START_message_send_wait_1).appendField(new Blockly.FieldDropdownDynamic("messages"),"VALUE").appendField(Lang.Blocks.START_message_send_wait_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; -Entry.block.message_cast_wait=function(b,a){if(a.runningScript){if(a.runningScript.length)return Entry.engine.computeFunction(a),a;delete a.runningScript;return a.callReturn()}var c=a.getField("VALUE",a),d=Entry.isExist(c,"id",Entry.variableContainer.messages_);if("null"==c||!d)throw Error("value can not be null or undefined");var e=[];Entry.container.mapEntityIncludeCloneOnScene(function(a,b){for(var c=b[0],d=b[1],l=a.parent.script.childNodes,q=0;qc.array_.length)throw Error("can not remove value from array");c.array_.splice(d-1,1);c.updateView();return a.callReturn()}; +"block_icon/variable_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.remove_value_from_list=function(a,b){var c=b.getField("LIST",b),d=b.getValue("VALUE",b),c=Entry.variableContainer.getList(c,a);if(!c.array_||isNaN(d)||d>c.array_.length)throw Error("can not remove value from array");c.array_.splice(d-1,1);c.updateView();return b.callReturn()}; Blockly.Blocks.insert_value_to_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_insert_value_to_list_1);this.appendValueInput("DATA").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_insert_value_to_list_2);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_insert_value_to_list_3);this.appendValueInput("INDEX").setCheck(["Number", "String"]);this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_insert_value_to_list_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/variable_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.insert_value_to_list=function(b,a){var c=a.getField("LIST",a),d=a.getValue("DATA",a),e=a.getValue("INDEX",a),c=Entry.variableContainer.getList(c,b);if(!c.array_||isNaN(e)||0==e||e>c.array_.length+1)throw Error("can not insert value to array");c.array_.splice(e-1,0,{data:d});c.updateView();return a.callReturn()}; +Entry.block.insert_value_to_list=function(a,b){var c=b.getField("LIST",b),d=b.getValue("DATA",b),e=b.getValue("INDEX",b),c=Entry.variableContainer.getList(c,a);if(!c.array_||isNaN(e)||0==e||e>c.array_.length+1)throw Error("can not insert value to array");c.array_.splice(e-1,0,{data:d});c.updateView();return b.callReturn()}; Blockly.Blocks.change_value_list_index={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_change_value_list_index_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_change_value_list_index_2);this.appendValueInput("INDEX").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_change_value_list_index_3);this.appendValueInput("DATA").setCheck(["Number", "String"]);this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_change_value_list_index_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/variable_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_value_list_index=function(b,a){var c=a.getField("LIST",a),d=a.getValue("DATA",a),e=a.getValue("INDEX",a),c=Entry.variableContainer.getList(c,b);if(!c.array_||isNaN(e)||e>c.array_.length)throw Error("can not insert value to array");c.array_[e-1].data=d;c.updateView();return a.callReturn()}; +Entry.block.change_value_list_index=function(a,b){var c=b.getField("LIST",b),d=b.getValue("DATA",b),e=b.getValue("INDEX",b),c=Entry.variableContainer.getList(c,a);if(!c.array_||isNaN(e)||e>c.array_.length)throw Error("can not insert value to array");c.array_[e-1].data=d;c.updateView();return b.callReturn()}; Blockly.Blocks.value_of_index_from_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_value_of_index_from_list_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_value_of_index_from_list_2);this.appendValueInput("INDEX").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_value_of_index_from_list_3);this.setOutput(!0, -"String");this.setInputsInline(!0)}};Entry.block.value_of_index_from_list=function(b,a){var c=a.getField("LIST",a),d=a.getValue("INDEX",a),c=Entry.variableContainer.getList(c,b),d=Entry.getListRealIndex(d,c);if(!c.array_||isNaN(d)||d>c.array_.length)throw Error("can not insert value to array");return c.array_[d-1].data}; -Blockly.Blocks.length_of_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_length_of_list_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_length_of_list_2);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.length_of_list=function(b,a){var c=a.getField("LIST",a);return Entry.variableContainer.getList(c).array_.length}; +"String");this.setInputsInline(!0)}};Entry.block.value_of_index_from_list=function(a,b){var c=b.getField("LIST",b),d=b.getValue("INDEX",b),c=Entry.variableContainer.getList(c,a),d=Entry.getListRealIndex(d,c);if(!c.array_||isNaN(d)||d>c.array_.length)throw Error("can not insert value to array");return c.array_[d-1].data}; +Blockly.Blocks.length_of_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_length_of_list_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_length_of_list_2);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.length_of_list=function(a,b){var c=b.getField("LIST",b);return Entry.variableContainer.getList(c).array_.length}; Blockly.Blocks.show_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_show_list_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST").appendField(Lang.Blocks.VARIABLE_show_list_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/variable_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.show_list=function(b,a){var c=a.getField("LIST",a);Entry.variableContainer.getList(c).setVisible(!0);return a.callReturn()}; +Entry.block.show_list=function(a,b){var c=b.getField("LIST",b);Entry.variableContainer.getList(c).setVisible(!0);return b.callReturn()}; Blockly.Blocks.hide_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_hide_list_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST").appendField(Lang.Blocks.VARIABLE_hide_list_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/variable_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.hide_list=function(b,a){var c=a.getField("LIST",a);Entry.variableContainer.getList(c).setVisible(!1);return a.callReturn()}; +Entry.block.hide_list=function(a,b){var c=b.getField("LIST",b);Entry.variableContainer.getList(c).setVisible(!1);return b.callReturn()}; Blockly.Blocks.options_for_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField("");this.appendDummyInput("VALUE").appendField(new Blockly.FieldDropdown([[Lang.Blocks.VARIABLE_list_option_first,"FIRST"],[Lang.Blocks.VARIABLE_list_option_last,"LAST"],[Lang.Blocks.VARIABLE_list_option_random,"RANDOM"]]),"OPERATOR");this.appendDummyInput().appendField(" ");this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.options_for_list=function(b,a){return a.getField("OPERATOR",a)}; +Entry.block.options_for_list=function(a,b){return b.getField("OPERATOR",b)}; Blockly.Blocks.set_visible_answer={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_get_canvas_input_value);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.CALC_timer_visible_show,"SHOW"],[Lang.Blocks.CALC_timer_visible_hide,"HIDE"]]),"BOOL");this.appendDummyInput().appendField("").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/variable_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0); -this.setNextStatement(!0)},whenAdd:function(){Entry.container.showProjectAnswer()},whenRemove:function(b){Entry.container.hideProjectAnswer(b)}};Entry.block.set_visible_answer=function(b,a){"HIDE"==a.getField("BOOL",a)?Entry.container.inputValue.setVisible(!1):Entry.container.inputValue.setVisible(!0);return a.callReturn()}; +this.setNextStatement(!0)},whenAdd:function(){Entry.container.showProjectAnswer()},whenRemove:function(a){Entry.container.hideProjectAnswer(a)}};Entry.block.set_visible_answer=function(a,b){"HIDE"==b.getField("BOOL",b)?Entry.container.inputValue.setVisible(!1):Entry.container.inputValue.setVisible(!0);return b.callReturn()}; Blockly.Blocks.is_included_in_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_is_included_in_list_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_is_included_in_list_2);this.appendValueInput("DATA").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_is_included_in_list_3);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; -Entry.block.is_included_in_list=function(b,a){var c=a.getField("LIST",a),d=a.getStringValue("DATA",a),c=Entry.variableContainer.getList(c);if(!c)return!1;for(var c=c.array_,e=0,f=c.length;eb||0>d||b>e||d>e||a.splice.call(this,d,0,a.splice.call(this,b,1)[0])};b.sort=function(){};b.fromJSON=function(){};b.toJSON=function(){for(var a=[],b=0,e=this.length;b/,d;d=b instanceof HTMLElement?$(b):b instanceof jQuery?b:c.test(b)?$(b):$("<"+b+">");if(void 0===a)return d;a.id&&d.attr("id",a.id);a.class&&d.addClass(a.class);a.classes&&a.classes.map(function(a){d.addClass(a)});a.parent&&a.parent.append(d);d.bindOnClick=function(){var a,b,c=function(a){a.stopImmediatePropagation();a.handled||(a.handled=!0,b.call(this,a))};1b.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");a.addClass("entryHidden");this.doneContainer=a;a=Entry.createElement("iframe");a.setAttribute("id","doneProjectframe");a.setAttribute("frameborder",0);a.setAttribute("src","/api/iframe/project/"+b);this.doneProjectFrame=a;this.doneContainer.appendChild(a)};p.getView=function(){return this.doneContainer}; -p.resize=function(){var b=document.getElementById("entryContainerWorkspaceId"),a=document.getElementById("doneProjectframe");w=b.offsetWidth;a.width=w+"px";a.height=9*w/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()||-1a||0>d||a>e||d>e||b.splice.call(this,d,0,b.splice.call(this,a,1)[0])};a.sort=function(){};a.fromJSON=function(){};a.toJSON=function(){for(var b=[],a=0,e=this.length;a/,d;d=a instanceof HTMLElement?$(a):a instanceof jQuery?a:c.test(a)?$(a):$("<"+a+">");if(void 0===b)return d;b.id&&d.attr("id",b.id);b.class&&d.addClass(b.class);b.classes&&b.classes.map(function(b){d.addClass(b)});b.parent&&b.parent.append(d);d.bindOnClick=function(){var b,a,c=function(b){b.stopImmediatePropagation();b.handled||(b.handled=!0,a.call(this,b))};1a.x+a.width+this.width?(this.object.x=a.x+a.width+this.width/2,b+="e"):(this.object.x=a.x-this.width/2,b+="w");this.notch.type!=b&&(this.object.removeChild(this.notch),this.notch=this.createSpeakNotch(b),this.object.addChild(this.notch))}; +Entry.Dialog.prototype.createSpeakNotch=function(a){var b=new createjs.Shape;b.type=a;"ne"==a?b.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"==a?b.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"==a?b.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"==a&&b.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 b};Entry.Dialog.prototype.remove=function(){Entry.stage.unloadDialog(this);this.parent.dialog=null};Entry.DoneProject=function(a){this.generateView(a)};var p=Entry.DoneProject.prototype;p.init=function(a){this.projectId=a};p.generateView=function(a){var b=Entry.createElement("div");b.addClass("entryContainerDoneWorkspace");b.addClass("entryHidden");this.doneContainer=b;b=Entry.createElement("iframe");b.setAttribute("id","doneProjectframe");b.setAttribute("frameborder",0);b.setAttribute("src","/api/iframe/project/"+a);this.doneProjectFrame=b;this.doneContainer.appendChild(b)};p.getView=function(){return this.doneContainer}; +p.resize=function(){var a=document.getElementById("entryContainerWorkspaceId"),b=document.getElementById("doneProjectframe");w=a.offsetWidth;b.width=w+"px";b.height=9*w/16+"px"};Entry.Engine=function(){function a(b){var a=[37,38,39,40,32],d=b.keyCode||b.which,e=Entry.stage.inputField;32==d&&e&&e.hasFocus()||-1c;c++)(function(c){var e=Entry.createElement("td","progressCell"+c);e.bindOnClick(function(){Entry.engine.setSpeedMeter(a[c])});b.appendChild(e)})(c);this.view_.insertBefore(this.speedProgress_,this.maximizeButton);this.speedProgress_.appendChild(b);this.speedHandle_=Entry.createElement("div","entrySpeedHandleWorkspace");c=(Entry.interfaceState.canvasWidth-84)/5;$(this.speedHandle_).draggable({axis:"x",grid:[c,c],containment:[80,0,4*c+80,0],drag:function(a,b){var c=(b.position.left-80)/(Entry.interfaceState.canvasWidth- +Entry.Engine.prototype.toggleSpeedPanel=function(){if(this.speedPanelOn)this.speedPanelOn=!1,$(Entry.stage.canvas.canvas).animate({top:"24px"}),this.coordinateButton.removeClass("entryRemove"),this.maximizeButton.removeClass("entryRemove"),this.mouseView.removeClass("entryRemoveElement"),$(this.speedLabel_).remove(),delete this.speedLabel_,$(this.speedProgress_).fadeOut(null,function(b){$(this).remove();delete this.speedProgress_}),$(this.speedHandle_).remove(),delete this.speedHandle_;else{this.speedPanelOn= +!0;$(Entry.stage.canvas.canvas).animate({top:"41px"});this.coordinateButton.addClass("entryRemove");this.maximizeButton.addClass("entryRemove");this.mouseView.addClass("entryRemoveElement");this.speedLabel_=Entry.createElement("div","entrySpeedLabelWorkspace");this.speedLabel_.innerHTML=Lang.Workspace.speed;this.view_.insertBefore(this.speedLabel_,this.maximizeButton);this.speedProgress_=Entry.createElement("table","entrySpeedProgressWorkspace");for(var a=Entry.createElement("tr"),b=this.speeds,c= +0;5>c;c++)(function(c){var e=Entry.createElement("td","progressCell"+c);e.bindOnClick(function(){Entry.engine.setSpeedMeter(b[c])});a.appendChild(e)})(c);this.view_.insertBefore(this.speedProgress_,this.maximizeButton);this.speedProgress_.appendChild(a);this.speedHandle_=Entry.createElement("div","entrySpeedHandleWorkspace");c=(Entry.interfaceState.canvasWidth-84)/5;$(this.speedHandle_).draggable({axis:"x",grid:[c,c],containment:[80,0,4*c+80,0],drag:function(b,a){var c=(a.position.left-80)/(Entry.interfaceState.canvasWidth- 84)*5,c=Math.floor(c);0>c||Entry.engine.setSpeedMeter(Entry.engine.speeds[c])}});this.view_.insertBefore(this.speedHandle_,this.maximizeButton);this.setSpeedMeter(Entry.FPS)}}; -Entry.Engine.prototype.setSpeedMeter=function(b){var a=this.speeds.indexOf(b);0>a||(a=Math.min(4,a),a=Math.max(0,a),this.speedPanelOn&&(this.speedHandle_.style.left=(Entry.interfaceState.canvasWidth-80)/10*(2*a+1)+80-9+"px"),Entry.FPS!=b&&(clearInterval(this.ticker),this.ticker=setInterval(this.update,Math.floor(1E3/b)),Entry.FPS=b))};Entry.Engine.prototype.start=function(b){createjs.Ticker.setFPS(Entry.FPS);this.ticker=setInterval(this.update,Math.floor(1E3/Entry.FPS))}; +Entry.Engine.prototype.setSpeedMeter=function(a){var b=this.speeds.indexOf(a);0>b||(b=Math.min(4,b),b=Math.max(0,b),this.speedPanelOn&&(this.speedHandle_.style.left=(Entry.interfaceState.canvasWidth-80)/10*(2*b+1)+80-9+"px"),Entry.FPS!=a&&(clearInterval(this.ticker),this.ticker=setInterval(this.update,Math.floor(1E3/a)),Entry.FPS=a))};Entry.Engine.prototype.start=function(a){createjs.Ticker.setFPS(Entry.FPS);this.ticker=setInterval(this.update,Math.floor(1E3/Entry.FPS))}; Entry.Engine.prototype.stop=function(){clearInterval(this.ticker);this.ticker=null};Entry.Engine.prototype.update=function(){Entry.engine.isState("run")&&(Entry.engine.computeObjects(),Entry.hw.update())};Entry.Engine.prototype.computeObjects=function(){Entry.container.mapEntityIncludeCloneOnScene(this.computeFunction)}; -Entry.Engine.prototype.computeFunction=function(b){b=b.runningScript;for(var a=0;aEntry.engine.pressedKeys.indexOf(a)&&Entry.engine.pressedKeys.push(a);b.ctrlKey&&"workspace"==c?83==a?(b.preventDefault(),Entry.dispatchEvent("saveWorkspace")):82==a?(b.preventDefault(),Entry.engine.run()):90==a?(b.preventDefault(),Entry.dispatchEvent(b.shiftKey?"redo":"undo")):48a&&(b.preventDefault(),Entry.playground.selectMenu(a-49)):Entry.engine.isState("run")&&(Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent, -["press_some_key",a]),Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent,["when_some_key_pressed",a]));Entry.engine.isState("stop")&&"workspace"===c&&37<=a&&40>=a&&Entry.stage.moveSprite(b)};Entry.Engine.prototype.captureKeyUpEvent=function(b){b=b.keyCode;0<=Entry.engine.pressedKeys.indexOf(b)&&Entry.engine.pressedKeys.splice(Entry.engine.pressedKeys.indexOf(b),1)}; -Entry.Engine.prototype.raiseKeyEvent=function(b,a){for(var c=a[0],d=a[1],e=b.parent.script.childNodes,f=0;fEntry.engine.pressedKeys.indexOf(b)&&Entry.engine.pressedKeys.push(b);a.ctrlKey&&"workspace"==c?83==b?(a.preventDefault(),Entry.dispatchEvent("saveWorkspace")):82==b?(a.preventDefault(),Entry.engine.run()):90==b?(a.preventDefault(),Entry.dispatchEvent(a.shiftKey?"redo":"undo")):48b&&(a.preventDefault(),Entry.playground.selectMenu(b-49)):Entry.engine.isState("run")&&(Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent, +["press_some_key",b]),Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent,["when_some_key_pressed",b]));Entry.engine.isState("stop")&&"workspace"===c&&37<=b&&40>=b&&Entry.stage.moveSprite(a)};Entry.Engine.prototype.captureKeyUpEvent=function(a){a=a.keyCode;0<=Entry.engine.pressedKeys.indexOf(a)&&Entry.engine.pressedKeys.splice(Entry.engine.pressedKeys.indexOf(a),1)}; +Entry.Engine.prototype.raiseKeyEvent=function(a,b){for(var c=b[0],d=b[1],e=a.parent.script.childNodes,f=0;fthis.direction)==(0<=b&&180>b)||(this.setScaleX(-this.getScaleX()),Entry.stage.updateObject(),this.flip=!this.flip);this.direction=b.mod(360);this.object.direction=this.direction;this.isClone||this.parent.updateRotationView();Entry.dispatchEvent("updateObject")}; -Entry.EntityObject.prototype.setRotation=function(b){"free"!=this.parent.getRotateMethod()&&(b=0);this.rotation=b.mod(360);this.object.rotation=this.rotation;this.updateDialog();this.isClone||this.parent.updateRotationView();Entry.dispatchEvent("updateObject")};Entry.EntityObject.prototype.getRotation=function(){return this.rotation};Entry.EntityObject.prototype.setRegX=function(b){"textBox"==this.type&&(b=0);this.regX=b;this.object.regX=this.regX};Entry.EntityObject.prototype.getRegX=function(){return this.regX}; -Entry.EntityObject.prototype.setRegY=function(b){"textBox"==this.type&&(b=0);this.regY=b;this.object.regY=this.regY};Entry.EntityObject.prototype.getRegY=function(){return this.regY};Entry.EntityObject.prototype.setScaleX=function(b){this.scaleX=b;this.object.scaleX=this.scaleX;this.parent.updateCoordinateView();this.updateDialog()};Entry.EntityObject.prototype.getScaleX=function(){return this.scaleX}; -Entry.EntityObject.prototype.setScaleY=function(b){this.scaleY=b;this.object.scaleY=this.scaleY;this.parent.updateCoordinateView();this.updateDialog()};Entry.EntityObject.prototype.getScaleY=function(){return this.scaleY};Entry.EntityObject.prototype.setSize=function(b){1>b&&(b=1);b/=this.getSize();this.setScaleX(this.getScaleX()*b);this.setScaleY(this.getScaleY()*b);this.isClone||this.parent.updateCoordinateView()}; -Entry.EntityObject.prototype.getSize=function(){return(this.getWidth()*Math.abs(this.getScaleX())+this.getHeight()*Math.abs(this.getScaleY()))/2};Entry.EntityObject.prototype.setWidth=function(b){this.width=b;this.object.width=this.width;this.textObject&&this.getLineBreak()&&(this.textObject.lineWidth=this.width);this.updateDialog();this.updateBG()};Entry.EntityObject.prototype.getWidth=function(){return this.width}; -Entry.EntityObject.prototype.setHeight=function(b){this.height=b;this.textObject&&(this.object.height=this.height,this.alignTextBox());this.updateDialog();this.updateBG()};Entry.EntityObject.prototype.getHeight=function(){return this.height};Entry.EntityObject.prototype.setColour=function(b){b||(b="#000000");this.colour=b;this.textObject&&(this.textObject.color=this.colour)};Entry.EntityObject.prototype.getColour=function(){return this.colour}; -Entry.EntityObject.prototype.setBGColour=function(b){b||(b="transparent");this.bgColor=b;this.updateBG()};Entry.EntityObject.prototype.getBGColour=function(){return this.bgColor};Entry.EntityObject.prototype.setUnderLine=function(b){void 0===b&&(b=!1);this.underLine=b;this.textObject.underLine=b};Entry.EntityObject.prototype.getUnderLine=function(){return this.underLine};Entry.EntityObject.prototype.setStrike=function(b){void 0===b&&(b=!1);this.strike=b;this.textObject.strike=b}; -Entry.EntityObject.prototype.getStrike=function(){return this.strike};Entry.EntityObject.prototype.getFont=function(){var b=[];this.fontBold&&b.push("bold");this.fontItalic&&b.push("italic");b.push(this.getFontSize()+"px");b.push(this.fontType);return b.join(" ")}; -Entry.EntityObject.prototype.setFont=function(b){if("textBox"==this.parent.objectType&&this.font!==b){b||(b="20px Nanum Gothic");var a=b.split(" "),c=0;if(c=-1=h?e=[1,0,0,0,0,0,g,f,0,0,0,-1*f,g,0,0,0,0,0,1,0,0,0,0,0,1]:.66>=h?e=[g,0,f,0,0,0,1,0,0,0,f,0,g,0,0,0,0,0,1,0,0,0,0,0,1]:.99>=h&&(e=[g,f,0,0,0,-1*f,g,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1]);e=(new createjs.ColorMatrix).concat(e);e=new createjs.ColorMatrixFilter(e);c.push(e);b.alpha=a.alpha=d(a.alpha,0,1);b.filters=c;b.cache(0,0,this.getWidth(),this.getHeight())}; +Entry.EntityObject.prototype.restoreEntity=function(a){var b=this.toJSON();this.syncModel_(a);Entry.dispatchEvent("updateObject");Entry.stateManager&&Entry.stateManager.addCommand("restore object",this,this.restoreEntity,b)};Entry.EntityObject.prototype.clearScript=function(a){for(;this.runningScript.length;)this.runningScript.pop()};Entry.EntityObject.prototype.setX=function(a){"number"==typeof a&&(this.x=a,this.object.x=this.x,this.isClone||this.parent.updateCoordinateView(),this.updateDialog())}; +Entry.EntityObject.prototype.getX=function(){return this.x};Entry.EntityObject.prototype.setY=function(a){"number"==typeof a&&(this.y=a,this.object.y=-this.y,this.isClone||this.parent.updateCoordinateView(),this.updateDialog())};Entry.EntityObject.prototype.getY=function(){return this.y};Entry.EntityObject.prototype.getDirection=function(){return this.direction}; +Entry.EntityObject.prototype.setDirection=function(a,b){a||(a=0);"vertical"!=this.parent.getRotateMethod()||b||(0<=this.direction&&180>this.direction)==(0<=a&&180>a)||(this.setScaleX(-this.getScaleX()),Entry.stage.updateObject(),this.flip=!this.flip);this.direction=a.mod(360);this.object.direction=this.direction;this.isClone||this.parent.updateRotationView();Entry.dispatchEvent("updateObject")}; +Entry.EntityObject.prototype.setRotation=function(a){"free"!=this.parent.getRotateMethod()&&(a=0);this.rotation=a.mod(360);this.object.rotation=this.rotation;this.updateDialog();this.isClone||this.parent.updateRotationView();Entry.dispatchEvent("updateObject")};Entry.EntityObject.prototype.getRotation=function(){return this.rotation};Entry.EntityObject.prototype.setRegX=function(a){"textBox"==this.type&&(a=0);this.regX=a;this.object.regX=this.regX};Entry.EntityObject.prototype.getRegX=function(){return this.regX}; +Entry.EntityObject.prototype.setRegY=function(a){"textBox"==this.type&&(a=0);this.regY=a;this.object.regY=this.regY};Entry.EntityObject.prototype.getRegY=function(){return this.regY};Entry.EntityObject.prototype.setScaleX=function(a){this.scaleX=a;this.object.scaleX=this.scaleX;this.parent.updateCoordinateView();this.updateDialog()};Entry.EntityObject.prototype.getScaleX=function(){return this.scaleX}; +Entry.EntityObject.prototype.setScaleY=function(a){this.scaleY=a;this.object.scaleY=this.scaleY;this.parent.updateCoordinateView();this.updateDialog()};Entry.EntityObject.prototype.getScaleY=function(){return this.scaleY};Entry.EntityObject.prototype.setSize=function(a){1>a&&(a=1);a/=this.getSize();this.setScaleX(this.getScaleX()*a);this.setScaleY(this.getScaleY()*a);this.isClone||this.parent.updateCoordinateView()}; +Entry.EntityObject.prototype.getSize=function(){return(this.getWidth()*Math.abs(this.getScaleX())+this.getHeight()*Math.abs(this.getScaleY()))/2};Entry.EntityObject.prototype.setWidth=function(a){this.width=a;this.object.width=this.width;this.textObject&&this.getLineBreak()&&(this.textObject.lineWidth=this.width);this.updateDialog();this.updateBG()};Entry.EntityObject.prototype.getWidth=function(){return this.width}; +Entry.EntityObject.prototype.setHeight=function(a){this.height=a;this.textObject&&(this.object.height=this.height,this.alignTextBox());this.updateDialog();this.updateBG()};Entry.EntityObject.prototype.getHeight=function(){return this.height};Entry.EntityObject.prototype.setColour=function(a){a||(a="#000000");this.colour=a;this.textObject&&(this.textObject.color=this.colour)};Entry.EntityObject.prototype.getColour=function(){return this.colour}; +Entry.EntityObject.prototype.setBGColour=function(a){a||(a="transparent");this.bgColor=a;this.updateBG()};Entry.EntityObject.prototype.getBGColour=function(){return this.bgColor};Entry.EntityObject.prototype.setUnderLine=function(a){void 0===a&&(a=!1);this.underLine=a;this.textObject.underLine=a};Entry.EntityObject.prototype.getUnderLine=function(){return this.underLine};Entry.EntityObject.prototype.setStrike=function(a){void 0===a&&(a=!1);this.strike=a;this.textObject.strike=a}; +Entry.EntityObject.prototype.getStrike=function(){return this.strike};Entry.EntityObject.prototype.getFont=function(){var a=[];this.fontBold&&a.push("bold");this.fontItalic&&a.push("italic");a.push(this.getFontSize()+"px");a.push(this.fontType);return a.join(" ")}; +Entry.EntityObject.prototype.setFont=function(a){if("textBox"==this.parent.objectType&&this.font!==a){a||(a="20px Nanum Gothic");var b=a.split(" "),c=0;if(c=-1=h?e=[1,0,0,0,0,0,g,f,0,0,0,-1*f,g,0,0,0,0,0,1,0,0,0,0,0,1]:.66>=h?e=[g,0,f,0,0,0,1,0,0,0,f,0,g,0,0,0,0,0,1,0,0,0,0,0,1]:.99>=h&&(e=[g,f,0,0,0,-1*f,g,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1]);e=(new createjs.ColorMatrix).concat(e);e=new createjs.ColorMatrixFilter(e);c.push(e);a.alpha=b.alpha=d(b.alpha,0,1);a.filters=c;a.cache(0,0,this.getWidth(),this.getHeight())}; 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.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.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.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={blur:0,hue:0,hsv:0,brightness:0,contrast:0,saturation:0,alpha:1}}; +Entry.EntityObject.prototype.loadSnapshot=function(){this.snapshot_&&this.syncModel_(this.snapshot_);"sprite"==this.parent.objectType&&this.setImage(this.parent.getPicture())};Entry.EntityObject.prototype.removeClone=function(){if(this.isClone){this.dialog&&this.dialog.remove();this.brush&&this.removeBrush();Entry.stage.unloadEntity(this);var a=this.parent.clonedEntities.indexOf(this);this.parent.clonedEntities.splice(a,1)}}; +Entry.EntityObject.prototype.toJSON=function(){var a={};a.x=Entry.cutDecimal(this.getX());a.y=Entry.cutDecimal(this.getY());a.regX=Entry.cutDecimal(this.getRegX());a.regY=Entry.cutDecimal(this.getRegY());a.scaleX=this.getScaleX();a.scaleY=this.getScaleY();a.rotation=Entry.cutDecimal(this.getRotation());a.direction=Entry.cutDecimal(this.getDirection());a.width=Entry.cutDecimal(this.getWidth());a.height=Entry.cutDecimal(this.getHeight());a.font=this.getFont();a.visible=this.getVisible();"textBox"== +this.parent.objectType&&(a.colour=this.getColour(),a.text=this.getText(),a.textAlign=this.getTextAlign(),a.lineBreak=this.getLineBreak(),a.bgColor=this.getBGColour(),a.underLine=this.getUnderLine(),a.strike=this.getStrike(),a.fontSize=this.getFontSize());return a};Entry.EntityObject.prototype.setInitialEffectValue=function(){this.effect={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}; -Entry.EntityObject.prototype.updateBG=function(){if(this.bgObject){this.bgObject.graphics.clear();var b=this.getWidth(),a=this.getHeight();this.bgObject.graphics.setStrokeStyle(1).beginStroke().beginFill(this.getBGColour()).drawRect(-b/2,-a/2,b,a);if(this.getLineBreak())this.bgObject.x=0;else switch(this.getTextAlign()){case Entry.TEXT_ALIGN_LEFT:this.bgObject.x=b/2;break;case Entry.TEXT_ALIGN_CENTER:this.bgObject.x=0;break;case Entry.TEXT_ALIGN_RIGHT:this.bgObject.x=-b/2}}}; -Entry.EntityObject.prototype.alignTextBox=function(){if("textBox"==this.type){var b=this.textObject;if(this.lineBreak){var a=b.getMeasuredLineHeight();b.y=a/2-this.getHeight()/2;switch(this.textAlign){case Entry.TEXT_ALIGN_CENTER:b.x=0;break;case Entry.TEXT_ALIGN_LEFT:b.x=-this.getWidth()/2;break;case Entry.TEXT_ALIGN_RIGHT:b.x=this.getWidth()/2}b.maxHeight=this.getHeight()}else b.x=0,b.y=0}};Entry.EntityObject.prototype.syncDialogVisible=function(){this.dialog&&(this.dialog.object.visible=this.visible)};Entry.Helper=function(){this.generateView()};p=Entry.Helper.prototype; -p.generateView=function(){this.blockHelpData=EntryStatic.blockInfo;var b=Entry.createElement("div","entryBlockHelperWorkspace");this._view=b;Entry.isForLecture&&b.addClass("lecture");var a=Entry.createElement("div","entryBlockHelperHeaderWorkspace");a.innerHTML=Lang.Helper.Block_info;b.appendChild(a);a=Entry.createElement("div","entryBlockHelperContentWorkspace");a.addClass("entryBlockHelperIntro");Entry.isForLecture&&a.addClass("lecture");b.appendChild(a);this.blockHelperContent_=a;this.blockHelperView_= -b;b=Entry.createElement("div","entryBlockHelperBlockWorkspace");this.blockMenu_=new Blockly.BlockMenu(b);this.blockMenu_.isViewOnly=!0;this.blockMenu_.isCenterAlign=!0;this.blockHelperContent_.appendChild(b);b=Entry.createElement("div","entryBlockHelperDescriptionWorkspace");this.blockHelperContent_.appendChild(b);b.innerHTML=Lang.Helper.Block_click_msg;this.blockHelperDescription_=b;this.first=!0};p.getView=function(){this.bindEvent();return this._view}; +Entry.EntityObject.prototype.updateBG=function(){if(this.bgObject){this.bgObject.graphics.clear();var a=this.getWidth(),b=this.getHeight();this.bgObject.graphics.setStrokeStyle(1).beginStroke().beginFill(this.getBGColour()).drawRect(-a/2,-b/2,a,b);if(this.getLineBreak())this.bgObject.x=0;else switch(this.getTextAlign()){case Entry.TEXT_ALIGN_LEFT:this.bgObject.x=a/2;break;case Entry.TEXT_ALIGN_CENTER:this.bgObject.x=0;break;case Entry.TEXT_ALIGN_RIGHT:this.bgObject.x=-a/2}}}; +Entry.EntityObject.prototype.alignTextBox=function(){if("textBox"==this.type){var a=this.textObject;if(this.lineBreak){var b=a.getMeasuredLineHeight();a.y=b/2-this.getHeight()/2;switch(this.textAlign){case Entry.TEXT_ALIGN_CENTER:a.x=0;break;case Entry.TEXT_ALIGN_LEFT:a.x=-this.getWidth()/2;break;case Entry.TEXT_ALIGN_RIGHT:a.x=this.getWidth()/2}a.maxHeight=this.getHeight()}else a.x=0,a.y=0}};Entry.EntityObject.prototype.syncDialogVisible=function(){this.dialog&&(this.dialog.object.visible=this.visible)};Entry.Helper=function(){this.generateView()};p=Entry.Helper.prototype; +p.generateView=function(){this.blockHelpData=EntryStatic.blockInfo;var a=Entry.createElement("div","entryBlockHelperWorkspace");this._view=a;Entry.isForLecture&&a.addClass("lecture");var b=Entry.createElement("div","entryBlockHelperHeaderWorkspace");b.innerHTML=Lang.Helper.Block_info;a.appendChild(b);b=Entry.createElement("div","entryBlockHelperContentWorkspace");b.addClass("entryBlockHelperIntro");Entry.isForLecture&&b.addClass("lecture");a.appendChild(b);this.blockHelperContent_=b;this.blockHelperView_= +a;a=Entry.createElement("div","entryBlockHelperBlockWorkspace");this.blockMenu_=new Blockly.BlockMenu(a);this.blockMenu_.isViewOnly=!0;this.blockMenu_.isCenterAlign=!0;this.blockHelperContent_.appendChild(a);a=Entry.createElement("div","entryBlockHelperDescriptionWorkspace");this.blockHelperContent_.appendChild(a);a.innerHTML=Lang.Helper.Block_click_msg;this.blockHelperDescription_=a;this.first=!0};p.getView=function(){this.bindEvent();return this._view}; p.bindEvent=function(){this.blockChangeEvent||(this.blockChangeEvent=Blockly.bindEvent_(Blockly.mainWorkspace.getCanvas(),"blocklySelectChange",this,this.updateSelectedBlock),Entry.playground.blockMenu&&(this.menuBlockChangeEvent=Blockly.bindEvent_(Entry.playground.blockMenu.workspace_.getCanvas(),"blocklySelectChange",this,this.updateSelectedBlock)))};p.updateSelectedBlock=function(){Blockly.selected&&(this.first&&(this.blockHelperContent_.removeClass("entryBlockHelperIntro"),this.first=!1),this.renderBlock(Blockly.selected.type))}; -p.renderBlock=function(b){var a=this.blockHelpData[b];a&&(a=jQuery.parseXML(a.xml),a=this.blockMenu_.show(a.childNodes),this.blockHelperDescription_.innerHTML=Entry.makeAutolink(Lang.Helper[b]),$(this.blockHelperDescription_).css({top:a+40}))};Entry.Activity=function(b,a){this.name=b;this.timestamp=new Date;var c=[];if(void 0!==a)for(var d=0,e=a.length;d");this.pictures=b.sprite.pictures;this.sounds=[];this.sounds=b.sprite.sounds;for(var a=0;a");this.pictures=a.sprite.pictures;this.sounds=[];this.sounds=a.sprite.sounds;for(var b=0;bthis.pictures.length)return!1;b=this.getPicture(b);var a=this.pictures.indexOf(b);Entry.stateManager&&Entry.stateManager.addCommand("remove sprite",this,this.addPicture,b,a);this.pictures.splice(a,1);b===this.selectedPicture&&Entry.playground.selectPicture(this.pictures[0]);Entry.playground.injectPicture(this);Entry.playground.reloadPlayground();return new Entry.State(this,this.addPicture,b,a)}; -Entry.EntryObject.prototype.getPicture=function(b){if(!b)return this.selectedPicture;b=b.trim();for(var a=this.pictures,c=a.length,d=0;d=b&&0Entry.maxCloneLimit||(b=new Entry.EntityObject(this),a?(b.injectModel(a.picture?a.picture:null,a.toJSON()),b.snapshot_=a.snapshot_,a.effect&&(b.effect=Entry.cloneSimpleObject(a.effect),b.applyFilter()),a.brush&&Entry.setCloneBrush(b,a.brush)):(b.injectModel(this.entity.picture?this.entity.picture:null,this.entity.toJSON(b)),b.snapshot_=this.entity.snapshot_,this.entity.effect&&(b.effect=Entry.cloneSimpleObject(this.entity.effect), -b.applyFilter()),this.entity.brush&&Entry.setCloneBrush(b,this.entity.brush)),Entry.engine.raiseEventOnEntity(b,[b,"when_clone_start"]),b.isClone=!0,b.isStarted=!0,this.addCloneVariables(this,b,a?a.variables:null,a?a.lists:null),this.clonedEntities.push(b),Entry.stage.loadEntity(b))}; -Entry.EntryObject.prototype.initializeSplitter=function(b){b.onmousedown=function(a){Entry.container.disableSort();Entry.container.splitterEnable=!0};document.addEventListener("mousemove",function(a){Entry.container.splitterEnable&&Entry.resizeElement({canvasWidth:a.x||a.clientX})});document.addEventListener("mouseup",function(a){Entry.container.splitterEnable=!1;Entry.container.enableSort()})};Entry.EntryObject.prototype.isSelected=function(){return this.isSelected_}; -Entry.EntryObject.prototype.toJSON=function(){var b={};b.id=this.id;b.name=this.name;"textBox"==this.objectType&&(b.text=this.text);b.script=this.getScriptText();"sprite"==this.objectType&&(b.selectedPictureId=this.selectedPicture.id);b.objectType=this.objectType;b.rotateMethod=this.getRotateMethod();b.scene=this.scene.id;b.sprite={pictures:Entry.getPicturesJSON(this.pictures),sounds:Entry.getSoundsJSON(this.sounds)};b.lock=this.lock;b.entity=this.entity.toJSON();return b}; -Entry.EntryObject.prototype.destroy=function(){Entry.stage.unloadEntity(this.entity);this.view_&&Entry.removeElement(this.view_)};Entry.EntryObject.prototype.getSound=function(b){b=b.trim();for(var a=this.sounds,c=a.length,d=0;d=b&&0this.pictures.length)return!1;a=this.getPicture(a);var b=this.pictures.indexOf(a);Entry.stateManager&&Entry.stateManager.addCommand("remove sprite",this,this.addPicture,a,b);this.pictures.splice(b,1);a===this.selectedPicture&&Entry.playground.selectPicture(this.pictures[0]);Entry.playground.injectPicture(this);Entry.playground.reloadPlayground();return new Entry.State(this,this.addPicture,a,b)}; +Entry.EntryObject.prototype.getPicture=function(a){if(!a)return this.selectedPicture;a=a.trim();for(var b=this.pictures,c=b.length,d=0;d=a&&0Entry.maxCloneLimit||(a=new Entry.EntityObject(this),b?(a.injectModel(b.picture?b.picture:null,b.toJSON()),a.snapshot_=b.snapshot_,b.effect&&(a.effect=Entry.cloneSimpleObject(b.effect),a.applyFilter()),b.brush&&Entry.setCloneBrush(a,b.brush)):(a.injectModel(this.entity.picture?this.entity.picture:null,this.entity.toJSON(a)),a.snapshot_=this.entity.snapshot_,this.entity.effect&&(a.effect=Entry.cloneSimpleObject(this.entity.effect), +a.applyFilter()),this.entity.brush&&Entry.setCloneBrush(a,this.entity.brush)),Entry.engine.raiseEventOnEntity(a,[a,"when_clone_start"]),a.isClone=!0,a.isStarted=!0,this.addCloneVariables(this,a,b?b.variables:null,b?b.lists:null),this.clonedEntities.push(a),Entry.stage.loadEntity(a))}; +Entry.EntryObject.prototype.initializeSplitter=function(a){a.onmousedown=function(b){Entry.container.disableSort();Entry.container.splitterEnable=!0};document.addEventListener("mousemove",function(b){Entry.container.splitterEnable&&Entry.resizeElement({canvasWidth:b.x||b.clientX})});document.addEventListener("mouseup",function(b){Entry.container.splitterEnable=!1;Entry.container.enableSort()})};Entry.EntryObject.prototype.isSelected=function(){return this.isSelected_}; +Entry.EntryObject.prototype.toJSON=function(){var a={};a.id=this.id;a.name=this.name;"textBox"==this.objectType&&(a.text=this.text);a.script=this.getScriptText();"sprite"==this.objectType&&(a.selectedPictureId=this.selectedPicture.id);a.objectType=this.objectType;a.rotateMethod=this.getRotateMethod();a.scene=this.scene.id;a.sprite={pictures:Entry.getPicturesJSON(this.pictures),sounds:Entry.getSoundsJSON(this.sounds)};a.lock=this.lock;a.entity=this.entity.toJSON();return a}; +Entry.EntryObject.prototype.destroy=function(){Entry.stage.unloadEntity(this.entity);this.view_&&Entry.removeElement(this.view_)};Entry.EntryObject.prototype.getSound=function(a){a=a.trim();for(var b=this.sounds,c=b.length,d=0;d=a&&0=a-e/100*a&&f<=a+e/100*a&&g>=c-e/100*c&&g<=c+e/100*c&&b>=d-e/100*d&&b<=d+e/100*d};Entry.Painter.prototype.matchColorOnly=function(b,a,c,d){return a===this.colorLayerData.data[b]&&c===this.colorLayerData.data[b+1]&&d===this.colorLayerData.data[b+2]?!0:!1}; -Entry.Painter.prototype.matchColor=function(b,a,c,d,e){return a===this.colorLayerData.data[b]&&c===this.colorLayerData.data[b+1]&&d===this.colorLayerData.data[b+2]&&e===this.colorLayerData.data[b+3]?!0:!1};Entry.Painter.prototype.colorPixel=function(b,a,c,d,e){e||(e=255);this.stroke.transparent&&(e=d=c=a=0);this.colorLayerData.data[b]=a;this.colorLayerData.data[b+1]=c;this.colorLayerData.data[b+2]=d;this.colorLayerData.data[b+3]=e}; -Entry.Painter.prototype.pickStrokeColor=function(b){b=4*(Math.round(b.stageY)*this.canvas.width+Math.round(b.stageX));this.stroke.lineColor=Entry.rgb2hex(this.colorLayerData.data[b],this.colorLayerData.data[b+1],this.colorLayerData.data[b+2]);document.getElementById("entryPainterAttrCircle").style.backgroundColor=this.stroke.lineColor;document.getElementById("entryPainterAttrCircleInput").value=this.stroke.lineColor}; -Entry.Painter.prototype.drawText=function(b){var a=document.getElementById("entryPainterAttrFontStyle").value,c=document.getElementById("entryPainterAttrFontName").value,d=document.getElementById("entryPainterAttrFontSize").value;b=new createjs.Text(b,a+" "+d+'px "'+c+'"',this.stroke.lineColor);b.textBaseline="top";b.x=this.oldPt.x;b.y=this.oldPt.y;this.objectContainer.addChild(b);this.selectTextObject(b);this.file.modified=!0}; -Entry.Painter.prototype.addImage=function(b){var a=new createjs.Bitmap(b);this.objectContainer.addChild(a);a.x=this.stage.canvas.width/2;a.y=this.stage.canvas.height/2;a.regX=a.image.width/2|0;a.regY=a.image.height/2|0;if(540=b-e/100*b&&f<=b+e/100*b&&g>=c-e/100*c&&g<=c+e/100*c&&a>=d-e/100*d&&a<=d+e/100*d};Entry.Painter.prototype.matchColorOnly=function(a,b,c,d){return b===this.colorLayerData.data[a]&&c===this.colorLayerData.data[a+1]&&d===this.colorLayerData.data[a+2]?!0:!1}; +Entry.Painter.prototype.matchColor=function(a,b,c,d,e){return b===this.colorLayerData.data[a]&&c===this.colorLayerData.data[a+1]&&d===this.colorLayerData.data[a+2]&&e===this.colorLayerData.data[a+3]?!0:!1};Entry.Painter.prototype.colorPixel=function(a,b,c,d,e){e||(e=255);this.stroke.transparent&&(e=d=c=b=0);this.colorLayerData.data[a]=b;this.colorLayerData.data[a+1]=c;this.colorLayerData.data[a+2]=d;this.colorLayerData.data[a+3]=e}; +Entry.Painter.prototype.pickStrokeColor=function(a){a=4*(Math.round(a.stageY)*this.canvas.width+Math.round(a.stageX));this.stroke.lineColor=Entry.rgb2hex(this.colorLayerData.data[a],this.colorLayerData.data[a+1],this.colorLayerData.data[a+2]);document.getElementById("entryPainterAttrCircle").style.backgroundColor=this.stroke.lineColor;document.getElementById("entryPainterAttrCircleInput").value=this.stroke.lineColor}; +Entry.Painter.prototype.drawText=function(a){var b=document.getElementById("entryPainterAttrFontStyle").value,c=document.getElementById("entryPainterAttrFontName").value,d=document.getElementById("entryPainterAttrFontSize").value;a=new createjs.Text(a,b+" "+d+'px "'+c+'"',this.stroke.lineColor);a.textBaseline="top";a.x=this.oldPt.x;a.y=this.oldPt.y;this.objectContainer.addChild(a);this.selectTextObject(a);this.file.modified=!0}; +Entry.Painter.prototype.addImage=function(a){var b=new createjs.Bitmap(a);this.objectContainer.addChild(b);b.x=this.stage.canvas.width/2;b.y=this.stage.canvas.height/2;b.regX=b.image.width/2|0;b.regY=b.image.height/2|0;if(540>1,this.oldPt.y+this.stage.mouseY>>1);this.brush.graphics.setStrokeStyle(this.stroke.thickness,"round").beginStroke(this.stroke.lineColor).moveTo(b.x,b.y).curveTo(this.oldPt.x,this.oldPt.y,this.oldMidPt.x,this.oldMidPt.y);this.oldPt.x=this.stage.mouseX;this.oldPt.y=this.stage.mouseY;this.oldMidPt.x=b.x;this.oldMidPt.y=b.y;this.file.modified=!0;this.stage.update()}; +Entry.Painter.prototype.fill=function(){if(!this.stroke.locked){this.stroke.locked=!0;this.initCommand();this.doCommand();this.clearHandle();var a=this.canvas.width,b=this.canvas.height;this.colorLayerData=this.ctx.getImageData(0,0,a,b);var c=new createjs.Point(this.stage.mouseX,this.stage.mouseY);c.x=Math.round(c.x);c.y=Math.round(c.y);for(var d=4*(c.y*a+c.x),e=this.colorLayerData.data[d],f=this.colorLayerData.data[d+1],g=this.colorLayerData.data[d+2],h=this.colorLayerData.data[d+3],k,l,c=[[c.x, +c.y]],q=Entry.hex2rgb(this.stroke.lineColor);c.length;){for(var d=c.pop(),n=d[0],m=d[1],d=4*(m*a+n);0<=m&&this.matchColor(d,e,f,g,h);)--m,d-=4*a;d+=4*a;m+=1;for(l=k=!1;m>1,this.oldPt.y+this.stage.mouseY>>1);this.brush.graphics.setStrokeStyle(this.stroke.thickness,"round").beginStroke(this.stroke.lineColor).moveTo(a.x,a.y).curveTo(this.oldPt.x,this.oldPt.y,this.oldMidPt.x,this.oldMidPt.y);this.oldPt.x=this.stage.mouseX;this.oldPt.y=this.stage.mouseY;this.oldMidPt.x=a.x;this.oldMidPt.y=a.y;this.file.modified=!0;this.stage.update()}; Entry.Painter.prototype.move_line=function(){this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").moveTo(this.oldPt.x,this.oldPt.y).lineTo(this.stage.mouseX,this.stage.mouseY);this.file.modified=!0;this.stage.update()}; -Entry.Painter.prototype.move_rect=function(){var b=this.stage.mouseX-this.oldPt.x,a=this.stage.mouseY-this.oldPt.y;event.shiftKey&&(a=b);this.stroke.fill?0===this.stroke.thickness?this.brush.graphics.clear().setStrokeStyle(this.stroke.thickness,"round").beginFill(this.stroke.fillColor).drawRect(this.oldPt.x,this.oldPt.y,b,a):this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").beginFill(this.stroke.fillColor).drawRect(this.oldPt.x,this.oldPt.y, -b,a):0===this.stroke.thickness?this.brush.graphics.clear().setStrokeStyle(this.stroke.thickness,"round").drawRect(this.oldPt.x,this.oldPt.y,b,a):this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").drawRect(this.oldPt.x,this.oldPt.y,b,a);this.file.modified=!0;this.stage.update()}; -Entry.Painter.prototype.move_circle=function(){var b=this.stage.mouseX-this.oldPt.x,a=this.stage.mouseY-this.oldPt.y;event.shiftKey&&(a=b);this.stroke.fill?0===this.stroke.thickness?this.brush.graphics.clear().beginStroke(this.stroke.fillColor).setStrokeStyle(this.stroke.thickness,"round").beginFill(this.stroke.fillColor).drawEllipse(this.oldPt.x,this.oldPt.y,b,a):this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").beginFill(this.stroke.fillColor).drawEllipse(this.oldPt.x, -this.oldPt.y,b,a):this.stroke.fill||(0===this.stroke.thickness?this.brush.graphics.clear().drawEllipse(this.oldPt.x,this.oldPt.y,b,a):this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").drawEllipse(this.oldPt.x,this.oldPt.y,b,a));this.file.modified=!0;this.stage.update()}; +Entry.Painter.prototype.move_rect=function(){var a=this.stage.mouseX-this.oldPt.x,b=this.stage.mouseY-this.oldPt.y;event.shiftKey&&(b=a);this.stroke.fill?0===this.stroke.thickness?this.brush.graphics.clear().setStrokeStyle(this.stroke.thickness,"round").beginFill(this.stroke.fillColor).drawRect(this.oldPt.x,this.oldPt.y,a,b):this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").beginFill(this.stroke.fillColor).drawRect(this.oldPt.x,this.oldPt.y, +a,b):0===this.stroke.thickness?this.brush.graphics.clear().setStrokeStyle(this.stroke.thickness,"round").drawRect(this.oldPt.x,this.oldPt.y,a,b):this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").drawRect(this.oldPt.x,this.oldPt.y,a,b);this.file.modified=!0;this.stage.update()}; +Entry.Painter.prototype.move_circle=function(){var a=this.stage.mouseX-this.oldPt.x,b=this.stage.mouseY-this.oldPt.y;event.shiftKey&&(b=a);this.stroke.fill?0===this.stroke.thickness?this.brush.graphics.clear().beginStroke(this.stroke.fillColor).setStrokeStyle(this.stroke.thickness,"round").beginFill(this.stroke.fillColor).drawEllipse(this.oldPt.x,this.oldPt.y,a,b):this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").beginFill(this.stroke.fillColor).drawEllipse(this.oldPt.x, +this.oldPt.y,a,b):this.stroke.fill||(0===this.stroke.thickness?this.brush.graphics.clear().drawEllipse(this.oldPt.x,this.oldPt.y,a,b):this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").drawEllipse(this.oldPt.x,this.oldPt.y,a,b));this.file.modified=!0;this.stage.update()}; Entry.Painter.prototype.edit_copy=function(){this.selectArea?(this.clearHandle(),this.selectedObject&&delete this.selectedObject,this.copyLayerData=this.ctx.getImageData(this.selectArea.x1,this.selectArea.y1,this.selectArea.x2,this.selectArea.y2),this.copy={},this.copy.width=this.selectArea.x2,this.copy.height=this.selectArea.y2,this.canvas_.width=this.copy.width,this.canvas_.height=this.copy.height,this.ctx_.clearRect(0,0,this.canvas_.width,this.canvas_.height),this.ctx_.putImageData(this.copyLayerData, 0,0)):alert("\ubcf5\uc0ac\ud560 \uc601\uc5ed\uc744 \uc120\ud0dd\ud558\uc138\uc694.")}; Entry.Painter.prototype.edit_cut=function(){this.selectArea?(this.clearHandle(),this.selectedObject&&delete this.selectedObject,this.copyLayerData=this.ctx.getImageData(this.selectArea.x1,this.selectArea.y1,this.selectArea.x2,this.selectArea.y2),this.copy={},this.copy.width=this.selectArea.x2,this.copy.height=this.selectArea.y2,this.canvas_.width=this.copy.width,this.canvas_.height=this.copy.height,this.ctx_.clearRect(0,0,this.canvas_.width,this.canvas_.height),this.ctx_.putImageData(this.copyLayerData, 0,0),this.ctx.clearRect(this.selectArea.x1,this.selectArea.y1,this.selectArea.x2,this.selectArea.y2),this.colorLayerData=this.ctx.getImageData(0,0,this.canvas.width,this.canvas.height),this.reloadContext(),this.file.modified=!0):alert("\uc790\ub97c \uc601\uc5ed\uc744 \uc120\ud0dd\ud558\uc138\uc694.")}; -Entry.Painter.prototype.edit_paste=function(){var b=new Image;b.src=this.canvas_.toDataURL();var a=this;b.onload=function(b){b=new createjs.Bitmap(b.target);b.x=a.canvas.width/2;b.y=a.canvas.height/2;b.regX=a.copy.width/2|0;b.regY=a.copy.height/2|0;b.id=Entry.generateHash();a.objectContainer.addChild(b);a.selectObject(b,!0)};this.file.modified=!0}; +Entry.Painter.prototype.edit_paste=function(){var a=new Image;a.src=this.canvas_.toDataURL();var b=this;a.onload=function(a){a=new createjs.Bitmap(a.target);a.x=b.canvas.width/2;a.y=b.canvas.height/2;a.regX=b.copy.width/2|0;a.regY=b.copy.height/2|0;a.id=Entry.generateHash();b.objectContainer.addChild(a);b.selectObject(a,!0)};this.file.modified=!0}; Entry.Painter.prototype.edit_select=function(){this.clearHandle();this.selectedObject&&delete this.selectedObject;this.copyLayerData=this.ctx.getImageData(this.selectArea.x1,this.selectArea.y1,this.selectArea.x2,this.selectArea.y2);this.copy={};this.copy.width=this.selectArea.x2;this.copy.height=this.selectArea.y2;this.canvas_.width=this.copy.width;this.canvas_.height=this.copy.height;this.ctx_.clearRect(0,0,this.canvas_.width,this.canvas_.height);this.ctx_.putImageData(this.copyLayerData,0,0);this.ctx.clearRect(this.selectArea.x1, -this.selectArea.y1,this.selectArea.x2,this.selectArea.y2);this.colorLayerData=this.ctx.getImageData(0,0,this.canvas.width,this.canvas.height);this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);this.ctx.putImageData(this.colorLayerData,0,0);var b=new Image;b.src=this.canvas.toDataURL();var a=this;b.onload=function(b){b=new createjs.Bitmap(b.target);a.objectContainer.removeAllChildren();a.objectContainer.addChild(b);b=new Image;b.src=a.canvas_.toDataURL();b.onload=function(b){b=new createjs.Bitmap(b.target); -b.x=a.selectArea.x1+a.copy.width/2;b.y=a.selectArea.y1+a.copy.height/2;b.regX=a.copy.width/2|0;b.regY=a.copy.height/2|0;b.id=Entry.generateHash();b.name=b.id;a.objectContainer.addChild(b);a.selectObject(b,!0)}}}; -Entry.Painter.prototype.move_erase=function(b){b=new createjs.Point(this.oldPt.x+this.stage.mouseX>>1,this.oldPt.y+this.stage.mouseY>>1);this.eraser.graphics.setStrokeStyle(this.stroke.thickness,"round").beginStroke("#ffffff").moveTo(b.x,b.y).curveTo(this.oldPt.x,this.oldPt.y,this.oldMidPt.x,this.oldMidPt.y);this.oldPt.x=this.stage.mouseX;this.oldPt.y=this.stage.mouseY;this.oldMidPt.x=b.x;this.oldMidPt.y=b.y;this.file.modified=!0;this.stage.update()}; +this.selectArea.y1,this.selectArea.x2,this.selectArea.y2);this.colorLayerData=this.ctx.getImageData(0,0,this.canvas.width,this.canvas.height);this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);this.ctx.putImageData(this.colorLayerData,0,0);var a=new Image;a.src=this.canvas.toDataURL();var b=this;a.onload=function(a){a=new createjs.Bitmap(a.target);b.objectContainer.removeAllChildren();b.objectContainer.addChild(a);a=new Image;a.src=b.canvas_.toDataURL();a.onload=function(a){a=new createjs.Bitmap(a.target); +a.x=b.selectArea.x1+b.copy.width/2;a.y=b.selectArea.y1+b.copy.height/2;a.regX=b.copy.width/2|0;a.regY=b.copy.height/2|0;a.id=Entry.generateHash();a.name=a.id;b.objectContainer.addChild(a);b.selectObject(a,!0)}}}; +Entry.Painter.prototype.move_erase=function(a){a=new createjs.Point(this.oldPt.x+this.stage.mouseX>>1,this.oldPt.y+this.stage.mouseY>>1);this.eraser.graphics.setStrokeStyle(this.stroke.thickness,"round").beginStroke("#ffffff").moveTo(a.x,a.y).curveTo(this.oldPt.x,this.oldPt.y,this.oldMidPt.x,this.oldMidPt.y);this.oldPt.x=this.stage.mouseX;this.oldPt.y=this.stage.mouseY;this.oldMidPt.x=a.x;this.oldMidPt.y=a.y;this.file.modified=!0;this.stage.update()}; Entry.Painter.prototype.settingShapeBlur=function(){this.objectWidthInput.blur();this.objectHeightInput.blur();this.objectRotateInput.blur()}; -Entry.Painter.prototype.stagemousedown=function(b){"picture"==Entry.playground.getViewMode()&&(this.settingShapeBlur(),this.oldPt=new createjs.Point(b.stageX,b.stageY),this.oldMidPt=this.oldPt.clone(),"select"===this.toolbox.selected?this.stage.addChild(this._handle):"spoid"===this.toolbox.selected?this.pickStrokeColor(b):"text"===this.toolbox.selected?(this.showInputField(b),this.stage.update()):"erase"===this.toolbox.selected?(this.createEraser(),this.stroke.enabled=!0):"fill"===this.toolbox.selected? +Entry.Painter.prototype.stagemousedown=function(a){"picture"==Entry.playground.getViewMode()&&(this.settingShapeBlur(),this.oldPt=new createjs.Point(a.stageX,a.stageY),this.oldMidPt=this.oldPt.clone(),"select"===this.toolbox.selected?this.stage.addChild(this._handle):"spoid"===this.toolbox.selected?this.pickStrokeColor(a):"text"===this.toolbox.selected?(this.showInputField(a),this.stage.update()):"erase"===this.toolbox.selected?(this.createEraser(),this.stroke.enabled=!0):"fill"===this.toolbox.selected? this.fill():"cursor"!==this.toolbox.selected&&(this.createBrush(),this.stroke.enabled=!0))}; -Entry.Painter.prototype.stagemousemove=function(b){"picture"==Entry.playground.getViewMode()&&("select"===this.toolbox.selected&&-1this.value&&(this.value=360+this.value%360);a.handle.rotation=this.value;a.updateImageHandle()};this.objectRotateInput.addClass("entryPlaygroundPainterNumberInput");this.objectRotateInput.defaultValue= +c.addClass("painterAttrRotateTop");c.innerHTML="\u03bf";d.appendChild(c);this.objectRotateInput=Entry.createElement("input","entryPainterAttrDegree");this.objectRotateInput.onblur=function(){if(isNaN(this.value))return alert("\uc22b\uc790\ub9cc \uc785\ub825 \uac00\ub2a5\ud569\ub2c8\ub2e4."),!1;360<=this.value?this.value%=360:0>this.value&&(this.value=360+this.value%360);b.handle.rotation=this.value;b.updateImageHandle()};this.objectRotateInput.addClass("entryPlaygroundPainterNumberInput");this.objectRotateInput.defaultValue= "0";d.appendChild(this.objectRotateInput);this.attrColorArea=Entry.createElement("fieldset","entryPainterAttrColor");this.attrColorArea.addClass("entryPlaygroundPainterAttrColor");g.appendChild(this.attrColorArea);var q=Entry.createElement("div");q.addClass("entryPlaygroundPainterAttrColorContainer");this.attrColorArea.appendChild(q);this.attrCircleArea=Entry.createElement("div");this.attrCircleArea.addClass("painterAttrCircleArea");g.appendChild(this.attrCircleArea);d=Entry.createElement("div","entryPainterAttrCircle"); -d.addClass("painterAttrCircle");this.attrCircleArea.appendChild(d);this.attrCircleArea.painterAttrCircle=d;d=Entry.createElement("input","entryPainterAttrCircleInput");d.value="#000000";d.addClass("painterAttrCircleInput");this.attrCircleArea.appendChild(d);this.attrColorSpoid=Entry.createElement("div");this.attrColorSpoid.bindOnClick(function(){a.selectToolbox("spoid")});this.attrColorSpoid.addClass("painterAttrColorSpoid");g.appendChild(this.attrColorSpoid);Entry.getColourCodes().forEach(function(b){var c= -Entry.createElement("div");c.addClass("entryPlaygroundPainterAttrColorElement");"transparent"===b?c.style.backgroundImage="url("+(Entry.mediaFilePath+"/transparent.png")+")":c.style.backgroundColor=b;c.bindOnClick(function(c){"transparent"===b?(a.stroke.transparent=!0,a.stroke.lineColor="#ffffff"):(a.stroke.transparent=!1,r&&(document.getElementById("entryPainterShapeBackgroundColor").style.backgroundColor=b,a.stroke.fillColor=b),r||(document.getElementById("entryPainterShapeLineColor").style.backgroundColor= -b,a.stroke.lineColor=b));document.getElementById("entryPainterAttrCircle").style.backgroundColor=a.stroke.lineColor;document.getElementById("entryPainterAttrCircleInput").value=b});q.appendChild(c)});this.attrThickArea=Entry.createElement("div","painterAttrThickArea");this.attrThickArea.addClass("entryPlaygroundentryPlaygroundPainterAttrThickArea");g.appendChild(this.attrThickArea);d=Entry.createElement("legend");d.addClass("painterAttrThickName");d.innerHTML=Lang.Workspace.thickness;this.attrThickArea.appendChild(d); -var n=Entry.createElement("fieldset","entryPainterAttrThick");n.addClass("entryPlaygroundPainterAttrThick");this.attrThickArea.appendChild(n);d=Entry.createElement("div");d.addClass("paintAttrThickTop");n.appendChild(d);e=Entry.createElement("select","entryPainterAttrThick");e.addClass("entryPlaygroundPainterAttrThickInput");e.size="1";e.onchange=function(b){a.stroke.thickness=b.target.value};for(d=1;10>=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,e.appendChild(c);n.appendChild(e); +d.addClass("painterAttrCircle");this.attrCircleArea.appendChild(d);this.attrCircleArea.painterAttrCircle=d;d=Entry.createElement("input","entryPainterAttrCircleInput");d.value="#000000";d.addClass("painterAttrCircleInput");this.attrCircleArea.appendChild(d);this.attrColorSpoid=Entry.createElement("div");this.attrColorSpoid.bindOnClick(function(){b.selectToolbox("spoid")});this.attrColorSpoid.addClass("painterAttrColorSpoid");g.appendChild(this.attrColorSpoid);Entry.getColourCodes().forEach(function(a){var c= +Entry.createElement("div");c.addClass("entryPlaygroundPainterAttrColorElement");"transparent"===a?c.style.backgroundImage="url("+(Entry.mediaFilePath+"/transparent.png")+")":c.style.backgroundColor=a;c.bindOnClick(function(c){"transparent"===a?(b.stroke.transparent=!0,b.stroke.lineColor="#ffffff"):(b.stroke.transparent=!1,r&&(document.getElementById("entryPainterShapeBackgroundColor").style.backgroundColor=a,b.stroke.fillColor=a),r||(document.getElementById("entryPainterShapeLineColor").style.backgroundColor= +a,b.stroke.lineColor=a));document.getElementById("entryPainterAttrCircle").style.backgroundColor=b.stroke.lineColor;document.getElementById("entryPainterAttrCircleInput").value=a});q.appendChild(c)});this.attrThickArea=Entry.createElement("div","painterAttrThickArea");this.attrThickArea.addClass("entryPlaygroundentryPlaygroundPainterAttrThickArea");g.appendChild(this.attrThickArea);d=Entry.createElement("legend");d.addClass("painterAttrThickName");d.innerHTML=Lang.Workspace.thickness;this.attrThickArea.appendChild(d); +var n=Entry.createElement("fieldset","entryPainterAttrThick");n.addClass("entryPlaygroundPainterAttrThick");this.attrThickArea.appendChild(n);d=Entry.createElement("div");d.addClass("paintAttrThickTop");n.appendChild(d);e=Entry.createElement("select","entryPainterAttrThick");e.addClass("entryPlaygroundPainterAttrThickInput");e.size="1";e.onchange=function(a){b.stroke.thickness=a.target.value};for(d=1;10>=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,e.appendChild(c);n.appendChild(e); d=Entry.createElement("div","entryPainterShapeLineColor");d.addClass("painterAttrShapeLineColor");c=Entry.createElement("div","entryPainterShapeInnerBackground");c.addClass("painterAttrShapeInnerBackground");d.appendChild(c);n.appendChild(d);this.attrThickArea.painterAttrShapeLineColor=d;n.bindOnClick(function(){m.style.zIndex="1";this.style.zIndex="10";r=!1});this.attrBackgroundArea=Entry.createElement("div","painterAttrBackgroundArea");this.attrBackgroundArea.addClass("entryPlaygroundPainterBackgroundArea"); -g.appendChild(this.attrBackgroundArea);d=Entry.createElement("fieldset","entryPainterAttrbackground");d.addClass("entryPlaygroundPainterAttrBackground");this.attrBackgroundArea.appendChild(d);c=Entry.createElement("div");c.addClass("paintAttrBackgroundTop");d.appendChild(c);var m=Entry.createElement("div","entryPainterShapeBackgroundColor");m.addClass("painterAttrShapeBackgroundColor");this.attrBackgroundArea.painterAttrShapeBackgroundColor=m;c.appendChild(m);var r=!1;m.bindOnClick(function(a){n.style.zIndex= +g.appendChild(this.attrBackgroundArea);d=Entry.createElement("fieldset","entryPainterAttrbackground");d.addClass("entryPlaygroundPainterAttrBackground");this.attrBackgroundArea.appendChild(d);c=Entry.createElement("div");c.addClass("paintAttrBackgroundTop");d.appendChild(c);var m=Entry.createElement("div","entryPainterShapeBackgroundColor");m.addClass("painterAttrShapeBackgroundColor");this.attrBackgroundArea.painterAttrShapeBackgroundColor=m;c.appendChild(m);var r=!1;m.bindOnClick(function(b){n.style.zIndex= "1";this.style.zIndex="10";r=!0});this.attrFontArea=Entry.createElement("div","painterAttrFont");this.attrFontArea.addClass("entryPlaygroundPainterAttrFont");g.appendChild(this.attrFontArea);e=Entry.createElement("div");e.addClass("entryPlaygroundPainterAttrTop");this.attrFontArea.appendChild(e);d=Entry.createElement("div");d.addClass("entryPlaygroundPaintAttrTop_");e.appendChild(d);d=Entry.createElement("legend");d.addClass("panterAttrFontTitle");d.innerHTML=Lang.Workspace.textStyle;k=Entry.createElement("select", -"entryPainterAttrFontName");k.addClass("entryPlaygroundPainterAttrFontName");k.size="1";k.onchange=function(b){a.font.name=b.target.value};for(d=0;d=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,k.appendChild(c);e.appendChild(k);e=Entry.createElement("div");e.addClass("entryPlaygroundPainterAttrFontStyleArea");this.attrFontArea.appendChild(e);d=Entry.createElement("div");d.addClass("entryPlaygroundPainterAttrFontTop");e.appendChild(d);k=Entry.createElement("select","entryPainterAttrFontStyle"); -k.addClass("entryPlaygroundPainterAttrFontStyle");k.size="1";k.onchange=function(b){a.font.style=b.target.value};h=[{label:"\ubcf4\ud1b5",value:"normal"},{label:"\uad75\uac8c",value:"bold"},{label:"\uae30\uc6b8\uc784",value:"italic"}];for(d=0;d=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,k.appendChild(c);e.appendChild(k);e=Entry.createElement("div");e.addClass("entryPlaygroundPainterAttrFontStyleArea");this.attrFontArea.appendChild(e);d=Entry.createElement("div");d.addClass("entryPlaygroundPainterAttrFontTop");e.appendChild(d);k=Entry.createElement("select","entryPainterAttrFontStyle"); +k.addClass("entryPlaygroundPainterAttrFontStyle");k.size="1";k.onchange=function(a){b.font.style=a.target.value};h=[{label:"\ubcf4\ud1b5",value:"normal"},{label:"\uad75\uac8c",value:"bold"},{label:"\uae30\uc6b8\uc784",value:"italic"}];for(d=0;d"+d[1];c.addEventListener("click",function(){Entry.engine.toggleStop()});this.view_.appendChild(c);this.curtainView_=c;Entry.pictureEditable&&(c=Entry.createElement("div","entryPicture"),c.addClass("entryPlaygroundPictureWorkspace"),c.addClass("entryRemove"),this.view_.appendChild(c),this.generatePictureView(c),this.pictureView_=c);c=Entry.createElement("div","entryText");c.addClass("entryPlaygroundTextWorkspace");c.addClass("entryRemove");this.view_.appendChild(c);this.generateTextView(c); this.textView_=c;Entry.soundEditable&&(c=Entry.createElement("div","entrySound"),c.addClass("entryPlaygroundSoundWorkspace"),c.addClass("entryRemove"),this.view_.appendChild(c),this.generateSoundView(c),this.soundView_=c);c=Entry.createElement("div","entryDefault");c.addClass("entryPlaygroundDefaultWorkspace");this.view_.appendChild(c);this.generateDefaultView(c);this.defaultView_=c;c=Entry.createElement("div","entryCode");c.addClass("entryPlaygroundCodeWorkspace");c.addClass("entryRemove");this.view_.appendChild(c); -this.generateCodeView(c);this.codeView_=c;d=Entry.createElement("div");d.addClass("entryPlaygroundResizeWorkspace","entryRemove");this.resizeHandle_=d;this.view_.appendChild(d);this.initializeResizeHandle(d);this.codeView_=c;Entry.addEventListener("run",function(a){Entry.playground.curtainView_.removeClass("entryRemove")});Entry.addEventListener("stop",function(a){Entry.playground.curtainView_.addClass("entryRemove")})}};Entry.Playground.prototype.generateDefaultView=function(b){return b}; -Entry.Playground.prototype.generateTabView=function(b){var a=Entry.createElement("ul");a.addClass("entryTabListWorkspace");this.tabList_=a;b.appendChild(a);this.tabViewElements={};b=Entry.createElement("li","entryCodeTab");b.innerHTML=Lang.Workspace.tab_code;b.addClass("entryTabListItemWorkspace");b.addClass("entryTabSelected");a.appendChild(b);b.bindOnClick(function(a){Entry.playground.changeViewMode("code")});this.tabViewElements.code=b;Entry.pictureEditable&&(b=Entry.createElement("li","entryPictureTab"), -b.innerHTML=Lang.Workspace.tab_picture,b.addClass("entryTabListItemWorkspace"),a.appendChild(b),b.bindOnClick(function(a){Entry.playground.changeViewMode("picture")}),this.tabViewElements.picture=b,b=Entry.createElement("li","entryTextboxTab"),b.innerHTML=Lang.Workspace.tab_text,b.addClass("entryTabListItemWorkspace"),a.appendChild(b),b.bindOnClick(function(a){Entry.playground.changeViewMode("text")}),this.tabViewElements.text=b,b.addClass("entryRemove"));Entry.soundEditable&&(b=Entry.createElement("li", -"entrySoundTab"),b.innerHTML=Lang.Workspace.tab_sound,b.addClass("entryTabListItemWorkspace"),a.appendChild(b),b.bindOnClick(function(a){Entry.playground.changeViewMode("sound")}),this.tabViewElements.sound=b);Entry.hasVariableManager&&(b=Entry.createElement("li","entryVariableTab"),b.innerHTML=Lang.Workspace.tab_attribute,b.addClass("entryTabListItemWorkspace"),b.addClass("entryVariableTabWorkspace"),a.appendChild(b),b.bindOnClick(function(a){Entry.playground.toggleOnVariableView();Entry.playground.changeViewMode("variable")}), -this.tabViewElements.variable=b)}; -Entry.Playground.prototype.generateCodeView=function(b){if(!Entry.type||"workspace"==Entry.type){var a=Entry.createElement("div","entryCategory");a.addClass("entryCategoryWorkspace");b.appendChild(a);this.categoryView_=a;var c=Entry.createElement("ul","entryCategoryList");c.addClass("entryCategoryListWorkspace");a.appendChild(c);this.categoryListView_=c;var d=Entry.createElement("div","entryBlocklyWorkspace");d.addClass("entryBlockMenuWorkspace");b.appendChild(d);$(d).mouseenter(function(a){Entry.playground.resizing|| -(Entry.playground.focusBlockMenu=!0,a=Blockly.mainWorkspace.blockMenu.blockMenuWidth+84,a>Entry.interfaceState.menuWidth&&(this.widthBackup=Entry.interfaceState.menuWidth,$(".entryBlockMenuWorkspace>svg").stop().animate({width:a-64},200)))});$(d).mouseleave(function(a){Entry.playground.resizing||(d.widthBackup&&!Blockly.mainWorkspace.blockMenu.hasStalkerBlock&&$(".entryBlockMenuWorkspace>svg").stop().animate({width:this.widthBackup-64},200),delete this.widthBackup,delete Entry.playground.focusBlockMenu)}); -Entry.addEventListener("entryBlocklyChanged",function(a){a=Entry.playground.blockMenuView_;a.widthBackup&&Entry.resizeElement({menuWidth:a.widthBackup});delete a.widthBackup;delete Entry.playground.focusBlockMenu});this.blockMenuView_=d;a=this.createVariableView();b.appendChild(a);this.variableView_=a;a=Entry.createElement("div","entryBlockly");a.addClass("entryBlocklyWorkspace");this.blocklyView_=a;Entry.bindAnimationCallback(this.blocklyView_,function(a){Blockly.fireUiEvent(window,"resize");Entry.playground.blocklyView_.removeClass("foldOut")}); -b.appendChild(a);c=Entry.parseTexttoXML("");Blockly.inject(a,{path:Entry.blockInjectPath||".././",toolbox:c,trashcan:!0,blockmenu:this.blockMenuView_,mediaFilePath:Entry.mediaFilePath});Blockly.mainWorkspace.flyout_.hide();Blockly.mainWorkspace.blockMenu.hide();document.addEventListener("blocklyWorkspaceChange",this.syncObjectWithEvent,!1);this.blockMenu=Blockly.mainWorkspace.blockMenu;Entry.hw.banHW();return b}if("phone"==Entry.type)return a=Entry.createElement("div","entryCategory"), -a.addClass("entryCategoryPhone"),b.appendChild(a),this.categoryView_=a,c=Entry.createElement("ul","entryCategoryList"),c.addClass("entryCategoryListPhone"),a.appendChild(c),this.categoryListView_=c,a=this.createVariableView(),b.appendChild(a),this.variableView_=a,a=Entry.createElement("div","entryBlockly"),a.addClass("entryBlocklyPhone"),this.blocklyView_=a,b.appendChild(a),c=Entry.parseTexttoXML(""),Blockly.inject(a,{path:Entry.blockInjectPath||".././",toolbox:c,trashcan:!0,mediaFilePath:Entry.mediaFilePath}), -Blockly.mainWorkspace.flyout_.autoClose=!0,Blockly.mainWorkspace.flyout_.hide(),document.addEventListener("blocklyWorkspaceChange",this.syncObjectWithEvent,!1),this.blockMenu=Blockly.mainWorkspace.flyout_,Entry.hw.banHW(),b}; -Entry.Playground.prototype.generatePictureView=function(b){if("workspace"==Entry.type){var a=Entry.createElement("div","entryAddPicture");a.addClass("entryPlaygroundAddPicture");a.bindOnClick(function(a){Entry.dispatchEvent("openPictureManager")});var c=Entry.createElement("div","entryAddPictureInner");c.addClass("entryPlaygroundAddPictureInner");c.innerHTML=Lang.Workspace.picture_add;a.appendChild(c);b.appendChild(a);a=Entry.createElement("ul","entryPictureList");a.addClass("entryPlaygroundPictureList"); -$&&$(a).sortable({start:function(a,b){b.item.data("start_pos",b.item.index())},stop:function(a,b){var c=b.item.data("start_pos"),g=b.item.index();Entry.playground.movePicture(c,g)},axis:"y"});b.appendChild(a);this.pictureListView_=a;a=Entry.createElement("div","entryPainter");a.addClass("entryPlaygroundPainter");b.appendChild(a);this.painter=new Entry.Painter;this.painter.initialize(a)}else"phone"==Entry.type&&(a=Entry.createElement("div","entryAddPicture"),a.addClass("entryPlaygroundAddPicturePhone"), -a.bindOnClick(function(a){Entry.dispatchEvent("openPictureManager")}),c=Entry.createElement("div","entryAddPictureInner"),c.addClass("entryPlaygroundAddPictureInnerPhone"),c.innerHTML=Lang.Workspace.picture_add,a.appendChild(c),b.appendChild(a),a=Entry.createElement("ul","entryPictureList"),a.addClass("entryPlaygroundPictureListPhone"),$&&$(a).sortable({start:function(a,b){b.item.data("start_pos",b.item.index())},stop:function(a,b){var c=b.item.data("start_pos"),g=b.item.index();Entry.playground.movePicture(c, -g)},axis:"y"}),b.appendChild(a),this.pictureListView_=a)}; -Entry.Playground.prototype.generateTextView=function(b){var a=Entry.createElement("div");b.appendChild(a);b=Entry.createElement("div");b.addClass("textProperties");a.appendChild(b);var c=Entry.createElement("div");c.addClass("entryTextFontSelect");b.appendChild(c);var d=Entry.createElement("select","entryPainterAttrFontName");d.addClass("entryPlaygroundPainterAttrFontName","entryTextFontSelecter");d.size="1";d.onchange=function(a){Entry.playground.object.entity.setFontType(a.target.value)};for(var e= -0;eEntry.interfaceState.menuWidth&&(this.widthBackup=Entry.interfaceState.menuWidth,$(".entryBlockMenuWorkspace>svg").stop().animate({width:b-64},200)))});$(d).mouseleave(function(b){Entry.playground.resizing||(d.widthBackup&&!Blockly.mainWorkspace.blockMenu.hasStalkerBlock&&$(".entryBlockMenuWorkspace>svg").stop().animate({width:this.widthBackup-64},200),delete this.widthBackup,delete Entry.playground.focusBlockMenu)}); +Entry.addEventListener("entryBlocklyChanged",function(b){b=Entry.playground.blockMenuView_;b.widthBackup&&Entry.resizeElement({menuWidth:b.widthBackup});delete b.widthBackup;delete Entry.playground.focusBlockMenu});this.blockMenuView_=d;b=this.createVariableView();a.appendChild(b);this.variableView_=b;b=Entry.createElement("div","entryBlockly");b.addClass("entryBlocklyWorkspace");this.blocklyView_=b;Entry.bindAnimationCallback(this.blocklyView_,function(b){Blockly.fireUiEvent(window,"resize");Entry.playground.blocklyView_.removeClass("foldOut")}); +a.appendChild(b);c=Entry.parseTexttoXML("");Blockly.inject(b,{path:Entry.blockInjectPath||".././",toolbox:c,trashcan:!0,blockmenu:this.blockMenuView_,mediaFilePath:Entry.mediaFilePath});Blockly.mainWorkspace.flyout_.hide();Blockly.mainWorkspace.blockMenu.hide();document.addEventListener("blocklyWorkspaceChange",this.syncObjectWithEvent,!1);this.blockMenu=Blockly.mainWorkspace.blockMenu;Entry.hw.banHW();return a}if("phone"==Entry.type)return b=Entry.createElement("div","entryCategory"), +b.addClass("entryCategoryPhone"),a.appendChild(b),this.categoryView_=b,c=Entry.createElement("ul","entryCategoryList"),c.addClass("entryCategoryListPhone"),b.appendChild(c),this.categoryListView_=c,b=this.createVariableView(),a.appendChild(b),this.variableView_=b,b=Entry.createElement("div","entryBlockly"),b.addClass("entryBlocklyPhone"),this.blocklyView_=b,a.appendChild(b),c=Entry.parseTexttoXML(""),Blockly.inject(b,{path:Entry.blockInjectPath||".././",toolbox:c,trashcan:!0,mediaFilePath:Entry.mediaFilePath}), +Blockly.mainWorkspace.flyout_.autoClose=!0,Blockly.mainWorkspace.flyout_.hide(),document.addEventListener("blocklyWorkspaceChange",this.syncObjectWithEvent,!1),this.blockMenu=Blockly.mainWorkspace.flyout_,Entry.hw.banHW(),a}; +Entry.Playground.prototype.generatePictureView=function(a){if("workspace"==Entry.type){var b=Entry.createElement("div","entryAddPicture");b.addClass("entryPlaygroundAddPicture");b.bindOnClick(function(b){Entry.dispatchEvent("openPictureManager")});var c=Entry.createElement("div","entryAddPictureInner");c.addClass("entryPlaygroundAddPictureInner");c.innerHTML=Lang.Workspace.picture_add;b.appendChild(c);a.appendChild(b);b=Entry.createElement("ul","entryPictureList");b.addClass("entryPlaygroundPictureList"); +$&&$(b).sortable({start:function(b,a){a.item.data("start_pos",a.item.index())},stop:function(b,a){var c=a.item.data("start_pos"),g=a.item.index();Entry.playground.movePicture(c,g)},axis:"y"});a.appendChild(b);this.pictureListView_=b;b=Entry.createElement("div","entryPainter");b.addClass("entryPlaygroundPainter");a.appendChild(b);this.painter=new Entry.Painter;this.painter.initialize(b)}else"phone"==Entry.type&&(b=Entry.createElement("div","entryAddPicture"),b.addClass("entryPlaygroundAddPicturePhone"), +b.bindOnClick(function(b){Entry.dispatchEvent("openPictureManager")}),c=Entry.createElement("div","entryAddPictureInner"),c.addClass("entryPlaygroundAddPictureInnerPhone"),c.innerHTML=Lang.Workspace.picture_add,b.appendChild(c),a.appendChild(b),b=Entry.createElement("ul","entryPictureList"),b.addClass("entryPlaygroundPictureListPhone"),$&&$(b).sortable({start:function(b,a){a.item.data("start_pos",a.item.index())},stop:function(b,a){var c=a.item.data("start_pos"),g=a.item.index();Entry.playground.movePicture(c, +g)},axis:"y"}),a.appendChild(b),this.pictureListView_=b)}; +Entry.Playground.prototype.generateTextView=function(a){var b=Entry.createElement("div");a.appendChild(b);a=Entry.createElement("div");a.addClass("textProperties");b.appendChild(a);var c=Entry.createElement("div");c.addClass("entryTextFontSelect");a.appendChild(c);var d=Entry.createElement("select","entryPainterAttrFontName");d.addClass("entryPlaygroundPainterAttrFontName","entryTextFontSelecter");d.size="1";d.onchange=function(b){Entry.playground.object.entity.setFontType(b.target.value)};for(var e= +0;e p").html(Lang.Menus.linebreak_on_desc_1),$(".entryPlaygroundLinebreakDescription > ul > li").eq(0).html(Lang.Menus.linebreak_on_desc_2),$(".entryPlaygroundLinebreakDescription > ul > li").eq(1).html(Lang.Menus.linebreak_on_desc_3)); -Entry.playground.setFontAlign(Entry.playground.object.entity.getTextAlign());b=Entry.playground.object.entity.getFontSize();Entry.playground.fontSizeIndiciator.style.width=b+"%";Entry.playground.fontSizeKnob.style.left=.88*b+"px"}};Entry.Playground.prototype.injectSound=function(){var b=this.soundListView_;if(b){for(;b.hasChildNodes();)b.removeChild(b.lastChild);if(this.object)for(var a=this.object.sounds,c=0,d=a.length;c1010', -selectedPictureId:"vx80",objectType:"sprite",rotateMethod:"free",scene:"7dwq",sprite:{sounds:[{duration:1.3,ext:".mp3",id:"8el5",fileurl:b+"media/bark.mp3",name:Lang.Blocks.bark_dog}],pictures:[{id:"vx80",fileurl:b+"media/entrybot1.png",name:Lang.Blocks.walking_entryBot+"1",scale:100,dimension:{width:284,height:350}},{id:"4t48",fileurl:b+"media/entrybot2.png",name:Lang.Blocks.walking_entryBot+"2",scale:100,dimension:{width:284,height:350}}]},entity:{x:0,y:0,regX:142,regY:175,scaleX:.3154574132492113, +Entry.Popup.prototype.resize=function(a){a=window.popup.window_;var b=.9*window.innerWidth,c=.9*window.innerHeight-35;9*b<=16*c?c=b/16*9:b=16*c/9;a.style.width=String(b)+"px";a.style.height=String(c+35)+"px"};Entry.popupHelper=function(a){this.popupList={};this.nowContent;a&&(window.popupHelper=null);Entry.assert(!window.popupHelper,"Popup exist");var b=["confirm","spinner"],c=["entryPopupHelperTopSpan","entryPopupHelperBottomSpan","entryPopupHelperLeftSpan","entryPopupHelperRightSpan"];this.body_=Entry.Dom("div",{classes:["entryPopup","hiddenPopup","popupHelper"]});var d=this;this.body_.bindOnClick(function(a){if(!(d.nowContent&&-11010', +selectedPictureId:"vx80",objectType:"sprite",rotateMethod:"free",scene:"7dwq",sprite:{sounds:[{duration:1.3,ext:".mp3",id:"8el5",fileurl:a+"media/bark.mp3",name:Lang.Blocks.bark_dog}],pictures:[{id:"vx80",fileurl:a+"media/entrybot1.png",name:Lang.Blocks.walking_entryBot+"1",scale:100,dimension:{width:284,height:350}},{id:"4t48",fileurl:a+"media/entrybot2.png",name:Lang.Blocks.walking_entryBot+"2",scale:100,dimension:{width:284,height:350}}]},entity:{x:0,y:0,regX:142,regY:175,scaleX:.3154574132492113, scaleY:.3154574132492113,rotation:0,direction:90,width:284,height:350,visible:!0},lock:!1,active:!0}],speed:60}};Entry.PropertyPanel=function(){this.modes={};this.selected=null}; -(function(b){b.generateView=function(a,b){this._view=Entry.Dom("div",{class:"propertyPanel",parent:$(a)});this._tabView=Entry.Dom("div",{class:"propertyTab",parent:this._view});this._contentView=Entry.Dom("div",{class:"propertyContent",parent:this._view});var d=Entry.createElement("div");d.addClass("entryObjectSelectedImgWorkspace");this.selectedImgView_=d;this._view.append(d);this.initializeSplitter(d);this.splitter=d};b.addMode=function(a,b){var d=b.getView(),d=Entry.Dom(d,{parent:this._contentView}), -e=Entry.Dom("
"+a+"
",{classes:["propertyTabElement","propertyTab"+a],parent:this._tabView}),f=this;e.bind("click",function(){f.select(a)});this.modes[a]&&(this.modes[a].tabDom.remove(),this.modes[a].contentDom.remove(),"hw"==a&&($(this.modes).removeClass(".propertyTabhw"),$(".propertyTabhw").unbind("dblclick")));this.modes[a]={obj:b,tabDom:e,contentDom:d};"hw"==a&&$(".propertyTabhw").bind("dblclick",function(){Entry.dispatchEvent("hwModeChange")})};b.resize=function(a){this._view.css({width:a+ -"px",top:9*a/16+123-22+"px"});430<=a?this._view.removeClass("collapsed"):this._view.addClass("collapsed");Entry.dispatchEvent("windowResized");(a=this.modes[this.selected].obj.resize)&&"hw"!=this.selected?a():"hw"==this.selected&&this.modes.hw.obj.listPorts?this.modes[this.selected].obj.resizeList():"hw"==this.selected&&this.modes[this.selected].obj.resize()};b.select=function(a){for(var b in this.modes){var d=this.modes[b];d.tabDom.removeClass("selected");d.contentDom.addClass("entryHidden")}b=this.modes[a]; -b.tabDom.addClass("selected");b.contentDom.removeClass("entryHidden");b.obj.resize&&b.obj.resize();this.selected=a};b.initializeSplitter=function(a){a.onmousedown=function(a){Entry.container.disableSort();Entry.container.splitterEnable=!0};document.addEventListener("mousemove",function(a){Entry.container.splitterEnable&&Entry.resizeElement({canvasWidth:a.x||a.clientX})});document.addEventListener("mouseup",function(a){Entry.container.splitterEnable=!1;Entry.container.enableSort()})}})(Entry.PropertyPanel.prototype);Entry.init=function(b,a){Entry.assert("object"===typeof a,"Init option is not object");this.events_={};this.interfaceState={menuWidth:264};Entry.Utils.bindGlobalEvent(["mousedown","mousemove"]);this.options=a;this.parseOptions(a);this.mediaFilePath=(a.libDir?a.libDir:"/lib")+"/entryjs/images/";this.defaultPath=a.defaultDir||"";this.blockInjectPath=a.blockInjectDir||"";"workspace"==this.type&&this.isPhone()&&(this.type="phone");this.initialize_();this.view_=b;this.view_.setAttribute("class","entry"); -Entry.initFonts(a.fonts);this.createDom(b,this.type);this.loadInterfaceState();this.overridePrototype();this.maxCloneLimit=302;this.cloudSavable=!0;this.startTime=(new Date).getTime();document.onkeydown=function(a){Entry.dispatchEvent("keyPressed",a)};document.onkeyup=function(a){Entry.dispatchEvent("keyUpped",a)};window.onresize=function(a){Entry.dispatchEvent("windowResized",a)};window.onbeforeunload=this.beforeUnload;Entry.addEventListener("saveWorkspace",function(a){Entry.addActivity("save")}); +(function(a){a.generateView=function(b,a){this._view=Entry.Dom("div",{class:"propertyPanel",parent:$(b)});this._tabView=Entry.Dom("div",{class:"propertyTab",parent:this._view});this._contentView=Entry.Dom("div",{class:"propertyContent",parent:this._view});var d=Entry.createElement("div");d.addClass("entryObjectSelectedImgWorkspace");this.selectedImgView_=d;this._view.append(d);this.initializeSplitter(d);this.splitter=d};a.addMode=function(b,a){var d=a.getView(),d=Entry.Dom(d,{parent:this._contentView}), +e=Entry.Dom("
"+b+"
",{classes:["propertyTabElement","propertyTab"+b],parent:this._tabView}),f=this;e.bind("click",function(){f.select(b)});this.modes[b]&&(this.modes[b].tabDom.remove(),this.modes[b].contentDom.remove(),"hw"==b&&($(this.modes).removeClass(".propertyTabhw"),$(".propertyTabhw").unbind("dblclick")));this.modes[b]={obj:a,tabDom:e,contentDom:d};"hw"==b&&$(".propertyTabhw").bind("dblclick",function(){Entry.dispatchEvent("hwModeChange")})};a.resize=function(b){this._view.css({width:b+ +"px",top:9*b/16+123-22+"px"});430<=b?this._view.removeClass("collapsed"):this._view.addClass("collapsed");Entry.dispatchEvent("windowResized");(b=this.modes[this.selected].obj.resize)&&"hw"!=this.selected?b():"hw"==this.selected&&this.modes.hw.obj.listPorts?this.modes[this.selected].obj.resizeList():"hw"==this.selected&&this.modes[this.selected].obj.resize()};a.select=function(b){for(var a in this.modes){var d=this.modes[a];d.tabDom.removeClass("selected");d.contentDom.addClass("entryHidden")}a=this.modes[b]; +a.tabDom.addClass("selected");a.contentDom.removeClass("entryHidden");a.obj.resize&&a.obj.resize();this.selected=b};a.initializeSplitter=function(b){b.onmousedown=function(b){Entry.container.disableSort();Entry.container.splitterEnable=!0};document.addEventListener("mousemove",function(b){Entry.container.splitterEnable&&Entry.resizeElement({canvasWidth:b.x||b.clientX})});document.addEventListener("mouseup",function(b){Entry.container.splitterEnable=!1;Entry.container.enableSort()})}})(Entry.PropertyPanel.prototype);Entry.init=function(a,b){Entry.assert("object"===typeof b,"Init option is not object");this.events_={};this.interfaceState={menuWidth:264};Entry.Utils.bindGlobalEvent(["mousedown","mousemove"]);this.options=b;this.parseOptions(b);this.mediaFilePath=(b.libDir?b.libDir:"/lib")+"/entryjs/images/";this.defaultPath=b.defaultDir||"";this.blockInjectPath=b.blockInjectDir||"";"workspace"==this.type&&this.isPhone()&&(this.type="phone");this.initialize_();this.view_=a;this.view_.setAttribute("class","entry"); +Entry.initFonts(b.fonts);this.createDom(a,this.type);this.loadInterfaceState();this.overridePrototype();this.maxCloneLimit=302;this.cloudSavable=!0;this.startTime=(new Date).getTime();document.onkeydown=function(b){Entry.dispatchEvent("keyPressed",b)};document.onkeyup=function(b){Entry.dispatchEvent("keyUpped",b)};window.onresize=function(b){Entry.dispatchEvent("windowResized",b)};window.onbeforeunload=this.beforeUnload;Entry.addEventListener("saveWorkspace",function(b){Entry.addActivity("save")}); "IE"!=Entry.getBrowserType().substr(0,2)||window.flashaudio?createjs.Sound.registerPlugins([createjs.WebAudioPlugin]):(createjs.FlashAudioPlugin.swfPath=this.mediaFilePath+"media/",createjs.Sound.registerPlugins([createjs.FlashAudioPlugin]),window.flashaudio=!0);Entry.soundQueue=new createjs.LoadQueue;Entry.soundQueue.installPlugin(createjs.Sound);Entry.loadAudio_([Entry.mediaFilePath+"media/click.mp3",Entry.mediaFilePath+"media/click.wav",Entry.mediaFilePath+"media/click.ogg"],"click");Entry.loadAudio_([Entry.mediaFilePath+ -"media/delete.mp3",Entry.mediaFilePath+"media/delete.ogg",Entry.mediaFilePath+"media/delete.wav"],"delete")};Entry.loadAudio_=function(b,a){if(window.Audio&&b.length)for(;0d+55)&&a>40+b*(h-d)&&(h=c.getNextScene())&&(h=$(h.view),$(document).trigger("mouseup"), -h.trigger("mousedown"))});var d=Entry.createElement("ul");d.addClass("entrySceneListWorkspace");Entry.sceneEditable&&$&&$(d).sortable({start:function(a,b){b.item.data("start_pos",b.item.index());$(b.item[0]).clone(!0)},stop:function(a,b){var c=b.item.data("start_pos"),d=b.item.index();Entry.scene.moveScene(c,d)},axis:"x",tolerance:"pointer"});this.view_.appendChild(d);this.listView_=d;Entry.sceneEditable&&(d=Entry.createElement("span"),d.addClass("entrySceneElementWorkspace"),d.addClass("entrySceneAddButtonWorkspace"), -d.bindOnClick(function(a){Entry.engine.isState("run")||Entry.scene.addScene()}),this.view_.appendChild(d),this.addButton_=d)}}; -Entry.Scene.prototype.generateElement=function(b){var a=this,c=Entry.createElement("li",b.id);c.addClass("entrySceneElementWorkspace");c.addClass("entrySceneButtonWorkspace");c.addClass("minValue");$(c).on("mousedown",function(a){Entry.engine.isState("run")?a.preventDefault():Entry.scene.selectScene(b)});var d=Entry.createElement("input");d.addClass("entrySceneFieldWorkspace");d.value=b.name;Entry.sceneEditable||(d.disabled="disabled");var e=Entry.createElement("span");e.addClass("entrySceneLeftWorkspace"); -c.appendChild(e);var f=Entry.createElement("span");f.addClass("entrySceneInputCover");f.style.width=Entry.computeInputWidth(b.name);c.appendChild(f);b.inputWrapper=f;d.onkeyup=function(c){c=c.keyCode;Entry.isArrowOrBackspace(c)||(b.name=this.value,f.style.width=Entry.computeInputWidth(b.name),a.resize(),13==c&&this.blur(),9=this.getScenes().length)Entry.toast.alert(Lang.Msgs.runtime_error,Lang.Workspace.Scene_delete_error,!1);else{var a=this.getScenes().indexOf(this.getSceneById(b.id));this.getScenes().splice(a,1);this.selectScene();for(var a=Entry.container.getSceneObjects(b),c=0;c=this.maxCount)Entry.toast.alert(Lang.Msgs.runtime_error,Lang.Workspace.Scene_add_error,!1);else{var a={name:b.name+Lang.Workspace.replica_of_object,id:Entry.generateHash()};this.generateElement(a);this.addScene(a);b=Entry.container.getSceneObjects(b);for(var c=b.length-1;0<=c;c--)Entry.container.addCloneObject(b[c],a.id)}}; -Entry.Scene.prototype.resize=function(){var b=this.getScenes(),a=this.selectedScene,c=b[0];if(0!==b.length&&c){var d=$(c.view).offset().left,c=parseFloat($(a.view).css("margin-left")),e=$(this.view_).width()-d,f=0,g;for(g in b){var d=b[g],h=d.view;h.addClass("minValue");$(h).removeProp("style");$(d.inputWrapper).width(Entry.computeInputWidth(d.name));h=$(h);f=f+h.width()+c}if(f>e)for(g in e-=$(a.view).width(),c=e/(b.length-1)-(Entry.Scene.viewBasicWidth+c),b)d=b[g],a.id!=d.id?(d.view.removeClass("minValue"), -$(d.inputWrapper).width(c)):d.view.addClass("minValue")}};Entry.Scene.prototype.getNextScene=function(){var b=this.getScenes();return b[b.indexOf(this.selectedScene)+1]};Entry.Script=function(b){this.entity=b};p=Entry.Script.prototype; -p.init=function(b,a,c){Entry.assert("BLOCK"==b.tagName.toUpperCase(),b.tagName);this.type=b.getAttribute("type");this.id=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;ad+55)&&b>40+a*(h-d)&&(h=c.getNextScene())&&(h=$(h.view),$(document).trigger("mouseup"), +h.trigger("mousedown"))});var d=Entry.createElement("ul");d.addClass("entrySceneListWorkspace");Entry.sceneEditable&&$&&$(d).sortable({start:function(b,a){a.item.data("start_pos",a.item.index());$(a.item[0]).clone(!0)},stop:function(b,a){var c=a.item.data("start_pos"),d=a.item.index();Entry.scene.moveScene(c,d)},axis:"x",tolerance:"pointer"});this.view_.appendChild(d);this.listView_=d;Entry.sceneEditable&&(d=Entry.createElement("span"),d.addClass("entrySceneElementWorkspace"),d.addClass("entrySceneAddButtonWorkspace"), +d.bindOnClick(function(b){Entry.engine.isState("run")||Entry.scene.addScene()}),this.view_.appendChild(d),this.addButton_=d)}}; +Entry.Scene.prototype.generateElement=function(a){var b=this,c=Entry.createElement("li",a.id);c.addClass("entrySceneElementWorkspace");c.addClass("entrySceneButtonWorkspace");c.addClass("minValue");$(c).on("mousedown",function(b){Entry.engine.isState("run")?b.preventDefault():Entry.scene.selectScene(a)});var d=Entry.createElement("input");d.addClass("entrySceneFieldWorkspace");d.value=a.name;Entry.sceneEditable||(d.disabled="disabled");var e=Entry.createElement("span");e.addClass("entrySceneLeftWorkspace"); +c.appendChild(e);var f=Entry.createElement("span");f.addClass("entrySceneInputCover");f.style.width=Entry.computeInputWidth(a.name);c.appendChild(f);a.inputWrapper=f;d.onkeyup=function(c){c=c.keyCode;Entry.isArrowOrBackspace(c)||(a.name=this.value,f.style.width=Entry.computeInputWidth(a.name),b.resize(),13==c&&this.blur(),9=this.getScenes().length)Entry.toast.alert(Lang.Msgs.runtime_error,Lang.Workspace.Scene_delete_error,!1);else{var b=this.getScenes().indexOf(this.getSceneById(a.id));this.getScenes().splice(b,1);this.selectScene();for(var b=Entry.container.getSceneObjects(a),c=0;c=this.maxCount)Entry.toast.alert(Lang.Msgs.runtime_error,Lang.Workspace.Scene_add_error,!1);else{var b={name:a.name+Lang.Workspace.replica_of_object,id:Entry.generateHash()};this.generateElement(b);this.addScene(b);a=Entry.container.getSceneObjects(a);for(var c=a.length-1;0<=c;c--)Entry.container.addCloneObject(a[c],b.id)}}; +Entry.Scene.prototype.resize=function(){var a=this.getScenes(),b=this.selectedScene,c=a[0];if(0!==a.length&&c){var d=$(c.view).offset().left,c=parseFloat($(b.view).css("margin-left")),e=$(this.view_).width()-d,f=0,g;for(g in a){var d=a[g],h=d.view;h.addClass("minValue");$(h).removeProp("style");$(d.inputWrapper).width(Entry.computeInputWidth(d.name));h=$(h);f=f+h.width()+c}if(f>e)for(g in e-=$(b.view).width(),c=e/(a.length-1)-(Entry.Scene.viewBasicWidth+c),a)d=a[g],b.id!=d.id?(d.view.removeClass("minValue"), +$(d.inputWrapper).width(c)):d.view.addClass("minValue")}};Entry.Scene.prototype.getNextScene=function(){var a=this.getScenes();return a[a.indexOf(this.selectedScene)+1]};Entry.Script=function(a){this.entity=a};p=Entry.Script.prototype; +p.init=function(a,b,c){Entry.assert("BLOCK"==a.tagName.toUpperCase(),a.tagName);this.type=a.getAttribute("type");this.id=+a.getAttribute("id");a.getElementsByTagName("mutation").length&&a.getElementsByTagName("mutation")[0].hasAttribute("hashid")&&(this.hashId=a.childNodes[0].getAttribute("hashid"));"REPEAT"==this.type.substr(0,6).toUpperCase()&&(this.isRepeat=!0);b instanceof Entry.Script&&(this.previousScript=b,b.parentScript&&(this.parentScript=b.parentScript));c instanceof Entry.Script&&(this.parentScript= +c);a=a.childNodes;for(b=0;ba.getScaleX()?a.setScaleX(-b.width/a.width):a.setScaleX(b.width/a.width)),0!==a.height&&a.setScaleY(b.height/a.height));var c=b.rotation/180*Math.PI;if("textBox"==a.type){var d=b.regX/a.scaleX,d=b.regY/a.scaleY;if(a.getLineBreak())a.setX(b.x),a.setY(-b.y);else switch(a.getTextAlign()){case Entry.TEXT_ALIGN_LEFT:a.setX(b.x- -b.width/2*Math.cos(c));a.setY(-b.y+b.width/2*Math.sin(c));break;case Entry.TEXT_ALIGN_CENTER:a.setX(b.x);a.setY(-b.y);break;case Entry.TEXT_ALIGN_RIGHT:a.setX(b.x+b.width/2*Math.cos(c)),a.setY(-b.y-b.width/2*Math.sin(c))}}else d=a.width/2+b.regX/a.scaleX,a.setX(b.x+b.regX*Math.cos(c)-b.regY*Math.sin(c)),a.setRegX(d),d=a.height/2+b.regY/a.scaleY,a.setY(-b.y-b.regX*Math.sin(c)-b.regY*Math.cos(c)),a.setRegY(d);a.setDirection(b.direction);a.setRotation(b.rotation);this.selectedObject.entity.doCommand(); +Entry.Stage.prototype.updateObject=function(){this.handle.setDraggable(!0);if(!this.editEntity){var a=this.selectedObject;if(a){"textBox"==a.objectType?this.handle.toggleCenter(!1):this.handle.toggleCenter(!0);"free"==a.getRotateMethod()?this.handle.toggleRotation(!0):this.handle.toggleRotation(!1);this.handle.toggleDirection(!0);a.getLock()?(this.handle.toggleRotation(!1),this.handle.toggleDirection(!1),this.handle.toggleResize(!1),this.handle.toggleCenter(!1),this.handle.setDraggable(!1)):this.handle.toggleResize(!0); +this.handle.setVisible(!0);var b=a.entity;this.handle.setWidth(b.getScaleX()*b.getWidth());this.handle.setHeight(b.getScaleY()*b.getHeight());var c,d;if("textBox"==b.type)if(b.getLineBreak())c=b.regX*b.scaleX,d=-b.regY*b.scaleY;else{var e=b.getTextAlign();d=-b.regY*b.scaleY;switch(e){case Entry.TEXT_ALIGN_LEFT:c=-b.getWidth()/2*b.scaleX;break;case Entry.TEXT_ALIGN_CENTER:c=b.regX*b.scaleX;break;case Entry.TEXT_ALIGN_RIGHT:c=b.getWidth()/2*b.scaleX}}else c=(b.regX-b.width/2)*b.scaleX,d=(b.height/2- +b.regY)*b.scaleY;e=b.getRotation()/180*Math.PI;this.handle.setX(b.getX()-c*Math.cos(e)-d*Math.sin(e));this.handle.setY(-b.getY()-c*Math.sin(e)+d*Math.cos(e));this.handle.setRegX((b.regX-b.width/2)*b.scaleX);this.handle.setRegY((b.regY-b.height/2)*b.scaleY);this.handle.setRotation(b.getRotation());this.handle.setDirection(b.getDirection());this.objectUpdated=!0;this.handle.setVisible(a.entity.getVisible());a.entity.getVisible()&&this.handle.render()}else this.handle.setVisible(!1)}}; +Entry.Stage.prototype.updateHandle=function(){this.editEntity=!0;var a=this.handle,b=this.selectedObject.entity;b.lineBreak?(b.setHeight(a.height/b.getScaleY()),b.setWidth(a.width/b.getScaleX())):(0!==b.width&&(0>b.getScaleX()?b.setScaleX(-a.width/b.width):b.setScaleX(a.width/b.width)),0!==b.height&&b.setScaleY(a.height/b.height));var c=a.rotation/180*Math.PI;if("textBox"==b.type){var d=a.regX/b.scaleX,d=a.regY/b.scaleY;if(b.getLineBreak())b.setX(a.x),b.setY(-a.y);else switch(b.getTextAlign()){case Entry.TEXT_ALIGN_LEFT:b.setX(a.x- +a.width/2*Math.cos(c));b.setY(-a.y+a.width/2*Math.sin(c));break;case Entry.TEXT_ALIGN_CENTER:b.setX(a.x);b.setY(-a.y);break;case Entry.TEXT_ALIGN_RIGHT:b.setX(a.x+a.width/2*Math.cos(c)),b.setY(-a.y-a.width/2*Math.sin(c))}}else d=b.width/2+a.regX/b.scaleX,b.setX(a.x+a.regX*Math.cos(c)-a.regY*Math.sin(c)),b.setRegX(d),d=b.height/2+a.regY/b.scaleY,b.setY(-a.y-a.regX*Math.sin(c)-a.regY*Math.cos(c)),b.setRegY(d);b.setDirection(a.direction);b.setRotation(a.rotation);this.selectedObject.entity.doCommand(); this.editEntity=!1};Entry.Stage.prototype.startEdit=function(){this.selectedObject.entity.initCommand()};Entry.Stage.prototype.endEdit=function(){this.selectedObject.entity.checkCommand()}; -Entry.Stage.prototype.initWall=function(){var b=new createjs.Container,a=new Image;a.src=Entry.mediaFilePath+"media/bound.png";b.up=new createjs.Bitmap;b.up.scaleX=16;b.up.y=-165;b.up.x=-240;b.up.image=a;b.addChild(b.up);b.down=new createjs.Bitmap;b.down.scaleX=16;b.down.y=135;b.down.x=-240;b.down.image=a;b.addChild(b.down);b.right=new createjs.Bitmap;b.right.scaleY=9;b.right.y=-135;b.right.x=240;b.right.image=a;b.addChild(b.right);b.left=new createjs.Bitmap;b.left.scaleY=9;b.left.y=-135;b.left.x= --270;b.left.image=a;b.addChild(b.left);this.canvas.addChild(b);this.wall=b}; -Entry.Stage.prototype.showInputField=function(b){b=1/1.5;this.inputField||(this.inputField=new CanvasInput({canvas:document.getElementById("entryCanvas"),fontSize:30*b,fontFamily:"NanumGothic",fontColor:"#212121",width:556*b,height:26*b,padding:8*b,borderWidth:1*b,borderColor:"#000",borderRadius:3*b,boxShadow:"none",innerShadow:"0px 0px 5px rgba(0, 0, 0, 0.5)",x:202*b,y:450*b,topPosition:!0,onsubmit:function(){Entry.dispatchEvent("canvasInputComplete")}}));b=new createjs.Container;var a=new Image; -a.src=Entry.mediaFilePath+"confirm_button.png";var c=new createjs.Bitmap;c.scaleX=.23;c.scaleY=.23;c.x=160;c.y=89;c.cursor="pointer";c.image=a;b.addChild(c);b.on("mousedown",function(a){Entry.dispatchEvent("canvasInputComplete")});this.inputSubmitButton||(this.inputField.value(""),this.canvas.addChild(b),this.inputSubmitButton=b);this.inputField.show()}; +Entry.Stage.prototype.initWall=function(){var a=new createjs.Container,b=new Image;b.src=Entry.mediaFilePath+"media/bound.png";a.up=new createjs.Bitmap;a.up.scaleX=16;a.up.y=-165;a.up.x=-240;a.up.image=b;a.addChild(a.up);a.down=new createjs.Bitmap;a.down.scaleX=16;a.down.y=135;a.down.x=-240;a.down.image=b;a.addChild(a.down);a.right=new createjs.Bitmap;a.right.scaleY=9;a.right.y=-135;a.right.x=240;a.right.image=b;a.addChild(a.right);a.left=new createjs.Bitmap;a.left.scaleY=9;a.left.y=-135;a.left.x= +-270;a.left.image=b;a.addChild(a.left);this.canvas.addChild(a);this.wall=a}; +Entry.Stage.prototype.showInputField=function(a){a=1/1.5;this.inputField||(this.inputField=new CanvasInput({canvas:document.getElementById("entryCanvas"),fontSize:30*a,fontFamily:"NanumGothic",fontColor:"#212121",width:556*a,height:26*a,padding:8*a,borderWidth:1*a,borderColor:"#000",borderRadius:3*a,boxShadow:"none",innerShadow:"0px 0px 5px rgba(0, 0, 0, 0.5)",x:202*a,y:450*a,topPosition:!0,onsubmit:function(){Entry.dispatchEvent("canvasInputComplete")}}));a=new createjs.Container;var b=new Image; +b.src=Entry.mediaFilePath+"confirm_button.png";var c=new createjs.Bitmap;c.scaleX=.23;c.scaleY=.23;c.x=160;c.y=89;c.cursor="pointer";c.image=b;a.addChild(c);a.on("mousedown",function(b){Entry.dispatchEvent("canvasInputComplete")});this.inputSubmitButton||(this.inputField.value(""),this.canvas.addChild(a),this.inputSubmitButton=a);this.inputField.show()}; Entry.Stage.prototype.hideInputField=function(){this.inputField&&this.inputField.value()&&this.inputField.value("");this.inputSubmitButton&&(this.canvas.removeChild(this.inputSubmitButton),this.inputSubmitButton=null);this.inputField&&this.inputField.hide()}; -Entry.Stage.prototype.initObjectContainers=function(){var b=Entry.scene.scenes_;if(b&&0!==b.length){for(var a=0;ad.style.opacity&&(clearInterval(a),d.style.display="none",Entry.removeElement(d));d.style.opacity*=.9},20)},1E3)}; -Entry.Toast.prototype.success=function(b,a,c){var d=Entry.createElement("div","entryToast");d.addClass("entryToast");d.addClass("entryToastSuccess");d.bindOnClick(function(){Entry.toast.body_.removeChild(this)});var e=Entry.createElement("div","entryToast");e.addClass("entryToastTitle");e.innerHTML=b;d.appendChild(e);b=Entry.createElement("p","entryToast");b.addClass("entryToastMessage");b.innerHTML=a;d.appendChild(b);this.toasts_.push(d);this.body_.appendChild(d);c||window.setTimeout(function(){d.style.opacity= -1;var a=setInterval(function(){.05>d.style.opacity&&(clearInterval(a),d.style.display="none",Entry.removeElement(d));d.style.opacity*=.9},20)},1E3)}; -Entry.Toast.prototype.alert=function(b,a,c){var d=Entry.createElement("div","entryToast");d.addClass("entryToast");d.addClass("entryToastAlert");d.bindOnClick(function(){Entry.toast.body_.removeChild(this)});var e=Entry.createElement("div","entryToast");e.addClass("entryToastTitle");e.innerHTML=b;d.appendChild(e);b=Entry.createElement("p","entryToast");b.addClass("entryToastMessage");b.innerHTML=a;d.appendChild(b);this.toasts_.push(d);this.body_.appendChild(d);c||window.setTimeout(function(){d.style.opacity= -1;var a=setInterval(function(){.05>d.style.opacity&&(clearInterval(a),d.style.display="none",Entry.toast.body_.removeChild(d));d.style.opacity*=.9},20)},5E3)};Entry.TvCast=function(b){this.generateView(b)};p=Entry.TvCast.prototype;p.init=function(b){this.tvCastHash=b};p.generateView=function(b){var a=Entry.createElement("div");a.addClass("entryContainerMovieWorkspace");a.addClass("entryHidden");this.movieContainer=a;a=Entry.createElement("iframe");a.setAttribute("id","tvCastIframe");a.setAttribute("allowfullscreen","");a.setAttribute("frameborder",0);a.setAttribute("src",b);this.movieFrame=a;this.movieContainer.appendChild(this.movieFrame)};p.getView=function(){return this.movieContainer}; -p.resize=function(){var b=document.getElementById("entryContainerWorkspaceId"),a=document.getElementById("tvCastIframe");w=b.offsetWidth;a.width=w+"px";a.height=9*w/16+"px"};Entry.ContextMenu={}; -(function(b){b.createDom=function(){this.dom=Entry.Dom("ul",{id:"entry-contextmenu",parent:$("body")});Entry.Utils.disableContextmenu(this.dom);Entry.documentMousedown.attach(this,function(){this.hide()})};b.show=function(a,b){this.dom||this.createDom();if(0!==a.length){var d=this;void 0!==b&&(this._className=b,this.dom.addClass(b));var e=this.dom;e.empty();for(var f=0,g=a.length;fg&&(a.x-=d+3);a.y+e>f&&(a.y-=e);b.css({left:a.x,top:a.y})};b.hide=function(){this.dom.empty();this.dom.addClass("entryRemove");this._className&&(this.dom.removeClass(this._className),delete this._className)}})(Entry.ContextMenu);Entry.STATIC={OBJECT:0,ENTITY:1,SPRITE:2,SOUND:3,VARIABLE:4,FUNCTION:5,SCENE:6,MESSAGE:7,BLOCK_MODEL:8,BLOCK_RENDER_MODEL:9,BOX_MODEL:10,THREAD_MODEL:11,DRAG_INSTANCE:12,BLOCK_STATIC:0,BLOCK_MOVE:1,BLOCK_FOLLOW:2,RETURN:0,CONTINUE:1};Entry.Utils={};Entry.overridePrototype=function(){Number.prototype.mod=function(b){return(this%b+b)%b}};Entry.Utils.generateId=function(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).substr(-4)};Entry.Utils.intersectArray=function(b,a){for(var c=[],d=0;d=a.x&&e-c<=a.y&&e+b.height+c>=a.y}; -Entry.Utils.colorDarken=function(b,a){var c,d,e;7===b.length?(c=parseInt(b.substr(1,2),16),d=parseInt(b.substr(3,2),16),e=parseInt(b.substr(5,2),16)):(c=parseInt(b.substr(1,2),16),d=parseInt(b.substr(2,2),16),e=parseInt(b.substr(3,2),16));a=void 0===a?.7:a;c=Math.floor(c*a).toString(16);d=Math.floor(d*a).toString(16);e=Math.floor(e*a).toString(16);return"#"+c+d+e}; -Entry.Utils.bindGlobalEvent=function(b){void 0===b&&(b=["resize","mousedown","mousemove","keydown","keyup"]);!Entry.windowReszied&&-1Entry.pressedKeys.indexOf(b)&&Entry.pressedKeys.push(b);Entry.keyPressed.notify(a)}));!Entry.keyUpped&&-1$1://$2").replace(/([xA1-xFEa-z0-9_-]+@[xA1-xFEa-z0-9-]+.[a-z0-9-]+)/gi,"$1"):""};Entry.generateHash=function(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).substr(-4)}; -Entry.addEventListener=function(b,a){this.events_||(this.events_={});this.events_[b]||(this.events_[b]=[]);a instanceof Function&&this.events_[b].push(a);return!0};Entry.dispatchEvent=function(b,a){this.events_||(this.events_={});if(this.events_[b])for(var c=0,d=this.events_[b].length;c=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:bd.style.opacity&&(clearInterval(b),d.style.display="none",Entry.removeElement(d));d.style.opacity*=.9},20)},1E3)}; +Entry.Toast.prototype.success=function(a,b,c){var d=Entry.createElement("div","entryToast");d.addClass("entryToast");d.addClass("entryToastSuccess");d.bindOnClick(function(){Entry.toast.body_.removeChild(this)});var e=Entry.createElement("div","entryToast");e.addClass("entryToastTitle");e.innerHTML=a;d.appendChild(e);a=Entry.createElement("p","entryToast");a.addClass("entryToastMessage");a.innerHTML=b;d.appendChild(a);this.toasts_.push(d);this.body_.appendChild(d);c||window.setTimeout(function(){d.style.opacity= +1;var b=setInterval(function(){.05>d.style.opacity&&(clearInterval(b),d.style.display="none",Entry.removeElement(d));d.style.opacity*=.9},20)},1E3)}; +Entry.Toast.prototype.alert=function(a,b,c){var d=Entry.createElement("div","entryToast");d.addClass("entryToast");d.addClass("entryToastAlert");d.bindOnClick(function(){Entry.toast.body_.removeChild(this)});var e=Entry.createElement("div","entryToast");e.addClass("entryToastTitle");e.innerHTML=a;d.appendChild(e);a=Entry.createElement("p","entryToast");a.addClass("entryToastMessage");a.innerHTML=b;d.appendChild(a);this.toasts_.push(d);this.body_.appendChild(d);c||window.setTimeout(function(){d.style.opacity= +1;var b=setInterval(function(){.05>d.style.opacity&&(clearInterval(b),d.style.display="none",Entry.toast.body_.removeChild(d));d.style.opacity*=.9},20)},5E3)};Entry.TvCast=function(a){this.generateView(a)};p=Entry.TvCast.prototype;p.init=function(a){this.tvCastHash=a};p.generateView=function(a){var b=Entry.createElement("div");b.addClass("entryContainerMovieWorkspace");b.addClass("entryHidden");this.movieContainer=b;b=Entry.createElement("iframe");b.setAttribute("id","tvCastIframe");b.setAttribute("allowfullscreen","");b.setAttribute("frameborder",0);b.setAttribute("src",a);this.movieFrame=b;this.movieContainer.appendChild(this.movieFrame)};p.getView=function(){return this.movieContainer}; +p.resize=function(){var a=document.getElementById("entryContainerWorkspaceId"),b=document.getElementById("tvCastIframe");w=a.offsetWidth;b.width=w+"px";b.height=9*w/16+"px"};Entry.ContextMenu={}; +(function(a){a.createDom=function(){this.dom=Entry.Dom("ul",{id:"entry-contextmenu",parent:$("body")});Entry.Utils.disableContextmenu(this.dom);Entry.documentMousedown.attach(this,function(){this.hide()})};a.show=function(b,a){this.dom||this.createDom();if(0!==b.length){var d=this;void 0!==a&&(this._className=a,this.dom.addClass(a));var e=this.dom;e.empty();for(var f=0,g=b.length;fg&&(b.x-=d+3);b.y+e>f&&(b.y-=e);a.css({left:b.x,top:b.y})};a.hide=function(){this.dom.empty();this.dom.addClass("entryRemove");this._className&&(this.dom.removeClass(this._className),delete this._className)}})(Entry.ContextMenu);Entry.STATIC={OBJECT:0,ENTITY:1,SPRITE:2,SOUND:3,VARIABLE:4,FUNCTION:5,SCENE:6,MESSAGE:7,BLOCK_MODEL:8,BLOCK_RENDER_MODEL:9,BOX_MODEL:10,THREAD_MODEL:11,DRAG_INSTANCE:12,BLOCK_STATIC:0,BLOCK_MOVE:1,BLOCK_FOLLOW:2,RETURN:0,CONTINUE:1};Entry.Utils={};Entry.overridePrototype=function(){Number.prototype.mod=function(a){return(this%a+a)%a}};Entry.Utils.generateId=function(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).substr(-4)};Entry.Utils.intersectArray=function(a,b){for(var c=[],d=0;d=b.x&&e-c<=b.y&&e+a.height+c>=b.y}; +Entry.Utils.colorDarken=function(a,b){var c,d,e;7===a.length?(c=parseInt(a.substr(1,2),16),d=parseInt(a.substr(3,2),16),e=parseInt(a.substr(5,2),16)):(c=parseInt(a.substr(1,2),16),d=parseInt(a.substr(2,2),16),e=parseInt(a.substr(3,2),16));b=void 0===b?.7:b;c=Math.floor(c*b).toString(16);d=Math.floor(d*b).toString(16);e=Math.floor(e*b).toString(16);return"#"+c+d+e}; +Entry.Utils.bindGlobalEvent=function(a){void 0===a&&(a=["resize","mousedown","mousemove","keydown","keyup"]);!Entry.windowReszied&&-1Entry.pressedKeys.indexOf(a)&&Entry.pressedKeys.push(a);Entry.keyPressed.notify(b)}));!Entry.keyUpped&&-1$1://$2").replace(/([xA1-xFEa-z0-9_-]+@[xA1-xFEa-z0-9-]+.[a-z0-9-]+)/gi,"$1"):""};Entry.generateHash=function(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).substr(-4)}; +Entry.addEventListener=function(a,b){this.events_||(this.events_={});this.events_[a]||(this.events_[a]=[]);b instanceof Function&&this.events_[a].push(b);return!0};Entry.dispatchEvent=function(a,b){this.events_||(this.events_={});if(this.events_[a])for(var c=0,d=this.events_[a].length;c=f?(parseFloat(a)+parseFloat(b)).toFixed(e):(parseFloat(a)+parseFloat(b)).toFixed(f):parseInt(a)+parseInt(b)}; +Entry.hex2rgb=function(a){return(a=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a))?{r:parseInt(a[1],16),g:parseInt(a[2],16),b:parseInt(a[3],16)}:null};Entry.rgb2hex=function(a,b,c){return"#"+(16777216+(a<<16)+(b<<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(a,b,c){return a>c?c:aa.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;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.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.COLLISION={NONE:0,UP:1,RIGHT:2,LEFT:3,DOWN:4};Entry.Model=function(b,a){var c=Entry.Model;c.generateSchema(b);c.generateSetter(b);c.generateObserve(b);(void 0===a||a)&&Object.seal(b);return b}; -(function(b){b.generateSchema=function(a){var b=a.schema;if(void 0!==b){b=JSON.parse(JSON.stringify(b));a.data={};for(var d in b)(function(d){a.data[d]=b[d];Object.defineProperty(a,d,{get:function(){return a.data[d]}})})(d);a._toJSON=this._toJSON}};b.generateSetter=function(a){a.set=this.set};b.set=function(a,b){var d={},e;for(e in this.data)void 0!==a[e]&&(a[e]===this.data[e]?delete a[e]:(d[e]=this.data[e],this.data[e]=a[e]));b||this.notify(Object.keys(a),d)};b.generateObserve=function(a){a.observers= -[];a.observe=this.observe;a.unobserve=this.unobserve;a.notify=this.notify};b.observe=function(a,b,d,e){d=new Entry.Observer(this.observers,a,b,d);if(!1!==e)a[b]([]);return d};b.unobserve=function(a){a.destroy()};b.notify=function(a,b){"string"===typeof a&&(a=[a]);var d=this;d.observers.map(function(e){var f=a;void 0!==e.attrs&&(f=Entry.Utils.intersectArray(e.attrs,a));if(f.length)e.object[e.funcName](f.map(function(a){return{name:a,object:d,oldValue:b[a]}}))})};b._toJSON=function(){var a={},b;for(b in this.data)a[b]= -this.data[b];return a}})(Entry.Model);Entry.Func=function(){this.id=Entry.generateHash();this.content=Blockly.Xml.textToDom(Entry.Func.CREATE_BLOCK);this.block=null;this.stringHash={};this.booleanHash={}};Entry.Func.threads={};Entry.Func.registerFunction=function(b,a){var c=Entry.generateHash(),d=Entry.variableContainer.getFunction(b),e=new Entry.Script(a);e.init(d.content.childNodes[0]);this.threads[c]=e;return c}; -Entry.Func.executeFunction=function(b){var a=this.threads[b];if(a=Entry.Engine.computeThread(a.entity,a))return this.threads[b]=a,!0;delete this.threads[b];return!1};Entry.Func.clearThreads=function(){this.threads={}};Entry.Func.prototype.init=function(b){this.id=b.id;this.content=Blockly.Xml.textToDom(b.content);this.block=Blockly.Xml.textToDom(""+b.block+"").childNodes[0]};Entry.Func.CREATE_BTN=''; +Entry.checkCollisionRect=function(a,b){return!(a.y+a.heightb.y+b.height||a.x+a.widthb.x+b.width)};Entry.bindAnimationCallback=function(a,b){a.addEventListener("webkitAnimationEnd",b,!1);a.addEventListener("animationend",b,!1);a.addEventListener("oanimationend",b,!1)};Entry.cloneSimpleObject=function(a){var b={},c;for(c in a)b[c]=a[c];return b};Entry.nodeListToArray=function(a){for(var b=Array(a.length),c=-1,d=a.length;++c!==d;b[c]=a[c]);return b}; +Entry.computeInputWidth=function(a){var b=document.createElement("span");b.className="tmp-element";b.innerHTML=a.replace(/&/g,"&").replace(//g,">");document.body.appendChild(b);a=b.offsetWidth;document.body.removeChild(b);return+(a+10)+"px"};Entry.isArrowOrBackspace=function(a){return-1<[37,38,39,40,8].indexOf(a)};Entry.hexStringToBin=function(a){for(var b=[],c=0;cd&&(d=h.index)}return 0b&&(b=e))}return Math.min(b,20)};Entry.convertToRoundedDecimals=function(a,b){return isNaN(a)||!this.isFloat(a)?a:+(Math.round(a+"e"+b)+"e-"+b)};Entry.attachEventListener=function(a,b,c){setTimeout(function(){a.addEventListener(b,c)},0)};Entry.deAttachEventListener=function(a,b,c){a.removeEventListener(b,c)}; +Entry.isEmpty=function(a){if(!a)return!0;for(var b in a)if(a.hasOwnProperty(b))return!1;return!0};Entry.Utils.disableContextmenu=function(a){if(a)$(a).on("contextmenu",function(b){b.stopPropagation();b.preventDefault();return!1})};Entry.Utils.isRightButton=function(a){return 2==a.button||a.ctrlKey};Entry.Utils.COLLISION={NONE:0,UP:1,RIGHT:2,LEFT:3,DOWN:4};Entry.Model=function(a,b){var c=Entry.Model;c.generateSchema(a);c.generateSetter(a);c.generateObserve(a);(void 0===b||b)&&Object.seal(a);return a}; +(function(a){a.generateSchema=function(b){var a=b.schema;if(void 0!==a){a=JSON.parse(JSON.stringify(a));b.data={};for(var d in a)(function(d){b.data[d]=a[d];Object.defineProperty(b,d,{get:function(){return b.data[d]}})})(d);b._toJSON=this._toJSON}};a.generateSetter=function(b){b.set=this.set};a.set=function(b,a){var d={},e;for(e in this.data)void 0!==b[e]&&(b[e]===this.data[e]?delete b[e]:(d[e]=this.data[e],this.data[e]=b[e]));a||this.notify(Object.keys(b),d)};a.generateObserve=function(b){b.observers= +[];b.observe=this.observe;b.unobserve=this.unobserve;b.notify=this.notify};a.observe=function(b,a,d,e){d=new Entry.Observer(this.observers,b,a,d);if(!1!==e)b[a]([]);return d};a.unobserve=function(b){b.destroy()};a.notify=function(b,a){"string"===typeof b&&(b=[b]);var d=this;d.observers.map(function(e){var f=b;void 0!==e.attrs&&(f=Entry.Utils.intersectArray(e.attrs,b));if(f.length)e.object[e.funcName](f.map(function(b){return{name:b,object:d,oldValue:a[b]}}))})};a._toJSON=function(){var b={},a;for(a in this.data)b[a]= +this.data[a];return b}})(Entry.Model);Entry.Func=function(){this.id=Entry.generateHash();this.content=Blockly.Xml.textToDom(Entry.Func.CREATE_BLOCK);this.block=null;this.stringHash={};this.booleanHash={}};Entry.Func.threads={};Entry.Func.registerFunction=function(a,b){var c=Entry.generateHash(),d=Entry.variableContainer.getFunction(a),e=new Entry.Script(b);e.init(d.content.childNodes[0]);this.threads[c]=e;return c}; +Entry.Func.executeFunction=function(a){var b=this.threads[a];if(b=Entry.Engine.computeThread(b.entity,b))return this.threads[a]=b,!0;delete this.threads[a];return!1};Entry.Func.clearThreads=function(){this.threads={}};Entry.Func.prototype.init=function(a){this.id=a.id;this.content=Blockly.Xml.textToDom(a.content);this.block=Blockly.Xml.textToDom(""+a.block+"").childNodes[0]};Entry.Func.CREATE_BTN=''; Entry.Func.createBtn=Entry.nodeListToArray(Blockly.Xml.textToDom(Entry.Func.CREATE_BTN).childNodes);Entry.Func.FIELD_BLOCK='';Entry.Func.fieldBlocks=Entry.nodeListToArray(Blockly.Xml.textToDom(Entry.Func.FIELD_BLOCK).childNodes); Entry.Func.CREATE_BLOCK=''; -Entry.Func.edit=function(b){this.srcFName="";for(var a=$(b.content.innerHTML).find("field"),c=0;cBlockly.Block.dragMode_&&(b.updateMenu(),b.fieldText=a,b.workspaceLength=c)}}; -Entry.Func.updateMenu=function(){if("func"==Entry.playground.selectedMenu&&(Entry.playground.blockMenu.hide(),Entry.playground.blockMenu.show(Entry.Func.getMenuXml()),!Blockly.WidgetDiv.field_&&Entry.Func.targetFunc)){var b=Entry.Func.targetFunc,a=Blockly.Xml.workspaceToDom(Entry.Func.workspace),c=a.getElementsByClassName("function_general"),d=b.id,e,c=Entry.nodeListToArray(c),f=[],g={};c.map(function(a){var b=a.getElementsByTagName("mutation")[0].getAttribute("hashid");b==d?f.push(a):(g[b]||(g[b]= -[]),g[b].push(a))});f.map(function(b){e=Entry.Func.generateWsBlock(a,Blockly.Xml.workspaceToDom(Entry.Func.workspace),d).block;for(var c=[],f=!1;b.firstChild;){var g=b.firstChild,h=g.tagName;if(f||"NEXT"==h)f=!0,c.push(g);b.removeChild(g)}for(;e.firstChild;)b.appendChild(e.firstChild);for(;c.length;)b.appendChild(c.shift())});for(var h in g){var b=g[h],k=Entry.variableContainer.getFunction(h).content;b.map(function(b){e=Entry.Func.generateWsBlock(a,k,h).block;for(var c=[],d=!1;b.firstChild;){var f= -b.firstChild,g=f.tagName;if(d||"NEXT"==g)d=!0,c.push(f);b.removeChild(f)}for(;e.firstChild;)b.appendChild(e.firstChild);for(;c.length;)b.appendChild(c.shift())})}Entry.Func.workspace.clear();Blockly.Xml.domToWorkspace(Entry.Func.workspace,a)}};Entry.Func.prototype.edit=function(){Entry.Func.isEdit||(Entry.Func.isEdit=!0,Entry.Func.svg?this.parentView.appendChild(this.svg):Entry.Func.initEditView())}; -Entry.Func.generateBlock=function(b,a,c){a=Entry.nodeListToArray(a.childNodes);var d,e;for(e in a)"function_create"==a[e].getAttribute("type")&&(d=a[e]);e=new Entry.Script;e.init(d);d=e;d.values&&(d=e.values.FIELD);e='';c=a="";var f=0,g=0;b.stringHash={};for(b.booleanHash={};;){switch(d.type){case "function_field_label":e+='",">")+'">';c+=d.fields.NAME;break;case "function_field_boolean":var h= -d.values.PARAM.hashId;e+='';a+='';b.booleanHash[h]=g;g++;c+="\ub17c\ub9ac\uac12"+g;break;case "function_field_string":h=d.values.PARAM.hashId,e+='',a+='10',b.stringHash[h]=f,f++,c+="\ubb38\uc790\uac12"+f}if(d.values&&d.values.NEXT)d=d.values.NEXT;else break;c+=" "}b=Blockly.Xml.textToDom(''+ -(e+"")+a+"").childNodes[0];c||(c="\ud568\uc218");return{block:b,description:c}};Entry.Func.prototype.generateBlock=function(b){b=Entry.Func.generateBlock(this,this.content,this.id);this.block=b.block;this.description=b.description};Entry.Func.prototype.syncViewSize_=function(){var b=this.parentView.getBoundingClientRect();this.svg.style.width=b.width;this.svg.style.height=b.height}; -Entry.Func.generateButtons=function(){var b=this,a=Blockly.createSvgElement("g",{},this.svg);this.btnWrapper=a;var c=Blockly.createSvgElement("text",{x:"27",y:"33","class":"entryFunctionButtonText"},a),d=document.createTextNode(Lang.Buttons.save);c.appendChild(d);var d=Blockly.createSvgElement("text",{x:"102.5",y:"33","class":"entryFunctionButtonText"},a),e=document.createTextNode(Lang.Buttons.cancel);d.appendChild(e);e=Blockly.createSvgElement("circle",{cx:"27.5",cy:"27.5",r:"27.5","class":"entryFunctionButton"}, -a);a=Blockly.createSvgElement("circle",{cx:"102.5",cy:"27.5",r:"27.5","class":"entryFunctionButton"},a);e.onclick=function(a){b.save()};c.onclick=function(a){b.save()};a.onclick=function(a){b.cancelEdit()};d.onclick=function(a){b.cancelEdit()}}; -Entry.Func.position_=function(){var b=this.workspace.getMetrics();if(b&&this.workspace.visible){var a=this.btnWrapper;a.setAttribute("transform","translate(30, 501)");Blockly.RTL?this.left_=this.MARGIN_SIDE_:a.left_=b.viewWidth/2+b.absoluteLeft-60;a.top_=b.viewHeight+b.absoluteTop-200;a.setAttribute("transform","translate("+a.left_+","+a.top_+")")}}; -Entry.Func.positionBlock_=function(b){var a=this.workspace.getMetrics();if(a&&this.workspace.visible){var c=b.getSvgRoot(),c=Blockly.getSvgXY_(c);b.getHeightWidth();b.moveBy(a.viewWidth/2-80-c.x,a.viewHeight/2-50-c.y)}}; -Entry.Func.doWhenInit=function(){var b=this.svg;b.appendChild(Blockly.fieldKeydownDom);b.appendChild(Blockly.fieldDropdownDom);b.appendChild(Blockly.contextMenu);Blockly.bindEvent_(window,"resize",this,this.position_);Blockly.bindEvent_(b,"mousedown",null,Blockly.onMouseDown_);Blockly.bindEvent_(b,"contextmenu",null,Blockly.onContextMenu_)}; -Entry.Func.doWhenCancel=function(){Blockly.clipboard_=null;var b=Blockly.svg;b.appendChild(Blockly.fieldKeydownDom);b.appendChild(Blockly.fieldDropdownDom);b.appendChild(Blockly.contextMenu);Blockly.unbindEvent_(window,"resize",this,this.position_);Blockly.unbindEvent_(b,"mousedown",null,Blockly.onMouseDown_);Blockly.unbindEvent_(b,"contextmenu",null,Blockly.onContextMenu_)}; -Entry.Func.generateWsBlock=function(b,a,c){a=a.childNodes;var d,e;for(e in a)if("function_create"==a[e].getAttribute("type")){d=a[e];break}e=new Entry.Script;e.init(d);d=e;d.values&&(d=e.values.FIELD);c='';a=e="";var f=0,g=0;b.stringHash={};for(b.booleanHash={};;){switch(d.type){case "function_field_label":c+='",">")+'">';a+=d.fields.NAME;break;case "function_field_boolean":var h=d.values.PARAM.hashId; -c+='';e+='';b.booleanHash[h]=g;g++;a+="\ub17c\ub9ac\uac12"+g;break;case "function_field_string":h=d.values.PARAM.hashId,c+='',e+='',b.stringHash[h]=f,f++,a+="\ubb38\uc790\uac12"+f}if(d.values&&d.values.NEXT)d= -d.values.NEXT;else break;a+=" "}a||(a="\ud568\uc218");return{block:Blockly.Xml.textToDom(''+(c+"")+e+"").childNodes[0],description:a}};Entry.HWMontior={};Entry.HWMonitor=function(b){this.svgDom=Entry.Dom($(''));this._hwModule=b;var a=this;Entry.addEventListener("windowResized",function(){var b=a._hwModule.monitorTemplate.mode;"both"==b&&(a.resize(),a.resizeList());"list"==b?a.resizeList():a.resize()});Entry.addEventListener("hwModeChange",function(){a.changeMode()});this.changeOffset=0;this.scale=.5;this._listPortViews={}}; -(function(b){b.initView=function(){this.svgDom=Entry.Dom($(''))};b.generateView=function(){this.snap=Entry.SVG("hwMonitor");this._svgGroup=this.snap.elem("g");this._portMap={n:[],e:[],s:[],w:[]};var a=this._hwModule.monitorTemplate,b={href:Entry.mediaFilePath+a.imgPath,x:-a.width/2,y:-a.height/2,width:a.width,height:a.height};this._portViews={};this.hwView=this._svgGroup.elem("image");this.hwView= -this.hwView.attr(b);this._template=a;a=a.ports;this.pathGroup=null;this.pathGroup=this._svgGroup.elem("g");var b=[],d;for(d in a){var e=this.generatePortView(a[d],"_svgGroup");this._portViews[d]=e;b.push(e)}b.sort(function(a,b){return a.box.x-b.box.x});var f=this._portMap;b.map(function(a){(1>(Math.atan2(-a.box.y,a.box.x)/Math.PI+2)%2?f.n:f.s).push(a)});this.resize()};b.toggleMode=function(a){var b=this._hwModule.monitorTemplate;"list"==a?(b.TempPort=null,this._hwModule.monitorTemplate.ports&&(this._hwModule.monitorTemplate.TempPort= +Entry.Func.getMenuXml=function(){var a=[];this.targetFunc||(a=a.concat(this.createBtn));if(this.targetFunc)var b=this.FIELD_BLOCK,b=b.replace("#1",Entry.generateHash()),b=b.replace("#2",Entry.generateHash()),b=Blockly.Xml.textToDom(b).childNodes,a=a.concat(Entry.nodeListToArray(b));for(var c in Entry.variableContainer.functions_)b=Entry.variableContainer.functions_[c],b===this.targetFunc?(b=Entry.Func.generateBlock(this.targetFunc,Blockly.Xml.workspaceToDom(Entry.Func.workspace),b.id).block,a.push(b)): +a.push(b.block);return a};Entry.Func.syncFunc=function(){var a=Entry.Func;if(a.targetFunc){var b=a.workspace.topBlocks_[0].toString(),c=a.workspace.topBlocks_.length;(a.fieldText!=b||a.workspaceLength!=c)&&1>Blockly.Block.dragMode_&&(a.updateMenu(),a.fieldText=b,a.workspaceLength=c)}}; +Entry.Func.updateMenu=function(){if("func"==Entry.playground.selectedMenu&&(Entry.playground.blockMenu.hide(),Entry.playground.blockMenu.show(Entry.Func.getMenuXml()),!Blockly.WidgetDiv.field_&&Entry.Func.targetFunc)){var a=Entry.Func.targetFunc,b=Blockly.Xml.workspaceToDom(Entry.Func.workspace),c=b.getElementsByClassName("function_general"),d=a.id,e,c=Entry.nodeListToArray(c),f=[],g={};c.map(function(b){var a=b.getElementsByTagName("mutation")[0].getAttribute("hashid");a==d?f.push(b):(g[a]||(g[a]= +[]),g[a].push(b))});f.map(function(a){e=Entry.Func.generateWsBlock(b,Blockly.Xml.workspaceToDom(Entry.Func.workspace),d).block;for(var c=[],f=!1;a.firstChild;){var g=a.firstChild,h=g.tagName;if(f||"NEXT"==h)f=!0,c.push(g);a.removeChild(g)}for(;e.firstChild;)a.appendChild(e.firstChild);for(;c.length;)a.appendChild(c.shift())});for(var h in g){var a=g[h],k=Entry.variableContainer.getFunction(h).content;a.map(function(a){e=Entry.Func.generateWsBlock(b,k,h).block;for(var c=[],d=!1;a.firstChild;){var f= +a.firstChild,g=f.tagName;if(d||"NEXT"==g)d=!0,c.push(f);a.removeChild(f)}for(;e.firstChild;)a.appendChild(e.firstChild);for(;c.length;)a.appendChild(c.shift())})}Entry.Func.workspace.clear();Blockly.Xml.domToWorkspace(Entry.Func.workspace,b)}};Entry.Func.prototype.edit=function(){Entry.Func.isEdit||(Entry.Func.isEdit=!0,Entry.Func.svg?this.parentView.appendChild(this.svg):Entry.Func.initEditView())}; +Entry.Func.generateBlock=function(a,b,c){b=Entry.nodeListToArray(b.childNodes);var d,e;for(e in b)"function_create"==b[e].getAttribute("type")&&(d=b[e]);e=new Entry.Script;e.init(d);d=e;d.values&&(d=e.values.FIELD);e='';c=b="";var f=0,g=0;a.stringHash={};for(a.booleanHash={};;){switch(d.type){case "function_field_label":e+='",">")+'">';c+=d.fields.NAME;break;case "function_field_boolean":var h= +d.values.PARAM.hashId;e+='';b+='';a.booleanHash[h]=g;g++;c+="\ub17c\ub9ac\uac12"+g;break;case "function_field_string":h=d.values.PARAM.hashId,e+='',b+='10',a.stringHash[h]=f,f++,c+="\ubb38\uc790\uac12"+f}if(d.values&&d.values.NEXT)d=d.values.NEXT;else break;c+=" "}a=Blockly.Xml.textToDom(''+ +(e+"")+b+"").childNodes[0];c||(c="\ud568\uc218");return{block:a,description:c}};Entry.Func.prototype.generateBlock=function(a){a=Entry.Func.generateBlock(this,this.content,this.id);this.block=a.block;this.description=a.description};Entry.Func.prototype.syncViewSize_=function(){var a=this.parentView.getBoundingClientRect();this.svg.style.width=a.width;this.svg.style.height=a.height}; +Entry.Func.generateButtons=function(){var a=this,b=Blockly.createSvgElement("g",{},this.svg);this.btnWrapper=b;var c=Blockly.createSvgElement("text",{x:"27",y:"33","class":"entryFunctionButtonText"},b),d=document.createTextNode(Lang.Buttons.save);c.appendChild(d);var d=Blockly.createSvgElement("text",{x:"102.5",y:"33","class":"entryFunctionButtonText"},b),e=document.createTextNode(Lang.Buttons.cancel);d.appendChild(e);e=Blockly.createSvgElement("circle",{cx:"27.5",cy:"27.5",r:"27.5","class":"entryFunctionButton"}, +b);b=Blockly.createSvgElement("circle",{cx:"102.5",cy:"27.5",r:"27.5","class":"entryFunctionButton"},b);e.onclick=function(b){a.save()};c.onclick=function(b){a.save()};b.onclick=function(b){a.cancelEdit()};d.onclick=function(b){a.cancelEdit()}}; +Entry.Func.position_=function(){var a=this.workspace.getMetrics();if(a&&this.workspace.visible){var b=this.btnWrapper;b.setAttribute("transform","translate(30, 501)");Blockly.RTL?this.left_=this.MARGIN_SIDE_:b.left_=a.viewWidth/2+a.absoluteLeft-60;b.top_=a.viewHeight+a.absoluteTop-200;b.setAttribute("transform","translate("+b.left_+","+b.top_+")")}}; +Entry.Func.positionBlock_=function(a){var b=this.workspace.getMetrics();if(b&&this.workspace.visible){var c=a.getSvgRoot(),c=Blockly.getSvgXY_(c);a.getHeightWidth();a.moveBy(b.viewWidth/2-80-c.x,b.viewHeight/2-50-c.y)}}; +Entry.Func.doWhenInit=function(){var a=this.svg;a.appendChild(Blockly.fieldKeydownDom);a.appendChild(Blockly.fieldDropdownDom);a.appendChild(Blockly.contextMenu);Blockly.bindEvent_(window,"resize",this,this.position_);Blockly.bindEvent_(a,"mousedown",null,Blockly.onMouseDown_);Blockly.bindEvent_(a,"contextmenu",null,Blockly.onContextMenu_)}; +Entry.Func.doWhenCancel=function(){Blockly.clipboard_=null;var a=Blockly.svg;a.appendChild(Blockly.fieldKeydownDom);a.appendChild(Blockly.fieldDropdownDom);a.appendChild(Blockly.contextMenu);Blockly.unbindEvent_(window,"resize",this,this.position_);Blockly.unbindEvent_(a,"mousedown",null,Blockly.onMouseDown_);Blockly.unbindEvent_(a,"contextmenu",null,Blockly.onContextMenu_)}; +Entry.Func.generateWsBlock=function(a,b,c){b=b.childNodes;var d,e;for(e in b)if("function_create"==b[e].getAttribute("type")){d=b[e];break}e=new Entry.Script;e.init(d);d=e;d.values&&(d=e.values.FIELD);e='';c=b="";var f=0,g=0;a.stringHash={};for(a.booleanHash={};;){switch(d.type){case "function_field_label":e+='",">")+'">';c+=d.fields.NAME;break;case "function_field_boolean":var h=d.values.PARAM.hashId; +e+='';b+='';a.booleanHash[h]=g;g++;c+="\ub17c\ub9ac\uac12"+g;break;case "function_field_string":h=d.values.PARAM.hashId,e+='',b+='',a.stringHash[h]=f,f++,c+="\ubb38\uc790\uac12"+f}if(d.values&&d.values.NEXT)d= +d.values.NEXT;else break;c+=" "}a=''+(e+"")+b+"";c||(c="\ud568\uc218");return{block:Blockly.Xml.textToDom(a).childNodes[0],description:c}};Entry.HWMontior={};Entry.HWMonitor=function(a){this.svgDom=Entry.Dom($(''));this._hwModule=a;var b=this;Entry.addEventListener("windowResized",function(){var a=b._hwModule.monitorTemplate.mode;"both"==a&&(b.resize(),b.resizeList());"list"==a?b.resizeList():b.resize()});Entry.addEventListener("hwModeChange",function(){b.changeMode()});this.changeOffset=0;this.scale=.5;this._listPortViews={}}; +(function(a){a.initView=function(){this.svgDom=Entry.Dom($(''))};a.generateView=function(){this.snap=Entry.SVG("hwMonitor");this._svgGroup=this.snap.elem("g");this._portMap={n:[],e:[],s:[],w:[]};var b=this._hwModule.monitorTemplate,a={href:Entry.mediaFilePath+b.imgPath,x:-b.width/2,y:-b.height/2,width:b.width,height:b.height};this._portViews={};this.hwView=this._svgGroup.elem("image");this.hwView= +this.hwView.attr(a);this._template=b;b=b.ports;this.pathGroup=null;this.pathGroup=this._svgGroup.elem("g");var a=[],d;for(d in b){var e=this.generatePortView(b[d],"_svgGroup");this._portViews[d]=e;a.push(e)}a.sort(function(b,a){return b.box.x-a.box.x});var f=this._portMap;a.map(function(b){(1>(Math.atan2(-b.box.y,b.box.x)/Math.PI+2)%2?f.n:f.s).push(b)});this.resize()};a.toggleMode=function(b){var a=this._hwModule.monitorTemplate;"list"==b?(a.TempPort=null,this._hwModule.monitorTemplate.ports&&(this._hwModule.monitorTemplate.TempPort= this._hwModule.monitorTemplate.ports,this._hwModule.monitorTemplate.listPorts=this.addPortEle(this._hwModule.monitorTemplate.listPorts,this._hwModule.monitorTemplate.ports)),$(this._svglistGroup).remove(),this._svgGroup&&$(this._svgGroup).remove(),$(this._pathGroup).remove(),this._hwModule.monitorTemplate.mode="list",this.generateListView()):(this._hwModule.monitorTemplate.TempPort&&(this._hwModule.monitorTemplate.ports=this._hwModule.monitorTemplate.TempPort,this._hwModule.monitorTemplate.listPorts= -this.removePortEle(this._hwModule.monitorTemplate.listPorts,this._hwModule.monitorTemplate.ports)),$(this._svglistGroup).remove(),this._hwModule.monitorTemplate.mode="both",this.generateListView(),this.generateView())};b.setHwmonitor=function(a){this._hwmodule=a};b.changeMode=function(a){"both"==this._hwModule.monitorTemplate.mode?this.toggleMode("list"):"list"==this._hwModule.monitorTemplate.mode&&this.toggleMode("both")};b.addPortEle=function(a,b){if("object"!=typeof b)return a;for(var d in b)a[d]= -b[d];return a};b.removePortEle=function(a,b){if("object"!=typeof b)return a;for(var d in b)delete a[d];return a};b.generateListView=function(){this._portMapList={n:[]};this._svglistGroup=null;this.listsnap=Entry.SVG("hwMonitor");this._svglistGroup=this.listsnap.elem("g");var a=this._hwModule.monitorTemplate;this._template=a;a=a.listPorts;this.pathGroup=this._svglistGroup.elem("g");var b=[],d;for(d in a){var e=this.generatePortView(a[d],"_svglistGroup");this._listPortViews[d]=e;b.push(e)}var f=this._portMapList; -b.map(function(a){f.n.push(a)});this.resizeList()};b.generatePortView=function(a,b){var d=this[b].elem("g");d.addClass("hwComponent");var e=null,e=this.pathGroup.elem("path").attr({d:"m0,0",fill:"none",stroke:"input"===a.type?"#00979d":"#A751E3","stroke-width":3}),f=d.elem("rect").attr({x:0,y:0,width:150,height:22,rx:4,ry:4,fill:"#fff",stroke:"#a0a1a1"}),g=d.elem("text").attr({x:4,y:12,fill:"#000","class":"hwComponentName","alignment-baseline":"central"});g.textContent=a.name;g=g.getComputedTextLength(); -d.elem("rect").attr({x:g+8,y:2,width:30,height:18,rx:9,ry:9,fill:"input"===a.type?"#00979d":"#A751E3"});var h=d.elem("text").attr({x:g+13,y:12,fill:"#fff","class":"hwComponentValue","alignment-baseline":"central"});h.textContent=0;g+=40;f.attr({width:g});return{group:d,value:h,type:a.type,path:e,box:{x:a.pos.x-this._template.width/2,y:a.pos.y-this._template.height/2,width:g},width:g}};b.getView=function(){return this.svgDom};b.update=function(){var a=Entry.hw.portData,b=Entry.hw.sendQueue,d=this._hwModule.monitorTemplate.mode, -e=[];if("list"==d)e=this._listPortViews;else if("both"==d){if(e=this._listPortViews,this._portViews)for(var f in this._portViews)e[f]=this._portViews[f]}else e=this._portViews;if(b)for(f in b)0!=b[f]&&e[f]&&(e[f].type="output");for(var g in e)d=e[g],"input"==d.type?(f=a[g],d.value.textContent=f?f:0,d.group.getElementsByTagName("rect")[1].attr({fill:"#00979D"})):(f=b[g],d.value.textContent=f?f:0,d.group.getElementsByTagName("rect")[1].attr({fill:"#A751E3"}))};b.resize=function(){this.hwView&&this.hwView.attr({transform:"scale("+ -this.scale+")"});if(this.svgDom)var a=this.svgDom.get(0).getBoundingClientRect();this._svgGroup.attr({transform:"translate("+a.width/2+","+a.height/1.8+")"});this._rect=a;0>=this._template.height||0>=a.height||(this.scale=a.height/this._template.height*this._template.height/1E3,this.align())};b.resizeList=function(){var a=this.svgDom.get(0).getBoundingClientRect();this._svglistGroup.attr({transform:"translate("+a.width/2+","+a.height/2+")"});this._rect=a;this.alignList()};b.align=function(){var a= -[],a=this._portMap.s.concat();this._alignNS(a,this.scale/3*this._template.height+5,27);a=this._portMap.n.concat();this._alignNS(a,-this._template.height*this.scale/3-32,-27);a=this._portMap.e.concat();this._alignEW(a,-this._template.width*this.scale/3-5,-27);a=this._portMap.w.concat();this._alignEW(a,this._template.width*this.scale/3-32,-27)};b.alignList=function(){for(var a={},a=this._hwModule.monitorTemplate.listPorts,b=a.length,d=0;dd-(l.width+q.width/2.2)&&(f+=1,initX=h,g=0)};b._movePort=function(a,b,d,e){var f=b,g=a.box.x*this.scale,h=a.box.y*this.scale;b>e?(f=b-a.width,b=b>g&&g>e?"M"+g+","+d+"L"+g+","+h:"M"+(b+e)/2+","+d+"l0,"+(h>d?28:-3)+"H"+g+"L"+g+","+h):b=bd?28:-3)+"H"+g+"L"+g+","+h;a.group.attr({transform:"translate("+f+","+d+")"}); -a.path.attr({d:b})}})(Entry.HWMonitor.prototype);Entry.HW=function(){this.connectTrial=0;this.isFirstConnect=!0;this.initSocket();this.connected=!1;this.portData={};this.sendQueue={};this.outputQueue={};this.settingQueue={};this.socketType=this.hwModule=this.selectedDevice=null;Entry.addEventListener("stop",this.setZero);this.hwInfo={11:Entry.Arduino,12:Entry.SensorBoard,13:Entry.CODEino,15:Entry.dplay,17:Entry.Xbot,24:Entry.Hamster,25:Entry.Albert,31:Entry.Bitbrick,42:Entry.Arduino,51:Entry.Neobot,71:Entry.Robotis_carCont,72:Entry.Robotis_openCM70}}; -Entry.HW.TRIAL_LIMIT=1;p=Entry.HW.prototype; -p.initSocket=function(){try{if(this.connectTrial>=Entry.HW.TRIAL_LIMIT)this.isFirstConnect||Entry.toast.alert(Lang.Menus.connect_hw,Lang.Menus.connect_fail,!1),this.isFirstConnect=!1;else{var b=this,a,c;if(-1=b+f?c.setSlideCommandX(0,!0):b+f>c.maxWidth+10?c.setSlideCommandX(c.maxWidth,!0):(this.offsetX=-(this.x-.75*a.stageX+240),c.setSlideCommandX(b))}});this.valueSetter_.on("pressup",function(a){c.isAdjusting=!1;delete c.viewValue_}); -this.view_.addChild(this.valueSetter_);a=Entry.variableContainer.variables_.length;this.getX()&&this.getY()?(this.setX(this.getX()),this.setY(this.getY())):(this.setX(-230+80*Math.floor(a/11)),this.setY(24*b+20-135-264*Math.floor(a/11)))}else this.view_=new createjs.Container,this.rect_=new createjs.Shape,this.view_.addChild(this.rect_),this.view_.variable=this,this.titleView_=new createjs.Text("asdf",this.FONT,"#000"),this.titleView_.textBaseline="alphabetic",this.titleView_.textAlign="center",this.titleView_.width= -this.width_-2*this.BORDER,this.titleView_.y=this.BORDER+10,this.titleView_.x=this.width_/2,this.view_.addChild(this.titleView_),this.resizeHandle_=new createjs.Shape,this.resizeHandle_.graphics.f("#1bafea").ss(1,0,0).s("#1bafea").lt(0,-9).lt(-9,0).lt(0,0),this.view_.addChild(this.resizeHandle_),this.resizeHandle_.list=this,this.resizeHandle_.on("mouseover",function(a){this.cursor="nwse-resize"}),this.resizeHandle_.on("mousedown",function(a){this.list.isResizing=!0;this.offset={x:.75*a.stageX-this.list.getWidth(), -y:.75*a.stageY-this.list.getHeight()};this.parent.cursor="nwse-resize"}),this.resizeHandle_.on("pressmove",function(a){this.list.setWidth(.75*a.stageX-this.offset.x);this.list.setHeight(.75*a.stageY-this.offset.y);this.list.updateView()}),this.view_.on("mouseover",function(a){this.cursor="move"}),this.view_.on("mousedown",function(a){"workspace"!=Entry.type||this.variable.isResizing||(this.offset={x:this.x-(.75*a.stageX-240),y:this.y-(.75*a.stageY-135)},this.cursor="move")}),this.view_.on("pressup", -function(a){this.cursor="initial";this.variable.isResizing=!1}),this.view_.on("pressmove",function(a){"workspace"!=Entry.type||this.variable.isResizing||(this.variable.setX(.75*a.stageX-240+this.offset.x),this.variable.setY(.75*a.stageY-135+this.offset.y),this.variable.updateView())}),this.elementView=new createjs.Container,a=new createjs.Text("asdf",this.FONT,"#000"),a.textBaseline="middle",a.y=5,this.elementView.addChild(a),this.elementView.indexView=a,a=new createjs.Shape,this.elementView.addChild(a), -this.elementView.valueWrapper=a,a=new createjs.Text("fdsa",this.FONT,"#eee"),a.x=24,a.y=6,a.textBaseline="middle",this.elementView.addChild(a),this.elementView.valueView=a,this.elementView.x=this.BORDER,this.scrollButton_=new createjs.Shape,this.scrollButton_.graphics.f("#aaa").rr(0,0,7,30,3.5),this.view_.addChild(this.scrollButton_),this.scrollButton_.y=23,this.scrollButton_.list=this,this.scrollButton_.on("mousedown",function(a){this.list.isResizing=!0;this.cursor="pointer";this.offsetY=isNaN(this.offsetY)|| -0>this.offsetY?a.rawY/2:this.offsetY}),this.scrollButton_.on("pressmove",function(a){void 0===this.moveAmount?(this.y=a.target.y,this.moveAmount=!0):this.y=a.rawY/2-this.offsetY+this.list.height_/100*23;23>this.y&&(this.y=23);this.y>this.list.getHeight()-40&&(this.y=this.list.getHeight()-40);this.list.updateView()}),this.scrollButton_.on("pressup",function(a){this.moveAmount=void 0}),this.getX()&&this.getY()?(this.setX(this.getX()),this.setY(this.getY())):(a=Entry.variableContainer.lists_.length, -this.setX(110*-Math.floor(a/6)+120),this.setY(24*b+20-135-145*Math.floor(a/6)));this.setVisible(this.isVisible());this.updateView();Entry.stage.loadVariable(this)}; -Entry.Variable.prototype.updateView=function(){if(this.view_&&this.isVisible())if("variable"==this.type){this.view_.x=this.getX();this.view_.y=this.getY();if(this.object_){var b=Entry.container.getObject(this.object_);this.textView_.text=b?b.name+":"+this.getName():this.getName()}else this.textView_.text=this.getName();this.valueView_.x=this.textView_.getMeasuredWidth()+14;this.valueView_.y=1;this.isNumber()?this.valueView_.text=this.getValue().toFixed(2).replace(".00",""):this.valueView_.text=this.getValue(); -this.rect_.graphics.clear().f("#ffffff").ss(1,2,0).s("#A0A1A1").rc(0,-14,this.textView_.getMeasuredWidth()+this.valueView_.getMeasuredWidth()+26,20,4,4,4,4);this.wrapper_.graphics.clear().f("#1bafea").ss(1,2,0).s("#1bafea").rc(this.textView_.getMeasuredWidth()+7,-11,this.valueView_.getMeasuredWidth()+15,14,7,7,7,7)}else if("slide"==this.type)this.view_.x=this.getX(),this.view_.y=this.getY(),this.object_?(b=Entry.container.getObject(this.object_),this.textView_.text=b?b.name+":"+this.getName():this.getName()): -this.textView_.text=this.getName(),this.valueView_.x=this.textView_.getMeasuredWidth()+14,this.valueView_.y=1,this.isNumber()?this.valueView_.text=this.getValue().toFixed(2).replace(".00",""):this.valueView_.text=this.getValue(),b=this.textView_.getMeasuredWidth()+this.valueView_.getMeasuredWidth()+26,b=Math.max(b,90),this.rect_.graphics.clear().f("#ffffff").ss(1,2,0).s("#A0A1A1").rc(0,-14,b,33,4,4,4,4),this.wrapper_.graphics.clear().f("#1bafea").ss(1,2,0).s("#1bafea").rc(this.textView_.getMeasuredWidth()+ -7,-11,this.valueView_.getMeasuredWidth()+15,14,7,7,7,7),b=this.textView_.getMeasuredWidth()+this.valueView_.getMeasuredWidth()+26,b=Math.max(b,90),this.maxWidth=b-20,this.slideBar_.graphics.clear().beginFill("#A0A1A1").s("#A0A1A1").ss(1).dr(10,10,this.maxWidth,1.5),b=this.getSlidePosition(this.maxWidth),this.valueSetter_.graphics.clear().beginFill("#1bafea").s("#A0A1A1").ss(1).dc(b,10.5,3);else if("list"==this.type){this.view_.x=this.getX();this.view_.y=this.getY();this.resizeHandle_.x=this.width_- -2;this.resizeHandle_.y=this.height_-2;var a=this.getName();this.object_&&(b=Entry.container.getObject(this.object_))&&(a=b.name+":"+a);a=7this.getHeight()-40&& -(this.scrollButton_.y=this.getHeight()-40),this.elementView.valueWrapper.graphics.clear().f("#1bafea").rr(20,-2,this.getWidth()-20-10-2*this.BORDER,17,2),this.scrollButton_.visible=!0,this.scrollButton_.x=this.getWidth()-12,this.scrollPosition=Math.floor((this.scrollButton_.y-23)/(this.getHeight()-23-40)*(this.array_.length-b))):(this.elementView.valueWrapper.graphics.clear().f("#1bafea").rr(20,-2,this.getWidth()-20-2*this.BORDER,17,2),this.scrollButton_.visible=!1,this.scrollPosition=0);for(a=this.scrollPosition;a< -this.scrollPosition+b&&ac.length?c+"..":c;this.elementView.valueView.text=c;c=this.elementView.clone(!0);c.y=20*(a-this.scrollPosition)+23;this.view_.addChild(c)}}else"answer"==this.type?(this.view_.x=this.getX(),this.view_.y=this.getY(),this.textView_.text=this.getName(),this.valueView_.x=this.textView_.getMeasuredWidth()+ +this.removePortEle(this._hwModule.monitorTemplate.listPorts,this._hwModule.monitorTemplate.ports)),$(this._svglistGroup).remove(),this._hwModule.monitorTemplate.mode="both",this.generateListView(),this.generateView())};a.setHwmonitor=function(b){this._hwmodule=b};a.changeMode=function(b){"both"==this._hwModule.monitorTemplate.mode?this.toggleMode("list"):"list"==this._hwModule.monitorTemplate.mode&&this.toggleMode("both")};a.addPortEle=function(b,a){if("object"!=typeof a)return b;for(var d in a)b[d]= +a[d];return b};a.removePortEle=function(b,a){if("object"!=typeof a)return b;for(var d in a)delete b[d];return b};a.generateListView=function(){this._portMapList={n:[]};this._svglistGroup=null;this.listsnap=Entry.SVG("hwMonitor");this._svglistGroup=this.listsnap.elem("g");var b=this._hwModule.monitorTemplate;this._template=b;b=b.listPorts;this.pathGroup=this._svglistGroup.elem("g");var a=[],d;for(d in b){var e=this.generatePortView(b[d],"_svglistGroup");this._listPortViews[d]=e;a.push(e)}var f=this._portMapList; +a.map(function(b){f.n.push(b)});this.resizeList()};a.generatePortView=function(b,a){var d=this[a].elem("g");d.addClass("hwComponent");var e=null,e=this.pathGroup.elem("path").attr({d:"m0,0",fill:"none",stroke:"input"===b.type?"#00979d":"#A751E3","stroke-width":3}),f=d.elem("rect").attr({x:0,y:0,width:150,height:22,rx:4,ry:4,fill:"#fff",stroke:"#a0a1a1"}),g=d.elem("text").attr({x:4,y:12,fill:"#000","class":"hwComponentName","alignment-baseline":"central"});g.textContent=b.name;g=g.getComputedTextLength(); +d.elem("rect").attr({x:g+8,y:2,width:30,height:18,rx:9,ry:9,fill:"input"===b.type?"#00979d":"#A751E3"});var h=d.elem("text").attr({x:g+13,y:12,fill:"#fff","class":"hwComponentValue","alignment-baseline":"central"});h.textContent=0;g+=40;f.attr({width:g});return{group:d,value:h,type:b.type,path:e,box:{x:b.pos.x-this._template.width/2,y:b.pos.y-this._template.height/2,width:g},width:g}};a.getView=function(){return this.svgDom};a.update=function(){var b=Entry.hw.portData,a=Entry.hw.sendQueue,d=this._hwModule.monitorTemplate.mode, +e=[];if("list"==d)e=this._listPortViews;else if("both"==d){if(e=this._listPortViews,this._portViews)for(var f in this._portViews)e[f]=this._portViews[f]}else e=this._portViews;if(a)for(f in a)0!=a[f]&&e[f]&&(e[f].type="output");for(var g in e)d=e[g],"input"==d.type?(f=b[g],d.value.textContent=f?f:0,d.group.getElementsByTagName("rect")[1].attr({fill:"#00979D"})):(f=a[g],d.value.textContent=f?f:0,d.group.getElementsByTagName("rect")[1].attr({fill:"#A751E3"}))};a.resize=function(){this.hwView&&this.hwView.attr({transform:"scale("+ +this.scale+")"});if(this.svgDom)var b=this.svgDom.get(0).getBoundingClientRect();this._svgGroup.attr({transform:"translate("+b.width/2+","+b.height/1.8+")"});this._rect=b;0>=this._template.height||0>=b.height||(this.scale=b.height/this._template.height*this._template.height/1E3,this.align())};a.resizeList=function(){var b=this.svgDom.get(0).getBoundingClientRect();this._svglistGroup.attr({transform:"translate("+b.width/2+","+b.height/2+")"});this._rect=b;this.alignList()};a.align=function(){var b= +[],b=this._portMap.s.concat();this._alignNS(b,this.scale/3*this._template.height+5,27);b=this._portMap.n.concat();this._alignNS(b,-this._template.height*this.scale/3-32,-27);b=this._portMap.e.concat();this._alignEW(b,-this._template.width*this.scale/3-5,-27);b=this._portMap.w.concat();this._alignEW(b,this._template.width*this.scale/3-32,-27)};a.alignList=function(){for(var b={},b=this._hwModule.monitorTemplate.listPorts,a=b.length,d=0;dd-(l.width+q.width/2.2)&&(f+=1,initX=h,g=0)};a._movePort=function(b,a,d,e){var f=a,g=b.box.x*this.scale,h=b.box.y*this.scale;a>e?(f=a-b.width,a=a>g&&g>e?"M"+g+","+d+"L"+g+","+h:"M"+(a+e)/2+","+d+"l0,"+(h>d?28:-3)+"H"+g+"L"+g+","+h):a=ad?28:-3)+"H"+g+"L"+g+","+h;b.group.attr({transform:"translate("+f+","+d+")"}); +b.path.attr({d:a})}})(Entry.HWMonitor.prototype);Entry.HW=function(){this.connectTrial=0;this.isFirstConnect=!0;this.initSocket();this.connected=!1;this.portData={};this.sendQueue={};this.outputQueue={};this.settingQueue={};this.socketType=this.hwModule=this.selectedDevice=null;Entry.addEventListener("stop",this.setZero);this.hwInfo={11:Entry.Arduino,12:Entry.SensorBoard,13:Entry.CODEino,15:Entry.dplay,17:Entry.Xbot,24:Entry.Hamster,25:Entry.Albert,31:Entry.Bitbrick,42:Entry.Arduino,51:Entry.Neobot,71:Entry.Robotis_carCont,72:Entry.Robotis_openCM70, +81:Entry.EV3}};Entry.HW.TRIAL_LIMIT=1;p=Entry.HW.prototype; +p.initSocket=function(){try{if(this.connectTrial>=Entry.HW.TRIAL_LIMIT)this.isFirstConnect||Entry.toast.alert(Lang.Menus.connect_hw,Lang.Menus.connect_fail,!1),this.isFirstConnect=!1;else{var a=this,b,c;if(-1=a+f?c.setSlideCommandX(0,!0):a+f>c.maxWidth+10?c.setSlideCommandX(c.maxWidth,!0):(this.offsetX=-(this.x-.75*b.stageX+240),c.setSlideCommandX(a))}});this.valueSetter_.on("pressup",function(b){c.isAdjusting=!1;delete c.viewValue_}); +this.view_.addChild(this.valueSetter_);b=Entry.variableContainer.variables_.length;this.getX()&&this.getY()?(this.setX(this.getX()),this.setY(this.getY())):(this.setX(-230+80*Math.floor(b/11)),this.setY(24*a+20-135-264*Math.floor(b/11)))}else this.view_=new createjs.Container,this.rect_=new createjs.Shape,this.view_.addChild(this.rect_),this.view_.variable=this,this.titleView_=new createjs.Text("asdf",this.FONT,"#000"),this.titleView_.textBaseline="alphabetic",this.titleView_.textAlign="center",this.titleView_.width= +this.width_-2*this.BORDER,this.titleView_.y=this.BORDER+10,this.titleView_.x=this.width_/2,this.view_.addChild(this.titleView_),this.resizeHandle_=new createjs.Shape,this.resizeHandle_.graphics.f("#1bafea").ss(1,0,0).s("#1bafea").lt(0,-9).lt(-9,0).lt(0,0),this.view_.addChild(this.resizeHandle_),this.resizeHandle_.list=this,this.resizeHandle_.on("mouseover",function(b){this.cursor="nwse-resize"}),this.resizeHandle_.on("mousedown",function(b){this.list.isResizing=!0;this.offset={x:.75*b.stageX-this.list.getWidth(), +y:.75*b.stageY-this.list.getHeight()};this.parent.cursor="nwse-resize"}),this.resizeHandle_.on("pressmove",function(b){this.list.setWidth(.75*b.stageX-this.offset.x);this.list.setHeight(.75*b.stageY-this.offset.y);this.list.updateView()}),this.view_.on("mouseover",function(b){this.cursor="move"}),this.view_.on("mousedown",function(b){"workspace"!=Entry.type||this.variable.isResizing||(this.offset={x:this.x-(.75*b.stageX-240),y:this.y-(.75*b.stageY-135)},this.cursor="move")}),this.view_.on("pressup", +function(b){this.cursor="initial";this.variable.isResizing=!1}),this.view_.on("pressmove",function(b){"workspace"!=Entry.type||this.variable.isResizing||(this.variable.setX(.75*b.stageX-240+this.offset.x),this.variable.setY(.75*b.stageY-135+this.offset.y),this.variable.updateView())}),this.elementView=new createjs.Container,b=new createjs.Text("asdf",this.FONT,"#000"),b.textBaseline="middle",b.y=5,this.elementView.addChild(b),this.elementView.indexView=b,b=new createjs.Shape,this.elementView.addChild(b), +this.elementView.valueWrapper=b,b=new createjs.Text("fdsa",this.FONT,"#eee"),b.x=24,b.y=6,b.textBaseline="middle",this.elementView.addChild(b),this.elementView.valueView=b,this.elementView.x=this.BORDER,this.scrollButton_=new createjs.Shape,this.scrollButton_.graphics.f("#aaa").rr(0,0,7,30,3.5),this.view_.addChild(this.scrollButton_),this.scrollButton_.y=23,this.scrollButton_.list=this,this.scrollButton_.on("mousedown",function(b){this.list.isResizing=!0;this.cursor="pointer";this.offsetY=isNaN(this.offsetY)|| +0>this.offsetY?b.rawY/2:this.offsetY}),this.scrollButton_.on("pressmove",function(b){void 0===this.moveAmount?(this.y=b.target.y,this.moveAmount=!0):this.y=b.rawY/2-this.offsetY+this.list.height_/100*23;23>this.y&&(this.y=23);this.y>this.list.getHeight()-40&&(this.y=this.list.getHeight()-40);this.list.updateView()}),this.scrollButton_.on("pressup",function(b){this.moveAmount=void 0}),this.getX()&&this.getY()?(this.setX(this.getX()),this.setY(this.getY())):(b=Entry.variableContainer.lists_.length, +this.setX(110*-Math.floor(b/6)+120),this.setY(24*a+20-135-145*Math.floor(b/6)));this.setVisible(this.isVisible());this.updateView();Entry.stage.loadVariable(this)}; +Entry.Variable.prototype.updateView=function(){if(this.view_&&this.isVisible())if("variable"==this.type){this.view_.x=this.getX();this.view_.y=this.getY();if(this.object_){var a=Entry.container.getObject(this.object_);this.textView_.text=a?a.name+":"+this.getName():this.getName()}else this.textView_.text=this.getName();this.valueView_.x=this.textView_.getMeasuredWidth()+14;this.valueView_.y=1;this.isNumber()?this.valueView_.text=this.getValue().toFixed(2).replace(".00",""):this.valueView_.text=this.getValue(); +this.rect_.graphics.clear().f("#ffffff").ss(1,2,0).s("#A0A1A1").rc(0,-14,this.textView_.getMeasuredWidth()+this.valueView_.getMeasuredWidth()+26,20,4,4,4,4);this.wrapper_.graphics.clear().f("#1bafea").ss(1,2,0).s("#1bafea").rc(this.textView_.getMeasuredWidth()+7,-11,this.valueView_.getMeasuredWidth()+15,14,7,7,7,7)}else if("slide"==this.type)this.view_.x=this.getX(),this.view_.y=this.getY(),this.object_?(a=Entry.container.getObject(this.object_),this.textView_.text=a?a.name+":"+this.getName():this.getName()): +this.textView_.text=this.getName(),this.valueView_.x=this.textView_.getMeasuredWidth()+14,this.valueView_.y=1,this.isNumber()?this.valueView_.text=this.getValue().toFixed(2).replace(".00",""):this.valueView_.text=this.getValue(),a=this.textView_.getMeasuredWidth()+this.valueView_.getMeasuredWidth()+26,a=Math.max(a,90),this.rect_.graphics.clear().f("#ffffff").ss(1,2,0).s("#A0A1A1").rc(0,-14,a,33,4,4,4,4),this.wrapper_.graphics.clear().f("#1bafea").ss(1,2,0).s("#1bafea").rc(this.textView_.getMeasuredWidth()+ +7,-11,this.valueView_.getMeasuredWidth()+15,14,7,7,7,7),a=this.textView_.getMeasuredWidth()+this.valueView_.getMeasuredWidth()+26,a=Math.max(a,90),this.maxWidth=a-20,this.slideBar_.graphics.clear().beginFill("#A0A1A1").s("#A0A1A1").ss(1).dr(10,10,this.maxWidth,1.5),a=this.getSlidePosition(this.maxWidth),this.valueSetter_.graphics.clear().beginFill("#1bafea").s("#A0A1A1").ss(1).dc(a,10.5,3);else if("list"==this.type){this.view_.x=this.getX();this.view_.y=this.getY();this.resizeHandle_.x=this.width_- +2;this.resizeHandle_.y=this.height_-2;var b=this.getName();this.object_&&(a=Entry.container.getObject(this.object_))&&(b=a.name+":"+b);b=7this.getHeight()-40&& +(this.scrollButton_.y=this.getHeight()-40),this.elementView.valueWrapper.graphics.clear().f("#1bafea").rr(20,-2,this.getWidth()-20-10-2*this.BORDER,17,2),this.scrollButton_.visible=!0,this.scrollButton_.x=this.getWidth()-12,this.scrollPosition=Math.floor((this.scrollButton_.y-23)/(this.getHeight()-23-40)*(this.array_.length-a))):(this.elementView.valueWrapper.graphics.clear().f("#1bafea").rr(20,-2,this.getWidth()-20-2*this.BORDER,17,2),this.scrollButton_.visible=!1,this.scrollPosition=0);for(b=this.scrollPosition;b< +this.scrollPosition+a&&bc.length?c+"..":c;this.elementView.valueView.text=c;c=this.elementView.clone(!0);c.y=20*(b-this.scrollPosition)+23;this.view_.addChild(c)}}else"answer"==this.type?(this.view_.x=this.getX(),this.view_.y=this.getY(),this.textView_.text=this.getName(),this.valueView_.x=this.textView_.getMeasuredWidth()+ 14,this.valueView_.y=1,this.isNumber()?parseInt(this.getValue(),10)==this.getValue()?this.valueView_.text=this.getValue():this.valueView_.text=this.getValue().toFixed(1).replace(".00",""):this.valueView_.text=this.getValue(),this.rect_.graphics.clear().f("#ffffff").ss(1,2,0).s("#A0A1A1").rc(0,-14,this.textView_.getMeasuredWidth()+this.valueView_.getMeasuredWidth()+26,20,4,4,4,4),this.wrapper_.graphics.clear().f("#E457DC").ss(1,2,0).s("#E457DC").rc(this.textView_.getMeasuredWidth()+7,-11,this.valueView_.getMeasuredWidth()+ 15,14,7,7,7,7)):(this.view_.x=this.getX(),this.view_.y=this.getY(),this.textView_.text=this.getName(),this.valueView_.x=this.textView_.getMeasuredWidth()+14,this.valueView_.y=1,this.isNumber()?this.valueView_.text=this.getValue().toFixed(1).replace(".00",""):this.valueView_.text=this.getValue(),this.rect_.graphics.clear().f("#ffffff").ss(1,2,0).s("#A0A1A1").rc(0,-14,this.textView_.getMeasuredWidth()+this.valueView_.getMeasuredWidth()+26,20,4,4,4,4),this.wrapper_.graphics.clear().f("#ffbb14").ss(1, -2,0).s("orange").rc(this.textView_.getMeasuredWidth()+7,-11,this.valueView_.getMeasuredWidth()+15,14,7,7,7,7))};Entry.Variable.prototype.getName=function(){return this.name_};Entry.Variable.prototype.setName=function(b){Entry.assert("string"==typeof b,"Variable name must be string");this.name_=b;this.updateView()};Entry.Variable.prototype.getId=function(){return this.id_};Entry.Variable.prototype.getValue=function(){return this.isNumber()?Number(this.value_):this.value_}; -Entry.Variable.prototype.isNumber=function(){return isNaN(this.value_)?!1:!0};Entry.Variable.prototype.setValue=function(b){if("slide"!=this.type)this.value_=b;else{var a=Entry.isFloat(this.minValue_),c=Entry.isFloat(this.maxValue_);this.value_=bthis.maxValue_?this.maxValue_:b;a||c||(this.viewValue_=this.value_,this.value_=Math.floor(this.value_))}this.isCloud_&&Entry.variableContainer.updateCloudVariables();this.updateView()};Entry.Variable.prototype.isVisible=function(){return this.visible_}; -Entry.Variable.prototype.setVisible=function(b){Entry.assert("boolean"==typeof b,"Variable visible state must be boolean");(this.visible_=this.view_.visible=b)&&this.updateView()};Entry.Variable.prototype.setX=function(b){this.x_=b;this.updateView()};Entry.Variable.prototype.getX=function(){return this.x_};Entry.Variable.prototype.setY=function(b){this.y_=b;this.updateView()};Entry.Variable.prototype.getY=function(){return this.y_}; -Entry.Variable.prototype.setWidth=function(b){this.width_=100>b?100:b;this.updateView()};Entry.Variable.prototype.getWidth=function(){return this.width_};Entry.Variable.prototype.isInList=function(b,a){this.getX();this.getY()};Entry.Variable.prototype.setHeight=function(b){this.height_=100>b?100:b;this.updateView()};Entry.Variable.prototype.getHeight=function(){return this.height_};Entry.Variable.prototype.takeSnapshot=function(){this.snapshot_=this.toJSON()}; -Entry.Variable.prototype.loadSnapshot=function(){this.snapshot_&&!this.isCloud_&&this.syncModel_(this.snapshot_)};Entry.Variable.prototype.syncModel_=function(b){this.setX(b.x);this.setY(b.y);this.id_=b.id;this.setVisible(b.visible);this.setValue(b.value);this.setName(b.name);this.isCloud_=b.isCloud;"list"==this.type&&(this.setWidth(b.width),this.setHeight(b.height),this.array_=b.array)}; -Entry.Variable.prototype.toJSON=function(){var b={};b.name=this.name_;b.id=this.id_;b.visible=this.visible_;b.value=this.value_;b.variableType=this.type;"list"==this.type?(b.width=this.getWidth(),b.height=this.getHeight(),b.array=JSON.parse(JSON.stringify(this.array_))):"slide"==this.type&&(b.minValue=this.minValue_,b.maxValue=this.maxValue_);b.isCloud=this.isCloud_;b.object=this.object_;b.x=this.x_;b.y=this.y_;return b};Entry.Variable.prototype.remove=function(){Entry.stage.removeVariable(this)}; -Entry.Variable.prototype.clone=function(){var b=this.toJSON();b.isClone=!0;return b=new Entry.Variable(b)};Entry.Variable.prototype.getType=function(){return this.type};Entry.Variable.prototype.setType=function(b){this.type=b};Entry.Variable.prototype.getSlidePosition=function(b){var a=this.minValue_;return Math.abs((this.viewValue_||this.value_)-a)/Math.abs(this.maxValue_-a)*b+10}; -Entry.Variable.prototype.setSlideCommandX=function(b,a){var c=this.valueSetter_.graphics.command;b="undefined"==typeof b?10:b;c.x=a?b+10:c.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?this.setValue(this.maxValue_):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()};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}; -Entry.VariableContainer.prototype.createDom=function(b){var a=this;this.view_=b;var c=Entry.createElement("table");c.addClass("entryVariableSelectorWorkspace");this.view_.appendChild(c);var d=Entry.createElement("tr");c.appendChild(d);var e=this.createSelectButton("all");e.setAttribute("rowspan","2");e.addClass("selected","allButton");d.appendChild(e);d.appendChild(this.createSelectButton("variable",Entry.variableEnable));d.appendChild(this.createSelectButton("message",Entry.messageEnable));d=Entry.createElement("tr"); -d.appendChild(this.createSelectButton("list",Entry.listEnable));d.appendChild(this.createSelectButton("func",Entry.functionEnable));c.appendChild(d);c=Entry.createElement("ul");c.addClass("entryVariableListWorkspace");this.view_.appendChild(c);this.listView_=c;c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.variable_create;var f=this;this.variableAddButton_=c;c.bindOnClick(function(b){b=f.variableAddPanel; -var c=b.view.name.value.trim();b.isOpen?c&&0!==c.length?a.addVariable():(b.view.addClass("entryRemove"),b.isOpen=!1):(b.view.removeClass("entryRemove"),b.view.name.focus(),b.isOpen=!0)});this.generateVariableAddView();this.generateListAddView();this.generateVariableSplitterView();this.generateVariableSettingView();this.generateListSettingView();c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.message_create; -this.messageAddButton_=c;c.bindOnClick(function(b){a.addMessage({name:Lang.Workspace.message+" "+(a.messages_.length+1)})});c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.list_create;this.listAddButton_=c;c.bindOnClick(function(b){b=f.listAddPanel;var c=b.view.name.value.trim();b.isOpen?c&&0!==c.length?a.addList():(b.view.addClass("entryRemove"),b.isOpen=!1):(b.view.removeClass("entryRemove"),b.view.name.focus(), -b.isOpen=!0)});c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.function_create;this.functionAddButton_=c;c.bindOnClick(function(b){Entry.playground.changeViewMode("code");"func"!=Entry.playground.selectedMenu&&Entry.playground.selectMenu("func");a.createFunction()});return b}; -Entry.VariableContainer.prototype.createSelectButton=function(b,a){var c=this;void 0===a&&(a=!0);var d=Entry.createElement("td");d.addClass("entryVariableSelectButtonWorkspace",b);d.innerHTML=Lang.Workspace[b];a?d.bindOnClick(function(a){c.selectFilter(b);this.addClass("selected")}):d.addClass("disable");return d}; -Entry.VariableContainer.prototype.selectFilter=function(b){for(var a=this.view_.getElementsByTagName("td"),c=0;cb.x_&&a.xe?!0:!1}; -Entry.VariableContainer.prototype.getListById=function(b){var a=this.lists_,c=[];if(0this.maxValue_?this.maxValue_:a;b||c||(this.viewValue_=this.value_,this.value_=Math.floor(this.value_))}this.isCloud_&&Entry.variableContainer.updateCloudVariables();this.updateView()};Entry.Variable.prototype.isVisible=function(){return this.visible_}; +Entry.Variable.prototype.setVisible=function(a){Entry.assert("boolean"==typeof a,"Variable visible state must be boolean");(this.visible_=this.view_.visible=a)&&this.updateView()};Entry.Variable.prototype.setX=function(a){this.x_=a;this.updateView()};Entry.Variable.prototype.getX=function(){return this.x_};Entry.Variable.prototype.setY=function(a){this.y_=a;this.updateView()};Entry.Variable.prototype.getY=function(){return this.y_}; +Entry.Variable.prototype.setWidth=function(a){this.width_=100>a?100:a;this.updateView()};Entry.Variable.prototype.getWidth=function(){return this.width_};Entry.Variable.prototype.isInList=function(a,b){this.getX();this.getY()};Entry.Variable.prototype.setHeight=function(a){this.height_=100>a?100:a;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(a){this.setX(a.x);this.setY(a.y);this.id_=a.id;this.setVisible(a.visible);this.setValue(a.value);this.setName(a.name);this.isCloud_=a.isCloud;"list"==this.type&&(this.setWidth(a.width),this.setHeight(a.height),this.array_=a.array)}; +Entry.Variable.prototype.toJSON=function(){var a={};a.name=this.name_;a.id=this.id_;a.visible=this.visible_;a.value=this.value_;a.variableType=this.type;"list"==this.type?(a.width=this.getWidth(),a.height=this.getHeight(),a.array=JSON.parse(JSON.stringify(this.array_))):"slide"==this.type&&(a.minValue=this.minValue_,a.maxValue=this.maxValue_);a.isCloud=this.isCloud_;a.object=this.object_;a.x=this.x_;a.y=this.y_;return a};Entry.Variable.prototype.remove=function(){Entry.stage.removeVariable(this)}; +Entry.Variable.prototype.clone=function(){var a=this.toJSON();a.isClone=!0;return a=new Entry.Variable(a)};Entry.Variable.prototype.getType=function(){return this.type};Entry.Variable.prototype.setType=function(a){this.type=a};Entry.Variable.prototype.getSlidePosition=function(a){var b=this.minValue_;return Math.abs((this.viewValue_||this.value_)-b)/Math.abs(this.maxValue_-b)*a+10}; +Entry.Variable.prototype.setSlideCommandX=function(a,b){var c=this.valueSetter_.graphics.command;a="undefined"==typeof a?10:a;c.x=b?a+10:c.x+a;this.updateSlideValueByView()}; +Entry.Variable.prototype.updateSlideValueByView=function(){var a=Math.max(this.valueSetter_.graphics.command.x-10,0)/this.maxWidth;0>a&&(a=0);1c?this.setValue(this.maxValue_):this.setValue(a)};Entry.Variable.prototype.getMinValue=function(){return this.minValue_}; +Entry.Variable.prototype.setMinValue=function(a){this.minValue_=a;this.value_a&&(this.value_=a);this.updateView()};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}; +Entry.VariableContainer.prototype.createDom=function(a){var b=this;this.view_=a;var c=Entry.createElement("table");c.addClass("entryVariableSelectorWorkspace");this.view_.appendChild(c);var d=Entry.createElement("tr");c.appendChild(d);var e=this.createSelectButton("all");e.setAttribute("rowspan","2");e.addClass("selected","allButton");d.appendChild(e);d.appendChild(this.createSelectButton("variable",Entry.variableEnable));d.appendChild(this.createSelectButton("message",Entry.messageEnable));d=Entry.createElement("tr"); +d.appendChild(this.createSelectButton("list",Entry.listEnable));d.appendChild(this.createSelectButton("func",Entry.functionEnable));c.appendChild(d);c=Entry.createElement("ul");c.addClass("entryVariableListWorkspace");this.view_.appendChild(c);this.listView_=c;c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.variable_create;var f=this;this.variableAddButton_=c;c.bindOnClick(function(a){a=f.variableAddPanel; +var c=a.view.name.value.trim();a.isOpen?c&&0!==c.length?b.addVariable():(a.view.addClass("entryRemove"),a.isOpen=!1):(a.view.removeClass("entryRemove"),a.view.name.focus(),a.isOpen=!0)});this.generateVariableAddView();this.generateListAddView();this.generateVariableSplitterView();this.generateVariableSettingView();this.generateListSettingView();c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.message_create; +this.messageAddButton_=c;c.bindOnClick(function(a){b.addMessage({name:Lang.Workspace.message+" "+(b.messages_.length+1)})});c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.list_create;this.listAddButton_=c;c.bindOnClick(function(a){a=f.listAddPanel;var c=a.view.name.value.trim();a.isOpen?c&&0!==c.length?b.addList():(a.view.addClass("entryRemove"),a.isOpen=!1):(a.view.removeClass("entryRemove"),a.view.name.focus(), +a.isOpen=!0)});c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.function_create;this.functionAddButton_=c;c.bindOnClick(function(a){Entry.playground.changeViewMode("code");"func"!=Entry.playground.selectedMenu&&Entry.playground.selectMenu("func");b.createFunction()});return a}; +Entry.VariableContainer.prototype.createSelectButton=function(a,b){var c=this;void 0===b&&(b=!0);var d=Entry.createElement("td");d.addClass("entryVariableSelectButtonWorkspace",a);d.innerHTML=Lang.Workspace[a];b?d.bindOnClick(function(b){c.selectFilter(a);this.addClass("selected")}):d.addClass("disable");return d}; +Entry.VariableContainer.prototype.selectFilter=function(a){for(var b=this.view_.getElementsByTagName("td"),c=0;ca.x_&&b.xe?!0:!1}; +Entry.VariableContainer.prototype.getListById=function(a){var b=this.lists_,c=[];if(0c.getValue()&&c.setValue(0),100b&&(a.length=b)}this.updateListSettingView()};Entry.VariableContainer.prototype.updateViews=function(){var b=this.lists_;this.variables_.map(function(a){a.updateView()});b.map(function(a){a.updateView()})}; -Entry.VariableContainer.prototype.updateSelectedVariable=function(b,a){b?"variable"==b.type?(this.selectedVariable=b,this.updateVariableSettingView(b)):"slide"==b.type?(this.selectedVariable=b,this.updateVariableSettingView(b)):"list"==b.type&&(this.selectedList=b,this.updateListSettingView(b)):(this.selectedVariable=null,"variable"==(a||"variable")?this.variableSettingView.addClass("entryRemove"):this.listSettingView.addClass("entryRemove"))}; -Entry.VariableContainer.prototype.removeLocalVariables=function(b){var a=[],c=this;this.mapVariable(function(b,c){b.object_&&b.object_==c&&a.push(b)},b);a.map(function(a){c.removeVariable(a)})}; -Entry.VariableContainer.prototype.updateCloudVariables=function(){var b=Entry.projectId;if(Entry.cloudSavable&&b){var a=Entry.variableContainer,b=a.variables_.filter(function(a){return a.isCloud_}),b=b.map(function(a){return a.toJSON()}),a=a.lists_.filter(function(a){return a.isCloud_}),a=a.map(function(a){return a.toJSON()});$.ajax({url:"/api/project/variable/"+Entry.projectId,type:"PUT",data:{variables:b,lists:a}}).done(function(){})}};Entry.block.run={skeleton:"basic",color:"#3BBD70",contents:["this is","basic block"],func:function(){}};Entry.block.jr_start={skeleton:"pebble_event",event:"start",color:"#3BBD70",contents:[{type:"Indicator",img:"/img/assets/ntry/bitmap/jr/block_play_image.png",highlightColor:"#3BBD70",size:22}],func:function(){var b=Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT),a;for(a in b)this._unit=b[a];Ntry.unitComp=Ntry.entityManager.getComponent(this._unit.id,Ntry.STATIC.UNIT)}}; +Entry.VariableContainer.prototype.changeListName=function(a,b){a.name_!=b&&(Entry.isExist(b,"name_",this.lists_)?(a.listElement.nameField.value=a.name_,Entry.toast.alert(Lang.Workspace.list_rename_failed,Lang.Workspace.list_dup)):10c.getValue()&&c.setValue(0),100a&&(b.length=a)}this.updateListSettingView()};Entry.VariableContainer.prototype.updateViews=function(){var a=this.lists_;this.variables_.map(function(b){b.updateView()});a.map(function(b){b.updateView()})}; +Entry.VariableContainer.prototype.updateSelectedVariable=function(a,b){a?"variable"==a.type?(this.selectedVariable=a,this.updateVariableSettingView(a)):"slide"==a.type?(this.selectedVariable=a,this.updateVariableSettingView(a)):"list"==a.type&&(this.selectedList=a,this.updateListSettingView(a)):(this.selectedVariable=null,"variable"==(b||"variable")?this.variableSettingView.addClass("entryRemove"):this.listSettingView.addClass("entryRemove"))}; +Entry.VariableContainer.prototype.removeLocalVariables=function(a){var b=[],c=this;this.mapVariable(function(a,c){a.object_&&a.object_==c&&b.push(a)},a);b.map(function(b){c.removeVariable(b)})}; +Entry.VariableContainer.prototype.updateCloudVariables=function(){var a=Entry.projectId;if(Entry.cloudSavable&&a){var b=Entry.variableContainer,a=b.variables_.filter(function(b){return b.isCloud_}),a=a.map(function(b){return b.toJSON()}),b=b.lists_.filter(function(b){return b.isCloud_}),b=b.map(function(b){return b.toJSON()});$.ajax({url:"/api/project/variable/"+Entry.projectId,type:"PUT",data:{variables:a,lists:b}}).done(function(){})}};Entry.block.run={skeleton:"basic",color:"#3BBD70",contents:["this is","basic block"],func:function(){}};Entry.block.jr_start={skeleton:"pebble_event",event:"start",color:"#3BBD70",contents:[{type:"Indicator",img:"/img/assets/ntry/bitmap/jr/block_play_image.png",highlightColor:"#3BBD70",size:22}],func:function(){var a=Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT),b;for(b in a)this._unit=a[b];Ntry.unitComp=Ntry.entityManager.getComponent(this._unit.id,Ntry.STATIC.UNIT)}}; Entry.block.jr_repeat={skeleton:"pebble_loop",color:"#127CDB",contents:[{type:"Dropdown",key:"REPEAT",options:[[1,1],[2,2],[3,3],[4,4],[5,5],[6,6],[7,7],[8,8],[9,9],[10,10]],value:1},{type:"Text",text:"\ubc18\ubcf5"},{type:"Statement",key:"STATEMENT",accept:"pebble_basic"}],func:function(){if(void 0===this.repeatCount)return this.repeatCount=this.block.values.REPEAT,Entry.STATIC.CONTINUE;if(0'),{parent:b});this.offset=this.svgDom.offset();this._svgWidth=this.svgDom.width();this.snap=Snap("#blockMenu"); +Entry.block.jr_if_construction={skeleton:"basic_loop",color:"#498DEB",contents:["\ub9cc\uc57d",{type:"Image",img:"/img/assets/ntry/bitmap/jr/jr_construction_image.png",size:18},"\uc55e\uc5d0 \uc788\ub2e4\uba74",{type:"Image",img:"/img/assets/week/blocks/for.png",size:24},{type:"Statement",key:"STATEMENT",accept:"basic",alignY:15,alignX:2}],func:function(){if(!this.isContinue){var a=Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT),b,c;for(c in a)b=a[c];a=Ntry.entityManager.getComponent(b.id, +Ntry.STATIC.UNIT);b=Ntry.entityManager.getComponent(b.id,Ntry.STATIC.GRID);b={x:b.x,y:b.y};Ntry.addVectorByDirection(b,a.direction,1);b=Ntry.entityManager.find({type:Ntry.STATIC.GRID,x:b.x,y:b.y},{type:Ntry.STATIC.TILE,tileType:Ntry.STATIC.OBSTACLE_REPAIR});this.isContinue=!0;a=this.block.values.STATEMENT;if(0!==b.length&&1!==a.getBlocks().length)return this.executor.stepInto(a),Entry.STATIC.CONTINUE}}}; +Entry.block.jr_if_speed={skeleton:"basic_loop",color:"#498DEB",contents:["\ub9cc\uc57d",{type:"Image",img:"/img/assets/ntry/bitmap/jr/jr_speed_image.png",size:18},"\uc55e\uc5d0 \uc788\ub2e4\uba74",{type:"Image",img:"/img/assets/week/blocks/for.png",size:24},{type:"Statement",key:"STATEMENT",accept:"basic",alignY:15,alignX:2}],func:function(){if(!this.isContinue){var a=Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT),b,c;for(c in a)b=a[c];a=Ntry.entityManager.getComponent(b.id,Ntry.STATIC.UNIT); +b=Ntry.entityManager.getComponent(b.id,Ntry.STATIC.GRID);b={x:b.x,y:b.y};Ntry.addVectorByDirection(b,a.direction,1);b=Ntry.entityManager.find({type:Ntry.STATIC.GRID,x:b.x,y:b.y},{type:Ntry.STATIC.TILE,tileType:Ntry.STATIC.OBSTACLE_SLOW});this.isContinue=!0;a=this.block.values.STATEMENT;if(0!==b.length&&1!==a.getBlocks().length)return this.executor.stepInto(a),Entry.STATIC.CONTINUE}}};Entry.BlockMenu=function(a,b){Entry.Model(this,!1);this._align=b||"CENTER";a="string"===typeof a?$("#"+a):$(a);if("DIV"!==a.prop("tagName"))return console.error("Dom is not div element");if("function"!==typeof window.Snap)return console.error("Snap library is required");this.svgDom=Entry.Dom($(''),{parent:a});this.offset=this.svgDom.offset();this._svgWidth=this.svgDom.width();this.snap=Snap("#blockMenu"); this.svgGroup=this.snap.group();this.svgThreadGroup=this.svgGroup.group();this.svgThreadGroup.board=this;this.svgBlockGroup=this.svgGroup.group();this.svgBlockGroup.board=this;this.changeEvent=new Entry.Event(this);this.observe(this,"generateDragBlockObserver",["dragBlock"]);Entry.documentMousedown&&Entry.documentMousedown.attach(this,this.setSelectedBlock)}; -(function(b){b.schema={code:null,dragBlock:null,closeBlock:null,selectedBlockView:null};b.changeCode=function(a){if(!(a instanceof Entry.Code))return console.error("You must inject code instance");this.codeListener&&this.code.changeEvent.detach(this.codeListener);this.set({code:a});var b=this;this.codeListener=this.code.changeEvent.attach(this,function(){b.changeEvent.notify()});a.createView(this);this.align()};b.bindCodeView=function(a){this.svgBlockGroup.remove();this.svgThreadGroup.remove();this.svgBlockGroup= -a.svgBlockGroup;this.svgThreadGroup=a.svgThreadGroup;this.svgGroup.append(this.svgThreadGroup);this.svgGroup.append(this.svgBlockGroup)};b.align=function(){for(var a=this.code.getThreads(),b=10,d="LEFT"==this._align?20:this.svgDom.width()/2,e=0,f=a.length;ee||(d.splice(e,1),(d=a.getFirstBlock())&&d.destroy(b))};b.doDestroyThread=function(a,b){var d=this._data,e=d.indexOf(a);0>e||(d.splice(e,1),(d=a.getFirstBlock())&&d.doDestroy(b))};b.getThreads=function(){return this._data};b.toJSON=function(){for(var a=this.getThreads(),b=[],d=0,e=a.length;de||(d.splice(e,1),(d=b.getFirstBlock())&&d.destroy(a))};a.doDestroyThread=function(b,a){var d=this._data,e=d.indexOf(b);0>e||(d.splice(e,1),(d=b.getFirstBlock())&&d.doDestroy(a))};a.getThreads=function(){return this._data};a.toJSON=function(){for(var b=this.getThreads(),a=[],d=0,e=b.length;d=e&&g>=b)}};b.align=function(){var a=this.getPosition();this.svgGroup.attr({transform:"t"+a.x+" "+a.y})};b.setPosition=function(){var a=this.board.svgDom;this._x=a.width()-110;this._y=a.height()-110;this.align()};b.getPosition=function(){return{x:this._x, -y:this._y}};b.tAnimation=function(a){if(a!==this.isOver){a=void 0===a?!0:a;var b=this.trashcanTop;a?b.animate({transform:"t5 -20 r30"},50):b.animate({transform:"r0"},50);this.isOver=a}}})(Entry.FieldTrashcan.prototype);Entry.Board=function(b){function a(a){var b=$(window);a=b.scrollTop();var b=b.scrollLeft(),f=c.offset;c.relativeOffset={top:f.top-a,left:f.left-b};console.log("update")}b="string"===typeof b?$("#"+b):$(b);if("DIV"!==b.prop("tagName"))return console.error("Dom is not div element");if("function"!==typeof window.Snap)return console.error("Snap library is required");Entry.Model(this,!1);this.svgDom=Entry.Dom($(''), -{parent:b});this.offset=this.svgDom.offset();this.offset.top=130;this.offset.left-=$(window).scrollLeft();this.relativeOffset=this.offset;var c=this;$(window).scroll(a);Entry.windowResized.attach(this,a);this.snap=Snap("#play");this._blockViews=[];this.trashcan=new Entry.FieldTrashcan(this);this.svgGroup=this.snap.group();this.svgThreadGroup=this.svgGroup.group();this.svgThreadGroup.board=this;this.svgBlockGroup=this.svgGroup.group();this.svgBlockGroup.board=this;Entry.ANIMATION_DURATION=200;Entry.BOARD_PADDING= -100;this.changeEvent=new Entry.Event(this);this.scroller=new Entry.Scroller(this,!0,!0);this._addControl(b);Entry.documentMousedown&&Entry.documentMousedown.attach(this,this.setSelectedBlock);Entry.keyPressed&&Entry.keyPressed.attach(this,this._keyboardControl)}; -(function(b){b.schema={code:null,dragBlock:null,magnetedBlockView:null,selectedBlockView:null};b.changeCode=function(a){this.codeListener&&this.code.changeEvent.detach(this.codeListener);this.set({code:a});var b=this;this.codeListener=this.code.changeEvent.attach(this,function(){b.changeEvent.notify()});a.createView(this);this.changeEvent.notify()};b.bindCodeView=function(a){this.svgBlockGroup.remove();this.svgThreadGroup.remove();this.svgBlockGroup=a.svgBlockGroup;this.svgThreadGroup=a.svgThreadGroup; -this.svgGroup.append(this.svgThreadGroup);this.svgGroup.append(this.svgBlockGroup)};b.setMagnetedBlock=function(a){if(this.magnetedBlockView){if(this.magnetedBlockView===a)return;this.magnetedBlockView.set({magneting:!1})}this.set({magnetedBlockView:a});a&&(a.set({magneting:!0,animating:!0}),a.dominate(),this.dragBlock.dominate())};b.getCode=function(){return this.code};b.findById=function(a){for(var b=this.code.getThreads(),d=0,e=b.length;d=e&&g>=a)}};a.align=function(){var b=this.getPosition();this.svgGroup.attr({transform:"t"+b.x+" "+b.y})};a.setPosition=function(){var b=this.board.svgDom;this._x=b.width()-110;this._y=b.height()-110;this.align()};a.getPosition=function(){return{x:this._x, +y:this._y}};a.tAnimation=function(b){if(b!==this.isOver){b=void 0===b?!0:b;var a=this.trashcanTop;b?a.animate({transform:"t5 -20 r30"},50):a.animate({transform:"r0"},50);this.isOver=b}}})(Entry.FieldTrashcan.prototype);Entry.Board=function(a){function b(b){var a=$(window);b=a.scrollTop();var a=a.scrollLeft(),f=c.offset;c.relativeOffset={top:f.top-b,left:f.left-a};console.log("update")}a="string"===typeof a?$("#"+a):$(a);if("DIV"!==a.prop("tagName"))return console.error("Dom is not div element");if("function"!==typeof window.Snap)return console.error("Snap library is required");Entry.Model(this,!1);this.svgDom=Entry.Dom($(''), +{parent:a});this.offset=this.svgDom.offset();this.offset.top=130;this.offset.left-=$(window).scrollLeft();this.relativeOffset=this.offset;var c=this;$(window).scroll(b);Entry.windowResized.attach(this,b);this.snap=Snap("#play");this._blockViews=[];this.trashcan=new Entry.FieldTrashcan(this);this.svgGroup=this.snap.group();this.svgThreadGroup=this.svgGroup.group();this.svgThreadGroup.board=this;this.svgBlockGroup=this.svgGroup.group();this.svgBlockGroup.board=this;Entry.ANIMATION_DURATION=200;Entry.BOARD_PADDING= +100;this.changeEvent=new Entry.Event(this);this.scroller=new Entry.Scroller(this,!0,!0);this._addControl(a);Entry.documentMousedown&&Entry.documentMousedown.attach(this,this.setSelectedBlock);Entry.keyPressed&&Entry.keyPressed.attach(this,this._keyboardControl)}; +(function(a){a.schema={code:null,dragBlock:null,magnetedBlockView:null,selectedBlockView:null};a.changeCode=function(b){this.codeListener&&this.code.changeEvent.detach(this.codeListener);this.set({code:b});var a=this;this.codeListener=this.code.changeEvent.attach(this,function(){a.changeEvent.notify()});b.createView(this);this.changeEvent.notify()};a.bindCodeView=function(b){this.svgBlockGroup.remove();this.svgThreadGroup.remove();this.svgBlockGroup=b.svgBlockGroup;this.svgThreadGroup=b.svgThreadGroup; +this.svgGroup.append(this.svgThreadGroup);this.svgGroup.append(this.svgBlockGroup)};a.setMagnetedBlock=function(b){if(this.magnetedBlockView){if(this.magnetedBlockView===b)return;this.magnetedBlockView.set({magneting:!1})}this.set({magnetedBlockView:b});b&&(b.set({magneting:!0,animating:!0}),b.dominate(),this.dragBlock.dominate())};a.getCode=function(){return this.code};a.findById=function(b){for(var a=this.code.getThreads(),d=0,e=a.length;d", "class": "xbot_sensor" }, - - "xbot_digitalInput": { + "xbot_digitalInput": { "isNotFor": ["xbot_epor_edge"], "xml": "", "class": "xbot_sensor" }, - "xbot_analogValue": { "isNotFor": ["xbot_epor_edge"], "xml": "", @@ -476,7 +476,16 @@ EntryStatic.blockInfo = { "class": "xbot_sensor" }, //end of XBOT Blocks added - + "ev3_port_out": { + "isNotFor": ["EV3"], + "xml": "10", + "class": "ev3_output" + },//end of XBOT Blocks added + "ev3_touch_sensor": { + "isNotFor": ["EV3"], + "xml": "", + "class": "ev3_sensor" + }, "when_run_button_click": { "xml": "", "class": "event", diff --git a/src/blocks/block_ev3.js b/src/blocks/block_ev3.js new file mode 100644 index 0000000000..db40adceea --- /dev/null +++ b/src/blocks/block_ev3.js @@ -0,0 +1,103 @@ +"use strict"; + +Entry.EV3 = { + PORT_MAP: { + A: 0, + B: 0, + C: 0, + D: 0, + '1': undefined, + '2': undefined, + '3': undefined, + '4': undefined + }, + deviceType: { + NxtTouch: 1, + NxtLight: 2, + NxtSound: 3, + NxtColor: 4, + NxtUltrasonic: 5, + NxtTemperature: 6, + LMotor: 7, + MMotor: 8, + Touch: 16, + Color: 29, + Ultrasonic: 30, + Gyroscope: 32, + Infrared: 33, + Initializing: 0x7d, + Empty: 0x7e, + WrongPort: 0x7f, + Unknown: 0xff + }, + setZero: function() { + var portMap = this.PORT_MAP; + Object.keys(portMap).forEach(function (port) { + Entry.hw.sendQueue[port] = portMap[port]; + }); + Entry.hw.update(); + }, + name: 'EV3' +}; + +//Motor +Blockly.Blocks.ev3_port_out = { + init: function() { + this.setColour("#00979D"); + this.appendDummyInput() + .appendField('') + .appendField(new Blockly.FieldDropdown([ + ['A', 'A'], + ['B', 'B'], + ['C', 'C'], + ['D', 'D'] + ]), "PORT") + .appendField('의 값을'); + this.appendValueInput("VALUE") + .setCheck(["Number", "String", null]); + this.appendDummyInput() + .appendField('으로 변환'); + // this.setOutput(true, 'Number'); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + } +}; + +Entry.block.ev3_port_out = function (sprite, script) { + var port = script.getStringField("PORT", script); + var value = script.getValue("VALUE", script); + Entry.hw.sendQueue[port] = value; + return script.callReturn(); +}; + +//sensor +Blockly.Blocks.ev3_touch_sensor = { + init: function() { + this.setColour("#00979D"); + this.appendDummyInput() + .appendField('') + .appendField(new Blockly.FieldDropdown([ + ['1', '1'], + ['2', '2'], + ['3', '3'], + ['4', '4'] + ]), "PORT") + .appendField('의 터치센서가 작동되었는가?'); + this.setOutput(true, 'Boolean'); + this.setInputsInline(true); + } +}; + +Entry.block.ev3_touch_sensor = function (sprite, script) { + var port = script.getStringField("PORT", script); + var portData = Entry.hw.getDigitalPortValue(script.getNumberField("PORT", script)); + result = false; + if(portData.type == Entry.EV3.deviceType.Touch) { + if(Number(portData.siValue) >= 1) { + result = true; + } + } + + return result; +}; \ No newline at end of file diff --git a/src/hw.js b/src/hw.js index c1753fa9eb..4caeea4741 100644 --- a/src/hw.js +++ b/src/hw.js @@ -33,7 +33,8 @@ Entry.HW = function() { '42': Entry.Arduino, '51': Entry.Neobot, '71': Entry.Robotis_carCont, - '72': Entry.Robotis_openCM70 + '72': Entry.Robotis_openCM70, + '81': Entry.EV3 }; }; From bcfe4723d3a5717105aab4c79fb803d18178e051 Mon Sep 17 00:00:00 2001 From: kimorkim Date: Thu, 28 Apr 2016 19:29:16 +0900 Subject: [PATCH 02/15] =?UTF-8?q?1=EC=B0=A8=20ev3=EA=B0=9C=EB=B0=9C=20?= =?UTF-8?q?=EC=99=84=EB=A3=8C.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/entry.js | 135 ++- dist/entry.min.js | 2213 ++++++++++++++++++++------------------- extern/util/static.js | 37 +- src/blocks/block_ev3.js | 272 ++++- 4 files changed, 1512 insertions(+), 1145 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index 321d483f77..349839e3bc 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -1904,26 +1904,35 @@ Entry.block.choose_project_timer_action = function(b, a) { "START" == c ? e.isInit ? e.isInit && e.isPaused && (e.pauseStart && (e.pausedTime += (new Date).getTime() - e.pauseStart), delete e.pauseStart, e.isPaused = !1) : d.startProjectTimer() : "STOP" == c ? e.isInit && !e.isPaused && (e.isPaused = !0, e.pauseStart = (new Date).getTime()) : "RESET" == c && e.isInit && (e.setValue(0), e.start = (new Date).getTime(), e.pausedTime = 0, delete e.pauseStart); return a.callReturn(); }; -Entry.EV3 = {PORT_MAP:{A:0, B:0, C:0, D:0, 1:void 0, 2:void 0, 3:void 0, 4:void 0}, deviceType:{NxtTouch:1, NxtLight:2, NxtSound:3, NxtColor:4, NxtUltrasonic:5, NxtTemperature:6, LMotor:7, MMotor:8, Touch:16, Color:29, Ultrasonic:30, Gyroscope:32, Infrared:33, Initializing:125, Empty:126, WrongPort:127, Unknown:255}, setZero:function() { +Entry.EV3 = {PORT_MAP:{A:0, B:0, C:0, D:0, 1:void 0, 2:void 0, 3:void 0, 4:void 0}, motorMovementTypes:{Degrees:0, Power:1}, deviceTypes:{NxtTouch:1, NxtLight:2, NxtSound:3, NxtColor:4, NxtUltrasonic:5, NxtTemperature:6, LMotor:7, MMotor:8, Touch:16, Color:29, Ultrasonic:30, Gyroscope:32, Infrared:33, Initializing:125, Empty:126, WrongPort:127, Unknown:255}, colorSensorValue:" 000000 0000FF 00FF00 FFFF00 FF0000 FFFFFF A52A2A".split(" "), timeouts:[], removeTimeout:function(b) { + clearTimeout(b); + var a = this.timeouts; + b = a.indexOf(b); + 0 <= b && a.splice(b, 1); +}, removeAllTimeouts:function() { + var b = this.timeouts, a; + for (a in b) { + clearTimeout(b[a]); + } + this.timeouts = []; +}, setZero:function() { var b = this.PORT_MAP; Object.keys(b).forEach(function(a) { - Entry.hw.sendQueue[a] = b[a]; + /[A-D]/i.test(a) ? Entry.hw.sendQueue[a] = {type:Entry.EV3.motorMovementTypes.Power, power:0} : Entry.hw.sendQueue[a] = b[a]; }); Entry.hw.update(); }, name:"EV3"}; -Blockly.Blocks.ev3_port_out = {init:function() { +Blockly.Blocks.ev3_get_sensor_value = {init:function() { this.setColour("#00979D"); - this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["A", "A"], ["B", "B"], ["C", "C"], ["D", "D"]]), "PORT").appendField("\uc758 \uac12\uc744"); - this.appendValueInput("VALUE").setCheck(["Number", "String", null]); - this.appendDummyInput().appendField("\uc73c\ub85c \ubcc0\ud658"); + this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"]]), "PORT").appendField("\uc758 \uac12"); + this.setOutput(!0, "Number"); this.setInputsInline(!0); - this.setPreviousStatement(!0); - this.setNextStatement(!0); }}; -Entry.block.ev3_port_out = function(b, a) { - var c = a.getStringField("PORT", a), d = a.getValue("VALUE", a); - Entry.hw.sendQueue[c] = d; - return a.callReturn(); +Entry.block.ev3_get_sensor_value = function(b, a) { + a.getStringField("PORT", a); + var c = Entry.hw.getDigitalPortValue(a.getNumberField("PORT", a)), d; + $.isPlainObject(c) && (d = c.siValue || 0); + return d; }; Blockly.Blocks.ev3_touch_sensor = {init:function() { this.setColour("#00979D"); @@ -1933,10 +1942,104 @@ Blockly.Blocks.ev3_touch_sensor = {init:function() { }}; Entry.block.ev3_touch_sensor = function(b, a) { a.getStringField("PORT", a); - var c = Entry.hw.getDigitalPortValue(a.getNumberField("PORT", a)); - result = !1; - c.type == Entry.EV3.deviceType.Touch && 1 <= +c.siValue && (result = !0); - return result; + var c = Entry.hw.getDigitalPortValue(a.getNumberField("PORT", a)), d = !1; + c.type == Entry.EV3.deviceTypes.Touch && 1 <= +c.siValue && (d = !0); + return d; +}; +Blockly.Blocks.ev3_color_sensor = {init:function() { + this.setColour("#00979D"); + this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"]]), "PORT").appendField("\uc758 ").appendField(new Blockly.FieldDropdown([["RGB", "RGB"], ["R", "R"], ["G", "G"], ["B", "B"]]), "RGB").appendField("\uac12"); + this.setOutput(!0, "String"); + this.setInputsInline(!0); +}}; +Entry.block.ev3_color_sensor = function(b, a) { + a.getStringField("PORT", a); + var c = a.getStringField("RGB", a), d = Entry.hw.getDigitalPortValue(a.getNumberField("PORT", a)), e = ""; + if (d.type == Entry.EV3.deviceTypes.Color) { + if (0 == d.siValue) { + e = ""; + } else { + switch(c) { + case "RGB": + e = Entry.EV3.colorSensorValue[d.siValue]; + break; + case "R": + e = Entry.EV3.colorSensorValue[d.siValue].substring(0, 2); + break; + case "G": + e = Entry.EV3.colorSensorValue[d.siValue].substring(2, 4); + break; + case "B": + e = Entry.EV3.colorSensorValue[d.siValue].substring(4, 6); + } + } + } else { + e = "\uceec\ub7ec \uc13c\uc11c \uc544\ub2d8"; + } + return e; +}; +Blockly.Blocks.ev3_motor_power = {init:function() { + this.setColour("#00979D"); + this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["A", "A"], ["B", "B"], ["C", "C"], ["D", "D"]]), "PORT").appendField("\uc758 \uac12\uc744"); + this.appendValueInput("VALUE").setCheck(["Number"]); + this.appendDummyInput().appendField("\uc73c\ub85c \ucd9c\ub825"); + this.setInputsInline(!0); + this.setPreviousStatement(!0); + this.setNextStatement(!0); +}}; +Entry.block.ev3_motor_power = function(b, a) { + var c = a.getStringField("PORT", a), d = a.getValue("VALUE", a); + Entry.hw.sendQueue[c] = {id:Math.floor(1E5 * Math.random(), 0), type:Entry.EV3.motorMovementTypes.Power, power:d}; + return a.callReturn(); +}; +Blockly.Blocks.ev3_motor_power_on_time = {init:function() { + this.setColour("#00979D"); + this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["A", "A"], ["B", "B"], ["C", "C"], ["D", "D"]]), "PORT").appendField("\uc758 \uac12\uc744"); + this.appendValueInput("TIME").setCheck(["Number"]); + this.appendDummyInput().appendField("\ucd08 \ub3d9\uc548"); + this.appendValueInput("VALUE").setCheck(["Number"]); + this.appendDummyInput().appendField("\uc73c\ub85c \ucd9c\ub825"); + this.setInputsInline(!0); + this.setPreviousStatement(!0); + this.setNextStatement(!0); +}}; +Entry.block.ev3_motor_power_on_time = function(b, a) { + if (a.isStart) { + if (1 == a.timeFlag) { + return a; + } + delete a.isStart; + delete a.timeFlag; + Entry.engine.isContinue = !1; + Entry.hw.sendQueue[c] = {id:Math.floor(1E5 * Math.random(), 0), type:Entry.EV3.motorMovementTypes.Power, power:0}; + return a.callReturn(); + } + a.isStart = !0; + a.timeFlag = 1; + var c = a.getStringField("PORT", a), d = a.getValue("TIME", a), e = a.getValue("VALUE", a); + Entry.hw.sendQueue[c] = {id:Math.floor(1E5 * Math.random(), 0), type:Entry.EV3.motorMovementTypes.Power, power:e}; + var f = setTimeout(function() { + a.timeFlag = 0; + Entry.EV3.removeTimeout(f); + }, 1E3 * d); + Entry.EV3.timeouts.push(f); + return a; +}; +Blockly.Blocks.ev3_motor_degrees = {init:function() { + this.setColour("#00979D"); + this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["A", "A"], ["B", "B"], ["C", "C"], ["D", "D"]]), "PORT").appendField("\uc758 \uac12\uc744").appendField(new Blockly.FieldDropdown([["\uc2dc\uacc4\ubc29\ud5a5", "CW"], ["\ubc18\uc2dc\uacc4\ubc29\ud5a5", "CCW"]]), "DIRECTION").appendField("\uc73c\ub85c "); + this.appendValueInput("DEGREE").setCheck(["Number"]); + this.appendDummyInput().appendField("\ub3c4 \ub9cc\ud07c \ud68c\uc804"); + this.setInputsInline(!0); + this.setPreviousStatement(!0); + this.setNextStatement(!0); +}}; +Entry.block.ev3_motor_degrees = function(b, a) { + var c = a.getStringField("PORT", a), d = a.getValue("DEGREE", a); + 0 >= d ? d = 0 : 720 <= d && (d = 720); + var e = a.getStringField("DIRECTION", a); + Entry.hw.sendQueue[c] = {id:Math.floor(1E5 * Math.random(), 0), type:Entry.EV3.motorMovementTypes.Degrees, degree:d, power:"CW" == e ? 50 : -50}; + return a.callReturn(); }; Blockly.Blocks.wait_second = {init:function() { this.setColour("#498deb"); diff --git a/dist/entry.min.js b/dist/entry.min.js index 8fd409a928..c49fd3d4fa 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -1,480 +1,493 @@ -var Entry={block:{},TEXT_ALIGN_CENTER:0,TEXT_ALIGN_LEFT:1,TEXT_ALIGN_RIGHT:2,TEXT_ALIGNS:["center","left","right"],loadProject:function(a){a||(a=Entry.getStartProject(Entry.mediaFilePath));"workspace"==this.type&&Entry.stateManager.startIgnore();Entry.projectId=a._id;Entry.variableContainer.setVariables(a.variables);Entry.variableContainer.setMessages(a.messages);Entry.variableContainer.setFunctions(a.functions);Entry.scene.addScenes(a.scenes);Entry.stage.initObjectContainers();Entry.container.setObjects(a.objects); -Entry.FPS=a.speed?a.speed:60;createjs.Ticker.setFPS(Entry.FPS);"workspace"==this.type&&Entry.stateManager.endIgnore();Entry.engine.projectTimer||Entry.variableContainer.generateTimer();0===Object.keys(Entry.container.inputValue).length&&Entry.variableContainer.generateAnswer();Entry.start();return a},exportProject:function(a){a||(a={});Entry.engine.isState("stop")||Entry.engine.toggleStop();Entry.Func&&Entry.Func.workspace&&Entry.Func.workspace.visible&&Entry.Func.cancelEdit();a.objects=Entry.container.toJSON(); -a.scenes=Entry.scene.toJSON();a.variables=Entry.variableContainer.getVariableJSON();a.messages=Entry.variableContainer.getMessageJSON();a.functions=Entry.variableContainer.getFunctionJSON();a.scenes=Entry.scene.toJSON();a.speed=Entry.FPS;return a},setBlockByText:function(a,b){for(var c=[],d=jQuery.parseXML(b).getElementsByTagName("category"),e=0;eb?b=325:720b?b=244:400svg").css({width:b-64+"px"});$(".entryBlocklyWorkspace").css({left:b+ -"px"});Entry.playground.resizeHandle_.style.left=b+"px";Entry.playground.variableViewWrapper_.style.width=b+"px";this.interfaceState=a}Blockly.fireUiEvent(window,"resize")},getUpTime:function(){return(new Date).getTime()-this.startTime},addActivity:function(a){Entry.stateManager&&Entry.stateManager.addActivity(a)},startActivityLogging:function(){Entry.reporter&&Entry.reporter.start(Entry.projectId,window.user?window.user._id:null,Entry.startTime)},getActivityLog:function(){var a={};Entry.stateManager&& -(a.activityLog=Entry.stateManager.activityLog_);return a},DRAG_MODE_NONE:0,DRAG_MODE_MOUSEDOWN:1,DRAG_MODE_DRAG:2,cancelObjectEdit:function(a){var b=Entry.playground.object;if(b){var c=a.target;a=0!==$(b.view_).find(c).length;c=c.tagName.toUpperCase();!b.isEditing||"INPUT"===c&&a||b.editObjectValues(!1)}}};window.Entry=Entry;Entry.Albert={PORT_MAP:{leftWheel:0,rightWheel:0,buzzer:0,leftEye:0,rightEye:0,note:0,bodyLed:0,frontLed:0,padWidth:0,padHeight:0},setZero:function(){var a=Entry.Albert.PORT_MAP,b=Entry.hw.sendQueue,c;for(c in a)b[c]=a[c];Entry.hw.update();a=Entry.Albert;a.tempo=60;a.removeAllTimeouts()},monitorTemplate:{imgPath:"hw/albert.png",width:387,height:503,listPorts:{oid:{name:"OID",type:"input",pos:{x:0,y:0}},buzzer:{name:Lang.Hw.buzzer,type:"output",pos:{x:0,y:0}},note:{name:Lang.Hw.note,type:"output", +var Entry={block:{},TEXT_ALIGN_CENTER:0,TEXT_ALIGN_LEFT:1,TEXT_ALIGN_RIGHT:2,TEXT_ALIGNS:["center","left","right"],loadProject:function(b){b||(b=Entry.getStartProject(Entry.mediaFilePath));"workspace"==this.type&&Entry.stateManager.startIgnore();Entry.projectId=b._id;Entry.variableContainer.setVariables(b.variables);Entry.variableContainer.setMessages(b.messages);Entry.variableContainer.setFunctions(b.functions);Entry.scene.addScenes(b.scenes);Entry.stage.initObjectContainers();Entry.container.setObjects(b.objects); +Entry.FPS=b.speed?b.speed:60;createjs.Ticker.setFPS(Entry.FPS);"workspace"==this.type&&Entry.stateManager.endIgnore();Entry.engine.projectTimer||Entry.variableContainer.generateTimer();0===Object.keys(Entry.container.inputValue).length&&Entry.variableContainer.generateAnswer();Entry.start();return b},exportProject:function(b){b||(b={});Entry.engine.isState("stop")||Entry.engine.toggleStop();Entry.Func&&Entry.Func.workspace&&Entry.Func.workspace.visible&&Entry.Func.cancelEdit();b.objects=Entry.container.toJSON(); +b.scenes=Entry.scene.toJSON();b.variables=Entry.variableContainer.getVariableJSON();b.messages=Entry.variableContainer.getMessageJSON();b.functions=Entry.variableContainer.getFunctionJSON();b.scenes=Entry.scene.toJSON();b.speed=Entry.FPS;return b},setBlockByText:function(b,a){for(var c=[],d=jQuery.parseXML(a).getElementsByTagName("category"),e=0;ea?a=325:720a?a=244:400svg").css({width:a-64+"px"});$(".entryBlocklyWorkspace").css({left:a+ +"px"});Entry.playground.resizeHandle_.style.left=a+"px";Entry.playground.variableViewWrapper_.style.width=a+"px";this.interfaceState=b}Blockly.fireUiEvent(window,"resize")},getUpTime:function(){return(new Date).getTime()-this.startTime},addActivity:function(b){Entry.stateManager&&Entry.stateManager.addActivity(b)},startActivityLogging:function(){Entry.reporter&&Entry.reporter.start(Entry.projectId,window.user?window.user._id:null,Entry.startTime)},getActivityLog:function(){var b={};Entry.stateManager&& +(b.activityLog=Entry.stateManager.activityLog_);return b},DRAG_MODE_NONE:0,DRAG_MODE_MOUSEDOWN:1,DRAG_MODE_DRAG:2,cancelObjectEdit:function(b){var a=Entry.playground.object;if(a){var c=b.target;b=0!==$(a.view_).find(c).length;c=c.tagName.toUpperCase();!a.isEditing||"INPUT"===c&&b||a.editObjectValues(!1)}}};window.Entry=Entry;Entry.Albert={PORT_MAP:{leftWheel:0,rightWheel:0,buzzer:0,leftEye:0,rightEye:0,note:0,bodyLed:0,frontLed:0,padWidth:0,padHeight:0},setZero:function(){var b=Entry.Albert.PORT_MAP,a=Entry.hw.sendQueue,c;for(c in b)a[c]=b[c];Entry.hw.update();b=Entry.Albert;b.tempo=60;b.removeAllTimeouts()},monitorTemplate:{imgPath:"hw/albert.png",width:387,height:503,listPorts:{oid:{name:"OID",type:"input",pos:{x:0,y:0}},buzzer:{name:Lang.Hw.buzzer,type:"output",pos:{x:0,y:0}},note:{name:Lang.Hw.note,type:"output", pos:{x:0,y:0}}},ports:{leftProximity:{name:Lang.Blocks.ALBERT_sensor_leftProximity,type:"input",pos:{x:178,y:401}},rightProximity:{name:Lang.Blocks.ALBERT_sensor_rightProximity,type:"input",pos:{x:66,y:359}},battery:{name:Lang.Blocks.ALBERT_sensor_battery,type:"input",pos:{x:88,y:368}},light:{name:Lang.Blocks.ALBERT_sensor_light,type:"input",pos:{x:127,y:391}},leftWheel:{name:Lang.Hw.leftWheel,type:"output",pos:{x:299,y:406}},rightWheel:{name:Lang.Hw.rightWheel,type:"output",pos:{x:22,y:325}},leftEye:{name:Lang.Hw.leftEye, -type:"output",pos:{x:260,y:26}},rightEye:{name:Lang.Hw.rightEye,type:"output",pos:{x:164,y:13}},bodyLed:{name:Lang.Hw.body+" "+Lang.Hw.led,type:"output",pos:{x:367,y:308}},frontLed:{name:Lang.Hw.front+" "+Lang.Hw.led,pos:{x:117,y:410}}},mode:"both"},tempo:60,timeouts:[],removeTimeout:function(a){clearTimeout(a);var b=this.timeouts;a=b.indexOf(a);0<=a&&b.splice(a,1)},removeAllTimeouts:function(){var a=this.timeouts,b;for(b in a)clearTimeout(a[b]);this.timeouts=[]},name:"albert"}; -Blockly.Blocks.albert_hand_found={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_hand_found);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.albert_hand_found=function(a,b){var c=Entry.hw.portData;return 40Entry.Albert.tempo&&(Entry.Albert.tempo=1);return b.callReturn()}; +Entry.block.albert_change_tempo_by=function(b,a){Entry.Albert.tempo+=a.getNumberValue("VALUE");1>Entry.Albert.tempo&&(Entry.Albert.tempo=1);return a.callReturn()}; Blockly.Blocks.albert_set_tempo_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_tempo_to_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ALBERT_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.albert_set_tempo_to=function(a,b){Entry.Albert.tempo=b.getNumberValue("VALUE");1>Entry.Albert.tempo&&(Entry.Albert.tempo=1);return b.callReturn()};Blockly.Blocks.albert_move_forward={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_move_forward).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.albert_move_forward=function(a,b){var c=Entry.hw.sendQueue;if(b.isStart){if(1==b.timeFlag)return b;delete b.timeFlag;delete b.isStart;Entry.engine.isContinue=!1;c.leftWheel=0;c.rightWheel=0;return b.callReturn()}b.isStart=!0;b.timeFlag=1;c.leftWheel=30;c.rightWheel=30;setTimeout(function(){b.timeFlag=0},1E3);return b}; +Entry.block.albert_set_tempo_to=function(b,a){Entry.Albert.tempo=a.getNumberValue("VALUE");1>Entry.Albert.tempo&&(Entry.Albert.tempo=1);return a.callReturn()};Blockly.Blocks.albert_move_forward={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_move_forward).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; +Entry.block.albert_move_forward=function(b,a){var c=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return 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;c.leftWheel=30;c.rightWheel=30;setTimeout(function(){a.timeFlag=0},1E3);return a}; Blockly.Blocks.albert_move_backward={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_move_backward).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.albert_move_backward=function(a,b){var c=Entry.hw.sendQueue;if(b.isStart){if(1==b.timeFlag)return c.leftWheel=-30,c.rightWheel=-30,b;delete b.timeFlag;delete b.isStart;Entry.engine.isContinue=!1;c.leftWheel=0;c.rightWheel=0;return b.callReturn()}b.isStart=!0;b.timeFlag=1;setTimeout(function(){b.timeFlag=0},1E3);return b}; +Entry.block.albert_move_backward=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}; 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(a,b){var c=Entry.hw.sendQueue;if(b.isStart){if(1==b.timeFlag)return c.leftWheel=b.leftValue,c.rightWheel=b.rightValue,b;delete b.timeFlag;delete b.isStart;delete b.leftValue;delete b.rightValue;Entry.engine.isContinue=!1;c.leftWheel=0;c.rightWheel=0;return b.callReturn()}c="LEFT"==b.getField("DIRECTION",b);b.leftValue=c?-30:30;b.rightValue=c?30:-30;b.isStart=!0;b.timeFlag=1;setTimeout(function(){b.timeFlag=0},1E3);return b}; +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(a,b){var c=Entry.hw.sendQueue,d=b.getField("DIRECTION",b),e=+b.getField("COLOR",b);"FRONT"==d?(c.leftEye=e,c.rightEye=e):"LEFT"==d?c.leftEye=e:c.rightEye=e;return b.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(a,b){var c=Entry.hw.sendQueue,d=b.getField("DIRECTION",b);"FRONT"==d?(c.leftEye=0,c.rightEye=0):"LEFT"==d?c.leftEye=0:c.rightEye=0;return b.callReturn()}; +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+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.albert_change_wheels_by=function(a,b){var c=Entry.hw.sendQueue,d=Entry.hw.portData,e=b.getField("DIRECTION"),f=b.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 b.callReturn()}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.albert_change_wheels_by=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()}; Blockly.Blocks.albert_set_wheels_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_wheels_to_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"FRONT"]]),"DIRECTION").appendField(Lang.Blocks.HAMSTER_set_wheels_to_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_wheels_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_wheels_to=function(a,b){var c=Entry.hw.sendQueue,d=b.getField("DIRECTION"),e=b.getNumberValue("VALUE");"LEFT"==d?c.leftWheel=e:("RIGHT"!=d&&(c.leftWheel=e),c.rightWheel=e);return b.callReturn()};Entry.Arduino={name:"arduino",setZero:function(){Entry.hw.sendQueue.readablePorts=[];for(var a=0;20>a;a++)Entry.hw.sendQueue[a]=0,Entry.hw.sendQueue.readablePorts.push(a);Entry.hw.update()},monitorTemplate:{imgPath:"hw/arduino.png",width:605,height:434,listPorts:{2:{name:Lang.Hw.port_en+" 2 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},3:{name:Lang.Hw.port_en+" 3 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},4:{name:Lang.Hw.port_en+" 4 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},5:{name:Lang.Hw.port_en+ +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.albert_set_wheels_to=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()};Entry.Arduino={name:"arduino",setZero:function(){Entry.hw.sendQueue.readablePorts=[];for(var b=0;20>b;b++)Entry.hw.sendQueue[b]=0,Entry.hw.sendQueue.readablePorts.push(b);Entry.hw.update()},monitorTemplate:{imgPath:"hw/arduino.png",width:605,height:434,listPorts:{2:{name:Lang.Hw.port_en+" 2 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},3:{name:Lang.Hw.port_en+" 3 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},4:{name:Lang.Hw.port_en+" 4 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},5:{name:Lang.Hw.port_en+ " 5 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},6:{name:Lang.Hw.port_en+" 6 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},7:{name:Lang.Hw.port_en+" 7 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},8:{name:Lang.Hw.port_en+" 8 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},9:{name:Lang.Hw.port_en+" 9 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},10:{name:Lang.Hw.port_en+" 10 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},11:{name:Lang.Hw.port_en+" 11 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},12:{name:Lang.Hw.port_en+ " 12 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},13:{name:Lang.Hw.port_en+" 13 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},a0:{name:Lang.Hw.port_en+" A0 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},a1:{name:Lang.Hw.port_en+" A1 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},a2:{name:Lang.Hw.port_en+" A2 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},a3:{name:Lang.Hw.port_en+" A3 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},a4:{name:Lang.Hw.port_en+" A4 "+Lang.Hw.port_ko,type:"input",pos:{x:0, y:0}},a5:{name:Lang.Hw.port_en+" A5 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}}},mode:"both"}}; Entry.SensorBoard={name:"sensorBoard",setZero:Entry.Arduino.setZero,monitorTemplate:{imgPath:"hw/sensorBoard.png",width:400,height:400,listPorts:{2:{name:Lang.Hw.port_en+" 2 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},3:{name:Lang.Hw.port_en+" 3 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},4:{name:Lang.Hw.port_en+" 4 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},5:{name:Lang.Hw.port_en+" 5 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},a3:{name:Lang.Hw.port_en+" A3 "+Lang.Hw.port_ko,type:"input", pos:{x:0,y:0}},a4:{name:Lang.Hw.port_en+" A4 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},a5:{name:Lang.Hw.port_en+" A5 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},6:{name:Lang.Hw.port_en+" 6 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},7:{name:Lang.Hw.port_en+" 7 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},12:{name:Lang.Hw.port_en+" 12 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},13:{name:Lang.Hw.port_en+" 13 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}}},ports:{0:{name:Lang.Hw.light+" "+ Lang.Hw.sensor+"2",type:"input",pos:{x:116,y:330}},slider:{name:Lang.Blocks.CODEino_sensor_name_2,type:"input",pos:{x:230,y:47}},1:{name:Lang.Hw.temp,type:"input",pos:{x:310,y:332}},8:{name:Lang.Hw.right_ko+Lang.Hw.switch_+Lang.Hw.right_en,type:"input",pos:{x:273,y:205}},9:{name:Lang.Hw.left_ko+Lang.Hw.switch_+Lang.Hw.left_en,type:"input",pos:{x:112,y:155}},10:{name:Lang.Hw.up_ko+Lang.Hw.switch_+Lang.Hw.up_en,type:"input",pos:{x:188,y:83}},11:{name:Lang.Hw.down_ko+Lang.Hw.switch_+Lang.Hw.down_en, -type:"input",pos:{x:196,y:281}}},mode:"both"}};Entry.dplay={name:"dplay",setZero:Entry.Arduino.setZero};Entry.CODEino={name:"CODEino",setZero:Entry.Arduino.setZero,monitorTemplate:Entry.Arduino.monitorTemplate};Blockly.Blocks.arduino_text={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldTextInput("Arduino"),"NAME");this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.arduino_text=function(a,b){return b.getStringField("NAME")}; +type:"input",pos:{x:196,y:281}}},mode:"both"}};Entry.dplay={name:"dplay",setZero:Entry.Arduino.setZero};Entry.CODEino={name:"CODEino",setZero:Entry.Arduino.setZero,monitorTemplate:Entry.Arduino.monitorTemplate};Blockly.Blocks.arduino_text={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldTextInput("Arduino"),"NAME");this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.arduino_text=function(b,a){return a.getStringField("NAME")}; 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(a,b){var c=b.getValue("VALUE",b),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 b.callReturn()}; +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(a,b){var c=b.getValue("VALUE",b),d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/",!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return+d.responseText}; +Entry.block.arduino_get_number=function(b,a){var c=a.getValue("VALUE",a),d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/",!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return+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(a,b){var c=b.getValue("VALUE",b),d=new XMLHttpRequest;d.open("POST","http://localhost:23518/arduino/",!1);d.send(String(c));Entry.assert(200==d.status,"arduino is not connected");return d.responseText}; +Entry.block.arduino_get_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(" "); -this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.arduino_get_sensor_number=function(a,b){return b.getStringField("PORT")}; -Blockly.Blocks.arduino_get_port_number={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["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"]]),"PORT");this.appendDummyInput().appendField(" ");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.arduino_get_port_number=function(a,b){return b.getStringField("PORT")}; -Blockly.Blocks.arduino_get_pwm_port_number={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["3","3"],["5","5"],["6","6"],["9","9"],["10","10"],["11","11"]]),"PORT");this.appendDummyInput().appendField(" ");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.arduino_get_pwm_port_number=function(a,b){return b.getStringField("PORT")}; -Blockly.Blocks.arduino_get_number_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_sensor_value_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_sensor_value_2).appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.arduino_get_number_sensor_value=function(a,b){var c=b.getValue("VALUE",b);return Entry.hw.getAnalogPortValue(c[1])}; -Blockly.Blocks.arduino_get_digital_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_get_digital_value_1);this.appendValueInput("VALUE").setCheck("Number");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_sensor_value_2).appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}};Entry.block.arduino_get_digital_value=function(a,b){var c=b.getNumberValue("VALUE",b);return Entry.hw.getDigitalPortValue(c)}; +this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.arduino_get_sensor_number=function(b,a){return a.getStringField("PORT")}; +Blockly.Blocks.arduino_get_port_number={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["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"]]),"PORT");this.appendDummyInput().appendField(" ");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.arduino_get_port_number=function(b,a){return a.getStringField("PORT")}; +Blockly.Blocks.arduino_get_pwm_port_number={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["3","3"],["5","5"],["6","6"],["9","9"],["10","10"],["11","11"]]),"PORT");this.appendDummyInput().appendField(" ");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.arduino_get_pwm_port_number=function(b,a){return a.getStringField("PORT")}; +Blockly.Blocks.arduino_get_number_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_sensor_value_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_sensor_value_2).appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.arduino_get_number_sensor_value=function(b,a){var c=a.getValue("VALUE",a);return Entry.hw.getAnalogPortValue(c[1])}; +Blockly.Blocks.arduino_get_digital_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_get_digital_value_1);this.appendValueInput("VALUE").setCheck("Number");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_sensor_value_2).appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}};Entry.block.arduino_get_digital_value=function(b,a){var c=a.getNumberValue("VALUE",a);return Entry.hw.getDigitalPortValue(c)}; Blockly.Blocks.arduino_toggle_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_pin_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_pin_2);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.ARDUINO_on,"on"],[Lang.Blocks.ARDUINO_off,"off"]]),"OPERATOR").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*")); -this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.arduino_toggle_led=function(a,b){var c=b.getNumberValue("VALUE"),d="on"==b.getField("OPERATOR")?255:0;Entry.hw.setDigitalPortValue(c,d);return b.callReturn()}; +this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.arduino_toggle_led=function(b,a){var c=a.getNumberValue("VALUE"),d="on"==a.getField("OPERATOR")?255:0;Entry.hw.setDigitalPortValue(c,d);return a.callReturn()}; Blockly.Blocks.arduino_toggle_pwm={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_toggle_pwm_1);this.appendValueInput("PORT").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_toggle_pwm_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_toggle_pwm_3);this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png", -"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.arduino_toggle_pwm=function(a,b){var c=b.getNumberValue("PORT"),d=b.getNumberValue("VALUE"),d=Math.round(d),d=Math.max(d,0),d=Math.min(d,255);Entry.hw.setDigitalPortValue(c,d);return b.callReturn()}; +"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.arduino_toggle_pwm=function(b,a){var c=a.getNumberValue("PORT"),d=a.getNumberValue("VALUE"),d=Math.round(d),d=Math.max(d,0),d=Math.min(d,255);Entry.hw.setDigitalPortValue(c,d);return a.callReturn()}; Blockly.Blocks.arduino_convert_scale={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_1);this.appendValueInput("VALUE1").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_2);this.appendValueInput("VALUE2").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_3);this.appendValueInput("VALUE3").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_4); this.appendValueInput("VALUE4").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_5);this.appendValueInput("VALUE5").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_6);this.appendDummyInput().appendField(" ");this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.arduino_convert_scale=function(a,b){var c=b.getNumberValue("VALUE1",b),d=b.getNumberValue("VALUE2",b),e=b.getNumberValue("VALUE3",b),f=b.getNumberValue("VALUE4",b),g=b.getNumberValue("VALUE5",b);if(d>e)var h=d,d=e,e=h;f>g&&(h=f,f=g,g=h);c-=d;c*=(g-f)/(e-d);c+=f;c=Math.min(g,c);c=Math.max(f,c);return Math.round(c)}; -Blockly.Blocks.sensorBoard_get_named_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["\uc18c\ub9ac","0"],["\ube5b \uac10\uc9c0","1"],["\uc2ac\ub77c\uc774\ub354","2"],["\uc628\ub3c4","3"]]),"PORT").appendField(" \uc13c\uc11c\uac12");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.sensorBoard_get_named_sensor_value=function(a,b){return Entry.hw.getAnalogPortValue(b.getField("PORT",b))}; +Entry.block.arduino_convert_scale=function(b,a){var c=a.getNumberValue("VALUE1",a),d=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a),f=a.getNumberValue("VALUE4",a),g=a.getNumberValue("VALUE5",a);if(d>e)var h=d,d=e,e=h;f>g&&(h=f,f=g,g=h);c-=d;c*=(g-f)/(e-d);c+=f;c=Math.min(g,c);c=Math.max(f,c);return Math.round(c)}; +Blockly.Blocks.sensorBoard_get_named_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["\uc18c\ub9ac","0"],["\ube5b \uac10\uc9c0","1"],["\uc2ac\ub77c\uc774\ub354","2"],["\uc628\ub3c4","3"]]),"PORT").appendField(" \uc13c\uc11c\uac12");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.sensorBoard_get_named_sensor_value=function(b,a){return Entry.hw.getAnalogPortValue(a.getField("PORT",a))}; Blockly.Blocks.sensorBoard_is_button_pressed={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["\ube68\uac04","8"],["\ud30c\ub780","9"],["\ub178\ub780","10"],["\ucd08\ub85d","11"]]),"PORT");this.appendDummyInput().appendField(" \ubc84\ud2bc\uc744 \ub20c\ub800\ub294\uac00?");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}}; -Entry.block.sensorBoard_is_button_pressed=function(a,b){return Entry.hw.getDigitalPortValue(b.getNumberField("PORT",b))}; +Entry.block.sensorBoard_is_button_pressed=function(b,a){return Entry.hw.getDigitalPortValue(a.getNumberField("PORT",a))}; Blockly.Blocks.sensorBoard_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["\ube68\uac04","2"],["\ucd08\ub85d","3"],["\ud30c\ub780","4"],["\ud770\uc0c9","5"]]),"PORT").appendField(" LED").appendField(new Blockly.FieldDropdown([["\ucf1c\uae30","255"],["\ub044\uae30","0"]]),"OPERATOR").appendField(" ").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0); -this.setNextStatement(!0)}};Entry.block.sensorBoard_led=function(a,b){Entry.hw.setDigitalPortValue(b.getField("PORT"),b.getNumberField("OPERATOR"));return b.callReturn()}; +this.setNextStatement(!0)}};Entry.block.sensorBoard_led=function(b,a){Entry.hw.setDigitalPortValue(a.getField("PORT"),a.getNumberField("OPERATOR"));return a.callReturn()}; Blockly.Blocks.CODEino_get_sensor_number={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.CODEino_get_sensor_number_0,"A0"],[Lang.Blocks.CODEino_get_sensor_number_1,"A1"],[Lang.Blocks.CODEino_get_sensor_number_2,"A2"],[Lang.Blocks.CODEino_get_sensor_number_3,"A3"],[Lang.Blocks.CODEino_get_sensor_number_4,"A4"],[Lang.Blocks.CODEino_get_sensor_number_5,"A5"],[Lang.Blocks.CODEino_get_sensor_number_6,"A6"]]),"PORT");this.appendDummyInput().appendField(" "); -this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.CODEino_get_sensor_number=function(a,b){return b.getStringField("PORT")}; +this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.CODEino_get_sensor_number=function(b,a){return a.getStringField("PORT")}; Blockly.Blocks.CODEino_get_named_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(" ").appendField(new Blockly.FieldDropdown([[Lang.Blocks.CODEino_sensor_name_0,"0"],[Lang.Blocks.CODEino_sensor_name_1,"1"],[Lang.Blocks.CODEino_sensor_name_2,"2"],[Lang.Blocks.CODEino_sensor_name_3,"3"],[Lang.Blocks.CODEino_sensor_name_4,"4"],[Lang.Blocks.CODEino_sensor_name_5,"5"],[Lang.Blocks.CODEino_sensor_name_6,"6"]]),"PORT").appendField(Lang.Blocks.CODEino_string_1); -this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.CODEino_get_named_sensor_value=function(a,b){return Entry.hw.getAnalogPortValue(b.getField("PORT",b))}; +this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.CODEino_get_named_sensor_value=function(b,a){return Entry.hw.getAnalogPortValue(a.getField("PORT",a))}; Blockly.Blocks.CODEino_get_sound_status={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.CODEino_string_10).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CODEino_string_11,"GREAT"],[Lang.Blocks.CODEino_string_12,"SMALL"]]),"STATUS").appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}}; -Entry.block.CODEino_get_sound_status=function(a,b){return"GREAT"==b.getField("STATUS",b)?600Entry.hw.getAnalogPortValue(0)?1:0}; +Entry.block.CODEino_get_sound_status=function(b,a){return"GREAT"==a.getField("STATUS",a)?600Entry.hw.getAnalogPortValue(0)?1:0}; Blockly.Blocks.CODEino_get_light_status={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.CODEino_string_13).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CODEino_string_14,"BRIGHT"],[Lang.Blocks.CODEino_string_15,"DARK"]]),"STATUS").appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}}; -Entry.block.CODEino_get_light_status=function(a,b){return"DARK"==b.getField("STATUS",b)?800Entry.hw.getAnalogPortValue(1)?1:0}; +Entry.block.CODEino_get_light_status=function(b,a){return"DARK"==a.getField("STATUS",a)?800Entry.hw.getAnalogPortValue(1)?1:0}; Blockly.Blocks.CODEino_is_button_pressed={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.CODEino_string_2).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CODEino_string_3,"4"],[Lang.Blocks.CODEino_string_4,"17"],[Lang.Blocks.CODEino_string_5,"18"],[Lang.Blocks.CODEino_string_6,"19"],[Lang.Blocks.CODEino_string_7,"20"]]),"PORT").appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}}; -Entry.block.CODEino_is_button_pressed=function(a,b){var c=b.getNumberField("PORT",b);return 14d?1:0;if("RIGHT"==c||"FRONT"==c)return 30d?1:0}; +Entry.block.CODEino_get_accelerometer_direction=function(b,a){var c=a.getField("DIRECTION",a),d=0;"LEFT"==c||"RIGHT"==c?d=3:"FRONT"==c||"REAR"==c?d=4:"REVERSE"==c&&(d=5);d=Entry.hw.getAnalogPortValue(d);d=180/137*(d-265);d+=-90;d=Math.min(90,d);d=Math.max(-90,d);d=Math.round(d);if("LEFT"==c||"REAR"==c)return-30>d?1:0;if("RIGHT"==c||"FRONT"==c)return 30d?1:0}; Blockly.Blocks.CODEino_get_accelerometer_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.CODEino_string_8).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CODEino_accelerometer_X,"3"],[Lang.Blocks.CODEino_accelerometer_Y,"4"],[Lang.Blocks.CODEino_accelerometer_Z,"5"]]),"PORT").appendField(Lang.Blocks.CODEino_string_9);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.CODEino_get_accelerometer_value=function(a,b){var c=265,d=402,e=-90,f=90,g=Entry.hw.getAnalogPortValue(b.getField("PORT",b));if(c>d)var h=c,c=d,d=h;e>f&&(h=e,e=f,f=h);g=(f-e)/(d-c)*(g-c);g+=e;g=Math.min(f,g);g=Math.max(e,g);return Math.round(g)};Entry.Bitbrick={SENSOR_MAP:{1:"light",2:"IR",3:"touch",4:"potentiometer",5:"MIC",21:"UserSensor",11:"USER INPUT",20:"LED",19:"SERVO",18:"DC"},PORT_MAP:{buzzer:2,5:4,6:6,7:8,8:10,LEDR:12,LEDG:14,LEDB:16},sensorList:function(){for(var a=[],b=Entry.hw.portData,c=1;5>c;c++){var d=b[c];d&&(d.value||0===d.value)&&a.push([c+" - "+Lang.Blocks["BITBRICK_"+d.type],c.toString()])}return 0==a.length?[[Lang.Blocks.no_target,"null"]]:a},touchList:function(){for(var a=[],b=Entry.hw.portData,c=1;5>c;c++){var d=b[c]; -d&&"touch"===d.type&&a.push([c.toString(),c.toString()])}return 0==a.length?[[Lang.Blocks.no_target,"null"]]:a},servoList:function(){for(var a=[],b=Entry.hw.portData,c=5;9>c;c++){var d=b[c];d&&"SERVO"===d.type&&a.push(["ABCD"[c-5],c.toString()])}return 0==a.length?[[Lang.Blocks.no_target,"null"]]:a},dcList:function(){for(var a=[],b=Entry.hw.portData,c=5;9>c;c++){var d=b[c];d&&"DC"===d.type&&a.push(["ABCD"[c-5],c.toString()])}return 0==a.length?[[Lang.Blocks.no_target,"null"]]:a},setZero:function(){var a= -Entry.hw.sendQueue,b;for(b in Entry.Bitbrick.PORT_MAP)a[b]=0;Entry.hw.update()},name:"bitbrick",servoMaxValue:181,servoMinValue:1,dcMaxValue:100,dcMinValue:-100,monitorTemplate:{imgPath:"hw/bitbrick.png",width:400,height:400,listPorts:{1:{name:Lang.Hw.port_en+" 1 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},2:{name:Lang.Hw.port_en+" 2 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},3:{name:Lang.Hw.port_en+" 3 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},4:{name:Lang.Hw.port_en+" 4 "+Lang.Hw.port_ko, +Entry.block.CODEino_get_accelerometer_value=function(b,a){var c=265,d=402,e=-90,f=90,g=Entry.hw.getAnalogPortValue(a.getField("PORT",a));if(c>d)var h=c,c=d,d=h;e>f&&(h=e,e=f,f=h);g=(f-e)/(d-c)*(g-c);g+=e;g=Math.min(f,g);g=Math.max(e,g);return Math.round(g)};Entry.Bitbrick={SENSOR_MAP:{1:"light",2:"IR",3:"touch",4:"potentiometer",5:"MIC",21:"UserSensor",11:"USER INPUT",20:"LED",19:"SERVO",18:"DC"},PORT_MAP:{buzzer:2,5:4,6:6,7:8,8:10,LEDR:12,LEDG:14,LEDB:16},sensorList:function(){for(var b=[],a=Entry.hw.portData,c=1;5>c;c++){var d=a[c];d&&(d.value||0===d.value)&&b.push([c+" - "+Lang.Blocks["BITBRICK_"+d.type],c.toString()])}return 0==b.length?[[Lang.Blocks.no_target,"null"]]:b},touchList:function(){for(var b=[],a=Entry.hw.portData,c=1;5>c;c++){var d=a[c]; +d&&"touch"===d.type&&b.push([c.toString(),c.toString()])}return 0==b.length?[[Lang.Blocks.no_target,"null"]]:b},servoList:function(){for(var b=[],a=Entry.hw.portData,c=5;9>c;c++){var d=a[c];d&&"SERVO"===d.type&&b.push(["ABCD"[c-5],c.toString()])}return 0==b.length?[[Lang.Blocks.no_target,"null"]]:b},dcList:function(){for(var b=[],a=Entry.hw.portData,c=5;9>c;c++){var d=a[c];d&&"DC"===d.type&&b.push(["ABCD"[c-5],c.toString()])}return 0==b.length?[[Lang.Blocks.no_target,"null"]]:b},setZero:function(){var b= +Entry.hw.sendQueue,a;for(a in Entry.Bitbrick.PORT_MAP)b[a]=0;Entry.hw.update()},name:"bitbrick",servoMaxValue:181,servoMinValue:1,dcMaxValue:100,dcMinValue:-100,monitorTemplate:{imgPath:"hw/bitbrick.png",width:400,height:400,listPorts:{1:{name:Lang.Hw.port_en+" 1 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},2:{name:Lang.Hw.port_en+" 2 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},3:{name:Lang.Hw.port_en+" 3 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},4:{name:Lang.Hw.port_en+" 4 "+Lang.Hw.port_ko, type:"input",pos:{x:0,y:0}},A:{name:Lang.Hw.port_en+" A "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},B:{name:Lang.Hw.port_en+" B "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},C:{name:Lang.Hw.port_en+" C "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},D:{name:Lang.Hw.port_en+" D "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}}},mode:"both"}}; -Blockly.Blocks.bitbrick_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.sensorList),"PORT").appendField(" \uac12");this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.bitbrick_sensor_value=function(a,b){var c=b.getStringField("PORT");return Entry.hw.portData[c].value}; -Blockly.Blocks.bitbrick_is_touch_pressed={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.BITBRICK_touch).appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.touchList),"PORT").appendField("\uc774(\uac00) \ub20c\ub838\ub294\uac00?");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.bitbrick_is_touch_pressed=function(a,b){return 0===Entry.hw.portData[b.getStringField("PORT")].value}; -Blockly.Blocks.bitbrick_turn_off_color_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uceec\ub7ec LED \ub044\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.bitbrick_turn_off_color_led=function(a,b){Entry.hw.sendQueue.LEDR=0;Entry.hw.sendQueue.LEDG=0;Entry.hw.sendQueue.LEDB=0;return b.callReturn()}; +Blockly.Blocks.bitbrick_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.sensorList),"PORT").appendField(" \uac12");this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.bitbrick_sensor_value=function(b,a){var c=a.getStringField("PORT");return Entry.hw.portData[c].value}; +Blockly.Blocks.bitbrick_is_touch_pressed={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.BITBRICK_touch).appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.touchList),"PORT").appendField("\uc774(\uac00) \ub20c\ub838\ub294\uac00?");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.bitbrick_is_touch_pressed=function(b,a){return 0===Entry.hw.portData[a.getStringField("PORT")].value}; +Blockly.Blocks.bitbrick_turn_off_color_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uceec\ub7ec LED \ub044\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.bitbrick_turn_off_color_led=function(b,a){Entry.hw.sendQueue.LEDR=0;Entry.hw.sendQueue.LEDG=0;Entry.hw.sendQueue.LEDB=0;return a.callReturn()}; Blockly.Blocks.bitbrick_turn_on_color_led_by_rgb={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uceec\ub7ec LED \ucf1c\uae30 R");this.appendValueInput("rValue").setCheck(["Number","String"]);this.appendDummyInput().appendField("G");this.appendValueInput("gValue").setCheck(["Number","String"]);this.appendDummyInput().appendField("B");this.appendValueInput("bValue").setCheck(["Number","String"]);this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.bitbrick_turn_on_color_led_by_rgb=function(a,b){var c=b.getNumberValue("rValue"),d=b.getNumberValue("gValue"),e=b.getNumberValue("bValue"),f=Entry.adjustValueWithMaxMin,g=Entry.hw.sendQueue;g.LEDR=f(c,0,255);g.LEDG=f(d,0,255);g.LEDB=f(e,0,255);return b.callReturn()}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.bitbrick_turn_on_color_led_by_rgb=function(b,a){var c=a.getNumberValue("rValue"),d=a.getNumberValue("gValue"),e=a.getNumberValue("bValue"),f=Entry.adjustValueWithMaxMin,g=Entry.hw.sendQueue;g.LEDR=f(c,0,255);g.LEDG=f(d,0,255);g.LEDB=f(e,0,255);return a.callReturn()}; Blockly.Blocks.bitbrick_turn_on_color_led_by_picker={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uceec\ub7ec LED \uc0c9 ").appendField(new Blockly.FieldColour("#ff0000"),"VALUE").appendField("\ub85c \uc815\ud558\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.bitbrick_turn_on_color_led_by_picker=function(a,b){var c=b.getStringField("VALUE");Entry.hw.sendQueue.LEDR=parseInt(c.substr(1,2),16);Entry.hw.sendQueue.LEDG=parseInt(c.substr(3,2),16);Entry.hw.sendQueue.LEDB=parseInt(c.substr(5,2),16);return b.callReturn()}; +Entry.block.bitbrick_turn_on_color_led_by_picker=function(b,a){var c=a.getStringField("VALUE");Entry.hw.sendQueue.LEDR=parseInt(c.substr(1,2),16);Entry.hw.sendQueue.LEDG=parseInt(c.substr(3,2),16);Entry.hw.sendQueue.LEDB=parseInt(c.substr(5,2),16);return a.callReturn()}; Blockly.Blocks.bitbrick_turn_on_color_led_by_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uceec\ub7ec LED \ucf1c\uae30 \uc0c9");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("\ub85c \uc815\ud558\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.bitbrick_turn_on_color_led_by_value=function(a,b){var c=b.getNumberValue("VALUE"),d,e,f,c=c%200;67>c?(d=200-3*c,e=3*c,f=0):134>c?(c-=67,d=0,e=200-3*c,f=3*c):201>c&&(c-=134,d=3*c,e=0,f=200-3*c);Entry.hw.sendQueue.LEDR=d;Entry.hw.sendQueue.LEDG=e;Entry.hw.sendQueue.LEDB=f;return b.callReturn()}; +Entry.block.bitbrick_turn_on_color_led_by_value=function(b,a){var c=a.getNumberValue("VALUE"),d,e,f,c=c%200;67>c?(d=200-3*c,e=3*c,f=0):134>c?(c-=67,d=0,e=200-3*c,f=3*c):201>c&&(c-=134,d=3*c,e=0,f=200-3*c);Entry.hw.sendQueue.LEDR=d;Entry.hw.sendQueue.LEDG=e;Entry.hw.sendQueue.LEDB=f;return a.callReturn()}; Blockly.Blocks.bitbrick_buzzer={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ubc84\uc800\uc74c ");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("\ub0b4\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.bitbrick_buzzer=function(a,b){if(b.isStart)return Entry.hw.sendQueue.buzzer=0,delete b.isStart,b.callReturn();var c=b.getNumberValue("VALUE");Entry.hw.sendQueue.buzzer=c;b.isStart=!0;return b}; +Entry.block.bitbrick_buzzer=function(b,a){if(a.isStart)return Entry.hw.sendQueue.buzzer=0,delete a.isStart,a.callReturn();var c=a.getNumberValue("VALUE");Entry.hw.sendQueue.buzzer=c;a.isStart=!0;return a}; Blockly.Blocks.bitbrick_turn_off_all_motors={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ubaa8\ub4e0 \ubaa8\ud130 \ub044\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.bitbrick_turn_off_all_motors=function(a,b){var c=Entry.hw.sendQueue,d=Entry.Bitbrick;d.servoList().map(function(b){c[b[1]]=0});d.dcList().map(function(b){c[b[1]]=128});return b.callReturn()}; +Entry.block.bitbrick_turn_off_all_motors=function(b,a){var c=Entry.hw.sendQueue,d=Entry.Bitbrick;d.servoList().map(function(a){c[a[1]]=0});d.dcList().map(function(a){c[a[1]]=128});return a.callReturn()}; Blockly.Blocks.bitbrick_dc_speed={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("DC \ubaa8\ud130").appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.dcList),"PORT").appendField(" \uc18d\ub3c4");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setPreviousStatement(!0);this.setNextStatement(!0);this.setInputsInline(!0)}}; -Entry.block.bitbrick_dc_speed=function(a,b){var c=b.getNumberValue("VALUE"),c=Math.min(c,Entry.Bitbrick.dcMaxValue),c=Math.max(c,Entry.Bitbrick.dcMinValue);Entry.hw.sendQueue[b.getStringField("PORT")]=c+128;return b.callReturn()}; +Entry.block.bitbrick_dc_speed=function(b,a){var c=a.getNumberValue("VALUE"),c=Math.min(c,Entry.Bitbrick.dcMaxValue),c=Math.max(c,Entry.Bitbrick.dcMinValue);Entry.hw.sendQueue[a.getStringField("PORT")]=c+128;return a.callReturn()}; Blockly.Blocks.bitbrick_dc_direction_speed={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("DC \ubaa8\ud130").appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.dcList),"PORT").appendField(" ").appendField(new Blockly.FieldDropdown([[Lang.Blocks.BITBRICK_dc_direction_cw,"CW"],[Lang.Blocks.BITBRICK_dc_direction_ccw,"CCW"]]),"DIRECTION").appendField(" \ubc29\ud5a5").appendField(" \uc18d\ub825");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setPreviousStatement(!0);this.setNextStatement(!0);this.setInputsInline(!0)}};Entry.block.bitbrick_dc_direction_speed=function(a,b){var c="CW"===b.getStringField("DIRECTION"),d=b.getNumberValue("VALUE"),d=Math.min(d,Entry.Bitbrick.dcMaxValue),d=Math.max(d,0);Entry.hw.sendQueue[b.getStringField("PORT")]=c?d+128:128-d;return b.callReturn()}; +"block_icon/hardware_03.png","*"));this.setPreviousStatement(!0);this.setNextStatement(!0);this.setInputsInline(!0)}};Entry.block.bitbrick_dc_direction_speed=function(b,a){var c="CW"===a.getStringField("DIRECTION"),d=a.getNumberValue("VALUE"),d=Math.min(d,Entry.Bitbrick.dcMaxValue),d=Math.max(d,0);Entry.hw.sendQueue[a.getStringField("PORT")]=c?d+128:128-d;return a.callReturn()}; Blockly.Blocks.bitbrick_servomotor_angle={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc11c\ubcf4 \ubaa8\ud130").appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.servoList),"PORT").appendField(" \uac01\ub3c4");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setPreviousStatement(!0);this.setNextStatement(!0); -this.setInputsInline(!0)}};Entry.block.bitbrick_servomotor_angle=function(a,b){var c=b.getNumberValue("VALUE")+1,c=Math.min(c,Entry.Bitbrick.servoMaxValue),c=Math.max(c,Entry.Bitbrick.servoMinValue);Entry.hw.sendQueue[b.getStringField("PORT")]=c;return b.callReturn()}; +this.setInputsInline(!0)}};Entry.block.bitbrick_servomotor_angle=function(b,a){var c=a.getNumberValue("VALUE")+1,c=Math.min(c,Entry.Bitbrick.servoMaxValue),c=Math.max(c,Entry.Bitbrick.servoMinValue);Entry.hw.sendQueue[a.getStringField("PORT")]=c;return a.callReturn()}; Blockly.Blocks.bitbrick_convert_scale={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ubcc0\ud658");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.sensorList),"PORT");this.appendDummyInput().appendField("\uac12");this.appendValueInput("VALUE2").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_3);this.appendValueInput("VALUE3").setCheck(["Number","String",null]); this.appendDummyInput().appendField("\uc5d0\uc11c");this.appendValueInput("VALUE4").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_5);this.appendValueInput("VALUE5").setCheck(["Number","String",null]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.bitbrick_convert_scale=function(a,b){var c=b.getNumberField("PORT"),d=Entry.hw.portData[c].value,c=b.getNumberValue("VALUE2",b),e=b.getNumberValue("VALUE3",b),f=b.getNumberValue("VALUE4",b),g=b.getNumberValue("VALUE5",b);if(f>g)var h=f,f=g,g=h;d-=c;d*=(g-f)/(e-c);d+=f;d=Math.min(g,d);d=Math.max(f,d);return Math.round(d)};var categoryColor="#FF9E20";Blockly.Blocks.start_drawing={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_start_drawing).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.start_drawing=function(a,b){a.brush?a.brush.stop=!1:Entry.setBasicBrush(a);Entry.stage.sortZorder();a.brush.moveTo(a.getX(),-1*a.getY());return b.callReturn()}; -Blockly.Blocks.stop_drawing={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_stop_drawing).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.stop_drawing=function(a,b){a.brush&&a.shape&&(a.brush.stop=!0);return b.callReturn()}; +Entry.block.bitbrick_convert_scale=function(b,a){var c=a.getNumberField("PORT"),d=Entry.hw.portData[c].value,c=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a),f=a.getNumberValue("VALUE4",a),g=a.getNumberValue("VALUE5",a);if(f>g)var h=f,f=g,g=h;d-=c;d*=(g-f)/(e-c);d+=f;d=Math.min(g,d);d=Math.max(f,d);return Math.round(d)};var categoryColor="#FF9E20";Blockly.Blocks.start_drawing={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_start_drawing).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.start_drawing=function(b,a){b.brush?b.brush.stop=!1:Entry.setBasicBrush(b);Entry.stage.sortZorder();b.brush.moveTo(b.getX(),-1*b.getY());return a.callReturn()}; +Blockly.Blocks.stop_drawing={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_stop_drawing).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.stop_drawing=function(b,a){b.brush&&b.shape&&(b.brush.stop=!0);return a.callReturn()}; Blockly.Blocks.set_color={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_color_1);this.appendDummyInput().appendField(new Blockly.FieldColour("#ff0000"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_color_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_color=function(a,b){var c=b.getField("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(c=Entry.hex2rgb(c),a.brush.rgb=c,a.brush.endStroke(),a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}; +Entry.block.set_color=function(b,a){var c=a.getField("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(c=Entry.hex2rgb(c),b.brush.rgb=c,b.brush.endStroke(),b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; Blockly.Blocks.set_random_color={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_random_color).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_random_color=function(a,b){a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);if(a.brush){var c=Entry.generateRgb();a.brush.rgb=c;a.brush.endStroke();a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")");a.brush.moveTo(a.getX(),-1*a.getY())}return b.callReturn()}; +Entry.block.set_random_color=function(b,a){b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);if(b.brush){var c=Entry.generateRgb();b.brush.rgb=c;b.brush.endStroke();b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")");b.brush.moveTo(b.getX(),-1*b.getY())}return a.callReturn()}; Blockly.Blocks.change_thickness={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_change_thickness_1);this.appendValueInput("VALUE").setCheck(["Number","Boolean"]);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_change_thickness_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_thickness=function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(a.brush.thickness+=c,1>a.brush.thickness&&(a.brush.thickness=1),a.brush.setStrokeStyle(a.brush.thickness),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}; +Entry.block.change_thickness=function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.thickness+=c,1>b.brush.thickness&&(b.brush.thickness=1),b.brush.setStrokeStyle(b.brush.thickness),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; Blockly.Blocks.set_thickness={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_thickness_1);this.appendValueInput("VALUE").setCheck(["Number","Boolean"]);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_thickness_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_thickness=function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(a.brush.thickness=c,a.brush.setStrokeStyle(a.brush.thickness),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}; +Entry.block.set_thickness=function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.thickness=c,b.brush.setStrokeStyle(b.brush.thickness),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; Blockly.Blocks.change_opacity={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_change_opacity_1);this.appendValueInput("VALUE").setCheck(["Number","Boolean"]);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_change_opacity_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_opacity=function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);c=Entry.adjustValueWithMaxMin(a.brush.opacity+c,0,100);a.brush&&(a.brush.opacity=c,a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}; +Entry.block.change_opacity=function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);c=Entry.adjustValueWithMaxMin(b.brush.opacity+c,0,100);b.brush&&(b.brush.opacity=c,b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; Blockly.Blocks.set_opacity={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_opacity_1);this.appendValueInput("VALUE").setCheck(["Number","Boolean"]);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_opacity_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_opacity=function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(a.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}; +Entry.block.set_opacity=function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; Blockly.Blocks.brush_erase_all={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_brush_erase_all).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.brush_erase_all=function(a,b){var c=a.brush;if(c){var d=c._stroke.style,e=c._strokeStyle.width;c.clear().setStrokeStyle(e).beginStroke(d);c.moveTo(a.getX(),-1*a.getY())}c=a.parent.getStampEntities();c.map(function(b){b.removeClone()});c=null;return b.callReturn()}; -Blockly.Blocks.brush_stamp={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_stamp).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.brush_stamp=function(a,b){a.parent.addStampEntity(a);return b.callReturn()}; +Entry.block.brush_erase_all=function(b,a){var c=b.brush;if(c){var d=c._stroke.style,e=c._strokeStyle.width;c.clear().setStrokeStyle(e).beginStroke(d);c.moveTo(b.getX(),-1*b.getY())}c=b.parent.getStampEntities();c.map(function(a){a.removeClone()});c=null;return a.callReturn()}; +Blockly.Blocks.brush_stamp={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_stamp).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.brush_stamp=function(b,a){b.parent.addStampEntity(b);return a.callReturn()}; Blockly.Blocks.change_brush_transparency={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_change_brush_transparency_1);this.appendValueInput("VALUE").setCheck(["Number","Boolean"]);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_change_brush_transparency_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_brush_transparency=function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);c=Entry.adjustValueWithMaxMin(a.brush.opacity-c,0,100);a.brush&&(a.brush.opacity=c,a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}; +Entry.block.change_brush_transparency=function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);c=Entry.adjustValueWithMaxMin(b.brush.opacity-c,0,100);b.brush&&(b.brush.opacity=c,b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; Blockly.Blocks.set_brush_tranparency={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_brush_transparency_1);this.appendValueInput("VALUE").setCheck(["Number","Boolean"]);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_brush_transparency_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_brush_tranparency=function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(a.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+(1-a.brush.opacity/100)+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()};var calcArrowColor="#e8b349",calcBlockColor="#FFD974",calcFontColor="#3D3D3D";Blockly.Blocks.number={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(new Blockly.FieldTextInput(""),"NUM");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.number=function(a,b){return b.fields.NUM}; -Blockly.Blocks.angle={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(new Blockly.FieldAngle("90"),"ANGLE");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.angle=function(a,b){return b.getNumberField("ANGLE")};Blockly.Blocks.get_x_coordinate={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_x_coordinate,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.get_x_coordinate=function(a,b){return a.getX()};Blockly.Blocks.get_y_coordinate={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_y_coordinate,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.get_y_coordinate=function(a,b){return a.getY()}; -Blockly.Blocks.get_angle={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_angle,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.get_angle=function(a,b){return parseFloat(a.getRotation().toFixed(1))}; +Entry.block.set_brush_tranparency=function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+(1-b.brush.opacity/100)+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()};var calcArrowColor="#e8b349",calcBlockColor="#FFD974",calcFontColor="#3D3D3D";Blockly.Blocks.number={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(new Blockly.FieldTextInput(""),"NUM");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.number=function(b,a){return a.fields.NUM}; +Blockly.Blocks.angle={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(new Blockly.FieldAngle("90"),"ANGLE");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.angle=function(b,a){return a.getNumberField("ANGLE")};Blockly.Blocks.get_x_coordinate={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_x_coordinate,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; +Entry.block.get_x_coordinate=function(b,a){return b.getX()};Blockly.Blocks.get_y_coordinate={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_y_coordinate,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.get_y_coordinate=function(b,a){return b.getY()}; +Blockly.Blocks.get_angle={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_angle,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.get_angle=function(b,a){return parseFloat(b.getRotation().toFixed(1))}; Blockly.Blocks.get_rotation_direction={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.CALC_rotation_value,"ROTATION"],[Lang.Blocks.CALC_direction_value,"DIRECTION"]],null,!0,calcArrowColor),"OPERATOR");this.appendDummyInput().appendField(" ");this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.get_rotation_direction=function(a,b){return"DIRECTION"==b.getField("OPERATOR",b).toUpperCase()?parseFloat(a.getDirection().toFixed(1)):parseFloat(a.getRotation().toFixed(1))}; +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(a,b){var c=b.getField("VALUE",b);if("mouse"==c)return c=Entry.stage.mouseCoordinate,Math.sqrt(Math.pow(a.getX()-c.x,2)+Math.pow(a.getY()-c.y,2));c=Entry.container.getEntity(c);return Math.sqrt(Math.pow(a.getX()-c.getX(),2)+Math.pow(a.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(a,b){return"x"===b.getField("VALUE",b)?+Entry.stage.mouseCoordinate.x:+Entry.stage.mouseCoordinate.y}; +Entry.block.distance_something=function(b,a){var c=a.getField("VALUE",a);if("mouse"==c)return c=Entry.stage.mouseCoordinate,Math.sqrt(Math.pow(b.getX()-c.x,2)+Math.pow(b.getY()-c.y,2));c=Entry.container.getEntity(c);return Math.sqrt(Math.pow(b.getX()-c.getX(),2)+Math.pow(b.getY()-c.getY(),2))}; +Blockly.Blocks.coordinate_mouse={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_coordinate_mouse_1,calcFontColor).appendField(new Blockly.FieldDropdown([["x","x"],["y","y"]],null,!0,calcArrowColor),"VALUE").appendField(Lang.Blocks.CALC_coordinate_mouse_2,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.coordinate_mouse=function(b,a){return"x"===a.getField("VALUE",a)?+Entry.stage.mouseCoordinate.x:+Entry.stage.mouseCoordinate.y}; Blockly.Blocks.coordinate_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(a,b){var c=b.getField("VALUE",b),c="self"==c?a:Entry.container.getEntity(c);switch(b.getField("COORDINATE",b)){case "x":return c.getX();case "y":return c.getY();case "rotation":return c.getRotation();case "direction":return c.getDirection();case "picture_index":var d=c.parent,d=d.pictures;return d.indexOf(c.picture)+1;case "size":return+c.getSize().toFixed(1);case "picture_name":return d=c.parent,d=d.pictures,d[d.indexOf(c.picture)].name}}; +Entry.block.coordinate_object=function(b,a){var c=a.getField("VALUE",a),c="self"==c?b:Entry.container.getEntity(c);switch(a.getField("COORDINATE",a)){case "x":return c.getX();case "y":return c.getY();case "rotation":return c.getRotation();case "direction":return c.getDirection();case "picture_index":var d=c.parent,d=d.pictures;return d.indexOf(c.picture)+1;case "size":return+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(a,b){var c=b.getField("OPERATOR",b),d=b.getNumberValue("LEFTHAND",b),e=b.getNumberValue("RIGHTHAND",b);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(a,b){var c=b.getNumberValue("LEFTHAND",b),d=b.getNumberValue("RIGHTHAND",b);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)}}; -Entry.block.calc_minus=function(a,b){var c=b.getNumberValue("LEFTHAND",b),d=b.getNumberValue("RIGHTHAND",b);return c-d};Blockly.Blocks.calc_times={init:function(){this.setColour(calcBlockColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("x",calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.calc_times=function(a,b){var c=b.getNumberValue("LEFTHAND",b),d=b.getNumberValue("RIGHTHAND",b);return c*d};Blockly.Blocks.calc_divide={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_divide=function(a,b){var c=b.getNumberValue("LEFTHAND",b),d=b.getNumberValue("RIGHTHAND",b);return c/d}; +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)}}; +Entry.block.calc_minus=function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c-d};Blockly.Blocks.calc_times={init:function(){this.setColour(calcBlockColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("x",calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; +Entry.block.calc_times=function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c*d};Blockly.Blocks.calc_divide={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_divide=function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c/d}; Blockly.Blocks.calc_mod={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_calc_mod_1,calcFontColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_mod_2,calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_mod_3,calcFontColor);this.setInputsInline(!0)}}; -Entry.block.calc_mod=function(a,b){var c=b.getNumberValue("LEFTHAND",b),d=b.getNumberValue("RIGHTHAND",b);return c%d}; +Entry.block.calc_mod=function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c%d}; Blockly.Blocks.calc_share={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_calc_share_1,calcFontColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.CALC_calc_share_2,calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_share_3,calcFontColor);this.setInputsInline(!0)}}; -Entry.block.calc_share=function(a,b){var c=b.getNumberValue("LEFTHAND",b),d=b.getNumberValue("RIGHTHAND",b);return Math.floor(c/d)}; +Entry.block.calc_share=function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return Math.floor(c/d)}; Blockly.Blocks.calc_operation={init:function(){this.setColour(calcBlockColor);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_operation_of_1,calcFontColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_operation_of_2,calcFontColor);this.appendDummyInput("VALUE").appendField(new Blockly.FieldDropdown([[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"]],null,!0,calcArrowColor),"VALUE");this.setOutput(!0,"Number");this.appendDummyInput().appendField(" ");this.setInputsInline(!0)}}; -Entry.block.calc_operation=function(a,b){var c=b.getNumberValue("LEFTHAND",b),d=b.getField("VALUE",b);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.block.calc_operation=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}; Blockly.Blocks.calc_rand={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_calc_rand_1,calcFontColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_rand_2,calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_rand_3,calcFontColor);this.setInputsInline(!0)}}; -Entry.block.calc_rand=function(a,b){var c=b.getStringValue("LEFTHAND",b),d=b.getStringValue("RIGHTHAND",b),e=Math.min(c,d),f=Math.max(c,d),c=Entry.isFloat(c);return Entry.isFloat(d)||c?(Math.random()*(f-e)+e).toFixed(2):Math.floor(Math.random()*(f-e+1)+e)}; +Entry.block.calc_rand=function(b,a){var c=a.getStringValue("LEFTHAND",a),d=a.getStringValue("RIGHTHAND",a),e=Math.min(c,d),f=Math.max(c,d),c=Entry.isFloat(c);return Entry.isFloat(d)||c?(Math.random()*(f-e)+e).toFixed(2):Math.floor(Math.random()*(f-e+1)+e)}; Blockly.Blocks.get_date={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_date_1,calcFontColor).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CALC_get_date_year,"YEAR"],[Lang.Blocks.CALC_get_date_month,"MONTH"],[Lang.Blocks.CALC_get_date_day,"DAY"],[Lang.Blocks.CALC_get_date_hour,"HOUR"],[Lang.Blocks.CALC_get_date_minute,"MINUTE"],[Lang.Blocks.CALC_get_date_second,"SECOND"]],null,!0,calcArrowColor),"VALUE");this.appendDummyInput().appendField(" ").appendField(Lang.Blocks.CALC_get_date_2, -calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.get_date=function(a,b){var c=b.getField("VALUE",b),d=new Date;return"YEAR"==c?d.getFullYear():"MONTH"==c?d.getMonth()+1:"DAY"==c?d.getDate():"HOUR"==c?d.getHours():"MINUTE"==c?d.getMinutes():d.getSeconds()}; +calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.get_date=function(b,a){var c=a.getField("VALUE",a),d=new Date;return"YEAR"==c?d.getFullYear():"MONTH"==c?d.getMonth()+1:"DAY"==c?d.getDate():"HOUR"==c?d.getHours():"MINUTE"==c?d.getMinutes():d.getSeconds()}; Blockly.Blocks.get_sound_duration={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_sound_duration_1,calcFontColor);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("sounds",null,!0,calcArrowColor),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.CALC_get_sound_duration_2,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.get_sound_duration=function(a,b){for(var c=b.getField("VALUE",b),d=a.parent.sounds,e=0;ed||d>c.length-1)throw Error();return c[d]}; -Blockly.Blocks.length_of_string={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_length_of_string_1,calcFontColor);this.appendValueInput("STRING").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_length_of_string_2,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.length_of_string=function(a,b){return b.getStringValue("STRING",b).length}; +Entry.block.char_at=function(b,a){var c=a.getStringValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a)-1;if(0>d||d>c.length-1)throw Error();return c[d]}; +Blockly.Blocks.length_of_string={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_length_of_string_1,calcFontColor);this.appendValueInput("STRING").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_length_of_string_2,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.length_of_string=function(b,a){return a.getStringValue("STRING",a).length}; Blockly.Blocks.substring={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_substring_1,calcFontColor);this.appendValueInput("STRING").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_substring_2,calcFontColor);this.appendValueInput("START").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_substring_3,calcFontColor);this.appendValueInput("END").setCheck(["Number","String"]); -this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_substring_4,calcFontColor);this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.substring=function(a,b){var c=b.getStringValue("STRING",b),d=b.getNumberValue("START",b)-1,e=b.getNumberValue("END",b)-1,f=c.length-1;if(0>d||0>e||d>f||e>f)throw Error();return c.substring(Math.min(d,e),Math.max(d,e)+1)}; +this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_substring_4,calcFontColor);this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.substring=function(b,a){var c=a.getStringValue("STRING",a),d=a.getNumberValue("START",a)-1,e=a.getNumberValue("END",a)-1,f=c.length-1;if(0>d||0>e||d>f||e>f)throw Error();return c.substring(Math.min(d,e),Math.max(d,e)+1)}; Blockly.Blocks.replace_string={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_replace_string_1,calcFontColor);this.appendValueInput("STRING").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_replace_string_2,calcFontColor);this.appendValueInput("OLD_WORD").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_replace_string_3,calcFontColor);this.appendValueInput("NEW_WORD").setCheck(["Number", -"String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_replace_string_4,calcFontColor);this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.replace_string=function(a,b){return b.getStringValue("STRING",b).replace(new RegExp(b.getStringValue("OLD_WORD",b),"gm"),b.getStringValue("NEW_WORD",b))}; +"String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_replace_string_4,calcFontColor);this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.replace_string=function(b,a){return a.getStringValue("STRING",a).replace(new RegExp(a.getStringValue("OLD_WORD",a),"gm"),a.getStringValue("NEW_WORD",a))}; Blockly.Blocks.change_string_case={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_change_string_case_1,calcFontColor);this.appendValueInput("STRING").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.CALC_change_string_case_2,calcFontColor);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.CALC_change_string_case_sub_1,"toUpperCase"],[Lang.Blocks.CALC_change_string_case_sub_2,"toLowerCase"]], -null,!0,calcArrowColor),"CASE");this.appendDummyInput().appendField(Lang.Blocks.CALC_change_string_case_3,calcFontColor);this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.change_string_case=function(a,b){return b.getStringValue("STRING",b)[b.getField("CASE",b)]()}; +null,!0,calcArrowColor),"CASE");this.appendDummyInput().appendField(Lang.Blocks.CALC_change_string_case_3,calcFontColor);this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.change_string_case=function(b,a){return a.getStringValue("STRING",a)[a.getField("CASE",a)]()}; Blockly.Blocks.index_of_string={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_index_of_string_1,calcFontColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_index_of_string_2,calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_index_of_string_3,calcFontColor); -this.setInputsInline(!0)}};Entry.block.index_of_string=function(a,b){var c=b.getStringValue("LEFTHAND",b),d=b.getStringValue("RIGHTHAND",b),c=c.indexOf(d);return-1=d?d=0:720<=d&&(d=720);var e=a.getStringField("DIRECTION",a);Entry.hw.sendQueue[c]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Degrees,degree:d,power:"CW"==e?50:-50};return a.callReturn()};Blockly.Blocks.wait_second={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_wait_second_1);this.appendValueInput("SECOND").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.FLOW_wait_second_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; +Entry.block.wait_second=function(b,a){if(a.isStart){if(1==a.timeFlag)return a;delete a.timeFlag;delete a.isStart;Entry.engine.isContinue=!1;return a.callReturn()}a.isStart=!0;a.timeFlag=1;var c=a.getNumberValue("SECOND",a),c=60/(Entry.FPS||60)*c*1E3;setTimeout(function(){a.timeFlag=0},c);return a}; Blockly.Blocks.repeat_basic={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_basic_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_basic_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.appendStatementInput("DO");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.repeat_basic=function(a,b){var c;if(!b.isLooped){b.isLooped=!0;c=b.getNumberValue("VALUE",b);if(0>c)throw Error(Lang.Blocks.FLOW_repeat_basic_errorMsg);b.iterCount=Math.floor(c)}if(0==b.iterCount||0>b.iterCount)return delete b.isLooped,delete b.iterCount,b.callReturn();b.iterCount--;return b.getStatement("DO",b)}; -Blockly.Blocks.repeat_inf={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_inf).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.appendStatementInput("DO");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.repeat_inf=function(a,b){b.isLooped=!0;return b.getStatement("DO")}; +Entry.block.repeat_basic=function(b,a){var c;if(!a.isLooped){a.isLooped=!0;c=a.getNumberValue("VALUE",a);if(0>c)throw Error(Lang.Blocks.FLOW_repeat_basic_errorMsg);a.iterCount=Math.floor(c)}if(0==a.iterCount||0>a.iterCount)return delete a.isLooped,delete a.iterCount,a.callReturn();a.iterCount--;return a.getStatement("DO",a)}; +Blockly.Blocks.repeat_inf={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_inf).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.appendStatementInput("DO");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.repeat_inf=function(b,a){a.isLooped=!0;return a.getStatement("DO")}; Blockly.Blocks.stop_repeat={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_stop_repeat).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.stop_repeat=function(a,b){for(var c=b;"REPEAT"!=c.type.substr(0,6).toUpperCase()&&c.parentScript;)c=c.parentScript,delete c.isLooped,delete c.iterCount;var d=c.callReturn();return c.statements&&d?d:c?null:b.callReturn()}; +Entry.block.stop_repeat=function(b,a){for(var c=a;"REPEAT"!=c.type.substr(0,6).toUpperCase()&&c.parentScript;)c=c.parentScript,delete c.isLooped,delete c.iterCount;var d=c.callReturn();return c.statements&&d?d:c?null:a.callReturn()}; Blockly.Blocks.wait_until_true={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_wait_until_true_1);this.appendValueInput("BOOL").setCheck("Boolean");this.appendDummyInput().appendField(Lang.Blocks.FLOW_wait_until_true_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.wait_until_true=function(a,b){return b.getBooleanValue("BOOL",b)?b.callReturn():b}; +Entry.block.wait_until_true=function(b,a){return a.getBooleanValue("BOOL",a)?a.callReturn():a}; Blockly.Blocks._if={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW__if_1);this.appendValueInput("BOOL").setCheck("Boolean");this.appendDummyInput().appendField(Lang.Blocks.FLOW__if_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.appendStatementInput("STACK");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block._if=function(a,b){return b.isLooped?(delete b.isLooped,b.callReturn()):b.getBooleanValue("BOOL",b)?(b.isLooped=!0,b.getStatement("STACK",b)):b.callReturn()}; +Entry.block._if=function(b,a){return a.isLooped?(delete a.isLooped,a.callReturn()):a.getBooleanValue("BOOL",a)?(a.isLooped=!0,a.getStatement("STACK",a)):a.callReturn()}; Blockly.Blocks.if_else={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_if_else_1);this.appendValueInput("BOOL").setCheck("Boolean");this.appendDummyInput().appendField(Lang.Blocks.FLOW_if_else_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.appendStatementInput("STACK_IF");this.appendDummyInput().appendField(Lang.Blocks.FLOW_if_else_3);this.appendStatementInput("STACK_ELSE");this.setInputsInline(!0);this.setPreviousStatement(!0); -this.setNextStatement(!0)}};Entry.block.if_else=function(a,b){if(b.isLooped)return delete b.isLooped,b.callReturn();var c=b.getBooleanValue("BOOL",b);b.isLooped=!0;return c?b.getStatement("STACK_IF",b):b.getStatement("STACK_ELSE",b)}; +this.setNextStatement(!0)}};Entry.block.if_else=function(b,a){if(a.isLooped)return delete a.isLooped,a.callReturn();var c=a.getBooleanValue("BOOL",a);a.isLooped=!0;return c?a.getStatement("STACK_IF",a):a.getStatement("STACK_ELSE",a)}; Blockly.Blocks.create_clone={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_create_clone_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("clone"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.FLOW_create_clone_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.create_clone=function(a,b){var c=b.getField("VALUE",b),d=b.callReturn();"self"==c?a.parent.addCloneEntity(a.parent,a,null):Entry.container.getObject(c).addCloneEntity(a.parent,null,null);return d};Blockly.Blocks.delete_clone={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_delete_clone).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0)}}; -Entry.block.delete_clone=function(a,b){if(!a.isClone)return b.callReturn();a.removeClone()};Blockly.Blocks.when_clone_start={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_clone.png","*","start")).appendField(Lang.Blocks.FLOW_when_clone_start);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_clone_start=function(a,b){return b.callReturn()}; -Blockly.Blocks.stop_run={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_stop_run).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.stop_run=function(a,b){return Entry.engine.toggleStop()}; +Entry.block.create_clone=function(b,a){var c=a.getField("VALUE",a),d=a.callReturn();"self"==c?b.parent.addCloneEntity(b.parent,b,null):Entry.container.getObject(c).addCloneEntity(b.parent,null,null);return d};Blockly.Blocks.delete_clone={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_delete_clone).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0)}}; +Entry.block.delete_clone=function(b,a){if(!b.isClone)return a.callReturn();b.removeClone()};Blockly.Blocks.when_clone_start={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_clone.png","*","start")).appendField(Lang.Blocks.FLOW_when_clone_start);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_clone_start=function(b,a){return a.callReturn()}; +Blockly.Blocks.stop_run={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_stop_run).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.stop_run=function(b,a){return Entry.engine.toggleStop()}; Blockly.Blocks.repeat_while_true={init:function(){this.setColour("#498deb");"ko"==Lang.type?(this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_while_true_1),this.appendValueInput("BOOL").setCheck("Boolean"),this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.FLOW_repeat_while_true_until,"until"],[Lang.Blocks.FLOW_repeat_while_true_while,"while"]]),"OPTION").appendField(Lang.Blocks.FLOW_repeat_while_true_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png", "*"))):(this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_while_true_1),this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.FLOW_repeat_while_true_until,"until"],[Lang.Blocks.FLOW_repeat_while_true_while,"while"]]),"OPTION"),this.appendValueInput("BOOL").setCheck("Boolean"),this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_while_true_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*")));this.appendStatementInput("DO"); -this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.repeat_while_true=function(a,b){var c=b.getBooleanValue("BOOL",b);"until"==b.getField("OPTION",b)&&(c=!c);return(b.isLooped=c)?b.getStatement("DO",b):b.callReturn()}; +this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.repeat_while_true=function(b,a){var c=a.getBooleanValue("BOOL",a);"until"==a.getField("OPTION",a)&&(c=!c);return(a.isLooped=c)?a.getStatement("DO",a):a.callReturn()}; Blockly.Blocks.stop_object={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_stop_object_1);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.FLOW_stop_object_all,"all"],[Lang.Blocks.FLOW_stop_object_this_object,"thisOnly"],[Lang.Blocks.FLOW_stop_object_this_thread,"thisThread"],[Lang.Blocks.FLOW_stop_object_other_thread,"otherThread"]]),"TARGET");this.appendDummyInput().appendField(Lang.Blocks.FLOW_stop_object_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ "block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.stop_object=function(a,b){var c=b.getField("TARGET",b),d=Entry.container;switch(c){case "all":d.mapEntityIncludeCloneOnScene(function(b){b.clearScript()});break;case "thisObject":a.clearScript();c=a.parent.clonedEntities;c.map(function(b){b.clearScript()});break;case "thisOnly":a.clearScript();break;case "otherThread":return a.clearScript(),c=a.parent.clonedEntities,c.map(function(b){b.clearScript()}),b.callReturn()}return null}; -Blockly.Blocks.restart_project={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_restart).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0)}};Entry.block.restart_project=function(a,b){Entry.engine.toggleStop();Entry.engine.toggleRun()}; -Blockly.Blocks.remove_all_clones={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_delete_clone_all).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.remove_all_clones=function(a,b){var c=a.parent.getClonedEntities();c.map(function(b){b.removeClone()});c=null;return b.callReturn()};Blockly.Blocks.function_field_label={init:function(){this.setColour("#f9c535");this.appendDummyInput().appendField(new Blockly.FieldTextInput(Lang.Blocks.FUNCTION_explanation_1),"NAME");this.appendValueInput("NEXT").setCheck(["Param"]);this.setOutput(!0,"Param");this.setInputsInline(!0)}};Blockly.Blocks.function_field_string={init:function(){this.setColour("#FFD974");this.appendValueInput("PARAM").setCheck(["String"]);this.appendValueInput("NEXT").setCheck(["Param"]);this.setOutput(!0,"Param");this.setInputsInline(!0)}}; +Entry.block.stop_object=function(b,a){var c=a.getField("TARGET",a),d=Entry.container;switch(c){case "all":d.mapEntityIncludeCloneOnScene(function(a){a.clearScript()});break;case "thisObject":b.clearScript();c=b.parent.clonedEntities;c.map(function(a){a.clearScript()});break;case "thisOnly":b.clearScript();break;case "otherThread":return b.clearScript(),c=b.parent.clonedEntities,c.map(function(a){a.clearScript()}),a.callReturn()}return null}; +Blockly.Blocks.restart_project={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_restart).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0)}};Entry.block.restart_project=function(b,a){Entry.engine.toggleStop();Entry.engine.toggleRun()}; +Blockly.Blocks.remove_all_clones={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_delete_clone_all).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.remove_all_clones=function(b,a){var c=b.parent.getClonedEntities();c.map(function(a){a.removeClone()});c=null;return a.callReturn()};Blockly.Blocks.function_field_label={init:function(){this.setColour("#f9c535");this.appendDummyInput().appendField(new Blockly.FieldTextInput(Lang.Blocks.FUNCTION_explanation_1),"NAME");this.appendValueInput("NEXT").setCheck(["Param"]);this.setOutput(!0,"Param");this.setInputsInline(!0)}};Blockly.Blocks.function_field_string={init:function(){this.setColour("#FFD974");this.appendValueInput("PARAM").setCheck(["String"]);this.appendValueInput("NEXT").setCheck(["Param"]);this.setOutput(!0,"Param");this.setInputsInline(!0)}}; Blockly.Blocks.function_field_boolean={init:function(){this.setColour("#AEB8FF");this.appendValueInput("PARAM").setCheck(["Boolean"]);this.appendValueInput("NEXT").setCheck(["Param"]);this.setOutput(!0,"Param");this.setInputsInline(!0)}}; -Blockly.Blocks.function_param_string={init:function(){this.setEditable(!1);this.setColour("#FFD974");this.setOutput(!0,["String","Number"]);this.setInputsInline(!0)},domToMutation:function(a){a.getElementsByTagName("field");this.hashId=a.getAttribute("hashid");(a=Entry.Func.targetFunc.stringHash[this.hashId])||(a="");this.appendDummyInput().appendField(new Blockly.FieldTextInput(Lang.Blocks.FUNCTION_character_variable+a),"")},mutationToDom:function(){var a=document.createElement("mutation");a.setAttribute("hashid", -this.hashId);return a}};Entry.block.function_param_string=function(a,b,c){return b.register[b.hashId].run()}; -Blockly.Blocks.function_param_boolean={init:function(){this.setEditable(!1);this.setColour("#AEB8FF");this.setOutput(!0,"Boolean");this.setInputsInline(!0)},domToMutation:function(a){a.getElementsByTagName("field");this.hashId=a.getAttribute("hashid");(a=Entry.Func.targetFunc.booleanHash[this.hashId])||(a="");this.appendDummyInput().appendField(new Blockly.FieldTextInput(Lang.Blocks.FUNCTION_logical_variable+a),"")},mutationToDom:function(){var a=document.createElement("mutation");a.setAttribute("hashid", -this.hashId);return a}};Entry.block.function_param_boolean=function(a,b,c){return b.register[b.hashId].run()};Blockly.Blocks.function_create={init:function(){this.appendDummyInput().appendField(Lang.Blocks.FUNCTION_define);this.setColour("#cc7337");this.appendValueInput("FIELD").setCheck(["Param"]);this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/function_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0)}}; -Entry.block.function_create=function(a,b){return b.callReturn()}; -Blockly.Blocks.function_general={init:function(){this.setColour("#cc7337");this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)},domToMutation:function(a){var b=a.getElementsByTagName("field");this.appendDummyInput().appendField("");b.length||this.appendDummyInput().appendField(Lang.Blocks.FUNCTION_function);for(var c=0;cb.count?(50>d.leftFloor&&50>d.rightFloor?b.count++:b.count=0,d=d.leftFloor-d.rightFloor,c.leftWheel=45+.25*d,c.rightWheel=45-.25*d):(b.count=0,b.boardState=2);break;case 2:d=d.leftFloor-d.rightFloor;c.leftWheel=45+.25*d;c.rightWheel=45-.25*d;b.boardState=3;var e=setTimeout(function(){b.boardState=4;Entry.Hamster.removeTimeout(e)},250);Entry.Hamster.timeouts.push(e); -break;case 3:d=d.leftFloor-d.rightFloor;c.leftWheel=45+.25*d;c.rightWheel=45-.25*d;break;case 4:c.leftWheel=0,c.rightWheel=0,b.boardState=0,b.isMoving=!1}return b}delete b.isStart;delete b.isMoving;delete b.count;delete b.boardState;Entry.engine.isContinue=!1;c.leftWheel=0;c.rightWheel=0;return b.callReturn()}b.isStart=!0;b.isMoving=!0;b.count=0;b.boardState=1;c.leftWheel=45;c.rightWheel=45;Entry.Hamster.setLineTracerMode(c,0);return b}; +Entry.block.hamster_move_forward_once=function(b,a){var c=Entry.hw.sendQueue,d=Entry.hw.portData;if(a.isStart){if(a.isMoving){switch(a.boardState){case 1:2>a.count?(50>d.leftFloor&&50>d.rightFloor?a.count++:a.count=0,d=d.leftFloor-d.rightFloor,c.leftWheel=45+.25*d,c.rightWheel=45-.25*d):(a.count=0,a.boardState=2);break;case 2:d=d.leftFloor-d.rightFloor;c.leftWheel=45+.25*d;c.rightWheel=45-.25*d;a.boardState=3;var e=setTimeout(function(){a.boardState=4;Entry.Hamster.removeTimeout(e)},250);Entry.Hamster.timeouts.push(e); +break;case 3:d=d.leftFloor-d.rightFloor;c.leftWheel=45+.25*d;c.rightWheel=45-.25*d;break;case 4:c.leftWheel=0,c.rightWheel=0,a.boardState=0,a.isMoving=!1}return a}delete a.isStart;delete a.isMoving;delete a.count;delete a.boardState;Entry.engine.isContinue=!1;c.leftWheel=0;c.rightWheel=0;return a.callReturn()}a.isStart=!0;a.isMoving=!0;a.count=0;a.boardState=1;c.leftWheel=45;c.rightWheel=45;Entry.Hamster.setLineTracerMode(c,0);return a}; Blockly.Blocks.hamster_turn_once={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_turn_once_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"]]),"DIRECTION").appendField(Lang.Blocks.HAMSTER_turn_once_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.hamster_turn_once=function(a,b){var c=Entry.hw.sendQueue,d=Entry.hw.portData;if(b.isStart){if(b.isMoving){if(b.isLeft)switch(b.boardState){case 1:2>b.count?50d.leftFloor&&(b.boardState=3);break;case 3:2>b.count?20>d.leftFloor&&b.count++:(b.count=0,b.boardState=4);break;case 4:50b.count?50d.rightFloor&&(b.boardState=3);break;case 3:2>b.count?20>d.rightFloor&&b.count++:(b.count=0,b.boardState=4);break;case 4:50a.count?50d.leftFloor&&(a.boardState=3);break;case 3:2>a.count?20>d.leftFloor&&a.count++:(a.count=0,a.boardState=4);break;case 4:50a.count?50d.rightFloor&&(a.boardState=3);break;case 3:2>a.count?20>d.rightFloor&&a.count++:(a.count=0,a.boardState=4);break;case 4:50Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return b.callReturn()}; +Entry.block.hamster_change_tempo_by=function(b,a){Entry.Hamster.tempo+=a.getNumberValue("VALUE");1>Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return a.callReturn()}; 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(a,b){Entry.Hamster.tempo=b.getNumberValue("VALUE");1>Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return b.callReturn()}; +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(a,b){var c=Entry.hw.sendQueue,d=b.getField("PORT",b),e=+b.getField("MODE",b);"A"==d?c.ioModeA=e:("B"!=d&&(c.ioModeA=e),c.ioModeB=e);return b.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(a,b){var c=Entry.hw.sendQueue,d=b.getField("PORT"),e=b.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 b.callReturn()}; +"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(a,b){var c=Entry.hw.sendQueue,d=b.getField("PORT"),e=b.getNumberValue("VALUE");"A"==d?c.outputA=e:("B"!=d&&(c.outputA=e),c.outputB=e);return b.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(a,b){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(a,b){var c=+b.getField("VALUE",b);return 0<=Entry.engine.pressedKeys.indexOf(c)}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_set_output_to=function(b,a){var c=Entry.hw.sendQueue,d=a.getField("PORT"),e=a.getNumberValue("VALUE");"A"==d?c.outputA=e:("B"!=d&&(c.outputA=e),c.outputB=e);return a.callReturn()};Blockly.Blocks.is_clicked={init:function(){this.setColour("#AEB8FF");this.appendDummyInput().appendField(Lang.Blocks.JUDGEMENT_is_clicked,"#3D3D3D");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.is_clicked=function(b,a){return Entry.stage.isClick}; +Blockly.Blocks.is_press_some_key={init:function(){this.setColour("#AEB8FF");this.appendDummyInput().appendField(Lang.Blocks.JUDGEMENT_is_press_some_key_1,"#3D3D3D");this.appendDummyInput().appendField(new Blockly.FieldKeydownInput("81"),"VALUE").appendField(Lang.Blocks.JUDGEMENT_is_press_some_key_2,"#3D3D3D");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.is_press_some_key=function(b,a){var c=+a.getField("VALUE",a);return 0<=Entry.engine.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(a,b){if(!a.getVisible())return!1;var c=b.getField("VALUE",b),d=a.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"==a.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"]]),"OPERATOR");this.appendValueInput("RIGHTHAND").setCheck(["String","Number"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; -Entry.block.boolean_comparison=function(a,b){var c=b.getField("OPERATOR",b),d=b.getNumberValue("LEFTHAND",b),e=b.getNumberValue("RIGHTHAND",b);return"EQUAL"==c?d==e:"BIGGER"==c?d>e:d","#3D3D3D");this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; -Entry.block.boolean_bigger=function(a,b){var c=b.getNumberValue("LEFTHAND",b),d=b.getNumberValue("RIGHTHAND",b);return c>d};Blockly.Blocks.boolean_smaller={init:function(){this.setColour("#AEB8FF");this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("<","#3D3D3D");this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; -Entry.block.boolean_smaller=function(a,b){var c=b.getNumberValue("LEFTHAND",b),d=b.getNumberValue("RIGHTHAND",b);return ce:d","#3D3D3D");this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; +Entry.block.boolean_bigger=function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c>d};Blockly.Blocks.boolean_smaller={init:function(){this.setColour("#AEB8FF");this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("<","#3D3D3D");this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; +Entry.block.boolean_smaller=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"]],null,!1),"OPERATOR");this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; -Entry.block.boolean_basic_operator=function(a,b){var c=b.getField("OPERATOR",b),d=b.getStringValue("LEFTHAND",b),e=b.getStringValue("RIGHTHAND",b);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(a,b){a.setVisible(!0);return b.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(a,b){a.setVisible(!1);return b.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)}}; -Entry.block.dialog_time=function(a,b){if(!b.isStart){var c=b.getNumberValue("SECOND",b),d=b.getStringValue("VALUE",b),e=b.getField("OPTION",b);b.isStart=!0;b.timeFlag=1;d||"number"==typeof d||(d=" ");d=Entry.convertToRoundedDecimals(d,3);new Entry.Dialog(a,d,e);a.syncDialogVisible(a.getVisible());setTimeout(function(){b.timeFlag=0},1E3*c)}return 0==b.timeFlag?(delete b.timeFlag,delete b.isStart,a.dialog&&a.dialog.remove(),b.callReturn()):b}; +Entry.block.dialog_time=function(b,a){if(!a.isStart){var c=a.getNumberValue("SECOND",a),d=a.getStringValue("VALUE",a),e=a.getField("OPTION",a);a.isStart=!0;a.timeFlag=1;d||"number"==typeof d||(d=" ");d=Entry.convertToRoundedDecimals(d,3);new Entry.Dialog(b,d,e);b.syncDialogVisible(b.getVisible());setTimeout(function(){a.timeFlag=0},1E3*c)}return 0==a.timeFlag?(delete a.timeFlag,delete a.isStart,b.dialog&&b.dialog.remove(),a.callReturn()):a}; Blockly.Blocks.dialog={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_1);this.appendValueInput("VALUE").setCheck(["String","Number",null]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_2);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.speak,"speak"]]),"OPTION");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png", -"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dialog=function(a,b){var c=b.getStringValue("VALUE",b);c||"number"==typeof c||(c=" ");var d=b.getField("OPTION",b),c=Entry.convertToRoundedDecimals(c,3);new Entry.Dialog(a,c,d);a.syncDialogVisible(a.getVisible());return b.callReturn()}; -Blockly.Blocks.remove_dialog={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_remove_dialog).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.remove_dialog=function(a,b){a.dialog&&a.dialog.remove();return b.callReturn()}; +"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dialog=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()}; +Blockly.Blocks.remove_dialog={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_remove_dialog).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.remove_dialog=function(b,a){b.dialog&&b.dialog.remove();return a.callReturn()}; Blockly.Blocks.change_to_nth_shape={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_to_nth_shape_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("pictures"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_to_nth_shape_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_to_nth_shape=function(a,b){var c=b.getField("VALUE",b),c=a.parent.getPicture(c);a.setImage(c);return b.callReturn()}; +Entry.block.change_to_nth_shape=function(b,a){var c=a.getField("VALUE",a),c=b.parent.getPicture(c);b.setImage(c);return a.callReturn()}; Blockly.Blocks.change_to_next_shape={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_to_near_shape_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.LOOKS_change_shape_next,"next"],[Lang.Blocks.LOOKS_change_shape_prev,"prev"]]),"DRIECTION").appendField(Lang.Blocks.LOOKS_change_to_near_shape_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_to_next_shape=function(a,b){var c;c=b.fields&&"prev"===b.getStringField("DRIECTION")?a.parent.getPrevPicture(a.picture.id):a.parent.getNextPicture(a.picture.id);a.setImage(c);return b.callReturn()}; +Entry.block.change_to_next_shape=function(b,a){var c;c=a.fields&&"prev"===a.getStringField("DRIECTION")?b.parent.getPrevPicture(b.picture.id):b.parent.getNextPicture(b.picture.id);b.setImage(c);return a.callReturn()}; Blockly.Blocks.set_effect_volume={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_effect_volume_1);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity,"opacity"]]),"EFFECT");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_effect_volume_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_effect_volume_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.set_effect_volume=function(a,b){var c=b.getField("EFFECT",b),d=b.getNumberValue("VALUE",b);"color"==c?a.effect.hue=d+a.effect.hue:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?a.effect.brightness=d+a.effect.brightness:"blur"!=c&&"opacity"==c&&(a.effect.alpha+=d/100));a.applyFilter();return b.callReturn()}; +"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.set_effect_volume=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()}; Blockly.Blocks.set_effect={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_effect_1);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity,"opacity"]]),"EFFECT");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_effect_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_effect_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.set_effect=function(a,b){var c=b.getField("EFFECT",b),d=b.getNumberValue("VALUE",b);"color"==c?a.effect.hue=d:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?a.effect.brightness=d:"blur"!=c&&"opacity"==c&&(a.effect.alpha=d/100));a.applyFilter();return b.callReturn()}; -Blockly.Blocks.erase_all_effects={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_erase_all_effects).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.erase_all_effects=function(a,b){a.resetFilter();return b.callReturn()}; +"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.set_effect=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()}; +Blockly.Blocks.erase_all_effects={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_erase_all_effects).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.erase_all_effects=function(b,a){b.resetFilter();return a.callReturn()}; Blockly.Blocks.change_scale_percent={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_scale_percent_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_scale_percent_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_scale_percent=function(a,b){var c=(b.getNumberValue("VALUE",b)+100)/100;a.setScaleX(a.getScaleX()*c);a.setScaleY(a.getScaleY()*c);return b.callReturn()}; +Entry.block.change_scale_percent=function(b,a){var c=(a.getNumberValue("VALUE",a)+100)/100;b.setScaleX(b.getScaleX()*c);b.setScaleY(b.getScaleY()*c);return a.callReturn()}; Blockly.Blocks.set_scale_percent={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_scale_percent_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_scale_percent_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_scale_percent=function(a,b){var c=b.getNumberValue("VALUE",b)/100,d=a.snapshot_;a.setScaleX(c*d.scaleX);a.setScaleY(c*d.scaleY);return b.callReturn()}; +Entry.block.set_scale_percent=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()}; Blockly.Blocks.change_scale_size={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_scale_percent_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_scale_percent_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_scale_size=function(a,b){var c=b.getNumberValue("VALUE",b);a.setSize(a.getSize()+c);return b.callReturn()}; +Entry.block.change_scale_size=function(b,a){var c=a.getNumberValue("VALUE",a);b.setSize(b.getSize()+c);return a.callReturn()}; Blockly.Blocks.set_scale_size={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_scale_percent_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_scale_percent_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_scale_size=function(a,b){var c=b.getNumberValue("VALUE",b);a.setSize(c);return b.callReturn()};Blockly.Blocks.flip_y={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_flip_y).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_y=function(a,b){a.setScaleX(-1*a.getScaleX());return b.callReturn()}; -Blockly.Blocks.flip_x={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_flip_x).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_x=function(a,b){a.setScaleY(-1*a.getScaleY());return b.callReturn()}; +Entry.block.set_scale_size=function(b,a){var c=a.getNumberValue("VALUE",a);b.setSize(c);return a.callReturn()};Blockly.Blocks.flip_y={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_flip_y).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_y=function(b,a){b.setScaleX(-1*b.getScaleX());return a.callReturn()}; +Blockly.Blocks.flip_x={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_flip_x).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_x=function(b,a){b.setScaleY(-1*b.getScaleY());return a.callReturn()}; Blockly.Blocks.set_object_order={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_object_order_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("objectSequence"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_object_order_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_object_order=function(a,b){var c=b.getField("VALUE",b),d=Entry.container.getCurrentObjects().indexOf(a.parent);if(-1f)throw Error("object is not available for current scene");switch(d){case "FRONT":c=0;break;case "FORWARD":c=Math.max(0,f-1);break;case "BACKWARD":c=Math.min(e,f+1);break;case "BACK":c=e}Entry.container.moveElementByBlock(f,c);return b.callReturn()};Blockly.Blocks.move_direction={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.move_direction=function(a,b){var c=b.getNumberValue("VALUE",b);a.setX(a.getX()+c*Math.cos((a.getRotation()+a.getDirection()-90)/180*Math.PI));a.setY(a.getY()-c*Math.sin((a.getRotation()+a.getDirection()-90)/180*Math.PI));a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}; +"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.change_object_index=function(b,a){var c,d=a.getField("LOCATION",a),e=Entry.container.getCurrentObjects(),f=e.indexOf(b.parent),e=e.length-1;if(0>f)throw Error("object is not available for current scene");switch(d){case "FRONT":c=0;break;case "FORWARD":c=Math.max(0,f-1);break;case "BACKWARD":c=Math.min(e,f+1);break;case "BACK":c=e}Entry.container.moveElementByBlock(f,c);return a.callReturn()};Blockly.Blocks.move_direction={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; +Entry.block.move_direction=function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(b.getX()+c*Math.cos((b.getRotation()+b.getDirection()-90)/180*Math.PI));b.setY(b.getY()-c*Math.sin((b.getRotation()+b.getDirection()-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; Blockly.Blocks.move_x={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_x_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_x_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.move_x=function(a,b){var c=b.getNumberValue("VALUE",b);a.setX(a.getX()+c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}; +Entry.block.move_x=function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(b.getX()+c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; Blockly.Blocks.move_y={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_y_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_y_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.move_y=function(a,b){var c=b.getNumberValue("VALUE",b);a.setY(a.getY()+c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}; +Entry.block.move_y=function(b,a){var c=a.getNumberValue("VALUE",a);b.setY(b.getY()+c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; Blockly.Blocks.locate_xy_time={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_xy_time_1);this.appendValueInput("VALUE1").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_xy_time_2);this.appendValueInput("VALUE2").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_xy_time_3);this.appendValueInput("VALUE3").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_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.locate_xy_time=function(a,b){if(!b.isStart){var c;c=b.getNumberValue("VALUE1",b);b.isStart=!0;b.frameCount=Math.floor(c*Entry.FPS);b.x=b.getNumberValue("VALUE2",b);b.y=b.getNumberValue("VALUE3",b)}if(0!=b.frameCount){c=b.x-a.getX();var d=b.y-a.getY();c/=b.frameCount;d/=b.frameCount;a.setX(a.getX()+c);a.setY(a.getY()+d);b.frameCount--;a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b}delete b.isStart;delete b.frameCount;return b.callReturn()}; +Entry.block.locate_xy_time=function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE1",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.x=a.getNumberValue("VALUE2",a);a.y=a.getNumberValue("VALUE3",a)}if(0!=a.frameCount){c=a.x-b.getX();var d=a.y-b.getY();c/=a.frameCount;d/=a.frameCount;b.setX(b.getX()+c);b.setY(b.getY()+d);a.frameCount--;b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a}delete a.isStart;delete a.frameCount;return a.callReturn()}; 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(a,b){var c=b.getNumberValue("VALUE",b);a.setRotation(a.getRotation()+c);return b.callReturn()}; +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(a,b){var c=b.getField("VALUE",b);a.setRotation(a.getRotation()+ +c);return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setDirection(c);return b.callReturn()}; +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)}}; -Entry.block.see_direction=function(a,b){var c=b.getField("VALUE",b),d=Entry.container.getEntity(c),c=d.getX()-a.getX(),d=d.getY()-a.getY();0<=c?a.setRotation(Math.atan(d/c)/Math.PI*180+90):a.setRotation(Math.atan(d/c)/Math.PI*180+270);return b.callReturn()}; +Entry.block.see_direction=function(b,a){var c=a.getField("VALUE",a),d=Entry.container.getEntity(c),c=d.getX()-b.getX(),d=d.getY()-b.getY();0<=c?b.setRotation(Math.atan(d/c)/Math.PI*180+90):b.setRotation(Math.atan(d/c)/Math.PI*180+270);return a.callReturn()}; Blockly.Blocks.locate_xy={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_xy_1);this.appendValueInput("VALUE1").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_xy_2);this.appendValueInput("VALUE2").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_xy_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0); -this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.locate_xy=function(a,b){var c=b.getNumberValue("VALUE1",b);a.setX(c);c=b.getNumberValue("VALUE2",b);a.setY(c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}; +this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.locate_xy=function(b,a){var c=a.getNumberValue("VALUE1",a);b.setX(c);c=a.getNumberValue("VALUE2",a);b.setY(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; Blockly.Blocks.locate_x={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_x_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_x_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.locate_x=function(a,b){var c=b.getNumberValue("VALUE",b);a.setX(c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}; +Entry.block.locate_x=function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; 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(a,b){var c=b.getNumberValue("VALUE",b);a.setY(c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}; +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(a,b){var c=b.getField("VALUE",b),d;"mouse"==c?(c=Entry.stage.mouseCoordinate.x,d=Entry.stage.mouseCoordinate.y):(d=Entry.container.getEntity(c),c=d.getX(),d=d.getY());a.setX(+c);a.setY(+d);a.brush&&!a.brush.stop&&a.brush.lineTo(c,-1*d);return b.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(a,b){if(!b.isStart){var c;c=b.getNumberValue("VALUE1",b);var d=b.getNumberValue("VALUE2",b),e=b.getNumberValue("VALUE3",b);b.isStart=!0;b.frameCount=Math.floor(c*Entry.FPS);b.dX=d/b.frameCount;b.dY=e/b.frameCount}if(0!=b.frameCount)return a.setX(a.getX()+b.dX),a.setY(a.getY()+b.dY),b.frameCount--,a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY()),b;delete b.isStart;delete b.frameCount;return b.callReturn()}; +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()}; Blockly.Blocks.locate_time={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_time_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_time_2);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("sprites"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_time_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png", "*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Blockly.Blocks.rotate_by_angle_time={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_time_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_time_2);this.appendDummyInput().appendField(new Blockly.FieldAngle("90"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_time_3).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_time=function(a,b){if(!b.isStart){var c;c=b.getNumberValue("VALUE",b);var d=b.getNumberField("VALUE",b);b.isStart=!0;b.frameCount=Math.floor(c*Entry.FPS);b.dAngle=d/b.frameCount}if(0!=b.frameCount)return a.setRotation(a.getRotation()+b.dAngle),b.frameCount--,b;delete b.isStart;delete b.frameCount;return b.callReturn()}; +"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.rotate_by_angle_time=function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE",a);var d=a.getNumberField("VALUE",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dAngle=d/a.frameCount}if(0!=a.frameCount)return b.setRotation(b.getRotation()+a.dAngle),a.frameCount--,a;delete a.isStart;delete a.frameCount;return a.callReturn()}; Blockly.Blocks.bounce_when={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_bounce_when_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("bounce"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.MOVING_bounce_when_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setPreviousStatement(!0);this.setInputsInline(!0);this.setNextStatement(!0)}}; Blockly.Blocks.bounce_wall={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_bounce_wall).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.bounce_wall=function(a,b){var c=a.parent.getRotateMethod(),d="free"==c?(a.getRotation()+a.getDirection()).mod(360):a.getDirection(),e=Entry.Utils.COLLISION.NONE;if(90>d&&0<=d||360>d&&270<=d){var e=a.collision==Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,a.object,0,!1);!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE);f&&e&&(f=!1);f?("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+180),a.collision=Entry.Utils.COLLISION.UP): -(e=a.collision==Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,a.object,0,!1),!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+180),a.collision=Entry.Utils.COLLISION.DOWN))}else 270>d&&90<=d&&(e=a.collision==Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,a.object,0,!1),!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f= -!1),f?("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+180),a.collision=Entry.Utils.COLLISION.DOWN):(e=a.collision==Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,a.object,0,!1),!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+180),a.collision=Entry.Utils.COLLISION.UP)));360>d&&180<=d?(e=a.collision==Entry.Utils.COLLISION.LEFT, -d=ndgmr.checkPixelCollision(Entry.stage.wall.left,a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()):a.setDirection(-a.getDirection()+360),a.collision=Entry.Utils.COLLISION.LEFT):(e=a.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()): -a.setDirection(-a.getDirection()+360),a.collision=Entry.Utils.COLLISION.RIGHT))):180>d&&0<=d&&(e=a.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()):a.setDirection(-a.getDirection()+360),a.collision=Entry.Utils.COLLISION.RIGHT):(e=a.collision==Entry.Utils.COLLISION.LEFT,d=ndgmr.checkPixelCollision(Entry.stage.wall.left, -a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()):a.setDirection(-a.getDirection()+360),a.collision=Entry.Utils.COLLISION.LEFT)));return b.callReturn()}; -Blockly.Blocks.flip_arrow_horizontal={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_flip_arrow_horizontal).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_arrow_horizontal=function(a,b){a.setDirection(a.getDirection()+180);return b.callReturn()}; -Blockly.Blocks.flip_arrow_vertical={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_flip_arrow_vertical).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_arrow_vertical=function(a,b){a.setDirection(a.getDirection()+180);return b.callReturn()}; +Entry.block.bounce_wall=function(b,a){var c=b.parent.getRotateMethod(),d="free"==c?(b.getRotation()+b.getDirection()).mod(360):b.getDirection(),e=Entry.Utils.COLLISION.NONE;if(90>d&&0<=d||360>d&&270<=d){var e=b.collision==Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,b.object,0,!1);!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE);f&&e&&(f=!1);f?("free"==c?b.setRotation(-b.getRotation()-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&&e&&(f=!1),f&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN))}else 270>d&&90<=d&&(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&&e&&(f= +!1),f?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN):(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)));360>d&&180<=d?(e=b.collision==Entry.Utils.COLLISION.LEFT, +d=ndgmr.checkPixelCollision(Entry.stage.wall.left,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.LEFT):(e=b.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()): +b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.RIGHT))):180>d&&0<=d&&(e=b.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.RIGHT):(e=b.collision==Entry.Utils.COLLISION.LEFT,d=ndgmr.checkPixelCollision(Entry.stage.wall.left, +b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.LEFT)));return a.callReturn()}; +Blockly.Blocks.flip_arrow_horizontal={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_flip_arrow_horizontal).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_arrow_horizontal=function(b,a){b.setDirection(b.getDirection()+180);return a.callReturn()}; +Blockly.Blocks.flip_arrow_vertical={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_flip_arrow_vertical).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_arrow_vertical=function(b,a){b.setDirection(b.getDirection()+180);return a.callReturn()}; Blockly.Blocks.see_angle_object={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_object_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("spritesWithMouse"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_object_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_object=function(a,b){var c=b.getField("VALUE",b),d=a.getX(),e=a.getY();if(a.parent.id==c)return b.callReturn();"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?a.getDirection()+a.getRotation():0<=d?-Math.atan(e/d)/Math.PI*180+90:-Math.atan(e/d)/Math.PI*180+270;d=a.getDirection()+a.getRotation();a.setRotation(a.getRotation()+e-d);return b.callReturn()}; +Entry.block.see_angle_object=function(b,a){var c=a.getField("VALUE",a),d=b.getX(),e=b.getY();if(b.parent.id==c)return a.callReturn();"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()}; Blockly.Blocks.see_angle_direction={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_direction_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_direction_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_direction=function(a,b){var c=b.getNumberValue("VALUE",b),d=a.getDirection()+a.getRotation();a.setRotation(a.getRotation()+c-d);return b.callReturn()}; +Entry.block.see_angle_direction=function(b,a){var c=a.getNumberValue("VALUE",a),d=b.getDirection()+b.getRotation();b.setRotation(b.getRotation()+c-d);return a.callReturn()}; Blockly.Blocks.rotate_direction={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_direction_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_direction_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.rotate_direction=function(a,b){var c=b.getNumberValue("VALUE",b);a.setDirection(c+a.getDirection());return b.callReturn()}; +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(a,b){if(!b.isStart){var c,d,e;d=b.getField("TARGET",b);c=b.getNumberValue("VALUE",b);c=Math.floor(c*Entry.FPS);e=Entry.stage.mouseCoordinate;if(0!=c)"mouse"==d?(d=e.x-a.getX(),e=e.y-a.getY()):(e=Entry.container.getEntity(d),d=e.getX()-a.getX(),e=e.getY()-a.getY()),b.isStart=!0,b.frameCount=c,b.dX=d/b.frameCount,b.dY=e/b.frameCount;else return"mouse"==d?(d=+e.x,e=+e.y):(e=Entry.container.getEntity(d),d=e.getX(),e=e.getY()),a.setX(d),a.setY(e),a.brush&&!a.brush.stop&& -a.brush.lineTo(a.getX(),-1*a.getY()),b.callReturn()}if(0!=b.frameCount)return a.setX(a.getX()+b.dX),a.setY(a.getY()+b.dY),b.frameCount--,a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY()),b;delete b.isStart;delete b.frameCount;return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setRotation(c);return b.callReturn()}; +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)}}; -Entry.block.rotate_relative=function(a,b){var c=b.getNumberValue("VALUE",b);a.setRotation(c+a.getRotation());return b.callReturn()}; +Entry.block.rotate_relative=function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c+b.getRotation());return a.callReturn()}; Blockly.Blocks.direction_absolute={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.direction_absolute=function(a,b){var c=b.getNumberValue("VALUE",b);a.setDirection(c);return b.callReturn()}; +Entry.block.direction_absolute=function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}; Blockly.Blocks.direction_relative={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_direction_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_direction_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.direction_relative=function(a,b){var c=b.getNumberValue("VALUE",b);a.setDirection(c+a.getDirection());return b.callReturn()}; +Entry.block.direction_relative=function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c+b.getDirection());return a.callReturn()}; Blockly.Blocks.move_to_angle={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_angle_1);this.appendValueInput("ANGLE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_angle_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_angle_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png", -"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.move_to_angle=function(a,b){var c=b.getNumberValue("VALUE",b),d=b.getNumberValue("ANGLE",b);a.setX(a.getX()+c*Math.cos((d-90)/180*Math.PI));a.setY(a.getY()-c*Math.sin((d-90)/180*Math.PI));a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}; +"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.move_to_angle=function(b,a){var c=a.getNumberValue("VALUE",a),d=a.getNumberValue("ANGLE",a);b.setX(b.getX()+c*Math.cos((d-90)/180*Math.PI));b.setY(b.getY()-c*Math.sin((d-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; Blockly.Blocks.rotate_by_time={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_add_direction_by_angle_time_explain_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_add_direction_by_angle_time_2);this.appendDummyInput().appendField(Lang.Blocks.MOVING_add_direction_by_angle_time_1);this.appendValueInput("ANGLE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_add_direction_by_angle_time_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.rotate_by_time=function(a,b){if(!b.isStart){var c;c=b.getNumberValue("VALUE",b);var d=b.getNumberValue("ANGLE",b);b.isStart=!0;b.frameCount=Math.floor(c*Entry.FPS);b.dAngle=d/b.frameCount}if(0!=b.frameCount)return a.setRotation(a.getRotation()+b.dAngle),b.frameCount--,b;delete b.isStart;delete b.frameCount;return b.callReturn()}; +"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.rotate_by_time=function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE",a);var d=a.getNumberValue("ANGLE",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dAngle=d/a.frameCount}if(0!=a.frameCount)return b.setRotation(b.getRotation()+a.dAngle),a.frameCount--,a;delete a.isStart;delete a.frameCount;return a.callReturn()}; Blockly.Blocks.direction_relative_duration={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_direction_relative_duration_1);this.appendValueInput("DURATION").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_direction_relative_duration_2);this.appendValueInput("AMOUNT").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_direction_relative_duration_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.direction_relative_duration=function(a,b){if(!b.isStart){var c;c=b.getNumberValue("DURATION",b);var d=b.getNumberValue("AMOUNT",b);b.isStart=!0;b.frameCount=Math.floor(c*Entry.FPS);b.dDirection=d/b.frameCount}if(0!=b.frameCount)return a.setDirection(a.getDirection()+b.dDirection),b.frameCount--,b;delete b.isStart;delete b.frameCount;delete b.dDirection;return b.callReturn()};Entry.Neobot={name:"neobot",PORT_MAP:{1:0,2:0,3:0,SERVO1:0,SERVO2:0,SERVO1_SPEED:3,SERVO2_SPEED:3,LMOT:0,RMOT:0,note:0,octave:0,duration:0,sound_check:0,O_1:0,O_2:0},setZero:function(){for(var a in Entry.Neobot.PORT_MAP)Entry.hw.sendQueue[a]=Entry.Neobot.PORT_MAP[a];Entry.hw.update()},name:"neobot",monitorTemplate:{imgPath:"hw/neobot.png",width:268,height:270,ports:{1:{name:Lang.Hw.port_en+" 1 "+Lang.Hw.port_ko,type:"input",pos:{x:78,y:9}},2:{name:Lang.Hw.port_en+" 2 "+Lang.Hw.port_ko,type:"input", +"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.direction_relative_duration=function(b,a){if(!a.isStart){var c;c=a.getNumberValue("DURATION",a);var d=a.getNumberValue("AMOUNT",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dDirection=d/a.frameCount}if(0!=a.frameCount)return b.setDirection(b.getDirection()+a.dDirection),a.frameCount--,a;delete a.isStart;delete a.frameCount;delete a.dDirection;return a.callReturn()};Entry.Neobot={name:"neobot",PORT_MAP:{1:0,2:0,3:0,SERVO1:0,SERVO2:0,SERVO1_SPEED:3,SERVO2_SPEED:3,LMOT:0,RMOT:0,note:0,octave:0,duration:0,sound_check:0,O_1:0,O_2:0},setZero:function(){for(var b in Entry.Neobot.PORT_MAP)Entry.hw.sendQueue[b]=Entry.Neobot.PORT_MAP[b];Entry.hw.update()},name:"neobot",monitorTemplate:{imgPath:"hw/neobot.png",width:268,height:270,ports:{1:{name:Lang.Hw.port_en+" 1 "+Lang.Hw.port_ko,type:"input",pos:{x:78,y:9}},2:{name:Lang.Hw.port_en+" 2 "+Lang.Hw.port_ko,type:"input", pos:{x:115,y:9}},3:{name:Lang.Hw.port_en+" 3 "+Lang.Hw.port_ko,type:"input",pos:{x:153,y:9}},LMOT:{name:Lang.Hw.left+" "+Lang.Hw.motor,type:"output",pos:{x:78,y:259}},RMOT:{name:Lang.Hw.right+" "+Lang.Hw.motor,type:"output",pos:{x:191,y:259}},note:{name:Lang.Hw.buzzer,type:"output",pos:{x:98,y:184}},SERVO1:{name:Lang.Hw.sub+" "+Lang.Hw.motor+" 1",type:"output",pos:{x:115,y:259}},SERVO2:{name:Lang.Hw.sub+" "+Lang.Hw.motor+" 2",type:"output",pos:{x:191,y:9}}}}}; -Blockly.Blocks.neobot_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["1\ubc88 \ud3ec\ud2b8","1"],["2\ubc88 \ud3ec\ud2b8","2"],["3\ubc88 \ud3ec\ud2b8","3"],["\ub9ac\ubaa8\ucee8","4"]]),"PORT").appendField(" \uac12");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.neobot_sensor_value=function(a,b){var c=b.getStringField("PORT");return Entry.hw.portData[c]}; +Blockly.Blocks.neobot_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["1\ubc88 \ud3ec\ud2b8","1"],["2\ubc88 \ud3ec\ud2b8","2"],["3\ubc88 \ud3ec\ud2b8","3"],["\ub9ac\ubaa8\ucee8","4"]]),"PORT").appendField(" \uac12");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.neobot_sensor_value=function(b,a){var c=a.getStringField("PORT");return Entry.hw.portData[c]}; Blockly.Blocks.neobot_turn_left={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc67c\ucabd\ubaa8\ud130\ub97c").appendField(new Blockly.FieldDropdown([["\uc55e\uc73c\ub85c","1"],["\ub4a4\ub85c","-1"]]),"DIRECTION").appendField(new Blockly.FieldDropdown([["\ub290\ub9ac\uac8c","1"],["\ubcf4\ud1b5","2"],["\ube60\ub974\uac8c","3"]]),"VALUE").appendField("\ud68c\uc804").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0); -this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_turn_left=function(a,b){var c=b.getNumberField("VALUE"),d=b.getNumberField("DIRECTION");Entry.hw.sendQueue.LMOT=c*d;return b.callReturn()}; -Blockly.Blocks.neobot_stop_left={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc67c\ucabd\ubaa8\ud130 \uc815\uc9c0").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_stop_left=function(a,b){Entry.hw.sendQueue.LMOT=0;return b.callReturn()}; +this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_turn_left=function(b,a){var c=a.getNumberField("VALUE"),d=a.getNumberField("DIRECTION");Entry.hw.sendQueue.LMOT=c*d;return a.callReturn()}; +Blockly.Blocks.neobot_stop_left={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc67c\ucabd\ubaa8\ud130 \uc815\uc9c0").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_stop_left=function(b,a){Entry.hw.sendQueue.LMOT=0;return a.callReturn()}; Blockly.Blocks.neobot_turn_right={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc624\ub978\ucabd\ubaa8\ud130\ub97c").appendField(new Blockly.FieldDropdown([["\uc55e\uc73c\ub85c","1"],["\ub4a4\ub85c","-1"]]),"DIRECTION").appendField(new Blockly.FieldDropdown([["\ub290\ub9ac\uac8c","1"],["\ubcf4\ud1b5","2"],["\ube60\ub974\uac8c","3"]]),"VALUE").appendField("\ud68c\uc804").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0); -this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_turn_right=function(a,b){var c=b.getNumberField("VALUE"),d=b.getNumberField("DIRECTION");Entry.hw.sendQueue.RMOT=c*d;return b.callReturn()}; -Blockly.Blocks.neobot_stop_right={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc624\ub978\ucabd\ubaa8\ud130 \uc815\uc9c0").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_stop_right=function(a,b){Entry.hw.sendQueue.RMOT=0;return b.callReturn()}; +this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_turn_right=function(b,a){var c=a.getNumberField("VALUE"),d=a.getNumberField("DIRECTION");Entry.hw.sendQueue.RMOT=c*d;return a.callReturn()}; +Blockly.Blocks.neobot_stop_right={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc624\ub978\ucabd\ubaa8\ud130 \uc815\uc9c0").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_stop_right=function(b,a){Entry.hw.sendQueue.RMOT=0;return a.callReturn()}; Blockly.Blocks.neobot_run_motor={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["\uc591\ucabd","1"],["\uc67c\ucabd","2"],["\uc624\ub978\ucabd","3"]]),"TYPE").appendField("\ubaa8\ud130\ub97c ");this.appendValueInput("DURATION").setCheck(["Number","String"]);this.appendDummyInput().appendField("\ucd08\uac04").appendField(new Blockly.FieldDropdown([["\ub290\ub9ac\uac8c","1"],["\ubcf4\ud1b5","2"],["\ube60\ub974\uac8c","3"]]),"VALUE").appendField(new Blockly.FieldDropdown([["\uc804\uc9c4", "1"],["\ud6c4\uc9c4","2"],["\uc88c\ud68c\uc804","3"],["\uc6b0\ud68c\uc804","4"]]),"DIRECTION").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.neobot_run_motor=function(a,b){if(b.isStart){if(1==b.timeFlag){var c=b.getNumberField("TYPE"),d=b.getNumberField("VALUE");switch(b.getNumberField("DIRECTION")){case 1:Entry.hw.sendQueue.LMOT=d;Entry.hw.sendQueue.RMOT=d;break;case 2:Entry.hw.sendQueue.LMOT=-1*d;Entry.hw.sendQueue.RMOT=-1*d;break;case 3:Entry.hw.sendQueue.LMOT=d;Entry.hw.sendQueue.RMOT=-1*d;break;case 4:Entry.hw.sendQueue.LMOT=-1*d,Entry.hw.sendQueue.RMOT=d}2===c?Entry.hw.sendQueue.RMOT=0:3===c&&(Entry.hw.sendQueue.LMOT= -0);return b}delete b.timeFlag;delete b.isStart;Entry.engine.isContinue=!1;Entry.hw.sendQueue.LMOT=0;Entry.hw.sendQueue.RMOT=0;return b.callReturn()}b.isStart=!0;b.timeFlag=1;c=1E3*b.getNumberValue("DURATION");setTimeout(function(){b.timeFlag=0},c);return b}; +Entry.block.neobot_run_motor=function(b,a){if(a.isStart){if(1==a.timeFlag){var c=a.getNumberField("TYPE"),d=a.getNumberField("VALUE");switch(a.getNumberField("DIRECTION")){case 1:Entry.hw.sendQueue.LMOT=d;Entry.hw.sendQueue.RMOT=d;break;case 2:Entry.hw.sendQueue.LMOT=-1*d;Entry.hw.sendQueue.RMOT=-1*d;break;case 3:Entry.hw.sendQueue.LMOT=d;Entry.hw.sendQueue.RMOT=-1*d;break;case 4:Entry.hw.sendQueue.LMOT=-1*d,Entry.hw.sendQueue.RMOT=d}2===c?Entry.hw.sendQueue.RMOT=0:3===c&&(Entry.hw.sendQueue.LMOT= +0);return a}delete a.timeFlag;delete a.isStart;Entry.engine.isContinue=!1;Entry.hw.sendQueue.LMOT=0;Entry.hw.sendQueue.RMOT=0;return a.callReturn()}a.isStart=!0;a.timeFlag=1;c=1E3*a.getNumberValue("DURATION");setTimeout(function(){a.timeFlag=0},c);return a}; Blockly.Blocks.neobot_servo_1={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("SERVO1\uc5d0 \uc5f0\uacb0\ub41c \uc11c\ubcf4\ubaa8\ud130\ub97c").appendField(new Blockly.FieldDropdown([["\ube60\ub978","3"],["\ubcf4\ud1b5","2"],["\ub290\ub9b0","1"]]),"SPEED").appendField("\uc18d\ub3c4\ub85c").appendField(new Blockly.FieldDropdown([["0\ub3c4","0"],["10\ub3c4","1"],["20\ub3c4","2"],["30\ub3c4","3"],["40\ub3c4","4"],["50\ub3c4","5"],["60\ub3c4","6"],["70\ub3c4","7"],["80\ub3c4", "8"],["90\ub3c4","9"],["100\ub3c4","10"],["110\ub3c4","11"],["120\ub3c4","12"],["130\ub3c4","13"],["140\ub3c4","14"],["150\ub3c4","15"],["160\ub3c4","16"]]),"VALUE").appendField("\ub85c \uc774\ub3d9").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.neobot_servo_1=function(a,b){var c=b.getNumberField("VALUE"),d=b.getNumberField("SPEED");Entry.hw.sendQueue.SERVO1=c;Entry.hw.sendQueue.SERVO1_SPEED=d;return b.callReturn()}; +Entry.block.neobot_servo_1=function(b,a){var c=a.getNumberField("VALUE"),d=a.getNumberField("SPEED");Entry.hw.sendQueue.SERVO1=c;Entry.hw.sendQueue.SERVO1_SPEED=d;return a.callReturn()}; Blockly.Blocks.neobot_servo_2={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("SERVO2\uc5d0 \uc5f0\uacb0\ub41c \uc11c\ubcf4\ubaa8\ud130\ub97c").appendField(new Blockly.FieldDropdown([["\ube60\ub978","3"],["\ubcf4\ud1b5","2"],["\ub290\ub9b0","1"]]),"SPEED").appendField("\uc18d\ub3c4\ub85c").appendField(new Blockly.FieldDropdown([["0\ub3c4","0"],["10\ub3c4","1"],["20\ub3c4","2"],["30\ub3c4","3"],["40\ub3c4","4"],["50\ub3c4","5"],["60\ub3c4","6"],["70\ub3c4","7"],["80\ub3c4", "8"],["90\ub3c4","9"],["100\ub3c4","10"],["110\ub3c4","11"],["120\ub3c4","12"],["130\ub3c4","13"],["140\ub3c4","14"],["150\ub3c4","15"],["160\ub3c4","16"]]),"VALUE").appendField("\ub85c \uc774\ub3d9").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.neobot_servo_2=function(a,b){var c=b.getNumberField("VALUE"),d=b.getNumberField("SPEED");Entry.hw.sendQueue.SERVO2=c;Entry.hw.sendQueue.SERVO2_SPEED=d;return b.callReturn()}; +Entry.block.neobot_servo_2=function(b,a){var c=a.getNumberField("VALUE"),d=a.getNumberField("SPEED");Entry.hw.sendQueue.SERVO2=c;Entry.hw.sendQueue.SERVO2_SPEED=d;return a.callReturn()}; Blockly.Blocks.neobot_play_note_for={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uba5c\ub85c\ub514").appendField(new Blockly.FieldDropdown([[Lang.General.note_c+"","1"],[Lang.General.note_d+"","2"],[Lang.General.note_e+"","3"],[Lang.General.note_f+"","4"],[Lang.General.note_g+"","5"],[Lang.General.note_a+"","6"],[Lang.General.note_b+"","7"],[Lang.General.note_c+"","8"]]),"NOTE").appendField("\uc744(\ub97c)").appendField(new Blockly.FieldDropdown([["1","0"],["2", "1"],["3","2"]]),"OCTAVE").appendField("\uc625\ud0c0\ube0c\ub85c").appendField(new Blockly.FieldDropdown([["2\ubd84\uc74c\ud45c","2"],["4\ubd84\uc74c\ud45c","4"],["8\ubd84\uc74c\ud45c","8"]]),"DURATION");this.appendDummyInput().appendField("\uae38\uc774\ub9cc\ud07c \uc18c\ub9ac\ub0b4\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.neobot_play_note_for=function(a,b){var c=Entry.hw.sendQueue;if(b.isStart){if(1==b.timeFlag)return b;delete b.timeFlag;delete b.isStart;Entry.engine.isContinue=!1;return b.callReturn()}var d=b.getNumberField("NOTE",b),e=b.getNumberField("OCTAVE",b),f=b.getNumberField("DURATION",b);b.note=d;b.isStart=!0;b.timeFlag=1;c.note=d;c.octave=e;c.duration=f;c.sound_check=(1E5*Math.random()).toFixed(0);setTimeout(function(){b.timeFlag=0},1/f*2E3);return b}; +Entry.block.neobot_play_note_for=function(b,a){var c=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return a;delete a.timeFlag;delete a.isStart;Entry.engine.isContinue=!1;return a.callReturn()}var d=a.getNumberField("NOTE",a),e=a.getNumberField("OCTAVE",a),f=a.getNumberField("DURATION",a);a.note=d;a.isStart=!0;a.timeFlag=1;c.note=d;c.octave=e;c.duration=f;c.sound_check=(1E5*Math.random()).toFixed(0);setTimeout(function(){a.timeFlag=0},1/f*2E3);return a}; Blockly.Blocks.neobot_set_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1","O_1"],["2","O_2"]]),"PORT").appendField("\ubc88 \ud3ec\ud2b8\uc758 \uac12\uc744").appendField(new Blockly.FieldDropdown([["\ucf1c\uae30","1"],["\ub044\uae30","0"]]),"VALUE");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.neobot_set_sensor_value=function(a,b){var c=Entry.hw.sendQueue,d=b.getStringField("PORT",b),e=b.getNumberField("VALUE",b);c[d]=e;return b.callReturn()};Entry.Robotis_carCont={INSTRUCTION:{NONE:0,WRITE:3,READ:2},CONTROL_TABLE:{CM_LED:[67,1],CM_SPRING_RIGHT:[69,1,69,2],CM_SPRING_LEFT:[70,1,69,2],CM_SWITCH:[71,1],CM_SOUND_DETECTED:[86,1],CM_SOUND_DETECTING:[87,1],CM_IR_LEFT:[91,2,91,4],CM_IR_RIGHT:[93,2,91,4],CM_CALIBRATION_LEFT:[95,2],CM_CALIBRATION_RIGHT:[97,2],AUX_MOTOR_SPEED_LEFT:[152,2],AUX_MOTOR_SPEED_RIGHT:[154,2]},setZero:function(){this.setRobotisData([[Entry.Robotis_carCont.INSTRUCTION.WRITE,152,2,0],[Entry.Robotis_carCont.INSTRUCTION.WRITE, -154,2,0]]);Entry.hw.sendQueue.setZero=[1];this.update();this.setRobotisData(null);Entry.hw.sendQueue.setZero=null;this.update()},name:"robotis_carCont",delay:40,postCallReturn:function(a,b,c){if(0>=c)return this.setRobotisData(b),this.update(),a.callReturn();if(a.isStart){if(1==a.timeFlag)return this.setRobotisData(null),a;delete a.timeFlag;delete a.isStart;Entry.engine.isContinue=!1;this.update();return a.callReturn()}a.isStart=!0;a.timeFlag=1;this.setRobotisData(b);setTimeout(function(){a.timeFlag= -0},c);return a},wait:function(a,b){Entry.hw.socket.send(JSON.stringify(a));for(var c=(new Date).getTime(),d=c;d=c)return this.setRobotisData(a),this.update(),b.callReturn();if(b.isStart){if(1==b.timeFlag)return this.setRobotisData(null),b;delete b.timeFlag;delete b.isStart;Entry.engine.isContinue=!1;this.update();return b.callReturn()}b.isStart=!0;b.timeFlag=1;this.setRobotisData(a);setTimeout(function(){b.timeFlag= +0},c);return b},wait:function(b,a){Entry.hw.socket.send(JSON.stringify(b));for(var c=(new Date).getTime(),d=c;dd&&(d=0);return Entry.Robotis_carCont.postCallReturn(b,[[e,f+(c-1)*g,g,d]],Entry.Robotis_openCM70.delay)}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.robotis_openCM70_aux_servo_position=function(b,a){var c=a.getField("PORT",a),d=a.getNumberValue("VALUE"),e=Entry.Robotis_openCM70.INSTRUCTION.WRITE,f=0,g=0,f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1];1023d&&(d=0);return Entry.Robotis_carCont.postCallReturn(a,[[e,f+(c-1)*g,g,d]],Entry.Robotis_openCM70.delay)}; Blockly.Blocks.robotis_openCM70_aux_led_module={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.robotis_common_port_3,"3"],[Lang.Blocks.robotis_common_port_4,"4"],[Lang.Blocks.robotis_common_port_5,"5"],[Lang.Blocks.robotis_common_port_6,"6"]]),"PORT").appendField(Lang.Blocks.robotis_openCM70_aux_led_module_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.robotis_cm_led_both+Lang.Blocks.robotis_common_off,"0"],[Lang.Blocks.robotis_cm_led_right+ Lang.Blocks.robotis_common_on,"1"],[Lang.Blocks.robotis_cm_led_left+Lang.Blocks.robotis_common_on,"2"],[Lang.Blocks.robotis_cm_led_both+Lang.Blocks.robotis_common_on,"3"]]),"LED_MODULE");this.appendDummyInput().appendField(Lang.Blocks.robotis_common_set).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.robotis_openCM70_aux_led_module=function(a,b){var c=b.getField("PORT",b),d=b.getField("LED_MODULE",b),e=Entry.Robotis_openCM70.INSTRUCTION.WRITE,f=0,g=0,f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[1];return Entry.Robotis_carCont.postCallReturn(b,[[e,f+(c-1)*g,g,d]],Entry.Robotis_openCM70.delay)}; +Entry.block.robotis_openCM70_aux_led_module=function(b,a){var c=a.getField("PORT",a),d=a.getField("LED_MODULE",a),e=Entry.Robotis_openCM70.INSTRUCTION.WRITE,f=0,g=0,f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[1];return Entry.Robotis_carCont.postCallReturn(a,[[e,f+(c-1)*g,g,d]],Entry.Robotis_openCM70.delay)}; Blockly.Blocks.robotis_openCM70_aux_custom={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.robotis_common_port_3,"3"],[Lang.Blocks.robotis_common_port_4,"4"],[Lang.Blocks.robotis_common_port_5,"5"],[Lang.Blocks.robotis_common_port_6,"6"]]),"PORT").appendField(Lang.Blocks.robotis_openCM70_aux_custom_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.robotis_common_set).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.robotis_openCM70_aux_custom=function(a,b){var c=b.getField("PORT",b),d=b.getNumberValue("VALUE"),e=Entry.Robotis_openCM70.INSTRUCTION.WRITE,f=0,g=0,f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1];return Entry.Robotis_carCont.postCallReturn(b,[[e,f+(c-1)*g,g,d]],Entry.Robotis_openCM70.delay)}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.robotis_openCM70_aux_custom=function(b,a){var c=a.getField("PORT",a),d=a.getNumberValue("VALUE"),e=Entry.Robotis_openCM70.INSTRUCTION.WRITE,f=0,g=0,f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1];return Entry.Robotis_carCont.postCallReturn(a,[[e,f+(c-1)*g,g,d]],Entry.Robotis_openCM70.delay)}; Blockly.Blocks.robotis_openCM70_cm_custom={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.robotis_cm_custom);this.appendDummyInput().appendField("(");this.appendValueInput("ADDRESS").setCheck(["Number","String"]);this.appendDummyInput().appendField(")");this.appendDummyInput().appendField(Lang.Blocks.robotis_common_case_01);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.robotis_common_set).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.robotis_openCM70_cm_custom=function(a,b){var c=Entry.Robotis_openCM70.INSTRUCTION.WRITE,d=0,e=0,d=b.getNumberValue("ADDRESS"),e=b.getNumberValue("VALUE");return Entry.Robotis_carCont.postCallReturn(b,[[c,d,65535c&&(c=0);createjs.Sound.setVolume(c);return b.callReturn()}; +Entry.block.sound_volume_change=function(b,a){var c=a.getNumberValue("VALUE",a)/100,c=c+createjs.Sound.getVolume();1c&&(c=0);createjs.Sound.setVolume(c);return a.callReturn()}; Blockly.Blocks.sound_volume_set={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_volume_set_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_volume_set_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; -Entry.block.sound_volume_set=function(a,b){var c=b.getNumberValue("VALUE",b)/100;1c&&(c=0);createjs.Sound.setVolume(c);return b.callReturn()};Blockly.Blocks.sound_silent_all={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_silent_all).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; -Entry.block.sound_silent_all=function(a,b){createjs.Sound.stop();return b.callReturn()};Blockly.Blocks.get_sounds={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField("");this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("sounds"),"VALUE");this.appendDummyInput().appendField(" ");this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.get_sounds=function(a,b){return b.getStringField("VALUE")}; +Entry.block.sound_volume_set=function(b,a){var c=a.getNumberValue("VALUE",a)/100;1c&&(c=0);createjs.Sound.setVolume(c);return a.callReturn()};Blockly.Blocks.sound_silent_all={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_silent_all).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; +Entry.block.sound_silent_all=function(b,a){createjs.Sound.stop();return a.callReturn()};Blockly.Blocks.get_sounds={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField("");this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("sounds"),"VALUE");this.appendDummyInput().appendField(" ");this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.get_sounds=function(b,a){return a.getStringField("VALUE")}; Blockly.Blocks.sound_something_with_block={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_1);this.appendValueInput("VALUE").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; -Entry.block.sound_something_with_block=function(a,b){var c=b.getStringValue("VALUE",b);(c=a.parent.getSound(c))&&createjs.Sound.play(c.id);return b.callReturn()}; +Entry.block.sound_something_with_block=function(b,a){var c=a.getStringValue("VALUE",a);(c=b.parent.getSound(c))&&createjs.Sound.play(c.id);return a.callReturn()}; Blockly.Blocks.sound_something_second_with_block={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_second_1);this.appendValueInput("VALUE").setCheck(["String","Number"]);this.appendDummyInput().appendField(" ").appendField(Lang.Blocks.SOUND_sound_something_second_2);this.appendValueInput("SECOND").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_second_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}};Entry.block.sound_something_second_with_block=function(a,b){var c=b.getStringValue("VALUE",b),d=b.getNumberValue("SECOND",b);(c=a.parent.getSound(c))&&createjs.Sound.play(c.id,{startTime:0,duration:1E3*d});return b.callReturn()}; +"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}};Entry.block.sound_something_second_with_block=function(b,a){var c=a.getStringValue("VALUE",a),d=a.getNumberValue("SECOND",a);(c=b.parent.getSound(c))&&createjs.Sound.play(c.id,{startTime:0,duration:1E3*d});return a.callReturn()}; Blockly.Blocks.sound_something_wait_with_block={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_wait_1);this.appendValueInput("VALUE").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_wait_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; -Entry.block.sound_something_wait_with_block=function(a,b){if(b.isPlay){if(1==b.playState)return b;delete b.playState;delete b.isPlay;return b.callReturn()}b.isPlay=!0;b.playState=1;var c=b.getStringValue("VALUE",b);if(c=a.parent.getSound(c))createjs.Sound.play(c.id),setTimeout(function(){b.playState=0},1E3*c.duration);return b}; +Entry.block.sound_something_wait_with_block=function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.playState;delete a.isPlay;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(c=b.parent.getSound(c))createjs.Sound.play(c.id),setTimeout(function(){a.playState=0},1E3*c.duration);return a}; Blockly.Blocks.sound_something_second_wait_with_block={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_second_wait_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_second_wait_2).appendField(" ");this.appendValueInput("SECOND").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_second_wait_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ "block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; -Entry.block.sound_something_second_wait_with_block=function(a,b){if(b.isPlay){if(1==b.playState)return b;delete b.isPlay;delete b.playState;return b.callReturn()}b.isPlay=!0;b.playState=1;var c=b.getStringValue("VALUE",b);if(c=a.parent.getSound(c)){var d=createjs.Sound.play(c.id),c=b.getNumberValue("SECOND",b);setTimeout(function(){d.stop();b.playState=0},1E3*c);d.addEventListener("complete",function(b){})}return b}; +Entry.block.sound_something_second_wait_with_block=function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.isPlay;delete a.playState;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(c=b.parent.getSound(c)){var d=createjs.Sound.play(c.id),c=a.getNumberValue("SECOND",a);setTimeout(function(){d.stop();a.playState=0},1E3*c);d.addEventListener("complete",function(a){})}return a}; Blockly.Blocks.sound_from_to={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_2);this.appendValueInput("START").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_3);this.appendValueInput("END").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}};Entry.block.sound_from_to=function(a,b){var c=b.getStringValue("VALUE",b);if(c=a.parent.getSound(c)){var d=1E3*b.getNumberValue("START",b),e=1E3*b.getNumberValue("END",b);createjs.Sound.play(c.id,{startTime:Math.min(d,e),duration:Math.max(d,e)-Math.min(d,e)})}return b.callReturn()}; +"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}};Entry.block.sound_from_to=function(b,a){var c=a.getStringValue("VALUE",a);if(c=b.parent.getSound(c)){var d=1E3*a.getNumberValue("START",a),e=1E3*a.getNumberValue("END",a);createjs.Sound.play(c.id,{startTime:Math.min(d,e),duration:Math.max(d,e)-Math.min(d,e)})}return a.callReturn()}; Blockly.Blocks.sound_from_to_and_wait={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_and_wait_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_and_wait_2);this.appendValueInput("START").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_and_wait_3);this.appendValueInput("END").setCheck(["String","Number"]); this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_and_wait_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; -Entry.block.sound_from_to_and_wait=function(a,b){if(b.isPlay){if(1==b.playState)return b;delete b.isPlay;delete b.playState;return b.callReturn()}b.isPlay=!0;b.playState=1;var c=b.getStringValue("VALUE",b);if(c=a.parent.getSound(c)){var d=1E3*b.getNumberValue("START",b),e=1E3*b.getNumberValue("END",b),f=Math.min(d,e),d=Math.max(d,e)-f;createjs.Sound.play(c.id,{startTime:f,duration:d});setTimeout(function(){b.playState=0},d)}return b};Blockly.Blocks.when_run_button_click={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_play.png","*","start")).appendField(Lang.Blocks.START_when_run_button_click);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_run_button_click=function(a,b){return b.callReturn()}; +Entry.block.sound_from_to_and_wait=function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.isPlay;delete a.playState;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(c=b.parent.getSound(c)){var d=1E3*a.getNumberValue("START",a),e=1E3*a.getNumberValue("END",a),f=Math.min(d,e),d=Math.max(d,e)-f;createjs.Sound.play(c.id,{startTime:f,duration:d});setTimeout(function(){a.playState=0},d)}return a};Blockly.Blocks.when_run_button_click={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_play.png","*","start")).appendField(Lang.Blocks.START_when_run_button_click);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_run_button_click=function(b,a){return a.callReturn()}; Blockly.Blocks.press_some_key={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_keyboard.png","*","start")).appendField(Lang.Blocks.START_press_some_key_1).appendField(new Blockly.FieldDropdown([["q","81"],["w","87"],["e","69"],["r","82"],["a","65"],["s","83"],["d","68"],[Lang.Blocks.START_press_some_key_up,"38"],[Lang.Blocks.START_press_some_key_down,"40"],[Lang.Blocks.START_press_some_key_left,"37"],[Lang.Blocks.START_press_some_key_right, -"39"],[Lang.Blocks.START_press_some_key_enter,"13"],[Lang.Blocks.START_press_some_key_space,"32"]]),"VALUE").appendField(Lang.Blocks.START_press_some_key_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.press_some_key=function(a,b){return b.callReturn()}; -Blockly.Blocks.when_some_key_pressed={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_keyboard.png","*","start")).appendField(Lang.Blocks.START_press_some_key_1).appendField(new Blockly.FieldKeydownInput("81"),"VALUE").appendField(Lang.Blocks.START_press_some_key_2);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_some_key_pressed=function(a,b){return b.callReturn()}; -Blockly.Blocks.mouse_clicked={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_mouse.png","*","start")).appendField(Lang.Blocks.START_mouse_clicked);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.mouse_clicked=function(a,b){return b.callReturn()}; -Blockly.Blocks.mouse_click_cancled={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_mouse.png","*","start")).appendField(Lang.Blocks.START_mouse_click_cancled);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.mouse_click_cancled=function(a,b){return b.callReturn()}; -Blockly.Blocks.when_object_click={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_mouse.png","*","start")).appendField(Lang.Blocks.START_when_object_click);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_object_click=function(a,b){return b.callReturn()}; -Blockly.Blocks.when_object_click_canceled={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_mouse.png","*","start")).appendField(Lang.Blocks.START_when_object_click_canceled);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_object_click_canceled=function(a,b){return b.callReturn()}; -Blockly.Blocks.when_some_key_click={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_keyboard.png","*","start")).appendField(Lang.Blocks.START_when_some_key_click);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_some_key_click=function(a,b){return b.callReturn()}; -Blockly.Blocks.when_message_cast={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_signal.png","*","start")).appendField(Lang.Blocks.START_when_message_cast_1).appendField(new Blockly.FieldDropdownDynamic("messages"),"VALUE").appendField(Lang.Blocks.START_when_message_cast_2);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_message_cast=function(a,b){return b.callReturn()}; +"39"],[Lang.Blocks.START_press_some_key_enter,"13"],[Lang.Blocks.START_press_some_key_space,"32"]]),"VALUE").appendField(Lang.Blocks.START_press_some_key_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.press_some_key=function(b,a){return a.callReturn()}; +Blockly.Blocks.when_some_key_pressed={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_keyboard.png","*","start")).appendField(Lang.Blocks.START_press_some_key_1).appendField(new Blockly.FieldKeydownInput("81"),"VALUE").appendField(Lang.Blocks.START_press_some_key_2);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_some_key_pressed=function(b,a){return a.callReturn()}; +Blockly.Blocks.mouse_clicked={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_mouse.png","*","start")).appendField(Lang.Blocks.START_mouse_clicked);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.mouse_clicked=function(b,a){return a.callReturn()}; +Blockly.Blocks.mouse_click_cancled={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_mouse.png","*","start")).appendField(Lang.Blocks.START_mouse_click_cancled);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.mouse_click_cancled=function(b,a){return a.callReturn()}; +Blockly.Blocks.when_object_click={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_mouse.png","*","start")).appendField(Lang.Blocks.START_when_object_click);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_object_click=function(b,a){return a.callReturn()}; +Blockly.Blocks.when_object_click_canceled={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_mouse.png","*","start")).appendField(Lang.Blocks.START_when_object_click_canceled);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_object_click_canceled=function(b,a){return a.callReturn()}; +Blockly.Blocks.when_some_key_click={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_keyboard.png","*","start")).appendField(Lang.Blocks.START_when_some_key_click);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_some_key_click=function(b,a){return a.callReturn()}; +Blockly.Blocks.when_message_cast={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_signal.png","*","start")).appendField(Lang.Blocks.START_when_message_cast_1).appendField(new Blockly.FieldDropdownDynamic("messages"),"VALUE").appendField(Lang.Blocks.START_when_message_cast_2);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_message_cast=function(b,a){return a.callReturn()}; Blockly.Blocks.message_cast={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(Lang.Blocks.START_message_cast_1).appendField(new Blockly.FieldDropdownDynamic("messages"),"VALUE").appendField(Lang.Blocks.START_message_cast_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_03.png","*"));this.setInputsInline(!0);this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; -Entry.block.message_cast=function(a,b){var c=b.getField("VALUE",b),d=Entry.isExist(c,"id",Entry.variableContainer.messages_);if("null"==c||!d)throw Error("value can not be null or undefined");Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent,["when_message_cast",c]);return b.callReturn()}; -Blockly.Blocks.add_message={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(Lang.Blocks.START_add_message).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_03.png","*"));this.setInputsInline(!0)}};Entry.block.add_massage=function(a,b){return b.callReturn()}; +Entry.block.message_cast=function(b,a){var c=a.getField("VALUE",a),d=Entry.isExist(c,"id",Entry.variableContainer.messages_);if("null"==c||!d)throw Error("value can not be null or undefined");Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent,["when_message_cast",c]);return a.callReturn()}; +Blockly.Blocks.add_message={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(Lang.Blocks.START_add_message).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_03.png","*"));this.setInputsInline(!0)}};Entry.block.add_massage=function(b,a){return a.callReturn()}; Blockly.Blocks.message_cast_wait={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(Lang.Blocks.START_message_send_wait_1).appendField(new Blockly.FieldDropdownDynamic("messages"),"VALUE").appendField(Lang.Blocks.START_message_send_wait_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; -Entry.block.message_cast_wait=function(a,b){if(b.runningScript){if(b.runningScript.length)return Entry.engine.computeFunction(b),b;delete b.runningScript;return b.callReturn()}var c=b.getField("VALUE",b),d=Entry.isExist(c,"id",Entry.variableContainer.messages_);if("null"==c||!d)throw Error("value can not be null or undefined");var e=[];Entry.container.mapEntityIncludeCloneOnScene(function(b,a){for(var c=a[0],d=a[1],l=b.parent.script.childNodes,q=0;qc.array_.length)throw Error("can not remove value from array");c.array_.splice(d-1,1);c.updateView();return b.callReturn()}; +"block_icon/variable_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.remove_value_from_list=function(b,a){var c=a.getField("LIST",a),d=a.getValue("VALUE",a),c=Entry.variableContainer.getList(c,b);if(!c.array_||isNaN(d)||d>c.array_.length)throw Error("can not remove value from array");c.array_.splice(d-1,1);c.updateView();return a.callReturn()}; Blockly.Blocks.insert_value_to_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_insert_value_to_list_1);this.appendValueInput("DATA").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_insert_value_to_list_2);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_insert_value_to_list_3);this.appendValueInput("INDEX").setCheck(["Number", "String"]);this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_insert_value_to_list_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/variable_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.insert_value_to_list=function(a,b){var c=b.getField("LIST",b),d=b.getValue("DATA",b),e=b.getValue("INDEX",b),c=Entry.variableContainer.getList(c,a);if(!c.array_||isNaN(e)||0==e||e>c.array_.length+1)throw Error("can not insert value to array");c.array_.splice(e-1,0,{data:d});c.updateView();return b.callReturn()}; +Entry.block.insert_value_to_list=function(b,a){var c=a.getField("LIST",a),d=a.getValue("DATA",a),e=a.getValue("INDEX",a),c=Entry.variableContainer.getList(c,b);if(!c.array_||isNaN(e)||0==e||e>c.array_.length+1)throw Error("can not insert value to array");c.array_.splice(e-1,0,{data:d});c.updateView();return a.callReturn()}; Blockly.Blocks.change_value_list_index={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_change_value_list_index_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_change_value_list_index_2);this.appendValueInput("INDEX").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_change_value_list_index_3);this.appendValueInput("DATA").setCheck(["Number", "String"]);this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_change_value_list_index_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/variable_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_value_list_index=function(a,b){var c=b.getField("LIST",b),d=b.getValue("DATA",b),e=b.getValue("INDEX",b),c=Entry.variableContainer.getList(c,a);if(!c.array_||isNaN(e)||e>c.array_.length)throw Error("can not insert value to array");c.array_[e-1].data=d;c.updateView();return b.callReturn()}; +Entry.block.change_value_list_index=function(b,a){var c=a.getField("LIST",a),d=a.getValue("DATA",a),e=a.getValue("INDEX",a),c=Entry.variableContainer.getList(c,b);if(!c.array_||isNaN(e)||e>c.array_.length)throw Error("can not insert value to array");c.array_[e-1].data=d;c.updateView();return a.callReturn()}; Blockly.Blocks.value_of_index_from_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_value_of_index_from_list_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_value_of_index_from_list_2);this.appendValueInput("INDEX").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_value_of_index_from_list_3);this.setOutput(!0, -"String");this.setInputsInline(!0)}};Entry.block.value_of_index_from_list=function(a,b){var c=b.getField("LIST",b),d=b.getValue("INDEX",b),c=Entry.variableContainer.getList(c,a),d=Entry.getListRealIndex(d,c);if(!c.array_||isNaN(d)||d>c.array_.length)throw Error("can not insert value to array");return c.array_[d-1].data}; -Blockly.Blocks.length_of_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_length_of_list_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_length_of_list_2);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.length_of_list=function(a,b){var c=b.getField("LIST",b);return Entry.variableContainer.getList(c).array_.length}; +"String");this.setInputsInline(!0)}};Entry.block.value_of_index_from_list=function(b,a){var c=a.getField("LIST",a),d=a.getValue("INDEX",a),c=Entry.variableContainer.getList(c,b),d=Entry.getListRealIndex(d,c);if(!c.array_||isNaN(d)||d>c.array_.length)throw Error("can not insert value to array");return c.array_[d-1].data}; +Blockly.Blocks.length_of_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_length_of_list_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_length_of_list_2);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.length_of_list=function(b,a){var c=a.getField("LIST",a);return Entry.variableContainer.getList(c).array_.length}; Blockly.Blocks.show_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_show_list_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST").appendField(Lang.Blocks.VARIABLE_show_list_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/variable_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.show_list=function(a,b){var c=b.getField("LIST",b);Entry.variableContainer.getList(c).setVisible(!0);return b.callReturn()}; +Entry.block.show_list=function(b,a){var c=a.getField("LIST",a);Entry.variableContainer.getList(c).setVisible(!0);return a.callReturn()}; Blockly.Blocks.hide_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_hide_list_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST").appendField(Lang.Blocks.VARIABLE_hide_list_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/variable_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.hide_list=function(a,b){var c=b.getField("LIST",b);Entry.variableContainer.getList(c).setVisible(!1);return b.callReturn()}; +Entry.block.hide_list=function(b,a){var c=a.getField("LIST",a);Entry.variableContainer.getList(c).setVisible(!1);return a.callReturn()}; Blockly.Blocks.options_for_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField("");this.appendDummyInput("VALUE").appendField(new Blockly.FieldDropdown([[Lang.Blocks.VARIABLE_list_option_first,"FIRST"],[Lang.Blocks.VARIABLE_list_option_last,"LAST"],[Lang.Blocks.VARIABLE_list_option_random,"RANDOM"]]),"OPERATOR");this.appendDummyInput().appendField(" ");this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.options_for_list=function(a,b){return b.getField("OPERATOR",b)}; +Entry.block.options_for_list=function(b,a){return a.getField("OPERATOR",a)}; Blockly.Blocks.set_visible_answer={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_get_canvas_input_value);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.CALC_timer_visible_show,"SHOW"],[Lang.Blocks.CALC_timer_visible_hide,"HIDE"]]),"BOOL");this.appendDummyInput().appendField("").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/variable_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0); -this.setNextStatement(!0)},whenAdd:function(){Entry.container.showProjectAnswer()},whenRemove:function(a){Entry.container.hideProjectAnswer(a)}};Entry.block.set_visible_answer=function(a,b){"HIDE"==b.getField("BOOL",b)?Entry.container.inputValue.setVisible(!1):Entry.container.inputValue.setVisible(!0);return b.callReturn()}; +this.setNextStatement(!0)},whenAdd:function(){Entry.container.showProjectAnswer()},whenRemove:function(b){Entry.container.hideProjectAnswer(b)}};Entry.block.set_visible_answer=function(b,a){"HIDE"==a.getField("BOOL",a)?Entry.container.inputValue.setVisible(!1):Entry.container.inputValue.setVisible(!0);return a.callReturn()}; Blockly.Blocks.is_included_in_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_is_included_in_list_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_is_included_in_list_2);this.appendValueInput("DATA").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_is_included_in_list_3);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; -Entry.block.is_included_in_list=function(a,b){var c=b.getField("LIST",b),d=b.getStringValue("DATA",b),c=Entry.variableContainer.getList(c);if(!c)return!1;for(var c=c.array_,e=0,f=c.length;ea||0>d||a>e||d>e||b.splice.call(this,d,0,b.splice.call(this,a,1)[0])};a.sort=function(){};a.fromJSON=function(){};a.toJSON=function(){for(var b=[],a=0,e=this.length;a/,d;d=a instanceof HTMLElement?$(a):a instanceof jQuery?a:c.test(a)?$(a):$("<"+a+">");if(void 0===b)return d;b.id&&d.attr("id",b.id);b.class&&d.addClass(b.class);b.classes&&b.classes.map(function(b){d.addClass(b)});b.parent&&b.parent.append(d);d.bindOnClick=function(){var b,a,c=function(b){b.stopImmediatePropagation();b.handled||(b.handled=!0,a.call(this,b))};1a.x+a.width+this.width?(this.object.x=a.x+a.width+this.width/2,b+="e"):(this.object.x=a.x-this.width/2,b+="w");this.notch.type!=b&&(this.object.removeChild(this.notch),this.notch=this.createSpeakNotch(b),this.object.addChild(this.notch))}; -Entry.Dialog.prototype.createSpeakNotch=function(a){var b=new createjs.Shape;b.type=a;"ne"==a?b.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"==a?b.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"==a?b.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"==a&&b.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 b};Entry.Dialog.prototype.remove=function(){Entry.stage.unloadDialog(this);this.parent.dialog=null};Entry.DoneProject=function(a){this.generateView(a)};var p=Entry.DoneProject.prototype;p.init=function(a){this.projectId=a};p.generateView=function(a){var b=Entry.createElement("div");b.addClass("entryContainerDoneWorkspace");b.addClass("entryHidden");this.doneContainer=b;b=Entry.createElement("iframe");b.setAttribute("id","doneProjectframe");b.setAttribute("frameborder",0);b.setAttribute("src","/api/iframe/project/"+a);this.doneProjectFrame=b;this.doneContainer.appendChild(b)};p.getView=function(){return this.doneContainer}; -p.resize=function(){var a=document.getElementById("entryContainerWorkspaceId"),b=document.getElementById("doneProjectframe");w=a.offsetWidth;b.width=w+"px";b.height=9*w/16+"px"};Entry.Engine=function(){function a(b){var a=[37,38,39,40,32],d=b.keyCode||b.which,e=Entry.stage.inputField;32==d&&e&&e.hasFocus()||-1b||0>d||b>e||d>e||a.splice.call(this,d,0,a.splice.call(this,b,1)[0])};b.sort=function(){};b.fromJSON=function(){};b.toJSON=function(){for(var a=[],b=0,e=this.length;b/,d;d=b instanceof HTMLElement?$(b):b instanceof jQuery?b:c.test(b)?$(b):$("<"+b+">");if(void 0===a)return d;a.id&&d.attr("id",a.id);a.class&&d.addClass(a.class);a.classes&&a.classes.map(function(a){d.addClass(a)});a.parent&&a.parent.append(d);d.bindOnClick=function(){var a,b,c=function(a){a.stopImmediatePropagation();a.handled||(a.handled=!0,b.call(this,a))};1b.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");a.addClass("entryHidden");this.doneContainer=a;a=Entry.createElement("iframe");a.setAttribute("id","doneProjectframe");a.setAttribute("frameborder",0);a.setAttribute("src","/api/iframe/project/"+b);this.doneProjectFrame=a;this.doneContainer.appendChild(a)};p.getView=function(){return this.doneContainer}; +p.resize=function(){var b=document.getElementById("entryContainerWorkspaceId"),a=document.getElementById("doneProjectframe");w=b.offsetWidth;a.width=w+"px";a.height=9*w/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()||-1c;c++)(function(c){var e=Entry.createElement("td","progressCell"+c);e.bindOnClick(function(){Entry.engine.setSpeedMeter(b[c])});a.appendChild(e)})(c);this.view_.insertBefore(this.speedProgress_,this.maximizeButton);this.speedProgress_.appendChild(a);this.speedHandle_=Entry.createElement("div","entrySpeedHandleWorkspace");c=(Entry.interfaceState.canvasWidth-84)/5;$(this.speedHandle_).draggable({axis:"x",grid:[c,c],containment:[80,0,4*c+80,0],drag:function(b,a){var c=(a.position.left-80)/(Entry.interfaceState.canvasWidth- +Entry.Engine.prototype.toggleSpeedPanel=function(){if(this.speedPanelOn)this.speedPanelOn=!1,$(Entry.stage.canvas.canvas).animate({top:"24px"}),this.coordinateButton.removeClass("entryRemove"),this.maximizeButton.removeClass("entryRemove"),this.mouseView.removeClass("entryRemoveElement"),$(this.speedLabel_).remove(),delete this.speedLabel_,$(this.speedProgress_).fadeOut(null,function(a){$(this).remove();delete this.speedProgress_}),$(this.speedHandle_).remove(),delete this.speedHandle_;else{this.speedPanelOn= +!0;$(Entry.stage.canvas.canvas).animate({top:"41px"});this.coordinateButton.addClass("entryRemove");this.maximizeButton.addClass("entryRemove");this.mouseView.addClass("entryRemoveElement");this.speedLabel_=Entry.createElement("div","entrySpeedLabelWorkspace");this.speedLabel_.innerHTML=Lang.Workspace.speed;this.view_.insertBefore(this.speedLabel_,this.maximizeButton);this.speedProgress_=Entry.createElement("table","entrySpeedProgressWorkspace");for(var b=Entry.createElement("tr"),a=this.speeds,c= +0;5>c;c++)(function(c){var e=Entry.createElement("td","progressCell"+c);e.bindOnClick(function(){Entry.engine.setSpeedMeter(a[c])});b.appendChild(e)})(c);this.view_.insertBefore(this.speedProgress_,this.maximizeButton);this.speedProgress_.appendChild(b);this.speedHandle_=Entry.createElement("div","entrySpeedHandleWorkspace");c=(Entry.interfaceState.canvasWidth-84)/5;$(this.speedHandle_).draggable({axis:"x",grid:[c,c],containment:[80,0,4*c+80,0],drag:function(a,b){var c=(b.position.left-80)/(Entry.interfaceState.canvasWidth- 84)*5,c=Math.floor(c);0>c||Entry.engine.setSpeedMeter(Entry.engine.speeds[c])}});this.view_.insertBefore(this.speedHandle_,this.maximizeButton);this.setSpeedMeter(Entry.FPS)}}; -Entry.Engine.prototype.setSpeedMeter=function(a){var b=this.speeds.indexOf(a);0>b||(b=Math.min(4,b),b=Math.max(0,b),this.speedPanelOn&&(this.speedHandle_.style.left=(Entry.interfaceState.canvasWidth-80)/10*(2*b+1)+80-9+"px"),Entry.FPS!=a&&(clearInterval(this.ticker),this.ticker=setInterval(this.update,Math.floor(1E3/a)),Entry.FPS=a))};Entry.Engine.prototype.start=function(a){createjs.Ticker.setFPS(Entry.FPS);this.ticker=setInterval(this.update,Math.floor(1E3/Entry.FPS))}; +Entry.Engine.prototype.setSpeedMeter=function(b){var a=this.speeds.indexOf(b);0>a||(a=Math.min(4,a),a=Math.max(0,a),this.speedPanelOn&&(this.speedHandle_.style.left=(Entry.interfaceState.canvasWidth-80)/10*(2*a+1)+80-9+"px"),Entry.FPS!=b&&(clearInterval(this.ticker),this.ticker=setInterval(this.update,Math.floor(1E3/b)),Entry.FPS=b))};Entry.Engine.prototype.start=function(b){createjs.Ticker.setFPS(Entry.FPS);this.ticker=setInterval(this.update,Math.floor(1E3/Entry.FPS))}; Entry.Engine.prototype.stop=function(){clearInterval(this.ticker);this.ticker=null};Entry.Engine.prototype.update=function(){Entry.engine.isState("run")&&(Entry.engine.computeObjects(),Entry.hw.update())};Entry.Engine.prototype.computeObjects=function(){Entry.container.mapEntityIncludeCloneOnScene(this.computeFunction)}; -Entry.Engine.prototype.computeFunction=function(a){a=a.runningScript;for(var b=0;bEntry.engine.pressedKeys.indexOf(b)&&Entry.engine.pressedKeys.push(b);a.ctrlKey&&"workspace"==c?83==b?(a.preventDefault(),Entry.dispatchEvent("saveWorkspace")):82==b?(a.preventDefault(),Entry.engine.run()):90==b?(a.preventDefault(),Entry.dispatchEvent(a.shiftKey?"redo":"undo")):48b&&(a.preventDefault(),Entry.playground.selectMenu(b-49)):Entry.engine.isState("run")&&(Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent, -["press_some_key",b]),Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent,["when_some_key_pressed",b]));Entry.engine.isState("stop")&&"workspace"===c&&37<=b&&40>=b&&Entry.stage.moveSprite(a)};Entry.Engine.prototype.captureKeyUpEvent=function(a){a=a.keyCode;0<=Entry.engine.pressedKeys.indexOf(a)&&Entry.engine.pressedKeys.splice(Entry.engine.pressedKeys.indexOf(a),1)}; -Entry.Engine.prototype.raiseKeyEvent=function(a,b){for(var c=b[0],d=b[1],e=a.parent.script.childNodes,f=0;fEntry.engine.pressedKeys.indexOf(a)&&Entry.engine.pressedKeys.push(a);b.ctrlKey&&"workspace"==c?83==a?(b.preventDefault(),Entry.dispatchEvent("saveWorkspace")):82==a?(b.preventDefault(),Entry.engine.run()):90==a?(b.preventDefault(),Entry.dispatchEvent(b.shiftKey?"redo":"undo")):48a&&(b.preventDefault(),Entry.playground.selectMenu(a-49)):Entry.engine.isState("run")&&(Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent, +["press_some_key",a]),Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent,["when_some_key_pressed",a]));Entry.engine.isState("stop")&&"workspace"===c&&37<=a&&40>=a&&Entry.stage.moveSprite(b)};Entry.Engine.prototype.captureKeyUpEvent=function(b){b=b.keyCode;0<=Entry.engine.pressedKeys.indexOf(b)&&Entry.engine.pressedKeys.splice(Entry.engine.pressedKeys.indexOf(b),1)}; +Entry.Engine.prototype.raiseKeyEvent=function(b,a){for(var c=a[0],d=a[1],e=b.parent.script.childNodes,f=0;fthis.direction)==(0<=a&&180>a)||(this.setScaleX(-this.getScaleX()),Entry.stage.updateObject(),this.flip=!this.flip);this.direction=a.mod(360);this.object.direction=this.direction;this.isClone||this.parent.updateRotationView();Entry.dispatchEvent("updateObject")}; -Entry.EntityObject.prototype.setRotation=function(a){"free"!=this.parent.getRotateMethod()&&(a=0);this.rotation=a.mod(360);this.object.rotation=this.rotation;this.updateDialog();this.isClone||this.parent.updateRotationView();Entry.dispatchEvent("updateObject")};Entry.EntityObject.prototype.getRotation=function(){return this.rotation};Entry.EntityObject.prototype.setRegX=function(a){"textBox"==this.type&&(a=0);this.regX=a;this.object.regX=this.regX};Entry.EntityObject.prototype.getRegX=function(){return this.regX}; -Entry.EntityObject.prototype.setRegY=function(a){"textBox"==this.type&&(a=0);this.regY=a;this.object.regY=this.regY};Entry.EntityObject.prototype.getRegY=function(){return this.regY};Entry.EntityObject.prototype.setScaleX=function(a){this.scaleX=a;this.object.scaleX=this.scaleX;this.parent.updateCoordinateView();this.updateDialog()};Entry.EntityObject.prototype.getScaleX=function(){return this.scaleX}; -Entry.EntityObject.prototype.setScaleY=function(a){this.scaleY=a;this.object.scaleY=this.scaleY;this.parent.updateCoordinateView();this.updateDialog()};Entry.EntityObject.prototype.getScaleY=function(){return this.scaleY};Entry.EntityObject.prototype.setSize=function(a){1>a&&(a=1);a/=this.getSize();this.setScaleX(this.getScaleX()*a);this.setScaleY(this.getScaleY()*a);this.isClone||this.parent.updateCoordinateView()}; -Entry.EntityObject.prototype.getSize=function(){return(this.getWidth()*Math.abs(this.getScaleX())+this.getHeight()*Math.abs(this.getScaleY()))/2};Entry.EntityObject.prototype.setWidth=function(a){this.width=a;this.object.width=this.width;this.textObject&&this.getLineBreak()&&(this.textObject.lineWidth=this.width);this.updateDialog();this.updateBG()};Entry.EntityObject.prototype.getWidth=function(){return this.width}; -Entry.EntityObject.prototype.setHeight=function(a){this.height=a;this.textObject&&(this.object.height=this.height,this.alignTextBox());this.updateDialog();this.updateBG()};Entry.EntityObject.prototype.getHeight=function(){return this.height};Entry.EntityObject.prototype.setColour=function(a){a||(a="#000000");this.colour=a;this.textObject&&(this.textObject.color=this.colour)};Entry.EntityObject.prototype.getColour=function(){return this.colour}; -Entry.EntityObject.prototype.setBGColour=function(a){a||(a="transparent");this.bgColor=a;this.updateBG()};Entry.EntityObject.prototype.getBGColour=function(){return this.bgColor};Entry.EntityObject.prototype.setUnderLine=function(a){void 0===a&&(a=!1);this.underLine=a;this.textObject.underLine=a};Entry.EntityObject.prototype.getUnderLine=function(){return this.underLine};Entry.EntityObject.prototype.setStrike=function(a){void 0===a&&(a=!1);this.strike=a;this.textObject.strike=a}; -Entry.EntityObject.prototype.getStrike=function(){return this.strike};Entry.EntityObject.prototype.getFont=function(){var a=[];this.fontBold&&a.push("bold");this.fontItalic&&a.push("italic");a.push(this.getFontSize()+"px");a.push(this.fontType);return a.join(" ")}; -Entry.EntityObject.prototype.setFont=function(a){if("textBox"==this.parent.objectType&&this.font!==a){a||(a="20px Nanum Gothic");var b=a.split(" "),c=0;if(c=-1=h?e=[1,0,0,0,0,0,g,f,0,0,0,-1*f,g,0,0,0,0,0,1,0,0,0,0,0,1]:.66>=h?e=[g,0,f,0,0,0,1,0,0,0,f,0,g,0,0,0,0,0,1,0,0,0,0,0,1]:.99>=h&&(e=[g,f,0,0,0,-1*f,g,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1]);e=(new createjs.ColorMatrix).concat(e);e=new createjs.ColorMatrixFilter(e);c.push(e);a.alpha=b.alpha=d(b.alpha,0,1);a.filters=c;a.cache(0,0,this.getWidth(),this.getHeight())}; +Entry.EntityObject.prototype.restoreEntity=function(b){var a=this.toJSON();this.syncModel_(b);Entry.dispatchEvent("updateObject");Entry.stateManager&&Entry.stateManager.addCommand("restore object",this,this.restoreEntity,a)};Entry.EntityObject.prototype.clearScript=function(b){for(;this.runningScript.length;)this.runningScript.pop()};Entry.EntityObject.prototype.setX=function(b){"number"==typeof b&&(this.x=b,this.object.x=this.x,this.isClone||this.parent.updateCoordinateView(),this.updateDialog())}; +Entry.EntityObject.prototype.getX=function(){return this.x};Entry.EntityObject.prototype.setY=function(b){"number"==typeof b&&(this.y=b,this.object.y=-this.y,this.isClone||this.parent.updateCoordinateView(),this.updateDialog())};Entry.EntityObject.prototype.getY=function(){return this.y};Entry.EntityObject.prototype.getDirection=function(){return this.direction}; +Entry.EntityObject.prototype.setDirection=function(b,a){b||(b=0);"vertical"!=this.parent.getRotateMethod()||a||(0<=this.direction&&180>this.direction)==(0<=b&&180>b)||(this.setScaleX(-this.getScaleX()),Entry.stage.updateObject(),this.flip=!this.flip);this.direction=b.mod(360);this.object.direction=this.direction;this.isClone||this.parent.updateRotationView();Entry.dispatchEvent("updateObject")}; +Entry.EntityObject.prototype.setRotation=function(b){"free"!=this.parent.getRotateMethod()&&(b=0);this.rotation=b.mod(360);this.object.rotation=this.rotation;this.updateDialog();this.isClone||this.parent.updateRotationView();Entry.dispatchEvent("updateObject")};Entry.EntityObject.prototype.getRotation=function(){return this.rotation};Entry.EntityObject.prototype.setRegX=function(b){"textBox"==this.type&&(b=0);this.regX=b;this.object.regX=this.regX};Entry.EntityObject.prototype.getRegX=function(){return this.regX}; +Entry.EntityObject.prototype.setRegY=function(b){"textBox"==this.type&&(b=0);this.regY=b;this.object.regY=this.regY};Entry.EntityObject.prototype.getRegY=function(){return this.regY};Entry.EntityObject.prototype.setScaleX=function(b){this.scaleX=b;this.object.scaleX=this.scaleX;this.parent.updateCoordinateView();this.updateDialog()};Entry.EntityObject.prototype.getScaleX=function(){return this.scaleX}; +Entry.EntityObject.prototype.setScaleY=function(b){this.scaleY=b;this.object.scaleY=this.scaleY;this.parent.updateCoordinateView();this.updateDialog()};Entry.EntityObject.prototype.getScaleY=function(){return this.scaleY};Entry.EntityObject.prototype.setSize=function(b){1>b&&(b=1);b/=this.getSize();this.setScaleX(this.getScaleX()*b);this.setScaleY(this.getScaleY()*b);this.isClone||this.parent.updateCoordinateView()}; +Entry.EntityObject.prototype.getSize=function(){return(this.getWidth()*Math.abs(this.getScaleX())+this.getHeight()*Math.abs(this.getScaleY()))/2};Entry.EntityObject.prototype.setWidth=function(b){this.width=b;this.object.width=this.width;this.textObject&&this.getLineBreak()&&(this.textObject.lineWidth=this.width);this.updateDialog();this.updateBG()};Entry.EntityObject.prototype.getWidth=function(){return this.width}; +Entry.EntityObject.prototype.setHeight=function(b){this.height=b;this.textObject&&(this.object.height=this.height,this.alignTextBox());this.updateDialog();this.updateBG()};Entry.EntityObject.prototype.getHeight=function(){return this.height};Entry.EntityObject.prototype.setColour=function(b){b||(b="#000000");this.colour=b;this.textObject&&(this.textObject.color=this.colour)};Entry.EntityObject.prototype.getColour=function(){return this.colour}; +Entry.EntityObject.prototype.setBGColour=function(b){b||(b="transparent");this.bgColor=b;this.updateBG()};Entry.EntityObject.prototype.getBGColour=function(){return this.bgColor};Entry.EntityObject.prototype.setUnderLine=function(b){void 0===b&&(b=!1);this.underLine=b;this.textObject.underLine=b};Entry.EntityObject.prototype.getUnderLine=function(){return this.underLine};Entry.EntityObject.prototype.setStrike=function(b){void 0===b&&(b=!1);this.strike=b;this.textObject.strike=b}; +Entry.EntityObject.prototype.getStrike=function(){return this.strike};Entry.EntityObject.prototype.getFont=function(){var b=[];this.fontBold&&b.push("bold");this.fontItalic&&b.push("italic");b.push(this.getFontSize()+"px");b.push(this.fontType);return b.join(" ")}; +Entry.EntityObject.prototype.setFont=function(b){if("textBox"==this.parent.objectType&&this.font!==b){b||(b="20px Nanum Gothic");var a=b.split(" "),c=0;if(c=-1=h?e=[1,0,0,0,0,0,g,f,0,0,0,-1*f,g,0,0,0,0,0,1,0,0,0,0,0,1]:.66>=h?e=[g,0,f,0,0,0,1,0,0,0,f,0,g,0,0,0,0,0,1,0,0,0,0,0,1]:.99>=h&&(e=[g,f,0,0,0,-1*f,g,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1]);e=(new createjs.ColorMatrix).concat(e);e=new createjs.ColorMatrixFilter(e);c.push(e);b.alpha=a.alpha=d(a.alpha,0,1);b.filters=c;b.cache(0,0,this.getWidth(),this.getHeight())}; 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.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.EntityObject.prototype.removeClone=function(){if(this.isClone){this.dialog&&this.dialog.remove();this.brush&&this.removeBrush();Entry.stage.unloadEntity(this);var a=this.parent.clonedEntities.indexOf(this);this.parent.clonedEntities.splice(a,1)}}; -Entry.EntityObject.prototype.toJSON=function(){var a={};a.x=Entry.cutDecimal(this.getX());a.y=Entry.cutDecimal(this.getY());a.regX=Entry.cutDecimal(this.getRegX());a.regY=Entry.cutDecimal(this.getRegY());a.scaleX=this.getScaleX();a.scaleY=this.getScaleY();a.rotation=Entry.cutDecimal(this.getRotation());a.direction=Entry.cutDecimal(this.getDirection());a.width=Entry.cutDecimal(this.getWidth());a.height=Entry.cutDecimal(this.getHeight());a.font=this.getFont();a.visible=this.getVisible();"textBox"== -this.parent.objectType&&(a.colour=this.getColour(),a.text=this.getText(),a.textAlign=this.getTextAlign(),a.lineBreak=this.getLineBreak(),a.bgColor=this.getBGColour(),a.underLine=this.getUnderLine(),a.strike=this.getStrike(),a.fontSize=this.getFontSize());return a};Entry.EntityObject.prototype.setInitialEffectValue=function(){this.effect={blur:0,hue:0,hsv:0,brightness:0,contrast:0,saturation:0,alpha:1}}; +Entry.EntityObject.prototype.loadSnapshot=function(){this.snapshot_&&this.syncModel_(this.snapshot_);"sprite"==this.parent.objectType&&this.setImage(this.parent.getPicture())};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.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={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}; -Entry.EntityObject.prototype.updateBG=function(){if(this.bgObject){this.bgObject.graphics.clear();var a=this.getWidth(),b=this.getHeight();this.bgObject.graphics.setStrokeStyle(1).beginStroke().beginFill(this.getBGColour()).drawRect(-a/2,-b/2,a,b);if(this.getLineBreak())this.bgObject.x=0;else switch(this.getTextAlign()){case Entry.TEXT_ALIGN_LEFT:this.bgObject.x=a/2;break;case Entry.TEXT_ALIGN_CENTER:this.bgObject.x=0;break;case Entry.TEXT_ALIGN_RIGHT:this.bgObject.x=-a/2}}}; -Entry.EntityObject.prototype.alignTextBox=function(){if("textBox"==this.type){var a=this.textObject;if(this.lineBreak){var b=a.getMeasuredLineHeight();a.y=b/2-this.getHeight()/2;switch(this.textAlign){case Entry.TEXT_ALIGN_CENTER:a.x=0;break;case Entry.TEXT_ALIGN_LEFT:a.x=-this.getWidth()/2;break;case Entry.TEXT_ALIGN_RIGHT:a.x=this.getWidth()/2}a.maxHeight=this.getHeight()}else a.x=0,a.y=0}};Entry.EntityObject.prototype.syncDialogVisible=function(){this.dialog&&(this.dialog.object.visible=this.visible)};Entry.Helper=function(){this.generateView()};p=Entry.Helper.prototype; -p.generateView=function(){this.blockHelpData=EntryStatic.blockInfo;var a=Entry.createElement("div","entryBlockHelperWorkspace");this._view=a;Entry.isForLecture&&a.addClass("lecture");var b=Entry.createElement("div","entryBlockHelperHeaderWorkspace");b.innerHTML=Lang.Helper.Block_info;a.appendChild(b);b=Entry.createElement("div","entryBlockHelperContentWorkspace");b.addClass("entryBlockHelperIntro");Entry.isForLecture&&b.addClass("lecture");a.appendChild(b);this.blockHelperContent_=b;this.blockHelperView_= -a;a=Entry.createElement("div","entryBlockHelperBlockWorkspace");this.blockMenu_=new Blockly.BlockMenu(a);this.blockMenu_.isViewOnly=!0;this.blockMenu_.isCenterAlign=!0;this.blockHelperContent_.appendChild(a);a=Entry.createElement("div","entryBlockHelperDescriptionWorkspace");this.blockHelperContent_.appendChild(a);a.innerHTML=Lang.Helper.Block_click_msg;this.blockHelperDescription_=a;this.first=!0};p.getView=function(){this.bindEvent();return this._view}; +Entry.EntityObject.prototype.updateBG=function(){if(this.bgObject){this.bgObject.graphics.clear();var b=this.getWidth(),a=this.getHeight();this.bgObject.graphics.setStrokeStyle(1).beginStroke().beginFill(this.getBGColour()).drawRect(-b/2,-a/2,b,a);if(this.getLineBreak())this.bgObject.x=0;else switch(this.getTextAlign()){case Entry.TEXT_ALIGN_LEFT:this.bgObject.x=b/2;break;case Entry.TEXT_ALIGN_CENTER:this.bgObject.x=0;break;case Entry.TEXT_ALIGN_RIGHT:this.bgObject.x=-b/2}}}; +Entry.EntityObject.prototype.alignTextBox=function(){if("textBox"==this.type){var b=this.textObject;if(this.lineBreak){var a=b.getMeasuredLineHeight();b.y=a/2-this.getHeight()/2;switch(this.textAlign){case Entry.TEXT_ALIGN_CENTER:b.x=0;break;case Entry.TEXT_ALIGN_LEFT:b.x=-this.getWidth()/2;break;case Entry.TEXT_ALIGN_RIGHT:b.x=this.getWidth()/2}b.maxHeight=this.getHeight()}else b.x=0,b.y=0}};Entry.EntityObject.prototype.syncDialogVisible=function(){this.dialog&&(this.dialog.object.visible=this.visible)};Entry.Helper=function(){this.generateView()};p=Entry.Helper.prototype; +p.generateView=function(){this.blockHelpData=EntryStatic.blockInfo;var b=Entry.createElement("div","entryBlockHelperWorkspace");this._view=b;Entry.isForLecture&&b.addClass("lecture");var a=Entry.createElement("div","entryBlockHelperHeaderWorkspace");a.innerHTML=Lang.Helper.Block_info;b.appendChild(a);a=Entry.createElement("div","entryBlockHelperContentWorkspace");a.addClass("entryBlockHelperIntro");Entry.isForLecture&&a.addClass("lecture");b.appendChild(a);this.blockHelperContent_=a;this.blockHelperView_= +b;b=Entry.createElement("div","entryBlockHelperBlockWorkspace");this.blockMenu_=new Blockly.BlockMenu(b);this.blockMenu_.isViewOnly=!0;this.blockMenu_.isCenterAlign=!0;this.blockHelperContent_.appendChild(b);b=Entry.createElement("div","entryBlockHelperDescriptionWorkspace");this.blockHelperContent_.appendChild(b);b.innerHTML=Lang.Helper.Block_click_msg;this.blockHelperDescription_=b;this.first=!0};p.getView=function(){this.bindEvent();return this._view}; p.bindEvent=function(){this.blockChangeEvent||(this.blockChangeEvent=Blockly.bindEvent_(Blockly.mainWorkspace.getCanvas(),"blocklySelectChange",this,this.updateSelectedBlock),Entry.playground.blockMenu&&(this.menuBlockChangeEvent=Blockly.bindEvent_(Entry.playground.blockMenu.workspace_.getCanvas(),"blocklySelectChange",this,this.updateSelectedBlock)))};p.updateSelectedBlock=function(){Blockly.selected&&(this.first&&(this.blockHelperContent_.removeClass("entryBlockHelperIntro"),this.first=!1),this.renderBlock(Blockly.selected.type))}; -p.renderBlock=function(a){var b=this.blockHelpData[a];b&&(b=jQuery.parseXML(b.xml),b=this.blockMenu_.show(b.childNodes),this.blockHelperDescription_.innerHTML=Entry.makeAutolink(Lang.Helper[a]),$(this.blockHelperDescription_).css({top:b+40}))};Entry.Activity=function(a,b){this.name=a;this.timestamp=new Date;var c=[];if(void 0!==b)for(var d=0,e=b.length;d");this.pictures=a.sprite.pictures;this.sounds=[];this.sounds=a.sprite.sounds;for(var b=0;b");this.pictures=b.sprite.pictures;this.sounds=[];this.sounds=b.sprite.sounds;for(var a=0;athis.pictures.length)return!1;a=this.getPicture(a);var b=this.pictures.indexOf(a);Entry.stateManager&&Entry.stateManager.addCommand("remove sprite",this,this.addPicture,a,b);this.pictures.splice(b,1);a===this.selectedPicture&&Entry.playground.selectPicture(this.pictures[0]);Entry.playground.injectPicture(this);Entry.playground.reloadPlayground();return new Entry.State(this,this.addPicture,a,b)}; -Entry.EntryObject.prototype.getPicture=function(a){if(!a)return this.selectedPicture;a=a.trim();for(var b=this.pictures,c=b.length,d=0;d=a&&0Entry.maxCloneLimit||(a=new Entry.EntityObject(this),b?(a.injectModel(b.picture?b.picture:null,b.toJSON()),a.snapshot_=b.snapshot_,b.effect&&(a.effect=Entry.cloneSimpleObject(b.effect),a.applyFilter()),b.brush&&Entry.setCloneBrush(a,b.brush)):(a.injectModel(this.entity.picture?this.entity.picture:null,this.entity.toJSON(a)),a.snapshot_=this.entity.snapshot_,this.entity.effect&&(a.effect=Entry.cloneSimpleObject(this.entity.effect), -a.applyFilter()),this.entity.brush&&Entry.setCloneBrush(a,this.entity.brush)),Entry.engine.raiseEventOnEntity(a,[a,"when_clone_start"]),a.isClone=!0,a.isStarted=!0,this.addCloneVariables(this,a,b?b.variables:null,b?b.lists:null),this.clonedEntities.push(a),Entry.stage.loadEntity(a))}; -Entry.EntryObject.prototype.initializeSplitter=function(a){a.onmousedown=function(b){Entry.container.disableSort();Entry.container.splitterEnable=!0};document.addEventListener("mousemove",function(b){Entry.container.splitterEnable&&Entry.resizeElement({canvasWidth:b.x||b.clientX})});document.addEventListener("mouseup",function(b){Entry.container.splitterEnable=!1;Entry.container.enableSort()})};Entry.EntryObject.prototype.isSelected=function(){return this.isSelected_}; -Entry.EntryObject.prototype.toJSON=function(){var a={};a.id=this.id;a.name=this.name;"textBox"==this.objectType&&(a.text=this.text);a.script=this.getScriptText();"sprite"==this.objectType&&(a.selectedPictureId=this.selectedPicture.id);a.objectType=this.objectType;a.rotateMethod=this.getRotateMethod();a.scene=this.scene.id;a.sprite={pictures:Entry.getPicturesJSON(this.pictures),sounds:Entry.getSoundsJSON(this.sounds)};a.lock=this.lock;a.entity=this.entity.toJSON();return a}; -Entry.EntryObject.prototype.destroy=function(){Entry.stage.unloadEntity(this.entity);this.view_&&Entry.removeElement(this.view_)};Entry.EntryObject.prototype.getSound=function(a){a=a.trim();for(var b=this.sounds,c=b.length,d=0;d=a&&0this.pictures.length)return!1;b=this.getPicture(b);var a=this.pictures.indexOf(b);Entry.stateManager&&Entry.stateManager.addCommand("remove sprite",this,this.addPicture,b,a);this.pictures.splice(a,1);b===this.selectedPicture&&Entry.playground.selectPicture(this.pictures[0]);Entry.playground.injectPicture(this);Entry.playground.reloadPlayground();return new Entry.State(this,this.addPicture,b,a)}; +Entry.EntryObject.prototype.getPicture=function(b){if(!b)return this.selectedPicture;b=b.trim();for(var a=this.pictures,c=a.length,d=0;d=b&&0Entry.maxCloneLimit||(b=new Entry.EntityObject(this),a?(b.injectModel(a.picture?a.picture:null,a.toJSON()),b.snapshot_=a.snapshot_,a.effect&&(b.effect=Entry.cloneSimpleObject(a.effect),b.applyFilter()),a.brush&&Entry.setCloneBrush(b,a.brush)):(b.injectModel(this.entity.picture?this.entity.picture:null,this.entity.toJSON(b)),b.snapshot_=this.entity.snapshot_,this.entity.effect&&(b.effect=Entry.cloneSimpleObject(this.entity.effect), +b.applyFilter()),this.entity.brush&&Entry.setCloneBrush(b,this.entity.brush)),Entry.engine.raiseEventOnEntity(b,[b,"when_clone_start"]),b.isClone=!0,b.isStarted=!0,this.addCloneVariables(this,b,a?a.variables:null,a?a.lists:null),this.clonedEntities.push(b),Entry.stage.loadEntity(b))}; +Entry.EntryObject.prototype.initializeSplitter=function(b){b.onmousedown=function(a){Entry.container.disableSort();Entry.container.splitterEnable=!0};document.addEventListener("mousemove",function(a){Entry.container.splitterEnable&&Entry.resizeElement({canvasWidth:a.x||a.clientX})});document.addEventListener("mouseup",function(a){Entry.container.splitterEnable=!1;Entry.container.enableSort()})};Entry.EntryObject.prototype.isSelected=function(){return this.isSelected_}; +Entry.EntryObject.prototype.toJSON=function(){var b={};b.id=this.id;b.name=this.name;"textBox"==this.objectType&&(b.text=this.text);b.script=this.getScriptText();"sprite"==this.objectType&&(b.selectedPictureId=this.selectedPicture.id);b.objectType=this.objectType;b.rotateMethod=this.getRotateMethod();b.scene=this.scene.id;b.sprite={pictures:Entry.getPicturesJSON(this.pictures),sounds:Entry.getSoundsJSON(this.sounds)};b.lock=this.lock;b.entity=this.entity.toJSON();return b}; +Entry.EntryObject.prototype.destroy=function(){Entry.stage.unloadEntity(this.entity);this.view_&&Entry.removeElement(this.view_)};Entry.EntryObject.prototype.getSound=function(b){b=b.trim();for(var a=this.sounds,c=a.length,d=0;d=b&&0=b-e/100*b&&f<=b+e/100*b&&g>=c-e/100*c&&g<=c+e/100*c&&a>=d-e/100*d&&a<=d+e/100*d};Entry.Painter.prototype.matchColorOnly=function(a,b,c,d){return b===this.colorLayerData.data[a]&&c===this.colorLayerData.data[a+1]&&d===this.colorLayerData.data[a+2]?!0:!1}; -Entry.Painter.prototype.matchColor=function(a,b,c,d,e){return b===this.colorLayerData.data[a]&&c===this.colorLayerData.data[a+1]&&d===this.colorLayerData.data[a+2]&&e===this.colorLayerData.data[a+3]?!0:!1};Entry.Painter.prototype.colorPixel=function(a,b,c,d,e){e||(e=255);this.stroke.transparent&&(e=d=c=b=0);this.colorLayerData.data[a]=b;this.colorLayerData.data[a+1]=c;this.colorLayerData.data[a+2]=d;this.colorLayerData.data[a+3]=e}; -Entry.Painter.prototype.pickStrokeColor=function(a){a=4*(Math.round(a.stageY)*this.canvas.width+Math.round(a.stageX));this.stroke.lineColor=Entry.rgb2hex(this.colorLayerData.data[a],this.colorLayerData.data[a+1],this.colorLayerData.data[a+2]);document.getElementById("entryPainterAttrCircle").style.backgroundColor=this.stroke.lineColor;document.getElementById("entryPainterAttrCircleInput").value=this.stroke.lineColor}; -Entry.Painter.prototype.drawText=function(a){var b=document.getElementById("entryPainterAttrFontStyle").value,c=document.getElementById("entryPainterAttrFontName").value,d=document.getElementById("entryPainterAttrFontSize").value;a=new createjs.Text(a,b+" "+d+'px "'+c+'"',this.stroke.lineColor);a.textBaseline="top";a.x=this.oldPt.x;a.y=this.oldPt.y;this.objectContainer.addChild(a);this.selectTextObject(a);this.file.modified=!0}; -Entry.Painter.prototype.addImage=function(a){var b=new createjs.Bitmap(a);this.objectContainer.addChild(b);b.x=this.stage.canvas.width/2;b.y=this.stage.canvas.height/2;b.regX=b.image.width/2|0;b.regY=b.image.height/2|0;if(540=a-e/100*a&&f<=a+e/100*a&&g>=c-e/100*c&&g<=c+e/100*c&&b>=d-e/100*d&&b<=d+e/100*d};Entry.Painter.prototype.matchColorOnly=function(b,a,c,d){return a===this.colorLayerData.data[b]&&c===this.colorLayerData.data[b+1]&&d===this.colorLayerData.data[b+2]?!0:!1}; +Entry.Painter.prototype.matchColor=function(b,a,c,d,e){return a===this.colorLayerData.data[b]&&c===this.colorLayerData.data[b+1]&&d===this.colorLayerData.data[b+2]&&e===this.colorLayerData.data[b+3]?!0:!1};Entry.Painter.prototype.colorPixel=function(b,a,c,d,e){e||(e=255);this.stroke.transparent&&(e=d=c=a=0);this.colorLayerData.data[b]=a;this.colorLayerData.data[b+1]=c;this.colorLayerData.data[b+2]=d;this.colorLayerData.data[b+3]=e}; +Entry.Painter.prototype.pickStrokeColor=function(b){b=4*(Math.round(b.stageY)*this.canvas.width+Math.round(b.stageX));this.stroke.lineColor=Entry.rgb2hex(this.colorLayerData.data[b],this.colorLayerData.data[b+1],this.colorLayerData.data[b+2]);document.getElementById("entryPainterAttrCircle").style.backgroundColor=this.stroke.lineColor;document.getElementById("entryPainterAttrCircleInput").value=this.stroke.lineColor}; +Entry.Painter.prototype.drawText=function(b){var a=document.getElementById("entryPainterAttrFontStyle").value,c=document.getElementById("entryPainterAttrFontName").value,d=document.getElementById("entryPainterAttrFontSize").value;b=new createjs.Text(b,a+" "+d+'px "'+c+'"',this.stroke.lineColor);b.textBaseline="top";b.x=this.oldPt.x;b.y=this.oldPt.y;this.objectContainer.addChild(b);this.selectTextObject(b);this.file.modified=!0}; +Entry.Painter.prototype.addImage=function(b){var a=new createjs.Bitmap(b);this.objectContainer.addChild(a);a.x=this.stage.canvas.width/2;a.y=this.stage.canvas.height/2;a.regX=a.image.width/2|0;a.regY=a.image.height/2|0;if(540>1,this.oldPt.y+this.stage.mouseY>>1);this.brush.graphics.setStrokeStyle(this.stroke.thickness,"round").beginStroke(this.stroke.lineColor).moveTo(a.x,a.y).curveTo(this.oldPt.x,this.oldPt.y,this.oldMidPt.x,this.oldMidPt.y);this.oldPt.x=this.stage.mouseX;this.oldPt.y=this.stage.mouseY;this.oldMidPt.x=a.x;this.oldMidPt.y=a.y;this.file.modified=!0;this.stage.update()}; +Entry.Painter.prototype.fill=function(){if(!this.stroke.locked){this.stroke.locked=!0;this.initCommand();this.doCommand();this.clearHandle();var b=this.canvas.width,a=this.canvas.height;this.colorLayerData=this.ctx.getImageData(0,0,b,a);var c=new createjs.Point(this.stage.mouseX,this.stage.mouseY);c.x=Math.round(c.x);c.y=Math.round(c.y);for(var d=4*(c.y*b+c.x),e=this.colorLayerData.data[d],f=this.colorLayerData.data[d+1],g=this.colorLayerData.data[d+2],h=this.colorLayerData.data[d+3],k,l,c=[[c.x, +c.y]],q=Entry.hex2rgb(this.stroke.lineColor);c.length;){for(var d=c.pop(),n=d[0],m=d[1],d=4*(m*b+n);0<=m&&this.matchColor(d,e,f,g,h);)--m,d-=4*b;d+=4*b;m+=1;for(l=k=!1;m>1,this.oldPt.y+this.stage.mouseY>>1);this.brush.graphics.setStrokeStyle(this.stroke.thickness,"round").beginStroke(this.stroke.lineColor).moveTo(b.x,b.y).curveTo(this.oldPt.x,this.oldPt.y,this.oldMidPt.x,this.oldMidPt.y);this.oldPt.x=this.stage.mouseX;this.oldPt.y=this.stage.mouseY;this.oldMidPt.x=b.x;this.oldMidPt.y=b.y;this.file.modified=!0;this.stage.update()}; Entry.Painter.prototype.move_line=function(){this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").moveTo(this.oldPt.x,this.oldPt.y).lineTo(this.stage.mouseX,this.stage.mouseY);this.file.modified=!0;this.stage.update()}; -Entry.Painter.prototype.move_rect=function(){var a=this.stage.mouseX-this.oldPt.x,b=this.stage.mouseY-this.oldPt.y;event.shiftKey&&(b=a);this.stroke.fill?0===this.stroke.thickness?this.brush.graphics.clear().setStrokeStyle(this.stroke.thickness,"round").beginFill(this.stroke.fillColor).drawRect(this.oldPt.x,this.oldPt.y,a,b):this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").beginFill(this.stroke.fillColor).drawRect(this.oldPt.x,this.oldPt.y, -a,b):0===this.stroke.thickness?this.brush.graphics.clear().setStrokeStyle(this.stroke.thickness,"round").drawRect(this.oldPt.x,this.oldPt.y,a,b):this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").drawRect(this.oldPt.x,this.oldPt.y,a,b);this.file.modified=!0;this.stage.update()}; -Entry.Painter.prototype.move_circle=function(){var a=this.stage.mouseX-this.oldPt.x,b=this.stage.mouseY-this.oldPt.y;event.shiftKey&&(b=a);this.stroke.fill?0===this.stroke.thickness?this.brush.graphics.clear().beginStroke(this.stroke.fillColor).setStrokeStyle(this.stroke.thickness,"round").beginFill(this.stroke.fillColor).drawEllipse(this.oldPt.x,this.oldPt.y,a,b):this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").beginFill(this.stroke.fillColor).drawEllipse(this.oldPt.x, -this.oldPt.y,a,b):this.stroke.fill||(0===this.stroke.thickness?this.brush.graphics.clear().drawEllipse(this.oldPt.x,this.oldPt.y,a,b):this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").drawEllipse(this.oldPt.x,this.oldPt.y,a,b));this.file.modified=!0;this.stage.update()}; +Entry.Painter.prototype.move_rect=function(){var b=this.stage.mouseX-this.oldPt.x,a=this.stage.mouseY-this.oldPt.y;event.shiftKey&&(a=b);this.stroke.fill?0===this.stroke.thickness?this.brush.graphics.clear().setStrokeStyle(this.stroke.thickness,"round").beginFill(this.stroke.fillColor).drawRect(this.oldPt.x,this.oldPt.y,b,a):this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").beginFill(this.stroke.fillColor).drawRect(this.oldPt.x,this.oldPt.y, +b,a):0===this.stroke.thickness?this.brush.graphics.clear().setStrokeStyle(this.stroke.thickness,"round").drawRect(this.oldPt.x,this.oldPt.y,b,a):this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").drawRect(this.oldPt.x,this.oldPt.y,b,a);this.file.modified=!0;this.stage.update()}; +Entry.Painter.prototype.move_circle=function(){var b=this.stage.mouseX-this.oldPt.x,a=this.stage.mouseY-this.oldPt.y;event.shiftKey&&(a=b);this.stroke.fill?0===this.stroke.thickness?this.brush.graphics.clear().beginStroke(this.stroke.fillColor).setStrokeStyle(this.stroke.thickness,"round").beginFill(this.stroke.fillColor).drawEllipse(this.oldPt.x,this.oldPt.y,b,a):this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").beginFill(this.stroke.fillColor).drawEllipse(this.oldPt.x, +this.oldPt.y,b,a):this.stroke.fill||(0===this.stroke.thickness?this.brush.graphics.clear().drawEllipse(this.oldPt.x,this.oldPt.y,b,a):this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").drawEllipse(this.oldPt.x,this.oldPt.y,b,a));this.file.modified=!0;this.stage.update()}; Entry.Painter.prototype.edit_copy=function(){this.selectArea?(this.clearHandle(),this.selectedObject&&delete this.selectedObject,this.copyLayerData=this.ctx.getImageData(this.selectArea.x1,this.selectArea.y1,this.selectArea.x2,this.selectArea.y2),this.copy={},this.copy.width=this.selectArea.x2,this.copy.height=this.selectArea.y2,this.canvas_.width=this.copy.width,this.canvas_.height=this.copy.height,this.ctx_.clearRect(0,0,this.canvas_.width,this.canvas_.height),this.ctx_.putImageData(this.copyLayerData, 0,0)):alert("\ubcf5\uc0ac\ud560 \uc601\uc5ed\uc744 \uc120\ud0dd\ud558\uc138\uc694.")}; Entry.Painter.prototype.edit_cut=function(){this.selectArea?(this.clearHandle(),this.selectedObject&&delete this.selectedObject,this.copyLayerData=this.ctx.getImageData(this.selectArea.x1,this.selectArea.y1,this.selectArea.x2,this.selectArea.y2),this.copy={},this.copy.width=this.selectArea.x2,this.copy.height=this.selectArea.y2,this.canvas_.width=this.copy.width,this.canvas_.height=this.copy.height,this.ctx_.clearRect(0,0,this.canvas_.width,this.canvas_.height),this.ctx_.putImageData(this.copyLayerData, 0,0),this.ctx.clearRect(this.selectArea.x1,this.selectArea.y1,this.selectArea.x2,this.selectArea.y2),this.colorLayerData=this.ctx.getImageData(0,0,this.canvas.width,this.canvas.height),this.reloadContext(),this.file.modified=!0):alert("\uc790\ub97c \uc601\uc5ed\uc744 \uc120\ud0dd\ud558\uc138\uc694.")}; -Entry.Painter.prototype.edit_paste=function(){var a=new Image;a.src=this.canvas_.toDataURL();var b=this;a.onload=function(a){a=new createjs.Bitmap(a.target);a.x=b.canvas.width/2;a.y=b.canvas.height/2;a.regX=b.copy.width/2|0;a.regY=b.copy.height/2|0;a.id=Entry.generateHash();b.objectContainer.addChild(a);b.selectObject(a,!0)};this.file.modified=!0}; +Entry.Painter.prototype.edit_paste=function(){var b=new Image;b.src=this.canvas_.toDataURL();var a=this;b.onload=function(b){b=new createjs.Bitmap(b.target);b.x=a.canvas.width/2;b.y=a.canvas.height/2;b.regX=a.copy.width/2|0;b.regY=a.copy.height/2|0;b.id=Entry.generateHash();a.objectContainer.addChild(b);a.selectObject(b,!0)};this.file.modified=!0}; Entry.Painter.prototype.edit_select=function(){this.clearHandle();this.selectedObject&&delete this.selectedObject;this.copyLayerData=this.ctx.getImageData(this.selectArea.x1,this.selectArea.y1,this.selectArea.x2,this.selectArea.y2);this.copy={};this.copy.width=this.selectArea.x2;this.copy.height=this.selectArea.y2;this.canvas_.width=this.copy.width;this.canvas_.height=this.copy.height;this.ctx_.clearRect(0,0,this.canvas_.width,this.canvas_.height);this.ctx_.putImageData(this.copyLayerData,0,0);this.ctx.clearRect(this.selectArea.x1, -this.selectArea.y1,this.selectArea.x2,this.selectArea.y2);this.colorLayerData=this.ctx.getImageData(0,0,this.canvas.width,this.canvas.height);this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);this.ctx.putImageData(this.colorLayerData,0,0);var a=new Image;a.src=this.canvas.toDataURL();var b=this;a.onload=function(a){a=new createjs.Bitmap(a.target);b.objectContainer.removeAllChildren();b.objectContainer.addChild(a);a=new Image;a.src=b.canvas_.toDataURL();a.onload=function(a){a=new createjs.Bitmap(a.target); -a.x=b.selectArea.x1+b.copy.width/2;a.y=b.selectArea.y1+b.copy.height/2;a.regX=b.copy.width/2|0;a.regY=b.copy.height/2|0;a.id=Entry.generateHash();a.name=a.id;b.objectContainer.addChild(a);b.selectObject(a,!0)}}}; -Entry.Painter.prototype.move_erase=function(a){a=new createjs.Point(this.oldPt.x+this.stage.mouseX>>1,this.oldPt.y+this.stage.mouseY>>1);this.eraser.graphics.setStrokeStyle(this.stroke.thickness,"round").beginStroke("#ffffff").moveTo(a.x,a.y).curveTo(this.oldPt.x,this.oldPt.y,this.oldMidPt.x,this.oldMidPt.y);this.oldPt.x=this.stage.mouseX;this.oldPt.y=this.stage.mouseY;this.oldMidPt.x=a.x;this.oldMidPt.y=a.y;this.file.modified=!0;this.stage.update()}; +this.selectArea.y1,this.selectArea.x2,this.selectArea.y2);this.colorLayerData=this.ctx.getImageData(0,0,this.canvas.width,this.canvas.height);this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);this.ctx.putImageData(this.colorLayerData,0,0);var b=new Image;b.src=this.canvas.toDataURL();var a=this;b.onload=function(b){b=new createjs.Bitmap(b.target);a.objectContainer.removeAllChildren();a.objectContainer.addChild(b);b=new Image;b.src=a.canvas_.toDataURL();b.onload=function(b){b=new createjs.Bitmap(b.target); +b.x=a.selectArea.x1+a.copy.width/2;b.y=a.selectArea.y1+a.copy.height/2;b.regX=a.copy.width/2|0;b.regY=a.copy.height/2|0;b.id=Entry.generateHash();b.name=b.id;a.objectContainer.addChild(b);a.selectObject(b,!0)}}}; +Entry.Painter.prototype.move_erase=function(b){b=new createjs.Point(this.oldPt.x+this.stage.mouseX>>1,this.oldPt.y+this.stage.mouseY>>1);this.eraser.graphics.setStrokeStyle(this.stroke.thickness,"round").beginStroke("#ffffff").moveTo(b.x,b.y).curveTo(this.oldPt.x,this.oldPt.y,this.oldMidPt.x,this.oldMidPt.y);this.oldPt.x=this.stage.mouseX;this.oldPt.y=this.stage.mouseY;this.oldMidPt.x=b.x;this.oldMidPt.y=b.y;this.file.modified=!0;this.stage.update()}; Entry.Painter.prototype.settingShapeBlur=function(){this.objectWidthInput.blur();this.objectHeightInput.blur();this.objectRotateInput.blur()}; -Entry.Painter.prototype.stagemousedown=function(a){"picture"==Entry.playground.getViewMode()&&(this.settingShapeBlur(),this.oldPt=new createjs.Point(a.stageX,a.stageY),this.oldMidPt=this.oldPt.clone(),"select"===this.toolbox.selected?this.stage.addChild(this._handle):"spoid"===this.toolbox.selected?this.pickStrokeColor(a):"text"===this.toolbox.selected?(this.showInputField(a),this.stage.update()):"erase"===this.toolbox.selected?(this.createEraser(),this.stroke.enabled=!0):"fill"===this.toolbox.selected? +Entry.Painter.prototype.stagemousedown=function(b){"picture"==Entry.playground.getViewMode()&&(this.settingShapeBlur(),this.oldPt=new createjs.Point(b.stageX,b.stageY),this.oldMidPt=this.oldPt.clone(),"select"===this.toolbox.selected?this.stage.addChild(this._handle):"spoid"===this.toolbox.selected?this.pickStrokeColor(b):"text"===this.toolbox.selected?(this.showInputField(b),this.stage.update()):"erase"===this.toolbox.selected?(this.createEraser(),this.stroke.enabled=!0):"fill"===this.toolbox.selected? this.fill():"cursor"!==this.toolbox.selected&&(this.createBrush(),this.stroke.enabled=!0))}; -Entry.Painter.prototype.stagemousemove=function(a){"picture"==Entry.playground.getViewMode()&&("select"===this.toolbox.selected&&-1this.value&&(this.value=360+this.value%360);b.handle.rotation=this.value;b.updateImageHandle()};this.objectRotateInput.addClass("entryPlaygroundPainterNumberInput");this.objectRotateInput.defaultValue= +c.addClass("painterAttrRotateTop");c.innerHTML="\u03bf";d.appendChild(c);this.objectRotateInput=Entry.createElement("input","entryPainterAttrDegree");this.objectRotateInput.onblur=function(){if(isNaN(this.value))return alert("\uc22b\uc790\ub9cc \uc785\ub825 \uac00\ub2a5\ud569\ub2c8\ub2e4."),!1;360<=this.value?this.value%=360:0>this.value&&(this.value=360+this.value%360);a.handle.rotation=this.value;a.updateImageHandle()};this.objectRotateInput.addClass("entryPlaygroundPainterNumberInput");this.objectRotateInput.defaultValue= "0";d.appendChild(this.objectRotateInput);this.attrColorArea=Entry.createElement("fieldset","entryPainterAttrColor");this.attrColorArea.addClass("entryPlaygroundPainterAttrColor");g.appendChild(this.attrColorArea);var q=Entry.createElement("div");q.addClass("entryPlaygroundPainterAttrColorContainer");this.attrColorArea.appendChild(q);this.attrCircleArea=Entry.createElement("div");this.attrCircleArea.addClass("painterAttrCircleArea");g.appendChild(this.attrCircleArea);d=Entry.createElement("div","entryPainterAttrCircle"); -d.addClass("painterAttrCircle");this.attrCircleArea.appendChild(d);this.attrCircleArea.painterAttrCircle=d;d=Entry.createElement("input","entryPainterAttrCircleInput");d.value="#000000";d.addClass("painterAttrCircleInput");this.attrCircleArea.appendChild(d);this.attrColorSpoid=Entry.createElement("div");this.attrColorSpoid.bindOnClick(function(){b.selectToolbox("spoid")});this.attrColorSpoid.addClass("painterAttrColorSpoid");g.appendChild(this.attrColorSpoid);Entry.getColourCodes().forEach(function(a){var c= -Entry.createElement("div");c.addClass("entryPlaygroundPainterAttrColorElement");"transparent"===a?c.style.backgroundImage="url("+(Entry.mediaFilePath+"/transparent.png")+")":c.style.backgroundColor=a;c.bindOnClick(function(c){"transparent"===a?(b.stroke.transparent=!0,b.stroke.lineColor="#ffffff"):(b.stroke.transparent=!1,r&&(document.getElementById("entryPainterShapeBackgroundColor").style.backgroundColor=a,b.stroke.fillColor=a),r||(document.getElementById("entryPainterShapeLineColor").style.backgroundColor= -a,b.stroke.lineColor=a));document.getElementById("entryPainterAttrCircle").style.backgroundColor=b.stroke.lineColor;document.getElementById("entryPainterAttrCircleInput").value=a});q.appendChild(c)});this.attrThickArea=Entry.createElement("div","painterAttrThickArea");this.attrThickArea.addClass("entryPlaygroundentryPlaygroundPainterAttrThickArea");g.appendChild(this.attrThickArea);d=Entry.createElement("legend");d.addClass("painterAttrThickName");d.innerHTML=Lang.Workspace.thickness;this.attrThickArea.appendChild(d); -var n=Entry.createElement("fieldset","entryPainterAttrThick");n.addClass("entryPlaygroundPainterAttrThick");this.attrThickArea.appendChild(n);d=Entry.createElement("div");d.addClass("paintAttrThickTop");n.appendChild(d);e=Entry.createElement("select","entryPainterAttrThick");e.addClass("entryPlaygroundPainterAttrThickInput");e.size="1";e.onchange=function(a){b.stroke.thickness=a.target.value};for(d=1;10>=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,e.appendChild(c);n.appendChild(e); +d.addClass("painterAttrCircle");this.attrCircleArea.appendChild(d);this.attrCircleArea.painterAttrCircle=d;d=Entry.createElement("input","entryPainterAttrCircleInput");d.value="#000000";d.addClass("painterAttrCircleInput");this.attrCircleArea.appendChild(d);this.attrColorSpoid=Entry.createElement("div");this.attrColorSpoid.bindOnClick(function(){a.selectToolbox("spoid")});this.attrColorSpoid.addClass("painterAttrColorSpoid");g.appendChild(this.attrColorSpoid);Entry.getColourCodes().forEach(function(b){var c= +Entry.createElement("div");c.addClass("entryPlaygroundPainterAttrColorElement");"transparent"===b?c.style.backgroundImage="url("+(Entry.mediaFilePath+"/transparent.png")+")":c.style.backgroundColor=b;c.bindOnClick(function(c){"transparent"===b?(a.stroke.transparent=!0,a.stroke.lineColor="#ffffff"):(a.stroke.transparent=!1,r&&(document.getElementById("entryPainterShapeBackgroundColor").style.backgroundColor=b,a.stroke.fillColor=b),r||(document.getElementById("entryPainterShapeLineColor").style.backgroundColor= +b,a.stroke.lineColor=b));document.getElementById("entryPainterAttrCircle").style.backgroundColor=a.stroke.lineColor;document.getElementById("entryPainterAttrCircleInput").value=b});q.appendChild(c)});this.attrThickArea=Entry.createElement("div","painterAttrThickArea");this.attrThickArea.addClass("entryPlaygroundentryPlaygroundPainterAttrThickArea");g.appendChild(this.attrThickArea);d=Entry.createElement("legend");d.addClass("painterAttrThickName");d.innerHTML=Lang.Workspace.thickness;this.attrThickArea.appendChild(d); +var n=Entry.createElement("fieldset","entryPainterAttrThick");n.addClass("entryPlaygroundPainterAttrThick");this.attrThickArea.appendChild(n);d=Entry.createElement("div");d.addClass("paintAttrThickTop");n.appendChild(d);e=Entry.createElement("select","entryPainterAttrThick");e.addClass("entryPlaygroundPainterAttrThickInput");e.size="1";e.onchange=function(b){a.stroke.thickness=b.target.value};for(d=1;10>=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,e.appendChild(c);n.appendChild(e); d=Entry.createElement("div","entryPainterShapeLineColor");d.addClass("painterAttrShapeLineColor");c=Entry.createElement("div","entryPainterShapeInnerBackground");c.addClass("painterAttrShapeInnerBackground");d.appendChild(c);n.appendChild(d);this.attrThickArea.painterAttrShapeLineColor=d;n.bindOnClick(function(){m.style.zIndex="1";this.style.zIndex="10";r=!1});this.attrBackgroundArea=Entry.createElement("div","painterAttrBackgroundArea");this.attrBackgroundArea.addClass("entryPlaygroundPainterBackgroundArea"); -g.appendChild(this.attrBackgroundArea);d=Entry.createElement("fieldset","entryPainterAttrbackground");d.addClass("entryPlaygroundPainterAttrBackground");this.attrBackgroundArea.appendChild(d);c=Entry.createElement("div");c.addClass("paintAttrBackgroundTop");d.appendChild(c);var m=Entry.createElement("div","entryPainterShapeBackgroundColor");m.addClass("painterAttrShapeBackgroundColor");this.attrBackgroundArea.painterAttrShapeBackgroundColor=m;c.appendChild(m);var r=!1;m.bindOnClick(function(b){n.style.zIndex= +g.appendChild(this.attrBackgroundArea);d=Entry.createElement("fieldset","entryPainterAttrbackground");d.addClass("entryPlaygroundPainterAttrBackground");this.attrBackgroundArea.appendChild(d);c=Entry.createElement("div");c.addClass("paintAttrBackgroundTop");d.appendChild(c);var m=Entry.createElement("div","entryPainterShapeBackgroundColor");m.addClass("painterAttrShapeBackgroundColor");this.attrBackgroundArea.painterAttrShapeBackgroundColor=m;c.appendChild(m);var r=!1;m.bindOnClick(function(a){n.style.zIndex= "1";this.style.zIndex="10";r=!0});this.attrFontArea=Entry.createElement("div","painterAttrFont");this.attrFontArea.addClass("entryPlaygroundPainterAttrFont");g.appendChild(this.attrFontArea);e=Entry.createElement("div");e.addClass("entryPlaygroundPainterAttrTop");this.attrFontArea.appendChild(e);d=Entry.createElement("div");d.addClass("entryPlaygroundPaintAttrTop_");e.appendChild(d);d=Entry.createElement("legend");d.addClass("panterAttrFontTitle");d.innerHTML=Lang.Workspace.textStyle;k=Entry.createElement("select", -"entryPainterAttrFontName");k.addClass("entryPlaygroundPainterAttrFontName");k.size="1";k.onchange=function(a){b.font.name=a.target.value};for(d=0;d=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,k.appendChild(c);e.appendChild(k);e=Entry.createElement("div");e.addClass("entryPlaygroundPainterAttrFontStyleArea");this.attrFontArea.appendChild(e);d=Entry.createElement("div");d.addClass("entryPlaygroundPainterAttrFontTop");e.appendChild(d);k=Entry.createElement("select","entryPainterAttrFontStyle"); -k.addClass("entryPlaygroundPainterAttrFontStyle");k.size="1";k.onchange=function(a){b.font.style=a.target.value};h=[{label:"\ubcf4\ud1b5",value:"normal"},{label:"\uad75\uac8c",value:"bold"},{label:"\uae30\uc6b8\uc784",value:"italic"}];for(d=0;d=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,k.appendChild(c);e.appendChild(k);e=Entry.createElement("div");e.addClass("entryPlaygroundPainterAttrFontStyleArea");this.attrFontArea.appendChild(e);d=Entry.createElement("div");d.addClass("entryPlaygroundPainterAttrFontTop");e.appendChild(d);k=Entry.createElement("select","entryPainterAttrFontStyle"); +k.addClass("entryPlaygroundPainterAttrFontStyle");k.size="1";k.onchange=function(b){a.font.style=b.target.value};h=[{label:"\ubcf4\ud1b5",value:"normal"},{label:"\uad75\uac8c",value:"bold"},{label:"\uae30\uc6b8\uc784",value:"italic"}];for(d=0;d"+d[1];c.addEventListener("click",function(){Entry.engine.toggleStop()});this.view_.appendChild(c);this.curtainView_=c;Entry.pictureEditable&&(c=Entry.createElement("div","entryPicture"),c.addClass("entryPlaygroundPictureWorkspace"),c.addClass("entryRemove"),this.view_.appendChild(c),this.generatePictureView(c),this.pictureView_=c);c=Entry.createElement("div","entryText");c.addClass("entryPlaygroundTextWorkspace");c.addClass("entryRemove");this.view_.appendChild(c);this.generateTextView(c); this.textView_=c;Entry.soundEditable&&(c=Entry.createElement("div","entrySound"),c.addClass("entryPlaygroundSoundWorkspace"),c.addClass("entryRemove"),this.view_.appendChild(c),this.generateSoundView(c),this.soundView_=c);c=Entry.createElement("div","entryDefault");c.addClass("entryPlaygroundDefaultWorkspace");this.view_.appendChild(c);this.generateDefaultView(c);this.defaultView_=c;c=Entry.createElement("div","entryCode");c.addClass("entryPlaygroundCodeWorkspace");c.addClass("entryRemove");this.view_.appendChild(c); -this.generateCodeView(c);this.codeView_=c;d=Entry.createElement("div");d.addClass("entryPlaygroundResizeWorkspace","entryRemove");this.resizeHandle_=d;this.view_.appendChild(d);this.initializeResizeHandle(d);this.codeView_=c;Entry.addEventListener("run",function(b){Entry.playground.curtainView_.removeClass("entryRemove")});Entry.addEventListener("stop",function(b){Entry.playground.curtainView_.addClass("entryRemove")})}};Entry.Playground.prototype.generateDefaultView=function(a){return a}; -Entry.Playground.prototype.generateTabView=function(a){var b=Entry.createElement("ul");b.addClass("entryTabListWorkspace");this.tabList_=b;a.appendChild(b);this.tabViewElements={};a=Entry.createElement("li","entryCodeTab");a.innerHTML=Lang.Workspace.tab_code;a.addClass("entryTabListItemWorkspace");a.addClass("entryTabSelected");b.appendChild(a);a.bindOnClick(function(b){Entry.playground.changeViewMode("code")});this.tabViewElements.code=a;Entry.pictureEditable&&(a=Entry.createElement("li","entryPictureTab"), -a.innerHTML=Lang.Workspace.tab_picture,a.addClass("entryTabListItemWorkspace"),b.appendChild(a),a.bindOnClick(function(b){Entry.playground.changeViewMode("picture")}),this.tabViewElements.picture=a,a=Entry.createElement("li","entryTextboxTab"),a.innerHTML=Lang.Workspace.tab_text,a.addClass("entryTabListItemWorkspace"),b.appendChild(a),a.bindOnClick(function(b){Entry.playground.changeViewMode("text")}),this.tabViewElements.text=a,a.addClass("entryRemove"));Entry.soundEditable&&(a=Entry.createElement("li", -"entrySoundTab"),a.innerHTML=Lang.Workspace.tab_sound,a.addClass("entryTabListItemWorkspace"),b.appendChild(a),a.bindOnClick(function(b){Entry.playground.changeViewMode("sound")}),this.tabViewElements.sound=a);Entry.hasVariableManager&&(a=Entry.createElement("li","entryVariableTab"),a.innerHTML=Lang.Workspace.tab_attribute,a.addClass("entryTabListItemWorkspace"),a.addClass("entryVariableTabWorkspace"),b.appendChild(a),a.bindOnClick(function(b){Entry.playground.toggleOnVariableView();Entry.playground.changeViewMode("variable")}), -this.tabViewElements.variable=a)}; -Entry.Playground.prototype.generateCodeView=function(a){if(!Entry.type||"workspace"==Entry.type){var b=Entry.createElement("div","entryCategory");b.addClass("entryCategoryWorkspace");a.appendChild(b);this.categoryView_=b;var c=Entry.createElement("ul","entryCategoryList");c.addClass("entryCategoryListWorkspace");b.appendChild(c);this.categoryListView_=c;var d=Entry.createElement("div","entryBlocklyWorkspace");d.addClass("entryBlockMenuWorkspace");a.appendChild(d);$(d).mouseenter(function(b){Entry.playground.resizing|| -(Entry.playground.focusBlockMenu=!0,b=Blockly.mainWorkspace.blockMenu.blockMenuWidth+84,b>Entry.interfaceState.menuWidth&&(this.widthBackup=Entry.interfaceState.menuWidth,$(".entryBlockMenuWorkspace>svg").stop().animate({width:b-64},200)))});$(d).mouseleave(function(b){Entry.playground.resizing||(d.widthBackup&&!Blockly.mainWorkspace.blockMenu.hasStalkerBlock&&$(".entryBlockMenuWorkspace>svg").stop().animate({width:this.widthBackup-64},200),delete this.widthBackup,delete Entry.playground.focusBlockMenu)}); -Entry.addEventListener("entryBlocklyChanged",function(b){b=Entry.playground.blockMenuView_;b.widthBackup&&Entry.resizeElement({menuWidth:b.widthBackup});delete b.widthBackup;delete Entry.playground.focusBlockMenu});this.blockMenuView_=d;b=this.createVariableView();a.appendChild(b);this.variableView_=b;b=Entry.createElement("div","entryBlockly");b.addClass("entryBlocklyWorkspace");this.blocklyView_=b;Entry.bindAnimationCallback(this.blocklyView_,function(b){Blockly.fireUiEvent(window,"resize");Entry.playground.blocklyView_.removeClass("foldOut")}); -a.appendChild(b);c=Entry.parseTexttoXML("");Blockly.inject(b,{path:Entry.blockInjectPath||".././",toolbox:c,trashcan:!0,blockmenu:this.blockMenuView_,mediaFilePath:Entry.mediaFilePath});Blockly.mainWorkspace.flyout_.hide();Blockly.mainWorkspace.blockMenu.hide();document.addEventListener("blocklyWorkspaceChange",this.syncObjectWithEvent,!1);this.blockMenu=Blockly.mainWorkspace.blockMenu;Entry.hw.banHW();return a}if("phone"==Entry.type)return b=Entry.createElement("div","entryCategory"), -b.addClass("entryCategoryPhone"),a.appendChild(b),this.categoryView_=b,c=Entry.createElement("ul","entryCategoryList"),c.addClass("entryCategoryListPhone"),b.appendChild(c),this.categoryListView_=c,b=this.createVariableView(),a.appendChild(b),this.variableView_=b,b=Entry.createElement("div","entryBlockly"),b.addClass("entryBlocklyPhone"),this.blocklyView_=b,a.appendChild(b),c=Entry.parseTexttoXML(""),Blockly.inject(b,{path:Entry.blockInjectPath||".././",toolbox:c,trashcan:!0,mediaFilePath:Entry.mediaFilePath}), -Blockly.mainWorkspace.flyout_.autoClose=!0,Blockly.mainWorkspace.flyout_.hide(),document.addEventListener("blocklyWorkspaceChange",this.syncObjectWithEvent,!1),this.blockMenu=Blockly.mainWorkspace.flyout_,Entry.hw.banHW(),a}; -Entry.Playground.prototype.generatePictureView=function(a){if("workspace"==Entry.type){var b=Entry.createElement("div","entryAddPicture");b.addClass("entryPlaygroundAddPicture");b.bindOnClick(function(b){Entry.dispatchEvent("openPictureManager")});var c=Entry.createElement("div","entryAddPictureInner");c.addClass("entryPlaygroundAddPictureInner");c.innerHTML=Lang.Workspace.picture_add;b.appendChild(c);a.appendChild(b);b=Entry.createElement("ul","entryPictureList");b.addClass("entryPlaygroundPictureList"); -$&&$(b).sortable({start:function(b,a){a.item.data("start_pos",a.item.index())},stop:function(b,a){var c=a.item.data("start_pos"),g=a.item.index();Entry.playground.movePicture(c,g)},axis:"y"});a.appendChild(b);this.pictureListView_=b;b=Entry.createElement("div","entryPainter");b.addClass("entryPlaygroundPainter");a.appendChild(b);this.painter=new Entry.Painter;this.painter.initialize(b)}else"phone"==Entry.type&&(b=Entry.createElement("div","entryAddPicture"),b.addClass("entryPlaygroundAddPicturePhone"), -b.bindOnClick(function(b){Entry.dispatchEvent("openPictureManager")}),c=Entry.createElement("div","entryAddPictureInner"),c.addClass("entryPlaygroundAddPictureInnerPhone"),c.innerHTML=Lang.Workspace.picture_add,b.appendChild(c),a.appendChild(b),b=Entry.createElement("ul","entryPictureList"),b.addClass("entryPlaygroundPictureListPhone"),$&&$(b).sortable({start:function(b,a){a.item.data("start_pos",a.item.index())},stop:function(b,a){var c=a.item.data("start_pos"),g=a.item.index();Entry.playground.movePicture(c, -g)},axis:"y"}),a.appendChild(b),this.pictureListView_=b)}; -Entry.Playground.prototype.generateTextView=function(a){var b=Entry.createElement("div");a.appendChild(b);a=Entry.createElement("div");a.addClass("textProperties");b.appendChild(a);var c=Entry.createElement("div");c.addClass("entryTextFontSelect");a.appendChild(c);var d=Entry.createElement("select","entryPainterAttrFontName");d.addClass("entryPlaygroundPainterAttrFontName","entryTextFontSelecter");d.size="1";d.onchange=function(b){Entry.playground.object.entity.setFontType(b.target.value)};for(var e= -0;eEntry.interfaceState.menuWidth&&(this.widthBackup=Entry.interfaceState.menuWidth,$(".entryBlockMenuWorkspace>svg").stop().animate({width:a-64},200)))});$(d).mouseleave(function(a){Entry.playground.resizing||(d.widthBackup&&!Blockly.mainWorkspace.blockMenu.hasStalkerBlock&&$(".entryBlockMenuWorkspace>svg").stop().animate({width:this.widthBackup-64},200),delete this.widthBackup,delete Entry.playground.focusBlockMenu)}); +Entry.addEventListener("entryBlocklyChanged",function(a){a=Entry.playground.blockMenuView_;a.widthBackup&&Entry.resizeElement({menuWidth:a.widthBackup});delete a.widthBackup;delete Entry.playground.focusBlockMenu});this.blockMenuView_=d;a=this.createVariableView();b.appendChild(a);this.variableView_=a;a=Entry.createElement("div","entryBlockly");a.addClass("entryBlocklyWorkspace");this.blocklyView_=a;Entry.bindAnimationCallback(this.blocklyView_,function(a){Blockly.fireUiEvent(window,"resize");Entry.playground.blocklyView_.removeClass("foldOut")}); +b.appendChild(a);c=Entry.parseTexttoXML("");Blockly.inject(a,{path:Entry.blockInjectPath||".././",toolbox:c,trashcan:!0,blockmenu:this.blockMenuView_,mediaFilePath:Entry.mediaFilePath});Blockly.mainWorkspace.flyout_.hide();Blockly.mainWorkspace.blockMenu.hide();document.addEventListener("blocklyWorkspaceChange",this.syncObjectWithEvent,!1);this.blockMenu=Blockly.mainWorkspace.blockMenu;Entry.hw.banHW();return b}if("phone"==Entry.type)return a=Entry.createElement("div","entryCategory"), +a.addClass("entryCategoryPhone"),b.appendChild(a),this.categoryView_=a,c=Entry.createElement("ul","entryCategoryList"),c.addClass("entryCategoryListPhone"),a.appendChild(c),this.categoryListView_=c,a=this.createVariableView(),b.appendChild(a),this.variableView_=a,a=Entry.createElement("div","entryBlockly"),a.addClass("entryBlocklyPhone"),this.blocklyView_=a,b.appendChild(a),c=Entry.parseTexttoXML(""),Blockly.inject(a,{path:Entry.blockInjectPath||".././",toolbox:c,trashcan:!0,mediaFilePath:Entry.mediaFilePath}), +Blockly.mainWorkspace.flyout_.autoClose=!0,Blockly.mainWorkspace.flyout_.hide(),document.addEventListener("blocklyWorkspaceChange",this.syncObjectWithEvent,!1),this.blockMenu=Blockly.mainWorkspace.flyout_,Entry.hw.banHW(),b}; +Entry.Playground.prototype.generatePictureView=function(b){if("workspace"==Entry.type){var a=Entry.createElement("div","entryAddPicture");a.addClass("entryPlaygroundAddPicture");a.bindOnClick(function(a){Entry.dispatchEvent("openPictureManager")});var c=Entry.createElement("div","entryAddPictureInner");c.addClass("entryPlaygroundAddPictureInner");c.innerHTML=Lang.Workspace.picture_add;a.appendChild(c);b.appendChild(a);a=Entry.createElement("ul","entryPictureList");a.addClass("entryPlaygroundPictureList"); +$&&$(a).sortable({start:function(a,b){b.item.data("start_pos",b.item.index())},stop:function(a,b){var c=b.item.data("start_pos"),g=b.item.index();Entry.playground.movePicture(c,g)},axis:"y"});b.appendChild(a);this.pictureListView_=a;a=Entry.createElement("div","entryPainter");a.addClass("entryPlaygroundPainter");b.appendChild(a);this.painter=new Entry.Painter;this.painter.initialize(a)}else"phone"==Entry.type&&(a=Entry.createElement("div","entryAddPicture"),a.addClass("entryPlaygroundAddPicturePhone"), +a.bindOnClick(function(a){Entry.dispatchEvent("openPictureManager")}),c=Entry.createElement("div","entryAddPictureInner"),c.addClass("entryPlaygroundAddPictureInnerPhone"),c.innerHTML=Lang.Workspace.picture_add,a.appendChild(c),b.appendChild(a),a=Entry.createElement("ul","entryPictureList"),a.addClass("entryPlaygroundPictureListPhone"),$&&$(a).sortable({start:function(a,b){b.item.data("start_pos",b.item.index())},stop:function(a,b){var c=b.item.data("start_pos"),g=b.item.index();Entry.playground.movePicture(c, +g)},axis:"y"}),b.appendChild(a),this.pictureListView_=a)}; +Entry.Playground.prototype.generateTextView=function(b){var a=Entry.createElement("div");b.appendChild(a);b=Entry.createElement("div");b.addClass("textProperties");a.appendChild(b);var c=Entry.createElement("div");c.addClass("entryTextFontSelect");b.appendChild(c);var d=Entry.createElement("select","entryPainterAttrFontName");d.addClass("entryPlaygroundPainterAttrFontName","entryTextFontSelecter");d.size="1";d.onchange=function(a){Entry.playground.object.entity.setFontType(a.target.value)};for(var e= +0;e p").html(Lang.Menus.linebreak_on_desc_1),$(".entryPlaygroundLinebreakDescription > ul > li").eq(0).html(Lang.Menus.linebreak_on_desc_2),$(".entryPlaygroundLinebreakDescription > ul > li").eq(1).html(Lang.Menus.linebreak_on_desc_3)); -Entry.playground.setFontAlign(Entry.playground.object.entity.getTextAlign());a=Entry.playground.object.entity.getFontSize();Entry.playground.fontSizeIndiciator.style.width=a+"%";Entry.playground.fontSizeKnob.style.left=.88*a+"px"}};Entry.Playground.prototype.injectSound=function(){var a=this.soundListView_;if(a){for(;a.hasChildNodes();)a.removeChild(a.lastChild);if(this.object)for(var b=this.object.sounds,c=0,d=b.length;c1010', -selectedPictureId:"vx80",objectType:"sprite",rotateMethod:"free",scene:"7dwq",sprite:{sounds:[{duration:1.3,ext:".mp3",id:"8el5",fileurl:a+"media/bark.mp3",name:Lang.Blocks.bark_dog}],pictures:[{id:"vx80",fileurl:a+"media/entrybot1.png",name:Lang.Blocks.walking_entryBot+"1",scale:100,dimension:{width:284,height:350}},{id:"4t48",fileurl:a+"media/entrybot2.png",name:Lang.Blocks.walking_entryBot+"2",scale:100,dimension:{width:284,height:350}}]},entity:{x:0,y:0,regX:142,regY:175,scaleX:.3154574132492113, +Entry.Popup.prototype.resize=function(b){b=window.popup.window_;var a=.9*window.innerWidth,c=.9*window.innerHeight-35;9*a<=16*c?c=a/16*9:a=16*c/9;b.style.width=String(a)+"px";b.style.height=String(c+35)+"px"};Entry.popupHelper=function(b){this.popupList={};this.nowContent;b&&(window.popupHelper=null);Entry.assert(!window.popupHelper,"Popup exist");var a=["confirm","spinner"],c=["entryPopupHelperTopSpan","entryPopupHelperBottomSpan","entryPopupHelperLeftSpan","entryPopupHelperRightSpan"];this.body_=Entry.Dom("div",{classes:["entryPopup","hiddenPopup","popupHelper"]});var d=this;this.body_.bindOnClick(function(b){if(!(d.nowContent&&-11010', +selectedPictureId:"vx80",objectType:"sprite",rotateMethod:"free",scene:"7dwq",sprite:{sounds:[{duration:1.3,ext:".mp3",id:"8el5",fileurl:b+"media/bark.mp3",name:Lang.Blocks.bark_dog}],pictures:[{id:"vx80",fileurl:b+"media/entrybot1.png",name:Lang.Blocks.walking_entryBot+"1",scale:100,dimension:{width:284,height:350}},{id:"4t48",fileurl:b+"media/entrybot2.png",name:Lang.Blocks.walking_entryBot+"2",scale:100,dimension:{width:284,height:350}}]},entity:{x:0,y:0,regX:142,regY:175,scaleX:.3154574132492113, scaleY:.3154574132492113,rotation:0,direction:90,width:284,height:350,visible:!0},lock:!1,active:!0}],speed:60}};Entry.PropertyPanel=function(){this.modes={};this.selected=null}; -(function(a){a.generateView=function(b,a){this._view=Entry.Dom("div",{class:"propertyPanel",parent:$(b)});this._tabView=Entry.Dom("div",{class:"propertyTab",parent:this._view});this._contentView=Entry.Dom("div",{class:"propertyContent",parent:this._view});var d=Entry.createElement("div");d.addClass("entryObjectSelectedImgWorkspace");this.selectedImgView_=d;this._view.append(d);this.initializeSplitter(d);this.splitter=d};a.addMode=function(b,a){var d=a.getView(),d=Entry.Dom(d,{parent:this._contentView}), -e=Entry.Dom("
"+b+"
",{classes:["propertyTabElement","propertyTab"+b],parent:this._tabView}),f=this;e.bind("click",function(){f.select(b)});this.modes[b]&&(this.modes[b].tabDom.remove(),this.modes[b].contentDom.remove(),"hw"==b&&($(this.modes).removeClass(".propertyTabhw"),$(".propertyTabhw").unbind("dblclick")));this.modes[b]={obj:a,tabDom:e,contentDom:d};"hw"==b&&$(".propertyTabhw").bind("dblclick",function(){Entry.dispatchEvent("hwModeChange")})};a.resize=function(b){this._view.css({width:b+ -"px",top:9*b/16+123-22+"px"});430<=b?this._view.removeClass("collapsed"):this._view.addClass("collapsed");Entry.dispatchEvent("windowResized");(b=this.modes[this.selected].obj.resize)&&"hw"!=this.selected?b():"hw"==this.selected&&this.modes.hw.obj.listPorts?this.modes[this.selected].obj.resizeList():"hw"==this.selected&&this.modes[this.selected].obj.resize()};a.select=function(b){for(var a in this.modes){var d=this.modes[a];d.tabDom.removeClass("selected");d.contentDom.addClass("entryHidden")}a=this.modes[b]; -a.tabDom.addClass("selected");a.contentDom.removeClass("entryHidden");a.obj.resize&&a.obj.resize();this.selected=b};a.initializeSplitter=function(b){b.onmousedown=function(b){Entry.container.disableSort();Entry.container.splitterEnable=!0};document.addEventListener("mousemove",function(b){Entry.container.splitterEnable&&Entry.resizeElement({canvasWidth:b.x||b.clientX})});document.addEventListener("mouseup",function(b){Entry.container.splitterEnable=!1;Entry.container.enableSort()})}})(Entry.PropertyPanel.prototype);Entry.init=function(a,b){Entry.assert("object"===typeof b,"Init option is not object");this.events_={};this.interfaceState={menuWidth:264};Entry.Utils.bindGlobalEvent(["mousedown","mousemove"]);this.options=b;this.parseOptions(b);this.mediaFilePath=(b.libDir?b.libDir:"/lib")+"/entryjs/images/";this.defaultPath=b.defaultDir||"";this.blockInjectPath=b.blockInjectDir||"";"workspace"==this.type&&this.isPhone()&&(this.type="phone");this.initialize_();this.view_=a;this.view_.setAttribute("class","entry"); -Entry.initFonts(b.fonts);this.createDom(a,this.type);this.loadInterfaceState();this.overridePrototype();this.maxCloneLimit=302;this.cloudSavable=!0;this.startTime=(new Date).getTime();document.onkeydown=function(b){Entry.dispatchEvent("keyPressed",b)};document.onkeyup=function(b){Entry.dispatchEvent("keyUpped",b)};window.onresize=function(b){Entry.dispatchEvent("windowResized",b)};window.onbeforeunload=this.beforeUnload;Entry.addEventListener("saveWorkspace",function(b){Entry.addActivity("save")}); +(function(b){b.generateView=function(a,b){this._view=Entry.Dom("div",{class:"propertyPanel",parent:$(a)});this._tabView=Entry.Dom("div",{class:"propertyTab",parent:this._view});this._contentView=Entry.Dom("div",{class:"propertyContent",parent:this._view});var d=Entry.createElement("div");d.addClass("entryObjectSelectedImgWorkspace");this.selectedImgView_=d;this._view.append(d);this.initializeSplitter(d);this.splitter=d};b.addMode=function(a,b){var d=b.getView(),d=Entry.Dom(d,{parent:this._contentView}), +e=Entry.Dom("
"+a+"
",{classes:["propertyTabElement","propertyTab"+a],parent:this._tabView}),f=this;e.bind("click",function(){f.select(a)});this.modes[a]&&(this.modes[a].tabDom.remove(),this.modes[a].contentDom.remove(),"hw"==a&&($(this.modes).removeClass(".propertyTabhw"),$(".propertyTabhw").unbind("dblclick")));this.modes[a]={obj:b,tabDom:e,contentDom:d};"hw"==a&&$(".propertyTabhw").bind("dblclick",function(){Entry.dispatchEvent("hwModeChange")})};b.resize=function(a){this._view.css({width:a+ +"px",top:9*a/16+123-22+"px"});430<=a?this._view.removeClass("collapsed"):this._view.addClass("collapsed");Entry.dispatchEvent("windowResized");(a=this.modes[this.selected].obj.resize)&&"hw"!=this.selected?a():"hw"==this.selected&&this.modes.hw.obj.listPorts?this.modes[this.selected].obj.resizeList():"hw"==this.selected&&this.modes[this.selected].obj.resize()};b.select=function(a){for(var b in this.modes){var d=this.modes[b];d.tabDom.removeClass("selected");d.contentDom.addClass("entryHidden")}b=this.modes[a]; +b.tabDom.addClass("selected");b.contentDom.removeClass("entryHidden");b.obj.resize&&b.obj.resize();this.selected=a};b.initializeSplitter=function(a){a.onmousedown=function(a){Entry.container.disableSort();Entry.container.splitterEnable=!0};document.addEventListener("mousemove",function(a){Entry.container.splitterEnable&&Entry.resizeElement({canvasWidth:a.x||a.clientX})});document.addEventListener("mouseup",function(a){Entry.container.splitterEnable=!1;Entry.container.enableSort()})}})(Entry.PropertyPanel.prototype);Entry.init=function(b,a){Entry.assert("object"===typeof a,"Init option is not object");this.events_={};this.interfaceState={menuWidth:264};Entry.Utils.bindGlobalEvent(["mousedown","mousemove"]);this.options=a;this.parseOptions(a);this.mediaFilePath=(a.libDir?a.libDir:"/lib")+"/entryjs/images/";this.defaultPath=a.defaultDir||"";this.blockInjectPath=a.blockInjectDir||"";"workspace"==this.type&&this.isPhone()&&(this.type="phone");this.initialize_();this.view_=b;this.view_.setAttribute("class","entry"); +Entry.initFonts(a.fonts);this.createDom(b,this.type);this.loadInterfaceState();this.overridePrototype();this.maxCloneLimit=302;this.cloudSavable=!0;this.startTime=(new Date).getTime();document.onkeydown=function(a){Entry.dispatchEvent("keyPressed",a)};document.onkeyup=function(a){Entry.dispatchEvent("keyUpped",a)};window.onresize=function(a){Entry.dispatchEvent("windowResized",a)};window.onbeforeunload=this.beforeUnload;Entry.addEventListener("saveWorkspace",function(a){Entry.addActivity("save")}); "IE"!=Entry.getBrowserType().substr(0,2)||window.flashaudio?createjs.Sound.registerPlugins([createjs.WebAudioPlugin]):(createjs.FlashAudioPlugin.swfPath=this.mediaFilePath+"media/",createjs.Sound.registerPlugins([createjs.FlashAudioPlugin]),window.flashaudio=!0);Entry.soundQueue=new createjs.LoadQueue;Entry.soundQueue.installPlugin(createjs.Sound);Entry.loadAudio_([Entry.mediaFilePath+"media/click.mp3",Entry.mediaFilePath+"media/click.wav",Entry.mediaFilePath+"media/click.ogg"],"click");Entry.loadAudio_([Entry.mediaFilePath+ -"media/delete.mp3",Entry.mediaFilePath+"media/delete.ogg",Entry.mediaFilePath+"media/delete.wav"],"delete")};Entry.loadAudio_=function(a,b){if(window.Audio&&a.length)for(;0d+55)&&b>40+a*(h-d)&&(h=c.getNextScene())&&(h=$(h.view),$(document).trigger("mouseup"), -h.trigger("mousedown"))});var d=Entry.createElement("ul");d.addClass("entrySceneListWorkspace");Entry.sceneEditable&&$&&$(d).sortable({start:function(b,a){a.item.data("start_pos",a.item.index());$(a.item[0]).clone(!0)},stop:function(b,a){var c=a.item.data("start_pos"),d=a.item.index();Entry.scene.moveScene(c,d)},axis:"x",tolerance:"pointer"});this.view_.appendChild(d);this.listView_=d;Entry.sceneEditable&&(d=Entry.createElement("span"),d.addClass("entrySceneElementWorkspace"),d.addClass("entrySceneAddButtonWorkspace"), -d.bindOnClick(function(b){Entry.engine.isState("run")||Entry.scene.addScene()}),this.view_.appendChild(d),this.addButton_=d)}}; -Entry.Scene.prototype.generateElement=function(a){var b=this,c=Entry.createElement("li",a.id);c.addClass("entrySceneElementWorkspace");c.addClass("entrySceneButtonWorkspace");c.addClass("minValue");$(c).on("mousedown",function(b){Entry.engine.isState("run")?b.preventDefault():Entry.scene.selectScene(a)});var d=Entry.createElement("input");d.addClass("entrySceneFieldWorkspace");d.value=a.name;Entry.sceneEditable||(d.disabled="disabled");var e=Entry.createElement("span");e.addClass("entrySceneLeftWorkspace"); -c.appendChild(e);var f=Entry.createElement("span");f.addClass("entrySceneInputCover");f.style.width=Entry.computeInputWidth(a.name);c.appendChild(f);a.inputWrapper=f;d.onkeyup=function(c){c=c.keyCode;Entry.isArrowOrBackspace(c)||(a.name=this.value,f.style.width=Entry.computeInputWidth(a.name),b.resize(),13==c&&this.blur(),9=this.getScenes().length)Entry.toast.alert(Lang.Msgs.runtime_error,Lang.Workspace.Scene_delete_error,!1);else{var b=this.getScenes().indexOf(this.getSceneById(a.id));this.getScenes().splice(b,1);this.selectScene();for(var b=Entry.container.getSceneObjects(a),c=0;c=this.maxCount)Entry.toast.alert(Lang.Msgs.runtime_error,Lang.Workspace.Scene_add_error,!1);else{var b={name:a.name+Lang.Workspace.replica_of_object,id:Entry.generateHash()};this.generateElement(b);this.addScene(b);a=Entry.container.getSceneObjects(a);for(var c=a.length-1;0<=c;c--)Entry.container.addCloneObject(a[c],b.id)}}; -Entry.Scene.prototype.resize=function(){var a=this.getScenes(),b=this.selectedScene,c=a[0];if(0!==a.length&&c){var d=$(c.view).offset().left,c=parseFloat($(b.view).css("margin-left")),e=$(this.view_).width()-d,f=0,g;for(g in a){var d=a[g],h=d.view;h.addClass("minValue");$(h).removeProp("style");$(d.inputWrapper).width(Entry.computeInputWidth(d.name));h=$(h);f=f+h.width()+c}if(f>e)for(g in e-=$(b.view).width(),c=e/(a.length-1)-(Entry.Scene.viewBasicWidth+c),a)d=a[g],b.id!=d.id?(d.view.removeClass("minValue"), -$(d.inputWrapper).width(c)):d.view.addClass("minValue")}};Entry.Scene.prototype.getNextScene=function(){var a=this.getScenes();return a[a.indexOf(this.selectedScene)+1]};Entry.Script=function(a){this.entity=a};p=Entry.Script.prototype; -p.init=function(a,b,c){Entry.assert("BLOCK"==a.tagName.toUpperCase(),a.tagName);this.type=a.getAttribute("type");this.id=+a.getAttribute("id");a.getElementsByTagName("mutation").length&&a.getElementsByTagName("mutation")[0].hasAttribute("hashid")&&(this.hashId=a.childNodes[0].getAttribute("hashid"));"REPEAT"==this.type.substr(0,6).toUpperCase()&&(this.isRepeat=!0);b instanceof Entry.Script&&(this.previousScript=b,b.parentScript&&(this.parentScript=b.parentScript));c instanceof Entry.Script&&(this.parentScript= -c);a=a.childNodes;for(b=0;bd+55)&&a>40+b*(h-d)&&(h=c.getNextScene())&&(h=$(h.view),$(document).trigger("mouseup"), +h.trigger("mousedown"))});var d=Entry.createElement("ul");d.addClass("entrySceneListWorkspace");Entry.sceneEditable&&$&&$(d).sortable({start:function(a,b){b.item.data("start_pos",b.item.index());$(b.item[0]).clone(!0)},stop:function(a,b){var c=b.item.data("start_pos"),d=b.item.index();Entry.scene.moveScene(c,d)},axis:"x",tolerance:"pointer"});this.view_.appendChild(d);this.listView_=d;Entry.sceneEditable&&(d=Entry.createElement("span"),d.addClass("entrySceneElementWorkspace"),d.addClass("entrySceneAddButtonWorkspace"), +d.bindOnClick(function(a){Entry.engine.isState("run")||Entry.scene.addScene()}),this.view_.appendChild(d),this.addButton_=d)}}; +Entry.Scene.prototype.generateElement=function(b){var a=this,c=Entry.createElement("li",b.id);c.addClass("entrySceneElementWorkspace");c.addClass("entrySceneButtonWorkspace");c.addClass("minValue");$(c).on("mousedown",function(a){Entry.engine.isState("run")?a.preventDefault():Entry.scene.selectScene(b)});var d=Entry.createElement("input");d.addClass("entrySceneFieldWorkspace");d.value=b.name;Entry.sceneEditable||(d.disabled="disabled");var e=Entry.createElement("span");e.addClass("entrySceneLeftWorkspace"); +c.appendChild(e);var f=Entry.createElement("span");f.addClass("entrySceneInputCover");f.style.width=Entry.computeInputWidth(b.name);c.appendChild(f);b.inputWrapper=f;d.onkeyup=function(c){c=c.keyCode;Entry.isArrowOrBackspace(c)||(b.name=this.value,f.style.width=Entry.computeInputWidth(b.name),a.resize(),13==c&&this.blur(),9=this.getScenes().length)Entry.toast.alert(Lang.Msgs.runtime_error,Lang.Workspace.Scene_delete_error,!1);else{var a=this.getScenes().indexOf(this.getSceneById(b.id));this.getScenes().splice(a,1);this.selectScene();for(var a=Entry.container.getSceneObjects(b),c=0;c=this.maxCount)Entry.toast.alert(Lang.Msgs.runtime_error,Lang.Workspace.Scene_add_error,!1);else{var a={name:b.name+Lang.Workspace.replica_of_object,id:Entry.generateHash()};this.generateElement(a);this.addScene(a);b=Entry.container.getSceneObjects(b);for(var c=b.length-1;0<=c;c--)Entry.container.addCloneObject(b[c],a.id)}}; +Entry.Scene.prototype.resize=function(){var b=this.getScenes(),a=this.selectedScene,c=b[0];if(0!==b.length&&c){var d=$(c.view).offset().left,c=parseFloat($(a.view).css("margin-left")),e=$(this.view_).width()-d,f=0,g;for(g in b){var d=b[g],h=d.view;h.addClass("minValue");$(h).removeProp("style");$(d.inputWrapper).width(Entry.computeInputWidth(d.name));h=$(h);f=f+h.width()+c}if(f>e)for(g in e-=$(a.view).width(),c=e/(b.length-1)-(Entry.Scene.viewBasicWidth+c),b)d=b[g],a.id!=d.id?(d.view.removeClass("minValue"), +$(d.inputWrapper).width(c)):d.view.addClass("minValue")}};Entry.Scene.prototype.getNextScene=function(){var b=this.getScenes();return b[b.indexOf(this.selectedScene)+1]};Entry.Script=function(b){this.entity=b};p=Entry.Script.prototype; +p.init=function(b,a,c){Entry.assert("BLOCK"==b.tagName.toUpperCase(),b.tagName);this.type=b.getAttribute("type");this.id=+b.getAttribute("id");b.getElementsByTagName("mutation").length&&b.getElementsByTagName("mutation")[0].hasAttribute("hashid")&&(this.hashId=b.childNodes[0].getAttribute("hashid"));"REPEAT"==this.type.substr(0,6).toUpperCase()&&(this.isRepeat=!0);a instanceof Entry.Script&&(this.previousScript=a,a.parentScript&&(this.parentScript=a.parentScript));c instanceof Entry.Script&&(this.parentScript= +c);b=b.childNodes;for(a=0;ab.getScaleX()?b.setScaleX(-a.width/b.width):b.setScaleX(a.width/b.width)),0!==b.height&&b.setScaleY(a.height/b.height));var c=a.rotation/180*Math.PI;if("textBox"==b.type){var d=a.regX/b.scaleX,d=a.regY/b.scaleY;if(b.getLineBreak())b.setX(a.x),b.setY(-a.y);else switch(b.getTextAlign()){case Entry.TEXT_ALIGN_LEFT:b.setX(a.x- -a.width/2*Math.cos(c));b.setY(-a.y+a.width/2*Math.sin(c));break;case Entry.TEXT_ALIGN_CENTER:b.setX(a.x);b.setY(-a.y);break;case Entry.TEXT_ALIGN_RIGHT:b.setX(a.x+a.width/2*Math.cos(c)),b.setY(-a.y-a.width/2*Math.sin(c))}}else d=b.width/2+a.regX/b.scaleX,b.setX(a.x+a.regX*Math.cos(c)-a.regY*Math.sin(c)),b.setRegX(d),d=b.height/2+a.regY/b.scaleY,b.setY(-a.y-a.regX*Math.sin(c)-a.regY*Math.cos(c)),b.setRegY(d);b.setDirection(a.direction);b.setRotation(a.rotation);this.selectedObject.entity.doCommand(); +Entry.Stage.prototype.updateObject=function(){this.handle.setDraggable(!0);if(!this.editEntity){var b=this.selectedObject;if(b){"textBox"==b.objectType?this.handle.toggleCenter(!1):this.handle.toggleCenter(!0);"free"==b.getRotateMethod()?this.handle.toggleRotation(!0):this.handle.toggleRotation(!1);this.handle.toggleDirection(!0);b.getLock()?(this.handle.toggleRotation(!1),this.handle.toggleDirection(!1),this.handle.toggleResize(!1),this.handle.toggleCenter(!1),this.handle.setDraggable(!1)):this.handle.toggleResize(!0); +this.handle.setVisible(!0);var a=b.entity;this.handle.setWidth(a.getScaleX()*a.getWidth());this.handle.setHeight(a.getScaleY()*a.getHeight());var c,d;if("textBox"==a.type)if(a.getLineBreak())c=a.regX*a.scaleX,d=-a.regY*a.scaleY;else{var e=a.getTextAlign();d=-a.regY*a.scaleY;switch(e){case Entry.TEXT_ALIGN_LEFT:c=-a.getWidth()/2*a.scaleX;break;case Entry.TEXT_ALIGN_CENTER:c=a.regX*a.scaleX;break;case Entry.TEXT_ALIGN_RIGHT:c=a.getWidth()/2*a.scaleX}}else c=(a.regX-a.width/2)*a.scaleX,d=(a.height/2- +a.regY)*a.scaleY;e=a.getRotation()/180*Math.PI;this.handle.setX(a.getX()-c*Math.cos(e)-d*Math.sin(e));this.handle.setY(-a.getY()-c*Math.sin(e)+d*Math.cos(e));this.handle.setRegX((a.regX-a.width/2)*a.scaleX);this.handle.setRegY((a.regY-a.height/2)*a.scaleY);this.handle.setRotation(a.getRotation());this.handle.setDirection(a.getDirection());this.objectUpdated=!0;this.handle.setVisible(b.entity.getVisible());b.entity.getVisible()&&this.handle.render()}else this.handle.setVisible(!1)}}; +Entry.Stage.prototype.updateHandle=function(){this.editEntity=!0;var b=this.handle,a=this.selectedObject.entity;a.lineBreak?(a.setHeight(b.height/a.getScaleY()),a.setWidth(b.width/a.getScaleX())):(0!==a.width&&(0>a.getScaleX()?a.setScaleX(-b.width/a.width):a.setScaleX(b.width/a.width)),0!==a.height&&a.setScaleY(b.height/a.height));var c=b.rotation/180*Math.PI;if("textBox"==a.type){var d=b.regX/a.scaleX,d=b.regY/a.scaleY;if(a.getLineBreak())a.setX(b.x),a.setY(-b.y);else switch(a.getTextAlign()){case Entry.TEXT_ALIGN_LEFT:a.setX(b.x- +b.width/2*Math.cos(c));a.setY(-b.y+b.width/2*Math.sin(c));break;case Entry.TEXT_ALIGN_CENTER:a.setX(b.x);a.setY(-b.y);break;case Entry.TEXT_ALIGN_RIGHT:a.setX(b.x+b.width/2*Math.cos(c)),a.setY(-b.y-b.width/2*Math.sin(c))}}else d=a.width/2+b.regX/a.scaleX,a.setX(b.x+b.regX*Math.cos(c)-b.regY*Math.sin(c)),a.setRegX(d),d=a.height/2+b.regY/a.scaleY,a.setY(-b.y-b.regX*Math.sin(c)-b.regY*Math.cos(c)),a.setRegY(d);a.setDirection(b.direction);a.setRotation(b.rotation);this.selectedObject.entity.doCommand(); this.editEntity=!1};Entry.Stage.prototype.startEdit=function(){this.selectedObject.entity.initCommand()};Entry.Stage.prototype.endEdit=function(){this.selectedObject.entity.checkCommand()}; -Entry.Stage.prototype.initWall=function(){var a=new createjs.Container,b=new Image;b.src=Entry.mediaFilePath+"media/bound.png";a.up=new createjs.Bitmap;a.up.scaleX=16;a.up.y=-165;a.up.x=-240;a.up.image=b;a.addChild(a.up);a.down=new createjs.Bitmap;a.down.scaleX=16;a.down.y=135;a.down.x=-240;a.down.image=b;a.addChild(a.down);a.right=new createjs.Bitmap;a.right.scaleY=9;a.right.y=-135;a.right.x=240;a.right.image=b;a.addChild(a.right);a.left=new createjs.Bitmap;a.left.scaleY=9;a.left.y=-135;a.left.x= --270;a.left.image=b;a.addChild(a.left);this.canvas.addChild(a);this.wall=a}; -Entry.Stage.prototype.showInputField=function(a){a=1/1.5;this.inputField||(this.inputField=new CanvasInput({canvas:document.getElementById("entryCanvas"),fontSize:30*a,fontFamily:"NanumGothic",fontColor:"#212121",width:556*a,height:26*a,padding:8*a,borderWidth:1*a,borderColor:"#000",borderRadius:3*a,boxShadow:"none",innerShadow:"0px 0px 5px rgba(0, 0, 0, 0.5)",x:202*a,y:450*a,topPosition:!0,onsubmit:function(){Entry.dispatchEvent("canvasInputComplete")}}));a=new createjs.Container;var b=new Image; -b.src=Entry.mediaFilePath+"confirm_button.png";var c=new createjs.Bitmap;c.scaleX=.23;c.scaleY=.23;c.x=160;c.y=89;c.cursor="pointer";c.image=b;a.addChild(c);a.on("mousedown",function(b){Entry.dispatchEvent("canvasInputComplete")});this.inputSubmitButton||(this.inputField.value(""),this.canvas.addChild(a),this.inputSubmitButton=a);this.inputField.show()}; +Entry.Stage.prototype.initWall=function(){var b=new createjs.Container,a=new Image;a.src=Entry.mediaFilePath+"media/bound.png";b.up=new createjs.Bitmap;b.up.scaleX=16;b.up.y=-165;b.up.x=-240;b.up.image=a;b.addChild(b.up);b.down=new createjs.Bitmap;b.down.scaleX=16;b.down.y=135;b.down.x=-240;b.down.image=a;b.addChild(b.down);b.right=new createjs.Bitmap;b.right.scaleY=9;b.right.y=-135;b.right.x=240;b.right.image=a;b.addChild(b.right);b.left=new createjs.Bitmap;b.left.scaleY=9;b.left.y=-135;b.left.x= +-270;b.left.image=a;b.addChild(b.left);this.canvas.addChild(b);this.wall=b}; +Entry.Stage.prototype.showInputField=function(b){b=1/1.5;this.inputField||(this.inputField=new CanvasInput({canvas:document.getElementById("entryCanvas"),fontSize:30*b,fontFamily:"NanumGothic",fontColor:"#212121",width:556*b,height:26*b,padding:8*b,borderWidth:1*b,borderColor:"#000",borderRadius:3*b,boxShadow:"none",innerShadow:"0px 0px 5px rgba(0, 0, 0, 0.5)",x:202*b,y:450*b,topPosition:!0,onsubmit:function(){Entry.dispatchEvent("canvasInputComplete")}}));b=new createjs.Container;var a=new Image; +a.src=Entry.mediaFilePath+"confirm_button.png";var c=new createjs.Bitmap;c.scaleX=.23;c.scaleY=.23;c.x=160;c.y=89;c.cursor="pointer";c.image=a;b.addChild(c);b.on("mousedown",function(a){Entry.dispatchEvent("canvasInputComplete")});this.inputSubmitButton||(this.inputField.value(""),this.canvas.addChild(b),this.inputSubmitButton=b);this.inputField.show()}; Entry.Stage.prototype.hideInputField=function(){this.inputField&&this.inputField.value()&&this.inputField.value("");this.inputSubmitButton&&(this.canvas.removeChild(this.inputSubmitButton),this.inputSubmitButton=null);this.inputField&&this.inputField.hide()}; -Entry.Stage.prototype.initObjectContainers=function(){var a=Entry.scene.scenes_;if(a&&0!==a.length){for(var b=0;bd.style.opacity&&(clearInterval(b),d.style.display="none",Entry.removeElement(d));d.style.opacity*=.9},20)},1E3)}; -Entry.Toast.prototype.success=function(a,b,c){var d=Entry.createElement("div","entryToast");d.addClass("entryToast");d.addClass("entryToastSuccess");d.bindOnClick(function(){Entry.toast.body_.removeChild(this)});var e=Entry.createElement("div","entryToast");e.addClass("entryToastTitle");e.innerHTML=a;d.appendChild(e);a=Entry.createElement("p","entryToast");a.addClass("entryToastMessage");a.innerHTML=b;d.appendChild(a);this.toasts_.push(d);this.body_.appendChild(d);c||window.setTimeout(function(){d.style.opacity= -1;var b=setInterval(function(){.05>d.style.opacity&&(clearInterval(b),d.style.display="none",Entry.removeElement(d));d.style.opacity*=.9},20)},1E3)}; -Entry.Toast.prototype.alert=function(a,b,c){var d=Entry.createElement("div","entryToast");d.addClass("entryToast");d.addClass("entryToastAlert");d.bindOnClick(function(){Entry.toast.body_.removeChild(this)});var e=Entry.createElement("div","entryToast");e.addClass("entryToastTitle");e.innerHTML=a;d.appendChild(e);a=Entry.createElement("p","entryToast");a.addClass("entryToastMessage");a.innerHTML=b;d.appendChild(a);this.toasts_.push(d);this.body_.appendChild(d);c||window.setTimeout(function(){d.style.opacity= -1;var b=setInterval(function(){.05>d.style.opacity&&(clearInterval(b),d.style.display="none",Entry.toast.body_.removeChild(d));d.style.opacity*=.9},20)},5E3)};Entry.TvCast=function(a){this.generateView(a)};p=Entry.TvCast.prototype;p.init=function(a){this.tvCastHash=a};p.generateView=function(a){var b=Entry.createElement("div");b.addClass("entryContainerMovieWorkspace");b.addClass("entryHidden");this.movieContainer=b;b=Entry.createElement("iframe");b.setAttribute("id","tvCastIframe");b.setAttribute("allowfullscreen","");b.setAttribute("frameborder",0);b.setAttribute("src",a);this.movieFrame=b;this.movieContainer.appendChild(this.movieFrame)};p.getView=function(){return this.movieContainer}; -p.resize=function(){var a=document.getElementById("entryContainerWorkspaceId"),b=document.getElementById("tvCastIframe");w=a.offsetWidth;b.width=w+"px";b.height=9*w/16+"px"};Entry.ContextMenu={}; -(function(a){a.createDom=function(){this.dom=Entry.Dom("ul",{id:"entry-contextmenu",parent:$("body")});Entry.Utils.disableContextmenu(this.dom);Entry.documentMousedown.attach(this,function(){this.hide()})};a.show=function(b,a){this.dom||this.createDom();if(0!==b.length){var d=this;void 0!==a&&(this._className=a,this.dom.addClass(a));var e=this.dom;e.empty();for(var f=0,g=b.length;fg&&(b.x-=d+3);b.y+e>f&&(b.y-=e);a.css({left:b.x,top:b.y})};a.hide=function(){this.dom.empty();this.dom.addClass("entryRemove");this._className&&(this.dom.removeClass(this._className),delete this._className)}})(Entry.ContextMenu);Entry.STATIC={OBJECT:0,ENTITY:1,SPRITE:2,SOUND:3,VARIABLE:4,FUNCTION:5,SCENE:6,MESSAGE:7,BLOCK_MODEL:8,BLOCK_RENDER_MODEL:9,BOX_MODEL:10,THREAD_MODEL:11,DRAG_INSTANCE:12,BLOCK_STATIC:0,BLOCK_MOVE:1,BLOCK_FOLLOW:2,RETURN:0,CONTINUE:1};Entry.Utils={};Entry.overridePrototype=function(){Number.prototype.mod=function(a){return(this%a+a)%a}};Entry.Utils.generateId=function(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).substr(-4)};Entry.Utils.intersectArray=function(a,b){for(var c=[],d=0;d=b.x&&e-c<=b.y&&e+a.height+c>=b.y}; -Entry.Utils.colorDarken=function(a,b){var c,d,e;7===a.length?(c=parseInt(a.substr(1,2),16),d=parseInt(a.substr(3,2),16),e=parseInt(a.substr(5,2),16)):(c=parseInt(a.substr(1,2),16),d=parseInt(a.substr(2,2),16),e=parseInt(a.substr(3,2),16));b=void 0===b?.7:b;c=Math.floor(c*b).toString(16);d=Math.floor(d*b).toString(16);e=Math.floor(e*b).toString(16);return"#"+c+d+e}; -Entry.Utils.bindGlobalEvent=function(a){void 0===a&&(a=["resize","mousedown","mousemove","keydown","keyup"]);!Entry.windowReszied&&-1Entry.pressedKeys.indexOf(a)&&Entry.pressedKeys.push(a);Entry.keyPressed.notify(b)}));!Entry.keyUpped&&-1$1://$2").replace(/([xA1-xFEa-z0-9_-]+@[xA1-xFEa-z0-9-]+.[a-z0-9-]+)/gi,"$1"):""};Entry.generateHash=function(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).substr(-4)}; -Entry.addEventListener=function(a,b){this.events_||(this.events_={});this.events_[a]||(this.events_[a]=[]);b instanceof Function&&this.events_[a].push(b);return!0};Entry.dispatchEvent=function(a,b){this.events_||(this.events_={});if(this.events_[a])for(var c=0,d=this.events_[a].length;c=f?(parseFloat(a)+parseFloat(b)).toFixed(e):(parseFloat(a)+parseFloat(b)).toFixed(f):parseInt(a)+parseInt(b)}; -Entry.hex2rgb=function(a){return(a=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a))?{r:parseInt(a[1],16),g:parseInt(a[2],16),b:parseInt(a[3],16)}:null};Entry.rgb2hex=function(a,b,c){return"#"+(16777216+(a<<16)+(b<<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(a,b,c){return a>c?c:ad.style.opacity&&(clearInterval(a),d.style.display="none",Entry.removeElement(d));d.style.opacity*=.9},20)},1E3)}; +Entry.Toast.prototype.success=function(b,a,c){var d=Entry.createElement("div","entryToast");d.addClass("entryToast");d.addClass("entryToastSuccess");d.bindOnClick(function(){Entry.toast.body_.removeChild(this)});var e=Entry.createElement("div","entryToast");e.addClass("entryToastTitle");e.innerHTML=b;d.appendChild(e);b=Entry.createElement("p","entryToast");b.addClass("entryToastMessage");b.innerHTML=a;d.appendChild(b);this.toasts_.push(d);this.body_.appendChild(d);c||window.setTimeout(function(){d.style.opacity= +1;var a=setInterval(function(){.05>d.style.opacity&&(clearInterval(a),d.style.display="none",Entry.removeElement(d));d.style.opacity*=.9},20)},1E3)}; +Entry.Toast.prototype.alert=function(b,a,c){var d=Entry.createElement("div","entryToast");d.addClass("entryToast");d.addClass("entryToastAlert");d.bindOnClick(function(){Entry.toast.body_.removeChild(this)});var e=Entry.createElement("div","entryToast");e.addClass("entryToastTitle");e.innerHTML=b;d.appendChild(e);b=Entry.createElement("p","entryToast");b.addClass("entryToastMessage");b.innerHTML=a;d.appendChild(b);this.toasts_.push(d);this.body_.appendChild(d);c||window.setTimeout(function(){d.style.opacity= +1;var a=setInterval(function(){.05>d.style.opacity&&(clearInterval(a),d.style.display="none",Entry.toast.body_.removeChild(d));d.style.opacity*=.9},20)},5E3)};Entry.TvCast=function(b){this.generateView(b)};p=Entry.TvCast.prototype;p.init=function(b){this.tvCastHash=b};p.generateView=function(b){var a=Entry.createElement("div");a.addClass("entryContainerMovieWorkspace");a.addClass("entryHidden");this.movieContainer=a;a=Entry.createElement("iframe");a.setAttribute("id","tvCastIframe");a.setAttribute("allowfullscreen","");a.setAttribute("frameborder",0);a.setAttribute("src",b);this.movieFrame=a;this.movieContainer.appendChild(this.movieFrame)};p.getView=function(){return this.movieContainer}; +p.resize=function(){var b=document.getElementById("entryContainerWorkspaceId"),a=document.getElementById("tvCastIframe");w=b.offsetWidth;a.width=w+"px";a.height=9*w/16+"px"};Entry.ContextMenu={}; +(function(b){b.createDom=function(){this.dom=Entry.Dom("ul",{id:"entry-contextmenu",parent:$("body")});Entry.Utils.disableContextmenu(this.dom);Entry.documentMousedown.attach(this,function(){this.hide()})};b.show=function(a,b){this.dom||this.createDom();if(0!==a.length){var d=this;void 0!==b&&(this._className=b,this.dom.addClass(b));var e=this.dom;e.empty();for(var f=0,g=a.length;fg&&(a.x-=d+3);a.y+e>f&&(a.y-=e);b.css({left:a.x,top:a.y})};b.hide=function(){this.dom.empty();this.dom.addClass("entryRemove");this._className&&(this.dom.removeClass(this._className),delete this._className)}})(Entry.ContextMenu);Entry.STATIC={OBJECT:0,ENTITY:1,SPRITE:2,SOUND:3,VARIABLE:4,FUNCTION:5,SCENE:6,MESSAGE:7,BLOCK_MODEL:8,BLOCK_RENDER_MODEL:9,BOX_MODEL:10,THREAD_MODEL:11,DRAG_INSTANCE:12,BLOCK_STATIC:0,BLOCK_MOVE:1,BLOCK_FOLLOW:2,RETURN:0,CONTINUE:1};Entry.Utils={};Entry.overridePrototype=function(){Number.prototype.mod=function(b){return(this%b+b)%b}};Entry.Utils.generateId=function(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).substr(-4)};Entry.Utils.intersectArray=function(b,a){for(var c=[],d=0;d=a.x&&e-c<=a.y&&e+b.height+c>=a.y}; +Entry.Utils.colorDarken=function(b,a){var c,d,e;7===b.length?(c=parseInt(b.substr(1,2),16),d=parseInt(b.substr(3,2),16),e=parseInt(b.substr(5,2),16)):(c=parseInt(b.substr(1,2),16),d=parseInt(b.substr(2,2),16),e=parseInt(b.substr(3,2),16));a=void 0===a?.7:a;c=Math.floor(c*a).toString(16);d=Math.floor(d*a).toString(16);e=Math.floor(e*a).toString(16);return"#"+c+d+e}; +Entry.Utils.bindGlobalEvent=function(b){void 0===b&&(b=["resize","mousedown","mousemove","keydown","keyup"]);!Entry.windowReszied&&-1Entry.pressedKeys.indexOf(b)&&Entry.pressedKeys.push(b);Entry.keyPressed.notify(a)}));!Entry.keyUpped&&-1$1://$2").replace(/([xA1-xFEa-z0-9_-]+@[xA1-xFEa-z0-9-]+.[a-z0-9-]+)/gi,"$1"):""};Entry.generateHash=function(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).substr(-4)}; +Entry.addEventListener=function(b,a){this.events_||(this.events_={});this.events_[b]||(this.events_[b]=[]);a instanceof Function&&this.events_[b].push(a);return!0};Entry.dispatchEvent=function(b,a){this.events_||(this.events_={});if(this.events_[b])for(var c=0,d=this.events_[b].length;c=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:bb.y+b.height||a.x+a.widthb.x+b.width)};Entry.bindAnimationCallback=function(a,b){a.addEventListener("webkitAnimationEnd",b,!1);a.addEventListener("animationend",b,!1);a.addEventListener("oanimationend",b,!1)};Entry.cloneSimpleObject=function(a){var b={},c;for(c in a)b[c]=a[c];return b};Entry.nodeListToArray=function(a){for(var b=Array(a.length),c=-1,d=a.length;++c!==d;b[c]=a[c]);return b}; -Entry.computeInputWidth=function(a){var b=document.createElement("span");b.className="tmp-element";b.innerHTML=a.replace(/&/g,"&").replace(//g,">");document.body.appendChild(b);a=b.offsetWidth;document.body.removeChild(b);return+(a+10)+"px"};Entry.isArrowOrBackspace=function(a){return-1<[37,38,39,40,8].indexOf(a)};Entry.hexStringToBin=function(a){for(var b=[],c=0;cd&&(d=h.index)}return 0b&&(b=e))}return Math.min(b,20)};Entry.convertToRoundedDecimals=function(a,b){return isNaN(a)||!this.isFloat(a)?a:+(Math.round(a+"e"+b)+"e-"+b)};Entry.attachEventListener=function(a,b,c){setTimeout(function(){a.addEventListener(b,c)},0)};Entry.deAttachEventListener=function(a,b,c){a.removeEventListener(b,c)}; -Entry.isEmpty=function(a){if(!a)return!0;for(var b in a)if(a.hasOwnProperty(b))return!1;return!0};Entry.Utils.disableContextmenu=function(a){if(a)$(a).on("contextmenu",function(b){b.stopPropagation();b.preventDefault();return!1})};Entry.Utils.isRightButton=function(a){return 2==a.button||a.ctrlKey};Entry.Utils.COLLISION={NONE:0,UP:1,RIGHT:2,LEFT:3,DOWN:4};Entry.Model=function(a,b){var c=Entry.Model;c.generateSchema(a);c.generateSetter(a);c.generateObserve(a);(void 0===b||b)&&Object.seal(a);return a}; -(function(a){a.generateSchema=function(b){var a=b.schema;if(void 0!==a){a=JSON.parse(JSON.stringify(a));b.data={};for(var d in a)(function(d){b.data[d]=a[d];Object.defineProperty(b,d,{get:function(){return b.data[d]}})})(d);b._toJSON=this._toJSON}};a.generateSetter=function(b){b.set=this.set};a.set=function(b,a){var d={},e;for(e in this.data)void 0!==b[e]&&(b[e]===this.data[e]?delete b[e]:(d[e]=this.data[e],this.data[e]=b[e]));a||this.notify(Object.keys(b),d)};a.generateObserve=function(b){b.observers= -[];b.observe=this.observe;b.unobserve=this.unobserve;b.notify=this.notify};a.observe=function(b,a,d,e){d=new Entry.Observer(this.observers,b,a,d);if(!1!==e)b[a]([]);return d};a.unobserve=function(b){b.destroy()};a.notify=function(b,a){"string"===typeof b&&(b=[b]);var d=this;d.observers.map(function(e){var f=b;void 0!==e.attrs&&(f=Entry.Utils.intersectArray(e.attrs,b));if(f.length)e.object[e.funcName](f.map(function(b){return{name:b,object:d,oldValue:a[b]}}))})};a._toJSON=function(){var b={},a;for(a in this.data)b[a]= -this.data[a];return b}})(Entry.Model);Entry.Func=function(){this.id=Entry.generateHash();this.content=Blockly.Xml.textToDom(Entry.Func.CREATE_BLOCK);this.block=null;this.stringHash={};this.booleanHash={}};Entry.Func.threads={};Entry.Func.registerFunction=function(a,b){var c=Entry.generateHash(),d=Entry.variableContainer.getFunction(a),e=new Entry.Script(b);e.init(d.content.childNodes[0]);this.threads[c]=e;return c}; -Entry.Func.executeFunction=function(a){var b=this.threads[a];if(b=Entry.Engine.computeThread(b.entity,b))return this.threads[a]=b,!0;delete this.threads[a];return!1};Entry.Func.clearThreads=function(){this.threads={}};Entry.Func.prototype.init=function(a){this.id=a.id;this.content=Blockly.Xml.textToDom(a.content);this.block=Blockly.Xml.textToDom(""+a.block+"").childNodes[0]};Entry.Func.CREATE_BTN=''; +Entry.checkCollisionRect=function(b,a){return!(b.y+b.heighta.y+a.height||b.x+b.widtha.x+a.width)};Entry.bindAnimationCallback=function(b,a){b.addEventListener("webkitAnimationEnd",a,!1);b.addEventListener("animationend",a,!1);b.addEventListener("oanimationend",a,!1)};Entry.cloneSimpleObject=function(b){var a={},c;for(c in b)a[c]=b[c];return a};Entry.nodeListToArray=function(b){for(var a=Array(b.length),c=-1,d=b.length;++c!==d;a[c]=b[c]);return a}; +Entry.computeInputWidth=function(b){var a=document.createElement("span");a.className="tmp-element";a.innerHTML=b.replace(/&/g,"&").replace(//g,">");document.body.appendChild(a);b=a.offsetWidth;document.body.removeChild(a);return+(b+10)+"px"};Entry.isArrowOrBackspace=function(b){return-1<[37,38,39,40,8].indexOf(b)};Entry.hexStringToBin=function(b){for(var a=[],c=0;cd&&(d=h.index)}return 0a&&(a=e))}return Math.min(a,20)};Entry.convertToRoundedDecimals=function(b,a){return isNaN(b)||!this.isFloat(b)?b:+(Math.round(b+"e"+a)+"e-"+a)};Entry.attachEventListener=function(b,a,c){setTimeout(function(){b.addEventListener(a,c)},0)};Entry.deAttachEventListener=function(b,a,c){b.removeEventListener(a,c)}; +Entry.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.COLLISION={NONE:0,UP:1,RIGHT:2,LEFT:3,DOWN:4};Entry.Model=function(b,a){var c=Entry.Model;c.generateSchema(b);c.generateSetter(b);c.generateObserve(b);(void 0===a||a)&&Object.seal(b);return b}; +(function(b){b.generateSchema=function(a){var b=a.schema;if(void 0!==b){b=JSON.parse(JSON.stringify(b));a.data={};for(var d in b)(function(d){a.data[d]=b[d];Object.defineProperty(a,d,{get:function(){return a.data[d]}})})(d);a._toJSON=this._toJSON}};b.generateSetter=function(a){a.set=this.set};b.set=function(a,b){var d={},e;for(e in this.data)void 0!==a[e]&&(a[e]===this.data[e]?delete a[e]:(d[e]=this.data[e],this.data[e]=a[e]));b||this.notify(Object.keys(a),d)};b.generateObserve=function(a){a.observers= +[];a.observe=this.observe;a.unobserve=this.unobserve;a.notify=this.notify};b.observe=function(a,b,d,e){d=new Entry.Observer(this.observers,a,b,d);if(!1!==e)a[b]([]);return d};b.unobserve=function(a){a.destroy()};b.notify=function(a,b){"string"===typeof a&&(a=[a]);var d=this;d.observers.map(function(e){var f=a;void 0!==e.attrs&&(f=Entry.Utils.intersectArray(e.attrs,a));if(f.length)e.object[e.funcName](f.map(function(a){return{name:a,object:d,oldValue:b[a]}}))})};b._toJSON=function(){var a={},b;for(b in this.data)a[b]= +this.data[b];return a}})(Entry.Model);Entry.Func=function(){this.id=Entry.generateHash();this.content=Blockly.Xml.textToDom(Entry.Func.CREATE_BLOCK);this.block=null;this.stringHash={};this.booleanHash={}};Entry.Func.threads={};Entry.Func.registerFunction=function(b,a){var c=Entry.generateHash(),d=Entry.variableContainer.getFunction(b),e=new Entry.Script(a);e.init(d.content.childNodes[0]);this.threads[c]=e;return c}; +Entry.Func.executeFunction=function(b){var a=this.threads[b];if(a=Entry.Engine.computeThread(a.entity,a))return this.threads[b]=a,!0;delete this.threads[b];return!1};Entry.Func.clearThreads=function(){this.threads={}};Entry.Func.prototype.init=function(b){this.id=b.id;this.content=Blockly.Xml.textToDom(b.content);this.block=Blockly.Xml.textToDom(""+b.block+"").childNodes[0]};Entry.Func.CREATE_BTN=''; Entry.Func.createBtn=Entry.nodeListToArray(Blockly.Xml.textToDom(Entry.Func.CREATE_BTN).childNodes);Entry.Func.FIELD_BLOCK='';Entry.Func.fieldBlocks=Entry.nodeListToArray(Blockly.Xml.textToDom(Entry.Func.FIELD_BLOCK).childNodes); Entry.Func.CREATE_BLOCK=''; -Entry.Func.edit=function(a){this.srcFName="";for(var b=$(a.content.innerHTML).find("field"),c=0;cBlockly.Block.dragMode_&&(a.updateMenu(),a.fieldText=b,a.workspaceLength=c)}}; -Entry.Func.updateMenu=function(){if("func"==Entry.playground.selectedMenu&&(Entry.playground.blockMenu.hide(),Entry.playground.blockMenu.show(Entry.Func.getMenuXml()),!Blockly.WidgetDiv.field_&&Entry.Func.targetFunc)){var a=Entry.Func.targetFunc,b=Blockly.Xml.workspaceToDom(Entry.Func.workspace),c=b.getElementsByClassName("function_general"),d=a.id,e,c=Entry.nodeListToArray(c),f=[],g={};c.map(function(b){var a=b.getElementsByTagName("mutation")[0].getAttribute("hashid");a==d?f.push(b):(g[a]||(g[a]= -[]),g[a].push(b))});f.map(function(a){e=Entry.Func.generateWsBlock(b,Blockly.Xml.workspaceToDom(Entry.Func.workspace),d).block;for(var c=[],f=!1;a.firstChild;){var g=a.firstChild,h=g.tagName;if(f||"NEXT"==h)f=!0,c.push(g);a.removeChild(g)}for(;e.firstChild;)a.appendChild(e.firstChild);for(;c.length;)a.appendChild(c.shift())});for(var h in g){var a=g[h],k=Entry.variableContainer.getFunction(h).content;a.map(function(a){e=Entry.Func.generateWsBlock(b,k,h).block;for(var c=[],d=!1;a.firstChild;){var f= -a.firstChild,g=f.tagName;if(d||"NEXT"==g)d=!0,c.push(f);a.removeChild(f)}for(;e.firstChild;)a.appendChild(e.firstChild);for(;c.length;)a.appendChild(c.shift())})}Entry.Func.workspace.clear();Blockly.Xml.domToWorkspace(Entry.Func.workspace,b)}};Entry.Func.prototype.edit=function(){Entry.Func.isEdit||(Entry.Func.isEdit=!0,Entry.Func.svg?this.parentView.appendChild(this.svg):Entry.Func.initEditView())}; -Entry.Func.generateBlock=function(a,b,c){b=Entry.nodeListToArray(b.childNodes);var d,e;for(e in b)"function_create"==b[e].getAttribute("type")&&(d=b[e]);e=new Entry.Script;e.init(d);d=e;d.values&&(d=e.values.FIELD);e='';c=b="";var f=0,g=0;a.stringHash={};for(a.booleanHash={};;){switch(d.type){case "function_field_label":e+='",">")+'">';c+=d.fields.NAME;break;case "function_field_boolean":var h= -d.values.PARAM.hashId;e+='';b+='';a.booleanHash[h]=g;g++;c+="\ub17c\ub9ac\uac12"+g;break;case "function_field_string":h=d.values.PARAM.hashId,e+='',b+='10',a.stringHash[h]=f,f++,c+="\ubb38\uc790\uac12"+f}if(d.values&&d.values.NEXT)d=d.values.NEXT;else break;c+=" "}a=Blockly.Xml.textToDom(''+ -(e+"")+b+"").childNodes[0];c||(c="\ud568\uc218");return{block:a,description:c}};Entry.Func.prototype.generateBlock=function(a){a=Entry.Func.generateBlock(this,this.content,this.id);this.block=a.block;this.description=a.description};Entry.Func.prototype.syncViewSize_=function(){var a=this.parentView.getBoundingClientRect();this.svg.style.width=a.width;this.svg.style.height=a.height}; -Entry.Func.generateButtons=function(){var a=this,b=Blockly.createSvgElement("g",{},this.svg);this.btnWrapper=b;var c=Blockly.createSvgElement("text",{x:"27",y:"33","class":"entryFunctionButtonText"},b),d=document.createTextNode(Lang.Buttons.save);c.appendChild(d);var d=Blockly.createSvgElement("text",{x:"102.5",y:"33","class":"entryFunctionButtonText"},b),e=document.createTextNode(Lang.Buttons.cancel);d.appendChild(e);e=Blockly.createSvgElement("circle",{cx:"27.5",cy:"27.5",r:"27.5","class":"entryFunctionButton"}, -b);b=Blockly.createSvgElement("circle",{cx:"102.5",cy:"27.5",r:"27.5","class":"entryFunctionButton"},b);e.onclick=function(b){a.save()};c.onclick=function(b){a.save()};b.onclick=function(b){a.cancelEdit()};d.onclick=function(b){a.cancelEdit()}}; -Entry.Func.position_=function(){var a=this.workspace.getMetrics();if(a&&this.workspace.visible){var b=this.btnWrapper;b.setAttribute("transform","translate(30, 501)");Blockly.RTL?this.left_=this.MARGIN_SIDE_:b.left_=a.viewWidth/2+a.absoluteLeft-60;b.top_=a.viewHeight+a.absoluteTop-200;b.setAttribute("transform","translate("+b.left_+","+b.top_+")")}}; -Entry.Func.positionBlock_=function(a){var b=this.workspace.getMetrics();if(b&&this.workspace.visible){var c=a.getSvgRoot(),c=Blockly.getSvgXY_(c);a.getHeightWidth();a.moveBy(b.viewWidth/2-80-c.x,b.viewHeight/2-50-c.y)}}; -Entry.Func.doWhenInit=function(){var a=this.svg;a.appendChild(Blockly.fieldKeydownDom);a.appendChild(Blockly.fieldDropdownDom);a.appendChild(Blockly.contextMenu);Blockly.bindEvent_(window,"resize",this,this.position_);Blockly.bindEvent_(a,"mousedown",null,Blockly.onMouseDown_);Blockly.bindEvent_(a,"contextmenu",null,Blockly.onContextMenu_)}; -Entry.Func.doWhenCancel=function(){Blockly.clipboard_=null;var a=Blockly.svg;a.appendChild(Blockly.fieldKeydownDom);a.appendChild(Blockly.fieldDropdownDom);a.appendChild(Blockly.contextMenu);Blockly.unbindEvent_(window,"resize",this,this.position_);Blockly.unbindEvent_(a,"mousedown",null,Blockly.onMouseDown_);Blockly.unbindEvent_(a,"contextmenu",null,Blockly.onContextMenu_)}; -Entry.Func.generateWsBlock=function(a,b,c){b=b.childNodes;var d,e;for(e in b)if("function_create"==b[e].getAttribute("type")){d=b[e];break}e=new Entry.Script;e.init(d);d=e;d.values&&(d=e.values.FIELD);e='';c=b="";var f=0,g=0;a.stringHash={};for(a.booleanHash={};;){switch(d.type){case "function_field_label":e+='",">")+'">';c+=d.fields.NAME;break;case "function_field_boolean":var h=d.values.PARAM.hashId; -e+='';b+='';a.booleanHash[h]=g;g++;c+="\ub17c\ub9ac\uac12"+g;break;case "function_field_string":h=d.values.PARAM.hashId,e+='',b+='',a.stringHash[h]=f,f++,c+="\ubb38\uc790\uac12"+f}if(d.values&&d.values.NEXT)d= -d.values.NEXT;else break;c+=" "}a=''+(e+"")+b+"";c||(c="\ud568\uc218");return{block:Blockly.Xml.textToDom(a).childNodes[0],description:c}};Entry.HWMontior={};Entry.HWMonitor=function(a){this.svgDom=Entry.Dom($(''));this._hwModule=a;var b=this;Entry.addEventListener("windowResized",function(){var a=b._hwModule.monitorTemplate.mode;"both"==a&&(b.resize(),b.resizeList());"list"==a?b.resizeList():b.resize()});Entry.addEventListener("hwModeChange",function(){b.changeMode()});this.changeOffset=0;this.scale=.5;this._listPortViews={}}; -(function(a){a.initView=function(){this.svgDom=Entry.Dom($(''))};a.generateView=function(){this.snap=Entry.SVG("hwMonitor");this._svgGroup=this.snap.elem("g");this._portMap={n:[],e:[],s:[],w:[]};var b=this._hwModule.monitorTemplate,a={href:Entry.mediaFilePath+b.imgPath,x:-b.width/2,y:-b.height/2,width:b.width,height:b.height};this._portViews={};this.hwView=this._svgGroup.elem("image");this.hwView= -this.hwView.attr(a);this._template=b;b=b.ports;this.pathGroup=null;this.pathGroup=this._svgGroup.elem("g");var a=[],d;for(d in b){var e=this.generatePortView(b[d],"_svgGroup");this._portViews[d]=e;a.push(e)}a.sort(function(b,a){return b.box.x-a.box.x});var f=this._portMap;a.map(function(b){(1>(Math.atan2(-b.box.y,b.box.x)/Math.PI+2)%2?f.n:f.s).push(b)});this.resize()};a.toggleMode=function(b){var a=this._hwModule.monitorTemplate;"list"==b?(a.TempPort=null,this._hwModule.monitorTemplate.ports&&(this._hwModule.monitorTemplate.TempPort= +Entry.Func.getMenuXml=function(){var b=[];this.targetFunc||(b=b.concat(this.createBtn));if(this.targetFunc)var a=this.FIELD_BLOCK,a=a.replace("#1",Entry.generateHash()),a=a.replace("#2",Entry.generateHash()),a=Blockly.Xml.textToDom(a).childNodes,b=b.concat(Entry.nodeListToArray(a));for(var c in Entry.variableContainer.functions_)a=Entry.variableContainer.functions_[c],a===this.targetFunc?(a=Entry.Func.generateBlock(this.targetFunc,Blockly.Xml.workspaceToDom(Entry.Func.workspace),a.id).block,b.push(a)): +b.push(a.block);return b};Entry.Func.syncFunc=function(){var b=Entry.Func;if(b.targetFunc){var a=b.workspace.topBlocks_[0].toString(),c=b.workspace.topBlocks_.length;(b.fieldText!=a||b.workspaceLength!=c)&&1>Blockly.Block.dragMode_&&(b.updateMenu(),b.fieldText=a,b.workspaceLength=c)}}; +Entry.Func.updateMenu=function(){if("func"==Entry.playground.selectedMenu&&(Entry.playground.blockMenu.hide(),Entry.playground.blockMenu.show(Entry.Func.getMenuXml()),!Blockly.WidgetDiv.field_&&Entry.Func.targetFunc)){var b=Entry.Func.targetFunc,a=Blockly.Xml.workspaceToDom(Entry.Func.workspace),c=a.getElementsByClassName("function_general"),d=b.id,e,c=Entry.nodeListToArray(c),f=[],g={};c.map(function(a){var b=a.getElementsByTagName("mutation")[0].getAttribute("hashid");b==d?f.push(a):(g[b]||(g[b]= +[]),g[b].push(a))});f.map(function(b){e=Entry.Func.generateWsBlock(a,Blockly.Xml.workspaceToDom(Entry.Func.workspace),d).block;for(var c=[],f=!1;b.firstChild;){var g=b.firstChild,h=g.tagName;if(f||"NEXT"==h)f=!0,c.push(g);b.removeChild(g)}for(;e.firstChild;)b.appendChild(e.firstChild);for(;c.length;)b.appendChild(c.shift())});for(var h in g){var b=g[h],k=Entry.variableContainer.getFunction(h).content;b.map(function(b){e=Entry.Func.generateWsBlock(a,k,h).block;for(var c=[],d=!1;b.firstChild;){var f= +b.firstChild,g=f.tagName;if(d||"NEXT"==g)d=!0,c.push(f);b.removeChild(f)}for(;e.firstChild;)b.appendChild(e.firstChild);for(;c.length;)b.appendChild(c.shift())})}Entry.Func.workspace.clear();Blockly.Xml.domToWorkspace(Entry.Func.workspace,a)}};Entry.Func.prototype.edit=function(){Entry.Func.isEdit||(Entry.Func.isEdit=!0,Entry.Func.svg?this.parentView.appendChild(this.svg):Entry.Func.initEditView())}; +Entry.Func.generateBlock=function(b,a,c){a=Entry.nodeListToArray(a.childNodes);var d,e;for(e in a)"function_create"==a[e].getAttribute("type")&&(d=a[e]);e=new Entry.Script;e.init(d);d=e;d.values&&(d=e.values.FIELD);e='';c=a="";var f=0,g=0;b.stringHash={};for(b.booleanHash={};;){switch(d.type){case "function_field_label":e+='",">")+'">';c+=d.fields.NAME;break;case "function_field_boolean":var h= +d.values.PARAM.hashId;e+='';a+='';b.booleanHash[h]=g;g++;c+="\ub17c\ub9ac\uac12"+g;break;case "function_field_string":h=d.values.PARAM.hashId,e+='',a+='10',b.stringHash[h]=f,f++,c+="\ubb38\uc790\uac12"+f}if(d.values&&d.values.NEXT)d=d.values.NEXT;else break;c+=" "}b=Blockly.Xml.textToDom(''+ +(e+"")+a+"").childNodes[0];c||(c="\ud568\uc218");return{block:b,description:c}};Entry.Func.prototype.generateBlock=function(b){b=Entry.Func.generateBlock(this,this.content,this.id);this.block=b.block;this.description=b.description};Entry.Func.prototype.syncViewSize_=function(){var b=this.parentView.getBoundingClientRect();this.svg.style.width=b.width;this.svg.style.height=b.height}; +Entry.Func.generateButtons=function(){var b=this,a=Blockly.createSvgElement("g",{},this.svg);this.btnWrapper=a;var c=Blockly.createSvgElement("text",{x:"27",y:"33","class":"entryFunctionButtonText"},a),d=document.createTextNode(Lang.Buttons.save);c.appendChild(d);var d=Blockly.createSvgElement("text",{x:"102.5",y:"33","class":"entryFunctionButtonText"},a),e=document.createTextNode(Lang.Buttons.cancel);d.appendChild(e);e=Blockly.createSvgElement("circle",{cx:"27.5",cy:"27.5",r:"27.5","class":"entryFunctionButton"}, +a);a=Blockly.createSvgElement("circle",{cx:"102.5",cy:"27.5",r:"27.5","class":"entryFunctionButton"},a);e.onclick=function(a){b.save()};c.onclick=function(a){b.save()};a.onclick=function(a){b.cancelEdit()};d.onclick=function(a){b.cancelEdit()}}; +Entry.Func.position_=function(){var b=this.workspace.getMetrics();if(b&&this.workspace.visible){var a=this.btnWrapper;a.setAttribute("transform","translate(30, 501)");Blockly.RTL?this.left_=this.MARGIN_SIDE_:a.left_=b.viewWidth/2+b.absoluteLeft-60;a.top_=b.viewHeight+b.absoluteTop-200;a.setAttribute("transform","translate("+a.left_+","+a.top_+")")}}; +Entry.Func.positionBlock_=function(b){var a=this.workspace.getMetrics();if(a&&this.workspace.visible){var c=b.getSvgRoot(),c=Blockly.getSvgXY_(c);b.getHeightWidth();b.moveBy(a.viewWidth/2-80-c.x,a.viewHeight/2-50-c.y)}}; +Entry.Func.doWhenInit=function(){var b=this.svg;b.appendChild(Blockly.fieldKeydownDom);b.appendChild(Blockly.fieldDropdownDom);b.appendChild(Blockly.contextMenu);Blockly.bindEvent_(window,"resize",this,this.position_);Blockly.bindEvent_(b,"mousedown",null,Blockly.onMouseDown_);Blockly.bindEvent_(b,"contextmenu",null,Blockly.onContextMenu_)}; +Entry.Func.doWhenCancel=function(){Blockly.clipboard_=null;var b=Blockly.svg;b.appendChild(Blockly.fieldKeydownDom);b.appendChild(Blockly.fieldDropdownDom);b.appendChild(Blockly.contextMenu);Blockly.unbindEvent_(window,"resize",this,this.position_);Blockly.unbindEvent_(b,"mousedown",null,Blockly.onMouseDown_);Blockly.unbindEvent_(b,"contextmenu",null,Blockly.onContextMenu_)}; +Entry.Func.generateWsBlock=function(b,a,c){a=a.childNodes;var d,e;for(e in a)if("function_create"==a[e].getAttribute("type")){d=a[e];break}e=new Entry.Script;e.init(d);d=e;d.values&&(d=e.values.FIELD);e='';c=a="";var f=0,g=0;b.stringHash={};for(b.booleanHash={};;){switch(d.type){case "function_field_label":e+='",">")+'">';c+=d.fields.NAME;break;case "function_field_boolean":var h=d.values.PARAM.hashId; +e+='';a+='';b.booleanHash[h]=g;g++;c+="\ub17c\ub9ac\uac12"+g;break;case "function_field_string":h=d.values.PARAM.hashId,e+='',a+='',b.stringHash[h]=f,f++,c+="\ubb38\uc790\uac12"+f}if(d.values&&d.values.NEXT)d= +d.values.NEXT;else break;c+=" "}b=''+(e+"")+a+"";c||(c="\ud568\uc218");return{block:Blockly.Xml.textToDom(b).childNodes[0],description:c}};Entry.HWMontior={};Entry.HWMonitor=function(b){this.svgDom=Entry.Dom($(''));this._hwModule=b;var a=this;Entry.addEventListener("windowResized",function(){var b=a._hwModule.monitorTemplate.mode;"both"==b&&(a.resize(),a.resizeList());"list"==b?a.resizeList():a.resize()});Entry.addEventListener("hwModeChange",function(){a.changeMode()});this.changeOffset=0;this.scale=.5;this._listPortViews={}}; +(function(b){b.initView=function(){this.svgDom=Entry.Dom($(''))};b.generateView=function(){this.snap=Entry.SVG("hwMonitor");this._svgGroup=this.snap.elem("g");this._portMap={n:[],e:[],s:[],w:[]};var a=this._hwModule.monitorTemplate,b={href:Entry.mediaFilePath+a.imgPath,x:-a.width/2,y:-a.height/2,width:a.width,height:a.height};this._portViews={};this.hwView=this._svgGroup.elem("image");this.hwView= +this.hwView.attr(b);this._template=a;a=a.ports;this.pathGroup=null;this.pathGroup=this._svgGroup.elem("g");var b=[],d;for(d in a){var e=this.generatePortView(a[d],"_svgGroup");this._portViews[d]=e;b.push(e)}b.sort(function(a,b){return a.box.x-b.box.x});var f=this._portMap;b.map(function(a){(1>(Math.atan2(-a.box.y,a.box.x)/Math.PI+2)%2?f.n:f.s).push(a)});this.resize()};b.toggleMode=function(a){var b=this._hwModule.monitorTemplate;"list"==a?(b.TempPort=null,this._hwModule.monitorTemplate.ports&&(this._hwModule.monitorTemplate.TempPort= this._hwModule.monitorTemplate.ports,this._hwModule.monitorTemplate.listPorts=this.addPortEle(this._hwModule.monitorTemplate.listPorts,this._hwModule.monitorTemplate.ports)),$(this._svglistGroup).remove(),this._svgGroup&&$(this._svgGroup).remove(),$(this._pathGroup).remove(),this._hwModule.monitorTemplate.mode="list",this.generateListView()):(this._hwModule.monitorTemplate.TempPort&&(this._hwModule.monitorTemplate.ports=this._hwModule.monitorTemplate.TempPort,this._hwModule.monitorTemplate.listPorts= -this.removePortEle(this._hwModule.monitorTemplate.listPorts,this._hwModule.monitorTemplate.ports)),$(this._svglistGroup).remove(),this._hwModule.monitorTemplate.mode="both",this.generateListView(),this.generateView())};a.setHwmonitor=function(b){this._hwmodule=b};a.changeMode=function(b){"both"==this._hwModule.monitorTemplate.mode?this.toggleMode("list"):"list"==this._hwModule.monitorTemplate.mode&&this.toggleMode("both")};a.addPortEle=function(b,a){if("object"!=typeof a)return b;for(var d in a)b[d]= -a[d];return b};a.removePortEle=function(b,a){if("object"!=typeof a)return b;for(var d in a)delete b[d];return b};a.generateListView=function(){this._portMapList={n:[]};this._svglistGroup=null;this.listsnap=Entry.SVG("hwMonitor");this._svglistGroup=this.listsnap.elem("g");var b=this._hwModule.monitorTemplate;this._template=b;b=b.listPorts;this.pathGroup=this._svglistGroup.elem("g");var a=[],d;for(d in b){var e=this.generatePortView(b[d],"_svglistGroup");this._listPortViews[d]=e;a.push(e)}var f=this._portMapList; -a.map(function(b){f.n.push(b)});this.resizeList()};a.generatePortView=function(b,a){var d=this[a].elem("g");d.addClass("hwComponent");var e=null,e=this.pathGroup.elem("path").attr({d:"m0,0",fill:"none",stroke:"input"===b.type?"#00979d":"#A751E3","stroke-width":3}),f=d.elem("rect").attr({x:0,y:0,width:150,height:22,rx:4,ry:4,fill:"#fff",stroke:"#a0a1a1"}),g=d.elem("text").attr({x:4,y:12,fill:"#000","class":"hwComponentName","alignment-baseline":"central"});g.textContent=b.name;g=g.getComputedTextLength(); -d.elem("rect").attr({x:g+8,y:2,width:30,height:18,rx:9,ry:9,fill:"input"===b.type?"#00979d":"#A751E3"});var h=d.elem("text").attr({x:g+13,y:12,fill:"#fff","class":"hwComponentValue","alignment-baseline":"central"});h.textContent=0;g+=40;f.attr({width:g});return{group:d,value:h,type:b.type,path:e,box:{x:b.pos.x-this._template.width/2,y:b.pos.y-this._template.height/2,width:g},width:g}};a.getView=function(){return this.svgDom};a.update=function(){var b=Entry.hw.portData,a=Entry.hw.sendQueue,d=this._hwModule.monitorTemplate.mode, -e=[];if("list"==d)e=this._listPortViews;else if("both"==d){if(e=this._listPortViews,this._portViews)for(var f in this._portViews)e[f]=this._portViews[f]}else e=this._portViews;if(a)for(f in a)0!=a[f]&&e[f]&&(e[f].type="output");for(var g in e)d=e[g],"input"==d.type?(f=b[g],d.value.textContent=f?f:0,d.group.getElementsByTagName("rect")[1].attr({fill:"#00979D"})):(f=a[g],d.value.textContent=f?f:0,d.group.getElementsByTagName("rect")[1].attr({fill:"#A751E3"}))};a.resize=function(){this.hwView&&this.hwView.attr({transform:"scale("+ -this.scale+")"});if(this.svgDom)var b=this.svgDom.get(0).getBoundingClientRect();this._svgGroup.attr({transform:"translate("+b.width/2+","+b.height/1.8+")"});this._rect=b;0>=this._template.height||0>=b.height||(this.scale=b.height/this._template.height*this._template.height/1E3,this.align())};a.resizeList=function(){var b=this.svgDom.get(0).getBoundingClientRect();this._svglistGroup.attr({transform:"translate("+b.width/2+","+b.height/2+")"});this._rect=b;this.alignList()};a.align=function(){var b= -[],b=this._portMap.s.concat();this._alignNS(b,this.scale/3*this._template.height+5,27);b=this._portMap.n.concat();this._alignNS(b,-this._template.height*this.scale/3-32,-27);b=this._portMap.e.concat();this._alignEW(b,-this._template.width*this.scale/3-5,-27);b=this._portMap.w.concat();this._alignEW(b,this._template.width*this.scale/3-32,-27)};a.alignList=function(){for(var b={},b=this._hwModule.monitorTemplate.listPorts,a=b.length,d=0;dd-(l.width+q.width/2.2)&&(f+=1,initX=h,g=0)};a._movePort=function(b,a,d,e){var f=a,g=b.box.x*this.scale,h=b.box.y*this.scale;a>e?(f=a-b.width,a=a>g&&g>e?"M"+g+","+d+"L"+g+","+h:"M"+(a+e)/2+","+d+"l0,"+(h>d?28:-3)+"H"+g+"L"+g+","+h):a=ad?28:-3)+"H"+g+"L"+g+","+h;b.group.attr({transform:"translate("+f+","+d+")"}); -b.path.attr({d:a})}})(Entry.HWMonitor.prototype);Entry.HW=function(){this.connectTrial=0;this.isFirstConnect=!0;this.initSocket();this.connected=!1;this.portData={};this.sendQueue={};this.outputQueue={};this.settingQueue={};this.socketType=this.hwModule=this.selectedDevice=null;Entry.addEventListener("stop",this.setZero);this.hwInfo={11:Entry.Arduino,12:Entry.SensorBoard,13:Entry.CODEino,15:Entry.dplay,17:Entry.Xbot,24:Entry.Hamster,25:Entry.Albert,31:Entry.Bitbrick,42:Entry.Arduino,51:Entry.Neobot,71:Entry.Robotis_carCont,72:Entry.Robotis_openCM70, +this.removePortEle(this._hwModule.monitorTemplate.listPorts,this._hwModule.monitorTemplate.ports)),$(this._svglistGroup).remove(),this._hwModule.monitorTemplate.mode="both",this.generateListView(),this.generateView())};b.setHwmonitor=function(a){this._hwmodule=a};b.changeMode=function(a){"both"==this._hwModule.monitorTemplate.mode?this.toggleMode("list"):"list"==this._hwModule.monitorTemplate.mode&&this.toggleMode("both")};b.addPortEle=function(a,b){if("object"!=typeof b)return a;for(var d in b)a[d]= +b[d];return a};b.removePortEle=function(a,b){if("object"!=typeof b)return a;for(var d in b)delete a[d];return a};b.generateListView=function(){this._portMapList={n:[]};this._svglistGroup=null;this.listsnap=Entry.SVG("hwMonitor");this._svglistGroup=this.listsnap.elem("g");var a=this._hwModule.monitorTemplate;this._template=a;a=a.listPorts;this.pathGroup=this._svglistGroup.elem("g");var b=[],d;for(d in a){var e=this.generatePortView(a[d],"_svglistGroup");this._listPortViews[d]=e;b.push(e)}var f=this._portMapList; +b.map(function(a){f.n.push(a)});this.resizeList()};b.generatePortView=function(a,b){var d=this[b].elem("g");d.addClass("hwComponent");var e=null,e=this.pathGroup.elem("path").attr({d:"m0,0",fill:"none",stroke:"input"===a.type?"#00979d":"#A751E3","stroke-width":3}),f=d.elem("rect").attr({x:0,y:0,width:150,height:22,rx:4,ry:4,fill:"#fff",stroke:"#a0a1a1"}),g=d.elem("text").attr({x:4,y:12,fill:"#000","class":"hwComponentName","alignment-baseline":"central"});g.textContent=a.name;g=g.getComputedTextLength(); +d.elem("rect").attr({x:g+8,y:2,width:30,height:18,rx:9,ry:9,fill:"input"===a.type?"#00979d":"#A751E3"});var h=d.elem("text").attr({x:g+13,y:12,fill:"#fff","class":"hwComponentValue","alignment-baseline":"central"});h.textContent=0;g+=40;f.attr({width:g});return{group:d,value:h,type:a.type,path:e,box:{x:a.pos.x-this._template.width/2,y:a.pos.y-this._template.height/2,width:g},width:g}};b.getView=function(){return this.svgDom};b.update=function(){var a=Entry.hw.portData,b=Entry.hw.sendQueue,d=this._hwModule.monitorTemplate.mode, +e=[];if("list"==d)e=this._listPortViews;else if("both"==d){if(e=this._listPortViews,this._portViews)for(var f in this._portViews)e[f]=this._portViews[f]}else e=this._portViews;if(b)for(f in b)0!=b[f]&&e[f]&&(e[f].type="output");for(var g in e)d=e[g],"input"==d.type?(f=a[g],d.value.textContent=f?f:0,d.group.getElementsByTagName("rect")[1].attr({fill:"#00979D"})):(f=b[g],d.value.textContent=f?f:0,d.group.getElementsByTagName("rect")[1].attr({fill:"#A751E3"}))};b.resize=function(){this.hwView&&this.hwView.attr({transform:"scale("+ +this.scale+")"});if(this.svgDom)var a=this.svgDom.get(0).getBoundingClientRect();this._svgGroup.attr({transform:"translate("+a.width/2+","+a.height/1.8+")"});this._rect=a;0>=this._template.height||0>=a.height||(this.scale=a.height/this._template.height*this._template.height/1E3,this.align())};b.resizeList=function(){var a=this.svgDom.get(0).getBoundingClientRect();this._svglistGroup.attr({transform:"translate("+a.width/2+","+a.height/2+")"});this._rect=a;this.alignList()};b.align=function(){var a= +[],a=this._portMap.s.concat();this._alignNS(a,this.scale/3*this._template.height+5,27);a=this._portMap.n.concat();this._alignNS(a,-this._template.height*this.scale/3-32,-27);a=this._portMap.e.concat();this._alignEW(a,-this._template.width*this.scale/3-5,-27);a=this._portMap.w.concat();this._alignEW(a,this._template.width*this.scale/3-32,-27)};b.alignList=function(){for(var a={},a=this._hwModule.monitorTemplate.listPorts,b=a.length,d=0;dd-(l.width+q.width/2.2)&&(f+=1,initX=h,g=0)};b._movePort=function(a,b,d,e){var f=b,g=a.box.x*this.scale,h=a.box.y*this.scale;b>e?(f=b-a.width,b=b>g&&g>e?"M"+g+","+d+"L"+g+","+h:"M"+(b+e)/2+","+d+"l0,"+(h>d?28:-3)+"H"+g+"L"+g+","+h):b=bd?28:-3)+"H"+g+"L"+g+","+h;a.group.attr({transform:"translate("+f+","+d+")"}); +a.path.attr({d:b})}})(Entry.HWMonitor.prototype);Entry.HW=function(){this.connectTrial=0;this.isFirstConnect=!0;this.initSocket();this.connected=!1;this.portData={};this.sendQueue={};this.outputQueue={};this.settingQueue={};this.socketType=this.hwModule=this.selectedDevice=null;Entry.addEventListener("stop",this.setZero);this.hwInfo={11:Entry.Arduino,12:Entry.SensorBoard,13:Entry.CODEino,15:Entry.dplay,17:Entry.Xbot,24:Entry.Hamster,25:Entry.Albert,31:Entry.Bitbrick,42:Entry.Arduino,51:Entry.Neobot,71:Entry.Robotis_carCont,72:Entry.Robotis_openCM70, 81:Entry.EV3}};Entry.HW.TRIAL_LIMIT=1;p=Entry.HW.prototype; -p.initSocket=function(){try{if(this.connectTrial>=Entry.HW.TRIAL_LIMIT)this.isFirstConnect||Entry.toast.alert(Lang.Menus.connect_hw,Lang.Menus.connect_fail,!1),this.isFirstConnect=!1;else{var a=this,b,c;if(-1=a+f?c.setSlideCommandX(0,!0):a+f>c.maxWidth+10?c.setSlideCommandX(c.maxWidth,!0):(this.offsetX=-(this.x-.75*b.stageX+240),c.setSlideCommandX(a))}});this.valueSetter_.on("pressup",function(b){c.isAdjusting=!1;delete c.viewValue_}); -this.view_.addChild(this.valueSetter_);b=Entry.variableContainer.variables_.length;this.getX()&&this.getY()?(this.setX(this.getX()),this.setY(this.getY())):(this.setX(-230+80*Math.floor(b/11)),this.setY(24*a+20-135-264*Math.floor(b/11)))}else this.view_=new createjs.Container,this.rect_=new createjs.Shape,this.view_.addChild(this.rect_),this.view_.variable=this,this.titleView_=new createjs.Text("asdf",this.FONT,"#000"),this.titleView_.textBaseline="alphabetic",this.titleView_.textAlign="center",this.titleView_.width= -this.width_-2*this.BORDER,this.titleView_.y=this.BORDER+10,this.titleView_.x=this.width_/2,this.view_.addChild(this.titleView_),this.resizeHandle_=new createjs.Shape,this.resizeHandle_.graphics.f("#1bafea").ss(1,0,0).s("#1bafea").lt(0,-9).lt(-9,0).lt(0,0),this.view_.addChild(this.resizeHandle_),this.resizeHandle_.list=this,this.resizeHandle_.on("mouseover",function(b){this.cursor="nwse-resize"}),this.resizeHandle_.on("mousedown",function(b){this.list.isResizing=!0;this.offset={x:.75*b.stageX-this.list.getWidth(), -y:.75*b.stageY-this.list.getHeight()};this.parent.cursor="nwse-resize"}),this.resizeHandle_.on("pressmove",function(b){this.list.setWidth(.75*b.stageX-this.offset.x);this.list.setHeight(.75*b.stageY-this.offset.y);this.list.updateView()}),this.view_.on("mouseover",function(b){this.cursor="move"}),this.view_.on("mousedown",function(b){"workspace"!=Entry.type||this.variable.isResizing||(this.offset={x:this.x-(.75*b.stageX-240),y:this.y-(.75*b.stageY-135)},this.cursor="move")}),this.view_.on("pressup", -function(b){this.cursor="initial";this.variable.isResizing=!1}),this.view_.on("pressmove",function(b){"workspace"!=Entry.type||this.variable.isResizing||(this.variable.setX(.75*b.stageX-240+this.offset.x),this.variable.setY(.75*b.stageY-135+this.offset.y),this.variable.updateView())}),this.elementView=new createjs.Container,b=new createjs.Text("asdf",this.FONT,"#000"),b.textBaseline="middle",b.y=5,this.elementView.addChild(b),this.elementView.indexView=b,b=new createjs.Shape,this.elementView.addChild(b), -this.elementView.valueWrapper=b,b=new createjs.Text("fdsa",this.FONT,"#eee"),b.x=24,b.y=6,b.textBaseline="middle",this.elementView.addChild(b),this.elementView.valueView=b,this.elementView.x=this.BORDER,this.scrollButton_=new createjs.Shape,this.scrollButton_.graphics.f("#aaa").rr(0,0,7,30,3.5),this.view_.addChild(this.scrollButton_),this.scrollButton_.y=23,this.scrollButton_.list=this,this.scrollButton_.on("mousedown",function(b){this.list.isResizing=!0;this.cursor="pointer";this.offsetY=isNaN(this.offsetY)|| -0>this.offsetY?b.rawY/2:this.offsetY}),this.scrollButton_.on("pressmove",function(b){void 0===this.moveAmount?(this.y=b.target.y,this.moveAmount=!0):this.y=b.rawY/2-this.offsetY+this.list.height_/100*23;23>this.y&&(this.y=23);this.y>this.list.getHeight()-40&&(this.y=this.list.getHeight()-40);this.list.updateView()}),this.scrollButton_.on("pressup",function(b){this.moveAmount=void 0}),this.getX()&&this.getY()?(this.setX(this.getX()),this.setY(this.getY())):(b=Entry.variableContainer.lists_.length, -this.setX(110*-Math.floor(b/6)+120),this.setY(24*a+20-135-145*Math.floor(b/6)));this.setVisible(this.isVisible());this.updateView();Entry.stage.loadVariable(this)}; -Entry.Variable.prototype.updateView=function(){if(this.view_&&this.isVisible())if("variable"==this.type){this.view_.x=this.getX();this.view_.y=this.getY();if(this.object_){var a=Entry.container.getObject(this.object_);this.textView_.text=a?a.name+":"+this.getName():this.getName()}else this.textView_.text=this.getName();this.valueView_.x=this.textView_.getMeasuredWidth()+14;this.valueView_.y=1;this.isNumber()?this.valueView_.text=this.getValue().toFixed(2).replace(".00",""):this.valueView_.text=this.getValue(); -this.rect_.graphics.clear().f("#ffffff").ss(1,2,0).s("#A0A1A1").rc(0,-14,this.textView_.getMeasuredWidth()+this.valueView_.getMeasuredWidth()+26,20,4,4,4,4);this.wrapper_.graphics.clear().f("#1bafea").ss(1,2,0).s("#1bafea").rc(this.textView_.getMeasuredWidth()+7,-11,this.valueView_.getMeasuredWidth()+15,14,7,7,7,7)}else if("slide"==this.type)this.view_.x=this.getX(),this.view_.y=this.getY(),this.object_?(a=Entry.container.getObject(this.object_),this.textView_.text=a?a.name+":"+this.getName():this.getName()): -this.textView_.text=this.getName(),this.valueView_.x=this.textView_.getMeasuredWidth()+14,this.valueView_.y=1,this.isNumber()?this.valueView_.text=this.getValue().toFixed(2).replace(".00",""):this.valueView_.text=this.getValue(),a=this.textView_.getMeasuredWidth()+this.valueView_.getMeasuredWidth()+26,a=Math.max(a,90),this.rect_.graphics.clear().f("#ffffff").ss(1,2,0).s("#A0A1A1").rc(0,-14,a,33,4,4,4,4),this.wrapper_.graphics.clear().f("#1bafea").ss(1,2,0).s("#1bafea").rc(this.textView_.getMeasuredWidth()+ -7,-11,this.valueView_.getMeasuredWidth()+15,14,7,7,7,7),a=this.textView_.getMeasuredWidth()+this.valueView_.getMeasuredWidth()+26,a=Math.max(a,90),this.maxWidth=a-20,this.slideBar_.graphics.clear().beginFill("#A0A1A1").s("#A0A1A1").ss(1).dr(10,10,this.maxWidth,1.5),a=this.getSlidePosition(this.maxWidth),this.valueSetter_.graphics.clear().beginFill("#1bafea").s("#A0A1A1").ss(1).dc(a,10.5,3);else if("list"==this.type){this.view_.x=this.getX();this.view_.y=this.getY();this.resizeHandle_.x=this.width_- -2;this.resizeHandle_.y=this.height_-2;var b=this.getName();this.object_&&(a=Entry.container.getObject(this.object_))&&(b=a.name+":"+b);b=7this.getHeight()-40&& -(this.scrollButton_.y=this.getHeight()-40),this.elementView.valueWrapper.graphics.clear().f("#1bafea").rr(20,-2,this.getWidth()-20-10-2*this.BORDER,17,2),this.scrollButton_.visible=!0,this.scrollButton_.x=this.getWidth()-12,this.scrollPosition=Math.floor((this.scrollButton_.y-23)/(this.getHeight()-23-40)*(this.array_.length-a))):(this.elementView.valueWrapper.graphics.clear().f("#1bafea").rr(20,-2,this.getWidth()-20-2*this.BORDER,17,2),this.scrollButton_.visible=!1,this.scrollPosition=0);for(b=this.scrollPosition;b< -this.scrollPosition+a&&bc.length?c+"..":c;this.elementView.valueView.text=c;c=this.elementView.clone(!0);c.y=20*(b-this.scrollPosition)+23;this.view_.addChild(c)}}else"answer"==this.type?(this.view_.x=this.getX(),this.view_.y=this.getY(),this.textView_.text=this.getName(),this.valueView_.x=this.textView_.getMeasuredWidth()+ +p.initSocket=function(){try{if(this.connectTrial>=Entry.HW.TRIAL_LIMIT)this.isFirstConnect||Entry.toast.alert(Lang.Menus.connect_hw,Lang.Menus.connect_fail,!1),this.isFirstConnect=!1;else{var b=this,a,c;if(-1=b+f?c.setSlideCommandX(0,!0):b+f>c.maxWidth+10?c.setSlideCommandX(c.maxWidth,!0):(this.offsetX=-(this.x-.75*a.stageX+240),c.setSlideCommandX(b))}});this.valueSetter_.on("pressup",function(a){c.isAdjusting=!1;delete c.viewValue_}); +this.view_.addChild(this.valueSetter_);a=Entry.variableContainer.variables_.length;this.getX()&&this.getY()?(this.setX(this.getX()),this.setY(this.getY())):(this.setX(-230+80*Math.floor(a/11)),this.setY(24*b+20-135-264*Math.floor(a/11)))}else this.view_=new createjs.Container,this.rect_=new createjs.Shape,this.view_.addChild(this.rect_),this.view_.variable=this,this.titleView_=new createjs.Text("asdf",this.FONT,"#000"),this.titleView_.textBaseline="alphabetic",this.titleView_.textAlign="center",this.titleView_.width= +this.width_-2*this.BORDER,this.titleView_.y=this.BORDER+10,this.titleView_.x=this.width_/2,this.view_.addChild(this.titleView_),this.resizeHandle_=new createjs.Shape,this.resizeHandle_.graphics.f("#1bafea").ss(1,0,0).s("#1bafea").lt(0,-9).lt(-9,0).lt(0,0),this.view_.addChild(this.resizeHandle_),this.resizeHandle_.list=this,this.resizeHandle_.on("mouseover",function(a){this.cursor="nwse-resize"}),this.resizeHandle_.on("mousedown",function(a){this.list.isResizing=!0;this.offset={x:.75*a.stageX-this.list.getWidth(), +y:.75*a.stageY-this.list.getHeight()};this.parent.cursor="nwse-resize"}),this.resizeHandle_.on("pressmove",function(a){this.list.setWidth(.75*a.stageX-this.offset.x);this.list.setHeight(.75*a.stageY-this.offset.y);this.list.updateView()}),this.view_.on("mouseover",function(a){this.cursor="move"}),this.view_.on("mousedown",function(a){"workspace"!=Entry.type||this.variable.isResizing||(this.offset={x:this.x-(.75*a.stageX-240),y:this.y-(.75*a.stageY-135)},this.cursor="move")}),this.view_.on("pressup", +function(a){this.cursor="initial";this.variable.isResizing=!1}),this.view_.on("pressmove",function(a){"workspace"!=Entry.type||this.variable.isResizing||(this.variable.setX(.75*a.stageX-240+this.offset.x),this.variable.setY(.75*a.stageY-135+this.offset.y),this.variable.updateView())}),this.elementView=new createjs.Container,a=new createjs.Text("asdf",this.FONT,"#000"),a.textBaseline="middle",a.y=5,this.elementView.addChild(a),this.elementView.indexView=a,a=new createjs.Shape,this.elementView.addChild(a), +this.elementView.valueWrapper=a,a=new createjs.Text("fdsa",this.FONT,"#eee"),a.x=24,a.y=6,a.textBaseline="middle",this.elementView.addChild(a),this.elementView.valueView=a,this.elementView.x=this.BORDER,this.scrollButton_=new createjs.Shape,this.scrollButton_.graphics.f("#aaa").rr(0,0,7,30,3.5),this.view_.addChild(this.scrollButton_),this.scrollButton_.y=23,this.scrollButton_.list=this,this.scrollButton_.on("mousedown",function(a){this.list.isResizing=!0;this.cursor="pointer";this.offsetY=isNaN(this.offsetY)|| +0>this.offsetY?a.rawY/2:this.offsetY}),this.scrollButton_.on("pressmove",function(a){void 0===this.moveAmount?(this.y=a.target.y,this.moveAmount=!0):this.y=a.rawY/2-this.offsetY+this.list.height_/100*23;23>this.y&&(this.y=23);this.y>this.list.getHeight()-40&&(this.y=this.list.getHeight()-40);this.list.updateView()}),this.scrollButton_.on("pressup",function(a){this.moveAmount=void 0}),this.getX()&&this.getY()?(this.setX(this.getX()),this.setY(this.getY())):(a=Entry.variableContainer.lists_.length, +this.setX(110*-Math.floor(a/6)+120),this.setY(24*b+20-135-145*Math.floor(a/6)));this.setVisible(this.isVisible());this.updateView();Entry.stage.loadVariable(this)}; +Entry.Variable.prototype.updateView=function(){if(this.view_&&this.isVisible())if("variable"==this.type){this.view_.x=this.getX();this.view_.y=this.getY();if(this.object_){var b=Entry.container.getObject(this.object_);this.textView_.text=b?b.name+":"+this.getName():this.getName()}else this.textView_.text=this.getName();this.valueView_.x=this.textView_.getMeasuredWidth()+14;this.valueView_.y=1;this.isNumber()?this.valueView_.text=this.getValue().toFixed(2).replace(".00",""):this.valueView_.text=this.getValue(); +this.rect_.graphics.clear().f("#ffffff").ss(1,2,0).s("#A0A1A1").rc(0,-14,this.textView_.getMeasuredWidth()+this.valueView_.getMeasuredWidth()+26,20,4,4,4,4);this.wrapper_.graphics.clear().f("#1bafea").ss(1,2,0).s("#1bafea").rc(this.textView_.getMeasuredWidth()+7,-11,this.valueView_.getMeasuredWidth()+15,14,7,7,7,7)}else if("slide"==this.type)this.view_.x=this.getX(),this.view_.y=this.getY(),this.object_?(b=Entry.container.getObject(this.object_),this.textView_.text=b?b.name+":"+this.getName():this.getName()): +this.textView_.text=this.getName(),this.valueView_.x=this.textView_.getMeasuredWidth()+14,this.valueView_.y=1,this.isNumber()?this.valueView_.text=this.getValue().toFixed(2).replace(".00",""):this.valueView_.text=this.getValue(),b=this.textView_.getMeasuredWidth()+this.valueView_.getMeasuredWidth()+26,b=Math.max(b,90),this.rect_.graphics.clear().f("#ffffff").ss(1,2,0).s("#A0A1A1").rc(0,-14,b,33,4,4,4,4),this.wrapper_.graphics.clear().f("#1bafea").ss(1,2,0).s("#1bafea").rc(this.textView_.getMeasuredWidth()+ +7,-11,this.valueView_.getMeasuredWidth()+15,14,7,7,7,7),b=this.textView_.getMeasuredWidth()+this.valueView_.getMeasuredWidth()+26,b=Math.max(b,90),this.maxWidth=b-20,this.slideBar_.graphics.clear().beginFill("#A0A1A1").s("#A0A1A1").ss(1).dr(10,10,this.maxWidth,1.5),b=this.getSlidePosition(this.maxWidth),this.valueSetter_.graphics.clear().beginFill("#1bafea").s("#A0A1A1").ss(1).dc(b,10.5,3);else if("list"==this.type){this.view_.x=this.getX();this.view_.y=this.getY();this.resizeHandle_.x=this.width_- +2;this.resizeHandle_.y=this.height_-2;var a=this.getName();this.object_&&(b=Entry.container.getObject(this.object_))&&(a=b.name+":"+a);a=7this.getHeight()-40&& +(this.scrollButton_.y=this.getHeight()-40),this.elementView.valueWrapper.graphics.clear().f("#1bafea").rr(20,-2,this.getWidth()-20-10-2*this.BORDER,17,2),this.scrollButton_.visible=!0,this.scrollButton_.x=this.getWidth()-12,this.scrollPosition=Math.floor((this.scrollButton_.y-23)/(this.getHeight()-23-40)*(this.array_.length-b))):(this.elementView.valueWrapper.graphics.clear().f("#1bafea").rr(20,-2,this.getWidth()-20-2*this.BORDER,17,2),this.scrollButton_.visible=!1,this.scrollPosition=0);for(a=this.scrollPosition;a< +this.scrollPosition+b&&ac.length?c+"..":c;this.elementView.valueView.text=c;c=this.elementView.clone(!0);c.y=20*(a-this.scrollPosition)+23;this.view_.addChild(c)}}else"answer"==this.type?(this.view_.x=this.getX(),this.view_.y=this.getY(),this.textView_.text=this.getName(),this.valueView_.x=this.textView_.getMeasuredWidth()+ 14,this.valueView_.y=1,this.isNumber()?parseInt(this.getValue(),10)==this.getValue()?this.valueView_.text=this.getValue():this.valueView_.text=this.getValue().toFixed(1).replace(".00",""):this.valueView_.text=this.getValue(),this.rect_.graphics.clear().f("#ffffff").ss(1,2,0).s("#A0A1A1").rc(0,-14,this.textView_.getMeasuredWidth()+this.valueView_.getMeasuredWidth()+26,20,4,4,4,4),this.wrapper_.graphics.clear().f("#E457DC").ss(1,2,0).s("#E457DC").rc(this.textView_.getMeasuredWidth()+7,-11,this.valueView_.getMeasuredWidth()+ 15,14,7,7,7,7)):(this.view_.x=this.getX(),this.view_.y=this.getY(),this.textView_.text=this.getName(),this.valueView_.x=this.textView_.getMeasuredWidth()+14,this.valueView_.y=1,this.isNumber()?this.valueView_.text=this.getValue().toFixed(1).replace(".00",""):this.valueView_.text=this.getValue(),this.rect_.graphics.clear().f("#ffffff").ss(1,2,0).s("#A0A1A1").rc(0,-14,this.textView_.getMeasuredWidth()+this.valueView_.getMeasuredWidth()+26,20,4,4,4,4),this.wrapper_.graphics.clear().f("#ffbb14").ss(1, -2,0).s("orange").rc(this.textView_.getMeasuredWidth()+7,-11,this.valueView_.getMeasuredWidth()+15,14,7,7,7,7))};Entry.Variable.prototype.getName=function(){return this.name_};Entry.Variable.prototype.setName=function(a){Entry.assert("string"==typeof a,"Variable name must be string");this.name_=a;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(a){if("slide"!=this.type)this.value_=a;else{var b=Entry.isFloat(this.minValue_),c=Entry.isFloat(this.maxValue_);this.value_=athis.maxValue_?this.maxValue_:a;b||c||(this.viewValue_=this.value_,this.value_=Math.floor(this.value_))}this.isCloud_&&Entry.variableContainer.updateCloudVariables();this.updateView()};Entry.Variable.prototype.isVisible=function(){return this.visible_}; -Entry.Variable.prototype.setVisible=function(a){Entry.assert("boolean"==typeof a,"Variable visible state must be boolean");(this.visible_=this.view_.visible=a)&&this.updateView()};Entry.Variable.prototype.setX=function(a){this.x_=a;this.updateView()};Entry.Variable.prototype.getX=function(){return this.x_};Entry.Variable.prototype.setY=function(a){this.y_=a;this.updateView()};Entry.Variable.prototype.getY=function(){return this.y_}; -Entry.Variable.prototype.setWidth=function(a){this.width_=100>a?100:a;this.updateView()};Entry.Variable.prototype.getWidth=function(){return this.width_};Entry.Variable.prototype.isInList=function(a,b){this.getX();this.getY()};Entry.Variable.prototype.setHeight=function(a){this.height_=100>a?100:a;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(a){this.setX(a.x);this.setY(a.y);this.id_=a.id;this.setVisible(a.visible);this.setValue(a.value);this.setName(a.name);this.isCloud_=a.isCloud;"list"==this.type&&(this.setWidth(a.width),this.setHeight(a.height),this.array_=a.array)}; -Entry.Variable.prototype.toJSON=function(){var a={};a.name=this.name_;a.id=this.id_;a.visible=this.visible_;a.value=this.value_;a.variableType=this.type;"list"==this.type?(a.width=this.getWidth(),a.height=this.getHeight(),a.array=JSON.parse(JSON.stringify(this.array_))):"slide"==this.type&&(a.minValue=this.minValue_,a.maxValue=this.maxValue_);a.isCloud=this.isCloud_;a.object=this.object_;a.x=this.x_;a.y=this.y_;return a};Entry.Variable.prototype.remove=function(){Entry.stage.removeVariable(this)}; -Entry.Variable.prototype.clone=function(){var a=this.toJSON();a.isClone=!0;return a=new Entry.Variable(a)};Entry.Variable.prototype.getType=function(){return this.type};Entry.Variable.prototype.setType=function(a){this.type=a};Entry.Variable.prototype.getSlidePosition=function(a){var b=this.minValue_;return Math.abs((this.viewValue_||this.value_)-b)/Math.abs(this.maxValue_-b)*a+10}; -Entry.Variable.prototype.setSlideCommandX=function(a,b){var c=this.valueSetter_.graphics.command;a="undefined"==typeof a?10:a;c.x=b?a+10:c.x+a;this.updateSlideValueByView()}; -Entry.Variable.prototype.updateSlideValueByView=function(){var a=Math.max(this.valueSetter_.graphics.command.x-10,0)/this.maxWidth;0>a&&(a=0);1c?this.setValue(this.maxValue_):this.setValue(a)};Entry.Variable.prototype.getMinValue=function(){return this.minValue_}; -Entry.Variable.prototype.setMinValue=function(a){this.minValue_=a;this.value_a&&(this.value_=a);this.updateView()};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}; -Entry.VariableContainer.prototype.createDom=function(a){var b=this;this.view_=a;var c=Entry.createElement("table");c.addClass("entryVariableSelectorWorkspace");this.view_.appendChild(c);var d=Entry.createElement("tr");c.appendChild(d);var e=this.createSelectButton("all");e.setAttribute("rowspan","2");e.addClass("selected","allButton");d.appendChild(e);d.appendChild(this.createSelectButton("variable",Entry.variableEnable));d.appendChild(this.createSelectButton("message",Entry.messageEnable));d=Entry.createElement("tr"); -d.appendChild(this.createSelectButton("list",Entry.listEnable));d.appendChild(this.createSelectButton("func",Entry.functionEnable));c.appendChild(d);c=Entry.createElement("ul");c.addClass("entryVariableListWorkspace");this.view_.appendChild(c);this.listView_=c;c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.variable_create;var f=this;this.variableAddButton_=c;c.bindOnClick(function(a){a=f.variableAddPanel; -var c=a.view.name.value.trim();a.isOpen?c&&0!==c.length?b.addVariable():(a.view.addClass("entryRemove"),a.isOpen=!1):(a.view.removeClass("entryRemove"),a.view.name.focus(),a.isOpen=!0)});this.generateVariableAddView();this.generateListAddView();this.generateVariableSplitterView();this.generateVariableSettingView();this.generateListSettingView();c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.message_create; -this.messageAddButton_=c;c.bindOnClick(function(a){b.addMessage({name:Lang.Workspace.message+" "+(b.messages_.length+1)})});c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.list_create;this.listAddButton_=c;c.bindOnClick(function(a){a=f.listAddPanel;var c=a.view.name.value.trim();a.isOpen?c&&0!==c.length?b.addList():(a.view.addClass("entryRemove"),a.isOpen=!1):(a.view.removeClass("entryRemove"),a.view.name.focus(), -a.isOpen=!0)});c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.function_create;this.functionAddButton_=c;c.bindOnClick(function(a){Entry.playground.changeViewMode("code");"func"!=Entry.playground.selectedMenu&&Entry.playground.selectMenu("func");b.createFunction()});return a}; -Entry.VariableContainer.prototype.createSelectButton=function(a,b){var c=this;void 0===b&&(b=!0);var d=Entry.createElement("td");d.addClass("entryVariableSelectButtonWorkspace",a);d.innerHTML=Lang.Workspace[a];b?d.bindOnClick(function(b){c.selectFilter(a);this.addClass("selected")}):d.addClass("disable");return d}; -Entry.VariableContainer.prototype.selectFilter=function(a){for(var b=this.view_.getElementsByTagName("td"),c=0;ca.x_&&b.xe?!0:!1}; -Entry.VariableContainer.prototype.getListById=function(a){var b=this.lists_,c=[];if(0this.maxValue_?this.maxValue_:b;a||c||(this.viewValue_=this.value_,this.value_=Math.floor(this.value_))}this.isCloud_&&Entry.variableContainer.updateCloudVariables();this.updateView()};Entry.Variable.prototype.isVisible=function(){return this.visible_}; +Entry.Variable.prototype.setVisible=function(b){Entry.assert("boolean"==typeof b,"Variable visible state must be boolean");(this.visible_=this.view_.visible=b)&&this.updateView()};Entry.Variable.prototype.setX=function(b){this.x_=b;this.updateView()};Entry.Variable.prototype.getX=function(){return this.x_};Entry.Variable.prototype.setY=function(b){this.y_=b;this.updateView()};Entry.Variable.prototype.getY=function(){return this.y_}; +Entry.Variable.prototype.setWidth=function(b){this.width_=100>b?100:b;this.updateView()};Entry.Variable.prototype.getWidth=function(){return this.width_};Entry.Variable.prototype.isInList=function(b,a){this.getX();this.getY()};Entry.Variable.prototype.setHeight=function(b){this.height_=100>b?100:b;this.updateView()};Entry.Variable.prototype.getHeight=function(){return this.height_};Entry.Variable.prototype.takeSnapshot=function(){this.snapshot_=this.toJSON()}; +Entry.Variable.prototype.loadSnapshot=function(){this.snapshot_&&!this.isCloud_&&this.syncModel_(this.snapshot_)};Entry.Variable.prototype.syncModel_=function(b){this.setX(b.x);this.setY(b.y);this.id_=b.id;this.setVisible(b.visible);this.setValue(b.value);this.setName(b.name);this.isCloud_=b.isCloud;"list"==this.type&&(this.setWidth(b.width),this.setHeight(b.height),this.array_=b.array)}; +Entry.Variable.prototype.toJSON=function(){var b={};b.name=this.name_;b.id=this.id_;b.visible=this.visible_;b.value=this.value_;b.variableType=this.type;"list"==this.type?(b.width=this.getWidth(),b.height=this.getHeight(),b.array=JSON.parse(JSON.stringify(this.array_))):"slide"==this.type&&(b.minValue=this.minValue_,b.maxValue=this.maxValue_);b.isCloud=this.isCloud_;b.object=this.object_;b.x=this.x_;b.y=this.y_;return b};Entry.Variable.prototype.remove=function(){Entry.stage.removeVariable(this)}; +Entry.Variable.prototype.clone=function(){var b=this.toJSON();b.isClone=!0;return b=new Entry.Variable(b)};Entry.Variable.prototype.getType=function(){return this.type};Entry.Variable.prototype.setType=function(b){this.type=b};Entry.Variable.prototype.getSlidePosition=function(b){var a=this.minValue_;return Math.abs((this.viewValue_||this.value_)-a)/Math.abs(this.maxValue_-a)*b+10}; +Entry.Variable.prototype.setSlideCommandX=function(b,a){var c=this.valueSetter_.graphics.command;b="undefined"==typeof b?10:b;c.x=a?b+10:c.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?this.setValue(this.maxValue_):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()};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}; +Entry.VariableContainer.prototype.createDom=function(b){var a=this;this.view_=b;var c=Entry.createElement("table");c.addClass("entryVariableSelectorWorkspace");this.view_.appendChild(c);var d=Entry.createElement("tr");c.appendChild(d);var e=this.createSelectButton("all");e.setAttribute("rowspan","2");e.addClass("selected","allButton");d.appendChild(e);d.appendChild(this.createSelectButton("variable",Entry.variableEnable));d.appendChild(this.createSelectButton("message",Entry.messageEnable));d=Entry.createElement("tr"); +d.appendChild(this.createSelectButton("list",Entry.listEnable));d.appendChild(this.createSelectButton("func",Entry.functionEnable));c.appendChild(d);c=Entry.createElement("ul");c.addClass("entryVariableListWorkspace");this.view_.appendChild(c);this.listView_=c;c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.variable_create;var f=this;this.variableAddButton_=c;c.bindOnClick(function(b){b=f.variableAddPanel; +var c=b.view.name.value.trim();b.isOpen?c&&0!==c.length?a.addVariable():(b.view.addClass("entryRemove"),b.isOpen=!1):(b.view.removeClass("entryRemove"),b.view.name.focus(),b.isOpen=!0)});this.generateVariableAddView();this.generateListAddView();this.generateVariableSplitterView();this.generateVariableSettingView();this.generateListSettingView();c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.message_create; +this.messageAddButton_=c;c.bindOnClick(function(b){a.addMessage({name:Lang.Workspace.message+" "+(a.messages_.length+1)})});c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.list_create;this.listAddButton_=c;c.bindOnClick(function(b){b=f.listAddPanel;var c=b.view.name.value.trim();b.isOpen?c&&0!==c.length?a.addList():(b.view.addClass("entryRemove"),b.isOpen=!1):(b.view.removeClass("entryRemove"),b.view.name.focus(), +b.isOpen=!0)});c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.function_create;this.functionAddButton_=c;c.bindOnClick(function(b){Entry.playground.changeViewMode("code");"func"!=Entry.playground.selectedMenu&&Entry.playground.selectMenu("func");a.createFunction()});return b}; +Entry.VariableContainer.prototype.createSelectButton=function(b,a){var c=this;void 0===a&&(a=!0);var d=Entry.createElement("td");d.addClass("entryVariableSelectButtonWorkspace",b);d.innerHTML=Lang.Workspace[b];a?d.bindOnClick(function(a){c.selectFilter(b);this.addClass("selected")}):d.addClass("disable");return d}; +Entry.VariableContainer.prototype.selectFilter=function(b){for(var a=this.view_.getElementsByTagName("td"),c=0;cb.x_&&a.xe?!0:!1}; +Entry.VariableContainer.prototype.getListById=function(b){var a=this.lists_,c=[];if(0c.getValue()&&c.setValue(0),100a&&(b.length=a)}this.updateListSettingView()};Entry.VariableContainer.prototype.updateViews=function(){var a=this.lists_;this.variables_.map(function(b){b.updateView()});a.map(function(b){b.updateView()})}; -Entry.VariableContainer.prototype.updateSelectedVariable=function(a,b){a?"variable"==a.type?(this.selectedVariable=a,this.updateVariableSettingView(a)):"slide"==a.type?(this.selectedVariable=a,this.updateVariableSettingView(a)):"list"==a.type&&(this.selectedList=a,this.updateListSettingView(a)):(this.selectedVariable=null,"variable"==(b||"variable")?this.variableSettingView.addClass("entryRemove"):this.listSettingView.addClass("entryRemove"))}; -Entry.VariableContainer.prototype.removeLocalVariables=function(a){var b=[],c=this;this.mapVariable(function(a,c){a.object_&&a.object_==c&&b.push(a)},a);b.map(function(b){c.removeVariable(b)})}; -Entry.VariableContainer.prototype.updateCloudVariables=function(){var a=Entry.projectId;if(Entry.cloudSavable&&a){var b=Entry.variableContainer,a=b.variables_.filter(function(b){return b.isCloud_}),a=a.map(function(b){return b.toJSON()}),b=b.lists_.filter(function(b){return b.isCloud_}),b=b.map(function(b){return b.toJSON()});$.ajax({url:"/api/project/variable/"+Entry.projectId,type:"PUT",data:{variables:a,lists:b}}).done(function(){})}};Entry.block.run={skeleton:"basic",color:"#3BBD70",contents:["this is","basic block"],func:function(){}};Entry.block.jr_start={skeleton:"pebble_event",event:"start",color:"#3BBD70",contents:[{type:"Indicator",img:"/img/assets/ntry/bitmap/jr/block_play_image.png",highlightColor:"#3BBD70",size:22}],func:function(){var a=Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT),b;for(b in a)this._unit=a[b];Ntry.unitComp=Ntry.entityManager.getComponent(this._unit.id,Ntry.STATIC.UNIT)}}; +Entry.VariableContainer.prototype.changeListName=function(b,a){b.name_!=a&&(Entry.isExist(a,"name_",this.lists_)?(b.listElement.nameField.value=b.name_,Entry.toast.alert(Lang.Workspace.list_rename_failed,Lang.Workspace.list_dup)):10c.getValue()&&c.setValue(0),100b&&(a.length=b)}this.updateListSettingView()};Entry.VariableContainer.prototype.updateViews=function(){var b=this.lists_;this.variables_.map(function(a){a.updateView()});b.map(function(a){a.updateView()})}; +Entry.VariableContainer.prototype.updateSelectedVariable=function(b,a){b?"variable"==b.type?(this.selectedVariable=b,this.updateVariableSettingView(b)):"slide"==b.type?(this.selectedVariable=b,this.updateVariableSettingView(b)):"list"==b.type&&(this.selectedList=b,this.updateListSettingView(b)):(this.selectedVariable=null,"variable"==(a||"variable")?this.variableSettingView.addClass("entryRemove"):this.listSettingView.addClass("entryRemove"))}; +Entry.VariableContainer.prototype.removeLocalVariables=function(b){var a=[],c=this;this.mapVariable(function(b,c){b.object_&&b.object_==c&&a.push(b)},b);a.map(function(a){c.removeVariable(a)})}; +Entry.VariableContainer.prototype.updateCloudVariables=function(){var b=Entry.projectId;if(Entry.cloudSavable&&b){var a=Entry.variableContainer,b=a.variables_.filter(function(a){return a.isCloud_}),b=b.map(function(a){return a.toJSON()}),a=a.lists_.filter(function(a){return a.isCloud_}),a=a.map(function(a){return a.toJSON()});$.ajax({url:"/api/project/variable/"+Entry.projectId,type:"PUT",data:{variables:b,lists:a}}).done(function(){})}};Entry.block.run={skeleton:"basic",color:"#3BBD70",contents:["this is","basic block"],func:function(){}};Entry.block.jr_start={skeleton:"pebble_event",event:"start",color:"#3BBD70",contents:[{type:"Indicator",img:"/img/assets/ntry/bitmap/jr/block_play_image.png",highlightColor:"#3BBD70",size:22}],func:function(){var b=Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT),a;for(a in b)this._unit=b[a];Ntry.unitComp=Ntry.entityManager.getComponent(this._unit.id,Ntry.STATIC.UNIT)}}; Entry.block.jr_repeat={skeleton:"pebble_loop",color:"#127CDB",contents:[{type:"Dropdown",key:"REPEAT",options:[[1,1],[2,2],[3,3],[4,4],[5,5],[6,6],[7,7],[8,8],[9,9],[10,10]],value:1},{type:"Text",text:"\ubc18\ubcf5"},{type:"Statement",key:"STATEMENT",accept:"pebble_basic"}],func:function(){if(void 0===this.repeatCount)return this.repeatCount=this.block.values.REPEAT,Entry.STATIC.CONTINUE;if(0'),{parent:a});this.offset=this.svgDom.offset();this._svgWidth=this.svgDom.width();this.snap=Snap("#blockMenu"); +Entry.block.jr_if_construction={skeleton:"basic_loop",color:"#498DEB",contents:["\ub9cc\uc57d",{type:"Image",img:"/img/assets/ntry/bitmap/jr/jr_construction_image.png",size:18},"\uc55e\uc5d0 \uc788\ub2e4\uba74",{type:"Image",img:"/img/assets/week/blocks/for.png",size:24},{type:"Statement",key:"STATEMENT",accept:"basic",alignY:15,alignX:2}],func:function(){if(!this.isContinue){var b=Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT),a,c;for(c in b)a=b[c];b=Ntry.entityManager.getComponent(a.id, +Ntry.STATIC.UNIT);a=Ntry.entityManager.getComponent(a.id,Ntry.STATIC.GRID);a={x:a.x,y:a.y};Ntry.addVectorByDirection(a,b.direction,1);a=Ntry.entityManager.find({type:Ntry.STATIC.GRID,x:a.x,y:a.y},{type:Ntry.STATIC.TILE,tileType:Ntry.STATIC.OBSTACLE_REPAIR});this.isContinue=!0;b=this.block.values.STATEMENT;if(0!==a.length&&1!==b.getBlocks().length)return this.executor.stepInto(b),Entry.STATIC.CONTINUE}}}; +Entry.block.jr_if_speed={skeleton:"basic_loop",color:"#498DEB",contents:["\ub9cc\uc57d",{type:"Image",img:"/img/assets/ntry/bitmap/jr/jr_speed_image.png",size:18},"\uc55e\uc5d0 \uc788\ub2e4\uba74",{type:"Image",img:"/img/assets/week/blocks/for.png",size:24},{type:"Statement",key:"STATEMENT",accept:"basic",alignY:15,alignX:2}],func:function(){if(!this.isContinue){var b=Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT),a,c;for(c in b)a=b[c];b=Ntry.entityManager.getComponent(a.id,Ntry.STATIC.UNIT); +a=Ntry.entityManager.getComponent(a.id,Ntry.STATIC.GRID);a={x:a.x,y:a.y};Ntry.addVectorByDirection(a,b.direction,1);a=Ntry.entityManager.find({type:Ntry.STATIC.GRID,x:a.x,y:a.y},{type:Ntry.STATIC.TILE,tileType:Ntry.STATIC.OBSTACLE_SLOW});this.isContinue=!0;b=this.block.values.STATEMENT;if(0!==a.length&&1!==b.getBlocks().length)return this.executor.stepInto(b),Entry.STATIC.CONTINUE}}};Entry.BlockMenu=function(b,a){Entry.Model(this,!1);this._align=a||"CENTER";b="string"===typeof b?$("#"+b):$(b);if("DIV"!==b.prop("tagName"))return console.error("Dom is not div element");if("function"!==typeof window.Snap)return console.error("Snap library is required");this.svgDom=Entry.Dom($(''),{parent:b});this.offset=this.svgDom.offset();this._svgWidth=this.svgDom.width();this.snap=Snap("#blockMenu"); this.svgGroup=this.snap.group();this.svgThreadGroup=this.svgGroup.group();this.svgThreadGroup.board=this;this.svgBlockGroup=this.svgGroup.group();this.svgBlockGroup.board=this;this.changeEvent=new Entry.Event(this);this.observe(this,"generateDragBlockObserver",["dragBlock"]);Entry.documentMousedown&&Entry.documentMousedown.attach(this,this.setSelectedBlock)}; -(function(a){a.schema={code:null,dragBlock:null,closeBlock:null,selectedBlockView:null};a.changeCode=function(b){if(!(b instanceof Entry.Code))return console.error("You must inject code instance");this.codeListener&&this.code.changeEvent.detach(this.codeListener);this.set({code:b});var a=this;this.codeListener=this.code.changeEvent.attach(this,function(){a.changeEvent.notify()});b.createView(this);this.align()};a.bindCodeView=function(b){this.svgBlockGroup.remove();this.svgThreadGroup.remove();this.svgBlockGroup= -b.svgBlockGroup;this.svgThreadGroup=b.svgThreadGroup;this.svgGroup.append(this.svgThreadGroup);this.svgGroup.append(this.svgBlockGroup)};a.align=function(){for(var b=this.code.getThreads(),a=10,d="LEFT"==this._align?20:this.svgDom.width()/2,e=0,f=b.length;ee||(d.splice(e,1),(d=b.getFirstBlock())&&d.destroy(a))};a.doDestroyThread=function(b,a){var d=this._data,e=d.indexOf(b);0>e||(d.splice(e,1),(d=b.getFirstBlock())&&d.doDestroy(a))};a.getThreads=function(){return this._data};a.toJSON=function(){for(var b=this.getThreads(),a=[],d=0,e=b.length;de||(d.splice(e,1),(d=a.getFirstBlock())&&d.destroy(b))};b.doDestroyThread=function(a,b){var d=this._data,e=d.indexOf(a);0>e||(d.splice(e,1),(d=a.getFirstBlock())&&d.doDestroy(b))};b.getThreads=function(){return this._data};b.toJSON=function(){for(var a=this.getThreads(),b=[],d=0,e=a.length;d=e&&g>=a)}};a.align=function(){var b=this.getPosition();this.svgGroup.attr({transform:"t"+b.x+" "+b.y})};a.setPosition=function(){var b=this.board.svgDom;this._x=b.width()-110;this._y=b.height()-110;this.align()};a.getPosition=function(){return{x:this._x, -y:this._y}};a.tAnimation=function(b){if(b!==this.isOver){b=void 0===b?!0:b;var a=this.trashcanTop;b?a.animate({transform:"t5 -20 r30"},50):a.animate({transform:"r0"},50);this.isOver=b}}})(Entry.FieldTrashcan.prototype);Entry.Board=function(a){function b(b){var a=$(window);b=a.scrollTop();var a=a.scrollLeft(),f=c.offset;c.relativeOffset={top:f.top-b,left:f.left-a};console.log("update")}a="string"===typeof a?$("#"+a):$(a);if("DIV"!==a.prop("tagName"))return console.error("Dom is not div element");if("function"!==typeof window.Snap)return console.error("Snap library is required");Entry.Model(this,!1);this.svgDom=Entry.Dom($(''), -{parent:a});this.offset=this.svgDom.offset();this.offset.top=130;this.offset.left-=$(window).scrollLeft();this.relativeOffset=this.offset;var c=this;$(window).scroll(b);Entry.windowResized.attach(this,b);this.snap=Snap("#play");this._blockViews=[];this.trashcan=new Entry.FieldTrashcan(this);this.svgGroup=this.snap.group();this.svgThreadGroup=this.svgGroup.group();this.svgThreadGroup.board=this;this.svgBlockGroup=this.svgGroup.group();this.svgBlockGroup.board=this;Entry.ANIMATION_DURATION=200;Entry.BOARD_PADDING= -100;this.changeEvent=new Entry.Event(this);this.scroller=new Entry.Scroller(this,!0,!0);this._addControl(a);Entry.documentMousedown&&Entry.documentMousedown.attach(this,this.setSelectedBlock);Entry.keyPressed&&Entry.keyPressed.attach(this,this._keyboardControl)}; -(function(a){a.schema={code:null,dragBlock:null,magnetedBlockView:null,selectedBlockView:null};a.changeCode=function(b){this.codeListener&&this.code.changeEvent.detach(this.codeListener);this.set({code:b});var a=this;this.codeListener=this.code.changeEvent.attach(this,function(){a.changeEvent.notify()});b.createView(this);this.changeEvent.notify()};a.bindCodeView=function(b){this.svgBlockGroup.remove();this.svgThreadGroup.remove();this.svgBlockGroup=b.svgBlockGroup;this.svgThreadGroup=b.svgThreadGroup; -this.svgGroup.append(this.svgThreadGroup);this.svgGroup.append(this.svgBlockGroup)};a.setMagnetedBlock=function(b){if(this.magnetedBlockView){if(this.magnetedBlockView===b)return;this.magnetedBlockView.set({magneting:!1})}this.set({magnetedBlockView:b});b&&(b.set({magneting:!0,animating:!0}),b.dominate(),this.dragBlock.dominate())};a.getCode=function(){return this.code};a.findById=function(b){for(var a=this.code.getThreads(),d=0,e=a.length;d=e&&g>=b)}};b.align=function(){var a=this.getPosition();this.svgGroup.attr({transform:"t"+a.x+" "+a.y})};b.setPosition=function(){var a=this.board.svgDom;this._x=a.width()-110;this._y=a.height()-110;this.align()};b.getPosition=function(){return{x:this._x, +y:this._y}};b.tAnimation=function(a){if(a!==this.isOver){a=void 0===a?!0:a;var b=this.trashcanTop;a?b.animate({transform:"t5 -20 r30"},50):b.animate({transform:"r0"},50);this.isOver=a}}})(Entry.FieldTrashcan.prototype);Entry.Board=function(b){function a(a){var b=$(window);a=b.scrollTop();var b=b.scrollLeft(),f=c.offset;c.relativeOffset={top:f.top-a,left:f.left-b};console.log("update")}b="string"===typeof b?$("#"+b):$(b);if("DIV"!==b.prop("tagName"))return console.error("Dom is not div element");if("function"!==typeof window.Snap)return console.error("Snap library is required");Entry.Model(this,!1);this.svgDom=Entry.Dom($(''), +{parent:b});this.offset=this.svgDom.offset();this.offset.top=130;this.offset.left-=$(window).scrollLeft();this.relativeOffset=this.offset;var c=this;$(window).scroll(a);Entry.windowResized.attach(this,a);this.snap=Snap("#play");this._blockViews=[];this.trashcan=new Entry.FieldTrashcan(this);this.svgGroup=this.snap.group();this.svgThreadGroup=this.svgGroup.group();this.svgThreadGroup.board=this;this.svgBlockGroup=this.svgGroup.group();this.svgBlockGroup.board=this;Entry.ANIMATION_DURATION=200;Entry.BOARD_PADDING= +100;this.changeEvent=new Entry.Event(this);this.scroller=new Entry.Scroller(this,!0,!0);this._addControl(b);Entry.documentMousedown&&Entry.documentMousedown.attach(this,this.setSelectedBlock);Entry.keyPressed&&Entry.keyPressed.attach(this,this._keyboardControl)}; +(function(b){b.schema={code:null,dragBlock:null,magnetedBlockView:null,selectedBlockView:null};b.changeCode=function(a){this.codeListener&&this.code.changeEvent.detach(this.codeListener);this.set({code:a});var b=this;this.codeListener=this.code.changeEvent.attach(this,function(){b.changeEvent.notify()});a.createView(this);this.changeEvent.notify()};b.bindCodeView=function(a){this.svgBlockGroup.remove();this.svgThreadGroup.remove();this.svgBlockGroup=a.svgBlockGroup;this.svgThreadGroup=a.svgThreadGroup; +this.svgGroup.append(this.svgThreadGroup);this.svgGroup.append(this.svgBlockGroup)};b.setMagnetedBlock=function(a){if(this.magnetedBlockView){if(this.magnetedBlockView===a)return;this.magnetedBlockView.set({magneting:!1})}this.set({magnetedBlockView:a});a&&(a.set({magneting:!0,animating:!0}),a.dominate(),this.dragBlock.dominate())};b.getCode=function(){return this.code};b.findById=function(a){for(var b=this.code.getThreads(),d=0,e=b.length;d10", - "class": "ev3_output" - },//end of XBOT Blocks added + "xml": "", + "class": "ev3_sensor" + }, "ev3_touch_sensor": { "isNotFor": ["EV3"], "xml": "", "class": "ev3_sensor" }, + "ev3_color_sensor": { + "isNotFor": ["EV3"], + "xml": "", + "class": "ev3_sensor" + }, + "ev3_motor_power": { + "isNotFor": ["EV3"], + "xml": "50", + "class": "ev3_output" + }, + "ev3_motor_power_on_time": { + "isNotFor": ["EV3"], + "xml": "250", + "class": "ev3_output" + }, + "ev3_motor_degrees": { + "isNotFor": ["EV3"], + "xml": " ", + "class": "ev3_output" + }, "when_run_button_click": { "xml": "", "class": "event", diff --git a/src/blocks/block_ev3.js b/src/blocks/block_ev3.js index db40adceea..109dbf18c3 100644 --- a/src/blocks/block_ev3.js +++ b/src/blocks/block_ev3.js @@ -11,7 +11,11 @@ Entry.EV3 = { '3': undefined, '4': undefined }, - deviceType: { + motorMovementTypes: { + Degrees: 0, + Power: 1 + }, + deviceTypes: { NxtTouch: 1, NxtLight: 2, NxtSound: 3, @@ -30,48 +34,71 @@ Entry.EV3 = { WrongPort: 0x7f, Unknown: 0xff }, + colorSensorValue: ['', '000000', '0000FF', '00FF00', 'FFFF00', 'FF0000', 'FFFFFF', 'A52A2A'], + timeouts: [], + removeTimeout: function(id) { + clearTimeout(id); + var timeouts = this.timeouts; + var index = timeouts.indexOf(id); + if(index >= 0) { + timeouts.splice(index, 1); + } + }, + removeAllTimeouts: function() { + var timeouts = this.timeouts; + for(var i in timeouts) { + clearTimeout(timeouts[i]); + } + this.timeouts = []; + }, setZero: function() { var portMap = this.PORT_MAP; Object.keys(portMap).forEach(function (port) { - Entry.hw.sendQueue[port] = portMap[port]; + var regex = /[A-D]/i; + if(regex.test(port)) { + Entry.hw.sendQueue[port] = { + type: Entry.EV3.motorMovementTypes.Power, + power: 0 + } + } else { + Entry.hw.sendQueue[port] = portMap[port]; + } + }); Entry.hw.update(); }, name: 'EV3' }; -//Motor -Blockly.Blocks.ev3_port_out = { +//sensor +Blockly.Blocks.ev3_get_sensor_value = { init: function() { this.setColour("#00979D"); this.appendDummyInput() .appendField('') .appendField(new Blockly.FieldDropdown([ - ['A', 'A'], - ['B', 'B'], - ['C', 'C'], - ['D', 'D'] + ['1', '1'], + ['2', '2'], + ['3', '3'], + ['4', '4'] ]), "PORT") - .appendField('의 값을'); - this.appendValueInput("VALUE") - .setCheck(["Number", "String", null]); - this.appendDummyInput() - .appendField('으로 변환'); - // this.setOutput(true, 'Number'); + .appendField('의 값'); + this.setOutput(true, 'Number'); this.setInputsInline(true); - this.setPreviousStatement(true); - this.setNextStatement(true); } }; -Entry.block.ev3_port_out = function (sprite, script) { +Entry.block.ev3_get_sensor_value = function (sprite, script) { var port = script.getStringField("PORT", script); - var value = script.getValue("VALUE", script); - Entry.hw.sendQueue[port] = value; - return script.callReturn(); + var portData = Entry.hw.getDigitalPortValue(script.getNumberField("PORT", script)); + var result; + if($.isPlainObject(portData)) { + result = portData.siValue || 0; + } + return result; }; -//sensor + Blockly.Blocks.ev3_touch_sensor = { init: function() { this.setColour("#00979D"); @@ -92,12 +119,211 @@ Blockly.Blocks.ev3_touch_sensor = { Entry.block.ev3_touch_sensor = function (sprite, script) { var port = script.getStringField("PORT", script); var portData = Entry.hw.getDigitalPortValue(script.getNumberField("PORT", script)); - result = false; - if(portData.type == Entry.EV3.deviceType.Touch) { + var result = false; + if(portData.type == Entry.EV3.deviceTypes.Touch) { if(Number(portData.siValue) >= 1) { result = true; } } return result; +}; + +Blockly.Blocks.ev3_color_sensor = { + init: function() { + this.setColour("#00979D"); + this.appendDummyInput() + .appendField('') + .appendField(new Blockly.FieldDropdown([ + ['1', '1'], + ['2', '2'], + ['3', '3'], + ['4', '4'] + ]), "PORT") + .appendField('의 ') + .appendField(new Blockly.FieldDropdown([ + ['RGB', 'RGB'], + ['R', 'R'], + ['G', 'G'], + ['B', 'B'] + ]), "RGB") + .appendField('값'); + this.setOutput(true, 'String'); + this.setInputsInline(true); + } +}; + +Entry.block.ev3_color_sensor = function (sprite, script) { + var port = script.getStringField("PORT", script); + var rgb = script.getStringField("RGB", script); + var portData = Entry.hw.getDigitalPortValue(script.getNumberField("PORT", script)); + var result = ''; + if(portData.type == Entry.EV3.deviceTypes.Color) { + if(portData.siValue == 0) { + result = ''; + } else { + switch(rgb) { + case 'RGB': + result = Entry.EV3.colorSensorValue[portData.siValue]; + break; + case 'R': + result = Entry.EV3.colorSensorValue[portData.siValue].substring(0, 2); + break; + case 'G': + result = Entry.EV3.colorSensorValue[portData.siValue].substring(2, 4); + break; + case 'B': + result = Entry.EV3.colorSensorValue[portData.siValue].substring(4, 6); + break; + } + } + } else { + result = '컬러 센서 아님'; + } + + return result; +}; + + +//Motor +Blockly.Blocks.ev3_motor_power = { + init: function() { + this.setColour("#00979D"); + this.appendDummyInput() + .appendField('') + .appendField(new Blockly.FieldDropdown([ + ['A', 'A'], + ['B', 'B'], + ['C', 'C'], + ['D', 'D'] + ]), "PORT") + .appendField('의 값을'); + this.appendValueInput("VALUE") + .setCheck(["Number"]); + this.appendDummyInput() + .appendField('으로 출력'); + // this.setOutput(true, 'Number'); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + } +}; + +Entry.block.ev3_motor_power = function (sprite, script) { + var port = script.getStringField("PORT", script); + var value = script.getValue("VALUE", script); + Entry.hw.sendQueue[port] = { + 'id': Math.floor(Math.random() * 100000, 0), + 'type': Entry.EV3.motorMovementTypes.Power, + 'power': value, + }; + return script.callReturn(); +}; + +Blockly.Blocks.ev3_motor_power_on_time = { + init: function() { + this.setColour("#00979D"); + this.appendDummyInput() + .appendField('') + .appendField(new Blockly.FieldDropdown([ + ['A', 'A'], + ['B', 'B'], + ['C', 'C'], + ['D', 'D'] + ]), "PORT") + .appendField('의 값을'); + this.appendValueInput("TIME") + .setCheck(["Number"]); + this.appendDummyInput() + .appendField('초 동안'); + this.appendValueInput("VALUE") + .setCheck(["Number"]); + this.appendDummyInput() + .appendField('으로 출력'); + // this.setOutput(true, 'Number'); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + } +}; + +Entry.block.ev3_motor_power_on_time = function (sprite, script) { + var sq = Entry.hw.sendQueue; + if (!script.isStart) { + script.isStart = true; + script.timeFlag = 1; + var port = script.getStringField("PORT", script); + var time = script.getValue("TIME", script); + var value = script.getValue("VALUE", script); + Entry.hw.sendQueue[port] = { + 'id': Math.floor(Math.random() * 100000, 0), + 'type': Entry.EV3.motorMovementTypes.Power, + 'power': value + }; + var timeValue = time * 1000; + var timer = setTimeout(function() { + script.timeFlag = 0; + Entry.EV3.removeTimeout(timer); + }, timeValue); + Entry.EV3.timeouts.push(timer); + return script; + } else if (script.timeFlag == 1) { + return script; + } else { + delete script.isStart; + delete script.timeFlag; + Entry.engine.isContinue = false; + Entry.hw.sendQueue[port] = { + 'id': Math.floor(Math.random() * 100000, 0), + 'type': Entry.EV3.motorMovementTypes.Power, + 'power': 0 + }; + return script.callReturn(); + } +}; + + +Blockly.Blocks.ev3_motor_degrees = { + init: function() { + this.setColour("#00979D"); + this.appendDummyInput() + .appendField('') + .appendField(new Blockly.FieldDropdown([ + ['A', 'A'], + ['B', 'B'], + ['C', 'C'], + ['D', 'D'] + ]), "PORT") + .appendField('의 값을') + .appendField(new Blockly.FieldDropdown([ + ['시계방향', 'CW'], + ['반시계방향', 'CCW'] + ]), "DIRECTION") + .appendField('으로 ') + this.appendValueInput("DEGREE") + .setCheck(["Number"]); + this.appendDummyInput() + .appendField('도 만큼 회전'); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + } +}; + +Entry.block.ev3_motor_degrees = function (sprite, script) { + var port = script.getStringField("PORT", script); + var degree = script.getValue("DEGREE", script); + if(degree <= 0) { + degree = 0; + } else if(degree >= 720) { + degree = 720; + } + var direction = script.getStringField("DIRECTION", script); + Entry.hw.sendQueue[port] = { + 'id': Math.floor(Math.random() * 100000, 0), + 'type': Entry.EV3.motorMovementTypes.Degrees, + 'degree': degree, + 'power': (direction == 'CW') ? 50 : -50 + }; + return script.callReturn(); }; \ No newline at end of file From d22348e870a89fb2db22a6f78db851081b2487e2 Mon Sep 17 00:00:00 2001 From: kimorkim Date: Mon, 2 May 2016 17:22:49 +0900 Subject: [PATCH 03/15] =?UTF-8?q?=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/entry.js | 3 ++- dist/entry.min.js | 4 ++-- src/blocks/block_ev3.js | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index 349839e3bc..87273dce69 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -2004,6 +2004,7 @@ Blockly.Blocks.ev3_motor_power_on_time = {init:function() { this.setNextStatement(!0); }}; Entry.block.ev3_motor_power_on_time = function(b, a) { + var c = a.getStringField("PORT", a); if (a.isStart) { if (1 == a.timeFlag) { return a; @@ -2014,9 +2015,9 @@ Entry.block.ev3_motor_power_on_time = function(b, a) { Entry.hw.sendQueue[c] = {id:Math.floor(1E5 * Math.random(), 0), type:Entry.EV3.motorMovementTypes.Power, power:0}; return a.callReturn(); } + var d = a.getValue("TIME", a), e = a.getValue("VALUE", a); a.isStart = !0; a.timeFlag = 1; - var c = a.getStringField("PORT", a), d = a.getValue("TIME", a), e = a.getValue("VALUE", a); Entry.hw.sendQueue[c] = {id:Math.floor(1E5 * Math.random(), 0), type:Entry.EV3.motorMovementTypes.Power, power:e}; var f = setTimeout(function() { a.timeFlag = 0; diff --git a/dist/entry.min.js b/dist/entry.min.js index c49fd3d4fa..7c83f53398 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -226,8 +226,8 @@ Entry.block.ev3_color_sensor=function(b,a){a.getStringField("PORT",a);var c=a.ge Entry.block.ev3_motor_power=function(b,a){var c=a.getStringField("PORT",a),d=a.getValue("VALUE",a);Entry.hw.sendQueue[c]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Power,power:d};return a.callReturn()}; Blockly.Blocks.ev3_motor_power_on_time={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["A","A"],["B","B"],["C","C"],["D","D"]]),"PORT").appendField("\uc758 \uac12\uc744");this.appendValueInput("TIME").setCheck(["Number"]);this.appendDummyInput().appendField("\ucd08 \ub3d9\uc548");this.appendValueInput("VALUE").setCheck(["Number"]);this.appendDummyInput().appendField("\uc73c\ub85c \ucd9c\ub825");this.setInputsInline(!0);this.setPreviousStatement(!0); this.setNextStatement(!0)}}; -Entry.block.ev3_motor_power_on_time=function(b,a){if(a.isStart){if(1==a.timeFlag)return a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;Entry.hw.sendQueue[c]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Power,power:0};return a.callReturn()}a.isStart=!0;a.timeFlag=1;var c=a.getStringField("PORT",a),d=a.getValue("TIME",a),e=a.getValue("VALUE",a);Entry.hw.sendQueue[c]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Power,power:e};var f=setTimeout(function(){a.timeFlag= -0;Entry.EV3.removeTimeout(f)},1E3*d);Entry.EV3.timeouts.push(f);return a}; +Entry.block.ev3_motor_power_on_time=function(b,a){var c=a.getStringField("PORT",a);if(a.isStart){if(1==a.timeFlag)return a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;Entry.hw.sendQueue[c]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Power,power:0};return a.callReturn()}var d=a.getValue("TIME",a),e=a.getValue("VALUE",a);a.isStart=!0;a.timeFlag=1;Entry.hw.sendQueue[c]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Power,power:e};var f= +setTimeout(function(){a.timeFlag=0;Entry.EV3.removeTimeout(f)},1E3*d);Entry.EV3.timeouts.push(f);return a}; Blockly.Blocks.ev3_motor_degrees={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["A","A"],["B","B"],["C","C"],["D","D"]]),"PORT").appendField("\uc758 \uac12\uc744").appendField(new Blockly.FieldDropdown([["\uc2dc\uacc4\ubc29\ud5a5","CW"],["\ubc18\uc2dc\uacc4\ubc29\ud5a5","CCW"]]),"DIRECTION").appendField("\uc73c\ub85c ");this.appendValueInput("DEGREE").setCheck(["Number"]);this.appendDummyInput().appendField("\ub3c4 \ub9cc\ud07c \ud68c\uc804"); this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.ev3_motor_degrees=function(b,a){var c=a.getStringField("PORT",a),d=a.getValue("DEGREE",a);0>=d?d=0:720<=d&&(d=720);var e=a.getStringField("DIRECTION",a);Entry.hw.sendQueue[c]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Degrees,degree:d,power:"CW"==e?50:-50};return a.callReturn()};Blockly.Blocks.wait_second={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_wait_second_1);this.appendValueInput("SECOND").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.FLOW_wait_second_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.wait_second=function(b,a){if(a.isStart){if(1==a.timeFlag)return a;delete a.timeFlag;delete a.isStart;Entry.engine.isContinue=!1;return a.callReturn()}a.isStart=!0;a.timeFlag=1;var c=a.getNumberValue("SECOND",a),c=60/(Entry.FPS||60)*c*1E3;setTimeout(function(){a.timeFlag=0},c);return a}; diff --git a/src/blocks/block_ev3.js b/src/blocks/block_ev3.js index 109dbf18c3..870087e028 100644 --- a/src/blocks/block_ev3.js +++ b/src/blocks/block_ev3.js @@ -249,12 +249,12 @@ Blockly.Blocks.ev3_motor_power_on_time = { Entry.block.ev3_motor_power_on_time = function (sprite, script) { var sq = Entry.hw.sendQueue; + var port = script.getStringField("PORT", script); if (!script.isStart) { - script.isStart = true; - script.timeFlag = 1; - var port = script.getStringField("PORT", script); var time = script.getValue("TIME", script); var value = script.getValue("VALUE", script); + script.isStart = true; + script.timeFlag = 1; Entry.hw.sendQueue[port] = { 'id': Math.floor(Math.random() * 100000, 0), 'type': Entry.EV3.motorMovementTypes.Power, From 20e76345e977d9bb781cb4376a2e3e3a46609ded Mon Sep 17 00:00:00 2001 From: jykim Date: Mon, 4 Jul 2016 18:45:26 +0900 Subject: [PATCH 04/15] =?UTF-8?q?ev3=20new=20block=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/entry.js | 2 +- dist/entry.min.js | 13 +- src/hw.js | 2 +- src/workspace/block_entry.js | 335 +++++++++++++++++++++++++++++++++++ 4 files changed, 348 insertions(+), 4 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index 245941f95a..9ac1973300 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -13131,7 +13131,7 @@ Entry.HW = function() { this.settingQueue = {}; this.socketType = this.hwModule = this.selectedDevice = null; Entry.addEventListener("stop", this.setZero); - this.hwInfo = {11:Entry.Arduino, 12:Entry.SensorBoard, 13:Entry.CODEino, 14:Entry.joystick, 15:Entry.dplay, 16:Entry.nemoino, 17:Entry.Xbot, 18:Entry.ardublock, 24:Entry.Hamster, 25:Entry.Albert, 31:Entry.Bitbrick, 42:Entry.Arduino, 51:Entry.Neobot, 71:Entry.Robotis_carCont, 72:Entry.Robotis_openCM70, 81:Entry.Arduino, 121:Entry.EV3}; + this.hwInfo = {11:Entry.Arduino, 12:Entry.SensorBoard, 13:Entry.CODEino, 14:Entry.joystick, 15:Entry.dplay, 16:Entry.nemoino, 17:Entry.Xbot, 18:Entry.ardublock, 24:Entry.Hamster, 25:Entry.Albert, 31:Entry.Bitbrick, 42:Entry.Arduino, 51:Entry.Neobot, 71:Entry.Robotis_carCont, 72:Entry.Robotis_openCM70, 81:Entry.Arduino, 181:Entry.EV3}; }; Entry.HW.TRIAL_LIMIT = 1; p = Entry.HW.prototype; diff --git a/dist/entry.min.js b/dist/entry.min.js index bb822eebe9..15e0990b28 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -1208,7 +1208,7 @@ listVLine=wholeHeight=0;mode=this._hwModule.monitorTemplate;for(f=0;fd-(l.width+n.width/2.2)&&(f+=1,initX=h,g=0)};b._movePort=function(a,b,d,e){var f=b,g=a.box.x*this.scale,h=a.box.y*this.scale; b>e?(f=b-a.width,b=b>g&&g>e?"M"+g+","+d+"L"+g+","+h:"M"+(b+e)/2+","+d+"l0,"+(h>d?28:-3)+"H"+g+"L"+g+","+h):b=bd?28:-3)+"H"+g+"L"+g+","+h;a.group.attr({transform:"translate("+f+","+d+")"});a.path.attr({d:b})}})(Entry.HWMonitor.prototype);Entry.HW=function(){this.connectTrial=0;this.isFirstConnect=!0;this.initSocket();this.connected=!1;this.portData={};this.sendQueue={};this.outputQueue={};this.settingQueue={};this.socketType=this.hwModule=this.selectedDevice=null;Entry.addEventListener("stop",this.setZero);this.hwInfo={11:Entry.Arduino,12:Entry.SensorBoard,13:Entry.CODEino,14:Entry.joystick,15:Entry.dplay,16:Entry.nemoino,17:Entry.Xbot,18:Entry.ardublock,24:Entry.Hamster,25:Entry.Albert,31:Entry.Bitbrick,42:Entry.Arduino,51:Entry.Neobot, -71:Entry.Robotis_carCont,72:Entry.Robotis_openCM70,81:Entry.Arduino,121:Entry.EV3}};Entry.HW.TRIAL_LIMIT=1;p=Entry.HW.prototype; +71:Entry.Robotis_carCont,72:Entry.Robotis_openCM70,81:Entry.Arduino,181:Entry.EV3}};Entry.HW.TRIAL_LIMIT=1;p=Entry.HW.prototype; p.initSocket=function(){try{if(this.connectTrial>=Entry.HW.TRIAL_LIMIT)this.isFirstConnect||Entry.toast.alert(Lang.Menus.connect_hw,Lang.Menus.connect_fail,!1),this.isFirstConnect=!1;else{var b=this,a,c;this.connected=!1;this.connectTrial++;if(-1=d?d=0:720<=d&&(d=720);var e=a.getStringField("DIRECTION",a);Entry.hw.sendQueue[c]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Degrees,degree:d,power:"CW"==e?50:-50};return a.callReturn()}},ev3_motor_power:{color:"#00979D",skeleton:"basic",statements:[],template:"%1 \uc758 \uac12\uc744 %2 \uc73c\ub85c \ucd9c\ub825", +params:[{type:"Dropdown",options:[["A","A"],["B","B"],["C","C"],["D","D"]],value:"A",fontSize:11},{type:"Block",accept:"string"}],events:{},def:{params:[null,{type:"number",params:["50"]}],type:"ev3_motor_power"},paramsKeyMap:{PORT:0,VALUE:1},"class":"ev3_output",isNotFor:["EV3"],func:function(b,a){var c=a.getStringField("PORT",a),d=a.getValue("VALUE",a);Entry.hw.sendQueue[c]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Power,power:d};return a.callReturn()}},ev3_motor_power_on_time:{color:"#00979D", +skeleton:"basic",statements:[],template:"%1 \uc758 \uac12\uc744 %2 \ucd08 \ub3d9\uc548 %3 \uc73c\ub85c \ucd9c\ub825",params:[{type:"Dropdown",options:[["A","A"],["B","B"],["C","C"],["D","D"]],value:"A",fontSize:11},{type:"Block",accept:"string"},{type:"Block",accept:"string"}],events:{},def:{params:[null,{type:"number",params:["2"]},{type:"number",params:["50"]}],type:"ev3_motor_power_on_time"},paramsKeyMap:{PORT:0,TIME:1,VALUE:2},"class":"ev3_output",isNotFor:["EV3"],func:function(b,a){var c=a.getStringField("PORT", +a);if(a.isStart){if(1==a.timeFlag)return a;delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;Entry.hw.sendQueue[c]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Power,power:0};return a.callReturn()}var d=a.getValue("TIME",a),e=a.getValue("VALUE",a);a.isStart=!0;a.timeFlag=1;Entry.hw.sendQueue[c]={id:Math.floor(1E5*Math.random(),0),type:Entry.EV3.motorMovementTypes.Power,power:e};var f=setTimeout(function(){a.timeFlag=0;Entry.EV3.removeTimeout(f)},1E3*d);Entry.EV3.timeouts.push(f); +return a}},ev3_touch_sensor:{color:"#00979D",skeleton:"basic_boolean_field",statements:[],template:"%1 \uc758 \ud130\uce58\uc13c\uc11c\uac00 \uc791\ub3d9\ub418\uc5c8\ub294\uac00?",params:[{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"],["4","4"]],value:"1",fontSize:11}],events:{},def:{params:[null],type:"ev3_touch_sensor"},paramsKeyMap:{PORT:0},"class":"ev3_sensor",isNotFor:["EV3"],func:function(b,a){a.getStringField("PORT",a);var c=Entry.hw.getDigitalPortValue(a.getNumberField("PORT",a)), +d=!1;c.type==Entry.EV3.deviceTypes.Touch&&1<=+c.siValue&&(d=!0);return d}}};(function(){for(var b in Entry.block){var a=Entry.block[b];if(a.parent){var c=function(){};c.prototype=Entry.block[a.parent];var c=new c,d;for(d in a)c[d]=a[d];Entry.block[b]=c}}})();"object"==typeof exports&&(exports.block=Entry.block);Entry.BlockMenu=function(b,a,c,d){Entry.Model(this,!1);this._align=a||"CENTER";this._scroll=void 0!==d?d:!1;this._bannedClass=[];this._categories=[];this.suffix="blockMenu";b="string"===typeof b?$("#"+b):$(b);if("DIV"!==b.prop("tagName"))return console.error("Dom is not div element");this.view=b;this.visible=!0;this._svgId="blockMenu"+(new Date).getTime();this._clearCategory();this._categoryData=c;this._generateView(c);this._splitters=[];this.setWidth();this.svg=Entry.SVG(this._svgId);Entry.Utils.addFilters(this.svg, this.suffix);this.patternRect=Entry.Utils.addBlockPattern(this.svg,this.suffix);this.svgGroup=this.svg.elem("g");this.svgThreadGroup=this.svgGroup.elem("g");this.svgThreadGroup.board=this;this.svgBlockGroup=this.svgGroup.elem("g");this.svgBlockGroup.board=this;this.changeEvent=new Entry.Event(this);c&&this._generateCategoryCodes(c);this.observe(this,"_handleDragBlock",["dragBlock"]);this._scroll&&(this._scroller=new Entry.BlockMenuScroller(this),this._addControl(b));Entry.documentMousedown&&Entry.documentMousedown.attach(this, this.setSelectedBlock);this._categoryCodes&&Entry.keyPressed&&Entry.keyPressed.attach(this,this._captureKeyEvent);Entry.windowResized&&(b=_.debounce(this.updateOffset,200),Entry.windowResized.attach(this,b))}; (function(b){b.schema={code:null,dragBlock:null,closeBlock:null,selectedBlockView:null};b._generateView=function(a){var b=this.view,d=this;a&&(this._categoryCol=Entry.Dom("ul",{class:"entryCategoryListWorkspace",parent:b}),this._generateCategoryView(a));this.blockMenuContainer=Entry.Dom("div",{"class":"blockMenuContainer",parent:b});this.svgDom=Entry.Dom($(''),{parent:this.blockMenuContainer});this.svgDom.mouseenter(function(a){d._scroller&& diff --git a/src/hw.js b/src/hw.js index afc75f6ffc..421c56cc44 100644 --- a/src/hw.js +++ b/src/hw.js @@ -38,7 +38,7 @@ Entry.HW = function() { '71': Entry.Robotis_carCont, '72': Entry.Robotis_openCM70, '81': Entry.Arduino, - '121': Entry.EV3 + '181': Entry.EV3 }; }; diff --git a/src/workspace/block_entry.js b/src/workspace/block_entry.js index fa8ca2d002..bbebc2784d 100644 --- a/src/workspace/block_entry.js +++ b/src/workspace/block_entry.js @@ -19352,6 +19352,341 @@ Entry.block = { } ] } + }, + "ev3_color_sensor": { + "color": "#00979D", + "fontColor": "#fff", + "skeleton": "basic_string_field", + "statements": [], + "template": "%1 의 %2 값", + "params": [{ + "type": "Dropdown", + "options": [ + ["1", "1"], + ["2", "2"], + ["3", "3"], + ["4", "4"] + ], + "value": "1", + "fontSize": 11 + }, { + "type": "Dropdown", + "options": [ + ["RGB", "RGB"], + ["R", "R"], + ["G", "G"], + ["B", "B"] + ], + "value": "RGB", + "fontSize": 11 + }], + "events": {}, + "def": { + "params": [null, null], + "type": "ev3_color_sensor" + }, + "paramsKeyMap": { + "PORT": 0, + "RGB": 1 + }, + "class": "ev3_sensor", + "isNotFor": ["EV3"], + "func": function (sprite, script) { + var port = script.getStringField("PORT", script); + var rgb = script.getStringField("RGB", script); + var portData = Entry.hw.getDigitalPortValue(script.getNumberField("PORT", script)); + var result = ''; + if(portData.type == Entry.EV3.deviceTypes.Color) { + if(portData.siValue == 0) { + result = ''; + } else { + switch(rgb) { + case 'RGB': + result = Entry.EV3.colorSensorValue[portData.siValue]; + break; + case 'R': + result = Entry.EV3.colorSensorValue[portData.siValue].substring(0, 2); + break; + case 'G': + result = Entry.EV3.colorSensorValue[portData.siValue].substring(2, 4); + break; + case 'B': + result = Entry.EV3.colorSensorValue[portData.siValue].substring(4, 6); + break; + } + } + } else { + result = '컬러 센서 아님'; + } + return result; + } + }, + "ev3_get_sensor_value": { + "color": "#00979D", + "fontColor": "#fff", + "skeleton": "basic_string_field", + "statements": [], + "template": "%1 의 값", + "params": [{ + "type": "Dropdown", + "options": [ + ["1", "1"], + ["2", "2"], + ["3", "3"], + ["4", "4"] + ], + "value": "1", + "fontSize": 11 + }], + "events": {}, + "def": { + "params": [null], + "type": "ev3_get_sensor_value" + }, + "paramsKeyMap": { + "PORT": 0 + }, + "class": "ev3_sensor", + "isNotFor": ["EV3"], + "func": function (sprite, script) { + var port = script.getStringField("PORT", script); + var portData = Entry.hw.getDigitalPortValue(script.getNumberField("PORT", script)); + var result; + if($.isPlainObject(portData)) { + result = portData.siValue || 0; + } + return result; + } + }, + "ev3_motor_degrees": { + "color": "#00979D", + "skeleton": "basic", + "statements": [], + "template": "%1 의 값을 %2 으로 %3 도 만큼 회전 %4", + "params": [{ + "type": "Dropdown", + "options": [ + ["A", "A"], + ["B", "B"], + ["C", "C"], + ["D", "D"] + ], + "value": "A", + "fontSize": 11 + }, { + "type": "Dropdown", + "options": [ + ["시계방향", "CW"], + ["반시계방향", "CCW"] + ], + "value": "CW", + "fontSize": 11 + }, { + "type": "Block", + "accept": "string" + }, { + "type": "Indicator", + "img": "block_icon/hardware_03.png", + "size": 12 + }], + "events": {}, + "def": { + "params": [null, null, { + "type": "angle" + }], + "type": "ev3_motor_degrees" + }, + "paramsKeyMap": { + "PORT": 0, + "DIRECTION": 1, + "DEGREE": 2 + }, + "class": "ev3_output", + "isNotFor": ["EV3"], + "func": function (sprite, script) { + var port = script.getStringField("PORT", script); + var degree = script.getValue("DEGREE", script); + if(degree <= 0) { + degree = 0; + } else if(degree >= 720) { + degree = 720; + } + var direction = script.getStringField("DIRECTION", script); + Entry.hw.sendQueue[port] = { + 'id': Math.floor(Math.random() * 100000, 0), + 'type': Entry.EV3.motorMovementTypes.Degrees, + 'degree': degree, + 'power': (direction == 'CW') ? 50 : -50 + }; + return script.callReturn(); + } + }, + "ev3_motor_power": { + "color": "#00979D", + "skeleton": "basic", + "statements": [], + "template": "%1 의 값을 %2 으로 출력 %3", + "params": [{ + "type": "Dropdown", + "options": [ + ["A", "A"], + ["B", "B"], + ["C", "C"], + ["D", "D"] + ], + "value": "A", + "fontSize": 11 + }, { + "type": "Block", + "accept": "string" + }, { + "type": "Indicator", + "img": "block_icon/hardware_03.png", + "size": 12 + }], + "events": {}, + "def": { + "params": [null, { + "type": "number", + "params": ["50"] + }], + "type": "ev3_motor_power" + }, + "paramsKeyMap": { + "PORT": 0, + "VALUE": 1 + }, + "class": "ev3_output", + "isNotFor": ["EV3"], + "func": function (sprite, script) { + var port = script.getStringField("PORT", script); + var value = script.getValue("VALUE", script); + Entry.hw.sendQueue[port] = { + 'id': Math.floor(Math.random() * 100000, 0), + 'type': Entry.EV3.motorMovementTypes.Power, + 'power': value, + }; + return script.callReturn(); + } + }, + "ev3_motor_power_on_time": { + "color": "#00979D", + "skeleton": "basic", + "statements": [], + "template": "%1 의 값을 %2 초 동안 %3 으로 출력 %4", + "params": [{ + "type": "Dropdown", + "options": [ + ["A", "A"], + ["B", "B"], + ["C", "C"], + ["D", "D"] + ], + "value": "A", + "fontSize": 11 + }, { + "type": "Block", + "accept": "string" + }, { + "type": "Block", + "accept": "string" + }, { + "type": "Indicator", + "img": "block_icon/hardware_03.png", + "size": 12 + }], + "events": {}, + "def": { + "params": [null, { + "type": "number", + "params": ["2"] + }, { + "type": "number", + "params": ["50"] + }], + "type": "ev3_motor_power_on_time" + }, + "paramsKeyMap": { + "PORT": 0, + "TIME": 1, + "VALUE": 2 + }, + "class": "ev3_output", + "isNotFor": ["EV3"], + "func": function (sprite, script) { + var sq = Entry.hw.sendQueue; + var port = script.getStringField("PORT", script); + if (!script.isStart) { + var time = script.getValue("TIME", script); + var value = script.getValue("VALUE", script); + script.isStart = true; + script.timeFlag = 1; + Entry.hw.sendQueue[port] = { + 'id': Math.floor(Math.random() * 100000, 0), + 'type': Entry.EV3.motorMovementTypes.Power, + 'power': value + }; + var timeValue = time * 1000; + var timer = setTimeout(function() { + script.timeFlag = 0; + Entry.EV3.removeTimeout(timer); + }, timeValue); + Entry.EV3.timeouts.push(timer); + return script; + } else if (script.timeFlag == 1) { + return script; + } else { + delete script.isStart; + delete script.timeFlag; + Entry.engine.isContinue = false; + Entry.hw.sendQueue[port] = { + 'id': Math.floor(Math.random() * 100000, 0), + 'type': Entry.EV3.motorMovementTypes.Power, + 'power': 0 + }; + return script.callReturn(); + } + } + }, + "ev3_touch_sensor": { + "color": "#00979D", + "fontColor": "#fff", + "skeleton": "basic_boolean_field", + "statements": [], + "template": "%1 의 터치센서가 작동되었는가?", + "params": [{ + "type": "Dropdown", + "options": [ + ["1", "1"], + ["2", "2"], + ["3", "3"], + ["4", "4"] + ], + "value": "1", + "fontSize": 11 + }], + "events": {}, + "def": { + "params": [null], + "type": "ev3_touch_sensor" + }, + "paramsKeyMap": { + "PORT": 0 + }, + "class": "ev3_sensor", + "isNotFor": ["EV3"], + "func": function (sprite, script) { + var port = script.getStringField("PORT", script); + var portData = Entry.hw.getDigitalPortValue(script.getNumberField("PORT", script)); + var result = false; + if(portData.type == Entry.EV3.deviceTypes.Touch) { + if(Number(portData.siValue) >= 1) { + result = true; + } + } + + return result; + } } }; From 857f0f71428ad7dabf778f4621341fb014ed2253 Mon Sep 17 00:00:00 2001 From: cobl Date: Wed, 27 Jul 2016 01:11:33 +0900 Subject: [PATCH 05/15] cobl_checkin checkin --- dist/entry.js | 27419 +++++++++++++++++---------------- dist/entry.min.js | 3812 ++--- extern/util/static.js | 23 +- src/blocks/block_cobl.js | 556 + src/hw.js | 3 +- src/workspace/block_entry.js | 751 + 6 files changed, 17148 insertions(+), 15416 deletions(-) create mode 100644 src/blocks/block_cobl.js diff --git a/dist/entry.js b/dist/entry.js index c5fa1ad7fb..14ed93bb16 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -1,14 +1,14 @@ -var Entry = {block:{}, TEXT_ALIGN_CENTER:0, TEXT_ALIGN_LEFT:1, TEXT_ALIGN_RIGHT:2, TEXT_ALIGNS:["center", "left", "right"], clipboard:null, loadProject:function(b) { - b || (b = Entry.getStartProject(Entry.mediaFilePath)); +var Entry = {block:{}, TEXT_ALIGN_CENTER:0, TEXT_ALIGN_LEFT:1, TEXT_ALIGN_RIGHT:2, TEXT_ALIGNS:["center", "left", "right"], clipboard:null, loadProject:function(a) { + a || (a = Entry.getStartProject(Entry.mediaFilePath)); "workspace" == this.type && Entry.stateManager.startIgnore(); - Entry.projectId = b._id; - Entry.variableContainer.setVariables(b.variables); - Entry.variableContainer.setMessages(b.messages); - Entry.scene.addScenes(b.scenes); + Entry.projectId = a._id; + Entry.variableContainer.setVariables(a.variables); + Entry.variableContainer.setMessages(a.messages); + Entry.scene.addScenes(a.scenes); Entry.stage.initObjectContainers(); - Entry.variableContainer.setFunctions(b.functions); - Entry.container.setObjects(b.objects); - Entry.FPS = b.speed ? b.speed : 60; + Entry.variableContainer.setFunctions(a.functions); + Entry.container.setObjects(a.objects); + Entry.FPS = a.speed ? a.speed : 60; createjs.Ticker.setFPS(Entry.FPS); "workspace" == this.type && setTimeout(function() { Entry.stateManager.endIgnore(); @@ -16,35 +16,37 @@ var Entry = {block:{}, TEXT_ALIGN_CENTER:0, TEXT_ALIGN_LEFT:1, TEXT_ALIGN_RIGHT: Entry.engine.projectTimer || Entry.variableContainer.generateTimer(); 0 === Object.keys(Entry.container.inputValue).length && Entry.variableContainer.generateAnswer(); Entry.start(); - return b; -}, exportProject:function(b) { - b || (b = {}); + return a; +}, exportProject:function(a) { + a || (a = {}); Entry.engine.isState("stop") || Entry.engine.toggleStop(); Entry.Func && Entry.Func.workspace && Entry.Func.workspace.visible && Entry.Func.cancelEdit(); - b.objects = Entry.container.toJSON(); - b.scenes = Entry.scene.toJSON(); - b.variables = Entry.variableContainer.getVariableJSON(); - b.messages = Entry.variableContainer.getMessageJSON(); - b.functions = Entry.variableContainer.getFunctionJSON(); - b.scenes = Entry.scene.toJSON(); - b.speed = Entry.FPS; - return b; -}, setBlockByText:function(b, a) { - for (var c = [], d = jQuery.parseXML(a).getElementsByTagName("category"), e = 0;e < d.length;e++) { - for (var f = d[e], g = {category:f.getAttribute("id"), blocks:[]}, f = f.childNodes, h = 0;h < f.length;h++) { - var k = f[h]; - !k.tagName || "BLOCK" != k.tagName.toUpperCase() && "BTN" != k.tagName.toUpperCase() || g.blocks.push(k.getAttribute("type")); - } - c.push(g); - } - Entry.playground.setBlockMenu(c); -}, setBlock:function(b, a) { - Entry.playground.setMenuBlock(b, a); + a.objects = Entry.container.toJSON(); + a.scenes = Entry.scene.toJSON(); + a.variables = Entry.variableContainer.getVariableJSON(); + a.messages = Entry.variableContainer.getMessageJSON(); + a.functions = Entry.variableContainer.getFunctionJSON(); + a.scenes = Entry.scene.toJSON(); + a.speed = Entry.FPS; + return a; +}, setBlockByText:function(a, b) { + a = []; + b = jQuery.parseXML(b).getElementsByTagName("category"); + for (var c = 0;c < b.length;c++) { + for (var d = b[c], e = {category:d.getAttribute("id"), blocks:[]}, d = d.childNodes, f = 0;f < d.length;f++) { + var g = d[f]; + !g.tagName || "BLOCK" != g.tagName.toUpperCase() && "BTN" != g.tagName.toUpperCase() || e.blocks.push(g.getAttribute("type")); + } + a.push(e); + } + Entry.playground.setBlockMenu(a); +}, setBlock:function(a, b) { + Entry.playground.setMenuBlock(a, b); }, enableArduino:function() { -}, initSound:function(b) { - b.path = b.fileurl ? b.fileurl : Entry.defaultPath + "/uploads/" + b.filename.substring(0, 2) + "/" + b.filename.substring(2, 4) + "/" + b.filename + b.ext; - Entry.soundQueue.loadFile({id:b.id, src:b.path, type:createjs.LoadQueue.SOUND}); -}, beforeUnload:function(b) { +}, initSound:function(a) { + a.path = a.fileurl ? a.fileurl : Entry.defaultPath + "/uploads/" + a.filename.substring(0, 2) + "/" + a.filename.substring(2, 4) + "/" + a.filename + a.ext; + Entry.soundQueue.loadFile({id:a.id, src:a.path, type:createjs.LoadQueue.SOUND}); +}, beforeUnload:function(a) { Entry.hw.closeConnection(); Entry.variableContainer.updateCloudVariables(); if ("workspace" == Entry.type && (localStorage && Entry.interfaceState && localStorage.setItem("workspace-interface", JSON.stringify(Entry.interfaceState)), !Entry.stateManager.isSaved())) { @@ -53,87 +55,87 @@ var Entry = {block:{}, TEXT_ALIGN_CENTER:0, TEXT_ALIGN_LEFT:1, TEXT_ALIGN_RIGHT: }, loadInterfaceState:function() { if ("workspace" == Entry.type) { if (localStorage && localStorage.getItem("workspace-interface")) { - var b = localStorage.getItem("workspace-interface"); - this.resizeElement(JSON.parse(b)); + var a = localStorage.getItem("workspace-interface"); + this.resizeElement(JSON.parse(a)); } else { this.resizeElement({menuWidth:280, canvasWidth:480}); } } -}, resizeElement:function(b) { +}, resizeElement:function(a) { if ("workspace" == Entry.type) { - var a = this.interfaceState; - !b.canvasWidth && a.canvasWidth && (b.canvasWidth = a.canvasWidth); - !b.menuWidth && this.interfaceState.menuWidth && (b.menuWidth = a.menuWidth); + var b = this.interfaceState; + !a.canvasWidth && b.canvasWidth && (a.canvasWidth = b.canvasWidth); + !a.menuWidth && this.interfaceState.menuWidth && (a.menuWidth = b.menuWidth); Entry.engine.speedPanelOn && Entry.engine.toggleSpeedPanel(); - (a = b.canvasWidth) ? 325 > a ? a = 325 : 720 < a && (a = 720) : a = 400; - b.canvasWidth = a; - var c = 9 * a / 16; - Entry.engine.view_.style.width = a + "px"; + (b = a.canvasWidth) ? 325 > b ? b = 325 : 720 < b && (b = 720) : b = 400; + a.canvasWidth = b; + var c = 9 * b / 16; + Entry.engine.view_.style.width = b + "px"; Entry.engine.view_.style.height = c + "px"; Entry.engine.view_.style.top = "40px"; - Entry.stage.canvas.canvas.style.width = a + "px"; - 400 <= a ? Entry.engine.view_.removeClass("collapsed") : Entry.engine.view_.addClass("collapsed"); - Entry.playground.view_.style.left = a + .5 + "px"; - Entry.propertyPanel.resize(a); + Entry.stage.canvas.canvas.style.width = b + "px"; + 400 <= b ? Entry.engine.view_.removeClass("collapsed") : Entry.engine.view_.addClass("collapsed"); + Entry.playground.view_.style.left = b + .5 + "px"; + Entry.propertyPanel.resize(b); var d = Entry.engine.view_.getElementsByClassName("entryAddButtonWorkspace_w")[0]; - d && (Entry.objectAddable ? (d.style.top = c + 24 + "px", d.style.width = .7 * a + "px") : d.style.display = "none"); + d && (Entry.objectAddable ? (d.style.top = c + 24 + "px", d.style.width = .7 * b + "px") : d.style.display = "none"); if (d = Entry.engine.view_.getElementsByClassName("entryRunButtonWorkspace_w")[0]) { - Entry.objectAddable ? (d.style.top = c + 24 + "px", d.style.left = .7 * a + "px", d.style.width = .3 * a + "px") : (d.style.left = "2px", d.style.top = c + 24 + "px", d.style.width = a - 4 + "px"); + Entry.objectAddable ? (d.style.top = c + 24 + "px", d.style.left = .7 * b + "px", d.style.width = .3 * b + "px") : (d.style.left = "2px", d.style.top = c + 24 + "px", d.style.width = b - 4 + "px"); } if (d = Entry.engine.view_.getElementsByClassName("entryStopButtonWorkspace_w")[0]) { - Entry.objectAddable ? (d.style.top = c + 24 + "px", d.style.left = .7 * a + "px", d.style.width = .3 * a + "px") : (d.style.left = "2px", d.style.top = c + 24 + "px", d.style.width = a + "px"); + Entry.objectAddable ? (d.style.top = c + 24 + "px", d.style.left = .7 * b + "px", d.style.width = .3 * b + "px") : (d.style.left = "2px", d.style.top = c + 24 + "px", d.style.width = b + "px"); } - (a = b.menuWidth) ? 244 > a ? a = 244 : 400 < a && (a = 400) : a = 264; - b.menuWidth = a; - $(".blockMenuContainer").css({width:a - 64 + "px"}); - $(".blockMenuContainer>svg").css({width:a - 64 + "px"}); + (b = a.menuWidth) ? 244 > b ? b = 244 : 400 < b && (b = 400) : b = 264; + a.menuWidth = b; + $(".blockMenuContainer").css({width:b - 64 + "px"}); + $(".blockMenuContainer>svg").css({width:b - 64 + "px"}); Entry.playground.mainWorkspace.blockMenu.setWidth(); - $(".entryWorkspaceBoard").css({left:a + "px"}); - Entry.playground.resizeHandle_.style.left = a + "px"; - Entry.playground.variableViewWrapper_.style.width = a + "px"; - this.interfaceState = b; + $(".entryWorkspaceBoard").css({left:b + "px"}); + Entry.playground.resizeHandle_.style.left = b + "px"; + Entry.playground.variableViewWrapper_.style.width = b + "px"; + this.interfaceState = a; } Entry.windowResized.notify(); }, getUpTime:function() { return (new Date).getTime() - this.startTime; -}, addActivity:function(b) { - Entry.stateManager && Entry.stateManager.addActivity(b); +}, addActivity:function(a) { + Entry.stateManager && Entry.stateManager.addActivity(a); }, startActivityLogging:function() { Entry.reporter && Entry.reporter.start(Entry.projectId, window.user ? window.user._id : null, Entry.startTime); }, getActivityLog:function() { - var b = {}; - Entry.stateManager && (b.activityLog = Entry.stateManager.activityLog_); - return b; -}, DRAG_MODE_NONE:0, DRAG_MODE_MOUSEDOWN:1, DRAG_MODE_DRAG:2, cancelObjectEdit:function(b) { - var a = Entry.playground.object; - if (a) { - var c = b.target; - b = 0 !== $(a.view_).find(c).length; + var a = {}; + Entry.stateManager && (a.activityLog = Entry.stateManager.activityLog_); + return a; +}, DRAG_MODE_NONE:0, DRAG_MODE_MOUSEDOWN:1, DRAG_MODE_DRAG:2, cancelObjectEdit:function(a) { + var b = Entry.playground.object; + if (b) { + var c = a.target; + a = 0 !== $(b.view_).find(c).length; c = c.tagName.toUpperCase(); - !a.isEditing || "INPUT" === c && b || a.editObjectValues(!1); + !b.isEditing || "INPUT" === c && a || b.editObjectValues(!1); } }}; window.Entry = Entry; Entry.Albert = {PORT_MAP:{leftWheel:0, rightWheel:0, buzzer:0, leftEye:0, rightEye:0, note:0, bodyLed:0, frontLed:0, padWidth:0, padHeight:0}, setZero:function() { - var b = Entry.Albert.PORT_MAP, a = Entry.hw.sendQueue, c; - for (c in b) { - a[c] = b[c]; + var a = Entry.Albert.PORT_MAP, b = Entry.hw.sendQueue, c; + for (c in a) { + b[c] = a[c]; } Entry.hw.update(); - b = Entry.Albert; - b.tempo = 60; - b.removeAllTimeouts(); + a = Entry.Albert; + a.tempo = 60; + a.removeAllTimeouts(); }, monitorTemplate:{imgPath:"hw/albert.png", width:387, height:503, listPorts:{oid:{name:"OID", type:"input", pos:{x:0, y:0}}, buzzer:{name:Lang.Hw.buzzer, type:"output", pos:{x:0, y:0}}, note:{name:Lang.Hw.note, type:"output", pos:{x:0, y:0}}}, ports:{leftProximity:{name:Lang.Blocks.ALBERT_sensor_leftProximity, type:"input", pos:{x:178, y:401}}, rightProximity:{name:Lang.Blocks.ALBERT_sensor_rightProximity, type:"input", pos:{x:66, y:359}}, battery:{name:Lang.Blocks.ALBERT_sensor_battery, type:"input", pos:{x:88, y:368}}, light:{name:Lang.Blocks.ALBERT_sensor_light, type:"input", pos:{x:127, y:391}}, leftWheel:{name:Lang.Hw.leftWheel, type:"output", pos:{x:299, y:406}}, rightWheel:{name:Lang.Hw.rightWheel, type:"output", pos:{x:22, y:325}}, leftEye:{name:Lang.Hw.leftEye, type:"output", pos:{x:260, y:26}}, rightEye:{name:Lang.Hw.rightEye, type:"output", pos:{x:164, y:13}}, bodyLed:{name:Lang.Hw.body + " " + Lang.Hw.led, type:"output", pos:{x:367, y:308}}, frontLed:{name:Lang.Hw.front + " " + Lang.Hw.led, -pos:{x:117, y:410}}}, mode:"both"}, tempo:60, timeouts:[], removeTimeout:function(b) { - clearTimeout(b); - var a = this.timeouts; - b = a.indexOf(b); - 0 <= b && a.splice(b, 1); +pos:{x:117, y:410}}}, mode:"both"}, tempo:60, timeouts:[], removeTimeout:function(a) { + clearTimeout(a); + var b = this.timeouts; + a = b.indexOf(a); + 0 <= a && b.splice(a, 1); }, removeAllTimeouts:function() { - var b = this.timeouts, a; - for (a in b) { - clearTimeout(b[a]); + var a = this.timeouts, b; + for (b in a) { + clearTimeout(a[b]); } this.timeouts = []; }, name:"albert"}; @@ -143,9 +145,9 @@ Blockly.Blocks.albert_hand_found = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.albert_hand_found = function(b, a) { - var c = Entry.hw.portData; - return 40 < c.leftProximity || 40 < c.rightProximity; +Entry.block.albert_hand_found = function(a, b) { + a = Entry.hw.portData; + return 40 < a.leftProximity || 40 < a.rightProximity; }; Blockly.Blocks.albert_value = {init:function() { this.setColour("#00979D"); @@ -154,9 +156,10 @@ Blockly.Blocks.albert_value = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Number"); }}; -Entry.block.albert_value = function(b, a) { - var c = Entry.hw.portData, d = a.getField("DEVICE"); - return c[d]; +Entry.block.albert_value = function(a, b) { + a = Entry.hw.portData; + b = b.getField("DEVICE"); + return a[b]; }; Blockly.Blocks.albert_move_forward_for_secs = {init:function() { this.setColour("#00979D"); @@ -167,29 +170,30 @@ Blockly.Blocks.albert_move_forward_for_secs = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_move_forward_for_secs = function(b, a) { - var c = Entry.hw.sendQueue; - if (a.isStart) { - if (1 == a.timeFlag) { - return a; +Entry.block.albert_move_forward_for_secs = function(a, b) { + a = Entry.hw.sendQueue; + if (b.isStart) { + if (1 == b.timeFlag) { + return b; } - delete a.isStart; - delete a.timeFlag; + delete b.isStart; + delete b.timeFlag; Entry.engine.isContinue = !1; - c.leftWheel = 0; - c.rightWheel = 0; - return a.callReturn(); + a.leftWheel = 0; + a.rightWheel = 0; + return b.callReturn(); } - a.isStart = !0; - a.timeFlag = 1; - c.leftWheel = 30; - c.rightWheel = 30; - var c = 1E3 * a.getNumberValue("VALUE"), d = setTimeout(function() { - a.timeFlag = 0; - Entry.Albert.removeTimeout(d); - }, c); - Entry.Albert.timeouts.push(d); - return a; + b.isStart = !0; + b.timeFlag = 1; + a.leftWheel = 30; + a.rightWheel = 30; + a = 1E3 * b.getNumberValue("VALUE"); + var c = setTimeout(function() { + b.timeFlag = 0; + Entry.Albert.removeTimeout(c); + }, a); + Entry.Albert.timeouts.push(c); + return b; }; Blockly.Blocks.albert_move_backward_for_secs = {init:function() { this.setColour("#00979D"); @@ -200,29 +204,30 @@ Blockly.Blocks.albert_move_backward_for_secs = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_move_backward_for_secs = function(b, a) { - var c = Entry.hw.sendQueue; - if (a.isStart) { - if (1 == a.timeFlag) { - return a; +Entry.block.albert_move_backward_for_secs = function(a, b) { + a = Entry.hw.sendQueue; + if (b.isStart) { + if (1 == b.timeFlag) { + return b; } - delete a.isStart; - delete a.timeFlag; + delete b.isStart; + delete b.timeFlag; Entry.engine.isContinue = !1; - c.leftWheel = 0; - c.rightWheel = 0; - return a.callReturn(); + a.leftWheel = 0; + a.rightWheel = 0; + return b.callReturn(); } - a.isStart = !0; - a.timeFlag = 1; - c.leftWheel = -30; - c.rightWheel = -30; - var c = 1E3 * a.getNumberValue("VALUE"), d = setTimeout(function() { - a.timeFlag = 0; - Entry.Albert.removeTimeout(d); - }, c); - Entry.Albert.timeouts.push(d); - return a; + b.isStart = !0; + b.timeFlag = 1; + a.leftWheel = -30; + a.rightWheel = -30; + a = 1E3 * b.getNumberValue("VALUE"); + var c = setTimeout(function() { + b.timeFlag = 0; + Entry.Albert.removeTimeout(c); + }, a); + Entry.Albert.timeouts.push(c); + return b; }; Blockly.Blocks.albert_turn_for_secs = {init:function() { this.setColour("#00979D"); @@ -233,28 +238,29 @@ Blockly.Blocks.albert_turn_for_secs = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_turn_for_secs = function(b, a) { - var c = Entry.hw.sendQueue; - if (a.isStart) { - if (1 == a.timeFlag) { - return a; +Entry.block.albert_turn_for_secs = function(a, b) { + a = Entry.hw.sendQueue; + if (b.isStart) { + if (1 == b.timeFlag) { + return b; } - delete a.isStart; - delete a.timeFlag; + delete b.isStart; + delete b.timeFlag; Entry.engine.isContinue = !1; - c.leftWheel = 0; - c.rightWheel = 0; - return a.callReturn(); + a.leftWheel = 0; + a.rightWheel = 0; + return b.callReturn(); } - a.isStart = !0; - a.timeFlag = 1; - "LEFT" == a.getField("DIRECTION", a) ? (c.leftWheel = -30, c.rightWheel = 30) : (c.leftWheel = 30, c.rightWheel = -30); - var c = 1E3 * a.getNumberValue("VALUE"), d = setTimeout(function() { - a.timeFlag = 0; - Entry.Albert.removeTimeout(d); - }, c); - Entry.Albert.timeouts.push(d); - return a; + b.isStart = !0; + b.timeFlag = 1; + "LEFT" == b.getField("DIRECTION", b) ? (a.leftWheel = -30, a.rightWheel = 30) : (a.leftWheel = 30, a.rightWheel = -30); + a = 1E3 * b.getNumberValue("VALUE"); + var c = setTimeout(function() { + b.timeFlag = 0; + Entry.Albert.removeTimeout(c); + }, a); + Entry.Albert.timeouts.push(c); + return b; }; Blockly.Blocks.albert_change_both_wheels_by = {init:function() { this.setColour("#00979D"); @@ -267,11 +273,12 @@ Blockly.Blocks.albert_change_both_wheels_by = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_change_both_wheels_by = function(b, a) { - var c = Entry.hw.sendQueue, d = a.getNumberValue("LEFT"), e = a.getNumberValue("RIGHT"); - c.leftWheel = void 0 != c.leftWheel ? c.leftWheel + d : d; - c.rightWheel = void 0 != c.rightWheel ? c.rightWheel + e : e; - return a.callReturn(); +Entry.block.albert_change_both_wheels_by = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getNumberValue("LEFT"), d = b.getNumberValue("RIGHT"); + a.leftWheel = void 0 != a.leftWheel ? a.leftWheel + c : c; + a.rightWheel = void 0 != a.rightWheel ? a.rightWheel + d : d; + return b.callReturn(); }; Blockly.Blocks.albert_set_both_wheels_to = {init:function() { this.setColour("#00979D"); @@ -284,11 +291,11 @@ Blockly.Blocks.albert_set_both_wheels_to = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_set_both_wheels_to = function(b, a) { - var c = Entry.hw.sendQueue; - c.leftWheel = a.getNumberValue("LEFT"); - c.rightWheel = a.getNumberValue("RIGHT"); - return a.callReturn(); +Entry.block.albert_set_both_wheels_to = function(a, b) { + a = Entry.hw.sendQueue; + a.leftWheel = b.getNumberValue("LEFT"); + a.rightWheel = b.getNumberValue("RIGHT"); + return b.callReturn(); }; Blockly.Blocks.albert_change_wheel_by = {init:function() { this.setColour("#00979D"); @@ -299,10 +306,11 @@ Blockly.Blocks.albert_change_wheel_by = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_change_wheel_by = function(b, a) { - var c = Entry.hw.sendQueue, d = a.getField("DIRECTION"), e = a.getNumberValue("VALUE"); - "LEFT" == d ? c.leftWheel = void 0 != c.leftWheel ? c.leftWheel + e : e : ("RIGHT" != d && (c.leftWheel = void 0 != c.leftWheel ? c.leftWheel + e : e), c.rightWheel = void 0 != c.rightWheel ? c.rightWheel + e : e); - return a.callReturn(); +Entry.block.albert_change_wheel_by = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getField("DIRECTION"), d = b.getNumberValue("VALUE"); + "LEFT" == c ? a.leftWheel = void 0 != a.leftWheel ? a.leftWheel + d : d : ("RIGHT" != c && (a.leftWheel = void 0 != a.leftWheel ? a.leftWheel + d : d), a.rightWheel = void 0 != a.rightWheel ? a.rightWheel + d : d); + return b.callReturn(); }; Blockly.Blocks.albert_set_wheel_to = {init:function() { this.setColour("#00979D"); @@ -313,10 +321,11 @@ Blockly.Blocks.albert_set_wheel_to = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_set_wheel_to = 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(); +Entry.block.albert_set_wheel_to = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getField("DIRECTION"), d = b.getNumberValue("VALUE"); + "LEFT" == c ? a.leftWheel = d : ("RIGHT" != c && (a.leftWheel = d), a.rightWheel = d); + return b.callReturn(); }; Blockly.Blocks.albert_stop = {init:function() { this.setColour("#00979D"); @@ -325,11 +334,11 @@ Blockly.Blocks.albert_stop = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_stop = function(b, a) { - var c = Entry.hw.sendQueue; - c.leftWheel = 0; - c.rightWheel = 0; - return a.callReturn(); +Entry.block.albert_stop = function(a, b) { + a = Entry.hw.sendQueue; + a.leftWheel = 0; + a.rightWheel = 0; + return b.callReturn(); }; Blockly.Blocks.albert_set_pad_size_to = {init:function() { this.setColour("#00979D"); @@ -342,11 +351,11 @@ Blockly.Blocks.albert_set_pad_size_to = {init:function() { 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(); +Entry.block.albert_set_pad_size_to = function(a, b) { + a = Entry.hw.sendQueue; + a.padWidth = b.getNumberValue("WIDTH"); + a.padHeight = b.getNumberValue("HEIGHT"); + return b.callReturn(); }; Blockly.Blocks.albert_set_eye_to = {init:function() { this.setColour("#00979D"); @@ -356,10 +365,11 @@ Blockly.Blocks.albert_set_eye_to = {init:function() { 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(); +Entry.block.albert_set_eye_to = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getField("DIRECTION", b), d = Number(b.getField("COLOR", b)); + "LEFT" == c ? a.leftEye = d : ("RIGHT" != c && (a.leftEye = d), a.rightEye = d); + return b.callReturn(); }; Blockly.Blocks.albert_clear_eye = {init:function() { this.setColour("#00979D"); @@ -368,10 +378,11 @@ Blockly.Blocks.albert_clear_eye = {init:function() { 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(); +Entry.block.albert_clear_eye = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getField("DIRECTION", b); + "LEFT" == c ? a.leftEye = 0 : ("RIGHT" != c && (a.leftEye = 0), a.rightEye = 0); + return b.callReturn(); }; Blockly.Blocks.albert_body_led = {init:function() { this.setColour("#00979D"); @@ -380,10 +391,10 @@ Blockly.Blocks.albert_body_led = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_body_led = function(b, a) { - var c = Entry.hw.sendQueue; - "ON" == a.getField("STATE", a) ? c.bodyLed = 1 : c.bodyLed = 0; - return a.callReturn(); +Entry.block.albert_body_led = function(a, b) { + a = Entry.hw.sendQueue; + "ON" == b.getField("STATE", b) ? a.bodyLed = 1 : a.bodyLed = 0; + return b.callReturn(); }; Blockly.Blocks.albert_front_led = {init:function() { this.setColour("#00979D"); @@ -392,10 +403,10 @@ Blockly.Blocks.albert_front_led = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_front_led = function(b, a) { - var c = Entry.hw.sendQueue; - "ON" == a.getField("STATE", a) ? c.frontLed = 1 : c.frontLed = 0; - return a.callReturn(); +Entry.block.albert_front_led = function(a, b) { + a = Entry.hw.sendQueue; + "ON" == b.getField("STATE", b) ? a.frontLed = 1 : a.frontLed = 0; + return b.callReturn(); }; Blockly.Blocks.albert_beep = {init:function() { this.setColour("#00979D"); @@ -404,28 +415,28 @@ Blockly.Blocks.albert_beep = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_beep = function(b, a) { - var c = Entry.hw.sendQueue; - if (a.isStart) { - if (1 == a.timeFlag) { - return a; +Entry.block.albert_beep = function(a, b) { + a = Entry.hw.sendQueue; + if (b.isStart) { + if (1 == b.timeFlag) { + return b; } - delete a.isStart; - delete a.timeFlag; + delete b.isStart; + delete b.timeFlag; Entry.engine.isContinue = !1; - c.buzzer = 0; - return a.callReturn(); + a.buzzer = 0; + return b.callReturn(); } - a.isStart = !0; - a.timeFlag = 1; - c.buzzer = 440; - c.note = 0; - var d = setTimeout(function() { - a.timeFlag = 0; - Entry.Albert.removeTimeout(d); + b.isStart = !0; + b.timeFlag = 1; + a.buzzer = 440; + a.note = 0; + var c = setTimeout(function() { + b.timeFlag = 0; + Entry.Albert.removeTimeout(c); }, 200); - Entry.Albert.timeouts.push(d); - return a; + Entry.Albert.timeouts.push(c); + return b; }; Blockly.Blocks.albert_change_buzzer_by = {init:function() { this.setColour("#00979D"); @@ -436,11 +447,12 @@ Blockly.Blocks.albert_change_buzzer_by = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_change_buzzer_by = 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(); +Entry.block.albert_change_buzzer_by = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getNumberValue("VALUE"); + a.buzzer = void 0 != a.buzzer ? a.buzzer + c : c; + a.note = 0; + return b.callReturn(); }; Blockly.Blocks.albert_set_buzzer_to = {init:function() { this.setColour("#00979D"); @@ -451,11 +463,11 @@ Blockly.Blocks.albert_set_buzzer_to = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_set_buzzer_to = function(b, a) { - var c = Entry.hw.sendQueue; - c.buzzer = a.getNumberValue("VALUE"); - c.note = 0; - return a.callReturn(); +Entry.block.albert_set_buzzer_to = function(a, b) { + a = Entry.hw.sendQueue; + a.buzzer = b.getNumberValue("VALUE"); + a.note = 0; + return b.callReturn(); }; Blockly.Blocks.albert_clear_buzzer = {init:function() { this.setColour("#00979D"); @@ -464,11 +476,11 @@ Blockly.Blocks.albert_clear_buzzer = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_clear_buzzer = function(b, a) { - var c = Entry.hw.sendQueue; - c.buzzer = 0; - c.note = 0; - return a.callReturn(); +Entry.block.albert_clear_buzzer = function(a, b) { + a = Entry.hw.sendQueue; + a.buzzer = 0; + a.note = 0; + return b.callReturn(); }; Blockly.Blocks.albert_play_note_for = {init:function() { this.setColour("#00979D"); @@ -480,36 +492,37 @@ Blockly.Blocks.albert_play_note_for = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_play_note_for = function(b, a) { +Entry.block.albert_play_note_for = function(a, b) { var c = Entry.hw.sendQueue; - if (a.isStart) { - if (1 == a.timeFlag) { - return a; + if (b.isStart) { + if (1 == b.timeFlag) { + return b; } - delete a.isStart; - delete a.timeFlag; + delete b.isStart; + delete b.timeFlag; Entry.engine.isContinue = !1; c.note = 0; - return a.callReturn(); + return b.callReturn(); } - var d = a.getNumberField("NOTE", a), e = a.getNumberField("OCTAVE", a), f = a.getNumberValue("VALUE", a), g = Entry.Albert.tempo, f = 6E4 * f / g; - a.isStart = !0; - a.timeFlag = 1; + a = b.getNumberField("NOTE", b); + var d = b.getNumberField("OCTAVE", b), e = 6E4 * b.getNumberValue("VALUE", b) / Entry.Albert.tempo; + b.isStart = !0; + b.timeFlag = 1; c.buzzer = 0; - c.note = d + 12 * (e - 1); - if (100 < f) { - var h = setTimeout(function() { + c.note = a + 12 * (d - 1); + if (100 < e) { + var f = setTimeout(function() { c.note = 0; - Entry.Albert.removeTimeout(h); - }, f - 100); - Entry.Albert.timeouts.push(h); + Entry.Albert.removeTimeout(f); + }, e - 100); + Entry.Albert.timeouts.push(f); } - var k = setTimeout(function() { - a.timeFlag = 0; - Entry.Albert.removeTimeout(k); - }, f); - Entry.Albert.timeouts.push(k); - return a; + var g = setTimeout(function() { + b.timeFlag = 0; + Entry.Albert.removeTimeout(g); + }, e); + Entry.Albert.timeouts.push(g); + return b; }; Blockly.Blocks.albert_rest_for = {init:function() { this.setColour("#00979D"); @@ -520,28 +533,28 @@ Blockly.Blocks.albert_rest_for = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_rest_for = function(b, a) { - var c = Entry.hw.sendQueue; - if (a.isStart) { - if (1 == a.timeFlag) { - return a; +Entry.block.albert_rest_for = function(a, b) { + a = Entry.hw.sendQueue; + if (b.isStart) { + if (1 == b.timeFlag) { + return b; } - delete a.isStart; - delete a.timeFlag; + delete b.isStart; + delete b.timeFlag; Entry.engine.isContinue = !1; - return a.callReturn(); + return b.callReturn(); } - a.isStart = !0; - a.timeFlag = 1; - var d = a.getNumberValue("VALUE"), d = 6E4 * d / Entry.Albert.tempo; - c.buzzer = 0; - c.note = 0; - var e = setTimeout(function() { - a.timeFlag = 0; - Entry.Albert.removeTimeout(e); - }, d); - Entry.Albert.timeouts.push(e); - return a; + b.isStart = !0; + b.timeFlag = 1; + var c = b.getNumberValue("VALUE"), c = 6E4 * c / Entry.Albert.tempo; + a.buzzer = 0; + a.note = 0; + var d = setTimeout(function() { + b.timeFlag = 0; + Entry.Albert.removeTimeout(d); + }, c); + Entry.Albert.timeouts.push(d); + return b; }; Blockly.Blocks.albert_change_tempo_by = {init:function() { this.setColour("#00979D"); @@ -552,10 +565,10 @@ Blockly.Blocks.albert_change_tempo_by = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_change_tempo_by = function(b, a) { - Entry.Albert.tempo += a.getNumberValue("VALUE"); +Entry.block.albert_change_tempo_by = function(a, b) { + Entry.Albert.tempo += b.getNumberValue("VALUE"); 1 > Entry.Albert.tempo && (Entry.Albert.tempo = 1); - return a.callReturn(); + return b.callReturn(); }; Blockly.Blocks.albert_set_tempo_to = {init:function() { this.setColour("#00979D"); @@ -566,10 +579,10 @@ Blockly.Blocks.albert_set_tempo_to = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_set_tempo_to = function(b, a) { - Entry.Albert.tempo = a.getNumberValue("VALUE"); +Entry.block.albert_set_tempo_to = function(a, b) { + Entry.Albert.tempo = b.getNumberValue("VALUE"); 1 > Entry.Albert.tempo && (Entry.Albert.tempo = 1); - return a.callReturn(); + return b.callReturn(); }; Blockly.Blocks.albert_move_forward = {init:function() { this.setColour("#00979D"); @@ -578,27 +591,27 @@ Blockly.Blocks.albert_move_forward = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_move_forward = function(b, a) { - var c = Entry.hw.sendQueue; - if (a.isStart) { - if (1 == a.timeFlag) { - return a; +Entry.block.albert_move_forward = function(a, b) { + a = Entry.hw.sendQueue; + if (b.isStart) { + if (1 == b.timeFlag) { + return b; } - delete a.timeFlag; - delete a.isStart; + delete b.timeFlag; + delete b.isStart; Entry.engine.isContinue = !1; - c.leftWheel = 0; - c.rightWheel = 0; - return a.callReturn(); + a.leftWheel = 0; + a.rightWheel = 0; + return b.callReturn(); } - a.isStart = !0; - a.timeFlag = 1; - c.leftWheel = 30; - c.rightWheel = 30; + b.isStart = !0; + b.timeFlag = 1; + a.leftWheel = 30; + a.rightWheel = 30; setTimeout(function() { - a.timeFlag = 0; + b.timeFlag = 0; }, 1E3); - return a; + return b; }; Blockly.Blocks.albert_move_backward = {init:function() { this.setColour("#00979D"); @@ -607,25 +620,25 @@ Blockly.Blocks.albert_move_backward = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_move_backward = function(b, a) { - var c = Entry.hw.sendQueue; - if (a.isStart) { - if (1 == a.timeFlag) { - return c.leftWheel = -30, c.rightWheel = -30, a; +Entry.block.albert_move_backward = function(a, b) { + a = Entry.hw.sendQueue; + if (b.isStart) { + if (1 == b.timeFlag) { + return a.leftWheel = -30, a.rightWheel = -30, b; } - delete a.timeFlag; - delete a.isStart; + delete b.timeFlag; + delete b.isStart; Entry.engine.isContinue = !1; - c.leftWheel = 0; - c.rightWheel = 0; - return a.callReturn(); + a.leftWheel = 0; + a.rightWheel = 0; + return b.callReturn(); } - a.isStart = !0; - a.timeFlag = 1; + b.isStart = !0; + b.timeFlag = 1; setTimeout(function() { - a.timeFlag = 0; + b.timeFlag = 0; }, 1E3); - return a; + return b; }; Blockly.Blocks.albert_turn_around = {init:function() { this.setColour("#00979D"); @@ -634,30 +647,30 @@ Blockly.Blocks.albert_turn_around = {init:function() { 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; +Entry.block.albert_turn_around = function(a, b) { + a = Entry.hw.sendQueue; + if (b.isStart) { + if (1 == b.timeFlag) { + return a.leftWheel = b.leftValue, a.rightWheel = b.rightValue, b; } - delete a.timeFlag; - delete a.isStart; - delete a.leftValue; - delete a.rightValue; + delete b.timeFlag; + delete b.isStart; + delete b.leftValue; + delete b.rightValue; Entry.engine.isContinue = !1; - c.leftWheel = 0; - c.rightWheel = 0; - return a.callReturn(); + a.leftWheel = 0; + a.rightWheel = 0; + return b.callReturn(); } - c = "LEFT" == a.getField("DIRECTION", a); - a.leftValue = c ? -30 : 30; - a.rightValue = c ? 30 : -30; - a.isStart = !0; - a.timeFlag = 1; + a = "LEFT" == b.getField("DIRECTION", b); + b.leftValue = a ? -30 : 30; + b.rightValue = a ? 30 : -30; + b.isStart = !0; + b.timeFlag = 1; setTimeout(function() { - a.timeFlag = 0; + b.timeFlag = 0; }, 1E3); - return a; + return b; }; Blockly.Blocks.albert_set_led_to = {init:function() { this.setColour("#00979D"); @@ -667,10 +680,11 @@ Blockly.Blocks.albert_set_led_to = {init:function() { 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(); +Entry.block.albert_set_led_to = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getField("DIRECTION", b), d = Number(b.getField("COLOR", b)); + "FRONT" == c ? (a.leftEye = d, a.rightEye = d) : "LEFT" == c ? a.leftEye = d : a.rightEye = d; + return b.callReturn(); }; Blockly.Blocks.albert_clear_led = {init:function() { this.setColour("#00979D"); @@ -679,10 +693,11 @@ Blockly.Blocks.albert_clear_led = {init:function() { 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(); +Entry.block.albert_clear_led = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getField("DIRECTION", b); + "FRONT" == c ? (a.leftEye = 0, a.rightEye = 0) : "LEFT" == c ? a.leftEye = 0 : a.rightEye = 0; + return b.callReturn(); }; Blockly.Blocks.albert_change_wheels_by = {init:function() { this.setColour("#00979D"); @@ -693,10 +708,11 @@ Blockly.Blocks.albert_change_wheels_by = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_change_wheels_by = 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(); +Entry.block.albert_change_wheels_by = function(a, b) { + a = Entry.hw.sendQueue; + var c = Entry.hw.portData, d = b.getField("DIRECTION"), e = b.getNumberValue("VALUE"); + "LEFT" == d ? a.leftWheel = void 0 != a.leftWheel ? a.leftWheel + e : c.leftWheel + e : ("RIGHT" != d && (a.leftWheel = void 0 != a.leftWheel ? a.leftWheel + e : c.leftWheel + e), a.rightWheel = void 0 != a.rightWheel ? a.rightWheel + e : c.rightWheel + e); + return b.callReturn(); }; Blockly.Blocks.albert_set_wheels_to = {init:function() { this.setColour("#00979D"); @@ -707,15 +723,16 @@ Blockly.Blocks.albert_set_wheels_to = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_set_wheels_to = 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(); +Entry.block.albert_set_wheels_to = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getField("DIRECTION"), d = b.getNumberValue("VALUE"); + "LEFT" == c ? a.leftWheel = d : ("RIGHT" != c && (a.leftWheel = d), a.rightWheel = d); + return b.callReturn(); }; Entry.Arduino = {name:"arduino", setZero:function() { Entry.hw.sendQueue.readablePorts = []; - for (var b = 0;20 > b;b++) { - Entry.hw.sendQueue[b] = 0, Entry.hw.sendQueue.readablePorts.push(b); + for (var a = 0;20 > a;a++) { + Entry.hw.sendQueue[a] = 0, Entry.hw.sendQueue.readablePorts.push(a); } Entry.hw.update(); }, monitorTemplate:{imgPath:"hw/arduino.png", width:605, height:434, listPorts:{2:{name:Lang.Hw.port_en + " 2 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, 3:{name:Lang.Hw.port_en + " 3 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, 4:{name:Lang.Hw.port_en + " 4 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, 5:{name:Lang.Hw.port_en + " 5 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, 6:{name:Lang.Hw.port_en + " 6 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, 7:{name:Lang.Hw.port_en + @@ -723,16 +740,16 @@ Entry.Arduino = {name:"arduino", setZero:function() { Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, a0:{name:Lang.Hw.port_en + " A0 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, a1:{name:Lang.Hw.port_en + " A1 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, a2:{name:Lang.Hw.port_en + " A2 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, a3:{name:Lang.Hw.port_en + " A3 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, a4:{name:Lang.Hw.port_en + " A4 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, a5:{name:Lang.Hw.port_en + " A5 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}}, mode:"both"}}; Entry.ArduinoExt = {name:"ArduinoExt", getSensorKey:function() { - return "xxxxxxxx".replace(/[xy]/g, function(b) { - var a = 16 * Math.random() | 0; - return ("x" == b ? a : a & 0 | 0).toString(16); + return "xxxxxxxx".replace(/[xy]/g, function(a) { + var b = 16 * Math.random() | 0; + return ("x" == a ? b : b & 0 | 0).toString(16); }).toUpperCase(); -}, getSensorTime:function(b) { - return (new Date).getTime() + b; +}, getSensorTime:function(a) { + return (new Date).getTime() + a; }, setZero:function() { - Entry.hw.sendQueue.SET ? Object.keys(Entry.hw.sendQueue.SET).forEach(function(b) { - Entry.hw.sendQueue.SET[b].data = 0; - Entry.hw.sendQueue.TIME = Entry.ArduinoExt.getSensorTime(Entry.hw.sendQueue.SET[b].type); + Entry.hw.sendQueue.SET ? Object.keys(Entry.hw.sendQueue.SET).forEach(function(a) { + Entry.hw.sendQueue.SET[a].data = 0; + Entry.hw.sendQueue.TIME = Entry.ArduinoExt.getSensorTime(Entry.hw.sendQueue.SET[a].type); Entry.hw.sendQueue.KEY = Entry.ArduinoExt.getSensorKey(); }) : Entry.hw.sendQueue = {SET:{0:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}, 1:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}, 2:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}, 3:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}, 4:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}, 5:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}, 6:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}, 7:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}, 8:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}, 9:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}, 10:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}, 11:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}, 12:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}, 13:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}}, TIME:Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.DIGITAL), KEY:Entry.ArduinoExt.getSensorKey()}; @@ -741,15 +758,15 @@ Entry.ArduinoExt = {name:"ArduinoExt", getSensorKey:function() { 1661, 3322, 6645], 10:[55, 110, 220, 440, 880, 1760, 3520, 7040], 11:[58, 117, 233, 466, 932, 1865, 3729, 7459], 12:[62, 123, 247, 494, 988, 1976, 3951, 7902]}, BlockState:{}}; Entry.SensorBoard = {name:"sensorBoard", setZero:Entry.Arduino.setZero}; Entry.ardublock = {name:"ardublock", setZero:Entry.Arduino.setZero}; -Entry.dplay = {name:"dplay", vel_value:255, Left_value:255, Right_value:255, setZero:Entry.Arduino.setZero, timeouts:[], removeTimeout:function(b) { - clearTimeout(b); - var a = this.timeouts; - b = a.indexOf(b); - 0 <= b && a.splice(b, 1); +Entry.dplay = {name:"dplay", vel_value:255, Left_value:255, Right_value:255, setZero:Entry.Arduino.setZero, timeouts:[], removeTimeout:function(a) { + clearTimeout(a); + var b = this.timeouts; + a = b.indexOf(a); + 0 <= a && b.splice(a, 1); }, removeAllTimeouts:function() { - var b = this.timeouts, a; - for (a in b) { - clearTimeout(b[a]); + var a = this.timeouts, b; + for (b in a) { + clearTimeout(a[b]); } this.timeouts = []; }}; @@ -762,8 +779,8 @@ Blockly.Blocks.arduino_text = {init:function() { this.setOutput(!0, "String"); this.setInputsInline(!0); }}; -Entry.block.arduino_text = function(b, a) { - return a.getStringField("NAME"); +Entry.block.arduino_text = function(a, b) { + return b.getStringField("NAME"); }; Blockly.Blocks.arduino_send = {init:function() { this.setColour("#00979D"); @@ -774,12 +791,13 @@ Blockly.Blocks.arduino_send = {init:function() { 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(); +Entry.block.arduino_send = function(a, b) { + a = b.getValue("VALUE", b); + var c = new XMLHttpRequest; + c.open("POST", "http://localhost:23518/arduino/", !1); + c.send(String(a)); + Entry.assert(200 == c.status, "arduino is not connected"); + return b.callReturn(); }; Blockly.Blocks.arduino_get_string = {init:function() { this.setColour("#00979D"); @@ -789,12 +807,13 @@ Blockly.Blocks.arduino_get_string = {init:function() { 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(a, b) { + a = b.getValue("VALUE", b); + b = new XMLHttpRequest; + b.open("POST", "http://localhost:23518/arduino/", !1); + b.send(String(a)); + Entry.assert(200 == b.status, "arduino is not connected"); + return Number(b.responseText); }; Blockly.Blocks.arduino_get_number = {init:function() { this.setColour("#00979D"); @@ -804,12 +823,13 @@ Blockly.Blocks.arduino_get_number = {init:function() { 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; +Entry.block.arduino_get_string = function(a, b) { + a = b.getValue("VALUE", b); + b = new XMLHttpRequest; + b.open("POST", "http://localhost:23518/arduino/", !1); + b.send(String(a)); + Entry.assert(200 == b.status, "arduino is not connected"); + return b.responseText; }; Blockly.Blocks.arduino_get_sensor_number = {init:function() { this.setColour("#00979D"); @@ -818,8 +838,8 @@ Blockly.Blocks.arduino_get_sensor_number = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.arduino_get_sensor_number = function(b, a) { - return a.getStringField("PORT"); +Entry.block.arduino_get_sensor_number = function(a, b) { + return b.getStringField("PORT"); }; Blockly.Blocks.arduino_get_port_number = {init:function() { this.setColour("#00979D"); @@ -828,8 +848,8 @@ Blockly.Blocks.arduino_get_port_number = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.arduino_get_port_number = function(b, a) { - return a.getStringField("PORT"); +Entry.block.arduino_get_port_number = function(a, b) { + return b.getStringField("PORT"); }; Blockly.Blocks.arduino_get_pwm_port_number = {init:function() { this.setColour("#00979D"); @@ -838,8 +858,8 @@ Blockly.Blocks.arduino_get_pwm_port_number = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.arduino_get_pwm_port_number = function(b, a) { - return a.getStringField("PORT"); +Entry.block.arduino_get_pwm_port_number = function(a, b) { + return b.getStringField("PORT"); }; Blockly.Blocks.arduino_get_number_sensor_value = {init:function() { this.setColour("#00979D"); @@ -849,9 +869,9 @@ Blockly.Blocks.arduino_get_number_sensor_value = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Number"); }}; -Entry.block.arduino_get_number_sensor_value = function(b, a) { - var c = a.getValue("VALUE", a); - return Entry.hw.getAnalogPortValue(c[1]); +Entry.block.arduino_get_number_sensor_value = function(a, b) { + a = b.getValue("VALUE", b); + return Entry.hw.getAnalogPortValue(a[1]); }; Blockly.Blocks.arduino_get_digital_value = {init:function() { this.setColour("#00979D"); @@ -861,9 +881,9 @@ Blockly.Blocks.arduino_get_digital_value = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Boolean"); }}; -Entry.block.arduino_get_digital_value = function(b, a) { - var c = a.getNumberValue("VALUE", a); - return Entry.hw.getDigitalPortValue(c); +Entry.block.arduino_get_digital_value = function(a, b) { + a = b.getNumberValue("VALUE", b); + return Entry.hw.getDigitalPortValue(a); }; Blockly.Blocks.arduino_toggle_led = {init:function() { this.setColour("#00979D"); @@ -875,10 +895,11 @@ Blockly.Blocks.arduino_toggle_led = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.arduino_toggle_led = function(b, a) { - var c = a.getNumberValue("VALUE"), d = a.getField("OPERATOR"); - Entry.hw.setDigitalPortValue(c, "on" == d ? 255 : 0); - return a.callReturn(); +Entry.block.arduino_toggle_led = function(a, b) { + a = b.getNumberValue("VALUE"); + var c = b.getField("OPERATOR"); + Entry.hw.setDigitalPortValue(a, "on" == c ? 255 : 0); + return b.callReturn(); }; Blockly.Blocks.arduino_toggle_pwm = {init:function() { this.setColour("#00979D"); @@ -892,10 +913,11 @@ Blockly.Blocks.arduino_toggle_pwm = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.arduino_toggle_pwm = function(b, a) { - var c = a.getNumberValue("PORT"), d = a.getNumberValue("VALUE"), d = Math.round(d), d = Math.max(d, 0), d = Math.min(d, 255); - Entry.hw.setDigitalPortValue(c, d); - return a.callReturn(); +Entry.block.arduino_toggle_pwm = function(a, b) { + a = b.getNumberValue("PORT"); + var c = b.getNumberValue("VALUE"), c = Math.round(c), c = Math.max(c, 0), c = Math.min(c, 255); + Entry.hw.setDigitalPortValue(a, c); + return b.callReturn(); }; Blockly.Blocks.arduino_convert_scale = {init:function() { this.setColour("#00979D"); @@ -914,17 +936,18 @@ Blockly.Blocks.arduino_convert_scale = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.arduino_convert_scale = function(b, a) { - var c = a.getNumberValue("VALUE1", a), d = a.getNumberValue("VALUE2", a), e = a.getNumberValue("VALUE3", a), f = a.getNumberValue("VALUE4", a), g = a.getNumberValue("VALUE5", a); +Entry.block.arduino_convert_scale = function(a, b) { + var c = b.getNumberValue("VALUE1", b), d = b.getNumberValue("VALUE2", b), e = b.getNumberValue("VALUE3", b); + a = b.getNumberValue("VALUE4", b); + b = b.getNumberValue("VALUE5", b); if (d > e) { - var h = d, d = e, e = h - } - f > g && (h = f, f = g, g = h); - c -= d; - c *= (g - f) / (e - d); - c += f; - c = Math.min(g, c); - c = Math.max(f, c); + var f = d, d = e, e = f + } + a > b && (f = a, a = b, b = f); + c = (b - a) / (e - d) * (c - d); + c += a; + c = Math.min(b, c); + c = Math.max(a, c); return Math.round(c); }; Blockly.Blocks.sensorBoard_get_named_sensor_value = {init:function() { @@ -933,8 +956,8 @@ Blockly.Blocks.sensorBoard_get_named_sensor_value = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.sensorBoard_get_named_sensor_value = function(b, a) { - return Entry.hw.getAnalogPortValue(a.getField("PORT", a)); +Entry.block.sensorBoard_get_named_sensor_value = function(a, b) { + return Entry.hw.getAnalogPortValue(b.getField("PORT", b)); }; Blockly.Blocks.sensorBoard_is_button_pressed = {init:function() { this.setColour("#00979D"); @@ -943,8 +966,8 @@ Blockly.Blocks.sensorBoard_is_button_pressed = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Boolean"); }}; -Entry.block.sensorBoard_is_button_pressed = function(b, a) { - return Entry.hw.getDigitalPortValue(a.getNumberField("PORT", a)); +Entry.block.sensorBoard_is_button_pressed = function(a, b) { + return Entry.hw.getDigitalPortValue(b.getNumberField("PORT", b)); }; Blockly.Blocks.sensorBoard_led = {init:function() { this.setColour("#00979D"); @@ -953,9 +976,9 @@ Blockly.Blocks.sensorBoard_led = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.sensorBoard_led = function(b, a) { - Entry.hw.setDigitalPortValue(a.getField("PORT"), a.getNumberField("OPERATOR")); - return a.callReturn(); +Entry.block.sensorBoard_led = function(a, b) { + Entry.hw.setDigitalPortValue(b.getField("PORT"), b.getNumberField("OPERATOR")); + return b.callReturn(); }; Entry.block.arduino_download_connector = {skeleton:"basic_button", color:"#eee", template:"%1", params:[{type:"Text", text:"\uc5f0\uacb0 \ud504\ub85c\uadf8\ub7a8 \ub2e4\uc6b4\ub85c\ub4dc", color:"#333", align:"center"}], func:function() { }, events:{mousedown:[function() { @@ -980,8 +1003,8 @@ Blockly.Blocks.CODEino_get_sensor_number = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.CODEino_get_sensor_number = function(b, a) { - return a.getStringField("PORT"); +Entry.block.CODEino_get_sensor_number = function(a, b) { + return b.getStringField("PORT"); }; Blockly.Blocks.CODEino_get_named_sensor_value = {init:function() { this.setColour("#00979D"); @@ -989,8 +1012,8 @@ Blockly.Blocks.CODEino_get_named_sensor_value = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.CODEino_get_named_sensor_value = function(b, a) { - return Entry.hw.getAnalogPortValue(a.getField("PORT", a)); +Entry.block.CODEino_get_named_sensor_value = function(a, b) { + return Entry.hw.getAnalogPortValue(b.getField("PORT", b)); }; Blockly.Blocks.CODEino_get_sound_status = {init:function() { this.setColour("#00979D"); @@ -998,8 +1021,8 @@ Blockly.Blocks.CODEino_get_sound_status = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Boolean"); }}; -Entry.block.CODEino_get_sound_status = function(b, a) { - return "GREAT" == a.getField("STATUS", a) ? 600 < Entry.hw.getAnalogPortValue(0) ? 1 : 0 : 600 > Entry.hw.getAnalogPortValue(0) ? 1 : 0; +Entry.block.CODEino_get_sound_status = function(a, b) { + return "GREAT" == b.getField("STATUS", b) ? 600 < Entry.hw.getAnalogPortValue(0) ? 1 : 0 : 600 > Entry.hw.getAnalogPortValue(0) ? 1 : 0; }; Blockly.Blocks.CODEino_get_light_status = {init:function() { this.setColour("#00979D"); @@ -1007,8 +1030,8 @@ Blockly.Blocks.CODEino_get_light_status = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Boolean"); }}; -Entry.block.CODEino_get_light_status = function(b, a) { - return "DARK" == a.getField("STATUS", a) ? 800 < Entry.hw.getAnalogPortValue(1) ? 1 : 0 : 800 > Entry.hw.getAnalogPortValue(1) ? 1 : 0; +Entry.block.CODEino_get_light_status = function(a, b) { + return "DARK" == b.getField("STATUS", b) ? 800 < Entry.hw.getAnalogPortValue(1) ? 1 : 0 : 800 > Entry.hw.getAnalogPortValue(1) ? 1 : 0; }; Blockly.Blocks.CODEino_is_button_pressed = {init:function() { this.setColour("#00979D"); @@ -1016,9 +1039,9 @@ Blockly.Blocks.CODEino_is_button_pressed = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Boolean"); }}; -Entry.block.CODEino_is_button_pressed = function(b, a) { - var c = a.getNumberField("PORT", a); - return 14 < c ? !Entry.hw.getAnalogPortValue(c - 14) : !Entry.hw.getDigitalPortValue(c); +Entry.block.CODEino_is_button_pressed = function(a, b) { + a = b.getNumberField("PORT", b); + return 14 < a ? !Entry.hw.getAnalogPortValue(a - 14) : !Entry.hw.getDigitalPortValue(a); }; Blockly.Blocks.CODEino_get_accelerometer_direction = {init:function() { this.setColour("#00979D"); @@ -1027,23 +1050,22 @@ Blockly.Blocks.CODEino_get_accelerometer_direction = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Boolean"); }}; -Entry.block.CODEino_get_accelerometer_direction = function(b, a) { - var c = a.getField("DIRECTION", a), d = 0; - "LEFT" == c || "RIGHT" == c ? d = 3 : "FRONT" == c || "REAR" == c ? d = 4 : "REVERSE" == c && (d = 5); - d = Entry.hw.getAnalogPortValue(d); - d = 180 / 137 * (d - 265); - d += -90; - d = Math.min(90, d); - d = Math.max(-90, d); - d = Math.round(d); - if ("LEFT" == c || "REAR" == c) { - return -30 > d ? 1 : 0; +Entry.block.CODEino_get_accelerometer_direction = function(a, b) { + a = b.getField("DIRECTION", b); + b = 0; + "LEFT" == a || "RIGHT" == a ? b = 3 : "FRONT" == a || "REAR" == a ? b = 4 : "REVERSE" == a && (b = 5); + b = Entry.hw.getAnalogPortValue(b) - 265; + b = Math.min(90, 180 / 137 * b + -90); + b = Math.max(-90, b); + b = Math.round(b); + if ("LEFT" == a || "REAR" == a) { + return -30 > b ? 1 : 0; } - if ("RIGHT" == c || "FRONT" == c) { - return 30 < d ? 1 : 0; + if ("RIGHT" == a || "FRONT" == a) { + return 30 < b ? 1 : 0; } - if ("REVERSE" == c) { - return -50 > d ? 1 : 0; + if ("REVERSE" == a) { + return -50 > b ? 1 : 0; } }; Blockly.Blocks.CODEino_get_accelerometer_value = {init:function() { @@ -1052,17 +1074,19 @@ Blockly.Blocks.CODEino_get_accelerometer_value = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.CODEino_get_accelerometer_value = function(b, a) { - var c = 265, d = 402, e = -90, f = 90, g = Entry.hw.getAnalogPortValue(a.getField("PORT", a)); - if (c > d) { - var h = c, c = d, d = h +Entry.block.CODEino_get_accelerometer_value = function(a, b) { + var c = Entry.hw.getAnalogPortValue(b.getField("PORT", b)), d = 265, e = 402; + a = -90; + b = 90; + if (d > e) { + var f = d, d = e, e = f } - e > f && (h = e, e = f, f = h); - g = (f - e) / (d - c) * (g - c); - g += e; - g = Math.min(f, g); - g = Math.max(e, g); - return Math.round(g); + a > b && (f = a, a = b, b = f); + c = (b - a) / (e - d) * (c - d); + c += a; + c = Math.min(b, c); + c = Math.max(a, c); + return Math.round(c); }; Blockly.Blocks.dplay_select_led = {init:function() { this.setColour("#00979D"); @@ -1074,12 +1098,13 @@ Blockly.Blocks.dplay_select_led = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.dplay_select_led = function(b, a) { - var c = a.getField("PORT"), d = 7; - "7" == c ? d = 7 : "8" == c ? d = 8 : "9" == c ? d = 9 : "10" == c && (d = 10); - c = a.getField("OPERATOR"); - Entry.hw.setDigitalPortValue(d, "on" == c ? 255 : 0); - return a.callReturn(); +Entry.block.dplay_select_led = function(a, b) { + var c = b.getField("PORT"); + a = 7; + "7" == c ? a = 7 : "8" == c ? a = 8 : "9" == c ? a = 9 : "10" == c && (a = 10); + c = b.getField("OPERATOR"); + Entry.hw.setDigitalPortValue(a, "on" == c ? 255 : 0); + return b.callReturn(); }; Blockly.Blocks.dplay_get_switch_status = {init:function() { this.setColour("#00979D"); @@ -1089,10 +1114,11 @@ Blockly.Blocks.dplay_get_switch_status = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Boolean"); }}; -Entry.block.dplay_get_switch_status = function(b, a) { - var c = a.getField("PORT"), d = 2; - "2" == c ? d = 2 : "4" == c && (d = 4); - return "OFF" == a.getField("STATUS") ? 1 == Entry.hw.getDigitalPortValue(d) ? 1 : 0 : 0 == Entry.hw.getDigitalPortValue(d) ? 1 : 0; +Entry.block.dplay_get_switch_status = function(a, b) { + a = b.getField("PORT"); + var c = 2; + "2" == a ? c = 2 : "4" == a && (c = 4); + return "OFF" == b.getField("STATUS") ? 1 == Entry.hw.getDigitalPortValue(c) ? 1 : 0 : 0 == Entry.hw.getDigitalPortValue(c) ? 1 : 0; }; Blockly.Blocks.dplay_get_light_status = {init:function() { this.setColour("#00979D"); @@ -1100,8 +1126,8 @@ Blockly.Blocks.dplay_get_light_status = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Boolean"); }}; -Entry.block.dplay_get_light_status = function(b, a) { - return "DARK" == a.getField("STATUS", a) ? 800 < Entry.hw.getAnalogPortValue(1) ? 1 : 0 : 800 > Entry.hw.getAnalogPortValue(1) ? 1 : 0; +Entry.block.dplay_get_light_status = function(a, b) { + return "DARK" == b.getField("STATUS", b) ? 800 < Entry.hw.getAnalogPortValue(1) ? 1 : 0 : 800 > Entry.hw.getAnalogPortValue(1) ? 1 : 0; }; Blockly.Blocks.dplay_get_value = {init:function() { this.setColour("#00979D"); @@ -1113,9 +1139,9 @@ Blockly.Blocks.dplay_get_value = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Number"); }}; -Entry.block.dplay_get_value = function(b, a) { - var c = a.getValue("VALUE", a); - return Entry.hw.getAnalogPortValue(c[1]); +Entry.block.dplay_get_value = function(a, b) { + a = b.getValue("VALUE", b); + return Entry.hw.getAnalogPortValue(a[1]); }; Blockly.Blocks.dplay_get_tilt = {init:function() { this.setColour("#00979D"); @@ -1123,8 +1149,8 @@ Blockly.Blocks.dplay_get_tilt = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Boolean"); }}; -Entry.block.dplay_get_tilt = function(b, a) { - return "LIGHT" == a.getField("STATUS", a) ? 1 == Entry.hw.getDigitalPortValue(12) ? 1 : 0 : 0 == Entry.hw.getDigitalPortValue(12) ? 1 : 0; +Entry.block.dplay_get_tilt = function(a, b) { + return "LIGHT" == b.getField("STATUS", b) ? 1 == Entry.hw.getDigitalPortValue(12) ? 1 : 0 : 0 == Entry.hw.getDigitalPortValue(12) ? 1 : 0; }; Blockly.Blocks.dplay_DCmotor = {init:function() { this.setColour("#00979D"); @@ -1135,14 +1161,15 @@ Blockly.Blocks.dplay_DCmotor = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.dplay_DCmotor = function(b, a) { - var c = a.getField("PORT"), d = 0; - "3" == c ? d = 5 : "6" == c && (d = 11); - var e = a.getField("OPERATOR"), f = 0, g = 0; - "FRONT" == e ? (f = 255, g = 0) : "REAR" == e ? (f = 0, g = 255) : "OFF" == e && (g = f = 0); +Entry.block.dplay_DCmotor = function(a, b) { + a = b.getField("PORT"); + var c = 0; + "3" == a ? c = 5 : "6" == a && (c = 11); + var d = b.getField("OPERATOR"), e = 0, f = 0; + "FRONT" == d ? (e = 255, f = 0) : "REAR" == d ? (e = 0, f = 255) : "OFF" == d && (f = e = 0); + Entry.hw.setDigitalPortValue(a, e); Entry.hw.setDigitalPortValue(c, f); - Entry.hw.setDigitalPortValue(d, g); - return a.callReturn(); + return b.callReturn(); }; Blockly.Blocks.dplay_buzzer = {init:function() { this.setColour("#00979D"); @@ -1156,15 +1183,16 @@ Blockly.Blocks.dplay_buzzer = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.dplay_buzzer = function(b, a) { - var c = a.getField("PORT"), d = 2; - "1" == c ? d = 2 : "2" == c ? d = 4 : "3" == c && (d = 7); - c = a.getNumberValue("VALUE"); +Entry.block.dplay_buzzer = function(a, b) { + var c = b.getField("PORT"); + a = 2; + "1" == c ? a = 2 : "2" == c ? a = 4 : "3" == c && (a = 7); + c = b.getNumberValue("VALUE"); c = Math.round(c); c = Math.max(c, 0); c = Math.min(c, 100); - Entry.hw.setDigitalPortValue(d, c); - return a.callReturn(); + Entry.hw.setDigitalPortValue(a, c); + return b.callReturn(); }; Blockly.Blocks.dplay_servo = {init:function() { this.setColour("#00979D"); @@ -1176,39 +1204,42 @@ Blockly.Blocks.dplay_servo = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.dplay_servo = function(b, a) { - var c = a.getNumberValue("VALUE"), c = Math.round(c), c = Math.max(c, 0), c = Math.min(c, 180); - Entry.hw.setDigitalPortValue(9, c); - return a.callReturn(); +Entry.block.dplay_servo = function(a, b) { + a = b.getNumberValue("VALUE"); + a = Math.round(a); + a = Math.max(a, 0); + a = Math.min(a, 180); + Entry.hw.setDigitalPortValue(9, a); + return b.callReturn(); }; Entry.Bitbrick = {SENSOR_MAP:{1:"light", 2:"IR", 3:"touch", 4:"potentiometer", 5:"MIC", 21:"UserSensor", 11:"UserInput", 20:"LED", 19:"SERVO", 18:"DC"}, PORT_MAP:{buzzer:2, 5:4, 6:6, 7:8, 8:10, LEDR:12, LEDG:14, LEDB:16}, sensorList:function() { - for (var b = [], a = Entry.hw.portData, c = 1;5 > c;c++) { - var d = a[c]; - d && (d.value || 0 === d.value) && b.push([c + " - " + Lang.Blocks["BITBRICK_" + d.type], c.toString()]); + for (var a = [], b = Entry.hw.portData, c = 1;5 > c;c++) { + var d = b[c]; + d && (d.value || 0 === d.value) && a.push([c + " - " + Lang.Blocks["BITBRICK_" + d.type], c.toString()]); } - return 0 == b.length ? [[Lang.Blocks.no_target, "null"]] : b; + return 0 == a.length ? [[Lang.Blocks.no_target, "null"]] : a; }, touchList:function() { - for (var b = [], a = Entry.hw.portData, c = 1;5 > c;c++) { - var d = a[c]; - d && "touch" === d.type && b.push([c.toString(), c.toString()]); + for (var a = [], b = Entry.hw.portData, c = 1;5 > c;c++) { + var d = b[c]; + d && "touch" === d.type && a.push([c.toString(), c.toString()]); } - return 0 == b.length ? [[Lang.Blocks.no_target, "null"]] : b; + return 0 == a.length ? [[Lang.Blocks.no_target, "null"]] : a; }, servoList:function() { - for (var b = [], a = Entry.hw.portData, c = 5;9 > c;c++) { - var d = a[c]; - d && "SERVO" === d.type && b.push(["ABCD"[c - 5], c.toString()]); + for (var a = [], b = Entry.hw.portData, c = 5;9 > c;c++) { + var d = b[c]; + d && "SERVO" === d.type && a.push(["ABCD"[c - 5], c.toString()]); } - return 0 == b.length ? [[Lang.Blocks.no_target, "null"]] : b; + return 0 == a.length ? [[Lang.Blocks.no_target, "null"]] : a; }, dcList:function() { - for (var b = [], a = Entry.hw.portData, c = 5;9 > c;c++) { - var d = a[c]; - d && "DC" === d.type && b.push(["ABCD"[c - 5], c.toString()]); + for (var a = [], b = Entry.hw.portData, c = 5;9 > c;c++) { + var d = b[c]; + d && "DC" === d.type && a.push(["ABCD"[c - 5], c.toString()]); } - return 0 == b.length ? [[Lang.Blocks.no_target, "null"]] : b; + return 0 == a.length ? [[Lang.Blocks.no_target, "null"]] : a; }, setZero:function() { - var b = Entry.hw.sendQueue, a; - for (a in Entry.Bitbrick.PORT_MAP) { - b[a] = 0; + var a = Entry.hw.sendQueue, b; + for (b in Entry.Bitbrick.PORT_MAP) { + a[b] = 0; } Entry.hw.update(); }, name:"bitbrick", servoMaxValue:181, servoMinValue:1, dcMaxValue:100, dcMinValue:-100, monitorTemplate:{keys:["value"], imgPath:"hw/bitbrick.png", width:400, height:400, listPorts:{1:{name:Lang.Hw.port_en + " 1 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, 2:{name:Lang.Hw.port_en + " 2 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, 3:{name:Lang.Hw.port_en + " 3 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, 4:{name:Lang.Hw.port_en + " 4 " + Lang.Hw.port_ko, type:"input", pos:{x:0, @@ -1219,9 +1250,9 @@ Blockly.Blocks.bitbrick_sensor_value = {init:function() { this.setOutput(!0, "String"); this.setInputsInline(!0); }}; -Entry.block.bitbrick_sensor_value = function(b, a) { - var c = a.getStringField("PORT"); - return Entry.hw.portData[c].value; +Entry.block.bitbrick_sensor_value = function(a, b) { + a = b.getStringField("PORT"); + return Entry.hw.portData[a].value; }; Blockly.Blocks.bitbrick_is_touch_pressed = {init:function() { this.setColour("#00979D"); @@ -1229,8 +1260,8 @@ Blockly.Blocks.bitbrick_is_touch_pressed = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.bitbrick_is_touch_pressed = function(b, a) { - return 0 === Entry.hw.portData[a.getStringField("PORT")].value; +Entry.block.bitbrick_is_touch_pressed = function(a, b) { + return 0 === Entry.hw.portData[b.getStringField("PORT")].value; }; Blockly.Blocks.bitbrick_turn_off_color_led = {init:function() { this.setColour("#00979D"); @@ -1239,11 +1270,11 @@ Blockly.Blocks.bitbrick_turn_off_color_led = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.bitbrick_turn_off_color_led = function(b, a) { +Entry.block.bitbrick_turn_off_color_led = function(a, b) { Entry.hw.sendQueue.LEDR = 0; Entry.hw.sendQueue.LEDG = 0; Entry.hw.sendQueue.LEDB = 0; - return a.callReturn(); + return b.callReturn(); }; Blockly.Blocks.bitbrick_turn_on_color_led_by_rgb = {init:function() { this.setColour("#00979D"); @@ -1258,12 +1289,13 @@ Blockly.Blocks.bitbrick_turn_on_color_led_by_rgb = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.bitbrick_turn_on_color_led_by_rgb = function(b, a) { - var c = a.getNumberValue("rValue"), d = a.getNumberValue("gValue"), e = a.getNumberValue("bValue"), f = Entry.adjustValueWithMaxMin, g = Entry.hw.sendQueue; - g.LEDR = f(c, 0, 255); - g.LEDG = f(d, 0, 255); - g.LEDB = f(e, 0, 255); - return a.callReturn(); +Entry.block.bitbrick_turn_on_color_led_by_rgb = function(a, b) { + a = b.getNumberValue("rValue"); + var c = b.getNumberValue("gValue"), d = b.getNumberValue("bValue"), e = Entry.adjustValueWithMaxMin, f = Entry.hw.sendQueue; + f.LEDR = e(a, 0, 255); + f.LEDG = e(c, 0, 255); + f.LEDB = e(d, 0, 255); + return b.callReturn(); }; Blockly.Blocks.bitbrick_turn_on_color_led_by_picker = {init:function() { this.setColour("#00979D"); @@ -1272,12 +1304,12 @@ Blockly.Blocks.bitbrick_turn_on_color_led_by_picker = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.bitbrick_turn_on_color_led_by_picker = function(b, a) { - var c = a.getStringField("VALUE"); - Entry.hw.sendQueue.LEDR = parseInt(c.substr(1, 2), 16); - Entry.hw.sendQueue.LEDG = parseInt(c.substr(3, 2), 16); - Entry.hw.sendQueue.LEDB = parseInt(c.substr(5, 2), 16); - return a.callReturn(); +Entry.block.bitbrick_turn_on_color_led_by_picker = function(a, b) { + a = b.getStringField("VALUE"); + Entry.hw.sendQueue.LEDR = parseInt(a.substr(1, 2), 16); + Entry.hw.sendQueue.LEDG = parseInt(a.substr(3, 2), 16); + Entry.hw.sendQueue.LEDB = parseInt(a.substr(5, 2), 16); + return b.callReturn(); }; Blockly.Blocks.bitbrick_turn_on_color_led_by_value = {init:function() { this.setColour("#00979D"); @@ -1288,13 +1320,15 @@ Blockly.Blocks.bitbrick_turn_on_color_led_by_value = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.bitbrick_turn_on_color_led_by_value = function(b, a) { - var c = a.getNumberValue("VALUE"), d, e, f, c = c % 200; - 67 > c ? (d = 200 - 3 * c, e = 3 * c, f = 0) : 134 > c ? (c -= 67, d = 0, e = 200 - 3 * c, f = 3 * c) : 201 > c && (c -= 134, d = 3 * c, e = 0, f = 200 - 3 * c); - Entry.hw.sendQueue.LEDR = d; - Entry.hw.sendQueue.LEDG = e; - Entry.hw.sendQueue.LEDB = f; - return a.callReturn(); +Entry.block.bitbrick_turn_on_color_led_by_value = function(a, b) { + a = b.getNumberValue("VALUE"); + var c, d, e; + a %= 200; + 67 > a ? (c = 200 - 3 * a, d = 3 * a, e = 0) : 134 > a ? (a -= 67, c = 0, d = 200 - 3 * a, e = 3 * a) : 201 > a && (a -= 134, c = 3 * a, d = 0, e = 200 - 3 * a); + Entry.hw.sendQueue.LEDR = c; + Entry.hw.sendQueue.LEDG = d; + Entry.hw.sendQueue.LEDB = e; + return b.callReturn(); }; Blockly.Blocks.bitbrick_buzzer = {init:function() { this.setColour("#00979D"); @@ -1305,14 +1339,14 @@ Blockly.Blocks.bitbrick_buzzer = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.bitbrick_buzzer = function(b, a) { - if (a.isStart) { - return Entry.hw.sendQueue.buzzer = 0, delete a.isStart, a.callReturn(); +Entry.block.bitbrick_buzzer = function(a, b) { + if (b.isStart) { + return Entry.hw.sendQueue.buzzer = 0, delete b.isStart, b.callReturn(); } - var c = a.getNumberValue("VALUE"); - Entry.hw.sendQueue.buzzer = c; - a.isStart = !0; - return a; + a = b.getNumberValue("VALUE"); + Entry.hw.sendQueue.buzzer = a; + b.isStart = !0; + return b; }; Blockly.Blocks.bitbrick_turn_off_all_motors = {init:function() { this.setColour("#00979D"); @@ -1321,15 +1355,16 @@ Blockly.Blocks.bitbrick_turn_off_all_motors = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.bitbrick_turn_off_all_motors = function(b, a) { - var c = Entry.hw.sendQueue, d = Entry.Bitbrick; - d.servoList().map(function(a) { - c[a[1]] = 0; +Entry.block.bitbrick_turn_off_all_motors = function(a, b) { + var c = Entry.hw.sendQueue; + a = Entry.Bitbrick; + a.servoList().map(function(b) { + c[b[1]] = 0; }); - d.dcList().map(function(a) { - c[a[1]] = 128; + a.dcList().map(function(b) { + c[b[1]] = 128; }); - return a.callReturn(); + return b.callReturn(); }; Blockly.Blocks.bitbrick_dc_speed = {init:function() { this.setColour("#00979D"); @@ -1340,10 +1375,12 @@ Blockly.Blocks.bitbrick_dc_speed = {init:function() { this.setNextStatement(!0); this.setInputsInline(!0); }}; -Entry.block.bitbrick_dc_speed = function(b, a) { - var c = a.getNumberValue("VALUE"), c = Math.min(c, Entry.Bitbrick.dcMaxValue), c = Math.max(c, Entry.Bitbrick.dcMinValue); - Entry.hw.sendQueue[a.getStringField("PORT")] = c + 128; - return a.callReturn(); +Entry.block.bitbrick_dc_speed = function(a, b) { + a = b.getNumberValue("VALUE"); + a = Math.min(a, Entry.Bitbrick.dcMaxValue); + a = Math.max(a, Entry.Bitbrick.dcMinValue); + Entry.hw.sendQueue[b.getStringField("PORT")] = a + 128; + return b.callReturn(); }; Blockly.Blocks.bitbrick_dc_direction_speed = {init:function() { this.setColour("#00979D"); @@ -1354,10 +1391,11 @@ Blockly.Blocks.bitbrick_dc_direction_speed = {init:function() { this.setNextStatement(!0); this.setInputsInline(!0); }}; -Entry.block.bitbrick_dc_direction_speed = function(b, a) { - var c = "CW" === a.getStringField("DIRECTION"), d = a.getNumberValue("VALUE"), d = Math.min(d, Entry.Bitbrick.dcMaxValue), d = Math.max(d, 0); - Entry.hw.sendQueue[a.getStringField("PORT")] = c ? d + 128 : 128 - d; - return a.callReturn(); +Entry.block.bitbrick_dc_direction_speed = function(a, b) { + a = "CW" === b.getStringField("DIRECTION"); + var c = b.getNumberValue("VALUE"), c = Math.min(c, Entry.Bitbrick.dcMaxValue), c = Math.max(c, 0); + Entry.hw.sendQueue[b.getStringField("PORT")] = a ? c + 128 : 128 - c; + return b.callReturn(); }; Blockly.Blocks.bitbrick_servomotor_angle = {init:function() { this.setColour("#00979D"); @@ -1368,10 +1406,12 @@ Blockly.Blocks.bitbrick_servomotor_angle = {init:function() { this.setNextStatement(!0); this.setInputsInline(!0); }}; -Entry.block.bitbrick_servomotor_angle = function(b, a) { - var c = a.getNumberValue("VALUE") + 1, c = Math.min(c, Entry.Bitbrick.servoMaxValue), c = Math.max(c, Entry.Bitbrick.servoMinValue); - Entry.hw.sendQueue[a.getStringField("PORT")] = c; - return a.callReturn(); +Entry.block.bitbrick_servomotor_angle = function(a, b) { + a = b.getNumberValue("VALUE") + 1; + a = Math.min(a, Entry.Bitbrick.servoMaxValue); + a = Math.max(a, Entry.Bitbrick.servoMinValue); + Entry.hw.sendQueue[b.getStringField("PORT")] = a; + return b.callReturn(); }; Blockly.Blocks.bitbrick_convert_scale = {init:function() { this.setColour("#00979D"); @@ -1388,17 +1428,21 @@ Blockly.Blocks.bitbrick_convert_scale = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.bitbrick_convert_scale = function(b, a) { - var c = a.getNumberField("PORT"), d = Entry.hw.portData[c].value, c = a.getNumberValue("VALUE2", a), e = a.getNumberValue("VALUE3", a), f = a.getNumberValue("VALUE4", a), g = a.getNumberValue("VALUE5", a); - if (f > g) { - var h = f, f = g, g = h - } - d -= c; - d *= (g - f) / (e - c); - d += f; - d = Math.min(g, d); - d = Math.max(f, d); - return Math.round(d); +Entry.block.bitbrick_convert_scale = function(a, b) { + a = b.getNumberField("PORT"); + var c = Entry.hw.portData[a].value, d = b.getNumberValue("VALUE2", b), e = b.getNumberValue("VALUE3", b); + a = b.getNumberValue("VALUE4", b); + b = b.getNumberValue("VALUE5", b); + if (a > b) { + var f = a; + a = b; + b = f; + } + c = (b - a) / (e - d) * (c - d); + c += a; + c = Math.min(b, c); + c = Math.max(a, c); + return Math.round(c); }; var categoryColor = "#FF9E20"; Blockly.Blocks.start_drawing = {init:function() { @@ -1408,11 +1452,11 @@ Blockly.Blocks.start_drawing = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.start_drawing = function(b, a) { - b.brush ? b.brush.stop = !1 : Entry.setBasicBrush(b); +Entry.block.start_drawing = function(a, b) { + a.brush ? a.brush.stop = !1 : Entry.setBasicBrush(a); Entry.stage.sortZorder(); - b.brush.moveTo(b.getX(), -1 * b.getY()); - return a.callReturn(); + a.brush.moveTo(a.getX(), -1 * a.getY()); + return b.callReturn(); }; Blockly.Blocks.stop_drawing = {init:function() { this.setColour(categoryColor); @@ -1421,9 +1465,9 @@ Blockly.Blocks.stop_drawing = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.stop_drawing = function(b, a) { - b.brush && b.shape && (b.brush.stop = !0); - return a.callReturn(); +Entry.block.stop_drawing = function(a, b) { + a.brush && a.shape && (a.brush.stop = !0); + return b.callReturn(); }; Blockly.Blocks.set_color = {init:function() { this.setColour(categoryColor); @@ -1434,11 +1478,11 @@ Blockly.Blocks.set_color = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.set_color = function(b, a) { - var c = a.getField("VALUE", a); - b.brush || (Entry.setBasicBrush(b), b.brush.stop = !0); - b.brush && (c = Entry.hex2rgb(c), b.brush.rgb = c, b.brush.endStroke(), b.brush.beginStroke("rgba(" + c.r + "," + c.g + "," + c.b + "," + b.brush.opacity / 100 + ")"), b.brush.moveTo(b.getX(), -1 * b.getY())); - return a.callReturn(); +Entry.block.set_color = function(a, b) { + var c = b.getField("VALUE", b); + a.brush || (Entry.setBasicBrush(a), a.brush.stop = !0); + a.brush && (c = Entry.hex2rgb(c), a.brush.rgb = c, a.brush.endStroke(), a.brush.beginStroke("rgba(" + c.r + "," + c.g + "," + c.b + "," + a.brush.opacity / 100 + ")"), a.brush.moveTo(a.getX(), -1 * a.getY())); + return b.callReturn(); }; Blockly.Blocks.set_random_color = {init:function() { this.setColour(categoryColor); @@ -1447,16 +1491,16 @@ Blockly.Blocks.set_random_color = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.set_random_color = function(b, a) { - b.brush || (Entry.setBasicBrush(b), b.brush.stop = !0); - if (b.brush) { +Entry.block.set_random_color = function(a, b) { + a.brush || (Entry.setBasicBrush(a), a.brush.stop = !0); + if (a.brush) { var c = Entry.generateRgb(); - b.brush.rgb = c; - b.brush.endStroke(); - b.brush.beginStroke("rgba(" + c.r + "," + c.g + "," + c.b + "," + b.brush.opacity / 100 + ")"); - b.brush.moveTo(b.getX(), -1 * b.getY()); + a.brush.rgb = c; + a.brush.endStroke(); + a.brush.beginStroke("rgba(" + c.r + "," + c.g + "," + c.b + "," + a.brush.opacity / 100 + ")"); + a.brush.moveTo(a.getX(), -1 * a.getY()); } - return a.callReturn(); + return b.callReturn(); }; Blockly.Blocks.change_thickness = {init:function() { this.setColour(categoryColor); @@ -1467,11 +1511,11 @@ Blockly.Blocks.change_thickness = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.change_thickness = function(b, a) { - var c = a.getNumberValue("VALUE", a); - b.brush || (Entry.setBasicBrush(b), b.brush.stop = !0); - b.brush && (b.brush.thickness += c, 1 > b.brush.thickness && (b.brush.thickness = 1), b.brush.setStrokeStyle(b.brush.thickness), b.brush.moveTo(b.getX(), -1 * b.getY())); - return a.callReturn(); +Entry.block.change_thickness = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.brush || (Entry.setBasicBrush(a), a.brush.stop = !0); + a.brush && (a.brush.thickness += c, 1 > a.brush.thickness && (a.brush.thickness = 1), a.brush.setStrokeStyle(a.brush.thickness), a.brush.moveTo(a.getX(), -1 * a.getY())); + return b.callReturn(); }; Blockly.Blocks.set_thickness = {init:function() { this.setColour(categoryColor); @@ -1482,11 +1526,11 @@ Blockly.Blocks.set_thickness = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.set_thickness = function(b, a) { - var c = a.getNumberValue("VALUE", a); - b.brush || (Entry.setBasicBrush(b), b.brush.stop = !0); - b.brush && (b.brush.thickness = c, b.brush.setStrokeStyle(b.brush.thickness), b.brush.moveTo(b.getX(), -1 * b.getY())); - return a.callReturn(); +Entry.block.set_thickness = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.brush || (Entry.setBasicBrush(a), a.brush.stop = !0); + a.brush && (a.brush.thickness = c, a.brush.setStrokeStyle(a.brush.thickness), a.brush.moveTo(a.getX(), -1 * a.getY())); + return b.callReturn(); }; Blockly.Blocks.change_opacity = {init:function() { this.setColour(categoryColor); @@ -1497,12 +1541,12 @@ Blockly.Blocks.change_opacity = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.change_opacity = function(b, a) { - var c = a.getNumberValue("VALUE", a); - b.brush || (Entry.setBasicBrush(b), b.brush.stop = !0); - c = Entry.adjustValueWithMaxMin(b.brush.opacity + c, 0, 100); - b.brush && (b.brush.opacity = c, b.brush.endStroke(), c = b.brush.rgb, b.brush.beginStroke("rgba(" + c.r + "," + c.g + "," + c.b + "," + b.brush.opacity / 100 + ")"), b.brush.moveTo(b.getX(), -1 * b.getY())); - return a.callReturn(); +Entry.block.change_opacity = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.brush || (Entry.setBasicBrush(a), a.brush.stop = !0); + c = Entry.adjustValueWithMaxMin(a.brush.opacity + c, 0, 100); + a.brush && (a.brush.opacity = c, a.brush.endStroke(), c = a.brush.rgb, a.brush.beginStroke("rgba(" + c.r + "," + c.g + "," + c.b + "," + a.brush.opacity / 100 + ")"), a.brush.moveTo(a.getX(), -1 * a.getY())); + return b.callReturn(); }; Blockly.Blocks.set_opacity = {init:function() { this.setColour(categoryColor); @@ -1513,11 +1557,11 @@ Blockly.Blocks.set_opacity = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.set_opacity = function(b, a) { - var c = a.getNumberValue("VALUE", a); - b.brush || (Entry.setBasicBrush(b), b.brush.stop = !0); - b.brush && (b.brush.opacity = Entry.adjustValueWithMaxMin(c, 0, 100), b.brush.endStroke(), c = b.brush.rgb, b.brush.beginStroke("rgba(" + c.r + "," + c.g + "," + c.b + "," + b.brush.opacity / 100 + ")"), b.brush.moveTo(b.getX(), -1 * b.getY())); - return a.callReturn(); +Entry.block.set_opacity = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.brush || (Entry.setBasicBrush(a), a.brush.stop = !0); + a.brush && (a.brush.opacity = Entry.adjustValueWithMaxMin(c, 0, 100), a.brush.endStroke(), c = a.brush.rgb, a.brush.beginStroke("rgba(" + c.r + "," + c.g + "," + c.b + "," + a.brush.opacity / 100 + ")"), a.brush.moveTo(a.getX(), -1 * a.getY())); + return b.callReturn(); }; Blockly.Blocks.brush_erase_all = {init:function() { this.setColour(categoryColor); @@ -1526,19 +1570,19 @@ Blockly.Blocks.brush_erase_all = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.brush_erase_all = function(b, a) { - var c = b.brush; +Entry.block.brush_erase_all = function(a, b) { + var c = a.brush; if (c) { var d = c._stroke.style, e = c._strokeStyle.width; c.clear().setStrokeStyle(e).beginStroke(d); - c.moveTo(b.getX(), -1 * b.getY()); + c.moveTo(a.getX(), -1 * a.getY()); } - c = b.parent.getStampEntities(); - c.map(function(a) { - a.removeClone(); + a = a.parent.getStampEntities(); + a.map(function(b) { + b.removeClone(); }); - c = null; - return a.callReturn(); + a = null; + return b.callReturn(); }; Blockly.Blocks.brush_stamp = {init:function() { this.setColour(categoryColor); @@ -1547,9 +1591,9 @@ Blockly.Blocks.brush_stamp = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.brush_stamp = function(b, a) { - b.parent.addStampEntity(b); - return a.callReturn(); +Entry.block.brush_stamp = function(a, b) { + a.parent.addStampEntity(a); + return b.callReturn(); }; Blockly.Blocks.change_brush_transparency = {init:function() { this.setColour(categoryColor); @@ -1560,12 +1604,12 @@ Blockly.Blocks.change_brush_transparency = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.change_brush_transparency = function(b, a) { - var c = a.getNumberValue("VALUE", a); - b.brush || (Entry.setBasicBrush(b), b.brush.stop = !0); - c = Entry.adjustValueWithMaxMin(b.brush.opacity - c, 0, 100); - b.brush && (b.brush.opacity = c, b.brush.endStroke(), c = b.brush.rgb, b.brush.beginStroke("rgba(" + c.r + "," + c.g + "," + c.b + "," + b.brush.opacity / 100 + ")"), b.brush.moveTo(b.getX(), -1 * b.getY())); - return a.callReturn(); +Entry.block.change_brush_transparency = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.brush || (Entry.setBasicBrush(a), a.brush.stop = !0); + c = Entry.adjustValueWithMaxMin(a.brush.opacity - c, 0, 100); + a.brush && (a.brush.opacity = c, a.brush.endStroke(), c = a.brush.rgb, a.brush.beginStroke("rgba(" + c.r + "," + c.g + "," + c.b + "," + a.brush.opacity / 100 + ")"), a.brush.moveTo(a.getX(), -1 * a.getY())); + return b.callReturn(); }; Blockly.Blocks.set_brush_tranparency = {init:function() { this.setColour(categoryColor); @@ -1576,11 +1620,11 @@ Blockly.Blocks.set_brush_tranparency = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.set_brush_tranparency = function(b, a) { - var c = a.getNumberValue("VALUE", a); - b.brush || (Entry.setBasicBrush(b), b.brush.stop = !0); - b.brush && (b.brush.opacity = Entry.adjustValueWithMaxMin(c, 0, 100), b.brush.endStroke(), c = b.brush.rgb, b.brush.beginStroke("rgba(" + c.r + "," + c.g + "," + c.b + "," + (1 - b.brush.opacity / 100) + ")"), b.brush.moveTo(b.getX(), -1 * b.getY())); - return a.callReturn(); +Entry.block.set_brush_tranparency = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.brush || (Entry.setBasicBrush(a), a.brush.stop = !0); + a.brush && (a.brush.opacity = Entry.adjustValueWithMaxMin(c, 0, 100), a.brush.endStroke(), c = a.brush.rgb, a.brush.beginStroke("rgba(" + c.r + "," + c.g + "," + c.b + "," + (1 - a.brush.opacity / 100) + ")"), a.brush.moveTo(a.getX(), -1 * a.getY())); + return b.callReturn(); }; var calcArrowColor = "#e8b349", calcBlockColor = "#FFD974", calcFontColor = "#3D3D3D"; Blockly.Blocks.number = {init:function() { @@ -1589,8 +1633,8 @@ Blockly.Blocks.number = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.number = function(b, a) { - return a.getField("NUM", a); +Entry.block.number = function(a, b) { + return b.getField("NUM", b); }; Blockly.Blocks.angle = {init:function() { this.setColour(calcBlockColor); @@ -1598,8 +1642,8 @@ Blockly.Blocks.angle = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.angle = function(b, a) { - return a.getNumberField("ANGLE"); +Entry.block.angle = function(a, b) { + return b.getNumberField("ANGLE"); }; Blockly.Blocks.get_x_coordinate = {init:function() { this.setColour(calcBlockColor); @@ -1607,8 +1651,8 @@ Blockly.Blocks.get_x_coordinate = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.get_x_coordinate = function(b, a) { - return b.getX(); +Entry.block.get_x_coordinate = function(a, b) { + return a.getX(); }; Blockly.Blocks.get_y_coordinate = {init:function() { this.setColour(calcBlockColor); @@ -1616,8 +1660,8 @@ Blockly.Blocks.get_y_coordinate = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.get_y_coordinate = function(b, a) { - return b.getY(); +Entry.block.get_y_coordinate = function(a, b) { + return a.getY(); }; Blockly.Blocks.get_angle = {init:function() { this.setColour(calcBlockColor); @@ -1625,8 +1669,8 @@ Blockly.Blocks.get_angle = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.get_angle = function(b, a) { - return parseFloat(b.getRotation().toFixed(1)); +Entry.block.get_angle = function(a, b) { + return parseFloat(a.getRotation().toFixed(1)); }; Blockly.Blocks.get_rotation_direction = {init:function() { this.setColour(calcBlockColor); @@ -1635,8 +1679,8 @@ Blockly.Blocks.get_rotation_direction = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -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)); +Entry.block.get_rotation_direction = function(a, b) { + return "DIRECTION" == b.getField("OPERATOR", b).toUpperCase() ? parseFloat(a.getDirection().toFixed(1)) : parseFloat(a.getRotation().toFixed(1)); }; Blockly.Blocks.distance_something = {init:function() { this.setColour(calcBlockColor); @@ -1644,13 +1688,13 @@ Blockly.Blocks.distance_something = {init:function() { 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)); +Entry.block.distance_something = function(a, b) { + b = b.getField("VALUE", b); + if ("mouse" == b) { + return b = Entry.stage.mouseCoordinate, Math.sqrt(Math.pow(a.getX() - b.x, 2) + Math.pow(a.getY() - b.y, 2)); } - c = Entry.container.getEntity(c); - return Math.sqrt(Math.pow(b.getX() - c.getX(), 2) + Math.pow(b.getY() - c.getY(), 2)); + b = Entry.container.getEntity(b); + return Math.sqrt(Math.pow(a.getX() - b.getX(), 2) + Math.pow(a.getY() - b.getY(), 2)); }; Blockly.Blocks.coordinate_mouse = {init:function() { this.setColour(calcBlockColor); @@ -1658,8 +1702,8 @@ Blockly.Blocks.coordinate_mouse = {init:function() { 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); +Entry.block.coordinate_mouse = function(a, b) { + return "x" === b.getField("VALUE", b) ? Number(Entry.stage.mouseCoordinate.x) : Number(Entry.stage.mouseCoordinate.y); }; Blockly.Blocks.coordinate_object = {init:function() { this.setColour(calcBlockColor); @@ -1668,24 +1712,24 @@ Blockly.Blocks.coordinate_object = {init:function() { 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)) { +Entry.block.coordinate_object = function(a, b) { + var c = b.getField("VALUE", b); + a = "self" == c ? a : Entry.container.getEntity(c); + switch(b.getField("COORDINATE", b)) { case "x": - return c.getX(); + return a.getX(); case "y": - return c.getY(); + return a.getY(); case "rotation": - return c.getRotation(); + return a.getRotation(); case "direction": - return c.getDirection(); + return a.getDirection(); case "picture_index": - var d = c.parent, d = d.pictures; - return d.indexOf(c.picture) + 1; + return b = a.parent, b = b.pictures, b.indexOf(a.picture) + 1; case "size": - return Number(c.getSize().toFixed(1)); + return Number(a.getSize().toFixed(1)); case "picture_name": - return d = c.parent, d = d.pictures, d[d.indexOf(c.picture)].name; + return b = a.parent, b = b.pictures, b[b.indexOf(a.picture)].name; } }; Blockly.Blocks.calc_basic = {init:function() { @@ -1696,9 +1740,11 @@ Blockly.Blocks.calc_basic = {init:function() { 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; +Entry.block.calc_basic = function(a, b) { + a = b.getField("OPERATOR", b); + var c = b.getNumberValue("LEFTHAND", b); + b = b.getNumberValue("RIGHTHAND", b); + return "PLUS" == a ? c + b : "MINUS" == a ? c - b : "MULTI" == a ? c * b : c / b; }; Blockly.Blocks.calc_plus = {init:function() { this.setColour(calcBlockColor); @@ -1708,9 +1754,10 @@ Blockly.Blocks.calc_plus = {init:function() { 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; +Entry.block.calc_plus = function(a, b) { + a = b.getNumberValue("LEFTHAND", b); + b = b.getNumberValue("RIGHTHAND", b); + return a + b; }; Blockly.Blocks.calc_minus = {init:function() { this.setColour(calcBlockColor); @@ -1720,9 +1767,10 @@ Blockly.Blocks.calc_minus = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.calc_minus = function(b, a) { - var c = a.getNumberValue("LEFTHAND", a), d = a.getNumberValue("RIGHTHAND", a); - return c - d; +Entry.block.calc_minus = function(a, b) { + a = b.getNumberValue("LEFTHAND", b); + b = b.getNumberValue("RIGHTHAND", b); + return a - b; }; Blockly.Blocks.calc_times = {init:function() { this.setColour(calcBlockColor); @@ -1732,9 +1780,10 @@ Blockly.Blocks.calc_times = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.calc_times = function(b, a) { - var c = a.getNumberValue("LEFTHAND", a), d = a.getNumberValue("RIGHTHAND", a); - return c * d; +Entry.block.calc_times = function(a, b) { + a = b.getNumberValue("LEFTHAND", b); + b = b.getNumberValue("RIGHTHAND", b); + return a * b; }; Blockly.Blocks.calc_divide = {init:function() { this.setColour(calcBlockColor); @@ -1744,9 +1793,10 @@ Blockly.Blocks.calc_divide = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.calc_divide = function(b, a) { - var c = a.getNumberValue("LEFTHAND", a), d = a.getNumberValue("RIGHTHAND", a); - return c / d; +Entry.block.calc_divide = function(a, b) { + a = b.getNumberValue("LEFTHAND", b); + b = b.getNumberValue("RIGHTHAND", b); + return a / b; }; Blockly.Blocks.calc_mod = {init:function() { this.setColour(calcBlockColor); @@ -1758,9 +1808,10 @@ Blockly.Blocks.calc_mod = {init:function() { this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_mod_3, calcFontColor); this.setInputsInline(!0); }}; -Entry.block.calc_mod = function(b, a) { - var c = a.getNumberValue("LEFTHAND", a), d = a.getNumberValue("RIGHTHAND", a); - return c % d; +Entry.block.calc_mod = function(a, b) { + a = b.getNumberValue("LEFTHAND", b); + b = b.getNumberValue("RIGHTHAND", b); + return a % b; }; Blockly.Blocks.calc_share = {init:function() { this.setColour(calcBlockColor); @@ -1772,9 +1823,10 @@ Blockly.Blocks.calc_share = {init:function() { this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_share_3, calcFontColor); this.setInputsInline(!0); }}; -Entry.block.calc_share = function(b, a) { - var c = a.getNumberValue("LEFTHAND", a), d = a.getNumberValue("RIGHTHAND", a); - return Math.floor(c / d); +Entry.block.calc_share = function(a, b) { + a = b.getNumberValue("LEFTHAND", b); + b = b.getNumberValue("RIGHTHAND", b); + return Math.floor(a / b); }; Blockly.Blocks.calc_operation = {init:function() { this.setColour(calcBlockColor); @@ -1787,45 +1839,45 @@ Blockly.Blocks.calc_operation = {init:function() { this.appendDummyInput().appendField(" "); this.setInputsInline(!0); }}; -Entry.block.calc_operation = function(b, a) { - var c = a.getNumberValue("LEFTHAND", a), d = a.getField("VALUE", a); - if (-1 < ["asin_radian", "acos_radian"].indexOf(d) && (1 < c || -1 > c)) { +Entry.block.calc_operation = function(a, b) { + a = b.getNumberValue("LEFTHAND", b); + b = b.getField("VALUE", b); + if (-1 < ["asin_radian", "acos_radian"].indexOf(b) && (1 < a || -1 > a)) { 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) { + b.indexOf("_") && (b = b.split("_")[0]); + -1 < ["sin", "cos", "tan"].indexOf(b) && (a = Entry.toRadian(a)); + switch(b) { case "square": - e = c * c; + b = a * a; break; case "factorial": - e = Entry.factorial(c); + b = Entry.factorial(a); break; case "root": - e = Math.sqrt(c); + b = Math.sqrt(a); break; case "log": - e = Math.log(c) / Math.LN10; + b = Math.log(a) / Math.LN10; break; case "ln": - e = Math.log(c); + b = Math.log(a); break; case "asin": ; case "acos": ; case "atan": - e = Entry.toDegrees(Math[d](c)); + b = Entry.toDegrees(Math[b](a)); break; case "unnatural": - e = c - Math.floor(c); - 0 > c && (e = 1 - e); + b = a - Math.floor(a); + 0 > a && (b = 1 - b); break; default: - e = Math[d](c); + b = Math[b](a); } - return Math.round(1E3 * e) / 1E3; + return Math.round(1E3 * b) / 1E3; }; Blockly.Blocks.calc_rand = {init:function() { this.setColour(calcBlockColor); @@ -1837,9 +1889,12 @@ Blockly.Blocks.calc_rand = {init:function() { this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_rand_3, calcFontColor); this.setInputsInline(!0); }}; -Entry.block.calc_rand = function(b, a) { - var c = a.getStringValue("LEFTHAND", a), d = a.getStringValue("RIGHTHAND", a), e = Math.min(c, d), f = Math.max(c, d), c = Entry.isFloat(c); - return Entry.isFloat(d) || c ? (Math.random() * (f - e) + e).toFixed(2) : Math.floor(Math.random() * (f - e + 1) + e); +Entry.block.calc_rand = function(a, b) { + a = b.getStringValue("LEFTHAND", b); + b = b.getStringValue("RIGHTHAND", b); + var c = Math.min(a, b), d = Math.max(a, b); + a = Entry.isFloat(a); + return Entry.isFloat(b) || a ? (Math.random() * (d - c) + c).toFixed(2) : Math.floor(Math.random() * (d - c + 1) + c); }; Blockly.Blocks.get_date = {init:function() { this.setColour(calcBlockColor); @@ -1848,9 +1903,10 @@ Blockly.Blocks.get_date = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.get_date = function(b, a) { - var c = a.getField("VALUE", a), d = new Date; - return "YEAR" == c ? d.getFullYear() : "MONTH" == c ? d.getMonth() + 1 : "DAY" == c ? d.getDate() : "HOUR" == c ? d.getHours() : "MINUTE" == c ? d.getMinutes() : d.getSeconds(); +Entry.block.get_date = function(a, b) { + a = b.getField("VALUE", b); + b = new Date; + return "YEAR" == a ? b.getFullYear() : "MONTH" == a ? b.getMonth() + 1 : "DAY" == a ? b.getDate() : "HOUR" == a ? b.getHours() : "MINUTE" == a ? b.getMinutes() : b.getSeconds(); }; Blockly.Blocks.get_sound_duration = {init:function() { this.setColour(calcBlockColor); @@ -1860,10 +1916,12 @@ Blockly.Blocks.get_sound_duration = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.get_sound_duration = function(b, a) { - for (var c = a.getField("VALUE", a), d = b.parent.sounds, e = 0;e < d.length;e++) { - if (d[e].id == c) { - return d[e].duration; +Entry.block.get_sound_duration = function(a, b) { + b = b.getField("VALUE", b); + a = a.parent.sounds; + for (var c = 0;c < a.length;c++) { + if (a[c].id == b) { + return a[c].duration; } } }; @@ -1875,12 +1933,12 @@ Blockly.Blocks.reset_project_timer = {init:function() { this.setNextStatement(!0); }, whenAdd:function() { Entry.engine && Entry.engine.showProjectTimer(); -}, whenRemove:function(b) { - Entry.engine && Entry.engine.hideProjectTimer(b); +}, whenRemove:function(a) { + Entry.engine && Entry.engine.hideProjectTimer(a); }}; -Entry.block.reset_project_timer = function(b, a) { +Entry.block.reset_project_timer = function(a, b) { Entry.engine.updateProjectTimer(0); - return a.callReturn(); + return b.callReturn(); }; Blockly.Blocks.set_visible_project_timer = {init:function() { this.setColour(calcBlockColor); @@ -1892,13 +1950,14 @@ Blockly.Blocks.set_visible_project_timer = {init:function() { this.setNextStatement(!0); }, whenAdd:function() { Entry.engine && Entry.engine.showProjectTimer(); -}, whenRemove:function(b) { - Entry.engine && Entry.engine.hideProjectTimer(b); +}, whenRemove:function(a) { + Entry.engine && Entry.engine.hideProjectTimer(a); }}; -Entry.block.set_visible_project_timer = function(b, a) { - var c = a.getField("ACTION", a), d = Entry.engine.projectTimer; - "SHOW" == c ? d.setVisible(!0) : d.setVisible(!1); - return a.callReturn(); +Entry.block.set_visible_project_timer = function(a, b) { + a = b.getField("ACTION", b); + var c = Entry.engine.projectTimer; + "SHOW" == a ? c.setVisible(!0) : c.setVisible(!1); + return b.callReturn(); }; Blockly.Blocks.timer_variable = {init:function() { this.setColour(calcBlockColor); @@ -1906,7 +1965,7 @@ Blockly.Blocks.timer_variable = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.timer_variable = function(b, a) { +Entry.block.timer_variable = function(a, b) { return Entry.container.inputValue.getValue(); }; Blockly.Blocks.get_project_timer_value = {init:function() { @@ -1916,10 +1975,10 @@ Blockly.Blocks.get_project_timer_value = {init:function() { this.setInputsInline(!0); }, whenAdd:function() { Entry.engine && Entry.engine.showProjectTimer(); -}, whenRemove:function(b) { - Entry.engine && Entry.engine.hideProjectTimer(b); +}, whenRemove:function(a) { + Entry.engine && Entry.engine.hideProjectTimer(a); }}; -Entry.block.get_project_timer_value = function(b, a) { +Entry.block.get_project_timer_value = function(a, b) { return Entry.engine.projectTimer.getValue(); }; Blockly.Blocks.char_at = {init:function() { @@ -1932,12 +1991,13 @@ Blockly.Blocks.char_at = {init:function() { this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_char_at_3, calcFontColor); this.setInputsInline(!0); }}; -Entry.block.char_at = function(b, a) { - var c = a.getStringValue("LEFTHAND", a), d = a.getNumberValue("RIGHTHAND", a) - 1; - if (0 > d || d > c.length - 1) { +Entry.block.char_at = function(a, b) { + a = b.getStringValue("LEFTHAND", b); + b = b.getNumberValue("RIGHTHAND", b) - 1; + if (0 > b || b > a.length - 1) { throw Error(); } - return c[d]; + return a[b]; }; Blockly.Blocks.length_of_string = {init:function() { this.setColour(calcBlockColor); @@ -1947,8 +2007,8 @@ Blockly.Blocks.length_of_string = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.length_of_string = function(b, a) { - return a.getStringValue("STRING", a).length; +Entry.block.length_of_string = function(a, b) { + return b.getStringValue("STRING", b).length; }; Blockly.Blocks.substring = {init:function() { this.setColour(calcBlockColor); @@ -1962,12 +2022,15 @@ Blockly.Blocks.substring = {init:function() { this.setOutput(!0, "String"); this.setInputsInline(!0); }}; -Entry.block.substring = function(b, a) { - var c = a.getStringValue("STRING", a), d = a.getNumberValue("START", a) - 1, e = a.getNumberValue("END", a) - 1, f = c.length - 1; - if (0 > d || 0 > e || d > f || e > f) { +Entry.block.substring = function(a, b) { + a = b.getStringValue("STRING", b); + var c = b.getNumberValue("START", b) - 1; + b = b.getNumberValue("END", b) - 1; + var d = a.length - 1; + if (0 > c || 0 > b || c > d || b > d) { throw Error(); } - return c.substring(Math.min(d, e), Math.max(d, e) + 1); + return a.substring(Math.min(c, b), Math.max(c, b) + 1); }; Blockly.Blocks.replace_string = {init:function() { this.setColour(calcBlockColor); @@ -1981,8 +2044,8 @@ Blockly.Blocks.replace_string = {init:function() { this.setOutput(!0, "String"); this.setInputsInline(!0); }}; -Entry.block.replace_string = function(b, a) { - return a.getStringValue("STRING", a).replace(new RegExp(a.getStringValue("OLD_WORD", a), "gm"), a.getStringValue("NEW_WORD", a)); +Entry.block.replace_string = function(a, b) { + return b.getStringValue("STRING", b).replace(new RegExp(b.getStringValue("OLD_WORD", b), "gm"), b.getStringValue("NEW_WORD", b)); }; Blockly.Blocks.change_string_case = {init:function() { this.setColour(calcBlockColor); @@ -1994,8 +2057,8 @@ Blockly.Blocks.change_string_case = {init:function() { this.setOutput(!0, "String"); this.setInputsInline(!0); }}; -Entry.block.change_string_case = function(b, a) { - return a.getStringValue("STRING", a)[a.getField("CASE", a)](); +Entry.block.change_string_case = function(a, b) { + return b.getStringValue("STRING", b)[b.getField("CASE", b)](); }; Blockly.Blocks.index_of_string = {init:function() { this.setColour(calcBlockColor); @@ -2007,9 +2070,11 @@ Blockly.Blocks.index_of_string = {init:function() { this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_index_of_string_3, calcFontColor); this.setInputsInline(!0); }}; -Entry.block.index_of_string = function(b, a) { - var c = a.getStringValue("LEFTHAND", a), d = a.getStringValue("RIGHTHAND", a), c = c.indexOf(d); - return -1 < c ? c + 1 : 0; +Entry.block.index_of_string = function(a, b) { + a = b.getStringValue("LEFTHAND", b); + b = b.getStringValue("RIGHTHAND", b); + b = a.indexOf(b); + return -1 < b ? b + 1 : 0; }; Blockly.Blocks.combine_something = {init:function() { this.setColour(calcBlockColor); @@ -2021,9 +2086,10 @@ Blockly.Blocks.combine_something = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "String"); }}; -Entry.block.combine_something = function(b, a) { - var c = a.getStringValue("VALUE1", a), d = a.getStringValue("VALUE2", a); - return c + d; +Entry.block.combine_something = function(a, b) { + a = b.getStringValue("VALUE1", b); + b = b.getStringValue("VALUE2", b); + return a + b; }; Blockly.Blocks.get_sound_volume = {init:function() { this.setColour(calcBlockColor); @@ -2031,7 +2097,7 @@ Blockly.Blocks.get_sound_volume = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.get_sound_volume = function(b, a) { +Entry.block.get_sound_volume = function(a, b) { return 100 * createjs.Sound.getVolume(); }; Blockly.Blocks.quotient_and_mod = {init:function() { @@ -2043,12 +2109,13 @@ Blockly.Blocks.quotient_and_mod = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.quotient_and_mod = function(b, a) { - var c = a.getNumberValue("LEFTHAND", a), d = a.getNumberValue("RIGHTHAND", a); - if (isNaN(c) || isNaN(d)) { +Entry.block.quotient_and_mod = function(a, b) { + a = b.getNumberValue("LEFTHAND", b); + var c = b.getNumberValue("RIGHTHAND", b); + if (isNaN(a) || isNaN(c)) { throw Error(); } - return "QUOTIENT" == a.getField("OPERATOR", a) ? Math.floor(c / d) : c % d; + return "QUOTIENT" == b.getField("OPERATOR", b) ? Math.floor(a / c) : a % c; }; Blockly.Blocks.choose_project_timer_action = {init:function() { this.setColour(calcBlockColor); @@ -2059,40 +2126,322 @@ Blockly.Blocks.choose_project_timer_action = {init:function() { this.setNextStatement(!0); }, whenAdd:function() { Entry.engine && Entry.engine.showProjectTimer(); -}, whenRemove:function(b) { - Entry.engine && Entry.engine.hideProjectTimer(b); +}, whenRemove:function(a) { + Entry.engine && Entry.engine.hideProjectTimer(a); }}; -Entry.block.choose_project_timer_action = function(b, a) { - var c = a.getField("ACTION"), d = Entry.engine, e = d.projectTimer; - "START" == c ? e.isInit ? e.isInit && e.isPaused && (e.pauseStart && (e.pausedTime += (new Date).getTime() - e.pauseStart), delete e.pauseStart, e.isPaused = !1) : d.startProjectTimer() : "STOP" == c ? e.isInit && !e.isPaused && (e.isPaused = !0, e.pauseStart = (new Date).getTime()) : "RESET" == c && e.isInit && (e.setValue(0), e.start = (new Date).getTime(), e.pausedTime = 0, delete e.pauseStart); - return a.callReturn(); +Entry.block.choose_project_timer_action = function(a, b) { + a = b.getField("ACTION"); + var c = Entry.engine, d = c.projectTimer; + "START" == a ? d.isInit ? d.isInit && d.isPaused && (d.pauseStart && (d.pausedTime += (new Date).getTime() - d.pauseStart), delete d.pauseStart, d.isPaused = !1) : c.startProjectTimer() : "STOP" == a ? d.isInit && !d.isPaused && (d.isPaused = !0, d.pauseStart = (new Date).getTime()) : "RESET" == a && d.isInit && (d.setValue(0), d.start = (new Date).getTime(), d.pausedTime = 0, delete d.pauseStart); + return b.callReturn(); }; -Blockly.Blocks.wait_second = {init:function() { - this.setColour("#498deb"); - this.appendDummyInput().appendField(Lang.Blocks.FLOW_wait_second_1); - this.appendValueInput("SECOND").setCheck(["Number", "String", null]); - this.appendDummyInput().appendField(Lang.Blocks.FLOW_wait_second_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath + "block_icon/flow_03.png", "*")); - this.setInputsInline(!0); +Entry.Cobl = {name:"cobl", setZero:function() { + for (var a = 0;14 > a;a++) { + Entry.hw.sendQueue[a] = 0; + } + Entry.hw.update(); +}}; +Blockly.Blocks.cobl_read_ultrason = {init:function() { + this.setColour("#00979D"); + this.appendDummyInput().appendField("\ucd08\uc74c\ud30c \uac70\ub9ac\uc7ac\uae30(0~400)"); + this.setInputsInline(!0); + this.setOutput(!0, "Number"); +}}; +Entry.block.cobl_read_ultrason = function(a, b) { + return Entry.hw.getAnalogPortValue("ultrason"); +}; +Blockly.Blocks.cobl_read_potenmeter = {init:function() { + this.setColour("#00979D"); + this.appendDummyInput().appendField("\uac00\ubcc0\uc800\ud56d \uc77d\uae30(0~1023)"); + this.setInputsInline(!0); + this.setOutput(!0, "Number"); +}}; +Entry.block.cobl_read_potenmeter = function(a, b) { + console.log("cobl_read_potenmeter"); + return Entry.hw.getAnalogPortValue("potenmeter"); +}; +Blockly.Blocks.cobl_read_irread1 = {init:function() { + this.setColour("#00979D"); + this.appendDummyInput().appendField("IR1 \uc77d\uae30(0~1023)"); + this.setInputsInline(!0); + this.setOutput(!0, "Number"); +}}; +Entry.block.cobl_read_irread1 = function(a, b) { + return Entry.hw.getAnalogPortValue("potenmeter"); +}; +Blockly.Blocks.cobl_read_irread2 = {init:function() { + this.setColour("#00979D"); + this.appendDummyInput().appendField("IR2 \uc77d\uae30(0~1023)"); + this.setInputsInline(!0); + this.setOutput(!0, "Number"); +}}; +Entry.block.cobl_read_irread2 = function(a, b) { + b.getValue("irread2", b); + return Entry.hw.getAnalogPortValue("irread2"); +}; +Blockly.Blocks.cobl_read_joyx = {init:function() { + this.setColour("#00979D"); + this.appendDummyInput().appendField("\uc870\uc774\uc2a4\ud2f1X\ucd95 \uc77d\uae30(1,0,-1)"); + this.setInputsInline(!0); + this.setOutput(!0, "Number"); +}}; +Entry.block.cobl_read_joyx = function(a, b) { + return Entry.hw.getAnalogPortValue("joyx"); +}; +Blockly.Blocks.cobl_read_joyy = {init:function() { + this.setColour("#00979D"); + this.appendDummyInput().appendField("\uc870\uc774\uc2a4\ud2f1Y\ucd95 \uc77d\uae30(1,0,-1)"); + this.setInputsInline(!0); + this.setOutput(!0, "Number"); +}}; +Entry.block.cobl_read_joyy = function(a, b) { + return Entry.hw.getAnalogPortValue("joyy"); +}; +Blockly.Blocks.cobl_read_sens1 = {init:function() { + this.setColour("#00979D"); + this.appendDummyInput().appendField("\uc13c\uc11c1 \uc77d\uae30(0~1023)"); + this.setInputsInline(!0); + this.setOutput(!0, "Number"); +}}; +Entry.block.cobl_read_sens1 = function(a, b) { + return Entry.hw.getAnalogPortValue("sens1"); +}; +Blockly.Blocks.cobl_read_sens2 = {init:function() { + this.setColour("#00979D"); + this.appendDummyInput().appendField("\uc13c\uc11c2 \uc77d\uae30(0~1023)"); + this.setInputsInline(!0); + this.setOutput(!0, "Number"); +}}; +Entry.block.cobl_read_sens2 = function(a, b) { + return Entry.hw.getAnalogPortValue("sens2"); +}; +Blockly.Blocks.cobl_read_tilt = {init:function() { + this.setColour("#00979D"); + this.appendDummyInput().appendField("\uae30\uc6b8\uae30\uc13c\uc11c \uc77d\uae30(0~4)"); + this.setInputsInline(!0); + this.setOutput(!0, "Number"); +}}; +Entry.block.cobl_read_tilt = function(a, b) { + return Entry.hw.getAnalogPortValue("tilt"); +}; +Blockly.Blocks.cobl_get_port_number = {init:function() { + this.setColour("#00979D"); + this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1", "1"], ["2", "2"]]), "PORT"); + this.appendDummyInput().appendField(" "); + this.setOutput(!0, "Number"); + this.setInputsInline(!0); +}}; +Entry.block.cobl_get_port_number = function(a, b) { + return b.getStringField("PORT"); +}; +Blockly.Blocks.cobl_read_temps = {init:function() { + this.setColour("#00979D"); + this.appendDummyInput().appendField("\uc628\ub3c4\uc13c\uc11c \uc77d\uae30@\ud3ec\ud2b8"); + this.appendValueInput("VALUE").setCheck("Number"); + this.setInputsInline(!0); + this.setOutput(!0, "Number"); +}}; +Entry.block.cobl_read_temps = function(a, b) { + a = b.getValue("VALUE", b); + if (1 == a) { + return Entry.hw.getAnalogPortValue("temps1"); + } + if (2 == a) { + return Entry.hw.getAnalogPortValue("temps2"); + } +}; +Blockly.Blocks.cobl_read_light = {init:function() { + this.setColour("#00979D"); + this.appendDummyInput().appendField("\ubc1d\uae30\uc13c\uc11c \uc77d\uae30@\ud3ec\ud2b8"); + this.appendValueInput("VALUE").setCheck("Number"); + this.setInputsInline(!0); + this.setOutput(!0, "Number"); +}}; +Entry.block.cobl_read_light = function(a, b) { + a = b.getValue("VALUE", b); + if (1 == a) { + return Entry.hw.getAnalogPortValue("light1"); + } + if (2 == a) { + return Entry.hw.getAnalogPortValue("light2"); + } +}; +Blockly.Blocks.cobl_read_btn = {init:function() { + this.setColour("#00979D"); + this.appendDummyInput().appendField("\ubc84\ud2bc\uc13c\uc11c \uc77d\uae30@\ud3ec\ud2b8"); + this.appendValueInput("VALUE").setCheck("Number"); + this.setInputsInline(!0); + this.setOutput(!0, "Boolean"); +}}; +Entry.block.cobl_read_btn = function(a, b) { + a = b.getValue("VALUE", b); + if (1 == a) { + return Entry.hw.getDigitalPortValue("btn1"); + } + if (2 == a) { + return Entry.hw.getDigitalPortValue("btn2"); + } +}; +Blockly.Blocks.cobl_led_control = {init:function() { + this.setColour("#00979D"); + this.appendDummyInput().appendField("Rainbow LED"); + this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1", "1"], ["2", "2"], ["3", "3"]]), "PORT"); + this.appendDummyInput().appendField(" "); + this.appendDummyInput().appendField(new Blockly.FieldDropdown([["OFF", "OFF"], ["Red", "Red"], ["Orange", "Orange"], ["Yellow", "Yellow"], ["Green", "Green"], ["Blue", "Blue"], ["Dark Blue", "Dark Blue"], ["Purple", "Purple"], ["White", "White"]]), "OPERATOR"); + this.setInputsInline(!0); this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.wait_second = function(b, a) { - if (a.isStart) { - if (1 == a.timeFlag) { - return a; +Entry.block.cobl_led_control = function(a, b) { + a = b.getStringField("PORT"); + var c = b.getStringField("OPERATOR"); + Entry.hw.setDigitalPortValue("RainBowLED_IDX", a); + Entry.hw.setDigitalPortValue("RainBowLED_COL", c); + return b.callReturn(); +}; +Blockly.Blocks.cobl_text = {init:function() { + this.setColour("#00979D"); + this.appendDummyInput().appendField(new Blockly.FieldTextInput("cobl"), "NAME"); + this.setOutput(!0, "String"); + this.setInputsInline(!0); +}}; +Entry.block.cobl_text = function(a, b) { + return b.getStringField("NAME"); +}; +Blockly.Blocks.cobl_servo_angle_control = {init:function() { + this.setColour("#00979D"); + this.appendDummyInput().appendField("Servo"); + this.appendValueInput("PORT").setCheck(["Number", "String"]); + this.appendDummyInput().appendField("Angle-"); + this.appendValueInput("VALUE").setCheck(["Number", "String"]); + this.appendDummyInput().appendField("(15~165)"); + this.setInputsInline(!0); + this.setPreviousStatement(!0); + this.setNextStatement(!0); +}}; +Entry.block.cobl_servo_angle_control = function(a, b) { + console.log("servo - test"); + a = b.getNumberValue("PORT"); + var c = b.getNumberValue("VALUE"), c = Math.round(c), c = Math.max(c, 15), c = Math.min(c, 165); + 1 == a && (console.log("servo 1 degree " + c), Entry.hw.setDigitalPortValue("Servo1", c)); + 2 == a && (console.log("servo 2 degree " + c), Entry.hw.setDigitalPortValue("Servo2", c)); + return b.callReturn(); +}; +Blockly.Blocks.cobl_melody = {init:function() { + this.setColour("#00979D"); + this.appendDummyInput().appendField("Melody"); + this.appendDummyInput().appendField(new Blockly.FieldDropdown([["(Low)So", "L_So"], ["(Low)So#", "L_So#"], ["(Low)La", "L_La"], ["(Low)La#", "L_La#"], ["(Low)Ti", "L_Ti"], ["Do", "Do"], ["Do#", "Do#"], ["Re", "Re"], ["Re#", "Re#"], ["Mi", "Mi"], ["Fa", "Fa"], ["Fa#", "Fa#"], ["So", "So"], ["So#", "So#"], ["La", "La"], ["La#", "La#"], ["Ti", "Ti"], ["(High)Do", "H_Do"], ["(High)Do#", "H_Do#"], ["(High)Re", "H_Re"], ["(High)R2#", "H_Re#"], ["(High)Mi", "H_Mi"], ["(High)Fa", "H_Fa"]]), "MELODY"); + this.setInputsInline(!0); + this.setPreviousStatement(!0); + this.setNextStatement(!0); +}}; +Entry.block.cobl_melody = function(a, b) { + a = b.getStringField("MELODY"); + console.log("cobl_melody" + a); + Entry.hw.setDigitalPortValue("Melody", a); + return b.callReturn(); +}; +Blockly.Blocks.cobl_dcmotor = {init:function() { + this.setColour("#00979D"); + this.appendDummyInput().appendField("DcMotor"); + this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1", "1"], ["2", "2"]]), "MOTOR"); + this.appendDummyInput().appendField(" "); + this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1.Clockwise", "1"], ["2.Counter Clockwise", "2"], ["3.Stop", "3"]]), "DIRECTION"); + this.appendDummyInput().appendField(" Speed"); + this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"]]), "SPEED"); + this.setInputsInline(!0); + this.setPreviousStatement(!0); + this.setNextStatement(!0); +}}; +Entry.block.cobl_dcmotor = function(a, b) { + a = b.getStringField("MOTOR"); + var c = b.getStringField("DIRECTION"), d = b.getStringField("SPEED"); + console.log("MOTOR" + a + " Direction" + c + " speed" + d); + 1 == a && (Entry.hw.setDigitalPortValue("DC1_DIR", c), Entry.hw.setDigitalPortValue("DC1_SPEED", d)); + 2 == a && (Entry.hw.setDigitalPortValue("DC2_DIR", c), Entry.hw.setDigitalPortValue("DC2_SPEED", d)); + return b.callReturn(); +}; +Blockly.Blocks.cobl_extention_port = {init:function() { + this.setColour("#00979D"); + this.appendDummyInput().appendField("Extention Port"); + this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1", "1"], ["2", "2"]]), "PORT"); + this.appendDummyInput().appendField(" Level"); + this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"]]), "LEVEL"); + this.setInputsInline(!0); + this.setPreviousStatement(!0); + this.setNextStatement(!0); +}}; +Entry.block.cobl_extention_port = function(a, b) { + a = b.getStringField("PORT"); + var c = b.getStringField("LEVEL"); + 1 == a && Entry.hw.setDigitalPortValue("EXUSB1", c); + 2 == a && Entry.hw.setDigitalPortValue("EXUSB2", c); + return b.callReturn(); +}; +Blockly.Blocks.cobl_external_led = {init:function() { + this.setColour("#00979D"); + this.appendDummyInput().appendField("External LED "); + this.appendValueInput("LED").setCheck(["Number", "String"]); + this.appendDummyInput().appendField(" (1~64)"); + this.appendDummyInput().appendField(" R "); + this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"], ["8", "8"], ["9", "9"], ["10", "10"]]), "RED"); + this.appendDummyInput().appendField(" G "); + this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"], ["8", "8"], ["9", "9"], ["10", "10"]]), "GREEN"); + this.appendDummyInput().appendField(" B "); + this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"], ["8", "8"], ["9", "9"], ["10", "10"]]), "BLUE"); + this.setInputsInline(!0); + this.setPreviousStatement(!0); + this.setNextStatement(!0); +}}; +Entry.block.cobl_external_led = function(a, b) { + a = b.getNumberValue("LED"); + var c = b.getStringField("RED"), d = b.getStringField("GREEN"), e = b.getStringField("BLUE"); + Entry.hw.setDigitalPortValue("ELED_IDX", a); + Entry.hw.setDigitalPortValue("ELED_R", c); + Entry.hw.setDigitalPortValue("ELED_G", d); + Entry.hw.setDigitalPortValue("ELED_B", e); + return b.callReturn(); +}; +Blockly.Blocks.cobl_7_segment = {init:function() { + this.setColour("#00979D"); + this.appendDummyInput().appendField("7 Segment"); + this.appendValueInput("VALUE").setCheck(["Number", "String"]); + this.appendDummyInput().appendField("(0~9999)"); + this.setInputsInline(!0); + this.setPreviousStatement(!0); + this.setNextStatement(!0); +}}; +Entry.block.cobl_7_segment = function(a, b) { + a = b.getNumberValue("VALUE"); + Entry.hw.setDigitalPortValue("7SEG", a); + return b.callReturn(); +}; +Blockly.Blocks.wait_second = {init:function() { + this.setColour("#498deb"); + this.appendDummyInput().appendField(Lang.Blocks.FLOW_wait_second_1); + this.appendValueInput("SECOND").setCheck(["Number", "String", null]); + this.appendDummyInput().appendField(Lang.Blocks.FLOW_wait_second_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath + "block_icon/flow_03.png", "*")); + this.setInputsInline(!0); + this.setPreviousStatement(!0); + this.setNextStatement(!0); +}}; +Entry.block.wait_second = function(a, b) { + if (b.isStart) { + if (1 == b.timeFlag) { + return b; } - delete a.timeFlag; - delete a.isStart; + delete b.timeFlag; + delete b.isStart; Entry.engine.isContinue = !1; - return a.callReturn(); + return b.callReturn(); } - a.isStart = !0; - a.timeFlag = 1; - var c = a.getNumberValue("SECOND", a); + b.isStart = !0; + b.timeFlag = 1; + a = b.getNumberValue("SECOND", b); setTimeout(function() { - a.timeFlag = 0; - }, 60 / (Entry.FPS || 60) * c * 1E3); - return a; + b.timeFlag = 0; + }, 60 / (Entry.FPS || 60) * a * 1E3); + return b; }; Blockly.Blocks.repeat_basic = {init:function() { this.setColour("#498deb"); @@ -2104,21 +2453,20 @@ Blockly.Blocks.repeat_basic = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.repeat_basic = function(b, a) { - var c; - if (!a.isLooped) { - a.isLooped = !0; - c = a.getNumberValue("VALUE", a); - if (0 > c) { +Entry.block.repeat_basic = function(a, b) { + if (!b.isLooped) { + b.isLooped = !0; + a = b.getNumberValue("VALUE", b); + if (0 > a) { throw Error(Lang.Blocks.FLOW_repeat_basic_errorMsg); } - a.iterCount = Math.floor(c); + b.iterCount = Math.floor(a); } - if (0 == a.iterCount || 0 > a.iterCount) { - return delete a.isLooped, delete a.iterCount, a.callReturn(); + if (0 == b.iterCount || 0 > b.iterCount) { + return delete b.isLooped, delete b.iterCount, b.callReturn(); } - a.iterCount--; - return a.getStatement("DO", a); + b.iterCount--; + return b.getStatement("DO", b); }; Blockly.Blocks.repeat_inf = {init:function() { this.setColour("#498deb"); @@ -2128,9 +2476,9 @@ Blockly.Blocks.repeat_inf = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.repeat_inf = function(b, a) { - a.isLooped = !0; - return a.getStatement("DO"); +Entry.block.repeat_inf = function(a, b) { + b.isLooped = !0; + return b.getStatement("DO"); }; Blockly.Blocks.stop_repeat = {init:function() { this.setColour("#498deb"); @@ -2139,7 +2487,7 @@ Blockly.Blocks.stop_repeat = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.stop_repeat = function(b, a) { +Entry.block.stop_repeat = function(a, b) { return this.executor.break(); }; Blockly.Blocks.wait_until_true = {init:function() { @@ -2151,8 +2499,8 @@ Blockly.Blocks.wait_until_true = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.wait_until_true = function(b, a) { - return a.getBooleanValue("BOOL", a) ? a.callReturn() : a; +Entry.block.wait_until_true = function(a, b) { + return b.getBooleanValue("BOOL", b) ? b.callReturn() : b; }; Blockly.Blocks._if = {init:function() { this.setColour("#498deb"); @@ -2164,8 +2512,8 @@ Blockly.Blocks._if = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block._if = function(b, a) { - return a.isLooped ? (delete a.isLooped, a.callReturn()) : a.getBooleanValue("BOOL", a) ? (a.isLooped = !0, a.getStatement("STACK", a)) : a.callReturn(); +Entry.block._if = function(a, b) { + return b.isLooped ? (delete b.isLooped, b.callReturn()) : b.getBooleanValue("BOOL", b) ? (b.isLooped = !0, b.getStatement("STACK", b)) : b.callReturn(); }; Blockly.Blocks.if_else = {init:function() { this.setColour("#498deb"); @@ -2179,13 +2527,13 @@ Blockly.Blocks.if_else = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.if_else = function(b, a) { - if (a.isLooped) { - return delete a.isLooped, a.callReturn(); +Entry.block.if_else = function(a, b) { + if (b.isLooped) { + return delete b.isLooped, b.callReturn(); } - var c = a.getBooleanValue("BOOL", a); - a.isLooped = !0; - return c ? a.getStatement("STACK_IF", a) : a.getStatement("STACK_ELSE", a); + a = b.getBooleanValue("BOOL", b); + b.isLooped = !0; + return a ? b.getStatement("STACK_IF", b) : b.getStatement("STACK_ELSE", b); }; Blockly.Blocks.create_clone = {init:function() { this.setColour("#498deb"); @@ -2196,10 +2544,11 @@ Blockly.Blocks.create_clone = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.create_clone = function(b, a) { - var c = a.getField("VALUE", a), d = a.callReturn(); - "self" == c ? b.parent.addCloneEntity(b.parent, b, null) : Entry.container.getObject(c).addCloneEntity(b.parent, null, null); - return d; +Entry.block.create_clone = function(a, b) { + var c = b.getField("VALUE", b); + b = b.callReturn(); + "self" == c ? a.parent.addCloneEntity(a.parent, a, null) : Entry.container.getObject(c).addCloneEntity(a.parent, null, null); + return b; }; Blockly.Blocks.delete_clone = {init:function() { this.setColour("#498deb"); @@ -2207,11 +2556,11 @@ Blockly.Blocks.delete_clone = {init:function() { this.setInputsInline(!0); this.setPreviousStatement(!0); }}; -Entry.block.delete_clone = function(b, a) { - if (!b.isClone) { - return a.callReturn(); +Entry.block.delete_clone = function(a, b) { + if (!a.isClone) { + return b.callReturn(); } - b.removeClone(); + a.removeClone(); }; Blockly.Blocks.when_clone_start = {init:function() { this.setColour("#498deb"); @@ -2219,8 +2568,8 @@ Blockly.Blocks.when_clone_start = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); }}; -Entry.block.when_clone_start = function(b, a) { - return a.callReturn(); +Entry.block.when_clone_start = function(a, b) { + return b.callReturn(); }; Blockly.Blocks.stop_run = {init:function() { this.setColour("#498deb"); @@ -2229,7 +2578,7 @@ Blockly.Blocks.stop_run = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.stop_run = function(b, a) { +Entry.block.stop_run = function(a, b) { return Entry.engine.toggleStop(); }; Blockly.Blocks.repeat_while_true = {init:function() { @@ -2241,10 +2590,10 @@ Blockly.Blocks.repeat_while_true = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.repeat_while_true = function(b, a) { - var c = a.getBooleanValue("BOOL", a); - "until" == a.getField("OPTION", a) && (c = !c); - return (a.isLooped = c) ? a.getStatement("DO", a) : a.callReturn(); +Entry.block.repeat_while_true = function(a, b) { + a = b.getBooleanValue("BOOL", b); + "until" == b.getField("OPTION", b) && (a = !a); + return (b.isLooped = a) ? b.getStatement("DO", b) : b.callReturn(); }; Blockly.Blocks.stop_object = {init:function() { this.setColour("#498deb"); @@ -2255,17 +2604,18 @@ Blockly.Blocks.stop_object = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.stop_object = function(b, a) { - var c = a.getField("TARGET", a), d = Entry.container; - switch(c) { +Entry.block.stop_object = function(a, b) { + b = b.getField("TARGET", b); + var c = Entry.container; + switch(b) { case "all": - return d.clearRunningState(), this.die(); + return c.clearRunningState(), this.die(); case "thisOnly": - return b.parent.script.clearExecutorsByEntity(b), this.die(); + return a.parent.script.clearExecutorsByEntity(a), this.die(); case "thisThread": return this.die(); case "otherThread": - b.parent.script.clearExecutors(), b.parent.script.addExecutor(this.executor); + a.parent.script.clearExecutors(), a.parent.script.addExecutor(this.executor); } }; Blockly.Blocks.restart_project = {init:function() { @@ -2274,7 +2624,7 @@ Blockly.Blocks.restart_project = {init:function() { this.setInputsInline(!0); this.setPreviousStatement(!0); }}; -Entry.block.restart_project = function(b, a) { +Entry.block.restart_project = function(a, b) { Entry.engine.toggleStop(); Entry.engine.toggleRun(); }; @@ -2285,13 +2635,13 @@ Blockly.Blocks.remove_all_clones = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.remove_all_clones = function(b, a) { - var c = b.parent.getClonedEntities(); - c.map(function(a) { - a.removeClone(); +Entry.block.remove_all_clones = function(a, b) { + a = a.parent.getClonedEntities(); + a.map(function(b) { + b.removeClone(); }); - c = null; - return a.callReturn(); + a = null; + return b.callReturn(); }; Entry.block.functionAddButton = {skeleton:"basic_button", color:"#eee", isNotFor:["functionInit"], template:"%1", params:[{type:"Text", text:"\ud568\uc218 \ucd94\uac00", color:"#333", align:"center"}], events:{mousedown:[function() { Entry.variableContainer.createFunction(); @@ -2325,18 +2675,18 @@ Blockly.Blocks.function_param_string = {init:function() { this.setColour("#FFD974"); this.setOutput(!0, ["String", "Number"]); this.setInputsInline(!0); -}, domToMutation:function(b) { - b.getElementsByTagName("field"); - this.hashId = b.getAttribute("hashid"); - (b = Entry.Func.targetFunc.stringHash[this.hashId]) || (b = ""); - this.appendDummyInput().appendField(new Blockly.FieldTextInput(Lang.Blocks.FUNCTION_character_variable + b), ""); +}, domToMutation:function(a) { + a.getElementsByTagName("field"); + this.hashId = a.getAttribute("hashid"); + (a = Entry.Func.targetFunc.stringHash[this.hashId]) || (a = ""); + this.appendDummyInput().appendField(new Blockly.FieldTextInput(Lang.Blocks.FUNCTION_character_variable + a), ""); }, mutationToDom:function() { - var b = document.createElement("mutation"); - b.setAttribute("hashid", this.hashId); - return b; + var a = document.createElement("mutation"); + a.setAttribute("hashid", this.hashId); + return a; }}; -Entry.block.function_param_string = function(b, a, c) { - return a.register[a.hashId].run(); +Entry.block.function_param_string = function(a, b, c) { + return b.register[b.hashId].run(); }; Entry.block.function_param_string = {skeleton:"basic_string_field", color:"#ffd974", template:"\ubb38\uc790/\uc22b\uc790\uac12", func:function() { return this.executor.register.params[this.executor.register.paramMap[this.block.type]]; @@ -2346,18 +2696,18 @@ Blockly.Blocks.function_param_boolean = {init:function() { this.setColour("#AEB8FF"); this.setOutput(!0, "Boolean"); this.setInputsInline(!0); -}, domToMutation:function(b) { - b.getElementsByTagName("field"); - this.hashId = b.getAttribute("hashid"); - (b = Entry.Func.targetFunc.booleanHash[this.hashId]) || (b = ""); - this.appendDummyInput().appendField(new Blockly.FieldTextInput(Lang.Blocks.FUNCTION_logical_variable + b), ""); +}, domToMutation:function(a) { + a.getElementsByTagName("field"); + this.hashId = a.getAttribute("hashid"); + (a = Entry.Func.targetFunc.booleanHash[this.hashId]) || (a = ""); + this.appendDummyInput().appendField(new Blockly.FieldTextInput(Lang.Blocks.FUNCTION_logical_variable + a), ""); }, mutationToDom:function() { - var b = document.createElement("mutation"); - b.setAttribute("hashid", this.hashId); - return b; + var a = document.createElement("mutation"); + a.setAttribute("hashid", this.hashId); + return a; }}; -Entry.block.function_param_boolean = function(b, a, c) { - return a.register[a.hashId].run(); +Entry.block.function_param_boolean = function(a, b, c) { + return b.register[b.hashId].run(); }; Entry.block.function_param_boolean = {skeleton:"basic_boolean_field", color:"#aeb8ff", template:"\ud310\ub2e8\uac12", func:function() { return this.executor.register.params[this.executor.register.paramMap[this.block.type]]; @@ -2370,8 +2720,8 @@ Blockly.Blocks.function_create = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); }}; -Entry.block.function_create = function(b, a) { - return a.callReturn(); +Entry.block.function_create = function(a, b) { + return b.callReturn(); }; Entry.block.function_create = {skeleton:"basic", color:"#cc7337", event:"funcDef", template:"\ud568\uc218 \uc815\uc758\ud558\uae30 %1 %2", params:[{type:"Block", accept:"paramMagnet", value:{type:"function_field_label"}}, {type:"Indicator", img:"/lib/entryjs/images/block_icon/function_03.png", size:12}], func:function() { }}; @@ -2380,12 +2730,12 @@ Blockly.Blocks.function_general = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); this.setPreviousStatement(!0); -}, domToMutation:function(b) { - var a = b.getElementsByTagName("field"); +}, domToMutation:function(a) { + var b = a.getElementsByTagName("field"); this.appendDummyInput().appendField(""); - a.length || this.appendDummyInput().appendField(Lang.Blocks.FUNCTION_function); - for (var c = 0;c < a.length;c++) { - var d = a[c], e = d.getAttribute("hashid"); + b.length || this.appendDummyInput().appendField(Lang.Blocks.FUNCTION_function); + for (var c = 0;c < b.length;c++) { + var d = b[c], e = d.getAttribute("hashid"); switch(d.getAttribute("type").toLowerCase()) { case "label": this.appendDummyInput().appendField(d.getAttribute("content")); @@ -2397,11 +2747,11 @@ Blockly.Blocks.function_general = {init:function() { this.appendValueInput(e).setCheck(["Boolean"]); } } - this.hashId = b.getAttribute("hashid"); + this.hashId = a.getAttribute("hashid"); this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath + "block_icon/function_03.png", "*")); }, mutationToDom:function() { - for (var b = document.createElement("mutation"), a = 1;a < this.inputList.length;a++) { - var c = this.inputList[a]; + for (var a = document.createElement("mutation"), b = 1;b < this.inputList.length;b++) { + var c = this.inputList[b]; if (c.fieldRow[0] && c.fieldRow[0] instanceof Blockly.FieldLabel) { var c = c.fieldRow[0], d = document.createElement("field"); d.setAttribute("type", "label"); @@ -2409,34 +2759,34 @@ Blockly.Blocks.function_general = {init:function() { } else { c.connection && "String" == c.connection.check_[0] ? (d = document.createElement("field"), d.setAttribute("type", "string"), d.setAttribute("hashid", c.name)) : c.connection && "Boolean" == c.connection.check_[0] && (d = document.createElement("field"), d.setAttribute("type", "boolean"), d.setAttribute("hashid", c.name)); } - b.appendChild(d); + a.appendChild(d); } - b.setAttribute("hashid", this.hashId); - return b; + a.setAttribute("hashid", this.hashId); + return a; }}; -Entry.block.function_general = function(b, a) { - if (!a.thread) { - var c = Entry.variableContainer.getFunction(a.hashId); - a.thread = new Entry.Script(b); - a.thread.register = a.values; +Entry.block.function_general = function(a, b) { + if (!b.thread) { + var c = Entry.variableContainer.getFunction(b.hashId); + b.thread = new Entry.Script(a); + b.thread.register = b.values; for (var d = 0;d < c.content.childNodes.length;d++) { - "function_create" == c.content.childNodes[d].getAttribute("type") && a.thread.init(c.content.childNodes[d]); + "function_create" == c.content.childNodes[d].getAttribute("type") && b.thread.init(c.content.childNodes[d]); } } - if (c = Entry.Engine.computeThread(b, a.thread)) { - return a.thread = c, a; + if (a = Entry.Engine.computeThread(a, b.thread)) { + return b.thread = a, b; } - delete a.thread; - return a.callReturn(); + delete b.thread; + return b.callReturn(); }; -Entry.block.function_general = {skeleton:"basic", color:"#cc7337", template:"\ud568\uc218", params:[], func:function(b) { +Entry.block.function_general = {skeleton:"basic", color:"#cc7337", template:"\ud568\uc218", params:[], func:function(a) { if (!this.initiated) { this.initiated = !0; - var a = Entry.variableContainer.getFunction(this.block.type.substr(5, 9)); - this.funcCode = a.content; - this.funcExecutor = this.funcCode.raiseEvent("funcDef", b)[0]; + var b = Entry.variableContainer.getFunction(this.block.type.substr(5, 9)); + this.funcCode = b.content; + this.funcExecutor = this.funcCode.raiseEvent("funcDef", a)[0]; this.funcExecutor.register.params = this.getParams(); - this.funcExecutor.register.paramMap = a.paramMap; + this.funcExecutor.register.paramMap = b.paramMap; } this.funcExecutor.execute(); if (!this.funcExecutor.isEnd()) { @@ -2444,31 +2794,31 @@ Entry.block.function_general = {skeleton:"basic", color:"#cc7337", template:"\ud } }}; Entry.Hamster = {PORT_MAP:{leftWheel:0, rightWheel:0, buzzer:0, outputA:0, outputB:0, leftLed:0, rightLed:0, note:0, lineTracerMode:0, lineTracerModeId:0, lineTracerSpeed:5, ioModeA:0, ioModeB:0}, setZero:function() { - var b = Entry.Hamster.PORT_MAP, a = Entry.hw.sendQueue, c; - for (c in b) { - a[c] = b[c]; + var a = Entry.Hamster.PORT_MAP, b = Entry.hw.sendQueue, c; + for (c in a) { + b[c] = a[c]; } Entry.hw.update(); - b = Entry.Hamster; - b.lineTracerModeId = 0; - b.lineTracerStateId = -1; - b.tempo = 60; - b.removeAllTimeouts(); -}, lineTracerModeId:0, lineTracerStateId:-1, tempo:60, timeouts:[], removeTimeout:function(b) { - clearTimeout(b); - var a = this.timeouts; - b = a.indexOf(b); - 0 <= b && a.splice(b, 1); + a = Entry.Hamster; + a.lineTracerModeId = 0; + a.lineTracerStateId = -1; + a.tempo = 60; + a.removeAllTimeouts(); +}, lineTracerModeId:0, lineTracerStateId:-1, tempo:60, timeouts:[], removeTimeout:function(a) { + clearTimeout(a); + var b = this.timeouts; + a = b.indexOf(a); + 0 <= a && b.splice(a, 1); }, removeAllTimeouts:function() { - var b = this.timeouts, a; - for (a in b) { - clearTimeout(b[a]); + var a = this.timeouts, b; + for (b in a) { + clearTimeout(a[b]); } this.timeouts = []; -}, setLineTracerMode:function(b, a) { +}, setLineTracerMode:function(a, b) { this.lineTracerModeId = this.lineTracerModeId + 1 & 255; - b.lineTracerMode = a; - b.lineTracerModeId = this.lineTracerModeId; + a.lineTracerMode = b; + a.lineTracerModeId = this.lineTracerModeId; }, name:"hamster", monitorTemplate:{imgPath:"hw/hamster.png", width:256, height:256, listPorts:{temperature:{name:Lang.Blocks.HAMSTER_sensor_temperature, type:"input", pos:{x:0, y:0}}, accelerationX:{name:Lang.Blocks.HAMSTER_sensor_accelerationX, type:"input", pos:{x:0, y:0}}, accelerationY:{name:Lang.Blocks.HAMSTER_sensor_accelerationY, type:"input", pos:{x:0, y:0}}, accelerationZ:{name:Lang.Blocks.HAMSTER_sensor_accelerationZ, type:"input", pos:{x:0, y:0}}, buzzer:{name:Lang.Hw.buzzer, type:"output", pos:{x:0, y:0}}, note:{name:Lang.Hw.buzzer + "2", type:"output", pos:{x:0, y:0}}, outputA:{name:Lang.Hw.output + "A", type:"output", pos:{x:0, y:0}}, outputB:{name:Lang.Hw.output + "B", type:"output", pos:{x:0, y:0}}}, ports:{leftProximity:{name:Lang.Blocks.HAMSTER_sensor_leftProximity, type:"input", pos:{x:122, y:156}}, rightProximity:{name:Lang.Blocks.HAMSTER_sensor_rightProximity, type:"input", pos:{x:10, y:108}}, leftFloor:{name:Lang.Blocks.HAMSTER_sensor_leftFloor, type:"input", pos:{x:100, y:234}}, rightFloor:{name:Lang.Blocks.HAMSTER_sensor_rightFloor, type:"input", pos:{x:13, y:180}}, lightsensor:{name:Lang.Blocks.HAMSTER_sensor_light, type:"input", pos:{x:56, y:189}}, leftWheel:{name:Lang.Hw.leftWheel, type:"output", pos:{x:209, y:115}}, rightWheel:{name:Lang.Hw.rightWheel, type:"output", pos:{x:98, y:30}}, leftLed:{name:Lang.Hw.left + " " + Lang.Hw.led, type:"output", pos:{x:87, y:210}}, rightLed:{name:Lang.Hw.right + " " + Lang.Hw.led, type:"output", pos:{x:24, y:168}}}, mode:"both"}}; @@ -2478,9 +2828,9 @@ Blockly.Blocks.hamster_hand_found = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.hamster_hand_found = function(b, a) { - var c = Entry.hw.portData; - return 50 < c.leftProximity || 50 < c.rightProximity; +Entry.block.hamster_hand_found = function(a, b) { + a = Entry.hw.portData; + return 50 < a.leftProximity || 50 < a.rightProximity; }; Blockly.Blocks.hamster_value = {init:function() { this.setColour("#00979D"); @@ -2489,9 +2839,10 @@ Blockly.Blocks.hamster_value = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Number"); }}; -Entry.block.hamster_value = function(b, a) { - var c = Entry.hw.portData, d = a.getField("DEVICE"); - return c[d]; +Entry.block.hamster_value = function(a, b) { + a = Entry.hw.portData; + b = b.getField("DEVICE"); + return a[b]; }; Blockly.Blocks.hamster_move_forward_once = {init:function() { this.setColour("#00979D"); @@ -2500,52 +2851,53 @@ Blockly.Blocks.hamster_move_forward_once = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_move_forward_once = function(b, a) { - var c = Entry.hw.sendQueue, d = Entry.hw.portData; - if (a.isStart) { - if (a.isMoving) { - switch(a.boardState) { +Entry.block.hamster_move_forward_once = function(a, b) { + a = Entry.hw.sendQueue; + var c = Entry.hw.portData; + if (b.isStart) { + if (b.isMoving) { + switch(b.boardState) { case 1: - 2 > a.count ? (50 > d.leftFloor && 50 > d.rightFloor ? a.count++ : a.count = 0, d = d.leftFloor - d.rightFloor, c.leftWheel = 45 + .25 * d, c.rightWheel = 45 - .25 * d) : (a.count = 0, a.boardState = 2); + 2 > b.count ? (50 > c.leftFloor && 50 > c.rightFloor ? b.count++ : b.count = 0, c = c.leftFloor - c.rightFloor, a.leftWheel = 45 + .25 * c, a.rightWheel = 45 - .25 * c) : (b.count = 0, b.boardState = 2); break; case 2: - d = d.leftFloor - d.rightFloor; - c.leftWheel = 45 + .25 * d; - c.rightWheel = 45 - .25 * d; - a.boardState = 3; - var e = setTimeout(function() { - a.boardState = 4; - Entry.Hamster.removeTimeout(e); + c = c.leftFloor - c.rightFloor; + a.leftWheel = 45 + .25 * c; + a.rightWheel = 45 - .25 * c; + b.boardState = 3; + var d = setTimeout(function() { + b.boardState = 4; + Entry.Hamster.removeTimeout(d); }, 250); - Entry.Hamster.timeouts.push(e); + Entry.Hamster.timeouts.push(d); break; case 3: - d = d.leftFloor - d.rightFloor; - c.leftWheel = 45 + .25 * d; - c.rightWheel = 45 - .25 * d; + c = c.leftFloor - c.rightFloor; + a.leftWheel = 45 + .25 * c; + a.rightWheel = 45 - .25 * c; break; case 4: - c.leftWheel = 0, c.rightWheel = 0, a.boardState = 0, a.isMoving = !1; + a.leftWheel = 0, a.rightWheel = 0, b.boardState = 0, b.isMoving = !1; } - return a; + return b; } - delete a.isStart; - delete a.isMoving; - delete a.count; - delete a.boardState; + delete b.isStart; + delete b.isMoving; + delete b.count; + delete b.boardState; Entry.engine.isContinue = !1; - c.leftWheel = 0; - c.rightWheel = 0; - return a.callReturn(); + a.leftWheel = 0; + a.rightWheel = 0; + return b.callReturn(); } - a.isStart = !0; - a.isMoving = !0; - a.count = 0; - a.boardState = 1; - c.leftWheel = 45; - c.rightWheel = 45; - Entry.Hamster.setLineTracerMode(c, 0); - return a; + b.isStart = !0; + b.isMoving = !0; + b.count = 0; + b.boardState = 1; + a.leftWheel = 45; + a.rightWheel = 45; + Entry.Hamster.setLineTracerMode(a, 0); + return b; }; Blockly.Blocks.hamster_turn_once = {init:function() { this.setColour("#00979D"); @@ -2554,64 +2906,65 @@ Blockly.Blocks.hamster_turn_once = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_turn_once = function(b, a) { - var c = Entry.hw.sendQueue, d = Entry.hw.portData; - if (a.isStart) { - if (a.isMoving) { - if (a.isLeft) { - switch(a.boardState) { +Entry.block.hamster_turn_once = function(a, b) { + a = Entry.hw.sendQueue; + var c = Entry.hw.portData; + if (b.isStart) { + if (b.isMoving) { + if (b.isLeft) { + switch(b.boardState) { case 1: - 2 > a.count ? 50 < d.leftFloor && a.count++ : (a.count = 0, a.boardState = 2); + 2 > b.count ? 50 < c.leftFloor && b.count++ : (b.count = 0, b.boardState = 2); break; case 2: - 20 > d.leftFloor && (a.boardState = 3); + 20 > c.leftFloor && (b.boardState = 3); break; case 3: - 2 > a.count ? 20 > d.leftFloor && a.count++ : (a.count = 0, a.boardState = 4); + 2 > b.count ? 20 > c.leftFloor && b.count++ : (b.count = 0, b.boardState = 4); break; case 4: - 50 < d.leftFloor && (a.boardState = 5); + 50 < c.leftFloor && (b.boardState = 5); break; case 5: - d = d.leftFloor - d.rightFloor, -15 < d ? (c.leftWheel = 0, c.rightWheel = 0, a.boardState = 0, a.isMoving = !1) : (c.leftWheel = .5 * d, c.rightWheel = .5 * -d); + c = c.leftFloor - c.rightFloor, -15 < c ? (a.leftWheel = 0, a.rightWheel = 0, b.boardState = 0, b.isMoving = !1) : (a.leftWheel = .5 * c, a.rightWheel = .5 * -c); } } else { - switch(a.boardState) { + switch(b.boardState) { case 1: - 2 > a.count ? 50 < d.rightFloor && a.count++ : (a.count = 0, a.boardState = 2); + 2 > b.count ? 50 < c.rightFloor && b.count++ : (b.count = 0, b.boardState = 2); break; case 2: - 20 > d.rightFloor && (a.boardState = 3); + 20 > c.rightFloor && (b.boardState = 3); break; case 3: - 2 > a.count ? 20 > d.rightFloor && a.count++ : (a.count = 0, a.boardState = 4); + 2 > b.count ? 20 > c.rightFloor && b.count++ : (b.count = 0, b.boardState = 4); break; case 4: - 50 < d.rightFloor && (a.boardState = 5); + 50 < c.rightFloor && (b.boardState = 5); break; case 5: - d = d.rightFloor - d.leftFloor, -15 < d ? (c.leftWheel = 0, c.rightWheel = 0, a.boardState = 0, a.isMoving = !1) : (c.leftWheel = .5 * -d, c.rightWheel = .5 * d); + c = c.rightFloor - c.leftFloor, -15 < c ? (a.leftWheel = 0, a.rightWheel = 0, b.boardState = 0, b.isMoving = !1) : (a.leftWheel = .5 * -c, a.rightWheel = .5 * c); } } - return a; + return b; } - delete a.isStart; - delete a.isMoving; - delete a.count; - delete a.boardState; - delete a.isLeft; + delete b.isStart; + delete b.isMoving; + delete b.count; + delete b.boardState; + delete b.isLeft; Entry.engine.isContinue = !1; - c.leftWheel = 0; - c.rightWheel = 0; - return a.callReturn(); + a.leftWheel = 0; + a.rightWheel = 0; + return b.callReturn(); } - a.isStart = !0; - a.isMoving = !0; - a.count = 0; - a.boardState = 1; - "LEFT" == a.getField("DIRECTION", a) ? (a.isLeft = !0, c.leftWheel = -45, c.rightWheel = 45) : (a.isLeft = !1, c.leftWheel = 45, c.rightWheel = -45); - Entry.Hamster.setLineTracerMode(c, 0); - return a; + b.isStart = !0; + b.isMoving = !0; + b.count = 0; + b.boardState = 1; + "LEFT" == b.getField("DIRECTION", b) ? (b.isLeft = !0, a.leftWheel = -45, a.rightWheel = 45) : (b.isLeft = !1, a.leftWheel = 45, a.rightWheel = -45); + Entry.Hamster.setLineTracerMode(a, 0); + return b; }; Blockly.Blocks.hamster_move_forward_for_secs = {init:function() { this.setColour("#00979D"); @@ -2622,30 +2975,31 @@ Blockly.Blocks.hamster_move_forward_for_secs = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_move_forward_for_secs = function(b, a) { - var c = Entry.hw.sendQueue; - if (a.isStart) { - if (1 == a.timeFlag) { - return a; +Entry.block.hamster_move_forward_for_secs = function(a, b) { + a = Entry.hw.sendQueue; + if (b.isStart) { + if (1 == b.timeFlag) { + return b; } - delete a.isStart; - delete a.timeFlag; + delete b.isStart; + delete b.timeFlag; Entry.engine.isContinue = !1; - c.leftWheel = 0; - c.rightWheel = 0; - return a.callReturn(); + a.leftWheel = 0; + a.rightWheel = 0; + return b.callReturn(); } - a.isStart = !0; - a.timeFlag = 1; - c.leftWheel = 30; - c.rightWheel = 30; - Entry.Hamster.setLineTracerMode(c, 0); - var c = 1E3 * a.getNumberValue("VALUE"), d = setTimeout(function() { - a.timeFlag = 0; - Entry.Hamster.removeTimeout(d); - }, c); - Entry.Hamster.timeouts.push(d); - return a; + b.isStart = !0; + b.timeFlag = 1; + a.leftWheel = 30; + a.rightWheel = 30; + Entry.Hamster.setLineTracerMode(a, 0); + a = 1E3 * b.getNumberValue("VALUE"); + var c = setTimeout(function() { + b.timeFlag = 0; + Entry.Hamster.removeTimeout(c); + }, a); + Entry.Hamster.timeouts.push(c); + return b; }; Blockly.Blocks.hamster_move_backward_for_secs = {init:function() { this.setColour("#00979D"); @@ -2656,30 +3010,31 @@ Blockly.Blocks.hamster_move_backward_for_secs = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_move_backward_for_secs = function(b, a) { - var c = Entry.hw.sendQueue; - if (a.isStart) { - if (1 == a.timeFlag) { - return a; +Entry.block.hamster_move_backward_for_secs = function(a, b) { + a = Entry.hw.sendQueue; + if (b.isStart) { + if (1 == b.timeFlag) { + return b; } - delete a.isStart; - delete a.timeFlag; + delete b.isStart; + delete b.timeFlag; Entry.engine.isContinue = !1; - c.leftWheel = 0; - c.rightWheel = 0; - return a.callReturn(); + a.leftWheel = 0; + a.rightWheel = 0; + return b.callReturn(); } - a.isStart = !0; - a.timeFlag = 1; - c.leftWheel = -30; - c.rightWheel = -30; - Entry.Hamster.setLineTracerMode(c, 0); - var c = 1E3 * a.getNumberValue("VALUE"), d = setTimeout(function() { - a.timeFlag = 0; - Entry.Hamster.removeTimeout(d); - }, c); - Entry.Hamster.timeouts.push(d); - return a; + b.isStart = !0; + b.timeFlag = 1; + a.leftWheel = -30; + a.rightWheel = -30; + Entry.Hamster.setLineTracerMode(a, 0); + a = 1E3 * b.getNumberValue("VALUE"); + var c = setTimeout(function() { + b.timeFlag = 0; + Entry.Hamster.removeTimeout(c); + }, a); + Entry.Hamster.timeouts.push(c); + return b; }; Blockly.Blocks.hamster_turn_for_secs = {init:function() { this.setColour("#00979D"); @@ -2690,29 +3045,30 @@ Blockly.Blocks.hamster_turn_for_secs = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_turn_for_secs = function(b, a) { - var c = Entry.hw.sendQueue; - if (a.isStart) { - if (1 == a.timeFlag) { - return a; +Entry.block.hamster_turn_for_secs = function(a, b) { + a = Entry.hw.sendQueue; + if (b.isStart) { + if (1 == b.timeFlag) { + return b; } - delete a.isStart; - delete a.timeFlag; + delete b.isStart; + delete b.timeFlag; Entry.engine.isContinue = !1; - c.leftWheel = 0; - c.rightWheel = 0; - return a.callReturn(); + a.leftWheel = 0; + a.rightWheel = 0; + return b.callReturn(); } - a.isStart = !0; - a.timeFlag = 1; - "LEFT" == a.getField("DIRECTION", a) ? (c.leftWheel = -30, c.rightWheel = 30) : (c.leftWheel = 30, c.rightWheel = -30); - Entry.Hamster.setLineTracerMode(c, 0); - var c = 1E3 * a.getNumberValue("VALUE"), d = setTimeout(function() { - a.timeFlag = 0; - Entry.Hamster.removeTimeout(d); - }, c); - Entry.Hamster.timeouts.push(d); - return a; + b.isStart = !0; + b.timeFlag = 1; + "LEFT" == b.getField("DIRECTION", b) ? (a.leftWheel = -30, a.rightWheel = 30) : (a.leftWheel = 30, a.rightWheel = -30); + Entry.Hamster.setLineTracerMode(a, 0); + a = 1E3 * b.getNumberValue("VALUE"); + var c = setTimeout(function() { + b.timeFlag = 0; + Entry.Hamster.removeTimeout(c); + }, a); + Entry.Hamster.timeouts.push(c); + return b; }; Blockly.Blocks.hamster_change_both_wheels_by = {init:function() { this.setColour("#00979D"); @@ -2725,12 +3081,13 @@ Blockly.Blocks.hamster_change_both_wheels_by = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_change_both_wheels_by = function(b, a) { - var c = Entry.hw.sendQueue, d = a.getNumberValue("LEFT"), e = a.getNumberValue("RIGHT"); - c.leftWheel = void 0 != c.leftWheel ? c.leftWheel + d : d; - c.rightWheel = void 0 != c.rightWheel ? c.rightWheel + e : e; - Entry.Hamster.setLineTracerMode(c, 0); - return a.callReturn(); +Entry.block.hamster_change_both_wheels_by = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getNumberValue("LEFT"), d = b.getNumberValue("RIGHT"); + a.leftWheel = void 0 != a.leftWheel ? a.leftWheel + c : c; + a.rightWheel = void 0 != a.rightWheel ? a.rightWheel + d : d; + Entry.Hamster.setLineTracerMode(a, 0); + return b.callReturn(); }; Blockly.Blocks.hamster_set_both_wheels_to = {init:function() { this.setColour("#00979D"); @@ -2743,12 +3100,12 @@ Blockly.Blocks.hamster_set_both_wheels_to = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_set_both_wheels_to = function(b, a) { - var c = Entry.hw.sendQueue; - c.leftWheel = a.getNumberValue("LEFT"); - c.rightWheel = a.getNumberValue("RIGHT"); - Entry.Hamster.setLineTracerMode(c, 0); - return a.callReturn(); +Entry.block.hamster_set_both_wheels_to = function(a, b) { + a = Entry.hw.sendQueue; + a.leftWheel = b.getNumberValue("LEFT"); + a.rightWheel = b.getNumberValue("RIGHT"); + Entry.Hamster.setLineTracerMode(a, 0); + return b.callReturn(); }; Blockly.Blocks.hamster_change_wheel_by = {init:function() { this.setColour("#00979D"); @@ -2759,11 +3116,12 @@ Blockly.Blocks.hamster_change_wheel_by = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_change_wheel_by = function(b, a) { - var c = Entry.hw.sendQueue, d = a.getField("DIRECTION"), e = a.getNumberValue("VALUE"); - "LEFT" == d ? c.leftWheel = void 0 != c.leftWheel ? c.leftWheel + e : e : ("RIGHT" != d && (c.leftWheel = void 0 != c.leftWheel ? c.leftWheel + e : e), c.rightWheel = void 0 != c.rightWheel ? c.rightWheel + e : e); - Entry.Hamster.setLineTracerMode(c, 0); - return a.callReturn(); +Entry.block.hamster_change_wheel_by = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getField("DIRECTION"), d = b.getNumberValue("VALUE"); + "LEFT" == c ? a.leftWheel = void 0 != a.leftWheel ? a.leftWheel + d : d : ("RIGHT" != c && (a.leftWheel = void 0 != a.leftWheel ? a.leftWheel + d : d), a.rightWheel = void 0 != a.rightWheel ? a.rightWheel + d : d); + Entry.Hamster.setLineTracerMode(a, 0); + return b.callReturn(); }; Blockly.Blocks.hamster_set_wheel_to = {init:function() { this.setColour("#00979D"); @@ -2774,11 +3132,12 @@ Blockly.Blocks.hamster_set_wheel_to = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_set_wheel_to = 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); - Entry.Hamster.setLineTracerMode(c, 0); - return a.callReturn(); +Entry.block.hamster_set_wheel_to = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getField("DIRECTION"), d = b.getNumberValue("VALUE"); + "LEFT" == c ? a.leftWheel = d : ("RIGHT" != c && (a.leftWheel = d), a.rightWheel = d); + Entry.Hamster.setLineTracerMode(a, 0); + return b.callReturn(); }; Blockly.Blocks.hamster_follow_line_using = {init:function() { this.setColour("#00979D"); @@ -2788,14 +3147,15 @@ Blockly.Blocks.hamster_follow_line_using = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_follow_line_using = 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(); +Entry.block.hamster_follow_line_using = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getField("COLOR"), d = b.getField("DIRECTION"), e = 1; + "RIGHT" == d ? e = 2 : "BOTH" == d && (e = 3); + "WHITE" == c && (e += 7); + a.leftWheel = 0; + a.rightWheel = 0; + Entry.Hamster.setLineTracerMode(a, e); + return b.callReturn(); }; Blockly.Blocks.hamster_follow_line_until = {init:function() { this.setColour("#00979D"); @@ -2805,18 +3165,19 @@ Blockly.Blocks.hamster_follow_line_until = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -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(); +Entry.block.hamster_follow_line_until = function(a, b) { + a = Entry.hw.sendQueue; + var c = Entry.hw.portData, d = b.getField("COLOR"), e = b.getField("DIRECTION"), f = 4; + "RIGHT" == e ? f = 5 : "FRONT" == e ? f = 6 : "REAR" == e && (f = 7); + "WHITE" == d && (f += 7); + if (b.isStart) { + if (d = Entry.Hamster, c.lineTracerStateId != d.lineTracerStateId && (d.lineTracerStateId = c.lineTracerStateId, 64 == c.lineTracerState)) { + return delete b.isStart, Entry.engine.isContinue = !1, d.setLineTracerMode(a, 0), b.callReturn(); } } else { - a.isStart = !0, c.leftWheel = 0, c.rightWheel = 0, Entry.Hamster.setLineTracerMode(c, g); + b.isStart = !0, a.leftWheel = 0, a.rightWheel = 0, Entry.Hamster.setLineTracerMode(a, f); } - return a; + return b; }; Blockly.Blocks.hamster_set_following_speed_to = {init:function() { this.setColour("#00979D"); @@ -2825,9 +3186,9 @@ Blockly.Blocks.hamster_set_following_speed_to = {init:function() { 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(); +Entry.block.hamster_set_following_speed_to = function(a, b) { + Entry.hw.sendQueue.lineTracerSpeed = Number(b.getField("SPEED", b)); + return b.callReturn(); }; Blockly.Blocks.hamster_stop = {init:function() { this.setColour("#00979D"); @@ -2836,12 +3197,12 @@ Blockly.Blocks.hamster_stop = {init:function() { 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(); +Entry.block.hamster_stop = function(a, b) { + a = Entry.hw.sendQueue; + a.leftWheel = 0; + a.rightWheel = 0; + Entry.Hamster.setLineTracerMode(a, 0); + return b.callReturn(); }; Blockly.Blocks.hamster_set_led_to = {init:function() { this.setColour("#00979D"); @@ -2851,10 +3212,11 @@ Blockly.Blocks.hamster_set_led_to = {init:function() { 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(); +Entry.block.hamster_set_led_to = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getField("DIRECTION", b), d = Number(b.getField("COLOR", b)); + "LEFT" == c ? a.leftLed = d : ("RIGHT" != c && (a.leftLed = d), a.rightLed = d); + return b.callReturn(); }; Blockly.Blocks.hamster_clear_led = {init:function() { this.setColour("#00979D"); @@ -2863,10 +3225,11 @@ Blockly.Blocks.hamster_clear_led = {init:function() { 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(); +Entry.block.hamster_clear_led = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getField("DIRECTION", b); + "LEFT" == c ? a.leftLed = 0 : ("RIGHT" != c && (a.leftLed = 0), a.rightLed = 0); + return b.callReturn(); }; Blockly.Blocks.hamster_beep = {init:function() { this.setColour("#00979D"); @@ -2875,28 +3238,28 @@ Blockly.Blocks.hamster_beep = {init:function() { 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; +Entry.block.hamster_beep = function(a, b) { + a = Entry.hw.sendQueue; + if (b.isStart) { + if (1 == b.timeFlag) { + return b; } - delete a.isStart; - delete a.timeFlag; + delete b.isStart; + delete b.timeFlag; Entry.engine.isContinue = !1; - c.buzzer = 0; - return a.callReturn(); + a.buzzer = 0; + return b.callReturn(); } - a.isStart = !0; - a.timeFlag = 1; - c.buzzer = 440; - c.note = 0; - var d = setTimeout(function() { - a.timeFlag = 0; - Entry.Hamster.removeTimeout(d); + b.isStart = !0; + b.timeFlag = 1; + a.buzzer = 440; + a.note = 0; + var c = setTimeout(function() { + b.timeFlag = 0; + Entry.Hamster.removeTimeout(c); }, 200); - Entry.Hamster.timeouts.push(d); - return a; + Entry.Hamster.timeouts.push(c); + return b; }; Blockly.Blocks.hamster_change_buzzer_by = {init:function() { this.setColour("#00979D"); @@ -2907,11 +3270,12 @@ Blockly.Blocks.hamster_change_buzzer_by = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_change_buzzer_by = 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(); +Entry.block.hamster_change_buzzer_by = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getNumberValue("VALUE"); + a.buzzer = void 0 != a.buzzer ? a.buzzer + c : c; + a.note = 0; + return b.callReturn(); }; Blockly.Blocks.hamster_set_buzzer_to = {init:function() { this.setColour("#00979D"); @@ -2922,11 +3286,11 @@ Blockly.Blocks.hamster_set_buzzer_to = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_set_buzzer_to = function(b, a) { - var c = Entry.hw.sendQueue; - c.buzzer = a.getNumberValue("VALUE"); - c.note = 0; - return a.callReturn(); +Entry.block.hamster_set_buzzer_to = function(a, b) { + a = Entry.hw.sendQueue; + a.buzzer = b.getNumberValue("VALUE"); + a.note = 0; + return b.callReturn(); }; Blockly.Blocks.hamster_clear_buzzer = {init:function() { this.setColour("#00979D"); @@ -2935,11 +3299,11 @@ Blockly.Blocks.hamster_clear_buzzer = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_clear_buzzer = function(b, a) { - var c = Entry.hw.sendQueue; - c.buzzer = 0; - c.note = 0; - return a.callReturn(); +Entry.block.hamster_clear_buzzer = function(a, b) { + a = Entry.hw.sendQueue; + a.buzzer = 0; + a.note = 0; + return b.callReturn(); }; Blockly.Blocks.hamster_play_note_for = {init:function() { this.setColour("#00979D"); @@ -2951,36 +3315,37 @@ Blockly.Blocks.hamster_play_note_for = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_play_note_for = function(b, a) { +Entry.block.hamster_play_note_for = function(a, b) { var c = Entry.hw.sendQueue; - if (a.isStart) { - if (1 == a.timeFlag) { - return a; + if (b.isStart) { + if (1 == b.timeFlag) { + return b; } - delete a.isStart; - delete a.timeFlag; + delete b.isStart; + delete b.timeFlag; Entry.engine.isContinue = !1; c.note = 0; - return a.callReturn(); + return b.callReturn(); } - var d = a.getNumberField("NOTE", a), e = a.getNumberField("OCTAVE", a), f = a.getNumberValue("VALUE", a), g = Entry.Hamster.tempo, f = 6E4 * f / g; - a.isStart = !0; - a.timeFlag = 1; + a = b.getNumberField("NOTE", b); + var d = b.getNumberField("OCTAVE", b), e = 6E4 * b.getNumberValue("VALUE", b) / Entry.Hamster.tempo; + b.isStart = !0; + b.timeFlag = 1; c.buzzer = 0; - c.note = d + 12 * (e - 1); - if (100 < f) { - var h = setTimeout(function() { + c.note = a + 12 * (d - 1); + if (100 < e) { + var f = setTimeout(function() { c.note = 0; - Entry.Hamster.removeTimeout(h); - }, f - 100); - Entry.Hamster.timeouts.push(h); + Entry.Hamster.removeTimeout(f); + }, e - 100); + Entry.Hamster.timeouts.push(f); } - var k = setTimeout(function() { - a.timeFlag = 0; - Entry.Hamster.removeTimeout(k); - }, f); - Entry.Hamster.timeouts.push(k); - return a; + var g = setTimeout(function() { + b.timeFlag = 0; + Entry.Hamster.removeTimeout(g); + }, e); + Entry.Hamster.timeouts.push(g); + return b; }; Blockly.Blocks.hamster_rest_for = {init:function() { this.setColour("#00979D"); @@ -2991,28 +3356,28 @@ Blockly.Blocks.hamster_rest_for = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_rest_for = function(b, a) { - var c = Entry.hw.sendQueue; - if (a.isStart) { - if (1 == a.timeFlag) { - return a; +Entry.block.hamster_rest_for = function(a, b) { + a = Entry.hw.sendQueue; + if (b.isStart) { + if (1 == b.timeFlag) { + return b; } - delete a.isStart; - delete a.timeFlag; + delete b.isStart; + delete b.timeFlag; Entry.engine.isContinue = !1; - return a.callReturn(); + return b.callReturn(); } - a.isStart = !0; - a.timeFlag = 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; + b.isStart = !0; + b.timeFlag = 1; + var c = b.getNumberValue("VALUE"), c = 6E4 * c / Entry.Hamster.tempo; + a.buzzer = 0; + a.note = 0; + var d = setTimeout(function() { + b.timeFlag = 0; + Entry.Hamster.removeTimeout(d); + }, c); + Entry.Hamster.timeouts.push(d); + return b; }; Blockly.Blocks.hamster_change_tempo_by = {init:function() { this.setColour("#00979D"); @@ -3023,10 +3388,10 @@ Blockly.Blocks.hamster_change_tempo_by = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_change_tempo_by = function(b, a) { - Entry.Hamster.tempo += a.getNumberValue("VALUE"); +Entry.block.hamster_change_tempo_by = function(a, b) { + Entry.Hamster.tempo += b.getNumberValue("VALUE"); 1 > Entry.Hamster.tempo && (Entry.Hamster.tempo = 1); - return a.callReturn(); + return b.callReturn(); }; Blockly.Blocks.hamster_set_tempo_to = {init:function() { this.setColour("#00979D"); @@ -3037,10 +3402,10 @@ Blockly.Blocks.hamster_set_tempo_to = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_set_tempo_to = function(b, a) { - Entry.Hamster.tempo = a.getNumberValue("VALUE"); +Entry.block.hamster_set_tempo_to = function(a, b) { + Entry.Hamster.tempo = b.getNumberValue("VALUE"); 1 > Entry.Hamster.tempo && (Entry.Hamster.tempo = 1); - return a.callReturn(); + return b.callReturn(); }; Blockly.Blocks.hamster_set_port_to = {init:function() { this.setColour("#00979D"); @@ -3050,10 +3415,11 @@ Blockly.Blocks.hamster_set_port_to = {init:function() { 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(); +Entry.block.hamster_set_port_to = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getField("PORT", b), d = Number(b.getField("MODE", b)); + "A" == c ? a.ioModeA = d : ("B" != c && (a.ioModeA = d), a.ioModeB = d); + return b.callReturn(); }; Blockly.Blocks.hamster_change_output_by = {init:function() { this.setColour("#00979D"); @@ -3064,10 +3430,11 @@ Blockly.Blocks.hamster_change_output_by = {init:function() { 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(); +Entry.block.hamster_change_output_by = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getField("PORT"), d = b.getNumberValue("VALUE"); + "A" == c ? a.outputA = void 0 != a.outputA ? a.outputA + d : d : ("B" != c && (a.outputA = void 0 != a.outputA ? a.outputA + d : d), a.outputB = void 0 != a.outputB ? a.outputB + d : d); + return b.callReturn(); }; Blockly.Blocks.hamster_set_output_to = {init:function() { this.setColour("#00979D"); @@ -3078,10 +3445,11 @@ Blockly.Blocks.hamster_set_output_to = {init:function() { 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(); +Entry.block.hamster_set_output_to = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getField("PORT"), d = b.getNumberValue("VALUE"); + "A" == c ? a.outputA = d : ("B" != c && (a.outputA = d), a.outputB = d); + return b.callReturn(); }; Blockly.Blocks.is_clicked = {init:function() { this.setColour("#AEB8FF"); @@ -3089,7 +3457,7 @@ Blockly.Blocks.is_clicked = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.is_clicked = function(b, a) { +Entry.block.is_clicked = function(a, b) { return Entry.stage.isClick; }; Blockly.Blocks.is_press_some_key = {init:function() { @@ -3099,9 +3467,9 @@ Blockly.Blocks.is_press_some_key = {init:function() { 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); +Entry.block.is_press_some_key = function(a, b) { + a = Number(b.getField("VALUE", b)); + return 0 <= Entry.pressedKeys.indexOf(a); }; Blockly.Blocks.reach_something = {init:function() { this.setColour("#AEB8FF"); @@ -3111,64 +3479,68 @@ Blockly.Blocks.reach_something = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.reach_something = function(b, a) { - if (!b.getVisible()) { +Entry.block.reach_something = function(a, b) { + if (!a.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) { + var c = b.getField("VALUE", b); + b = a.object; + var d = /wall/.test(c), e = ndgmr.checkPixelCollision; + if (d) { + switch(a = 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)) { + if (e(b, a.up, .2, !0) || e(b, a.down, .2, !0) || e(b, a.left, .2, !0) || e(b, a.right, .2, !0)) { return !0; } break; case "wall_up": - if (f(d, e.up, .2, !0)) { + if (e(b, a.up, .2, !0)) { return !0; } break; case "wall_down": - if (f(d, e.down, .2, !0)) { + if (e(b, a.down, .2, !0)) { return !0; } break; case "wall_right": - if (f(d, e.right, .2, !0)) { + if (e(b, a.right, .2, !0)) { return !0; } break; case "wall_left": - if (f(d, e.left, .2, !0)) { + if (e(b, a.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); + return e = Entry.stage.canvas, e = b.globalToLocal(e.mouseX, e.mouseY), b.hitTest(e.x, e.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)) { + if ("textBox" == c.type || "textBox" == a.type) { + e = c.object.getTransformedBounds(); + b = b.getTransformedBounds(); + if (Entry.checkCollisionRect(b, e)) { return !0; } - for (var c = c.parent.clonedEntities, e = 0, g = c.length;e < g;e++) { - var h = c[e]; - if (!h.isStamp && h.getVisible() && Entry.checkCollisionRect(d, h.object.getTransformedBounds())) { + a = c.parent.clonedEntities; + c = 0; + for (d = a.length;c < d;c++) { + var f = a[c]; + if (!f.isStamp && f.getVisible() && Entry.checkCollisionRect(b, f.object.getTransformedBounds())) { return !0; } } } else { - if (c.getVisible() && f(d, c.object, .2, !0)) { + if (c.getVisible() && e(b, c.object, .2, !0)) { return !0; } - c = c.parent.clonedEntities; - e = 0; - for (g = c.length;e < g;e++) { - if (h = c[e], !h.isStamp && h.getVisible() && f(d, h.object, .2, !0)) { + a = c.parent.clonedEntities; + c = 0; + for (d = a.length;c < d;c++) { + if (f = a[c], !f.isStamp && f.getVisible() && e(b, f.object, .2, !0)) { return !0; } } @@ -3184,9 +3556,11 @@ Blockly.Blocks.boolean_comparison = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.boolean_comparison = 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 < e; +Entry.block.boolean_comparison = function(a, b) { + a = b.getField("OPERATOR", b); + var c = b.getNumberValue("LEFTHAND", b); + b = b.getNumberValue("RIGHTHAND", b); + return "EQUAL" == a ? c == b : "BIGGER" == a ? c > b : c < b; }; Blockly.Blocks.boolean_equal = {init:function() { this.setColour("#AEB8FF"); @@ -3196,9 +3570,10 @@ Blockly.Blocks.boolean_equal = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.boolean_equal = function(b, a) { - var c = a.getStringValue("LEFTHAND", a), d = a.getStringValue("RIGHTHAND", a); - return c == d; +Entry.block.boolean_equal = function(a, b) { + a = b.getStringValue("LEFTHAND", b); + b = b.getStringValue("RIGHTHAND", b); + return a == b; }; Blockly.Blocks.boolean_bigger = {init:function() { this.setColour("#AEB8FF"); @@ -3208,9 +3583,10 @@ Blockly.Blocks.boolean_bigger = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.boolean_bigger = function(b, a) { - var c = a.getNumberValue("LEFTHAND", a), d = a.getNumberValue("RIGHTHAND", a); - return c > d; +Entry.block.boolean_bigger = function(a, b) { + a = b.getNumberValue("LEFTHAND", b); + b = b.getNumberValue("RIGHTHAND", b); + return a > b; }; Blockly.Blocks.boolean_smaller = {init:function() { this.setColour("#AEB8FF"); @@ -3220,9 +3596,10 @@ Blockly.Blocks.boolean_smaller = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.boolean_smaller = function(b, a) { - var c = a.getNumberValue("LEFTHAND", a), d = a.getNumberValue("RIGHTHAND", a); - return c < d; +Entry.block.boolean_smaller = function(a, b) { + a = b.getNumberValue("LEFTHAND", b); + b = b.getNumberValue("RIGHTHAND", b); + return a < b; }; Blockly.Blocks.boolean_and_or = {init:function() { this.setColour("#AEB8FF"); @@ -3232,9 +3609,11 @@ Blockly.Blocks.boolean_and_or = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.boolean_and_or = function(b, a) { - var c = a.getField("OPERATOR", a), d = a.getBooleanValue("LEFTHAND", a), e = a.getBooleanValue("RIGHTHAND", a); - return "AND" == c ? d && e : d || e; +Entry.block.boolean_and_or = function(a, b) { + a = b.getField("OPERATOR", b); + var c = b.getBooleanValue("LEFTHAND", b); + b = b.getBooleanValue("RIGHTHAND", b); + return "AND" == a ? c && b : c || b; }; Blockly.Blocks.boolean_and = {init:function() { this.setColour("#AEB8FF"); @@ -3244,9 +3623,10 @@ Blockly.Blocks.boolean_and = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.boolean_and = function(b, a) { - var c = a.getBooleanValue("LEFTHAND", a), d = a.getBooleanValue("RIGHTHAND", a); - return c && d; +Entry.block.boolean_and = function(a, b) { + a = b.getBooleanValue("LEFTHAND", b); + b = b.getBooleanValue("RIGHTHAND", b); + return a && b; }; Blockly.Blocks.boolean_or = {init:function() { this.setColour("#AEB8FF"); @@ -3256,9 +3636,10 @@ Blockly.Blocks.boolean_or = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.boolean_or = function(b, a) { - var c = a.getBooleanValue("LEFTHAND", a), d = a.getBooleanValue("RIGHTHAND", a); - return c || d; +Entry.block.boolean_or = function(a, b) { + a = b.getBooleanValue("LEFTHAND", b); + b = b.getBooleanValue("RIGHTHAND", b); + return a || b; }; Blockly.Blocks.boolean_not = {init:function() { this.setColour("#AEB8FF"); @@ -3269,8 +3650,8 @@ Blockly.Blocks.boolean_not = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.boolean_not = function(b, a) { - return !a.getBooleanValue("VALUE"); +Entry.block.boolean_not = function(a, b) { + return !b.getBooleanValue("VALUE"); }; Blockly.Blocks.true_or_false = {init:function() { this.setColour("#AEB8FF"); @@ -3279,8 +3660,8 @@ Blockly.Blocks.true_or_false = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.true_or_false = function(b, a) { - return "true" == a.children[0].textContent; +Entry.block.true_or_false = function(a, b) { + return "true" == b.children[0].textContent; }; Blockly.Blocks.True = {init:function() { this.setColour("#AEB8FF"); @@ -3288,7 +3669,7 @@ Blockly.Blocks.True = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.True = function(b, a) { +Entry.block.True = function(a, b) { return !0; }; Blockly.Blocks.False = {init:function() { @@ -3297,7 +3678,7 @@ Blockly.Blocks.False = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.False = function(b, a) { +Entry.block.False = function(a, b) { return !1; }; Blockly.Blocks.boolean_basic_operator = {init:function() { @@ -3308,19 +3689,21 @@ Blockly.Blocks.boolean_basic_operator = {init:function() { 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) { +Entry.block.boolean_basic_operator = function(a, b) { + a = b.getField("OPERATOR", b); + var c = b.getStringValue("LEFTHAND", b); + b = b.getStringValue("RIGHTHAND", b); + switch(a) { case "EQUAL": - return d == e; + return c == b; case "GREATER": - return Number(d) > Number(e); + return Number(c) > Number(b); case "LESS": - return Number(d) < Number(e); + return Number(c) < Number(b); case "GREATER_OR_EQUAL": - return Number(d) >= Number(e); + return Number(c) >= Number(b); case "LESS_OR_EQUAL": - return Number(d) <= Number(e); + return Number(c) <= Number(b); } }; Blockly.Blocks.show = {init:function() { @@ -3330,9 +3713,9 @@ Blockly.Blocks.show = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.show = function(b, a) { - b.setVisible(!0); - return a.callReturn(); +Entry.block.show = function(a, b) { + a.setVisible(!0); + return b.callReturn(); }; Blockly.Blocks.hide = {init:function() { this.setColour("#EC4466"); @@ -3341,9 +3724,9 @@ Blockly.Blocks.hide = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hide = function(b, a) { - b.setVisible(!1); - return a.callReturn(); +Entry.block.hide = function(a, b) { + a.setVisible(!1); + return b.callReturn(); }; Blockly.Blocks.dialog_time = {init:function() { this.setColour("#EC4466"); @@ -3358,20 +3741,20 @@ Blockly.Blocks.dialog_time = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.dialog_time = 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; +Entry.block.dialog_time = function(a, b) { + if (!b.isStart) { + var c = b.getNumberValue("SECOND", b), d = b.getStringValue("VALUE", b), e = b.getField("OPTION", b); + b.isStart = !0; + b.timeFlag = 1; d || "number" == typeof d || (d = " "); d = Entry.convertToRoundedDecimals(d, 3); - new Entry.Dialog(b, d, e); - b.syncDialogVisible(b.getVisible()); + new Entry.Dialog(a, d, e); + a.syncDialogVisible(a.getVisible()); setTimeout(function() { - a.timeFlag = 0; + b.timeFlag = 0; }, 1E3 * c); } - return 0 == a.timeFlag ? (delete a.timeFlag, delete a.isStart, b.dialog && b.dialog.remove(), a.callReturn()) : a; + return 0 == b.timeFlag ? (delete b.timeFlag, delete b.isStart, a.dialog && a.dialog.remove(), b.callReturn()) : b; }; Blockly.Blocks.dialog = {init:function() { this.setColour("#EC4466"); @@ -3384,13 +3767,13 @@ Blockly.Blocks.dialog = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.dialog = function(b, a) { - var c = a.getStringValue("VALUE", a); +Entry.block.dialog = function(a, b) { + var c = b.getStringValue("VALUE", b); 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(); + var d = b.getField("OPTION", b), c = Entry.convertToRoundedDecimals(c, 3); + new Entry.Dialog(a, c, d); + a.syncDialogVisible(a.getVisible()); + return b.callReturn(); }; Blockly.Blocks.remove_dialog = {init:function() { this.setColour("#EC4466"); @@ -3399,9 +3782,9 @@ Blockly.Blocks.remove_dialog = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.remove_dialog = function(b, a) { - b.dialog && b.dialog.remove(); - return a.callReturn(); +Entry.block.remove_dialog = function(a, b) { + a.dialog && a.dialog.remove(); + return b.callReturn(); }; Blockly.Blocks.change_to_nth_shape = {init:function() { this.setColour("#EC4466"); @@ -3412,10 +3795,10 @@ Blockly.Blocks.change_to_nth_shape = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.change_to_nth_shape = function(b, a) { - var c = a.getField("VALUE", a), c = b.parent.getPicture(c); - b.setImage(c); - return a.callReturn(); +Entry.block.change_to_nth_shape = function(a, b) { + var c = b.getField("VALUE", b), c = a.parent.getPicture(c); + a.setImage(c); + return b.callReturn(); }; Blockly.Blocks.change_to_next_shape = {init:function() { this.setColour("#EC4466"); @@ -3424,11 +3807,11 @@ Blockly.Blocks.change_to_next_shape = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.change_to_next_shape = function(b, a) { +Entry.block.change_to_next_shape = function(a, b) { var c; - c = a.fields && "prev" === a.getStringField("DRIECTION") ? b.parent.getPrevPicture(b.picture.id) : b.parent.getNextPicture(b.picture.id); - b.setImage(c); - return a.callReturn(); + c = b.fields && "prev" === b.getStringField("DRIECTION") ? a.parent.getPrevPicture(a.picture.id) : a.parent.getNextPicture(a.picture.id); + a.setImage(c); + return b.callReturn(); }; Blockly.Blocks.set_effect_volume = {init:function() { this.setColour("#EC4466"); @@ -3441,11 +3824,11 @@ Blockly.Blocks.set_effect_volume = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.set_effect_volume = 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(); +Entry.block.set_effect_volume = function(a, b) { + var c = b.getField("EFFECT", b), d = b.getNumberValue("VALUE", b); + "color" == c ? a.effect.hue = d + a.effect.hue : "lens" != c && "swriling" != c && "pixel" != c && "mosaic" != c && ("brightness" == c ? a.effect.brightness = d + a.effect.brightness : "blur" != c && "opacity" == c && (a.effect.alpha += d / 100)); + a.applyFilter(); + return b.callReturn(); }; Blockly.Blocks.set_effect = {init:function() { this.setColour("#EC4466"); @@ -3458,11 +3841,11 @@ Blockly.Blocks.set_effect = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.set_effect = 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(); +Entry.block.set_effect = function(a, b) { + var c = b.getField("EFFECT", b), d = b.getNumberValue("VALUE", b); + "color" == c ? a.effect.hue = d : "lens" != c && "swriling" != c && "pixel" != c && "mosaic" != c && ("brightness" == c ? a.effect.brightness = d : "blur" != c && "opacity" == c && (a.effect.alpha = d / 100)); + a.applyFilter(); + return b.callReturn(); }; Blockly.Blocks.erase_all_effects = {init:function() { this.setColour("#EC4466"); @@ -3471,9 +3854,9 @@ Blockly.Blocks.erase_all_effects = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.erase_all_effects = function(b, a) { - b.resetFilter(); - return a.callReturn(); +Entry.block.erase_all_effects = function(a, b) { + a.resetFilter(); + return b.callReturn(); }; Blockly.Blocks.change_scale_percent = {init:function() { this.setColour("#EC4466"); @@ -3484,11 +3867,11 @@ Blockly.Blocks.change_scale_percent = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.change_scale_percent = function(b, a) { - var c = (a.getNumberValue("VALUE", a) + 100) / 100; - b.setScaleX(b.getScaleX() * c); - b.setScaleY(b.getScaleY() * c); - return a.callReturn(); +Entry.block.change_scale_percent = function(a, b) { + var c = (b.getNumberValue("VALUE", b) + 100) / 100; + a.setScaleX(a.getScaleX() * c); + a.setScaleY(a.getScaleY() * c); + return b.callReturn(); }; Blockly.Blocks.set_scale_percent = {init:function() { this.setColour("#EC4466"); @@ -3499,11 +3882,11 @@ Blockly.Blocks.set_scale_percent = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.set_scale_percent = 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(); +Entry.block.set_scale_percent = function(a, b) { + var c = b.getNumberValue("VALUE", b) / 100, d = a.snapshot_; + a.setScaleX(c * d.scaleX); + a.setScaleY(c * d.scaleY); + return b.callReturn(); }; Blockly.Blocks.change_scale_size = {init:function() { this.setColour("#EC4466"); @@ -3514,10 +3897,10 @@ Blockly.Blocks.change_scale_size = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.change_scale_size = function(b, a) { - var c = a.getNumberValue("VALUE", a); - b.setSize(b.getSize() + c); - return a.callReturn(); +Entry.block.change_scale_size = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.setSize(a.getSize() + c); + return b.callReturn(); }; Blockly.Blocks.set_scale_size = {init:function() { this.setColour("#EC4466"); @@ -3528,10 +3911,10 @@ Blockly.Blocks.set_scale_size = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.set_scale_size = function(b, a) { - var c = a.getNumberValue("VALUE", a); - b.setSize(c); - return a.callReturn(); +Entry.block.set_scale_size = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.setSize(c); + return b.callReturn(); }; Blockly.Blocks.flip_y = {init:function() { this.setColour("#EC4466"); @@ -3540,9 +3923,9 @@ Blockly.Blocks.flip_y = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.flip_y = function(b, a) { - b.setScaleX(-1 * b.getScaleX()); - return a.callReturn(); +Entry.block.flip_y = function(a, b) { + a.setScaleX(-1 * a.getScaleX()); + return b.callReturn(); }; Blockly.Blocks.flip_x = {init:function() { this.setColour("#EC4466"); @@ -3551,9 +3934,9 @@ Blockly.Blocks.flip_x = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.flip_x = function(b, a) { - b.setScaleY(-1 * b.getScaleY()); - return a.callReturn(); +Entry.block.flip_x = function(a, b) { + a.setScaleY(-1 * a.getScaleY()); + return b.callReturn(); }; Blockly.Blocks.set_object_order = {init:function() { this.setColour("#EC4466"); @@ -3564,10 +3947,11 @@ Blockly.Blocks.set_object_order = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.set_object_order = function(b, a) { - var c = a.getField("VALUE", a), d = Entry.container.getCurrentObjects().indexOf(b.parent); - if (-1 < d) { - return Entry.container.moveElementByBlock(d, c), a.callReturn(); +Entry.block.set_object_order = function(a, b) { + var c = b.getField("VALUE", b); + a = Entry.container.getCurrentObjects().indexOf(a.parent); + if (-1 < a) { + return Entry.container.moveElementByBlock(a, c), b.callReturn(); } throw Error("object is not available"); }; @@ -3579,8 +3963,8 @@ Blockly.Blocks.get_pictures = {init:function() { this.setOutput(!0, "String"); this.setInputsInline(!0); }}; -Entry.block.get_pictures = function(b, a) { - return a.getStringField("VALUE"); +Entry.block.get_pictures = function(a, b) { + return b.getStringField("VALUE"); }; Blockly.Blocks.change_to_some_shape = {init:function() { this.setColour("#EC4466"); @@ -3591,12 +3975,12 @@ Blockly.Blocks.change_to_some_shape = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.change_to_some_shape = function(b, a) { - var c = a.getStringValue("VALUE"); +Entry.block.change_to_some_shape = function(a, b) { + var c = b.getStringValue("VALUE"); Entry.parseNumber(c); - c = b.parent.getPicture(c); - b.setImage(c); - return a.callReturn(); + c = a.parent.getPicture(c); + a.setImage(c); + return b.callReturn(); }; Blockly.Blocks.add_effect_amount = {init:function() { this.setColour("#EC4466"); @@ -3609,11 +3993,11 @@ Blockly.Blocks.add_effect_amount = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.add_effect_amount = function(b, a) { - var c = a.getField("EFFECT", a), d = a.getNumberValue("VALUE", a); - "color" == c ? b.effect.hsv = d + b.effect.hsv : "brightness" == c ? b.effect.brightness = d + b.effect.brightness : "transparency" == c && (b.effect.alpha -= d / 100); - b.applyFilter(); - return a.callReturn(); +Entry.block.add_effect_amount = function(a, b) { + var c = b.getField("EFFECT", b), d = b.getNumberValue("VALUE", b); + "color" == c ? a.effect.hsv = d + a.effect.hsv : "brightness" == c ? a.effect.brightness = d + a.effect.brightness : "transparency" == c && (a.effect.alpha -= d / 100); + a.applyFilter(); + return b.callReturn(); }; Blockly.Blocks.change_effect_amount = {init:function() { this.setColour("#EC4466"); @@ -3626,11 +4010,11 @@ Blockly.Blocks.change_effect_amount = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.change_effect_amount = function(b, a) { - var c = a.getField("EFFECT", a), d = a.getNumberValue("VALUE", a); - "color" == c ? b.effect.hsv = d : "brightness" == c ? b.effect.brightness = d : "transparency" == c && (b.effect.alpha = 1 - d / 100); - b.applyFilter(); - return a.callReturn(); +Entry.block.change_effect_amount = function(a, b) { + var c = b.getField("EFFECT", b), d = b.getNumberValue("VALUE", b); + "color" == c ? a.effect.hsv = d : "brightness" == c ? a.effect.brightness = d : "transparency" == c && (a.effect.alpha = 1 - d / 100); + a.applyFilter(); + return b.callReturn(); }; Blockly.Blocks.set_effect_amount = {init:function() { this.setColour("#EC4466"); @@ -3643,11 +4027,11 @@ Blockly.Blocks.set_effect_amount = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.set_effect_amount = function(b, a) { - var c = a.getField("EFFECT", a), d = a.getNumberValue("VALUE", a); - "color" == c ? b.effect.hue = d + b.effect.hue : "brightness" == c ? b.effect.brightness = d + b.effect.brightness : "transparency" == c && (b.effect.alpha -= d / 100); - b.applyFilter(); - return a.callReturn(); +Entry.block.set_effect_amount = function(a, b) { + var c = b.getField("EFFECT", b), d = b.getNumberValue("VALUE", b); + "color" == c ? a.effect.hue = d + a.effect.hue : "brightness" == c ? a.effect.brightness = d + a.effect.brightness : "transparency" == c && (a.effect.alpha -= d / 100); + a.applyFilter(); + return b.callReturn(); }; Blockly.Blocks.set_entity_effect = {init:function() { this.setColour("#EC4466"); @@ -3660,11 +4044,11 @@ Blockly.Blocks.set_entity_effect = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.set_entity_effect = function(b, a) { - var c = a.getField("EFFECT", a), d = a.getNumberValue("VALUE", a); - "color" == c ? b.effect.hue = d : "brightness" == c ? b.effect.brightness = d : "transparency" == c && (b.effect.alpha = 1 - d / 100); - b.applyFilter(); - return a.callReturn(); +Entry.block.set_entity_effect = function(a, b) { + var c = b.getField("EFFECT", b), d = b.getNumberValue("VALUE", b); + "color" == c ? a.effect.hue = d : "brightness" == c ? a.effect.brightness = d : "transparency" == c && (a.effect.alpha = 1 - d / 100); + a.applyFilter(); + return b.callReturn(); }; Blockly.Blocks.change_object_index = {init:function() { this.setColour("#EC4466"); @@ -3674,9 +4058,11 @@ Blockly.Blocks.change_object_index = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.change_object_index = function(b, a) { - var c, d = a.getField("LOCATION", a), e = Entry.container.getCurrentObjects(), f = e.indexOf(b.parent), e = e.length - 1; - if (0 > f) { +Entry.block.change_object_index = function(a, b) { + var c, d = b.getField("LOCATION", b), e = Entry.container.getCurrentObjects(); + a = e.indexOf(a.parent); + e = e.length - 1; + if (0 > a) { throw Error("object is not available for current scene"); } switch(d) { @@ -3684,16 +4070,16 @@ Entry.block.change_object_index = function(b, a) { c = 0; break; case "FORWARD": - c = Math.max(0, f - 1); + c = Math.max(0, a - 1); break; case "BACKWARD": - c = Math.min(e, f + 1); + c = Math.min(e, a + 1); break; case "BACK": c = e; } - Entry.container.moveElementByBlock(f, c); - return a.callReturn(); + Entry.container.moveElementByBlock(a, c); + return b.callReturn(); }; Blockly.Blocks.move_direction = {init:function() { this.setColour("#A751E3"); @@ -3704,12 +4090,12 @@ Blockly.Blocks.move_direction = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.move_direction = function(b, a) { - var c = a.getNumberValue("VALUE", a); - b.setX(b.getX() + c * Math.cos((b.getRotation() + b.getDirection() - 90) / 180 * Math.PI)); - b.setY(b.getY() - c * Math.sin((b.getRotation() + b.getDirection() - 90) / 180 * Math.PI)); - b.brush && !b.brush.stop && b.brush.lineTo(b.getX(), -1 * b.getY()); - return a.callReturn(); +Entry.block.move_direction = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.setX(a.getX() + c * Math.cos((a.getRotation() + a.getDirection() - 90) / 180 * Math.PI)); + a.setY(a.getY() - c * Math.sin((a.getRotation() + a.getDirection() - 90) / 180 * Math.PI)); + a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()); + return b.callReturn(); }; Blockly.Blocks.move_x = {init:function() { this.setColour("#A751E3"); @@ -3720,11 +4106,11 @@ Blockly.Blocks.move_x = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.move_x = function(b, a) { - var c = a.getNumberValue("VALUE", a); - b.setX(b.getX() + c); - b.brush && !b.brush.stop && b.brush.lineTo(b.getX(), -1 * b.getY()); - return a.callReturn(); +Entry.block.move_x = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.setX(a.getX() + c); + a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()); + return b.callReturn(); }; Blockly.Blocks.move_y = {init:function() { this.setColour("#A751E3"); @@ -3735,11 +4121,11 @@ Blockly.Blocks.move_y = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.move_y = function(b, a) { - var c = a.getNumberValue("VALUE", a); - b.setY(b.getY() + c); - b.brush && !b.brush.stop && b.brush.lineTo(b.getX(), -1 * b.getY()); - return a.callReturn(); +Entry.block.move_y = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.setY(a.getY() + c); + a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()); + return b.callReturn(); }; Blockly.Blocks.locate_xy_time = {init:function() { this.setColour("#A751E3"); @@ -3754,29 +4140,29 @@ Blockly.Blocks.locate_xy_time = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.locate_xy_time = function(b, a) { - if (!a.isStart) { +Entry.block.locate_xy_time = function(a, b) { + if (!b.isStart) { var c; - c = a.getNumberValue("VALUE1", a); - a.isStart = !0; - a.frameCount = Math.floor(c * Entry.FPS); - a.x = a.getNumberValue("VALUE2", a); - a.y = a.getNumberValue("VALUE3", a); - } - if (0 != a.frameCount) { - c = a.x - b.getX(); - var d = a.y - b.getY(); - c /= a.frameCount; - d /= a.frameCount; - b.setX(b.getX() + c); - b.setY(b.getY() + d); - a.frameCount--; - b.brush && !b.brush.stop && b.brush.lineTo(b.getX(), -1 * b.getY()); - return a; + c = b.getNumberValue("VALUE1", b); + b.isStart = !0; + b.frameCount = Math.floor(c * Entry.FPS); + b.x = b.getNumberValue("VALUE2", b); + b.y = b.getNumberValue("VALUE3", b); + } + if (0 != b.frameCount) { + c = b.x - a.getX(); + var d = b.y - a.getY(); + c /= b.frameCount; + d /= b.frameCount; + a.setX(a.getX() + c); + a.setY(a.getY() + d); + b.frameCount--; + a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()); + return b; } - delete a.isStart; - delete a.frameCount; - return a.callReturn(); + delete b.isStart; + delete b.frameCount; + return b.callReturn(); }; Blockly.Blocks.rotate_by_angle = {init:function() { this.setColour("#A751E3"); @@ -3787,10 +4173,10 @@ Blockly.Blocks.rotate_by_angle = {init:function() { 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(); +Entry.block.rotate_by_angle = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.setRotation(a.getRotation() + c); + return b.callReturn(); }; Blockly.Blocks.rotate_by_angle_dropdown = {init:function() { this.setColour("#A751E3"); @@ -3800,10 +4186,10 @@ Blockly.Blocks.rotate_by_angle_dropdown = {init:function() { 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(a, b) { + var c = b.getField("VALUE", b); + a.setRotation(a.getRotation() + Number(c)); + return b.callReturn(); }; Blockly.Blocks.see_angle = {init:function() { this.setColour("#A751E3"); @@ -3814,10 +4200,10 @@ Blockly.Blocks.see_angle = {init:function() { 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(); +Entry.block.see_angle = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.setDirection(c); + return b.callReturn(); }; Blockly.Blocks.see_direction = {init:function() { this.setColour("#A751E3"); @@ -3828,10 +4214,10 @@ Blockly.Blocks.see_direction = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.see_direction = function(b, a) { - var c = a.getField("VALUE", a), d = Entry.container.getEntity(c), c = d.getX() - b.getX(), d = d.getY() - b.getY(); - 0 <= c ? b.setRotation(Math.atan(d / c) / Math.PI * 180 + 90) : b.setRotation(Math.atan(d / c) / Math.PI * 180 + 270); - return a.callReturn(); +Entry.block.see_direction = function(a, b) { + var c = b.getField("VALUE", b), d = Entry.container.getEntity(c), c = d.getX() - a.getX(), d = d.getY() - a.getY(); + 0 <= c ? a.setRotation(Math.atan(d / c) / Math.PI * 180 + 90) : a.setRotation(Math.atan(d / c) / Math.PI * 180 + 270); + return b.callReturn(); }; Blockly.Blocks.locate_xy = {init:function() { this.setColour("#A751E3"); @@ -3844,13 +4230,13 @@ Blockly.Blocks.locate_xy = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.locate_xy = function(b, a) { - var c = a.getNumberValue("VALUE1", a); - b.setX(c); - c = a.getNumberValue("VALUE2", a); - b.setY(c); - b.brush && !b.brush.stop && b.brush.lineTo(b.getX(), -1 * b.getY()); - return a.callReturn(); +Entry.block.locate_xy = function(a, b) { + var c = b.getNumberValue("VALUE1", b); + a.setX(c); + c = b.getNumberValue("VALUE2", b); + a.setY(c); + a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()); + return b.callReturn(); }; Blockly.Blocks.locate_x = {init:function() { this.setColour("#A751E3"); @@ -3861,11 +4247,11 @@ Blockly.Blocks.locate_x = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.locate_x = function(b, a) { - var c = a.getNumberValue("VALUE", a); - b.setX(c); - b.brush && !b.brush.stop && b.brush.lineTo(b.getX(), -1 * b.getY()); - return a.callReturn(); +Entry.block.locate_x = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.setX(c); + a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()); + return b.callReturn(); }; Blockly.Blocks.locate_y = {init:function() { this.setColour("#A751E3"); @@ -3876,11 +4262,11 @@ Blockly.Blocks.locate_y = {init:function() { 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(); +Entry.block.locate_y = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.setY(c); + a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()); + return b.callReturn(); }; Blockly.Blocks.locate = {init:function() { this.setColour("#A751E3"); @@ -3891,13 +4277,13 @@ Blockly.Blocks.locate = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.locate = function(b, a) { - var c = a.getField("VALUE", a), d; +Entry.block.locate = function(a, b) { + var c = b.getField("VALUE", b), 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(); + a.setX(Number(c)); + a.setY(Number(d)); + a.brush && !a.brush.stop && a.brush.lineTo(c, -1 * d); + return b.callReturn(); }; Blockly.Blocks.move_xy_time = {init:function() { this.setColour("#A751E3"); @@ -3912,22 +4298,22 @@ Blockly.Blocks.move_xy_time = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.move_xy_time = function(b, a) { - if (!a.isStart) { +Entry.block.move_xy_time = function(a, b) { + if (!b.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; + c = b.getNumberValue("VALUE1", b); + var d = b.getNumberValue("VALUE2", b), e = b.getNumberValue("VALUE3", b); + b.isStart = !0; + b.frameCount = Math.floor(c * Entry.FPS); + b.dX = d / b.frameCount; + b.dY = e / b.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; + if (0 != b.frameCount) { + return a.setX(a.getX() + b.dX), a.setY(a.getY() + b.dY), b.frameCount--, a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()), b; } - delete a.isStart; - delete a.frameCount; - return a.callReturn(); + delete b.isStart; + delete b.frameCount; + return b.callReturn(); }; Blockly.Blocks.locate_time = {init:function() { this.setColour("#A751E3"); @@ -3951,21 +4337,21 @@ Blockly.Blocks.rotate_by_angle_time = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.rotate_by_angle_time = function(b, a) { - if (!a.isStart) { +Entry.block.rotate_by_angle_time = function(a, b) { + if (!b.isStart) { var c; - c = a.getNumberValue("VALUE", a); - var d = a.getNumberField("VALUE", a); - a.isStart = !0; - a.frameCount = Math.floor(c * Entry.FPS); - a.dAngle = d / a.frameCount; + c = b.getNumberValue("VALUE", b); + var d = b.getNumberField("VALUE", b); + b.isStart = !0; + b.frameCount = Math.floor(c * Entry.FPS); + b.dAngle = d / b.frameCount; } - if (0 != a.frameCount) { - return b.setRotation(b.getRotation() + a.dAngle), a.frameCount--, a; + if (0 != b.frameCount) { + return a.setRotation(a.getRotation() + b.dAngle), b.frameCount--, b; } - delete a.isStart; - delete a.frameCount; - return a.callReturn(); + delete b.isStart; + delete b.frameCount; + return b.callReturn(); }; Blockly.Blocks.bounce_when = {init:function() { this.setColour("#A751E3"); @@ -3983,22 +4369,23 @@ Blockly.Blocks.bounce_wall = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.bounce_wall = function(b, a) { - var c = b.parent.getRotateMethod(), d = "free" == c ? (b.getRotation() + b.getDirection()).mod(360) : b.getDirection(), e = Entry.Utils.COLLISION.NONE; +Entry.block.bounce_wall = function(a, b) { + var c = a.parent.getRotateMethod(), d = "free" == c ? (a.getRotation() + a.getDirection()).mod(360) : a.getDirection(), e; if (90 > d && 0 <= d || 360 > d && 270 <= d) { - var e = b.collision == Entry.Utils.COLLISION.UP, f = ndgmr.checkPixelCollision(Entry.stage.wall.up, b.object, 0, !1); - !f && e && (b.collision = Entry.Utils.COLLISION.NONE); + e = a.collision == Entry.Utils.COLLISION.UP; + var f = ndgmr.checkPixelCollision(Entry.stage.wall.up, a.object, 0, !1); + !f && e && (a.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 && e && (f = !1), f && ("free" == c ? b.setRotation(-b.getRotation() - 2 * b.getDirection() + 180) : b.setDirection(-b.getDirection() + 180), b.collision = + f ? ("free" == c ? a.setRotation(-a.getRotation() - 2 * a.getDirection() + 180) : a.setDirection(-a.getDirection() + 180), a.collision = Entry.Utils.COLLISION.UP) : (e = a.collision == Entry.Utils.COLLISION.DOWN, f = ndgmr.checkPixelCollision(Entry.stage.wall.down, a.object, 0, !1), !f && e && (a.collision = Entry.Utils.COLLISION.NONE), f && e && (f = !1), f && ("free" == c ? a.setRotation(-a.getRotation() - 2 * a.getDirection() + 180) : a.setDirection(-a.getDirection() + 180), a.collision = Entry.Utils.COLLISION.DOWN)); } else { - 270 > d && 90 <= d && (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 && e && (f = !1), f ? ("free" == c ? b.setRotation(-b.getRotation() - 2 * b.getDirection() + 180) : b.setDirection(-b.getDirection() + 180), b.collision = Entry.Utils.COLLISION.DOWN) : (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))); + 270 > d && 90 <= d && (e = a.collision == Entry.Utils.COLLISION.DOWN, f = ndgmr.checkPixelCollision(Entry.stage.wall.down, a.object, 0, !1), !f && e && (a.collision = Entry.Utils.COLLISION.NONE), f && e && (f = !1), f ? ("free" == c ? a.setRotation(-a.getRotation() - 2 * a.getDirection() + 180) : a.setDirection(-a.getDirection() + 180), a.collision = Entry.Utils.COLLISION.DOWN) : (e = a.collision == Entry.Utils.COLLISION.UP, f = ndgmr.checkPixelCollision(Entry.stage.wall.up, a.object, 0, !1), + !f && e && (a.collision = Entry.Utils.COLLISION.NONE), f && e && (f = !1), f && ("free" == c ? a.setRotation(-a.getRotation() - 2 * a.getDirection() + 180) : a.setDirection(-a.getDirection() + 180), a.collision = Entry.Utils.COLLISION.UP))); } - 360 > d && 180 <= d ? (e = b.collision == Entry.Utils.COLLISION.LEFT, d = ndgmr.checkPixelCollision(Entry.stage.wall.left, b.object, 0, !1), !d && e && (b.collision = Entry.Utils.COLLISION.NONE), d && e && (d = !1), d ? ("free" == c ? b.setRotation(-b.getRotation() - 2 * b.getDirection()) : b.setDirection(-b.getDirection() + 360), b.collision = Entry.Utils.COLLISION.LEFT) : (e = b.collision == Entry.Utils.COLLISION.RIGHT, d = ndgmr.checkPixelCollision(Entry.stage.wall.right, b.object, 0, !1), !d && - e && (b.collision = Entry.Utils.COLLISION.NONE), d && e && (d = !1), d && ("free" == c ? b.setRotation(-b.getRotation() - 2 * b.getDirection()) : b.setDirection(-b.getDirection() + 360), b.collision = Entry.Utils.COLLISION.RIGHT))) : 180 > d && 0 <= d && (e = b.collision == Entry.Utils.COLLISION.RIGHT, d = ndgmr.checkPixelCollision(Entry.stage.wall.right, b.object, 0, !1), !d && e && (b.collision = Entry.Utils.COLLISION.NONE), d && e && (d = !1), d ? ("free" == c ? b.setRotation(-b.getRotation() - - 2 * b.getDirection()) : b.setDirection(-b.getDirection() + 360), b.collision = Entry.Utils.COLLISION.RIGHT) : (e = b.collision == Entry.Utils.COLLISION.LEFT, d = ndgmr.checkPixelCollision(Entry.stage.wall.left, b.object, 0, !1), !d && e && (b.collision = Entry.Utils.COLLISION.NONE), d && e && (d = !1), d && ("free" == c ? b.setRotation(-b.getRotation() - 2 * b.getDirection()) : b.setDirection(-b.getDirection() + 360), b.collision = Entry.Utils.COLLISION.LEFT))); - return a.callReturn(); + 360 > d && 180 <= d ? (e = a.collision == Entry.Utils.COLLISION.LEFT, d = ndgmr.checkPixelCollision(Entry.stage.wall.left, a.object, 0, !1), !d && e && (a.collision = Entry.Utils.COLLISION.NONE), d && e && (d = !1), d ? ("free" == c ? a.setRotation(-a.getRotation() - 2 * a.getDirection()) : a.setDirection(-a.getDirection() + 360), a.collision = Entry.Utils.COLLISION.LEFT) : (e = a.collision == Entry.Utils.COLLISION.RIGHT, d = ndgmr.checkPixelCollision(Entry.stage.wall.right, a.object, 0, !1), !d && + e && (a.collision = Entry.Utils.COLLISION.NONE), d && e && (d = !1), d && ("free" == c ? a.setRotation(-a.getRotation() - 2 * a.getDirection()) : a.setDirection(-a.getDirection() + 360), a.collision = Entry.Utils.COLLISION.RIGHT))) : 180 > d && 0 <= d && (e = a.collision == Entry.Utils.COLLISION.RIGHT, d = ndgmr.checkPixelCollision(Entry.stage.wall.right, a.object, 0, !1), !d && e && (a.collision = Entry.Utils.COLLISION.NONE), d && e && (d = !1), d ? ("free" == c ? a.setRotation(-a.getRotation() - + 2 * a.getDirection()) : a.setDirection(-a.getDirection() + 360), a.collision = Entry.Utils.COLLISION.RIGHT) : (e = a.collision == Entry.Utils.COLLISION.LEFT, d = ndgmr.checkPixelCollision(Entry.stage.wall.left, a.object, 0, !1), !d && e && (a.collision = Entry.Utils.COLLISION.NONE), d && e && (d = !1), d && ("free" == c ? a.setRotation(-a.getRotation() - 2 * a.getDirection()) : a.setDirection(-a.getDirection() + 360), a.collision = Entry.Utils.COLLISION.LEFT))); + return b.callReturn(); }; Blockly.Blocks.flip_arrow_horizontal = {init:function() { this.setColour("#A751E3"); @@ -4007,9 +4394,9 @@ Blockly.Blocks.flip_arrow_horizontal = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.flip_arrow_horizontal = function(b, a) { - b.setDirection(b.getDirection() + 180); - return a.callReturn(); +Entry.block.flip_arrow_horizontal = function(a, b) { + a.setDirection(a.getDirection() + 180); + return b.callReturn(); }; Blockly.Blocks.flip_arrow_vertical = {init:function() { this.setColour("#A751E3"); @@ -4018,9 +4405,9 @@ Blockly.Blocks.flip_arrow_vertical = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.flip_arrow_vertical = function(b, a) { - b.setDirection(b.getDirection() + 180); - return a.callReturn(); +Entry.block.flip_arrow_vertical = function(a, b) { + a.setDirection(a.getDirection() + 180); + return b.callReturn(); }; Blockly.Blocks.see_angle_object = {init:function() { this.setColour("#A751E3"); @@ -4031,16 +4418,16 @@ Blockly.Blocks.see_angle_object = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.see_angle_object = function(b, a) { - var c = a.getField("VALUE", a), d = b.getX(), e = b.getY(); - if (b.parent.id == c) { - return a.callReturn(); +Entry.block.see_angle_object = function(a, b) { + var c = b.getField("VALUE", b), d = a.getX(), e = a.getY(); + if (a.parent.id == c) { + return b.callReturn(); } "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(); + e = 0 === d && 0 === e ? a.getDirection() + a.getRotation() : 0 <= d ? -Math.atan(e / d) / Math.PI * 180 + 90 : -Math.atan(e / d) / Math.PI * 180 + 270; + d = a.getDirection() + a.getRotation(); + a.setRotation(a.getRotation() + e - d); + return b.callReturn(); }; Blockly.Blocks.see_angle_direction = {init:function() { this.setColour("#A751E3"); @@ -4051,10 +4438,10 @@ Blockly.Blocks.see_angle_direction = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.see_angle_direction = function(b, a) { - var c = a.getNumberValue("VALUE", a), d = b.getDirection() + b.getRotation(); - b.setRotation(b.getRotation() + c - d); - return a.callReturn(); +Entry.block.see_angle_direction = function(a, b) { + var c = b.getNumberValue("VALUE", b), d = a.getDirection() + a.getRotation(); + a.setRotation(a.getRotation() + c - d); + return b.callReturn(); }; Blockly.Blocks.rotate_direction = {init:function() { this.setColour("#A751E3"); @@ -4065,10 +4452,10 @@ Blockly.Blocks.rotate_direction = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.rotate_direction = function(b, a) { - var c = a.getNumberValue("VALUE", a); - b.setDirection(c + b.getDirection()); - return a.callReturn(); +Entry.block.rotate_direction = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.setDirection(c + a.getDirection()); + return b.callReturn(); }; Blockly.Blocks.locate_object_time = {init:function() { this.setColour("#A751E3"); @@ -4081,25 +4468,25 @@ Blockly.Blocks.locate_object_time = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.locate_object_time = function(b, a) { - if (!a.isStart) { +Entry.block.locate_object_time = function(a, b) { + if (!b.isStart) { var c, d, e; - d = a.getField("TARGET", a); - c = a.getNumberValue("VALUE", a); + d = b.getField("TARGET", b); + c = b.getNumberValue("VALUE", b); 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; + "mouse" == d ? (d = e.x - a.getX(), e = e.y - a.getY()) : (e = Entry.container.getEntity(d), d = e.getX() - a.getX(), e = e.getY() - a.getY()), b.isStart = !0, b.frameCount = c, b.dX = d / b.frameCount, b.dY = e / b.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 = Number(e.x), e = Number(e.y)) : (e = Entry.container.getEntity(d), d = e.getX(), e = e.getY()), a.setX(d), a.setY(e), a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()), b.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; + if (0 != b.frameCount) { + return a.setX(a.getX() + b.dX), a.setY(a.getY() + b.dY), b.frameCount--, a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()), b; } - delete a.isStart; - delete a.frameCount; - return a.callReturn(); + delete b.isStart; + delete b.frameCount; + return b.callReturn(); }; Blockly.Blocks.rotate_absolute = {init:function() { this.setColour("#A751E3"); @@ -4110,10 +4497,10 @@ Blockly.Blocks.rotate_absolute = {init:function() { 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(); +Entry.block.rotate_absolute = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.setRotation(c); + return b.callReturn(); }; Blockly.Blocks.rotate_relative = {init:function() { this.setColour("#A751E3"); @@ -4124,10 +4511,10 @@ Blockly.Blocks.rotate_relative = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.rotate_relative = function(b, a) { - var c = a.getNumberValue("VALUE", a); - b.setRotation(c + b.getRotation()); - return a.callReturn(); +Entry.block.rotate_relative = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.setRotation(c + a.getRotation()); + return b.callReturn(); }; Blockly.Blocks.direction_absolute = {init:function() { this.setColour("#A751E3"); @@ -4138,10 +4525,10 @@ Blockly.Blocks.direction_absolute = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.direction_absolute = function(b, a) { - var c = a.getNumberValue("VALUE", a); - b.setDirection(c); - return a.callReturn(); +Entry.block.direction_absolute = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.setDirection(c); + return b.callReturn(); }; Blockly.Blocks.direction_relative = {init:function() { this.setColour("#A751E3"); @@ -4152,10 +4539,10 @@ Blockly.Blocks.direction_relative = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.direction_relative = function(b, a) { - var c = a.getNumberValue("VALUE", a); - b.setDirection(c + b.getDirection()); - return a.callReturn(); +Entry.block.direction_relative = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.setDirection(c + a.getDirection()); + return b.callReturn(); }; Blockly.Blocks.move_to_angle = {init:function() { this.setColour("#A751E3"); @@ -4168,12 +4555,12 @@ Blockly.Blocks.move_to_angle = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.move_to_angle = function(b, a) { - var c = a.getNumberValue("VALUE", a), d = a.getNumberValue("ANGLE", a); - b.setX(b.getX() + c * Math.cos((d - 90) / 180 * Math.PI)); - b.setY(b.getY() - c * Math.sin((d - 90) / 180 * Math.PI)); - b.brush && !b.brush.stop && b.brush.lineTo(b.getX(), -1 * b.getY()); - return a.callReturn(); +Entry.block.move_to_angle = function(a, b) { + var c = b.getNumberValue("VALUE", b), d = b.getNumberValue("ANGLE", b); + a.setX(a.getX() + c * Math.cos((d - 90) / 180 * Math.PI)); + a.setY(a.getY() - c * Math.sin((d - 90) / 180 * Math.PI)); + a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()); + return b.callReturn(); }; Blockly.Blocks.rotate_by_time = {init:function() { this.setColour("#A751E3"); @@ -4187,21 +4574,21 @@ Blockly.Blocks.rotate_by_time = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.rotate_by_time = function(b, a) { - if (!a.isStart) { +Entry.block.rotate_by_time = function(a, b) { + if (!b.isStart) { var c; - c = a.getNumberValue("VALUE", a); - var d = a.getNumberValue("ANGLE", a); - a.isStart = !0; - a.frameCount = Math.floor(c * Entry.FPS); - a.dAngle = d / a.frameCount; + c = b.getNumberValue("VALUE", b); + var d = b.getNumberValue("ANGLE", b); + b.isStart = !0; + b.frameCount = Math.floor(c * Entry.FPS); + b.dAngle = d / b.frameCount; } - if (0 != a.frameCount) { - return b.setRotation(b.getRotation() + a.dAngle), a.frameCount--, a; + if (0 != b.frameCount) { + return a.setRotation(a.getRotation() + b.dAngle), b.frameCount--, b; } - delete a.isStart; - delete a.frameCount; - return a.callReturn(); + delete b.isStart; + delete b.frameCount; + return b.callReturn(); }; Blockly.Blocks.direction_relative_duration = {init:function() { this.setColour("#A751E3"); @@ -4214,26 +4601,26 @@ Blockly.Blocks.direction_relative_duration = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.direction_relative_duration = function(b, a) { - if (!a.isStart) { +Entry.block.direction_relative_duration = function(a, b) { + if (!b.isStart) { var c; - c = a.getNumberValue("DURATION", a); - var d = a.getNumberValue("AMOUNT", a); - a.isStart = !0; - a.frameCount = Math.floor(c * Entry.FPS); - a.dDirection = d / a.frameCount; + c = b.getNumberValue("DURATION", b); + var d = b.getNumberValue("AMOUNT", b); + b.isStart = !0; + b.frameCount = Math.floor(c * Entry.FPS); + b.dDirection = d / b.frameCount; } - if (0 != a.frameCount) { - return b.setDirection(b.getDirection() + a.dDirection), a.frameCount--, a; + if (0 != b.frameCount) { + return a.setDirection(a.getDirection() + b.dDirection), b.frameCount--, b; } - delete a.isStart; - delete a.frameCount; - delete a.dDirection; - return a.callReturn(); + delete b.isStart; + delete b.frameCount; + delete b.dDirection; + return b.callReturn(); }; Entry.Neobot = {name:"neobot", LOCAL_MAP:["IN1", "IN2", "IN3", "IR", "BAT"], REMOTE_MAP:"OUT1 OUT2 OUT3 DCR DCL SND FND OPT".split(" "), setZero:function() { - for (var b in Entry.Neobot.REMOTE_MAP) { - Entry.hw.sendQueue[Entry.Neobot.REMOTE_MAP[b]] = 0; + for (var a in Entry.Neobot.REMOTE_MAP) { + Entry.hw.sendQueue[Entry.Neobot.REMOTE_MAP[a]] = 0; } Entry.hw.update(); }, name:"neobot", monitorTemplate:{imgPath:"hw/neobot.png", width:700, height:700, listPorts:{IR:{name:"\ub9ac\ubaa8\ucee8", type:"input", pos:{x:0, y:0}}, BAT:{name:"\ubca0\ud130\ub9ac", type:"input", pos:{x:0, y:0}}, SND:{name:Lang.Hw.buzzer, type:"output", pos:{x:0, y:0}}, FND:{name:"FND", type:"output", pos:{x:0, y:0}}}, ports:{IN1:{name:"IN1", type:"input", pos:{x:270, y:200}}, IN2:{name:"IN2", type:"input", pos:{x:325, y:200}}, IN3:{name:"IN3", type:"input", pos:{x:325, y:500}}, DCL:{name:"L-Motor", @@ -4244,9 +4631,9 @@ Blockly.Blocks.neobot_sensor_value = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.neobot_sensor_value = function(b, a) { - var c = a.getStringField("PORT"); - return Entry.hw.portData[c]; +Entry.block.neobot_sensor_value = function(a, b) { + a = b.getStringField("PORT"); + return Entry.hw.portData[a]; }; Blockly.Blocks.neobot_left_motor = {init:function() { this.setColour("#00979D"); @@ -4256,10 +4643,11 @@ Blockly.Blocks.neobot_left_motor = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.neobot_left_motor = function(b, a) { - var c = a.getNumberField("SPEED"), d = a.getNumberField("DIRECTION"); - Entry.hw.sendQueue.DCL = c + d; - return a.callReturn(); +Entry.block.neobot_left_motor = function(a, b) { + a = b.getNumberField("SPEED"); + var c = b.getNumberField("DIRECTION"); + Entry.hw.sendQueue.DCL = a + c; + return b.callReturn(); }; Blockly.Blocks.neobot_stop_left_motor = {init:function() { this.setColour("#00979D"); @@ -4268,9 +4656,9 @@ Blockly.Blocks.neobot_stop_left_motor = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.neobot_stop_left_motor = function(b, a) { +Entry.block.neobot_stop_left_motor = function(a, b) { Entry.hw.sendQueue.DCL = 0; - return a.callReturn(); + return b.callReturn(); }; Blockly.Blocks.neobot_right_motor = {init:function() { this.setColour("#00979D"); @@ -4280,10 +4668,11 @@ Blockly.Blocks.neobot_right_motor = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.neobot_right_motor = function(b, a) { - var c = a.getNumberField("SPEED"), d = a.getNumberField("DIRECTION"); - Entry.hw.sendQueue.DCR = c + d; - return a.callReturn(); +Entry.block.neobot_right_motor = function(a, b) { + a = b.getNumberField("SPEED"); + var c = b.getNumberField("DIRECTION"); + Entry.hw.sendQueue.DCR = a + c; + return b.callReturn(); }; Blockly.Blocks.neobot_stop_right_motor = {init:function() { this.setColour("#00979D"); @@ -4292,9 +4681,9 @@ Blockly.Blocks.neobot_stop_right_motor = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.neobot_stop_right_motor = function(b, a) { +Entry.block.neobot_stop_right_motor = function(a, b) { Entry.hw.sendQueue.DCR = 0; - return a.callReturn(); + return b.callReturn(); }; Blockly.Blocks.neobot_all_motor = {init:function() { this.setColour("#00979D"); @@ -4305,34 +4694,34 @@ Blockly.Blocks.neobot_all_motor = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.neobot_all_motor = function(b, a) { - a.getNumberField("TYPE"); - var c = a.getNumberField("SPEED"); - switch(a.getNumberField("DIRECTION")) { +Entry.block.neobot_all_motor = function(a, b) { + b.getNumberField("TYPE"); + a = b.getNumberField("SPEED"); + switch(b.getNumberField("DIRECTION")) { case 1: - Entry.hw.sendQueue.DCL = 16 + c; - Entry.hw.sendQueue.DCR = 16 + c; + Entry.hw.sendQueue.DCL = 16 + a; + Entry.hw.sendQueue.DCR = 16 + a; break; case 2: - Entry.hw.sendQueue.DCL = 32 + c; - Entry.hw.sendQueue.DCR = 32 + c; + Entry.hw.sendQueue.DCL = 32 + a; + Entry.hw.sendQueue.DCR = 32 + a; break; case 3: - Entry.hw.sendQueue.DCL = 32 + c; - Entry.hw.sendQueue.DCR = 16 + c; + Entry.hw.sendQueue.DCL = 32 + a; + Entry.hw.sendQueue.DCR = 16 + a; break; case 4: - Entry.hw.sendQueue.DCL = 16 + c; - Entry.hw.sendQueue.DCR = 32 + c; + Entry.hw.sendQueue.DCL = 16 + a; + Entry.hw.sendQueue.DCR = 32 + a; break; case 5: Entry.hw.sendQueue.DCL = 0; - Entry.hw.sendQueue.DCR = 16 + c; + Entry.hw.sendQueue.DCR = 16 + a; break; case 6: - Entry.hw.sendQueue.DCL = 16 + c, Entry.hw.sendQueue.DCR = 0; + Entry.hw.sendQueue.DCL = 16 + a, Entry.hw.sendQueue.DCR = 0; } - return a.callReturn(); + return b.callReturn(); }; Blockly.Blocks.neobot_set_servo = {init:function() { this.setColour("#00979D"); @@ -4342,12 +4731,13 @@ Blockly.Blocks.neobot_set_servo = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.neobot_set_servo = function(b, a) { - var c = a.getNumberField("PORT"), d = a.getNumberField("DEGREE"); - Entry.hw.sendQueue["OUT" + c] = d; - 3 === c && (c = 4); - Entry.hw.sendQueue.OPT |= c; - return a.callReturn(); +Entry.block.neobot_set_servo = function(a, b) { + a = b.getNumberField("PORT"); + var c = b.getNumberField("DEGREE"); + Entry.hw.sendQueue["OUT" + a] = c; + 3 === a && (a = 4); + Entry.hw.sendQueue.OPT |= a; + return b.callReturn(); }; Blockly.Blocks.neobot_set_output = {init:function() { this.setColour("#00979D"); @@ -4358,13 +4748,14 @@ Blockly.Blocks.neobot_set_output = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.neobot_set_output = function(b, a) { - var c = a.getStringField("PORT", a), d = a.getNumberValue("VALUE", a), e = c; - 0 > d ? d = 0 : 255 < d && (d = 255); - 3 === e && (e = 4); - Entry.hw.sendQueue["OUT" + c] = d; - Entry.hw.sendQueue.OPT &= ~e; - return a.callReturn(); +Entry.block.neobot_set_output = function(a, b) { + a = b.getStringField("PORT", b); + var c = b.getNumberValue("VALUE", b), d = a; + 0 > c ? c = 0 : 255 < c && (c = 255); + 3 === d && (d = 4); + Entry.hw.sendQueue["OUT" + a] = c; + Entry.hw.sendQueue.OPT &= ~d; + return b.callReturn(); }; Blockly.Blocks.neobot_set_fnd = {init:function() { this.setColour("#00979D"); @@ -4375,11 +4766,11 @@ Blockly.Blocks.neobot_set_fnd = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.neobot_set_fnd = function(b, a) { - var c = a.getNumberValue("VALUE", a); - 255 < c ? c = 255 : 0 > c && (c = 0); - Entry.hw.sendQueue.FND = c; - return a.callReturn(); +Entry.block.neobot_set_fnd = function(a, b) { + a = b.getNumberValue("VALUE", b); + 255 < a ? a = 255 : 0 > a && (a = 0); + Entry.hw.sendQueue.FND = a; + return b.callReturn(); }; Blockly.Blocks.neobot_play_note_for = {init:function() { this.setColour("#00979D"); @@ -4390,27 +4781,27 @@ Blockly.Blocks.neobot_play_note_for = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.neobot_play_note_for = function(b, a) { - var c = Entry.hw.sendQueue; - if (a.isStart) { - if (1 == a.timeFlag) { - return a; +Entry.block.neobot_play_note_for = function(a, b) { + a = Entry.hw.sendQueue; + if (b.isStart) { + if (1 == b.timeFlag) { + return b; } - delete a.timeFlag; - delete a.isStart; + delete b.timeFlag; + delete b.isStart; Entry.hw.sendQueue.SND = 0; Entry.engine.isContinue = !1; - return a.callReturn(); + return b.callReturn(); } - var d = a.getNumberField("NOTE", a), e = a.getNumberField("OCTAVE", a), f = a.getNumberField("DURATION", a), d = d + 12 * e; - a.isStart = !0; - a.timeFlag = 1; - 65 < d && (d = 65); - c.SND = d; + var c = b.getNumberField("NOTE", b), d = b.getNumberField("OCTAVE", b), e = b.getNumberField("DURATION", b), c = c + 12 * d; + b.isStart = !0; + b.timeFlag = 1; + 65 < c && (c = 65); + a.SND = c; setTimeout(function() { - a.timeFlag = 0; - }, 1 / f * 2E3); - return a; + b.timeFlag = 0; + }, 1 / e * 2E3); + return b; }; Entry.Robotis_carCont = {INSTRUCTION:{NONE:0, WRITE:3, READ:2}, CONTROL_TABLE:{CM_LED:[67, 1], CM_SPRING_RIGHT:[69, 1, 69, 2], CM_SPRING_LEFT:[70, 1, 69, 2], CM_SWITCH:[71, 1], CM_SOUND_DETECTED:[86, 1], CM_SOUND_DETECTING:[87, 1], CM_IR_LEFT:[91, 2, 91, 4], CM_IR_RIGHT:[93, 2, 91, 4], CM_CALIBRATION_LEFT:[95, 2], CM_CALIBRATION_RIGHT:[97, 2], AUX_MOTOR_SPEED_LEFT:[152, 2], AUX_MOTOR_SPEED_RIGHT:[154, 2]}, setZero:function() { this.setRobotisData([[Entry.Robotis_carCont.INSTRUCTION.WRITE, 152, 2, 0], [Entry.Robotis_carCont.INSTRUCTION.WRITE, 154, 2, 0]]); @@ -4419,47 +4810,47 @@ Entry.Robotis_carCont = {INSTRUCTION:{NONE:0, WRITE:3, READ:2}, CONTROL_TABLE:{C this.setRobotisData(null); Entry.hw.sendQueue.setZero = null; this.update(); -}, name:"robotis_carCont", delay:40, postCallReturn:function(b, a, c) { +}, name:"robotis_carCont", delay:40, postCallReturn:function(a, b, c) { if (0 >= c) { - return this.setRobotisData(a), this.update(), b.callReturn(); + return this.setRobotisData(b), this.update(), a.callReturn(); } - if (b.isStart) { - if (1 == b.timeFlag) { - return this.setRobotisData(null), b; + if (a.isStart) { + if (1 == a.timeFlag) { + return this.setRobotisData(null), a; } - delete b.timeFlag; - delete b.isStart; + delete a.timeFlag; + delete a.isStart; Entry.engine.isContinue = !1; this.update(); - return b.callReturn(); + return a.callReturn(); } - b.isStart = !0; - b.timeFlag = 1; - this.setRobotisData(a); + a.isStart = !0; + a.timeFlag = 1; + this.setRobotisData(b); setTimeout(function() { - b.timeFlag = 0; + a.timeFlag = 0; }, c); - return b; -}, wait:function(b, a) { - Entry.hw.socket.send(JSON.stringify(b)); - for (var c = (new Date).getTime(), d = c;d < c + a;) { - d = (new Date).getTime(); + return a; +}, wait:function(a, b) { + Entry.hw.socket.send(JSON.stringify(a)); + for (var c = a = (new Date).getTime();c < a + b;) { + c = (new Date).getTime(); } }, update:function() { Entry.hw.update(); - var b = Entry.hw.sendQueue.ROBOTIS_DATA; - b && b.forEach(function(a) { - a.send = !0; + var a = Entry.hw.sendQueue.ROBOTIS_DATA; + a && a.forEach(function(b) { + b.send = !0; }); this.setRobotisData(null); }, filterSendData:function() { - var b = Entry.hw.sendQueue.ROBOTIS_DATA; - return b ? b.filter(function(a) { - return !0 !== a.send; + var a = Entry.hw.sendQueue.ROBOTIS_DATA; + return a ? a.filter(function(b) { + return !0 !== b.send; }) : null; -}, setRobotisData:function(b) { - var a = this.filterSendData(); - Entry.hw.sendQueue.ROBOTIS_DATA = null == b ? a : a ? a.concat(b) : b; +}, setRobotisData:function(a) { + var b = this.filterSendData(); + Entry.hw.sendQueue.ROBOTIS_DATA = null == a ? b : b ? b.concat(a) : a; }}; Entry.Robotis_openCM70 = {INSTRUCTION:{NONE:0, WRITE:3, READ:2}, CONTROL_TABLE:{CM_LED_R:[79, 1], CM_LED_G:[80, 1], CM_LED_B:[81, 1], CM_BUZZER_INDEX:[84, 1], CM_BUZZER_TIME:[85, 1], CM_SOUND_DETECTED:[86, 1], CM_SOUND_DETECTING:[87, 1], CM_USER_BUTTON:[26, 1], CM_MOTION:[66, 1], AUX_SERVO_POSITION:[152, 2], AUX_IR:[168, 2], AUX_TOUCH:[202, 1], AUX_TEMPERATURE:[234, 1], AUX_ULTRASONIC:[242, 1], AUX_MAGNETIC:[250, 1], AUX_MOTION_DETECTION:[258, 1], AUX_COLOR:[266, 1], AUX_CUSTOM:[216, 2], AUX_BRIGHTNESS:[288, 2], AUX_HYDRO_THEMO_HUMIDITY:[274, 1], AUX_HYDRO_THEMO_TEMPER:[282, 1], AUX_SERVO_MODE:[126, 1], AUX_SERVO_SPEED:[136, 2], AUX_MOTOR_SPEED:[136, 2], AUX_LED_MODULE:[210, 1]}, setZero:function() { @@ -4482,13 +4873,14 @@ Blockly.Blocks.robotis_openCM70_cm_custom_value = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.robotis_openCM70_cm_custom_value = function(b, a) { - var c = Entry.Robotis_openCM70.INSTRUCTION.READ, d = 0, e = 0, f = 0, d = a.getStringField("SIZE"); - "BYTE" == d ? e = 1 : "WORD" == d ? e = 2 : "DWORD" == d && (e = 4); - f = d = a.getNumberValue("VALUE"); - Entry.Robotis_carCont.setRobotisData([[c, d, e, 0, e]]); +Entry.block.robotis_openCM70_cm_custom_value = function(a, b) { + a = Entry.Robotis_openCM70.INSTRUCTION.READ; + var c = 0, d = b.getStringField("SIZE"); + "BYTE" == d ? c = 1 : "WORD" == d ? c = 2 : "DWORD" == d && (c = 4); + b = b.getNumberValue("VALUE"); + Entry.Robotis_carCont.setRobotisData([[a, b, c, 0, c]]); Entry.Robotis_carCont.update(); - return Entry.hw.portData[f]; + return Entry.hw.portData[b]; }; Blockly.Blocks.robotis_openCM70_sensor_value = {init:function() { this.setColour("#00979D"); @@ -4498,20 +4890,22 @@ Blockly.Blocks.robotis_openCM70_sensor_value = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }, sensorList:function() { - var b = []; - b.push([Lang.Blocks.robotis_cm_sound_detected, "CM_SOUND_DETECTED"]); - b.push([Lang.Blocks.robotis_cm_sound_detecting, "CM_SOUND_DETECTING"]); - b.push([Lang.Blocks.robotis_cm_user_button, "CM_USER_BUTTON"]); - return b; + var a = []; + a.push([Lang.Blocks.robotis_cm_sound_detected, "CM_SOUND_DETECTED"]); + a.push([Lang.Blocks.robotis_cm_sound_detecting, "CM_SOUND_DETECTING"]); + a.push([Lang.Blocks.robotis_cm_user_button, "CM_USER_BUTTON"]); + return a; }}; -Entry.block.robotis_openCM70_sensor_value = function(b, a) { - var c = Entry.Robotis_openCM70.INSTRUCTION.READ, d = 0, e = 0, f = 0, g = 0, h = a.getStringField("SENSOR"); - "CM_SOUND_DETECTED" == h ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1], d = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1]) : "CM_SOUND_DETECTING" == h ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1], d = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0], - e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1]) : "CM_USER_BUTTON" == h && (f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1], d = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1]); - f += 0 * g; - Entry.Robotis_carCont.setRobotisData([[c, d, e, 0, g]]); +Entry.block.robotis_openCM70_sensor_value = function(a, b) { + a = Entry.Robotis_openCM70.INSTRUCTION.READ; + var c = 0, d = 0, e = 0, f = 0; + b = b.getStringField("SENSOR"); + "CM_SOUND_DETECTED" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1]) : "CM_SOUND_DETECTING" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0], + d = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1]) : "CM_USER_BUTTON" == b && (e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1]); + e += 0 * f; + Entry.Robotis_carCont.setRobotisData([[a, c, d, 0, f]]); Entry.Robotis_carCont.update(); - return Entry.hw.portData[f]; + return Entry.hw.portData[e]; }; Blockly.Blocks.robotis_openCM70_aux_sensor_value = {init:function() { this.setColour("#00979D"); @@ -4523,43 +4917,46 @@ Blockly.Blocks.robotis_openCM70_aux_sensor_value = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }, portList:function() { - var b = []; - b.push([Lang.Blocks.robotis_common_port_3, "PORT_3"]); - b.push([Lang.Blocks.robotis_common_port_4, "PORT_4"]); - b.push([Lang.Blocks.robotis_common_port_5, "PORT_5"]); - b.push([Lang.Blocks.robotis_common_port_6, "PORT_6"]); - return b; + var a = []; + a.push([Lang.Blocks.robotis_common_port_3, "PORT_3"]); + a.push([Lang.Blocks.robotis_common_port_4, "PORT_4"]); + a.push([Lang.Blocks.robotis_common_port_5, "PORT_5"]); + a.push([Lang.Blocks.robotis_common_port_6, "PORT_6"]); + return a; }, sensorList:function() { - var b = []; - b.push([Lang.Blocks.robotis_aux_servo_position, "AUX_SERVO_POSITION"]); - b.push([Lang.Blocks.robotis_aux_ir, "AUX_IR"]); - b.push([Lang.Blocks.robotis_aux_touch, "AUX_TOUCH"]); - b.push([Lang.Blocks.robotis_aux_brightness, "AUX_BRIGHTNESS"]); - b.push([Lang.Blocks.robotis_aux_hydro_themo_humidity, "AUX_HYDRO_THEMO_HUMIDITY"]); - b.push([Lang.Blocks.robotis_aux_hydro_themo_temper, "AUX_HYDRO_THEMO_TEMPER"]); - b.push([Lang.Blocks.robotis_aux_temperature, "AUX_TEMPERATURE"]); - b.push([Lang.Blocks.robotis_aux_ultrasonic, "AUX_ULTRASONIC"]); - b.push([Lang.Blocks.robotis_aux_magnetic, "AUX_MAGNETIC"]); - b.push([Lang.Blocks.robotis_aux_motion_detection, "AUX_MOTION_DETECTION"]); - b.push([Lang.Blocks.robotis_aux_color, "AUX_COLOR"]); - b.push([Lang.Blocks.robotis_aux_custom, "AUX_CUSTOM"]); - return b; + var a = []; + a.push([Lang.Blocks.robotis_aux_servo_position, "AUX_SERVO_POSITION"]); + a.push([Lang.Blocks.robotis_aux_ir, "AUX_IR"]); + a.push([Lang.Blocks.robotis_aux_touch, "AUX_TOUCH"]); + a.push([Lang.Blocks.robotis_aux_brightness, "AUX_BRIGHTNESS"]); + a.push([Lang.Blocks.robotis_aux_hydro_themo_humidity, "AUX_HYDRO_THEMO_HUMIDITY"]); + a.push([Lang.Blocks.robotis_aux_hydro_themo_temper, "AUX_HYDRO_THEMO_TEMPER"]); + a.push([Lang.Blocks.robotis_aux_temperature, "AUX_TEMPERATURE"]); + a.push([Lang.Blocks.robotis_aux_ultrasonic, "AUX_ULTRASONIC"]); + a.push([Lang.Blocks.robotis_aux_magnetic, "AUX_MAGNETIC"]); + a.push([Lang.Blocks.robotis_aux_motion_detection, "AUX_MOTION_DETECTION"]); + a.push([Lang.Blocks.robotis_aux_color, "AUX_COLOR"]); + a.push([Lang.Blocks.robotis_aux_custom, "AUX_CUSTOM"]); + return a; }}; -Entry.block.robotis_openCM70_aux_sensor_value = function(b, a) { - var c = Entry.Robotis_openCM70.INSTRUCTION.READ, d = 0, e = 0, f = 0, g = 0, h = a.getStringField("PORT"), k = a.getStringField("SENSOR"), l = 0; - "PORT_3" == h ? l = 2 : "PORT_4" == h ? l = 3 : "PORT_5" == h ? l = 4 : "PORT_6" == h && (l = 5); - "AUX_SERVO_POSITION" == k ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1]) : "AUX_IR" == k ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1]) : - "AUX_TOUCH" == k ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1]) : "AUX_TEMPERATURE" == k ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1]) : - "AUX_BRIGHTNESS" == k ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1]) : "AUX_HYDRO_THEMO_HUMIDITY" == k ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0], - e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1]) : "AUX_HYDRO_THEMO_TEMPER" == k ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1]) : "AUX_ULTRASONIC" == k ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1], - d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1]) : "AUX_MAGNETIC" == k ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1]) : "AUX_MOTION_DETECTION" == k ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1], - d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1]) : "AUX_COLOR" == k ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1]) : "AUX_CUSTOM" == k && (f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1], - d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1]); - f += l * g; - 0 != l && (e = 6 * g); - Entry.Robotis_carCont.setRobotisData([[c, d, e, 0, g]]); +Entry.block.robotis_openCM70_aux_sensor_value = function(a, b) { + a = Entry.Robotis_openCM70.INSTRUCTION.READ; + var c = 0, d = 0, e = 0, f = 0, g = b.getStringField("PORT"); + b = b.getStringField("SENSOR"); + var h = 0; + "PORT_3" == g ? h = 2 : "PORT_4" == g ? h = 3 : "PORT_5" == g ? h = 4 : "PORT_6" == g && (h = 5); + "AUX_SERVO_POSITION" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1]) : "AUX_IR" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1]) : + "AUX_TOUCH" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1]) : "AUX_TEMPERATURE" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1]) : + "AUX_BRIGHTNESS" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1]) : "AUX_HYDRO_THEMO_HUMIDITY" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0], + d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1]) : "AUX_HYDRO_THEMO_TEMPER" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1]) : "AUX_ULTRASONIC" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1], + c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1]) : "AUX_MAGNETIC" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1]) : "AUX_MOTION_DETECTION" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1], + c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1]) : "AUX_COLOR" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1]) : "AUX_CUSTOM" == b && (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1], + c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1]); + e += h * f; + 0 != h && (d = 6 * f); + Entry.Robotis_carCont.setRobotisData([[a, c, d, 0, f]]); Entry.Robotis_carCont.update(); - return Entry.hw.portData[f]; + return Entry.hw.portData[e]; }; Blockly.Blocks.robotis_openCM70_cm_buzzer_index = {init:function() { this.setColour("#00979D"); @@ -4576,12 +4973,14 @@ Blockly.Blocks.robotis_openCM70_cm_buzzer_index = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_openCM70_cm_buzzer_index = function(b, a) { - var c = a.getField("CM_BUZZER_INDEX", a), d = a.getNumberValue("CM_BUZZER_TIME", a), e = Entry.Robotis_openCM70.INSTRUCTION.WRITE, f = 0, g = 0, h = 0, k = 0, l = 0, f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[1], h = parseInt(10 * d); - 50 < h && (h = 50); - k = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[0]; - l = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[1]; - return Entry.Robotis_carCont.postCallReturn(a, [[e, f, g, h], [e, k, l, c]], 1E3 * d); +Entry.block.robotis_openCM70_cm_buzzer_index = function(a, b) { + a = b.getField("CM_BUZZER_INDEX", b); + var c = b.getNumberValue("CM_BUZZER_TIME", b), d = Entry.Robotis_openCM70.INSTRUCTION.WRITE, e, f, g; + e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[0]; + f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[1]; + g = parseInt(10 * c); + 50 < g && (g = 50); + return Entry.Robotis_carCont.postCallReturn(b, [[d, e, f, g], [d, Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[0], Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[1], a]], 1E3 * c); }; Blockly.Blocks.robotis_openCM70_cm_buzzer_melody = {init:function() { this.setColour("#00979D"); @@ -4594,9 +4993,10 @@ Blockly.Blocks.robotis_openCM70_cm_buzzer_melody = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_openCM70_cm_buzzer_melody = function(b, a) { - var c = a.getField("CM_BUZZER_MELODY", a), d = Entry.Robotis_openCM70.INSTRUCTION.WRITE, e = 0, f = 0, g = 0, h = 0, e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[1], g = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[0], h = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[1]; - return Entry.Robotis_carCont.postCallReturn(a, [[d, e, f, 255], [d, g, h, c]], 1E3); +Entry.block.robotis_openCM70_cm_buzzer_melody = function(a, b) { + a = b.getField("CM_BUZZER_MELODY", b); + var c = Entry.Robotis_openCM70.INSTRUCTION.WRITE; + return Entry.Robotis_carCont.postCallReturn(b, [[c, Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[0], Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[1], 255], [c, Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[0], Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[1], a]], 1E3); }; Blockly.Blocks.robotis_openCM70_cm_sound_detected_clear = {init:function() { this.setColour("#00979D"); @@ -4605,9 +5005,8 @@ Blockly.Blocks.robotis_openCM70_cm_sound_detected_clear = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_openCM70_cm_sound_detected_clear = function(b, a) { - var c = Entry.Robotis_openCM70.INSTRUCTION.WRITE, d = 0, e = 0, d = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1]; - return Entry.Robotis_carCont.postCallReturn(a, [[c, d, e, 0]], Entry.Robotis_openCM70.delay); +Entry.block.robotis_openCM70_cm_sound_detected_clear = function(a, b) { + return Entry.Robotis_carCont.postCallReturn(b, [[Entry.Robotis_openCM70.INSTRUCTION.WRITE, Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0], Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1], 0]], Entry.Robotis_openCM70.delay); }; Blockly.Blocks.robotis_openCM70_cm_led = {init:function() { this.setColour("#00979D"); @@ -4617,10 +5016,11 @@ Blockly.Blocks.robotis_openCM70_cm_led = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_openCM70_cm_led = function(b, a) { - var c = a.getField("CM_LED", a), d = a.getField("VALUE", a), e = Entry.Robotis_openCM70.INSTRUCTION.WRITE, f = 0, g = 0; - "CM_LED_R" == c ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_R[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_R[1]) : "CM_LED_G" == c ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_G[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_G[1]) : "CM_LED_B" == c && (f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_B[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_B[1]); - return Entry.Robotis_carCont.postCallReturn(a, [[e, f, g, d]], Entry.Robotis_openCM70.delay); +Entry.block.robotis_openCM70_cm_led = function(a, b) { + a = b.getField("CM_LED", b); + var c = b.getField("VALUE", b), d = Entry.Robotis_openCM70.INSTRUCTION.WRITE, e = 0, f = 0; + "CM_LED_R" == a ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_R[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_R[1]) : "CM_LED_G" == a ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_G[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_G[1]) : "CM_LED_B" == a && (e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_B[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_B[1]); + return Entry.Robotis_carCont.postCallReturn(b, [[d, e, f, c]], Entry.Robotis_openCM70.delay); }; Blockly.Blocks.robotis_openCM70_cm_motion = {init:function() { this.setColour("#00979D"); @@ -4632,9 +5032,13 @@ Blockly.Blocks.robotis_openCM70_cm_motion = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_openCM70_cm_motion = function(b, a) { - var c = Entry.Robotis_openCM70.INSTRUCTION.WRITE, d = 0, e = 0, f = 0, d = Entry.Robotis_openCM70.CONTROL_TABLE.CM_MOTION[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_MOTION[1], f = a.getNumberValue("VALUE", a); - return Entry.Robotis_carCont.postCallReturn(a, [[c, d, e, f]], Entry.Robotis_openCM70.delay); +Entry.block.robotis_openCM70_cm_motion = function(a, b) { + a = Entry.Robotis_openCM70.INSTRUCTION.WRITE; + var c, d, e; + c = Entry.Robotis_openCM70.CONTROL_TABLE.CM_MOTION[0]; + d = Entry.Robotis_openCM70.CONTROL_TABLE.CM_MOTION[1]; + e = b.getNumberValue("VALUE", b); + return Entry.Robotis_carCont.postCallReturn(b, [[a, c, d, e]], Entry.Robotis_openCM70.delay); }; Blockly.Blocks.robotis_openCM70_aux_motor_speed = {init:function() { this.setColour("#00979D"); @@ -4645,10 +5049,13 @@ Blockly.Blocks.robotis_openCM70_aux_motor_speed = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_openCM70_aux_motor_speed = function(b, a) { - var c = a.getField("PORT", a), d = a.getField("DIRECTION_ANGLE", a), e = a.getNumberValue("VALUE"), f = Entry.Robotis_openCM70.INSTRUCTION.WRITE, g = 0, h = 0, g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTOR_SPEED[0], h = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTOR_SPEED[1]; - "CW" == d ? (e += 1024, 2047 < e && (e = 2047)) : 1023 < e && (e = 1023); - return Entry.Robotis_carCont.postCallReturn(a, [[f, g + (c - 1) * h, h, e]], Entry.Robotis_openCM70.delay); +Entry.block.robotis_openCM70_aux_motor_speed = function(a, b) { + a = b.getField("PORT", b); + var c = b.getField("DIRECTION_ANGLE", b), d = b.getNumberValue("VALUE"), e = Entry.Robotis_openCM70.INSTRUCTION.WRITE, f, g; + f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTOR_SPEED[0]; + g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTOR_SPEED[1]; + "CW" == c ? (d += 1024, 2047 < d && (d = 2047)) : 1023 < d && (d = 1023); + return Entry.Robotis_carCont.postCallReturn(b, [[e, f + (a - 1) * g, g, d]], Entry.Robotis_openCM70.delay); }; Blockly.Blocks.robotis_openCM70_aux_servo_mode = {init:function() { this.setColour("#00979D"); @@ -4658,9 +5065,12 @@ Blockly.Blocks.robotis_openCM70_aux_servo_mode = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_openCM70_aux_servo_mode = function(b, a) { - var c = a.getField("PORT", a), d = a.getField("MODE", a), e = Entry.Robotis_openCM70.INSTRUCTION.WRITE, f = 0, g = 0, f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_MODE[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_MODE[1]; - return Entry.Robotis_carCont.postCallReturn(a, [[e, f + (c - 1) * g, g, d]], Entry.Robotis_openCM70.delay); +Entry.block.robotis_openCM70_aux_servo_mode = function(a, b) { + a = b.getField("PORT", b); + var c = b.getField("MODE", b), d = Entry.Robotis_openCM70.INSTRUCTION.WRITE, e, f; + e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_MODE[0]; + f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_MODE[1]; + return Entry.Robotis_carCont.postCallReturn(b, [[d, e + (a - 1) * f, f, c]], Entry.Robotis_openCM70.delay); }; Blockly.Blocks.robotis_openCM70_aux_servo_speed = {init:function() { this.setColour("#00979D"); @@ -4671,10 +5081,13 @@ Blockly.Blocks.robotis_openCM70_aux_servo_speed = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_openCM70_aux_servo_speed = function(b, a) { - var c = a.getField("PORT", a), d = a.getField("DIRECTION_ANGLE", a), e = a.getNumberValue("VALUE"), f = Entry.Robotis_openCM70.INSTRUCTION.WRITE, g = 0, h = 0, g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_SPEED[0], h = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_SPEED[1]; - "CW" == d ? (e += 1024, 2047 < e && (e = 2047)) : 1023 < e && (e = 1023); - return Entry.Robotis_carCont.postCallReturn(a, [[f, g + (c - 1) * h, h, e]], Entry.Robotis_openCM70.delay); +Entry.block.robotis_openCM70_aux_servo_speed = function(a, b) { + a = b.getField("PORT", b); + var c = b.getField("DIRECTION_ANGLE", b), d = b.getNumberValue("VALUE"), e = Entry.Robotis_openCM70.INSTRUCTION.WRITE, f, g; + f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_SPEED[0]; + g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_SPEED[1]; + "CW" == c ? (d += 1024, 2047 < d && (d = 2047)) : 1023 < d && (d = 1023); + return Entry.Robotis_carCont.postCallReturn(b, [[e, f + (a - 1) * g, g, d]], Entry.Robotis_openCM70.delay); }; Blockly.Blocks.robotis_openCM70_aux_servo_position = {init:function() { this.setColour("#00979D"); @@ -4685,10 +5098,13 @@ Blockly.Blocks.robotis_openCM70_aux_servo_position = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_openCM70_aux_servo_position = function(b, a) { - var c = a.getField("PORT", a), d = a.getNumberValue("VALUE"), e = Entry.Robotis_openCM70.INSTRUCTION.WRITE, f = 0, g = 0, f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1]; - 1023 < d ? d = 1023 : 0 > d && (d = 0); - return Entry.Robotis_carCont.postCallReturn(a, [[e, f + (c - 1) * g, g, d]], Entry.Robotis_openCM70.delay); +Entry.block.robotis_openCM70_aux_servo_position = function(a, b) { + a = b.getField("PORT", b); + var c = b.getNumberValue("VALUE"), d = Entry.Robotis_openCM70.INSTRUCTION.WRITE, e, f; + e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0]; + f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1]; + 1023 < c ? c = 1023 : 0 > c && (c = 0); + return Entry.Robotis_carCont.postCallReturn(b, [[d, e + (a - 1) * f, f, c]], Entry.Robotis_openCM70.delay); }; Blockly.Blocks.robotis_openCM70_aux_led_module = {init:function() { this.setColour("#00979D"); @@ -4699,9 +5115,12 @@ Blockly.Blocks.robotis_openCM70_aux_led_module = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_openCM70_aux_led_module = function(b, a) { - var c = a.getField("PORT", a), d = a.getField("LED_MODULE", a), e = Entry.Robotis_openCM70.INSTRUCTION.WRITE, f = 0, g = 0, f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[1]; - return Entry.Robotis_carCont.postCallReturn(a, [[e, f + (c - 1) * g, g, d]], Entry.Robotis_openCM70.delay); +Entry.block.robotis_openCM70_aux_led_module = function(a, b) { + a = b.getField("PORT", b); + var c = b.getField("LED_MODULE", b), d = Entry.Robotis_openCM70.INSTRUCTION.WRITE, e, f; + e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[0]; + f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[1]; + return Entry.Robotis_carCont.postCallReturn(b, [[d, e + (a - 1) * f, f, c]], Entry.Robotis_openCM70.delay); }; Blockly.Blocks.robotis_openCM70_aux_custom = {init:function() { this.setColour("#00979D"); @@ -4712,9 +5131,12 @@ Blockly.Blocks.robotis_openCM70_aux_custom = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_openCM70_aux_custom = function(b, a) { - var c = a.getField("PORT", a), d = a.getNumberValue("VALUE"), e = Entry.Robotis_openCM70.INSTRUCTION.WRITE, f = 0, g = 0, f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1]; - return Entry.Robotis_carCont.postCallReturn(a, [[e, f + (c - 1) * g, g, d]], Entry.Robotis_openCM70.delay); +Entry.block.robotis_openCM70_aux_custom = function(a, b) { + a = b.getField("PORT", b); + var c = b.getNumberValue("VALUE"), d = Entry.Robotis_openCM70.INSTRUCTION.WRITE, e, f; + e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0]; + f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1]; + return Entry.Robotis_carCont.postCallReturn(b, [[d, e + (a - 1) * f, f, c]], Entry.Robotis_openCM70.delay); }; Blockly.Blocks.robotis_openCM70_cm_custom = {init:function() { this.setColour("#00979D"); @@ -4729,9 +5151,12 @@ Blockly.Blocks.robotis_openCM70_cm_custom = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_openCM70_cm_custom = function(b, a) { - var c = Entry.Robotis_openCM70.INSTRUCTION.WRITE, d = 0, e = 0, d = a.getNumberValue("ADDRESS"), e = a.getNumberValue("VALUE"); - return Entry.Robotis_carCont.postCallReturn(a, [[c, d, 65535 < e ? 4 : 255 < e ? 2 : 1, e]], Entry.Robotis_openCM70.delay); +Entry.block.robotis_openCM70_cm_custom = function(a, b) { + a = Entry.Robotis_openCM70.INSTRUCTION.WRITE; + var c, d; + c = b.getNumberValue("ADDRESS"); + d = b.getNumberValue("VALUE"); + return Entry.Robotis_carCont.postCallReturn(b, [[a, c, 65535 < d ? 4 : 255 < d ? 2 : 1, d]], Entry.Robotis_openCM70.delay); }; Blockly.Blocks.robotis_carCont_sensor_value = {init:function() { this.setColour("#00979D"); @@ -4740,17 +5165,19 @@ Blockly.Blocks.robotis_carCont_sensor_value = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.robotis_carCont_sensor_value = function(b, a) { - var c = Entry.Robotis_carCont.INSTRUCTION.READ, d = 0, e = 0, f = 0, g = 0, h = a.getStringField("SENSOR"); - "CM_SPRING_LEFT" == h ? (f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[0], g = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[1], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[2], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[3]) : "CM_SPRING_RIGHT" == h ? (f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[0], g = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[1], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[2], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[3]) : - "CM_SWITCH" == h ? (f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[0], g = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[1], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[0], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[1]) : "CM_SOUND_DETECTED" == h ? (f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[0], g = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[1], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[0], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[1]) : - "CM_SOUND_DETECTING" == h ? (f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[0], g = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[1], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[0], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[1]) : "CM_IR_LEFT" == h ? (f = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[0], g = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[1], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[2], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[3]) : - "CM_IR_RIGHT" == h ? (f = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[0], g = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[1], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[2], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[3]) : "CM_CALIBRATION_LEFT" == h ? (f = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[0], g = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[1], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[0], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[1]) : - "CM_CALIBRATION_RIGHT" == h ? (f = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[0], g = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[1], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[0], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[1]) : "CM_BUTTON_STATUS" == h && (f = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[0], g = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[1], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[0], - e = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[1]); - Entry.Robotis_carCont.setRobotisData([[c, d, e, 0, g]]); +Entry.block.robotis_carCont_sensor_value = function(a, b) { + a = Entry.Robotis_carCont.INSTRUCTION.READ; + var c = 0, d = 0, e = 0, f = 0; + b = b.getStringField("SENSOR"); + "CM_SPRING_LEFT" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[2], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[3]) : "CM_SPRING_RIGHT" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[2], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[3]) : + "CM_SWITCH" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[0], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[1]) : "CM_SOUND_DETECTED" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[0], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[1]) : + "CM_SOUND_DETECTING" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[0], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[1]) : "CM_IR_LEFT" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[2], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[3]) : + "CM_IR_RIGHT" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[2], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[3]) : "CM_CALIBRATION_LEFT" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[0], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[1]) : + "CM_CALIBRATION_RIGHT" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[0], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[1]) : "CM_BUTTON_STATUS" == b && (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[0], + d = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[1]); + Entry.Robotis_carCont.setRobotisData([[a, c, d, 0, f]]); Entry.Robotis_carCont.update(); - return Entry.hw.portData[f]; + return Entry.hw.portData[e]; }; Blockly.Blocks.robotis_carCont_cm_led = {init:function() { this.setColour("#00979D"); @@ -4759,11 +5186,14 @@ Blockly.Blocks.robotis_carCont_cm_led = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_carCont_cm_led = function(b, a) { - var c = a.getField("VALUE_LEFT", a), d = a.getField("VALUE_RIGHT", a), e = Entry.Robotis_carCont.INSTRUCTION.WRITE, f = 0, g = 0, h = 0, f = Entry.Robotis_carCont.CONTROL_TABLE.CM_LED[0], g = Entry.Robotis_carCont.CONTROL_TABLE.CM_LED[1]; - 1 == c && 1 == d ? h = 9 : 1 == c && 0 == d && (h = 8); - 0 == c && 1 == d && (h = 1); - return Entry.Robotis_carCont.postCallReturn(a, [[e, f, g, h]], Entry.Robotis_carCont.delay); +Entry.block.robotis_carCont_cm_led = function(a, b) { + a = b.getField("VALUE_LEFT", b); + var c = b.getField("VALUE_RIGHT", b), d = Entry.Robotis_carCont.INSTRUCTION.WRITE, e, f, g = 0; + e = Entry.Robotis_carCont.CONTROL_TABLE.CM_LED[0]; + f = Entry.Robotis_carCont.CONTROL_TABLE.CM_LED[1]; + 1 == a && 1 == c ? g = 9 : 1 == a && 0 == c && (g = 8); + 0 == a && 1 == c && (g = 1); + return Entry.Robotis_carCont.postCallReturn(b, [[d, e, f, g]], Entry.Robotis_carCont.delay); }; Blockly.Blocks.robotis_carCont_cm_sound_detected_clear = {init:function() { this.setColour("#00979D"); @@ -4772,9 +5202,8 @@ Blockly.Blocks.robotis_carCont_cm_sound_detected_clear = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_carCont_cm_sound_detected_clear = function(b, a) { - var c = Entry.Robotis_carCont.INSTRUCTION.WRITE, d = 0, e = 0, d = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[0], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[1]; - return Entry.Robotis_carCont.postCallReturn(a, [[c, d, e, 0]], Entry.Robotis_carCont.delay); +Entry.block.robotis_carCont_cm_sound_detected_clear = function(a, b) { + return Entry.Robotis_carCont.postCallReturn(b, [[Entry.Robotis_carCont.INSTRUCTION.WRITE, Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[0], Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[1], 0]], Entry.Robotis_carCont.delay); }; Blockly.Blocks.robotis_carCont_aux_motor_speed = {init:function() { this.setColour("#00979D"); @@ -4785,11 +5214,13 @@ Blockly.Blocks.robotis_carCont_aux_motor_speed = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_carCont_aux_motor_speed = function(b, a) { - var c = a.getField("DIRECTION", a), d = a.getField("DIRECTION_ANGLE", a), e = a.getNumberValue("VALUE"), f = Entry.Robotis_carCont.INSTRUCTION.WRITE, g = 0, h = 0; - "LEFT" == c ? (g = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_LEFT[0], h = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_LEFT[1]) : (g = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_RIGHT[0], h = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_RIGHT[1]); - "CW" == d ? (e += 1024, 2047 < e && (e = 2047)) : 1023 < e && (e = 1023); - return Entry.Robotis_carCont.postCallReturn(a, [[f, g, h, e]], Entry.Robotis_carCont.delay); +Entry.block.robotis_carCont_aux_motor_speed = function(a, b) { + var c = b.getField("DIRECTION", b); + a = b.getField("DIRECTION_ANGLE", b); + var d = b.getNumberValue("VALUE"), e = Entry.Robotis_carCont.INSTRUCTION.WRITE, f; + "LEFT" == c ? (c = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_LEFT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_LEFT[1]) : (c = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_RIGHT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_RIGHT[1]); + "CW" == a ? (d += 1024, 2047 < d && (d = 2047)) : 1023 < d && (d = 1023); + return Entry.Robotis_carCont.postCallReturn(b, [[e, c, f, d]], Entry.Robotis_carCont.delay); }; Blockly.Blocks.robotis_carCont_cm_calibration = {init:function() { this.setColour("#00979D"); @@ -4800,10 +5231,12 @@ Blockly.Blocks.robotis_carCont_cm_calibration = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_carCont_cm_calibration = function(b, a) { - var c = a.getField("DIRECTION", a), d = a.getNumberValue("VALUE"), e = Entry.Robotis_carCont.INSTRUCTION.WRITE, f = 0, g = 0; - "LEFT" == c ? (f = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[0], g = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[1]) : (f = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[0], g = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[1]); - return Entry.Robotis_carCont.postCallReturn(a, [[e, f, g, d]], Entry.Robotis_carCont.delay); +Entry.block.robotis_carCont_cm_calibration = function(a, b) { + var c = b.getField("DIRECTION", b); + a = b.getNumberValue("VALUE"); + var d = Entry.Robotis_carCont.INSTRUCTION.WRITE, e; + "LEFT" == c ? (c = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[0], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[1]) : (c = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[0], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[1]); + return Entry.Robotis_carCont.postCallReturn(b, [[d, c, e, a]], Entry.Robotis_carCont.delay); }; Blockly.Blocks.when_scene_start = {init:function() { this.setColour("#3BBD70"); @@ -4811,8 +5244,8 @@ Blockly.Blocks.when_scene_start = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); }}; -Entry.block.when_scene_start = function(b, a) { - return a.callReturn(); +Entry.block.when_scene_start = function(a, b) { + return b.callReturn(); }; Blockly.Blocks.start_scene = {init:function() { this.setColour("#3BBD70"); @@ -4821,10 +5254,10 @@ Blockly.Blocks.start_scene = {init:function() { this.setInputsInline(!0); this.setPreviousStatement(!0); }}; -Entry.block.start_scene = function(b, a) { - var c = a.getField("VALUE", a); - if (c = Entry.scene.getSceneById(c)) { - Entry.scene.selectScene(c), Entry.engine.fireEvent("when_scene_start"); +Entry.block.start_scene = function(a, b) { + a = b.getField("VALUE", b); + if (a = Entry.scene.getSceneById(a)) { + Entry.scene.selectScene(a), Entry.engine.fireEvent("when_scene_start"); } return null; }; @@ -4835,9 +5268,11 @@ Blockly.Blocks.start_neighbor_scene = {init:function() { this.setInputsInline(!0); this.setPreviousStatement(!0); }}; -Entry.block.start_neighbor_scene = function(b, a) { - var c = Entry.scene.selectedScene, d = Entry.scene.getScenes(), c = d.indexOf(c); - "next" == a.getField("OPERATOR", a) ? c + 1 < d.length && (d = Entry.scene.getSceneById(d[c + 1].id)) && (Entry.scene.selectScene(d), Entry.engine.fireEvent("when_scene_start")) : 0 < c && (d = Entry.scene.getSceneById(d[c - 1].id)) && (Entry.scene.selectScene(d), Entry.engine.fireEvent("when_scene_start")); +Entry.block.start_neighbor_scene = function(a, b) { + var c = Entry.scene.selectedScene; + a = Entry.scene.getScenes(); + c = a.indexOf(c); + "next" == b.getField("OPERATOR", b) ? c + 1 < a.length && (b = Entry.scene.getSceneById(a[c + 1].id)) && (Entry.scene.selectScene(b), Entry.engine.fireEvent("when_scene_start")) : 0 < c && (b = Entry.scene.getSceneById(a[c - 1].id)) && (Entry.scene.selectScene(b), Entry.engine.fireEvent("when_scene_start")); return null; }; Blockly.Blocks.sound_something = {init:function() { @@ -4849,10 +5284,10 @@ Blockly.Blocks.sound_something = {init:function() { this.setNextStatement(!0); this.setPreviousStatement(!0); }}; -Entry.block.sound_something = function(b, a) { - var c = a.getField("VALUE", a); - Entry.isExist(c, "id", b.parent.sounds) && createjs.Sound.play(c); - return a.callReturn(); +Entry.block.sound_something = function(a, b) { + var c = b.getField("VALUE", b); + Entry.isExist(c, "id", a.parent.sounds) && createjs.Sound.play(c); + return b.callReturn(); }; Blockly.Blocks.sound_something_second = {init:function() { this.setColour("#A4D01D"); @@ -4865,15 +5300,15 @@ Blockly.Blocks.sound_something_second = {init:function() { this.setNextStatement(!0); this.setPreviousStatement(!0); }}; -Entry.block.sound_something_second = function(b, a) { - var c = a.getField("VALUE", a), d = a.getNumberValue("SECOND", a); - if (Entry.isExist(c, "id", b.parent.sounds)) { +Entry.block.sound_something_second = function(a, b) { + var c = b.getField("VALUE", b), d = b.getNumberValue("SECOND", b); + if (Entry.isExist(c, "id", a.parent.sounds)) { var e = createjs.Sound.play(c); setTimeout(function() { e.stop(); }, 1E3 * d); } - return a.callReturn(); + return b.callReturn(); }; Blockly.Blocks.sound_something_wait = {init:function() { this.setColour("#A4D01D"); @@ -4884,22 +5319,22 @@ Blockly.Blocks.sound_something_wait = {init:function() { this.setNextStatement(!0); this.setPreviousStatement(!0); }}; -Entry.block.sound_something_wait = function(b, a) { - if (a.isPlay) { - if (1 == a.playState) { - return a; +Entry.block.sound_something_wait = function(a, b) { + if (b.isPlay) { + if (1 == b.playState) { + return b; } - delete a.playState; - delete a.isPlay; - return a.callReturn(); + delete b.playState; + delete b.isPlay; + return b.callReturn(); } - a.isPlay = !0; - a.playState = 1; - var c = a.getField("VALUE", a), d = b.parent.getSound(c); - Entry.isExist(c, "id", b.parent.sounds) && (createjs.Sound.play(c), setTimeout(function() { - a.playState = 0; + b.isPlay = !0; + b.playState = 1; + var c = b.getField("VALUE", b), d = a.parent.getSound(c); + Entry.isExist(c, "id", a.parent.sounds) && (createjs.Sound.play(c), setTimeout(function() { + b.playState = 0; }, 1E3 * d.duration)); - return a; + return b; }; Blockly.Blocks.sound_something_second_wait = {init:function() { this.setColour("#A4D01D"); @@ -4912,28 +5347,29 @@ Blockly.Blocks.sound_something_second_wait = {init:function() { this.setNextStatement(!0); this.setPreviousStatement(!0); }}; -Entry.block.sound_something_second_wait = function(b, a) { - if (a.isPlay) { - if (1 == a.playState) { - return a; +Entry.block.sound_something_second_wait = function(a, b) { + if (b.isPlay) { + if (1 == b.playState) { + return b; } - delete a.isPlay; - delete a.playState; - return a.callReturn(); + delete b.isPlay; + delete b.playState; + return b.callReturn(); } - a.isPlay = !0; - a.playState = 1; - var c = a.getField("VALUE", a); - if (Entry.isExist(c, "id", b.parent.sounds)) { - var d = createjs.Sound.play(c), c = a.getNumberValue("SECOND", a); + b.isPlay = !0; + b.playState = 1; + var c = b.getField("VALUE", b); + if (Entry.isExist(c, "id", a.parent.sounds)) { + var d = createjs.Sound.play(c); + a = b.getNumberValue("SECOND", b); setTimeout(function() { d.stop(); - a.playState = 0; - }, 1E3 * c); - d.addEventListener("complete", function(a) { + b.playState = 0; + }, 1E3 * a); + d.addEventListener("complete", function(b) { }); } - return a; + return b; }; Blockly.Blocks.sound_volume_change = {init:function() { this.setColour("#A4D01D"); @@ -4944,12 +5380,13 @@ Blockly.Blocks.sound_volume_change = {init:function() { this.setNextStatement(!0); this.setPreviousStatement(!0); }}; -Entry.block.sound_volume_change = function(b, a) { - var c = a.getNumberValue("VALUE", a) / 100, c = c + createjs.Sound.getVolume(); - 1 < c && (c = 1); - 0 > c && (c = 0); - createjs.Sound.setVolume(c); - return a.callReturn(); +Entry.block.sound_volume_change = function(a, b) { + a = b.getNumberValue("VALUE", b) / 100; + a += createjs.Sound.getVolume(); + 1 < a && (a = 1); + 0 > a && (a = 0); + createjs.Sound.setVolume(a); + return b.callReturn(); }; Blockly.Blocks.sound_volume_set = {init:function() { this.setColour("#A4D01D"); @@ -4960,12 +5397,12 @@ Blockly.Blocks.sound_volume_set = {init:function() { this.setNextStatement(!0); this.setPreviousStatement(!0); }}; -Entry.block.sound_volume_set = function(b, a) { - var c = a.getNumberValue("VALUE", a) / 100; - 1 < c && (c = 1); - 0 > c && (c = 0); - createjs.Sound.setVolume(c); - return a.callReturn(); +Entry.block.sound_volume_set = function(a, b) { + a = b.getNumberValue("VALUE", b) / 100; + 1 < a && (a = 1); + 0 > a && (a = 0); + createjs.Sound.setVolume(a); + return b.callReturn(); }; Blockly.Blocks.sound_silent_all = {init:function() { this.setColour("#A4D01D"); @@ -4974,9 +5411,9 @@ Blockly.Blocks.sound_silent_all = {init:function() { this.setNextStatement(!0); this.setPreviousStatement(!0); }}; -Entry.block.sound_silent_all = function(b, a) { +Entry.block.sound_silent_all = function(a, b) { createjs.Sound.stop(); - return a.callReturn(); + return b.callReturn(); }; Blockly.Blocks.get_sounds = {init:function() { this.setColour("#A4D01D"); @@ -4986,8 +5423,8 @@ Blockly.Blocks.get_sounds = {init:function() { this.setOutput(!0, "String"); this.setInputsInline(!0); }}; -Entry.block.get_sounds = function(b, a) { - return a.getStringField("VALUE"); +Entry.block.get_sounds = function(a, b) { + return b.getStringField("VALUE"); }; Blockly.Blocks.sound_something_with_block = {init:function() { this.setColour("#A4D01D"); @@ -4998,10 +5435,10 @@ Blockly.Blocks.sound_something_with_block = {init:function() { this.setNextStatement(!0); this.setPreviousStatement(!0); }}; -Entry.block.sound_something_with_block = function(b, a) { - var c = a.getStringValue("VALUE", a); - (c = b.parent.getSound(c)) && createjs.Sound.play(c.id); - return a.callReturn(); +Entry.block.sound_something_with_block = function(a, b) { + var c = b.getStringValue("VALUE", b); + (a = a.parent.getSound(c)) && createjs.Sound.play(a.id); + return b.callReturn(); }; Blockly.Blocks.sound_something_second_with_block = {init:function() { this.setColour("#A4D01D"); @@ -5014,10 +5451,10 @@ Blockly.Blocks.sound_something_second_with_block = {init:function() { this.setNextStatement(!0); this.setPreviousStatement(!0); }}; -Entry.block.sound_something_second_with_block = function(b, a) { - var c = a.getStringValue("VALUE", a), d = a.getNumberValue("SECOND", a); - (c = b.parent.getSound(c)) && createjs.Sound.play(c.id, {startTime:0, duration:1E3 * d}); - return a.callReturn(); +Entry.block.sound_something_second_with_block = function(a, b) { + var c = b.getStringValue("VALUE", b), d = b.getNumberValue("SECOND", b); + (a = a.parent.getSound(c)) && createjs.Sound.play(a.id, {startTime:0, duration:1E3 * d}); + return b.callReturn(); }; Blockly.Blocks.sound_something_wait_with_block = {init:function() { this.setColour("#A4D01D"); @@ -5028,24 +5465,24 @@ Blockly.Blocks.sound_something_wait_with_block = {init:function() { this.setNextStatement(!0); this.setPreviousStatement(!0); }}; -Entry.block.sound_something_wait_with_block = function(b, a) { - if (a.isPlay) { - if (1 == a.playState) { - return a; +Entry.block.sound_something_wait_with_block = function(a, b) { + if (b.isPlay) { + if (1 == b.playState) { + return b; } - delete a.playState; - delete a.isPlay; - return a.callReturn(); + delete b.playState; + delete b.isPlay; + return b.callReturn(); } - a.isPlay = !0; - a.playState = 1; - var c = a.getStringValue("VALUE", a); - if (c = b.parent.getSound(c)) { - createjs.Sound.play(c.id), setTimeout(function() { - a.playState = 0; - }, 1E3 * c.duration); + b.isPlay = !0; + b.playState = 1; + var c = b.getStringValue("VALUE", b); + if (a = a.parent.getSound(c)) { + createjs.Sound.play(a.id), setTimeout(function() { + b.playState = 0; + }, 1E3 * a.duration); } - return a; + return b; }; Blockly.Blocks.sound_something_second_wait_with_block = {init:function() { this.setColour("#A4D01D"); @@ -5058,28 +5495,29 @@ Blockly.Blocks.sound_something_second_wait_with_block = {init:function() { this.setNextStatement(!0); this.setPreviousStatement(!0); }}; -Entry.block.sound_something_second_wait_with_block = function(b, a) { - if (a.isPlay) { - if (1 == a.playState) { - return a; +Entry.block.sound_something_second_wait_with_block = function(a, b) { + if (b.isPlay) { + if (1 == b.playState) { + return b; } - delete a.isPlay; - delete a.playState; - return a.callReturn(); + delete b.isPlay; + delete b.playState; + return b.callReturn(); } - a.isPlay = !0; - a.playState = 1; - var c = a.getStringValue("VALUE", a); - if (c = b.parent.getSound(c)) { - var d = createjs.Sound.play(c.id), c = a.getNumberValue("SECOND", a); + b.isPlay = !0; + b.playState = 1; + var c = b.getStringValue("VALUE", b); + if (a = a.parent.getSound(c)) { + var d = createjs.Sound.play(a.id); + a = b.getNumberValue("SECOND", b); setTimeout(function() { d.stop(); - a.playState = 0; - }, 1E3 * c); - d.addEventListener("complete", function(a) { + b.playState = 0; + }, 1E3 * a); + d.addEventListener("complete", function(b) { }); } - return a; + return b; }; Blockly.Blocks.sound_from_to = {init:function() { this.setColour("#A4D01D"); @@ -5094,13 +5532,13 @@ Blockly.Blocks.sound_from_to = {init:function() { this.setNextStatement(!0); this.setPreviousStatement(!0); }}; -Entry.block.sound_from_to = function(b, a) { - var c = a.getStringValue("VALUE", a); - if (c = b.parent.getSound(c)) { - var d = 1E3 * a.getNumberValue("START", a), e = 1E3 * a.getNumberValue("END", a); - createjs.Sound.play(c.id, {startTime:Math.min(d, e), duration:Math.max(d, e) - Math.min(d, e)}); +Entry.block.sound_from_to = function(a, b) { + var c = b.getStringValue("VALUE", b); + if (a = a.parent.getSound(c)) { + var c = 1E3 * b.getNumberValue("START", b), d = 1E3 * b.getNumberValue("END", b); + createjs.Sound.play(a.id, {startTime:Math.min(c, d), duration:Math.max(c, d) - Math.min(c, d)}); } - return a.callReturn(); + return b.callReturn(); }; Blockly.Blocks.sound_from_to_and_wait = {init:function() { this.setColour("#A4D01D"); @@ -5115,26 +5553,26 @@ Blockly.Blocks.sound_from_to_and_wait = {init:function() { this.setNextStatement(!0); this.setPreviousStatement(!0); }}; -Entry.block.sound_from_to_and_wait = function(b, a) { - if (a.isPlay) { - if (1 == a.playState) { - return a; +Entry.block.sound_from_to_and_wait = function(a, b) { + if (b.isPlay) { + if (1 == b.playState) { + return b; } - delete a.isPlay; - delete a.playState; - return a.callReturn(); + delete b.isPlay; + delete b.playState; + return b.callReturn(); } - a.isPlay = !0; - a.playState = 1; - var c = a.getStringValue("VALUE", a); - if (c = b.parent.getSound(c)) { - var d = 1E3 * a.getNumberValue("START", a), e = 1E3 * a.getNumberValue("END", a), f = Math.min(d, e), d = Math.max(d, e) - f; - createjs.Sound.play(c.id, {startTime:f, duration:d}); + b.isPlay = !0; + b.playState = 1; + var c = b.getStringValue("VALUE", b); + if (a = a.parent.getSound(c)) { + var d = 1E3 * b.getNumberValue("START", b), e = 1E3 * b.getNumberValue("END", b), c = Math.min(d, e), d = Math.max(d, e) - c; + createjs.Sound.play(a.id, {startTime:c, duration:d}); setTimeout(function() { - a.playState = 0; + b.playState = 0; }, d); } - return a; + return b; }; Blockly.Blocks.when_run_button_click = {init:function() { this.setColour("#3BBD70"); @@ -5142,8 +5580,8 @@ Blockly.Blocks.when_run_button_click = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); }}; -Entry.block.when_run_button_click = function(b, a) { - return a.callReturn(); +Entry.block.when_run_button_click = function(a, b) { + return b.callReturn(); }; Blockly.Blocks.press_some_key = {init:function() { this.setColour("#3BBD70"); @@ -5152,8 +5590,8 @@ Blockly.Blocks.press_some_key = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); }}; -Entry.block.press_some_key = function(b, a) { - return a.callReturn(); +Entry.block.press_some_key = function(a, b) { + return b.callReturn(); }; Blockly.Blocks.when_some_key_pressed = {init:function() { this.setColour("#3BBD70"); @@ -5161,8 +5599,8 @@ Blockly.Blocks.when_some_key_pressed = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); }}; -Entry.block.when_some_key_pressed = function(b, a) { - return a.callReturn(); +Entry.block.when_some_key_pressed = function(a, b) { + return b.callReturn(); }; Blockly.Blocks.mouse_clicked = {init:function() { this.setColour("#3BBD70"); @@ -5170,8 +5608,8 @@ Blockly.Blocks.mouse_clicked = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); }}; -Entry.block.mouse_clicked = function(b, a) { - return a.callReturn(); +Entry.block.mouse_clicked = function(a, b) { + return b.callReturn(); }; Blockly.Blocks.mouse_click_cancled = {init:function() { this.setColour("#3BBD70"); @@ -5179,8 +5617,8 @@ Blockly.Blocks.mouse_click_cancled = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); }}; -Entry.block.mouse_click_cancled = function(b, a) { - return a.callReturn(); +Entry.block.mouse_click_cancled = function(a, b) { + return b.callReturn(); }; Blockly.Blocks.when_object_click = {init:function() { this.setColour("#3BBD70"); @@ -5188,8 +5626,8 @@ Blockly.Blocks.when_object_click = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); }}; -Entry.block.when_object_click = function(b, a) { - return a.callReturn(); +Entry.block.when_object_click = function(a, b) { + return b.callReturn(); }; Blockly.Blocks.when_object_click_canceled = {init:function() { this.setColour("#3BBD70"); @@ -5197,8 +5635,8 @@ Blockly.Blocks.when_object_click_canceled = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); }}; -Entry.block.when_object_click_canceled = function(b, a) { - return a.callReturn(); +Entry.block.when_object_click_canceled = function(a, b) { + return b.callReturn(); }; Blockly.Blocks.when_some_key_click = {init:function() { this.setColour("#3BBD70"); @@ -5206,23 +5644,23 @@ Blockly.Blocks.when_some_key_click = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); }}; -Entry.block.when_some_key_click = function(b, a) { - return a.callReturn(); +Entry.block.when_some_key_click = function(a, b) { + return b.callReturn(); }; Blockly.Blocks.when_message_cast = {init:function() { this.setColour("#3BBD70"); this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath + "block_icon/start_icon_signal.png", "*", "start")).appendField(Lang.Blocks.START_when_message_cast_1).appendField(new Blockly.FieldDropdownDynamic("messages"), "VALUE").appendField(Lang.Blocks.START_when_message_cast_2); this.setInputsInline(!0); this.setNextStatement(!0); -}, whenAdd:function(b) { - var a = Entry.variableContainer; - a && a.addRef("_messageRefs", b); -}, whenRemove:function(b) { - var a = Entry.variableContainer; - a && a.removeRef("_messageRefs", b); +}, whenAdd:function(a) { + var b = Entry.variableContainer; + b && b.addRef("_messageRefs", a); +}, whenRemove:function(a) { + var b = Entry.variableContainer; + b && b.removeRef("_messageRefs", a); }}; -Entry.block.when_message_cast = function(b, a) { - return a.callReturn(); +Entry.block.when_message_cast = function(a, b) { + return b.callReturn(); }; Blockly.Blocks.message_cast = {init:function() { this.setColour("#3BBD70"); @@ -5231,20 +5669,21 @@ Blockly.Blocks.message_cast = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); this.setPreviousStatement(!0); -}, whenAdd:function(b) { - var a = Entry.variableContainer; - a && a.addRef("_messageRefs", b); -}, whenRemove:function(b) { - var a = Entry.variableContainer; - a && a.removeRef("_messageRefs", b); -}}; -Entry.block.message_cast = function(b, a) { - var c = a.getField("VALUE", a), d = Entry.isExist(c, "id", Entry.variableContainer.messages_); - if ("null" == c || !d) { +}, whenAdd:function(a) { + var b = Entry.variableContainer; + b && b.addRef("_messageRefs", a); +}, whenRemove:function(a) { + var b = Entry.variableContainer; + b && b.removeRef("_messageRefs", a); +}}; +Entry.block.message_cast = function(a, b) { + a = b.getField("VALUE", b); + var c = Entry.isExist(a, "id", Entry.variableContainer.messages_); + if ("null" == a || !c) { throw Error("value can not be null or undefined"); } - Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent, ["when_message_cast", c]); - return a.callReturn(); + Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent, ["when_message_cast", a]); + return b.callReturn(); }; Blockly.Blocks.message_cast_wait = {init:function() { this.setColour("#3BBD70"); @@ -5252,32 +5691,33 @@ Blockly.Blocks.message_cast_wait = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); this.setPreviousStatement(!0); -}, whenAdd:function(b) { - var a = Entry.variableContainer; - a && a.addRef("_messageRefs", b); -}, whenRemove:function(b) { - var a = Entry.variableContainer; - a && a.removeRef("_messageRefs", b); -}}; -Entry.block.message_cast_wait = function(b, a) { - if (a.runningScript) { - for (var c = a.runningScript, d = c.length, e = 0;e < d;e++) { - var f = c.shift(); - f && !f.isEnd() && c.push(f); - } - return c.length ? a : a.callReturn(); - } - c = a.getField("VALUE", a); - f = Entry.isExist(c, "id", Entry.variableContainer.messages_); - if ("null" == c || !f) { +}, whenAdd:function(a) { + var b = Entry.variableContainer; + b && b.addRef("_messageRefs", a); +}, whenRemove:function(a) { + var b = Entry.variableContainer; + b && b.removeRef("_messageRefs", a); +}}; +Entry.block.message_cast_wait = function(a, b) { + if (b.runningScript) { + a = b.runningScript; + for (var c = a.length, d = 0;d < c;d++) { + var e = a.shift(); + e && !e.isEnd() && a.push(e); + } + return a.length ? b : b.callReturn(); + } + a = b.getField("VALUE", b); + e = Entry.isExist(a, "id", Entry.variableContainer.messages_); + if ("null" == a || !e) { throw Error("value can not be null or undefined"); } - d = Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent, ["when_message_cast", c]); - for (c = [];d.length;) { - (f = d.shift()) && (c = c.concat(f)); + c = Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent, ["when_message_cast", a]); + for (a = [];c.length;) { + (e = c.shift()) && (a = a.concat(e)); } - a.runningScript = c; - return a; + b.runningScript = a; + return b; }; var colour = "#FFCA36"; Blockly.Blocks.text = {init:function() { @@ -5286,8 +5726,8 @@ Blockly.Blocks.text = {init:function() { this.setOutput(!0, "String"); this.setInputsInline(!0); }}; -Entry.block.text = function(b, a) { - return a.getField("NAME", a); +Entry.block.text = function(a, b) { + return b.getField("NAME", b); }; Blockly.Blocks.text_write = {init:function() { this.setColour(colour); @@ -5298,10 +5738,10 @@ Blockly.Blocks.text_write = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.text_write = function(b, a) { - var c = a.getStringValue("VALUE", a), c = Entry.convertToRoundedDecimals(c, 3); - b.setText(c); - return a.callReturn(); +Entry.block.text_write = function(a, b) { + var c = b.getStringValue("VALUE", b), c = Entry.convertToRoundedDecimals(c, 3); + a.setText(c); + return b.callReturn(); }; Blockly.Blocks.text_append = {init:function() { this.setColour(colour); @@ -5312,10 +5752,10 @@ Blockly.Blocks.text_append = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.text_append = function(b, a) { - var c = a.getStringValue("VALUE", a); - b.setText(Entry.convertToRoundedDecimals(b.getText(), 3) + Entry.convertToRoundedDecimals(c, 3)); - return a.callReturn(); +Entry.block.text_append = function(a, b) { + var c = b.getStringValue("VALUE", b); + a.setText(Entry.convertToRoundedDecimals(a.getText(), 3) + Entry.convertToRoundedDecimals(c, 3)); + return b.callReturn(); }; Blockly.Blocks.text_prepend = {init:function() { this.setColour(colour); @@ -5326,10 +5766,10 @@ Blockly.Blocks.text_prepend = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.text_prepend = function(b, a) { - var c = a.getStringValue("VALUE", a); - b.setText(Entry.convertToRoundedDecimals(c, 3) + Entry.convertToRoundedDecimals(b.getText(), 3)); - return a.callReturn(); +Entry.block.text_prepend = function(a, b) { + var c = b.getStringValue("VALUE", b); + a.setText(Entry.convertToRoundedDecimals(c, 3) + Entry.convertToRoundedDecimals(a.getText(), 3)); + return b.callReturn(); }; Blockly.Blocks.text_flush = {init:function() { this.setColour(colour); @@ -5338,9 +5778,9 @@ Blockly.Blocks.text_flush = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.text_flush = function(b, a) { - b.setText(""); - return a.callReturn(); +Entry.block.text_flush = function(a, b) { + a.setText(""); + return b.callReturn(); }; Entry.block.variableAddButton = {skeleton:"basic_button", color:"#eee", template:"%1", params:[{type:"Text", text:"\ubcc0\uc218 \ucd94\uac00", color:"#333", align:"center"}], func:function() { }, events:{mousedown:[function() { @@ -5360,22 +5800,22 @@ Blockly.Blocks.change_variable = {init:function() { this.setInputsInline(!0); this.setPreviousStatement(!0); this.setNextStatement(!0); -}, whenAdd:function(b) { - var a = Entry.variableContainer; - a && a.addRef("_variableRefs", b); -}, whenRemove:function(b) { - var a = Entry.variableContainer; - a && a.removeRef("_variableRefs", b); -}}; -Entry.block.change_variable = function(b, a) { - var c = a.getField("VARIABLE", a), d = a.getNumberValue("VALUE", a), e = 0, d = Entry.parseNumber(d); +}, whenAdd:function(a) { + var b = Entry.variableContainer; + b && b.addRef("_variableRefs", a); +}, whenRemove:function(a) { + var b = Entry.variableContainer; + b && b.removeRef("_variableRefs", a); +}}; +Entry.block.change_variable = function(a, b) { + var c = b.getField("VARIABLE", b), d = b.getNumberValue("VALUE", b), d = Entry.parseNumber(d); if (0 == d && "boolean" == typeof d) { throw Error("Type is not correct"); } - c = Entry.variableContainer.getVariable(c, b); - e = Entry.getMaxFloatPoint([d, c.getValue()]); - c.setValue((d + c.getValue()).toFixed(e)); - return a.callReturn(); + c = Entry.variableContainer.getVariable(c, a); + a = Entry.getMaxFloatPoint([d, c.getValue()]); + c.setValue((d + c.getValue()).toFixed(a)); + return b.callReturn(); }; Blockly.Blocks.set_variable = {init:function() { this.setColour("#E457DC"); @@ -5387,17 +5827,17 @@ Blockly.Blocks.set_variable = {init:function() { this.setInputsInline(!0); this.setPreviousStatement(!0); this.setNextStatement(!0); -}, whenAdd:function(b) { - var a = Entry.variableContainer; - a && a.addRef("_variableRefs", b); -}, whenRemove:function(b) { - var a = Entry.variableContainer; - a && a.removeRef("_variableRefs", b); -}}; -Entry.block.set_variable = function(b, a) { - var c = a.getField("VARIABLE", a), d = a.getValue("VALUE", a); - Entry.variableContainer.getVariable(c, b).setValue(d); - return a.callReturn(); +}, whenAdd:function(a) { + var b = Entry.variableContainer; + b && b.addRef("_variableRefs", a); +}, whenRemove:function(a) { + var b = Entry.variableContainer; + b && b.removeRef("_variableRefs", a); +}}; +Entry.block.set_variable = function(a, b) { + var c = b.getField("VARIABLE", b), d = b.getValue("VALUE", b); + Entry.variableContainer.getVariable(c, a).setValue(d); + return b.callReturn(); }; Blockly.Blocks.show_variable = {init:function() { this.setColour("#E457DC"); @@ -5406,18 +5846,19 @@ Blockly.Blocks.show_variable = {init:function() { this.setInputsInline(!0); this.setPreviousStatement(!0); this.setNextStatement(!0); -}, whenAdd:function(b) { - var a = Entry.variableContainer; - a && a.addRef("_variableRefs", b); -}, whenRemove:function(b) { - var a = Entry.variableContainer; - a && a.removeRef("_variableRefs", b); -}}; -Entry.block.show_variable = function(b, a) { - var c = a.getField("VARIABLE", a), c = Entry.variableContainer.getVariable(c, b); - c.setVisible(!0); - c.updateView(); - return a.callReturn(); +}, whenAdd:function(a) { + var b = Entry.variableContainer; + b && b.addRef("_variableRefs", a); +}, whenRemove:function(a) { + var b = Entry.variableContainer; + b && b.removeRef("_variableRefs", a); +}}; +Entry.block.show_variable = function(a, b) { + var c = b.getField("VARIABLE", b); + a = Entry.variableContainer.getVariable(c, a); + a.setVisible(!0); + a.updateView(); + return b.callReturn(); }; Blockly.Blocks.hide_variable = {init:function() { this.setColour("#E457DC"); @@ -5426,17 +5867,17 @@ Blockly.Blocks.hide_variable = {init:function() { this.setInputsInline(!0); this.setPreviousStatement(!0); this.setNextStatement(!0); -}, whenAdd:function(b) { - var a = Entry.variableContainer; - a && a.addRef("_variableRefs", b); -}, whenRemove:function(b) { - var a = Entry.variableContainer; - a && a.removeRef("_variableRefs", b); -}}; -Entry.block.hide_variable = function(b, a) { - var c = a.getField("VARIABLE", a); - Entry.variableContainer.getVariable(c, b).setVisible(!1); - return a.callReturn(); +}, whenAdd:function(a) { + var b = Entry.variableContainer; + b && b.addRef("_variableRefs", a); +}, whenRemove:function(a) { + var b = Entry.variableContainer; + b && b.removeRef("_variableRefs", a); +}}; +Entry.block.hide_variable = function(a, b) { + var c = b.getField("VARIABLE", b); + Entry.variableContainer.getVariable(c, a).setVisible(!1); + return b.callReturn(); }; Blockly.Blocks.get_y = {init:function() { this.setColour(230); @@ -5449,16 +5890,16 @@ Blockly.Blocks.get_variable = {init:function() { this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("variables"), "VARIABLE").appendField(Lang.Blocks.VARIABLE_get_variable_2); this.setOutput(!0, "Number"); this.setInputsInline(!0); -}, whenAdd:function(b) { - var a = Entry.variableContainer; - a && a.addRef("_variableRefs", b); -}, whenRemove:function(b) { - var a = Entry.variableContainer; - a && a.removeRef("_variableRefs", b); +}, whenAdd:function(a) { + var b = Entry.variableContainer; + b && b.addRef("_variableRefs", a); +}, whenRemove:function(a) { + var b = Entry.variableContainer; + b && b.removeRef("_variableRefs", a); }}; -Entry.block.get_variable = function(b, a) { - var c = a.getField("VARIABLE", a); - return Entry.variableContainer.getVariable(c, b).getValue(); +Entry.block.get_variable = function(a, b) { + b = b.getField("VARIABLE", b); + return Entry.variableContainer.getVariable(b, a).getValue(); }; Blockly.Blocks.ask_and_wait = {init:function() { this.setColour("#E457DC"); @@ -5470,30 +5911,30 @@ Blockly.Blocks.ask_and_wait = {init:function() { this.setNextStatement(!0); }, whenAdd:function() { Entry.container && Entry.container.showProjectAnswer(); -}, whenRemove:function(b) { - Entry.container && Entry.container.hideProjectAnswer(b); +}, whenRemove:function(a) { + Entry.container && Entry.container.hideProjectAnswer(a); }}; -Entry.block.ask_and_wait = function(b, a) { - var c = Entry.container.inputValue, d = Entry.stage.inputField, e = a.getValue("VALUE", a); +Entry.block.ask_and_wait = function(a, b) { + var c = Entry.container.inputValue, d = Entry.stage.inputField, e = b.getValue("VALUE", b); if (!e) { throw Error("message can not be empty"); } - if (c.sprite == b && d && !d._isHidden) { - return a; + if (c.sprite == a && d && !d._isHidden) { + return b; } - if (c.sprite != b && a.isInit) { - return b.dialog && b.dialog.remove(), delete a.isInit, a.callReturn(); + if (c.sprite != a && b.isInit) { + return a.dialog && a.dialog.remove(), delete b.isInit, b.callReturn(); } - if (c.complete && c.sprite == b && d._isHidden && a.isInit) { - return b.dialog && b.dialog.remove(), delete c.complete, delete a.isInit, a.callReturn(); + if (c.complete && c.sprite == a && d._isHidden && b.isInit) { + return a.dialog && a.dialog.remove(), delete c.complete, delete b.isInit, b.callReturn(); } e = Entry.convertToRoundedDecimals(e, 3); - new Entry.Dialog(b, e, "speak"); + new Entry.Dialog(a, e, "speak"); Entry.stage.showInputField(); - c.script = a; - c.sprite = b; - a.isInit = !0; - return a; + c.script = b; + c.sprite = a; + b.isInit = !0; + return b; }; Blockly.Blocks.get_canvas_input_value = {init:function() { this.setColour("#E457DC"); @@ -5503,10 +5944,10 @@ Blockly.Blocks.get_canvas_input_value = {init:function() { this.setInputsInline(!0); }, whenAdd:function() { Entry.container && Entry.container.showProjectAnswer(); -}, whenRemove:function(b) { - Entry.container && Entry.container.hideProjectAnswer(b); +}, whenRemove:function(a) { + Entry.container && Entry.container.hideProjectAnswer(a); }}; -Entry.block.get_canvas_input_value = function(b, a) { +Entry.block.get_canvas_input_value = function(a, b) { return Entry.container.getInputValue(); }; Blockly.Blocks.add_value_to_list = {init:function() { @@ -5519,19 +5960,20 @@ Blockly.Blocks.add_value_to_list = {init:function() { this.setInputsInline(!0); this.setPreviousStatement(!0); this.setNextStatement(!0); -}, whenAdd:function(b) { - var a = Entry.variableContainer; - a && a.addRef("_variableRefs", b); -}, whenRemove:function(b) { - var a = Entry.variableContainer; - a && a.removeRef("_variableRefs", b); -}}; -Entry.block.add_value_to_list = function(b, a) { - var c = a.getField("LIST", a), d = a.getValue("VALUE", a), c = Entry.variableContainer.getList(c, b); - c.array_ || (c.array_ = []); - c.array_.push({data:d}); - c.updateView(); - return a.callReturn(); +}, whenAdd:function(a) { + var b = Entry.variableContainer; + b && b.addRef("_variableRefs", a); +}, whenRemove:function(a) { + var b = Entry.variableContainer; + b && b.removeRef("_variableRefs", a); +}}; +Entry.block.add_value_to_list = function(a, b) { + var c = b.getField("LIST", b), d = b.getValue("VALUE", b); + a = Entry.variableContainer.getList(c, a); + a.array_ || (a.array_ = []); + a.array_.push({data:d}); + a.updateView(); + return b.callReturn(); }; Blockly.Blocks.remove_value_from_list = {init:function() { this.setColour("#E457DC"); @@ -5544,14 +5986,15 @@ Blockly.Blocks.remove_value_from_list = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.remove_value_from_list = function(b, a) { - var c = a.getField("LIST", a), d = a.getValue("VALUE", a), c = Entry.variableContainer.getList(c, b); - if (!c.array_ || isNaN(d) || d > c.array_.length) { +Entry.block.remove_value_from_list = function(a, b) { + var c = b.getField("LIST", b), d = b.getValue("VALUE", b); + a = Entry.variableContainer.getList(c, a); + if (!a.array_ || isNaN(d) || d > a.array_.length) { throw Error("can not remove value from array"); } - c.array_.splice(d - 1, 1); - c.updateView(); - return a.callReturn(); + a.array_.splice(d - 1, 1); + a.updateView(); + return b.callReturn(); }; Blockly.Blocks.insert_value_to_list = {init:function() { this.setColour("#E457DC"); @@ -5566,14 +6009,15 @@ Blockly.Blocks.insert_value_to_list = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.insert_value_to_list = function(b, a) { - var c = a.getField("LIST", a), d = a.getValue("DATA", a), e = a.getValue("INDEX", a), c = Entry.variableContainer.getList(c, b); - if (!c.array_ || isNaN(e) || 0 == e || e > c.array_.length + 1) { +Entry.block.insert_value_to_list = function(a, b) { + var c = b.getField("LIST", b), d = b.getValue("DATA", b), e = b.getValue("INDEX", b); + a = Entry.variableContainer.getList(c, a); + if (!a.array_ || isNaN(e) || 0 == e || e > a.array_.length + 1) { throw Error("can not insert value to array"); } - c.array_.splice(e - 1, 0, {data:d}); - c.updateView(); - return a.callReturn(); + a.array_.splice(e - 1, 0, {data:d}); + a.updateView(); + return b.callReturn(); }; Blockly.Blocks.change_value_list_index = {init:function() { this.setColour("#E457DC"); @@ -5588,14 +6032,15 @@ Blockly.Blocks.change_value_list_index = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.change_value_list_index = function(b, a) { - var c = a.getField("LIST", a), d = a.getValue("DATA", a), e = a.getValue("INDEX", a), c = Entry.variableContainer.getList(c, b); - if (!c.array_ || isNaN(e) || e > c.array_.length) { +Entry.block.change_value_list_index = function(a, b) { + var c = b.getField("LIST", b), d = b.getValue("DATA", b), e = b.getValue("INDEX", b); + a = Entry.variableContainer.getList(c, a); + if (!a.array_ || isNaN(e) || e > a.array_.length) { throw Error("can not insert value to array"); } - c.array_[e - 1].data = d; - c.updateView(); - return a.callReturn(); + a.array_[e - 1].data = d; + a.updateView(); + return b.callReturn(); }; Blockly.Blocks.value_of_index_from_list = {init:function() { this.setColour("#E457DC"); @@ -5607,12 +6052,15 @@ Blockly.Blocks.value_of_index_from_list = {init:function() { this.setOutput(!0, "String"); this.setInputsInline(!0); }}; -Entry.block.value_of_index_from_list = function(b, a) { - var c = a.getField("LIST", a), d = a.getValue("INDEX", a), c = Entry.variableContainer.getList(c, b), d = Entry.getListRealIndex(d, c); - if (!c.array_ || isNaN(d) || d > c.array_.length) { +Entry.block.value_of_index_from_list = function(a, b) { + var c = b.getField("LIST", b); + b = b.getValue("INDEX", b); + a = Entry.variableContainer.getList(c, a); + b = Entry.getListRealIndex(b, a); + if (!a.array_ || isNaN(b) || b > a.array_.length) { throw Error("can not insert value to array"); } - return c.array_[d - 1].data; + return a.array_[b - 1].data; }; Blockly.Blocks.length_of_list = {init:function() { this.setColour("#E457DC"); @@ -5622,9 +6070,9 @@ Blockly.Blocks.length_of_list = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.length_of_list = function(b, a) { - var c = a.getField("LIST", a); - return Entry.variableContainer.getList(c).array_.length; +Entry.block.length_of_list = function(a, b) { + a = b.getField("LIST", b); + return Entry.variableContainer.getList(a).array_.length; }; Blockly.Blocks.show_list = {init:function() { this.setColour("#E457DC"); @@ -5634,10 +6082,10 @@ Blockly.Blocks.show_list = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.show_list = function(b, a) { - var c = a.getField("LIST", a); - Entry.variableContainer.getList(c).setVisible(!0); - return a.callReturn(); +Entry.block.show_list = function(a, b) { + a = b.getField("LIST", b); + Entry.variableContainer.getList(a).setVisible(!0); + return b.callReturn(); }; Blockly.Blocks.hide_list = {init:function() { this.setColour("#E457DC"); @@ -5647,10 +6095,10 @@ Blockly.Blocks.hide_list = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hide_list = function(b, a) { - var c = a.getField("LIST", a); - Entry.variableContainer.getList(c).setVisible(!1); - return a.callReturn(); +Entry.block.hide_list = function(a, b) { + a = b.getField("LIST", b); + Entry.variableContainer.getList(a).setVisible(!1); + return b.callReturn(); }; Blockly.Blocks.options_for_list = {init:function() { this.setColour("#E457DC"); @@ -5660,8 +6108,8 @@ Blockly.Blocks.options_for_list = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.options_for_list = function(b, a) { - return a.getField("OPERATOR", a); +Entry.block.options_for_list = function(a, b) { + return b.getField("OPERATOR", b); }; Blockly.Blocks.set_visible_answer = {init:function() { this.setColour("#E457DC"); @@ -5673,12 +6121,12 @@ Blockly.Blocks.set_visible_answer = {init:function() { this.setNextStatement(!0); }, whenAdd:function() { Entry.container && Entry.container.showProjectAnswer(); -}, whenRemove:function(b) { - Entry.container && Entry.container.hideProjectAnswer(b); +}, whenRemove:function(a) { + Entry.container && Entry.container.hideProjectAnswer(a); }}; -Entry.block.set_visible_answer = function(b, a) { - "HIDE" == a.getField("BOOL", a) ? Entry.container.inputValue.setVisible(!1) : Entry.container.inputValue.setVisible(!0); - return a.callReturn(); +Entry.block.set_visible_answer = function(a, b) { + "HIDE" == b.getField("BOOL", b) ? Entry.container.inputValue.setVisible(!1) : Entry.container.inputValue.setVisible(!0); + return b.callReturn(); }; Blockly.Blocks.is_included_in_list = {init:function() { this.setColour("#E457DC"); @@ -5690,34 +6138,37 @@ Blockly.Blocks.is_included_in_list = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.is_included_in_list = function(b, a) { - var c = a.getField("LIST", a), d = a.getStringValue("DATA", a), c = Entry.variableContainer.getList(c); - if (!c) { +Entry.block.is_included_in_list = function(a, b) { + a = b.getField("LIST", b); + b = b.getStringValue("DATA", b); + a = Entry.variableContainer.getList(a); + if (!a) { return !1; } - for (var c = c.array_, e = 0, f = c.length;e < f;e++) { - if (c[e].data.toString() == d.toString()) { + a = a.array_; + for (var c = 0, d = a.length;c < d;c++) { + if (a[c].data.toString() == b.toString()) { return !0; } } return !1; }; Entry.Xbot = {PORT_MAP:{rightWheel:0, leftWheel:0, head:90, armR:90, armL:90, analogD5:127, analogD6:127, D4:0, D7:0, D12:0, D13:0, ledR:0, ledG:0, ledB:0, lcdNum:0, lcdTxt:" ", note:262, duration:0}, setZero:function() { - var b = Entry.Xbot.PORT_MAP, a = Entry.hw.sendQueue, c; - for (c in b) { - a[c] = b[c]; + var a = Entry.Xbot.PORT_MAP, b = Entry.hw.sendQueue, c; + for (c in a) { + b[c] = a[c]; } Entry.hw.update(); Entry.Xbot.removeAllTimeouts(); -}, timeouts:[], removeTimeout:function(b) { - clearTimeout(b); - var a = this.timeouts; - b = a.indexOf(b); - 0 <= b && a.splice(b, 1); +}, timeouts:[], removeTimeout:function(a) { + clearTimeout(a); + var b = this.timeouts; + a = b.indexOf(a); + 0 <= a && b.splice(a, 1); }, removeAllTimeouts:function() { - var b = this.timeouts, a; - for (a in b) { - clearTimeout(b[a]); + var a = this.timeouts, b; + for (b in a) { + clearTimeout(a[b]); } this.timeouts = []; }, name:"xbot_epor_edge"}; @@ -5727,9 +6178,10 @@ Blockly.Blocks.xbot_digitalInput = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Boolean"); }}; -Entry.block.xbot_digitalInput = function(b, a) { - var c = Entry.hw.portData, d = a.getField("DEVICE"); - return c[d]; +Entry.block.xbot_digitalInput = function(a, b) { + a = Entry.hw.portData; + b = b.getField("DEVICE"); + return a[b]; }; Blockly.Blocks.xbot_analogValue = {init:function() { this.setColour("#00979D"); @@ -5737,9 +6189,10 @@ Blockly.Blocks.xbot_analogValue = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Number"); }}; -Entry.block.xbot_analogValue = function(b, a) { - var c = Entry.hw.portData, d = a.getField("DEVICE"); - return c[d]; +Entry.block.xbot_analogValue = function(a, b) { + a = Entry.hw.portData; + b = b.getField("DEVICE"); + return a[b]; }; Blockly.Blocks.xbot_digitalOutput = {init:function() { this.setColour("#00979D"); @@ -5749,13 +6202,14 @@ Blockly.Blocks.xbot_digitalOutput = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.xbot_digitalOutput = function(b, a) { - var c = Entry.hw.sendQueue, d = a.getStringField("DEVICE", a), e = a.getStringField("VALUE", a); - c.D13 = "D13" == d && "HIGH" == e ? 1 : 0; - c.D4 = "D4" == d && "HIGH" == e ? 1 : 0; - c.D7 = "D7" == d && "HIGH" == e ? 1 : 0; - c.D12 = "D12" == d && "HIGH" == e ? 1 : 0; - return a.callReturn(); +Entry.block.xbot_digitalOutput = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getStringField("DEVICE", b), d = b.getStringField("VALUE", b); + a.D13 = "D13" == c && "HIGH" == d ? 1 : 0; + a.D4 = "D4" == c && "HIGH" == d ? 1 : 0; + a.D7 = "D7" == c && "HIGH" == d ? 1 : 0; + a.D12 = "D12" == c && "HIGH" == d ? 1 : 0; + return b.callReturn(); }; Blockly.Blocks.xbot_analogOutput = {init:function() { this.setColour("#00979D"); @@ -5766,10 +6220,11 @@ Blockly.Blocks.xbot_analogOutput = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.xbot_analogOutput = function(b, a) { - var c = Entry.hw.sendQueue, d = a.getStringField("DEVICE", a), e = a.getNumberValue("VALUE", a); - "analogD5" == d ? c.analogD5 = e : "analogD6" == d && (c.analogD6 = e); - return a.callReturn(); +Entry.block.xbot_analogOutput = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getStringField("DEVICE", b), d = b.getNumberValue("VALUE", b); + "analogD5" == c ? a.analogD5 = d : "analogD6" == c && (a.analogD6 = d); + return b.callReturn(); }; Blockly.Blocks.xbot_servo = {init:function() { this.setColour("#00979D"); @@ -5780,10 +6235,11 @@ Blockly.Blocks.xbot_servo = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.xbot_servo = function(b, a) { - var c = Entry.hw.sendQueue, d = a.getStringField("DEVICE", a), e = a.getNumberValue("VALUE", a); - "head" == d ? c.head = e : "right" == d ? c.armR = e : "left" == d && (c.armL = e); - return a.callReturn(); +Entry.block.xbot_servo = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getStringField("DEVICE", b), d = b.getNumberValue("VALUE", b); + "head" == c ? a.head = d : "right" == c ? a.armR = d : "left" == c && (a.armL = d); + return b.callReturn(); }; Blockly.Blocks.xbot_oneWheel = {init:function() { this.setColour("#00979D"); @@ -5794,10 +6250,11 @@ Blockly.Blocks.xbot_oneWheel = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.xbot_oneWheel = function(b, a) { - var c = Entry.hw.sendQueue, d = a.getStringField("DEVICE", a), e = a.getNumberValue("VALUE", a); - "rightWheel" == d ? c.rightWheel = e : "leftWheel" == d ? c.leftWheel = e : c.rightWheel = c.leftWheel = e; - return a.callReturn(); +Entry.block.xbot_oneWheel = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getStringField("DEVICE", b), d = b.getNumberValue("VALUE", b); + "rightWheel" == c ? a.rightWheel = d : "leftWheel" == c ? a.leftWheel = d : a.rightWheel = a.leftWheel = d; + return b.callReturn(); }; Blockly.Blocks.xbot_twoWheel = {init:function() { this.setColour("#00979D"); @@ -5810,11 +6267,11 @@ Blockly.Blocks.xbot_twoWheel = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.xbot_twoWheel = function(b, a) { - var c = Entry.hw.sendQueue; - c.rightWheel = a.getNumberValue("rightWheel"); - c.leftWheel = a.getNumberValue("leftWheel"); - return a.callReturn(); +Entry.block.xbot_twoWheel = function(a, b) { + a = Entry.hw.sendQueue; + a.rightWheel = b.getNumberValue("rightWheel"); + a.leftWheel = b.getNumberValue("leftWheel"); + return b.callReturn(); }; Blockly.Blocks.xbot_rgb = {init:function() { this.setColour("#00979D"); @@ -5829,12 +6286,12 @@ Blockly.Blocks.xbot_rgb = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.xbot_rgb = function(b, a) { - var c = Entry.hw.sendQueue; - c.ledR = a.getNumberValue("ledR"); - c.ledG = a.getNumberValue("ledG"); - c.ledB = a.getNumberValue("ledB"); - return a.callReturn(); +Entry.block.xbot_rgb = function(a, b) { + a = Entry.hw.sendQueue; + a.ledR = b.getNumberValue("ledR"); + a.ledG = b.getNumberValue("ledG"); + a.ledB = b.getNumberValue("ledB"); + return b.callReturn(); }; Blockly.Blocks.xbot_rgb_picker = {init:function() { this.setColour("#00979D"); @@ -5843,12 +6300,13 @@ Blockly.Blocks.xbot_rgb_picker = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.xbot_rgb_picker = function(b, a) { - var c = a.getStringField("VALUE"), d = Entry.hw.sendQueue; - d.ledR = parseInt(.3 * parseInt(c.substr(1, 2), 16)); - d.ledG = parseInt(.3 * parseInt(c.substr(3, 2), 16)); - d.ledB = parseInt(.3 * parseInt(c.substr(5, 2), 16)); - return a.callReturn(); +Entry.block.xbot_rgb_picker = function(a, b) { + a = b.getStringField("VALUE"); + var c = Entry.hw.sendQueue; + c.ledR = parseInt(.3 * parseInt(a.substr(1, 2), 16)); + c.ledG = parseInt(.3 * parseInt(a.substr(3, 2), 16)); + c.ledB = parseInt(.3 * parseInt(a.substr(5, 2), 16)); + return b.callReturn(); }; Blockly.Blocks.xbot_buzzer = {init:function() { this.setColour("#00979D"); @@ -5859,12 +6317,13 @@ Blockly.Blocks.xbot_buzzer = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.xbot_buzzer = function(b, a) { - var c = Entry.hw.sendQueue, d = a.getStringField("NOTE", a), e = a.getStringField("OCTAVE", a), f = a.getNumberValue("VALUE", a), d = d + e; - c.note = "C2" == d ? 65 : "D2" == d ? 73 : "E2" == d ? 82 : "F2" == d ? 87 : "G2" == d ? 98 : "A2" == d ? 110 : "B2" == d ? 123 : "C3" == d ? 131 : "D3" == d ? 147 : "E3" == d ? 165 : "F3" == d ? 175 : "G3" == d ? 196 : "A3" == d ? 220 : "B3" == d ? 247 : "C4" == d ? 262 : "D4" == d ? 294 : "E4" == d ? 330 : "F4" == d ? 349 : "G4" == d ? 392 : "A4" == d ? 440 : "B4" == d ? 494 : "C5" == d ? 523 : "D5" == d ? 587 : "E5" == d ? 659 : "F5" == d ? 698 : "G5" == d ? 784 : "A5" == d ? 880 : "B5" == d ? - 988 : "C6" == d ? 1047 : "D6" == d ? 1175 : "E6" == d ? 1319 : "F6" == d ? 1397 : "G6" == d ? 1568 : "A6" == d ? 1760 : "B6" == d ? 1976 : "C7" == d ? 2093 : "D7" == d ? 2349 : "E7" == d ? 2637 : "F7" == d ? 2794 : "G7" == d ? 3136 : "A7" == d ? 3520 : "B7" == d ? 3951 : 262; - c.duration = 40 * f; - return a.callReturn(); +Entry.block.xbot_buzzer = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getStringField("NOTE", b), d = b.getStringField("OCTAVE", b), e = b.getNumberValue("VALUE", b), c = c + d; + a.note = "C2" == c ? 65 : "D2" == c ? 73 : "E2" == c ? 82 : "F2" == c ? 87 : "G2" == c ? 98 : "A2" == c ? 110 : "B2" == c ? 123 : "C3" == c ? 131 : "D3" == c ? 147 : "E3" == c ? 165 : "F3" == c ? 175 : "G3" == c ? 196 : "A3" == c ? 220 : "B3" == c ? 247 : "C4" == c ? 262 : "D4" == c ? 294 : "E4" == c ? 330 : "F4" == c ? 349 : "G4" == c ? 392 : "A4" == c ? 440 : "B4" == c ? 494 : "C5" == c ? 523 : "D5" == c ? 587 : "E5" == c ? 659 : "F5" == c ? 698 : "G5" == c ? 784 : "A5" == c ? 880 : "B5" == c ? + 988 : "C6" == c ? 1047 : "D6" == c ? 1175 : "E6" == c ? 1319 : "F6" == c ? 1397 : "G6" == c ? 1568 : "A6" == c ? 1760 : "B6" == c ? 1976 : "C7" == c ? 2093 : "D7" == c ? 2349 : "E7" == c ? 2637 : "F7" == c ? 2794 : "G7" == c ? 3136 : "A7" == c ? 3520 : "B7" == c ? 3951 : 262; + a.duration = 40 * e; + return b.callReturn(); }; Blockly.Blocks.xbot_lcd = {init:function() { this.setColour("#00979D"); @@ -5875,5403 +6334,6303 @@ Blockly.Blocks.xbot_lcd = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.xbot_lcd = function(b, a) { - var c = Entry.hw.sendQueue, d = a.getNumberField("LINE", a), e = a.getStringValue("VALUE", a); - 0 == d ? (c.lcdNum = 0, c.lcdTxt = e) : 1 == d && (c.lcdNum = 1, c.lcdTxt = e); - return a.callReturn(); +Entry.block.xbot_lcd = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getNumberField("LINE", b), d = b.getStringValue("VALUE", b); + 0 == c ? (a.lcdNum = 0, a.lcdTxt = d) : 1 == c && (a.lcdNum = 1, a.lcdTxt = d); + return b.callReturn(); }; -Entry.Collection = function(b) { +Entry.Collection = function(a) { this.length = 0; this._hashMap = {}; this._observers = []; - this.set(b); + this.set(a); }; -(function(b, a) { - b.set = function(b) { +(function(a, b) { + a.set = function(a) { for (;this.length;) { - a.pop.call(this); + b.pop.call(this); } var d = this._hashMap, e; for (e in d) { delete d[e]; } - if (void 0 !== b) { + if (void 0 !== a) { e = 0; - for (var f = b.length;e < f;e++) { - var g = b[e]; + for (var f = a.length;e < f;e++) { + var g = a[e]; d[g.id] = g; - a.push.call(this, g); + b.push.call(this, g); } } }; - b.push = function(b) { - this._hashMap[b.id] = b; - a.push.call(this, b); + a.push = function(a) { + this._hashMap[a.id] = a; + b.push.call(this, a); }; - b.unshift = function() { - for (var b = Array.prototype.slice.call(arguments, 0), d = this._hashMap, e = b.length - 1;0 <= e;e--) { - var f = b[e]; - a.unshift.call(this, f); + a.unshift = function() { + for (var a = Array.prototype.slice.call(arguments, 0), d = this._hashMap, e = a.length - 1;0 <= e;e--) { + var f = a[e]; + b.unshift.call(this, f); d[f.id] = f; } }; - b.insert = function(b, d) { - a.splice.call(this, d, 0, b); - this._hashMap[b.id] = b; + a.insert = function(a, d) { + b.splice.call(this, d, 0, a); + this._hashMap[a.id] = a; }; - b.has = function(a) { - return !!this._hashMap[a]; + a.has = function(b) { + return !!this._hashMap[b]; }; - b.get = function(a) { - return this._hashMap[a]; + a.get = function(b) { + return this._hashMap[b]; }; - b.at = function(a) { - return this[a]; + a.at = function(b) { + return this[b]; }; - b.getAll = function() { - for (var a = this.length, b = [], e = 0;e < a;e++) { - b.push(this[e]); + a.getAll = function() { + for (var b = this.length, a = [], e = 0;e < b;e++) { + a.push(this[e]); } - return b; + return a; }; - b.indexOf = function(b) { - return a.indexOf.call(this, b); + a.indexOf = function(a) { + return b.indexOf.call(this, a); }; - b.find = function(a) { - for (var b = [], e, f = 0, g = this.length;f < g;f++) { + a.find = function(b) { + for (var a = [], e, f = 0, g = this.length;f < g;f++) { e = !0; var h = this[f], k; - for (k in a) { - if (a[k] != h[k]) { + for (k in b) { + if (b[k] != h[k]) { e = !1; break; } } - e && b.push(h); + e && a.push(h); } - return b; + return a; }; - b.pop = function() { - var b = a.pop.call(this); - delete this._hashMap[b.id]; - return b; + a.pop = function() { + var a = b.pop.call(this); + delete this._hashMap[a.id]; + return a; }; - b.shift = function() { - var b = a.shift.call(this); - delete this._hashMap[b.id]; - return b; + a.shift = function() { + var a = b.shift.call(this); + delete this._hashMap[a.id]; + return a; }; - b.slice = function(b, d) { - var e = a.slice.call(this, b, d), f = this._hashMap, g; - for (g in e) { - delete f[e[g].id]; + a.slice = function(a, d) { + a = b.slice.call(this, a, d); + d = this._hashMap; + for (var e in a) { + delete d[a[e].id]; } - return e; + return a; }; - b.remove = function(a) { - var b = this.indexOf(a); - -1 < b && (delete this._hashMap[a.id], this.splice(b, 1)); + a.remove = function(b) { + var a = this.indexOf(b); + -1 < a && (delete this._hashMap[b.id], this.splice(a, 1)); }; - b.splice = function(b, d) { - var e = a.slice.call(arguments, 2), f = this._hashMap; - d = void 0 === d ? this.length - b : d; - for (var g = a.splice.call(this, b, d), h = 0, k = g.length;h < k;h++) { + a.splice = function(a, d) { + var e = b.slice.call(arguments, 2), f = this._hashMap; + d = void 0 === d ? this.length - a : d; + for (var g = b.splice.call(this, a, d), h = 0, k = g.length;h < k;h++) { delete f[g[h].id]; } h = 0; for (k = e.length;h < k;h++) { - f = e[h], a.splice.call(this, b++, 0, f), this._hashMap[f.id] = f; + f = e[h], b.splice.call(this, a++, 0, f), this._hashMap[f.id] = f; } return g; }; - b.clear = function() { + a.clear = function() { for (;this.length;) { - a.pop.call(this); + b.pop.call(this); } this._hashMap = {}; }; - b.map = function(a, b) { + a.map = function(b, a) { for (var e = [], f = 0, g = this.length;f < g;f++) { - e.push(a(this[f], b)); + e.push(b(this[f], a)); } return e; }; - b.moveFromTo = function(b, d) { + a.moveFromTo = function(a, d) { var e = this.length - 1; - 0 > b || 0 > d || b > e || d > e || a.splice.call(this, d, 0, a.splice.call(this, b, 1)[0]); + 0 > a || 0 > d || a > e || d > e || b.splice.call(this, d, 0, b.splice.call(this, a, 1)[0]); }; - b.sort = function() { + a.sort = function() { }; - b.fromJSON = function() { + a.fromJSON = function() { }; - b.toJSON = function() { - for (var a = [], b = 0, e = this.length;b < e;b++) { - a.push(this[b].toJSON()); + a.toJSON = function() { + for (var b = [], a = 0, e = this.length;a < e;a++) { + b.push(this[a].toJSON()); } - return a; + return b; }; - b.observe = function() { + a.observe = function() { }; - b.unobserve = function() { + a.unobserve = function() { }; - b.notify = function() { + a.notify = function() { }; - b.destroy = function() { + a.destroy = function() { }; })(Entry.Collection.prototype, Array.prototype); -Entry.Event = function(b) { - this._sender = b; +Entry.Event = function(a) { + this._sender = a; this._listeners = []; }; -(function(b) { - b.attach = function(a, b) { - var d = this, e = {obj:a, fn:b, destroy:function() { +(function(a) { + a.attach = function(b, a) { + var d = this; + b = {obj:b, fn:a, destroy:function() { d.detach(this); }}; - this._listeners.push(e); - return e; + this._listeners.push(b); + return b; }; - b.detach = function(a) { - var b = this._listeners; - a = b.indexOf(a); - if (-1 < a) { - return b.splice(a, 1); + a.detach = function(b) { + var a = this._listeners; + b = a.indexOf(b); + if (-1 < b) { + return a.splice(b, 1); } }; - b.clear = function() { - for (var a = this._listeners;a.length;) { - a.pop(); + a.clear = function() { + for (var b = this._listeners;b.length;) { + b.pop(); } }; - b.notify = function() { - var a = arguments; - this._listeners.slice().forEach(function(b) { - b.fn.apply(b.obj, a); + a.notify = function() { + var b = arguments; + this._listeners.slice().forEach(function(a) { + a.fn.apply(a.obj, b); }); }; })(Entry.Event.prototype); -Entry.Observer = function(b, a, c, d) { - this.parent = b; - this.object = a; - this.funcName = c; - this.attrs = d; - b.push(this); -}; -(function(b) { - b.destroy = function() { - var a = this.parent, b = a.indexOf(this); - -1 < b && a.splice(b, 1); - return this; +Entry.Utils = {}; +Entry.overridePrototype = function() { + Number.prototype.mod = function(a) { + return (this % a + a) % a; }; -})(Entry.Observer.prototype); -Entry.Command = {}; -(function(b) { - b["do"] = {type:EntryStatic.COMMAND_TYPES["do"], log:function(a) { - return [b["do"].type]; - }}; - b.undo = {type:EntryStatic.COMMAND_TYPES.undo, log:function(a) { - return [b.undo.type]; - }}; - b.redo = {type:EntryStatic.COMMAND_TYPES.redo, log:function(a) { - return [b.redo.type]; - }}; -})(Entry.Command); -Entry.Commander = function(b) { - if ("workspace" == b || "phone" == b) { - Entry.stateManager = new Entry.StateManager; - } - Entry.do = this.do.bind(this); - Entry.undo = this.undo.bind(this); - this.editor = {}; - this.reporters = []; - this._tempStorage = null; - Entry.Command.editor = this.editor; }; -(function(b) { - b.do = function(a) { - var b = this, d = Array.prototype.slice.call(arguments); - d.shift(); - var e = Entry.Command[a]; - Entry.stateManager && Entry.stateManager.addCommand.apply(Entry.stateManager, [a, this, this.do, e.undo].concat(e.state.apply(this, d))); - e = Entry.Command[a].do.apply(this, d); - setTimeout(function() { - b.report("do"); - b.report(a, d); - }, 0); - return {value:e, isPass:this.isPass.bind(this)}; - }; - b.undo = function() { - var a = Array.prototype.slice.call(arguments), b = a.shift(), d = Entry.Command[b]; - this.report("undo"); - Entry.stateManager && Entry.stateManager.addCommand.apply(Entry.stateManager, [b, this, this.do, d.undo].concat(d.state.apply(this, a))); - return {value:Entry.Command[b].do.apply(this, a), isPass:this.isPass.bind(this)}; - }; - b.redo = function() { - var a = Array.prototype.slice.call(arguments), b = a.shift(), d = Entry.Command[b]; - that.report("redo"); - Entry.stateManager && Entry.stateManager.addCommand.apply(Entry.stateManager, [b, this, this.undo, b].concat(d.state.apply(null, a))); - d.undo.apply(this, a); - }; - b.setCurrentEditor = function(a, b) { - this.editor[a] = b; - }; - b.isPass = function(a) { - a = void 0 === a ? !0 : a; - if (Entry.stateManager) { - var b = Entry.stateManager.getLastCommand(); - b && (b.isPass = a); +Entry.Utils.generateId = function() { + return ("0000" + (Math.random() * Math.pow(36, 4) << 0).toString(36)).substr(-4); +}; +Entry.Utils.intersectArray = function(a, b) { + for (var c = [], d = 0;d < a.length;d++) { + for (var e = 0;e < b.length;e++) { + if (a[d] == b[e]) { + c.push(a[d]); + break; + } } - }; - b.addReporter = function(a) { - this.reporters.push(a); - }; - b.removeReporter = function(a) { - a = this.reporters.indexOf(a); - -1 < a && this.reporters.splice(a, 1); - }; - b.report = function(a, b) { - var d = this.reporters; - if (0 !== d.length) { - var e; - e = a && Entry.Command[a] && Entry.Command[a].log ? Entry.Command[a].log.apply(this, b) : b; - d.forEach(function(a) { - a.add(e); - }); - } - }; -})(Entry.Commander.prototype); -(function(b) { - b.addThread = {type:EntryStatic.COMMAND_TYPES.addThread, do:function(a) { - return this.editor.board.code.createThread(a); - }, state:function(a) { - a.length && (a[0].id = Entry.Utils.generateId()); - return [a]; - }, log:function(a) { - a = this.editor.board.code.getThreads().pop(); - return [b.addThread.type, ["thread", a.stringify()], ["code", this.editor.board.code.stringify()]]; - }, undo:"destroyThread"}; - b.destroyThread = {type:EntryStatic.COMMAND_TYPES.destroyThread, do:function(a) { - this.editor.board.findById(a[0].id).destroy(!0, !0); - }, state:function(a) { - return [this.editor.board.findById(a[0].id).thread.toJSON()]; - }, log:function(a) { - a = a[0].id; - this.editor.board.findById(a); - return [b.destroyThread.type, ["blockId", a], ["code", this.editor.board.code.stringify()]]; - }, undo:"addThread"}; - b.destroyBlock = {type:EntryStatic.COMMAND_TYPES.destroyBlock, do:function(a) { - "string" === typeof a && (a = this.editor.board.findById(a)); - a.doDestroy(!0); - }, state:function(a) { - "string" === typeof a && (a = this.editor.board.findById(a)); - return [a.toJSON(), a.pointer()]; - }, log:function(a) { - "string" === typeof a && (a = this.editor.board.findById(a)); - return [b.destroyBlock.type, ["blockId", a.id], ["code", this.editor.board.code.stringify()]]; - }, undo:"recoverBlock"}; - b.recoverBlock = {type:EntryStatic.COMMAND_TYPES.recoverBlock, do:function(a, b) { - var d = this.editor.board.code.createThread([a]).getFirstBlock(); - "string" === typeof d && (d = this.editor.board.findById(d)); - this.editor.board.insert(d, b); - }, state:function(a) { - "string" !== typeof a && (a = a.id); - return [a]; - }, log:function(a, c) { - a = this.editor.board.findById(a.id); - return [b.recoverBlock.type, ["block", a.stringify()], ["pointer", c], ["code", this.editor.board.code.stringify()]]; - }, undo:"destroyBlock"}; - b.insertBlock = {type:EntryStatic.COMMAND_TYPES.insertBlock, do:function(a, b, d) { - "string" === typeof a && (a = this.editor.board.findById(a)); - this.editor.board.insert(a, b, d); - }, state:function(a, b) { - "string" === typeof a && (a = this.editor.board.findById(a)); - var d = [a.id], e = a.targetPointer(); - d.push(e); - "string" !== typeof a && "basic" === a.getBlockType() && d.push(a.thread.getCount(a)); - return d; - }, log:function(a, c, d) { - "string" === typeof a && (a = this.editor.board.findById(a)); - return [b.insertBlock.type, ["blockId", a.id], ["targetPointer", a.targetPointer()], ["count", d], ["code", this.editor.board.code.stringify()]]; - }, undo:"insertBlock"}; - b.separateBlock = {type:EntryStatic.COMMAND_TYPES.separateBlock, do:function(a) { - a.view && a.view._toGlobalCoordinate(Entry.DRAG_MODE_DRAG); - a.doSeparate(); - }, state:function(a) { - var b = [a.id], d = a.targetPointer(); - b.push(d); - "basic" === a.getBlockType() && b.push(a.thread.getCount(a)); + } + return c; +}; +Entry.Utils.isPointInMatrix = function(a, b, c) { + c = void 0 === c ? 0 : c; + var d = a.offsetX ? a.x + a.offsetX : a.x, e = a.offsetY ? a.y + a.offsety : a.y; + return d - c <= b.x && d + a.width + c >= b.x && e - c <= b.y && e + a.height + c >= b.y; +}; +Entry.Utils.colorDarken = function(a, b) { + function c(b) { + 2 != b.length && (b = "0" + b); return b; - }, log:function(a) { - "string" === typeof a && (a = this.editor.board.findById(a)); - return [b.separateBlock.type, ["blockId", a.id], ["x", a.x], ["y", a.y], ["code", this.editor.board.code.stringify()]]; - }, undo:"insertBlock"}; - b.moveBlock = {type:EntryStatic.COMMAND_TYPES.moveBlock, do:function(a, b, d) { - void 0 !== b ? (a = this.editor.board.findById(a), a.moveTo(b, d)) : a._updatePos(); - }, state:function(a) { - "string" === typeof a && (a = this.editor.board.findById(a)); - return [a.id, a.x, a.y]; - }, log:function(a, c, d) { - return [b.moveBlock.type, ["blockId", a.id], ["x", a.x], ["y", a.y], ["code", this.editor.board.code.stringify()]]; - }, undo:"moveBlock"}; - b.cloneBlock = {type:EntryStatic.COMMAND_TYPES.cloneBlock, do:function(a) { - "string" === typeof a && (a = this.editor.board.findById(a)); - this.editor.board.code.createThread(a.copy()); - }, state:function(a) { - "string" !== typeof a && (a = a.id); - return [a]; - }, log:function(a) { - "string" === typeof a && (a = this.editor.board.findById(a)); - var c = this.editor.board.code.getThreads().pop(); - return [b.cloneBlock.type, ["blockId", a.id], ["thread", c.stringify()], ["code", this.editor.board.code.stringify()]]; - }, undo:"uncloneBlock"}; - b.uncloneBlock = {type:EntryStatic.COMMAND_TYPES.uncloneBlock, do:function(a) { - a = this.editor.board.code.getThreads().pop().getFirstBlock(); - this._tempStorage = a.id; - a.destroy(!0, !0); - }, state:function(a) { - return [a]; - }, log:function(a) { - a = this._tempStorage; - this._tempStorage = null; - return [b.uncloneBlock.type, ["blockId", a], ["code", this.editor.board.code.stringify()]]; - }, undo:"cloneBlock"}; - b.scrollBoard = {type:EntryStatic.COMMAND_TYPES.scrollBoard, do:function(a, b, d) { - d || this.editor.board.scroller._scroll(a, b); - delete this.editor.board.scroller._diffs; - }, state:function(a, b) { - return [-a, -b]; - }, log:function(a, c) { - return [b.scrollBoard.type, ["dx", a], ["dy", c]]; - }, undo:"scrollBoard"}; - b.setFieldValue = {type:EntryStatic.COMMAND_TYPES.setFieldValue, do:function(a, b, d, e, f) { - b.setValue(f, !0); - }, state:function(a, b, d, e, f) { - return [a, b, d, f, e]; - }, log:function(a, c, d, e, f) { - return [b.setFieldValue.type, ["pointer", d], ["newValue", f], ["code", this.editor.board.code.stringify()]]; - }, undo:"setFieldValue"}; -})(Entry.Command); -(function(b) { - b.selectObject = {type:EntryStatic.COMMAND_TYPES.selectObject, do:function(a) { - return Entry.container.selectObject(a); - }, state:function(a) { - if ((a = Entry.playground) && a.object) { - return [a.object.id]; - } - }, log:function(a) { - return [a]; - }, undo:"selectObject"}; -})(Entry.Command); -Entry.Container = function() { - this.objects_ = []; - this.cachedPicture = {}; - this.inputValue = {}; - this.currentObjects_ = this.copiedObject = null; + } + var d, e; + 7 === a.length ? (d = parseInt(a.substr(1, 2), 16), e = parseInt(a.substr(3, 2), 16), a = parseInt(a.substr(5, 2), 16)) : (d = parseInt(a.substr(1, 2), 16), e = parseInt(a.substr(2, 2), 16), a = parseInt(a.substr(3, 2), 16)); + b = void 0 === b ? .7 : b; + d = c(Math.floor(d * b).toString(16)); + e = c(Math.floor(e * b).toString(16)); + a = c(Math.floor(a * b).toString(16)); + return "#" + d + e + a; +}; +Entry.Utils.colorLighten = function(a, b) { + b = 0 === b ? 0 : b || 20; + a = Entry.Utils.hexToHsl(a); + a.l += b / 100; + a.l = Math.min(1, Math.max(0, a.l)); + return Entry.Utils.hslToHex(a); +}; +Entry.Utils.bound01 = function(a, b) { + var c = a; + "string" == typeof c && -1 != c.indexOf(".") && 1 === parseFloat(c) && (a = "100%"); + c = "string" === typeof a && -1 != a.indexOf("%"); + a = Math.min(b, Math.max(0, parseFloat(a))); + c && (a = parseInt(a * b, 10) / 100); + return 1E-6 > Math.abs(a - b) ? 1 : a % b / parseFloat(b); +}; +Entry.Utils.hexToHsl = function(a) { + var b, c; + 7 === a.length ? (b = parseInt(a.substr(1, 2), 16), c = parseInt(a.substr(3, 2), 16), a = parseInt(a.substr(5, 2), 16)) : (b = parseInt(a.substr(1, 2), 16), c = parseInt(a.substr(2, 2), 16), a = parseInt(a.substr(3, 2), 16)); + b = Entry.Utils.bound01(b, 255); + c = Entry.Utils.bound01(c, 255); + a = Entry.Utils.bound01(a, 255); + var d = Math.max(b, c, a), e = Math.min(b, c, a), f, g = (d + e) / 2; + if (d == e) { + f = e = 0; + } else { + var h = d - e, e = .5 < g ? h / (2 - d - e) : h / (d + e); + switch(d) { + case b: + f = (c - a) / h + (c < a ? 6 : 0); + break; + case c: + f = (a - b) / h + 2; + break; + case a: + f = (b - c) / h + 4; + } + f /= 6; + } + return {h:360 * f, s:e, l:g}; }; -Entry.Container.prototype.generateView = function(b, a) { - this._view = b; - this._view.addClass("entryContainer"); - if (a && "workspace" != a) { - "phone" == a && (this._view.addClass("entryContainerPhone"), c = Entry.createElement("div"), c.addClass("entryAddObjectWorkspace"), c.innerHTML = Lang.Workspace.add_object, c.bindOnClick(function(a) { - Entry.dispatchEvent("openSpriteManager"); - }), c = Entry.createElement("div"), c.addClass("entryContainerListPhoneWrapper"), this._view.appendChild(c), d = Entry.createElement("ul"), d.addClass("entryContainerListPhone"), c.appendChild(d), this.listView_ = d); +Entry.Utils.hslToHex = function(a) { + function b(b, a, c) { + 0 > c && (c += 1); + 1 < c && --c; + return c < 1 / 6 ? b + 6 * (a - b) * c : .5 > c ? a : c < 2 / 3 ? b + (a - b) * (2 / 3 - c) * 6 : b; + } + function c(b) { + return 1 == b.length ? "0" + b : "" + b; + } + var d, e; + e = Entry.Utils.bound01(a.h, 360); + d = Entry.Utils.bound01(a.s, 1); + a = Entry.Utils.bound01(a.l, 1); + if (0 === d) { + d = a = e = a; } else { - this._view.addClass("entryContainerWorkspace"); - this._view.setAttribute("id", "entryContainerWorkspaceId"); - var c = Entry.createElement("div"); - c.addClass("entryAddObjectWorkspace"); - c.innerHTML = Lang.Workspace.add_object; - c.bindOnClick(function(a) { - Entry.dispatchEvent("openSpriteManager"); - }); - c = Entry.createElement("div"); - c.addClass("entryContainerListWorkspaceWrapper"); - Entry.isForLecture && c.addClass("lecture"); - Entry.Utils.disableContextmenu(c); - $(c).on("contextmenu", function(a) { - a = [{text:Lang.Blocks.Paste_blocks, enable:!Entry.engine.isState("run") && !!Entry.container.copiedObject, callback:function() { - Entry.container.copiedObject ? Entry.container.addCloneObject(Entry.container.copiedObject) : Entry.toast.alert(Lang.Workspace.add_object_alert, Lang.Workspace.object_not_found_for_paste); - }}]; - Entry.ContextMenu.show(a, "workspace-contextmenu"); - }); - this._view.appendChild(c); - var d = Entry.createElement("ul"); - d.addClass("entryContainerListWorkspace"); - c.appendChild(d); - this.listView_ = d; - this.enableSort(); + var f = .5 > a ? a * (1 + d) : a + d - a * d, g = 2 * a - f; + d = b(g, f, e + 1 / 3); + a = b(g, f, e); + e = b(g, f, e - 1 / 3); } + a *= 255; + e *= 255; + return "#" + [c(Math.round(255 * d).toString(16)), c(Math.round(a).toString(16)), c(Math.round(e).toString(16))].join(""); }; -Entry.Container.prototype.enableSort = function() { - $ && $(this.listView_).sortable({start:function(b, a) { - a.item.data("start_pos", a.item.index()); - }, stop:function(b, a) { - var c = a.item.data("start_pos"), d = a.item.index(); - Entry.container.moveElement(c, d); - }, axis:"y", cancel:"input.selectedEditingObject"}); +Entry.Utils.bindGlobalEvent = function(a) { + var b = $(document); + void 0 === a && (a = "resize mousedown mousemove keydown keyup dispose".split(" ")); + -1 < a.indexOf("resize") && (Entry.windowReszied && ($(window).off("resize"), Entry.windowReszied.clear()), Entry.windowResized = new Entry.Event(window), $(window).on("resize", function(b) { + Entry.windowResized.notify(b); + })); + -1 < a.indexOf("mousedown") && (Entry.documentMousedown && (b.off("mousedown"), Entry.documentMousedown.clear()), Entry.documentMousedown = new Entry.Event(window), b.on("mousedown", function(b) { + Entry.documentMousedown.notify(b); + })); + -1 < a.indexOf("mousemove") && (Entry.documentMousemove && (b.off("touchmove mousemove"), Entry.documentMousemove.clear()), Entry.mouseCoordinate = {}, Entry.documentMousemove = new Entry.Event(window), b.on("touchmove mousemove", function(b) { + b.originalEvent && b.originalEvent.touches && (b = b.originalEvent.touches[0]); + Entry.documentMousemove.notify(b); + Entry.mouseCoordinate.x = b.clientX; + Entry.mouseCoordinate.y = b.clientY; + })); + -1 < a.indexOf("keydown") && (Entry.keyPressed && (b.off("keydown"), Entry.keyPressed.clear()), Entry.pressedKeys = [], Entry.keyPressed = new Entry.Event(window), b.on("keydown", function(b) { + var a = b.keyCode; + 0 > Entry.pressedKeys.indexOf(a) && Entry.pressedKeys.push(a); + Entry.keyPressed.notify(b); + })); + -1 < a.indexOf("keyup") && (Entry.keyUpped && (b.off("keyup"), Entry.keyUpped.clear()), Entry.keyUpped = new Entry.Event(window), b.on("keyup", function(b) { + var a = Entry.pressedKeys.indexOf(b.keyCode); + -1 < a && Entry.pressedKeys.splice(a, 1); + Entry.keyUpped.notify(b); + })); + -1 < a.indexOf("dispose") && (Entry.disposeEvent && Entry.disposeEvent.clear(), Entry.disposeEvent = new Entry.Event(window), Entry.documentMousedown && Entry.documentMousedown.attach(this, function(b) { + Entry.disposeEvent.notify(b); + })); }; -Entry.Container.prototype.disableSort = function() { - $ && $(this.listView_).sortable("destroy"); +Entry.Utils.makeActivityReporter = function() { + Entry.activityReporter = new Entry.ActivityReporter; + Entry.commander && Entry.commander.addReporter(Entry.activityReporter); + return Entry.activityReporter; }; -Entry.Container.prototype.updateListView = function() { - if (this.listView_) { - for (var b = this.listView_;b.hasChildNodes();) { - b.removeChild(b.lastChild); - } - var a = this.getCurrentObjects(), c; - for (c in a) { - b.appendChild(a[c].view_); - } - Entry.stage.sortZorder(); +Entry.Utils.initEntryEvent_ = function() { + Entry.events_ || (Entry.events_ = []); +}; +Entry.sampleColours = []; +Entry.assert = function(a, b) { + if (!a) { + throw Error(b || "Assert failed"); } }; -Entry.Container.prototype.setObjects = function(b) { - for (var a in b) { - var c = new Entry.EntryObject(b[a]); - this.objects_.push(c); - c.generateView(); - c.pictures.map(function(a) { - Entry.playground.generatePictureElement(a); - }); - c.sounds.map(function(a) { - Entry.playground.generateSoundElement(a); +Entry.parseTexttoXML = function(a) { + var b; + window.ActiveXObject ? (b = new ActiveXObject("Microsoft.XMLDOM"), b.async = "false", b.loadXML(a)) : b = (new DOMParser).parseFromString(a, "text/xml"); + return b; +}; +Entry.createElement = function(a, b) { + a = document.createElement(a); + b && (a.id = b); + a.hasClass = function(b) { + return this.className.match(new RegExp("(\\s|^)" + b + "(\\s|$)")); + }; + a.addClass = function(b) { + for (var a = 0;a < arguments.length;a++) { + b = arguments[a], this.hasClass(b) || (this.className += " " + b); + } + }; + a.removeClass = function(b) { + for (var a = 0;a < arguments.length;a++) { + b = arguments[a], this.hasClass(b) && (this.className = this.className.replace(new RegExp("(\\s|^)" + b + "(\\s|$)"), " ")); + } + }; + a.bindOnClick = function(b) { + $(this).on("click tab", function(a) { + a.stopImmediatePropagation(); + b.call(this, a); }); - } - this.updateObjectsOrder(); - this.updateListView(); - Entry.stage.sortZorder(); - Entry.variableContainer.updateViews(); - b = Entry.type; - ("workspace" == b || "phone" == b) && (b = this.getCurrentObjects()[0]) && this.selectObject(b.id); + }; + return a; }; -Entry.Container.prototype.getPictureElement = function(b, a) { - var c = this.getObject(a).getPicture(b); - if (c) { - return c.view; - } - throw Error("No picture found"); +Entry.makeAutolink = function(a) { + return a ? a.replace(/(http|https|ftp|telnet|news|irc):\/\/([-/.a-zA-Z0-9_~#%$?&=:200-377()][^)\]}]+)/gi, "$1://$2").replace(/([xA1-xFEa-z0-9_-]+@[xA1-xFEa-z0-9-]+.[a-z0-9-]+)/gi, "$1") : ""; }; -Entry.Container.prototype.setPicture = function(b) { - var a = this.getObject(b.objectId), c; - for (c in a.pictures) { - if (b.id === a.pictures[c].id) { - var d = {}; - d.dimension = b.dimension; - d.id = b.id; - d.filename = b.filename; - d.fileurl = b.fileurl; - d.name = b.name; - d.view = a.pictures[c].view; - a.pictures[c] = d; - return; +Entry.generateHash = function() { + return ("0000" + (Math.random() * Math.pow(36, 4) << 0).toString(36)).substr(-4); +}; +Entry.addEventListener = function(a, b) { + this.events_ || (this.events_ = {}); + this.events_[a] || (this.events_[a] = []); + b instanceof Function && this.events_[a].push(b); + return !0; +}; +Entry.dispatchEvent = function(a, b) { + this.events_ || (this.events_ = {}); + if (this.events_[a]) { + for (var c = 0, d = this.events_[a].length;c < d;c++) { + this.events_[a][c].call(window, b); } } - throw Error("No picture found"); }; -Entry.Container.prototype.selectPicture = function(b, a) { - var c = this.getObject(a), d = c.getPicture(b); - if (d) { - return c.selectedPicture = d, c.entity.setImage(d), c.updateThumbnailView(), c.id; +Entry.removeEventListener = function(a, b) { + if (this.events_[a]) { + for (var c = 0, d = this.events_[a].length;c < d;c++) { + if (this.events_[a][c] === b) { + this.events_[a].splice(c, 1); + break; + } + } } - throw Error("No picture found"); }; -Entry.Container.prototype.addObject = function(b, a) { - var c = new Entry.EntryObject(b); - c.name = Entry.getOrderedName(c.name, this.objects_); - Entry.stateManager && Entry.stateManager.addCommand("add object", this, this.removeObject, c); - c.scene || (c.scene = Entry.scene.selectedScene); - "number" == typeof a ? b.sprite.category && "background" == b.sprite.category.main ? (c.setLock(!0), this.objects_.push(c)) : this.objects_.splice(a, 0, c) : b.sprite.category && "background" == b.sprite.category.main ? this.objects_.push(c) : this.objects_.unshift(c); - c.generateView(); - c.pictures.map(function(a) { - Entry.playground.generatePictureElement(a); - }); - c.sounds.map(function(a) { - Entry.playground.generateSoundElement(a); - }); - this.setCurrentObjects(); - this.updateObjectsOrder(); - this.updateListView(); - this.selectObject(c.id); - Entry.variableContainer.updateViews(); - return new Entry.State(this, this.removeObject, c); +Entry.removeAllEventListener = function(a) { + this.events_ && this.events_[a] && delete this.events_[a]; }; -Entry.Container.prototype.addCloneObject = function(b, a) { - var c = b.toJSON(), d = Entry.generateHash(); - Entry.variableContainer.addCloneLocalVariables({objectId:c.id, newObjectId:d, json:c}); - c.id = d; - c.scene = a || Entry.scene.selectedScene; - this.addObject(c); -}; -Entry.Container.prototype.removeObject = function(b) { - var a = this.objects_.indexOf(b), c = b.toJSON(); - Entry.stateManager && Entry.stateManager.addCommand("remove object", this, this.addObject, c, a); - c = new Entry.State(this.addObject, c, a); - b.destroy(); - this.objects_.splice(a, 1); - this.setCurrentObjects(); - Entry.stage.sortZorder(); - this.objects_.length && 0 !== a ? 0 < this.getCurrentObjects().length ? Entry.container.selectObject(this.getCurrentObjects()[0].id) : Entry.container.selectObject() : this.objects_.length && 0 === a ? Entry.container.selectObject(this.getCurrentObjects()[0].id) : (Entry.container.selectObject(), Entry.playground.flushPlayground()); - Entry.toast.success(Lang.Workspace.remove_object, b.name + " " + Lang.Workspace.remove_object_msg); - Entry.variableContainer.removeLocalVariables(b.id); - Entry.playground.reloadPlayground(); - return c; +Entry.addTwoNumber = function(a, b) { + if (isNaN(a) || isNaN(b)) { + return a + b; + } + a += ""; + b += ""; + var c = a.indexOf("."), d = b.indexOf("."), e = 0, f = 0; + 0 < c && (e = a.length - c - 1); + 0 < d && (f = b.length - d - 1); + return 0 < e || 0 < f ? e >= f ? (parseFloat(a) + parseFloat(b)).toFixed(e) : (parseFloat(a) + parseFloat(b)).toFixed(f) : parseInt(a) + parseInt(b); }; -Entry.Container.prototype.selectObject = function(b, a) { - var c = this.getObject(b); - a && c && Entry.scene.selectScene(c.scene); - this.mapObjectOnScene(function(a) { - a.view_ && a.view_.removeClass("selectedObject"); - a.isSelected_ = !1; - }); - c && (c.view_ && c.view_.addClass("selectedObject"), c.isSelected_ = !0); - Entry.playground && Entry.playground.injectObject(c); - "minimize" != Entry.type && Entry.engine.isState("stop") && Entry.stage.selectObject(c); +Entry.hex2rgb = function(a) { + return (a = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a)) ? {r:parseInt(a[1], 16), g:parseInt(a[2], 16), b:parseInt(a[3], 16)} : null; }; -Entry.Container.prototype.getAllObjects = function() { - return this.objects_; +Entry.rgb2hex = function(a, b, c) { + return "#" + (16777216 + (a << 16) + (b << 8) + c).toString(16).slice(1); }; -Entry.Container.prototype.getObject = function(b) { - !b && Entry.playground && Entry.playground.object && (b = Entry.playground.object.id); - for (var a = this.objects_.length, c = 0;c < a;c++) { - var d = this.objects_[c]; - if (d.id == b) { - return d; - } - } +Entry.generateRgb = function() { + return {r:Math.floor(256 * Math.random()), g:Math.floor(256 * Math.random()), b:Math.floor(256 * Math.random())}; }; -Entry.Container.prototype.getEntity = function(b) { - if (b = this.getObject(b)) { - return b.entity; - } - Entry.toast.alert(Lang.Msgs.runtime_error, Lang.Workspace.object_not_found, !0); +Entry.adjustValueWithMaxMin = function(a, b, c) { + return a > c ? c : a < b ? b : a; }; -Entry.Container.prototype.getVariable = function(b) { - for (var a = 0;a < this.variables_.length;a++) { - var c = this.variables_[a]; - if (c.getId() == b || c.getName() == b) { - return c; +Entry.isExist = function(a, b, c) { + for (var d = 0;d < c.length;d++) { + if (c[d][b] == a) { + return c[d]; } } + return !1; }; -Entry.Container.prototype.moveElement = function(b, a, c) { - var d; - d = this.getCurrentObjects(); - b = this.getAllObjects().indexOf(d[b]); - a = this.getAllObjects().indexOf(d[a]); - !c && Entry.stateManager && Entry.stateManager.addCommand("reorder object", Entry.container, Entry.container.moveElement, a, b, !0); - this.objects_.splice(a, 0, this.objects_.splice(b, 1)[0]); - this.setCurrentObjects(); - Entry.container.updateListView(); - Entry.requestUpdate = !0; - return new Entry.State(Entry.container, Entry.container.moveElement, a, b, !0); +Entry.getColourCodes = function() { + return "transparent #660000 #663300 #996633 #003300 #003333 #003399 #000066 #330066 #660066 #FFFFFF #990000 #993300 #CC9900 #006600 #336666 #0033FF #000099 #660099 #990066 #000000 #CC0000 #CC3300 #FFCC00 #009900 #006666 #0066FF #0000CC #663399 #CC0099 #333333 #FF0000 #FF3300 #FFFF00 #00CC00 #009999 #0099FF #0000FF #9900CC #FF0099 #666666 #CC3333 #FF6600 #FFFF33 #00FF00 #00CCCC #00CCFF #3366FF #9933FF #FF00FF #999999 #FF6666 #FF6633 #FFFF66 #66FF66 #66CCCC #00FFFF #3399FF #9966FF #FF66FF #BBBBBB #FF9999 #FF9966 #FFFF99 #99FF99 #66FFCC #99FFFF #66CCff #9999FF #FF99FF #CCCCCC #FFCCCC #FFCC99 #FFFFCC #CCFFCC #99FFCC #CCFFFF #99CCFF #CCCCFF #FFCCFF".split(" "); }; -Entry.Container.prototype.moveElementByBlock = function(b, a) { - var c = this.getCurrentObjects().splice(b, 1)[0]; - this.getCurrentObjects().splice(a, 0, c); - Entry.stage.sortZorder(); - this.updateListView(); +Entry.removeElement = function(a) { + a && a.parentNode && a.parentNode.removeChild(a); }; -Entry.Container.prototype.getDropdownList = function(b, a) { - var c = []; - switch(b) { - case "sprites": - for (var d = this.getCurrentObjects(), e = d.length, f = 0;f < e;f++) { - a = d[f], c.push([a.name, a.id]); - } - break; - case "spritesWithMouse": - d = this.getCurrentObjects(); - e = d.length; - for (f = 0;f < e;f++) { - a = d[f], c.push([a.name, a.id]); - } - c.push([Lang.Blocks.mouse_pointer, "mouse"]); - break; - case "spritesWithSelf": - d = this.getCurrentObjects(); - e = d.length; - for (f = 0;f < e;f++) { - a = d[f], c.push([a.name, a.id]); - } - c.push([Lang.Blocks.self, "self"]); - break; - case "collision": - c.push([Lang.Blocks.mouse_pointer, "mouse"]); - d = this.getCurrentObjects(); - e = d.length; - for (f = 0;f < e;f++) { - a = d[f], c.push([a.name, a.id]); - } - c.push([Lang.Blocks.wall, "wall"]); - c.push([Lang.Blocks.wall_up, "wall_up"]); - c.push([Lang.Blocks.wall_down, "wall_down"]); - c.push([Lang.Blocks.wall_right, "wall_right"]); - c.push([Lang.Blocks.wall_left, "wall_left"]); - break; - case "pictures": - a = Entry.playground.object || a; - if (!a) { - break; - } - d = a.pictures; - for (f = 0;f < d.length;f++) { - e = d[f], c.push([e.name, e.id]); - } - break; - case "messages": - d = Entry.variableContainer.messages_; - for (f = 0;f < d.length;f++) { - e = d[f], c.push([e.name, e.id]); - } - break; - case "variables": - d = Entry.variableContainer.variables_; - for (f = 0;f < d.length;f++) { - e = d[f], e.object_ && Entry.playground.object && e.object_ != Entry.playground.object.id || c.push([e.getName(), e.getId()]); - } - c && 0 !== c.length || c.push([Lang.Blocks.VARIABLE_variable, "null"]); - break; - case "lists": - a = Entry.playground.object || a; - d = Entry.variableContainer.lists_; - for (f = 0;f < d.length;f++) { - e = d[f], e.object_ && a && e.object_ != a.id || c.push([e.getName(), e.getId()]); - } - c && 0 !== c.length || c.push([Lang.Blocks.VARIABLE_list, "null"]); - break; - case "scenes": - d = Entry.scene.scenes_; - for (f = 0;f < d.length;f++) { - e = d[f], c.push([e.name, e.id]); - } - break; - case "sounds": - a = Entry.playground.object || a; - if (!a) { - break; - } - d = a.sounds; - for (f = 0;f < d.length;f++) { - e = d[f], c.push([e.name, e.id]); - } - break; - case "clone": - c.push([Lang.Blocks.oneself, "self"]); - e = this.objects_.length; - for (f = 0;f < e;f++) { - a = this.objects_[f], c.push([a.name, a.id]); - } - break; - case "objectSequence": - for (e = this.getCurrentObjects().length, f = 0;f < e;f++) { - c.push([(f + 1).toString(), f.toString()]); - } - ; +Entry.getElementsByClassName = function(a) { + for (var b = [], c = document.getElementsByTagName("*"), d = 0;d < c.length;d++) { + -1 < (" " + c[d].className + " ").indexOf(" " + a + " ") && b.push(c[d]); } - c.length || (c = [[Lang.Blocks.no_target, "null"]]); - return c; + return b; }; -Entry.Container.prototype.clearRunningState = function() { - this.mapObject(function(b) { - b.clearExecutor(); - for (var a = b.clonedEntities.length;0 < a;a--) { - b.clonedEntities[a - 1].removeClone(); - } - b.clonedEntities = []; - }); +Entry.parseNumber = function(a) { + return "string" != typeof a || isNaN(Number(a)) ? "number" != typeof a || isNaN(Number(a)) ? !1 : a : Number(a); }; -Entry.Container.prototype.mapObject = function(b, a) { - for (var c = this.objects_.length, d = [], e = 0;e < c;e++) { - d.push(b(this.objects_[e], a)); +Entry.countStringLength = function(a) { + var b, c = 0; + for (b = 0;b < a.length;b++) { + 255 < a.charCodeAt(b) ? c += 2 : c++; } - return d; + return c; }; -Entry.Container.prototype.mapObjectOnScene = function(b, a) { - for (var c = this.getCurrentObjects(), d = c.length, e = [], f = 0;f < d;f++) { - e.push(b(c[f], a)); +Entry.cutStringByLength = function(a, b) { + var c, d = 0; + for (c = 0;d < b && c < a.length;c++) { + 255 < a.charCodeAt(c) ? d += 2 : d++; } - return e; + return a.substr(0, c); }; -Entry.Container.prototype.clearRunningStateOnScene = function() { - this.mapObjectOnScene(function(b) { - b.clearExecutor(); - for (var a = b.clonedEntities.length;0 < a;a--) { - b.clonedEntities[a - 1].removeClone(); +Entry.isChild = function(a, b) { + if (!b) { + for (;b.parentNode;) { + if ((b = b.parentNode) == a) { + return !0; + } } - b.clonedEntities = []; - }); -}; -Entry.Container.prototype.mapEntity = function(b, a) { - for (var c = this.objects_.length, d = [], e = 0;e < c;e++) { - d.push(b(this.objects_[e].entity, a)); } - return d; + return !1; }; -Entry.Container.prototype.mapEntityOnScene = function(b, a) { - for (var c = this.getCurrentObjects(), d = c.length, e = [], f = 0;f < d;f++) { - e.push(b(c[f].entity, a)); - } - return e; +Entry.launchFullScreen = function(a) { + a.requestFullscreen ? a.requestFullscreen() : a.mozRequestFulScreen ? a.mozRequestFulScreen() : a.webkitRequestFullscreen ? a.webkitRequestFullscreen() : a.msRequestFullScreen && a.msRequestFullScreen(); }; -Entry.Container.prototype.mapEntityIncludeClone = function(b, a) { - for (var c = this.objects_, d = c.length, e = [], f = 0;f < d;f++) { - var g = c[f], h = g.clonedEntities.length; - e.push(b(g.entity, a)); - for (var k = 0;k < h;k++) { - var l = g.clonedEntities[k]; - l && !l.isStamp && e.push(b(l, a)); - } - } - return e; +Entry.exitFullScreen = function() { + document.exitFullScreen ? document.exitFullScreen() : document.mozCancelFullScreen ? document.mozCancelFullScreen() : document.webkitExitFullscreen && document.webkitExitFullscreen(); }; -Entry.Container.prototype.mapEntityIncludeCloneOnScene = function(b, a) { - for (var c = this.getCurrentObjects(), d = c.length, e = [], f = 0;f < d;f++) { - var g = c[f], h = g.clonedEntities.length; - e.push(b(g.entity, a)); - for (var k = 0;k < h;k++) { - var l = g.clonedEntities[k]; - l && !l.isStamp && e.push(b(l, a)); - } - } - return e; +Entry.isPhone = function() { + return !1; +}; +Entry.getKeyCodeMap = function() { + return {65:"a", 66:"b", 67:"c", 68:"d", 69:"e", 70:"f", 71:"g", 72:"h", 73:"i", 74:"j", 75:"k", 76:"l", 77:"m", 78:"n", 79:"o", 80:"p", 81:"q", 82:"r", 83:"s", 84:"t", 85:"u", 86:"v", 87:"w", 88:"x", 89:"y", 90:"z", 32:Lang.Blocks.START_press_some_key_space, 37:Lang.Blocks.START_press_some_key_left, 38:Lang.Blocks.START_press_some_key_up, 39:Lang.Blocks.START_press_some_key_right, 40:Lang.Blocks.START_press_some_key_down, 48:"0", 49:"1", 50:"2", 51:"3", 52:"4", 53:"5", 54:"6", 55:"7", 56:"8", 57:"9", + 13:Lang.Blocks.START_press_some_key_enter}; }; -Entry.Container.prototype.getCachedPicture = function(b) { - Entry.assert("string" == typeof b, "pictureId must be string"); - return this.cachedPicture[b]; +Entry.checkCollisionRect = function(a, b) { + return !(a.y + a.height < b.y || a.y > b.y + b.height || a.x + a.width < b.x || a.x > b.x + b.width); }; -Entry.Container.prototype.cachePicture = function(b, a) { - this.cachedPicture[b] = a; +Entry.bindAnimationCallback = function(a, b) { + a.addEventListener("webkitAnimationEnd", b, !1); + a.addEventListener("animationend", b, !1); + a.addEventListener("oanimationend", b, !1); }; -Entry.Container.prototype.toJSON = function() { - for (var b = [], a = this.objects_.length, c = 0;c < a;c++) { - b.push(this.objects_[c].toJSON()); +Entry.cloneSimpleObject = function(a) { + var b = {}, c; + for (c in a) { + b[c] = a[c]; } return b; }; -Entry.Container.prototype.takeSequenceSnapshot = function() { - for (var b = this.objects_.length, a = this.objects_, c = 0;c < b;c++) { - a[c].index = c; +Entry.nodeListToArray = function(a) { + for (var b = Array(a.length), c = -1, d = a.length;++c !== d;b[c] = a[c]) { } + return b; }; -Entry.Container.prototype.loadSequenceSnapshot = function() { - for (var b = this.objects_.length, a = Array(b), c = 0;c < b;c++) { - var d = this.objects_[c]; - a[d.index || c] = d; - delete d.index; - } - this.objects_ = a; - this.setCurrentObjects(); - Entry.stage.sortZorder(); - this.updateListView(); +Entry.computeInputWidth = function(a) { + var b = document.createElement("span"); + b.className = "tmp-element"; + b.innerHTML = a.replace(/&/g, "&").replace(//g, ">"); + document.body.appendChild(b); + a = b.offsetWidth; + document.body.removeChild(b); + return Number(a + 10) + "px"; }; -Entry.Container.prototype.getInputValue = function() { - return this.inputValue.getValue(); +Entry.isArrowOrBackspace = function(a) { + return -1 < [37, 38, 39, 40, 8].indexOf(a); }; -Entry.Container.prototype.setInputValue = function(b) { - b ? this.inputValue.setValue(b) : this.inputValue.setValue(0); +Entry.hexStringToBin = function(a) { + for (var b = [], c = 0;c < a.length - 1;c += 2) { + b.push(parseInt(a.substr(c, 2), 16)); + } + return String.fromCharCode.apply(String, b); }; -Entry.Container.prototype.resetSceneDuringRun = function() { - this.mapEntityOnScene(function(b) { - b.loadSnapshot(); - b.object.filters = []; - b.resetFilter(); - b.dialog && b.dialog.remove(); - b.shape && b.removeBrush(); - }); - this.clearRunningStateOnScene(); +Entry.findObjsByKey = function(a, b, c) { + for (var d = [], e = 0;e < a.length;e++) { + a[e][b] == c && d.push(a[e]); + } + return d; }; -Entry.Container.prototype.setCopiedObject = function(b) { - this.copiedObject = b; +Entry.factorials = []; +Entry.factorial = function(a) { + return 0 === a || 1 == a ? 1 : 0 < Entry.factorials[a] ? Entry.factorials[a] : Entry.factorials[a] = Entry.factorial(a - 1) * a; }; -Entry.Container.prototype.updateObjectsOrder = function() { - for (var b = Entry.scene.getScenes(), a = [], c = 0;c < b.length;c++) { - for (var d = this.getSceneObjects(b[c]), e = 0;e < d.length;e++) { - a.push(d[e]); +Entry.getListRealIndex = function(a, b) { + if (isNaN(a)) { + switch(a) { + case "FIRST": + a = 1; + break; + case "LAST": + a = b.array_.length; + break; + case "RANDOM": + a = Math.floor(Math.random() * b.array_.length) + 1; } } - this.objects_ = a; -}; -Entry.Container.prototype.getSceneObjects = function(b) { - b = b || Entry.scene.selectedScene; - for (var a = [], c = this.getAllObjects(), d = 0;d < c.length;d++) { - b.id == c[d].scene.id && a.push(c[d]); - } return a; }; -Entry.Container.prototype.setCurrentObjects = function() { - this.currentObjects_ = this.getSceneObjects(); +Entry.toRadian = function(a) { + return a * Math.PI / 180; }; -Entry.Container.prototype.getCurrentObjects = function() { - var b = this.currentObjects_; - b && 0 !== b.length || this.setCurrentObjects(); - return this.currentObjects_; +Entry.toDegrees = function(a) { + return 180 * a / Math.PI; }; -Entry.Container.prototype.getProjectWithJSON = function(b) { - b.objects = Entry.container.toJSON(); - b.variables = Entry.variableContainer.getVariableJSON(); - b.messages = Entry.variableContainer.getMessageJSON(); - b.scenes = Entry.scene.toJSON(); +Entry.getPicturesJSON = function(a) { + for (var b = [], c = 0, d = a.length;c < d;c++) { + var e = a[c], f = {}; + f._id = e._id; + f.id = e.id; + f.dimension = e.dimension; + f.filename = e.filename; + f.fileurl = e.fileurl; + f.name = e.name; + f.scale = e.scale; + b.push(f); + } return b; }; -Entry.Container.prototype.blurAllInputs = function() { - this.getSceneObjects().map(function(b) { - b = b.view_.getElementsByTagName("input"); - for (var a = 0, c = b.length;a < c;a++) { - b[a].blur(); - } - }); +Entry.getSoundsJSON = function(a) { + for (var b = [], c = 0, d = a.length;c < d;c++) { + var e = a[c], f = {}; + f._id = e._id; + f.duration = e.duration; + f.ext = e.ext; + f.id = e.id; + f.filename = e.filename; + f.fileurl = e.fileurl; + f.name = e.name; + b.push(f); + } + return b; }; -Entry.Container.prototype.showProjectAnswer = function() { - var b = this.inputValue; - b && b.setVisible(!0); +Entry.cutDecimal = function(a) { + return Math.round(100 * a) / 100; }; -Entry.Container.prototype.hideProjectAnswer = function(b) { - if ((b = this.inputValue) && b.isVisible() && !Entry.engine.isState("run")) { - for (var a = Entry.container.getAllObjects(), c = ["ask_and_wait", "get_canvas_input_value", "set_visible_answer"], d = 0, e = a.length;d < e;d++) { - for (var f = a[d].script, g = 0;g < c.length;g++) { - if (f.hasBlockType(c[g])) { - return; - } - } - } - b.setVisible(!1); +Entry.getBrowserType = function() { + if (Entry.userAgent) { + return Entry.userAgent; + } + var a = navigator.userAgent, b, c = a.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []; + if (/trident/i.test(c[1])) { + return b = /\brv[ :]+(\d+)/g.exec(a) || [], "IE " + (b[1] || ""); + } + if ("Chrome" === c[1] && (b = a.match(/\b(OPR|Edge)\/(\d+)/), null != b)) { + return b.slice(1).join(" ").replace("OPR", "Opera"); } + c = c[2] ? [c[1], c[2]] : [navigator.appName, navigator.appVersion, "-?"]; + null != (b = a.match(/version\/(\d+)/i)) && c.splice(1, 1, b[1]); + a = c.join(" "); + return Entry.userAgent = a; +}; +Entry.setBasicBrush = function(a) { + var b = new createjs.Graphics; + b.thickness = 1; + b.rgb = Entry.hex2rgb("#ff0000"); + b.opacity = 100; + b.setStrokeStyle(1); + b.beginStroke("rgba(255,0,0,1)"); + var c = new createjs.Shape(b); + Entry.stage.selectedObjectContainer.addChild(c); + a.brush && (a.brush = null); + a.brush = b; + a.shape && (a.shape = null); + a.shape = c; }; -Entry.Container.prototype.getView = function() { - return this._view; +Entry.setCloneBrush = function(a, b) { + var c = new createjs.Graphics; + c.thickness = b.thickness; + c.rgb = b.rgb; + c.opacity = b.opacity; + c.setStrokeStyle(c.thickness); + c.beginStroke("rgba(" + c.rgb.r + "," + c.rgb.g + "," + c.rgb.b + "," + c.opacity / 100 + ")"); + b = new createjs.Shape(c); + Entry.stage.selectedObjectContainer.addChild(b); + a.brush && (a.brush = null); + a.brush = c; + a.shape && (a.shape = null); + a.shape = b; }; -Entry.Container.prototype.resize = function() { +Entry.isFloat = function(a) { + return /\d+\.{1}\d+/.test(a); }; -Entry.db = {data:{}, typeMap:{}}; -(function(b) { - b.add = function(a) { - this.data[a.id] = a; - var b = a.type; - void 0 === this.typeMap[b] && (this.typeMap[b] = {}); - this.typeMap[b][a.id] = a; - }; - b.has = function(a) { - return this.data.hasOwnProperty(a); - }; - b.remove = function(a) { - this.has(a) && (delete this.typeMap[this.data[a].type][a], delete this.data[a]); - }; - b.get = function(a) { - return this.data[a]; - }; - b.find = function() { - }; - b.clear = function() { - this.data = {}; - this.typeMap = {}; - }; -})(Entry.db); -Entry.Dom = function(b, a) { - var c = /<(\w+)>/, d; - d = b instanceof HTMLElement ? $(b) : b instanceof jQuery ? b : c.test(b) ? $(b) : $("<" + b + ">"); - if (void 0 === a) { - return d; +Entry.getStringIndex = function(a) { + if (!a) { + return ""; } - a.id && d.attr("id", a.id); - a.class && d.addClass(a.class); - a.classes && a.classes.map(function(a) { - d.addClass(a); - }); - a.src && d.attr("src", a.src); - a.parent && a.parent.append(d); - d.bindOnClick = function() { - var a, b, c = function(a) { - a.stopImmediatePropagation(); - a.handled || (a.handled = !0, b.call(this, a)); - }; - 1 < arguments.length ? (b = arguments[1] instanceof Function ? arguments[1] : function() { - }, a = "string" === typeof arguments[0] ? arguments[0] : "") : b = arguments[0] instanceof Function ? arguments[0] : function() { - }; - if (a) { - $(this).on("click tab", a, c); + for (var b = {string:a, index:1}, c = 0, d = [], e = a.length - 1;0 < e;--e) { + var f = a.charAt(e); + if (isNaN(f)) { + break; } else { - $(this).on("click tab", c); - } - }; - return d; -}; -Entry.SVG = function(b) { - b = document.getElementById(b); - return Entry.SVG.createElement(b); -}; -Entry.SVG.NS = "http://www.w3.org/2000/svg"; -Entry.SVG.NS_XLINK = "http://www.w3.org/1999/xlink"; -Entry.SVG.createElement = function(b, a) { - var c; - c = "string" === typeof b ? document.createElementNS(Entry.SVG.NS, b) : b; - if (a) { - a.href && (c.setAttributeNS(Entry.SVG.NS_XLINK, "href", a.href), delete a.href); - for (var d in a) { - c.setAttribute(d, a[d]); + d.unshift(f), c = e; } } - this instanceof SVGElement && this.appendChild(c); - c.elem = Entry.SVG.createElement; - c.attr = Entry.SVG.attr; - c.addClass = Entry.SVG.addClass; - c.removeClass = Entry.SVG.removeClass; - c.hasClass = Entry.SVG.hasClass; - c.remove = Entry.SVG.remove; - c.removeAttr = Entry.SVG.removeAttr; - return c; + 0 < c && (b.string = a.substring(0, c), b.index = parseInt(d.join("")) + 1); + return b; }; -Entry.SVG.attr = function(b, a) { - if ("string" === typeof b) { - var c = {}; - c[b] = a; - b = c; +Entry.getOrderedName = function(a, b, c) { + if (!a) { + return "untitled"; } - 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]); - } + if (!b || 0 === b.length) { + return a; } - return this; -}; -Entry.SVG.addClass = function(b) { - for (var a = this.getAttribute("class"), c = 0;c < arguments.length;c++) { - b = arguments[c], this.hasClass(b) || (a += " " + b); + c || (c = "name"); + for (var d = 0, e = Entry.getStringIndex(a), f = 0, g = b.length;f < g;f++) { + var h = Entry.getStringIndex(b[f][c]); + e.string === h.string && h.index > d && (d = h.index); } - this.setAttribute("class", a); - return this; + return 0 < d ? e.string + d : a; }; -Entry.SVG.removeClass = function(b) { - for (var a = this.getAttribute("class"), c = 0;c < arguments.length;c++) { - b = arguments[c], this.hasClass(b) && (a = a.replace(new RegExp("(\\s|^)" + b + "(\\s|$)"), " ")); +Entry.changeXmlHashId = function(a) { + if (/function_field/.test(a.getAttribute("type"))) { + for (var b = a.getElementsByTagName("mutation"), c = 0, d = b.length;c < d;c++) { + b[c].setAttribute("hashid", Entry.generateHash()); + } } - this.setAttribute("class", a); - return this; + return a; }; -Entry.SVG.hasClass = function(b) { - var a = this.getAttribute("class"); - return a ? a.match(new RegExp("(\\s|^)" + b + "(\\s|$)")) : !1; +Entry.getMaxFloatPoint = function(a) { + for (var b = 0, c = 0, d = a.length;c < d;c++) { + var e = String(a[c]), f = e.indexOf("."); + -1 !== f && (e = e.length - (f + 1), e > b && (b = e)); + } + return Math.min(b, 20); }; -Entry.SVG.remove = function() { - this.parentNode && this.parentNode.removeChild(this); +Entry.convertToRoundedDecimals = function(a, b) { + return isNaN(a) || !this.isFloat(a) ? a : Number(Math.round(a + "e" + b) + "e-" + b); }; -Entry.SVG.removeAttr = function(b) { - this.removeAttribute(b); +Entry.attachEventListener = function(a, b, c) { + setTimeout(function() { + a.addEventListener(b, c); + }, 0); }; -Entry.Dialog = function(b, a, c, d) { - b.dialog && b.dialog.remove(); - b.dialog = this; - this.parent = b; - this.padding = 10; - this.border = 2; - "number" == typeof a && (a = String(a)); - this.message_ = a = a.match(/.{1,15}/g).join("\n"); - this.mode_ = c; - "speak" == c && this.generateSpeak(); - d || Entry.stage.loadDialog(this); +Entry.deAttachEventListener = function(a, b, c) { + a.removeEventListener(b, c); }; -Entry.Dialog.prototype.generateSpeak = function() { - this.object = new createjs.Container; - var b = new createjs.Text; - b.font = "15px NanumGothic"; - b.textBaseline = "top"; - b.textAlign = "left"; - b.text = this.message_; - var a = b.getTransformedBounds(), c = a.height, a = 10 <= a.width ? a.width : 17, d = new createjs.Shape; - d.graphics.f("#f5f5f5").ss(2, "round").s("#6FC0DD").rr(-this.padding, -this.padding, a + 2 * this.padding, c + 2 * this.padding, this.padding); - this.object.addChild(d); - this.object.regX = a / 2; - this.object.regY = c / 2; - this.width = a; - this.height = c; - this.notch = this.createSpeakNotch("ne"); - this.update(); - this.object.addChild(this.notch); - this.object.addChild(b); - Entry.requestUpdate = !0; +Entry.isEmpty = function(a) { + if (!a) { + return !0; + } + for (var b in a) { + if (a.hasOwnProperty(b)) { + return !1; + } + } + return !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.Utils.disableContextmenu = function(a) { + if (a) { + $(a).on("contextmenu", function(b) { + b.stopPropagation(); + b.preventDefault(); + return !1; + }); + } }; -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.Utils.isRightButton = function(a) { + return 2 == a.button || a.ctrlKey; }; -Entry.Dialog.prototype.remove = function() { - Entry.stage.unloadDialog(this); - this.parent.dialog = null; - Entry.requestUpdate = !0; +Entry.Utils.isTouchEvent = function(a) { + return "mousedown" !== a.type.toLowerCase(); }; -Entry.DoneProject = function(b) { - this.generateView(b); +Entry.Utils.inherit = function(a, b) { + function c() { + } + c.prototype = a.prototype; + b.prototype = new c; + return b; }; -var p = Entry.DoneProject.prototype; -p.init = function(b) { - this.projectId = b; +Entry.bindAnimationCallbackOnce = function(a, b) { + a.one("webkitAnimationEnd animationendo animationend", b); +}; +Entry.Utils.isInInput = function(a) { + return "textarea" == a.target.type || "text" == a.target.type; +}; +Entry.Utils.isFunction = function(a) { + return "function" === typeof a; +}; +Entry.Utils.addFilters = function(a, b) { + a = a.elem("defs"); + var c = a.elem("filter", {id:"entryTrashcanFilter_" + b}); + c.elem("feGaussianBlur", {"in":"SourceAlpha", stdDeviation:2, result:"blur"}); + c.elem("feOffset", {"in":"blur", dx:1, dy:1, result:"offsetBlur"}); + c = c.elem("feMerge"); + c.elem("feMergeNode", {"in":"offsetBlur"}); + c.elem("feMergeNode", {"in":"SourceGraphic"}, c); + c = a.elem("filter", {id:"entryBlockShadowFilter_" + b, height:"200%"}); + c.elem("feOffset", {result:"offOut", in:"SourceGraphic", dx:0, dy:1}); + c.elem("feColorMatrix", {result:"matrixOut", in:"offOut", type:"matrix", values:"0.7 0 0 0 0 0 0.7 0 0 0 0 0 0.7 0 0 0 0 0 1 0"}); + c.elem("feBlend", {in:"SourceGraphic", in1:"offOut", mode:"normal"}); + b = a.elem("filter", {id:"entryBlockHighlightFilter_" + b}); + b.elem("feOffset", {result:"offOut", in:"SourceGraphic", dx:0, dy:0}); + b.elem("feColorMatrix", {result:"matrixOut", in:"offOut", type:"matrix", values:"1.3 0 0 0 0 0 1.3 0 0 0 0 0 1.3 0 0 0 0 0 1 0"}); +}; +Entry.Utils.addBlockPattern = function(a, b) { + a = a.elem("pattern", {id:"blockHoverPattern_" + b, class:"blockHoverPattern", patternUnits:"userSpaceOnUse", patternTransform:"translate(12, 0)", x:0, y:0, width:125, height:33, style:"display: none"}); + b = a.elem("g"); + for (var c = b.elem("rect", {x:0, y:0, width:125, height:33}), d = Entry.mediaFilePath + "block_pattern_(order).png", e = 1;5 > e;e++) { + b.elem("image", {class:"pattern" + e, href:d.replace("(order)", e), x:0, y:0, width:125, height:33}); + } + return {pattern:a, rect:c}; }; -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"); +Entry.Utils.COLLISION = {NONE:0, UP:1, RIGHT:2, LEFT:3, DOWN:4}; +Entry.Utils.createMouseEvent = function(a, b) { + var c = document.createEvent("MouseEvent"); + c.initMouseEvent(a, !0, !0, window, 0, 0, 0, b.clientX, b.clientY, !1, !1, !1, !1, 0, null); + return c; }; -p.getView = function() { - return this.doneContainer; +Entry.Utils.xmlToJsonData = function(a) { + a = $.parseXML(a); + var b = []; + a = a.childNodes[0].childNodes; + for (var c in a) { + var d = a[c]; + if (d.tagName) { + var e = {category:d.getAttribute("id"), blocks:[]}, d = d.childNodes; + for (c in d) { + var f = d[c]; + f.tagName && (f = f.getAttribute("type")) && e.blocks.push(f); + } + b.push(e); + } + } + return b; }; -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.Utils.stopProjectWithToast = function(a, b, c) { + var d = a.block; + b = b || "\ub7f0\ud0c0\uc784 \uc5d0\ub7ec \ubc1c\uc0dd"; + Entry.toast && !c && Entry.toast.alert(Lang.Msgs.warn, Lang.Workspace.check_runtime_error, !0); + Entry.engine && Entry.engine.toggleStop(); + "workspace" === Entry.type && (a.block && "funcBlock" in a.block ? d = a.block.funcBlock : a.funcExecutor && (d = a.funcExecutor.scope.block, a = a.type.replace("func_", ""), Entry.Func.edit(Entry.variableContainer.functions_[a])), d && (Entry.container.selectObject(d.getCode().object.id, !0), d.view.getBoard().activateBlock(d))); + throw Error(b); }; -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 < b.indexOf(d) && a.preventDefault(); - } - this.state = "stop"; - this.popup = null; - this.isUpdating = !0; - this.speeds = [1, 15, 30, 45, 60]; - this._mouseMoved = !1; - Entry.keyPressed && Entry.keyPressed.attach(this, this.captureKeyEvent); - Entry.addEventListener("canvasClick", function(a) { - Entry.engine.fireEvent("mouse_clicked"); - }); - Entry.addEventListener("canvasClickCanceled", function(a) { - Entry.engine.fireEvent("mouse_click_cancled"); - }); - Entry.addEventListener("entityClick", function(a) { - Entry.engine.fireEventOnEntity("when_object_click", a); - }); - Entry.addEventListener("entityClickCanceled", function(a) { - Entry.engine.fireEventOnEntity("when_object_click_canceled", a); - }); - "phone" != Entry.type && (Entry.addEventListener("stageMouseMove", function(a) { - this._mouseMoved = !0; - }.bind(this)), Entry.addEventListener("stageMouseOut", function(a) { - Entry.engine.hideMouseView(); - })); - Entry.addEventListener("run", function() { - $(window).bind("keydown", b); - }); - Entry.addEventListener("stop", function() { - $(window).unbind("keydown", b); - }); - setInterval(function() { - this._mouseMoved && (this.updateMouseView(), this._mouseMoved = !1); - }.bind(this), 100); +Entry.Utils.AsyncError = function(a) { + this.name = "AsyncError"; + this.message = a || "\ube44\ub3d9\uae30 \ud638\ucd9c \ub300\uae30"; }; -Entry.Engine.prototype.generateView = function(b, a) { - if (a && "workspace" != a) { - "minimize" == a ? (this.view_ = b, this.view_.addClass("entryEngine"), this.view_.addClass("entryEngineMinimize"), this.maximizeButton = Entry.createElement("button"), this.maximizeButton.addClass("entryEngineButtonMinimize"), this.maximizeButton.addClass("entryMaximizeButtonMinimize"), this.view_.appendChild(this.maximizeButton), this.maximizeButton.bindOnClick(function(a) { - Entry.engine.toggleFullscreen(); - }), this.coordinateButton = Entry.createElement("button"), this.coordinateButton.addClass("entryEngineButtonMinimize"), this.coordinateButton.addClass("entryCoordinateButtonMinimize"), this.view_.appendChild(this.coordinateButton), this.coordinateButton.bindOnClick(function(a) { - this.hasClass("toggleOn") ? this.removeClass("toggleOn") : this.addClass("toggleOn"); - Entry.stage.toggleCoordinator(); - }), this.stopButton = Entry.createElement("button"), this.stopButton.addClass("entryEngineButtonMinimize"), this.stopButton.addClass("entryStopButtonMinimize"), this.stopButton.addClass("entryRemove"), this.stopButton.innerHTML = Lang.Workspace.stop, this.view_.appendChild(this.stopButton), this.stopButton.bindOnClick(function(a) { - this.blur(); - Entry.engine.toggleStop(); - }), this.pauseButton = Entry.createElement("button"), this.pauseButton.innerHTML = Lang.Workspace.pause, this.pauseButton.addClass("entryEngineButtonMinimize"), this.pauseButton.addClass("entryPauseButtonMinimize"), this.pauseButton.addClass("entryRemove"), this.view_.appendChild(this.pauseButton), this.pauseButton.bindOnClick(function(a) { - this.blur(); - Entry.engine.togglePause(); - }), this.mouseView = Entry.createElement("div"), this.mouseView.addClass("entryMouseViewMinimize"), this.mouseView.addClass("entryRemove"), this.view_.appendChild(this.mouseView), Entry.addEventListener("loadComplete", function() { - this.runButton = Entry.Dom("div", {class:"entryRunButtonBigMinimize", parent:$("#entryCanvasWrapper")}); - this.runButton.bindOnClick(function(a) { - Entry.engine.toggleRun(); - }); - }.bind(this))) : "phone" == a && (this.view_ = b, this.view_.addClass("entryEngine", "entryEnginePhone"), this.headerView_ = Entry.createElement("div", "entryEngineHeader"), this.headerView_.addClass("entryEngineHeaderPhone"), this.view_.appendChild(this.headerView_), this.maximizeButton = Entry.createElement("button"), this.maximizeButton.addClass("entryEngineButtonPhone", "entryMaximizeButtonPhone"), this.headerView_.appendChild(this.maximizeButton), this.maximizeButton.bindOnClick(function(a) { - Entry.engine.footerView_.addClass("entryRemove"); - Entry.engine.headerView_.addClass("entryRemove"); - Entry.launchFullScreen(Entry.engine.view_); - }), document.addEventListener("fullscreenchange", function(a) { - Entry.engine.exitFullScreen(); - }), document.addEventListener("webkitfullscreenchange", function(a) { - Entry.engine.exitFullScreen(); - }), document.addEventListener("mozfullscreenchange", function(a) { - Entry.engine.exitFullScreen(); - }), this.footerView_ = Entry.createElement("div", "entryEngineFooter"), this.footerView_.addClass("entryEngineFooterPhone"), this.view_.appendChild(this.footerView_), this.runButton = Entry.createElement("button"), this.runButton.addClass("entryEngineButtonPhone", "entryRunButtonPhone"), Entry.objectAddable && this.runButton.addClass("small"), this.runButton.innerHTML = Lang.Workspace.run, this.footerView_.appendChild(this.runButton), this.runButton.bindOnClick(function(a) { - Entry.engine.toggleRun(); - }), this.stopButton = Entry.createElement("button"), this.stopButton.addClass("entryEngineButtonPhone", "entryStopButtonPhone", "entryRemove"), Entry.objectAddable && this.stopButton.addClass("small"), this.stopButton.innerHTML = Lang.Workspace.stop, this.footerView_.appendChild(this.stopButton), this.stopButton.bindOnClick(function(a) { - Entry.engine.toggleStop(); - })); - } else { - this.view_ = b; - this.view_.addClass("entryEngine_w"); - this.view_.addClass("entryEngineWorkspace_w"); - var c = Entry.createElement("button"); - this.speedButton = c; - this.speedButton.addClass("entrySpeedButtonWorkspace", "entryEngineTopWorkspace", "entryEngineButtonWorkspace_w"); - this.view_.appendChild(this.speedButton); - this.speedButton.bindOnClick(function(a) { - Entry.engine.toggleSpeedPanel(); - c.blur(); - }); - this.maximizeButton = Entry.createElement("button"); - this.maximizeButton.addClass("entryEngineButtonWorkspace_w", "entryEngineTopWorkspace", "entryMaximizeButtonWorkspace_w"); - this.view_.appendChild(this.maximizeButton); - this.maximizeButton.bindOnClick(function(a) { - Entry.engine.toggleFullscreen(); - }); - var d = Entry.createElement("button"); - this.coordinateButton = d; - this.coordinateButton.addClass("entryEngineButtonWorkspace_w", "entryEngineTopWorkspace", "entryCoordinateButtonWorkspace_w"); - this.view_.appendChild(this.coordinateButton); - this.coordinateButton.bindOnClick(function(a) { - this.hasClass("toggleOn") ? this.removeClass("toggleOn") : this.addClass("toggleOn"); - d.blur(); - Entry.stage.toggleCoordinator(); - }); - this.addButton = Entry.createElement("button"); - this.addButton.addClass("entryEngineButtonWorkspace_w"); - this.addButton.addClass("entryAddButtonWorkspace_w"); - this.addButton.innerHTML = Lang.Workspace.add_object; - this.addButton.bindOnClick(function(a) { - Entry.dispatchEvent("openSpriteManager"); - }); - this.view_.appendChild(this.addButton); - this.runButton = Entry.createElement("button"); - this.runButton.addClass("entryEngineButtonWorkspace_w"); - this.runButton.addClass("entryRunButtonWorkspace_w"); - this.runButton.innerHTML = Lang.Workspace.run; - this.view_.appendChild(this.runButton); - this.runButton.bindOnClick(function(a) { - Entry.engine.toggleRun(); - }); - this.runButton2 = Entry.createElement("button"); - this.runButton2.addClass("entryEngineButtonWorkspace_w"); - this.runButton2.addClass("entryRunButtonWorkspace_w2"); - this.view_.appendChild(this.runButton2); - this.runButton2.bindOnClick(function(a) { - Entry.engine.toggleRun(); - }); - this.stopButton = Entry.createElement("button"); - this.stopButton.addClass("entryEngineButtonWorkspace_w"); - this.stopButton.addClass("entryStopButtonWorkspace_w"); - this.stopButton.addClass("entryRemove"); - this.stopButton.innerHTML = Lang.Workspace.stop; - this.view_.appendChild(this.stopButton); - this.stopButton.bindOnClick(function(a) { - Entry.engine.toggleStop(); - }); - this.stopButton2 = Entry.createElement("button"); - this.stopButton2.addClass("entryEngineButtonWorkspace_w"); - this.stopButton2.addClass("entryStopButtonWorkspace_w2"); - this.stopButton2.addClass("entryRemove"); - this.stopButton2.innerHTML = Lang.Workspace.stop; - this.view_.appendChild(this.stopButton2); - this.stopButton2.bindOnClick(function(a) { - Entry.engine.toggleStop(); - }); - this.pauseButton = Entry.createElement("button"); - this.pauseButton.addClass("entryEngineButtonWorkspace_w"); - this.pauseButton.addClass("entryPauseButtonWorkspace_w"); - this.pauseButton.addClass("entryRemove"); - this.view_.appendChild(this.pauseButton); - this.pauseButton.bindOnClick(function(a) { - Entry.engine.togglePause(); - }); - this.mouseView = Entry.createElement("div"); - this.mouseView.addClass("entryMouseViewWorkspace_w"); - this.mouseView.addClass("entryRemove"); - this.view_.appendChild(this.mouseView); - } +Entry.Utils.AsyncError.prototype = Error(); +Entry.Utils.AsyncError.prototype.constructor = Entry.Utils.AsyncError; +Entry.Utils.isChrome = function() { + return /chrom(e|ium)/.test(navigator.userAgent.toLowerCase()); }; -Entry.Engine.prototype.toggleSpeedPanel = function() { - if (this.speedPanelOn) { - this.speedPanelOn = !1, $(Entry.stage.canvas.canvas).animate({top:"24px"}), this.coordinateButton.removeClass("entryRemove"), this.maximizeButton.removeClass("entryRemove"), this.mouseView.removeClass("entryRemoveElement"), $(this.speedLabel_).remove(), delete this.speedLabel_, $(this.speedProgress_).fadeOut(null, function(a) { - $(this).remove(); - delete this.speedProgress_; - }), $(this.speedHandle_).remove(), delete this.speedHandle_; - } else { - this.speedPanelOn = !0; - $(Entry.stage.canvas.canvas).animate({top:"41px"}); - this.coordinateButton.addClass("entryRemove"); - this.maximizeButton.addClass("entryRemove"); - this.mouseView.addClass("entryRemoveElement"); - this.speedLabel_ = Entry.createElement("div", "entrySpeedLabelWorkspace"); - this.speedLabel_.innerHTML = Lang.Workspace.speed; - this.view_.insertBefore(this.speedLabel_, this.maximizeButton); - this.speedProgress_ = Entry.createElement("table", "entrySpeedProgressWorkspace"); - for (var b = Entry.createElement("tr"), a = this.speeds, c = 0;5 > c;c++) { - (function(c) { - var e = Entry.createElement("td", "progressCell" + c); - e.bindOnClick(function() { - Entry.engine.setSpeedMeter(a[c]); - }); - b.appendChild(e); - })(c); - } - this.view_.insertBefore(this.speedProgress_, this.maximizeButton); - this.speedProgress_.appendChild(b); - this.speedHandle_ = Entry.createElement("div", "entrySpeedHandleWorkspace"); - c = (Entry.interfaceState.canvasWidth - 84) / 5; - $(this.speedHandle_).draggable({axis:"x", grid:[c, c], containment:[80, 0, 4 * c + 80, 0], drag:function(a, b) { - var c = (b.position.left - 80) / (Entry.interfaceState.canvasWidth - 84) * 5, c = Math.floor(c); - 0 > c || Entry.engine.setSpeedMeter(Entry.engine.speeds[c]); - }}); - this.view_.insertBefore(this.speedHandle_, this.maximizeButton); - this.setSpeedMeter(Entry.FPS); +Entry.Utils.waitForWebfonts = function(a, b) { + for (var c = 0, d = 0, e = a.length;d < e;++d) { + (function(d) { + function e() { + h && h.offsetWidth != k && (++c, h.parentNode.removeChild(h), h = null); + if (c >= a.length && (l && clearInterval(l), c == a.length)) { + return b(), !0; + } + } + var h = document.createElement("span"); + h.innerHTML = "giItT1WQy@!-/#"; + h.style.position = "absolute"; + h.style.left = "-10000px"; + h.style.top = "-10000px"; + h.style.fontSize = "300px"; + h.style.fontFamily = "sans-serif"; + h.style.fontVariant = "normal"; + h.style.fontStyle = "normal"; + h.style.fontWeight = "normal"; + h.style.letterSpacing = "0"; + document.body.appendChild(h); + var k = h.offsetWidth; + h.style.fontFamily = d; + var l; + e() || (l = setInterval(e, 50)); + })(a[d]); } }; -Entry.Engine.prototype.setSpeedMeter = function(b) { - var a = this.speeds.indexOf(b); - 0 > a || (a = Math.min(4, a), a = Math.max(0, a), this.speedPanelOn && (this.speedHandle_.style.left = (Entry.interfaceState.canvasWidth - 80) / 10 * (2 * a + 1) + 80 - 9 + "px"), Entry.FPS != b && (clearInterval(this.ticker), this.ticker = setInterval(this.update, Math.floor(1E3 / b)), Entry.FPS = b)); +window.requestAnimFrame = function() { + return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(a) { + window.setTimeout(a, 1E3 / 60); + }; +}(); +Entry.Model = function(a, b) { + var c = Entry.Model; + c.generateSchema(a); + c.generateSetter(a); + c.generateObserve(a); + (void 0 === b || b) && Object.seal(a); + return a; }; -Entry.Engine.prototype.start = function(b) { - createjs.Ticker.setFPS(Entry.FPS); - this.ticker = setInterval(this.update, Math.floor(1E3 / Entry.FPS)); +(function(a) { + a.generateSchema = function(b) { + var a = b.schema; + if (void 0 !== a) { + a = JSON.parse(JSON.stringify(a)); + b.data = {}; + for (var d in a) { + (function(d) { + b.data[d] = a[d]; + Object.defineProperty(b, d, {get:function() { + return b.data[d]; + }}); + })(d); + } + b._toJSON = this._toJSON; + } + }; + a.generateSetter = function(b) { + b.set = this.set; + }; + a.set = function(b, a) { + var d = {}, e; + for (e in this.data) { + void 0 !== b[e] && (b[e] === this.data[e] ? delete b[e] : (d[e] = this.data[e], this.data[e] = b[e] instanceof Array ? b[e].concat() : b[e])); + } + a || this.notify(Object.keys(b), d); + }; + a.generateObserve = function(b) { + b.observers = []; + b.observe = this.observe; + b.unobserve = this.unobserve; + b.notify = this.notify; + }; + a.observe = function(b, a, d, e) { + d = new Entry.Observer(this.observers, b, a, d); + if (!1 !== e) { + b[a]([]); + } + return d; + }; + a.unobserve = function(b) { + b.destroy(); + }; + a.notify = function(b, a) { + "string" === typeof b && (b = [b]); + var d = this; + d.observers.map(function(e) { + var f = b; + void 0 !== e.attrs && (f = Entry.Utils.intersectArray(e.attrs, b)); + if (f.length) { + e.object[e.funcName](f.map(function(b) { + return {name:b, object:d, oldValue:a[b]}; + })); + } + }); + }; + a._toJSON = function() { + var b = {}, a; + for (a in this.data) { + b[a] = this.data[a]; + } + return b; + }; +})(Entry.Model); +Entry.Observer = function(a, b, c, d) { + this.parent = a; + this.object = b; + this.funcName = c; + this.attrs = d; + a.push(this); }; -Entry.Engine.prototype.stop = function() { - clearInterval(this.ticker); - this.ticker = null; +(function(a) { + a.destroy = function() { + var b = this.parent, a = b.indexOf(this); + -1 < a && b.splice(a, 1); + return this; + }; +})(Entry.Observer.prototype); +Entry.Command = {}; +(function(a) { + a["do"] = {type:EntryStatic.COMMAND_TYPES["do"], log:function(b) { + return [a["do"].type]; + }}; + a.undo = {type:EntryStatic.COMMAND_TYPES.undo, log:function(b) { + return [a.undo.type]; + }}; + a.redo = {type:EntryStatic.COMMAND_TYPES.redo, log:function(b) { + return [a.redo.type]; + }}; +})(Entry.Command); +Entry.Commander = function(a) { + if ("workspace" == a || "phone" == a) { + Entry.stateManager = new Entry.StateManager; + } + Entry.do = this.do.bind(this); + Entry.undo = this.undo.bind(this); + this.editor = {}; + this.reporters = []; + this._tempStorage = null; + Entry.Command.editor = this.editor; }; -Entry.Engine.prototype.update = function() { - Entry.engine.isState("run") && (Entry.engine.computeObjects(), Entry.hw.update()); +(function(a) { + a.do = function(b) { + var a = this, d = Array.prototype.slice.call(arguments); + d.shift(); + var e = Entry.Command[b]; + Entry.stateManager && Entry.stateManager.addCommand.apply(Entry.stateManager, [b, this, this.do, e.undo].concat(e.state.apply(this, d))); + e = Entry.Command[b].do.apply(this, d); + setTimeout(function() { + a.report("do"); + a.report(b, d); + }, 0); + return {value:e, isPass:this.isPass.bind(this)}; + }; + a.undo = function() { + var b = Array.prototype.slice.call(arguments), a = b.shift(), d = Entry.Command[a]; + this.report("undo"); + Entry.stateManager && Entry.stateManager.addCommand.apply(Entry.stateManager, [a, this, this.do, d.undo].concat(d.state.apply(this, b))); + return {value:Entry.Command[a].do.apply(this, b), isPass:this.isPass.bind(this)}; + }; + a.redo = function() { + var b = Array.prototype.slice.call(arguments), a = b.shift(), d = Entry.Command[a]; + that.report("redo"); + Entry.stateManager && Entry.stateManager.addCommand.apply(Entry.stateManager, [a, this, this.undo, a].concat(d.state.apply(null, b))); + d.undo.apply(this, b); + }; + a.setCurrentEditor = function(b, a) { + this.editor[b] = a; + }; + a.isPass = function(b) { + b = void 0 === b ? !0 : b; + if (Entry.stateManager) { + var a = Entry.stateManager.getLastCommand(); + a && (a.isPass = b); + } + }; + a.addReporter = function(b) { + this.reporters.push(b); + }; + a.removeReporter = function(b) { + b = this.reporters.indexOf(b); + -1 < b && this.reporters.splice(b, 1); + }; + a.report = function(b, a) { + var d = this.reporters; + if (0 !== d.length) { + var e; + e = b && Entry.Command[b] && Entry.Command[b].log ? Entry.Command[b].log.apply(this, a) : a; + d.forEach(function(b) { + b.add(e); + }); + } + }; +})(Entry.Commander.prototype); +(function(a) { + a.addThread = {type:EntryStatic.COMMAND_TYPES.addThread, do:function(b) { + return this.editor.board.code.createThread(b); + }, state:function(b) { + b.length && (b[0].id = Entry.Utils.generateId()); + return [b]; + }, log:function(b) { + b = this.editor.board.code.getThreads().pop(); + return [a.addThread.type, ["thread", b.stringify()], ["code", this.editor.board.code.stringify()]]; + }, undo:"destroyThread"}; + a.destroyThread = {type:EntryStatic.COMMAND_TYPES.destroyThread, do:function(b) { + this.editor.board.findById(b[0].id).destroy(!0, !0); + }, state:function(b) { + return [this.editor.board.findById(b[0].id).thread.toJSON()]; + }, log:function(b) { + b = b[0].id; + this.editor.board.findById(b); + return [a.destroyThread.type, ["blockId", b], ["code", this.editor.board.code.stringify()]]; + }, undo:"addThread"}; + a.destroyBlock = {type:EntryStatic.COMMAND_TYPES.destroyBlock, do:function(b) { + "string" === typeof b && (b = this.editor.board.findById(b)); + b.doDestroy(!0); + }, state:function(b) { + "string" === typeof b && (b = this.editor.board.findById(b)); + return [b.toJSON(), b.pointer()]; + }, log:function(b) { + "string" === typeof b && (b = this.editor.board.findById(b)); + return [a.destroyBlock.type, ["blockId", b.id], ["code", this.editor.board.code.stringify()]]; + }, undo:"recoverBlock"}; + a.recoverBlock = {type:EntryStatic.COMMAND_TYPES.recoverBlock, do:function(b, a) { + b = this.editor.board.code.createThread([b]).getFirstBlock(); + "string" === typeof b && (b = this.editor.board.findById(b)); + this.editor.board.insert(b, a); + }, state:function(b) { + "string" !== typeof b && (b = b.id); + return [b]; + }, log:function(b, c) { + b = this.editor.board.findById(b.id); + return [a.recoverBlock.type, ["block", b.stringify()], ["pointer", c], ["code", this.editor.board.code.stringify()]]; + }, undo:"destroyBlock"}; + a.insertBlock = {type:EntryStatic.COMMAND_TYPES.insertBlock, do:function(b, a, d) { + "string" === typeof b && (b = this.editor.board.findById(b)); + this.editor.board.insert(b, a, d); + }, state:function(b, a) { + "string" === typeof b && (b = this.editor.board.findById(b)); + a = [b.id]; + var d = b.targetPointer(); + a.push(d); + "string" !== typeof b && "basic" === b.getBlockType() && a.push(b.thread.getCount(b)); + return a; + }, log:function(b, c, d) { + "string" === typeof b && (b = this.editor.board.findById(b)); + return [a.insertBlock.type, ["blockId", b.id], ["targetPointer", b.targetPointer()], ["count", d], ["code", this.editor.board.code.stringify()]]; + }, undo:"insertBlock"}; + a.separateBlock = {type:EntryStatic.COMMAND_TYPES.separateBlock, do:function(b) { + b.view && b.view._toGlobalCoordinate(Entry.DRAG_MODE_DRAG); + b.doSeparate(); + }, state:function(b) { + var a = [b.id], d = b.targetPointer(); + a.push(d); + "basic" === b.getBlockType() && a.push(b.thread.getCount(b)); + return a; + }, log:function(b) { + "string" === typeof b && (b = this.editor.board.findById(b)); + return [a.separateBlock.type, ["blockId", b.id], ["x", b.x], ["y", b.y], ["code", this.editor.board.code.stringify()]]; + }, undo:"insertBlock"}; + a.moveBlock = {type:EntryStatic.COMMAND_TYPES.moveBlock, do:function(b, a, d) { + void 0 !== a ? (b = this.editor.board.findById(b), b.moveTo(a, d)) : b._updatePos(); + }, state:function(b) { + "string" === typeof b && (b = this.editor.board.findById(b)); + return [b.id, b.x, b.y]; + }, log:function(b, c, d) { + return [a.moveBlock.type, ["blockId", b.id], ["x", b.x], ["y", b.y], ["code", this.editor.board.code.stringify()]]; + }, undo:"moveBlock"}; + a.cloneBlock = {type:EntryStatic.COMMAND_TYPES.cloneBlock, do:function(b) { + "string" === typeof b && (b = this.editor.board.findById(b)); + this.editor.board.code.createThread(b.copy()); + }, state:function(b) { + "string" !== typeof b && (b = b.id); + return [b]; + }, log:function(b) { + "string" === typeof b && (b = this.editor.board.findById(b)); + var c = this.editor.board.code.getThreads().pop(); + return [a.cloneBlock.type, ["blockId", b.id], ["thread", c.stringify()], ["code", this.editor.board.code.stringify()]]; + }, undo:"uncloneBlock"}; + a.uncloneBlock = {type:EntryStatic.COMMAND_TYPES.uncloneBlock, do:function(b) { + b = this.editor.board.code.getThreads().pop().getFirstBlock(); + this._tempStorage = b.id; + b.destroy(!0, !0); + }, state:function(b) { + return [b]; + }, log:function(b) { + b = this._tempStorage; + this._tempStorage = null; + return [a.uncloneBlock.type, ["blockId", b], ["code", this.editor.board.code.stringify()]]; + }, undo:"cloneBlock"}; + a.scrollBoard = {type:EntryStatic.COMMAND_TYPES.scrollBoard, do:function(b, a, d) { + d || this.editor.board.scroller._scroll(b, a); + delete this.editor.board.scroller._diffs; + }, state:function(b, a) { + return [-b, -a]; + }, log:function(b, c) { + return [a.scrollBoard.type, ["dx", b], ["dy", c]]; + }, undo:"scrollBoard"}; + a.setFieldValue = {type:EntryStatic.COMMAND_TYPES.setFieldValue, do:function(b, a, d, e, f) { + a.setValue(f, !0); + }, state:function(b, a, d, e, f) { + return [b, a, d, f, e]; + }, log:function(b, c, d, e, f) { + return [a.setFieldValue.type, ["pointer", d], ["newValue", f], ["code", this.editor.board.code.stringify()]]; + }, undo:"setFieldValue"}; +})(Entry.Command); +(function(a) { + a.selectObject = {type:EntryStatic.COMMAND_TYPES.selectObject, do:function(b) { + return Entry.container.selectObject(b); + }, state:function(b) { + if ((b = Entry.playground) && b.object) { + return [b.object.id]; + } + }, log:function(b) { + return [b]; + }, undo:"selectObject"}; +})(Entry.Command); +Entry.Container = function() { + this.objects_ = []; + this.cachedPicture = {}; + this.inputValue = {}; + this.currentObjects_ = this.copiedObject = null; }; -Entry.Engine.prototype.computeObjects = function() { - Entry.container.mapObjectOnScene(this.computeFunction); +Entry.Container.prototype.generateView = function(a, b) { + this._view = a; + this._view.addClass("entryContainer"); + b && "workspace" != b ? "phone" == b && (this._view.addClass("entryContainerPhone"), a = Entry.createElement("div"), a.addClass("entryAddObjectWorkspace"), a.innerHTML = Lang.Workspace.add_object, a.bindOnClick(function(b) { + Entry.dispatchEvent("openSpriteManager"); + }), a = Entry.createElement("div"), a.addClass("entryContainerListPhoneWrapper"), this._view.appendChild(a), b = Entry.createElement("ul"), b.addClass("entryContainerListPhone"), a.appendChild(b), this.listView_ = b) : (this._view.addClass("entryContainerWorkspace"), this._view.setAttribute("id", "entryContainerWorkspaceId"), a = Entry.createElement("div"), a.addClass("entryAddObjectWorkspace"), a.innerHTML = Lang.Workspace.add_object, a.bindOnClick(function(b) { + Entry.dispatchEvent("openSpriteManager"); + }), a = Entry.createElement("div"), a.addClass("entryContainerListWorkspaceWrapper"), Entry.isForLecture && a.addClass("lecture"), Entry.Utils.disableContextmenu(a), $(a).on("contextmenu", function(b) { + b = [{text:Lang.Blocks.Paste_blocks, enable:!Entry.engine.isState("run") && !!Entry.container.copiedObject, callback:function() { + Entry.container.copiedObject ? Entry.container.addCloneObject(Entry.container.copiedObject) : Entry.toast.alert(Lang.Workspace.add_object_alert, Lang.Workspace.object_not_found_for_paste); + }}]; + Entry.ContextMenu.show(b, "workspace-contextmenu"); + }), this._view.appendChild(a), b = Entry.createElement("ul"), b.addClass("entryContainerListWorkspace"), a.appendChild(b), this.listView_ = b, this.enableSort()); }; -Entry.Engine.prototype.computeFunction = function(b) { - b.script.tick(); +Entry.Container.prototype.enableSort = function() { + $ && $(this.listView_).sortable({start:function(a, b) { + b.item.data("start_pos", b.item.index()); + }, stop:function(a, b) { + a = b.item.data("start_pos"); + b = b.item.index(); + Entry.container.moveElement(a, b); + }, axis:"y", cancel:"input.selectedEditingObject"}); }; -Entry.Engine.computeThread = function(b, a) { - Entry.engine.isContinue = !0; - for (var c = !1;a && Entry.engine.isContinue && !c;) { - Entry.engine.isContinue = !a.isRepeat; - var d = a.run(), c = d && d === a; - a = d; +Entry.Container.prototype.disableSort = function() { + $ && $(this.listView_).sortable("destroy"); +}; +Entry.Container.prototype.updateListView = function() { + if (this.listView_) { + for (var a = this.listView_;a.hasChildNodes();) { + a.removeChild(a.lastChild); + } + var b = this.getCurrentObjects(), c; + for (c in b) { + a.appendChild(b[c].view_); + } + Entry.stage.sortZorder(); } - return a; }; -Entry.Engine.prototype.isState = function(b) { - return -1 < this.state.indexOf(b); +Entry.Container.prototype.setObjects = function(a) { + for (var b in a) { + var c = new Entry.EntryObject(a[b]); + this.objects_.push(c); + c.generateView(); + c.pictures.map(function(b) { + Entry.playground.generatePictureElement(b); + }); + c.sounds.map(function(b) { + Entry.playground.generateSoundElement(b); + }); + } + this.updateObjectsOrder(); + this.updateListView(); + Entry.stage.sortZorder(); + Entry.variableContainer.updateViews(); + a = Entry.type; + ("workspace" == a || "phone" == a) && (a = this.getCurrentObjects()[0]) && this.selectObject(a.id); }; -Entry.Engine.prototype.run = function() { - this.isState("run") ? this.toggleStop() : (this.isState("stop") || this.isState("pause")) && this.toggleRun(); +Entry.Container.prototype.getPictureElement = function(a, b) { + if (a = this.getObject(b).getPicture(a)) { + return a.view; + } + throw Error("No picture found"); }; -Entry.Engine.prototype.toggleRun = function() { - "pause" === this.state ? this.togglePause() : (Entry.addActivity("run"), "stop" == this.state && (Entry.container.mapEntity(function(b) { - b.takeSnapshot(); - }), Entry.variableContainer.mapVariable(function(b) { - b.takeSnapshot(); - }), Entry.variableContainer.mapList(function(b) { - b.takeSnapshot(); - }), this.projectTimer.takeSnapshot(), Entry.container.inputValue.takeSnapshot(), Entry.container.takeSequenceSnapshot(), Entry.scene.takeStartSceneSnapshot(), this.state = "run", this.fireEvent("start")), this.state = "run", "mobile" == Entry.type && this.view_.addClass("entryEngineBlueWorkspace"), this.pauseButton.innerHTML = Lang.Workspace.pause, this.runButton.addClass("run"), this.runButton.addClass("entryRemove"), this.stopButton.removeClass("entryRemove"), this.pauseButton && this.pauseButton.removeClass("entryRemove"), - this.runButton2 && this.runButton2.addClass("entryRemove"), this.stopButton2 && this.stopButton2.removeClass("entryRemove"), this.isUpdating || (Entry.engine.update(), Entry.engine.isUpdating = !0), Entry.stage.selectObject(), Entry.dispatchEvent("run")); +Entry.Container.prototype.setPicture = function(a) { + var b = this.getObject(a.objectId), c; + for (c in b.pictures) { + if (a.id === b.pictures[c].id) { + var d = {}; + d.dimension = a.dimension; + d.id = a.id; + d.filename = a.filename; + d.fileurl = a.fileurl; + d.name = a.name; + d.view = b.pictures[c].view; + b.pictures[c] = d; + return; + } + } + throw Error("No picture found"); }; -Entry.Engine.prototype.toggleStop = function() { - Entry.addActivity("stop"); - var b = Entry.container, a = Entry.variableContainer; - b.mapEntity(function(a) { - a.loadSnapshot(); - a.object.filters = []; - a.resetFilter(); - a.dialog && a.dialog.remove(); - a.brush && a.removeBrush(); - }); - a.mapVariable(function(a) { - a.loadSnapshot(); +Entry.Container.prototype.selectPicture = function(a, b) { + b = this.getObject(b); + if (a = b.getPicture(a)) { + return b.selectedPicture = a, b.entity.setImage(a), b.updateThumbnailView(), b.id; + } + throw Error("No picture found"); +}; +Entry.Container.prototype.addObject = function(a, b) { + var c = new Entry.EntryObject(a); + c.name = Entry.getOrderedName(c.name, this.objects_); + Entry.stateManager && Entry.stateManager.addCommand("add object", this, this.removeObject, c); + c.scene || (c.scene = Entry.scene.selectedScene); + "number" == typeof b ? a.sprite.category && "background" == a.sprite.category.main ? (c.setLock(!0), this.objects_.push(c)) : this.objects_.splice(b, 0, c) : a.sprite.category && "background" == a.sprite.category.main ? this.objects_.push(c) : this.objects_.unshift(c); + c.generateView(); + c.pictures.map(function(b) { + Entry.playground.generatePictureElement(b); }); - a.mapList(function(a) { - a.loadSnapshot(); - a.updateView(); + c.sounds.map(function(b) { + Entry.playground.generateSoundElement(b); }); - this.stopProjectTimer(); - b.clearRunningState(); - b.loadSequenceSnapshot(); - this.projectTimer.loadSnapshot(); - Entry.container.inputValue.loadSnapshot(); - Entry.scene.loadStartSceneSnapshot(); - Entry.Func.clearThreads(); - createjs.Sound.setVolume(1); - createjs.Sound.stop(); - this.view_.removeClass("entryEngineBlueWorkspace"); - this.runButton.removeClass("entryRemove"); - this.stopButton.addClass("entryRemove"); - this.pauseButton && this.pauseButton.addClass("entryRemove"); - this.runButton2 && this.runButton2.removeClass("entryRemove"); - this.stopButton2 && this.stopButton2.addClass("entryRemove"); - this.state = "stop"; - Entry.dispatchEvent("stop"); - Entry.stage.hideInputField(); -}; -Entry.Engine.prototype.togglePause = function() { - var b = Entry.engine.projectTimer; - "pause" == this.state ? (b.pausedTime += (new Date).getTime() - b.pauseStart, b.isPaused ? b.pauseStart = (new Date).getTime() : delete b.pauseStart, this.state = "run", this.pauseButton.innerHTML = Lang.Workspace.pause, this.runButton.addClass("entryRemove"), this.runButton2 && this.runButton2.addClass("entryRemove")) : (this.state = "pause", b.isPaused && (b.pausedTime += (new Date).getTime() - b.pauseStart), b.pauseStart = (new Date).getTime(), this.pauseButton.innerHTML = Lang.Workspace.restart, - this.runButton.removeClass("entryRemove"), this.stopButton.removeClass("entryRemove"), this.runButton2 && this.runButton2.removeClass("entryRemove")); -}; -Entry.Engine.prototype.fireEvent = function(b) { - "run" == this.state && Entry.container.mapEntityIncludeCloneOnScene(this.raiseEvent, b); -}; -Entry.Engine.prototype.raiseEvent = function(b, a) { - b.parent.script.raiseEvent(a, b); -}; -Entry.Engine.prototype.fireEventOnEntity = function(b, a) { - "run" == this.state && Entry.container.mapEntityIncludeCloneOnScene(this.raiseEventOnEntity, [a, b]); + this.setCurrentObjects(); + this.updateObjectsOrder(); + this.updateListView(); + this.selectObject(c.id); + Entry.variableContainer.updateViews(); + return new Entry.State(this, this.removeObject, c); }; -Entry.Engine.prototype.raiseEventOnEntity = function(b, a) { - b === a[0] && b.parent.script.raiseEvent(a[1], b); +Entry.Container.prototype.addCloneObject = function(a, b) { + a = a.toJSON(); + var c = Entry.generateHash(); + Entry.variableContainer.addCloneLocalVariables({objectId:a.id, newObjectId:c, json:a}); + a.id = c; + a.scene = b || Entry.scene.selectedScene; + this.addObject(a); +}; +Entry.Container.prototype.removeObject = function(a) { + var b = this.objects_.indexOf(a), c = a.toJSON(); + Entry.stateManager && Entry.stateManager.addCommand("remove object", this, this.addObject, c, b); + c = new Entry.State(this.addObject, c, b); + a.destroy(); + this.objects_.splice(b, 1); + this.setCurrentObjects(); + Entry.stage.sortZorder(); + this.objects_.length && 0 !== b ? 0 < this.getCurrentObjects().length ? Entry.container.selectObject(this.getCurrentObjects()[0].id) : Entry.container.selectObject() : this.objects_.length && 0 === b ? Entry.container.selectObject(this.getCurrentObjects()[0].id) : (Entry.container.selectObject(), Entry.playground.flushPlayground()); + Entry.toast.success(Lang.Workspace.remove_object, a.name + " " + Lang.Workspace.remove_object_msg); + Entry.variableContainer.removeLocalVariables(a.id); + Entry.playground.reloadPlayground(); + return c; }; -Entry.Engine.prototype.captureKeyEvent = function(b) { - var a = b.keyCode, c = Entry.type; - b.ctrlKey && "workspace" == c ? 83 == a ? (b.preventDefault(), Entry.dispatchEvent("saveWorkspace")) : 82 == a ? (b.preventDefault(), Entry.engine.run()) : 90 == a && (b.preventDefault(), console.log("engine"), Entry.dispatchEvent(b.shiftKey ? "redo" : "undo")) : Entry.engine.isState("run") && Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent, ["keyPress", a]); - Entry.engine.isState("stop") && "workspace" === c && 37 <= a && 40 >= a && Entry.stage.moveSprite(b); +Entry.Container.prototype.selectObject = function(a, b) { + a = this.getObject(a); + b && a && Entry.scene.selectScene(a.scene); + this.mapObjectOnScene(function(b) { + b.view_ && b.view_.removeClass("selectedObject"); + b.isSelected_ = !1; + }); + a && (a.view_ && a.view_.addClass("selectedObject"), a.isSelected_ = !0); + Entry.playground && Entry.playground.injectObject(a); + "minimize" != Entry.type && Entry.engine.isState("stop") && Entry.stage.selectObject(a); }; -Entry.Engine.prototype.raiseKeyEvent = function(b, a) { - return b.parent.script.raiseEvent(a[0], b, String(a[1])); +Entry.Container.prototype.getAllObjects = function() { + return this.objects_; }; -Entry.Engine.prototype.updateMouseView = function() { - var b = Entry.stage.mouseCoordinate; - this.mouseView.textContent = "X : " + b.x + ", Y : " + b.y; - this.mouseView.removeClass("entryRemove"); +Entry.Container.prototype.getObject = function(a) { + !a && Entry.playground && Entry.playground.object && (a = Entry.playground.object.id); + for (var b = this.objects_.length, c = 0;c < b;c++) { + var d = this.objects_[c]; + if (d.id == a) { + return d; + } + } }; -Entry.Engine.prototype.hideMouseView = function() { - this.mouseView.addClass("entryRemove"); +Entry.Container.prototype.getEntity = function(a) { + if (a = this.getObject(a)) { + return a.entity; + } + Entry.toast.alert(Lang.Msgs.runtime_error, Lang.Workspace.object_not_found, !0); }; -Entry.Engine.prototype.toggleFullscreen = function() { - if (this.popup) { - this.popup.remove(), this.popup = null; - } else { - this.popup = new Entry.Popup; - if ("workspace" != Entry.type) { - var b = $(document); - $(this.popup.body_).css("top", b.scrollTop()); - $("body").css("overflow", "hidden"); - popup.window_.appendChild(Entry.stage.canvas.canvas); - popup.window_.appendChild(Entry.engine.runButton[0]); +Entry.Container.prototype.getVariable = function(a) { + for (var b = 0;b < this.variables_.length;b++) { + var c = this.variables_[b]; + if (c.getId() == a || c.getName() == a) { + return c; } - popup.window_.appendChild(Entry.engine.view_); } - Entry.windowResized.notify(); }; -Entry.Engine.prototype.exitFullScreen = function() { - document.webkitIsFullScreen || document.mozIsFullScreen || document.isFullScreen || (Entry.engine.footerView_.removeClass("entryRemove"), Entry.engine.headerView_.removeClass("entryRemove")); - Entry.windowResized.notify(); +Entry.Container.prototype.moveElement = function(a, b, c) { + var d; + d = this.getCurrentObjects(); + a = this.getAllObjects().indexOf(d[a]); + b = this.getAllObjects().indexOf(d[b]); + !c && Entry.stateManager && Entry.stateManager.addCommand("reorder object", Entry.container, Entry.container.moveElement, b, a, !0); + this.objects_.splice(b, 0, this.objects_.splice(a, 1)[0]); + this.setCurrentObjects(); + Entry.container.updateListView(); + Entry.requestUpdate = !0; + return new Entry.State(Entry.container, Entry.container.moveElement, b, a, !0); }; -Entry.Engine.prototype.showProjectTimer = function() { - Entry.engine.projectTimer && this.projectTimer.setVisible(!0); +Entry.Container.prototype.moveElementByBlock = function(a, b) { + a = this.getCurrentObjects().splice(a, 1)[0]; + this.getCurrentObjects().splice(b, 0, a); + Entry.stage.sortZorder(); + this.updateListView(); }; -Entry.Engine.prototype.hideProjectTimer = function() { - var b = this.projectTimer; - if (b && b.isVisible() && !this.isState("run")) { - for (var a = Entry.container.getAllObjects(), c = ["get_project_timer_value", "reset_project_timer", "set_visible_project_timer", "choose_project_timer_action"], d = 0, e = a.length;d < e;d++) { - for (var f = a[d].script, g = 0;g < c.length;g++) { - if (f.hasBlockType(c[g])) { - return; - } +Entry.Container.prototype.getDropdownList = function(a, b) { + var c = []; + switch(a) { + case "sprites": + var d = this.getCurrentObjects(), e = d.length; + for (a = 0;a < e;a++) { + b = d[a], c.push([b.name, b.id]); } - } - b.setVisible(!1); + break; + case "spritesWithMouse": + d = this.getCurrentObjects(); + e = d.length; + for (a = 0;a < e;a++) { + b = d[a], c.push([b.name, b.id]); + } + c.push([Lang.Blocks.mouse_pointer, "mouse"]); + break; + case "spritesWithSelf": + d = this.getCurrentObjects(); + e = d.length; + for (a = 0;a < e;a++) { + b = d[a], c.push([b.name, b.id]); + } + c.push([Lang.Blocks.self, "self"]); + break; + case "collision": + c.push([Lang.Blocks.mouse_pointer, "mouse"]); + d = this.getCurrentObjects(); + e = d.length; + for (a = 0;a < e;a++) { + b = d[a], c.push([b.name, b.id]); + } + c.push([Lang.Blocks.wall, "wall"]); + c.push([Lang.Blocks.wall_up, "wall_up"]); + c.push([Lang.Blocks.wall_down, "wall_down"]); + c.push([Lang.Blocks.wall_right, "wall_right"]); + c.push([Lang.Blocks.wall_left, "wall_left"]); + break; + case "pictures": + b = Entry.playground.object || b; + if (!b) { + break; + } + b = b.pictures; + for (a = 0;a < b.length;a++) { + d = b[a], c.push([d.name, d.id]); + } + break; + case "messages": + b = Entry.variableContainer.messages_; + for (a = 0;a < b.length;a++) { + d = b[a], c.push([d.name, d.id]); + } + break; + case "variables": + b = Entry.variableContainer.variables_; + for (a = 0;a < b.length;a++) { + d = b[a], d.object_ && Entry.playground.object && d.object_ != Entry.playground.object.id || c.push([d.getName(), d.getId()]); + } + c && 0 !== c.length || c.push([Lang.Blocks.VARIABLE_variable, "null"]); + break; + case "lists": + b = Entry.playground.object || b; + d = Entry.variableContainer.lists_; + for (a = 0;a < d.length;a++) { + e = d[a], e.object_ && b && e.object_ != b.id || c.push([e.getName(), e.getId()]); + } + c && 0 !== c.length || c.push([Lang.Blocks.VARIABLE_list, "null"]); + break; + case "scenes": + b = Entry.scene.scenes_; + for (a = 0;a < b.length;a++) { + d = b[a], c.push([d.name, d.id]); + } + break; + case "sounds": + b = Entry.playground.object || b; + if (!b) { + break; + } + b = b.sounds; + for (a = 0;a < b.length;a++) { + d = b[a], c.push([d.name, d.id]); + } + break; + case "clone": + c.push([Lang.Blocks.oneself, "self"]); + e = this.objects_.length; + for (a = 0;a < e;a++) { + b = this.objects_[a], c.push([b.name, b.id]); + } + break; + case "objectSequence": + for (e = this.getCurrentObjects().length, a = 0;a < e;a++) { + c.push([(a + 1).toString(), a.toString()]); + } + ; } + c.length || (c = [[Lang.Blocks.no_target, "null"]]); + return c; }; -Entry.Engine.prototype.clearTimer = function() { - clearInterval(this.ticker); - clearInterval(this.projectTimer.tick); -}; -Entry.Engine.prototype.startProjectTimer = function() { - var b = this.projectTimer; - b && (b.start = (new Date).getTime(), b.isInit = !0, b.pausedTime = 0, b.tick = setInterval(function(a) { - Entry.engine.updateProjectTimer(); - }, 1E3 / 60)); +Entry.Container.prototype.clearRunningState = function() { + this.mapObject(function(a) { + a.clearExecutor(); + for (var b = a.clonedEntities.length;0 < b;b--) { + a.clonedEntities[b - 1].removeClone(); + } + a.clonedEntities = []; + }); }; -Entry.Engine.prototype.stopProjectTimer = function() { - var b = this.projectTimer; - b && (this.updateProjectTimer(0), b.isPaused = !1, b.isInit = !1, b.pausedTime = 0, clearInterval(b.tick)); +Entry.Container.prototype.mapObject = function(a, b) { + for (var c = this.objects_.length, d = [], e = 0;e < c;e++) { + d.push(a(this.objects_[e], b)); + } + return d; }; -Entry.Engine.prototype.updateProjectTimer = function(b) { - var a = Entry.engine, c = a.projectTimer; - if (c) { - var d = (new Date).getTime(); - "undefined" == typeof b ? c.isPaused || a.isState("pause") || c.setValue((d - c.start - c.pausedTime) / 1E3) : (c.setValue(b), c.pausedTime = 0, c.start = d); +Entry.Container.prototype.mapObjectOnScene = function(a, b) { + for (var c = this.getCurrentObjects(), d = c.length, e = [], f = 0;f < d;f++) { + e.push(a(c[f], b)); } + return e; }; -Entry.EntityObject = function(b) { - this.parent = b; - this.type = b.objectType; - this.flip = !1; - this.collision = Entry.Utils.COLLISION.NONE; - this.id = Entry.generateHash(); - "sprite" == this.type ? (this.object = new createjs.Bitmap, this.effect = {}, this.setInitialEffectValue()) : "textBox" == this.type && (this.object = new createjs.Container, this.textObject = new createjs.Text, this.textObject.font = "20px Nanum Gothic", this.textObject.textBaseline = "middle", this.textObject.textAlign = "center", this.bgObject = new createjs.Shape, this.bgObject.graphics.setStrokeStyle(1).beginStroke("#f00").drawRect(0, 0, 100, 100), this.object.addChild(this.bgObject), this.object.addChild(this.textObject), - this.fontType = "Nanum Gothic", this.fontSize = 20, this.strike = this.underLine = this.fontItalic = this.fontBold = !1); - this.object.entity = this; - this.object.cursor = "pointer"; - this.object.on("mousedown", function(a) { - var b = this.entity.parent.id; - Entry.dispatchEvent("entityClick", this.entity); - Entry.stage.isObjectClick = !0; - "minimize" != Entry.type && Entry.engine.isState("stop") && (this.offset = {x:-this.parent.x + this.entity.getX() - (.75 * a.stageX - 240), y:-this.parent.y - this.entity.getY() - (.75 * a.stageY - 135)}, this.cursor = "move", this.entity.initCommand(), Entry.container.selectObject(b)); - }); - this.object.on("pressup", function(a) { - Entry.dispatchEvent("entityClickCanceled", this.entity); - this.cursor = "pointer"; - this.entity.checkCommand(); - }); - this.object.on("pressmove", function(a) { - "minimize" != Entry.type && Entry.engine.isState("stop") && !this.entity.parent.getLock() && (this.entity.doCommand(), this.entity.setX(.75 * a.stageX - 240 + this.offset.x), this.entity.setY(-(.75 * a.stageY - 135) - this.offset.y), Entry.stage.updateObject()); +Entry.Container.prototype.clearRunningStateOnScene = function() { + this.mapObjectOnScene(function(a) { + a.clearExecutor(); + for (var b = a.clonedEntities.length;0 < b;b--) { + a.clonedEntities[b - 1].removeClone(); + } + a.clonedEntities = []; }); }; -Entry.EntityObject.prototype.injectModel = function(b, a) { - if ("sprite" == this.type) { - this.setImage(b); - } else { - if ("textBox" == this.type) { - var c = this.parent; - a.text = a.text || c.text || c.name; - this.setFont(a.font); - this.setBGColour(a.bgColor); - this.setColour(a.colour); - this.setUnderLine(a.underLine); - this.setStrike(a.strike); - this.setText(a.text); - } - } - a && this.syncModel_(a); -}; -Entry.EntityObject.prototype.syncModel_ = function(b) { - this.setX(b.x); - this.setY(b.y); - this.setRegX(b.regX); - this.setRegY(b.regY); - this.setScaleX(b.scaleX); - this.setScaleY(b.scaleY); - this.setRotation(b.rotation); - this.setDirection(b.direction, !0); - this.setLineBreak(b.lineBreak); - this.setWidth(b.width); - this.setHeight(b.height); - this.setText(b.text); - this.setTextAlign(b.textAlign); - this.setFontSize(b.fontSize || this.getFontSize()); - this.setVisible(b.visible); +Entry.Container.prototype.mapEntity = function(a, b) { + for (var c = this.objects_.length, d = [], e = 0;e < c;e++) { + d.push(a(this.objects_[e].entity, b)); + } + return d; }; -Entry.EntityObject.prototype.initCommand = function() { - Entry.engine.isState("stop") && (this.isCommandValid = !1, Entry.stateManager && Entry.stateManager.addCommand("edit entity", this, this.restoreEntity, this.toJSON())); +Entry.Container.prototype.mapEntityOnScene = function(a, b) { + for (var c = this.getCurrentObjects(), d = c.length, e = [], f = 0;f < d;f++) { + e.push(a(c[f].entity, b)); + } + return e; }; -Entry.EntityObject.prototype.doCommand = function() { - this.isCommandValid = !0; +Entry.Container.prototype.mapEntityIncludeClone = function(a, b) { + for (var c = this.objects_, d = c.length, e = [], f = 0;f < d;f++) { + var g = c[f], h = g.clonedEntities.length; + e.push(a(g.entity, b)); + for (var k = 0;k < h;k++) { + var l = g.clonedEntities[k]; + l && !l.isStamp && e.push(a(l, b)); + } + } + return e; }; -Entry.EntityObject.prototype.checkCommand = function() { - Entry.engine.isState("stop") && !this.isCommandValid && Entry.dispatchEvent("cancelLastCommand"); +Entry.Container.prototype.mapEntityIncludeCloneOnScene = function(a, b) { + for (var c = this.getCurrentObjects(), d = c.length, e = [], f = 0;f < d;f++) { + var g = c[f], h = g.clonedEntities.length; + e.push(a(g.entity, b)); + for (var k = 0;k < h;k++) { + var l = g.clonedEntities[k]; + l && !l.isStamp && e.push(a(l, b)); + } + } + return e; }; -Entry.EntityObject.prototype.restoreEntity = function(b) { - var a = this.toJSON(); - this.syncModel_(b); - Entry.dispatchEvent("updateObject"); - Entry.stateManager && Entry.stateManager.addCommand("restore object", this, this.restoreEntity, a); -}; -Entry.EntityObject.prototype.setX = function(b) { - "number" == typeof b && (this.x = b, this.object.x = this.x, this.isClone || this.parent.updateCoordinateView(), this.updateDialog(), Entry.requestUpdate = !0); -}; -Entry.EntityObject.prototype.getX = function() { - return this.x; -}; -Entry.EntityObject.prototype.setY = function(b) { - "number" == typeof b && (this.y = b, this.object.y = -this.y, this.isClone || this.parent.updateCoordinateView(), this.updateDialog(), Entry.requestUpdate = !0); -}; -Entry.EntityObject.prototype.getY = function() { - return this.y; -}; -Entry.EntityObject.prototype.getDirection = function() { - return this.direction; -}; -Entry.EntityObject.prototype.setDirection = function(b, a) { - b || (b = 0); - "vertical" != this.parent.getRotateMethod() || a || (0 <= this.direction && 180 > this.direction) == (0 <= b && 180 > b) || (this.setScaleX(-this.getScaleX()), Entry.stage.updateObject(), this.flip = !this.flip); - this.direction = b.mod(360); - this.object.direction = this.direction; - this.isClone || this.parent.updateRotationView(); - Entry.dispatchEvent("updateObject"); - Entry.requestUpdate = !0; -}; -Entry.EntityObject.prototype.setRotation = function(b) { - "free" != this.parent.getRotateMethod() && (b = 0); - this.rotation = b.mod(360); - this.object.rotation = this.rotation; - this.updateDialog(); - this.isClone || this.parent.updateRotationView(); - Entry.dispatchEvent("updateObject"); - Entry.requestUpdate = !0; -}; -Entry.EntityObject.prototype.getRotation = function() { - return this.rotation; -}; -Entry.EntityObject.prototype.setRegX = function(b) { - "textBox" == this.type && (b = 0); - this.regX = b; - this.object.regX = this.regX; - Entry.requestUpdate = !0; +Entry.Container.prototype.getCachedPicture = function(a) { + Entry.assert("string" == typeof a, "pictureId must be string"); + return this.cachedPicture[a]; }; -Entry.EntityObject.prototype.getRegX = function() { - return this.regX; +Entry.Container.prototype.cachePicture = function(a, b) { + this.cachedPicture[a] = b; }; -Entry.EntityObject.prototype.setRegY = function(b) { - "textBox" == this.type && (b = 0); - this.regY = b; - this.object.regY = this.regY; - Entry.requestUpdate = !0; +Entry.Container.prototype.toJSON = function() { + for (var a = [], b = this.objects_.length, c = 0;c < b;c++) { + a.push(this.objects_[c].toJSON()); + } + return a; }; -Entry.EntityObject.prototype.getRegY = function() { - return this.regY; +Entry.Container.prototype.takeSequenceSnapshot = function() { + for (var a = this.objects_.length, b = this.objects_, c = 0;c < a;c++) { + b[c].index = c; + } }; -Entry.EntityObject.prototype.setScaleX = function(b) { - this.scaleX = b; - this.object.scaleX = this.scaleX; - this.parent.updateCoordinateView(); - this.updateDialog(); - Entry.requestUpdate = !0; +Entry.Container.prototype.loadSequenceSnapshot = function() { + for (var a = this.objects_.length, b = Array(a), c = 0;c < a;c++) { + var d = this.objects_[c]; + b[d.index || c] = d; + delete d.index; + } + this.objects_ = b; + this.setCurrentObjects(); + Entry.stage.sortZorder(); + this.updateListView(); }; -Entry.EntityObject.prototype.getScaleX = function() { - return this.scaleX; +Entry.Container.prototype.getInputValue = function() { + return this.inputValue.getValue(); }; -Entry.EntityObject.prototype.setScaleY = function(b) { - this.scaleY = b; - this.object.scaleY = this.scaleY; - this.parent.updateCoordinateView(); - this.updateDialog(); - Entry.requestUpdate = !0; +Entry.Container.prototype.setInputValue = function(a) { + a ? this.inputValue.setValue(a) : this.inputValue.setValue(0); }; -Entry.EntityObject.prototype.getScaleY = function() { - return this.scaleY; +Entry.Container.prototype.resetSceneDuringRun = function() { + this.mapEntityOnScene(function(a) { + a.loadSnapshot(); + a.object.filters = []; + a.resetFilter(); + a.dialog && a.dialog.remove(); + a.shape && a.removeBrush(); + }); + this.clearRunningStateOnScene(); }; -Entry.EntityObject.prototype.setSize = function(b) { - 1 > b && (b = 1); - b /= this.getSize(); - this.setScaleX(this.getScaleX() * b); - this.setScaleY(this.getScaleY() * b); - this.isClone || this.parent.updateCoordinateView(); - Entry.requestUpdate = !0; +Entry.Container.prototype.setCopiedObject = function(a) { + this.copiedObject = a; }; -Entry.EntityObject.prototype.getSize = function() { - return (this.getWidth() * Math.abs(this.getScaleX()) + this.getHeight() * Math.abs(this.getScaleY())) / 2; +Entry.Container.prototype.updateObjectsOrder = function() { + for (var a = Entry.scene.getScenes(), b = [], c = 0;c < a.length;c++) { + for (var d = this.getSceneObjects(a[c]), e = 0;e < d.length;e++) { + b.push(d[e]); + } + } + this.objects_ = b; }; -Entry.EntityObject.prototype.setWidth = function(b) { - this.width = b; - this.object.width = this.width; - this.textObject && this.getLineBreak() && (this.textObject.lineWidth = this.width); - this.updateDialog(); - this.updateBG(); - Entry.requestUpdate = !0; +Entry.Container.prototype.getSceneObjects = function(a) { + a = a || Entry.scene.selectedScene; + for (var b = [], c = this.getAllObjects(), d = 0;d < c.length;d++) { + a.id == c[d].scene.id && b.push(c[d]); + } + return b; }; -Entry.EntityObject.prototype.getWidth = function() { - return this.width; +Entry.Container.prototype.setCurrentObjects = function() { + this.currentObjects_ = this.getSceneObjects(); }; -Entry.EntityObject.prototype.setHeight = function(b) { - this.height = b; - this.textObject && (this.object.height = this.height, this.alignTextBox()); - this.updateDialog(); - this.updateBG(); - Entry.requestUpdate = !0; +Entry.Container.prototype.getCurrentObjects = function() { + var a = this.currentObjects_; + a && 0 !== a.length || this.setCurrentObjects(); + return this.currentObjects_; }; -Entry.EntityObject.prototype.getHeight = function() { - return this.height; +Entry.Container.prototype.getProjectWithJSON = function(a) { + a.objects = Entry.container.toJSON(); + a.variables = Entry.variableContainer.getVariableJSON(); + a.messages = Entry.variableContainer.getMessageJSON(); + a.scenes = Entry.scene.toJSON(); + return a; }; -Entry.EntityObject.prototype.setColour = function(b) { - b || (b = "#000000"); - this.colour = b; - this.textObject && (this.textObject.color = this.colour); - Entry.requestUpdate = !0; +Entry.Container.prototype.blurAllInputs = function() { + this.getSceneObjects().map(function(a) { + a = a.view_.getElementsByTagName("input"); + for (var b = 0, c = a.length;b < c;b++) { + a[b].blur(); + } + }); }; -Entry.EntityObject.prototype.getColour = function() { - return this.colour; +Entry.Container.prototype.showProjectAnswer = function() { + var a = this.inputValue; + a && a.setVisible(!0); }; -Entry.EntityObject.prototype.setBGColour = function(b) { - b || (b = "transparent"); - this.bgColor = b; - this.updateBG(); - Entry.requestUpdate = !0; +Entry.Container.prototype.hideProjectAnswer = function(a) { + if ((a = this.inputValue) && a.isVisible() && !Entry.engine.isState("run")) { + for (var b = Entry.container.getAllObjects(), c = ["ask_and_wait", "get_canvas_input_value", "set_visible_answer"], d = 0, e = b.length;d < e;d++) { + for (var f = b[d].script, g = 0;g < c.length;g++) { + if (f.hasBlockType(c[g])) { + return; + } + } + } + a.setVisible(!1); + } }; -Entry.EntityObject.prototype.getBGColour = function() { - return this.bgColor; +Entry.Container.prototype.getView = function() { + return this._view; }; -Entry.EntityObject.prototype.setUnderLine = function(b) { - void 0 === b && (b = !1); - this.underLine = b; - this.textObject.underLine = b; - Entry.requestUpdate = !0; +Entry.Container.prototype.resize = function() { }; -Entry.EntityObject.prototype.getUnderLine = function() { - return this.underLine; +Entry.db = {data:{}, typeMap:{}}; +(function(a) { + a.add = function(b) { + this.data[b.id] = b; + var a = b.type; + void 0 === this.typeMap[a] && (this.typeMap[a] = {}); + this.typeMap[a][b.id] = b; + }; + a.has = function(b) { + return this.data.hasOwnProperty(b); + }; + a.remove = function(b) { + this.has(b) && (delete this.typeMap[this.data[b].type][b], delete this.data[b]); + }; + a.get = function(b) { + return this.data[b]; + }; + a.find = function() { + }; + a.clear = function() { + this.data = {}; + this.typeMap = {}; + }; +})(Entry.db); +Entry.Dom = function(a, b) { + var c = /<(\w+)>/, d; + d = a instanceof HTMLElement ? $(a) : a instanceof jQuery ? a : c.test(a) ? $(a) : $("<" + a + ">"); + if (void 0 === b) { + return d; + } + b.id && d.attr("id", b.id); + b.class && d.addClass(b.class); + b.classes && b.classes.map(function(b) { + d.addClass(b); + }); + b.src && d.attr("src", b.src); + b.parent && b.parent.append(d); + d.bindOnClick = function() { + var b, a, c = function(b) { + b.stopImmediatePropagation(); + b.handled || (b.handled = !0, a.call(this, b)); + }; + 1 < arguments.length ? (a = arguments[1] instanceof Function ? arguments[1] : function() { + }, b = "string" === typeof arguments[0] ? arguments[0] : "") : a = arguments[0] instanceof Function ? arguments[0] : function() { + }; + if (b) { + $(this).on("click tab", b, c); + } else { + $(this).on("click tab", c); + } + }; + return d; }; -Entry.EntityObject.prototype.setStrike = function(b) { - void 0 === b && (b = !1); - this.strike = b; - this.textObject.strike = b; - Entry.requestUpdate = !0; +Entry.SVG = function(a) { + a = document.getElementById(a); + return Entry.SVG.createElement(a); }; -Entry.EntityObject.prototype.getStrike = function() { - return this.strike; +Entry.SVG.NS = "http://www.w3.org/2000/svg"; +Entry.SVG.NS_XLINK = "http://www.w3.org/1999/xlink"; +Entry.SVG.createElement = function(a, b) { + a = "string" === typeof a ? document.createElementNS(Entry.SVG.NS, a) : a; + if (b) { + b.href && (a.setAttributeNS(Entry.SVG.NS_XLINK, "href", b.href), delete b.href); + for (var c in b) { + a.setAttribute(c, b[c]); + } + } + this instanceof SVGElement && this.appendChild(a); + a.elem = Entry.SVG.createElement; + a.attr = Entry.SVG.attr; + a.addClass = Entry.SVG.addClass; + a.removeClass = Entry.SVG.removeClass; + a.hasClass = Entry.SVG.hasClass; + a.remove = Entry.SVG.remove; + a.removeAttr = Entry.SVG.removeAttr; + return a; }; -Entry.EntityObject.prototype.getFont = function() { - var b = []; - this.fontBold && b.push("bold"); - this.fontItalic && b.push("italic"); - b.push(this.getFontSize() + "px"); - b.push(this.fontType); - return b.join(" "); -}; -Entry.EntityObject.prototype.setFont = function(b) { - if ("textBox" == this.parent.objectType && this.font !== b) { - b || (b = "20px Nanum Gothic"); - var a = b.split(" "), c = 0; - if (c = -1 < a.indexOf("bold")) { - a.splice(c - 1, 1), this.setFontBold(!0); - } - if (c = -1 < a.indexOf("italic")) { - a.splice(c - 1, 1), this.setFontItalic(!0); - } - c = parseInt(a.shift()); - this.setFontSize(c); - this.setFontType(a.join(" ")); - this.font = this.getFont(); - this.textObject.font = b; - Entry.stage.update(); - this.setWidth(this.textObject.getMeasuredWidth()); - this.updateBG(); - Entry.stage.updateObject(); +Entry.SVG.attr = function(a, b) { + if ("string" === typeof a) { + var c = {}; + c[a] = b; + a = c; + } + if (a) { + a.href && (this.setAttributeNS(Entry.SVG.NS_XLINK, "href", a.href), delete a.href); + for (var d in a) { + this.setAttribute(d, a[d]); + } } + return this; }; -Entry.EntityObject.prototype.setLineHeight = function() { - switch(this.getFontType()) { - case "Nanum Gothic Coding": - this.textObject.lineHeight = this.fontSize; - break; - default: - this.textObject.lineHeight = 0; +Entry.SVG.addClass = function(a) { + for (var b = this.getAttribute("class"), c = 0;c < arguments.length;c++) { + a = arguments[c], this.hasClass(a) || (b += " " + a); } + this.setAttribute("class", b); + return this; }; -Entry.EntityObject.prototype.syncFont = function() { - this.textObject.font = this.getFont(); - this.setLineHeight(); - Entry.stage.update(); - this.getLineBreak() || this.setWidth(this.textObject.getMeasuredWidth()); - Entry.stage.updateObject(); - Entry.requestUpdate = !0; +Entry.SVG.removeClass = function(a) { + for (var b = this.getAttribute("class"), c = 0;c < arguments.length;c++) { + a = arguments[c], this.hasClass(a) && (b = b.replace(new RegExp("(\\s|^)" + a + "(\\s|$)"), " ")); + } + this.setAttribute("class", b); + return this; }; -Entry.EntityObject.prototype.getFontType = function() { - return this.fontType; +Entry.SVG.hasClass = function(a) { + var b = this.getAttribute("class"); + return b ? b.match(new RegExp("(\\s|^)" + a + "(\\s|$)")) : !1; }; -Entry.EntityObject.prototype.setFontType = function(b) { - "textBox" == this.parent.objectType && (this.fontType = b ? b : "Nanum Gothic", this.syncFont()); +Entry.SVG.remove = function() { + this.parentNode && this.parentNode.removeChild(this); }; -Entry.EntityObject.prototype.getFontSize = function(b) { - return this.fontSize; +Entry.SVG.removeAttr = function(a) { + this.removeAttribute(a); }; -Entry.EntityObject.prototype.setFontSize = function(b) { - "textBox" == this.parent.objectType && this.fontSize != b && (this.fontSize = b ? b : 20, this.syncFont(), this.alignTextBox()); +Entry.Dialog = function(a, b, c, d) { + a.dialog && a.dialog.remove(); + a.dialog = this; + this.parent = a; + this.padding = 10; + this.border = 2; + "number" == typeof b && (b = String(b)); + this.message_ = b = b.match(/.{1,15}/g).join("\n"); + this.mode_ = c; + "speak" == c && this.generateSpeak(); + d || Entry.stage.loadDialog(this); }; -Entry.EntityObject.prototype.setFontBold = function(b) { - this.fontBold = b; +Entry.Dialog.prototype.generateSpeak = function() { + this.object = new createjs.Container; + var a = new createjs.Text; + a.font = "15px NanumGothic"; + a.textBaseline = "top"; + a.textAlign = "left"; + a.text = this.message_; + var b = a.getTransformedBounds(), c = b.height, b = 10 <= b.width ? b.width : 17, d = new createjs.Shape; + d.graphics.f("#f5f5f5").ss(2, "round").s("#6FC0DD").rr(-this.padding, -this.padding, b + 2 * this.padding, c + 2 * this.padding, this.padding); + this.object.addChild(d); + this.object.regX = b / 2; + this.object.regY = c / 2; + this.width = b; + this.height = c; + this.notch = this.createSpeakNotch("ne"); + this.update(); + this.object.addChild(this.notch); + this.object.addChild(a); Entry.requestUpdate = !0; }; -Entry.EntityObject.prototype.toggleFontBold = function() { - this.fontBold = !this.fontBold; - this.syncFont(); - return this.fontBold; -}; -Entry.EntityObject.prototype.setFontItalic = function(b) { - this.fontItalic = b; +Entry.Dialog.prototype.update = function() { + var a = this.parent.object.getTransformedBounds(), b = ""; + -135 < a.y - this.height - 20 - this.border ? (this.object.y = a.y - this.height / 2 - 20 - this.padding, b += "n") : (this.object.y = a.y + a.height + this.height / 2 + 20 + this.padding, b += "s"); + 240 > a.x + a.width + this.width ? (this.object.x = a.x + a.width + this.width / 2, b += "e") : (this.object.x = a.x - this.width / 2, b += "w"); + this.notch.type != b && (this.object.removeChild(this.notch), this.notch = this.createSpeakNotch(b), this.object.addChild(this.notch)); Entry.requestUpdate = !0; }; -Entry.EntityObject.prototype.toggleFontItalic = function() { - this.fontItalic = !this.fontItalic; - this.syncFont(); - return this.fontItalic; +Entry.Dialog.prototype.createSpeakNotch = function(a) { + var b = new createjs.Shape; + b.type = a; + "ne" == a ? b.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" == a ? b.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" == a ? b.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" == a && b.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 b; }; -Entry.EntityObject.prototype.setFontName = function(b) { - for (var a = this.font.split(" "), c = [], d = 0, e = a.length;d < e;d++) { - ("bold" === a[d] || "italic" === a[d] || -1 < a[d].indexOf("px")) && c.push(a[d]); - } - this.setFont(c.join(" ") + " " + b); +Entry.Dialog.prototype.remove = function() { + Entry.stage.unloadDialog(this); + this.parent.dialog = null; + Entry.requestUpdate = !0; }; -Entry.EntityObject.prototype.getFontName = function() { - if ("textBox" == this.type) { - if (!this.font) { - return ""; - } - for (var b = this.font.split(" "), a = [], c = 0, d = b.length;c < d;c++) { - "bold" !== b[c] && "italic" !== b[c] && -1 === b[c].indexOf("px") && a.push(b[c]); - } - return a.join(" ").trim(); - } +Entry.DoneProject = function(a) { + this.generateView(a); }; -Entry.EntityObject.prototype.setText = function(b) { - "textBox" == this.parent.objectType && (void 0 === b && (b = ""), this.text = b, this.textObject.text = this.text, this.lineBreak || (this.setWidth(this.textObject.getMeasuredWidth()), this.parent.updateCoordinateView()), this.updateBG(), Entry.stage.updateObject()); +var p = Entry.DoneProject.prototype; +p.init = function(a) { + this.projectId = a; }; -Entry.EntityObject.prototype.getText = function() { - return this.text; +p.generateView = function(a) { + var b = Entry.createElement("div"); + b.addClass("entryContainerDoneWorkspace"); + this.doneContainer = b; + var c = Entry.createElement("iframe"); + c.setAttribute("id", "doneProjectframe"); + c.setAttribute("frameborder", 0); + c.setAttribute("src", "/api/iframe/project/" + a); + this.doneProjectFrame = c; + this.doneContainer.appendChild(c); + b.addClass("entryRemove"); }; -Entry.EntityObject.prototype.setTextAlign = function(b) { - "textBox" == this.parent.objectType && (void 0 === b && (b = Entry.TEXT_ALIGN_CENTER), this.textAlign = b, this.textObject.textAlign = Entry.TEXT_ALIGNS[this.textAlign], this.alignTextBox(), this.updateBG(), Entry.stage.updateObject()); +p.getView = function() { + return this.doneContainer; }; -Entry.EntityObject.prototype.getTextAlign = function() { - return this.textAlign; +p.resize = function() { + document.getElementById("entryContainerWorkspaceId"); + var a = document.getElementById("doneProjectframe"), b = this.doneContainer.offsetWidth; + a.width = b + "px"; + a.height = 9 * b / 16 + "px"; }; -Entry.EntityObject.prototype.setLineBreak = function(b) { - if ("textBox" == this.parent.objectType) { - void 0 === b && (b = !1); - var a = this.lineBreak; - this.lineBreak = b; - a && !this.lineBreak ? (this.textObject.lineWidth = null, this.setHeight(this.textObject.getMeasuredLineHeight()), this.setText(this.getText().replace(/\n/g, ""))) : !a && this.lineBreak && (this.setFontSize(this.getFontSize() * this.getScaleX()), this.setHeight(3 * this.textObject.getMeasuredLineHeight()), this.setWidth(this.getWidth() * this.getScaleX()), this.setScaleX(1), this.setScaleY(1), this.textObject.lineWidth = this.getWidth(), this.alignTextBox()); - Entry.stage.updateObject(); +Entry.Engine = function() { + function a(b) { + var a = [37, 38, 39, 40, 32], d = b.keyCode || b.which, e = Entry.stage.inputField; + 32 == d && e && e.hasFocus() || -1 < a.indexOf(d) && b.preventDefault(); } + this.state = "stop"; + this.popup = null; + this.isUpdating = !0; + this.speeds = [1, 15, 30, 45, 60]; + this._mouseMoved = !1; + Entry.keyPressed && Entry.keyPressed.attach(this, this.captureKeyEvent); + Entry.addEventListener("canvasClick", function(b) { + Entry.engine.fireEvent("mouse_clicked"); + }); + Entry.addEventListener("canvasClickCanceled", function(b) { + Entry.engine.fireEvent("mouse_click_cancled"); + }); + Entry.addEventListener("entityClick", function(b) { + Entry.engine.fireEventOnEntity("when_object_click", b); + }); + Entry.addEventListener("entityClickCanceled", function(b) { + Entry.engine.fireEventOnEntity("when_object_click_canceled", b); + }); + "phone" != Entry.type && (Entry.addEventListener("stageMouseMove", function(b) { + this._mouseMoved = !0; + }.bind(this)), Entry.addEventListener("stageMouseOut", function(b) { + Entry.engine.hideMouseView(); + })); + Entry.addEventListener("run", function() { + $(window).bind("keydown", a); + }); + Entry.addEventListener("stop", function() { + $(window).unbind("keydown", a); + }); + setInterval(function() { + this._mouseMoved && (this.updateMouseView(), this._mouseMoved = !1); + }.bind(this), 100); }; -Entry.EntityObject.prototype.getLineBreak = function() { - return this.lineBreak; -}; -Entry.EntityObject.prototype.setVisible = function(b) { - void 0 === b && (b = !0); - this.visible = b; - this.object.visible = this.visible; - this.dialog && this.syncDialogVisible(); - Entry.requestUpdate = !0; - return this.visible; -}; -Entry.EntityObject.prototype.getVisible = function() { - return this.visible; -}; -Entry.EntityObject.prototype.setImage = function(b) { - delete b._id; - Entry.assert("sprite" == this.type, "Set image is only for sprite object"); - b.id || (b.id = Entry.generateHash()); - this.picture = b; - var a = this.picture.dimension, c = this.getRegX() - this.getWidth() / 2, d = this.getRegY() - this.getHeight() / 2; - this.setWidth(a.width); - this.setHeight(a.height); - a.scaleX || (a.scaleX = this.getScaleX(), a.scaleY = this.getScaleY()); - this.setScaleX(this.scaleX); - this.setScaleY(this.scaleY); - this.setRegX(this.width / 2 + c); - this.setRegY(this.height / 2 + d); - var e = Entry.container.getCachedPicture(b.id); - if (e) { - Entry.image = e, this.object.image = e, this.object.cache(0, 0, this.getWidth(), this.getHeight()); +Entry.Engine.prototype.generateView = function(a, b) { + if (b && "workspace" != b) { + "minimize" == b ? (this.view_ = a, this.view_.addClass("entryEngine"), this.view_.addClass("entryEngineMinimize"), this.maximizeButton = Entry.createElement("button"), this.maximizeButton.addClass("entryEngineButtonMinimize"), this.maximizeButton.addClass("entryMaximizeButtonMinimize"), this.view_.appendChild(this.maximizeButton), this.maximizeButton.bindOnClick(function(b) { + Entry.engine.toggleFullscreen(); + }), this.coordinateButton = Entry.createElement("button"), this.coordinateButton.addClass("entryEngineButtonMinimize"), this.coordinateButton.addClass("entryCoordinateButtonMinimize"), this.view_.appendChild(this.coordinateButton), this.coordinateButton.bindOnClick(function(b) { + this.hasClass("toggleOn") ? this.removeClass("toggleOn") : this.addClass("toggleOn"); + Entry.stage.toggleCoordinator(); + }), this.stopButton = Entry.createElement("button"), this.stopButton.addClass("entryEngineButtonMinimize"), this.stopButton.addClass("entryStopButtonMinimize"), this.stopButton.addClass("entryRemove"), this.stopButton.innerHTML = Lang.Workspace.stop, this.view_.appendChild(this.stopButton), this.stopButton.bindOnClick(function(b) { + this.blur(); + Entry.engine.toggleStop(); + }), this.pauseButton = Entry.createElement("button"), this.pauseButton.innerHTML = Lang.Workspace.pause, this.pauseButton.addClass("entryEngineButtonMinimize"), this.pauseButton.addClass("entryPauseButtonMinimize"), this.pauseButton.addClass("entryRemove"), this.view_.appendChild(this.pauseButton), this.pauseButton.bindOnClick(function(b) { + this.blur(); + Entry.engine.togglePause(); + }), this.mouseView = Entry.createElement("div"), this.mouseView.addClass("entryMouseViewMinimize"), this.mouseView.addClass("entryRemove"), this.view_.appendChild(this.mouseView), Entry.addEventListener("loadComplete", function() { + this.runButton = Entry.Dom("div", {class:"entryRunButtonBigMinimize", parent:$("#entryCanvasWrapper")}); + this.runButton.bindOnClick(function(b) { + Entry.engine.toggleRun(); + }); + }.bind(this))) : "phone" == b && (this.view_ = a, this.view_.addClass("entryEngine", "entryEnginePhone"), this.headerView_ = Entry.createElement("div", "entryEngineHeader"), this.headerView_.addClass("entryEngineHeaderPhone"), this.view_.appendChild(this.headerView_), this.maximizeButton = Entry.createElement("button"), this.maximizeButton.addClass("entryEngineButtonPhone", "entryMaximizeButtonPhone"), this.headerView_.appendChild(this.maximizeButton), this.maximizeButton.bindOnClick(function(b) { + Entry.engine.footerView_.addClass("entryRemove"); + Entry.engine.headerView_.addClass("entryRemove"); + Entry.launchFullScreen(Entry.engine.view_); + }), document.addEventListener("fullscreenchange", function(b) { + Entry.engine.exitFullScreen(); + }), document.addEventListener("webkitfullscreenchange", function(b) { + Entry.engine.exitFullScreen(); + }), document.addEventListener("mozfullscreenchange", function(b) { + Entry.engine.exitFullScreen(); + }), this.footerView_ = Entry.createElement("div", "entryEngineFooter"), this.footerView_.addClass("entryEngineFooterPhone"), this.view_.appendChild(this.footerView_), this.runButton = Entry.createElement("button"), this.runButton.addClass("entryEngineButtonPhone", "entryRunButtonPhone"), Entry.objectAddable && this.runButton.addClass("small"), this.runButton.innerHTML = Lang.Workspace.run, this.footerView_.appendChild(this.runButton), this.runButton.bindOnClick(function(b) { + Entry.engine.toggleRun(); + }), this.stopButton = Entry.createElement("button"), this.stopButton.addClass("entryEngineButtonPhone", "entryStopButtonPhone", "entryRemove"), Entry.objectAddable && this.stopButton.addClass("small"), this.stopButton.innerHTML = Lang.Workspace.stop, this.footerView_.appendChild(this.stopButton), this.stopButton.bindOnClick(function(b) { + Entry.engine.toggleStop(); + })); } else { - e = new Image; - b.fileurl ? e.src = b.fileurl : (a = b.filename, e.src = Entry.defaultPath + "/uploads/" + a.substring(0, 2) + "/" + a.substring(2, 4) + "/image/" + a + ".png"); - var f = this; - e.onload = function(a) { - Entry.container.cachePicture(b.id, e); - Entry.image = e; - f.object.image = e; - f.object.cache(0, 0, f.getWidth(), f.getHeight()); - f = null; - Entry.requestUpdate = !0; - }; + this.view_ = a; + this.view_.addClass("entryEngine_w"); + this.view_.addClass("entryEngineWorkspace_w"); + var c = Entry.createElement("button"); + this.speedButton = c; + this.speedButton.addClass("entrySpeedButtonWorkspace", "entryEngineTopWorkspace", "entryEngineButtonWorkspace_w"); + this.view_.appendChild(this.speedButton); + this.speedButton.bindOnClick(function(b) { + Entry.engine.toggleSpeedPanel(); + c.blur(); + }); + this.maximizeButton = Entry.createElement("button"); + this.maximizeButton.addClass("entryEngineButtonWorkspace_w", "entryEngineTopWorkspace", "entryMaximizeButtonWorkspace_w"); + this.view_.appendChild(this.maximizeButton); + this.maximizeButton.bindOnClick(function(b) { + Entry.engine.toggleFullscreen(); + }); + var d = Entry.createElement("button"); + this.coordinateButton = d; + this.coordinateButton.addClass("entryEngineButtonWorkspace_w", "entryEngineTopWorkspace", "entryCoordinateButtonWorkspace_w"); + this.view_.appendChild(this.coordinateButton); + this.coordinateButton.bindOnClick(function(b) { + this.hasClass("toggleOn") ? this.removeClass("toggleOn") : this.addClass("toggleOn"); + d.blur(); + Entry.stage.toggleCoordinator(); + }); + this.addButton = Entry.createElement("button"); + this.addButton.addClass("entryEngineButtonWorkspace_w"); + this.addButton.addClass("entryAddButtonWorkspace_w"); + this.addButton.innerHTML = Lang.Workspace.add_object; + this.addButton.bindOnClick(function(b) { + Entry.dispatchEvent("openSpriteManager"); + }); + this.view_.appendChild(this.addButton); + this.runButton = Entry.createElement("button"); + this.runButton.addClass("entryEngineButtonWorkspace_w"); + this.runButton.addClass("entryRunButtonWorkspace_w"); + this.runButton.innerHTML = Lang.Workspace.run; + this.view_.appendChild(this.runButton); + this.runButton.bindOnClick(function(b) { + Entry.engine.toggleRun(); + }); + this.runButton2 = Entry.createElement("button"); + this.runButton2.addClass("entryEngineButtonWorkspace_w"); + this.runButton2.addClass("entryRunButtonWorkspace_w2"); + this.view_.appendChild(this.runButton2); + this.runButton2.bindOnClick(function(b) { + Entry.engine.toggleRun(); + }); + this.stopButton = Entry.createElement("button"); + this.stopButton.addClass("entryEngineButtonWorkspace_w"); + this.stopButton.addClass("entryStopButtonWorkspace_w"); + this.stopButton.addClass("entryRemove"); + this.stopButton.innerHTML = Lang.Workspace.stop; + this.view_.appendChild(this.stopButton); + this.stopButton.bindOnClick(function(b) { + Entry.engine.toggleStop(); + }); + this.stopButton2 = Entry.createElement("button"); + this.stopButton2.addClass("entryEngineButtonWorkspace_w"); + this.stopButton2.addClass("entryStopButtonWorkspace_w2"); + this.stopButton2.addClass("entryRemove"); + this.stopButton2.innerHTML = Lang.Workspace.stop; + this.view_.appendChild(this.stopButton2); + this.stopButton2.bindOnClick(function(b) { + Entry.engine.toggleStop(); + }); + this.pauseButton = Entry.createElement("button"); + this.pauseButton.addClass("entryEngineButtonWorkspace_w"); + this.pauseButton.addClass("entryPauseButtonWorkspace_w"); + this.pauseButton.addClass("entryRemove"); + this.view_.appendChild(this.pauseButton); + this.pauseButton.bindOnClick(function(b) { + Entry.engine.togglePause(); + }); + this.mouseView = Entry.createElement("div"); + this.mouseView.addClass("entryMouseViewWorkspace_w"); + this.mouseView.addClass("entryRemove"); + this.view_.appendChild(this.mouseView); } - Entry.dispatchEvent("updateObject"); }; -Entry.EntityObject.prototype.applyFilter = function() { - var b = this.effect, a = this.object; - (function(a, b) { - for (var e in a) { - if (a[e] !== b[e]) { - return !1; - } +Entry.Engine.prototype.toggleSpeedPanel = function() { + if (this.speedPanelOn) { + this.speedPanelOn = !1, $(Entry.stage.canvas.canvas).animate({top:"24px"}), this.coordinateButton.removeClass("entryRemove"), this.maximizeButton.removeClass("entryRemove"), this.mouseView.removeClass("entryRemoveElement"), $(this.speedLabel_).remove(), delete this.speedLabel_, $(this.speedProgress_).fadeOut(null, function(b) { + $(this).remove(); + delete this.speedProgress_; + }), $(this.speedHandle_).remove(), delete this.speedHandle_; + } else { + this.speedPanelOn = !0; + $(Entry.stage.canvas.canvas).animate({top:"41px"}); + this.coordinateButton.addClass("entryRemove"); + this.maximizeButton.addClass("entryRemove"); + this.mouseView.addClass("entryRemoveElement"); + this.speedLabel_ = Entry.createElement("div", "entrySpeedLabelWorkspace"); + this.speedLabel_.innerHTML = Lang.Workspace.speed; + this.view_.insertBefore(this.speedLabel_, this.maximizeButton); + this.speedProgress_ = Entry.createElement("table", "entrySpeedProgressWorkspace"); + for (var a = Entry.createElement("tr"), b = this.speeds, c = 0;5 > c;c++) { + (function(c) { + var e = Entry.createElement("td", "progressCell" + c); + e.bindOnClick(function() { + Entry.engine.setSpeedMeter(b[c]); + }); + a.appendChild(e); + })(c); } - return !0; - })(b, this.getInitialEffectValue()) || (function(a, b) { - var e = [], f = Entry.adjustValueWithMaxMin; - a.brightness = a.brightness; - var g = new createjs.ColorMatrix; - g.adjustColor(f(a.brightness, -100, 100), 0, 0, 0); - g = new createjs.ColorMatrixFilter(g); - e.push(g); - a.hue = a.hue.mod(360); - g = new createjs.ColorMatrix; - g.adjustColor(0, 0, 0, a.hue); - g = new createjs.ColorMatrixFilter(g); - e.push(g); - var g = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1], h = 10.8 * a.hsv * Math.PI / 180, k = Math.cos(h), h = Math.sin(h), l = Math.abs(a.hsv / 100); - 1 < l && (l -= Math.floor(l)); - 0 < l && .33 >= 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); + this.view_.insertBefore(this.speedProgress_, this.maximizeButton); + this.speedProgress_.appendChild(a); + this.speedHandle_ = Entry.createElement("div", "entrySpeedHandleWorkspace"); + c = (Entry.interfaceState.canvasWidth - 84) / 5; + $(this.speedHandle_).draggable({axis:"x", grid:[c, c], containment:[80, 0, 4 * c + 80, 0], drag:function(b, a) { + b = (a.position.left - 80) / (Entry.interfaceState.canvasWidth - 84) * 5; + b = Math.floor(b); + 0 > b || Entry.engine.setSpeedMeter(Entry.engine.speeds[b]); + }}); + this.view_.insertBefore(this.speedHandle_, this.maximizeButton); + this.setSpeedMeter(Entry.FPS); + } }; -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.Engine.prototype.setSpeedMeter = function(a) { + var b = this.speeds.indexOf(a); + 0 > b || (b = Math.min(4, b), b = Math.max(0, b), this.speedPanelOn && (this.speedHandle_.style.left = (Entry.interfaceState.canvasWidth - 80) / 10 * (2 * b + 1) + 80 - 9 + "px"), Entry.FPS != a && (clearInterval(this.ticker), this.ticker = setInterval(this.update, Math.floor(1E3 / a)), Entry.FPS = a)); }; -Entry.EntityObject.prototype.updateDialog = function() { - this.dialog && this.dialog.update(); - Entry.requestUpdate = !0; +Entry.Engine.prototype.start = function(a) { + createjs.Ticker.setFPS(Entry.FPS); + this.ticker = setInterval(this.update, Math.floor(1E3 / Entry.FPS)); }; -Entry.EntityObject.prototype.takeSnapshot = function() { - this.snapshot_ = this.toJSON(); - this.collision = Entry.Utils.COLLISION.NONE; +Entry.Engine.prototype.stop = function() { + clearInterval(this.ticker); + this.ticker = null; }; -Entry.EntityObject.prototype.loadSnapshot = function() { - this.snapshot_ && this.syncModel_(this.snapshot_); - "sprite" == this.parent.objectType && this.setImage(this.parent.getPicture()); - Entry.requestUpdate = !0; +Entry.Engine.prototype.update = function() { + Entry.engine.isState("run") && (Entry.engine.computeObjects(), Entry.hw.update()); }; -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.Engine.prototype.computeObjects = function() { + Entry.container.mapObjectOnScene(this.computeFunction); }; -Entry.EntityObject.prototype.clearExecutor = function() { - this.parent.script.clearExecutorsByEntity(this); +Entry.Engine.prototype.computeFunction = function(a) { + a.script.tick(); }; -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()); +Entry.Engine.computeThread = function(a, b) { + Entry.engine.isContinue = !0; + for (a = !1;b && Entry.engine.isContinue && !a;) { + Entry.engine.isContinue = !b.isRepeat; + var c = b.run(); + a = c && c === b; + b = c; + } 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; +Entry.Engine.prototype.isState = function(a) { + return -1 < this.state.indexOf(a); }; -Entry.EntityObject.prototype.updateBG = function() { - if (this.bgObject) { - this.bgObject.graphics.clear(); - var b = this.getWidth(), a = this.getHeight(); - this.bgObject.graphics.setStrokeStyle(1).beginStroke().beginFill(this.getBGColour()).drawRect(-b / 2, -a / 2, b, a); - if (this.getLineBreak()) { - this.bgObject.x = 0; - } else { - switch(this.getTextAlign()) { - case Entry.TEXT_ALIGN_LEFT: - this.bgObject.x = b / 2; - break; - case Entry.TEXT_ALIGN_CENTER: - this.bgObject.x = 0; - break; - case Entry.TEXT_ALIGN_RIGHT: - this.bgObject.x = -b / 2; - } - } - } +Entry.Engine.prototype.run = function() { + this.isState("run") ? this.toggleStop() : (this.isState("stop") || this.isState("pause")) && this.toggleRun(); }; -Entry.EntityObject.prototype.alignTextBox = function() { - if ("textBox" == this.type) { - var b = this.textObject; - if (this.lineBreak) { - var a = b.getMeasuredLineHeight(); - b.y = a / 2 - this.getHeight() / 2; - switch(this.textAlign) { - case Entry.TEXT_ALIGN_CENTER: - b.x = 0; - break; - case Entry.TEXT_ALIGN_LEFT: - b.x = -this.getWidth() / 2; - break; - case Entry.TEXT_ALIGN_RIGHT: - b.x = this.getWidth() / 2; - } - b.maxHeight = this.getHeight(); - } else { - b.x = 0, b.y = 0; - } - } +Entry.Engine.prototype.toggleRun = function() { + "pause" === this.state ? this.togglePause() : (Entry.addActivity("run"), "stop" == this.state && (Entry.container.mapEntity(function(a) { + a.takeSnapshot(); + }), Entry.variableContainer.mapVariable(function(a) { + a.takeSnapshot(); + }), Entry.variableContainer.mapList(function(a) { + a.takeSnapshot(); + }), this.projectTimer.takeSnapshot(), Entry.container.inputValue.takeSnapshot(), Entry.container.takeSequenceSnapshot(), Entry.scene.takeStartSceneSnapshot(), this.state = "run", this.fireEvent("start")), this.state = "run", "mobile" == Entry.type && this.view_.addClass("entryEngineBlueWorkspace"), this.pauseButton.innerHTML = Lang.Workspace.pause, this.runButton.addClass("run"), this.runButton.addClass("entryRemove"), this.stopButton.removeClass("entryRemove"), this.pauseButton && this.pauseButton.removeClass("entryRemove"), + this.runButton2 && this.runButton2.addClass("entryRemove"), this.stopButton2 && this.stopButton2.removeClass("entryRemove"), this.isUpdating || (Entry.engine.update(), Entry.engine.isUpdating = !0), Entry.stage.selectObject(), Entry.dispatchEvent("run")); }; -Entry.EntityObject.prototype.syncDialogVisible = function() { - this.dialog && (this.dialog.object.visible = this.visible); +Entry.Engine.prototype.toggleStop = function() { + Entry.addActivity("stop"); + var a = Entry.container, b = Entry.variableContainer; + a.mapEntity(function(b) { + b.loadSnapshot(); + b.object.filters = []; + b.resetFilter(); + b.dialog && b.dialog.remove(); + b.brush && b.removeBrush(); + }); + b.mapVariable(function(b) { + b.loadSnapshot(); + }); + b.mapList(function(b) { + b.loadSnapshot(); + b.updateView(); + }); + this.stopProjectTimer(); + a.clearRunningState(); + a.loadSequenceSnapshot(); + this.projectTimer.loadSnapshot(); + Entry.container.inputValue.loadSnapshot(); + Entry.scene.loadStartSceneSnapshot(); + Entry.Func.clearThreads(); + createjs.Sound.setVolume(1); + createjs.Sound.stop(); + this.view_.removeClass("entryEngineBlueWorkspace"); + this.runButton.removeClass("entryRemove"); + this.stopButton.addClass("entryRemove"); + this.pauseButton && this.pauseButton.addClass("entryRemove"); + this.runButton2 && this.runButton2.removeClass("entryRemove"); + this.stopButton2 && this.stopButton2.addClass("entryRemove"); + this.state = "stop"; + Entry.dispatchEvent("stop"); + Entry.stage.hideInputField(); }; -Entry.Helper = function() { - this.visible = !1; +Entry.Engine.prototype.togglePause = function() { + var a = Entry.engine.projectTimer; + "pause" == this.state ? (a.pausedTime += (new Date).getTime() - a.pauseStart, a.isPaused ? a.pauseStart = (new Date).getTime() : delete a.pauseStart, this.state = "run", this.pauseButton.innerHTML = Lang.Workspace.pause, this.runButton.addClass("entryRemove"), this.runButton2 && this.runButton2.addClass("entryRemove")) : (this.state = "pause", a.isPaused && (a.pausedTime += (new Date).getTime() - a.pauseStart), a.pauseStart = (new Date).getTime(), this.pauseButton.innerHTML = Lang.Workspace.restart, + this.runButton.removeClass("entryRemove"), this.stopButton.removeClass("entryRemove"), this.runButton2 && this.runButton2.removeClass("entryRemove")); }; -p = Entry.Helper.prototype; -p.generateView = function(b, a) { - if (!this.parentView_) { - this.parentView_ = b; - this.blockHelpData = EntryStatic.blockInfo; - var c = Entry.createElement("div", "entryBlockHelperWorkspace"); - this.view = c; - Entry.isForLecture && c.addClass("lecture"); - this.parentView_.appendChild(c); - var d = Entry.createElement("div", "entryBlockHelperContentWorkspace"); - d.addClass("entryBlockHelperIntro"); - Entry.isForLecture && d.addClass("lecture"); - c.appendChild(d); - this.blockHelperContent_ = d; - this.blockHelperView_ = c; - c = Entry.createElement("div", "entryBlockHelperBlockWorkspace"); - this.blockHelperContent_.appendChild(c); - d = Entry.createElement("div", "entryBlockHelperDescriptionWorkspace"); - this.blockHelperContent_.appendChild(d); - d.innerHTML = Lang.Helper.Block_click_msg; - this.blockHelperDescription_ = d; - this._renderView = new Entry.RenderView($(c), "LEFT"); - this.code = new Entry.Code([]); - this._renderView.changeCode(this.code); - this.first = !0; - } -}; -p.bindWorkspace = function(b) { - b && (this._blockViewObserver && this._blockViewObserver.destroy(), this.workspace = b, this._blockViewObserver = b.observe(this, "_updateSelectedBlock", ["selectedBlockView"])); +Entry.Engine.prototype.fireEvent = function(a) { + "run" == this.state && Entry.container.mapEntityIncludeCloneOnScene(this.raiseEvent, a); }; -p._updateSelectedBlock = function() { - var b = this.workspace.selectedBlockView; - if (b && this.visible && b != this._blockView) { - var a = b.block.type; - this._blockView = b; - this.renderBlock(a); - } +Entry.Engine.prototype.raiseEvent = function(a, b) { + a.parent.script.raiseEvent(b, a); }; -p.renderBlock = function(b) { - var a = Lang.Helper[b]; - if (b && this.visible && a && !Entry.block[b].isPrimitive) { - this.first && (this.blockHelperContent_.removeClass("entryBlockHelperIntro"), this.first = !1); - this.code.clear(); - var c = Entry.block[b].def, c = c || {type:b}; - this.code.createThread([c]); - this.code.board.align(); - this.code.board.resize(); - var c = this.code.getThreads()[0].getFirstBlock().view, d = c.svgGroup.getBBox(); - b = d.width; - d = d.height; - c = c.getSkeleton().box(c).offsetX; - isNaN(c) && (c = 0); - this.blockHelperDescription_.innerHTML = a; - this._renderView.align(); - $(this.blockHelperDescription_).css({top:d + 30}); - this._renderView.svgDom.css({"margin-left":-(b / 2) - 20 - c}); - } +Entry.Engine.prototype.fireEventOnEntity = function(a, b) { + "run" == this.state && Entry.container.mapEntityIncludeCloneOnScene(this.raiseEventOnEntity, [b, a]); }; -p.getView = function() { - return this.view; +Entry.Engine.prototype.raiseEventOnEntity = function(a, b) { + a === b[0] && a.parent.script.raiseEvent(b[1], a); }; -p.resize = function() { +Entry.Engine.prototype.captureKeyEvent = function(a) { + var b = a.keyCode, c = Entry.type; + a.ctrlKey && "workspace" == c ? 83 == b ? (a.preventDefault(), Entry.dispatchEvent("saveWorkspace")) : 82 == b ? (a.preventDefault(), Entry.engine.run()) : 90 == b && (a.preventDefault(), console.log("engine"), Entry.dispatchEvent(a.shiftKey ? "redo" : "undo")) : Entry.engine.isState("run") && Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent, ["keyPress", b]); + Entry.engine.isState("stop") && "workspace" === c && 37 <= b && 40 >= b && Entry.stage.moveSprite(a); }; -Entry.Activity = function(b, a) { - this.name = b; - this.timestamp = new Date; - var c = []; - if (void 0 !== a) { - for (var d = 0, e = a.length;d < e;d++) { - var f = a[d]; - c.push({key:f[0], value:f[1]}); +Entry.Engine.prototype.raiseKeyEvent = function(a, b) { + return a.parent.script.raiseEvent(b[0], a, String(b[1])); +}; +Entry.Engine.prototype.updateMouseView = function() { + var a = Entry.stage.mouseCoordinate; + this.mouseView.textContent = "X : " + a.x + ", Y : " + a.y; + this.mouseView.removeClass("entryRemove"); +}; +Entry.Engine.prototype.hideMouseView = function() { + this.mouseView.addClass("entryRemove"); +}; +Entry.Engine.prototype.toggleFullscreen = function() { + if (this.popup) { + this.popup.remove(), this.popup = null; + } else { + this.popup = new Entry.Popup; + if ("workspace" != Entry.type) { + var a = $(document); + $(this.popup.body_).css("top", a.scrollTop()); + $("body").css("overflow", "hidden"); + popup.window_.appendChild(Entry.stage.canvas.canvas); + popup.window_.appendChild(Entry.engine.runButton[0]); } + popup.window_.appendChild(Entry.engine.view_); } - this.data = c; + Entry.windowResized.notify(); }; -Entry.ActivityReporter = function() { - this._activities = []; +Entry.Engine.prototype.exitFullScreen = function() { + document.webkitIsFullScreen || document.mozIsFullScreen || document.isFullScreen || (Entry.engine.footerView_.removeClass("entryRemove"), Entry.engine.headerView_.removeClass("entryRemove")); + Entry.windowResized.notify(); }; -(function(b) { - b.add = function(a) { - if (a && 0 !== a.length) { - if (!(a instanceof Entry.Activity)) { - var b = a.shift(); - a = new Entry.Activity(b, a); +Entry.Engine.prototype.showProjectTimer = function() { + Entry.engine.projectTimer && this.projectTimer.setVisible(!0); +}; +Entry.Engine.prototype.hideProjectTimer = function() { + var a = this.projectTimer; + if (a && a.isVisible() && !this.isState("run")) { + for (var b = Entry.container.getAllObjects(), c = ["get_project_timer_value", "reset_project_timer", "set_visible_project_timer", "choose_project_timer_action"], d = 0, e = b.length;d < e;d++) { + for (var f = b[d].script, g = 0;g < c.length;g++) { + if (f.hasBlockType(c[g])) { + return; + } } - this._activities.push(a); } - }; - b.clear = function() { - this._activities = []; - }; - b.get = function() { - return this._activities; - }; - b.report = function() { - }; -})(Entry.ActivityReporter.prototype); -Entry.State = function(b, a, c, d) { - this.caller = a; - this.func = c; - 3 < arguments.length && (this.params = Array.prototype.slice.call(arguments).slice(3)); - this.message = b; - this.time = Entry.getUpTime(); - this.isPass = Entry.Command[b] ? Entry.Command[b].isPass : !1; + a.setVisible(!1); + } }; -Entry.State.prototype.generateMessage = function() { +Entry.Engine.prototype.clearTimer = function() { + clearInterval(this.ticker); + clearInterval(this.projectTimer.tick); }; -Entry.StateManager = function() { - this.undoStack_ = []; - this.redoStack_ = []; - this.isIgnore = this.isRestore = !1; - Entry.addEventListener("cancelLastCommand", function(b) { - Entry.stateManager.cancelLastCommand(); - }); - Entry.addEventListener("run", function(b) { - Entry.stateManager.updateView(); - }); - Entry.addEventListener("stop", function(b) { - Entry.stateManager.updateView(); - }); - Entry.addEventListener("saveWorkspace", function(b) { - Entry.stateManager.addStamp(); +Entry.Engine.prototype.startProjectTimer = function() { + var a = this.projectTimer; + a && (a.start = (new Date).getTime(), a.isInit = !0, a.pausedTime = 0, a.tick = setInterval(function(b) { + Entry.engine.updateProjectTimer(); + }, 1E3 / 60)); +}; +Entry.Engine.prototype.stopProjectTimer = function() { + var a = this.projectTimer; + a && (this.updateProjectTimer(0), a.isPaused = !1, a.isInit = !1, a.pausedTime = 0, clearInterval(a.tick)); +}; +Entry.Engine.prototype.updateProjectTimer = function(a) { + var b = Entry.engine, c = b.projectTimer; + if (c) { + var d = (new Date).getTime(); + "undefined" == typeof a ? c.isPaused || b.isState("pause") || c.setValue((d - c.start - c.pausedTime) / 1E3) : (c.setValue(a), c.pausedTime = 0, c.start = d); + } +}; +Entry.EntityObject = function(a) { + this.parent = a; + this.type = a.objectType; + this.flip = !1; + this.collision = Entry.Utils.COLLISION.NONE; + this.id = Entry.generateHash(); + "sprite" == this.type ? (this.object = new createjs.Bitmap, this.effect = {}, this.setInitialEffectValue()) : "textBox" == this.type && (this.object = new createjs.Container, this.textObject = new createjs.Text, this.textObject.font = "20px Nanum Gothic", this.textObject.textBaseline = "middle", this.textObject.textAlign = "center", this.bgObject = new createjs.Shape, this.bgObject.graphics.setStrokeStyle(1).beginStroke("#f00").drawRect(0, 0, 100, 100), this.object.addChild(this.bgObject), this.object.addChild(this.textObject), + this.fontType = "Nanum Gothic", this.fontSize = 20, this.strike = this.underLine = this.fontItalic = this.fontBold = !1); + this.object.entity = this; + this.object.cursor = "pointer"; + this.object.on("mousedown", function(b) { + var a = this.entity.parent.id; + Entry.dispatchEvent("entityClick", this.entity); + Entry.stage.isObjectClick = !0; + "minimize" != Entry.type && Entry.engine.isState("stop") && (this.offset = {x:-this.parent.x + this.entity.getX() - (.75 * b.stageX - 240), y:-this.parent.y - this.entity.getY() - (.75 * b.stageY - 135)}, this.cursor = "move", this.entity.initCommand(), Entry.container.selectObject(a)); }); - Entry.addEventListener("undo", function(b) { - Entry.stateManager.undo(); + this.object.on("pressup", function(b) { + Entry.dispatchEvent("entityClickCanceled", this.entity); + this.cursor = "pointer"; + this.entity.checkCommand(); }); - Entry.addEventListener("redo", function(b) { - Entry.stateManager.redo(); + this.object.on("pressmove", function(b) { + "minimize" != Entry.type && Entry.engine.isState("stop") && !this.entity.parent.getLock() && (this.entity.doCommand(), this.entity.setX(.75 * b.stageX - 240 + this.offset.x), this.entity.setY(-(.75 * b.stageY - 135) - this.offset.y), Entry.stage.updateObject()); }); }; -Entry.StateManager.prototype.generateView = function(b, a) { +Entry.EntityObject.prototype.injectModel = function(a, b) { + "sprite" == this.type ? this.setImage(a) : "textBox" == this.type && (a = this.parent, b.text = b.text || a.text || a.name, this.setFont(b.font), this.setBGColour(b.bgColor), this.setColour(b.colour), this.setUnderLine(b.underLine), this.setStrike(b.strike), this.setText(b.text)); + b && this.syncModel_(b); +}; +Entry.EntityObject.prototype.syncModel_ = function(a) { + this.setX(a.x); + this.setY(a.y); + this.setRegX(a.regX); + this.setRegY(a.regY); + this.setScaleX(a.scaleX); + this.setScaleY(a.scaleY); + this.setRotation(a.rotation); + this.setDirection(a.direction, !0); + this.setLineBreak(a.lineBreak); + this.setWidth(a.width); + this.setHeight(a.height); + this.setText(a.text); + this.setTextAlign(a.textAlign); + this.setFontSize(a.fontSize || this.getFontSize()); + this.setVisible(a.visible); }; -Entry.StateManager.prototype.addCommand = function(b, a, c, d) { - if (!this.isIgnoring()) { - if (this.isRestoring()) { - var e = new Entry.State, f = Array.prototype.slice.call(arguments); - Entry.State.prototype.constructor.apply(e, f); - this.redoStack_.push(e); - Entry.reporter && Entry.reporter.report(e); - } else { - e = new Entry.State, f = Array.prototype.slice.call(arguments), Entry.State.prototype.constructor.apply(e, f), this.undoStack_.push(e), Entry.reporter && Entry.reporter.report(e), this.updateView(); - } - Entry.creationChangedEvent && Entry.creationChangedEvent.notify(); - } +Entry.EntityObject.prototype.initCommand = function() { + Entry.engine.isState("stop") && (this.isCommandValid = !1, Entry.stateManager && Entry.stateManager.addCommand("edit entity", this, this.restoreEntity, this.toJSON())); }; -Entry.StateManager.prototype.cancelLastCommand = function() { - this.canUndo() && (this.undoStack_.pop(), this.updateView(), Entry.creationChangedEvent && Entry.creationChangedEvent.notify()); +Entry.EntityObject.prototype.doCommand = function() { + this.isCommandValid = !0; }; -Entry.StateManager.prototype.getLastCommand = function() { - return this.undoStack_[this.undoStack_.length - 1]; +Entry.EntityObject.prototype.checkCommand = function() { + Entry.engine.isState("stop") && !this.isCommandValid && Entry.dispatchEvent("cancelLastCommand"); }; -Entry.StateManager.prototype.undo = function() { - if (this.canUndo() && !this.isRestoring()) { - this.addActivity("undo"); - for (this.startRestore();this.undoStack_.length;) { - var b = this.undoStack_.pop(); - b.func.apply(b.caller, b.params); - if (!0 !== b.isPass) { - break; - } - } - this.updateView(); - this.endRestore(); - Entry.creationChangedEvent && Entry.creationChangedEvent.notify(); - } +Entry.EntityObject.prototype.restoreEntity = function(a) { + var b = this.toJSON(); + this.syncModel_(a); + Entry.dispatchEvent("updateObject"); + Entry.stateManager && Entry.stateManager.addCommand("restore object", this, this.restoreEntity, b); }; -Entry.StateManager.prototype.redo = function() { - if (this.canRedo() && !this.isRestoring()) { - this.addActivity("redo"); - var b = this.redoStack_.pop(); - b.func.apply(b.caller, b.params); - this.updateView(); - Entry.creationChangedEvent && Entry.creationChangedEvent.notify(); - } +Entry.EntityObject.prototype.setX = function(a) { + "number" == typeof a && (this.x = a, this.object.x = this.x, this.isClone || this.parent.updateCoordinateView(), this.updateDialog(), Entry.requestUpdate = !0); }; -Entry.StateManager.prototype.updateView = function() { - this.undoButton && this.redoButton && (this.canUndo() ? this.undoButton.addClass("active") : this.undoButton.removeClass("active"), this.canRedo() ? this.redoButton.addClass("active") : this.redoButton.removeClass("active")); +Entry.EntityObject.prototype.getX = function() { + return this.x; }; -Entry.StateManager.prototype.startRestore = function() { - this.isRestore = !0; +Entry.EntityObject.prototype.setY = function(a) { + "number" == typeof a && (this.y = a, this.object.y = -this.y, this.isClone || this.parent.updateCoordinateView(), this.updateDialog(), Entry.requestUpdate = !0); }; -Entry.StateManager.prototype.endRestore = function() { - this.isRestore = !1; +Entry.EntityObject.prototype.getY = function() { + return this.y; }; -Entry.StateManager.prototype.isRestoring = function() { - return this.isRestore; +Entry.EntityObject.prototype.getDirection = function() { + return this.direction; }; -Entry.StateManager.prototype.startIgnore = function() { - this.isIgnore = !0; +Entry.EntityObject.prototype.setDirection = function(a, b) { + a || (a = 0); + "vertical" != this.parent.getRotateMethod() || b || (0 <= this.direction && 180 > this.direction) == (0 <= a && 180 > a) || (this.setScaleX(-this.getScaleX()), Entry.stage.updateObject(), this.flip = !this.flip); + this.direction = a.mod(360); + this.object.direction = this.direction; + this.isClone || this.parent.updateRotationView(); + Entry.dispatchEvent("updateObject"); + Entry.requestUpdate = !0; }; -Entry.StateManager.prototype.endIgnore = function() { - this.isIgnore = !1; +Entry.EntityObject.prototype.setRotation = function(a) { + "free" != this.parent.getRotateMethod() && (a = 0); + this.rotation = a.mod(360); + this.object.rotation = this.rotation; + this.updateDialog(); + this.isClone || this.parent.updateRotationView(); + Entry.dispatchEvent("updateObject"); + Entry.requestUpdate = !0; }; -Entry.StateManager.prototype.isIgnoring = function() { - return this.isIgnore; +Entry.EntityObject.prototype.getRotation = function() { + return this.rotation; }; -Entry.StateManager.prototype.canUndo = function() { - return 0 < this.undoStack_.length && Entry.engine.isState("stop"); +Entry.EntityObject.prototype.setRegX = function(a) { + "textBox" == this.type && (a = 0); + this.regX = a; + this.object.regX = this.regX; + Entry.requestUpdate = !0; }; -Entry.StateManager.prototype.canRedo = function() { - return 0 < this.redoStack_.length && Entry.engine.isState("stop"); +Entry.EntityObject.prototype.getRegX = function() { + return this.regX; }; -Entry.StateManager.prototype.addStamp = function() { - this.stamp = Entry.generateHash(); - this.undoStack_.length && (this.undoStack_[this.undoStack_.length - 1].stamp = this.stamp); +Entry.EntityObject.prototype.setRegY = function(a) { + "textBox" == this.type && (a = 0); + this.regY = a; + this.object.regY = this.regY; + Entry.requestUpdate = !0; }; -Entry.StateManager.prototype.isSaved = function() { - return 0 === this.undoStack_.length || this.undoStack_[this.undoStack_.length - 1].stamp == this.stamp && "string" == typeof this.stamp; +Entry.EntityObject.prototype.getRegY = function() { + return this.regY; }; -Entry.StateManager.prototype.addActivity = function(b) { - Entry.reporter && Entry.reporter.report(new Entry.State(b)); +Entry.EntityObject.prototype.setScaleX = function(a) { + this.scaleX = a; + this.object.scaleX = this.scaleX; + this.parent.updateCoordinateView(); + this.updateDialog(); + Entry.requestUpdate = !0; }; -Entry.EntryObject = function(b) { - if (b) { - this.id = b.id; - this.name = b.name || b.sprite.name; - this.text = b.text || this.name; - this.objectType = b.objectType; - this.objectType || (this.objectType = "sprite"); - this.script = new Entry.Code(b.script ? b.script : [], this); - this.pictures = b.sprite.pictures; - this.sounds = []; - this.sounds = b.sprite.sounds; - for (var a = 0;a < this.sounds.length;a++) { - this.sounds[a].id || (this.sounds[a].id = Entry.generateHash()), Entry.initSound(this.sounds[a]); - } - this.lock = b.lock ? b.lock : !1; - this.isEditing = !1; - "sprite" == this.objectType && (this.selectedPicture = b.selectedPictureId ? this.getPicture(b.selectedPictureId) : this.pictures[0]); - this.scene = Entry.scene.getSceneById(b.scene) || Entry.scene.selectedScene; - this.setRotateMethod(b.rotateMethod); - this.entity = new Entry.EntityObject(this); - this.entity.injectModel(this.selectedPicture ? this.selectedPicture : null, b.entity ? b.entity : this.initEntity(b)); - this.clonedEntities = []; - Entry.stage.loadObject(this); - for (a in this.pictures) { - var c = this.pictures[a]; - c.objectId = this.id; - c.id || (c.id = Entry.generateHash()); - var d = new Image; - c.fileurl ? d.src = c.fileurl : c.fileurl ? d.src = c.fileurl : (b = c.filename, d.src = Entry.defaultPath + "/uploads/" + b.substring(0, 2) + "/" + b.substring(2, 4) + "/image/" + b + ".png"); - Entry.Loader.addQueue(); - d.onload = function(a) { - Entry.container.cachePicture(c.id, d); - Entry.Loader.removeQueue(); - Entry.requestUpdate = !0; - }; - } - } +Entry.EntityObject.prototype.getScaleX = function() { + return this.scaleX; }; -Entry.EntryObject.prototype.generateView = function() { - if ("workspace" == Entry.type) { - var 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); - }); - Entry.Utils.disableContextmenu(b); - var a = this; - $(b).on("contextmenu", function(b) { - b = [{text:Lang.Workspace.context_rename, callback:function(b) { - b.stopPropagation(); - b = a; - b.setLock(!1); - b.editObjectValues(!0); - b.nameView_.select(); - }}, {text:Lang.Workspace.context_duplicate, enable:!Entry.engine.isState("run"), callback:function() { - Entry.container.addCloneObject(a); - }}, {text:Lang.Workspace.context_remove, callback:function() { - Entry.container.removeObject(a); - }}, {text:Lang.Workspace.copy_file, callback:function() { - Entry.container.setCopiedObject(a); - }}, {text:Lang.Blocks.Paste_blocks, enable:!Entry.engine.isState("run") && !!Entry.container.copiedObject, callback:function() { - Entry.container.copiedObject ? Entry.container.addCloneObject(Entry.container.copiedObject) : Entry.toast.alert(Lang.Workspace.add_object_alert, Lang.Workspace.object_not_found_for_paste); - }}]; - Entry.ContextMenu.show(b, "workspace-contextmenu"); - }); - this.view_ = b; - var c = this, b = Entry.createElement("ul"); - b.addClass("objectInfoView"); - Entry.objectEditable || b.addClass("entryHide"); - var d = Entry.createElement("li"); - d.addClass("objectInfo_visible"); - this.entity.getVisible() || d.addClass("objectInfo_unvisible"); - d.bindOnClick(function(a) { - Entry.engine.isState("run") || (a = c.entity, a.setVisible(!a.getVisible()) ? this.removeClass("objectInfo_unvisible") : this.addClass("objectInfo_unvisible")); - }); - var e = Entry.createElement("li"); - e.addClass("objectInfo_unlock"); - this.getLock() && e.addClass("objectInfo_lock"); - e.bindOnClick(function(a) { - Entry.engine.isState("run") || (a = c, a.setLock(!a.getLock()) ? this.addClass("objectInfo_lock") : this.removeClass("objectInfo_lock"), a.updateInputViews(a.getLock())); - }); - b.appendChild(d); - b.appendChild(e); - this.view_.appendChild(b); - b = Entry.createElement("div"); - b.addClass("entryObjectThumbnailWorkspace"); - this.view_.appendChild(b); - this.thumbnailView_ = b; - b = Entry.createElement("div"); - b.addClass("entryObjectWrapperWorkspace"); - this.view_.appendChild(b); - d = Entry.createElement("input"); - d.bindOnClick(function(a) { - a.preventDefault(); - Entry.container.selectObject(c.id); - this.readOnly || (this.focus(), this.select()); - }); - d.addClass("entryObjectNameWorkspace"); - b.appendChild(d); - this.nameView_ = d; - this.nameView_.entryObject = this; - d.setAttribute("readonly", !0); - var f = this; - this.nameView_.onblur = function(a) { - this.entryObject.name = this.value; - Entry.playground.reloadPlayground(); - }; - this.nameView_.onkeypress = function(a) { - 13 == a.keyCode && f.editObjectValues(!1); - }; - this.nameView_.value = this.name; - d = Entry.createElement("div"); - d.addClass("entryObjectEditWorkspace"); - d.object = this; - this.editView_ = d; - this.view_.appendChild(d); - Entry.objectEditable ? ($(d).mousedown(function(b) { - var c = a.isEditing; - b.stopPropagation(); - Entry.documentMousedown.notify(b); - Entry.engine.isState("run") || !1 !== c || (a.editObjectValues(!c), Entry.playground.object !== a && Entry.container.selectObject(a.id), a.nameView_.select()); - }), 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 q = Entry.createElement("input"); - q.addClass("entryObjectCoordinateInputWorkspace", "entryObjectCoordinateInputWorkspace_size"); - q.bindOnClick(function(a) { - a.stopPropagation(); - this.select(); - }); - q.setAttribute("readonly", !0); - d.appendChild(e); - d.appendChild(g); - d.appendChild(h); - d.appendChild(k); - d.appendChild(l); - d.appendChild(q); - d.xInput_ = g; - d.yInput_ = k; - d.sizeInput_ = q; - 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(); - }; - q.onkeypress = function(a) { - 13 == a.keyCode && c.editObjectValues(!1); - }; - q.onblur = function(a) { - isNaN(q.value) || c.entity.setSize(Number(q.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 n = Entry.createElement("input"); - n.addClass("entryObjectRotateInputWorkspace"); - n.setAttribute("readonly", !0); - n.bindOnClick(function(a) { - a.stopPropagation(); - this.select(); - }); - this.rotateSpan_ = e; - this.rotateInput_ = n; - h = Entry.createElement("span"); - h.addClass("entryObjectDirectionSpanWorkspace"); - h.innerHTML = Lang.Workspace.direction + " : "; - var m = Entry.createElement("input"); - m.addClass("entryObjectDirectionInputWorkspace"); - m.setAttribute("readonly", !0); - m.bindOnClick(function(a) { - a.stopPropagation(); - this.select(); - }); - this.directionInput_ = m; - d.appendChild(e); - d.appendChild(n); - d.appendChild(h); - d.appendChild(m); - d.rotateInput_ = n; - d.directionInput_ = m; - c = this; - n.onkeypress = function(a) { - 13 == a.keyCode && c.editObjectValues(!1); - }; - n.onblur = function(a) { - a = n.value; - -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))); - isNaN(a) || c.entity.setRotation(Number(a)); - c.updateRotationView(); - Entry.stage.updateObject(); - }; - 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.setDirection(Number(a)); - c.updateRotationView(); - Entry.stage.updateObject(); - }; - d = Entry.createElement("div"); - d.addClass("rotationMethodWrapper"); - b.appendChild(d); - this.rotationMethodWrapper_ = d; - b = Entry.createElement("span"); - b.addClass("entryObjectRotateMethodLabelWorkspace"); - d.appendChild(b); - b.innerHTML = Lang.Workspace.rotate_method + " : "; - b = Entry.createElement("div"); - b.addClass("entryObjectRotateModeWorkspace"); - b.addClass("entryObjectRotateModeAWorkspace"); - b.object = this; - this.rotateModeAView_ = b; - d.appendChild(b); - b.bindOnClick(function(a) { - Entry.engine.isState("run") || this.object.getLock() || (this.object.initRotateValue("free"), this.object.setRotateMethod("free")); - }); - b = Entry.createElement("div"); - b.addClass("entryObjectRotateModeWorkspace"); - b.addClass("entryObjectRotateModeBWorkspace"); - b.object = this; - this.rotateModeBView_ = b; - d.appendChild(b); - b.bindOnClick(function(a) { - Entry.engine.isState("run") || this.object.getLock() || (this.object.initRotateValue("vertical"), this.object.setRotateMethod("vertical")); - }); - b = Entry.createElement("div"); - b.addClass("entryObjectRotateModeWorkspace"); - b.addClass("entryObjectRotateModeCWorkspace"); - b.object = this; - this.rotateModeCView_ = b; - d.appendChild(b); - b.bindOnClick(function(a) { - Entry.engine.isState("run") || this.object.getLock() || (this.object.initRotateValue("none"), this.object.setRotateMethod("none")); - }); - this.updateThumbnailView(); - this.updateCoordinateView(); - this.updateRotateMethodView(); - this.updateInputViews(); - this.updateCoordinateView(!0); - this.updateRotationView(!0); - return this.view_; - } - if ("phone" == Entry.type) { - return b = Entry.createElement("li", this.id), b.addClass("entryContainerListElementWorkspace"), b.object = this, b.bindOnClick(function(a) { - Entry.container.getObject(this.id) && Entry.container.selectObject(this.id); - }), $ && (a = this, context.attach("#" + this.id, [{text:Lang.Workspace.context_rename, href:"/", action:function(a) { - a.preventDefault(); - }}, {text:Lang.Workspace.context_duplicate, href:"/", action:function(b) { - b.preventDefault(); - Entry.container.addCloneObject(a); - }}, {text:Lang.Workspace.context_remove, href:"/", action:function(b) { - b.preventDefault(); - Entry.container.removeObject(a); - }}])), this.view_ = b, b = Entry.createElement("ul"), b.addClass("objectInfoView"), d = Entry.createElement("li"), d.addClass("objectInfo_visible"), e = Entry.createElement("li"), e.addClass("objectInfo_lock"), b.appendChild(d), b.appendChild(e), this.view_.appendChild(b), b = Entry.createElement("div"), b.addClass("entryObjectThumbnailWorkspace"), this.view_.appendChild(b), this.thumbnailView_ = b, b = Entry.createElement("div"), b.addClass("entryObjectWrapperWorkspace"), this.view_.appendChild(b), - d = Entry.createElement("input"), d.addClass("entryObjectNameWorkspace"), b.appendChild(d), this.nameView_ = d, this.nameView_.entryObject = this, this.nameView_.onblur = function() { - this.entryObject.name = this.value; - Entry.playground.reloadPlayground(); - }, this.nameView_.onkeypress = function(a) { - 13 == a.keyCode && c.editObjectValues(!1); - }, this.nameView_.value = this.name, Entry.objectEditable && Entry.objectDeletable && (d = Entry.createElement("div"), d.addClass("entryObjectDeletePhone"), d.object = this, this.deleteView_ = d, this.view_.appendChild(d), d.bindOnClick(function(a) { - Entry.engine.isState("run") || Entry.container.removeObject(this.object); - })), d = Entry.createElement("button"), d.addClass("entryObjectEditPhone"), d.object = this, d.bindOnClick(function(a) { - if (a = Entry.container.getObject(this.id)) { - Entry.container.selectObject(a.id), Entry.playground.injectObject(a); - } - }), this.view_.appendChild(d), d = Entry.createElement("div"), d.addClass("entryObjectInformationWorkspace"), d.object = this, this.isInformationToggle = !1, b.appendChild(d), this.informationView_ = d, d = Entry.createElement("div"), d.addClass("entryObjectRotateLabelWrapperWorkspace"), this.view_.appendChild(d), this.rotateLabelWrapperView_ = d, e = Entry.createElement("span"), e.addClass("entryObjectRotateSpanWorkspace"), e.innerHTML = Lang.Workspace.rotation + " : ", n = Entry.createElement("input"), - n.addClass("entryObjectRotateInputWorkspace"), this.rotateSpan_ = e, this.rotateInput_ = n, h = Entry.createElement("span"), h.addClass("entryObjectDirectionSpanWorkspace"), h.innerHTML = Lang.Workspace.direction + " : ", m = Entry.createElement("input"), m.addClass("entryObjectDirectionInputWorkspace"), this.directionInput_ = m, d.appendChild(e), d.appendChild(n), d.appendChild(h), d.appendChild(m), d.rotateInput_ = n, d.directionInput_ = m, c = this, n.onkeypress = function(a) { - 13 == a.keyCode && (a = n.value, -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))), isNaN(a) || c.entity.setRotation(Number(a)), c.updateRotationView(), n.blur()); - }, n.onblur = function(a) { - c.entity.setRotation(c.entity.getRotation()); - Entry.stage.updateObject(); - }, 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.setDirection(Number(a)), c.updateRotationView(), m.blur()); - }, m.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, q = Entry.createElement("input"), q.addClass("entryObjectCoordinateInputWorkspace", "entryObjectCoordinateInputWorkspace_size"), d.appendChild(e), d.appendChild(g), d.appendChild(h), d.appendChild(k), d.appendChild(l), d.appendChild(q), - d.xInput_ = g, d.yInput_ = k, d.sizeInput_ = q, 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.EntityObject.prototype.setScaleY = function(a) { + this.scaleY = a; + this.object.scaleY = this.scaleY; + this.parent.updateCoordinateView(); + this.updateDialog(); + Entry.requestUpdate = !0; }; -Entry.EntryObject.prototype.setName = function(b) { - Entry.assert("string" == typeof b, "object name must be string"); - this.name = b; - this.nameView_.value = b; +Entry.EntityObject.prototype.getScaleY = function() { + return this.scaleY; }; -Entry.EntryObject.prototype.setText = function(b) { - Entry.assert("string" == typeof b, "object text must be string"); - this.text = b; +Entry.EntityObject.prototype.setSize = function(a) { + 1 > a && (a = 1); + a /= this.getSize(); + this.setScaleX(this.getScaleX() * a); + this.setScaleY(this.getScaleY() * a); + this.isClone || this.parent.updateCoordinateView(); + Entry.requestUpdate = !0; }; -Entry.EntryObject.prototype.setScript = function(b) { - this.script = b; +Entry.EntityObject.prototype.getSize = function() { + return (this.getWidth() * Math.abs(this.getScaleX()) + this.getHeight() * Math.abs(this.getScaleY())) / 2; }; -Entry.EntryObject.prototype.getScriptText = function() { - return JSON.stringify(this.script.toJSON()); +Entry.EntityObject.prototype.setWidth = function(a) { + this.width = a; + this.object.width = this.width; + this.textObject && this.getLineBreak() && (this.textObject.lineWidth = this.width); + this.updateDialog(); + this.updateBG(); + Entry.requestUpdate = !0; }; -Entry.EntryObject.prototype.initEntity = function(b) { - var a = {}; - a.x = a.y = 0; - a.rotation = 0; - a.direction = 90; - if ("sprite" == this.objectType) { - var c = b.sprite.pictures[0].dimension; - a.regX = c.width / 2; - a.regY = c.height / 2; - a.scaleX = a.scaleY = "background" == b.sprite.category.main ? Math.max(270 / c.height, 480 / c.width) : "new" == b.sprite.category.main ? 1 : 200 / (c.width + c.height); - a.width = c.width; - a.height = c.height; - } else { - if ("textBox" == this.objectType) { - if (a.regX = 25, a.regY = 12, a.scaleX = a.scaleY = 1.5, a.width = 50, a.height = 24, a.text = b.text, b.options) { - if (b = b.options, c = "", b.bold && (c += "bold "), b.italic && (c += "italic "), a.underline = b.underline, a.strike = b.strike, a.font = c + "20px " + b.font.family, a.colour = b.colour, a.bgColor = b.background, a.lineBreak = b.lineBreak) { - a.width = 256, a.height = .5625 * a.width, a.regX = a.width / 2, a.regY = a.height / 2; - } - } else { - a.underline = !1, a.strike = !1, a.font = "20px Nanum Gothic", a.colour = "#000000", a.bgColor = "#ffffff"; - } - } - } - return a; +Entry.EntityObject.prototype.getWidth = function() { + return this.width; }; -Entry.EntryObject.prototype.updateThumbnailView = function() { - if ("sprite" == this.objectType) { - if (this.entity.picture.fileurl) { - this.thumbnailView_.style.backgroundImage = 'url("' + this.entity.picture.fileurl + '")'; - } else { - var b = this.entity.picture.filename; - this.thumbnailView_.style.backgroundImage = 'url("' + Entry.defaultPath + "/uploads/" + b.substring(0, 2) + "/" + b.substring(2, 4) + "/thumb/" + b + '.png")'; - } - } else { - "textBox" == this.objectType && (this.thumbnailView_.style.backgroundImage = "url(" + (Entry.mediaFilePath + "/text_icon.png") + ")"); - } +Entry.EntityObject.prototype.setHeight = function(a) { + this.height = a; + this.textObject && (this.object.height = this.height, this.alignTextBox()); + this.updateDialog(); + this.updateBG(); + Entry.requestUpdate = !0; }; -Entry.EntryObject.prototype.updateCoordinateView = function(b) { - if ((this.isSelected() || b) && this.coordinateView_ && this.coordinateView_.xInput_ && this.coordinateView_.yInput_) { - b = this.coordinateView_.xInput_.value; - var a = this.coordinateView_.yInput_.value, c = this.coordinateView_.sizeInput_.value, d = this.entity.getX().toFixed(1), e = this.entity.getY().toFixed(1), f = this.entity.getSize().toFixed(1); - b != d && (this.coordinateView_.xInput_.value = d); - a != e && (this.coordinateView_.yInput_.value = e); - c != f && (this.coordinateView_.sizeInput_.value = f); - } +Entry.EntityObject.prototype.getHeight = function() { + return this.height; }; -Entry.EntryObject.prototype.updateRotationView = function(b) { - if (this.isSelected() && this.view_ || b) { - b = "", "free" == this.getRotateMethod() ? (this.rotateSpan_.removeClass("entryRemove"), this.rotateInput_.removeClass("entryRemove"), b += this.entity.getRotation().toFixed(1), this.rotateInput_.value = b + "\u02da") : (this.rotateSpan_.addClass("entryRemove"), this.rotateInput_.addClass("entryRemove")), b = "" + this.entity.getDirection().toFixed(1), b += "\u02da", this.directionInput_.value = b; - } +Entry.EntityObject.prototype.setColour = function(a) { + a || (a = "#000000"); + this.colour = a; + this.textObject && (this.textObject.color = this.colour); + Entry.requestUpdate = !0; }; -Entry.EntryObject.prototype.select = function(b) { - console.log(this); +Entry.EntityObject.prototype.getColour = function() { + return this.colour; }; -Entry.EntryObject.prototype.addPicture = function(b, a) { - Entry.stateManager && Entry.stateManager.addCommand("add sprite", this, this.removePicture, b.id); - b.objectId = this.id; - a || 0 === a ? (this.pictures.splice(a, 0, b), Entry.playground.injectPicture(this)) : this.pictures.push(b); - return new Entry.State(this, this.removePicture, b.id); +Entry.EntityObject.prototype.setBGColour = function(a) { + a || (a = "transparent"); + this.bgColor = a; + this.updateBG(); + Entry.requestUpdate = !0; }; -Entry.EntryObject.prototype.removePicture = function(b) { - if (2 > this.pictures.length) { - return !1; - } - b = this.getPicture(b); - var a = this.pictures.indexOf(b); - Entry.stateManager && Entry.stateManager.addCommand("remove sprite", this, this.addPicture, b, a); - this.pictures.splice(a, 1); - b === this.selectedPicture && Entry.playground.selectPicture(this.pictures[0]); - Entry.playground.injectPicture(this); - Entry.playground.reloadPlayground(); - return new Entry.State(this, this.addPicture, b, a); +Entry.EntityObject.prototype.getBGColour = function() { + return this.bgColor; }; -Entry.EntryObject.prototype.getPicture = function(b) { - if (!b) { - return this.selectedPicture; - } - b = b.trim(); - for (var a = this.pictures, c = a.length, d = 0;d < c;d++) { - if (a[d].id == b) { - return a[d]; - } - } - for (d = 0;d < c;d++) { - if (a[d].name == b) { - return a[d]; - } - } - b = Entry.parseNumber(b); - if ((!1 !== b || "boolean" != typeof b) && c >= b && 0 < b) { - return a[b - 1]; - } - throw Error("No picture found"); +Entry.EntityObject.prototype.setUnderLine = function(a) { + void 0 === a && (a = !1); + this.underLine = a; + this.textObject.underLine = a; + Entry.requestUpdate = !0; }; -Entry.EntryObject.prototype.setPicture = function(b) { - for (var a in this.pictures) { - if (b.id === this.pictures[a].id) { - this.pictures[a] = b; - return; - } - } - throw Error("No picture found"); +Entry.EntityObject.prototype.getUnderLine = function() { + return this.underLine; }; -Entry.EntryObject.prototype.getPrevPicture = function(b) { - for (var a = this.pictures, c = a.length, d = 0;d < c;d++) { - if (a[d].id == b) { - return a[0 == d ? c - 1 : d - 1]; - } - } +Entry.EntityObject.prototype.setStrike = function(a) { + void 0 === a && (a = !1); + this.strike = a; + this.textObject.strike = a; + Entry.requestUpdate = !0; }; -Entry.EntryObject.prototype.getNextPicture = function(b) { - for (var a = this.pictures, c = a.length, d = 0;d < c;d++) { - if (a[d].id == b) { - return a[d == c - 1 ? 0 : d + 1]; - } +Entry.EntityObject.prototype.getStrike = function() { + return this.strike; +}; +Entry.EntityObject.prototype.getFont = function() { + var a = []; + this.fontBold && a.push("bold"); + this.fontItalic && a.push("italic"); + a.push(this.getFontSize() + "px"); + a.push(this.fontType); + return a.join(" "); +}; +Entry.EntityObject.prototype.setFont = function(a) { + if ("textBox" == this.parent.objectType && this.font !== a) { + a || (a = "20px Nanum Gothic"); + var b = a.split(" "), c; + if (c = -1 < b.indexOf("bold")) { + b.splice(c - 1, 1), this.setFontBold(!0); + } + if (c = -1 < b.indexOf("italic")) { + b.splice(c - 1, 1), this.setFontItalic(!0); + } + c = parseInt(b.shift()); + this.setFontSize(c); + this.setFontType(b.join(" ")); + this.font = this.getFont(); + this.textObject.font = a; + Entry.stage.update(); + this.setWidth(this.textObject.getMeasuredWidth()); + this.updateBG(); + Entry.stage.updateObject(); } }; -Entry.EntryObject.prototype.selectPicture = function(b) { - var a = this.getPicture(b); - if (a) { - this.selectedPicture = a, this.entity.setImage(a), this.updateThumbnailView(); - } else { - throw Error("No picture with pictureId : " + b); - } -}; -Entry.EntryObject.prototype.addSound = function(b, a) { - b.id || (b.id = Entry.generateHash()); - Entry.stateManager && Entry.stateManager.addCommand("add sound", this, this.removeSound, b.id); - Entry.initSound(b, a); - a || 0 === a ? (this.sounds.splice(a, 0, b), Entry.playground.injectSound(this)) : this.sounds.push(b); - return new Entry.State(this, this.removeSound, b.id); -}; -Entry.EntryObject.prototype.removeSound = function(b) { - var a; - a = this.getSound(b); - b = this.sounds.indexOf(a); - Entry.stateManager && Entry.stateManager.addCommand("remove sound", this, this.addSound, a, b); - this.sounds.splice(b, 1); - Entry.playground.reloadPlayground(); - Entry.playground.injectSound(this); - return new Entry.State(this, this.addSound, a, b); +Entry.EntityObject.prototype.setLineHeight = function() { + switch(this.getFontType()) { + case "Nanum Gothic Coding": + this.textObject.lineHeight = this.fontSize; + break; + default: + this.textObject.lineHeight = 0; + } }; -Entry.EntryObject.prototype.getRotateMethod = function() { - this.rotateMethod || (this.rotateMethod = "free"); - return this.rotateMethod; +Entry.EntityObject.prototype.syncFont = function() { + this.textObject.font = this.getFont(); + this.setLineHeight(); + Entry.stage.update(); + this.getLineBreak() || this.setWidth(this.textObject.getMeasuredWidth()); + Entry.stage.updateObject(); + Entry.requestUpdate = !0; }; -Entry.EntryObject.prototype.setRotateMethod = function(b) { - b || (b = "free"); - this.rotateMethod = b; - this.updateRotateMethodView(); - Entry.stage.selectedObject && Entry.stage.selectedObject.entity && (Entry.stage.updateObject(), Entry.stage.updateHandle()); +Entry.EntityObject.prototype.getFontType = function() { + return this.fontType; }; -Entry.EntryObject.prototype.initRotateValue = function(b) { - this.rotateMethod != b && (b = this.entity, b.rotation = 0, b.direction = 90, b.flip = !1); +Entry.EntityObject.prototype.setFontType = function(a) { + "textBox" == this.parent.objectType && (this.fontType = a ? a : "Nanum Gothic", this.syncFont()); }; -Entry.EntryObject.prototype.updateRotateMethodView = function() { - var b = this.rotateMethod; - this.rotateModeAView_ && (this.rotateModeAView_.removeClass("selected"), this.rotateModeBView_.removeClass("selected"), this.rotateModeCView_.removeClass("selected"), "free" == b ? this.rotateModeAView_.addClass("selected") : "vertical" == b ? this.rotateModeBView_.addClass("selected") : this.rotateModeCView_.addClass("selected"), this.updateRotationView()); +Entry.EntityObject.prototype.getFontSize = function(a) { + return this.fontSize; }; -Entry.EntryObject.prototype.toggleInformation = function(b) { - this.setRotateMethod(this.getRotateMethod()); - void 0 === b && (b = this.isInformationToggle = !this.isInformationToggle); - b ? this.view_.addClass("informationToggle") : this.view_.removeClass("informationToggle"); +Entry.EntityObject.prototype.setFontSize = function(a) { + "textBox" == this.parent.objectType && this.fontSize != a && (this.fontSize = a ? a : 20, this.syncFont(), this.alignTextBox()); }; -Entry.EntryObject.prototype.addCloneEntity = function(b, a, c) { - this.clonedEntities.length > Entry.maxCloneLimit || (b = new Entry.EntityObject(this), a ? (b.injectModel(a.picture ? a.picture : null, a.toJSON()), b.snapshot_ = a.snapshot_, a.effect && (b.effect = Entry.cloneSimpleObject(a.effect), b.applyFilter()), a.brush && Entry.setCloneBrush(b, a.brush)) : (b.injectModel(this.entity.picture ? this.entity.picture : null, this.entity.toJSON(b)), b.snapshot_ = this.entity.snapshot_, this.entity.effect && (b.effect = Entry.cloneSimpleObject(this.entity.effect), - b.applyFilter()), this.entity.brush && Entry.setCloneBrush(b, this.entity.brush)), Entry.engine.raiseEventOnEntity(b, [b, "when_clone_start"]), b.isClone = !0, b.isStarted = !0, this.addCloneVariables(this, b, a ? a.variables : null, a ? a.lists : null), this.clonedEntities.push(b), Entry.stage.loadEntity(b)); +Entry.EntityObject.prototype.setFontBold = function(a) { + this.fontBold = a; + Entry.requestUpdate = !0; }; -Entry.EntryObject.prototype.initializeSplitter = function(b) { - b.onmousedown = function(a) { - Entry.container.disableSort(); - Entry.container.splitterEnable = !0; - }; - document.addEventListener("mousemove", function(a) { - Entry.container.splitterEnable && Entry.resizeElement({canvasWidth:a.x || a.clientX}); - }); - document.addEventListener("mouseup", function(a) { - Entry.container.splitterEnable = !1; - Entry.container.enableSort(); - }); +Entry.EntityObject.prototype.toggleFontBold = function() { + this.fontBold = !this.fontBold; + this.syncFont(); + return this.fontBold; }; -Entry.EntryObject.prototype.isSelected = function() { - return this.isSelected_; +Entry.EntityObject.prototype.setFontItalic = function(a) { + this.fontItalic = a; + Entry.requestUpdate = !0; }; -Entry.EntryObject.prototype.toJSON = function() { - var b = {}; - b.id = this.id; - b.name = this.name; - "textBox" == this.objectType && (b.text = this.text); - b.script = this.getScriptText(); - "sprite" == this.objectType && (b.selectedPictureId = this.selectedPicture.id); - b.objectType = this.objectType; - b.rotateMethod = this.getRotateMethod(); - b.scene = this.scene.id; - b.sprite = {pictures:Entry.getPicturesJSON(this.pictures), sounds:Entry.getSoundsJSON(this.sounds)}; - b.lock = this.lock; - b.entity = this.entity.toJSON(); - return b; +Entry.EntityObject.prototype.toggleFontItalic = function() { + this.fontItalic = !this.fontItalic; + this.syncFont(); + return this.fontItalic; }; -Entry.EntryObject.prototype.destroy = function() { - Entry.stage.unloadEntity(this.entity); - this.view_ && Entry.removeElement(this.view_); +Entry.EntityObject.prototype.setFontName = function(a) { + for (var b = this.font.split(" "), c = [], d = 0, e = b.length;d < e;d++) { + ("bold" === b[d] || "italic" === b[d] || -1 < b[d].indexOf("px")) && c.push(b[d]); + } + this.setFont(c.join(" ") + " " + a); }; -Entry.EntryObject.prototype.getSound = function(b) { - b = b.trim(); - for (var a = this.sounds, c = a.length, d = 0;d < c;d++) { - if (a[d].id == b) { - return a[d]; +Entry.EntityObject.prototype.getFontName = function() { + if ("textBox" == this.type) { + if (!this.font) { + return ""; } - } - for (d = 0;d < c;d++) { - if (a[d].name == b) { - return a[d]; + for (var a = this.font.split(" "), b = [], c = 0, d = a.length;c < d;c++) { + "bold" !== a[c] && "italic" !== a[c] && -1 === a[c].indexOf("px") && b.push(a[c]); } + return b.join(" ").trim(); } - b = Entry.parseNumber(b); - if ((!1 !== b || "boolean" != typeof b) && c >= b && 0 < b) { - return a[b - 1]; +}; +Entry.EntityObject.prototype.setText = function(a) { + "textBox" == this.parent.objectType && (void 0 === a && (a = ""), this.text = a, this.textObject.text = this.text, this.lineBreak || (this.setWidth(this.textObject.getMeasuredWidth()), this.parent.updateCoordinateView()), this.updateBG(), Entry.stage.updateObject()); +}; +Entry.EntityObject.prototype.getText = function() { + return this.text; +}; +Entry.EntityObject.prototype.setTextAlign = function(a) { + "textBox" == this.parent.objectType && (void 0 === a && (a = Entry.TEXT_ALIGN_CENTER), this.textAlign = a, this.textObject.textAlign = Entry.TEXT_ALIGNS[this.textAlign], this.alignTextBox(), this.updateBG(), Entry.stage.updateObject()); +}; +Entry.EntityObject.prototype.getTextAlign = function() { + return this.textAlign; +}; +Entry.EntityObject.prototype.setLineBreak = function(a) { + if ("textBox" == this.parent.objectType) { + void 0 === a && (a = !1); + var b = this.lineBreak; + this.lineBreak = a; + b && !this.lineBreak ? (this.textObject.lineWidth = null, this.setHeight(this.textObject.getMeasuredLineHeight()), this.setText(this.getText().replace(/\n/g, ""))) : !b && this.lineBreak && (this.setFontSize(this.getFontSize() * this.getScaleX()), this.setHeight(3 * this.textObject.getMeasuredLineHeight()), this.setWidth(this.getWidth() * this.getScaleX()), this.setScaleX(1), this.setScaleY(1), this.textObject.lineWidth = this.getWidth(), this.alignTextBox()); + Entry.stage.updateObject(); } - throw Error("No Sound"); }; -Entry.EntryObject.prototype.addCloneVariables = function(b, a, c, d) { - a.variables = []; - a.lists = []; - c || (c = Entry.findObjsByKey(Entry.variableContainer.variables_, "object_", b.id)); - d || (d = Entry.findObjsByKey(Entry.variableContainer.lists_, "object_", b.id)); - for (b = 0;b < c.length;b++) { - a.variables.push(c[b].clone()); +Entry.EntityObject.prototype.getLineBreak = function() { + return this.lineBreak; +}; +Entry.EntityObject.prototype.setVisible = function(a) { + void 0 === a && (a = !0); + this.visible = a; + this.object.visible = this.visible; + this.dialog && this.syncDialogVisible(); + Entry.requestUpdate = !0; + return this.visible; +}; +Entry.EntityObject.prototype.getVisible = function() { + return this.visible; +}; +Entry.EntityObject.prototype.setImage = function(a) { + delete a._id; + Entry.assert("sprite" == this.type, "Set image is only for sprite object"); + a.id || (a.id = Entry.generateHash()); + this.picture = a; + var b = this.picture.dimension, c = this.getRegX() - this.getWidth() / 2, d = this.getRegY() - this.getHeight() / 2; + this.setWidth(b.width); + this.setHeight(b.height); + b.scaleX || (b.scaleX = this.getScaleX(), b.scaleY = this.getScaleY()); + this.setScaleX(this.scaleX); + this.setScaleY(this.scaleY); + this.setRegX(this.width / 2 + c); + this.setRegY(this.height / 2 + d); + var e = Entry.container.getCachedPicture(a.id); + if (e) { + Entry.image = e, this.object.image = e, this.object.cache(0, 0, this.getWidth(), this.getHeight()); + } else { + e = new Image; + a.fileurl ? e.src = a.fileurl : (b = a.filename, e.src = Entry.defaultPath + "/uploads/" + b.substring(0, 2) + "/" + b.substring(2, 4) + "/image/" + b + ".png"); + var f = this; + e.onload = function(b) { + Entry.container.cachePicture(a.id, e); + Entry.image = e; + f.object.image = e; + f.object.cache(0, 0, f.getWidth(), f.getHeight()); + f = null; + Entry.requestUpdate = !0; + }; } - for (b = 0;b < d.length;b++) { - a.lists.push(d[b].clone()); + Entry.dispatchEvent("updateObject"); +}; +Entry.EntityObject.prototype.applyFilter = function() { + var a = this.effect, b = this.object; + (function(b, a) { + for (var e in b) { + if (b[e] !== a[e]) { + return !1; + } + } + return !0; + })(a, this.getInitialEffectValue()) || (function(b, a) { + var e = [], f = Entry.adjustValueWithMaxMin; + b.brightness = b.brightness; + var g = new createjs.ColorMatrix; + g.adjustColor(f(b.brightness, -100, 100), 0, 0, 0); + g = new createjs.ColorMatrixFilter(g); + e.push(g); + b.hue = b.hue.mod(360); + g = new createjs.ColorMatrix; + g.adjustColor(0, 0, 0, b.hue); + g = new createjs.ColorMatrixFilter(g); + e.push(g); + var g = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1], h = 10.8 * b.hsv * Math.PI / 180, k = Math.cos(h), h = Math.sin(h), l = Math.abs(b.hsv / 100); + 1 < l && (l -= Math.floor(l)); + 0 < l && .33 >= 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); + a.alpha = b.alpha = f(b.alpha, 0, 1); + a.filters = e; + }(a, b), b.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.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 a = this.parent.clonedEntities.indexOf(this); + this.parent.clonedEntities.splice(a, 1); + Entry.Utils.isFunction(this.clearExecutor) && this.clearExecutor(); } }; -Entry.EntryObject.prototype.getLock = function() { - return this.lock; +Entry.EntityObject.prototype.clearExecutor = function() { + this.parent.script.clearExecutorsByEntity(this); }; -Entry.EntryObject.prototype.setLock = function(b) { - this.lock = b; - Entry.stage.updateObject(); - return b; +Entry.EntityObject.prototype.toJSON = function() { + var a = {}; + a.x = Entry.cutDecimal(this.getX()); + a.y = Entry.cutDecimal(this.getY()); + a.regX = Entry.cutDecimal(this.getRegX()); + a.regY = Entry.cutDecimal(this.getRegY()); + a.scaleX = this.getScaleX(); + a.scaleY = this.getScaleY(); + a.rotation = Entry.cutDecimal(this.getRotation()); + a.direction = Entry.cutDecimal(this.getDirection()); + a.width = Entry.cutDecimal(this.getWidth()); + a.height = Entry.cutDecimal(this.getHeight()); + a.font = this.getFont(); + a.visible = this.getVisible(); + "textBox" == this.parent.objectType && (a.colour = this.getColour(), a.text = this.getText(), a.textAlign = this.getTextAlign(), a.lineBreak = this.getLineBreak(), a.bgColor = this.getBGColour(), a.underLine = this.getUnderLine(), a.strike = this.getStrike(), a.fontSize = this.getFontSize()); + return a; +}; +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; }; -Entry.EntryObject.prototype.updateInputViews = function(b) { - b = b || this.getLock(); - var a = [this.nameView_, this.coordinateView_.xInput_, this.coordinateView_.yInput_, this.rotateInput_, this.directionInput_, this.coordinateView_.sizeInput_]; - if (b && 1 != a[0].getAttribute("readonly")) { - for (b = 0;b < a.length;b++) { - a[b].removeClass("selectedEditingObject"), a[b].setAttribute("readonly", !1), this.isEditing = !1; +Entry.EntityObject.prototype.updateBG = function() { + if (this.bgObject) { + this.bgObject.graphics.clear(); + var a = this.getWidth(), b = this.getHeight(); + this.bgObject.graphics.setStrokeStyle(1).beginStroke().beginFill(this.getBGColour()).drawRect(-a / 2, -b / 2, a, b); + if (this.getLineBreak()) { + this.bgObject.x = 0; + } else { + switch(this.getTextAlign()) { + case Entry.TEXT_ALIGN_LEFT: + this.bgObject.x = a / 2; + break; + case Entry.TEXT_ALIGN_CENTER: + this.bgObject.x = 0; + break; + case Entry.TEXT_ALIGN_RIGHT: + this.bgObject.x = -a / 2; + } } } }; -Entry.EntryObject.prototype.editObjectValues = function(b) { - var a; - a = this.getLock() ? [this.nameView_] : [this.nameView_, this.coordinateView_.xInput_, this.coordinateView_.yInput_, this.rotateInput_, this.directionInput_, this.coordinateView_.sizeInput_]; - if (b) { - $(a).removeClass("selectedNotEditingObject"); - for (b = 0;b < a.length;b++) { - a[b].removeAttribute("readonly"), a[b].addClass("selectedEditingObject"); +Entry.EntityObject.prototype.alignTextBox = function() { + if ("textBox" == this.type) { + var a = this.textObject; + if (this.lineBreak) { + var b = a.getMeasuredLineHeight(); + a.y = b / 2 - this.getHeight() / 2; + switch(this.textAlign) { + case Entry.TEXT_ALIGN_CENTER: + a.x = 0; + break; + case Entry.TEXT_ALIGN_LEFT: + a.x = -this.getWidth() / 2; + break; + case Entry.TEXT_ALIGN_RIGHT: + a.x = this.getWidth() / 2; + } + a.maxHeight = this.getHeight(); + } else { + a.x = 0, a.y = 0; } - this.isEditing = !0; - } else { - for (b = 0;b < a.length;b++) { - a[b].blur(!0); + } +}; +Entry.EntityObject.prototype.syncDialogVisible = function() { + this.dialog && (this.dialog.object.visible = this.visible); +}; +Entry.Func = function(a) { + this.id = a ? a.id : Entry.generateHash(); + this.content = a ? new Entry.Code(a.content) : new Entry.Code([[{type:"function_create", copyable:!1, deletable:!1, x:40, y:40}]]); + this.blockMenuBlock = this.block = null; + this.hashMap = {}; + this.paramMap = {}; + var b = function() { + }; + b.prototype = Entry.block.function_general; + b = new b; + b.changeEvent = new Entry.Event; + b.template = Lang.template.function_general; + Entry.block["func_" + this.id] = b; + if (a) { + a = this.content._blockMap; + for (var c in a) { + Entry.Func.registerParamBlock(a[c].type); } - this.blurAllInput(); - this.isEditing = !1; + Entry.Func.generateWsBlock(this); } + Entry.Func.registerFunction(this); + Entry.Func.updateMenu(); }; -Entry.EntryObject.prototype.blurAllInput = function() { - var b = document.getElementsByClassName("selectedEditingObject"); - $(b).removeClass("selectedEditingObject"); - for (var b = [this.nameView_, this.coordinateView_.xInput_, this.coordinateView_.yInput_, this.rotateInput_, this.directionInput_, this.coordinateView_.sizeInput_], a = 0;a < b.length;a++) { - b[a].addClass("selectedNotEditingObject"), b[a].setAttribute("readonly", !0); +Entry.Func.threads = {}; +Entry.Func.registerFunction = function(a) { + if (Entry.playground) { + var b = Entry.playground.mainWorkspace; + b && (this._targetFuncBlock = b.getBlockMenu().getCategoryCodes("func").createThread([{type:"func_" + a.id}]), a.blockMenuBlock = this._targetFuncBlock); } }; -Entry.EntryObject.prototype.addStampEntity = function(b) { - b = new Entry.StampEntity(this, b); - Entry.stage.loadEntity(b); - this.clonedEntities.push(b); - Entry.stage.sortZorder(); +Entry.Func.executeFunction = function(a) { + var b = this.threads[a]; + if (b = Entry.Engine.computeThread(b.entity, b)) { + return this.threads[a] = b, !0; + } + delete this.threads[a]; + return !1; }; -Entry.EntryObject.prototype.getClonedEntities = function() { - var b = []; - this.clonedEntities.map(function(a) { - a.isStamp || b.push(a); - }); - return b; +Entry.Func.clearThreads = function() { + this.threads = {}; }; -Entry.EntryObject.prototype.getStampEntities = function() { - var b = []; - this.clonedEntities.map(function(a) { - a.isStamp && b.push(a); - }); - return b; +Entry.Func.prototype.init = function(a) { + this.id = a.id; + this.content = Blockly.Xml.textToDom(a.content); + this.block = Blockly.Xml.textToDom("" + a.block + "").childNodes[0]; }; -Entry.EntryObject.prototype.clearExecutor = function() { - this.script.clearExecutors(); +Entry.Func.prototype.destroy = function() { + this.blockMenuBlock.destroy(); }; -Entry.Painter = function() { - this.toolbox = {selected:"cursor"}; - this.stroke = {enabled:!1, fillColor:"#000000", lineColor:"#000000", thickness:1, fill:!0, transparent:!1, style:"line", locked:!1}; - this.file = {id:Entry.generateHash(), name:"\uc0c8\uadf8\ub9bc", modified:!1, mode:"new"}; - this.font = {name:"KoPub Batang", size:20, style:"normal"}; - this.selectArea = {}; - this.firstStatement = !1; +Entry.Func.edit = function(a) { + this.cancelEdit(); + this.targetFunc = a; + this.initEditView(a.content); + this.bindFuncChangeEvent(); + this.updateMenu(); }; -Entry.Painter.prototype.initialize = function(b) { - this.generateView(b); - this.canvas = document.getElementById("entryPainterCanvas"); - this.canvas_ = document.getElementById("entryPainterCanvas_"); - this.stage = new createjs.Stage(this.canvas); - this.stage.autoClear = !0; - this.stage.enableDOMEvents(!0); - this.stage.enableMouseOver(10); - this.stage.mouseMoveOutside = !0; - createjs.Touch.enable(this.stage); - this.objectContainer = new createjs.Container; - this.objectContainer.name = "container"; - this.stage.addChild(this.objectContainer); - this.ctx = this.stage.canvas.getContext("2d"); - this.ctx.imageSmoothingEnabled = !1; - this.ctx.webkitImageSmoothingEnabled = !1; - this.ctx.mozImageSmoothingEnabled = !1; - this.ctx.msImageSmoothingEnabled = !1; - this.ctx.oImageSmoothingEnabled = !1; - this.ctx_ = this.canvas_.getContext("2d"); - this.initDashedLine(); - this.initPicture(); - this.initCoordinator(); - this.initHandle(); - this.initDraw(); - var a = this; - Entry.addEventListener("textUpdate", function() { - var b = a.inputField.value(); - "" === b ? (a.inputField.hide(), delete a.inputField) : (a.inputField.hide(), a.drawText(b), a.selectToolbox("cursor")); - }); - this.selectToolbox("cursor"); +Entry.Func.initEditView = function(a) { + this.menuCode || this.setupMenuCode(); + var b = Entry.playground.mainWorkspace; + b.setMode(Entry.Workspace.MODE_OVERLAYBOARD); + b.changeOverlayBoardCode(a); + this._workspaceStateEvent = b.changeEvent.attach(this, this.endEdit); }; -Entry.Painter.prototype.initHandle = function() { - this._handle = new createjs.Container; - this._handle.rect = new createjs.Shape; - this._handle.addChild(this._handle.rect); - var b = new createjs.Container; - b.name = "move"; - b.width = 90; - b.height = 90; - b.x = 90; - b.y = 90; - b.rect = new createjs.Shape; - var a = this; - b.rect.on("mousedown", function(c) { - "cursor" === a.toolbox.selected && (a.initCommand(), this.offset = {x:this.parent.x - this.x - c.stageX, y:this.parent.y - this.y - c.stageY}, this.parent.handleMode = "move", b.isSelectCenter = !1); - }); - b.rect.on("pressmove", function(c) { - "cursor" !== a.toolbox.selected || b.isSelectCenter || (a.doCommand(), this.parent.x = c.stageX + this.offset.x, this.parent.y = c.stageY + this.offset.y, a.updateImageHandle()); - }); - b.on("mouseup", function(b) { - a.checkCommand(); - }); - b.rect.cursor = "move"; - b.addChild(b.rect); - b.notch = new createjs.Shape; - b.addChild(b.notch); - b.NEHandle = this.generateCornerHandle(); - b.addChild(b.NEHandle); - b.NWHandle = this.generateCornerHandle(); - b.addChild(b.NWHandle); - b.SWHandle = this.generateCornerHandle(); - b.addChild(b.SWHandle); - b.SEHandle = this.generateCornerHandle(); - b.addChild(b.SEHandle); - b.EHandle = this.generateXHandle(); - b.addChild(b.EHandle); - b.WHandle = this.generateXHandle(); - b.addChild(b.WHandle); - b.NHandle = this.generateYHandle(); - b.addChild(b.NHandle); - b.SHandle = this.generateYHandle(); - b.addChild(b.SHandle); - b.RHandle = new createjs.Shape; - b.RHandle.graphics.ss(2, 2, 0).beginFill("#888").s("#c1c7cd").f("#c1c7cd").dr(-2, -2, 8, 8); - b.RHandle.on("mousedown", function(b) { - a.initCommand(); - }); - b.RHandle.on("pressmove", function(b) { - a.doCommand(); - var d = b.stageX - this.parent.x; - b = b.stageY - this.parent.y; - this.parent.rotation = 0 <= d ? Math.atan(b / d) / Math.PI * 180 + 90 : Math.atan(b / d) / Math.PI * 180 + 270; - a.updateImageHandle(); - }); - b.RHandle.cursor = "crosshair"; - b.addChild(b.RHandle); - b.on("mouseup", function(b) { - a.checkCommand(); - }); - b.visible = !1; - this.handle = b; - this.stage.addChild(b); - this.updateImageHandleCursor(); +Entry.Func.endEdit = function(a) { + this.unbindFuncChangeEvent(); + this._workspaceStateEvent.destroy(); + delete this._workspaceStateEvent; + switch(a) { + case "save": + this.save(); + case "cancelEdit": + this.cancelEdit(); + } }; -Entry.Painter.prototype.generateCornerHandle = function() { - var b = this, a = new createjs.Shape; - a.graphics.beginFill("#c1c7cd").ss(2, 2, 0).s("#c1c7cd").dr(-4, -4, 8, 8); - a.on("mousedown", function(a) { - b.initCommand(); - this.offset = {x:a.stageX - this.parent.x + this.parent.regX, y:a.stageY - this.parent.y + this.parent.regY}; - }); - a.on("pressmove", function(a) { - b.doCommand(); - var d = Math.sqrt(Math.abs((a.stageX - this.parent.x + this.parent.regX) / this.offset.x * (a.stageY - this.parent.y + this.parent.regY) / this.offset.y)); - 10 < this.parent.width * d && 10 < this.parent.height * d && (this.parent.width *= d, this.parent.height *= d, this.offset = {x:a.stageX - this.parent.x + this.parent.regX, y:a.stageY - this.parent.y + this.parent.regY}); - b.updateImageHandle(); - }); - a.on("mouseup", function(a) { - b.checkCommand(); - }); - return a; +Entry.Func.save = function() { + this.targetFunc.generateBlock(!0); + Entry.variableContainer.saveFunction(this.targetFunc); }; -Entry.Painter.prototype.generateXHandle = function() { - var b = this, a = new createjs.Shape; - a.graphics.beginFill("#c1c7cd").ss(2, 2, 0).s("#c1c7cd").dr(-4, -4, 8, 8); - a.on("mousedown", function(a) { - b.initCommand(); - this.offset = {x:a.stageX - this.parent.x + this.parent.regX}; - }); - a.on("pressmove", function(a) { - b.doCommand(); - var d = Math.abs((a.stageX - this.parent.x + this.parent.regX) / this.offset.x); - 10 < this.parent.width * d && (this.parent.width *= d, this.offset = {x:a.stageX - this.parent.x + this.parent.regX}); - b.updateImageHandle(); - }); - a.on("mouseup", function(a) { - b.checkCommand(); - }); - return a; +Entry.Func.syncFuncName = function(a) { + var b = 0; + a = a.split(" "); + var c = "", d; + d = Blockly.mainWorkspace.getAllBlocks(); + for (var e = 0;e < d.length;e++) { + var f = d[e]; + if ("function_general" === f.type) { + for (var f = f.inputList, g = 0;g < f.length;g++) { + var h = f[g]; + 0 < h.fieldRow.length && h.fieldRow[0] instanceof Blockly.FieldLabel && void 0 != h.fieldRow[0].text_ && (c += h.fieldRow[0].text_, c += " "); + } + c = c.trim(); + if (c === this.srcFName && this.srcFName.split(" ").length == a.length) { + for (c = 0;c < f.length;c++) { + if (h = f[c], 0 < h.fieldRow.length && h.fieldRow[0] instanceof Blockly.FieldLabel && void 0 != h.fieldRow[0].text_) { + if (void 0 === a[b]) { + f.splice(c, 1); + break; + } else { + h.fieldRow[0].text_ = a[b]; + } + b++; + } + } + } + c = ""; + b = 0; + } + } + b = Blockly.Xml.workspaceToDom(Blockly.mainWorkspace); + Blockly.mainWorkspace.clear(); + Blockly.Xml.domToWorkspace(Blockly.mainWorkspace, b); }; -Entry.Painter.prototype.generateYHandle = function() { - var b = this, a = new createjs.Shape; - a.graphics.beginFill("#c1c7cd").ss(2, 2, 0).s("#c1c7cd").dr(-4, -4, 8, 8); - a.on("mousedown", function(a) { - b.initCommand(); - this.offset = {y:a.stageY - this.parent.y + this.parent.regY}; - }); - a.on("pressmove", function(a) { - b.doCommand(); - var d = Math.abs((a.stageY - this.parent.y + this.parent.regY) / this.offset.y); - 10 < this.parent.height * d && (this.parent.height *= d, this.offset = {y:a.stageY - this.parent.y + this.parent.regY}); - b.updateImageHandle(); - }); - a.on("mouseup", function(a) { - b.checkCommand(); - }); +Entry.Func.cancelEdit = function() { + this.targetFunc && (Entry.Func.isEdit = !1, this.targetFunc.block || (this._targetFuncBlock.destroy(), delete Entry.variableContainer.functions_[this.targetFunc.id], delete Entry.variableContainer.selected), delete this.targetFunc, this.updateMenu(), Entry.variableContainer.updateList(), Entry.playground.mainWorkspace.setMode(Entry.Workspace.MODE_BOARD)); +}; +Entry.Func.getMenuXml = function() { + var a = []; + this.targetFunc || (a = a.concat(this.createBtn)); + if (this.targetFunc) { + var b = this.FIELD_BLOCK, b = b.replace("#1", Entry.generateHash()), b = b.replace("#2", Entry.generateHash()), b = Blockly.Xml.textToDom(b).childNodes, a = a.concat(Entry.nodeListToArray(b)) + } + for (var c in Entry.variableContainer.functions_) { + b = Entry.variableContainer.functions_[c], b === this.targetFunc ? (b = Entry.Func.generateBlock(this.targetFunc, Blockly.Xml.workspaceToDom(Entry.Func.workspace), b.id).block, a.push(b)) : a.push(b.block); + } return a; }; -Entry.Painter.prototype.updateImageHandle = function() { - if (this.handle.visible) { - var b = this.handle, a = b.direction, c = b.width, d = b.height, e = b.regX, f = b.regY; - b.rect.graphics.clear().f("rgba(0,0,1,0.01)").ss(2, 2, 0).s("#c1c7cd").lt(-c / 2, -d / 2).lt(0, -d / 2).lt(0, -d / 2).lt(+c / 2, -d / 2).lt(+c / 2, +d / 2).lt(-c / 2, +d / 2).cp(); - b.notch.graphics.clear().f("rgba(0,0,1,0.01)").ss(2, 2, 0).s("#c1c7cd").lt(0, -d / 2).lt(0, -d / 2 - 20).cp(); - b.NEHandle.x = +b.width / 2; - b.NEHandle.y = -b.height / 2; - b.NWHandle.x = -b.width / 2; - b.NWHandle.y = -b.height / 2; - b.SWHandle.x = -b.width / 2; - b.SWHandle.y = +b.height / 2; - b.SEHandle.x = +b.width / 2; - b.SEHandle.y = +b.height / 2; - b.EHandle.x = +b.width / 2; - b.EHandle.y = 0; - b.WHandle.x = -b.width / 2; - b.WHandle.y = 0; - b.NHandle.x = 0; - b.NHandle.y = -b.height / 2; - b.SHandle.x = 0; - b.SHandle.y = +b.height / 2; - b.RHandle.x = -2; - b.RHandle.y = -b.height / 2 - 20 - 2; - this.handle.visible && (c = this.selectedObject, this.selectedObject.text ? (c.width = this.selectedObject.width, c.height = this.selectedObject.height) : (c.width = c.image.width, c.height = c.image.height), c.scaleX = b.width / c.width, c.scaleY = b.height / c.height, c.x = b.x, c.y = b.y, c.regX = c.width / 2 + e / c.scaleX, c.regY = c.height / 2 + f / c.scaleY, c.rotation = b.rotation, c.direction = a, this.selectArea.x1 = b.x - b.width / 2, this.selectArea.y1 = b.y - b.height / 2, this.selectArea.x2 = - b.width, this.selectArea.y2 = b.height, this.objectWidthInput.value = Math.abs(c.width * c.scaleX).toFixed(0), this.objectHeightInput.value = Math.abs(c.height * c.scaleY).toFixed(0), this.objectRotateInput.value = (1 * c.rotation).toFixed(0)); - this.updateImageHandleCursor(); - this.stage.update(); +Entry.Func.syncFunc = function() { + var a = Entry.Func; + if (a.targetFunc) { + var b = a.workspace.topBlocks_[0].toString(), c = a.workspace.topBlocks_.length; + (a.fieldText != b || a.workspaceLength != c) && 1 > Blockly.Block.dragMode_ && (a.updateMenu(), a.fieldText = b, a.workspaceLength = c); } }; -Entry.Painter.prototype.updateImageHandleCursor = function() { - var b = this.handle; - b.rect.cursor = "move"; - b.RHandle.cursor = "crosshair"; - for (var a = ["nwse-resize", "ns-resize", "nesw-resize", "ew-resize"], c = Math.floor((b.rotation + 22.5) % 180 / 45), d = 0;d < c;d++) { - a.push(a.shift()); - } - b.NHandle.cursor = a[1]; - b.NEHandle.cursor = a[2]; - b.EHandle.cursor = a[3]; - b.SEHandle.cursor = a[0]; - b.SHandle.cursor = a[1]; - b.SWHandle.cursor = a[2]; - b.WHandle.cursor = a[3]; - b.NWHandle.cursor = a[0]; -}; -Entry.Painter.prototype.clearCanvas = function(b) { - this.clearHandle(); - b || this.initCommand(); - this.objectContainer.removeAllChildren(); - this.stage.update(); - this.colorLayerData = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height); - b = 0; - for (var a = this.colorLayerData.data.length;b < a;b++) { - this.colorLayerData.data[b] = 255, this.colorLayerData.data[b + 1] = 255, this.colorLayerData.data[b + 2] = 255, this.colorLayerData.data[b + 3] = 255; +Entry.Func.setupMenuCode = function() { + var a = Entry.playground.mainWorkspace; + a && (a = a.getBlockMenu().getCategoryCodes("func"), this._fieldLabel = a.createThread([{type:"function_field_label"}]).getFirstBlock(), this._fieldString = a.createThread([{type:"function_field_string", params:[{type:this.requestParamBlock("string")}]}]).getFirstBlock(), this._fieldBoolean = a.createThread([{type:"function_field_boolean", params:[{type:this.requestParamBlock("boolean")}]}]).getFirstBlock(), this.menuCode = a); +}; +Entry.Func.refreshMenuCode = function() { + if (Entry.playground.mainWorkspace) { + this.menuCode || this.setupMenuCode(); + var a = Entry.block[this._fieldString.params[0].type].changeEvent._listeners.length; + 2 < a && this._fieldString.params[0].changeType(this.requestParamBlock("string")); + a = Entry.block[this._fieldBoolean.params[0].type].changeEvent._listeners.length; + 2 < a && this._fieldBoolean.params[0].changeType(this.requestParamBlock("boolean")); } - this.reloadContext(); }; -Entry.Painter.prototype.newPicture = function() { - var b = {dimension:{height:1, width:1}, fileurl:Entry.mediaFilePath + "_1x1.png", name:Lang.Workspace.new_picture}; - b.id = Entry.generateHash(); - Entry.playground.addPicture(b, !0); +Entry.Func.requestParamBlock = function(a) { + var b = Entry.generateHash(), c; + switch(a) { + case "string": + c = Entry.block.function_param_string; + break; + case "boolean": + c = Entry.block.function_param_boolean; + break; + default: + return null; + } + b = a + "Param_" + b; + a = Entry.Func.createParamBlock(b, c, a); + Entry.block[b] = a; + return b; }; -Entry.Painter.prototype.initPicture = function() { - var b = this; - Entry.addEventListener("pictureSelected", function(a) { - b.selectToolbox("cursor"); - if (b.file.id !== a.id) { - b.file.modified && confirm("\uc218\uc815\ub41c \ub0b4\uc6a9\uc744 \uc800\uc7a5\ud558\uc2dc\uaca0\uc2b5\ub2c8\uae4c?") && (b.file_ = JSON.parse(JSON.stringify(b.file)), b.file_save(!0)); - b.file.modified = !1; - b.clearCanvas(!0); - var c = new Image; - c.id = a.id ? a.id : Entry.generateHash(); - b.file.id = c.id; - b.file.name = a.name; - b.file.mode = "edit"; - c.src = a.fileurl ? a.fileurl : Entry.defaultPath + "/uploads/" + a.filename.substring(0, 2) + "/" + a.filename.substring(2, 4) + "/image/" + a.filename + ".png"; - c.onload = function(a) { - b.addImage(a.target); - }; - } - }); - Entry.addEventListener("pictureImport", function(a) { - b.addPicture(a); - }); - Entry.addEventListener("pictureNameChanged", function(a) { - b.file.name = a.name; - }); - Entry.addEventListener("pictureClear", function(a) { - b.file.modified = !1; - b.file.id = ""; - b.file.name = ""; - b.clearCanvas(); - }); +Entry.Func.registerParamBlock = function(a) { + -1 < a.indexOf("stringParam") ? Entry.Func.createParamBlock(a, Entry.block.function_param_string, a) : -1 < a.indexOf("booleanParam") && Entry.Func.createParamBlock(a, Entry.block.function_param_boolean, a); }; -Entry.Painter.prototype.initDraw = function() { - var b = this; - this.stage.on("stagemousedown", function(a) { - b.stagemousedown(a); - }); - this.stage.on("stagemouseup", function(a) { - b.stagemouseup(a); - }); - this.stage.on("stagemousemove", function(a) { - b.stagemousemove(a); - }); +Entry.Func.createParamBlock = function(a, b, c) { + var d = function() { + }; + c = "string" === c ? "function_param_string" : "function_param_boolean"; + d.prototype = b; + d = new d; + d.changeEvent = new Entry.Event; + d.template = Lang.template[c]; + return Entry.block[a] = d; }; -Entry.Painter.prototype.selectObject = function(b, a) { - this.selectedObject = b; - this.handle.visible = b.visible; - a ? (this.handle.width = this.copy.width, this.handle.height = this.copy.height, this.handle.x = this.selectArea.x1 + this.copy.width / 2, this.handle.y = this.selectArea.y1 + this.copy.height / 2) : (this.handle.width = b.scaleX * b.image.width, this.handle.height = b.scaleY * b.image.height, this.handle.x = b.x, this.handle.y = b.y, this.handle.regX = +(b.regX - b.image.width / 2) * b.scaleX, this.handle.regY = +(b.regY - b.image.height / 2) * b.scaleY); - this.handle.rotation = b.rotation; - this.handle.direction = 0; - this.updateImageHandle(); +Entry.Func.updateMenu = function() { + if (Entry.playground && Entry.playground.mainWorkspace) { + var a = Entry.playground.mainWorkspace.getBlockMenu(); + this.targetFunc ? (this.menuCode || this.setupMenuCode(), a.banClass("functionInit"), a.unbanClass("functionEdit")) : (a.unbanClass("functionInit"), a.banClass("functionEdit")); + a.reDraw(); + } }; -Entry.Painter.prototype.selectTextObject = function(b) { - this.selectedObject = b; - var a = b.getTransformedBounds(); - this.handle.visible = b.visible; - b.width || (this.selectedObject.width = a.width); - b.height || (this.selectedObject.height = a.height); - this.handle.width = b.scaleX * this.selectedObject.width; - this.handle.height = b.scaleY * this.selectedObject.height; - this.handle.x = b.x; - this.handle.y = b.y; - b.regX || (b.regX = b.width / 2); - b.regY || (b.regY = b.height / 2); - this.handle.regX = (b.regX - this.selectedObject.width / 2) * b.scaleX; - this.handle.regY = (b.regY - this.selectedObject.height / 2) * b.scaleY; - this.handle.rotation = b.rotation; - this.handle.direction = 0; - this.updateImageHandle(); +Entry.Func.prototype.edit = function() { + Entry.Func.isEdit || (Entry.Func.isEdit = !0, Entry.Func.svg ? this.parentView.appendChild(this.svg) : Entry.Func.initEditView()); }; -Entry.Painter.prototype.updateHandle = function() { - -1 < this.stage.getChildIndex(this._handle) && this.stage.removeChild(this._handle); - -1 === this.stage.getChildIndex(this.handle) && this.stage.addChild(this.handle); - var b = new createjs.Shape; - b.graphics.clear().beginFill("#000").rect(this.selectArea.x1, this.selectArea.y1, this.selectArea.x2, this.selectArea.y2); - this.handle.rect.hitArea = b; - this.handle.rect.graphics.clear().setStrokeStyle(1, "round").beginStroke("#000000").drawDashedRect(this.selectArea.x1, this.selectArea.y1, this.selectArea.x2, this.selectArea.y2, 4); - this.stage.update(); +Entry.Func.generateBlock = function(a) { + a = Entry.block["func_" + a.id]; + var b = {template:a.template, params:a.params}, c = /(%\d)/mi, d = a.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 = a.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:b, description:e}; }; -Entry.Painter.prototype.updateHandle_ = function() { - this.stage.getChildIndex(-1 < this._handle) && this.stage.addChild(this._handle); - this._handle.rect.graphics.clear().setStrokeStyle(1, "round").beginStroke("#cccccc").drawDashedRect(this.selectArea.x1, this.selectArea.y1, this.selectArea.x2, this.selectArea.y2, 2); - this.stage.update(); +Entry.Func.prototype.generateBlock = function(a) { + a = Entry.Func.generateBlock(this); + this.block = a.block; + this.description = a.description; }; -Entry.Painter.prototype.matchTolerance = function(b, a, c, d, e) { - var f = this.colorLayerData.data[b], g = this.colorLayerData.data[b + 1]; - b = this.colorLayerData.data[b + 2]; - return f >= a - e / 100 * a && f <= a + e / 100 * a && g >= c - e / 100 * c && g <= c + e / 100 * c && b >= d - e / 100 * d && b <= d + e / 100 * d; +Entry.Func.generateWsBlock = function(a) { + this.unbindFuncChangeEvent(); + a = a ? a : this.targetFunc; + for (var b = a.content.getEventMap("funcDef")[0].params[0], c = 0, d = 0, e = [], f = "", g = a.hashMap, h = a.paramMap;b;) { + var k = b.params[0]; + switch(b.type) { + case "function_field_label": + f = f + " " + k; + break; + case "function_field_boolean": + Entry.Mutator.mutate(k.type, {template:Lang.Blocks.FUNCTION_logical_variable + " " + (c ? c : "")}); + g[k.type] = !1; + h[k.type] = c + d; + c++; + e.push({type:"Block", accept:"boolean"}); + f += " %" + (c + d); + break; + case "function_field_string": + Entry.Mutator.mutate(k.type, {template:Lang.Blocks.FUNCTION_character_variable + " " + (d ? d : "")}), g[k.type] = !1, h[k.type] = c + d, d++, f += " %" + (c + d), e.push({type:"Block", accept:"string"}); + } + b = b.getOutputBlock(); + } + c++; + f += " %" + (c + d); + e.push({type:"Indicator", img:"block_icon/function_03.png", size:12}); + Entry.Mutator.mutate("func_" + a.id, {params:e, template:f}); + for (var l in g) { + g[l] ? (b = -1 < l.indexOf("string") ? Lang.Blocks.FUNCTION_character_variable : Lang.Blocks.FUNCTION_logical_variable, Entry.Mutator.mutate(l, {template:b})) : g[l] = !0; + } + this.bindFuncChangeEvent(a); }; -Entry.Painter.prototype.matchColorOnly = function(b, a, c, d) { - return a === this.colorLayerData.data[b] && c === this.colorLayerData.data[b + 1] && d === this.colorLayerData.data[b + 2] ? !0 : !1; +Entry.Func.bindFuncChangeEvent = function(a) { + a = a ? a : this.targetFunc; + !this._funcChangeEvent && a.content.getEventMap("funcDef")[0].view && (this._funcChangeEvent = a.content.getEventMap("funcDef")[0].view._contents[1].changeEvent.attach(this, this.generateWsBlock)); }; -Entry.Painter.prototype.matchColor = function(b, a, c, d, e) { - return a === this.colorLayerData.data[b] && c === this.colorLayerData.data[b + 1] && d === this.colorLayerData.data[b + 2] && e === this.colorLayerData.data[b + 3] ? !0 : !1; +Entry.Func.unbindFuncChangeEvent = function() { + this._funcChangeEvent && this._funcChangeEvent.destroy(); + delete this._funcChangeEvent; }; -Entry.Painter.prototype.colorPixel = function(b, a, c, d, e) { - e || (e = 255); - this.stroke.transparent && (e = d = c = a = 0); - this.colorLayerData.data[b] = a; - this.colorLayerData.data[b + 1] = c; - this.colorLayerData.data[b + 2] = d; - this.colorLayerData.data[b + 3] = e; -}; -Entry.Painter.prototype.pickStrokeColor = function(b) { - b = 4 * (Math.round(b.stageY) * this.canvas.width + Math.round(b.stageX)); - this.stroke.lineColor = Entry.rgb2hex(this.colorLayerData.data[b], this.colorLayerData.data[b + 1], this.colorLayerData.data[b + 2]); - document.getElementById("entryPainterAttrCircle").style.backgroundColor = this.stroke.lineColor; - document.getElementById("entryPainterAttrCircleInput").value = this.stroke.lineColor; +Entry.Helper = function() { + this.visible = !1; }; -Entry.Painter.prototype.drawText = function(b) { - var a = document.getElementById("entryPainterAttrFontStyle").value, c = document.getElementById("entryPainterAttrFontName").value, d = document.getElementById("entryPainterAttrFontSize").value; - b = new createjs.Text(b, a + " " + d + 'px "' + c + '"', this.stroke.lineColor); - b.textBaseline = "top"; - b.x = this.oldPt.x; - b.y = this.oldPt.y; - this.objectContainer.addChild(b); - this.selectTextObject(b); - this.file.modified = !0; +p = Entry.Helper.prototype; +p.generateView = function(a, b) { + this.parentView_ || (this.parentView_ = a, this.blockHelpData = EntryStatic.blockInfo, this.view = a = Entry.createElement("div", "entryBlockHelperWorkspace"), Entry.isForLecture && a.addClass("lecture"), this.parentView_.appendChild(a), b = Entry.createElement("div", "entryBlockHelperContentWorkspace"), b.addClass("entryBlockHelperIntro"), Entry.isForLecture && b.addClass("lecture"), a.appendChild(b), this.blockHelperContent_ = b, this.blockHelperView_ = a, a = Entry.createElement("div", "entryBlockHelperBlockWorkspace"), + this.blockHelperContent_.appendChild(a), b = Entry.createElement("div", "entryBlockHelperDescriptionWorkspace"), this.blockHelperContent_.appendChild(b), b.innerHTML = Lang.Helper.Block_click_msg, this.blockHelperDescription_ = b, this._renderView = new Entry.RenderView($(a), "LEFT"), this.code = new Entry.Code([]), this._renderView.changeCode(this.code), this.first = !0); }; -Entry.Painter.prototype.addImage = function(b) { - var a = new createjs.Bitmap(b); - this.objectContainer.addChild(a); - a.x = this.stage.canvas.width / 2; - a.y = this.stage.canvas.height / 2; - a.regX = a.image.width / 2 | 0; - a.regY = a.image.height / 2 | 0; - if (540 < a.image.height) { - var c = 540 / a.image.height; - a.scaleX = c; - a.scaleY = c; - } - a.name = b.id; - a.id = b.id; - this.selectObject(a); - this.stage.update(); +p.bindWorkspace = function(a) { + a && (this._blockViewObserver && this._blockViewObserver.destroy(), this.workspace = a, this._blockViewObserver = a.observe(this, "_updateSelectedBlock", ["selectedBlockView"])); }; -Entry.Painter.prototype.createBrush = function() { - this.initCommand(); - this.brush = new createjs.Shape; - this.objectContainer.addChild(this.brush); - this.stage.update(); +p._updateSelectedBlock = function() { + var a = this.workspace.selectedBlockView; + if (a && this.visible && a != this._blockView) { + var b = a.block.type; + this._blockView = a; + this.renderBlock(b); + } }; -Entry.Painter.prototype.createEraser = function() { - this.initCommand(); - this.eraser = new createjs.Shape; - this.objectContainer.addChild(this.eraser); - this.stage.update(); +p.renderBlock = function(a) { + var b = Lang.Helper[a]; + if (a && this.visible && b && !Entry.block[a].isPrimitive) { + this.first && (this.blockHelperContent_.removeClass("entryBlockHelperIntro"), this.first = !1); + this.code.clear(); + var c = Entry.block[a].def, c = c || {type:a}; + this.code.createThread([c]); + this.code.board.align(); + this.code.board.resize(); + var c = this.code.getThreads()[0].getFirstBlock().view, d = c.svgGroup.getBBox(); + a = d.width; + d = d.height; + c = c.getSkeleton().box(c).offsetX; + isNaN(c) && (c = 0); + this.blockHelperDescription_.innerHTML = b; + this._renderView.align(); + $(this.blockHelperDescription_).css({top:d + 30}); + this._renderView.svgDom.css({"margin-left":-(a / 2) - 20 - c}); + } }; -Entry.Painter.prototype.clearHandle = function() { - this.handle.visible && (this.handle.visible = !1); - this.coordinator.visible && (this.coordinator.visible = !1); - this.stage.update(); +p.getView = function() { + return this.view; }; -Entry.Painter.prototype.initCommand = function() { - var b = !1; - this.handle.visible && (b = !0, this.handle.visible = !1); - var a = !1; - this.coordinator.visible && (a = !0, this.coordinator.visible = !1); - (b || a) && this.stage.update(); - this.isCommandValid = !1; - this.colorLayerModel = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height); - Entry.stateManager && this.firstStatement && Entry.stateManager.addCommand("edit sprite", this, this.restorePainter, this.colorLayerModel); - this.firstStatement = !0; - b && (this.handle.visible = !0); - a && (this.coordinator.visible = !0); - (b || a) && this.stage.update(); -}; -Entry.Painter.prototype.doCommand = function() { - this.isCommandValid = !0; +p.resize = function() { }; -Entry.Painter.prototype.checkCommand = function() { - this.isCommandValid || Entry.dispatchEvent("cancelLastCommand"); +Entry.HWMontior = {}; +Entry.HWMonitor = function(a) { + this.svgDom = Entry.Dom($('')); + this._hwModule = a; + var b = this; + Entry.addEventListener("windowResized", function() { + var a = b._hwModule.monitorTemplate.mode; + "both" == a && (b.resize(), b.resizeList()); + "list" == a ? b.resizeList() : b.resize(); + }); + Entry.addEventListener("hwModeChange", function() { + b.changeMode(); + }); + this.changeOffset = 0; + this.scale = .5; + this._listPortViews = {}; }; -Entry.Painter.prototype.restorePainter = function(b) { - this.clearHandle(); - var a = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height); - this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height); - this.ctx.putImageData(b, 0, 0); - b = new Image; - b.src = this.canvas.toDataURL(); - var c = this; - b.onload = function(a) { - a = new createjs.Bitmap(a.target); - c.objectContainer.removeAllChildren(); - c.objectContainer.addChild(a); +(function(a) { + a.initView = function() { + this.svgDom = Entry.Dom($('')); }; - Entry.stateManager && Entry.stateManager.addCommand("restore sprite", this, this.restorePainter, a); -}; -Entry.Painter.prototype.platten = function() { - this.colorLayerData = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height); - this.reloadContext(); -}; -Entry.Painter.prototype.fill = function() { - if (!this.stroke.locked) { - this.stroke.locked = !0; - this.initCommand(); - this.doCommand(); - this.clearHandle(); - var b = this.canvas.width, a = this.canvas.height; - this.colorLayerData = this.ctx.getImageData(0, 0, b, a); - var c = new createjs.Point(this.stage.mouseX, this.stage.mouseY); - c.x = Math.round(c.x); - c.y = Math.round(c.y); - for (var d = 4 * (c.y * b + c.x), e = this.colorLayerData.data[d], f = this.colorLayerData.data[d + 1], g = this.colorLayerData.data[d + 2], h = this.colorLayerData.data[d + 3], k, l, c = [[c.x, c.y]], q = Entry.hex2rgb(this.stroke.lineColor);c.length;) { - for (var d = c.pop(), n = d[0], m = d[1], d = 4 * (m * b + n);0 <= m && this.matchColor(d, e, f, g, h);) { - --m, d -= 4 * b; + a.generateView = function() { + this.snap = Entry.SVG("hwMonitor"); + this._svgGroup = this.snap.elem("g"); + this._portMap = {n:[], e:[], s:[], w:[]}; + var b = this._hwModule.monitorTemplate, a = {href:Entry.mediaFilePath + b.imgPath, x:-b.width / 2, y:-b.height / 2, width:b.width, height:b.height}; + this._portViews = {}; + this.hwView = this._svgGroup.elem("image"); + this.hwView = this.hwView.attr(a); + this._template = b; + b = b.ports; + this.pathGroup = null; + this.pathGroup = this._svgGroup.elem("g"); + var a = [], d; + for (d in b) { + var e = this.generatePortView(b[d], "_svgGroup"); + this._portViews[d] = e; + a.push(e); + } + a.sort(function(b, a) { + return b.box.x - a.box.x; + }); + var f = this._portMap; + a.map(function(b) { + (1 > (Math.atan2(-b.box.y, b.box.x) / Math.PI + 2) % 2 ? f.n : f.s).push(b); + }); + this.resize(); + }; + a.toggleMode = function(b) { + var a = this._hwModule.monitorTemplate; + "list" == b ? (a.TempPort = null, this._hwModule.monitorTemplate.ports && (this._hwModule.monitorTemplate.TempPort = this._hwModule.monitorTemplate.ports, this._hwModule.monitorTemplate.listPorts = this.addPortEle(this._hwModule.monitorTemplate.listPorts, this._hwModule.monitorTemplate.ports)), $(this._svglistGroup).remove(), this._svgGroup && $(this._svgGroup).remove(), $(this._pathGroup).remove(), this._hwModule.monitorTemplate.mode = "list", this.generateListView()) : (this._hwModule.monitorTemplate.TempPort && + (this._hwModule.monitorTemplate.ports = this._hwModule.monitorTemplate.TempPort, this._hwModule.monitorTemplate.listPorts = this.removePortEle(this._hwModule.monitorTemplate.listPorts, this._hwModule.monitorTemplate.ports)), $(this._svglistGroup).remove(), this._hwModule.monitorTemplate.mode = "both", this.generateListView(), this.generateView()); + }; + a.setHwmonitor = function(b) { + this._hwmodule = b; + }; + a.changeMode = function(b) { + "both" == this._hwModule.monitorTemplate.mode ? this.toggleMode("list") : "list" == this._hwModule.monitorTemplate.mode && this.toggleMode("both"); + }; + a.addPortEle = function(b, a) { + if ("object" != typeof a) { + return b; + } + for (var d in a) { + b[d] = a[d]; + } + return b; + }; + a.removePortEle = function(b, a) { + if ("object" != typeof a) { + return b; + } + for (var d in a) { + delete b[d]; + } + return b; + }; + a.generateListView = function() { + this._portMapList = {n:[]}; + this._svglistGroup = null; + this.listsnap = Entry.SVG("hwMonitor"); + this._svglistGroup = this.listsnap.elem("g"); + var b = this._hwModule.monitorTemplate; + this._template = b; + b = b.listPorts; + this.pathGroup = this._svglistGroup.elem("g"); + var a = [], d; + for (d in b) { + var e = this.generatePortView(b[d], "_svglistGroup"); + this._listPortViews[d] = e; + a.push(e); + } + var f = this._portMapList; + a.map(function(b) { + f.n.push(b); + }); + this.resizeList(); + }; + a.generatePortView = function(b, a) { + a = this[a].elem("g"); + a.addClass("hwComponent"); + var d; + d = this.pathGroup.elem("path").attr({d:"m0,0", fill:"none", stroke:"input" === b.type ? "#00979d" : "#A751E3", "stroke-width":3}); + var e = a.elem("rect").attr({x:0, y:0, width:150, height:22, rx:4, ry:4, fill:"#fff", stroke:"#a0a1a1"}), f = a.elem("text").attr({x:4, y:12, fill:"#000", "class":"hwComponentName", "alignment-baseline":"central"}); + f.textContent = b.name; + f = f.getComputedTextLength(); + a.elem("rect").attr({x:f + 8, y:2, width:30, height:18, rx:9, ry:9, fill:"input" === b.type ? "#00979d" : "#A751E3"}); + var g = a.elem("text").attr({x:f + 13, y:12, fill:"#fff", "class":"hwComponentValue", "alignment-baseline":"central"}); + g.textContent = 0; + f += 40; + e.attr({width:f}); + return {group:a, value:g, type:b.type, path:d, box:{x:b.pos.x - this._template.width / 2, y:b.pos.y - this._template.height / 2, width:f}, width:f}; + }; + a.getView = function() { + return this.svgDom; + }; + a.update = function() { + var b = Entry.hw.portData, a = Entry.hw.sendQueue, d = this._hwModule.monitorTemplate.mode, e = this._hwModule.monitorTemplate.keys || [], f = []; + if ("list" == d) { + f = this._listPortViews; + } else { + if ("both" == d) { + if (f = this._listPortViews, this._portViews) { + for (var g in this._portViews) { + f[g] = this._portViews[g]; + } + } + } else { + f = this._portViews; } - d += 4 * b; - m += 1; - for (l = k = !1;m < a - 1 && this.matchColor(d, e, f, g, h);) { - m += 1, this.colorPixel(d, q.r, q.g, q.b), 0 < n && (this.matchColor(d - 4, e, f, g, h) ? k || (c.push([n - 1, m]), k = !0) : k && (k = !1)), n < b - 1 && (this.matchColor(d + 4, e, f, g, h) ? l || (c.push([n + 1, m]), l = !0) : l && (l = !1)), d += 4 * b; + } + if (a) { + for (g in a) { + 0 != a[g] && f[g] && (f[g].type = "output"); } - if (1080 < c.length) { - break; + } + for (var h in f) { + if (d = f[h], "input" == d.type) { + var k = b[h]; + 0 < e.length && $.each(e, function(b, a) { + if ($.isPlainObject(k)) { + k = k[a] || 0; + } else { + return !1; + } + }); + d.value.textContent = k ? k : 0; + d.group.getElementsByTagName("rect")[1].attr({fill:"#00979D"}); + } else { + k = a[h], 0 < e.length && $.each(e, function(b, a) { + if ($.isPlainObject(k)) { + k = k[a] || 0; + } else { + return !1; + } + }), d.value.textContent = k ? k : 0, d.group.getElementsByTagName("rect")[1].attr({fill:"#A751E3"}); } } - this.file.modified = !0; - this.reloadContext(); - } -}; -Entry.Painter.prototype.reloadContext = function() { - delete this.selectedObject; - this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height); - this.ctx.putImageData(this.colorLayerData, 0, 0); - var b = new Image; - b.src = this.canvas.toDataURL(); - var a = this; - b.onload = function(b) { - b = new createjs.Bitmap(b.target); - a.objectContainer.removeAllChildren(); - a.objectContainer.addChild(b); - a.stroke.locked = !1; }; + a.resize = function() { + this.hwView && this.hwView.attr({transform:"scale(" + this.scale + ")"}); + if (this.svgDom) { + var b = this.svgDom.get(0).getBoundingClientRect() + } + this._svgGroup.attr({transform:"translate(" + b.width / 2 + "," + b.height / 1.8 + ")"}); + this._rect = b; + 0 >= this._template.height || 0 >= b.height || (this.scale = b.height / this._template.height * this._template.height / 1E3, this.align()); + }; + a.resizeList = function() { + var b = this.svgDom.get(0).getBoundingClientRect(); + this._svglistGroup.attr({transform:"translate(" + b.width / 2 + "," + b.height / 2 + ")"}); + this._rect = b; + this.alignList(); + }; + a.align = function() { + var b; + b = this._portMap.s.concat(); + this._alignNS(b, this.scale / 3 * this._template.height + 5, 27); + b = this._portMap.n.concat(); + this._alignNS(b, -this._template.height * this.scale / 3 - 32, -27); + b = this._portMap.e.concat(); + this._alignEW(b, -this._template.width * this.scale / 3 - 5, -27); + b = this._portMap.w.concat(); + this._alignEW(b, this._template.width * this.scale / 3 - 32, -27); + }; + a.alignList = function() { + var b; + b = this._hwModule.monitorTemplate.listPorts; + for (var a = b.length, d = 0;d < b.length;d++) { + b[d].group.attr({transform:"translate(" + this._template.width * (d / a - .5) + "," + (-this._template.width / 2 - 30) + ")"}); + } + b = this._portMapList.n.concat(); + this._alignNSList(b, -this._template.width * this.scale / 2 - 32, -27); + }; + a._alignEW = function(b, a, d) { + var e = b.length, f = this._rect.height - 50; + tP = -f / 2; + bP = f / 2; + height = this._rect.height; + listVLine = wholeHeight = 0; + mode = this._hwModule.monitorTemplate; + for (f = 0;f < e;f++) { + wholeHeight += b[f].height + 5; + } + wholeHeight < bP - tP && (bP = wholeHeight / 2 + 3, tP = -wholeHeight / 2 - 3); + for (;1 < e;) { + var g = b.shift(), f = b.pop(), h = tP, k = bP, l = d; + wholeWidth <= bP - tP ? (tP += g.width + 5, bP -= f.width + 5, l = 0) : 0 === b.length ? (tP = (tP + bP) / 2 - 3, bP = tP + 6) : (tP = Math.max(tP, -width / 2 + g.width) + 15, bP = Math.min(bP, width / 2 - f.width) - 15); + wholeWidth -= g.width + f.width + 10; + a += l; + } + b.length && b[0].group.attr({transform:"translate(" + a + ",60)"}); + g && rPort && (this._movePort(g, a, tP, h), this._movePort(rPort, a, bP, k)); + }; + a._alignNS = function(b, a, d) { + for (var e = -this._rect.width / 2, f = this._rect.width / 2, g = this._rect.width, h = 0, k = 0;k < b.length;k++) { + h += b[k].width + 5; + } + h < f - e && (f = h / 2 + 3, e = -h / 2 - 3); + for (;1 < b.length;) { + var k = b.shift(), l = b.pop(), q = e, n = f, m = d; + h <= f - e ? (e += k.width + 5, f -= l.width + 5, m = 0) : 0 === b.length ? (e = (e + f) / 2 - 3, f = e + 6) : (e = Math.max(e, -g / 2 + k.width) + 15, f = Math.min(f, g / 2 - l.width) - 15); + this._movePort(k, e, a, q); + this._movePort(l, f, a, n); + h -= k.width + l.width + 10; + a += m; + } + b.length && this._movePort(b[0], (f + e - b[0].width) / 2, a, 100); + }; + a._alignNSList = function(b, a) { + a = this._rect.width; + initX = -this._rect.width / 2 + 10; + initY = -this._rect.height / 2 + 10; + for (var d = listLine = wholeWidth = 0;d < b.length;d++) { + wholeWidth += b[d].width; + } + for (var e = 0, f = 0, g = initX, h, k, l = 0, d = 0;d < b.length;d++) { + k = b[d], d != b.length - 1 && (l = b[d + 1]), f += k.width, lP = initX, h = initY + 30 * e, k.group.attr({transform:"translate(" + lP + "," + h + ")"}), initX += k.width + 10, f > a - (k.width + l.width / 2.2) && (e += 1, initX = g, f = 0); + } + }; + a._movePort = function(b, a, d, e) { + var f = a, g = b.box.x * this.scale, h = b.box.y * this.scale; + a > e ? (f = a - b.width, a = a > g && g > e ? "M" + g + "," + d + "L" + g + "," + h : "M" + (a + e) / 2 + "," + d + "l0," + (h > d ? 28 : -3) + "H" + g + "L" + g + "," + h) : a = a < g && g < e ? "m" + g + "," + d + "L" + g + "," + h : "m" + (e + a) / 2 + "," + d + "l0," + (h > d ? 28 : -3) + "H" + g + "L" + g + "," + h; + b.group.attr({transform:"translate(" + f + "," + d + ")"}); + b.path.attr({d:a}); + }; +})(Entry.HWMonitor.prototype); +Entry.HW = function() { + this.connectTrial = 0; + this.isFirstConnect = !0; + this.initSocket(); + this.connected = !1; + this.portData = {}; + this.sendQueue = {}; + this.outputQueue = {}; + this.settingQueue = {}; + this.socketType = this.hwModule = this.selectedDevice = null; + Entry.addEventListener("stop", this.setZero); + this.hwInfo = {11:Entry.Arduino, 19:Entry.ArduinoExt, 12:Entry.SensorBoard, 13:Entry.CODEino, 14:Entry.joystick, 15:Entry.dplay, 16:Entry.nemoino, 17:Entry.Xbot, 18:Entry.ardublock, 110:Entry.Cobl, 24:Entry.Hamster, 25:Entry.Albert, 31:Entry.Bitbrick, 42:Entry.Arduino, 51:Entry.Neobot, 71:Entry.Robotis_carCont, 72:Entry.Robotis_openCM70, 81:Entry.Arduino}; }; -Entry.Painter.prototype.move_pen = function() { - var b = new createjs.Point(this.oldPt.x + this.stage.mouseX >> 1, this.oldPt.y + this.stage.mouseY >> 1); - this.brush.graphics.setStrokeStyle(this.stroke.thickness, "round").beginStroke(this.stroke.lineColor).moveTo(b.x, b.y).curveTo(this.oldPt.x, this.oldPt.y, this.oldMidPt.x, this.oldMidPt.y); - this.oldPt.x = this.stage.mouseX; - this.oldPt.y = this.stage.mouseY; - this.oldMidPt.x = b.x; - this.oldMidPt.y = b.y; - this.file.modified = !0; - this.stage.update(); +Entry.HW.TRIAL_LIMIT = 1; +p = Entry.HW.prototype; +p.initSocket = function() { + try { + if (this.connectTrial >= Entry.HW.TRIAL_LIMIT) { + this.isFirstConnect || Entry.toast.alert(Lang.Menus.connect_hw, Lang.Menus.connect_fail, !1), this.isFirstConnect = !1; + } else { + var a = this, b, c; + this.connected = !1; + this.connectTrial++; + if (-1 < location.protocol.indexOf("https")) { + c = new WebSocket("wss://hardware.play-entry.org:23518"); + } else { + try { + b = new WebSocket("ws://127.0.0.1:23518"), b.binaryType = "arraybuffer", b.onopen = function() { + a.socketType = "WebSocket"; + a.initHardware(b); + }.bind(this), b.onmessage = function(b) { + b = JSON.parse(b.data); + a.checkDevice(b); + a.updatePortData(b); + }.bind(this), b.onclose = function() { + "WebSocket" === a.socketType && (this.socket = null, a.initSocket()); + }; + } catch (d) { + } + try { + c = new WebSocket("wss://hardware.play-entry.org:23518"); + } catch (d) { + } + } + c.binaryType = "arraybuffer"; + c.onopen = function() { + a.socketType = "WebSocketSecurity"; + a.initHardware(c); + }; + c.onmessage = function(b) { + b = JSON.parse(b.data); + a.checkDevice(b); + a.updatePortData(b); + }; + c.onclose = function() { + "WebSocketSecurity" === a.socketType && (this.socket = null, a.initSocket()); + }; + Entry.dispatchEvent("hwChanged"); + } + } catch (d) { + } }; -Entry.Painter.prototype.move_line = function() { - this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness, "round").moveTo(this.oldPt.x, this.oldPt.y).lineTo(this.stage.mouseX, this.stage.mouseY); - this.file.modified = !0; - this.stage.update(); +p.retryConnect = function() { + this.connectTrial = 0; + this.initSocket(); }; -Entry.Painter.prototype.move_rect = function() { - var b = this.stage.mouseX - this.oldPt.x, a = this.stage.mouseY - this.oldPt.y; - event.shiftKey && (a = b); - this.stroke.fill ? 0 === this.stroke.thickness ? this.brush.graphics.clear().setStrokeStyle(this.stroke.thickness, "round").beginFill(this.stroke.fillColor).drawRect(this.oldPt.x, this.oldPt.y, b, a) : this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness, "round").beginFill(this.stroke.fillColor).drawRect(this.oldPt.x, this.oldPt.y, b, a) : 0 === this.stroke.thickness ? this.brush.graphics.clear().setStrokeStyle(this.stroke.thickness, "round").drawRect(this.oldPt.x, - this.oldPt.y, b, a) : this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness, "round").drawRect(this.oldPt.x, this.oldPt.y, b, a); - this.file.modified = !0; - this.stage.update(); +p.initHardware = function(a) { + this.socket = a; + this.connectTrial = 0; + this.connected = !0; + Entry.dispatchEvent("hwChanged"); + Entry.playground && Entry.playground.object && Entry.playground.setMenu(Entry.playground.object.objectType); }; -Entry.Painter.prototype.move_circle = function() { - var b = this.stage.mouseX - this.oldPt.x, a = this.stage.mouseY - this.oldPt.y; - event.shiftKey && (a = b); - this.stroke.fill ? 0 === this.stroke.thickness ? this.brush.graphics.clear().beginStroke(this.stroke.fillColor).setStrokeStyle(this.stroke.thickness, "round").beginFill(this.stroke.fillColor).drawEllipse(this.oldPt.x, this.oldPt.y, b, a) : this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness, "round").beginFill(this.stroke.fillColor).drawEllipse(this.oldPt.x, this.oldPt.y, b, a) : this.stroke.fill || (0 === this.stroke.thickness ? this.brush.graphics.clear().drawEllipse(this.oldPt.x, - this.oldPt.y, b, a) : this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness, "round").drawEllipse(this.oldPt.x, this.oldPt.y, b, a)); - this.file.modified = !0; - this.stage.update(); +p.setDigitalPortValue = function(a, b) { + this.sendQueue[a] = b; + this.removePortReadable(a); }; -Entry.Painter.prototype.edit_copy = function() { - this.selectArea ? (this.clearHandle(), this.selectedObject && delete this.selectedObject, this.copyLayerData = this.ctx.getImageData(this.selectArea.x1, this.selectArea.y1, this.selectArea.x2, this.selectArea.y2), this.copy = {}, this.copy.width = this.selectArea.x2, this.copy.height = this.selectArea.y2, this.canvas_.width = this.copy.width, this.canvas_.height = this.copy.height, this.ctx_.clearRect(0, 0, this.canvas_.width, this.canvas_.height), this.ctx_.putImageData(this.copyLayerData, 0, - 0)) : alert("\ubcf5\uc0ac\ud560 \uc601\uc5ed\uc744 \uc120\ud0dd\ud558\uc138\uc694."); +p.getAnalogPortValue = function(a) { + return this.connected ? this.portData["a" + a] : 0; }; -Entry.Painter.prototype.edit_cut = function() { - this.selectArea ? (this.clearHandle(), this.selectedObject && delete this.selectedObject, this.copyLayerData = this.ctx.getImageData(this.selectArea.x1, this.selectArea.y1, this.selectArea.x2, this.selectArea.y2), this.copy = {}, this.copy.width = this.selectArea.x2, this.copy.height = this.selectArea.y2, this.canvas_.width = this.copy.width, this.canvas_.height = this.copy.height, this.ctx_.clearRect(0, 0, this.canvas_.width, this.canvas_.height), this.ctx_.putImageData(this.copyLayerData, 0, - 0), this.ctx.clearRect(this.selectArea.x1, this.selectArea.y1, this.selectArea.x2, this.selectArea.y2), this.colorLayerData = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height), this.reloadContext(), this.file.modified = !0) : alert("\uc790\ub97c \uc601\uc5ed\uc744 \uc120\ud0dd\ud558\uc138\uc694."); +p.getDigitalPortValue = function(a) { + if (!this.connected) { + return 0; + } + this.setPortReadable(a); + return void 0 !== this.portData[a] ? this.portData[a] : 0; }; -Entry.Painter.prototype.edit_paste = function() { - var b = new Image; - b.src = this.canvas_.toDataURL(); - var a = this; - b.onload = function(b) { - b = new createjs.Bitmap(b.target); - b.x = a.canvas.width / 2; - b.y = a.canvas.height / 2; - b.regX = a.copy.width / 2 | 0; - b.regY = a.copy.height / 2 | 0; - b.id = Entry.generateHash(); - a.objectContainer.addChild(b); - a.selectObject(b, !0); - }; - this.file.modified = !0; +p.setPortReadable = function(a) { + this.sendQueue.readablePorts || (this.sendQueue.readablePorts = []); + var b = !1, c; + for (c in this.sendQueue.readablePorts) { + if (this.sendQueue.readablePorts[c] == a) { + b = !0; + break; + } + } + b || this.sendQueue.readablePorts.push(a); }; -Entry.Painter.prototype.edit_select = function() { - this.clearHandle(); - this.selectedObject && delete this.selectedObject; - this.copyLayerData = this.ctx.getImageData(this.selectArea.x1, this.selectArea.y1, this.selectArea.x2, this.selectArea.y2); - this.copy = {}; - this.copy.width = this.selectArea.x2; - this.copy.height = this.selectArea.y2; - this.canvas_.width = this.copy.width; - this.canvas_.height = this.copy.height; - this.ctx_.clearRect(0, 0, this.canvas_.width, this.canvas_.height); - this.ctx_.putImageData(this.copyLayerData, 0, 0); - this.ctx.clearRect(this.selectArea.x1, this.selectArea.y1, this.selectArea.x2, this.selectArea.y2); - this.colorLayerData = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height); - this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height); - this.ctx.putImageData(this.colorLayerData, 0, 0); - var b = new Image; - b.src = this.canvas.toDataURL(); - var a = this; - b.onload = function(b) { - b = new createjs.Bitmap(b.target); - a.objectContainer.removeAllChildren(); - a.objectContainer.addChild(b); - b = new Image; - b.src = a.canvas_.toDataURL(); - b.onload = function(b) { - b = new createjs.Bitmap(b.target); - b.x = a.selectArea.x1 + a.copy.width / 2; - b.y = a.selectArea.y1 + a.copy.height / 2; - b.regX = a.copy.width / 2 | 0; - b.regY = a.copy.height / 2 | 0; - b.id = Entry.generateHash(); - b.name = b.id; - a.objectContainer.addChild(b); - a.selectObject(b, !0); - }; - }; +p.removePortReadable = function(a) { + if (this.sendQueue.readablePorts || Array.isArray(this.sendQueue.readablePorts)) { + var b, c; + for (c in this.sendQueue.readablePorts) { + if (this.sendQueue.readablePorts[c] == a) { + b = Number(c); + break; + } + } + this.sendQueue.readablePorts = void 0 != b ? this.sendQueue.readablePorts.slice(0, b).concat(this.sendQueue.readablePorts.slice(b + 1, this.sendQueue.readablePorts.length)) : []; + } }; -Entry.Painter.prototype.move_erase = function(b) { - b = new createjs.Point(this.oldPt.x + this.stage.mouseX >> 1, this.oldPt.y + this.stage.mouseY >> 1); - this.eraser.graphics.setStrokeStyle(this.stroke.thickness, "round").beginStroke("#ffffff").moveTo(b.x, b.y).curveTo(this.oldPt.x, this.oldPt.y, this.oldMidPt.x, this.oldMidPt.y); - this.oldPt.x = this.stage.mouseX; - this.oldPt.y = this.stage.mouseY; - this.oldMidPt.x = b.x; - this.oldMidPt.y = b.y; - this.file.modified = !0; - this.stage.update(); +p.update = function() { + this.socket && 1 == this.socket.readyState && this.socket.send(JSON.stringify(this.sendQueue)); }; -Entry.Painter.prototype.settingShapeBlur = function() { - this.objectWidthInput.blur(); - this.objectHeightInput.blur(); - this.objectRotateInput.blur(); +p.updatePortData = function(a) { + this.portData = a; + this.hwMonitor && "hw" == Entry.propertyPanel.selected && this.hwMonitor.update(); }; -Entry.Painter.prototype.stagemousedown = function(b) { - "picture" == Entry.playground.getViewMode() && (this.settingShapeBlur(), this.oldPt = new createjs.Point(b.stageX, b.stageY), this.oldMidPt = this.oldPt.clone(), "select" === this.toolbox.selected ? this.stage.addChild(this._handle) : "spoid" === this.toolbox.selected ? this.pickStrokeColor(b) : "text" === this.toolbox.selected ? (this.showInputField(b), this.stage.update()) : "erase" === this.toolbox.selected ? (this.createEraser(), this.stroke.enabled = !0) : "fill" === this.toolbox.selected ? - this.fill() : "cursor" !== this.toolbox.selected && (this.createBrush(), this.stroke.enabled = !0)); +p.closeConnection = function() { + this.socket && this.socket.close(); }; -Entry.Painter.prototype.stagemousemove = function(b) { - "picture" == Entry.playground.getViewMode() && ("select" === this.toolbox.selected && -1 < this.stage.getChildIndex(this._handle) ? (this.selectArea.x1 = this.oldPt.x, this.selectArea.y1 = this.oldPt.y, this.selectArea.x2 = b.stageX - this.oldPt.x, this.selectArea.y2 = b.stageY - this.oldPt.y, this.updateHandle_()) : this.stroke.enabled && (this.doCommand(), "pen" === this.toolbox.selected ? this.move_pen(b) : "line" === this.toolbox.selected ? this.move_line(b) : "rect" === this.toolbox.selected ? - this.move_rect(b) : "circle" === this.toolbox.selected ? this.move_circle(b) : "erase" === this.toolbox.selected && this.move_erase(b)), this.painterTopStageXY.innerHTML = "x:" + b.stageX.toFixed(1) + ", y:" + b.stageY.toFixed(1)); +p.downloadConnector = function() { + window.open("http://download.play-entry.org/apps/Entry_HW_1.5.8_Setup.exe", "_blank").focus(); }; -Entry.Painter.prototype.stagemouseup = function(b) { - "picture" == Entry.playground.getViewMode() && ("select" === this.toolbox.selected ? (this.selectArea.x1 = this.oldPt.x, this.selectArea.y1 = this.oldPt.y, this.selectArea.x2 = b.stageX - this.oldPt.x, this.selectArea.y2 = b.stageY - this.oldPt.y, this.stage.removeChild(this._handle), this.stage.update(), 0 < this.selectArea.x2 && 0 < this.selectArea.y2 && this.edit_select(), this.selectToolbox("cursor")) : "cursor" !== this.toolbox.selected && this.stroke.enabled && (-1 < this.objectContainer.getChildIndex(this.eraser) && - this.eraser.graphics.endStroke(), -1 < this.objectContainer.getChildIndex(this.brush) && this.brush.graphics.endStroke(), this.clearHandle(), this.platten(), this.stroke.enabled = !1, this.checkCommand())); +p.downloadSource = function() { + window.open("http://play-entry.com/down/board.ino", "_blank").focus(); }; -Entry.Painter.prototype.file_save = function(b) { - this.clearHandle(); - this.transparent(); - this.trim(); - var a = this.canvas_.toDataURL(); - Entry.dispatchEvent("saveCanvasImage", {file:b ? this.file_ : this.file, image:a}); - this.file.modified = !1; +p.setZero = function() { + Entry.hw.hwModule && Entry.hw.hwModule.setZero(); }; -Entry.Painter.prototype.transparent = function() { - var b = this.canvas.width, a = this.canvas.height; - this.colorLayerData = this.ctx.getImageData(0, 0, b, a); - var c = b * (a - 1) * 4, d = 4 * (b - 1), e = 4 * (b * a - 1); - this.matchColorOnly(0, 255, 255, 255) ? this.fillTransparent(1, 1) : this.matchColorOnly(c, 255, 255, 255) ? this.fillTransparent(1, a) : this.matchColorOnly(d, 255, 255, 255) ? this.fillTransparent(b, 1) : this.matchColorOnly(e, 255, 255, 255) && this.fillTransparent(b, a); -}; -Entry.Painter.prototype.fillTransparent = function(b, a) { - this.stage.mouseX = b; - this.stage.mouseY = a; - this.stroke.transparent = !0; - this.fill(); +p.checkDevice = function(a) { + void 0 !== a.company && (a = "" + a.company + a.model, a != this.selectedDevice && (this.selectedDevice = a, this.hwModule = this.hwInfo[a], 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), a = this.hwModule.monitorTemplate, "both" == a.mode ? (a.mode = "list", this.hwMonitor.generateListView(), a.mode = "general", this.hwMonitor.generateView(), a.mode = "both") : "list" == a.mode ? this.hwMonitor.generateListView() : this.hwMonitor.generateView()))); }; -Entry.Painter.prototype.trim = function() { - var b = this.canvas.width, a = this.ctx.getImageData(0, 0, b, this.canvas.height), c = a.data.length, d, e = null, f = null, g = null, h = null, k; - for (d = 0;d < c;d += 4) { - 0 !== a.data[d + 3] && (g = d / 4 % b, k = ~~(d / 4 / b), null === e && (e = k), null === f ? f = g : g < f && (f = g), null === h ? h = k : h < k && (h = k)); +p.banHW = function() { + var a = this.hwInfo, b; + for (b in a) { + Entry.playground.mainWorkspace.blockMenu.banClass(a[b].name, !0); } - b = h - e; - a = g - f; - c = null; - 0 === b || 0 === a ? (c = this.ctx.getImageData(0, 0, 1, 1), c.data[0] = 255, c.data[1] = 255, c.data[2] = 255, c.data[3] = 255, this.canvas_.width = 1, this.canvas_.height = 1) : (c = this.ctx.getImageData(f, e, a, b), this.canvas_.width = a, this.canvas_.height = b); - this.ctx_.putImageData(c, 0, 0); }; -Entry.Painter.prototype.showInputField = function(b) { - this.inputField ? (Entry.dispatchEvent("textUpdate"), delete this.inputField) : (this.initCommand(), this.doCommand(), this.inputField = new CanvasInput({canvas:document.getElementById("entryPainterCanvas"), fontSize:20, fontFamily:this.font.name, fontColor:"#000", width:650, padding:8, borderWidth:1, borderColor:"#000", borderRadius:3, boxShadow:"1px 1px 0px #fff", innerShadow:"0px 0px 5px rgba(0, 0, 0, 0.5)", x:b.stageX, y:b.stageY, onsubmit:function() { - Entry.dispatchEvent("textUpdate"); - }}), this.inputField.show()); +Entry.PropertyPanel = function() { + this.modes = {}; + this.selected = null; }; -Entry.Painter.prototype.addPicture = function(b) { - this.initCommand(); - var a = new Image; - a.id = Entry.generateHash(); - a.src = b.fileurl ? b.fileurl : Entry.defaultPath + "/uploads/" + b.filename.substring(0, 2) + "/" + b.filename.substring(2, 4) + "/image/" + b.filename + ".png"; - var c = this; - a.onload = function(a) { - c.addImage(a.target); - c.selectToolbox("cursor"); +(function(a) { + a.generateView = function(b, a) { + this._view = Entry.Dom("div", {class:"propertyPanel", parent:$(b)}); + this._tabView = Entry.Dom("div", {class:"propertyTab", parent:this._view}); + this._contentView = Entry.Dom("div", {class:"propertyContent", parent:this._view}); + this._cover = Entry.Dom("div", {classes:["propertyPanelCover", "entryRemove"], parent:this._view}); + b = Entry.Dom("div", {class:"entryObjectSelectedImgWorkspace", parent:this._view}); + this.initializeSplitter(b); + }; + a.addMode = function(b, a) { + var d = a.getView(), d = Entry.Dom(d, {parent:this._contentView}), e = Entry.Dom("
" + Lang.Menus[b] + "
", {classes:["propertyTabElement", "propertyTab" + b], parent:this._tabView}), f = this; + e.bind("click", function() { + f.select(b); + }); + this.modes[b] && (this.modes[b].tabDom.remove(), this.modes[b].contentDom.remove(), "hw" == b && ($(this.modes).removeClass(".propertyTabhw"), $(".propertyTabhw").unbind("dblclick"))); + this.modes[b] = {obj:a, tabDom:e, contentDom:d}; + "hw" == b && $(".propertyTabhw").bind("dblclick", function() { + Entry.dispatchEvent("hwModeChange"); + }); + }; + a.resize = function(b) { + this._view.css({width:b + "px", top:9 * b / 16 + 123 - 22 + "px"}); + 430 <= b ? this._view.removeClass("collapsed") : this._view.addClass("collapsed"); + Entry.dispatchEvent("windowResized"); + b = this.selected; + "hw" == b ? this.modes.hw.obj.listPorts ? this.modes[b].obj.resizeList() : this.modes[b].obj.resize() : this.modes[b].obj.resize(); + }; + a.select = function(b) { + for (var a in this.modes) { + var d = this.modes[a]; + d.tabDom.removeClass("selected"); + d.contentDom.addClass("entryRemove"); + d.obj.visible = !1; + } + a = this.modes[b]; + a.tabDom.addClass("selected"); + a.contentDom.removeClass("entryRemove"); + a.obj.resize && a.obj.resize(); + a.obj.visible = !0; + this.selected = b; + }; + a.initializeSplitter = function(b) { + var a = this; + b.bind("mousedown touchstart", function(b) { + a._cover.removeClass("entryRemove"); + Entry.container.disableSort(); + Entry.container.splitterEnable = !0; + Entry.documentMousemove && (Entry.container.resizeEvent = Entry.documentMousemove.attach(this, function(b) { + Entry.container.splitterEnable && Entry.resizeElement({canvasWidth:b.clientX || b.x}); + })); + }); + $(document).bind("mouseup touchend", function(b) { + if (b = Entry.container.resizeEvent) { + Entry.container.splitterEnable = !1, Entry.documentMousemove.detach(b), a._cover.addClass("entryRemove"), delete Entry.container.resizeEvent; + } + Entry.container.enableSort(); + }); + }; +})(Entry.PropertyPanel.prototype); +Entry.init = function(a, b) { + Entry.assert("object" === typeof b, "Init option is not object"); + this.events_ = {}; + this.interfaceState = {menuWidth:264}; + Entry.Utils.bindGlobalEvent("resize mousedown mousemove keydown keyup dispose".split(" ")); + this.options = b; + this.parseOptions(b); + this.mediaFilePath = (b.libDir ? b.libDir : "/lib") + "/entryjs/images/"; + this.defaultPath = b.defaultDir || ""; + this.blockInjectPath = b.blockInjectDir || ""; + "workspace" == this.type && this.isPhone() && (this.type = "phone"); + this.initialize_(); + this.view_ = a; + this.view_.setAttribute("class", "entry"); + Entry.initFonts(b.fonts); + this.createDom(a, this.type); + this.loadInterfaceState(); + this.overridePrototype(); + this.maxCloneLimit = 302; + this.cloudSavable = !0; + this.startTime = (new Date).getTime(); + document.onkeydown = function(b) { + Entry.dispatchEvent("keyPressed", b); }; + document.onkeyup = function(b) { + Entry.dispatchEvent("keyUpped", b); + }; + window.onresize = function(b) { + Entry.dispatchEvent("windowResized", b); + }; + window.onbeforeunload = this.beforeUnload; + Entry.addEventListener("saveWorkspace", function(b) { + Entry.addActivity("save"); + }); + "IE" != Entry.getBrowserType().substr(0, 2) || window.flashaudio ? createjs.Sound.registerPlugins([createjs.WebAudioPlugin]) : (createjs.FlashAudioPlugin.swfPath = this.mediaFilePath + "media/", createjs.Sound.registerPlugins([createjs.FlashAudioPlugin]), window.flashaudio = !0); + Entry.soundQueue = new createjs.LoadQueue; + Entry.soundQueue.installPlugin(createjs.Sound); + Entry.loadAudio_([Entry.mediaFilePath + "sounds/click.mp3", Entry.mediaFilePath + "sounds/click.wav", Entry.mediaFilePath + "sounds/click.ogg"], "entryMagneting"); + Entry.loadAudio_([Entry.mediaFilePath + "sounds/delete.mp3", Entry.mediaFilePath + "sounds/delete.ogg", Entry.mediaFilePath + "sounds/delete.wav"], "entryDelete"); + createjs.Sound.stop(); }; -Entry.Painter.prototype.initCoordinator = function() { - var b = new createjs.Container, a = new createjs.Bitmap(Entry.mediaFilePath + "/workspace_coordinate.png"); - b.addChild(a); - this.stage.addChild(b); - b.visible = !1; - this.coordinator = b; +Entry.loadAudio_ = function(a, b) { + if (window.Audio && a.length) { + for (;0 < a.length;) { + a = a[0]; + a.match(/\/([^.]+)./); + Entry.soundQueue.loadFile({id:b, src:a, type:createjs.LoadQueue.SOUND}); + break; + } + } }; -Entry.Painter.prototype.toggleCoordinator = function() { - this.coordinator.visible = !this.coordinator.visible; - this.stage.update(); +Entry.initialize_ = function() { + this.stage = new Entry.Stage; + Entry.engine && Entry.engine.clearTimer(); + this.engine = new Entry.Engine; + this.propertyPanel = new Entry.PropertyPanel; + this.container = new Entry.Container; + this.helper = new Entry.Helper; + this.youtube = new Entry.Youtube; + this.variableContainer = new Entry.VariableContainer; + this.commander = new Entry.Commander(this.type); + this.scene = new Entry.Scene; + this.playground = new Entry.Playground; + this.toast = new Entry.Toast; + this.hw && this.hw.closeConnection(); + this.hw = new Entry.HW; + if (Entry.enableActivityLogging) { + this.reporter = new Entry.Reporter(!1); + } else { + if ("workspace" == this.type || "phone" == this.type) { + this.reporter = new Entry.Reporter(!0); + } + } }; -Entry.Painter.prototype.initDashedLine = function() { - createjs.Graphics.prototype.dashedLineTo = function(b, a, c, d, e) { - this.moveTo(b, a); - var f = c - b, g = d - a; - e = Math.floor(Math.sqrt(f * f + g * g) / e); - for (var f = f / e, g = g / e, h = 0;h++ < e;) { - b += f, a += g, this[0 === h % 2 ? "moveTo" : "lineTo"](b, a); +Entry.createDom = function(a, b) { + if (b && "workspace" != b) { + "minimize" == b ? (c = Entry.createElement("canvas"), c.className = "entryCanvasWorkspace", c.id = "entryCanvas", c.width = 640, c.height = 360, d = Entry.createElement("div", "entryCanvasWrapper"), d.appendChild(c), a.appendChild(d), this.canvas_ = c, this.stage.initStage(this.canvas_), d = Entry.createElement("div"), a.appendChild(d), this.engineView = d, this.engine.generateView(this.engineView, b)) : "phone" == b && (this.stateManagerView = c = Entry.createElement("div"), this.stateManager.generateView(this.stateManagerView, + b), d = Entry.createElement("div"), a.appendChild(d), this.engineView = d, this.engine.generateView(this.engineView, b), c = Entry.createElement("canvas"), c.addClass("entryCanvasPhone"), c.id = "entryCanvas", c.width = 640, c.height = 360, d.insertBefore(c, this.engine.footerView_), this.canvas_ = c, this.stage.initStage(this.canvas_), c = Entry.createElement("div"), a.appendChild(c), this.containerView = c, this.container.generateView(this.containerView, b), c = Entry.createElement("div"), + a.appendChild(c), this.playgroundView = c, this.playground.generateView(this.playgroundView, b)); + } else { + Entry.documentMousedown.attach(this, this.cancelObjectEdit); + var c = Entry.createElement("div"); + a.appendChild(c); + this.sceneView = c; + this.scene.generateView(this.sceneView, b); + c = Entry.createElement("div"); + this.sceneView.appendChild(c); + this.stateManagerView = c; + this.stateManager.generateView(this.stateManagerView, b); + var d = Entry.createElement("div"); + a.appendChild(d); + this.engineView = d; + this.engine.generateView(this.engineView, b); + c = Entry.createElement("canvas"); + c.addClass("entryCanvasWorkspace"); + c.id = "entryCanvas"; + c.width = 640; + c.height = 360; + d.insertBefore(c, this.engine.addButton); + c.addEventListener("mousewheel", function(b) { + var a = Entry.variableContainer.getListById(Entry.stage.mouseCoordinate); + b = 0 < b.wheelDelta ? !0 : !1; + for (var c = 0;c < a.length;c++) { + var d = a[c]; + d.scrollButton_.y = b ? 46 <= d.scrollButton_.y ? d.scrollButton_.y - 23 : 23 : d.scrollButton_.y + 23; + d.updateView(); + } + }); + this.canvas_ = c; + this.stage.initStage(this.canvas_); + c = Entry.createElement("div"); + this.propertyPanel.generateView(a, b); + this.containerView = c; + this.container.generateView(this.containerView, b); + this.propertyPanel.addMode("object", this.container); + this.helper.generateView(this.containerView, b); + this.propertyPanel.addMode("helper", this.helper); + c = Entry.createElement("div"); + a.appendChild(c); + this.playgroundView = c; + this.playground.generateView(this.playgroundView, b); + this.propertyPanel.select("object"); + this.helper.bindWorkspace(this.playground.mainWorkspace); + } +}; +Entry.start = function(a) { + this.FPS || (this.FPS = 60); + Entry.assert("number" == typeof this.FPS, "FPS must be number"); + Entry.engine.start(this.FPS); +}; +Entry.parseOptions = function(a) { + this.type = a.type; + this.projectSaveable = a.projectsaveable; + void 0 === this.projectSaveable && (this.projectSaveable = !0); + this.objectAddable = a.objectaddable; + void 0 === this.objectAddable && (this.objectAddable = !0); + this.objectEditable = a.objectEditable; + void 0 === this.objectEditable && (this.objectEditable = !0); + this.objectEditable || (this.objectAddable = !1); + this.objectDeletable = a.objectdeletable; + void 0 === this.objectDeletable && (this.objectDeletable = !0); + this.soundEditable = a.soundeditable; + void 0 === this.soundEditable && (this.soundEditable = !0); + this.pictureEditable = a.pictureeditable; + void 0 === this.pictureEditable && (this.pictureEditable = !0); + this.sceneEditable = a.sceneEditable; + void 0 === this.sceneEditable && (this.sceneEditable = !0); + this.functionEnable = a.functionEnable; + void 0 === this.functionEnable && (this.functionEnable = !0); + this.messageEnable = a.messageEnable; + void 0 === this.messageEnable && (this.messageEnable = !0); + this.variableEnable = a.variableEnable; + void 0 === this.variableEnable && (this.variableEnable = !0); + this.listEnable = a.listEnable; + void 0 === this.listEnable && (this.listEnable = !0); + this.hasVariableManager = a.hasvariablemanager; + this.variableEnable || this.messageEnable || this.listEnable || this.functionEnable ? void 0 === this.hasVariableManager && (this.hasVariableManager = !0) : this.hasVariableManager = !1; + this.isForLecture = a.isForLecture; +}; +Entry.initFonts = function(a) { + this.fonts = a; + a || (this.fonts = []); +}; +Entry.Activity = function(a, b) { + this.name = a; + this.timestamp = new Date; + a = []; + if (void 0 !== b) { + for (var c = 0, d = b.length;c < d;c++) { + var e = b[c]; + a.push({key:e[0], value:e[1]}); + } + } + this.data = a; +}; +Entry.ActivityReporter = function() { + this._activities = []; +}; +(function(a) { + a.add = function(b) { + if (b && 0 !== b.length) { + if (!(b instanceof Entry.Activity)) { + var a = b.shift(); + b = new Entry.Activity(a, b); + } + this._activities.push(b); } - this[0 === h % 2 ? "moveTo" : "lineTo"](c, d); - return this; }; - createjs.Graphics.prototype.drawDashedRect = function(b, a, c, d, e) { - this.moveTo(b, a); - c = b + c; - d = a + d; - this.dashedLineTo(b, a, c, a, e); - this.dashedLineTo(c, a, c, d, e); - this.dashedLineTo(c, d, b, d, e); - this.dashedLineTo(b, d, b, a, e); - return this; + a.clear = function() { + this._activities = []; }; - createjs.Graphics.prototype.drawResizableDashedRect = function(b, a, c, d, e, f) { - this.moveTo(b, a); - c = b + c; - d = a + d; - this.dashedLineTo(b + f, a, c - f, a, e); - this.dashedLineTo(c, a + f, c, d - f, e); - this.dashedLineTo(c - f, d, b + f, d, e); - this.dashedLineTo(b, d - f, b, a + f, e); - return this; + a.get = function() { + return this._activities; + }; + a.report = function() { }; +})(Entry.ActivityReporter.prototype); +Entry.State = function(a, b, c, d) { + this.caller = b; + this.func = c; + 3 < arguments.length && (this.params = Array.prototype.slice.call(arguments).slice(3)); + this.message = a; + this.time = Entry.getUpTime(); + this.isPass = Entry.Command[a] ? Entry.Command[a].isPass : !1; }; -Entry.Painter.prototype.generateView = function(b) { - var a = this; - this.view_ = b; - if (!Entry.type || "workspace" == Entry.type) { - this.view_.addClass("entryPainterWorkspace"); - var c = Entry.createElement("div", "entryPainterTop"); - c.addClass("entryPlaygroundPainterTop"); - this.view_.appendChild(c); - var d = Entry.createElement("div", "entryPainterToolbox"); - d.addClass("entryPlaygroundPainterToolbox"); - this.view_.appendChild(d); - var e = Entry.createElement("div", "entryPainterToolboxTop"); - e.addClass("entryPainterToolboxTop"); - d.appendChild(e); - var f = Entry.createElement("div", "entryPainterContainer"); - f.addClass("entryPlaygroundPainterContainer"); - this.view_.appendChild(f); - e = Entry.createElement("canvas", "entryPainterCanvas"); - e.width = 960; - e.height = 540; - e.addClass("entryPlaygroundPainterCanvas"); - f.appendChild(e); - e = Entry.createElement("canvas", "entryPainterCanvas_"); - e.addClass("entryRemove"); - e.width = 960; - e.height = 540; - f.appendChild(e); - var g = Entry.createElement("div", "entryPainterAttr"); - g.addClass("entryPlaygroundPainterAttr"); - this.view_.appendChild(g); - this.flipObject = Entry.createElement("div", "entryPictureFlip"); - this.flipObject.addClass("entryPlaygroundPainterFlip"); - g.appendChild(this.flipObject); - e = Entry.createElement("div", "entryPictureFlipX"); - e.title = "\uc88c\uc6b0\ub4a4\uc9d1\uae30"; - e.bindOnClick(function() { - a.selectedObject && (a.selectedObject.scaleX *= -1, a.selectedObject.text ? a.selectTextObject(a.selectedObject) : a.selectObject(a.selectedObject), a.updateImageHandle(), a.stage.update()); - }); - e.addClass("entryPlaygroundPainterFlipX"); - this.flipObject.appendChild(e); - e = Entry.createElement("div", "entryPictureFlipY"); - e.title = "\uc0c1\ud558\ub4a4\uc9d1\uae30"; - e.bindOnClick(function() { - a.selectedObject && (a.selectedObject.scaleY *= -1, a.selectedObject.text ? a.selectTextObject(a.selectedObject) : a.selectObject(a.selectedObject), a.updateImageHandle(), a.stage.update()); +Entry.State.prototype.generateMessage = function() { +}; +Entry.StateManager = function() { + this.undoStack_ = []; + this.redoStack_ = []; + this.isIgnore = this.isRestore = !1; + Entry.addEventListener("cancelLastCommand", function(a) { + Entry.stateManager.cancelLastCommand(); + }); + Entry.addEventListener("run", function(a) { + Entry.stateManager.updateView(); + }); + Entry.addEventListener("stop", function(a) { + Entry.stateManager.updateView(); + }); + Entry.addEventListener("saveWorkspace", function(a) { + Entry.stateManager.addStamp(); + }); + Entry.addEventListener("undo", function(a) { + Entry.stateManager.undo(); + }); + Entry.addEventListener("redo", function(a) { + Entry.stateManager.redo(); + }); +}; +Entry.StateManager.prototype.generateView = function(a, b) { +}; +Entry.StateManager.prototype.addCommand = function(a, b, c, d) { + if (!this.isIgnoring()) { + if (this.isRestoring()) { + var e = new Entry.State, f = Array.prototype.slice.call(arguments); + Entry.State.prototype.constructor.apply(e, f); + this.redoStack_.push(e); + Entry.reporter && Entry.reporter.report(e); + } else { + e = new Entry.State, f = Array.prototype.slice.call(arguments), Entry.State.prototype.constructor.apply(e, f), this.undoStack_.push(e), Entry.reporter && Entry.reporter.report(e), this.updateView(); + } + Entry.creationChangedEvent && Entry.creationChangedEvent.notify(); + } +}; +Entry.StateManager.prototype.cancelLastCommand = function() { + this.canUndo() && (this.undoStack_.pop(), this.updateView(), Entry.creationChangedEvent && Entry.creationChangedEvent.notify()); +}; +Entry.StateManager.prototype.getLastCommand = function() { + return this.undoStack_[this.undoStack_.length - 1]; +}; +Entry.StateManager.prototype.undo = function() { + if (this.canUndo() && !this.isRestoring()) { + this.addActivity("undo"); + for (this.startRestore();this.undoStack_.length;) { + var a = this.undoStack_.pop(); + a.func.apply(a.caller, a.params); + if (!0 !== a.isPass) { + break; + } + } + this.updateView(); + this.endRestore(); + Entry.creationChangedEvent && Entry.creationChangedEvent.notify(); + } +}; +Entry.StateManager.prototype.redo = function() { + if (this.canRedo() && !this.isRestoring()) { + this.addActivity("redo"); + var a = this.redoStack_.pop(); + a.func.apply(a.caller, a.params); + this.updateView(); + Entry.creationChangedEvent && Entry.creationChangedEvent.notify(); + } +}; +Entry.StateManager.prototype.updateView = function() { + this.undoButton && this.redoButton && (this.canUndo() ? this.undoButton.addClass("active") : this.undoButton.removeClass("active"), this.canRedo() ? this.redoButton.addClass("active") : this.redoButton.removeClass("active")); +}; +Entry.StateManager.prototype.startRestore = function() { + this.isRestore = !0; +}; +Entry.StateManager.prototype.endRestore = function() { + this.isRestore = !1; +}; +Entry.StateManager.prototype.isRestoring = function() { + return this.isRestore; +}; +Entry.StateManager.prototype.startIgnore = function() { + this.isIgnore = !0; +}; +Entry.StateManager.prototype.endIgnore = function() { + this.isIgnore = !1; +}; +Entry.StateManager.prototype.isIgnoring = function() { + return this.isIgnore; +}; +Entry.StateManager.prototype.canUndo = function() { + return 0 < this.undoStack_.length && Entry.engine.isState("stop"); +}; +Entry.StateManager.prototype.canRedo = function() { + return 0 < this.redoStack_.length && Entry.engine.isState("stop"); +}; +Entry.StateManager.prototype.addStamp = function() { + this.stamp = Entry.generateHash(); + this.undoStack_.length && (this.undoStack_[this.undoStack_.length - 1].stamp = this.stamp); +}; +Entry.StateManager.prototype.isSaved = function() { + return 0 === this.undoStack_.length || this.undoStack_[this.undoStack_.length - 1].stamp == this.stamp && "string" == typeof this.stamp; +}; +Entry.StateManager.prototype.addActivity = function(a) { + Entry.reporter && Entry.reporter.report(new Entry.State(a)); +}; +Entry.STATIC = {OBJECT:0, ENTITY:1, SPRITE:2, SOUND:3, VARIABLE:4, FUNCTION:5, SCENE:6, MESSAGE:7, BLOCK_MODEL:8, BLOCK_RENDER_MODEL:9, BOX_MODEL:10, THREAD_MODEL:11, DRAG_INSTANCE:12, BLOCK_STATIC:0, BLOCK_MOVE:1, BLOCK_FOLLOW:2, RETURN:0, CONTINUE:1, BREAK:2, PASS:3}; +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(a) { + Entry.Model(this); + this.set(a); +}; +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.EntryObject = function(a) { + if (a) { + this.id = a.id; + this.name = a.name || a.sprite.name; + this.text = a.text || this.name; + this.objectType = a.objectType; + this.objectType || (this.objectType = "sprite"); + this.script = new Entry.Code(a.script ? a.script : [], this); + this.pictures = a.sprite.pictures; + this.sounds = []; + this.sounds = a.sprite.sounds; + for (var b = 0;b < this.sounds.length;b++) { + this.sounds[b].id || (this.sounds[b].id = Entry.generateHash()), Entry.initSound(this.sounds[b]); + } + this.lock = a.lock ? a.lock : !1; + this.isEditing = !1; + "sprite" == this.objectType && (this.selectedPicture = a.selectedPictureId ? this.getPicture(a.selectedPictureId) : this.pictures[0]); + this.scene = Entry.scene.getSceneById(a.scene) || Entry.scene.selectedScene; + this.setRotateMethod(a.rotateMethod); + this.entity = new Entry.EntityObject(this); + this.entity.injectModel(this.selectedPicture ? this.selectedPicture : null, a.entity ? a.entity : this.initEntity(a)); + this.clonedEntities = []; + Entry.stage.loadObject(this); + for (b in this.pictures) { + var c = this.pictures[b]; + c.objectId = this.id; + c.id || (c.id = Entry.generateHash()); + var d = new Image; + c.fileurl ? d.src = c.fileurl : c.fileurl ? d.src = c.fileurl : (a = c.filename, d.src = Entry.defaultPath + "/uploads/" + a.substring(0, 2) + "/" + a.substring(2, 4) + "/image/" + a + ".png"); + Entry.Loader.addQueue(); + d.onload = function(b) { + Entry.container.cachePicture(c.id, d); + Entry.Loader.removeQueue(); + Entry.requestUpdate = !0; + }; + } + } +}; +Entry.EntryObject.prototype.generateView = function() { + if ("workspace" == Entry.type) { + var a = Entry.createElement("li", this.id); + a.addClass("entryContainerListElementWorkspace"); + a.object = this; + a.bindOnClick(function(b) { + Entry.container.getObject(this.id) && Entry.container.selectObject(this.id); }); - e.addClass("entryPlaygroundPainterFlipY"); - this.flipObject.appendChild(e); - Entry.addEventListener("windowResized", function(a) { - var c = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; - a = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; - var d = parseInt(document.getElementById("entryCanvas").style.width), c = c - (d + 240), d = a - 349; - b.style.width = c + "px"; - f.style.width = c - 54 + "px"; - f.style.height = d + "px"; - g.style.top = d + 30 + "px"; - g.style.height = a - d + "px"; + Entry.Utils.disableContextmenu(a); + var b = this; + $(a).on("contextmenu", function(a) { + a = [{text:Lang.Workspace.context_rename, callback:function(a) { + a.stopPropagation(); + a = b; + a.setLock(!1); + a.editObjectValues(!0); + a.nameView_.select(); + }}, {text:Lang.Workspace.context_duplicate, enable:!Entry.engine.isState("run"), callback:function() { + Entry.container.addCloneObject(b); + }}, {text:Lang.Workspace.context_remove, callback:function() { + Entry.container.removeObject(b); + }}, {text:Lang.Workspace.copy_file, callback:function() { + Entry.container.setCopiedObject(b); + }}, {text:Lang.Blocks.Paste_blocks, enable:!Entry.engine.isState("run") && !!Entry.container.copiedObject, callback:function() { + Entry.container.copiedObject ? Entry.container.addCloneObject(Entry.container.copiedObject) : Entry.toast.alert(Lang.Workspace.add_object_alert, Lang.Workspace.object_not_found_for_paste); + }}]; + Entry.ContextMenu.show(a, "workspace-contextmenu"); }); - var h = Entry.createElement("nav", "entryPainterTopMenu"); - h.addClass("entryPlaygroundPainterTopMenu"); - c.appendChild(h); - e = Entry.createElement("ul"); - h.appendChild(e); - var k = Entry.createElement("li"); - h.appendChild(k); - h = Entry.createElement("a", "entryPainterTopMenuFileNew"); - h.bindOnClick(function() { - a.newPicture(); + this.view_ = a; + var c = this, a = Entry.createElement("ul"); + a.addClass("objectInfoView"); + Entry.objectEditable || a.addClass("entryHide"); + var d = Entry.createElement("li"); + d.addClass("objectInfo_visible"); + this.entity.getVisible() || d.addClass("objectInfo_unvisible"); + d.bindOnClick(function(b) { + Entry.engine.isState("run") || (b = c.entity, b.setVisible(!b.getVisible()) ? this.removeClass("objectInfo_unvisible") : this.addClass("objectInfo_unvisible")); }); - h.addClass("entryPlaygroundPainterTopMenuFileNew"); - h.innerHTML = Lang.Workspace.new_picture; - k.appendChild(h); - h = Entry.createElement("li", "entryPainterTopMenuFile"); - h.addClass("entryPlaygroundPainterTopMenuFile"); - h.innerHTML = Lang.Workspace.painter_file; - e.appendChild(h); - k = Entry.createElement("ul"); - h.appendChild(k); - h = Entry.createElement("li"); - k.appendChild(h); - var l = Entry.createElement("a", "entryPainterTopMenuFileSave"); - l.bindOnClick(function() { - a.file_save(!1); + var e = Entry.createElement("li"); + e.addClass("objectInfo_unlock"); + this.getLock() && e.addClass("objectInfo_lock"); + e.bindOnClick(function(b) { + Entry.engine.isState("run") || (b = c, b.setLock(!b.getLock()) ? this.addClass("objectInfo_lock") : this.removeClass("objectInfo_lock"), b.updateInputViews(b.getLock())); }); - l.addClass("entryPainterTopMenuFileSave"); - l.innerHTML = Lang.Workspace.painter_file_save; - h.appendChild(l); - h = Entry.createElement("li"); - k.appendChild(h); - k = Entry.createElement("a", "entryPainterTopMenuFileSaveAs"); - k.bindOnClick(function() { - a.file.mode = "new"; - a.file_save(!1); + a.appendChild(d); + a.appendChild(e); + this.view_.appendChild(a); + a = Entry.createElement("div"); + a.addClass("entryObjectThumbnailWorkspace"); + this.view_.appendChild(a); + this.thumbnailView_ = a; + a = Entry.createElement("div"); + a.addClass("entryObjectWrapperWorkspace"); + this.view_.appendChild(a); + d = Entry.createElement("input"); + d.bindOnClick(function(b) { + b.preventDefault(); + Entry.container.selectObject(c.id); + this.readOnly || (this.focus(), this.select()); }); - k.addClass("entryPlaygroundPainterTopMenuFileSaveAs"); - k.innerHTML = Lang.Workspace.painter_file_saveas; - h.appendChild(k); - k = Entry.createElement("li", "entryPainterTopMenuEdit"); - k.addClass("entryPlaygroundPainterTopMenuEdit"); - k.innerHTML = Lang.Workspace.painter_edit; - e.appendChild(k); - e = Entry.createElement("ul"); - k.appendChild(e); - k = Entry.createElement("li"); - e.appendChild(k); - h = Entry.createElement("a", "entryPainterTopMenuEditImportLink"); - h.bindOnClick(function() { - Entry.dispatchEvent("openPictureImport"); + d.addClass("entryObjectNameWorkspace"); + a.appendChild(d); + this.nameView_ = d; + this.nameView_.entryObject = this; + d.setAttribute("readonly", !0); + var f = this; + this.nameView_.onblur = function(b) { + this.entryObject.name = this.value; + Entry.playground.reloadPlayground(); + }; + this.nameView_.onkeypress = function(b) { + 13 == b.keyCode && f.editObjectValues(!1); + }; + this.nameView_.value = this.name; + d = Entry.createElement("div"); + d.addClass("entryObjectEditWorkspace"); + d.object = this; + this.editView_ = d; + this.view_.appendChild(d); + Entry.objectEditable ? ($(d).mousedown(function(a) { + var c = b.isEditing; + a.stopPropagation(); + Entry.documentMousedown.notify(a); + Entry.engine.isState("run") || !1 !== c || (b.editObjectValues(!c), Entry.playground.object !== b && Entry.container.selectObject(b.id), b.nameView_.select()); + }), d.blur = function(a) { + b.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(b) { + Entry.engine.isState("run") || Entry.container.removeObject(this.object); + })); + d = Entry.createElement("div"); + d.addClass("entryObjectInformationWorkspace"); + d.object = this; + this.isInformationToggle = !1; + a.appendChild(d); + this.informationView_ = d; + a = Entry.createElement("div"); + a.addClass("entryObjectRotationWrapperWorkspace"); + a.object = this; + this.view_.appendChild(a); + d = Entry.createElement("span"); + d.addClass("entryObjectCoordinateWorkspace"); + a.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(b) { + b.stopPropagation(); + this.select(); }); - h.addClass("entryPainterTopMenuEditImport"); - h.innerHTML = Lang.Workspace.get_file; - k.appendChild(h); - k = Entry.createElement("li"); - e.appendChild(k); - h = Entry.createElement("a", "entryPainterTopMenuEditCopy"); - h.bindOnClick(function() { - a.edit_copy(); + var h = Entry.createElement("span"); + h.addClass("entryObjectCoordinateSpanWorkspace"); + h.innerHTML = "Y:"; + var k = Entry.createElement("input"); + k.addClass("entryObjectCoordinateInputWorkspace entryObjectCoordinateInputWorkspace_right"); + k.bindOnClick(function(b) { + b.stopPropagation(); + this.select(); }); - h.addClass("entryPlaygroundPainterTopMenuEditCopy"); - h.innerHTML = Lang.Workspace.copy_file; - k.appendChild(h); - k = Entry.createElement("li"); - e.appendChild(k); - h = Entry.createElement("a", "entryPainterTopMenuEditCut"); - h.bindOnClick(function() { - a.edit_cut(); - }); - h.addClass("entryPlaygroundPainterTopMenuEditCut"); - h.innerHTML = Lang.Workspace.cut_picture; - k.appendChild(h); - k = Entry.createElement("li"); - e.appendChild(k); - h = Entry.createElement("a", "entryPainterTopMenuEditPaste"); - h.bindOnClick(function() { - a.edit_paste(); - }); - h.addClass("entryPlaygroundPainterTopMenuEditPaste"); - h.innerHTML = Lang.Workspace.paste_picture; - k.appendChild(h); - k = Entry.createElement("li"); - e.appendChild(k); - e = Entry.createElement("a", "entryPainterTopMenuEditEraseAll"); - e.addClass("entryPlaygroundPainterTopMenuEditEraseAll"); - e.innerHTML = Lang.Workspace.remove_all; - e.bindOnClick(function() { - a.clearCanvas(); - }); - k.appendChild(e); - this.painterTopStageXY = e = Entry.createElement("div", "entryPainterTopStageXY"); - e.addClass("entryPlaygroundPainterTopStageXY"); - c.appendChild(e); - e = Entry.createElement("ul", "entryPainterTopToolbar"); - e.addClass("entryPlaygroundPainterTopToolbar"); - c.appendChild(e); - c = Entry.createElement("li", "entryPainterTopToolbarUndo"); - c.bindOnClick(function() { - }); - c.addClass("entryPlaygroundPainterTopToolbar"); - e.appendChild(c); - c = Entry.createElement("li", "entryPainterTopToolbarRedo"); - c.bindOnClick(function() { - }); - c.addClass("entryPlaygroundPainterTopToolbar"); - e.appendChild(c); - c = Entry.createElement("ul"); - c.addClass("entryPlaygroundPainterToolboxContainer"); - d.appendChild(c); - this.toolboxCursor = Entry.createElement("li", "entryPainterToolboxCursor"); - this.toolboxCursor.title = "\uc774\ub3d9"; - this.toolboxCursor.bindOnClick(function() { - a.selectToolbox("cursor"); - }); - this.toolboxCursor.addClass("entryPlaygroundPainterToolboxCursor"); - c.appendChild(this.toolboxCursor); - this.toolboxSelect = Entry.createElement("li", "entryPainterToolboxSelect"); - this.toolboxSelect.title = "\uc790\ub974\uae30"; - this.toolboxSelect.bindOnClick(function() { - a.selectToolbox("select"); - }); - this.toolboxSelect.addClass("entryPlaygroundPainterToolboxSelect"); - c.appendChild(this.toolboxSelect); - this.toolboxPen = Entry.createElement("li", "entryPainterToolboxPen"); - this.toolboxPen.title = "\ud39c"; - this.toolboxPen.bindOnClick(function() { - a.selectToolbox("pen"); - }); - this.toolboxPen.addClass("entryPlaygroundPainterToolboxPen"); - c.appendChild(this.toolboxPen); - this.toolboxLine = Entry.createElement("li", "entryPainterToolboxLine"); - this.toolboxLine.title = "\uc9c1\uc120"; - this.toolboxLine.bindOnClick(function() { - a.selectToolbox("line"); - }); - this.toolboxLine.addClass("entryPlaygroundPainterToolboxLine"); - c.appendChild(this.toolboxLine); - this.toolboxRect = Entry.createElement("li", "entryPainterToolboxRect"); - this.toolboxRect.title = "\uc0ac\uac01\ud615"; - this.toolboxRect.bindOnClick(function() { - a.selectToolbox("rect"); - }); - this.toolboxRect.addClass("entryPlaygroundPainterToolboxRect"); - c.appendChild(this.toolboxRect); - this.toolboxCircle = Entry.createElement("li", "entryPainterToolboxCircle"); - this.toolboxCircle.title = "\uc6d0"; - this.toolboxCircle.bindOnClick(function() { - a.selectToolbox("circle"); - }); - this.toolboxCircle.addClass("entryPlaygroundPainterToolboxCircle"); - c.appendChild(this.toolboxCircle); - this.toolboxText = Entry.createElement("li", "entryPainterToolboxText"); - this.toolboxText.title = "\uae00\uc0c1\uc790"; - this.toolboxText.bindOnClick(function() { - a.selectToolbox("text"); - }); - this.toolboxText.addClass("entryPlaygroundPainterToolboxText"); - c.appendChild(this.toolboxText); - this.toolboxFill = Entry.createElement("li", "entryPainterToolboxFill"); - this.toolboxFill.bindOnClick(function() { - a.selectToolbox("fill"); + k.setAttribute("readonly", !0); + var l = Entry.createElement("span"); + l.addClass("entryObjectCoordinateSizeWorkspace"); + l.innerHTML = Lang.Workspace.Size + " : "; + var q = Entry.createElement("input"); + q.addClass("entryObjectCoordinateInputWorkspace", "entryObjectCoordinateInputWorkspace_size"); + q.bindOnClick(function(b) { + b.stopPropagation(); + this.select(); }); - this.toolboxFill.addClass("entryPlaygroundPainterToolboxFill"); - c.appendChild(this.toolboxFill); - this.toolboxErase = Entry.createElement("li", "entryPainterToolboxErase"); - this.toolboxErase.title = "\uc9c0\uc6b0\uae30"; - this.toolboxErase.bindOnClick(function() { - a.selectToolbox("erase"); + q.setAttribute("readonly", !0); + d.appendChild(e); + d.appendChild(g); + d.appendChild(h); + d.appendChild(k); + d.appendChild(l); + d.appendChild(q); + d.xInput_ = g; + d.yInput_ = k; + d.sizeInput_ = q; + this.coordinateView_ = d; + c = this; + g.onkeypress = function(b) { + 13 == b.keyCode && c.editObjectValues(!1); + }; + g.onblur = function(b) { + isNaN(g.value) || c.entity.setX(Number(g.value)); + c.updateCoordinateView(); + Entry.stage.updateObject(); + }; + k.onkeypress = function(b) { + 13 == b.keyCode && c.editObjectValues(!1); + }; + k.onblur = function(b) { + isNaN(k.value) || c.entity.setY(Number(k.value)); + c.updateCoordinateView(); + Entry.stage.updateObject(); + }; + q.onkeypress = function(b) { + 13 == b.keyCode && c.editObjectValues(!1); + }; + q.onblur = function(b) { + isNaN(q.value) || c.entity.setSize(Number(q.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 n = Entry.createElement("input"); + n.addClass("entryObjectRotateInputWorkspace"); + n.setAttribute("readonly", !0); + n.bindOnClick(function(b) { + b.stopPropagation(); + this.select(); }); - this.toolboxErase.addClass("entryPlaygroundPainterToolboxErase"); - c.appendChild(this.toolboxErase); - d = Entry.createElement("li", "entryPainterToolboxCoordinate"); - d.title = "\uc88c\ud45c"; - d.bindOnClick(function() { - a.toggleCoordinator(); + this.rotateSpan_ = e; + this.rotateInput_ = n; + h = Entry.createElement("span"); + h.addClass("entryObjectDirectionSpanWorkspace"); + h.innerHTML = Lang.Workspace.direction + " : "; + var m = Entry.createElement("input"); + m.addClass("entryObjectDirectionInputWorkspace"); + m.setAttribute("readonly", !0); + m.bindOnClick(function(b) { + b.stopPropagation(); + this.select(); }); - d.addClass("entryPlaygroundPainterToolboxCoordinate"); - c.appendChild(d); - this.attrResizeArea = Entry.createElement("fieldset", "painterAttrResize"); - this.attrResizeArea.addClass("entryPlaygroundPainterAttrResize"); - g.appendChild(this.attrResizeArea); - d = Entry.createElement("legend"); - d.innerHTML = Lang.Workspace.picture_size; - this.attrResizeArea.appendChild(d); - d = Entry.createElement("div", "painterAttrWrapper"); - d.addClass("painterAttrWrapper"); - this.attrResizeArea.appendChild(d); - c = Entry.createElement("div"); - c.addClass("entryPlaygroundPainterAttrResizeX"); - d.appendChild(c); - e = Entry.createElement("div"); - e.addClass("entryPlaygroundPainterAttrResizeXTop"); - e.innerHTML = "X"; - c.appendChild(e); - this.objectWidthInput = Entry.createElement("input", "entryPainterAttrWidth"); - this.objectWidthInput.onblur = function() { - if (isNaN(this.value)) { - return alert("\uc22b\uc790\ub9cc \uc785\ub825 \uac00\ub2a5\ud569\ub2c8\ub2e4."), !1; - } - a.handle.width = this.value; - a.updateImageHandle(); + this.directionInput_ = m; + d.appendChild(e); + d.appendChild(n); + d.appendChild(h); + d.appendChild(m); + d.rotateInput_ = n; + d.directionInput_ = m; + c = this; + n.onkeypress = function(b) { + 13 == b.keyCode && c.editObjectValues(!1); }; - this.objectWidthInput.addClass("entryPlaygroundPainterNumberInput"); - c.appendChild(this.objectWidthInput); - c = Entry.createElement("div"); - c.addClass("entryPlaygroundPainterSizeText"); - c.innerHTML = "x"; - d.appendChild(c); - c = Entry.createElement("div"); - c.addClass("entryPlaygroundAttrReiszeY"); - d.appendChild(c); - d = Entry.createElement("div"); - d.addClass("entryPlaygroundPainterAttrResizeYTop"); - d.innerHTML = "Y"; - c.appendChild(d); - this.objectHeightInput = Entry.createElement("input", "entryPainterAttrHeight"); - this.objectHeightInput.onblur = function() { - if (isNaN(this.value)) { - return alert("\uc22b\uc790\ub9cc \uc785\ub825 \uac00\ub2a5\ud569\ub2c8\ub2e4."), !1; - } - a.handle.height = this.value; - a.updateImageHandle(); + n.onblur = function(b) { + b = n.value; + -1 != b.indexOf("\u02da") && (b = b.substring(0, b.indexOf("\u02da"))); + isNaN(b) || c.entity.setRotation(Number(b)); + c.updateRotationView(); + Entry.stage.updateObject(); + }; + m.onkeypress = function(b) { + 13 == b.keyCode && c.editObjectValues(!1); + }; + m.onblur = function(b) { + b = m.value; + -1 != b.indexOf("\u02da") && (b = b.substring(0, b.indexOf("\u02da"))); + isNaN(b) || c.entity.setDirection(Number(b)); + c.updateRotationView(); + Entry.stage.updateObject(); }; - this.objectHeightInput.addClass("entryPlaygroundPainterNumberInput"); - c.appendChild(this.objectHeightInput); - this.attrRotateArea = Entry.createElement("div", "painterAttrRotateArea"); - this.attrRotateArea.addClass("painterAttrRotateArea"); - g.appendChild(this.attrRotateArea); d = Entry.createElement("div"); - d.addClass("painterAttrRotateName"); - d.innerHTML = Lang.Workspace.picture_rotation; - this.attrRotateArea.appendChild(d); - d = Entry.createElement("fieldset", "entryPainterAttrRotate"); - d.addClass("entryPlaygroundPainterAttrRotate"); - this.attrRotateArea.appendChild(d); - c = Entry.createElement("div"); - c.addClass("painterAttrRotateTop"); - c.innerHTML = "\u03bf"; - d.appendChild(c); - this.objectRotateInput = Entry.createElement("input", "entryPainterAttrDegree"); - this.objectRotateInput.onblur = function() { - if (isNaN(this.value)) { - return alert("\uc22b\uc790\ub9cc \uc785\ub825 \uac00\ub2a5\ud569\ub2c8\ub2e4."), !1; + d.addClass("rotationMethodWrapper"); + a.appendChild(d); + this.rotationMethodWrapper_ = d; + a = Entry.createElement("span"); + a.addClass("entryObjectRotateMethodLabelWorkspace"); + d.appendChild(a); + a.innerHTML = Lang.Workspace.rotate_method + " : "; + a = Entry.createElement("div"); + a.addClass("entryObjectRotateModeWorkspace"); + a.addClass("entryObjectRotateModeAWorkspace"); + a.object = this; + this.rotateModeAView_ = a; + d.appendChild(a); + a.bindOnClick(function(b) { + Entry.engine.isState("run") || this.object.getLock() || (this.object.initRotateValue("free"), this.object.setRotateMethod("free")); + }); + a = Entry.createElement("div"); + a.addClass("entryObjectRotateModeWorkspace"); + a.addClass("entryObjectRotateModeBWorkspace"); + a.object = this; + this.rotateModeBView_ = a; + d.appendChild(a); + a.bindOnClick(function(b) { + Entry.engine.isState("run") || this.object.getLock() || (this.object.initRotateValue("vertical"), this.object.setRotateMethod("vertical")); + }); + a = Entry.createElement("div"); + a.addClass("entryObjectRotateModeWorkspace"); + a.addClass("entryObjectRotateModeCWorkspace"); + a.object = this; + this.rotateModeCView_ = a; + d.appendChild(a); + a.bindOnClick(function(b) { + 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 a = Entry.createElement("li", this.id), a.addClass("entryContainerListElementWorkspace"), a.object = this, a.bindOnClick(function(b) { + Entry.container.getObject(this.id) && Entry.container.selectObject(this.id); + }), $ && (b = this, context.attach("#" + this.id, [{text:Lang.Workspace.context_rename, href:"/", action:function(b) { + b.preventDefault(); + }}, {text:Lang.Workspace.context_duplicate, href:"/", action:function(a) { + a.preventDefault(); + Entry.container.addCloneObject(b); + }}, {text:Lang.Workspace.context_remove, href:"/", action:function(a) { + a.preventDefault(); + Entry.container.removeObject(b); + }}])), this.view_ = a, a = Entry.createElement("ul"), a.addClass("objectInfoView"), d = Entry.createElement("li"), d.addClass("objectInfo_visible"), e = Entry.createElement("li"), e.addClass("objectInfo_lock"), a.appendChild(d), a.appendChild(e), this.view_.appendChild(a), a = Entry.createElement("div"), a.addClass("entryObjectThumbnailWorkspace"), this.view_.appendChild(a), this.thumbnailView_ = a, a = Entry.createElement("div"), a.addClass("entryObjectWrapperWorkspace"), this.view_.appendChild(a), + d = Entry.createElement("input"), d.addClass("entryObjectNameWorkspace"), a.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(b) { + 13 == b.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(b) { + Entry.engine.isState("run") || Entry.container.removeObject(this.object); + })), d = Entry.createElement("button"), d.addClass("entryObjectEditPhone"), d.object = this, d.bindOnClick(function(b) { + if (b = Entry.container.getObject(this.id)) { + Entry.container.selectObject(b.id), Entry.playground.injectObject(b); + } + }), this.view_.appendChild(d), d = Entry.createElement("div"), d.addClass("entryObjectInformationWorkspace"), d.object = this, this.isInformationToggle = !1, a.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 + " : ", n = Entry.createElement("input"), + n.addClass("entryObjectRotateInputWorkspace"), this.rotateSpan_ = e, this.rotateInput_ = n, h = Entry.createElement("span"), h.addClass("entryObjectDirectionSpanWorkspace"), h.innerHTML = Lang.Workspace.direction + " : ", m = Entry.createElement("input"), m.addClass("entryObjectDirectionInputWorkspace"), this.directionInput_ = m, d.appendChild(e), d.appendChild(n), d.appendChild(h), d.appendChild(m), d.rotateInput_ = n, d.directionInput_ = m, c = this, n.onkeypress = function(b) { + 13 == b.keyCode && (b = n.value, -1 != b.indexOf("\u02da") && (b = b.substring(0, b.indexOf("\u02da"))), isNaN(b) || c.entity.setRotation(Number(b)), c.updateRotationView(), n.blur()); + }, n.onblur = function(b) { + c.entity.setRotation(c.entity.getRotation()); + Entry.stage.updateObject(); + }, m.onkeypress = function(b) { + 13 == b.keyCode && (b = m.value, -1 != b.indexOf("\u02da") && (b = b.substring(0, b.indexOf("\u02da"))), isNaN(b) || c.entity.setDirection(Number(b)), c.updateRotationView(), m.blur()); + }, m.onblur = function(b) { + c.entity.setDirection(c.entity.getDirection()); + Entry.stage.updateObject(); + }, a = Entry.createElement("div"), a.addClass("entryObjectRotationWrapperWorkspace"), a.object = this, this.view_.appendChild(a), d = Entry.createElement("span"), d.addClass("entryObjectCoordinateWorkspace"), a.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, q = Entry.createElement("input"), q.addClass("entryObjectCoordinateInputWorkspace", "entryObjectCoordinateInputWorkspace_size"), d.appendChild(e), d.appendChild(g), d.appendChild(h), d.appendChild(k), d.appendChild(l), d.appendChild(q), + d.xInput_ = g, d.yInput_ = k, d.sizeInput_ = q, this.coordinateView_ = d, c = this, g.onkeypress = function(b) { + 13 == b.keyCode && (isNaN(g.value) || c.entity.setX(Number(g.value)), c.updateCoordinateView(), c.blur()); + }, g.onblur = function(b) { + c.entity.setX(c.entity.getX()); + Entry.stage.updateObject(); + }, k.onkeypress = function(b) { + 13 == b.keyCode && (isNaN(k.value) || c.entity.setY(Number(k.value)), c.updateCoordinateView(), c.blur()); + }, k.onblur = function(b) { + c.entity.setY(c.entity.getY()); + Entry.stage.updateObject(); + }, d = Entry.createElement("div"), d.addClass("rotationMethodWrapper"), a.appendChild(d), this.rotationMethodWrapper_ = d, a = Entry.createElement("span"), a.addClass("entryObjectRotateMethodLabelWorkspace"), d.appendChild(a), a.innerHTML = Lang.Workspace.rotate_method + " : ", a = Entry.createElement("div"), a.addClass("entryObjectRotateModeWorkspace"), a.addClass("entryObjectRotateModeAWorkspace"), a.object = this, this.rotateModeAView_ = a, d.appendChild(a), a.bindOnClick(function(b) { + Entry.engine.isState("run") || this.object.setRotateMethod("free"); + }), a = Entry.createElement("div"), a.addClass("entryObjectRotateModeWorkspace"), a.addClass("entryObjectRotateModeBWorkspace"), a.object = this, this.rotateModeBView_ = a, d.appendChild(a), a.bindOnClick(function(b) { + Entry.engine.isState("run") || this.object.setRotateMethod("vertical"); + }), a = Entry.createElement("div"), a.addClass("entryObjectRotateModeWorkspace"), a.addClass("entryObjectRotateModeCWorkspace"), a.object = this, this.rotateModeCView_ = a, d.appendChild(a), a.bindOnClick(function(b) { + Entry.engine.isState("run") || this.object.setRotateMethod("none"); + }), this.updateThumbnailView(), this.updateCoordinateView(), this.updateRotateMethodView(), this.updateInputViews(), this.view_; + } +}; +Entry.EntryObject.prototype.setName = function(a) { + Entry.assert("string" == typeof a, "object name must be string"); + this.name = a; + this.nameView_.value = a; +}; +Entry.EntryObject.prototype.setText = function(a) { + Entry.assert("string" == typeof a, "object text must be string"); + this.text = a; +}; +Entry.EntryObject.prototype.setScript = function(a) { + this.script = a; +}; +Entry.EntryObject.prototype.getScriptText = function() { + return JSON.stringify(this.script.toJSON()); +}; +Entry.EntryObject.prototype.initEntity = function(a) { + var b = {}; + b.x = b.y = 0; + b.rotation = 0; + b.direction = 90; + if ("sprite" == this.objectType) { + var c = a.sprite.pictures[0].dimension; + b.regX = c.width / 2; + b.regY = c.height / 2; + b.scaleX = b.scaleY = "background" == a.sprite.category.main ? Math.max(270 / c.height, 480 / c.width) : "new" == a.sprite.category.main ? 1 : 200 / (c.width + c.height); + b.width = c.width; + b.height = c.height; + } else { + if ("textBox" == this.objectType) { + if (b.regX = 25, b.regY = 12, b.scaleX = b.scaleY = 1.5, b.width = 50, b.height = 24, b.text = a.text, a.options) { + if (a = a.options, c = "", a.bold && (c += "bold "), a.italic && (c += "italic "), b.underline = a.underline, b.strike = a.strike, b.font = c + "20px " + a.font.family, b.colour = a.colour, b.bgColor = a.background, b.lineBreak = a.lineBreak) { + b.width = 256, b.height = .5625 * b.width, b.regX = b.width / 2, b.regY = b.height / 2; + } + } else { + b.underline = !1, b.strike = !1, b.font = "20px Nanum Gothic", b.colour = "#000000", b.bgColor = "#ffffff"; } - 360 <= this.value ? this.value %= 360 : 0 > this.value && (this.value = 360 + this.value % 360); - a.handle.rotation = this.value; - a.updateImageHandle(); - }; - this.objectRotateInput.addClass("entryPlaygroundPainterNumberInput"); - this.objectRotateInput.defaultValue = "0"; - d.appendChild(this.objectRotateInput); - this.attrColorArea = Entry.createElement("fieldset", "entryPainterAttrColor"); - this.attrColorArea.addClass("entryPlaygroundPainterAttrColor"); - g.appendChild(this.attrColorArea); - var q = Entry.createElement("div"); - q.addClass("entryPlaygroundPainterAttrColorContainer"); - this.attrColorArea.appendChild(q); - this.attrCircleArea = Entry.createElement("div"); - this.attrCircleArea.addClass("painterAttrCircleArea"); - g.appendChild(this.attrCircleArea); - d = Entry.createElement("div", "entryPainterAttrCircle"); - d.addClass("painterAttrCircle"); - this.attrCircleArea.appendChild(d); - this.attrCircleArea.painterAttrCircle = d; - d = Entry.createElement("input", "entryPainterAttrCircleInput"); - d.value = "#000000"; - d.addClass("painterAttrCircleInput"); - this.attrCircleArea.appendChild(d); - this.attrColorSpoid = Entry.createElement("div"); - this.attrColorSpoid.bindOnClick(function() { - a.selectToolbox("spoid"); - }); - this.attrColorSpoid.addClass("painterAttrColorSpoid"); - g.appendChild(this.attrColorSpoid); - Entry.getColourCodes().forEach(function(b) { - var c = Entry.createElement("div"); - c.addClass("entryPlaygroundPainterAttrColorElement"); - "transparent" === b ? c.style.backgroundImage = "url(" + (Entry.mediaFilePath + "/transparent.png") + ")" : c.style.backgroundColor = b; - c.bindOnClick(function(c) { - "transparent" === b ? (a.stroke.transparent = !0, a.stroke.lineColor = "#ffffff") : (a.stroke.transparent = !1, r && (document.getElementById("entryPainterShapeBackgroundColor").style.backgroundColor = b, a.stroke.fillColor = b), r || (document.getElementById("entryPainterShapeLineColor").style.backgroundColor = b, a.stroke.lineColor = b)); - document.getElementById("entryPainterAttrCircle").style.backgroundColor = a.stroke.lineColor; - document.getElementById("entryPainterAttrCircleInput").value = b; - }); - q.appendChild(c); - }); - this.attrThickArea = Entry.createElement("div", "painterAttrThickArea"); - this.attrThickArea.addClass("entryPlaygroundentryPlaygroundPainterAttrThickArea"); - g.appendChild(this.attrThickArea); - d = Entry.createElement("legend"); - d.addClass("painterAttrThickName"); - d.innerHTML = Lang.Workspace.thickness; - this.attrThickArea.appendChild(d); - var n = Entry.createElement("fieldset", "entryPainterAttrThick"); - n.addClass("entryPlaygroundPainterAttrThick"); - this.attrThickArea.appendChild(n); - d = Entry.createElement("div"); - d.addClass("paintAttrThickTop"); - n.appendChild(d); - e = Entry.createElement("select", "entryPainterAttrThick"); - e.addClass("entryPlaygroundPainterAttrThickInput"); - e.size = "1"; - e.onchange = function(b) { - a.stroke.thickness = b.target.value; - }; - for (d = 1;10 >= d;d++) { - c = Entry.createElement("option"), c.value = d, c.innerHTML = d, e.appendChild(c); } - n.appendChild(e); - d = Entry.createElement("div", "entryPainterShapeLineColor"); - d.addClass("painterAttrShapeLineColor"); - c = Entry.createElement("div", "entryPainterShapeInnerBackground"); - c.addClass("painterAttrShapeInnerBackground"); - d.appendChild(c); - n.appendChild(d); - this.attrThickArea.painterAttrShapeLineColor = d; - n.bindOnClick(function() { - m.style.zIndex = "1"; - this.style.zIndex = "10"; - r = !1; - }); - this.attrBackgroundArea = Entry.createElement("div", "painterAttrBackgroundArea"); - this.attrBackgroundArea.addClass("entryPlaygroundPainterBackgroundArea"); - g.appendChild(this.attrBackgroundArea); - d = Entry.createElement("fieldset", "entryPainterAttrbackground"); - d.addClass("entryPlaygroundPainterAttrBackground"); - this.attrBackgroundArea.appendChild(d); - c = Entry.createElement("div"); - c.addClass("paintAttrBackgroundTop"); - d.appendChild(c); - var m = Entry.createElement("div", "entryPainterShapeBackgroundColor"); - m.addClass("painterAttrShapeBackgroundColor"); - this.attrBackgroundArea.painterAttrShapeBackgroundColor = m; - c.appendChild(m); - var r = !1; - m.bindOnClick(function(a) { - n.style.zIndex = "1"; - this.style.zIndex = "10"; - r = !0; - }); - this.attrFontArea = Entry.createElement("div", "painterAttrFont"); - this.attrFontArea.addClass("entryPlaygroundPainterAttrFont"); - g.appendChild(this.attrFontArea); - e = Entry.createElement("div"); - e.addClass("entryPlaygroundPainterAttrTop"); - this.attrFontArea.appendChild(e); - d = Entry.createElement("div"); - d.addClass("entryPlaygroundPaintAttrTop_"); - e.appendChild(d); - d = Entry.createElement("legend"); - d.addClass("panterAttrFontTitle"); - d.innerHTML = Lang.Workspace.textStyle; - k = Entry.createElement("select", "entryPainterAttrFontName"); - k.addClass("entryPlaygroundPainterAttrFontName"); - k.size = "1"; - k.onchange = function(b) { - a.font.name = b.target.value; - }; - for (d = 0;d < Entry.fonts.length;d++) { - h = Entry.fonts[d], c = Entry.createElement("option"), c.value = h.family, c.innerHTML = h.name, k.appendChild(c); + } + return b; +}; +Entry.EntryObject.prototype.updateThumbnailView = function() { + if ("sprite" == this.objectType) { + if (this.entity.picture.fileurl) { + this.thumbnailView_.style.backgroundImage = 'url("' + this.entity.picture.fileurl + '")'; + } else { + var a = this.entity.picture.filename; + this.thumbnailView_.style.backgroundImage = 'url("' + Entry.defaultPath + "/uploads/" + a.substring(0, 2) + "/" + a.substring(2, 4) + "/thumb/" + a + '.png")'; } - e.appendChild(k); - e = Entry.createElement("div"); - e.addClass("painterAttrFontSizeArea"); - this.attrFontArea.appendChild(e); - d = Entry.createElement("div"); - d.addClass("painterAttrFontSizeTop"); - e.appendChild(d); - k = Entry.createElement("select", "entryPainterAttrFontSize"); - k.addClass("entryPlaygroundPainterAttrFontSize"); - k.size = "1"; - k.onchange = function(b) { - a.font.size = b.target.value; - }; - for (d = 20;72 >= d;d++) { - c = Entry.createElement("option"), c.value = d, c.innerHTML = d, k.appendChild(c); + } else { + "textBox" == this.objectType && (this.thumbnailView_.style.backgroundImage = "url(" + (Entry.mediaFilePath + "/text_icon.png") + ")"); + } +}; +Entry.EntryObject.prototype.updateCoordinateView = function(a) { + if ((this.isSelected() || a) && this.coordinateView_ && this.coordinateView_.xInput_ && this.coordinateView_.yInput_) { + a = this.coordinateView_.xInput_.value; + var b = this.coordinateView_.yInput_.value, c = this.coordinateView_.sizeInput_.value, d = this.entity.getX().toFixed(1), e = this.entity.getY().toFixed(1), f = this.entity.getSize().toFixed(1); + a != d && (this.coordinateView_.xInput_.value = d); + b != e && (this.coordinateView_.yInput_.value = e); + c != f && (this.coordinateView_.sizeInput_.value = f); + } +}; +Entry.EntryObject.prototype.updateRotationView = function(a) { + if (this.isSelected() && this.view_ || a) { + a = "", "free" == this.getRotateMethod() ? (this.rotateSpan_.removeClass("entryRemove"), this.rotateInput_.removeClass("entryRemove"), a += this.entity.getRotation().toFixed(1), this.rotateInput_.value = a + "\u02da") : (this.rotateSpan_.addClass("entryRemove"), this.rotateInput_.addClass("entryRemove")), a = "" + this.entity.getDirection().toFixed(1), this.directionInput_.value = a + "\u02da"; + } +}; +Entry.EntryObject.prototype.select = function(a) { + console.log(this); +}; +Entry.EntryObject.prototype.addPicture = function(a, b) { + Entry.stateManager && Entry.stateManager.addCommand("add sprite", this, this.removePicture, a.id); + a.objectId = this.id; + b || 0 === b ? (this.pictures.splice(b, 0, a), Entry.playground.injectPicture(this)) : this.pictures.push(a); + return new Entry.State(this, this.removePicture, a.id); +}; +Entry.EntryObject.prototype.removePicture = function(a) { + if (2 > this.pictures.length) { + return !1; + } + a = this.getPicture(a); + var b = this.pictures.indexOf(a); + Entry.stateManager && Entry.stateManager.addCommand("remove sprite", this, this.addPicture, a, b); + this.pictures.splice(b, 1); + a === this.selectedPicture && Entry.playground.selectPicture(this.pictures[0]); + Entry.playground.injectPicture(this); + Entry.playground.reloadPlayground(); + return new Entry.State(this, this.addPicture, a, b); +}; +Entry.EntryObject.prototype.getPicture = function(a) { + if (!a) { + return this.selectedPicture; + } + a = a.trim(); + for (var b = this.pictures, c = b.length, d = 0;d < c;d++) { + if (b[d].id == a) { + return b[d]; } - e.appendChild(k); - e = Entry.createElement("div"); - e.addClass("entryPlaygroundPainterAttrFontStyleArea"); - this.attrFontArea.appendChild(e); - d = Entry.createElement("div"); - d.addClass("entryPlaygroundPainterAttrFontTop"); - e.appendChild(d); - k = Entry.createElement("select", "entryPainterAttrFontStyle"); - k.addClass("entryPlaygroundPainterAttrFontStyle"); - k.size = "1"; - k.onchange = function(b) { - a.font.style = b.target.value; - }; - h = [{label:"\ubcf4\ud1b5", value:"normal"}, {label:"\uad75\uac8c", value:"bold"}, {label:"\uae30\uc6b8\uc784", value:"italic"}]; - for (d = 0;d < h.length;d++) { - l = h[d], c = Entry.createElement("option"), c.value = l.value, c.innerHTML = l.label, k.appendChild(c); + } + for (d = 0;d < c;d++) { + if (b[d].name == a) { + return b[d]; } - e.appendChild(k); - this.attrLineArea = Entry.createElement("div", "painterAttrLineStyle"); - this.attrLineArea.addClass("entryPlaygroundPainterAttrLineStyle"); - g.appendChild(this.attrLineArea); - var v = Entry.createElement("div"); - v.addClass("entryPlaygroundPainterAttrLineStyleLine"); - this.attrLineArea.appendChild(v); - var u = Entry.createElement("div"); - u.addClass("entryPlaygroundPaitnerAttrLineArea"); - this.attrLineArea.appendChild(u); - d = Entry.createElement("div"); - d.addClass("entryPlaygroundPainterAttrLineStyleLine1"); - u.appendChild(d); - d.value = "line"; - var t = Entry.createElement("div"); - t.addClass("painterAttrLineStyleBackgroundLine"); - v.bindOnClick(function(a) { - u.removeClass("entryRemove"); - }); - u.blur = function(a) { - this.addClass("entryRemove"); - }; - u.onmouseleave = function(a) { - this.addClass("entryRemove"); - }; - d.bindOnClick(function(a) { - this.attrLineArea.removeClass(v); - this.attrLineArea.appendChild(t); - this.attrLineArea.onchange(a); - u.blur(); - }); - t.bindOnClick(function(a) { - u.removeClass("entryRemove"); - }); - this.attrLineArea.onchange = function(b) { - a.stroke.style = b.target.value; - }; - u.blur(); } + a = Entry.parseNumber(a); + if ((!1 !== a || "boolean" != typeof a) && c >= a && 0 < a) { + return b[a - 1]; + } + throw Error("No picture found"); }; -Entry.Painter.prototype.restoreHandle = function() { - this.selectedObject && !1 === this.handle.visible && (this.handle.visible = !0, this.stage.update()); +Entry.EntryObject.prototype.setPicture = function(a) { + for (var b in this.pictures) { + if (a.id === this.pictures[b].id) { + this.pictures[b] = a; + return; + } + } + throw Error("No picture found"); }; -Entry.Painter.prototype.initDisplay = function() { - this.stroke.enabled = !1; - this.toolboxCursor.addClass("entryPlaygroundPainterToolboxCursor"); - this.toolboxCursor.removeClass("entryToolboxCursorClicked"); - this.toolboxSelect.addClass("entryPlaygroundPainterToolboxSelect"); - this.toolboxSelect.removeClass("entryToolboxSelectClicked"); - this.toolboxPen.addClass("entryPlaygroundPainterToolboxPen"); - this.toolboxPen.removeClass("entryToolboxPenClicked"); - this.toolboxLine.addClass("entryPlaygroundPainterToolboxLine"); - this.toolboxLine.removeClass("entryToolboxLineClicked"); - this.toolboxRect.addClass("entryPlaygroundPainterToolboxRect"); - this.toolboxRect.removeClass("entryToolboxRectClicked"); - this.toolboxCircle.addClass("entryPlaygroundPainterToolboxCircle"); - this.toolboxCircle.removeClass("entryToolBoxCircleClicked"); - this.toolboxText.addClass("entryPlaygroundPainterToolboxText"); - this.toolboxText.removeClass("entryToolBoxTextClicked"); - this.toolboxFill.addClass("entryPlaygroundPainterToolboxFill"); - this.toolboxFill.removeClass("entryToolBoxFillClicked"); - this.toolboxErase.addClass("entryPlaygroundPainterToolboxErase"); - this.toolboxErase.removeClass("entryToolBoxEraseClicked"); - this.attrColorSpoid.addClass("painterAttrColorSpoid"); - this.attrColorSpoid.removeClass("painterAttrColorSpoidClicked"); - this.attrResizeArea.addClass("entryRemove"); - this.attrRotateArea.addClass("entryRemove"); - this.attrThickArea.addClass("entryRemove"); - this.attrFontArea.addClass("entryRemove"); - this.attrLineArea.addClass("entryRemove"); - this.attrColorArea.addClass("entryRemove"); - this.attrCircleArea.addClass("entryRemove"); - this.attrColorSpoid.addClass("entryRemove"); - this.attrFontArea.addClass("entryRemove"); - this.attrBackgroundArea.addClass("entryRemove"); - this.flipObject.addClass("entryRemove"); - this.attrThickArea.painterAttrShapeLineColor.addClass("entryRemove"); - this.attrBackgroundArea.painterAttrShapeBackgroundColor.addClass("entryRemove"); - this.attrCircleArea.painterAttrCircle.addClass("entryRemove"); - this.inputField && !this.inputField._isHidden && (this.inputField.hide(), this.stage.update()); +Entry.EntryObject.prototype.getPrevPicture = function(a) { + for (var b = this.pictures, c = b.length, d = 0;d < c;d++) { + if (b[d].id == a) { + return b[0 == d ? c - 1 : d - 1]; + } + } }; -Entry.Painter.prototype.selectToolbox = function(b) { - this.toolbox.selected = b; - "erase" != b && $(".entryPlaygroundPainterContainer").removeClass("dd"); - this.initDisplay(); - "cursor" !== b && this.clearHandle(); - "text" !== b && this.inputField && delete this.inputField; - switch(b) { - case "cursor": - this.restoreHandle(); - this.toolboxCursor.addClass("entryToolboxCursorClicked"); - this.attrResizeArea.removeClass("entryRemove"); - this.attrRotateArea.removeClass("entryRemove"); - this.flipObject.removeClass("entryRemove"); - break; - case "select": - this.toolboxSelect.addClass("entryToolboxSelectClicked"); - break; - case "pen": - this.toolboxPen.addClass("entryToolboxPenClicked"); - this.attrThickArea.removeClass("entryRemove"); - this.attrColorArea.removeClass("entryRemove"); - this.attrCircleArea.removeClass("entryRemove"); - this.attrColorSpoid.removeClass("entryRemove"); - this.attrThickArea.painterAttrShapeLineColor.removeClass("entryRemove"); - break; - case "line": - this.toolboxLine.addClass("entryToolboxLineClicked"); - this.attrThickArea.removeClass("entryRemove"); - this.attrColorArea.removeClass("entryRemove"); - this.attrCircleArea.removeClass("entryRemove"); - this.attrColorSpoid.removeClass("entryRemove"); - this.attrThickArea.painterAttrShapeLineColor.removeClass("entryRemove"); - break; - case "rect": - this.toolboxRect.addClass("entryToolboxRectClicked"); - this.attrThickArea.removeClass("entryRemove"); - this.attrColorArea.removeClass("entryRemove"); - this.attrCircleArea.removeClass("entryRemove"); - this.attrColorSpoid.removeClass("entryRemove"); - this.attrBackgroundArea.removeClass("entryRemove"); - this.attrThickArea.painterAttrShapeLineColor.removeClass("entryRemove"); - this.attrBackgroundArea.painterAttrShapeBackgroundColor.removeClass("entryRemove"); - break; - case "circle": - this.toolboxCircle.addClass("entryToolBoxCircleClicked"); - this.attrThickArea.removeClass("entryRemove"); - this.attrColorArea.removeClass("entryRemove"); - this.attrCircleArea.removeClass("entryRemove"); - this.attrColorSpoid.removeClass("entryRemove"); - this.attrThickArea.painterAttrShapeLineColor.removeClass("entryRemove"); - this.attrBackgroundArea.removeClass("entryRemove"); - this.attrBackgroundArea.painterAttrShapeBackgroundColor.removeClass("entryRemove"); - break; - case "text": - this.toolboxText.addClass("entryToolBoxTextClicked"); - this.attrFontArea.removeClass("entryRemove"); - this.attrColorArea.removeClass("entryRemove"); - this.attrCircleArea.removeClass("entryRemove"); - this.attrColorSpoid.removeClass("entryRemove"); - this.attrCircleArea.painterAttrCircle.removeClass("entryRemove"); - break; - case "fill": - this.toolboxFill.addClass("entryToolBoxFillClicked"); - this.attrColorArea.removeClass("entryRemove"); - this.attrCircleArea.removeClass("entryRemove"); - this.attrColorSpoid.removeClass("entryRemove"); - this.attrCircleArea.painterAttrCircle.removeClass("entryRemove"); - break; - case "erase": - $(".entryPlaygroundPainterContainer").addClass("dd"); - this.toolboxErase.addClass("entryToolBoxEraseClicked"); - this.attrThickArea.removeClass("entryRemove"); - break; - case "spoid": - this.attrColorArea.removeClass("entryRemove"); - this.attrCircleArea.removeClass("entryRemove"); - this.attrColorSpoid.removeClass("entryRemove"); - this.attrColorSpoid.removeClass("painterAttrColorSpoid"); - this.attrColorSpoid.addClass("painterAttrColorSpoidClicked"); - break; - case "coordinate": - this.toggleCoordinator(); +Entry.EntryObject.prototype.getNextPicture = function(a) { + for (var b = this.pictures, c = b.length, d = 0;d < c;d++) { + if (b[d].id == a) { + return b[d == c - 1 ? 0 : d + 1]; + } } }; -Entry.BlockParser = function(b) { - this.syntax = b; - this._iterVariableCount = 0; - this._iterVariableChunk = ["i", "j", "k"]; +Entry.EntryObject.prototype.selectPicture = function(a) { + var b = this.getPicture(a); + if (b) { + this.selectedPicture = b, this.entity.setImage(b), this.updateThumbnailView(); + } else { + throw Error("No picture with pictureId : " + a); + } +}; +Entry.EntryObject.prototype.addSound = function(a, b) { + a.id || (a.id = Entry.generateHash()); + Entry.stateManager && Entry.stateManager.addCommand("add sound", this, this.removeSound, a.id); + Entry.initSound(a, b); + b || 0 === b ? (this.sounds.splice(b, 0, a), Entry.playground.injectSound(this)) : this.sounds.push(a); + return new Entry.State(this, this.removeSound, a.id); +}; +Entry.EntryObject.prototype.removeSound = function(a) { + var b; + b = this.getSound(a); + a = this.sounds.indexOf(b); + Entry.stateManager && Entry.stateManager.addCommand("remove sound", this, this.addSound, b, a); + this.sounds.splice(a, 1); + Entry.playground.reloadPlayground(); + Entry.playground.injectSound(this); + return new Entry.State(this, this.addSound, b, a); }; -(function(b) { - b.Code = function(a) { - if (a instanceof Entry.Thread) { - return this.Thread(a); - } - if (a instanceof Entry.Block) { - return this.Block(a); - } - var b = ""; - a = a.getThreads(); - for (var d = 0;d < a.length;d++) { - b += this.Thread(a[d]); - } - return b; - }; - b.Thread = function(a) { - if (a instanceof Entry.Block) { - return this.Block(a); - } - var b = ""; - a = a.getBlocks(); - for (var d = 0;d < a.length;d++) { - b += this.Block(a[d]); - } - return b; - }; - b.Block = function(a) { - var b = a._schema.syntax; - return b ? this[b[0]](a) : ""; - }; - b.Program = function(a) { - return ""; - }; - b.Scope = function(a) { - a = a._schema.syntax.concat(); - return a.splice(1, a.length - 1).join(".") + "();\n"; - }; - b.BasicFunction = function(a) { - a = this.Thread(a.statements[0]); - return "function promise() {\n" + this.indent(a) + "}\n"; - }; - b.BasicIteration = function(a) { - var b = a.params[0], d = this.publishIterateVariable(); - a = this.Thread(a.statements[0]); - this.unpublishIterateVariable(); - return "for (var " + d + " = 0; " + d + " < " + b + "; " + d + "++){\n" + this.indent(a) + "}\n"; - }; - b.BasicIf = function(a) { - var b = this.Thread(a.statements[0]); - return "if (" + a._schema.syntax.concat()[1] + ") {\n" + this.indent(b) + "}\n"; - }; - b.BasicWhile = function(a) { - var b = this.Thread(a.statements[0]); - return "while (" + a._schema.syntax.concat()[1] + ") {\n" + this.indent(b) + "}\n"; - }; - b.indent = function(a) { - var b = " "; - a = a.split("\n"); - a.pop(); - return b += a.join("\n ") + "\n"; - }; - b.publishIterateVariable = function() { - var a = "", b = this._iterVariableCount; - do { - a = this._iterVariableChunk[b % 3] + a, b = parseInt(b / 3) - 1, 0 === b && (a = this._iterVariableChunk[0] + a); - } while (0 < b); - this._iterVariableCount++; - return a; - }; - b.unpublishIterateVariable = function() { - this._iterVariableCount && this._iterVariableCount--; - }; -})(Entry.BlockParser.prototype); -Entry.JSParser = function(b) { - this.syntax = b; - this.scopeChain = []; - this.scope = null; +Entry.EntryObject.prototype.getRotateMethod = function() { + this.rotateMethod || (this.rotateMethod = "free"); + return this.rotateMethod; }; -(function(b) { - b.Program = function(a) { - var b = [], d = []; - d.push({type:this.syntax.Program}); - var e = this.initScope(a), d = d.concat(this.BlockStatement(a)); - this.unloadScope(); - b.push(d); - return b = b.concat(e); - }; - b.Identifier = function(a, b) { - return b ? b[a.name] : this.scope[a.name]; - }; - b.ExpressionStatement = function(a) { - a = a.expression; - return this[a.type](a); - }; - b.ForStatement = function(a) { - var b = a.init, d = a.test, e = a.update, f = a.body; - if (this.syntax.ForStatement) { - throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - } - var f = this[f.type](f), b = b.declarations[0].init.value, g = d.operator, d = d.right.value, h = 0; - "++" != e.operator && (e = b, b = d, d = e); - switch(g) { - case "<": - h = d - b; - break; - case "<=": - h = d + 1 - b; - break; - case ">": - h = b - d; - break; - case ">=": - h = b + 1 - d; - } - return this.BasicIteration(a, h, f); - }; - b.BlockStatement = function(a) { - var b = []; - a = a.body; - for (var d = 0;d < a.length;d++) { - var e = a[d], f = this[e.type](e); - if (f) { - if (void 0 === f.type) { - throw {message:"\ud574\ub2f9\ud558\ub294 \ube14\ub85d\uc774 \uc5c6\uc2b5\ub2c8\ub2e4.", node:e}; - } - f && b.push(f); - } - } - return b; - }; - b.EmptyStatement = function(a) { - throw {message:"empty\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.DebuggerStatement = function(a) { - throw {message:"debugger\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.WithStatement = function(a) { - throw {message:"with\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.ReturnStaement = function(a) { - throw {message:"return\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.LabeledStatement = function(a) { - throw {message:"label\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.BreakStatement = function(a) { - throw {message:"break\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.ContinueStatement = function(a) { - throw {message:"continue\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.IfStatement = function(a) { - if (this.syntax.IfStatement) { - throw {message:"if\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - } - return this.BasicIf(a); - }; - b.SwitchStatement = function(a) { - throw {message:"switch\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.SwitchCase = function(a) { - throw {message:"switch ~ case\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.ThrowStatement = function(a) { - throw {message:"throw\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.TryStatement = function(a) { - throw {message:"try\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.CatchClause = function(a) { - throw {message:"catch\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.WhileStatement = function(a) { - var b = a.body, d = this.syntax.WhileStatement, b = this[b.type](b); - if (d) { - throw {message:"while\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - } - return this.BasicWhile(a, b); - }; - b.DoWhileStatement = function(a) { - throw {message:"do ~ while\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.ForInStatement = function(a) { - throw {message:"for ~ in\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.FunctionDeclaration = function(a) { - if (this.syntax.FunctionDeclaration) { - throw {message:"function\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - } - return null; - }; - b.VariableDeclaration = function(a) { - throw {message:"var\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.ThisExpression = function(a) { - return this.scope.this; - }; - b.ArrayExpression = function(a) { - throw {message:"array\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.ObjectExpression = function(a) { - throw {message:"object\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.Property = function(a) { - throw {message:"init, get, set\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.FunctionExpression = function(a) { - throw {message:"function\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.UnaryExpression = function(a) { - throw {message:a.operator + "\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub839\uc5b4 \uc785\ub2c8\ub2e4.", node:a}; - }; - b.UnaryOperator = function() { - return "- + ! ~ typeof void delete".split(" "); - }; - b.updateOperator = function() { - return ["++", "--"]; - }; - b.BinaryOperator = function() { - return "== != === !== < <= > >= << >> >>> + - * / % , ^ & in instanceof".split(" "); - }; - b.AssignmentExpression = function(a) { - throw {message:a.operator + "\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub839\uc5b4 \uc785\ub2c8\ub2e4.", node:a}; - }; - b.AssignmentOperator = function() { - return "= += -= *= /= %= <<= >>= >>>= ,= ^= &=".split(" "); - }; - b.LogicalExpression = function(a) { - throw {message:a.operator + "\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub839\uc5b4 \uc785\ub2c8\ub2e4.", node:a}; - }; - b.LogicalOperator = function() { - return ["||", "&&"]; +Entry.EntryObject.prototype.setRotateMethod = function(a) { + a || (a = "free"); + this.rotateMethod = a; + this.updateRotateMethodView(); + Entry.stage.selectedObject && Entry.stage.selectedObject.entity && (Entry.stage.updateObject(), Entry.stage.updateHandle()); +}; +Entry.EntryObject.prototype.initRotateValue = function(a) { + this.rotateMethod != a && (a = this.entity, a.rotation = 0, a.direction = 90, a.flip = !1); +}; +Entry.EntryObject.prototype.updateRotateMethodView = function() { + var a = this.rotateMethod; + this.rotateModeAView_ && (this.rotateModeAView_.removeClass("selected"), this.rotateModeBView_.removeClass("selected"), this.rotateModeCView_.removeClass("selected"), "free" == a ? this.rotateModeAView_.addClass("selected") : "vertical" == a ? this.rotateModeBView_.addClass("selected") : this.rotateModeCView_.addClass("selected"), this.updateRotationView()); +}; +Entry.EntryObject.prototype.toggleInformation = function(a) { + this.setRotateMethod(this.getRotateMethod()); + void 0 === a && (a = this.isInformationToggle = !this.isInformationToggle); + a ? this.view_.addClass("informationToggle") : this.view_.removeClass("informationToggle"); +}; +Entry.EntryObject.prototype.addCloneEntity = function(a, b, c) { + this.clonedEntities.length > Entry.maxCloneLimit || (a = new Entry.EntityObject(this), b ? (a.injectModel(b.picture ? b.picture : null, b.toJSON()), a.snapshot_ = b.snapshot_, b.effect && (a.effect = Entry.cloneSimpleObject(b.effect), a.applyFilter()), b.brush && Entry.setCloneBrush(a, b.brush)) : (a.injectModel(this.entity.picture ? this.entity.picture : null, this.entity.toJSON(a)), a.snapshot_ = this.entity.snapshot_, this.entity.effect && (a.effect = Entry.cloneSimpleObject(this.entity.effect), + a.applyFilter()), this.entity.brush && Entry.setCloneBrush(a, this.entity.brush)), Entry.engine.raiseEventOnEntity(a, [a, "when_clone_start"]), a.isClone = !0, a.isStarted = !0, this.addCloneVariables(this, a, b ? b.variables : null, b ? b.lists : null), this.clonedEntities.push(a), Entry.stage.loadEntity(a)); +}; +Entry.EntryObject.prototype.initializeSplitter = function(a) { + a.onmousedown = function(b) { + Entry.container.disableSort(); + Entry.container.splitterEnable = !0; }; - b.MemberExpression = function(a) { - var b = a.object, d = a.property; - console.log(b.type); - b = this[b.type](b); - console.log(b); - d = this[d.type](d, b); - if (Object(b) !== b || Object.getPrototypeOf(b) !== Object.prototype) { - throw {message:b + "\uc740(\ub294) \uc798\ubabb\ub41c \uba64\ubc84 \ubcc0\uc218\uc785\ub2c8\ub2e4.", node:a}; - } - b = d; - if (!b) { - throw {message:d + "\uc774(\uac00) \uc874\uc7ac\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.", node:a}; + document.addEventListener("mousemove", function(b) { + Entry.container.splitterEnable && Entry.resizeElement({canvasWidth:b.x || b.clientX}); + }); + document.addEventListener("mouseup", function(b) { + Entry.container.splitterEnable = !1; + Entry.container.enableSort(); + }); +}; +Entry.EntryObject.prototype.isSelected = function() { + return this.isSelected_; +}; +Entry.EntryObject.prototype.toJSON = function() { + var a = {}; + a.id = this.id; + a.name = this.name; + "textBox" == this.objectType && (a.text = this.text); + a.script = this.getScriptText(); + "sprite" == this.objectType && (a.selectedPictureId = this.selectedPicture.id); + a.objectType = this.objectType; + a.rotateMethod = this.getRotateMethod(); + a.scene = this.scene.id; + a.sprite = {pictures:Entry.getPicturesJSON(this.pictures), sounds:Entry.getSoundsJSON(this.sounds)}; + a.lock = this.lock; + a.entity = this.entity.toJSON(); + return a; +}; +Entry.EntryObject.prototype.destroy = function() { + Entry.stage.unloadEntity(this.entity); + this.view_ && Entry.removeElement(this.view_); +}; +Entry.EntryObject.prototype.getSound = function(a) { + a = a.trim(); + for (var b = this.sounds, c = b.length, d = 0;d < c;d++) { + if (b[d].id == a) { + return b[d]; } - return b; - }; - b.ConditionalExpression = function(a) { - throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.UpdateExpression = function(a) { - throw {message:a.operator + "\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub801\uc5b4 \uc785\ub2c8\ub2e4.", node:a}; - }; - b.CallExpression = function(a) { - a = a.callee; - return {type:this[a.type](a)}; - }; - b.NewExpression = function(a) { - throw {message:"new\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.SequenceExpression = function(a) { - throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", 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; + } + for (d = 0;d < c;d++) { + if (b[d].name == a) { + return b[d]; } - 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 < a.length;d++) { - var e = a[d]; - "FunctionDeclaration" === e.type && (this.scope[e.id.name] = this.scope.promise, this.syntax.BasicFunction && (e = e.body, b.push([{type:this.syntax.BasicFunction, statements:[this[e.type](e)]}]))); + } + a = Entry.parseNumber(a); + if ((!1 !== a || "boolean" != typeof a) && c >= a && 0 < a) { + return b[a - 1]; + } + throw Error("No Sound"); +}; +Entry.EntryObject.prototype.addCloneVariables = function(a, b, c, d) { + b.variables = []; + b.lists = []; + c || (c = Entry.findObjsByKey(Entry.variableContainer.variables_, "object_", a.id)); + d || (d = Entry.findObjsByKey(Entry.variableContainer.lists_, "object_", a.id)); + for (a = 0;a < c.length;a++) { + b.variables.push(c[a].clone()); + } + for (a = 0;a < d.length;a++) { + b.lists.push(d[a].clone()); + } +}; +Entry.EntryObject.prototype.getLock = function() { + return this.lock; +}; +Entry.EntryObject.prototype.setLock = function(a) { + this.lock = a; + Entry.stage.updateObject(); + return a; +}; +Entry.EntryObject.prototype.updateInputViews = function(a) { + a = a || this.getLock(); + var b = [this.nameView_, this.coordinateView_.xInput_, this.coordinateView_.yInput_, this.rotateInput_, this.directionInput_, this.coordinateView_.sizeInput_]; + if (a && 1 != b[0].getAttribute("readonly")) { + for (a = 0;a < b.length;a++) { + b[a].removeClass("selectedEditingObject"), b[a].setAttribute("readonly", !1), this.isEditing = !1; } - return b; - }; - b.BasicFunction = function(a, b) { - return null; - }; - b.BasicIteration = function(a, b, d) { - var e = this.syntax.BasicIteration; - if (!e) { - throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; + } +}; +Entry.EntryObject.prototype.editObjectValues = function(a) { + var b; + b = this.getLock() ? [this.nameView_] : [this.nameView_, this.coordinateView_.xInput_, this.coordinateView_.yInput_, this.rotateInput_, this.directionInput_, this.coordinateView_.sizeInput_]; + if (a) { + $(b).removeClass("selectedNotEditingObject"); + for (a = 0;a < b.length;a++) { + b[a].removeAttribute("readonly"), b[a].addClass("selectedEditingObject"); } - return {params:[b], type:e, statements:[d]}; - }; - b.BasicWhile = function(a, b) { - var d = a.test.raw; - if (this.syntax.BasicWhile[d]) { - return {type:this.syntax.BasicWhile[d], statements:[b]}; + this.isEditing = !0; + } else { + for (a = 0;a < b.length;a++) { + b[a].blur(!0); } - throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a.test}; - }; - b.BasicIf = function(a) { - var b = a.consequent, b = this[b.type](b); - try { - var d = "", e = "===" === a.test.operator ? "==" : a.test.operator; - if ("Identifier" === a.test.left.type && "Literal" === a.test.right.type) { - d = a.test.left.name + " " + e + " " + a.test.right.raw; - } else { - if ("Literal" === a.test.left.type && "Identifier" === a.test.right.type) { - d = a.test.right.name + " " + e + " " + a.test.left.raw; - } else { - throw Error(); - } + this.blurAllInput(); + this.isEditing = !1; + } +}; +Entry.EntryObject.prototype.blurAllInput = function() { + var a = document.getElementsByClassName("selectedEditingObject"); + $(a).removeClass("selectedEditingObject"); + for (var a = [this.nameView_, this.coordinateView_.xInput_, this.coordinateView_.yInput_, this.rotateInput_, this.directionInput_, this.coordinateView_.sizeInput_], b = 0;b < a.length;b++) { + a[b].addClass("selectedNotEditingObject"), a[b].setAttribute("readonly", !0); + } +}; +Entry.EntryObject.prototype.addStampEntity = function(a) { + a = new Entry.StampEntity(this, a); + Entry.stage.loadEntity(a); + this.clonedEntities.push(a); + Entry.stage.sortZorder(); +}; +Entry.EntryObject.prototype.getClonedEntities = function() { + var a = []; + this.clonedEntities.map(function(b) { + b.isStamp || a.push(b); + }); + return a; +}; +Entry.EntryObject.prototype.getStampEntities = function() { + var a = []; + this.clonedEntities.map(function(b) { + b.isStamp && a.push(b); + }); + return a; +}; +Entry.EntryObject.prototype.clearExecutor = function() { + this.script.clearExecutors(); +}; +Entry.Painter = function() { + this.toolbox = {selected:"cursor"}; + this.stroke = {enabled:!1, fillColor:"#000000", lineColor:"#000000", thickness:1, fill:!0, transparent:!1, style:"line", locked:!1}; + this.file = {id:Entry.generateHash(), name:"\uc0c8\uadf8\ub9bc", modified:!1, mode:"new"}; + this.font = {name:"KoPub Batang", size:20, style:"normal"}; + this.selectArea = {}; + this.firstStatement = !1; +}; +Entry.Painter.prototype.initialize = function(a) { + this.generateView(a); + this.canvas = document.getElementById("entryPainterCanvas"); + this.canvas_ = document.getElementById("entryPainterCanvas_"); + this.stage = new createjs.Stage(this.canvas); + this.stage.autoClear = !0; + this.stage.enableDOMEvents(!0); + this.stage.enableMouseOver(10); + this.stage.mouseMoveOutside = !0; + createjs.Touch.enable(this.stage); + this.objectContainer = new createjs.Container; + this.objectContainer.name = "container"; + this.stage.addChild(this.objectContainer); + this.ctx = this.stage.canvas.getContext("2d"); + this.ctx.imageSmoothingEnabled = !1; + this.ctx.webkitImageSmoothingEnabled = !1; + this.ctx.mozImageSmoothingEnabled = !1; + this.ctx.msImageSmoothingEnabled = !1; + this.ctx.oImageSmoothingEnabled = !1; + this.ctx_ = this.canvas_.getContext("2d"); + this.initDashedLine(); + this.initPicture(); + this.initCoordinator(); + this.initHandle(); + this.initDraw(); + var b = this; + Entry.addEventListener("textUpdate", function() { + var a = b.inputField.value(); + "" === a ? (b.inputField.hide(), delete b.inputField) : (b.inputField.hide(), b.drawText(a), b.selectToolbox("cursor")); + }); + this.selectToolbox("cursor"); +}; +Entry.Painter.prototype.initHandle = function() { + this._handle = new createjs.Container; + this._handle.rect = new createjs.Shape; + this._handle.addChild(this._handle.rect); + var a = new createjs.Container; + a.name = "move"; + a.width = 90; + a.height = 90; + a.x = 90; + a.y = 90; + a.rect = new createjs.Shape; + var b = this; + a.rect.on("mousedown", function(c) { + "cursor" === b.toolbox.selected && (b.initCommand(), this.offset = {x:this.parent.x - this.x - c.stageX, y:this.parent.y - this.y - c.stageY}, this.parent.handleMode = "move", a.isSelectCenter = !1); + }); + a.rect.on("pressmove", function(c) { + "cursor" !== b.toolbox.selected || a.isSelectCenter || (b.doCommand(), this.parent.x = c.stageX + this.offset.x, this.parent.y = c.stageY + this.offset.y, b.updateImageHandle()); + }); + a.on("mouseup", function(a) { + b.checkCommand(); + }); + a.rect.cursor = "move"; + a.addChild(a.rect); + a.notch = new createjs.Shape; + a.addChild(a.notch); + a.NEHandle = this.generateCornerHandle(); + a.addChild(a.NEHandle); + a.NWHandle = this.generateCornerHandle(); + a.addChild(a.NWHandle); + a.SWHandle = this.generateCornerHandle(); + a.addChild(a.SWHandle); + a.SEHandle = this.generateCornerHandle(); + a.addChild(a.SEHandle); + a.EHandle = this.generateXHandle(); + a.addChild(a.EHandle); + a.WHandle = this.generateXHandle(); + a.addChild(a.WHandle); + a.NHandle = this.generateYHandle(); + a.addChild(a.NHandle); + a.SHandle = this.generateYHandle(); + a.addChild(a.SHandle); + a.RHandle = new createjs.Shape; + a.RHandle.graphics.ss(2, 2, 0).beginFill("#888").s("#c1c7cd").f("#c1c7cd").dr(-2, -2, 8, 8); + a.RHandle.on("mousedown", function(a) { + b.initCommand(); + }); + a.RHandle.on("pressmove", function(a) { + b.doCommand(); + var d = a.stageX - this.parent.x; + a = a.stageY - this.parent.y; + this.parent.rotation = 0 <= d ? Math.atan(a / d) / Math.PI * 180 + 90 : Math.atan(a / d) / Math.PI * 180 + 270; + b.updateImageHandle(); + }); + a.RHandle.cursor = "crosshair"; + a.addChild(a.RHandle); + a.on("mouseup", function(a) { + b.checkCommand(); + }); + a.visible = !1; + this.handle = a; + this.stage.addChild(a); + this.updateImageHandleCursor(); +}; +Entry.Painter.prototype.generateCornerHandle = function() { + var a = this, b = new createjs.Shape; + b.graphics.beginFill("#c1c7cd").ss(2, 2, 0).s("#c1c7cd").dr(-4, -4, 8, 8); + b.on("mousedown", function(b) { + a.initCommand(); + this.offset = {x:b.stageX - this.parent.x + this.parent.regX, y:b.stageY - this.parent.y + this.parent.regY}; + }); + b.on("pressmove", function(b) { + a.doCommand(); + var d = Math.sqrt(Math.abs((b.stageX - this.parent.x + this.parent.regX) / this.offset.x * (b.stageY - this.parent.y + this.parent.regY) / this.offset.y)); + 10 < this.parent.width * d && 10 < this.parent.height * d && (this.parent.width *= d, this.parent.height *= d, this.offset = {x:b.stageX - this.parent.x + this.parent.regX, y:b.stageY - this.parent.y + this.parent.regY}); + a.updateImageHandle(); + }); + b.on("mouseup", function(b) { + a.checkCommand(); + }); + return b; +}; +Entry.Painter.prototype.generateXHandle = function() { + var a = this, b = new createjs.Shape; + b.graphics.beginFill("#c1c7cd").ss(2, 2, 0).s("#c1c7cd").dr(-4, -4, 8, 8); + b.on("mousedown", function(b) { + a.initCommand(); + this.offset = {x:b.stageX - this.parent.x + this.parent.regX}; + }); + b.on("pressmove", function(b) { + a.doCommand(); + var d = Math.abs((b.stageX - this.parent.x + this.parent.regX) / this.offset.x); + 10 < this.parent.width * d && (this.parent.width *= d, this.offset = {x:b.stageX - this.parent.x + this.parent.regX}); + a.updateImageHandle(); + }); + b.on("mouseup", function(b) { + a.checkCommand(); + }); + return b; +}; +Entry.Painter.prototype.generateYHandle = function() { + var a = this, b = new createjs.Shape; + b.graphics.beginFill("#c1c7cd").ss(2, 2, 0).s("#c1c7cd").dr(-4, -4, 8, 8); + b.on("mousedown", function(b) { + a.initCommand(); + this.offset = {y:b.stageY - this.parent.y + this.parent.regY}; + }); + b.on("pressmove", function(b) { + a.doCommand(); + var d = Math.abs((b.stageY - this.parent.y + this.parent.regY) / this.offset.y); + 10 < this.parent.height * d && (this.parent.height *= d, this.offset = {y:b.stageY - this.parent.y + this.parent.regY}); + a.updateImageHandle(); + }); + b.on("mouseup", function(b) { + a.checkCommand(); + }); + return b; +}; +Entry.Painter.prototype.updateImageHandle = function() { + if (this.handle.visible) { + var a = this.handle, b = a.direction, c = a.width, d = a.height, e = a.regX, f = a.regY; + a.rect.graphics.clear().f("rgba(0,0,1,0.01)").ss(2, 2, 0).s("#c1c7cd").lt(-c / 2, -d / 2).lt(0, -d / 2).lt(0, -d / 2).lt(+c / 2, -d / 2).lt(+c / 2, +d / 2).lt(-c / 2, +d / 2).cp(); + a.notch.graphics.clear().f("rgba(0,0,1,0.01)").ss(2, 2, 0).s("#c1c7cd").lt(0, -d / 2).lt(0, -d / 2 - 20).cp(); + a.NEHandle.x = +a.width / 2; + a.NEHandle.y = -a.height / 2; + a.NWHandle.x = -a.width / 2; + a.NWHandle.y = -a.height / 2; + a.SWHandle.x = -a.width / 2; + a.SWHandle.y = +a.height / 2; + a.SEHandle.x = +a.width / 2; + a.SEHandle.y = +a.height / 2; + a.EHandle.x = +a.width / 2; + a.EHandle.y = 0; + a.WHandle.x = -a.width / 2; + a.WHandle.y = 0; + a.NHandle.x = 0; + a.NHandle.y = -a.height / 2; + a.SHandle.x = 0; + a.SHandle.y = +a.height / 2; + a.RHandle.x = -2; + a.RHandle.y = -a.height / 2 - 20 - 2; + this.handle.visible && (c = this.selectedObject, this.selectedObject.text ? (c.width = this.selectedObject.width, c.height = this.selectedObject.height) : (c.width = c.image.width, c.height = c.image.height), c.scaleX = a.width / c.width, c.scaleY = a.height / c.height, c.x = a.x, c.y = a.y, c.regX = c.width / 2 + e / c.scaleX, c.regY = c.height / 2 + f / c.scaleY, c.rotation = a.rotation, c.direction = b, this.selectArea.x1 = a.x - a.width / 2, this.selectArea.y1 = a.y - a.height / 2, this.selectArea.x2 = + a.width, this.selectArea.y2 = a.height, this.objectWidthInput.value = Math.abs(c.width * c.scaleX).toFixed(0), this.objectHeightInput.value = Math.abs(c.height * c.scaleY).toFixed(0), this.objectRotateInput.value = (1 * c.rotation).toFixed(0)); + this.updateImageHandleCursor(); + this.stage.update(); + } +}; +Entry.Painter.prototype.updateImageHandleCursor = function() { + var a = this.handle; + a.rect.cursor = "move"; + a.RHandle.cursor = "crosshair"; + for (var b = ["nwse-resize", "ns-resize", "nesw-resize", "ew-resize"], c = Math.floor((a.rotation + 22.5) % 180 / 45), d = 0;d < c;d++) { + b.push(b.shift()); + } + a.NHandle.cursor = b[1]; + a.NEHandle.cursor = b[2]; + a.EHandle.cursor = b[3]; + a.SEHandle.cursor = b[0]; + a.SHandle.cursor = b[1]; + a.SWHandle.cursor = b[2]; + a.WHandle.cursor = b[3]; + a.NWHandle.cursor = b[0]; +}; +Entry.Painter.prototype.clearCanvas = function(a) { + this.clearHandle(); + a || this.initCommand(); + this.objectContainer.removeAllChildren(); + this.stage.update(); + this.colorLayerData = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height); + a = 0; + for (var b = this.colorLayerData.data.length;a < b;a++) { + this.colorLayerData.data[a] = 255, this.colorLayerData.data[a + 1] = 255, this.colorLayerData.data[a + 2] = 255, this.colorLayerData.data[a + 3] = 255; + } + this.reloadContext(); +}; +Entry.Painter.prototype.newPicture = function() { + var a = {dimension:{height:1, width:1}, fileurl:Entry.mediaFilePath + "_1x1.png", name:Lang.Workspace.new_picture}; + a.id = Entry.generateHash(); + Entry.playground.addPicture(a, !0); +}; +Entry.Painter.prototype.initPicture = function() { + var a = this; + Entry.addEventListener("pictureSelected", function(b) { + a.selectToolbox("cursor"); + if (a.file.id !== b.id) { + a.file.modified && confirm("\uc218\uc815\ub41c \ub0b4\uc6a9\uc744 \uc800\uc7a5\ud558\uc2dc\uaca0\uc2b5\ub2c8\uae4c?") && (a.file_ = JSON.parse(JSON.stringify(a.file)), a.file_save(!0)); + a.file.modified = !1; + a.clearCanvas(!0); + var c = new Image; + c.id = b.id ? b.id : Entry.generateHash(); + a.file.id = c.id; + a.file.name = b.name; + a.file.mode = "edit"; + c.src = b.fileurl ? b.fileurl : Entry.defaultPath + "/uploads/" + b.filename.substring(0, 2) + "/" + b.filename.substring(2, 4) + "/image/" + b.filename + ".png"; + c.onload = function(b) { + a.addImage(b.target); + }; + } + }); + Entry.addEventListener("pictureImport", function(b) { + a.addPicture(b); + }); + Entry.addEventListener("pictureNameChanged", function(b) { + a.file.name = b.name; + }); + Entry.addEventListener("pictureClear", function(b) { + a.file.modified = !1; + a.file.id = ""; + a.file.name = ""; + a.clearCanvas(); + }); +}; +Entry.Painter.prototype.initDraw = function() { + var a = this; + this.stage.on("stagemousedown", function(b) { + a.stagemousedown(b); + }); + this.stage.on("stagemouseup", function(b) { + a.stagemouseup(b); + }); + this.stage.on("stagemousemove", function(b) { + a.stagemousemove(b); + }); +}; +Entry.Painter.prototype.selectObject = function(a, b) { + this.selectedObject = a; + this.handle.visible = a.visible; + b ? (this.handle.width = this.copy.width, this.handle.height = this.copy.height, this.handle.x = this.selectArea.x1 + this.copy.width / 2, this.handle.y = this.selectArea.y1 + this.copy.height / 2) : (this.handle.width = a.scaleX * a.image.width, this.handle.height = a.scaleY * a.image.height, this.handle.x = a.x, this.handle.y = a.y, this.handle.regX = +(a.regX - a.image.width / 2) * a.scaleX, this.handle.regY = +(a.regY - a.image.height / 2) * a.scaleY); + this.handle.rotation = a.rotation; + this.handle.direction = 0; + this.updateImageHandle(); +}; +Entry.Painter.prototype.selectTextObject = function(a) { + this.selectedObject = a; + var b = a.getTransformedBounds(); + this.handle.visible = a.visible; + a.width || (this.selectedObject.width = b.width); + a.height || (this.selectedObject.height = b.height); + this.handle.width = a.scaleX * this.selectedObject.width; + this.handle.height = a.scaleY * this.selectedObject.height; + this.handle.x = a.x; + this.handle.y = a.y; + a.regX || (a.regX = a.width / 2); + a.regY || (a.regY = a.height / 2); + this.handle.regX = (a.regX - this.selectedObject.width / 2) * a.scaleX; + this.handle.regY = (a.regY - this.selectedObject.height / 2) * a.scaleY; + this.handle.rotation = a.rotation; + this.handle.direction = 0; + this.updateImageHandle(); +}; +Entry.Painter.prototype.updateHandle = function() { + -1 < this.stage.getChildIndex(this._handle) && this.stage.removeChild(this._handle); + -1 === this.stage.getChildIndex(this.handle) && this.stage.addChild(this.handle); + var a = new createjs.Shape; + a.graphics.clear().beginFill("#000").rect(this.selectArea.x1, this.selectArea.y1, this.selectArea.x2, this.selectArea.y2); + this.handle.rect.hitArea = a; + this.handle.rect.graphics.clear().setStrokeStyle(1, "round").beginStroke("#000000").drawDashedRect(this.selectArea.x1, this.selectArea.y1, this.selectArea.x2, this.selectArea.y2, 4); + this.stage.update(); +}; +Entry.Painter.prototype.updateHandle_ = function() { + this.stage.getChildIndex(-1 < this._handle) && this.stage.addChild(this._handle); + this._handle.rect.graphics.clear().setStrokeStyle(1, "round").beginStroke("#cccccc").drawDashedRect(this.selectArea.x1, this.selectArea.y1, this.selectArea.x2, this.selectArea.y2, 2); + this.stage.update(); +}; +Entry.Painter.prototype.matchTolerance = function(a, b, c, d, e) { + var f = this.colorLayerData.data[a], g = this.colorLayerData.data[a + 1]; + a = this.colorLayerData.data[a + 2]; + return f >= b - e / 100 * b && f <= b + e / 100 * b && g >= c - e / 100 * c && g <= c + e / 100 * c && a >= d - e / 100 * d && a <= d + e / 100 * d; +}; +Entry.Painter.prototype.matchColorOnly = function(a, b, c, d) { + return b === this.colorLayerData.data[a] && c === this.colorLayerData.data[a + 1] && d === this.colorLayerData.data[a + 2] ? !0 : !1; +}; +Entry.Painter.prototype.matchColor = function(a, b, c, d, e) { + return b === this.colorLayerData.data[a] && c === this.colorLayerData.data[a + 1] && d === this.colorLayerData.data[a + 2] && e === this.colorLayerData.data[a + 3] ? !0 : !1; +}; +Entry.Painter.prototype.colorPixel = function(a, b, c, d, e) { + e || (e = 255); + this.stroke.transparent && (e = d = c = b = 0); + this.colorLayerData.data[a] = b; + this.colorLayerData.data[a + 1] = c; + this.colorLayerData.data[a + 2] = d; + this.colorLayerData.data[a + 3] = e; +}; +Entry.Painter.prototype.pickStrokeColor = function(a) { + a = 4 * (Math.round(a.stageY) * this.canvas.width + Math.round(a.stageX)); + this.stroke.lineColor = Entry.rgb2hex(this.colorLayerData.data[a], this.colorLayerData.data[a + 1], this.colorLayerData.data[a + 2]); + document.getElementById("entryPainterAttrCircle").style.backgroundColor = this.stroke.lineColor; + document.getElementById("entryPainterAttrCircleInput").value = this.stroke.lineColor; +}; +Entry.Painter.prototype.drawText = function(a) { + var b = document.getElementById("entryPainterAttrFontStyle").value, c = document.getElementById("entryPainterAttrFontName").value, d = document.getElementById("entryPainterAttrFontSize").value; + a = new createjs.Text(a, b + " " + d + 'px "' + c + '"', this.stroke.lineColor); + a.textBaseline = "top"; + a.x = this.oldPt.x; + a.y = this.oldPt.y; + this.objectContainer.addChild(a); + this.selectTextObject(a); + this.file.modified = !0; +}; +Entry.Painter.prototype.addImage = function(a) { + var b = new createjs.Bitmap(a); + this.objectContainer.addChild(b); + b.x = this.stage.canvas.width / 2; + b.y = this.stage.canvas.height / 2; + b.regX = b.image.width / 2 | 0; + b.regY = b.image.height / 2 | 0; + if (540 < b.image.height) { + var c = 540 / b.image.height; + b.scaleX = c; + b.scaleY = c; + } + b.name = a.id; + b.id = a.id; + this.selectObject(b); + this.stage.update(); +}; +Entry.Painter.prototype.createBrush = function() { + this.initCommand(); + this.brush = new createjs.Shape; + this.objectContainer.addChild(this.brush); + this.stage.update(); +}; +Entry.Painter.prototype.createEraser = function() { + this.initCommand(); + this.eraser = new createjs.Shape; + this.objectContainer.addChild(this.eraser); + this.stage.update(); +}; +Entry.Painter.prototype.clearHandle = function() { + this.handle.visible && (this.handle.visible = !1); + this.coordinator.visible && (this.coordinator.visible = !1); + this.stage.update(); +}; +Entry.Painter.prototype.initCommand = function() { + var a = !1; + this.handle.visible && (a = !0, this.handle.visible = !1); + var b = !1; + this.coordinator.visible && (b = !0, this.coordinator.visible = !1); + (a || b) && this.stage.update(); + this.isCommandValid = !1; + this.colorLayerModel = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height); + Entry.stateManager && this.firstStatement && Entry.stateManager.addCommand("edit sprite", this, this.restorePainter, this.colorLayerModel); + this.firstStatement = !0; + a && (this.handle.visible = !0); + b && (this.coordinator.visible = !0); + (a || b) && this.stage.update(); +}; +Entry.Painter.prototype.doCommand = function() { + this.isCommandValid = !0; +}; +Entry.Painter.prototype.checkCommand = function() { + this.isCommandValid || Entry.dispatchEvent("cancelLastCommand"); +}; +Entry.Painter.prototype.restorePainter = function(a) { + this.clearHandle(); + var b = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height); + this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height); + this.ctx.putImageData(a, 0, 0); + a = new Image; + a.src = this.canvas.toDataURL(); + var c = this; + a.onload = function(b) { + b = new createjs.Bitmap(b.target); + c.objectContainer.removeAllChildren(); + c.objectContainer.addChild(b); + }; + Entry.stateManager && Entry.stateManager.addCommand("restore sprite", this, this.restorePainter, b); +}; +Entry.Painter.prototype.platten = function() { + this.colorLayerData = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height); + this.reloadContext(); +}; +Entry.Painter.prototype.fill = function() { + if (!this.stroke.locked) { + this.stroke.locked = !0; + this.initCommand(); + this.doCommand(); + this.clearHandle(); + var a = this.canvas.width, b = this.canvas.height; + this.colorLayerData = this.ctx.getImageData(0, 0, a, b); + var c = new createjs.Point(this.stage.mouseX, this.stage.mouseY); + c.x = Math.round(c.x); + c.y = Math.round(c.y); + for (var d = 4 * (c.y * a + c.x), e = this.colorLayerData.data[d], f = this.colorLayerData.data[d + 1], g = this.colorLayerData.data[d + 2], h = this.colorLayerData.data[d + 3], k, l, c = [[c.x, c.y]], q = Entry.hex2rgb(this.stroke.lineColor);c.length;) { + for (var d = c.pop(), n = d[0], m = d[1], d = 4 * (m * a + n);0 <= m && this.matchColor(d, e, f, g, h);) { + --m, d -= 4 * a; + } + d += 4 * a; + m += 1; + for (l = k = !1;m < b - 1 && this.matchColor(d, e, f, g, h);) { + m += 1, this.colorPixel(d, q.r, q.g, q.b), 0 < n && (this.matchColor(d - 4, e, f, g, h) ? k || (c.push([n - 1, m]), k = !0) : k && (k = !1)), n < a - 1 && (this.matchColor(d + 4, e, f, g, h) ? l || (c.push([n + 1, m]), l = !0) : l && (l = !1)), d += 4 * a; + } + if (1080 < c.length) { + break; + } + } + this.file.modified = !0; + this.reloadContext(); + } +}; +Entry.Painter.prototype.reloadContext = function() { + delete this.selectedObject; + this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height); + this.ctx.putImageData(this.colorLayerData, 0, 0); + var a = new Image; + a.src = this.canvas.toDataURL(); + var b = this; + a.onload = function(a) { + a = new createjs.Bitmap(a.target); + b.objectContainer.removeAllChildren(); + b.objectContainer.addChild(a); + b.stroke.locked = !1; + }; +}; +Entry.Painter.prototype.move_pen = function() { + var a = new createjs.Point(this.oldPt.x + this.stage.mouseX >> 1, this.oldPt.y + this.stage.mouseY >> 1); + this.brush.graphics.setStrokeStyle(this.stroke.thickness, "round").beginStroke(this.stroke.lineColor).moveTo(a.x, a.y).curveTo(this.oldPt.x, this.oldPt.y, this.oldMidPt.x, this.oldMidPt.y); + this.oldPt.x = this.stage.mouseX; + this.oldPt.y = this.stage.mouseY; + this.oldMidPt.x = a.x; + this.oldMidPt.y = a.y; + this.file.modified = !0; + this.stage.update(); +}; +Entry.Painter.prototype.move_line = function() { + this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness, "round").moveTo(this.oldPt.x, this.oldPt.y).lineTo(this.stage.mouseX, this.stage.mouseY); + this.file.modified = !0; + this.stage.update(); +}; +Entry.Painter.prototype.move_rect = function() { + var a = this.stage.mouseX - this.oldPt.x, b = this.stage.mouseY - this.oldPt.y; + event.shiftKey && (b = a); + this.stroke.fill ? 0 === this.stroke.thickness ? this.brush.graphics.clear().setStrokeStyle(this.stroke.thickness, "round").beginFill(this.stroke.fillColor).drawRect(this.oldPt.x, this.oldPt.y, a, b) : this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness, "round").beginFill(this.stroke.fillColor).drawRect(this.oldPt.x, this.oldPt.y, a, b) : 0 === this.stroke.thickness ? this.brush.graphics.clear().setStrokeStyle(this.stroke.thickness, "round").drawRect(this.oldPt.x, + this.oldPt.y, a, b) : this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness, "round").drawRect(this.oldPt.x, this.oldPt.y, a, b); + this.file.modified = !0; + this.stage.update(); +}; +Entry.Painter.prototype.move_circle = function() { + var a = this.stage.mouseX - this.oldPt.x, b = this.stage.mouseY - this.oldPt.y; + event.shiftKey && (b = a); + this.stroke.fill ? 0 === this.stroke.thickness ? this.brush.graphics.clear().beginStroke(this.stroke.fillColor).setStrokeStyle(this.stroke.thickness, "round").beginFill(this.stroke.fillColor).drawEllipse(this.oldPt.x, this.oldPt.y, a, b) : this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness, "round").beginFill(this.stroke.fillColor).drawEllipse(this.oldPt.x, this.oldPt.y, a, b) : this.stroke.fill || (0 === this.stroke.thickness ? this.brush.graphics.clear().drawEllipse(this.oldPt.x, + this.oldPt.y, a, b) : this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness, "round").drawEllipse(this.oldPt.x, this.oldPt.y, a, b)); + this.file.modified = !0; + this.stage.update(); +}; +Entry.Painter.prototype.edit_copy = function() { + this.selectArea ? (this.clearHandle(), this.selectedObject && delete this.selectedObject, this.copyLayerData = this.ctx.getImageData(this.selectArea.x1, this.selectArea.y1, this.selectArea.x2, this.selectArea.y2), this.copy = {}, this.copy.width = this.selectArea.x2, this.copy.height = this.selectArea.y2, this.canvas_.width = this.copy.width, this.canvas_.height = this.copy.height, this.ctx_.clearRect(0, 0, this.canvas_.width, this.canvas_.height), this.ctx_.putImageData(this.copyLayerData, 0, + 0)) : alert("\ubcf5\uc0ac\ud560 \uc601\uc5ed\uc744 \uc120\ud0dd\ud558\uc138\uc694."); +}; +Entry.Painter.prototype.edit_cut = function() { + this.selectArea ? (this.clearHandle(), this.selectedObject && delete this.selectedObject, this.copyLayerData = this.ctx.getImageData(this.selectArea.x1, this.selectArea.y1, this.selectArea.x2, this.selectArea.y2), this.copy = {}, this.copy.width = this.selectArea.x2, this.copy.height = this.selectArea.y2, this.canvas_.width = this.copy.width, this.canvas_.height = this.copy.height, this.ctx_.clearRect(0, 0, this.canvas_.width, this.canvas_.height), this.ctx_.putImageData(this.copyLayerData, 0, + 0), this.ctx.clearRect(this.selectArea.x1, this.selectArea.y1, this.selectArea.x2, this.selectArea.y2), this.colorLayerData = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height), this.reloadContext(), this.file.modified = !0) : alert("\uc790\ub97c \uc601\uc5ed\uc744 \uc120\ud0dd\ud558\uc138\uc694."); +}; +Entry.Painter.prototype.edit_paste = function() { + var a = new Image; + a.src = this.canvas_.toDataURL(); + var b = this; + a.onload = function(a) { + a = new createjs.Bitmap(a.target); + a.x = b.canvas.width / 2; + a.y = b.canvas.height / 2; + a.regX = b.copy.width / 2 | 0; + a.regY = b.copy.height / 2 | 0; + a.id = Entry.generateHash(); + b.objectContainer.addChild(a); + b.selectObject(a, !0); + }; + this.file.modified = !0; +}; +Entry.Painter.prototype.edit_select = function() { + this.clearHandle(); + this.selectedObject && delete this.selectedObject; + this.copyLayerData = this.ctx.getImageData(this.selectArea.x1, this.selectArea.y1, this.selectArea.x2, this.selectArea.y2); + this.copy = {}; + this.copy.width = this.selectArea.x2; + this.copy.height = this.selectArea.y2; + this.canvas_.width = this.copy.width; + this.canvas_.height = this.copy.height; + this.ctx_.clearRect(0, 0, this.canvas_.width, this.canvas_.height); + this.ctx_.putImageData(this.copyLayerData, 0, 0); + this.ctx.clearRect(this.selectArea.x1, this.selectArea.y1, this.selectArea.x2, this.selectArea.y2); + this.colorLayerData = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height); + this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height); + this.ctx.putImageData(this.colorLayerData, 0, 0); + var a = new Image; + a.src = this.canvas.toDataURL(); + var b = this; + a.onload = function(a) { + a = new createjs.Bitmap(a.target); + b.objectContainer.removeAllChildren(); + b.objectContainer.addChild(a); + a = new Image; + a.src = b.canvas_.toDataURL(); + a.onload = function(a) { + a = new createjs.Bitmap(a.target); + a.x = b.selectArea.x1 + b.copy.width / 2; + a.y = b.selectArea.y1 + b.copy.height / 2; + a.regX = b.copy.width / 2 | 0; + a.regY = b.copy.height / 2 | 0; + a.id = Entry.generateHash(); + a.name = a.id; + b.objectContainer.addChild(a); + b.selectObject(a, !0); + }; + }; +}; +Entry.Painter.prototype.move_erase = function(a) { + a = new createjs.Point(this.oldPt.x + this.stage.mouseX >> 1, this.oldPt.y + this.stage.mouseY >> 1); + this.eraser.graphics.setStrokeStyle(this.stroke.thickness, "round").beginStroke("#ffffff").moveTo(a.x, a.y).curveTo(this.oldPt.x, this.oldPt.y, this.oldMidPt.x, this.oldMidPt.y); + this.oldPt.x = this.stage.mouseX; + this.oldPt.y = this.stage.mouseY; + this.oldMidPt.x = a.x; + this.oldMidPt.y = a.y; + this.file.modified = !0; + this.stage.update(); +}; +Entry.Painter.prototype.settingShapeBlur = function() { + this.objectWidthInput.blur(); + this.objectHeightInput.blur(); + this.objectRotateInput.blur(); +}; +Entry.Painter.prototype.stagemousedown = function(a) { + "picture" == Entry.playground.getViewMode() && (this.settingShapeBlur(), this.oldPt = new createjs.Point(a.stageX, a.stageY), this.oldMidPt = this.oldPt.clone(), "select" === this.toolbox.selected ? this.stage.addChild(this._handle) : "spoid" === this.toolbox.selected ? this.pickStrokeColor(a) : "text" === this.toolbox.selected ? (this.showInputField(a), this.stage.update()) : "erase" === this.toolbox.selected ? (this.createEraser(), this.stroke.enabled = !0) : "fill" === this.toolbox.selected ? + this.fill() : "cursor" !== this.toolbox.selected && (this.createBrush(), this.stroke.enabled = !0)); +}; +Entry.Painter.prototype.stagemousemove = function(a) { + "picture" == Entry.playground.getViewMode() && ("select" === this.toolbox.selected && -1 < this.stage.getChildIndex(this._handle) ? (this.selectArea.x1 = this.oldPt.x, this.selectArea.y1 = this.oldPt.y, this.selectArea.x2 = a.stageX - this.oldPt.x, this.selectArea.y2 = a.stageY - this.oldPt.y, this.updateHandle_()) : this.stroke.enabled && (this.doCommand(), "pen" === this.toolbox.selected ? this.move_pen(a) : "line" === this.toolbox.selected ? this.move_line(a) : "rect" === this.toolbox.selected ? + this.move_rect(a) : "circle" === this.toolbox.selected ? this.move_circle(a) : "erase" === this.toolbox.selected && this.move_erase(a)), this.painterTopStageXY.innerHTML = "x:" + a.stageX.toFixed(1) + ", y:" + a.stageY.toFixed(1)); +}; +Entry.Painter.prototype.stagemouseup = function(a) { + "picture" == Entry.playground.getViewMode() && ("select" === this.toolbox.selected ? (this.selectArea.x1 = this.oldPt.x, this.selectArea.y1 = this.oldPt.y, this.selectArea.x2 = a.stageX - this.oldPt.x, this.selectArea.y2 = a.stageY - this.oldPt.y, this.stage.removeChild(this._handle), this.stage.update(), 0 < this.selectArea.x2 && 0 < this.selectArea.y2 && this.edit_select(), this.selectToolbox("cursor")) : "cursor" !== this.toolbox.selected && this.stroke.enabled && (-1 < this.objectContainer.getChildIndex(this.eraser) && + this.eraser.graphics.endStroke(), -1 < this.objectContainer.getChildIndex(this.brush) && this.brush.graphics.endStroke(), this.clearHandle(), this.platten(), this.stroke.enabled = !1, this.checkCommand())); +}; +Entry.Painter.prototype.file_save = function(a) { + this.clearHandle(); + this.transparent(); + this.trim(); + var b = this.canvas_.toDataURL(); + Entry.dispatchEvent("saveCanvasImage", {file:a ? this.file_ : this.file, image:b}); + this.file.modified = !1; +}; +Entry.Painter.prototype.transparent = function() { + var a = this.canvas.width, b = this.canvas.height; + this.colorLayerData = this.ctx.getImageData(0, 0, a, b); + var c = a * (b - 1) * 4, d = 4 * (a - 1), e = 4 * (a * b - 1); + this.matchColorOnly(0, 255, 255, 255) ? this.fillTransparent(1, 1) : this.matchColorOnly(c, 255, 255, 255) ? this.fillTransparent(1, b) : this.matchColorOnly(d, 255, 255, 255) ? this.fillTransparent(a, 1) : this.matchColorOnly(e, 255, 255, 255) && this.fillTransparent(a, b); +}; +Entry.Painter.prototype.fillTransparent = function(a, b) { + this.stage.mouseX = a; + this.stage.mouseY = b; + this.stroke.transparent = !0; + this.fill(); +}; +Entry.Painter.prototype.trim = function() { + var a = this.canvas.width, b = this.ctx.getImageData(0, 0, a, this.canvas.height), c = b.data.length, d, e = null, f = null, g = null, h = null, k; + for (d = 0;d < c;d += 4) { + 0 !== b.data[d + 3] && (g = d / 4 % a, k = ~~(d / 4 / a), null === e && (e = k), null === f ? f = g : g < f && (f = g), null === h ? h = k : h < k && (h = k)); + } + a = h - e; + b = g - f; + 0 === a || 0 === b ? (e = this.ctx.getImageData(0, 0, 1, 1), e.data[0] = 255, e.data[1] = 255, e.data[2] = 255, e.data[3] = 255, this.canvas_.width = 1, this.canvas_.height = 1) : (e = this.ctx.getImageData(f, e, b, a), this.canvas_.width = b, this.canvas_.height = a); + this.ctx_.putImageData(e, 0, 0); +}; +Entry.Painter.prototype.showInputField = function(a) { + this.inputField ? (Entry.dispatchEvent("textUpdate"), delete this.inputField) : (this.initCommand(), this.doCommand(), this.inputField = new CanvasInput({canvas:document.getElementById("entryPainterCanvas"), fontSize:20, fontFamily:this.font.name, fontColor:"#000", width:650, padding:8, borderWidth:1, borderColor:"#000", borderRadius:3, boxShadow:"1px 1px 0px #fff", innerShadow:"0px 0px 5px rgba(0, 0, 0, 0.5)", x:a.stageX, y:a.stageY, onsubmit:function() { + Entry.dispatchEvent("textUpdate"); + }}), this.inputField.show()); +}; +Entry.Painter.prototype.addPicture = function(a) { + this.initCommand(); + var b = new Image; + b.id = Entry.generateHash(); + b.src = a.fileurl ? a.fileurl : Entry.defaultPath + "/uploads/" + a.filename.substring(0, 2) + "/" + a.filename.substring(2, 4) + "/image/" + a.filename + ".png"; + var c = this; + b.onload = function(b) { + c.addImage(b.target); + c.selectToolbox("cursor"); + }; +}; +Entry.Painter.prototype.initCoordinator = function() { + var a = new createjs.Container, b = new createjs.Bitmap(Entry.mediaFilePath + "/workspace_coordinate.png"); + a.addChild(b); + this.stage.addChild(a); + a.visible = !1; + this.coordinator = a; +}; +Entry.Painter.prototype.toggleCoordinator = function() { + this.coordinator.visible = !this.coordinator.visible; + this.stage.update(); +}; +Entry.Painter.prototype.initDashedLine = function() { + createjs.Graphics.prototype.dashedLineTo = function(a, b, c, d, e) { + this.moveTo(a, b); + var f = c - a, g = d - b; + e = Math.floor(Math.sqrt(f * f + g * g) / e); + for (var f = f / e, g = g / e, h = 0;h++ < e;) { + a += f, b += g, this[0 === h % 2 ? "moveTo" : "lineTo"](a, b); + } + this[0 === h % 2 ? "moveTo" : "lineTo"](c, d); + return this; + }; + createjs.Graphics.prototype.drawDashedRect = function(a, b, c, d, e) { + this.moveTo(a, b); + c = a + c; + d = b + d; + this.dashedLineTo(a, b, c, b, e); + this.dashedLineTo(c, b, c, d, e); + this.dashedLineTo(c, d, a, d, e); + this.dashedLineTo(a, d, a, b, e); + return this; + }; + createjs.Graphics.prototype.drawResizableDashedRect = function(a, b, c, d, e, f) { + this.moveTo(a, b); + c = a + c; + d = b + d; + this.dashedLineTo(a + f, b, c - f, b, e); + this.dashedLineTo(c, b + f, c, d - f, e); + this.dashedLineTo(c - f, d, a + f, d, e); + this.dashedLineTo(a, d - f, a, b + f, e); + return this; + }; +}; +Entry.Painter.prototype.generateView = function(a) { + var b = this; + this.view_ = a; + if (!Entry.type || "workspace" == Entry.type) { + this.view_.addClass("entryPainterWorkspace"); + var c = Entry.createElement("div", "entryPainterTop"); + c.addClass("entryPlaygroundPainterTop"); + this.view_.appendChild(c); + var d = Entry.createElement("div", "entryPainterToolbox"); + d.addClass("entryPlaygroundPainterToolbox"); + this.view_.appendChild(d); + var e = Entry.createElement("div", "entryPainterToolboxTop"); + e.addClass("entryPainterToolboxTop"); + d.appendChild(e); + var f = Entry.createElement("div", "entryPainterContainer"); + f.addClass("entryPlaygroundPainterContainer"); + this.view_.appendChild(f); + e = Entry.createElement("canvas", "entryPainterCanvas"); + e.width = 960; + e.height = 540; + e.addClass("entryPlaygroundPainterCanvas"); + f.appendChild(e); + e = Entry.createElement("canvas", "entryPainterCanvas_"); + e.addClass("entryRemove"); + e.width = 960; + e.height = 540; + f.appendChild(e); + var g = Entry.createElement("div", "entryPainterAttr"); + g.addClass("entryPlaygroundPainterAttr"); + this.view_.appendChild(g); + this.flipObject = Entry.createElement("div", "entryPictureFlip"); + this.flipObject.addClass("entryPlaygroundPainterFlip"); + g.appendChild(this.flipObject); + e = Entry.createElement("div", "entryPictureFlipX"); + e.title = "\uc88c\uc6b0\ub4a4\uc9d1\uae30"; + e.bindOnClick(function() { + b.selectedObject && (b.selectedObject.scaleX *= -1, b.selectedObject.text ? b.selectTextObject(b.selectedObject) : b.selectObject(b.selectedObject), b.updateImageHandle(), b.stage.update()); + }); + e.addClass("entryPlaygroundPainterFlipX"); + this.flipObject.appendChild(e); + e = Entry.createElement("div", "entryPictureFlipY"); + e.title = "\uc0c1\ud558\ub4a4\uc9d1\uae30"; + e.bindOnClick(function() { + b.selectedObject && (b.selectedObject.scaleY *= -1, b.selectedObject.text ? b.selectTextObject(b.selectedObject) : b.selectObject(b.selectedObject), b.updateImageHandle(), b.stage.update()); + }); + e.addClass("entryPlaygroundPainterFlipY"); + this.flipObject.appendChild(e); + Entry.addEventListener("windowResized", function(b) { + var c = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; + b = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; + var d = parseInt(document.getElementById("entryCanvas").style.width), c = c - (d + 240), d = b - 349; + a.style.width = c + "px"; + f.style.width = c - 54 + "px"; + f.style.height = d + "px"; + g.style.top = d + 30 + "px"; + g.style.height = b - d + "px"; + }); + var h = Entry.createElement("nav", "entryPainterTopMenu"); + h.addClass("entryPlaygroundPainterTopMenu"); + c.appendChild(h); + e = Entry.createElement("ul"); + h.appendChild(e); + var k = Entry.createElement("li"); + h.appendChild(k); + h = Entry.createElement("a", "entryPainterTopMenuFileNew"); + h.bindOnClick(function() { + b.newPicture(); + }); + h.addClass("entryPlaygroundPainterTopMenuFileNew"); + h.innerHTML = Lang.Workspace.new_picture; + k.appendChild(h); + h = Entry.createElement("li", "entryPainterTopMenuFile"); + h.addClass("entryPlaygroundPainterTopMenuFile"); + h.innerHTML = Lang.Workspace.painter_file; + e.appendChild(h); + k = Entry.createElement("ul"); + h.appendChild(k); + h = Entry.createElement("li"); + k.appendChild(h); + var l = Entry.createElement("a", "entryPainterTopMenuFileSave"); + l.bindOnClick(function() { + b.file_save(!1); + }); + l.addClass("entryPainterTopMenuFileSave"); + l.innerHTML = Lang.Workspace.painter_file_save; + h.appendChild(l); + h = Entry.createElement("li"); + k.appendChild(h); + k = Entry.createElement("a", "entryPainterTopMenuFileSaveAs"); + k.bindOnClick(function() { + b.file.mode = "new"; + b.file_save(!1); + }); + k.addClass("entryPlaygroundPainterTopMenuFileSaveAs"); + k.innerHTML = Lang.Workspace.painter_file_saveas; + h.appendChild(k); + k = Entry.createElement("li", "entryPainterTopMenuEdit"); + k.addClass("entryPlaygroundPainterTopMenuEdit"); + k.innerHTML = Lang.Workspace.painter_edit; + e.appendChild(k); + e = Entry.createElement("ul"); + k.appendChild(e); + k = Entry.createElement("li"); + e.appendChild(k); + h = Entry.createElement("a", "entryPainterTopMenuEditImportLink"); + h.bindOnClick(function() { + Entry.dispatchEvent("openPictureImport"); + }); + h.addClass("entryPainterTopMenuEditImport"); + h.innerHTML = Lang.Workspace.get_file; + k.appendChild(h); + k = Entry.createElement("li"); + e.appendChild(k); + h = Entry.createElement("a", "entryPainterTopMenuEditCopy"); + h.bindOnClick(function() { + b.edit_copy(); + }); + h.addClass("entryPlaygroundPainterTopMenuEditCopy"); + h.innerHTML = Lang.Workspace.copy_file; + k.appendChild(h); + k = Entry.createElement("li"); + e.appendChild(k); + h = Entry.createElement("a", "entryPainterTopMenuEditCut"); + h.bindOnClick(function() { + b.edit_cut(); + }); + h.addClass("entryPlaygroundPainterTopMenuEditCut"); + h.innerHTML = Lang.Workspace.cut_picture; + k.appendChild(h); + k = Entry.createElement("li"); + e.appendChild(k); + h = Entry.createElement("a", "entryPainterTopMenuEditPaste"); + h.bindOnClick(function() { + b.edit_paste(); + }); + h.addClass("entryPlaygroundPainterTopMenuEditPaste"); + h.innerHTML = Lang.Workspace.paste_picture; + k.appendChild(h); + k = Entry.createElement("li"); + e.appendChild(k); + e = Entry.createElement("a", "entryPainterTopMenuEditEraseAll"); + e.addClass("entryPlaygroundPainterTopMenuEditEraseAll"); + e.innerHTML = Lang.Workspace.remove_all; + e.bindOnClick(function() { + b.clearCanvas(); + }); + k.appendChild(e); + this.painterTopStageXY = e = Entry.createElement("div", "entryPainterTopStageXY"); + e.addClass("entryPlaygroundPainterTopStageXY"); + c.appendChild(e); + e = Entry.createElement("ul", "entryPainterTopToolbar"); + e.addClass("entryPlaygroundPainterTopToolbar"); + c.appendChild(e); + c = Entry.createElement("li", "entryPainterTopToolbarUndo"); + c.bindOnClick(function() { + }); + c.addClass("entryPlaygroundPainterTopToolbar"); + e.appendChild(c); + c = Entry.createElement("li", "entryPainterTopToolbarRedo"); + c.bindOnClick(function() { + }); + c.addClass("entryPlaygroundPainterTopToolbar"); + e.appendChild(c); + c = Entry.createElement("ul"); + c.addClass("entryPlaygroundPainterToolboxContainer"); + d.appendChild(c); + this.toolboxCursor = Entry.createElement("li", "entryPainterToolboxCursor"); + this.toolboxCursor.title = "\uc774\ub3d9"; + this.toolboxCursor.bindOnClick(function() { + b.selectToolbox("cursor"); + }); + this.toolboxCursor.addClass("entryPlaygroundPainterToolboxCursor"); + c.appendChild(this.toolboxCursor); + this.toolboxSelect = Entry.createElement("li", "entryPainterToolboxSelect"); + this.toolboxSelect.title = "\uc790\ub974\uae30"; + this.toolboxSelect.bindOnClick(function() { + b.selectToolbox("select"); + }); + this.toolboxSelect.addClass("entryPlaygroundPainterToolboxSelect"); + c.appendChild(this.toolboxSelect); + this.toolboxPen = Entry.createElement("li", "entryPainterToolboxPen"); + this.toolboxPen.title = "\ud39c"; + this.toolboxPen.bindOnClick(function() { + b.selectToolbox("pen"); + }); + this.toolboxPen.addClass("entryPlaygroundPainterToolboxPen"); + c.appendChild(this.toolboxPen); + this.toolboxLine = Entry.createElement("li", "entryPainterToolboxLine"); + this.toolboxLine.title = "\uc9c1\uc120"; + this.toolboxLine.bindOnClick(function() { + b.selectToolbox("line"); + }); + this.toolboxLine.addClass("entryPlaygroundPainterToolboxLine"); + c.appendChild(this.toolboxLine); + this.toolboxRect = Entry.createElement("li", "entryPainterToolboxRect"); + this.toolboxRect.title = "\uc0ac\uac01\ud615"; + this.toolboxRect.bindOnClick(function() { + b.selectToolbox("rect"); + }); + this.toolboxRect.addClass("entryPlaygroundPainterToolboxRect"); + c.appendChild(this.toolboxRect); + this.toolboxCircle = Entry.createElement("li", "entryPainterToolboxCircle"); + this.toolboxCircle.title = "\uc6d0"; + this.toolboxCircle.bindOnClick(function() { + b.selectToolbox("circle"); + }); + this.toolboxCircle.addClass("entryPlaygroundPainterToolboxCircle"); + c.appendChild(this.toolboxCircle); + this.toolboxText = Entry.createElement("li", "entryPainterToolboxText"); + this.toolboxText.title = "\uae00\uc0c1\uc790"; + this.toolboxText.bindOnClick(function() { + b.selectToolbox("text"); + }); + this.toolboxText.addClass("entryPlaygroundPainterToolboxText"); + c.appendChild(this.toolboxText); + this.toolboxFill = Entry.createElement("li", "entryPainterToolboxFill"); + this.toolboxFill.bindOnClick(function() { + b.selectToolbox("fill"); + }); + this.toolboxFill.addClass("entryPlaygroundPainterToolboxFill"); + c.appendChild(this.toolboxFill); + this.toolboxErase = Entry.createElement("li", "entryPainterToolboxErase"); + this.toolboxErase.title = "\uc9c0\uc6b0\uae30"; + this.toolboxErase.bindOnClick(function() { + b.selectToolbox("erase"); + }); + this.toolboxErase.addClass("entryPlaygroundPainterToolboxErase"); + c.appendChild(this.toolboxErase); + d = Entry.createElement("li", "entryPainterToolboxCoordinate"); + d.title = "\uc88c\ud45c"; + d.bindOnClick(function() { + b.toggleCoordinator(); + }); + d.addClass("entryPlaygroundPainterToolboxCoordinate"); + c.appendChild(d); + this.attrResizeArea = Entry.createElement("fieldset", "painterAttrResize"); + this.attrResizeArea.addClass("entryPlaygroundPainterAttrResize"); + g.appendChild(this.attrResizeArea); + d = Entry.createElement("legend"); + d.innerHTML = Lang.Workspace.picture_size; + this.attrResizeArea.appendChild(d); + d = Entry.createElement("div", "painterAttrWrapper"); + d.addClass("painterAttrWrapper"); + this.attrResizeArea.appendChild(d); + c = Entry.createElement("div"); + c.addClass("entryPlaygroundPainterAttrResizeX"); + d.appendChild(c); + e = Entry.createElement("div"); + e.addClass("entryPlaygroundPainterAttrResizeXTop"); + e.innerHTML = "X"; + c.appendChild(e); + this.objectWidthInput = Entry.createElement("input", "entryPainterAttrWidth"); + this.objectWidthInput.onblur = function() { + if (isNaN(this.value)) { + return alert("\uc22b\uc790\ub9cc \uc785\ub825 \uac00\ub2a5\ud569\ub2c8\ub2e4."), !1; } - if (this.syntax.BasicIf[d]) { - return Array.isArray(b) || "object" !== typeof b || (b = [b]), {type:this.syntax.BasicIf[d], statements:[b]}; + b.handle.width = this.value; + b.updateImageHandle(); + }; + this.objectWidthInput.addClass("entryPlaygroundPainterNumberInput"); + c.appendChild(this.objectWidthInput); + c = Entry.createElement("div"); + c.addClass("entryPlaygroundPainterSizeText"); + c.innerHTML = "x"; + d.appendChild(c); + c = Entry.createElement("div"); + c.addClass("entryPlaygroundAttrReiszeY"); + d.appendChild(c); + d = Entry.createElement("div"); + d.addClass("entryPlaygroundPainterAttrResizeYTop"); + d.innerHTML = "Y"; + c.appendChild(d); + this.objectHeightInput = Entry.createElement("input", "entryPainterAttrHeight"); + this.objectHeightInput.onblur = function() { + if (isNaN(this.value)) { + return alert("\uc22b\uc790\ub9cc \uc785\ub825 \uac00\ub2a5\ud569\ub2c8\ub2e4."), !1; } - throw Error(); - } catch (f) { - throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a.test}; - } - }; -})(Entry.JSParser.prototype); -Entry.Parser = function(b, a, c) { - this._mode = b; - this.syntax = {}; - 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)); - this.mappingSyntax(b); - switch(this._lang) { - case "js": - this._parser = new Entry.JSParser(this.syntax); - a = this.syntax; - var d = {}, e; - for (e in a.Scope) { - d[e + "();\n"] = a.Scope[e]; + b.handle.height = this.value; + b.updateImageHandle(); + }; + this.objectHeightInput.addClass("entryPlaygroundPainterNumberInput"); + c.appendChild(this.objectHeightInput); + this.attrRotateArea = Entry.createElement("div", "painterAttrRotateArea"); + this.attrRotateArea.addClass("painterAttrRotateArea"); + g.appendChild(this.attrRotateArea); + d = Entry.createElement("div"); + d.addClass("painterAttrRotateName"); + d.innerHTML = Lang.Workspace.picture_rotation; + this.attrRotateArea.appendChild(d); + d = Entry.createElement("fieldset", "entryPainterAttrRotate"); + d.addClass("entryPlaygroundPainterAttrRotate"); + this.attrRotateArea.appendChild(d); + c = Entry.createElement("div"); + c.addClass("painterAttrRotateTop"); + c.innerHTML = "\u03bf"; + d.appendChild(c); + this.objectRotateInput = Entry.createElement("input", "entryPainterAttrDegree"); + this.objectRotateInput.onblur = function() { + if (isNaN(this.value)) { + return alert("\uc22b\uc790\ub9cc \uc785\ub825 \uac00\ub2a5\ud569\ub2c8\ub2e4."), !1; } - "BasicIf" in a && (d.front = "BasicIf"); - CodeMirror.commands.javascriptComplete = function(a) { - CodeMirror.showHint(a, null, {globalScope:d}); - }; - c.on("keyup", function(a, b) { - !a.state.completionActive && 65 <= b.keyCode && 95 >= b.keyCode && CodeMirror.showHint(a, null, {completeSingle:!1, globalScope:d}); + 360 <= this.value ? this.value %= 360 : 0 > this.value && (this.value = 360 + this.value % 360); + b.handle.rotation = this.value; + b.updateImageHandle(); + }; + this.objectRotateInput.addClass("entryPlaygroundPainterNumberInput"); + this.objectRotateInput.defaultValue = "0"; + d.appendChild(this.objectRotateInput); + this.attrColorArea = Entry.createElement("fieldset", "entryPainterAttrColor"); + this.attrColorArea.addClass("entryPlaygroundPainterAttrColor"); + g.appendChild(this.attrColorArea); + var q = Entry.createElement("div"); + q.addClass("entryPlaygroundPainterAttrColorContainer"); + this.attrColorArea.appendChild(q); + this.attrCircleArea = Entry.createElement("div"); + this.attrCircleArea.addClass("painterAttrCircleArea"); + g.appendChild(this.attrCircleArea); + d = Entry.createElement("div", "entryPainterAttrCircle"); + d.addClass("painterAttrCircle"); + this.attrCircleArea.appendChild(d); + this.attrCircleArea.painterAttrCircle = d; + d = Entry.createElement("input", "entryPainterAttrCircleInput"); + d.value = "#000000"; + d.addClass("painterAttrCircleInput"); + this.attrCircleArea.appendChild(d); + this.attrColorSpoid = Entry.createElement("div"); + this.attrColorSpoid.bindOnClick(function() { + b.selectToolbox("spoid"); + }); + this.attrColorSpoid.addClass("painterAttrColorSpoid"); + g.appendChild(this.attrColorSpoid); + Entry.getColourCodes().forEach(function(a) { + var c = Entry.createElement("div"); + c.addClass("entryPlaygroundPainterAttrColorElement"); + "transparent" === a ? c.style.backgroundImage = "url(" + (Entry.mediaFilePath + "/transparent.png") + ")" : c.style.backgroundColor = a; + c.bindOnClick(function(c) { + "transparent" === a ? (b.stroke.transparent = !0, b.stroke.lineColor = "#ffffff") : (b.stroke.transparent = !1, r && (document.getElementById("entryPainterShapeBackgroundColor").style.backgroundColor = a, b.stroke.fillColor = a), r || (document.getElementById("entryPainterShapeLineColor").style.backgroundColor = a, b.stroke.lineColor = a)); + document.getElementById("entryPainterAttrCircle").style.backgroundColor = b.stroke.lineColor; + document.getElementById("entryPainterAttrCircleInput").value = a; }); - 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 < b.indexOf("function") ? b + a : a + b; - return d + "\n"; - }) : ""; + q.appendChild(c); + }); + this.attrThickArea = Entry.createElement("div", "painterAttrThickArea"); + this.attrThickArea.addClass("entryPlaygroundentryPlaygroundPainterAttrThickArea"); + g.appendChild(this.attrThickArea); + d = Entry.createElement("legend"); + d.addClass("painterAttrThickName"); + d.innerHTML = Lang.Workspace.thickness; + this.attrThickArea.appendChild(d); + var n = Entry.createElement("fieldset", "entryPainterAttrThick"); + n.addClass("entryPlaygroundPainterAttrThick"); + this.attrThickArea.appendChild(n); + d = Entry.createElement("div"); + d.addClass("paintAttrThickTop"); + n.appendChild(d); + e = Entry.createElement("select", "entryPainterAttrThick"); + e.addClass("entryPlaygroundPainterAttrThickInput"); + e.size = "1"; + e.onchange = function(a) { + b.stroke.thickness = a.target.value; + }; + for (d = 1;10 >= d;d++) { + c = Entry.createElement("option"), c.value = d, c.innerHTML = d, e.appendChild(c); } - return b; - }; - b.getLineNumber = function(a, b) { - var d = this.codeMirror.getValue(), e = {from:{}, to:{}}, f = d.substring(0, a).split(/\n/gi); - e.from.line = f.length - 1; - e.from.ch = f[f.length - 1].length; - d = d.substring(0, b).split(/\n/gi); - e.to.line = d.length - 1; - e.to.ch = d[d.length - 1].length; - return e; - }; - b.mappingSyntax = function(a) { - for (var b = Object.keys(Entry.block), d = 0;d < b.length;d++) { - var e = b[d], f = Entry.block[e]; - if (f.mode === a && -1 < this.availableCode.indexOf(e) && (f = f.syntax)) { - for (var g = this.syntax, h = 0;h < f.length;h++) { - var k = f[h]; - if (h === f.length - 2 && "function" === typeof f[h + 1]) { - g[k] = f[h + 1]; - break; - } - g[k] || (g[k] = {}); - h === f.length - 1 ? g[k] = e : g = g[k]; - } - } + n.appendChild(e); + d = Entry.createElement("div", "entryPainterShapeLineColor"); + d.addClass("painterAttrShapeLineColor"); + c = Entry.createElement("div", "entryPainterShapeInnerBackground"); + c.addClass("painterAttrShapeInnerBackground"); + d.appendChild(c); + n.appendChild(d); + this.attrThickArea.painterAttrShapeLineColor = d; + n.bindOnClick(function() { + m.style.zIndex = "1"; + this.style.zIndex = "10"; + r = !1; + }); + this.attrBackgroundArea = Entry.createElement("div", "painterAttrBackgroundArea"); + this.attrBackgroundArea.addClass("entryPlaygroundPainterBackgroundArea"); + g.appendChild(this.attrBackgroundArea); + d = Entry.createElement("fieldset", "entryPainterAttrbackground"); + d.addClass("entryPlaygroundPainterAttrBackground"); + this.attrBackgroundArea.appendChild(d); + c = Entry.createElement("div"); + c.addClass("paintAttrBackgroundTop"); + d.appendChild(c); + var m = Entry.createElement("div", "entryPainterShapeBackgroundColor"); + m.addClass("painterAttrShapeBackgroundColor"); + this.attrBackgroundArea.painterAttrShapeBackgroundColor = m; + c.appendChild(m); + var r = !1; + m.bindOnClick(function(b) { + n.style.zIndex = "1"; + this.style.zIndex = "10"; + r = !0; + }); + this.attrFontArea = Entry.createElement("div", "painterAttrFont"); + this.attrFontArea.addClass("entryPlaygroundPainterAttrFont"); + g.appendChild(this.attrFontArea); + e = Entry.createElement("div"); + e.addClass("entryPlaygroundPainterAttrTop"); + this.attrFontArea.appendChild(e); + d = Entry.createElement("div"); + d.addClass("entryPlaygroundPaintAttrTop_"); + e.appendChild(d); + d = Entry.createElement("legend"); + d.addClass("panterAttrFontTitle"); + d.innerHTML = Lang.Workspace.textStyle; + k = Entry.createElement("select", "entryPainterAttrFontName"); + k.addClass("entryPlaygroundPainterAttrFontName"); + k.size = "1"; + k.onchange = function(a) { + b.font.name = a.target.value; + }; + for (d = 0;d < Entry.fonts.length;d++) { + h = Entry.fonts[d], c = Entry.createElement("option"), c.value = h.family, c.innerHTML = h.name, k.appendChild(c); + } + e.appendChild(k); + e = Entry.createElement("div"); + e.addClass("painterAttrFontSizeArea"); + this.attrFontArea.appendChild(e); + d = Entry.createElement("div"); + d.addClass("painterAttrFontSizeTop"); + e.appendChild(d); + k = Entry.createElement("select", "entryPainterAttrFontSize"); + k.addClass("entryPlaygroundPainterAttrFontSize"); + k.size = "1"; + k.onchange = function(a) { + b.font.size = a.target.value; + }; + for (d = 20;72 >= d;d++) { + c = Entry.createElement("option"), c.value = d, c.innerHTML = d, k.appendChild(c); + } + e.appendChild(k); + e = Entry.createElement("div"); + e.addClass("entryPlaygroundPainterAttrFontStyleArea"); + this.attrFontArea.appendChild(e); + d = Entry.createElement("div"); + d.addClass("entryPlaygroundPainterAttrFontTop"); + e.appendChild(d); + k = Entry.createElement("select", "entryPainterAttrFontStyle"); + k.addClass("entryPlaygroundPainterAttrFontStyle"); + k.size = "1"; + k.onchange = function(a) { + b.font.style = a.target.value; + }; + h = [{label:"\ubcf4\ud1b5", value:"normal"}, {label:"\uad75\uac8c", value:"bold"}, {label:"\uae30\uc6b8\uc784", value:"italic"}]; + for (d = 0;d < h.length;d++) { + l = h[d], c = Entry.createElement("option"), c.value = l.value, c.innerHTML = l.label, k.appendChild(c); } - }; - b.setAvailableCode = function(a, b) { - var d = []; - a.forEach(function(a, b) { - a.forEach(function(a, b) { - d.push(a.type); - }); + e.appendChild(k); + this.attrLineArea = Entry.createElement("div", "painterAttrLineStyle"); + this.attrLineArea.addClass("entryPlaygroundPainterAttrLineStyle"); + g.appendChild(this.attrLineArea); + var u = Entry.createElement("div"); + u.addClass("entryPlaygroundPainterAttrLineStyleLine"); + this.attrLineArea.appendChild(u); + var t = Entry.createElement("div"); + t.addClass("entryPlaygroundPaitnerAttrLineArea"); + this.attrLineArea.appendChild(t); + d = Entry.createElement("div"); + d.addClass("entryPlaygroundPainterAttrLineStyleLine1"); + t.appendChild(d); + d.value = "line"; + var v = Entry.createElement("div"); + v.addClass("painterAttrLineStyleBackgroundLine"); + u.bindOnClick(function(b) { + t.removeClass("entryRemove"); }); - b instanceof Entry.Code ? b.getBlockList().forEach(function(a) { - a.type !== NtryData.START && -1 === d.indexOf(a.type) && d.push(a.type); - }) : b.forEach(function(a, b) { - a.forEach(function(a, b) { - a.type !== NtryData.START && -1 === d.indexOf(a.type) && d.push(a.type); - }); + t.blur = function(b) { + this.addClass("entryRemove"); + }; + t.onmouseleave = function(b) { + this.addClass("entryRemove"); + }; + d.bindOnClick(function(b) { + this.attrLineArea.removeClass(u); + this.attrLineArea.appendChild(v); + this.attrLineArea.onchange(b); + t.blur(); }); - this.availableCode = this.availableCode.concat(d); - }; -})(Entry.Parser.prototype); -Entry.Pdf = function(b) { - this.generateView(b); -}; -p = Entry.Pdf.prototype; -p.generateView = function(b) { - var a = Entry.createElement("div", "entryPdfWorkspace"); - a.addClass("entryRemove"); - this._view = a; - var c = "/pdfjs/web/viewer.html"; - b && "" != b && (c += "?file=" + b); - pdfViewIframe = Entry.createElement("iframe", "entryPdfIframeWorkspace"); - pdfViewIframe.setAttribute("id", "pdfViewIframe"); - pdfViewIframe.setAttribute("frameborder", 0); - pdfViewIframe.setAttribute("src", c); - a.appendChild(pdfViewIframe); -}; -p.getView = function() { - return this._view; -}; -p.resize = function() { - var b = document.getElementById("entryContainerWorkspaceId"), a = document.getElementById("pdfViewIframe"); - w = b.offsetWidth; - a.width = w + "px"; - a.height = 9 * w / 16 + "px"; -}; -Entry.Popup = function() { - Entry.assert(!window.popup, "Popup exist"); - this.body_ = Entry.createElement("div"); - this.body_.addClass("entryPopup"); - this.body_.bindOnClick(function(b) { - b.target == this && this.popup.remove(); - }); - this.body_.popup = this; - document.body.appendChild(this.body_); - this.window_ = Entry.createElement("div"); - this.window_.addClass("entryPopupWindow"); - this.window_.bindOnClick(function() { - }); - Entry.addEventListener("windowResized", this.resize); - window.popup = this; - this.resize(); - this.body_.appendChild(this.window_); -}; -Entry.Popup.prototype.remove = function() { - for (;this.window_.hasChildNodes();) { - "workspace" == Entry.type ? Entry.view_.insertBefore(this.window_.firstChild, Entry.container.view_) : Entry.view_.insertBefore(this.window_.lastChild, Entry.view_.firstChild); + v.bindOnClick(function(b) { + t.removeClass("entryRemove"); + }); + this.attrLineArea.onchange = function(a) { + b.stroke.style = a.target.value; + }; + t.blur(); } - $("body").css("overflow", "auto"); - Entry.removeElement(this.body_); - window.popup = null; - Entry.removeEventListener("windowResized", this.resize); - Entry.engine.popup = null; }; -Entry.Popup.prototype.resize = function(b) { - b = window.popup.window_; - var a = .9 * window.innerWidth, c = .9 * window.innerHeight - 35; - 9 * a <= 16 * c ? c = a / 16 * 9 : a = 16 * c / 9; - b.style.width = String(a) + "px"; - b.style.height = String(c + 35) + "px"; +Entry.Painter.prototype.restoreHandle = function() { + this.selectedObject && !1 === this.handle.visible && (this.handle.visible = !0, this.stage.update()); }; -Entry.popupHelper = function(b) { - this.popupList = {}; - this.nowContent; - b && (window.popupHelper = null); - Entry.assert(!window.popupHelper, "Popup exist"); - var a = ["confirm", "spinner"], c = ["entryPopupHelperTopSpan", "entryPopupHelperBottomSpan", "entryPopupHelperLeftSpan", "entryPopupHelperRightSpan"]; - this.body_ = Entry.Dom("div", {classes:["entryPopup", "hiddenPopup", "popupHelper"]}); - var d = this; - this.body_.bindOnClick(function(b) { - if (!(d.nowContent && -1 < a.indexOf(d.nowContent.prop("type")))) { - var f = $(b.target); - c.forEach(function(a) { - f.hasClass(a) && this.popup.hide(); - }.bind(this)); - b.target == this && this.popup.hide(); - } - }); - window.popupHelper = this; - this.body_.prop("popup", this); - Entry.Dom("div", {class:"entryPopupHelperTopSpan", parent:this.body_}); - b = Entry.Dom("div", {class:"entryPopupHelperMiddleSpan", parent:this.body_}); - Entry.Dom("div", {class:"entryPopupHelperBottomSpan", parent:this.body_}); - Entry.Dom("div", {class:"entryPopupHelperLeftSpan", parent:b}); - this.window_ = Entry.Dom("div", {class:"entryPopupHelperWindow", parent:b}); - Entry.Dom("div", {class:"entryPopupHelperRightSpan", parent:b}); - $("body").append(this.body_); +Entry.Painter.prototype.initDisplay = function() { + this.stroke.enabled = !1; + this.toolboxCursor.addClass("entryPlaygroundPainterToolboxCursor"); + this.toolboxCursor.removeClass("entryToolboxCursorClicked"); + this.toolboxSelect.addClass("entryPlaygroundPainterToolboxSelect"); + this.toolboxSelect.removeClass("entryToolboxSelectClicked"); + this.toolboxPen.addClass("entryPlaygroundPainterToolboxPen"); + this.toolboxPen.removeClass("entryToolboxPenClicked"); + this.toolboxLine.addClass("entryPlaygroundPainterToolboxLine"); + this.toolboxLine.removeClass("entryToolboxLineClicked"); + this.toolboxRect.addClass("entryPlaygroundPainterToolboxRect"); + this.toolboxRect.removeClass("entryToolboxRectClicked"); + this.toolboxCircle.addClass("entryPlaygroundPainterToolboxCircle"); + this.toolboxCircle.removeClass("entryToolBoxCircleClicked"); + this.toolboxText.addClass("entryPlaygroundPainterToolboxText"); + this.toolboxText.removeClass("entryToolBoxTextClicked"); + this.toolboxFill.addClass("entryPlaygroundPainterToolboxFill"); + this.toolboxFill.removeClass("entryToolBoxFillClicked"); + this.toolboxErase.addClass("entryPlaygroundPainterToolboxErase"); + this.toolboxErase.removeClass("entryToolBoxEraseClicked"); + this.attrColorSpoid.addClass("painterAttrColorSpoid"); + this.attrColorSpoid.removeClass("painterAttrColorSpoidClicked"); + this.attrResizeArea.addClass("entryRemove"); + this.attrRotateArea.addClass("entryRemove"); + this.attrThickArea.addClass("entryRemove"); + this.attrFontArea.addClass("entryRemove"); + this.attrLineArea.addClass("entryRemove"); + this.attrColorArea.addClass("entryRemove"); + this.attrCircleArea.addClass("entryRemove"); + this.attrColorSpoid.addClass("entryRemove"); + this.attrFontArea.addClass("entryRemove"); + this.attrBackgroundArea.addClass("entryRemove"); + this.flipObject.addClass("entryRemove"); + this.attrThickArea.painterAttrShapeLineColor.addClass("entryRemove"); + this.attrBackgroundArea.painterAttrShapeBackgroundColor.addClass("entryRemove"); + this.attrCircleArea.painterAttrCircle.addClass("entryRemove"); + this.inputField && !this.inputField._isHidden && (this.inputField.hide(), this.stage.update()); }; -Entry.popupHelper.prototype.clearPopup = function() { - for (var b = this.popupWrapper_.children.length - 1;2 < b;b--) { - this.popupWrapper_.removeChild(this.popupWrapper_.children[b]); +Entry.Painter.prototype.selectToolbox = function(a) { + this.toolbox.selected = a; + "erase" != a && $(".entryPlaygroundPainterContainer").removeClass("dd"); + this.initDisplay(); + "cursor" !== a && this.clearHandle(); + "text" !== a && this.inputField && delete this.inputField; + switch(a) { + case "cursor": + this.restoreHandle(); + this.toolboxCursor.addClass("entryToolboxCursorClicked"); + this.attrResizeArea.removeClass("entryRemove"); + this.attrRotateArea.removeClass("entryRemove"); + this.flipObject.removeClass("entryRemove"); + break; + case "select": + this.toolboxSelect.addClass("entryToolboxSelectClicked"); + break; + case "pen": + this.toolboxPen.addClass("entryToolboxPenClicked"); + this.attrThickArea.removeClass("entryRemove"); + this.attrColorArea.removeClass("entryRemove"); + this.attrCircleArea.removeClass("entryRemove"); + this.attrColorSpoid.removeClass("entryRemove"); + this.attrThickArea.painterAttrShapeLineColor.removeClass("entryRemove"); + break; + case "line": + this.toolboxLine.addClass("entryToolboxLineClicked"); + this.attrThickArea.removeClass("entryRemove"); + this.attrColorArea.removeClass("entryRemove"); + this.attrCircleArea.removeClass("entryRemove"); + this.attrColorSpoid.removeClass("entryRemove"); + this.attrThickArea.painterAttrShapeLineColor.removeClass("entryRemove"); + break; + case "rect": + this.toolboxRect.addClass("entryToolboxRectClicked"); + this.attrThickArea.removeClass("entryRemove"); + this.attrColorArea.removeClass("entryRemove"); + this.attrCircleArea.removeClass("entryRemove"); + this.attrColorSpoid.removeClass("entryRemove"); + this.attrBackgroundArea.removeClass("entryRemove"); + this.attrThickArea.painterAttrShapeLineColor.removeClass("entryRemove"); + this.attrBackgroundArea.painterAttrShapeBackgroundColor.removeClass("entryRemove"); + break; + case "circle": + this.toolboxCircle.addClass("entryToolBoxCircleClicked"); + this.attrThickArea.removeClass("entryRemove"); + this.attrColorArea.removeClass("entryRemove"); + this.attrCircleArea.removeClass("entryRemove"); + this.attrColorSpoid.removeClass("entryRemove"); + this.attrThickArea.painterAttrShapeLineColor.removeClass("entryRemove"); + this.attrBackgroundArea.removeClass("entryRemove"); + this.attrBackgroundArea.painterAttrShapeBackgroundColor.removeClass("entryRemove"); + break; + case "text": + this.toolboxText.addClass("entryToolBoxTextClicked"); + this.attrFontArea.removeClass("entryRemove"); + this.attrColorArea.removeClass("entryRemove"); + this.attrCircleArea.removeClass("entryRemove"); + this.attrColorSpoid.removeClass("entryRemove"); + this.attrCircleArea.painterAttrCircle.removeClass("entryRemove"); + break; + case "fill": + this.toolboxFill.addClass("entryToolBoxFillClicked"); + this.attrColorArea.removeClass("entryRemove"); + this.attrCircleArea.removeClass("entryRemove"); + this.attrColorSpoid.removeClass("entryRemove"); + this.attrCircleArea.painterAttrCircle.removeClass("entryRemove"); + break; + case "erase": + $(".entryPlaygroundPainterContainer").addClass("dd"); + this.toolboxErase.addClass("entryToolBoxEraseClicked"); + this.attrThickArea.removeClass("entryRemove"); + break; + case "spoid": + this.attrColorArea.removeClass("entryRemove"); + this.attrCircleArea.removeClass("entryRemove"); + this.attrColorSpoid.removeClass("entryRemove"); + this.attrColorSpoid.removeClass("painterAttrColorSpoid"); + this.attrColorSpoid.addClass("painterAttrColorSpoidClicked"); + break; + case "coordinate": + this.toggleCoordinator(); } }; -Entry.popupHelper.prototype.addPopup = function(b, a) { - var c = Entry.Dom("div"), d = Entry.Dom("div", {class:"entryPopupHelperCloseButton"}); - d.bindOnClick(function() { - a.closeEvent ? a.closeEvent(this) : this.hide(); - }.bind(this)); - var e = Entry.Dom("div", {class:"entryPopupHelperWrapper"}); - e.append(d); - a.title && (d = Entry.Dom("div", {class:"entryPopupHelperTitle"}), e.append(d), d.text(a.title)); - c.addClass(b); - c.append(e); - c.popupWrapper_ = e; - c.prop("type", a.type); - "function" === typeof a.setPopupLayout && a.setPopupLayout(c); - this.popupList[b] = c; -}; -Entry.popupHelper.prototype.hasPopup = function(b) { - return !!this.popupList[b]; -}; -Entry.popupHelper.prototype.setPopup = function(b) { -}; -Entry.popupHelper.prototype.remove = function(b) { - 0 < this.window_.children().length && this.window_.children().remove(); - this.window_.remove(); - delete this.popupList[b]; - this.nowContent = void 0; - this.body_.addClass("hiddenPopup"); -}; -Entry.popupHelper.prototype.resize = function(b) { -}; -Entry.popupHelper.prototype.show = function(b) { - 0 < this.window_.children().length && this.window_.children().detach(); - this.window_.append(this.popupList[b]); - this.nowContent = this.popupList[b]; - this.body_.removeClass("hiddenPopup"); -}; -Entry.popupHelper.prototype.hide = function() { - this.nowContent = void 0; - this.body_.addClass("hiddenPopup"); -}; -Entry.getStartProject = function(b) { - return {category:"\uae30\ud0c0", scenes:[{name:"\uc7a5\uba74 1", id:"7dwq"}], variables:[{name:"\ucd08\uc2dc\uacc4", id:"brih", visible:!1, value:"0", variableType:"timer", x:150, y:-70, array:[], object:null, isCloud:!1}, {name:"\ub300\ub2f5", id:"1vu8", visible:!1, value:"0", variableType:"answer", x:150, y:-100, array:[], object:null, isCloud:!1}], objects:[{id:"7y0y", name:"\uc5d4\ud2b8\ub9ac\ubd07", script:[[{type:"when_run_button_click", x:40, y:50}, {type:"repeat_basic", statements:[[{type:"move_direction"}]]}]], - selectedPictureId:"vx80", objectType:"sprite", rotateMethod:"free", scene:"7dwq", sprite:{sounds:[{duration:1.3, ext:".mp3", id:"8el5", fileurl:b + "media/bark.mp3", name:"\uac15\uc544\uc9c0 \uc9d6\ub294\uc18c\ub9ac"}], pictures:[{id:"vx80", fileurl:b + "media/entrybot1.png", name:Lang.Blocks.walking_entryBot + "1", scale:100, dimension:{width:284, height:350}}, {id:"4t48", fileurl:b + "media/entrybot2.png", name:Lang.Blocks.walking_entryBot + "2", scale:100, dimension:{width:284, height:350}}]}, - entity:{x:0, y:0, regX:142, regY:175, scaleX:.3154574132492113, scaleY:.3154574132492113, rotation:0, direction:90, width:284, height:350, visible:!0}, lock:!1, active:!0}], speed:60}; -}; -Entry.PropertyPanel = function() { - this.modes = {}; - this.selected = null; +Entry.BlockParser = function(a) { + this.syntax = a; + this._iterVariableCount = 0; + this._iterVariableChunk = ["i", "j", "k"]; }; -(function(b) { - b.generateView = function(a, b) { - this._view = Entry.Dom("div", {class:"propertyPanel", parent:$(a)}); - this._tabView = Entry.Dom("div", {class:"propertyTab", parent:this._view}); - this._contentView = Entry.Dom("div", {class:"propertyContent", parent:this._view}); - this._cover = Entry.Dom("div", {classes:["propertyPanelCover", "entryRemove"], parent:this._view}); - var d = Entry.Dom("div", {class:"entryObjectSelectedImgWorkspace", parent:this._view}); - this.initializeSplitter(d); +(function(a) { + a.Code = function(b) { + if (b instanceof Entry.Thread) { + return this.Thread(b); + } + if (b instanceof Entry.Block) { + return this.Block(b); + } + var a = ""; + b = b.getThreads(); + for (var d = 0;d < b.length;d++) { + a += this.Thread(b[d]); + } + return a; + }; + a.Thread = function(b) { + if (b instanceof Entry.Block) { + return this.Block(b); + } + var a = ""; + b = b.getBlocks(); + for (var d = 0;d < b.length;d++) { + a += this.Block(b[d]); + } + return a; + }; + a.Block = function(b) { + var a = b._schema.syntax; + return a ? this[a[0]](b) : ""; + }; + a.Program = function(b) { + return ""; }; - b.addMode = function(a, b) { - var d = b.getView(), d = Entry.Dom(d, {parent:this._contentView}), e = Entry.Dom("
" + Lang.Menus[a] + "
", {classes:["propertyTabElement", "propertyTab" + a], parent:this._tabView}), f = this; - e.bind("click", function() { - f.select(a); - }); - this.modes[a] && (this.modes[a].tabDom.remove(), this.modes[a].contentDom.remove(), "hw" == a && ($(this.modes).removeClass(".propertyTabhw"), $(".propertyTabhw").unbind("dblclick"))); - this.modes[a] = {obj:b, tabDom:e, contentDom:d}; - "hw" == a && $(".propertyTabhw").bind("dblclick", function() { - Entry.dispatchEvent("hwModeChange"); - }); + a.Scope = function(b) { + b = b._schema.syntax.concat(); + return b.splice(1, b.length - 1).join(".") + "();\n"; }; - b.resize = function(a) { - this._view.css({width:a + "px", top:9 * a / 16 + 123 - 22 + "px"}); - 430 <= a ? this._view.removeClass("collapsed") : this._view.addClass("collapsed"); - Entry.dispatchEvent("windowResized"); - a = this.selected; - "hw" == a ? this.modes.hw.obj.listPorts ? this.modes[a].obj.resizeList() : this.modes[a].obj.resize() : this.modes[a].obj.resize(); + a.BasicFunction = function(b) { + b = this.Thread(b.statements[0]); + return "function promise() {\n" + this.indent(b) + "}\n"; }; - b.select = function(a) { - for (var b in this.modes) { - var d = this.modes[b]; - d.tabDom.removeClass("selected"); - d.contentDom.addClass("entryRemove"); - d.obj.visible = !1; - } - b = this.modes[a]; - b.tabDom.addClass("selected"); - b.contentDom.removeClass("entryRemove"); - b.obj.resize && b.obj.resize(); - b.obj.visible = !0; - this.selected = a; + a.BasicIteration = function(b) { + var a = b.params[0], d = this.publishIterateVariable(); + b = this.Thread(b.statements[0]); + this.unpublishIterateVariable(); + return "for (var " + d + " = 0; " + d + " < " + a + "; " + d + "++){\n" + this.indent(b) + "}\n"; }; - b.initializeSplitter = function(a) { - var b = this; - a.bind("mousedown touchstart", function(a) { - b._cover.removeClass("entryRemove"); - Entry.container.disableSort(); - Entry.container.splitterEnable = !0; - Entry.documentMousemove && (Entry.container.resizeEvent = Entry.documentMousemove.attach(this, function(a) { - Entry.container.splitterEnable && Entry.resizeElement({canvasWidth:a.clientX || a.x}); - })); - }); - $(document).bind("mouseup touchend", function(a) { - if (a = Entry.container.resizeEvent) { - Entry.container.splitterEnable = !1, Entry.documentMousemove.detach(a), b._cover.addClass("entryRemove"), delete Entry.container.resizeEvent; - } - Entry.container.enableSort(); - }); + a.BasicIf = function(b) { + var a = this.Thread(b.statements[0]); + return "if (" + b._schema.syntax.concat()[1] + ") {\n" + this.indent(a) + "}\n"; }; -})(Entry.PropertyPanel.prototype); -Entry.init = function(b, a) { - Entry.assert("object" === typeof a, "Init option is not object"); - this.events_ = {}; - this.interfaceState = {menuWidth:264}; - Entry.Utils.bindGlobalEvent("resize mousedown mousemove keydown keyup dispose".split(" ")); - this.options = a; - this.parseOptions(a); - this.mediaFilePath = (a.libDir ? a.libDir : "/lib") + "/entryjs/images/"; - this.defaultPath = a.defaultDir || ""; - this.blockInjectPath = a.blockInjectDir || ""; - "workspace" == this.type && this.isPhone() && (this.type = "phone"); - this.initialize_(); - this.view_ = b; - this.view_.setAttribute("class", "entry"); - Entry.initFonts(a.fonts); - this.createDom(b, this.type); - this.loadInterfaceState(); - this.overridePrototype(); - this.maxCloneLimit = 302; - this.cloudSavable = !0; - this.startTime = (new Date).getTime(); - document.onkeydown = function(a) { - Entry.dispatchEvent("keyPressed", a); + a.BasicWhile = function(b) { + var a = this.Thread(b.statements[0]); + return "while (" + b._schema.syntax.concat()[1] + ") {\n" + this.indent(a) + "}\n"; }; - document.onkeyup = function(a) { - Entry.dispatchEvent("keyUpped", a); + a.indent = function(b) { + var a = " "; + b = b.split("\n"); + b.pop(); + return a += b.join("\n ") + "\n"; + }; + a.publishIterateVariable = function() { + var b = "", a = this._iterVariableCount; + do { + b = this._iterVariableChunk[a % 3] + b, a = parseInt(a / 3) - 1, 0 === a && (b = this._iterVariableChunk[0] + b); + } while (0 < a); + this._iterVariableCount++; + return b; }; - window.onresize = function(a) { - Entry.dispatchEvent("windowResized", a); + a.unpublishIterateVariable = function() { + this._iterVariableCount && this._iterVariableCount--; }; - window.onbeforeunload = this.beforeUnload; - Entry.addEventListener("saveWorkspace", function(a) { - Entry.addActivity("save"); - }); - "IE" != Entry.getBrowserType().substr(0, 2) || window.flashaudio ? createjs.Sound.registerPlugins([createjs.WebAudioPlugin]) : (createjs.FlashAudioPlugin.swfPath = this.mediaFilePath + "media/", createjs.Sound.registerPlugins([createjs.FlashAudioPlugin]), window.flashaudio = !0); - Entry.soundQueue = new createjs.LoadQueue; - Entry.soundQueue.installPlugin(createjs.Sound); - Entry.loadAudio_([Entry.mediaFilePath + "sounds/click.mp3", Entry.mediaFilePath + "sounds/click.wav", Entry.mediaFilePath + "sounds/click.ogg"], "entryMagneting"); - Entry.loadAudio_([Entry.mediaFilePath + "sounds/delete.mp3", Entry.mediaFilePath + "sounds/delete.ogg", Entry.mediaFilePath + "sounds/delete.wav"], "entryDelete"); - createjs.Sound.stop(); +})(Entry.BlockParser.prototype); +Entry.JSParser = function(a) { + this.syntax = a; + this.scopeChain = []; + this.scope = null; }; -Entry.loadAudio_ = function(b, a) { - if (window.Audio && b.length) { - for (;0 < b.length;) { - var c = b[0]; - c.match(/\/([^.]+)./); - Entry.soundQueue.loadFile({id:a, src:c, type:createjs.LoadQueue.SOUND}); - break; +(function(a) { + a.Program = function(b) { + var a = [], d = []; + d.push({type:this.syntax.Program}); + var e = this.initScope(b), d = d.concat(this.BlockStatement(b)); + this.unloadScope(); + a.push(d); + return a = a.concat(e); + }; + a.Identifier = function(b, a) { + return a ? a[b.name] : this.scope[b.name]; + }; + a.ExpressionStatement = function(b) { + b = b.expression; + return this[b.type](b); + }; + a.ForStatement = function(b) { + var a = b.init, d = b.test, e = b.update, f = b.body; + if (this.syntax.ForStatement) { + throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; } - } -}; -Entry.initialize_ = function() { - this.stage = new Entry.Stage; - Entry.engine && Entry.engine.clearTimer(); - this.engine = new Entry.Engine; - this.propertyPanel = new Entry.PropertyPanel; - this.container = new Entry.Container; - this.helper = new Entry.Helper; - this.youtube = new Entry.Youtube; - this.variableContainer = new Entry.VariableContainer; - this.commander = new Entry.Commander(this.type); - this.scene = new Entry.Scene; - this.playground = new Entry.Playground; - this.toast = new Entry.Toast; - this.hw && this.hw.closeConnection(); - this.hw = new Entry.HW; - if (Entry.enableActivityLogging) { - this.reporter = new Entry.Reporter(!1); - } else { - if ("workspace" == this.type || "phone" == this.type) { - this.reporter = new Entry.Reporter(!0); + var f = this[f.type](f), a = a.declarations[0].init.value, g = d.operator, d = d.right.value, h = 0; + "++" != e.operator && (e = a, a = d, d = e); + switch(g) { + case "<": + h = d - a; + break; + case "<=": + h = d + 1 - a; + break; + case ">": + h = a - d; + break; + case ">=": + h = a + 1 - d; } - } -}; -Entry.createDom = function(b, a) { - if (a && "workspace" != a) { - "minimize" == a ? (c = Entry.createElement("canvas"), c.className = "entryCanvasWorkspace", c.id = "entryCanvas", c.width = 640, c.height = 360, d = Entry.createElement("div", "entryCanvasWrapper"), d.appendChild(c), b.appendChild(d), this.canvas_ = c, this.stage.initStage(this.canvas_), d = Entry.createElement("div"), b.appendChild(d), this.engineView = d, this.engine.generateView(this.engineView, a)) : "phone" == a && (this.stateManagerView = c = Entry.createElement("div"), this.stateManager.generateView(this.stateManagerView, - a), d = Entry.createElement("div"), b.appendChild(d), this.engineView = d, this.engine.generateView(this.engineView, a), c = Entry.createElement("canvas"), c.addClass("entryCanvasPhone"), c.id = "entryCanvas", c.width = 640, c.height = 360, d.insertBefore(c, this.engine.footerView_), this.canvas_ = c, this.stage.initStage(this.canvas_), c = Entry.createElement("div"), b.appendChild(c), this.containerView = c, this.container.generateView(this.containerView, a), c = Entry.createElement("div"), - b.appendChild(c), this.playgroundView = c, this.playground.generateView(this.playgroundView, a)); - } else { - Entry.documentMousedown.attach(this, this.cancelObjectEdit); - var c = Entry.createElement("div"); - b.appendChild(c); - this.sceneView = c; - this.scene.generateView(this.sceneView, a); - c = Entry.createElement("div"); - this.sceneView.appendChild(c); - this.stateManagerView = c; - this.stateManager.generateView(this.stateManagerView, a); - var d = Entry.createElement("div"); - b.appendChild(d); - this.engineView = d; - this.engine.generateView(this.engineView, a); - c = Entry.createElement("canvas"); - c.addClass("entryCanvasWorkspace"); - c.id = "entryCanvas"; - c.width = 640; - c.height = 360; - d.insertBefore(c, this.engine.addButton); - c.addEventListener("mousewheel", function(a) { - var b = Entry.variableContainer.getListById(Entry.stage.mouseCoordinate); - a = 0 < a.wheelDelta ? !0 : !1; - for (var c = 0;c < b.length;c++) { - var d = b[c]; - d.scrollButton_.y = a ? 46 <= d.scrollButton_.y ? d.scrollButton_.y - 23 : 23 : d.scrollButton_.y + 23; - d.updateView(); + return this.BasicIteration(b, h, f); + }; + a.BlockStatement = function(b) { + var a = []; + b = b.body; + for (var d = 0;d < b.length;d++) { + var e = b[d], f = this[e.type](e); + if (f) { + if (void 0 === f.type) { + throw {message:"\ud574\ub2f9\ud558\ub294 \ube14\ub85d\uc774 \uc5c6\uc2b5\ub2c8\ub2e4.", node:e}; + } + f && a.push(f); } - }); - this.canvas_ = c; - this.stage.initStage(this.canvas_); - c = Entry.createElement("div"); - this.propertyPanel.generateView(b, a); - this.containerView = c; - this.container.generateView(this.containerView, a); - this.propertyPanel.addMode("object", this.container); - this.helper.generateView(this.containerView, a); - this.propertyPanel.addMode("helper", this.helper); - c = Entry.createElement("div"); - b.appendChild(c); - this.playgroundView = c; - this.playground.generateView(this.playgroundView, a); - this.propertyPanel.select("object"); - this.helper.bindWorkspace(this.playground.mainWorkspace); - } -}; -Entry.start = function(b) { - this.FPS || (this.FPS = 60); - Entry.assert("number" == typeof this.FPS, "FPS must be number"); - Entry.engine.start(this.FPS); -}; -Entry.parseOptions = function(b) { - this.type = b.type; - this.projectSaveable = b.projectsaveable; - void 0 === this.projectSaveable && (this.projectSaveable = !0); - this.objectAddable = b.objectaddable; - void 0 === this.objectAddable && (this.objectAddable = !0); - this.objectEditable = b.objectEditable; - void 0 === this.objectEditable && (this.objectEditable = !0); - this.objectEditable || (this.objectAddable = !1); - this.objectDeletable = b.objectdeletable; - void 0 === this.objectDeletable && (this.objectDeletable = !0); - this.soundEditable = b.soundeditable; - void 0 === this.soundEditable && (this.soundEditable = !0); - this.pictureEditable = b.pictureeditable; - void 0 === this.pictureEditable && (this.pictureEditable = !0); - this.sceneEditable = b.sceneEditable; - void 0 === this.sceneEditable && (this.sceneEditable = !0); - this.functionEnable = b.functionEnable; - void 0 === this.functionEnable && (this.functionEnable = !0); - this.messageEnable = b.messageEnable; - void 0 === this.messageEnable && (this.messageEnable = !0); - this.variableEnable = b.variableEnable; - void 0 === this.variableEnable && (this.variableEnable = !0); - this.listEnable = b.listEnable; - void 0 === this.listEnable && (this.listEnable = !0); - this.hasVariableManager = b.hasvariablemanager; - this.variableEnable || this.messageEnable || this.listEnable || this.functionEnable ? void 0 === this.hasVariableManager && (this.hasVariableManager = !0) : this.hasVariableManager = !1; - this.isForLecture = b.isForLecture; -}; -Entry.initFonts = function(b) { - this.fonts = b; - b || (this.fonts = []); -}; -Entry.Reporter = function(b) { - this.projectId = this.userId = null; - this.isRealTime = b; - this.activities = []; -}; -Entry.Reporter.prototype.start = function(b, a, c) { - this.isRealTime && (-1 < window.location.href.indexOf("localhost") ? this.io = io("localhost:7000") : this.io = io("play04.play-entry.com:7000"), this.io.emit("activity", {message:"start", userId:a, projectId:b, time:c})); - this.userId = a; - this.projectId = b; -}; -Entry.Reporter.prototype.report = function(b) { - if (!this.isRealTime || this.io) { - var a = [], c; - for (c in b.params) { - var d = b.params[c]; - "object" !== typeof d ? a.push(d) : d.id && a.push(d.id); } - b = {message:b.message, userId:this.userId, projectId:this.projectId, time:b.time, params:a}; - this.isRealTime ? this.io.emit("activity", b) : this.activities.push(b); - } -}; -Entry.Scene = function() { - var b = this; - this.scenes_ = []; - this.selectedScene = null; - this.maxCount = 20; - $(window).on("resize", function(a) { - b.resize(); - }); -}; -Entry.Scene.viewBasicWidth = 70; -Entry.Scene.prototype.generateView = function(b, a) { - var c = this; - this.view_ = b; - this.view_.addClass("entryScene"); - if (!a || "workspace" == a) { - this.view_.addClass("entrySceneWorkspace"); - $(this.view_).on("mousedown", function(a) { - var b = $(this).offset(), d = $(window), h = a.pageX - b.left + d.scrollLeft(); - a = a.pageY - b.top + d.scrollTop(); - a = 40 - a; - b = -40 / 55; - d = $(c.selectedScene.view).find(".entrySceneRemoveButtonCoverWorkspace").offset().left; - !(h < d || h > d + 55) && a > 40 + b * (h - d) && (h = c.getNextScene()) && (h = $(h.view), $(document).trigger("mouseup"), h.trigger("mousedown")); - }); - var d = Entry.createElement("ul"); - d.addClass("entrySceneListWorkspace"); - Entry.sceneEditable && $ && $(d).sortable({start:function(a, b) { - b.item.data("start_pos", b.item.index()); - $(b.item[0]).clone(!0); - }, stop:function(a, b) { - var c = b.item.data("start_pos"), d = b.item.index(); - Entry.scene.moveScene(c, d); - }, axis:"x", tolerance:"pointer"}); - this.view_.appendChild(d); - this.listView_ = d; - Entry.sceneEditable && (d = Entry.createElement("span"), d.addClass("entrySceneElementWorkspace"), d.addClass("entrySceneAddButtonWorkspace"), d.bindOnClick(function(a) { - Entry.engine.isState("run") || Entry.scene.addScene(); - }), this.view_.appendChild(d), this.addButton_ = d); - } -}; -Entry.Scene.prototype.generateElement = function(b) { - var a = this, c = Entry.createElement("li", b.id); - c.addClass("entrySceneElementWorkspace"); - c.addClass("entrySceneButtonWorkspace"); - c.addClass("minValue"); - $(c).on("mousedown", function(a) { - Entry.engine.isState("run") ? a.preventDefault() : Entry.scene.selectScene(b); - }); - var d = Entry.createElement("input"); - d.addClass("entrySceneFieldWorkspace"); - d.value = b.name; - Entry.sceneEditable || (d.disabled = "disabled"); - var e = Entry.createElement("span"); - e.addClass("entrySceneLeftWorkspace"); - c.appendChild(e); - var f = Entry.createElement("span"); - f.addClass("entrySceneInputCover"); - f.style.width = Entry.computeInputWidth(b.name); - c.appendChild(f); - b.inputWrapper = f; - d.onkeyup = function(c) { - c = c.keyCode; - Entry.isArrowOrBackspace(c) || (b.name = this.value, f.style.width = Entry.computeInputWidth(b.name), a.resize(), 13 == c && this.blur(), 10 < this.value.length && (this.value = this.value.substring(0, 10), this.blur())); + return a; }; - d.onblur = function(a) { - d.value = this.value; - b.name = this.value; - f.style.width = Entry.computeInputWidth(b.name); + a.EmptyStatement = function(b) { + throw {message:"empty\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; }; - f.appendChild(d); - e = Entry.createElement("span"); - e.addClass("entrySceneRemoveButtonCoverWorkspace"); - c.appendChild(e); - if (Entry.sceneEditable) { - var g = Entry.createElement("button"); - g.addClass("entrySceneRemoveButtonWorkspace"); - g.innerHTML = "x"; - g.scene = b; - g.bindOnClick(function(a) { - a.stopPropagation(); - Entry.engine.isState("run") || confirm(Lang.Workspace.will_you_delete_scene) && Entry.scene.removeScene(this.scene); - }); - e.appendChild(g); - } - Entry.Utils.disableContextmenu(c); - $(c).on("contextmenu", function() { - var a = [{text:Lang.Workspace.duplicate_scene, enable:Entry.engine.isState("stop"), callback:function() { - Entry.scene.cloneScene(b); - }}]; - Entry.ContextMenu.show(a, "workspace-contextmenu"); - }); - return b.view = c; -}; -Entry.Scene.prototype.updateView = function() { - if (!Entry.type || "workspace" == Entry.type) { - for (var b = this.listView_, a = $(b).children().length;a < this.getScenes().length;a++) { - b.appendChild(this.getScenes()[a].view); - } - this.addButton_ && (this.getScenes().length < this.maxCount ? this.addButton_.removeClass("entryRemove") : this.addButton_.addClass("entryRemove")); - } - this.resize(); -}; -Entry.Scene.prototype.addScenes = function(b) { - if ((this.scenes_ = b) && 0 !== b.length) { - for (var a = 0, c = b.length;a < c;a++) { - this.generateElement(b[a]); - } - } else { - this.scenes_ = [], this.scenes_.push(this.createScene()); - } - this.selectScene(this.getScenes()[0]); - this.updateView(); -}; -Entry.Scene.prototype.addScene = function(b, a) { - void 0 === b && (b = this.createScene()); - b.view || this.generateElement(b); - a || "number" == typeof a ? this.getScenes().splice(a, 0, b) : this.getScenes().push(b); - Entry.stage.objectContainers.push(Entry.stage.createObjectContainer(b)); - Entry.playground.flushPlayground(); - this.selectScene(b); - this.updateView(); - return b; -}; -Entry.Scene.prototype.removeScene = function(b) { - if (1 >= this.getScenes().length) { - Entry.toast.alert(Lang.Msgs.runtime_error, Lang.Workspace.Scene_delete_error, !1); - } else { - var a = this.getScenes().indexOf(this.getSceneById(b.id)); - this.getScenes().splice(a, 1); - for (var a = Entry.container.getSceneObjects(b), c = 0;c < a.length;c++) { - Entry.container.removeObject(a[c]); - } - Entry.stage.removeObjectContainer(b); - $(b.view).remove(); - this.selectScene(); - } -}; -Entry.Scene.prototype.selectScene = function(b) { - b = b || this.getScenes()[0]; - if (!this.selectedScene || this.selectedScene.id != b.id) { - Entry.engine.isState("run") && Entry.container.resetSceneDuringRun(); - var a = this.selectedScene; - a && (a = a.view, a.removeClass("selectedScene"), a = $(a), a.find("input").blur()); - this.selectedScene = b; - b.view.addClass("selectedScene"); - Entry.container.setCurrentObjects(); - Entry.stage.objectContainers && 0 !== Entry.stage.objectContainers.length && Entry.stage.selectObjectContainer(b); - (b = Entry.container.getCurrentObjects()[0]) && "minimize" != Entry.type ? (Entry.container.selectObject(b.id), Entry.playground.refreshPlayground()) : (Entry.stage.selectObject(null), Entry.playground.flushPlayground(), Entry.variableContainer.updateList()); - Entry.container.listView_ || Entry.stage.sortZorder(); - Entry.container.updateListView(); - this.updateView(); - Entry.requestUpdate = !0; - } -}; -Entry.Scene.prototype.toJSON = function() { - for (var b = [], a = this.getScenes().length, c = 0;c < a;c++) { - var d = this.getScenes()[c], e = d.view, f = d.inputWrapper; - delete d.view; - delete d.inputWrapper; - b.push(JSON.parse(JSON.stringify(d))); - d.view = e; - d.inputWrapper = f; - } - return b; -}; -Entry.Scene.prototype.moveScene = function(b, a) { - this.getScenes().splice(a, 0, this.getScenes().splice(b, 1)[0]); - Entry.container.updateObjectsOrder(); - Entry.stage.sortZorder(); - $(".entrySceneElementWorkspace").removeAttr("style"); -}; -Entry.Scene.prototype.getSceneById = function(b) { - for (var a = this.getScenes(), c = 0;c < a.length;c++) { - if (a[c].id == b) { - return a[c]; + a.DebuggerStatement = function(b) { + throw {message:"debugger\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.WithStatement = function(b) { + throw {message:"with\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.ReturnStaement = function(b) { + throw {message:"return\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.LabeledStatement = function(b) { + throw {message:"label\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.BreakStatement = function(b) { + throw {message:"break\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.ContinueStatement = function(b) { + throw {message:"continue\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.IfStatement = function(b) { + if (this.syntax.IfStatement) { + throw {message:"if\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; } - } - return !1; -}; -Entry.Scene.prototype.getScenes = function() { - return this.scenes_; -}; -Entry.Scene.prototype.takeStartSceneSnapshot = function() { - this.sceneBeforeRun = this.selectedScene; -}; -Entry.Scene.prototype.loadStartSceneSnapshot = function() { - this.selectScene(this.sceneBeforeRun); - this.sceneBeforeRun = null; -}; -Entry.Scene.prototype.createScene = function() { - var b = {name:Lang.Blocks.SCENE + " " + (this.getScenes().length + 1), id:Entry.generateHash()}; - this.generateElement(b); - return b; -}; -Entry.Scene.prototype.cloneScene = function(b) { - if (this.scenes_.length >= 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); + return this.BasicIf(b); + }; + a.SwitchStatement = function(b) { + throw {message:"switch\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.SwitchCase = function(b) { + throw {message:"switch ~ case\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.ThrowStatement = function(b) { + throw {message:"throw\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.TryStatement = function(b) { + throw {message:"try\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.CatchClause = function(b) { + throw {message:"catch\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.WhileStatement = function(b) { + var a = b.body, d = this.syntax.WhileStatement, a = this[a.type](a); + if (d) { + throw {message:"while\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; } - } -}; -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; + return this.BasicWhile(b, a); + }; + a.DoWhileStatement = function(b) { + throw {message:"do ~ while\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.ForInStatement = function(b) { + throw {message:"for ~ in\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.FunctionDeclaration = function(b) { + if (this.syntax.FunctionDeclaration) { + throw {message:"function\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; } - 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"); - } + return null; + }; + a.VariableDeclaration = function(b) { + throw {message:"var\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.ThisExpression = function(b) { + return this.scope.this; + }; + a.ArrayExpression = function(b) { + throw {message:"array\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.ObjectExpression = function(b) { + throw {message:"object\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.Property = function(b) { + throw {message:"init, get, set\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.FunctionExpression = function(b) { + throw {message:"function\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.UnaryExpression = function(b) { + throw {message:b.operator + "\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub839\uc5b4 \uc785\ub2c8\ub2e4.", node:b}; + }; + a.UnaryOperator = function() { + return "- + ! ~ typeof void delete".split(" "); + }; + a.updateOperator = function() { + return ["++", "--"]; + }; + a.BinaryOperator = function() { + return "== != === !== < <= > >= << >> >>> + - * / % , ^ & in instanceof".split(" "); + }; + a.AssignmentExpression = function(b) { + throw {message:b.operator + "\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub839\uc5b4 \uc785\ub2c8\ub2e4.", node:b}; + }; + a.AssignmentOperator = function() { + return "= += -= *= /= %= <<= >>= >>>= ,= ^= &=".split(" "); + }; + a.LogicalExpression = function(b) { + throw {message:b.operator + "\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub839\uc5b4 \uc785\ub2c8\ub2e4.", node:b}; + }; + a.LogicalOperator = function() { + return ["||", "&&"]; + }; + a.MemberExpression = function(b) { + var a = b.object, d = b.property; + console.log(a.type); + a = this[a.type](a); + console.log(a); + d = this[d.type](d, a); + if (Object(a) !== a || Object.getPrototypeOf(a) !== Object.prototype) { + throw {message:a + "\uc740(\ub294) \uc798\ubabb\ub41c \uba64\ubc84 \ubcc0\uc218\uc785\ub2c8\ub2e4.", node:b}; } - } -}; -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 < b.length;a++) { - if (c = b[a], "NEXT" == c.tagName.toUpperCase()) { - this.nextScript = new Entry.Script(this.entity), this.register && (this.nextScript.register = this.register), this.nextScript.init(b[a].childNodes[0], this); + a = d; + if (!a) { + throw {message:d + "\uc774(\uac00) \uc874\uc7ac\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.", node:b}; + } + return a; + }; + a.ConditionalExpression = function(b) { + throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.UpdateExpression = function(b) { + throw {message:b.operator + "\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub801\uc5b4 \uc785\ub2c8\ub2e4.", node:b}; + }; + a.CallExpression = function(b) { + b = b.callee; + return {type:this[b.type](b)}; + }; + a.NewExpression = function(b) { + throw {message:"new\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.SequenceExpression = function(b) { + throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.initScope = function(b) { + if (null === this.scope) { + var a = function() { + }; + a.prototype = this.syntax.Scope; } else { - if ("VALUE" == c.tagName.toUpperCase()) { - this.values || (this.values = {}); - var d = new Entry.Script(this.entity); - this.register && (d.register = this.register); - d.init(c.childNodes[0]); - this.values[c.getAttribute("name")] = d; - } else { - "FIELD" == c.tagName.toUpperCase() ? (this.fields || (this.fields = {}), this.fields[c.getAttribute("name")] = c.textContent) : "STATEMENT" == c.tagName.toUpperCase() && (this.statements || (this.statements = {}), d = new Entry.Script(this.entity), this.register && (d.register = this.register), d.init(c.childNodes[0], null, this), d.key = c.getAttribute("name"), this.statements[c.getAttribute("name")] = d); - } + a = function() { + }, a.prototype = this.scope; } - } -}; -p.clone = function(b, a) { - var c = new Entry.Script(b); - c.id = this.id; - c.type = this.type; - c.isRepeat = this.isRepeat; - if (this.parentScript && !this.previousScript && 2 != a) { - c.parentScript = this.parentScript.clone(b); - for (var d = c.parentScript.statements[this.key] = c;d.nextScript;) { - d = d.nextScript, d.parentScript = c.parentScript; + this.scope = new a; + this.scopeChain.push(this.scope); + return this.scanDefinition(b); + }; + a.unloadScope = function() { + this.scopeChain.pop(); + this.scope = this.scopeChain.length ? this.scopeChain[this.scopeChain.length - 1] : null; + }; + a.scanDefinition = function(b) { + b = b.body; + for (var a = [], d = 0;d < b.length;d++) { + var e = b[d]; + "FunctionDeclaration" === e.type && (this.scope[e.id.name] = this.scope.promise, this.syntax.BasicFunction && (e = e.body, a.push([{type:this.syntax.BasicFunction, statements:[this[e.type](e)]}]))); } - } - this.nextScript && 1 != a && (c.nextScript = this.nextScript.clone(b, 0), c.nextScript.previousScript = this); - this.previousScript && 0 !== a && (c.previousScript = this.previousScript.clone(b, 1), c.previousScript.previousScript = this); - if (this.fields) { - c.fields = {}; - for (var e in this.fields) { - c.fields[e] = this.fields[e]; + return a; + }; + a.BasicFunction = function(b, a) { + return null; + }; + a.BasicIteration = function(b, a, d) { + var e = this.syntax.BasicIteration; + if (!e) { + throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; } - } - if (this.values) { - for (e in c.values = {}, this.values) { - c.values[e] = this.values[e].clone(b); + return {params:[a], type:e, statements:[d]}; + }; + a.BasicWhile = function(b, a) { + var d = b.test.raw; + if (this.syntax.BasicWhile[d]) { + return {type:this.syntax.BasicWhile[d], statements:[a]}; } - } - if (this.statements) { - for (e in c.statements = {}, this.statements) { - for (c.statements[e] = this.statements[e].clone(b, 2), d = c.statements[e], d.parentScript = c;d.nextScript;) { - d = d.nextScript, d.parentScript = c; + throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b.test}; + }; + a.BasicIf = function(b) { + var a = b.consequent, a = this[a.type](a); + try { + var d = "", e = "===" === b.test.operator ? "==" : b.test.operator; + if ("Identifier" === b.test.left.type && "Literal" === b.test.right.type) { + d = b.test.left.name + " " + e + " " + b.test.right.raw; + } else { + if ("Literal" === b.test.left.type && "Identifier" === b.test.right.type) { + d = b.test.right.name + " " + e + " " + b.test.left.raw; + } else { + throw Error(); + } + } + if (this.syntax.BasicIf[d]) { + return Array.isArray(a) || "object" !== typeof a || (a = [a]), {type:this.syntax.BasicIf[d], statements:[a]}; } + throw Error(); + } catch (f) { + throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b.test}; } + }; +})(Entry.JSParser.prototype); +Entry.Parser = function(a, b, c) { + this._mode = a; + this.syntax = {}; + this.codeMirror = c; + this._lang = b || "js"; + this.availableCode = []; + "maze" === a && (this._stageId = Number(Ntry.configManager.getConfig("stageId")), "object" == typeof NtryData && this.setAvailableCode(NtryData.config[this._stageId].availableCode, NtryData.player[this._stageId].code)); + this.mappingSyntax(a); + switch(this._lang) { + case "js": + this._parser = new Entry.JSParser(this.syntax); + b = this.syntax; + var d = {}, e; + for (e in b.Scope) { + d[e + "();\n"] = b.Scope[e]; + } + "BasicIf" in b && (d.front = "BasicIf"); + CodeMirror.commands.javascriptComplete = function(b) { + CodeMirror.showHint(b, null, {globalScope:d}); + }; + c.on("keyup", function(b, a) { + !b.state.completionActive && 65 <= a.keyCode && 95 >= a.keyCode && CodeMirror.showHint(b, null, {completeSingle:!1, globalScope:d}); + }); + break; + case "block": + this._parser = new Entry.BlockParser(this.syntax); } - return c; -}; -p.getStatement = function(b) { - return this.statements[b]; -}; -p.compute = function() { -}; -p.getValue = function(b) { - return this.values[b].run(); -}; -p.getNumberValue = function(b) { - return Number(this.values[b].run()); -}; -p.getStringValue = function(b) { - return String(this.values[b].run()); -}; -p.getBooleanValue = function(b) { - return this.values[b].run() ? !0 : !1; -}; -p.getField = function(b) { - return this.fields[b]; -}; -p.getStringField = function(b) { - return String(this.fields[b]); -}; -p.getNumberField = function(b) { - return Number(this.fields[b]); -}; -p.callReturn = function() { - return this.nextScript ? this.nextScript : this.parentScript ? this.parentScript : null; -}; -p.run = function() { - return Entry.block[this.type](this.entity, this); -}; -Entry.StampEntity = function(b, a) { - this.parent = b; - this.type = b.objectType; - this.isStamp = this.isClone = !0; - this.width = a.getWidth(); - this.height = a.getHeight(); - "sprite" == this.type && (this.object = a.object.clone(!0), this.object.filters = null, a.effect && (this.effect = Entry.cloneSimpleObject(a.effect), this.applyFilter())); - this.object.entity = this; - if (a.dialog) { - var c = a.dialog; - new Entry.Dialog(this, c.message_, c.mode_, !0); - this.dialog.object = a.dialog.object.clone(!0); - Entry.stage.loadDialog(this.dialog); - } -}; -var EntityPrototype = Entry.EntityObject.prototype; -Entry.StampEntity.prototype.applyFilter = EntityPrototype.applyFilter; -Entry.StampEntity.prototype.removeClone = EntityPrototype.removeClone; -Entry.StampEntity.prototype.getWidth = EntityPrototype.getWidth; -Entry.StampEntity.prototype.getHeight = EntityPrototype.getHeight; -Entry.StampEntity.prototype.getInitialEffectValue = EntityPrototype.getInitialEffectValue; -Entry.Toast = function() { - this.toasts_ = []; - var b = document.getElementById("entryToastContainer"); - b && document.body.removeChild(b); - this.body_ = Entry.createElement("div", "entryToastContainer"); - this.body_.addClass("entryToastContainer"); - document.body.appendChild(this.body_); -}; -Entry.Toast.prototype.warning = function(b, a, c) { - var d = Entry.createElement("div", "entryToast"); - d.addClass("entryToast"); - d.addClass("entryToastWarning"); - d.bindOnClick(function() { - Entry.toast.body_.removeChild(this); - }); - var e = Entry.createElement("div", "entryToast"); - e.addClass("entryToastTitle"); - e.innerHTML = b; - d.appendChild(e); - b = Entry.createElement("p", "entryToast"); - b.addClass("entryToastMessage"); - b.innerHTML = a; - d.appendChild(b); - this.toasts_.push(d); - this.body_.appendChild(d); - c || window.setTimeout(function() { - d.style.opacity = 1; - var a = setInterval(function() { - .05 > d.style.opacity && (clearInterval(a), d.style.display = "none", Entry.removeElement(d)); - d.style.opacity *= .9; - }, 20); - }, 1E3); -}; -Entry.Toast.prototype.success = function(b, a, c) { - var d = Entry.createElement("div", "entryToast"); - d.addClass("entryToast"); - d.addClass("entryToastSuccess"); - d.bindOnClick(function() { - Entry.toast.body_.removeChild(this); - }); - var e = Entry.createElement("div", "entryToast"); - e.addClass("entryToastTitle"); - e.innerHTML = b; - d.appendChild(e); - b = Entry.createElement("p", "entryToast"); - b.addClass("entryToastMessage"); - b.innerHTML = a; - d.appendChild(b); - this.toasts_.push(d); - this.body_.appendChild(d); - c || window.setTimeout(function() { - d.style.opacity = 1; - var a = setInterval(function() { - .05 > d.style.opacity && (clearInterval(a), d.style.display = "none", Entry.removeElement(d)); - d.style.opacity *= .9; - }, 20); - }, 1E3); -}; -Entry.Toast.prototype.alert = function(b, a, c) { - var d = Entry.createElement("div", "entryToast"); - d.addClass("entryToast"); - d.addClass("entryToastAlert"); - d.bindOnClick(function() { - Entry.toast.body_.removeChild(this); - }); - var e = Entry.createElement("div", "entryToast"); - e.addClass("entryToastTitle"); - e.innerHTML = b; - d.appendChild(e); - b = Entry.createElement("p", "entryToast"); - b.addClass("entryToastMessage"); - b.innerHTML = a; - d.appendChild(b); - this.toasts_.push(d); - this.body_.appendChild(d); - c || window.setTimeout(function() { - d.style.opacity = 1; - var a = setInterval(function() { - .05 > d.style.opacity && (clearInterval(a), d.style.display = "none", Entry.toast.body_.removeChild(d)); - d.style.opacity *= .9; - }, 20); - }, 5E3); -}; -Entry.TvCast = function(b) { - this.generateView(b); }; -p = Entry.TvCast.prototype; -p.init = function(b) { - this.tvCastHash = b; +(function(a) { + a.parse = function(b) { + var a = null; + switch(this._lang) { + case "js": + try { + var d = acorn.parse(b), a = this._parser.Program(d); + } catch (e) { + this.codeMirror && (e instanceof SyntaxError ? (b = {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.") : (b = this.getLineNumber(e.node.start, e.node.end), b.message = e.message, b.severity = "error", this.codeMirror.markText(b.from, b.to, {className:"CodeMirror-lint-mark-error", __annotation:b, clearOnEnter:!0})), Entry.toast.alert("Error", e.message)), a = []; + } + break; + case "block": + b = this._parser.Code(b).match(/(.*{.*[\S|\s]+?}|.+)/g), a = Array.isArray(b) ? b.reduce(function(b, a, c) { + 1 === c && (b += "\n"); + return (-1 < a.indexOf("function") ? a + b : b + a) + "\n"; + }) : ""; + } + return a; + }; + a.getLineNumber = function(b, a) { + var d = this.codeMirror.getValue(), e = {from:{}, to:{}}; + b = d.substring(0, b).split(/\n/gi); + e.from.line = b.length - 1; + e.from.ch = b[b.length - 1].length; + a = d.substring(0, a).split(/\n/gi); + e.to.line = a.length - 1; + e.to.ch = a[a.length - 1].length; + return e; + }; + a.mappingSyntax = function(b) { + for (var a = Object.keys(Entry.block), d = 0;d < a.length;d++) { + var e = a[d], f = Entry.block[e]; + if (f.mode === b && -1 < this.availableCode.indexOf(e) && (f = f.syntax)) { + for (var g = this.syntax, h = 0;h < f.length;h++) { + var k = f[h]; + if (h === f.length - 2 && "function" === typeof f[h + 1]) { + g[k] = f[h + 1]; + break; + } + g[k] || (g[k] = {}); + h === f.length - 1 ? g[k] = e : g = g[k]; + } + } + } + }; + a.setAvailableCode = function(b, a) { + var d = []; + b.forEach(function(b, a) { + b.forEach(function(b, a) { + d.push(b.type); + }); + }); + a instanceof Entry.Code ? a.getBlockList().forEach(function(b) { + b.type !== NtryData.START && -1 === d.indexOf(b.type) && d.push(b.type); + }) : a.forEach(function(b, a) { + b.forEach(function(b, a) { + b.type !== NtryData.START && -1 === d.indexOf(b.type) && d.push(b.type); + }); + }); + this.availableCode = this.availableCode.concat(d); + }; +})(Entry.Parser.prototype); +Entry.Pdf = function(a) { + this.generateView(a); }; -p.generateView = function(b) { - var a = Entry.createElement("div"); - a.addClass("entryContainerMovieWorkspace"); - a.addClass("entryRemove"); - this.movieContainer = a; - a = Entry.createElement("iframe"); - a.setAttribute("id", "tvCastIframe"); - a.setAttribute("allowfullscreen", ""); - a.setAttribute("frameborder", 0); - a.setAttribute("src", b); - this.movieFrame = a; - this.movieContainer.appendChild(this.movieFrame); +p = Entry.Pdf.prototype; +p.generateView = function(a) { + var b = Entry.createElement("div", "entryPdfWorkspace"); + b.addClass("entryRemove"); + this._view = b; + var c = "/pdfjs/web/viewer.html"; + a && "" != a && (c += "?file=" + a); + pdfViewIframe = Entry.createElement("iframe", "entryPdfIframeWorkspace"); + pdfViewIframe.setAttribute("id", "pdfViewIframe"); + pdfViewIframe.setAttribute("frameborder", 0); + pdfViewIframe.setAttribute("src", c); + b.appendChild(pdfViewIframe); }; p.getView = function() { - return this.movieContainer; + return this._view; }; p.resize = function() { - document.getElementById("entryContainerWorkspaceId"); - var b = document.getElementById("tvCastIframe"); - w = this.movieContainer.offsetWidth; + var a = document.getElementById("entryContainerWorkspaceId"), b = document.getElementById("pdfViewIframe"); + w = a.offsetWidth; b.width = w + "px"; b.height = 9 * w / 16 + "px"; }; +Entry.FieldTrashcan = function(a) { + a && this.setBoard(a); + this.dragBlockObserver = this.dragBlock = null; + this.isOver = !1; + Entry.windowResized && Entry.windowResized.attach(this, this.setPosition); +}; +(function(a) { + a._generateView = function() { + this.svgGroup = this.board.svg.elem("g"); + this.renderStart(); + this._addControl(); + }; + a.renderStart = function() { + var b = Entry.mediaFilePath + "delete_"; + this.trashcanTop = this.svgGroup.elem("image", {href:b + "cover.png", width:60, height:20}); + this.svgGroup.elem("image", {href:b + "body.png", y:20, width:60, height:60}); + }; + a._addControl = function() { + $(this.svgGroup).bind("mousedown", function(b) { + Entry.Utils.isRightButton(b) && (b.stopPropagation(), $("#entryWorkspaceBoard").css("background", "white")); + }); + }; + a.updateDragBlock = function() { + var b = this.board.dragBlock, a = this.dragBlockObserver; + a && (a.destroy(), this.dragBlockObserver = null); + b ? this.dragBlockObserver = b.observe(this, "checkBlock", ["x", "y"]) : (this.isOver && this.dragBlock && !this.dragBlock.block.getPrevBlock() && (this.dragBlock.block.doDestroyBelow(!0), createjs.Sound.play("entryDelete")), this.tAnimation(!1)); + this.dragBlock = b; + }; + a.checkBlock = function() { + var b = this.dragBlock; + if (b && b.block.isDeletable()) { + var a = this.board.offset(), d = this.getPosition(), e = d.x + a.left, a = d.y + a.top, f, g; + if (b = b.dragInstance) { + f = b.offsetX, g = b.offsetY; + } + this.tAnimation(f >= e && g >= a); + } + }; + a.align = function() { + var b = this.getPosition(); + this.svgGroup.attr({transform:"translate(" + b.x + "," + b.y + ")"}); + }; + a.setPosition = function() { + if (this.board) { + var b = this.board.svgDom; + this._x = b.width() - 110; + this._y = b.height() - 110; + this.align(); + } + }; + a.getPosition = function() { + return {x:this._x, y:this._y}; + }; + a.tAnimation = function(b) { + if (b !== this.isOver) { + b = void 0 === b ? !0 : b; + var a, d = this.trashcanTop; + a = b ? {translateX:15, translateY:-25, rotateZ:30} : {translateX:0, translateY:0, rotateZ:0}; + $(d).velocity(a, {duration:50}); + this.isOver = b; + } + }; + a.setBoard = function(b) { + this._dragBlockObserver && this._dragBlockObserver.destroy(); + this.board = b; + this.svgGroup || this._generateView(); + var a = b.svg, d = a.firstChild; + d ? a.insertBefore(this.svgGroup, d) : a.appendChild(this.svgGroup); + this._dragBlockObserver = b.observe(this, "updateDragBlock", ["dragBlock"]); + this.svgGroup.attr({filter:"url(#entryTrashcanFilter_" + b.suffix + ")"}); + this.setPosition(); + }; +})(Entry.FieldTrashcan.prototype); +Entry.Workspace = function(a) { + Entry.Model(this, !1); + this.observe(this, "_handleChangeBoard", ["selectedBoard"], !1); + this.trashcan = new Entry.FieldTrashcan; + var b = a.blockMenu; + b && (this.blockMenu = new Entry.BlockMenu(b.dom, b.align, b.categoryData, b.scroll), this.blockMenu.workspace = this, this.blockMenu.observe(this, "_setSelectedBlockView", ["selectedBlockView"], !1)); + if (b = a.board) { + b.workspace = this, this.board = new Entry.Board(b), this.board.observe(this, "_setSelectedBlockView", ["selectedBlockView"], !1), this.set({selectedBoard:this.board}); + } + if (b = a.vimBoard) { + this.vimBoard = new Entry.Vim(b.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(a) { + a.schema = {selectedBlockView:null, selectedBoard:null}; + a.getBoard = function() { + return this.board; + }; + a.getSelectedBoard = function() { + return this.selectedBoard; + }; + a.getBlockMenu = function() { + return this.blockMenu; + }; + a.getVimBoard = function() { + return this.vimBoard; + }; + a.getMode = function() { + return this.mode; + }; + a.setMode = function(b, a) { + b = Number(b); + var d = this.mode; + this.mode = b; + switch(b) { + 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(a); + }; + a.changeBoardCode = function(b) { + this.board.changeCode(b); + }; + a.changeOverlayBoardCode = function(b) { + this.overlayBoard && this.overlayBoard.changeCode(b); + }; + a.changeBlockMenuCode = function(b) { + this.blockMenu.changeCode(b); + }; + a.textToCode = function(b) { + if (b == Entry.Workspace.MODE_VIMBOARD) { + b = this.vimBoard.textToCode(); + var a = this.board, d = a.code; + d.load(b); + d.createView(a); + a.reDraw(); + this.board.alignThreads(); + } + }; + a.codeToText = function(b) { + return this.vimBoard.codeToText(b); + }; + a.getCodeToText = function(b) { + return this.vimBoard.getCodeToText(b); + }; + a._setSelectedBlockView = function() { + this.set({selectedBlockView:this.board.selectedBlockView || this.blockMenu.selectedBlockView || (this.overlayBoard ? this.overlayBoard.selectedBlockView : null)}); + }; + a.initOverlayBoard = function() { + this.overlayBoard = new Entry.Board({dom:this.board.view, workspace:this, isOverlay:!0}); + this.overlayBoard.changeCode(new Entry.Code([])); + this.overlayBoard.workspace = this; + this.overlayBoard.observe(this, "_setSelectedBlockView", ["selectedBlockView"], !1); + }; + a._keyboardControl = function(b) { + var a = b.keyCode || b.which, d = b.ctrlKey; + if (!Entry.Utils.isInInput(b)) { + var e = this.selectedBlockView; + e && !e.isInBlockMenu && e.block.isDeletable() && (8 == a || 46 == a ? (Entry.do("destroyBlock", e.block), b.preventDefault()) : d && (67 == a ? e.block.copyToClipboard() : 88 == a && (b = e.block, b.copyToClipboard(), b.destroy(!0, !0), e.getBoard().setSelectedBlock(null)))); + d && 86 == a && (a = this.selectedBoard) && a instanceof Entry.Board && Entry.clipboard && Entry.do("addThread", Entry.clipboard).value.getFirstBlock().copyToClipboard(); + } + }; + a._handleChangeBoard = function() { + var b = this.selectedBoard; + b && b.constructor === Entry.Board && this.trashcan.setBoard(b); + }; +})(Entry.Workspace.prototype); Entry.BlockDriver = function() { }; -(function(b) { - b.convert = function() { - var a = new Date, b; - for (b in Entry.block) { - "function" === typeof Entry.block[b] && this._convertBlock(b); +(function(a) { + a.convert = function() { + var b = new Date, a; + for (a in Entry.block) { + "function" === typeof Entry.block[a] && this._convertBlock(a); } - console.log((new Date).getTime() - a.getTime()); + console.log((new Date).getTime() - b.getTime()); }; - b._convertBlock = function(a) { - function b(a) { - var d = {type:a.getAttribute("type"), index:{}}; - a = $(a).children(); - if (!a) { + a._convertBlock = function(b) { + function a(b) { + var d = {type:b.getAttribute("type"), index:{}}; + b = $(b).children(); + if (!b) { return d; } - for (var e = 0;e < a.length;e++) { - var f = a[e], g = f.tagName, h = $(f).children()[0], v = f.getAttribute("name"); - "value" === g ? "block" == h.nodeName && (d.params || (d.params = []), d.params.push(b(h)), d.index[v] = d.params.length - 1) : "field" === g && (d.params || (d.params = []), d.params.push(f.textContent), d.index[v] = d.params.length - 1); + for (var e = 0;e < b.length;e++) { + var f = b[e], g = f.tagName, h = $(f).children()[0], u = f.getAttribute("name"); + "value" === g ? "block" == h.nodeName && (d.params || (d.params = []), d.params.push(a(h)), d.index[u] = d.params.length - 1) : "field" === g && (d.params || (d.params = []), d.params.push(f.textContent), d.index[u] = d.params.length - 1); } return d; } - var d = Blockly.Blocks[a], e = EntryStatic.blockInfo[a], f, g; + var d = Blockly.Blocks[b], e = EntryStatic.blockInfo[b], f, g; if (e && (f = e.class, g = e.isNotFor, e = e.xml)) { - var e = $.parseXML(e), h = b(e.childNodes[0]) + var e = $.parseXML(e), h = a(e.childNodes[0]) } - d = (new Entry.BlockMockup(d, h, a)).toJSON(); + d = (new Entry.BlockMockup(d, h, b)).toJSON(); d.class = f; d.isNotFor = g; _.isEmpty(d.paramsKeyMap) && delete d.paramsKeyMap; _.isEmpty(d.statementsKeyMap) && delete d.statementsKeyMap; - d.func = Entry.block[a]; - -1 < "NUMBER TRUE FALSE TEXT FUNCTION_PARAM_BOOLEAN FUNCTION_PARAM_STRING TRUE_UN".split(" ").indexOf(a.toUpperCase()) && (d.isPrimitive = !0); - Entry.block[a] = d; + d.func = Entry.block[b]; + -1 < "NUMBER TRUE FALSE TEXT FUNCTION_PARAM_BOOLEAN FUNCTION_PARAM_STRING TRUE_UN".split(" ").indexOf(b.toUpperCase()) && (d.isPrimitive = !0); + Entry.block[b] = d; }; })(Entry.BlockDriver.prototype); -Entry.BlockMockup = function(b, a, c) { +Entry.BlockMockup = function(a, b, c) { this.templates = []; this.params = []; this.statements = []; @@ -11279,33 +12638,33 @@ Entry.BlockMockup = function(b, a, c) { this.output = this.isNext = this.isPrev = !1; this.fieldCount = 0; this.events = {}; - this.def = a || {}; + this.def = b || {}; this.paramsKeyMap = {}; this.statementsKeyMap = {}; this.definition = {params:[], type:this.def.type}; - this.simulate(b); + this.simulate(a); this.def = this.definition; }; -(function(b) { - b.simulate = function(a) { - a.sensorList && (this.sensorList = a.sensorList); - a.portList && (this.portList = a.portList); - a.init.call(this); - a.whenAdd && (this.events.blockViewAdd || (this.events.blockViewAdd = []), this.events.blockViewAdd.push(a.whenAdd)); - a.whenRemove && (this.events.blockViewDestroy || (this.events.blockViewDestroy = []), this.events.blockViewDestroy.push(a.whenRemove)); +(function(a) { + a.simulate = function(b) { + b.sensorList && (this.sensorList = b.sensorList); + b.portList && (this.portList = b.portList); + b.init.call(this); + b.whenAdd && (this.events.blockViewAdd || (this.events.blockViewAdd = []), this.events.blockViewAdd.push(b.whenAdd)); + b.whenRemove && (this.events.blockViewDestroy || (this.events.blockViewDestroy = []), this.events.blockViewDestroy.push(b.whenRemove)); }; - b.toJSON = function() { - function a(b) { - if (b && (b = b.params)) { - for (var c = 0;c < b.length;c++) { - var d = b[c]; - d && (delete d.index, a(d)); + a.toJSON = function() { + function b(a) { + if (a && (a = a.params)) { + for (var c = 0;c < a.length;c++) { + var d = a[c]; + d && (delete d.index, b(d)); } } } - var b = ""; - this.output ? b = "Boolean" === this.output ? "basic_boolean_field" : "basic_string_field" : !this.isPrev && this.isNext ? b = "basic_event" : 1 == this.statements.length ? b = "basic_loop" : 2 == this.statements.length ? b = "basic_double_loop" : this.isPrev && this.isNext ? b = "basic" : this.isPrev && !this.isNext && (b = "basic_without_next"); - a(this.def); + var a = ""; + this.output ? a = "Boolean" === this.output ? "basic_boolean_field" : "basic_string_field" : !this.isPrev && this.isNext ? a = "basic_event" : 1 == this.statements.length ? a = "basic_loop" : 2 == this.statements.length ? a = "basic_double_loop" : this.isPrev && this.isNext ? a = "basic" : this.isPrev && !this.isNext && (a = "basic_without_next"); + b(this.def); var d = /dummy_/mi, e; for (e in this.paramsKeyMap) { d.test(e) && delete this.paramsKeyMap[e]; @@ -11313,1469 +12672,1351 @@ Entry.BlockMockup = function(b, a, c) { for (e in this.statementsKeyMap) { d.test(e) && delete this.statementsKeyMap[e]; } - return {color:this.color, skeleton:b, statements:this.statements, template:this.templates.filter(function(a) { + return {color:this.color, skeleton:a, statements:this.statements, template:this.templates.filter(function(a) { return "string" === typeof a; }).join(" "), params:this.params, events:this.events, def:this.def, paramsKeyMap:this.paramsKeyMap, statementsKeyMap:this.statementsKeyMap}; }; - b.appendDummyInput = function() { + a.appendDummyInput = function() { return this; }; - b.appendValueInput = function(a) { + a.appendValueInput = function(a) { this.def && this.def.index && (void 0 !== this.def.index[a] ? this.definition.params.push(this.def.params[this.def.index[a]]) : this.definition.params.push(null)); this.params.push({type:"Block", accept:"string"}); this._addToParamsKeyMap(a); this.templates.push(this.getFieldCount()); return this; }; - b.appendStatementInput = function(a) { + a.appendStatementInput = function(a) { this._addToStatementsKeyMap(a); this.statements.push({accept:"basic"}); }; - b.setCheck = function(a) { - var b = this.params; - "Boolean" === a && (b[b.length - 1].accept = "boolean"); + a.setCheck = function(a) { + var c = this.params; + "Boolean" === a && (c[c.length - 1].accept = "boolean"); }; - b.appendField = function(a, b) { + a.appendField = function(a, c) { if (!a) { return this; } - "string" === typeof a && 0 < a.length ? b ? (a = {type:"Text", text:a, color:b}, this.params.push(a), this._addToParamsKeyMap(), this.templates.push(this.getFieldCount()), this.def && this.def.index && void 0 !== this.def.index[b] ? this.definition.params.push(this.def.params[this.def.index[b]]) : this.definition.params.push(void 0)) : this.templates.push(a) : a.constructor == Blockly.FieldIcon ? ("start" === a.type ? this.params.push({type:"Indicator", img:a.src_, size:17, position:{x:0, y:-2}}) : - this.params.push({type:"Indicator", img:a.src_, size:12}), this._addToParamsKeyMap(), this.templates.push(this.getFieldCount()), this.definition && this.definition.params.push(null)) : a.constructor == Blockly.FieldDropdown ? (this.params.push({type:"Dropdown", options:a.menuGenerator_, value:a.menuGenerator_[0][1], fontSize:11}), this._addToParamsKeyMap(b), this.templates.push(this.getFieldCount()), this.def && this.def.index && void 0 !== this.def.index[b] ? this.definition.params.push(this.def.params[this.def.index[b]]) : - this.definition.params.push(void 0)) : a.constructor == Blockly.FieldDropdownDynamic ? (this.params.push({type:"DropdownDynamic", value:null, menuName:a.menuName_, fontSize:11}), this.templates.push(this.getFieldCount()), this.def && this.def.index && void 0 !== this.def.index[b] ? this.definition.params.push(this.def.params[this.def.index[b]]) : this.definition.params.push(void 0), this._addToParamsKeyMap(b)) : a.constructor == Blockly.FieldTextInput ? (this.params.push({type:"TextInput", value:10}), - this.templates.push(this.getFieldCount()), this._addToParamsKeyMap(b)) : a.constructor == Blockly.FieldAngle ? (this.params.push({type:"Angle"}), this.templates.push(this.getFieldCount()), this.def && this.def.index && void 0 !== this.def.index[b] ? this.definition.params.push(this.def.params[this.def.index[b]]) : this.definition.params.push(null), this._addToParamsKeyMap(b)) : a.constructor == Blockly.FieldKeydownInput ? (this.params.push({type:"Keyboard", value:81}), this.templates.push(this.getFieldCount()), - void 0 !== this.def.index[b] ? this.definition.params.push(this.def.params[this.def.index[b]]) : this.definition.params.push(void 0), this._addToParamsKeyMap(b)) : a.constructor == Blockly.FieldColour ? (this.params.push({type:"Color"}), this.templates.push(this.getFieldCount()), this._addToParamsKeyMap(b)) : console.log("else", a); + "string" === typeof a && 0 < a.length ? c ? (a = {type:"Text", text:a, color:c}, this.params.push(a), this._addToParamsKeyMap(), this.templates.push(this.getFieldCount()), this.def && this.def.index && void 0 !== this.def.index[c] ? this.definition.params.push(this.def.params[this.def.index[c]]) : this.definition.params.push(void 0)) : this.templates.push(a) : a.constructor == Blockly.FieldIcon ? ("start" === a.type ? this.params.push({type:"Indicator", img:a.src_, size:17, position:{x:0, y:-2}}) : + this.params.push({type:"Indicator", img:a.src_, size:12}), this._addToParamsKeyMap(), this.templates.push(this.getFieldCount()), this.definition && this.definition.params.push(null)) : a.constructor == Blockly.FieldDropdown ? (this.params.push({type:"Dropdown", options:a.menuGenerator_, value:a.menuGenerator_[0][1], fontSize:11}), this._addToParamsKeyMap(c), this.templates.push(this.getFieldCount()), this.def && this.def.index && void 0 !== this.def.index[c] ? this.definition.params.push(this.def.params[this.def.index[c]]) : + this.definition.params.push(void 0)) : a.constructor == Blockly.FieldDropdownDynamic ? (this.params.push({type:"DropdownDynamic", value:null, menuName:a.menuName_, fontSize:11}), this.templates.push(this.getFieldCount()), this.def && this.def.index && void 0 !== this.def.index[c] ? this.definition.params.push(this.def.params[this.def.index[c]]) : this.definition.params.push(void 0), this._addToParamsKeyMap(c)) : a.constructor == Blockly.FieldTextInput ? (this.params.push({type:"TextInput", value:10}), + this.templates.push(this.getFieldCount()), this._addToParamsKeyMap(c)) : a.constructor == Blockly.FieldAngle ? (this.params.push({type:"Angle"}), this.templates.push(this.getFieldCount()), this.def && this.def.index && void 0 !== this.def.index[c] ? this.definition.params.push(this.def.params[this.def.index[c]]) : this.definition.params.push(null), this._addToParamsKeyMap(c)) : a.constructor == Blockly.FieldKeydownInput ? (this.params.push({type:"Keyboard", value:81}), this.templates.push(this.getFieldCount()), + void 0 !== this.def.index[c] ? this.definition.params.push(this.def.params[this.def.index[c]]) : this.definition.params.push(void 0), this._addToParamsKeyMap(c)) : a.constructor == Blockly.FieldColour ? (this.params.push({type:"Color"}), this.templates.push(this.getFieldCount()), this._addToParamsKeyMap(c)) : console.log("else", a); return this; }; - b.setColour = function(a) { + a.setColour = function(a) { this.color = a; }; - b.setInputsInline = function() { + a.setInputsInline = function() { }; - b.setOutput = function(a, b) { - a && (this.output = b); + a.setOutput = function(a, c) { + a && (this.output = c); }; - b.setPreviousStatement = function(a) { + a.setPreviousStatement = function(a) { this.isPrev = a; }; - b.setNextStatement = function(a) { + a.setNextStatement = function(a) { this.isNext = a; }; - b.setEditable = function(a) { + a.setEditable = function(a) { }; - b.getFieldCount = function() { + a.getFieldCount = function() { this.fieldCount++; return "%" + this.fieldCount; }; - b._addToParamsKeyMap = function(a) { + a._addToParamsKeyMap = function(a) { a = a ? a : "dummy_" + Entry.Utils.generateId(); - var b = this.paramsKeyMap; - b[a] = Object.keys(b).length; + var c = this.paramsKeyMap; + c[a] = Object.keys(c).length; }; - b._addToStatementsKeyMap = function(a) { + a._addToStatementsKeyMap = function(a) { a = a ? a : "dummy_" + Entry.Utils.generateId(); - var b = this.statementsKeyMap; - b[a] = Object.keys(b).length; - }; -})(Entry.BlockMockup.prototype); -Entry.ContextMenu = {}; -(function(b) { - b.createDom = function() { - this.dom = Entry.Dom("ul", {id:"entry-contextmenu", parent:$("body")}); - Entry.Utils.disableContextmenu(this.dom); - Entry.documentMousedown.attach(this, function() { - this.hide(); - }); - }; - b.show = function(a, b) { - this.dom || this.createDom(); - if (0 !== a.length) { - var d = this; - void 0 !== b && (this._className = b, this.dom.addClass(b)); - var e = this.dom; - e.empty(); - for (var f = 0, g = a.length;f < g;f++) { - var h = a[f], k = h.text, l = !1 !== h.enable, q = Entry.Dom("li", {class:l ? "menuAble" : "menuDisable", parent:e}); - q.text(k); - l && h.callback && function(a, b) { - a.mousedown(function(a) { - a.preventDefault(); - d.hide(); - b(a); - }); - }(q, h.callback); - } - e.removeClass("entryRemove"); - this.position(Entry.mouseCoordinate); - } - }; - b.position = function(a) { - var b = this.dom; - b.css({left:0, top:0}); - var d = b.width(), e = b.height(), f = $(window), g = f.width(), f = f.height(); - a.x + d > g && (a.x -= d + 3); - a.y + e > f && (a.y -= e); - b.css({left:a.x, top:a.y}); - }; - b.hide = function() { - this.dom.empty(); - this.dom.addClass("entryRemove"); - this._className && (this.dom.removeClass(this._className), delete this._className); - }; -})(Entry.ContextMenu); -Entry.Loader = {queueCount:0, totalCount:0}; -Entry.Loader.addQueue = function(b) { - this.queueCount || Entry.dispatchEvent("loadStart"); - this.queueCount++; - this.totalCount++; -}; -Entry.Loader.removeQueue = function(b) { - this.queueCount--; - this.queueCount || (Entry.dispatchEvent("loadComplete"), this.totalCount = 0); -}; -Entry.Loader.getLoadedPercent = function() { - return 0 === this.totalCount ? 1 : this.queueCount / this.totalCount; -}; -Entry.STATIC = {OBJECT:0, ENTITY:1, SPRITE:2, SOUND:3, VARIABLE:4, FUNCTION:5, SCENE:6, MESSAGE:7, BLOCK_MODEL:8, BLOCK_RENDER_MODEL:9, BOX_MODEL:10, THREAD_MODEL:11, DRAG_INSTANCE:12, BLOCK_STATIC:0, BLOCK_MOVE:1, BLOCK_FOLLOW:2, RETURN:0, CONTINUE:1, BREAK:2, PASS:3}; -Entry.Utils = {}; -Entry.overridePrototype = function() { - Number.prototype.mod = function(b) { - return (this % b + b) % b; - }; -}; -Entry.Utils.generateId = function() { - return ("0000" + (Math.random() * Math.pow(36, 4) << 0).toString(36)).substr(-4); -}; -Entry.Utils.intersectArray = function(b, a) { - for (var c = [], d = 0;d < b.length;d++) { - for (var e = 0;e < a.length;e++) { - if (b[d] == a[e]) { - c.push(b[d]); - break; - } - } - } - return c; -}; -Entry.Utils.isPointInMatrix = function(b, a, c) { - c = void 0 === c ? 0 : c; - var d = b.offsetX ? b.x + b.offsetX : b.x, e = b.offsetY ? b.y + b.offsety : b.y; - return d - c <= a.x && d + b.width + c >= a.x && e - c <= a.y && e + b.height + c >= a.y; -}; -Entry.Utils.colorDarken = function(b, a) { - function c(a) { - 2 != a.length && (a = "0" + a); - return a; - } - var d, e, f; - 7 === b.length ? (d = parseInt(b.substr(1, 2), 16), e = parseInt(b.substr(3, 2), 16), f = parseInt(b.substr(5, 2), 16)) : (d = parseInt(b.substr(1, 2), 16), e = parseInt(b.substr(2, 2), 16), f = parseInt(b.substr(3, 2), 16)); - a = void 0 === a ? .7 : a; - d = c(Math.floor(d * a).toString(16)); - e = c(Math.floor(e * a).toString(16)); - f = c(Math.floor(f * a).toString(16)); - return "#" + d + e + f; -}; -Entry.Utils.colorLighten = function(b, a) { - a = 0 === a ? 0 : a || 20; - var c = Entry.Utils.hexToHsl(b); - c.l += a / 100; - c.l = Math.min(1, Math.max(0, c.l)); - return Entry.Utils.hslToHex(c); -}; -Entry.Utils.bound01 = function(b, a) { - var c = b; - "string" == typeof c && -1 != c.indexOf(".") && 1 === parseFloat(c) && (b = "100%"); - c = "string" === typeof b && -1 != b.indexOf("%"); - b = Math.min(a, Math.max(0, parseFloat(b))); - c && (b = parseInt(b * a, 10) / 100); - return 1E-6 > Math.abs(b - a) ? 1 : b % a / parseFloat(a); -}; -Entry.Utils.hexToHsl = function(b) { - var a, c; - 7 === b.length ? (a = parseInt(b.substr(1, 2), 16), c = parseInt(b.substr(3, 2), 16), b = parseInt(b.substr(5, 2), 16)) : (a = parseInt(b.substr(1, 2), 16), c = parseInt(b.substr(2, 2), 16), b = parseInt(b.substr(3, 2), 16)); - a = Entry.Utils.bound01(a, 255); - c = Entry.Utils.bound01(c, 255); - b = Entry.Utils.bound01(b, 255); - var d = Math.max(a, c, b), e = Math.min(a, c, b), f, g = (d + e) / 2; - if (d == e) { - f = e = 0; - } else { - var h = d - e, e = .5 < g ? h / (2 - d - e) : h / (d + e); - switch(d) { - case a: - f = (c - b) / h + (c < b ? 6 : 0); - break; - case c: - f = (b - a) / h + 2; - break; - case b: - f = (a - c) / h + 4; - } - f /= 6; - } - return {h:360 * f, s:e, l:g}; -}; -Entry.Utils.hslToHex = function(b) { - function a(a, b, c) { - 0 > c && (c += 1); - 1 < c && --c; - return c < 1 / 6 ? a + 6 * (b - a) * c : .5 > c ? b : c < 2 / 3 ? a + (b - a) * (2 / 3 - c) * 6 : a; - } - function c(a) { - return 1 == a.length ? "0" + a : "" + a; - } - var d, e; - e = Entry.Utils.bound01(b.h, 360); - d = Entry.Utils.bound01(b.s, 1); - b = Entry.Utils.bound01(b.l, 1); - if (0 === d) { - d = b = e = b; - } else { - var f = .5 > b ? b * (1 + d) : b + d - b * d, g = 2 * b - f; - d = a(g, f, e + 1 / 3); - b = a(g, f, e); - e = a(g, f, e - 1 / 3); - } - b *= 255; - e *= 255; - return "#" + [c(Math.round(255 * d).toString(16)), c(Math.round(b).toString(16)), c(Math.round(e).toString(16))].join(""); -}; -Entry.Utils.bindGlobalEvent = function(b) { - var a = $(document); - void 0 === b && (b = "resize mousedown mousemove keydown keyup dispose".split(" ")); - -1 < b.indexOf("resize") && (Entry.windowReszied && ($(window).off("resize"), Entry.windowReszied.clear()), Entry.windowResized = new Entry.Event(window), $(window).on("resize", function(a) { - Entry.windowResized.notify(a); - })); - -1 < b.indexOf("mousedown") && (Entry.documentMousedown && (a.off("mousedown"), Entry.documentMousedown.clear()), Entry.documentMousedown = new Entry.Event(window), a.on("mousedown", function(a) { - Entry.documentMousedown.notify(a); - })); - -1 < b.indexOf("mousemove") && (Entry.documentMousemove && (a.off("touchmove mousemove"), Entry.documentMousemove.clear()), Entry.mouseCoordinate = {}, Entry.documentMousemove = new Entry.Event(window), a.on("touchmove mousemove", function(a) { - a.originalEvent && a.originalEvent.touches && (a = a.originalEvent.touches[0]); - Entry.documentMousemove.notify(a); - Entry.mouseCoordinate.x = a.clientX; - Entry.mouseCoordinate.y = a.clientY; - })); - -1 < b.indexOf("keydown") && (Entry.keyPressed && (a.off("keydown"), Entry.keyPressed.clear()), Entry.pressedKeys = [], Entry.keyPressed = new Entry.Event(window), a.on("keydown", function(a) { - var b = a.keyCode; - 0 > Entry.pressedKeys.indexOf(b) && Entry.pressedKeys.push(b); - Entry.keyPressed.notify(a); - })); - -1 < b.indexOf("keyup") && (Entry.keyUpped && (a.off("keyup"), Entry.keyUpped.clear()), Entry.keyUpped = new Entry.Event(window), a.on("keyup", function(a) { - var b = Entry.pressedKeys.indexOf(a.keyCode); - -1 < b && Entry.pressedKeys.splice(b, 1); - Entry.keyUpped.notify(a); - })); - -1 < b.indexOf("dispose") && (Entry.disposeEvent && Entry.disposeEvent.clear(), Entry.disposeEvent = new Entry.Event(window), Entry.documentMousedown && Entry.documentMousedown.attach(this, function(a) { - Entry.disposeEvent.notify(a); - })); -}; -Entry.Utils.makeActivityReporter = function() { - Entry.activityReporter = new Entry.ActivityReporter; - Entry.commander && Entry.commander.addReporter(Entry.activityReporter); - return Entry.activityReporter; -}; -Entry.Utils.initEntryEvent_ = function() { - Entry.events_ || (Entry.events_ = []); -}; -Entry.sampleColours = []; -Entry.assert = function(b, a) { - if (!b) { - throw Error(a || "Assert failed"); - } -}; -Entry.parseTexttoXML = function(b) { - var a; - window.ActiveXObject ? (a = new ActiveXObject("Microsoft.XMLDOM"), a.async = "false", a.loadXML(b)) : a = (new DOMParser).parseFromString(b, "text/xml"); - return a; -}; -Entry.createElement = function(b, a) { - var c = document.createElement(b); - a && (c.id = a); - c.hasClass = function(a) { - return this.className.match(new RegExp("(\\s|^)" + a + "(\\s|$)")); - }; - c.addClass = function(a) { - for (var b = 0;b < arguments.length;b++) { - a = arguments[b], this.hasClass(a) || (this.className += " " + a); - } - }; - c.removeClass = function(a) { - for (var b = 0;b < arguments.length;b++) { - a = arguments[b], this.hasClass(a) && (this.className = this.className.replace(new RegExp("(\\s|^)" + a + "(\\s|$)"), " ")); - } + var c = this.statementsKeyMap; + c[a] = Object.keys(c).length; }; - c.bindOnClick = function(a) { - $(this).on("click tab", function(b) { - b.stopImmediatePropagation(); - a.call(this, b); - }); - }; - return c; -}; -Entry.makeAutolink = function(b) { - return b ? b.replace(/(http|https|ftp|telnet|news|irc):\/\/([-/.a-zA-Z0-9_~#%$?&=:200-377()][^)\]}]+)/gi, "$1://$2").replace(/([xA1-xFEa-z0-9_-]+@[xA1-xFEa-z0-9-]+.[a-z0-9-]+)/gi, "$1") : ""; -}; -Entry.generateHash = function() { - return ("0000" + (Math.random() * Math.pow(36, 4) << 0).toString(36)).substr(-4); +})(Entry.BlockMockup.prototype); +Entry.Playground = function() { + this.enableArduino = this.isTextBGMode_ = !1; + this.viewMode_ = "default"; + Entry.addEventListener("textEdited", this.injectText); + Entry.addEventListener("hwChanged", this.updateHW); }; -Entry.addEventListener = function(b, a) { - this.events_ || (this.events_ = {}); - this.events_[b] || (this.events_[b] = []); - a instanceof Function && this.events_[b].push(a); - return !0; +Entry.Playground.prototype.generateView = function(a, b) { + this.view_ = a; + this.view_.addClass("entryPlayground"); + b && "workspace" != b ? "phone" == b && (this.view_.addClass("entryPlaygroundPhone"), a = Entry.createElement("div", "entryCategoryTab"), a.addClass("entryPlaygroundTabPhone"), Entry.view_.insertBefore(a, this.view_), this.generateTabView(a), this.tabView_ = a, a = Entry.createElement("div", "entryCurtain"), a.addClass("entryPlaygroundCurtainPhone"), a.addClass("entryRemove"), a.innerHTML = Lang.Workspace.cannot_edit_click_to_stop, a.bindOnClick(function() { + Entry.engine.toggleStop(); + }), this.view_.appendChild(a), this.curtainView_ = a, Entry.pictureEditable && (a = Entry.createElement("div", "entryPicture"), a.addClass("entryPlaygroundPicturePhone"), a.addClass("entryRemove"), this.view_.appendChild(a), this.generatePictureView(a), this.pictureView_ = a), a = Entry.createElement("div", "entryText"), a.addClass("entryRemove"), this.view_.appendChild(a), this.generateTextView(a), this.textView_ = a, Entry.soundEditable && (a = Entry.createElement("div", "entrySound"), a.addClass("entryPlaygroundSoundWorkspacePhone"), + a.addClass("entryRemove"), this.view_.appendChild(a), this.generateSoundView(a), this.soundView_ = a), a = Entry.createElement("div", "entryDefault"), this.view_.appendChild(a), this.generateDefaultView(a), this.defaultView_ = a, a = Entry.createElement("div", "entryCode"), a.addClass("entryPlaygroundCodePhone"), this.view_.appendChild(a), this.generateCodeView(a), this.codeView_ = this.codeView_ = a, Entry.addEventListener("run", function(a) { + Entry.playground.curtainView_.removeClass("entryRemove"); + }), Entry.addEventListener("stop", function(a) { + Entry.playground.curtainView_.addClass("entryRemove"); + })) : (this.view_.addClass("entryPlaygroundWorkspace"), a = Entry.createElement("div", "entryCategoryTab"), a.addClass("entryPlaygroundTabWorkspace"), this.view_.appendChild(a), this.generateTabView(a), this.tabView_ = a, a = Entry.createElement("div", "entryCurtain"), a.addClass("entryPlaygroundCurtainWorkspace"), a.addClass("entryRemove"), b = Lang.Workspace.cannot_edit_click_to_stop.split("."), a.innerHTML = b[0] + ".
" + b[1], a.addEventListener("click", function() { + Entry.engine.toggleStop(); + }), this.view_.appendChild(a), this.curtainView_ = a, Entry.pictureEditable && (a = Entry.createElement("div", "entryPicture"), a.addClass("entryPlaygroundPictureWorkspace"), a.addClass("entryRemove"), this.view_.appendChild(a), this.generatePictureView(a), this.pictureView_ = a), a = Entry.createElement("div", "entryText"), a.addClass("entryPlaygroundTextWorkspace"), a.addClass("entryRemove"), this.view_.appendChild(a), this.generateTextView(a), this.textView_ = a, Entry.soundEditable && (a = + Entry.createElement("div", "entrySound"), a.addClass("entryPlaygroundSoundWorkspace"), a.addClass("entryRemove"), this.view_.appendChild(a), this.generateSoundView(a), this.soundView_ = a), a = Entry.createElement("div", "entryDefault"), a.addClass("entryPlaygroundDefaultWorkspace"), this.view_.appendChild(a), this.generateDefaultView(a), this.defaultView_ = a, a = Entry.createElement("div", "entryCode"), a.addClass("entryPlaygroundCodeWorkspace"), a.addClass("entryRemove"), this.view_.appendChild(a), + this.generateCodeView(a), this.codeView_ = a, b = Entry.createElement("div"), b.addClass("entryPlaygroundResizeWorkspace", "entryRemove"), this.resizeHandle_ = b, this.view_.appendChild(b), this.initializeResizeHandle(b), this.codeView_ = a, Entry.addEventListener("run", function(a) { + Entry.playground.curtainView_.removeClass("entryRemove"); + }), Entry.addEventListener("stop", function(a) { + Entry.playground.curtainView_.addClass("entryRemove"); + })); }; -Entry.dispatchEvent = function(b, a) { - this.events_ || (this.events_ = {}); - if (this.events_[b]) { - for (var c = 0, d = this.events_[b].length;c < d;c++) { - this.events_[b][c].call(window, a); - } - } +Entry.Playground.prototype.generateDefaultView = function(a) { + return a; }; -Entry.removeEventListener = function(b, a) { - if (this.events_[b]) { - for (var c = 0, d = this.events_[b].length;c < d;c++) { - if (this.events_[b][c] === a) { - this.events_[b].splice(c, 1); - break; - } - } - } +Entry.Playground.prototype.generateTabView = function(a) { + var b = this, c = Entry.createElement("ul"); + c.addClass("entryTabListWorkspace"); + this.tabList_ = c; + a.appendChild(c); + this.tabViewElements = {}; + a = Entry.createElement("li", "entryCodeTab"); + a.innerHTML = Lang.Workspace.tab_code; + a.addClass("entryTabListItemWorkspace"); + a.addClass("entryTabSelected"); + c.appendChild(a); + a.bindOnClick(function(a) { + b.changeViewMode("code"); + b.blockMenu.reDraw(); + }); + this.tabViewElements.code = a; + Entry.pictureEditable && (a = Entry.createElement("li", "entryPictureTab"), a.innerHTML = Lang.Workspace.tab_picture, a.addClass("entryTabListItemWorkspace"), c.appendChild(a), a.bindOnClick(function(a) { + Entry.playground.changeViewMode("picture"); + }), this.tabViewElements.picture = a, a = Entry.createElement("li", "entryTextboxTab"), a.innerHTML = Lang.Workspace.tab_text, a.addClass("entryTabListItemWorkspace"), c.appendChild(a), a.bindOnClick(function(a) { + Entry.playground.changeViewMode("text"); + }), this.tabViewElements.text = a, a.addClass("entryRemove")); + Entry.soundEditable && (a = Entry.createElement("li", "entrySoundTab"), a.innerHTML = Lang.Workspace.tab_sound, a.addClass("entryTabListItemWorkspace"), c.appendChild(a), a.bindOnClick(function(a) { + Entry.playground.changeViewMode("sound"); + }), this.tabViewElements.sound = a); + Entry.hasVariableManager && (a = Entry.createElement("li", "entryVariableTab"), a.innerHTML = Lang.Workspace.tab_attribute, a.addClass("entryTabListItemWorkspace"), a.addClass("entryVariableTabWorkspace"), c.appendChild(a), a.bindOnClick(function(a) { + Entry.playground.toggleOnVariableView(); + Entry.playground.changeViewMode("variable"); + }), this.tabViewElements.variable = a); }; -Entry.removeAllEventListener = function(b) { - this.events_ && this.events_[b] && delete this.events_[b]; +Entry.Playground.prototype.generateCodeView = function(a) { + var b = this.createVariableView(); + a.appendChild(b); + this.variableView_ = b; + a = Entry.Dom(a); + b = Entry.Dom("div", {parent:a, id:"entryWorkspaceBoard", class:"entryWorkspaceBoard"}); + a = Entry.Dom("div", {parent:a, id:"entryWorkspaceBlockMenu", class:"entryWorkspaceBlockMenu"}); + this.mainWorkspace = new Entry.Workspace({blockMenu:{dom:a, align:"LEFT", categoryData:EntryStatic.getAllBlocks(), scroll:!0}, board:{dom:b}}); + this.blockMenu = this.mainWorkspace.blockMenu; + this.board = this.mainWorkspace.board; + Entry.hw && this.updateHW(); }; -Entry.addTwoNumber = function(b, a) { - if (isNaN(b) || isNaN(a)) { - return b + a; +Entry.Playground.prototype.generatePictureView = function(a) { + if ("workspace" == Entry.type) { + var b = Entry.createElement("div", "entryAddPicture"); + b.addClass("entryPlaygroundAddPicture"); + b.bindOnClick(function(a) { + Entry.dispatchEvent("openPictureManager"); + }); + var c = Entry.createElement("div", "entryAddPictureInner"); + c.addClass("entryPlaygroundAddPictureInner"); + c.innerHTML = Lang.Workspace.picture_add; + b.appendChild(c); + a.appendChild(b); + b = Entry.createElement("ul", "entryPictureList"); + b.addClass("entryPlaygroundPictureList"); + $ && $(b).sortable({start:function(a, b) { + b.item.data("start_pos", b.item.index()); + }, stop:function(a, b) { + a = b.item.data("start_pos"); + b = b.item.index(); + Entry.playground.movePicture(a, b); + }, axis:"y"}); + a.appendChild(b); + this.pictureListView_ = b; + b = Entry.createElement("div", "entryPainter"); + b.addClass("entryPlaygroundPainter"); + a.appendChild(b); + this.painter = new Entry.Painter; + this.painter.initialize(b); + } else { + "phone" == Entry.type && (b = Entry.createElement("div", "entryAddPicture"), b.addClass("entryPlaygroundAddPicturePhone"), b.bindOnClick(function(a) { + Entry.dispatchEvent("openPictureManager"); + }), c = Entry.createElement("div", "entryAddPictureInner"), c.addClass("entryPlaygroundAddPictureInnerPhone"), c.innerHTML = Lang.Workspace.picture_add, b.appendChild(c), a.appendChild(b), b = Entry.createElement("ul", "entryPictureList"), b.addClass("entryPlaygroundPictureListPhone"), $ && $(b).sortable({start:function(a, b) { + b.item.data("start_pos", b.item.index()); + }, stop:function(a, b) { + a = b.item.data("start_pos"); + b = b.item.index(); + Entry.playground.movePicture(a, b); + }, axis:"y"}), a.appendChild(b), this.pictureListView_ = b); } - b += ""; - a += ""; - var c = b.indexOf("."), d = a.indexOf("."), e = 0, f = 0; - 0 < c && (e = b.length - c - 1); - 0 < d && (f = a.length - d - 1); - return 0 < e || 0 < f ? e >= 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 : b < a ? a : b; }; -Entry.isExist = function(b, a, c) { - for (var d = 0;d < c.length;d++) { - if (c[d][a] == b) { - return c[d]; - } +Entry.Playground.prototype.generateTextView = function(a) { + var b = Entry.createElement("div"); + a.appendChild(b); + a = Entry.createElement("div"); + a.addClass("textProperties"); + b.appendChild(a); + var c = Entry.createElement("div"); + c.addClass("entryTextFontSelect"); + a.appendChild(c); + var d = Entry.createElement("select", "entryPainterAttrFontName"); + d.addClass("entryPlaygroundPainterAttrFontName", "entryTextFontSelecter"); + d.size = "1"; + d.onchange = function(a) { + Entry.playground.object.entity.setFontType(a.target.value); + }; + for (var e = 0;e < Entry.fonts.length;e++) { + var f = Entry.fonts[e], g = Entry.createElement("option"); + g.value = f.family; + g.innerHTML = f.name; + d.appendChild(g); } - return !1; -}; -Entry.getColourCodes = function() { - return "transparent #660000 #663300 #996633 #003300 #003333 #003399 #000066 #330066 #660066 #FFFFFF #990000 #993300 #CC9900 #006600 #336666 #0033FF #000099 #660099 #990066 #000000 #CC0000 #CC3300 #FFCC00 #009900 #006666 #0066FF #0000CC #663399 #CC0099 #333333 #FF0000 #FF3300 #FFFF00 #00CC00 #009999 #0099FF #0000FF #9900CC #FF0099 #666666 #CC3333 #FF6600 #FFFF33 #00FF00 #00CCCC #00CCFF #3366FF #9933FF #FF00FF #999999 #FF6666 #FF6633 #FFFF66 #66FF66 #66CCCC #00FFFF #3399FF #9966FF #FF66FF #BBBBBB #FF9999 #FF9966 #FFFF99 #99FF99 #66FFCC #99FFFF #66CCff #9999FF #FF99FF #CCCCCC #FFCCCC #FFCC99 #FFFFCC #CCFFCC #99FFCC #CCFFFF #99CCFF #CCCCFF #FFCCFF".split(" "); -}; -Entry.removeElement = function(b) { - b && b.parentNode && b.parentNode.removeChild(b); -}; -Entry.getElementsByClassName = function(b) { - for (var a = [], c = document.getElementsByTagName("*"), d = 0;d < c.length;d++) { - -1 < (" " + c[d].className + " ").indexOf(" " + b + " ") && a.push(c[d]); + this.fontName_ = d; + c.appendChild(d); + e = Entry.createElement("ul"); + e.addClass("entryPlayground_text_buttons"); + a.appendChild(e); + c = Entry.createElement("li"); + c.addClass("entryPlaygroundTextAlignLeft"); + c.bindOnClick(function(a) { + Entry.playground.setFontAlign(Entry.TEXT_ALIGN_LEFT); + }); + e.appendChild(c); + this.alignLeftBtn = c; + c = Entry.createElement("li"); + c.addClass("entryPlaygroundTextAlignCenter"); + c.bindOnClick(function(a) { + Entry.playground.setFontAlign(Entry.TEXT_ALIGN_CENTER); + }); + e.appendChild(c); + this.alignCenterBtn = c; + c = Entry.createElement("li"); + c.addClass("entryPlaygroundTextAlignRight"); + c.bindOnClick(function(a) { + Entry.playground.setFontAlign(Entry.TEXT_ALIGN_RIGHT); + }); + e.appendChild(c); + this.alignRightBtn = c; + c = Entry.createElement("li"); + e.appendChild(c); + d = Entry.createElement("a"); + c.appendChild(d); + d.bindOnClick(function() { + Entry.playground.object.entity.toggleFontBold() ? h.src = Entry.mediaFilePath + "text_button_bold_true.png" : h.src = Entry.mediaFilePath + "text_button_bold_false.png"; + }); + var h = Entry.createElement("img", "entryPlaygroundText_boldImage"); + d.appendChild(h); + h.src = Entry.mediaFilePath + "text_button_bold_false.png"; + c = Entry.createElement("li"); + e.appendChild(c); + d = Entry.createElement("a"); + c.appendChild(d); + d.bindOnClick(function() { + var a = !Entry.playground.object.entity.getUnderLine() || !1; + k.src = Entry.mediaFilePath + "text_button_underline_" + a + ".png"; + Entry.playground.object.entity.setUnderLine(a); + }); + var k = Entry.createElement("img", "entryPlaygroundText_underlineImage"); + d.appendChild(k); + k.src = Entry.mediaFilePath + "text_button_underline_false.png"; + c = Entry.createElement("li"); + e.appendChild(c); + d = Entry.createElement("a"); + c.appendChild(d); + d.bindOnClick(function() { + Entry.playground.object.entity.toggleFontItalic() ? l.src = Entry.mediaFilePath + "text_button_italic_true.png" : l.src = Entry.mediaFilePath + "/text_button_italic_false.png"; + }); + var l = Entry.createElement("img", "entryPlaygroundText_italicImage"); + d.appendChild(l); + l.src = Entry.mediaFilePath + "text_button_italic_false.png"; + c = Entry.createElement("li"); + e.appendChild(c); + d = Entry.createElement("a"); + c.appendChild(d); + d.bindOnClick(function() { + var a = !Entry.playground.object.entity.getStrike() || !1; + Entry.playground.object.entity.setStrike(a); + q.src = Entry.mediaFilePath + "text_button_strike_" + a + ".png"; + }); + var q = Entry.createElement("img", "entryPlaygroundText_strikeImage"); + d.appendChild(q); + q.src = Entry.mediaFilePath + "text_button_strike_false.png"; + d = Entry.createElement("li"); + e.appendChild(d); + c = Entry.createElement("a"); + d.appendChild(c); + c.bindOnClick(function() { + Entry.playground.toggleColourChooser("foreground"); + }); + d = Entry.createElement("img"); + c.appendChild(d); + d.src = Entry.mediaFilePath + "text_button_color_false.png"; + c = Entry.createElement("li"); + e.appendChild(c); + e = Entry.createElement("a"); + c.appendChild(e); + e.bindOnClick(function() { + Entry.playground.toggleColourChooser("background"); + }); + c = Entry.createElement("img"); + e.appendChild(c); + c.src = Entry.mediaFilePath + "text_button_background_false.png"; + e = Entry.createElement("div"); + e.addClass("entryPlayground_fgColorDiv"); + c = Entry.createElement("div"); + c.addClass("entryPlayground_bgColorDiv"); + a.appendChild(e); + a.appendChild(c); + d = Entry.createElement("div"); + d.addClass("entryPlaygroundTextColoursWrapper"); + this.coloursWrapper = d; + b.appendChild(d); + a = Entry.getColourCodes(); + for (e = 0;e < a.length;e++) { + c = Entry.createElement("div"), c.addClass("modal_colour"), c.setAttribute("colour", a[e]), c.style.backgroundColor = a[e], 0 === e && c.addClass("modalColourTrans"), c.bindOnClick(function(a) { + Entry.playground.setTextColour(a.target.getAttribute("colour")); + }), d.appendChild(c); } - return a; -}; -Entry.parseNumber = function(b) { - return "string" != typeof b || isNaN(Number(b)) ? "number" != typeof b || isNaN(Number(b)) ? !1 : b : Number(b); -}; -Entry.countStringLength = function(b) { - var a, c = 0; - for (a = 0;a < b.length;a++) { - 255 < b.charCodeAt(a) ? c += 2 : c++; + d.style.display = "none"; + d = Entry.createElement("div"); + d.addClass("entryPlaygroundTextBackgroundsWrapper"); + this.backgroundsWrapper = d; + b.appendChild(d); + for (e = 0;e < a.length;e++) { + c = Entry.createElement("div"), c.addClass("modal_colour"), c.setAttribute("colour", a[e]), c.style.backgroundColor = a[e], 0 === e && c.addClass("modalColourTrans"), c.bindOnClick(function(a) { + Entry.playground.setBackgroundColour(a.target.getAttribute("colour")); + }), d.appendChild(c); } - return c; + d.style.display = "none"; + a = Entry.createElement("input"); + a.addClass("entryPlayground_textBox"); + a.onkeyup = function() { + Entry.playground.object.setText(this.value); + Entry.playground.object.entity.setText(this.value); + }; + a.onblur = function() { + Entry.dispatchEvent("textEdited"); + }; + this.textEditInput = a; + b.appendChild(a); + a = Entry.createElement("textarea"); + a.addClass("entryPlayground_textArea"); + a.style.display = "none"; + a.onkeyup = function() { + Entry.playground.object.setText(this.value); + Entry.playground.object.entity.setText(this.value); + }; + a.onblur = function() { + Entry.dispatchEvent("textEdited"); + }; + this.textEditArea = a; + b.appendChild(a); + a = Entry.createElement("div"); + a.addClass("entryPlaygroundFontSizeWrapper"); + b.appendChild(a); + this.fontSizeWrapper = a; + var n = Entry.createElement("div"); + n.addClass("entryPlaygroundFontSizeSlider"); + a.appendChild(n); + var m = Entry.createElement("div"); + m.addClass("entryPlaygroundFontSizeIndicator"); + n.appendChild(m); + this.fontSizeIndiciator = m; + var r = Entry.createElement("div"); + r.addClass("entryPlaygroundFontSizeKnob"); + n.appendChild(r); + this.fontSizeKnob = r; + e = Entry.createElement("div"); + e.addClass("entryPlaygroundFontSizeLabel"); + e.innerHTML = "\uae00\uc790 \ud06c\uae30"; + a.appendChild(e); + var u = !1, t = 0; + r.onmousedown = function(a) { + u = !0; + t = $(n).offset().left; + }; + document.addEventListener("mousemove", function(a) { + u && (a = a.pageX - t, a = Math.max(a, 5), a = Math.min(a, 88), r.style.left = a + "px", a /= .88, m.style.width = a + "%", Entry.playground.object.entity.setFontSize(a)); + }); + document.addEventListener("mouseup", function(a) { + u = !1; + }); + a = Entry.createElement("div"); + a.addClass("entryPlaygroundLinebreakWrapper"); + b.appendChild(a); + b = Entry.createElement("hr"); + b.addClass("entryPlaygroundLinebreakHorizontal"); + a.appendChild(b); + b = Entry.createElement("div"); + b.addClass("entryPlaygroundLinebreakButtons"); + a.appendChild(b); + e = Entry.createElement("img"); + e.bindOnClick(function() { + Entry.playground.toggleLineBreak(!1); + v.innerHTML = Lang.Menus.linebreak_off_desc_1; + x.innerHTML = Lang.Menus.linebreak_off_desc_2; + y.innerHTML = Lang.Menus.linebreak_off_desc_3; + }); + e.src = Entry.mediaFilePath + "text-linebreak-off-true.png"; + b.appendChild(e); + this.linebreakOffImage = e; + e = Entry.createElement("img"); + e.bindOnClick(function() { + Entry.playground.toggleLineBreak(!0); + v.innerHTML = Lang.Menus.linebreak_on_desc_1; + x.innerHTML = Lang.Menus.linebreak_on_desc_2; + y.innerHTML = Lang.Menus.linebreak_on_desc_3; + }); + e.src = Entry.mediaFilePath + "text-linebreak-on-false.png"; + b.appendChild(e); + this.linebreakOnImage = e; + b = Entry.createElement("div"); + b.addClass("entryPlaygroundLinebreakDescription"); + a.appendChild(b); + var v = Entry.createElement("p"); + v.innerHTML = Lang.Menus.linebreak_off_desc_1; + b.appendChild(v); + a = Entry.createElement("ul"); + b.appendChild(a); + var x = Entry.createElement("li"); + x.innerHTML = Lang.Menus.linebreak_off_desc_2; + a.appendChild(x); + var y = Entry.createElement("li"); + y.innerHTML = Lang.Menus.linebreak_off_desc_3; + a.appendChild(y); }; -Entry.cutStringByLength = function(b, a) { - var c, d = 0; - for (c = 0;d < a && c < b.length;c++) { - 255 < b.charCodeAt(c) ? d += 2 : d++; +Entry.Playground.prototype.generateSoundView = function(a) { + if ("workspace" == Entry.type) { + var b = Entry.createElement("div", "entryAddSound"); + b.addClass("entryPlaygroundAddSound"); + b.bindOnClick(function(a) { + Entry.dispatchEvent("openSoundManager"); + }); + var c = Entry.createElement("div", "entryAddSoundInner"); + c.addClass("entryPlaygroundAddSoundInner"); + c.innerHTML = Lang.Workspace.sound_add; + b.appendChild(c); + a.appendChild(b); + b = Entry.createElement("ul", "entrySoundList"); + b.addClass("entryPlaygroundSoundList"); + $ && $(b).sortable({start:function(a, b) { + b.item.data("start_pos", b.item.index()); + }, stop:function(a, b) { + a = b.item.data("start_pos"); + b = b.item.index(); + Entry.playground.moveSound(a, b); + }, axis:"y"}); + a.appendChild(b); + this.soundListView_ = b; + } else { + "phone" == Entry.type && (b = Entry.createElement("div", "entryAddSound"), b.addClass("entryPlaygroundAddSoundPhone"), b.bindOnClick(function(a) { + Entry.dispatchEvent("openSoundManager"); + }), c = Entry.createElement("div", "entryAddSoundInner"), c.addClass("entryPlaygroundAddSoundInnerPhone"), c.innerHTML = Lang.Workspace.sound_add, b.appendChild(c), a.appendChild(b), b = Entry.createElement("ul", "entrySoundList"), b.addClass("entryPlaygroundSoundListPhone"), $ && $(b).sortable({start:function(a, b) { + b.item.data("start_pos", b.item.index()); + }, stop:function(a, b) { + a = b.item.data("start_pos"); + b = b.item.index(); + Entry.playground.moveSound(a, b); + }, axis:"y"}), a.appendChild(b), this.soundListView_ = b); } - return b.substr(0, c); }; -Entry.isChild = function(b, a) { +Entry.Playground.prototype.injectObject = function(a) { if (!a) { - for (;a.parentNode;) { - if ((a = a.parentNode) == b) { - return !0; - } + this.changeViewMode("code"), this.object = null; + } else { + if (a !== this.object) { + this.object && this.object.toggleInformation(!1); + this.object = a; + this.setMenu(a.objectType); + this.injectCode(); + "sprite" == a.objectType && Entry.pictureEditable ? (this.tabViewElements.text && this.tabViewElements.text.addClass("entryRemove"), this.tabViewElements.picture && this.tabViewElements.picture.removeClass("entryRemove")) : "textBox" == a.objectType && (this.tabViewElements.picture && this.tabViewElements.picture.addClass("entryRemove"), this.tabViewElements.text && this.tabViewElements.text.removeClass("entryRemove")); + var b = this.viewMode_; + "default" == b ? this.changeViewMode("code") : "picture" != b && "text" != b || "textBox" != a.objectType ? "text" != b && "picture" != b || "sprite" != a.objectType ? "sound" == b && this.changeViewMode("sound") : this.changeViewMode("picture") : this.changeViewMode("text"); + this.reloadPlayground(); } } - return !1; -}; -Entry.launchFullScreen = function(b) { - b.requestFullscreen ? b.requestFullscreen() : b.mozRequestFulScreen ? b.mozRequestFulScreen() : b.webkitRequestFullscreen ? b.webkitRequestFullscreen() : b.msRequestFullScreen && b.msRequestFullScreen(); -}; -Entry.exitFullScreen = function() { - document.exitFullScreen ? document.exitFullScreen() : document.mozCancelFullScreen ? document.mozCancelFullScreen() : document.webkitExitFullscreen && document.webkitExitFullscreen(); -}; -Entry.isPhone = function() { - return !1; -}; -Entry.getKeyCodeMap = function() { - return {65:"a", 66:"b", 67:"c", 68:"d", 69:"e", 70:"f", 71:"g", 72:"h", 73:"i", 74:"j", 75:"k", 76:"l", 77:"m", 78:"n", 79:"o", 80:"p", 81:"q", 82:"r", 83:"s", 84:"t", 85:"u", 86:"v", 87:"w", 88:"x", 89:"y", 90:"z", 32:Lang.Blocks.START_press_some_key_space, 37:Lang.Blocks.START_press_some_key_left, 38:Lang.Blocks.START_press_some_key_up, 39:Lang.Blocks.START_press_some_key_right, 40:Lang.Blocks.START_press_some_key_down, 48:"0", 49:"1", 50:"2", 51:"3", 52:"4", 53:"5", 54:"6", 55:"7", 56:"8", 57:"9", - 13:Lang.Blocks.START_press_some_key_enter}; -}; -Entry.checkCollisionRect = function(b, a) { - return !(b.y + b.height < a.y || b.y > a.y + a.height || b.x + b.width < a.x || b.x > a.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 < b.length - 1;c += 2) { - a.push(parseInt(b.substr(c, 2), 16)); - } - return String.fromCharCode.apply(String, a); +Entry.Playground.prototype.injectCode = function() { + var a = this.mainWorkspace; + a.changeBoardCode(this.object.script); + a.getBoard().adjustThreadsPosition(); }; -Entry.findObjsByKey = function(b, a, c) { - for (var d = [], e = 0;e < b.length;e++) { - b[e][a] == c && d.push(b[e]); +Entry.Playground.prototype.injectPicture = function() { + var a = this.pictureListView_; + if (a) { + for (;a.hasChildNodes();) { + a.removeChild(a.lastChild); + } + if (this.object) { + for (var b = this.object.pictures, c = 0, d = b.length;c < d;c++) { + var e = b[c].view; + e || console.log(e); + e.orderHolder.innerHTML = c + 1; + a.appendChild(e); + } + this.selectPicture(this.object.selectedPicture); + } else { + Entry.dispatchEvent("pictureClear"); + } } - return d; }; -Entry.factorials = []; -Entry.factorial = function(b) { - return 0 === b || 1 == b ? 1 : 0 < Entry.factorials[b] ? Entry.factorials[b] : Entry.factorials[b] = Entry.factorial(b - 1) * b; +Entry.Playground.prototype.addPicture = function(a, b) { + a = Entry.cloneSimpleObject(a); + delete a.id; + delete a.view; + a = JSON.parse(JSON.stringify(a)); + a.id = Entry.generateHash(); + a.name = Entry.getOrderedName(a.name, this.object.pictures); + this.generatePictureElement(a); + this.object.addPicture(a); + this.injectPicture(); + this.selectPicture(a); }; -Entry.getListRealIndex = function(b, a) { - if (isNaN(b)) { - switch(b) { - case "FIRST": - b = 1; - break; - case "LAST": - b = a.array_.length; - break; - case "RANDOM": - b = Math.floor(Math.random() * a.array_.length) + 1; +Entry.Playground.prototype.setPicture = function(a) { + var b = Entry.container.getPictureElement(a.id, a.objectId), c = $(b); + if (b) { + a.view = b; + b.picture = a; + b = c.find("#t_" + a.id)[0]; + if (a.fileurl) { + b.style.backgroundImage = 'url("' + a.fileurl + '")'; + } else { + var d = a.filename; + b.style.backgroundImage = 'url("' + Entry.defaultPath + "/uploads/" + d.substring(0, 2) + "/" + d.substring(2, 4) + "/thumb/" + d + '.png")'; } + c.find("#s_" + a.id)[0].innerHTML = a.dimension.width + " X " + a.dimension.height; } - return b; + Entry.container.setPicture(a); }; -Entry.toRadian = function(b) { - return b * Math.PI / 180; -}; -Entry.toDegrees = function(b) { - return 180 * b / Math.PI; -}; -Entry.getPicturesJSON = function(b) { - for (var a = [], c = 0, d = b.length;c < d;c++) { - var e = b[c], f = {}; - f._id = e._id; - f.id = e.id; - f.dimension = e.dimension; - f.filename = e.filename; - f.fileurl = e.fileurl; - f.name = e.name; - f.scale = e.scale; - a.push(f); - } - return a; +Entry.Playground.prototype.clonePicture = function(a) { + a = Entry.playground.object.getPicture(a); + this.addPicture(a, !0); }; -Entry.getSoundsJSON = function(b) { - for (var a = [], c = 0, d = b.length;c < d;c++) { - var e = b[c], f = {}; - f._id = e._id; - f.duration = e.duration; - f.ext = e.ext; - f.id = e.id; - f.filename = e.filename; - f.fileurl = e.fileurl; - f.name = e.name; - a.push(f); +Entry.Playground.prototype.selectPicture = function(a) { + for (var b = this.object.pictures, c = 0, d = b.length;c < d;c++) { + var e = b[c]; + e.id === a.id ? e.view.addClass("entryPictureSelected") : e.view.removeClass("entryPictureSelected"); } - return a; + var f; + a && a.id && (f = Entry.container.selectPicture(a.id, a.objectId)); + this.object.id === f && Entry.dispatchEvent("pictureSelected", a); }; -Entry.cutDecimal = function(b) { - return Math.round(100 * b) / 100; +Entry.Playground.prototype.movePicture = function(a, b) { + this.object.pictures.splice(b, 0, this.object.pictures.splice(a, 1)[0]); + this.injectPicture(); + Entry.stage.sortZorder(); }; -Entry.getBrowserType = function() { - if (Entry.userAgent) { - return Entry.userAgent; - } - var b = navigator.userAgent, a, c = b.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []; - if (/trident/i.test(c[1])) { - return a = /\brv[ :]+(\d+)/g.exec(b) || [], "IE " + (a[1] || ""); - } - if ("Chrome" === c[1] && (a = b.match(/\b(OPR|Edge)\/(\d+)/), null != a)) { - return a.slice(1).join(" ").replace("OPR", "Opera"); +Entry.Playground.prototype.injectText = function() { + if (Entry.playground.object) { + Entry.playground.textEditInput.value = Entry.playground.object.entity.getText(); + Entry.playground.textEditArea.value = Entry.playground.object.entity.getText(); + Entry.playground.fontName_.value = Entry.playground.object.entity.getFontName(); + if (Entry.playground.object.entity.font) { + var a = -1 < Entry.playground.object.entity.font.indexOf("bold") || !1; + $("#entryPlaygroundText_boldImage").attr("src", Entry.mediaFilePath + "text_button_bold_" + a + ".png"); + a = -1 < Entry.playground.object.entity.font.indexOf("italic") || !1; + $("#entryPlaygroundText_italicImage").attr("src", Entry.mediaFilePath + "text_button_italic_" + a + ".png"); + } + a = Entry.playground.object.entity.getUnderLine() || !1; + $("#entryPlaygroundText_underlineImage").attr("src", Entry.mediaFilePath + "text_button_underline_" + a + ".png"); + a = Entry.playground.object.entity.getStrike() || !1; + $("#entryPlaygroundText_strikeImage").attr("src", Entry.mediaFilePath + "text_button_strike_" + a + ".png"); + $(".entryPlayground_fgColorDiv").css("backgroundColor", Entry.playground.object.entity.colour); + $(".entryPlayground_bgColorDiv").css("backgroundColor", Entry.playground.object.entity.bgColour); + Entry.playground.toggleLineBreak(Entry.playground.object.entity.getLineBreak()); + Entry.playground.object.entity.getLineBreak() && ($(".entryPlaygroundLinebreakDescription > p").html(Lang.Menus.linebreak_on_desc_1), $(".entryPlaygroundLinebreakDescription > ul > li").eq(0).html(Lang.Menus.linebreak_on_desc_2), $(".entryPlaygroundLinebreakDescription > ul > li").eq(1).html(Lang.Menus.linebreak_on_desc_3)); + Entry.playground.setFontAlign(Entry.playground.object.entity.getTextAlign()); + a = Entry.playground.object.entity.getFontSize(); + Entry.playground.fontSizeIndiciator.style.width = a + "%"; + Entry.playground.fontSizeKnob.style.left = .88 * a + "px"; } - c = c[2] ? [c[1], c[2]] : [navigator.appName, navigator.appVersion, "-?"]; - null != (a = b.match(/version\/(\d+)/i)) && c.splice(1, 1, a[1]); - b = c.join(" "); - return Entry.userAgent = b; -}; -Entry.setBasicBrush = function(b) { - var a = new createjs.Graphics; - a.thickness = 1; - a.rgb = Entry.hex2rgb("#ff0000"); - a.opacity = 100; - a.setStrokeStyle(1); - a.beginStroke("rgba(255,0,0,1)"); - var c = new createjs.Shape(a); - Entry.stage.selectedObjectContainer.addChild(c); - b.brush && (b.brush = null); - b.brush = a; - b.shape && (b.shape = null); - b.shape = c; -}; -Entry.setCloneBrush = function(b, a) { - var c = new createjs.Graphics; - c.thickness = a.thickness; - c.rgb = a.rgb; - c.opacity = a.opacity; - c.setStrokeStyle(c.thickness); - c.beginStroke("rgba(" + c.rgb.r + "," + c.rgb.g + "," + c.rgb.b + "," + c.opacity / 100 + ")"); - var d = new createjs.Shape(c); - Entry.stage.selectedObjectContainer.addChild(d); - b.brush && (b.brush = null); - b.brush = c; - b.shape && (b.shape = null); - b.shape = d; -}; -Entry.isFloat = function(b) { - return /\d+\.{1}\d+/.test(b); }; -Entry.getStringIndex = function(b) { - if (!b) { - return ""; - } - for (var a = {string:b, index:1}, c = 0, d = [], e = b.length - 1;0 < e;--e) { - var f = b.charAt(e); - if (isNaN(f)) { - break; - } else { - d.unshift(f), c = e; +Entry.Playground.prototype.injectSound = function() { + var a = this.soundListView_; + if (a) { + for (;a.hasChildNodes();) { + a.removeChild(a.lastChild); } - } - 0 < c && (a.string = b.substring(0, c), a.index = parseInt(d.join("")) + 1); - return a; -}; -Entry.getOrderedName = function(b, a, c) { - if (!b) { - return "untitled"; - } - if (!a || 0 === a.length) { - return b; - } - c || (c = "name"); - for (var d = 0, e = Entry.getStringIndex(b), f = 0, g = a.length;f < g;f++) { - var h = Entry.getStringIndex(a[f][c]); - e.string === h.string && h.index > d && (d = h.index); - } - return 0 < d ? e.string + d : b; -}; -Entry.changeXmlHashId = function(b) { - if (/function_field/.test(b.getAttribute("type"))) { - for (var a = b.getElementsByTagName("mutation"), c = 0, d = a.length;c < d;c++) { - a[c].setAttribute("hashid", Entry.generateHash()); + if (this.object) { + for (var b = this.object.sounds, c = 0, d = b.length;c < d;c++) { + var e = b[c].view; + e.orderHolder.innerHTML = c + 1; + a.appendChild(e); + } } } - return b; -}; -Entry.getMaxFloatPoint = function(b) { - for (var a = 0, c = 0, d = b.length;c < d;c++) { - var e = String(b[c]), f = e.indexOf("."); - -1 !== f && (e = e.length - (f + 1), e > a && (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.Playground.prototype.moveSound = function(a, b) { + this.object.sounds.splice(b, 0, this.object.sounds.splice(a, 1)[0]); + this.updateListViewOrder("sound"); + Entry.stage.sortZorder(); }; -Entry.deAttachEventListener = function(b, a, c) { - b.removeEventListener(a, c); +Entry.Playground.prototype.addSound = function(a, b) { + a = Entry.cloneSimpleObject(a); + delete a.view; + delete a.id; + a = JSON.parse(JSON.stringify(a)); + a.id = Entry.generateHash(); + a.name = Entry.getOrderedName(a.name, this.object.sounds); + this.generateSoundElement(a); + this.object.addSound(a); + this.injectSound(); }; -Entry.isEmpty = function(b) { - if (!b) { - return !0; +Entry.Playground.prototype.changeViewMode = function(a) { + for (var b in this.tabViewElements) { + this.tabViewElements[b].removeClass("entryTabSelected"); } - for (var a in b) { - if (b.hasOwnProperty(a)) { - return !1; + "default" != a && this.tabViewElements[a].addClass("entryTabSelected"); + if ("variable" != a) { + var c = this.view_.children; + for (b = 0;b < c.length;b++) { + var d = c[b]; + -1 < d.id.toUpperCase().indexOf(a.toUpperCase()) ? d.removeClass("entryRemove") : d.addClass("entryRemove"); } + if ("picture" == a && (!this.pictureView_.object || this.pictureView_.object != this.object)) { + this.pictureView_.object = this.object, this.injectPicture(); + } else { + if ("sound" == a && (!this.soundView_.object || this.soundView_.object != this.object)) { + this.soundView_.object = this.object, this.injectSound(); + } else { + if ("text" == a && "textBox" == this.object.objectType || this.textView_.object != this.object) { + this.textView_.object = this.object, this.injectText(); + } + } + } + "code" == a && this.resizeHandle_ && this.resizeHandle_.removeClass("entryRemove"); + Entry.engine.isState("run") && this.curtainView_.removeClass("entryRemove"); + this.viewMode_ = a; + this.toggleOffVariableView(); } - 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; +Entry.Playground.prototype.createVariableView = function() { + var a = Entry.createElement("div"); + Entry.type && "workspace" != Entry.type ? "phone" == Entry.type && a.addClass("entryVariablePanelPhone") : a.addClass("entryVariablePanelWorkspace"); + this.variableViewWrapper_ = a; + Entry.variableContainer.createDom(a); 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.Playground.prototype.toggleOnVariableView = function() { + Entry.playground.changeViewMode("code"); + this.hideBlockMenu(); + Entry.variableContainer.updateList(); + this.variableView_.removeClass("entryRemove"); + this.resizeHandle_.removeClass("entryRemove"); }; -Entry.Utils.isFunction = function(b) { - return "function" === typeof b; +Entry.Playground.prototype.toggleOffVariableView = function() { + this.showBlockMenu(); + this.variableView_.addClass("entryRemove"); }; -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", {result:"matrixOut", in:"offOut", type:"matrix", values:"0.7 0 0 0 0 0 0.7 0 0 0 0 0 0.7 0 0 0 0 0 1 0"}); - d.elem("feBlend", {in:"SourceGraphic", in1:"offOut", mode:"normal"}); - c = c.elem("filter", {id:"entryBlockHighlightFilter_" + a}); - c.elem("feOffset", {result:"offOut", in:"SourceGraphic", dx:0, dy:0}); - c.elem("feColorMatrix", {result:"matrixOut", in:"offOut", type:"matrix", values:"1.3 0 0 0 0 0 1.3 0 0 0 0 0 1.3 0 0 0 0 0 1 0"}); +Entry.Playground.prototype.editBlock = function() { + var a = Entry.playground; + Entry.stateManager && Entry.stateManager.addCommand("edit block", a, a.restoreBlock, a.object, a.object.getScriptText()); }; -Entry.Utils.addBlockPattern = function(b, a) { - for (var c = b.elem("pattern", {id:"blockHoverPattern_" + a, class:"blockHoverPattern", patternUnits:"userSpaceOnUse", patternTransform:"translate(12, 0)", x:0, y:0, width:125, height:33, style:"display: none"}), d = c.elem("g"), e = d.elem("rect", {x:0, y:0, width:125, height:33}), f = Entry.mediaFilePath + "block_pattern_(order).png", g = 1;5 > g;g++) { - d.elem("image", {class:"pattern" + g, href:f.replace("(order)", g), x:0, y:0, width:125, height:33}); +Entry.Playground.prototype.mouseupBlock = function() { + if (Entry.reporter) { + var a = Entry.playground, b = a.object; + Entry.reporter.report(new Entry.State("edit block mouseup", a, a.restoreBlock, b, b.getScriptText())); } - return {pattern:c, rect:e}; }; -Entry.Utils.COLLISION = {NONE:0, UP:1, RIGHT:2, LEFT:3, DOWN:4}; -Entry.Utils.createMouseEvent = function(b, a) { - var c = document.createEvent("MouseEvent"); - c.initMouseEvent(b, !0, !0, window, 0, 0, 0, a.clientX, a.clientY, !1, !1, !1, !1, 0, null); - return c; +Entry.Playground.prototype.restoreBlock = function(a, b) { + Entry.container.selectObject(a.id); + Entry.stateManager && Entry.stateManager.addCommand("restore block", this, this.restoreBlock, this.object, this.object.getScriptText()); + Blockly.Xml.textToDom(b); }; -Entry.Utils.xmlToJsonData = function(b) { - b = $.parseXML(b); - var a = []; - b = b.childNodes[0].childNodes; - for (var c in b) { - var d = b[c]; - if (d.tagName) { - var e = {category:d.getAttribute("id"), blocks:[]}, d = d.childNodes; - for (c in d) { - var f = d[c]; - f.tagName && (f = f.getAttribute("type")) && e.blocks.push(f); - } - a.push(e); - } +Entry.Playground.prototype.setMenu = function(a) { + if (this.currentObjectType != a) { + var b = this.blockMenu; + b.unbanClass(this.currentObjectType); + b.banClass(a); + b.setMenu(); + b.selectMenu(0, !0); + this.currentObjectType = a; } - return a; }; -Entry.Utils.stopProjectWithToast = function(b, a, c) { - var d = b.block; - a = a || "\ub7f0\ud0c0\uc784 \uc5d0\ub7ec \ubc1c\uc0dd"; - Entry.toast && !c && Entry.toast.alert(Lang.Msgs.warn, Lang.Workspace.check_runtime_error, !0); - Entry.engine && Entry.engine.toggleStop(); - "workspace" === Entry.type && (b.block && "funcBlock" in b.block ? d = b.block.funcBlock : b.funcExecutor && (d = b.funcExecutor.scope.block, b = b.type.replace("func_", ""), Entry.Func.edit(Entry.variableContainer.functions_[b])), d && (Entry.container.selectObject(d.getCode().object.id, !0), d.view.getBoard().activateBlock(d))); - throw Error(a); +Entry.Playground.prototype.hideTabs = function() { + var a = ["picture", "text", "sound", "variable"], b; + for (b in a) { + this.hideTab([a[b]]); + } }; -Entry.Utils.AsyncError = function(b) { - this.name = "AsyncError"; - this.message = b || "\ube44\ub3d9\uae30 \ud638\ucd9c \ub300\uae30"; +Entry.Playground.prototype.hideTab = function(a) { + this.tabViewElements[a] && (this.tabViewElements[a].addClass("hideTab"), this.tabViewElements[a].removeClass("showTab")); }; -Entry.Utils.AsyncError.prototype = Error(); -Entry.Utils.AsyncError.prototype.constructor = Entry.Utils.AsyncError; -Entry.Utils.isChrome = function() { - return /chrom(e|ium)/.test(navigator.userAgent.toLowerCase()); +Entry.Playground.prototype.showTabs = function() { + var a = ["picture", "text", "sound", "variable"], b; + for (b in a) { + this.showTab(a[b]); + } }; -Entry.Utils.waitForWebfonts = function(b, a) { - for (var c = 0, d = 0, e = b.length;d < e;++d) { - (function(d) { - function e() { - h && h.offsetWidth != k && (++c, h.parentNode.removeChild(h), h = null); - if (c >= b.length && (l && clearInterval(l), c == b.length)) { - return a(), !0; - } - } - var h = document.createElement("span"); - h.innerHTML = "giItT1WQy@!-/#"; - h.style.position = "absolute"; - h.style.left = "-10000px"; - h.style.top = "-10000px"; - h.style.fontSize = "300px"; - h.style.fontFamily = "sans-serif"; - h.style.fontVariant = "normal"; - h.style.fontStyle = "normal"; - h.style.fontWeight = "normal"; - h.style.letterSpacing = "0"; - document.body.appendChild(h); - var k = h.offsetWidth; - h.style.fontFamily = d; - var l; - e() || (l = setInterval(e, 50)); - })(b[d]); +Entry.Playground.prototype.showTab = function(a) { + this.tabViewElements[a] && (this.tabViewElements[a].addClass("showTab"), this.tabViewElements[a].removeClass("hideTab")); +}; +Entry.Playground.prototype.initializeResizeHandle = function(a) { + a.onmousedown = function(a) { + Entry.playground.resizing = !0; + Entry.documentMousemove && (Entry.playground.resizeEvent = Entry.documentMousemove.attach(this, function(a) { + Entry.playground.resizing && Entry.resizeElement({menuWidth:a.clientX - Entry.interfaceState.canvasWidth}); + })); + }; + document.addEventListener("mouseup", function(a) { + if (a = Entry.playground.resizeEvent) { + Entry.playground.resizing = !1, Entry.documentMousemove.detach(a), delete Entry.playground.resizeEvent; + } + }); +}; +Entry.Playground.prototype.reloadPlayground = function() { + var a = this.mainWorkspace; + a && (a.getBlockMenu().reDraw(), this.object && this.object.script.view.reDraw()); +}; +Entry.Playground.prototype.flushPlayground = function() { + this.object = null; + if (Entry.playground && Entry.playground.view_) { + this.injectPicture(); + this.injectSound(); + var a = Entry.playground.mainWorkspace.getBoard(); + a.clear(); + a.changeCode(null); } }; -window.requestAnimFrame = function() { - return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(b) { - window.setTimeout(b, 1E3 / 60); - }; -}(); -Entry.Model = function(b, a) { - var c = Entry.Model; - c.generateSchema(b); - c.generateSetter(b); - c.generateObserve(b); - (void 0 === a || a) && Object.seal(b); - return b; +Entry.Playground.prototype.refreshPlayground = function() { + Entry.playground && Entry.playground.view_ && ("picture" === this.getViewMode() && this.injectPicture(), "sound" === this.getViewMode() && this.injectSound()); }; -(function(b) { - b.generateSchema = function(a) { - var b = a.schema; - if (void 0 !== b) { - b = JSON.parse(JSON.stringify(b)); - a.data = {}; - for (var d in b) { - (function(d) { - a.data[d] = b[d]; - Object.defineProperty(a, d, {get:function() { - return a.data[d]; - }}); - })(d); +Entry.Playground.prototype.updateListViewOrder = function(a) { + a = "picture" == a ? this.pictureListView_.childNodes : this.soundListView_.childNodes; + for (var b = 0, c = a.length;b < c;b++) { + a[b].orderHolder.innerHTML = b + 1; + } +}; +Entry.Playground.prototype.generatePictureElement = function(a) { + function b() { + if ("" === this.value.trim()) { + Entry.deAttachEventListener(this, "blur", b), alert("\uc774\ub984\uc744 \uc785\ub825\ud558\uc5ec \uc8fc\uc138\uc694."), this.focus(), Entry.attachEventListener(this, "blur", b); + } else { + for (var a = $(".entryPlaygroundPictureName"), c = 0;c < a.length;c++) { + if (a.eq(c).val() == f.value && a[c] != this) { + Entry.deAttachEventListener(this, "blur", b); + alert("\uc774\ub984\uc774 \uc911\ubcf5 \ub418\uc5c8\uc2b5\ub2c8\ub2e4."); + this.focus(); + Entry.attachEventListener(this, "blur", b); + return; + } } - a._toJSON = this._toJSON; - } - }; - b.generateSetter = function(a) { - a.set = this.set; - }; - b.set = function(a, b) { - var d = {}, e; - for (e in this.data) { - void 0 !== a[e] && (a[e] === this.data[e] ? delete a[e] : (d[e] = this.data[e], this.data[e] = a[e] instanceof Array ? a[e].concat() : a[e])); - } - b || this.notify(Object.keys(a), d); - }; - b.generateObserve = function(a) { - a.observers = []; - a.observe = this.observe; - a.unobserve = this.unobserve; - a.notify = this.notify; - }; - b.observe = function(a, b, d, e) { - d = new Entry.Observer(this.observers, a, b, d); - if (!1 !== e) { - a[b]([]); + this.picture.name = this.value; + Entry.playground.reloadPlayground(); + Entry.dispatchEvent("pictureNameChanged", this.picture); } - return d; - }; - b.unobserve = function(a) { - a.destroy(); + } + var c = Entry.createElement("li", a.id); + a.view = c; + c.addClass("entryPlaygroundPictureElement"); + c.picture = a; + c.bindOnClick(function(a) { + Entry.playground.selectPicture(this.picture); + }); + Entry.Utils.disableContextmenu(a.view); + $(a.view).on("contextmenu", function() { + Entry.ContextMenu.show([{text:Lang.Workspace.context_rename, callback:function() { + f.focus(); + }}, {text:Lang.Workspace.context_duplicate, callback:function() { + Entry.playground.clonePicture(a.id); + }}, {text:Lang.Workspace.context_remove, callback:function() { + Entry.playground.object.removePicture(a.id) ? (Entry.removeElement(c), Entry.toast.success(Lang.Workspace.shape_remove_ok, a.name + " " + Lang.Workspace.shape_remove_ok_msg)) : Entry.toast.alert(Lang.Workspace.shape_remove_fail, Lang.Workspace.shape_remove_fail_msg); + }}, {divider:!0}, {text:Lang.Workspace.context_download, callback:function() { + a.fileurl ? window.open(a.fileurl) : window.open("/api/sprite/download/image/" + encodeURIComponent(a.filename) + "/" + encodeURIComponent(a.name) + ".png"); + }}], "workspace-contextmenu"); + }); + var d = Entry.createElement("div"); + d.addClass("entryPlaygroundPictureOrder"); + c.orderHolder = d; + c.appendChild(d); + d = Entry.createElement("div", "t_" + a.id); + d.addClass("entryPlaygroundPictureThumbnail"); + if (a.fileurl) { + d.style.backgroundImage = 'url("' + a.fileurl + '")'; + } else { + var e = a.filename; + d.style.backgroundImage = 'url("' + Entry.defaultPath + "/uploads/" + e.substring(0, 2) + "/" + e.substring(2, 4) + "/thumb/" + e + '.png")'; + } + c.appendChild(d); + var f = Entry.createElement("input"); + f.addClass("entryPlaygroundPictureName"); + f.addClass("entryEllipsis"); + f.picture = a; + f.value = a.name; + Entry.attachEventListener(f, "blur", b); + f.onkeypress = function(a) { + 13 == a.keyCode && this.blur(); }; - b.notify = function(a, b) { - "string" === typeof a && (a = [a]); - var d = this; - d.observers.map(function(e) { - var f = a; - void 0 !== e.attrs && (f = Entry.Utils.intersectArray(e.attrs, a)); - if (f.length) { - e.object[e.funcName](f.map(function(a) { - return {name:a, object:d, oldValue:b[a]}; - })); + c.appendChild(f); + d = Entry.createElement("div", "s_" + a.id); + d.addClass("entryPlaygroundPictureSize"); + d.innerHTML = a.dimension.width + " X " + a.dimension.height; + c.appendChild(d); +}; +Entry.Playground.prototype.generateSoundElement = function(a) { + var b = Entry.createElement("sound", a.id); + a.view = b; + b.addClass("entryPlaygroundSoundElement"); + b.sound = a; + Entry.Utils.disableContextmenu(a.view); + $(a.view).on("contextmenu", function() { + Entry.ContextMenu.show([{text:Lang.Workspace.context_rename, callback:function() { + g.focus(); + }}, {text:Lang.Workspace.context_duplicate, callback:function() { + Entry.playground.addSound(a, !0); + }}, {text:Lang.Workspace.context_remove, callback:function() { + Entry.playground.object.removeSound(a.id) ? (Entry.removeElement(b), Entry.toast.success(Lang.Workspace.sound_remove_ok, a.name + " " + Lang.Workspace.sound_remove_ok_msg)) : Entry.toast.alert(Lang.Workspace.sound_remove_fail, ""); + Entry.removeElement(b); + }}], "workspace-contextmenu"); + }); + var c = Entry.createElement("div"); + c.addClass("entryPlaygroundSoundOrder"); + b.orderHolder = c; + b.appendChild(c); + var d = Entry.createElement("div"); + d.addClass("entryPlaygroundSoundThumbnail"); + d.addClass("entryPlaygroundSoundPlay"); + var e = !1, f; + d.addEventListener("click", function() { + e ? (e = !1, d.removeClass("entryPlaygroundSoundStop"), d.addClass("entryPlaygroundSoundPlay"), f.stop()) : (e = !0, d.removeClass("entryPlaygroundSoundPlay"), d.addClass("entryPlaygroundSoundStop"), f = createjs.Sound.play(a.id), f.addEventListener("complete", function(a) { + d.removeClass("entryPlaygroundSoundStop"); + d.addClass("entryPlaygroundSoundPlay"); + e = !1; + }), f.addEventListener("loop", function(a) { + }), f.addEventListener("failed", function(a) { + })); + }); + b.appendChild(d); + var g = Entry.createElement("input"); + g.addClass("entryPlaygroundSoundName"); + g.sound = a; + g.value = a.name; + var h = document.getElementsByClassName("entryPlaygroundSoundName"); + g.onblur = function() { + if ("" === this.value) { + alert("\uc774\ub984\uc744 \uc785\ub825\ud558\uc5ec \uc8fc\uc138\uc694."), this.focus(); + } else { + for (var a = 0, b = 0;b < h.length;b++) { + if (h[b].value == g.value && (a += 1, 1 < a)) { + alert("\uc774\ub984\uc774 \uc911\ubcf5 \ub418\uc5c8\uc2b5\ub2c8\ub2e4."); + this.focus(); + return; + } } - }); - }; - b._toJSON = function() { - var a = {}, b; - for (b in this.data) { - a[b] = this.data[b]; + this.sound.name = this.value; + Entry.playground.reloadPlayground(); } - return a; }; -})(Entry.Model); -Entry.Func = function(b) { - this.id = b ? b.id : Entry.generateHash(); - this.content = b ? new Entry.Code(b.content) : new Entry.Code([[{type:"function_create", copyable:!1, deletable:!1, x:40, y:40}]]); - this.blockMenuBlock = this.block = null; - this.hashMap = {}; - this.paramMap = {}; - var a = function() { + g.onkeypress = function(a) { + 13 == a.keyCode && this.blur(); }; - a.prototype = Entry.block.function_general; - a = new a; - a.changeEvent = new Entry.Event; - a.template = Lang.template.function_general; - Entry.block["func_" + this.id] = a; - if (b) { - b = this.content._blockMap; - for (var c in b) { - Entry.Func.registerParamBlock(b[c].type); - } - Entry.Func.generateWsBlock(this); - } - Entry.Func.registerFunction(this); - Entry.Func.updateMenu(); -}; -Entry.Func.threads = {}; -Entry.Func.registerFunction = function(b) { - if (Entry.playground) { - var a = Entry.playground.mainWorkspace; - a && (this._targetFuncBlock = a.getBlockMenu().getCategoryCodes("func").createThread([{type:"func_" + b.id}]), b.blockMenuBlock = this._targetFuncBlock); - } + b.appendChild(g); + c = Entry.createElement("div"); + c.addClass("entryPlaygroundSoundLength"); + c.innerHTML = a.duration + " \ucd08"; + b.appendChild(c); }; -Entry.Func.executeFunction = function(b) { - var a = this.threads[b]; - if (a = Entry.Engine.computeThread(a.entity, a)) { - return this.threads[b] = a, !0; - } - delete this.threads[b]; - return !1; +Entry.Playground.prototype.toggleColourChooser = function(a) { + "foreground" === a ? "none" === this.coloursWrapper.style.display ? (this.coloursWrapper.style.display = "block", this.backgroundsWrapper.style.display = "none") : this.coloursWrapper.style.display = "none" : "background" === a && ("none" === this.backgroundsWrapper.style.display ? (this.backgroundsWrapper.style.display = "block", this.coloursWrapper.style.display = "none") : this.backgroundsWrapper.style.display = "none"); }; -Entry.Func.clearThreads = function() { - this.threads = {}; +Entry.Playground.prototype.setTextColour = function(a) { + Entry.playground.object.entity.setColour(a); + Entry.playground.toggleColourChooser("foreground"); + $(".entryPlayground_fgColorDiv").css("backgroundColor", a); }; -Entry.Func.prototype.init = function(b) { - this.id = b.id; - this.content = Blockly.Xml.textToDom(b.content); - this.block = Blockly.Xml.textToDom("" + b.block + "").childNodes[0]; +Entry.Playground.prototype.setBackgroundColour = function(a) { + Entry.playground.object.entity.setBGColour(a); + Entry.playground.toggleColourChooser("background"); + $(".entryPlayground_bgColorDiv").css("backgroundColor", a); }; -Entry.Func.prototype.destroy = function() { - this.blockMenuBlock.destroy(); +Entry.Playground.prototype.isTextBGMode = function() { + return this.isTextBGMode_; }; -Entry.Func.edit = function(b) { - this.cancelEdit(); - this.targetFunc = b; - this.initEditView(b.content); - this.bindFuncChangeEvent(); - this.updateMenu(); +Entry.Playground.prototype.checkVariables = function() { + Entry.forEBS || (Entry.variableContainer.lists_.length ? this.blockMenu.unbanClass("listNotExist") : this.blockMenu.banClass("listNotExist"), Entry.variableContainer.variables_.length ? this.blockMenu.unbanClass("variableNotExist") : this.blockMenu.banClass("variableNotExist")); }; -Entry.Func.initEditView = function(b) { - this.menuCode || this.setupMenuCode(); - var a = Entry.playground.mainWorkspace; - a.setMode(Entry.Workspace.MODE_OVERLAYBOARD); - a.changeOverlayBoardCode(b); - this._workspaceStateEvent = a.changeEvent.attach(this, this.endEdit); +Entry.Playground.prototype.getViewMode = function() { + return this.viewMode_; }; -Entry.Func.endEdit = function(b) { - this.unbindFuncChangeEvent(); - this._workspaceStateEvent.destroy(); - delete this._workspaceStateEvent; - switch(b) { - case "save": - this.save(); - case "cancelEdit": - this.cancelEdit(); +Entry.Playground.prototype.updateHW = function() { + var a = Entry.playground.mainWorkspace.blockMenu; + if (a) { + var b = Entry.hw; + b && b.connected ? (a.unbanClass("arduinoConnected", !0), a.banClass("arduinoDisconnected", !0), b.banHW(), b.hwModule && a.unbanClass(b.hwModule.name)) : (a.banClass("arduinoConnected", !0), a.unbanClass("arduinoDisconnected", !0), Entry.hw.banHW()); + a.reDraw(); } }; -Entry.Func.save = function() { - this.targetFunc.generateBlock(!0); - Entry.variableContainer.saveFunction(this.targetFunc); +Entry.Playground.prototype.toggleLineBreak = function(a) { + this.object && "textBox" == this.object.objectType && (a ? (Entry.playground.object.entity.setLineBreak(!0), $(".entryPlayground_textArea").css("display", "block"), $(".entryPlayground_textBox").css("display", "none"), this.linebreakOffImage.src = Entry.mediaFilePath + "text-linebreak-off-false.png", this.linebreakOnImage.src = Entry.mediaFilePath + "text-linebreak-on-true.png", this.fontSizeWrapper.removeClass("entryHide")) : (Entry.playground.object.entity.setLineBreak(!1), $(".entryPlayground_textArea").css("display", + "none"), $(".entryPlayground_textBox").css("display", "block"), this.linebreakOffImage.src = Entry.mediaFilePath + "text-linebreak-off-true.png", this.linebreakOnImage.src = Entry.mediaFilePath + "text-linebreak-on-false.png", this.fontSizeWrapper.addClass("entryHide"))); }; -Entry.Func.syncFuncName = function(b) { - var a = 0, c = [], c = b.split(" "), d = ""; - b = []; - b = Blockly.mainWorkspace.getAllBlocks(); - for (var e = 0;e < b.length;e++) { - var f = b[e]; - if ("function_general" === f.type) { - for (var g = [], g = f.inputList, h = 0;h < g.length;h++) { - f = g[h], 0 < f.fieldRow.length && f.fieldRow[0] instanceof Blockly.FieldLabel && void 0 != f.fieldRow[0].text_ && (d += f.fieldRow[0].text_, d += " "); - } - d = d.trim(); - if (d === this.srcFName && this.srcFName.split(" ").length == c.length) { - for (d = 0;d < g.length;d++) { - if (f = g[d], 0 < f.fieldRow.length && f.fieldRow[0] instanceof Blockly.FieldLabel && void 0 != f.fieldRow[0].text_) { - if (void 0 === c[a]) { - g.splice(d, 1); - break; - } else { - f.fieldRow[0].text_ = c[a]; - } - a++; - } - } - } - d = ""; - a = 0; +Entry.Playground.prototype.setFontAlign = function(a) { + if ("textBox" == this.object.objectType) { + this.alignLeftBtn.removeClass("toggle"); + this.alignCenterBtn.removeClass("toggle"); + this.alignRightBtn.removeClass("toggle"); + switch(a) { + case Entry.TEXT_ALIGN_LEFT: + this.alignLeftBtn.addClass("toggle"); + break; + case Entry.TEXT_ALIGN_CENTER: + this.alignCenterBtn.addClass("toggle"); + break; + case Entry.TEXT_ALIGN_RIGHT: + this.alignRightBtn.addClass("toggle"); } + this.object.entity.setTextAlign(a); } - a = Blockly.Xml.workspaceToDom(Blockly.mainWorkspace); - Blockly.mainWorkspace.clear(); - Blockly.Xml.domToWorkspace(Blockly.mainWorkspace, a); }; -Entry.Func.cancelEdit = function() { - this.targetFunc && (Entry.Func.isEdit = !1, this.targetFunc.block || (this._targetFuncBlock.destroy(), delete Entry.variableContainer.functions_[this.targetFunc.id], delete Entry.variableContainer.selected), delete this.targetFunc, this.updateMenu(), Entry.variableContainer.updateList(), Entry.playground.mainWorkspace.setMode(Entry.Workspace.MODE_BOARD)); +Entry.Playground.prototype.hideBlockMenu = function() { + this.mainWorkspace.getBlockMenu().hide(); }; -Entry.Func.getMenuXml = function() { - var b = []; - this.targetFunc || (b = b.concat(this.createBtn)); - if (this.targetFunc) { - var a = this.FIELD_BLOCK, a = a.replace("#1", Entry.generateHash()), a = a.replace("#2", Entry.generateHash()), a = Blockly.Xml.textToDom(a).childNodes, b = b.concat(Entry.nodeListToArray(a)) - } - for (var c in Entry.variableContainer.functions_) { - a = Entry.variableContainer.functions_[c], a === this.targetFunc ? (a = Entry.Func.generateBlock(this.targetFunc, Blockly.Xml.workspaceToDom(Entry.Func.workspace), a.id).block, b.push(a)) : b.push(a.block); - } - return b; +Entry.Playground.prototype.showBlockMenu = function() { + this.mainWorkspace.getBlockMenu().show(); }; -Entry.Func.syncFunc = function() { - var b = Entry.Func; - if (b.targetFunc) { - var a = b.workspace.topBlocks_[0].toString(), c = b.workspace.topBlocks_.length; - (b.fieldText != a || b.workspaceLength != c) && 1 > Blockly.Block.dragMode_ && (b.updateMenu(), b.fieldText = a, b.workspaceLength = c); +Entry.Popup = function() { + Entry.assert(!window.popup, "Popup exist"); + this.body_ = Entry.createElement("div"); + this.body_.addClass("entryPopup"); + this.body_.bindOnClick(function(a) { + a.target == this && this.popup.remove(); + }); + this.body_.popup = this; + document.body.appendChild(this.body_); + this.window_ = Entry.createElement("div"); + this.window_.addClass("entryPopupWindow"); + this.window_.bindOnClick(function() { + }); + Entry.addEventListener("windowResized", this.resize); + window.popup = this; + this.resize(); + this.body_.appendChild(this.window_); +}; +Entry.Popup.prototype.remove = function() { + for (;this.window_.hasChildNodes();) { + "workspace" == Entry.type ? Entry.view_.insertBefore(this.window_.firstChild, Entry.container.view_) : Entry.view_.insertBefore(this.window_.lastChild, Entry.view_.firstChild); } + $("body").css("overflow", "auto"); + Entry.removeElement(this.body_); + window.popup = null; + Entry.removeEventListener("windowResized", this.resize); + Entry.engine.popup = null; }; -Entry.Func.setupMenuCode = function() { - var b = Entry.playground.mainWorkspace; - b && (b = b.getBlockMenu().getCategoryCodes("func"), this._fieldLabel = b.createThread([{type:"function_field_label"}]).getFirstBlock(), this._fieldString = b.createThread([{type:"function_field_string", params:[{type:this.requestParamBlock("string")}]}]).getFirstBlock(), this._fieldBoolean = b.createThread([{type:"function_field_boolean", params:[{type:this.requestParamBlock("boolean")}]}]).getFirstBlock(), this.menuCode = b); +Entry.Popup.prototype.resize = function(a) { + a = window.popup.window_; + var b = .9 * window.innerWidth, c = .9 * window.innerHeight - 35; + 9 * b <= 16 * c ? c = b / 16 * 9 + 35 : (b = 16 * c / 9, c += 35); + a.style.width = String(b) + "px"; + a.style.height = String(c) + "px"; }; -Entry.Func.refreshMenuCode = function() { - if (Entry.playground.mainWorkspace) { - this.menuCode || this.setupMenuCode(); - var b = Entry.block[this._fieldString.params[0].type].changeEvent._listeners.length; - 2 < b && this._fieldString.params[0].changeType(this.requestParamBlock("string")); - b = Entry.block[this._fieldBoolean.params[0].type].changeEvent._listeners.length; - 2 < b && this._fieldBoolean.params[0].changeType(this.requestParamBlock("boolean")); - } +Entry.popupHelper = function(a) { + this.popupList = {}; + this.nowContent; + a && (window.popupHelper = null); + Entry.assert(!window.popupHelper, "Popup exist"); + var b = ["confirm", "spinner"], c = ["entryPopupHelperTopSpan", "entryPopupHelperBottomSpan", "entryPopupHelperLeftSpan", "entryPopupHelperRightSpan"]; + this.body_ = Entry.Dom("div", {classes:["entryPopup", "hiddenPopup", "popupHelper"]}); + var d = this; + this.body_.bindOnClick(function(a) { + if (!(d.nowContent && -1 < b.indexOf(d.nowContent.prop("type")))) { + var f = $(a.target); + c.forEach(function(a) { + f.hasClass(a) && this.popup.hide(); + }.bind(this)); + a.target == this && this.popup.hide(); + } + }); + window.popupHelper = this; + this.body_.prop("popup", this); + Entry.Dom("div", {class:"entryPopupHelperTopSpan", parent:this.body_}); + a = Entry.Dom("div", {class:"entryPopupHelperMiddleSpan", parent:this.body_}); + Entry.Dom("div", {class:"entryPopupHelperBottomSpan", parent:this.body_}); + Entry.Dom("div", {class:"entryPopupHelperLeftSpan", parent:a}); + this.window_ = Entry.Dom("div", {class:"entryPopupHelperWindow", parent:a}); + Entry.Dom("div", {class:"entryPopupHelperRightSpan", parent:a}); + $("body").append(this.body_); }; -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; +Entry.popupHelper.prototype.clearPopup = function() { + for (var a = this.popupWrapper_.children.length - 1;2 < a;a--) { + this.popupWrapper_.removeChild(this.popupWrapper_.children[a]); } - a = b + "Param_" + a; - b = Entry.Func.createParamBlock(a, c, b); - Entry.block[a] = b; - return a; }; -Entry.Func.registerParamBlock = function(b) { - -1 < b.indexOf("stringParam") ? Entry.Func.createParamBlock(b, Entry.block.function_param_string, b) : -1 < b.indexOf("booleanParam") && Entry.Func.createParamBlock(b, Entry.block.function_param_boolean, b); +Entry.popupHelper.prototype.addPopup = function(a, b) { + var c = Entry.Dom("div"), d = Entry.Dom("div", {class:"entryPopupHelperCloseButton"}); + d.bindOnClick(function() { + b.closeEvent ? b.closeEvent(this) : this.hide(); + }.bind(this)); + var e = Entry.Dom("div", {class:"entryPopupHelperWrapper"}); + e.append(d); + b.title && (d = Entry.Dom("div", {class:"entryPopupHelperTitle"}), e.append(d), d.text(b.title)); + c.addClass(a); + c.append(e); + c.popupWrapper_ = e; + c.prop("type", b.type); + "function" === typeof b.setPopupLayout && b.setPopupLayout(c); + this.popupList[a] = c; }; -Entry.Func.createParamBlock = function(b, a, c) { - var d = function() { - }; - c = "string" === c ? "function_param_string" : "function_param_boolean"; - d.prototype = a; - d = new d; - d.changeEvent = new Entry.Event; - d.template = Lang.template[c]; - return Entry.block[b] = d; +Entry.popupHelper.prototype.hasPopup = function(a) { + return !!this.popupList[a]; }; -Entry.Func.updateMenu = function() { - if (Entry.playground && Entry.playground.mainWorkspace) { - var b = Entry.playground.mainWorkspace.getBlockMenu(); - this.targetFunc ? (this.menuCode || this.setupMenuCode(), b.banClass("functionInit"), b.unbanClass("functionEdit")) : (b.unbanClass("functionInit"), b.banClass("functionEdit")); - b.reDraw(); - } +Entry.popupHelper.prototype.setPopup = function(a) { }; -Entry.Func.prototype.edit = function() { - Entry.Func.isEdit || (Entry.Func.isEdit = !0, Entry.Func.svg ? this.parentView.appendChild(this.svg) : Entry.Func.initEditView()); +Entry.popupHelper.prototype.remove = function(a) { + 0 < this.window_.children().length && this.window_.children().remove(); + this.window_.remove(); + delete this.popupList[a]; + this.nowContent = void 0; + this.body_.addClass("hiddenPopup"); }; -Entry.Func.generateBlock = function(b) { - b = Entry.block["func_" + b.id]; - 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; - } - return {block:a, description:e}; +Entry.popupHelper.prototype.resize = function(a) { }; -Entry.Func.prototype.generateBlock = function(b) { - b = Entry.Func.generateBlock(this); - this.block = b.block; - this.description = b.description; +Entry.popupHelper.prototype.show = function(a) { + 0 < this.window_.children().length && this.window_.children().detach(); + this.window_.append(this.popupList[a]); + this.nowContent = this.popupList[a]; + this.body_.removeClass("hiddenPopup"); }; -Entry.Func.generateWsBlock = function(b) { - this.unbindFuncChangeEvent(); - b = b ? b : this.targetFunc; - for (var a = b.content.getEventMap("funcDef")[0].params[0], c = 0, d = 0, e = [], f = "", g = b.hashMap, h = b.paramMap;a;) { - var k = a.params[0]; - switch(a.type) { - case "function_field_label": - f = f + " " + k; - break; - case "function_field_boolean": - Entry.Mutator.mutate(k.type, {template:Lang.Blocks.FUNCTION_logical_variable + " " + (c ? c : "")}); - g[k.type] = !1; - h[k.type] = c + d; - c++; - e.push({type:"Block", accept:"boolean"}); - f += " %" + (c + d); - break; - case "function_field_string": - Entry.Mutator.mutate(k.type, {template:Lang.Blocks.FUNCTION_character_variable + " " + (d ? d : "")}), g[k.type] = !1, h[k.type] = c + d, d++, f += " %" + (c + d), e.push({type:"Block", accept:"string"}); - } - a = a.getOutputBlock(); - } - c++; - f += " %" + (c + d); - e.push({type:"Indicator", img:"block_icon/function_03.png", size:12}); - Entry.Mutator.mutate("func_" + b.id, {params:e, template:f}); - for (var l in g) { - g[l] ? (a = -1 < l.indexOf("string") ? Lang.Blocks.FUNCTION_character_variable : Lang.Blocks.FUNCTION_logical_variable, Entry.Mutator.mutate(l, {template:a})) : g[l] = !0; - } - this.bindFuncChangeEvent(b); +Entry.popupHelper.prototype.hide = function() { + this.nowContent = void 0; + this.body_.addClass("hiddenPopup"); +}; +Entry.getStartProject = function(a) { + return {category:"\uae30\ud0c0", scenes:[{name:"\uc7a5\uba74 1", id:"7dwq"}], variables:[{name:"\ucd08\uc2dc\uacc4", id:"brih", visible:!1, value:"0", variableType:"timer", x:150, y:-70, array:[], object:null, isCloud:!1}, {name:"\ub300\ub2f5", id:"1vu8", visible:!1, value:"0", variableType:"answer", x:150, y:-100, array:[], object:null, isCloud:!1}], objects:[{id:"7y0y", name:"\uc5d4\ud2b8\ub9ac\ubd07", script:[[{type:"when_run_button_click", x:40, y:50}, {type:"repeat_basic", statements:[[{type:"move_direction"}]]}]], + selectedPictureId:"vx80", objectType:"sprite", rotateMethod:"free", scene:"7dwq", sprite:{sounds:[{duration:1.3, ext:".mp3", id:"8el5", fileurl:a + "media/bark.mp3", name:"\uac15\uc544\uc9c0 \uc9d6\ub294\uc18c\ub9ac"}], pictures:[{id:"vx80", fileurl:a + "media/entrybot1.png", name:Lang.Blocks.walking_entryBot + "1", scale:100, dimension:{width:284, height:350}}, {id:"4t48", fileurl:a + "media/entrybot2.png", name:Lang.Blocks.walking_entryBot + "2", scale:100, dimension:{width:284, height:350}}]}, + entity:{x:0, y:0, regX:142, regY:175, scaleX:.3154574132492113, scaleY:.3154574132492113, rotation:0, direction:90, width:284, height:350, visible:!0}, lock:!1, active:!0}], speed:60}; }; -Entry.Func.bindFuncChangeEvent = function(b) { - b = b ? b : this.targetFunc; - !this._funcChangeEvent && b.content.getEventMap("funcDef")[0].view && (this._funcChangeEvent = b.content.getEventMap("funcDef")[0].view._contents[1].changeEvent.attach(this, this.generateWsBlock)); +Entry.Reporter = function(a) { + this.projectId = this.userId = null; + this.isRealTime = a; + this.activities = []; }; -Entry.Func.unbindFuncChangeEvent = function() { - this._funcChangeEvent && this._funcChangeEvent.destroy(); - delete this._funcChangeEvent; +Entry.Reporter.prototype.start = function(a, b, c) { + this.isRealTime && (-1 < window.location.href.indexOf("localhost") ? this.io = io("localhost:7000") : this.io = io("play04.play-entry.com:7000"), this.io.emit("activity", {message:"start", userId:b, projectId:a, time:c})); + this.userId = b; + this.projectId = a; }; -Entry.HWMontior = {}; -Entry.HWMonitor = function(b) { - this.svgDom = Entry.Dom($('')); - this._hwModule = b; +Entry.Reporter.prototype.report = function(a) { + if (!this.isRealTime || this.io) { + var b = [], c; + for (c in a.params) { + var d = a.params[c]; + "object" !== typeof d ? b.push(d) : d.id && b.push(d.id); + } + a = {message:a.message, userId:this.userId, projectId:this.projectId, time:a.time, params:b}; + this.isRealTime ? this.io.emit("activity", a) : this.activities.push(a); + } +}; +Entry.Scene = function() { var a = this; - Entry.addEventListener("windowResized", function() { - var b = a._hwModule.monitorTemplate.mode; - "both" == b && (a.resize(), a.resizeList()); - "list" == b ? a.resizeList() : a.resize(); - }); - Entry.addEventListener("hwModeChange", function() { - a.changeMode(); + this.scenes_ = []; + this.selectedScene = null; + this.maxCount = 20; + $(window).on("resize", function(b) { + a.resize(); }); - this.changeOffset = 0; - this.scale = .5; - this._listPortViews = {}; }; -(function(b) { - b.initView = function() { - this.svgDom = Entry.Dom($('')); - }; - b.generateView = function() { - this.snap = Entry.SVG("hwMonitor"); - this._svgGroup = this.snap.elem("g"); - this._portMap = {n:[], e:[], s:[], w:[]}; - var a = this._hwModule.monitorTemplate, b = {href:Entry.mediaFilePath + a.imgPath, x:-a.width / 2, y:-a.height / 2, width:a.width, height:a.height}; - this._portViews = {}; - this.hwView = this._svgGroup.elem("image"); - this.hwView = this.hwView.attr(b); - this._template = a; - a = a.ports; - this.pathGroup = null; - this.pathGroup = this._svgGroup.elem("g"); - var b = [], d; - for (d in a) { - var e = this.generatePortView(a[d], "_svgGroup"); - this._portViews[d] = e; - b.push(e); - } - b.sort(function(a, b) { - return a.box.x - b.box.x; - }); - var f = this._portMap; - b.map(function(a) { - (1 > (Math.atan2(-a.box.y, a.box.x) / Math.PI + 2) % 2 ? f.n : f.s).push(a); - }); - this.resize(); - }; - b.toggleMode = function(a) { - var b = this._hwModule.monitorTemplate; - "list" == a ? (b.TempPort = null, this._hwModule.monitorTemplate.ports && (this._hwModule.monitorTemplate.TempPort = this._hwModule.monitorTemplate.ports, this._hwModule.monitorTemplate.listPorts = this.addPortEle(this._hwModule.monitorTemplate.listPorts, this._hwModule.monitorTemplate.ports)), $(this._svglistGroup).remove(), this._svgGroup && $(this._svgGroup).remove(), $(this._pathGroup).remove(), this._hwModule.monitorTemplate.mode = "list", this.generateListView()) : (this._hwModule.monitorTemplate.TempPort && - (this._hwModule.monitorTemplate.ports = this._hwModule.monitorTemplate.TempPort, this._hwModule.monitorTemplate.listPorts = this.removePortEle(this._hwModule.monitorTemplate.listPorts, this._hwModule.monitorTemplate.ports)), $(this._svglistGroup).remove(), this._hwModule.monitorTemplate.mode = "both", this.generateListView(), this.generateView()); - }; - b.setHwmonitor = function(a) { - this._hwmodule = a; - }; - b.changeMode = function(a) { - "both" == this._hwModule.monitorTemplate.mode ? this.toggleMode("list") : "list" == this._hwModule.monitorTemplate.mode && this.toggleMode("both"); - }; - b.addPortEle = function(a, b) { - if ("object" != typeof b) { - return a; - } - for (var d in b) { - a[d] = b[d]; - } - return a; - }; - b.removePortEle = function(a, b) { - if ("object" != typeof b) { - return a; - } - for (var d in b) { - delete a[d]; - } - return a; - }; - b.generateListView = function() { - this._portMapList = {n:[]}; - this._svglistGroup = null; - this.listsnap = Entry.SVG("hwMonitor"); - this._svglistGroup = this.listsnap.elem("g"); - var a = this._hwModule.monitorTemplate; - this._template = a; - a = a.listPorts; - this.pathGroup = this._svglistGroup.elem("g"); - var b = [], d; - for (d in a) { - var e = this.generatePortView(a[d], "_svglistGroup"); - this._listPortViews[d] = e; - b.push(e); - } - var f = this._portMapList; - b.map(function(a) { - f.n.push(a); - }); - this.resizeList(); - }; - b.generatePortView = function(a, b) { - var d = this[b].elem("g"); - d.addClass("hwComponent"); - var e = null, e = this.pathGroup.elem("path").attr({d:"m0,0", fill:"none", stroke:"input" === a.type ? "#00979d" : "#A751E3", "stroke-width":3}), f = d.elem("rect").attr({x:0, y:0, width:150, height:22, rx:4, ry:4, fill:"#fff", stroke:"#a0a1a1"}), g = d.elem("text").attr({x:4, y:12, fill:"#000", "class":"hwComponentName", "alignment-baseline":"central"}); - g.textContent = a.name; - g = g.getComputedTextLength(); - d.elem("rect").attr({x:g + 8, y:2, width:30, height:18, rx:9, ry:9, fill:"input" === a.type ? "#00979d" : "#A751E3"}); - var h = d.elem("text").attr({x:g + 13, y:12, fill:"#fff", "class":"hwComponentValue", "alignment-baseline":"central"}); - h.textContent = 0; - g += 40; - f.attr({width:g}); - return {group:d, value:h, type:a.type, path:e, box:{x:a.pos.x - this._template.width / 2, y:a.pos.y - this._template.height / 2, width:g}, width:g}; - }; - b.getView = function() { - return this.svgDom; - }; - b.update = function() { - var a = Entry.hw.portData, b = Entry.hw.sendQueue, d = this._hwModule.monitorTemplate.mode, e = this._hwModule.monitorTemplate.keys || [], f = []; - if ("list" == d) { - f = this._listPortViews; - } else { - if ("both" == d) { - if (f = this._listPortViews, this._portViews) { - for (var g in this._portViews) { - f[g] = this._portViews[g]; - } - } - } else { - f = this._portViews; - } - } - if (b) { - for (g in b) { - 0 != b[g] && f[g] && (f[g].type = "output"); - } - } - for (var h in f) { - if (d = f[h], "input" == d.type) { - var k = a[h]; - 0 < e.length && $.each(e, function(a, b) { - if ($.isPlainObject(k)) { - k = k[b] || 0; - } else { - return !1; - } - }); - d.value.textContent = k ? k : 0; - d.group.getElementsByTagName("rect")[1].attr({fill:"#00979D"}); - } else { - k = b[h], 0 < e.length && $.each(e, function(a, b) { - if ($.isPlainObject(k)) { - k = k[b] || 0; - } else { - return !1; - } - }), d.value.textContent = k ? k : 0, d.group.getElementsByTagName("rect")[1].attr({fill:"#A751E3"}); - } - } - }; - b.resize = function() { - this.hwView && this.hwView.attr({transform:"scale(" + this.scale + ")"}); - if (this.svgDom) { - var a = this.svgDom.get(0).getBoundingClientRect() - } - this._svgGroup.attr({transform:"translate(" + a.width / 2 + "," + a.height / 1.8 + ")"}); - this._rect = a; - 0 >= this._template.height || 0 >= a.height || (this.scale = a.height / this._template.height * this._template.height / 1E3, this.align()); - }; - b.resizeList = function() { - var a = this.svgDom.get(0).getBoundingClientRect(); - this._svglistGroup.attr({transform:"translate(" + a.width / 2 + "," + a.height / 2 + ")"}); - this._rect = a; - this.alignList(); - }; - b.align = function() { - var a = [], a = this._portMap.s.concat(); - this._alignNS(a, this.scale / 3 * this._template.height + 5, 27); - a = this._portMap.n.concat(); - this._alignNS(a, -this._template.height * this.scale / 3 - 32, -27); - a = this._portMap.e.concat(); - this._alignEW(a, -this._template.width * this.scale / 3 - 5, -27); - a = this._portMap.w.concat(); - this._alignEW(a, this._template.width * this.scale / 3 - 32, -27); - }; - b.alignList = function() { - for (var a = {}, a = this._hwModule.monitorTemplate.listPorts, b = a.length, d = 0;d < a.length;d++) { - a[d].group.attr({transform:"translate(" + this._template.width * (d / b - .5) + "," + (-this._template.width / 2 - 30) + ")"}); - } - a = this._portMapList.n.concat(); - this._alignNSList(a, -this._template.width * this.scale / 2 - 32, -27); - }; - b._alignEW = function(a, b, d) { - var e = a.length, f = this._rect.height - 50; - tP = -f / 2; - bP = f / 2; - height = this._rect.height; - listVLine = wholeHeight = 0; - mode = this._hwModule.monitorTemplate; - for (f = 0;f < e;f++) { - wholeHeight += a[f].height + 5; - } - wholeHeight < bP - tP && (bP = wholeHeight / 2 + 3, tP = -wholeHeight / 2 - 3); - for (;1 < e;) { - var g = a.shift(), f = a.pop(), h = tP, k = bP, l = d; - wholeWidth <= bP - tP ? (tP += g.width + 5, bP -= f.width + 5, l = 0) : 0 === a.length ? (tP = (tP + bP) / 2 - 3, bP = tP + 6) : (tP = Math.max(tP, -width / 2 + g.width) + 15, bP = Math.min(bP, width / 2 - f.width) - 15); - wholeWidth -= g.width + f.width + 10; - b += l; - } - a.length && a[0].group.attr({transform:"translate(" + b + ",60)"}); - g && rPort && (this._movePort(g, b, tP, h), this._movePort(rPort, b, bP, k)); - }; - b._alignNS = function(a, b, d) { - for (var e = -this._rect.width / 2, f = this._rect.width / 2, g = this._rect.width, h = 0, k = 0;k < a.length;k++) { - h += a[k].width + 5; - } - h < f - e && (f = h / 2 + 3, e = -h / 2 - 3); - for (;1 < a.length;) { - var k = a.shift(), l = a.pop(), q = e, n = f, m = d; - h <= f - e ? (e += k.width + 5, f -= l.width + 5, m = 0) : 0 === a.length ? (e = (e + f) / 2 - 3, f = e + 6) : (e = Math.max(e, -g / 2 + k.width) + 15, f = Math.min(f, g / 2 - l.width) - 15); - this._movePort(k, e, b, q); - this._movePort(l, f, b, n); - h -= k.width + l.width + 10; - b += m; - } - a.length && this._movePort(a[0], (f + e - a[0].width) / 2, b, 100); - }; - b._alignNSList = function(a, b) { - var d = this._rect.width; - initX = -this._rect.width / 2 + 10; - initY = -this._rect.height / 2 + 10; - for (var e = listLine = wholeWidth = 0;e < a.length;e++) { - wholeWidth += a[e].width; - } - for (var f = 0, g = 0, h = initX, k = 0, l = 0, q = 0, e = 0;e < a.length;e++) { - l = a[e], e != a.length - 1 && (q = a[e + 1]), g += l.width, lP = initX, k = initY + 30 * f, l.group.attr({transform:"translate(" + lP + "," + k + ")"}), initX += l.width + 10, g > d - (l.width + q.width / 2.2) && (f += 1, initX = h, g = 0); - } +Entry.Scene.viewBasicWidth = 70; +Entry.Scene.prototype.generateView = function(a, b) { + var c = this; + this.view_ = a; + this.view_.addClass("entryScene"); + b && "workspace" != b || (this.view_.addClass("entrySceneWorkspace"), $(this.view_).on("mousedown", function(a) { + var b = $(this).offset(), f = $(window), g = a.pageX - b.left + f.scrollLeft(); + a = a.pageY - b.top + f.scrollTop(); + a = 40 - a; + b = -40 / 55; + f = $(c.selectedScene.view).find(".entrySceneRemoveButtonCoverWorkspace").offset().left; + !(g < f || g > f + 55) && a > 40 + b * (g - f) && (g = c.getNextScene()) && (g = $(g.view), $(document).trigger("mouseup"), g.trigger("mousedown")); + }), a = Entry.createElement("ul"), a.addClass("entrySceneListWorkspace"), Entry.sceneEditable && $ && $(a).sortable({start:function(a, b) { + b.item.data("start_pos", b.item.index()); + $(b.item[0]).clone(!0); + }, stop:function(a, b) { + a = b.item.data("start_pos"); + b = b.item.index(); + Entry.scene.moveScene(a, b); + }, axis:"x", tolerance:"pointer"}), this.view_.appendChild(a), this.listView_ = a, Entry.sceneEditable && (a = Entry.createElement("span"), a.addClass("entrySceneElementWorkspace"), a.addClass("entrySceneAddButtonWorkspace"), a.bindOnClick(function(a) { + Entry.engine.isState("run") || Entry.scene.addScene(); + }), this.view_.appendChild(a), this.addButton_ = a)); +}; +Entry.Scene.prototype.generateElement = function(a) { + var b = this, c = Entry.createElement("li", a.id); + c.addClass("entrySceneElementWorkspace"); + c.addClass("entrySceneButtonWorkspace"); + c.addClass("minValue"); + $(c).on("mousedown", function(b) { + Entry.engine.isState("run") ? b.preventDefault() : Entry.scene.selectScene(a); + }); + var d = Entry.createElement("input"); + d.addClass("entrySceneFieldWorkspace"); + d.value = a.name; + Entry.sceneEditable || (d.disabled = "disabled"); + var e = Entry.createElement("span"); + e.addClass("entrySceneLeftWorkspace"); + c.appendChild(e); + var f = Entry.createElement("span"); + f.addClass("entrySceneInputCover"); + f.style.width = Entry.computeInputWidth(a.name); + c.appendChild(f); + a.inputWrapper = f; + d.onkeyup = function(c) { + c = c.keyCode; + Entry.isArrowOrBackspace(c) || (a.name = this.value, f.style.width = Entry.computeInputWidth(a.name), b.resize(), 13 == c && this.blur(), 10 < this.value.length && (this.value = this.value.substring(0, 10), this.blur())); }; - b._movePort = function(a, b, d, e) { - var f = b, g = a.box.x * this.scale, h = a.box.y * this.scale; - b > e ? (f = b - a.width, b = b > g && g > e ? "M" + g + "," + d + "L" + g + "," + h : "M" + (b + e) / 2 + "," + d + "l0," + (h > d ? 28 : -3) + "H" + g + "L" + g + "," + h) : b = b < g && g < e ? "m" + g + "," + d + "L" + g + "," + h : "m" + (e + b) / 2 + "," + d + "l0," + (h > d ? 28 : -3) + "H" + g + "L" + g + "," + h; - a.group.attr({transform:"translate(" + f + "," + d + ")"}); - a.path.attr({d:b}); + d.onblur = function(b) { + d.value = this.value; + a.name = this.value; + f.style.width = Entry.computeInputWidth(a.name); }; -})(Entry.HWMonitor.prototype); -Entry.HW = function() { - this.connectTrial = 0; - this.isFirstConnect = !0; - this.initSocket(); - this.connected = !1; - this.portData = {}; - this.sendQueue = {}; - this.outputQueue = {}; - this.settingQueue = {}; - this.socketType = this.hwModule = this.selectedDevice = null; - Entry.addEventListener("stop", this.setZero); - this.hwInfo = {11:Entry.Arduino, 19:Entry.ArduinoExt, 12:Entry.SensorBoard, 13:Entry.CODEino, 14:Entry.joystick, 15:Entry.dplay, 16:Entry.nemoino, 17:Entry.Xbot, 18:Entry.ardublock, 24:Entry.Hamster, 25:Entry.Albert, 31:Entry.Bitbrick, 42:Entry.Arduino, 51:Entry.Neobot, 71:Entry.Robotis_carCont, 72:Entry.Robotis_openCM70, 81:Entry.Arduino}; -}; -Entry.HW.TRIAL_LIMIT = 1; -p = Entry.HW.prototype; -p.initSocket = function() { - try { - if (this.connectTrial >= Entry.HW.TRIAL_LIMIT) { - this.isFirstConnect || Entry.toast.alert(Lang.Menus.connect_hw, Lang.Menus.connect_fail, !1), this.isFirstConnect = !1; - } else { - var b = this, a, c; - this.connected = !1; - this.connectTrial++; - if (-1 < location.protocol.indexOf("https")) { - c = new WebSocket("wss://hardware.play-entry.org:23518"); - } else { - try { - a = new WebSocket("ws://127.0.0.1:23518"), a.binaryType = "arraybuffer", a.onopen = function() { - b.socketType = "WebSocket"; - b.initHardware(a); - }.bind(this), a.onmessage = function(a) { - a = 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"); + f.appendChild(d); + e = Entry.createElement("span"); + e.addClass("entrySceneRemoveButtonCoverWorkspace"); + c.appendChild(e); + if (Entry.sceneEditable) { + var g = Entry.createElement("button"); + g.addClass("entrySceneRemoveButtonWorkspace"); + g.innerHTML = "x"; + g.scene = a; + g.bindOnClick(function(a) { + a.stopPropagation(); + Entry.engine.isState("run") || confirm(Lang.Workspace.will_you_delete_scene) && Entry.scene.removeScene(this.scene); + }); + e.appendChild(g); + } + Entry.Utils.disableContextmenu(c); + $(c).on("contextmenu", function() { + var b = [{text:Lang.Workspace.duplicate_scene, enable:Entry.engine.isState("stop"), callback:function() { + Entry.scene.cloneScene(a); + }}]; + Entry.ContextMenu.show(b, "workspace-contextmenu"); + }); + return a.view = c; +}; +Entry.Scene.prototype.updateView = function() { + if (!Entry.type || "workspace" == Entry.type) { + for (var a = this.listView_, b = $(a).children().length;b < this.getScenes().length;b++) { + a.appendChild(this.getScenes()[b].view); } - } catch (d) { + this.addButton_ && (this.getScenes().length < this.maxCount ? this.addButton_.removeClass("entryRemove") : this.addButton_.addClass("entryRemove")); } + this.resize(); }; -p.retryConnect = function() { - this.connectTrial = 0; - this.initSocket(); +Entry.Scene.prototype.addScenes = function(a) { + if ((this.scenes_ = a) && 0 !== a.length) { + for (var b = 0, c = a.length;b < c;b++) { + this.generateElement(a[b]); + } + } else { + this.scenes_ = [], this.scenes_.push(this.createScene()); + } + this.selectScene(this.getScenes()[0]); + this.updateView(); }; -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); +Entry.Scene.prototype.addScene = function(a, b) { + void 0 === a && (a = this.createScene()); + a.view || this.generateElement(a); + b || "number" == typeof b ? this.getScenes().splice(b, 0, a) : this.getScenes().push(a); + Entry.stage.objectContainers.push(Entry.stage.createObjectContainer(a)); + Entry.playground.flushPlayground(); + this.selectScene(a); + this.updateView(); + return a; }; -p.setDigitalPortValue = function(b, a) { - this.sendQueue[b] = a; - this.removePortReadable(b); +Entry.Scene.prototype.removeScene = function(a) { + if (1 >= this.getScenes().length) { + Entry.toast.alert(Lang.Msgs.runtime_error, Lang.Workspace.Scene_delete_error, !1); + } else { + var b = this.getScenes().indexOf(this.getSceneById(a.id)); + this.getScenes().splice(b, 1); + for (var b = Entry.container.getSceneObjects(a), c = 0;c < b.length;c++) { + Entry.container.removeObject(b[c]); + } + Entry.stage.removeObjectContainer(a); + $(a.view).remove(); + this.selectScene(); + } }; -p.getAnalogPortValue = function(b) { - return this.connected ? this.portData["a" + b] : 0; +Entry.Scene.prototype.selectScene = function(a) { + a = a || this.getScenes()[0]; + if (!this.selectedScene || this.selectedScene.id != a.id) { + Entry.engine.isState("run") && Entry.container.resetSceneDuringRun(); + var b = this.selectedScene; + b && (b = b.view, b.removeClass("selectedScene"), b = $(b), b.find("input").blur()); + this.selectedScene = a; + a.view.addClass("selectedScene"); + Entry.container.setCurrentObjects(); + Entry.stage.objectContainers && 0 !== Entry.stage.objectContainers.length && Entry.stage.selectObjectContainer(a); + (a = Entry.container.getCurrentObjects()[0]) && "minimize" != Entry.type ? (Entry.container.selectObject(a.id), Entry.playground.refreshPlayground()) : (Entry.stage.selectObject(null), Entry.playground.flushPlayground(), Entry.variableContainer.updateList()); + Entry.container.listView_ || Entry.stage.sortZorder(); + Entry.container.updateListView(); + this.updateView(); + Entry.requestUpdate = !0; + } }; -p.getDigitalPortValue = function(b) { - if (!this.connected) { - return 0; +Entry.Scene.prototype.toJSON = function() { + for (var a = [], b = this.getScenes().length, c = 0;c < b;c++) { + var d = this.getScenes()[c], e = d.view, f = d.inputWrapper; + delete d.view; + delete d.inputWrapper; + a.push(JSON.parse(JSON.stringify(d))); + d.view = e; + d.inputWrapper = f; } - this.setPortReadable(b); - return void 0 !== this.portData[b] ? this.portData[b] : 0; + return a; }; -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; +Entry.Scene.prototype.moveScene = function(a, b) { + this.getScenes().splice(b, 0, this.getScenes().splice(a, 1)[0]); + Entry.container.updateObjectsOrder(); + Entry.stage.sortZorder(); + $(".entrySceneElementWorkspace").removeAttr("style"); +}; +Entry.Scene.prototype.getSceneById = function(a) { + for (var b = this.getScenes(), c = 0;c < b.length;c++) { + if (b[c].id == a) { + return b[c]; } } - a || this.sendQueue.readablePorts.push(b); + return !1; }; -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; +Entry.Scene.prototype.getScenes = function() { + return this.scenes_; +}; +Entry.Scene.prototype.takeStartSceneSnapshot = function() { + this.sceneBeforeRun = this.selectedScene; +}; +Entry.Scene.prototype.loadStartSceneSnapshot = function() { + this.selectScene(this.sceneBeforeRun); + this.sceneBeforeRun = null; +}; +Entry.Scene.prototype.createScene = function() { + var a = {name:Lang.Blocks.SCENE + " " + (this.getScenes().length + 1), id:Entry.generateHash()}; + this.generateElement(a); + return a; +}; +Entry.Scene.prototype.cloneScene = function(a) { + if (this.scenes_.length >= this.maxCount) { + Entry.toast.alert(Lang.Msgs.runtime_error, Lang.Workspace.Scene_add_error, !1); + } else { + var b = {name:a.name + Lang.Workspace.replica_of_object, id:Entry.generateHash()}; + this.generateElement(b); + this.addScene(b); + a = Entry.container.getSceneObjects(a); + for (var c = a.length - 1;0 <= c;c--) { + Entry.container.addCloneObject(a[c], b.id); + } + } +}; +Entry.Scene.prototype.resize = function() { + var a = this.getScenes(), b = this.selectedScene, c = a[0]; + if (0 !== a.length && c) { + var d = $(c.view).offset().left, c = parseFloat($(b.view).css("margin-left")), e = $(this.view_).width() - d, f = 0, g; + for (g in a) { + var d = a[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 -= $(b.view).width(), c = e / (a.length - 1) - (Entry.Scene.viewBasicWidth + c), a) { + d = a[g], b.id != d.id ? (d.view.removeClass("minValue"), $(d.inputWrapper).width(c)) : d.view.addClass("minValue"); } } - 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)); +Entry.Scene.prototype.getNextScene = function() { + var a = this.getScenes(); + return a[a.indexOf(this.selectedScene) + 1]; }; -p.updatePortData = function(b) { - this.portData = b; - this.hwMonitor && "hw" == Entry.propertyPanel.selected && this.hwMonitor.update(); +Entry.Script = function(a) { + this.entity = a; }; -p.closeConnection = function() { - this.socket && this.socket.close(); +p = Entry.Script.prototype; +p.init = function(a, b, c) { + Entry.assert("BLOCK" == a.tagName.toUpperCase(), a.tagName); + this.type = a.getAttribute("type"); + this.id = Number(a.getAttribute("id")); + a.getElementsByTagName("mutation").length && a.getElementsByTagName("mutation")[0].hasAttribute("hashid") && (this.hashId = a.childNodes[0].getAttribute("hashid")); + "REPEAT" == this.type.substr(0, 6).toUpperCase() && (this.isRepeat = !0); + b instanceof Entry.Script && (this.previousScript = b, b.parentScript && (this.parentScript = b.parentScript)); + c instanceof Entry.Script && (this.parentScript = c); + a = a.childNodes; + for (b = 0;b < a.length;b++) { + if (c = a[b], "NEXT" == c.tagName.toUpperCase()) { + this.nextScript = new Entry.Script(this.entity), this.register && (this.nextScript.register = this.register), this.nextScript.init(a[b].childNodes[0], this); + } else { + if ("VALUE" == c.tagName.toUpperCase()) { + this.values || (this.values = {}); + var d = new Entry.Script(this.entity); + this.register && (d.register = this.register); + d.init(c.childNodes[0]); + this.values[c.getAttribute("name")] = d; + } else { + "FIELD" == c.tagName.toUpperCase() ? (this.fields || (this.fields = {}), this.fields[c.getAttribute("name")] = c.textContent) : "STATEMENT" == c.tagName.toUpperCase() && (this.statements || (this.statements = {}), d = new Entry.Script(this.entity), this.register && (d.register = this.register), d.init(c.childNodes[0], null, this), d.key = c.getAttribute("name"), this.statements[c.getAttribute("name")] = d); + } + } + } }; -p.downloadConnector = function() { - window.open("http://download.play-entry.org/apps/Entry_HW_1.5.8_Setup.exe", "_blank").focus(); +p.clone = function(a, b) { + var c = new Entry.Script(a); + c.id = this.id; + c.type = this.type; + c.isRepeat = this.isRepeat; + if (this.parentScript && !this.previousScript && 2 != b) { + c.parentScript = this.parentScript.clone(a); + for (var d = c.parentScript.statements[this.key] = c;d.nextScript;) { + d = d.nextScript, d.parentScript = c.parentScript; + } + } + this.nextScript && 1 != b && (c.nextScript = this.nextScript.clone(a, 0), c.nextScript.previousScript = this); + this.previousScript && 0 !== b && (c.previousScript = this.previousScript.clone(a, 1), c.previousScript.previousScript = this); + if (this.fields) { + c.fields = {}; + for (var e in this.fields) { + c.fields[e] = this.fields[e]; + } + } + if (this.values) { + for (e in c.values = {}, this.values) { + c.values[e] = this.values[e].clone(a); + } + } + if (this.statements) { + for (e in c.statements = {}, this.statements) { + for (c.statements[e] = this.statements[e].clone(a, 2), d = c.statements[e], d.parentScript = c;d.nextScript;) { + d = d.nextScript, d.parentScript = c; + } + } + } + return c; }; -p.downloadSource = function() { - window.open("http://play-entry.com/down/board.ino", "_blank").focus(); +p.getStatement = function(a) { + return this.statements[a]; }; -p.setZero = function() { - Entry.hw.hwModule && Entry.hw.hwModule.setZero(); +p.compute = function() { }; -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.getValue = function(a) { + return this.values[a].run(); }; -p.banHW = function() { - var b = this.hwInfo, a; - for (a in b) { - Entry.playground.mainWorkspace.blockMenu.banClass(b[a].name, !0); - } +p.getNumberValue = function(a) { + return Number(this.values[a].run()); }; -Entry.BlockModel = function() { - Entry.Model(this); +p.getStringValue = function(a) { + return String(this.values[a].run()); }; -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); +p.getBooleanValue = function(a) { + return this.values[a].run() ? !0 : !1; }; -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); +p.getField = function(a) { + return this.fields[a]; }; -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); +p.getStringField = function(a) { + return String(this.fields[a]); }; -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); +p.getNumberField = function(a) { + return Number(this.fields[a]); +}; +p.callReturn = function() { + return this.nextScript ? this.nextScript : this.parentScript ? this.parentScript : null; +}; +p.run = function() { + return Entry.block[this.type](this.entity, 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; @@ -12787,8 +14028,8 @@ Entry.Stage = function() { this.selectedObject = null; this.isObjectClick = !1; }; -Entry.Stage.prototype.initStage = function(b) { - this.canvas = new createjs.Stage(b.id); +Entry.Stage.prototype.initStage = function(a) { + this.canvas = new createjs.Stage(a.id); this.canvas.x = 320; this.canvas.y = 180; this.canvas.scaleX = this.canvas.scaleY = 2 / 1.5; @@ -12803,26 +14044,26 @@ Entry.Stage.prototype.initStage = function(b) { this.initHandle(); this.mouseCoordinate = {x:0, y:0}; if (Entry.isPhone()) { - b.ontouchstart = function(a) { + a.ontouchstart = function(a) { Entry.dispatchEvent("canvasClick", a); Entry.stage.isClick = !0; - }, b.ontouchend = function(a) { + }, a.ontouchend = function(a) { Entry.stage.isClick = !1; Entry.dispatchEvent("canvasClickCanceled", a); }; } else { - var a = function(a) { + var b = function(a) { Entry.dispatchEvent("canvasClick", a); Entry.stage.isClick = !0; }; - b.onmousedown = a; - b.ontouchstart = a; - a = function(a) { + a.onmousedown = b; + a.ontouchstart = b; + b = function(a) { Entry.stage.isClick = !1; Entry.dispatchEvent("canvasClickCanceled", a); }; - b.onmouseup = a; - b.ontouchend = a; + a.onmouseup = b; + a.ontouchend = b; $(document).click(function(a) { Entry.stage.focused = "entryCanvas" === a.target.id ? !0 : !1; }); @@ -12833,7 +14074,7 @@ Entry.Stage.prototype.initStage = function(b) { Entry.windowResized.attach(this, function() { Entry.stage.updateBoundRect(); }); - a = function(a) { + b = function(a) { a.preventDefault(); var b = Entry.stage.getBoundRect(), e; -1 < Entry.getBrowserType().indexOf("IE") ? (e = 480 * ((a.pageX - b.left - document.documentElement.scrollLeft) / b.width - .5), a = -270 * ((a.pageY - b.top - document.documentElement.scrollTop) / b.height - .5)) : a.changedTouches ? (e = 480 * ((a.changedTouches[0].pageX - b.left - document.body.scrollLeft) / b.width - .5), a = -270 * ((a.changedTouches[0].pageY - b.top - document.body.scrollTop) / b.height - .5)) : (e = 480 * ((a.pageX - b.left - document.body.scrollLeft) / b.width - .5), @@ -12841,9 +14082,9 @@ Entry.Stage.prototype.initStage = function(b) { Entry.stage.mouseCoordinate = {x:e.toFixed(1), y:a.toFixed(1)}; Entry.dispatchEvent("stageMouseMove"); }; - b.onmousemove = a; - b.ontouchmove = a; - b.onmouseout = function(a) { + a.onmousemove = b; + a.ontouchmove = b; + a.onmouseout = function(a) { Entry.dispatchEvent("stageMouseOut"); }; Entry.addEventListener("updateObject", function(a) { @@ -12866,68 +14107,68 @@ Entry.Stage.prototype.initStage = function(b) { }; Entry.Stage.prototype.render = function() { Entry.stage.timer && clearTimeout(Entry.stage.timer); - var b = (new Date).getTime(); + var a = (new Date).getTime(); Entry.stage.update(); - b = (new Date).getTime() - b; - Entry.stage.timer = setTimeout(Entry.stage.render, 16 - b % 16 + 16 * Math.floor(b / 16)); + a = (new Date).getTime() - a; + Entry.stage.timer = setTimeout(Entry.stage.render, 16 - a % 16 + 16 * Math.floor(a / 16)); }; Entry.Stage.prototype.update = function() { Entry.requestUpdate ? (Entry.engine.isState("stop") && this.objectUpdated ? (this.canvas.update(), this.objectUpdated = !1) : this.canvas.update(), this.inputField && !this.inputField._isHidden && this.inputField.render(), Entry.requestUpdateTwice ? Entry.requestUpdateTwice = !1 : Entry.requestUpdate = !1) : Entry.requestUpdate = !1; }; -Entry.Stage.prototype.loadObject = function(b) { - var a = b.entity.object; - this.getObjectContainerByScene(b.scene).addChild(a); +Entry.Stage.prototype.loadObject = function(a) { + var b = a.entity.object; + this.getObjectContainerByScene(a.scene).addChild(b); this.canvas.update(); }; -Entry.Stage.prototype.loadEntity = function(b) { - Entry.stage.getObjectContainerByScene(b.parent.scene).addChild(b.object); +Entry.Stage.prototype.loadEntity = function(a) { + Entry.stage.getObjectContainerByScene(a.parent.scene).addChild(a.object); this.sortZorder(); }; -Entry.Stage.prototype.unloadEntity = function(b) { - Entry.stage.getObjectContainerByScene(b.parent.scene).removeChild(b.object); +Entry.Stage.prototype.unloadEntity = function(a) { + Entry.stage.getObjectContainerByScene(a.parent.scene).removeChild(a.object); }; -Entry.Stage.prototype.loadVariable = function(b) { - var a = b.view_; - this.variables[b.id] = a; - this.variableContainer.addChild(a); +Entry.Stage.prototype.loadVariable = function(a) { + var b = a.view_; + this.variables[a.id] = b; + this.variableContainer.addChild(b); Entry.requestUpdate = !0; }; -Entry.Stage.prototype.removeVariable = function(b) { - this.variableContainer.removeChild(b.view_); +Entry.Stage.prototype.removeVariable = function(a) { + this.variableContainer.removeChild(a.view_); Entry.requestUpdate = !0; }; -Entry.Stage.prototype.loadDialog = function(b) { - this.dialogContainer.addChild(b.object); +Entry.Stage.prototype.loadDialog = function(a) { + this.dialogContainer.addChild(a.object); }; -Entry.Stage.prototype.unloadDialog = function(b) { - this.dialogContainer.removeChild(b.object); +Entry.Stage.prototype.unloadDialog = function(a) { + this.dialogContainer.removeChild(a.object); }; Entry.Stage.prototype.sortZorder = function() { - for (var b = Entry.container.getCurrentObjects(), a = this.selectedObjectContainer, c = 0, d = b.length - 1;0 <= d;d--) { - for (var e = b[d], f = e.entity, e = e.clonedEntities, g = 0, h = e.length;g < h;g++) { - e[g].shape && a.setChildIndex(e[g].shape, c++), a.setChildIndex(e[g].object, c++); + for (var a = Entry.container.getCurrentObjects(), b = this.selectedObjectContainer, c = 0, d = a.length - 1;0 <= d;d--) { + for (var e = a[d], f = e.entity, e = e.clonedEntities, g = 0, h = e.length;g < h;g++) { + e[g].shape && b.setChildIndex(e[g].shape, c++), b.setChildIndex(e[g].object, c++); } - f.shape && a.setChildIndex(f.shape, c++); - a.setChildIndex(f.object, c++); + f.shape && b.setChildIndex(f.shape, c++); + b.setChildIndex(f.object, c++); } }; Entry.Stage.prototype.initCoordinator = function() { - var b = new createjs.Container, a = new createjs.Bitmap(Entry.mediaFilePath + "workspace_coordinate.png"); - a.scaleX = .5; - a.scaleY = .5; - a.x = -240; - a.y = -135; - b.addChild(a); - this.canvas.addChild(b); - b.visible = !1; - this.coordinator = b; + var a = new createjs.Container, b = new createjs.Bitmap(Entry.mediaFilePath + "workspace_coordinate.png"); + b.scaleX = .5; + b.scaleY = .5; + b.x = -240; + b.y = -135; + a.addChild(b); + this.canvas.addChild(a); + a.visible = !1; + this.coordinator = a; }; Entry.Stage.prototype.toggleCoordinator = function() { this.coordinator.visible = !this.coordinator.visible; Entry.requestUpdate = !0; }; -Entry.Stage.prototype.selectObject = function(b) { - this.selectedObject = b ? b : null; +Entry.Stage.prototype.selectObject = function(a) { + this.selectedObject = a ? a : null; this.updateObject(); }; Entry.Stage.prototype.initHandle = function() { @@ -12940,47 +14181,47 @@ Entry.Stage.prototype.updateObject = function() { Entry.requestUpdate = !0; this.handle.setDraggable(!0); if (!this.editEntity) { - var b = this.selectedObject; - if (b) { - "textBox" == b.objectType ? this.handle.toggleCenter(!1) : this.handle.toggleCenter(!0); - "free" == b.getRotateMethod() ? this.handle.toggleRotation(!0) : this.handle.toggleRotation(!1); + var a = this.selectedObject; + if (a) { + "textBox" == a.objectType ? this.handle.toggleCenter(!1) : this.handle.toggleCenter(!0); + "free" == a.getRotateMethod() ? this.handle.toggleRotation(!0) : this.handle.toggleRotation(!1); this.handle.toggleDirection(!0); - b.getLock() ? (this.handle.toggleRotation(!1), this.handle.toggleDirection(!1), this.handle.toggleResize(!1), this.handle.toggleCenter(!1), this.handle.setDraggable(!1)) : this.handle.toggleResize(!0); + a.getLock() ? (this.handle.toggleRotation(!1), this.handle.toggleDirection(!1), this.handle.toggleResize(!1), this.handle.toggleCenter(!1), this.handle.setDraggable(!1)) : this.handle.toggleResize(!0); this.handle.setVisible(!0); - var a = b.entity; - this.handle.setWidth(a.getScaleX() * a.getWidth()); - this.handle.setHeight(a.getScaleY() * a.getHeight()); + var b = a.entity; + this.handle.setWidth(b.getScaleX() * b.getWidth()); + this.handle.setHeight(b.getScaleY() * b.getHeight()); var c, d; - if ("textBox" == a.type) { - if (a.getLineBreak()) { - c = a.regX * a.scaleX, d = -a.regY * a.scaleY; + if ("textBox" == b.type) { + if (b.getLineBreak()) { + c = b.regX * b.scaleX, d = -b.regY * b.scaleY; } else { - var e = a.getTextAlign(); - d = -a.regY * a.scaleY; + var e = b.getTextAlign(); + d = -b.regY * b.scaleY; switch(e) { case Entry.TEXT_ALIGN_LEFT: - c = -a.getWidth() / 2 * a.scaleX; + c = -b.getWidth() / 2 * b.scaleX; break; case Entry.TEXT_ALIGN_CENTER: - c = a.regX * a.scaleX; + c = b.regX * b.scaleX; break; case Entry.TEXT_ALIGN_RIGHT: - c = a.getWidth() / 2 * a.scaleX; + c = b.getWidth() / 2 * b.scaleX; } } } else { - c = (a.regX - a.width / 2) * a.scaleX, d = (a.height / 2 - a.regY) * a.scaleY; + c = (b.regX - b.width / 2) * b.scaleX, d = (b.height / 2 - b.regY) * b.scaleY; } - e = a.getRotation() / 180 * Math.PI; - this.handle.setX(a.getX() - c * Math.cos(e) - d * Math.sin(e)); - this.handle.setY(-a.getY() - c * Math.sin(e) + d * Math.cos(e)); - this.handle.setRegX((a.regX - a.width / 2) * a.scaleX); - this.handle.setRegY((a.regY - a.height / 2) * a.scaleY); - this.handle.setRotation(a.getRotation()); - this.handle.setDirection(a.getDirection()); + e = b.getRotation() / 180 * Math.PI; + this.handle.setX(b.getX() - c * Math.cos(e) - d * Math.sin(e)); + this.handle.setY(-b.getY() - c * Math.sin(e) + d * Math.cos(e)); + this.handle.setRegX((b.regX - b.width / 2) * b.scaleX); + this.handle.setRegY((b.regY - b.height / 2) * b.scaleY); + this.handle.setRotation(b.getRotation()); + this.handle.setDirection(b.getDirection()); this.objectUpdated = !0; - this.handle.setVisible(b.entity.getVisible()); - b.entity.getVisible() && this.handle.render(); + this.handle.setVisible(a.entity.getVisible()); + a.entity.getVisible() && this.handle.render(); } else { this.handle.setVisible(!1); } @@ -12988,41 +14229,41 @@ Entry.Stage.prototype.updateObject = function() { }; Entry.Stage.prototype.updateHandle = function() { this.editEntity = !0; - var b = this.handle, a = this.selectedObject.entity; - if (a.lineBreak) { - a.setHeight(b.height / a.getScaleY()), a.setWidth(b.width / a.getScaleX()); + var a = this.handle, b = this.selectedObject.entity; + if (b.lineBreak) { + b.setHeight(a.height / b.getScaleY()), b.setWidth(a.width / b.getScaleX()); } else { - if (0 !== a.width) { - var c = Math.abs(b.width / a.width); - a.flip && (c *= -1); - a.setScaleX(c); - } - 0 !== a.height && a.setScaleY(b.height / a.height); - } - c = b.rotation / 180 * Math.PI; - if ("textBox" == a.type) { - var d = b.regX / a.scaleX, d = b.regY / a.scaleY; - if (a.getLineBreak()) { - a.setX(b.x), a.setY(-b.y); + if (0 !== b.width) { + var c = Math.abs(a.width / b.width); + b.flip && (c *= -1); + b.setScaleX(c); + } + 0 !== b.height && b.setScaleY(a.height / b.height); + } + c = a.rotation / 180 * Math.PI; + if ("textBox" == b.type) { + var d; + if (b.getLineBreak()) { + b.setX(a.x), b.setY(-a.y); } else { - switch(a.getTextAlign()) { + switch(b.getTextAlign()) { case Entry.TEXT_ALIGN_LEFT: - a.setX(b.x - b.width / 2 * Math.cos(c)); - a.setY(-b.y + b.width / 2 * Math.sin(c)); + b.setX(a.x - a.width / 2 * Math.cos(c)); + b.setY(-a.y + a.width / 2 * Math.sin(c)); break; case Entry.TEXT_ALIGN_CENTER: - a.setX(b.x); - a.setY(-b.y); + b.setX(a.x); + b.setY(-a.y); break; case Entry.TEXT_ALIGN_RIGHT: - a.setX(b.x + b.width / 2 * Math.cos(c)), a.setY(-b.y - b.width / 2 * Math.sin(c)); + b.setX(a.x + a.width / 2 * Math.cos(c)), b.setY(-a.y - a.width / 2 * Math.sin(c)); } } } else { - d = a.width / 2 + b.regX / a.scaleX, a.setX(b.x + b.regX * Math.cos(c) - b.regY * Math.sin(c)), a.setRegX(d), d = a.height / 2 + b.regY / a.scaleY, a.setY(-b.y - b.regX * Math.sin(c) - b.regY * Math.cos(c)), a.setRegY(d); + d = b.width / 2 + a.regX / b.scaleX, b.setX(a.x + a.regX * Math.cos(c) - a.regY * Math.sin(c)), b.setRegX(d), d = b.height / 2 + a.regY / b.scaleY, b.setY(-a.y - a.regX * Math.sin(c) - a.regY * Math.cos(c)), b.setRegY(d); } - a.setDirection(b.direction); - a.setRotation(b.rotation); + b.setDirection(a.direction); + b.setRotation(a.rotation); this.selectedObject.entity.doCommand(); this.editEntity = !1; }; @@ -13033,162 +14274,349 @@ Entry.Stage.prototype.endEdit = function() { this.selectedObject.entity.checkCommand(); }; Entry.Stage.prototype.initWall = function() { - var b = new createjs.Container, a = new Image; - a.src = Entry.mediaFilePath + "media/bound.png"; - b.up = new createjs.Bitmap; - b.up.scaleX = 16; - b.up.y = -165; - b.up.x = -240; - b.up.image = a; - b.addChild(b.up); - b.down = new createjs.Bitmap; - b.down.scaleX = 16; - b.down.y = 135; - b.down.x = -240; - b.down.image = a; - b.addChild(b.down); - b.right = new createjs.Bitmap; - b.right.scaleY = 9; - b.right.y = -135; - b.right.x = 240; - b.right.image = a; - b.addChild(b.right); - b.left = new createjs.Bitmap; - b.left.scaleY = 9; - b.left.y = -135; - b.left.x = -270; - b.left.image = a; - b.addChild(b.left); - this.canvas.addChild(b); - this.wall = b; -}; -Entry.Stage.prototype.showInputField = function(b) { - b = 1 / 1.5; - this.inputField || (this.inputField = new CanvasInput({canvas:document.getElementById("entryCanvas"), fontSize:30 * b, fontFamily:"NanumGothic", fontColor:"#212121", width:556 * b, height:26 * b, padding:8 * b, borderWidth:1 * b, borderColor:"#000", borderRadius:3 * b, boxShadow:"none", innerShadow:"0px 0px 5px rgba(0, 0, 0, 0.5)", x:202 * b, y:450 * b, topPosition:!0, onsubmit:function() { + var a = new createjs.Container, b = new Image; + b.src = Entry.mediaFilePath + "media/bound.png"; + a.up = new createjs.Bitmap; + a.up.scaleX = 16; + a.up.y = -165; + a.up.x = -240; + a.up.image = b; + a.addChild(a.up); + a.down = new createjs.Bitmap; + a.down.scaleX = 16; + a.down.y = 135; + a.down.x = -240; + a.down.image = b; + a.addChild(a.down); + a.right = new createjs.Bitmap; + a.right.scaleY = 9; + a.right.y = -135; + a.right.x = 240; + a.right.image = b; + a.addChild(a.right); + a.left = new createjs.Bitmap; + a.left.scaleY = 9; + a.left.y = -135; + a.left.x = -270; + a.left.image = b; + a.addChild(a.left); + this.canvas.addChild(a); + this.wall = a; +}; +Entry.Stage.prototype.showInputField = function(a) { + a = 1 / 1.5; + this.inputField || (this.inputField = new CanvasInput({canvas:document.getElementById("entryCanvas"), fontSize:30 * a, fontFamily:"NanumGothic", fontColor:"#212121", width:556 * a, height:26 * a, padding:8 * a, borderWidth:1 * a, borderColor:"#000", borderRadius:3 * a, boxShadow:"none", innerShadow:"0px 0px 5px rgba(0, 0, 0, 0.5)", x:202 * a, y:450 * a, topPosition:!0, onsubmit:function() { Entry.dispatchEvent("canvasInputComplete"); }})); - b = new createjs.Container; - var a = new Image; - a.src = Entry.mediaFilePath + "confirm_button.png"; + a = new createjs.Container; + var b = new Image; + b.src = Entry.mediaFilePath + "confirm_button.png"; var c = new createjs.Bitmap; c.scaleX = .23; c.scaleY = .23; c.x = 160; c.y = 89; c.cursor = "pointer"; - c.image = a; - b.addChild(c); - b.on("mousedown", function(a) { + c.image = b; + a.addChild(c); + a.on("mousedown", function(a) { Entry.dispatchEvent("canvasInputComplete"); }); - this.inputSubmitButton || (this.inputField.value(""), this.canvas.addChild(b), this.inputSubmitButton = b); + this.inputSubmitButton || (this.inputField.value(""), this.canvas.addChild(a), this.inputSubmitButton = a); this.inputField.show(); Entry.requestUpdateTwice = !0; }; -Entry.Stage.prototype.hideInputField = function() { - this.inputField && this.inputField.value() && this.inputField.value(""); - this.inputSubmitButton && (this.canvas.removeChild(this.inputSubmitButton), this.inputSubmitButton = null); - this.inputField && this.inputField.hide(); - Entry.requestUpdate = !0; +Entry.Stage.prototype.hideInputField = function() { + this.inputField && this.inputField.value() && this.inputField.value(""); + this.inputSubmitButton && (this.canvas.removeChild(this.inputSubmitButton), this.inputSubmitButton = null); + this.inputField && this.inputField.hide(); + Entry.requestUpdate = !0; +}; +Entry.Stage.prototype.initObjectContainers = function() { + var a = Entry.scene.scenes_; + if (a && 0 !== a.length) { + for (var b = 0;b < a.length;b++) { + this.objectContainers[b] = this.createObjectContainer(a[b]); + } + this.selectedObjectContainer = this.objectContainers[0]; + } else { + a = this.createObjectContainer(Entry.scene.selectedScene), this.objectContainers.push(a), this.selectedObjectContainer = a; + } + this.canvas.addChild(this.selectedObjectContainer); + this.selectObjectContainer(Entry.scene.selectedScene); +}; +Entry.Stage.prototype.selectObjectContainer = function(a) { + if (this.canvas) { + for (var b = this.objectContainers, c = 0;c < b.length;c++) { + this.canvas.removeChild(b[c]); + } + this.selectedObjectContainer = this.getObjectContainerByScene(a); + this.canvas.addChildAt(this.selectedObjectContainer, 2); + } +}; +Entry.Stage.prototype.reAttachToCanvas = function() { + for (var a = [this.selectedObjectContainer, this.variableContainer, this.coordinator, this.handle, this.dialogContainer], b = 0;b < a.length;b++) { + this.canvas.removeChild(a[b]), this.canvas.addChild(a[b]); + } + console.log(this.canvas.getChildIndex(this.selectedObjectContainer)); +}; +Entry.Stage.prototype.createObjectContainer = function(a) { + var b = new createjs.Container; + b.scene = a; + return b; +}; +Entry.Stage.prototype.removeObjectContainer = function(a) { + var b = this.objectContainers; + a = this.getObjectContainerByScene(a); + this.canvas.removeChild(a); + b.splice(this.objectContainers.indexOf(a), 1); +}; +Entry.Stage.prototype.getObjectContainerByScene = function(a) { + for (var b = this.objectContainers, c = 0;c < b.length;c++) { + if (b[c].scene.id == a.id) { + return b[c]; + } + } +}; +Entry.Stage.prototype.moveSprite = function(a) { + if (this.selectedObject && Entry.stage.focused && !this.selectedObject.getLock()) { + var b = 5; + a.shiftKey && (b = 1); + var c = this.selectedObject.entity; + switch(a.keyCode) { + case 38: + c.setY(c.getY() + b); + break; + case 40: + c.setY(c.getY() - b); + break; + case 37: + c.setX(c.getX() - b); + break; + case 39: + c.setX(c.getX() + b); + } + this.updateObject(); + } +}; +Entry.Stage.prototype.getBoundRect = function(a) { + this._boundRect || this.updateBoundRect(); + return this._boundRect; +}; +Entry.Stage.prototype.updateBoundRect = function(a) { + this._boundRect = this.canvas.canvas.getBoundingClientRect(); +}; +Entry.StampEntity = function(a, b) { + this.parent = a; + this.type = a.objectType; + this.isStamp = this.isClone = !0; + this.width = b.getWidth(); + this.height = b.getHeight(); + "sprite" == this.type && (this.object = b.object.clone(!0), this.object.filters = null, b.effect && (this.effect = Entry.cloneSimpleObject(b.effect), this.applyFilter())); + this.object.entity = this; + b.dialog && (a = b.dialog, new Entry.Dialog(this, a.message_, a.mode_, !0), this.dialog.object = b.dialog.object.clone(!0), Entry.stage.loadDialog(this.dialog)); +}; +var EntityPrototype = Entry.EntityObject.prototype; +Entry.StampEntity.prototype.applyFilter = EntityPrototype.applyFilter; +Entry.StampEntity.prototype.removeClone = EntityPrototype.removeClone; +Entry.StampEntity.prototype.getWidth = EntityPrototype.getWidth; +Entry.StampEntity.prototype.getHeight = EntityPrototype.getHeight; +Entry.StampEntity.prototype.getInitialEffectValue = EntityPrototype.getInitialEffectValue; +Entry.Toast = function() { + this.toasts_ = []; + var a = document.getElementById("entryToastContainer"); + a && document.body.removeChild(a); + this.body_ = Entry.createElement("div", "entryToastContainer"); + this.body_.addClass("entryToastContainer"); + document.body.appendChild(this.body_); +}; +Entry.Toast.prototype.warning = function(a, b, c) { + var d = Entry.createElement("div", "entryToast"); + d.addClass("entryToast"); + d.addClass("entryToastWarning"); + d.bindOnClick(function() { + Entry.toast.body_.removeChild(this); + }); + var e = Entry.createElement("div", "entryToast"); + e.addClass("entryToastTitle"); + e.innerHTML = a; + d.appendChild(e); + a = Entry.createElement("p", "entryToast"); + a.addClass("entryToastMessage"); + a.innerHTML = b; + d.appendChild(a); + this.toasts_.push(d); + this.body_.appendChild(d); + c || window.setTimeout(function() { + d.style.opacity = 1; + var a = setInterval(function() { + .05 > d.style.opacity && (clearInterval(a), d.style.display = "none", Entry.removeElement(d)); + d.style.opacity *= .9; + }, 20); + }, 1E3); +}; +Entry.Toast.prototype.success = function(a, b, c) { + var d = Entry.createElement("div", "entryToast"); + d.addClass("entryToast"); + d.addClass("entryToastSuccess"); + d.bindOnClick(function() { + Entry.toast.body_.removeChild(this); + }); + var e = Entry.createElement("div", "entryToast"); + e.addClass("entryToastTitle"); + e.innerHTML = a; + d.appendChild(e); + a = Entry.createElement("p", "entryToast"); + a.addClass("entryToastMessage"); + a.innerHTML = b; + d.appendChild(a); + this.toasts_.push(d); + this.body_.appendChild(d); + c || window.setTimeout(function() { + d.style.opacity = 1; + var a = setInterval(function() { + .05 > d.style.opacity && (clearInterval(a), d.style.display = "none", Entry.removeElement(d)); + d.style.opacity *= .9; + }, 20); + }, 1E3); }; -Entry.Stage.prototype.initObjectContainers = function() { - var b = Entry.scene.scenes_; - if (b && 0 !== b.length) { - for (var a = 0;a < b.length;a++) { - this.objectContainers[a] = this.createObjectContainer(b[a]); - } - this.selectedObjectContainer = this.objectContainers[0]; - } else { - b = this.createObjectContainer(Entry.scene.selectedScene), this.objectContainers.push(b), this.selectedObjectContainer = b; - } - this.canvas.addChild(this.selectedObjectContainer); - this.selectObjectContainer(Entry.scene.selectedScene); +Entry.Toast.prototype.alert = function(a, b, c) { + var d = Entry.createElement("div", "entryToast"); + d.addClass("entryToast"); + d.addClass("entryToastAlert"); + d.bindOnClick(function() { + Entry.toast.body_.removeChild(this); + }); + var e = Entry.createElement("div", "entryToast"); + e.addClass("entryToastTitle"); + e.innerHTML = a; + d.appendChild(e); + a = Entry.createElement("p", "entryToast"); + a.addClass("entryToastMessage"); + a.innerHTML = b; + d.appendChild(a); + this.toasts_.push(d); + this.body_.appendChild(d); + c || window.setTimeout(function() { + d.style.opacity = 1; + var a = setInterval(function() { + .05 > d.style.opacity && (clearInterval(a), d.style.display = "none", Entry.toast.body_.removeChild(d)); + d.style.opacity *= .9; + }, 20); + }, 5E3); }; -Entry.Stage.prototype.selectObjectContainer = function(b) { - if (this.canvas) { - for (var a = this.objectContainers, c = 0;c < a.length;c++) { - this.canvas.removeChild(a[c]); - } - this.selectedObjectContainer = this.getObjectContainerByScene(b); - this.canvas.addChildAt(this.selectedObjectContainer, 2); - } +Entry.TvCast = function(a) { + this.generateView(a); }; -Entry.Stage.prototype.reAttachToCanvas = function() { - for (var b = [this.selectedObjectContainer, this.variableContainer, this.coordinator, this.handle, this.dialogContainer], a = 0;a < b.length;a++) { - this.canvas.removeChild(b[a]), this.canvas.addChild(b[a]); - } - console.log(this.canvas.getChildIndex(this.selectedObjectContainer)); +p = Entry.TvCast.prototype; +p.init = function(a) { + this.tvCastHash = a; }; -Entry.Stage.prototype.createObjectContainer = function(b) { - var a = new createjs.Container; - a.scene = b; - return a; +p.generateView = function(a) { + var b = Entry.createElement("div"); + b.addClass("entryContainerMovieWorkspace"); + b.addClass("entryRemove"); + this.movieContainer = b; + b = Entry.createElement("iframe"); + b.setAttribute("id", "tvCastIframe"); + b.setAttribute("allowfullscreen", ""); + b.setAttribute("frameborder", 0); + b.setAttribute("src", a); + this.movieFrame = b; + this.movieContainer.appendChild(this.movieFrame); }; -Entry.Stage.prototype.removeObjectContainer = function(b) { - var a = this.objectContainers; - b = this.getObjectContainerByScene(b); - this.canvas.removeChild(b); - a.splice(this.objectContainers.indexOf(b), 1); +p.getView = function() { + return this.movieContainer; }; -Entry.Stage.prototype.getObjectContainerByScene = function(b) { - for (var a = this.objectContainers, c = 0;c < a.length;c++) { - if (a[c].scene.id == b.id) { - return a[c]; - } - } +p.resize = function() { + document.getElementById("entryContainerWorkspaceId"); + var a = document.getElementById("tvCastIframe"); + w = this.movieContainer.offsetWidth; + a.width = w + "px"; + a.height = 9 * w / 16 + "px"; }; -Entry.Stage.prototype.moveSprite = function(b) { - if (this.selectedObject && Entry.stage.focused && !this.selectedObject.getLock()) { - var a = 5; - b.shiftKey && (a = 1); - var c = this.selectedObject.entity; - switch(b.keyCode) { - case 38: - c.setY(c.getY() + a); - break; - case 40: - c.setY(c.getY() - a); - break; - case 37: - c.setX(c.getX() - a); - break; - case 39: - c.setX(c.getX() + a); +Entry.ContextMenu = {}; +(function(a) { + a.createDom = function() { + this.dom = Entry.Dom("ul", {id:"entry-contextmenu", parent:$("body")}); + Entry.Utils.disableContextmenu(this.dom); + Entry.documentMousedown.attach(this, function() { + this.hide(); + }); + }; + a.show = function(a, c) { + this.dom || this.createDom(); + if (0 !== a.length) { + var d = this; + void 0 !== c && (this._className = c, this.dom.addClass(c)); + c = this.dom; + c.empty(); + for (var e = 0, f = a.length;e < f;e++) { + var g = a[e], h = g.text, k = !1 !== g.enable, l = Entry.Dom("li", {class:k ? "menuAble" : "menuDisable", parent:c}); + l.text(h); + k && g.callback && function(a, b) { + a.mousedown(function(a) { + a.preventDefault(); + d.hide(); + b(a); + }); + }(l, g.callback); + } + c.removeClass("entryRemove"); + this.position(Entry.mouseCoordinate); } - this.updateObject(); - } + }; + a.position = function(a) { + var c = this.dom; + c.css({left:0, top:0}); + var d = c.width(), e = c.height(), f = $(window), g = f.width(), f = f.height(); + a.x + d > g && (a.x -= d + 3); + a.y + e > f && (a.y -= e); + c.css({left:a.x, top:a.y}); + }; + a.hide = function() { + this.dom.empty(); + this.dom.addClass("entryRemove"); + this._className && (this.dom.removeClass(this._className), delete this._className); + }; +})(Entry.ContextMenu); +Entry.Loader = {queueCount:0, totalCount:0}; +Entry.Loader.addQueue = function(a) { + this.queueCount || Entry.dispatchEvent("loadStart"); + this.queueCount++; + this.totalCount++; }; -Entry.Stage.prototype.getBoundRect = function(b) { - this._boundRect || this.updateBoundRect(); - return this._boundRect; +Entry.Loader.removeQueue = function(a) { + this.queueCount--; + this.queueCount || (Entry.dispatchEvent("loadComplete"), this.totalCount = 0); }; -Entry.Stage.prototype.updateBoundRect = function(b) { - this._boundRect = this.canvas.canvas.getBoundingClientRect(); +Entry.Loader.getLoadedPercent = function() { + return 0 === this.totalCount ? 1 : this.queueCount / this.totalCount; }; -Entry.Variable = function(b) { - Entry.assert("string" == typeof b.name, "Variable name must be given"); - this.name_ = b.name; - this.id_ = b.id ? b.id : Entry.generateHash(); - this.type = b.variableType ? b.variableType : "variable"; - this.object_ = b.object || null; - this.isCloud_ = b.isCloud || !1; +Entry.Variable = function(a) { + Entry.assert("string" == typeof a.name, "Variable name must be given"); + this.name_ = a.name; + this.id_ = a.id ? a.id : Entry.generateHash(); + this.type = a.variableType ? a.variableType : "variable"; + this.object_ = a.object || null; + this.isCloud_ = a.isCloud || !1; 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 : []); - 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) { - var a = this.type; - if ("variable" == a || "timer" == a || "answer" == a) { + var b = Entry.parseNumber(a.value); + this.value_ = "number" == typeof b ? b : a.value ? a.value : 0; + "slide" == this.type ? (this.minValue_ = Number(a.minValue ? a.minValue : 0), this.maxValue_ = Number(a.maxValue ? a.maxValue : 100)) : "list" == this.type && (this.array_ = a.array ? a.array : []); + a.isClone || (this.visible_ = a.visible || "boolean" == typeof a.visible ? a.visible : !0, this.x_ = a.x ? a.x : null, this.y_ = a.y ? a.y : null, "list" == this.type && (this.width_ = a.width ? a.width : 100, this.height_ = a.height ? a.height : 120, this.scrollPosition = 0), this.BORDER = 6, this.FONT = "10pt NanumGothic"); +}; +Entry.Variable.prototype.generateView = function(a) { + var b = this.type; + if ("variable" == b || "timer" == b || "answer" == b) { this.view_ = new createjs.Container, this.rect_ = new createjs.Shape, this.view_.addChild(this.rect_), this.view_.variable = this, this.wrapper_ = new createjs.Shape, this.view_.addChild(this.wrapper_), this.textView_ = new createjs.Text("asdf", this.FONT, "#000000"), this.textView_.textBaseline = "alphabetic", this.textView_.x = 4, this.textView_.y = 1, this.view_.addChild(this.textView_), this.valueView_ = new createjs.Text("asdf", "10pt NanumGothic", "#ffffff"), this.valueView_.textBaseline = - "alphabetic", a = Entry.variableContainer.variables_.length, this.getX() && this.getY() ? (this.setX(this.getX()), this.setY(this.getY())) : (this.setX(-230 + 80 * Math.floor(a / 11)), this.setY(24 * b + 20 - 135 - 264 * Math.floor(a / 11))), this.view_.visible = this.visible_, this.view_.addChild(this.valueView_), this.view_.on("mousedown", function(a) { + "alphabetic", b = Entry.variableContainer.variables_.length, this.getX() && this.getY() ? (this.setX(this.getX()), this.setY(this.getY())) : (this.setX(-230 + 80 * Math.floor(b / 11)), this.setY(24 * a + 20 - 135 - 264 * Math.floor(b / 11))), this.view_.visible = this.visible_, this.view_.addChild(this.valueView_), this.view_.on("mousedown", function(a) { "workspace" == Entry.type && (this.offset = {x:this.x - (.75 * a.stageX - 240), y:this.y - (.75 * a.stageY - 135)}, this.cursor = "move"); }), this.view_.on("pressmove", function(a) { "workspace" == Entry.type && (this.variable.setX(.75 * a.stageX - 240 + this.offset.x), this.variable.setY(.75 * a.stageY - 135 + this.offset.y), this.variable.updateView()); }); } else { - if ("slide" == a) { + if ("slide" == b) { var c = this; this.view_ = new createjs.Container; this.rect_ = new createjs.Shape; @@ -13211,15 +14639,15 @@ Entry.Variable.prototype.generateView = function(b) { }); this.view_.visible = this.visible_; this.view_.addChild(this.valueView_); - a = this.textView_.getMeasuredWidth() + this.valueView_.getMeasuredWidth() + 26; - a = Math.max(a, 90); - this.maxWidth = a - 20; + b = this.textView_.getMeasuredWidth() + this.valueView_.getMeasuredWidth() + 26; + b = Math.max(b, 90); + this.maxWidth = b - 20; this.slideBar_ = new createjs.Shape; this.slideBar_.graphics.beginFill("#A0A1A1").s("#A0A1A1").ss(1).dr(10, 10, this.maxWidth, 1.5); this.view_.addChild(this.slideBar_); - a = this.getSlidePosition(this.maxWidth); + b = this.getSlidePosition(this.maxWidth); this.valueSetter_ = new createjs.Shape; - this.valueSetter_.graphics.beginFill("#1bafea").s("#A0A1A1").ss(1).dc(a, 10.5, 3); + this.valueSetter_.graphics.beginFill("#1bafea").s("#A0A1A1").ss(1).dc(b, 10.5, 3); this.valueSetter_.cursor = "pointer"; this.valueSetter_.on("mousedown", function(a) { Entry.engine.isState("run") && (c.isAdjusting = !0, this.offsetX = -(this.x - .75 * a.stageX + 240)); @@ -13235,8 +14663,8 @@ Entry.Variable.prototype.generateView = function(b) { c.isAdjusting = !1; }); this.view_.addChild(this.valueSetter_); - a = Entry.variableContainer.variables_.length; - this.getX() && this.getY() ? (this.setX(this.getX()), this.setY(this.getY())) : (this.setX(-230 + 80 * Math.floor(a / 11)), this.setY(24 * b + 20 - 135 - 264 * Math.floor(a / 11))); + b = Entry.variableContainer.variables_.length; + this.getX() && this.getY() ? (this.setX(this.getX()), this.setY(this.getY())) : (this.setX(-230 + 80 * Math.floor(b / 11)), this.setY(24 * a + 20 - 135 - 264 * Math.floor(b / 11))); } else { this.view_ = new createjs.Container, this.rect_ = new createjs.Shape, this.view_.addChild(this.rect_), this.view_.variable = this, this.titleView_ = new createjs.Text("asdf", this.FONT, "#000"), this.titleView_.textBaseline = "alphabetic", this.titleView_.textAlign = "center", this.titleView_.width = this.width_ - 2 * this.BORDER, this.titleView_.y = this.BORDER + 10, this.titleView_.x = this.width_ / 2, this.view_.addChild(this.titleView_), this.resizeHandle_ = new createjs.Shape, this.resizeHandle_.graphics.f("#1bafea").ss(1, 0, 0).s("#1bafea").lt(0, -9).lt(-9, 0).lt(0, 0), this.view_.addChild(this.resizeHandle_), this.resizeHandle_.list = this, this.resizeHandle_.on("mouseover", function(a) { @@ -13258,7 +14686,7 @@ Entry.Variable.prototype.generateView = function(b) { this.variable.isResizing = !1; }), this.view_.on("pressmove", function(a) { "workspace" != Entry.type || this.variable.isResizing || (this.variable.setX(.75 * a.stageX - 240 + this.offset.x), this.variable.setY(.75 * a.stageY - 135 + this.offset.y), this.variable.updateView()); - }), this.elementView = new createjs.Container, a = new createjs.Text("asdf", this.FONT, "#000"), a.textBaseline = "middle", a.y = 5, this.elementView.addChild(a), this.elementView.indexView = a, a = new createjs.Shape, this.elementView.addChild(a), this.elementView.valueWrapper = a, a = new createjs.Text("fdsa", this.FONT, "#eee"), a.x = 24, a.y = 6, a.textBaseline = "middle", this.elementView.addChild(a), this.elementView.valueView = a, this.elementView.x = this.BORDER, this.scrollButton_ = + }), this.elementView = new createjs.Container, b = new createjs.Text("asdf", this.FONT, "#000"), b.textBaseline = "middle", b.y = 5, this.elementView.addChild(b), this.elementView.indexView = b, b = new createjs.Shape, this.elementView.addChild(b), this.elementView.valueWrapper = b, b = new createjs.Text("fdsa", this.FONT, "#eee"), b.x = 24, b.y = 6, b.textBaseline = "middle", this.elementView.addChild(b), this.elementView.valueView = b, this.elementView.x = this.BORDER, this.scrollButton_ = new createjs.Shape, this.scrollButton_.graphics.f("#aaa").rr(0, 0, 7, 30, 3.5), this.view_.addChild(this.scrollButton_), this.scrollButton_.y = 23, this.scrollButton_.list = this, this.scrollButton_.on("mousedown", function(a) { this.list.isResizing = !0; this.cursor = "pointer"; @@ -13270,7 +14698,7 @@ Entry.Variable.prototype.generateView = function(b) { this.list.updateView(); }), this.scrollButton_.on("pressup", function(a) { this.moveAmount = void 0; - }), this.getX() && this.getY() ? (this.setX(this.getX()), this.setY(this.getY())) : (a = Entry.variableContainer.lists_.length, this.setX(110 * -Math.floor(a / 6) + 120), this.setY(24 * b + 20 - 135 - 145 * Math.floor(a / 6))); + }), this.getX() && this.getY() ? (this.setX(this.getX()), this.setY(this.getY())) : (b = Entry.variableContainer.lists_.length, this.setX(110 * -Math.floor(b / 6) + 120), this.setY(24 * a + 20 - 135 - 145 * Math.floor(b / 6))); } } this.setVisible(this.isVisible()); @@ -13284,8 +14712,8 @@ Entry.Variable.prototype.updateView = function() { this.view_.x = this.getX(); this.view_.y = this.getY(); if (this.object_) { - var b = Entry.container.getObject(this.object_); - this.textView_.text = b ? b.name + ":" + this.getName() : this.getName(); + var a = Entry.container.getObject(this.object_); + this.textView_.text = a ? a.name + ":" + this.getName() : this.getName(); } else { this.textView_.text = this.getName(); } @@ -13298,32 +14726,32 @@ Entry.Variable.prototype.updateView = function() { this.wrapper_.graphics.clear().f("#1bafea").ss(1, 2, 0).s("#1bafea").rc(this._nameWidth + 7, -11, this._valueWidth + 15, 14, 7, 7, 7, 7); } else { if ("slide" == this.type) { - this.view_.x = this.getX(), this.view_.y = this.getY(), this.object_ ? (b = Entry.container.getObject(this.object_), this.textView_.text = b ? b.name + ":" + this.getName() : this.getName()) : this.textView_.text = this.getName(), null === this._nameWidth && (this._nameWidth = this.textView_.getMeasuredWidth()), this.valueView_.x = this._nameWidth + 14, this.valueView_.y = 1, this.isNumber() ? this.valueView_.text = this.getValue().toFixed(2).replace(".00", "") : this.valueView_.text = - this.getValue(), null === this._valueWidth && (this._valueWidth = this.valueView_.getMeasuredWidth()), b = this._nameWidth + this._valueWidth + 26, b = Math.max(b, 90), this.rect_.graphics.clear().f("#ffffff").ss(1, 2, 0).s("#A0A1A1").rc(0, -14, b, 33, 4, 4, 4, 4), this.wrapper_.graphics.clear().f("#1bafea").ss(1, 2, 0).s("#1bafea").rc(this._nameWidth + 7, -11, this._valueWidth + 15, 14, 7, 7, 7, 7), b = this._nameWidth + this._valueWidth + 26, b = Math.max(b, 90), this.maxWidth = b - 20, - this.slideBar_.graphics.clear().beginFill("#A0A1A1").s("#A0A1A1").ss(1).dr(10, 10, this.maxWidth, 1.5), b = this.getSlidePosition(this.maxWidth), this.valueSetter_.graphics.clear().beginFill("#1bafea").s("#A0A1A1").ss(1).dc(b, 10.5, 3); + this.view_.x = this.getX(), this.view_.y = this.getY(), this.object_ ? (a = Entry.container.getObject(this.object_), this.textView_.text = a ? a.name + ":" + this.getName() : this.getName()) : this.textView_.text = this.getName(), null === this._nameWidth && (this._nameWidth = this.textView_.getMeasuredWidth()), this.valueView_.x = this._nameWidth + 14, this.valueView_.y = 1, this.isNumber() ? this.valueView_.text = this.getValue().toFixed(2).replace(".00", "") : this.valueView_.text = + this.getValue(), null === this._valueWidth && (this._valueWidth = this.valueView_.getMeasuredWidth()), a = this._nameWidth + this._valueWidth + 26, a = Math.max(a, 90), this.rect_.graphics.clear().f("#ffffff").ss(1, 2, 0).s("#A0A1A1").rc(0, -14, a, 33, 4, 4, 4, 4), this.wrapper_.graphics.clear().f("#1bafea").ss(1, 2, 0).s("#1bafea").rc(this._nameWidth + 7, -11, this._valueWidth + 15, 14, 7, 7, 7, 7), a = this._nameWidth + this._valueWidth + 26, a = Math.max(a, 90), this.maxWidth = a - 20, + this.slideBar_.graphics.clear().beginFill("#A0A1A1").s("#A0A1A1").ss(1).dr(10, 10, this.maxWidth, 1.5), a = this.getSlidePosition(this.maxWidth), this.valueSetter_.graphics.clear().beginFill("#1bafea").s("#A0A1A1").ss(1).dc(a, 10.5, 3); } else { if ("list" == this.type) { this.view_.x = this.getX(); this.view_.y = this.getY(); this.resizeHandle_.x = this.width_ - 2; this.resizeHandle_.y = this.height_ - 2; - var a = this.getName(); - this.object_ && (b = Entry.container.getObject(this.object_)) && (a = b.name + ":" + a); - a = 7 < a.length ? a.substr(0, 6) + ".." : a; - this.titleView_.text = a; + var b = this.getName(); + this.object_ && (a = Entry.container.getObject(this.object_)) && (b = a.name + ":" + b); + b = 7 < b.length ? b.substr(0, 6) + ".." : b; + this.titleView_.text = b; this.titleView_.x = this.width_ / 2; for (this.rect_.graphics.clear().f("#ffffff").ss(1, 2, 0).s("#A0A1A1").rect(0, 0, this.width_, this.height_);this.view_.children[4];) { this.view_.removeChild(this.view_.children[4]); } - b = Math.floor((this.getHeight() - 20) / 20); - b < this.array_.length ? (this.scrollButton_.y > this.getHeight() - 40 && (this.scrollButton_.y = this.getHeight() - 40), this.elementView.valueWrapper.graphics.clear().f("#1bafea").rr(20, -2, this.getWidth() - 20 - 10 - 2 * this.BORDER, 17, 2), this.scrollButton_.visible = !0, this.scrollButton_.x = this.getWidth() - 12, this.scrollPosition = Math.floor((this.scrollButton_.y - 23) / (this.getHeight() - 23 - 40) * (this.array_.length - b))) : (this.elementView.valueWrapper.graphics.clear().f("#1bafea").rr(20, + a = Math.floor((this.getHeight() - 20) / 20); + a < this.array_.length ? (this.scrollButton_.y > this.getHeight() - 40 && (this.scrollButton_.y = this.getHeight() - 40), this.elementView.valueWrapper.graphics.clear().f("#1bafea").rr(20, -2, this.getWidth() - 20 - 10 - 2 * this.BORDER, 17, 2), this.scrollButton_.visible = !0, this.scrollButton_.x = this.getWidth() - 12, this.scrollPosition = Math.floor((this.scrollButton_.y - 23) / (this.getHeight() - 23 - 40) * (this.array_.length - a))) : (this.elementView.valueWrapper.graphics.clear().f("#1bafea").rr(20, -2, this.getWidth() - 20 - 2 * this.BORDER, 17, 2), this.scrollButton_.visible = !1, this.scrollPosition = 0); - for (a = this.scrollPosition;a < this.scrollPosition + b && a < this.array_.length;a++) { - this.elementView.indexView.text = a + 1; - var c = String(this.array_[a].data), d = Math.floor((this.getWidth() - 50) / 7), c = Entry.cutStringByLength(c, d), c = String(this.array_[a].data).length > c.length ? c + ".." : c; + for (b = this.scrollPosition;b < this.scrollPosition + a && b < this.array_.length;b++) { + this.elementView.indexView.text = b + 1; + var c = String(this.array_[b].data), d = Math.floor((this.getWidth() - 50) / 7), c = Entry.cutStringByLength(c, d), c = String(this.array_[b].data).length > c.length ? c + ".." : c; this.elementView.valueView.text = c; c = this.elementView.clone(!0); - c.y = 20 * (a - this.scrollPosition) + 23; + c.y = 20 * (b - this.scrollPosition) + 23; this.view_.addChild(c); } } else { @@ -13341,9 +14769,9 @@ Entry.Variable.prototype.updateView = function() { Entry.Variable.prototype.getName = function() { return this.name_; }; -Entry.Variable.prototype.setName = function(b) { - Entry.assert("string" == typeof b, "Variable name must be string"); - this.name_ = b; +Entry.Variable.prototype.setName = function(a) { + Entry.assert("string" == typeof a, "Variable name must be string"); + this.name_ = a; this._nameWidth = null; this.updateView(); Entry.requestUpdateTwice = !0; @@ -13357,8 +14785,8 @@ Entry.Variable.prototype.getValue = function() { 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); +Entry.Variable.prototype.setValue = function(a) { + "slide" != this.type ? this.value_ = a : (a = Number(a), this.value_ = a < this.minValue_ ? this.minValue_ : a > this.maxValue_ ? this.maxValue_ : a); this.isCloud_ && Entry.variableContainer.updateCloudVariables(); this._valueWidth = null; this.updateView(); @@ -13367,37 +14795,37 @@ Entry.Variable.prototype.setValue = function(b) { 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 !== b && (this.visible_ = this.view_.visible = b, this.updateView()); +Entry.Variable.prototype.setVisible = function(a) { + Entry.assert("boolean" == typeof a, "Variable visible state must be boolean"); + this.visible !== a && (this.visible_ = this.view_.visible = a, this.updateView()); }; -Entry.Variable.prototype.setX = function(b) { - this.x_ = b; +Entry.Variable.prototype.setX = function(a) { + this.x_ = a; this.updateView(); }; Entry.Variable.prototype.getX = function() { return this.x_; }; -Entry.Variable.prototype.setY = function(b) { - this.y_ = b; +Entry.Variable.prototype.setY = function(a) { + this.y_ = a; this.updateView(); }; Entry.Variable.prototype.getY = function() { return this.y_; }; -Entry.Variable.prototype.setWidth = function(b) { - this.width_ = 100 > b ? 100 : b; +Entry.Variable.prototype.setWidth = function(a) { + this.width_ = 100 > a ? 100 : a; this.updateView(); }; Entry.Variable.prototype.getWidth = function() { return this.width_; }; -Entry.Variable.prototype.isInList = function(b, a) { +Entry.Variable.prototype.isInList = function(a, b) { this.getX(); this.getY(); }; -Entry.Variable.prototype.setHeight = function(b) { - this.height_ = 100 > b ? 100 : b; +Entry.Variable.prototype.setHeight = function(a) { + this.height_ = 100 > a ? 100 : a; this.updateView(); }; Entry.Variable.prototype.getHeight = function() { @@ -13409,79 +14837,79 @@ Entry.Variable.prototype.takeSnapshot = function() { 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.syncModel_ = function(a) { + this.setX(a.x); + this.setY(a.y); + this.id_ = a.id; + this.setVisible(a.visible); + this.setValue(a.value); + this.setName(a.name); + this.isCloud_ = a.isCloud; + "list" == this.type && (this.setWidth(a.width), this.setHeight(a.height), this.array_ = a.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; + var a = {}; + a.name = this.name_; + a.id = this.id_; + a.visible = this.visible_; + a.value = this.value_; + a.variableType = this.type; + "list" == this.type ? (a.width = this.getWidth(), a.height = this.getHeight(), a.array = JSON.parse(JSON.stringify(this.array_))) : "slide" == this.type && (a.minValue = this.minValue_, a.maxValue = this.maxValue_); + a.isCloud = this.isCloud_; + a.object = this.object_; + a.x = this.x_; + a.y = this.y_; + return a; }; 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); + var a = this.toJSON(); + a.isClone = !0; + return a = new Entry.Variable(a); }; Entry.Variable.prototype.getType = function() { return this.type; }; -Entry.Variable.prototype.setType = function(b) { - this.type = b; +Entry.Variable.prototype.setType = function(a) { + this.type = a; }; -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.getSlidePosition = function(a) { + var b = this.minValue_; + return Math.abs(this.value_ - b) / Math.abs(this.maxValue_ - b) * a + 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; +Entry.Variable.prototype.setSlideCommandX = function(a) { + var b = this.valueSetter_.graphics.command; + a = Math.max("undefined" == typeof a ? 10 : a, 10); + a = Math.min(this.maxWidth + 10, a); + b.x = a; this.updateSlideValueByView(); }; 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); - b < a ? b = this.minValue_ : b > c && (b = this.maxValue_); - this.isFloatPoint() || (b = Math.round(b)); - this.setValue(b); + var a = Math.max(this.valueSetter_.graphics.command.x - 10, 0) / this.maxWidth; + 0 > a && (a = 0); + 1 < a && (a = 1); + var b = parseFloat(this.minValue_), c = parseFloat(this.maxValue_), a = (b + Number(Math.abs(c - b) * a)).toFixed(2), a = parseFloat(a); + a < b ? a = this.minValue_ : a > c && (a = this.maxValue_); + this.isFloatPoint() || (a = Math.round(a)); + this.setValue(a); }; Entry.Variable.prototype.getMinValue = function() { return this.minValue_; }; -Entry.Variable.prototype.setMinValue = function(b) { - this.minValue_ = b; - this.value_ < b && (this.value_ = b); +Entry.Variable.prototype.setMinValue = function(a) { + this.minValue_ = a; + this.value_ < a && (this.value_ = a); this.updateView(); this.isMinFloat = Entry.isFloat(this.minValue_); }; Entry.Variable.prototype.getMaxValue = function() { return this.maxValue_; }; -Entry.Variable.prototype.setMaxValue = function(b) { - this.maxValue_ = b; - this.value_ > b && (this.value_ = b); +Entry.Variable.prototype.setMaxValue = function(a) { + this.maxValue_ = a; + this.value_ > a && (this.value_ = a); this.updateView(); this.isMaxFloat = Entry.isFloat(this.maxValue_); }; @@ -13502,9 +14930,9 @@ Entry.VariableContainer = function() { this._messageRefs = []; this._functionRefs = []; }; -Entry.VariableContainer.prototype.createDom = function(b) { - var a = this; - this.view_ = b; +Entry.VariableContainer.prototype.createDom = function(a) { + var b = this; + this.view_ = a; var c = Entry.createElement("table"); c.addClass("entryVariableSelectorWorkspace"); this.view_.appendChild(c); @@ -13530,10 +14958,10 @@ Entry.VariableContainer.prototype.createDom = function(b) { c.innerHTML = "+ " + Lang.Workspace.variable_add; var f = this; this.variableAddButton_ = c; - c.bindOnClick(function(b) { - b = f.variableAddPanel; - var c = b.view.name.value.trim(); - b.isOpen ? c && 0 !== c.length ? a.addVariable() : (b.view.addClass("entryRemove"), b.isOpen = !1) : (b.view.removeClass("entryRemove"), b.view.name.focus(), b.isOpen = !0); + c.bindOnClick(function(a) { + a = f.variableAddPanel; + var c = a.view.name.value.trim(); + a.isOpen ? c && 0 !== c.length ? b.addVariable() : (a.view.addClass("entryRemove"), a.isOpen = !1) : (a.view.removeClass("entryRemove"), a.view.name.focus(), a.isOpen = !0); }); this.generateVariableAddView(); this.generateListAddView(); @@ -13545,71 +14973,71 @@ Entry.VariableContainer.prototype.createDom = function(b) { c.addClass("entryVariableListElementWorkspace"); c.innerHTML = "+ " + Lang.Workspace.message_create; this.messageAddButton_ = c; - c.bindOnClick(function(b) { - a.addMessage({name:Lang.Workspace.message + " " + (a.messages_.length + 1)}); + c.bindOnClick(function(a) { + b.addMessage({name:Lang.Workspace.message + " " + (b.messages_.length + 1)}); }); c = Entry.createElement("li"); c.addClass("entryVariableAddWorkspace"); c.addClass("entryVariableListElementWorkspace"); c.innerHTML = "+ " + Lang.Workspace.list_create; this.listAddButton_ = c; - c.bindOnClick(function(b) { - b = f.listAddPanel; - var c = b.view.name.value.trim(); - b.isOpen ? c && 0 !== c.length ? a.addList() : (b.view.addClass("entryRemove"), b.isOpen = !1) : (b.view.removeClass("entryRemove"), b.view.name.focus(), b.isOpen = !0); + c.bindOnClick(function(a) { + a = f.listAddPanel; + var c = a.view.name.value.trim(); + a.isOpen ? c && 0 !== c.length ? b.addList() : (a.view.addClass("entryRemove"), a.isOpen = !1) : (a.view.removeClass("entryRemove"), a.view.name.focus(), a.isOpen = !0); }); c = Entry.createElement("li"); c.addClass("entryVariableAddWorkspace"); c.addClass("entryVariableListElementWorkspace"); c.innerHTML = "+ " + Lang.Workspace.function_add; this.functionAddButton_ = c; - c.bindOnClick(function(b) { - b = a._getBlockMenu(); + c.bindOnClick(function(a) { + a = b._getBlockMenu(); Entry.playground.changeViewMode("code"); - "func" != b.lastSelector && b.selectMenu("func"); - a.createFunction(); + "func" != a.lastSelector && a.selectMenu("func"); + b.createFunction(); }); - return b; + return a; }; -Entry.VariableContainer.prototype.createSelectButton = function(b, a) { +Entry.VariableContainer.prototype.createSelectButton = function(a, b) { var c = this; - void 0 === a && (a = !0); + void 0 === b && (b = !0); var d = Entry.createElement("td"); - d.addClass("entryVariableSelectButtonWorkspace", b); - d.innerHTML = Lang.Workspace[b]; - a ? d.bindOnClick(function(a) { - c.selectFilter(b); + d.addClass("entryVariableSelectButtonWorkspace", a); + d.innerHTML = Lang.Workspace[a]; + b ? d.bindOnClick(function(b) { + c.selectFilter(a); this.addClass("selected"); }) : d.addClass("disable"); return d; }; -Entry.VariableContainer.prototype.selectFilter = function(b) { - for (var a = this.view_.getElementsByTagName("td"), c = 0;c < a.length;c++) { - a[c].removeClass("selected"), a[c].hasClass(b) && a[c].addClass("selected"); +Entry.VariableContainer.prototype.selectFilter = function(a) { + for (var b = this.view_.getElementsByTagName("td"), c = 0;c < b.length;c++) { + b[c].removeClass("selected"), b[c].hasClass(a) && b[c].addClass("selected"); } - this.viewMode_ = b; + this.viewMode_ = a; this.select(); this.updateList(); }; -Entry.VariableContainer.prototype.updateVariableAddView = function(b) { - b = "variable" == (b ? b : "variable") ? this.variableAddPanel : this.listAddPanel; - var a = b.info, c = b.view; - b.view.addClass("entryRemove"); +Entry.VariableContainer.prototype.updateVariableAddView = function(a) { + a = "variable" == (a ? a : "variable") ? this.variableAddPanel : this.listAddPanel; + var b = a.info, c = a.view; + a.view.addClass("entryRemove"); c.cloudCheck.removeClass("entryVariableAddChecked"); c.localCheck.removeClass("entryVariableAddChecked"); c.globalCheck.removeClass("entryVariableAddChecked"); c.cloudWrapper.removeClass("entryVariableAddSpaceUnCheckedWorkspace"); - a.isCloud && c.cloudCheck.addClass("entryVariableAddChecked"); - b.isOpen && (c.removeClass("entryRemove"), c.name.focus()); - a.object ? (c.localCheck.addClass("entryVariableAddChecked"), c.cloudWrapper.addClass("entryVariableAddSpaceUnCheckedWorkspace")) : c.globalCheck.addClass("entryVariableAddChecked"); + b.isCloud && c.cloudCheck.addClass("entryVariableAddChecked"); + a.isOpen && (c.removeClass("entryRemove"), c.name.focus()); + b.object ? (c.localCheck.addClass("entryVariableAddChecked"), c.cloudWrapper.addClass("entryVariableAddSpaceUnCheckedWorkspace")) : c.globalCheck.addClass("entryVariableAddChecked"); }; -Entry.VariableContainer.prototype.select = function(b) { - b = this.selected == b ? null : b; +Entry.VariableContainer.prototype.select = function(a) { + a = this.selected == a ? null : a; this.selected && (this.selected.listElement.removeClass("selected"), this.selected.callerListElement && (this.listView_.removeChild(this.selected.callerListElement), delete this.selected.callerListElement), this.selected = null); - b && (b.listElement.addClass("selected"), this.selected = b, b instanceof Entry.Variable ? (this.renderVariableReference(b), b.object_ && Entry.container.selectObject(b.object_, !0)) : b instanceof Entry.Func ? this.renderFunctionReference(b) : this.renderMessageReference(b)); + a && (a.listElement.addClass("selected"), this.selected = a, a instanceof Entry.Variable ? (this.renderVariableReference(a), a.object_ && Entry.container.selectObject(a.object_, !0)) : a instanceof Entry.Func ? this.renderFunctionReference(a) : this.renderMessageReference(a)); }; -Entry.VariableContainer.prototype.renderMessageReference = function(b) { - for (var a = this, c = this._messageRefs, d = b.id, e = [], f = 0;f < c.length;f++) { +Entry.VariableContainer.prototype.renderMessageReference = function(a) { + for (var b = this, c = this._messageRefs, d = a.id, e = [], f = 0;f < c.length;f++) { -1 < c[f].block.params.indexOf(d) && e.push(c[f]); } c = Entry.createElement("ul"); @@ -13623,21 +15051,21 @@ Entry.VariableContainer.prototype.renderMessageReference = function(b) { h.innerHTML = d.object.name + " : " + Lang.Blocks["START_" + d.block.type]; g.appendChild(h); g.caller = d; - g.message = b; - g.bindOnClick(function(b) { - Entry.playground.object != this.caller.object && (Entry.container.selectObject(), Entry.container.selectObject(this.caller.object.id, !0), a.select(null), a.select(this.message)); + g.message = a; + g.bindOnClick(function(a) { + Entry.playground.object != this.caller.object && (Entry.container.selectObject(), Entry.container.selectObject(this.caller.object.id, !0), b.select(null), b.select(this.message)); Entry.playground.toggleOnVariableView(); Entry.playground.changeViewMode("variable"); }); c.appendChild(g); } 0 === e.length && (g = Entry.createElement("li"), g.addClass("entryVariableListCallerWorkspace"), g.addClass("entryVariableListCallerNoneWorkspace"), g.innerHTML = Lang.Workspace.no_use, c.appendChild(g)); - b.callerListElement = c; - this.listView_.insertBefore(c, b.listElement); - this.listView_.insertBefore(b.listElement, c); + a.callerListElement = c; + this.listView_.insertBefore(c, a.listElement); + this.listView_.insertBefore(a.listElement, c); }; -Entry.VariableContainer.prototype.renderVariableReference = function(b) { - for (var a = this, c = this._variableRefs, d = b.id_, e = [], f = 0;f < c.length;f++) { +Entry.VariableContainer.prototype.renderVariableReference = function(a) { + for (var b = this, c = this._variableRefs, d = a.id_, e = [], f = 0;f < c.length;f++) { -1 < c[f].block.params.indexOf(d) && e.push(c[f]); } c = Entry.createElement("ul"); @@ -13651,24 +15079,24 @@ Entry.VariableContainer.prototype.renderVariableReference = function(b) { h.innerHTML = d.object.name + " : " + Lang.Blocks["VARIABLE_" + d.block.type]; g.appendChild(h); g.caller = d; - g.variable = b; - g.bindOnClick(function(b) { - Entry.playground.object != this.caller.object && (Entry.container.selectObject(), Entry.container.selectObject(this.caller.object.id, !0), a.select(null)); - b = this.caller; - b = b.funcBlock || b.block; - b.view.getBoard().activateBlock(b); + g.variable = a; + g.bindOnClick(function(a) { + Entry.playground.object != this.caller.object && (Entry.container.selectObject(), Entry.container.selectObject(this.caller.object.id, !0), b.select(null)); + a = this.caller; + a = a.funcBlock || a.block; + a.view.getBoard().activateBlock(a); Entry.playground.toggleOnVariableView(); Entry.playground.changeViewMode("variable"); }); c.appendChild(g); } 0 === e.length && (g = Entry.createElement("li"), g.addClass("entryVariableListCallerWorkspace"), g.addClass("entryVariableListCallerNoneWorkspace"), g.innerHTML = Lang.Workspace.no_use, c.appendChild(g)); - b.callerListElement = c; - this.listView_.insertBefore(c, b.listElement); - this.listView_.insertBefore(b.listElement, c); + a.callerListElement = c; + this.listView_.insertBefore(c, a.listElement); + this.listView_.insertBefore(a.listElement, c); }; -Entry.VariableContainer.prototype.renderFunctionReference = function(b) { - for (var a = this, c = this._functionRefs, d = [], e = 0;e < c.length;e++) { +Entry.VariableContainer.prototype.renderFunctionReference = function(a) { + for (var b = this, c = this._functionRefs, d = [], e = 0;e < c.length;e++) { d.push(c[e]); } c = Entry.createElement("ul"); @@ -13683,7 +15111,7 @@ Entry.VariableContainer.prototype.renderFunctionReference = function(b) { g.appendChild(h); g.caller = f; g.bindOnClick(function(c) { - Entry.playground.object != this.caller.object && (Entry.container.selectObject(), Entry.container.selectObject(this.caller.object.id, !0), a.select(null), a.select(b)); + Entry.playground.object != this.caller.object && (Entry.container.selectObject(), Entry.container.selectObject(this.caller.object.id, !0), b.select(null), b.select(a)); c = this.caller.block; Entry.playground.toggleOnVariableView(); c.view.getBoard().activateBlock(c); @@ -13692,9 +15120,9 @@ Entry.VariableContainer.prototype.renderFunctionReference = function(b) { c.appendChild(g); } 0 === d.length && (g = Entry.createElement("li"), g.addClass("entryVariableListCallerWorkspace"), g.addClass("entryVariableListCallerNoneWorkspace"), g.innerHTML = Lang.Workspace.no_use, c.appendChild(g)); - b.callerListElement = c; - this.listView_.insertBefore(c, b.listElement); - this.listView_.insertBefore(b.listElement, c); + a.callerListElement = c; + this.listView_.insertBefore(c, a.listElement); + this.listView_.insertBefore(a.listElement, c); }; Entry.VariableContainer.prototype.updateList = function() { if (this.listView_) { @@ -13702,19 +15130,19 @@ Entry.VariableContainer.prototype.updateList = function() { for (this.listSettingView.addClass("entryRemove");this.listView_.firstChild;) { this.listView_.removeChild(this.listView_.firstChild); } - var b = this.viewMode_, a = []; - if ("all" == b || "message" == b) { - "message" == b && this.listView_.appendChild(this.messageAddButton_); + var a = this.viewMode_, b = []; + if ("all" == a || "message" == a) { + "message" == a && this.listView_.appendChild(this.messageAddButton_); for (var c in this.messages_) { var d = this.messages_[c]; - a.push(d); + b.push(d); var e = d.listElement; this.listView_.appendChild(e); d.callerListElement && this.listView_.appendChild(d.callerListElement); } } - if ("all" == b || "variable" == b) { - if ("variable" == b) { + if ("all" == a || "variable" == a) { + if ("variable" == a) { e = this.variableAddPanel.info; e.object && !Entry.playground.object && (e.object = null); this.listView_.appendChild(this.variableAddButton_); @@ -13722,22 +15150,22 @@ Entry.VariableContainer.prototype.updateList = function() { this.variableSplitters.top.innerHTML = Lang.Workspace.Variable_used_at_all_objects; this.listView_.appendChild(this.variableSplitters.top); for (c in this.variables_) { - d = this.variables_[c], d.object_ || (a.push(d), e = d.listElement, this.listView_.appendChild(e), d.callerListElement && this.listView_.appendChild(d.callerListElement)); + d = this.variables_[c], d.object_ || (b.push(d), e = d.listElement, this.listView_.appendChild(e), d.callerListElement && this.listView_.appendChild(d.callerListElement)); } this.variableSplitters.bottom.innerHTML = Lang.Workspace.Variable_used_at_special_object; this.listView_.appendChild(this.variableSplitters.bottom); for (c in this.variables_) { - d = this.variables_[c], d.object_ && (a.push(d), e = d.listElement, this.listView_.appendChild(e), d.callerListElement && this.listView_.appendChild(d.callerListElement)); + d = this.variables_[c], d.object_ && (b.push(d), e = d.listElement, this.listView_.appendChild(e), d.callerListElement && this.listView_.appendChild(d.callerListElement)); } this.updateVariableAddView("variable"); } else { for (c in this.variables_) { - d = this.variables_[c], a.push(d), e = d.listElement, this.listView_.appendChild(e), d.callerListElement && this.listView_.appendChild(d.callerListElement); + d = this.variables_[c], b.push(d), e = d.listElement, this.listView_.appendChild(e), d.callerListElement && this.listView_.appendChild(d.callerListElement); } } } - if ("all" == b || "list" == b) { - if ("list" == b) { + if ("all" == a || "list" == a) { + if ("list" == a) { e = this.listAddPanel.info; e.object && !Entry.playground.object && (e.object = null); this.listView_.appendChild(this.listAddButton_); @@ -13746,32 +15174,32 @@ Entry.VariableContainer.prototype.updateList = function() { this.listView_.appendChild(this.variableSplitters.top); this.updateVariableAddView("list"); for (c in this.lists_) { - d = this.lists_[c], d.object_ || (a.push(d), e = d.listElement, this.listView_.appendChild(e), d.callerListElement && this.listView_.appendChild(d.callerListElement)); + d = this.lists_[c], d.object_ || (b.push(d), e = d.listElement, this.listView_.appendChild(e), d.callerListElement && this.listView_.appendChild(d.callerListElement)); } this.variableSplitters.bottom.innerHTML = Lang.Workspace.list_used_specific_objects; this.listView_.appendChild(this.variableSplitters.bottom); for (c in this.lists_) { - d = this.lists_[c], d.object_ && (a.push(d), e = d.listElement, this.listView_.appendChild(e), d.callerListElement && this.listView_.appendChild(d.callerListElement)); + d = this.lists_[c], d.object_ && (b.push(d), e = d.listElement, this.listView_.appendChild(e), d.callerListElement && this.listView_.appendChild(d.callerListElement)); } this.updateVariableAddView("variable"); } else { for (c in this.lists_) { - d = this.lists_[c], a.push(d), e = d.listElement, this.listView_.appendChild(e), d.callerListElement && this.listView_.appendChild(d.callerListElement); + d = this.lists_[c], b.push(d), e = d.listElement, this.listView_.appendChild(e), d.callerListElement && this.listView_.appendChild(d.callerListElement); } } } - if ("all" == b || "func" == b) { - for (c in "func" == b && this.listView_.appendChild(this.functionAddButton_), this.functions_) { - b = this.functions_[c], a.push(b), e = b.listElement, this.listView_.appendChild(e), b.callerListElement && this.listView_.appendChild(b.callerListElement); + if ("all" == a || "func" == a) { + for (c in "func" == a && this.listView_.appendChild(this.functionAddButton_), this.functions_) { + a = this.functions_[c], b.push(a), e = a.listElement, this.listView_.appendChild(e), a.callerListElement && this.listView_.appendChild(a.callerListElement); } } this.listView_.appendChild(this.variableSettingView); this.listView_.appendChild(this.listSettingView); } }; -Entry.VariableContainer.prototype.setMessages = function(b) { - for (var a in b) { - var c = b[a]; +Entry.VariableContainer.prototype.setMessages = function(a) { + for (var b in a) { + var c = a[b]; c.id || (c.id = Entry.generateHash()); this.createMessageView(c); this.messages_.push(c); @@ -13779,9 +15207,9 @@ Entry.VariableContainer.prototype.setMessages = function(b) { Entry.playground.reloadPlayground(); this.updateList(); }; -Entry.VariableContainer.prototype.setVariables = function(b) { - for (var a in b) { - var c = new Entry.Variable(b[a]), d = c.getType(); +Entry.VariableContainer.prototype.setVariables = function(a) { + for (var b in a) { + var c = new Entry.Variable(a[b]), d = c.getType(); "variable" == d || "slide" == d ? (c.generateView(this.variables_.length), this.createVariableView(c), this.variables_.push(c)) : "list" == d ? (c.generateView(this.lists_.length), this.createListView(c), this.lists_.push(c)) : "timer" == d ? this.generateTimer(c) : "answer" == d && this.generateAnswer(c); } Entry.isEmpty(Entry.engine.projectTimer) && Entry.variableContainer.generateTimer(); @@ -13789,169 +15217,169 @@ Entry.VariableContainer.prototype.setVariables = function(b) { Entry.playground.reloadPlayground(); this.updateList(); }; -Entry.VariableContainer.prototype.setFunctions = function(b) { - for (var a in b) { - var c = new Entry.Func(b[a]); +Entry.VariableContainer.prototype.setFunctions = function(a) { + for (var b in a) { + var c = new Entry.Func(a[b]); c.generateBlock(); this.createFunctionView(c); this.functions_[c.id] = c; } this.updateList(); }; -Entry.VariableContainer.prototype.getFunction = function(b) { - return this.functions_[b]; +Entry.VariableContainer.prototype.getFunction = function(a) { + return this.functions_[a]; }; -Entry.VariableContainer.prototype.getVariable = function(b, a) { - var c = Entry.findObjsByKey(this.variables_, "id_", b)[0]; - a && a.isClone && c.object_ && (c = Entry.findObjsByKey(a.variables, "id_", b)[0]); +Entry.VariableContainer.prototype.getVariable = function(a, b) { + var c = Entry.findObjsByKey(this.variables_, "id_", a)[0]; + b && b.isClone && c.object_ && (c = Entry.findObjsByKey(b.variables, "id_", a)[0]); return c; }; -Entry.VariableContainer.prototype.getList = function(b, a) { - var c = Entry.findObjsByKey(this.lists_, "id_", b)[0]; - a && a.isClone && c.object_ && (c = Entry.findObjsByKey(a.lists, "id_", b)[0]); +Entry.VariableContainer.prototype.getList = function(a, b) { + var c = Entry.findObjsByKey(this.lists_, "id_", a)[0]; + b && b.isClone && c.object_ && (c = Entry.findObjsByKey(b.lists, "id_", a)[0]); return c; }; Entry.VariableContainer.prototype.createFunction = function() { if (!Entry.Func.isEdit) { - var b = new Entry.Func; - Entry.Func.edit(b); + var a = new Entry.Func; + Entry.Func.edit(a); } }; -Entry.VariableContainer.prototype.addFunction = function(b) { +Entry.VariableContainer.prototype.addFunction = function(a) { }; -Entry.VariableContainer.prototype.removeFunction = function(b) { - this.functions_[b.id].destroy(); - delete this.functions_[b.id]; +Entry.VariableContainer.prototype.removeFunction = function(a) { + this.functions_[a.id].destroy(); + delete this.functions_[a.id]; this.updateList(); }; -Entry.VariableContainer.prototype.checkListPosition = function(b, a) { - var c = b.x_ + b.width_, d = -b.y_, e = -b.y_ + -b.height_; - return a.x > b.x_ && a.x < c && a.y < d && a.y > e ? !0 : !1; +Entry.VariableContainer.prototype.checkListPosition = function(a, b) { + var c = a.x_ + a.width_, d = -a.y_, e = -a.y_ + -a.height_; + return b.x > a.x_ && b.x < c && b.y < d && b.y > e ? !0 : !1; }; -Entry.VariableContainer.prototype.getListById = function(b) { - var a = this.lists_, c = []; - if (0 < a.length) { - for (var d = 0;d < a.length;d++) { - this.checkListPosition(a[d], b) && c.push(a[d]); +Entry.VariableContainer.prototype.getListById = function(a) { + var b = this.lists_, c = []; + if (0 < b.length) { + for (var d = 0;d < b.length;d++) { + this.checkListPosition(b[d], a) && c.push(b[d]); } return c; } return !1; }; -Entry.VariableContainer.prototype.editFunction = function(b, a) { +Entry.VariableContainer.prototype.editFunction = function(a, b) { }; -Entry.VariableContainer.prototype.saveFunction = function(b) { - this.functions_[b.id] || (this.functions_[b.id] = b, this.createFunctionView(b)); - b.listElement.nameField.innerHTML = b.description; +Entry.VariableContainer.prototype.saveFunction = function(a) { + this.functions_[a.id] || (this.functions_[a.id] = a, this.createFunctionView(a)); + a.listElement.nameField.innerHTML = a.description; this.updateList(); }; -Entry.VariableContainer.prototype.createFunctionView = function(b) { - var a = this; +Entry.VariableContainer.prototype.createFunctionView = function(a) { + var b = this; if (this.view_) { var c = Entry.createElement("li"); c.addClass("entryVariableListElementWorkspace"); c.addClass("entryFunctionElementWorkspace"); c.bindOnClick(function(c) { c.stopPropagation(); - a.select(b); + b.select(a); }); var d = Entry.createElement("button"); d.addClass("entryVariableListElementDeleteWorkspace"); d.bindOnClick(function(c) { c.stopPropagation(); - a.removeFunction(b); - a.selected = null; + b.removeFunction(a); + b.selected = null; }); var e = Entry.createElement("button"); e.addClass("entryVariableListElementEditWorkspace"); var f = this._getBlockMenu(); - e.bindOnClick(function(a) { - a.stopPropagation(); - Entry.Func.edit(b); + e.bindOnClick(function(b) { + b.stopPropagation(); + Entry.Func.edit(a); Entry.playground && (Entry.playground.changeViewMode("code"), "func" != f.lastSelector && f.selectMenu("func")); }); var g = Entry.createElement("div"); g.addClass("entryVariableFunctionElementNameWorkspace"); - g.innerHTML = b.description; + g.innerHTML = a.description; c.nameField = g; c.appendChild(g); c.appendChild(e); c.appendChild(d); - b.listElement = c; + a.listElement = c; } }; -Entry.VariableContainer.prototype.checkAllVariableName = function(b, a) { - a = this[a]; - for (var c = 0;c < a.length;c++) { - if (a[c].name_ == b) { +Entry.VariableContainer.prototype.checkAllVariableName = function(a, b) { + b = this[b]; + for (var c = 0;c < b.length;c++) { + if (b[c].name_ == a) { return !0; } } return !1; }; -Entry.VariableContainer.prototype.addVariable = function(b) { - if (!b) { - var a = this.variableAddPanel; - b = a.view.name.value.trim(); - b && 0 !== b.length || (b = Lang.Workspace.variable); - b.length > this._maxNameLength && (b = this._truncName(b, "variable")); - b = this.checkAllVariableName(b, "variables_") ? Entry.getOrderedName(b, this.variables_, "name_") : b; - var c = a.info; - b = {name:b, isCloud:c.isCloud, object:c.object, variableType:"variable"}; - a.view.addClass("entryRemove"); +Entry.VariableContainer.prototype.addVariable = function(a) { + if (!a) { + var b = this.variableAddPanel; + a = b.view.name.value.trim(); + a && 0 !== a.length || (a = Lang.Workspace.variable); + a.length > this._maxNameLength && (a = this._truncName(a, "variable")); + a = this.checkAllVariableName(a, "variables_") ? Entry.getOrderedName(a, this.variables_, "name_") : a; + var c = b.info; + a = {name:a, isCloud:c.isCloud, object:c.object, variableType:"variable"}; + b.view.addClass("entryRemove"); this.resetVariableAddPanel("variable"); } - b = new Entry.Variable(b); - Entry.stateManager && Entry.stateManager.addCommand("add variable", this, this.removeVariable, b); - b.generateView(this.variables_.length); - this.createVariableView(b); - this.variables_.unshift(b); + a = new Entry.Variable(a); + Entry.stateManager && Entry.stateManager.addCommand("add variable", this, this.removeVariable, a); + a.generateView(this.variables_.length); + this.createVariableView(a); + this.variables_.unshift(a); Entry.playground.reloadPlayground(); this.updateList(); - return new Entry.State(this, this.removeVariable, b); + return new Entry.State(this, this.removeVariable, a); }; -Entry.VariableContainer.prototype.removeVariable = function(b) { - var a = this.variables_.indexOf(b), c = b.toJSON(); - this.selected == b && this.select(null); - b.remove(); - this.variables_.splice(a, 1); +Entry.VariableContainer.prototype.removeVariable = function(a) { + var b = this.variables_.indexOf(a), c = a.toJSON(); + this.selected == a && this.select(null); + a.remove(); + this.variables_.splice(b, 1); Entry.stateManager && Entry.stateManager.addCommand("remove variable", this, this.addVariable, c); Entry.playground.reloadPlayground(); this.updateList(); return new Entry.State(this, this.addVariable, c); }; -Entry.VariableContainer.prototype.changeVariableName = function(b, a) { - b.name_ != a && (Entry.isExist(a, "name_", this.variables_) ? (b.listElement.nameField.value = b.name_, Entry.toast.alert(Lang.Workspace.variable_rename_failed, Lang.Workspace.variable_dup)) : 10 < a.length ? (b.listElement.nameField.value = b.name_, Entry.toast.alert(Lang.Workspace.variable_rename_failed, Lang.Workspace.variable_too_long)) : (b.setName(a), Entry.playground.reloadPlayground(), Entry.toast.success(Lang.Workspace.variable_rename, Lang.Workspace.variable_rename_ok))); +Entry.VariableContainer.prototype.changeVariableName = function(a, b) { + a.name_ != b && (Entry.isExist(b, "name_", this.variables_) ? (a.listElement.nameField.value = a.name_, Entry.toast.alert(Lang.Workspace.variable_rename_failed, Lang.Workspace.variable_dup)) : 10 < b.length ? (a.listElement.nameField.value = a.name_, Entry.toast.alert(Lang.Workspace.variable_rename_failed, Lang.Workspace.variable_too_long)) : (a.setName(b), Entry.playground.reloadPlayground(), Entry.toast.success(Lang.Workspace.variable_rename, Lang.Workspace.variable_rename_ok))); }; -Entry.VariableContainer.prototype.changeListName = function(b, a) { - b.name_ != a && (Entry.isExist(a, "name_", this.lists_) ? (b.listElement.nameField.value = b.name_, Entry.toast.alert(Lang.Workspace.list_rename_failed, Lang.Workspace.list_dup)) : 10 < a.length ? (b.listElement.nameField.value = b.name_, Entry.toast.alert(Lang.Workspace.list_rename_failed, Lang.Workspace.list_too_long)) : (b.name_ = a, b.updateView(), Entry.playground.reloadPlayground(), Entry.toast.success(Lang.Workspace.list_rename, Lang.Workspace.list_rename_ok))); +Entry.VariableContainer.prototype.changeListName = function(a, b) { + a.name_ != b && (Entry.isExist(b, "name_", this.lists_) ? (a.listElement.nameField.value = a.name_, Entry.toast.alert(Lang.Workspace.list_rename_failed, Lang.Workspace.list_dup)) : 10 < b.length ? (a.listElement.nameField.value = a.name_, Entry.toast.alert(Lang.Workspace.list_rename_failed, Lang.Workspace.list_too_long)) : (a.name_ = b, a.updateView(), Entry.playground.reloadPlayground(), Entry.toast.success(Lang.Workspace.list_rename, Lang.Workspace.list_rename_ok))); }; -Entry.VariableContainer.prototype.removeList = function(b) { - var a = this.lists_.indexOf(b), c = b.toJSON(); +Entry.VariableContainer.prototype.removeList = function(a) { + var b = this.lists_.indexOf(a), c = a.toJSON(); Entry.stateManager && Entry.stateManager.addCommand("remove list", this, this.addList, c); - this.selected == b && this.select(null); - b.remove(); - this.lists_.splice(a, 1); + this.selected == a && this.select(null); + a.remove(); + this.lists_.splice(b, 1); Entry.playground.reloadPlayground(); this.updateList(); return new Entry.State(this, this.addList, c); }; -Entry.VariableContainer.prototype.createVariableView = function(b) { - var a = this, c = Entry.createElement("li"), d = Entry.createElement("div"); +Entry.VariableContainer.prototype.createVariableView = function(a) { + var b = this, c = Entry.createElement("li"), d = Entry.createElement("div"); d.addClass("entryVariableListElementWrapperWorkspace"); c.appendChild(d); c.addClass("entryVariableListElementWorkspace"); - b.object_ ? c.addClass("entryVariableLocalElementWorkspace") : b.isCloud_ ? c.addClass("entryVariableCloudElementWorkspace") : c.addClass("entryVariableGlobalElementWorkspace"); + a.object_ ? c.addClass("entryVariableLocalElementWorkspace") : a.isCloud_ ? c.addClass("entryVariableCloudElementWorkspace") : c.addClass("entryVariableGlobalElementWorkspace"); c.bindOnClick(function(c) { - a.select(b); + b.select(a); }); var e = Entry.createElement("button"); e.addClass("entryVariableListElementDeleteWorkspace"); e.bindOnClick(function(c) { c.stopPropagation(); - a.removeVariable(b); - a.selectedVariable = null; - a.variableSettingView.addClass("entryRemove"); + b.removeVariable(a); + b.selectedVariable = null; + b.variableSettingView.addClass("entryRemove"); }); var f = Entry.createElement("button"); f.addClass("entryVariableListElementEditWorkspace"); @@ -13960,31 +15388,31 @@ Entry.VariableContainer.prototype.createVariableView = function(b) { h.removeAttribute("disabled"); g.removeClass("entryRemove"); this.addClass("entryRemove"); - a.updateSelectedVariable(b); + b.updateSelectedVariable(a); h.focus(); }); c.editButton = f; var g = Entry.createElement("button"); g.addClass("entryVariableListElementEditWorkspace"); g.addClass("entryRemove"); - g.bindOnClick(function(b) { - b.stopPropagation(); + g.bindOnClick(function(a) { + a.stopPropagation(); h.blur(); h.setAttribute("disabled", "disabled"); f.removeClass("entryRemove"); this.addClass("entryRemove"); - a.updateSelectedVariable(null, "variable"); + b.updateSelectedVariable(null, "variable"); }); c.editSaveButton = g; var h = Entry.createElement("input"); h.addClass("entryVariableListElementNameWorkspace"); h.setAttribute("disabled", "disabled"); - h.value = b.name_; + h.value = a.name_; h.bindOnClick(function(a) { a.stopPropagation(); }); h.onblur = function(c) { - (c = this.value.trim()) && 0 !== c.length ? a.changeVariableName(b, this.value) : (Entry.toast.alert(Lang.Msgs.warn, Lang.Workspace.variable_can_not_space), this.value = b.getName()); + (c = this.value.trim()) && 0 !== c.length ? b.changeVariableName(a, this.value) : (Entry.toast.alert(Lang.Msgs.warn, Lang.Workspace.variable_can_not_space), this.value = a.getName()); }; h.onkeydown = function(a) { 13 == a.keyCode && this.blur(); @@ -13994,42 +15422,42 @@ Entry.VariableContainer.prototype.createVariableView = function(b) { d.appendChild(f); d.appendChild(g); d.appendChild(e); - b.listElement = c; + a.listElement = c; }; -Entry.VariableContainer.prototype.addMessage = function(b) { - b.id || (b.id = Entry.generateHash()); - Entry.stateManager && Entry.stateManager.addCommand("add message", this, this.removeMessage, b); - this.createMessageView(b); - this.messages_.unshift(b); +Entry.VariableContainer.prototype.addMessage = function(a) { + a.id || (a.id = Entry.generateHash()); + Entry.stateManager && Entry.stateManager.addCommand("add message", this, this.removeMessage, a); + this.createMessageView(a); + this.messages_.unshift(a); Entry.playground.reloadPlayground(); this.updateList(); - b.listElement.nameField.focus(); - return new Entry.State(this, this.removeMessage, b); -}; -Entry.VariableContainer.prototype.removeMessage = function(b) { - this.selected == b && this.select(null); - Entry.stateManager && Entry.stateManager.addCommand("remove message", this, this.addMessage, b); - var a = this.messages_.indexOf(b); - this.messages_.splice(a, 1); + a.listElement.nameField.focus(); + return new Entry.State(this, this.removeMessage, a); +}; +Entry.VariableContainer.prototype.removeMessage = function(a) { + this.selected == a && this.select(null); + Entry.stateManager && Entry.stateManager.addCommand("remove message", this, this.addMessage, a); + var b = this.messages_.indexOf(a); + this.messages_.splice(b, 1); this.updateList(); Entry.playground.reloadPlayground(); - return new Entry.State(this, this.addMessage, b); + return new Entry.State(this, this.addMessage, a); }; -Entry.VariableContainer.prototype.changeMessageName = function(b, a) { - b.name != a && (Entry.isExist(a, "name", this.messages_) ? (b.listElement.nameField.value = b.name, Entry.toast.alert(Lang.Workspace.message_rename_failed, Lang.Workspace.message_dup)) : 10 < a.length ? (b.listElement.nameField.value = b.name, Entry.toast.alert(Lang.Workspace.message_rename_failed, Lang.Workspace.message_too_long)) : (b.name = a, Entry.playground.reloadPlayground(), Entry.toast.success(Lang.Workspace.message_rename, Lang.Workspace.message_rename_ok))); +Entry.VariableContainer.prototype.changeMessageName = function(a, b) { + a.name != b && (Entry.isExist(b, "name", this.messages_) ? (a.listElement.nameField.value = a.name, Entry.toast.alert(Lang.Workspace.message_rename_failed, Lang.Workspace.message_dup)) : 10 < b.length ? (a.listElement.nameField.value = a.name, Entry.toast.alert(Lang.Workspace.message_rename_failed, Lang.Workspace.message_too_long)) : (a.name = b, Entry.playground.reloadPlayground(), Entry.toast.success(Lang.Workspace.message_rename, Lang.Workspace.message_rename_ok))); }; -Entry.VariableContainer.prototype.createMessageView = function(b) { - var a = this, c = Entry.createElement("li"); +Entry.VariableContainer.prototype.createMessageView = function(a) { + var b = this, c = Entry.createElement("li"); c.addClass("entryVariableListElementWorkspace"); c.addClass("entryMessageElementWorkspace"); c.bindOnClick(function(c) { - a.select(b); + b.select(a); }); var d = Entry.createElement("button"); d.addClass("entryVariableListElementDeleteWorkspace"); d.bindOnClick(function(c) { c.stopPropagation(); - a.removeMessage(b); + b.removeMessage(a); }); var e = Entry.createElement("button"); e.addClass("entryVariableListElementEditWorkspace"); @@ -14051,12 +15479,12 @@ Entry.VariableContainer.prototype.createMessageView = function(b) { }); var g = Entry.createElement("input"); g.addClass("entryVariableListElementNameWorkspace"); - g.value = b.name; + g.value = a.name; g.bindOnClick(function(a) { a.stopPropagation(); }); g.onblur = function(c) { - (c = this.value.trim()) && 0 !== c.length ? (a.changeMessageName(b, this.value), e.removeClass("entryRemove"), f.addClass("entryRemove"), g.setAttribute("disabled", "disabled")) : (Entry.toast.alert(Lang.Msgs.warn, Lang.Msgs.sign_can_not_space), this.value = b.name); + (c = this.value.trim()) && 0 !== c.length ? (b.changeMessageName(a, this.value), e.removeClass("entryRemove"), f.addClass("entryRemove"), g.setAttribute("disabled", "disabled")) : (Entry.toast.alert(Lang.Msgs.warn, Lang.Msgs.sign_can_not_space), this.value = a.name); }; g.onkeydown = function(a) { 13 == a.keyCode && this.blur(); @@ -14066,45 +15494,45 @@ Entry.VariableContainer.prototype.createMessageView = function(b) { c.appendChild(e); c.appendChild(f); c.appendChild(d); - b.listElement = c; + a.listElement = c; }; -Entry.VariableContainer.prototype.addList = function(b) { - if (!b) { - var a = this.listAddPanel; - b = a.view.name.value.trim(); - b && 0 !== b.length || (b = Lang.Workspace.list); - var c = a.info; - b.length > this._maxNameLength && (b = this._truncName(b, "list")); - b = this.checkAllVariableName(b, "lists_") ? Entry.getOrderedName(b, this.lists_, "name_") : b; - b = {name:b, isCloud:c.isCloud, object:c.object, variableType:"list"}; - a.view.addClass("entryRemove"); +Entry.VariableContainer.prototype.addList = function(a) { + if (!a) { + var b = this.listAddPanel; + a = b.view.name.value.trim(); + a && 0 !== a.length || (a = Lang.Workspace.list); + var c = b.info; + a.length > this._maxNameLength && (a = this._truncName(a, "list")); + a = this.checkAllVariableName(a, "lists_") ? Entry.getOrderedName(a, this.lists_, "name_") : a; + a = {name:a, isCloud:c.isCloud, object:c.object, variableType:"list"}; + b.view.addClass("entryRemove"); this.resetVariableAddPanel("list"); } - b = new Entry.Variable(b); - Entry.stateManager && Entry.stateManager.addCommand("add list", this, this.removeList, b); - b.generateView(this.lists_.length); - this.createListView(b); - this.lists_.unshift(b); + a = new Entry.Variable(a); + Entry.stateManager && Entry.stateManager.addCommand("add list", this, this.removeList, a); + a.generateView(this.lists_.length); + this.createListView(a); + this.lists_.unshift(a); Entry.playground.reloadPlayground(); this.updateList(); - return new Entry.State(this, this.removelist, b); + return new Entry.State(this, this.removelist, a); }; -Entry.VariableContainer.prototype.createListView = function(b) { - var a = this, c = Entry.createElement("li"), d = Entry.createElement("div"); +Entry.VariableContainer.prototype.createListView = function(a) { + var b = this, c = Entry.createElement("li"), d = Entry.createElement("div"); d.addClass("entryVariableListElementWrapperWorkspace"); c.appendChild(d); c.addClass("entryVariableListElementWorkspace"); - b.object_ ? c.addClass("entryListLocalElementWorkspace") : b.isCloud_ ? c.addClass("entryListCloudElementWorkspace") : c.addClass("entryListGlobalElementWorkspace"); + a.object_ ? c.addClass("entryListLocalElementWorkspace") : a.isCloud_ ? c.addClass("entryListCloudElementWorkspace") : c.addClass("entryListGlobalElementWorkspace"); c.bindOnClick(function(c) { - a.select(b); + b.select(a); }); var e = Entry.createElement("button"); e.addClass("entryVariableListElementDeleteWorkspace"); e.bindOnClick(function(c) { c.stopPropagation(); - a.removeList(b); - a.selectedList = null; - a.listSettingView.addClass("entryRemove"); + b.removeList(a); + b.selectedList = null; + b.listSettingView.addClass("entryRemove"); }); var f = Entry.createElement("button"); f.addClass("entryVariableListElementEditWorkspace"); @@ -14113,7 +15541,7 @@ Entry.VariableContainer.prototype.createListView = function(b) { h.removeAttribute("disabled"); g.removeClass("entryRemove"); this.addClass("entryRemove"); - a.updateSelectedVariable(b); + b.updateSelectedVariable(a); h.focus(); }); c.editButton = f; @@ -14126,19 +15554,19 @@ Entry.VariableContainer.prototype.createListView = function(b) { h.setAttribute("disabled", "disabled"); f.removeClass("entryRemove"); this.addClass("entryRemove"); - a.select(b); - a.updateSelectedVariable(null, "list"); + b.select(a); + b.updateSelectedVariable(null, "list"); }); c.editSaveButton = g; var h = Entry.createElement("input"); h.setAttribute("disabled", "disabled"); h.addClass("entryVariableListElementNameWorkspace"); - h.value = b.name_; + h.value = a.name_; h.bindOnClick(function(a) { a.stopPropagation(); }); h.onblur = function(c) { - (c = this.value.trim()) && 0 !== c.length ? a.changeListName(b, this.value) : (Entry.toast.alert(Lang.Msgs.warn, Lang.Msgs.list_can_not_space), this.value = b.getName()); + (c = this.value.trim()) && 0 !== c.length ? b.changeListName(a, this.value) : (Entry.toast.alert(Lang.Msgs.warn, Lang.Msgs.list_can_not_space), this.value = a.getName()); }; h.onkeydown = function(a) { 13 == a.keyCode && this.blur(); @@ -14148,78 +15576,78 @@ Entry.VariableContainer.prototype.createListView = function(b) { d.appendChild(f); d.appendChild(g); d.appendChild(e); - b.listElement = c; + a.listElement = c; }; -Entry.VariableContainer.prototype.mapVariable = function(b, a) { +Entry.VariableContainer.prototype.mapVariable = function(a, b) { for (var c = this.variables_.length, d = 0;d < c;d++) { - b(this.variables_[d], a); + a(this.variables_[d], b); } }; -Entry.VariableContainer.prototype.mapList = function(b, a) { +Entry.VariableContainer.prototype.mapList = function(a, b) { for (var c = this.lists_.length, d = 0;d < c;d++) { - b(this.lists_[d], a); + a(this.lists_[d], b); } }; Entry.VariableContainer.prototype.getVariableJSON = function() { - for (var b = [], a = 0;a < this.variables_.length;a++) { - b.push(this.variables_[a].toJSON()); + for (var a = [], b = 0;b < this.variables_.length;b++) { + a.push(this.variables_[b].toJSON()); } - for (a = 0;a < this.lists_.length;a++) { - b.push(this.lists_[a].toJSON()); + for (b = 0;b < this.lists_.length;b++) { + a.push(this.lists_[b].toJSON()); } - Entry.engine.projectTimer && b.push(Entry.engine.projectTimer.toJSON()); - a = Entry.container.inputValue; - Entry.isEmpty(a) || b.push(a.toJSON()); - return b; + Entry.engine.projectTimer && a.push(Entry.engine.projectTimer.toJSON()); + b = Entry.container.inputValue; + Entry.isEmpty(b) || a.push(b.toJSON()); + return a; }; Entry.VariableContainer.prototype.getMessageJSON = function() { - for (var b = [], a = 0;a < this.messages_.length;a++) { - b.push({id:this.messages_[a].id, name:this.messages_[a].name}); + for (var a = [], b = 0;b < this.messages_.length;b++) { + a.push({id:this.messages_[b].id, name:this.messages_[b].name}); } - return b; + return a; }; Entry.VariableContainer.prototype.getFunctionJSON = function() { - var b = [], a; - for (a in this.functions_) { - var c = this.functions_[a], c = {id:c.id, content:JSON.stringify(c.content.toJSON())}; - b.push(c); + var a = [], b; + for (b in this.functions_) { + var c = this.functions_[b], c = {id:c.id, content:JSON.stringify(c.content.toJSON())}; + a.push(c); } - return b; + return a; }; -Entry.VariableContainer.prototype.resetVariableAddPanel = function(b) { - b = b || "variable"; - var a = "variable" == b ? this.variableAddPanel : this.listAddPanel, c = a.info; +Entry.VariableContainer.prototype.resetVariableAddPanel = function(a) { + a = a || "variable"; + var b = "variable" == a ? this.variableAddPanel : this.listAddPanel, c = b.info; c.isCloud = !1; c.object = null; - a.view.name.value = ""; - a.isOpen = !1; - this.updateVariableAddView(b); + b.view.name.value = ""; + b.isOpen = !1; + this.updateVariableAddView(a); }; Entry.VariableContainer.prototype.generateVariableAddView = function() { - var b = this, a = Entry.createElement("li"); - this.variableAddPanel.view = a; + var a = this, b = Entry.createElement("li"); + this.variableAddPanel.view = b; this.variableAddPanel.isOpen = !1; - a.addClass("entryVariableAddSpaceWorkspace"); - a.addClass("entryRemove"); + b.addClass("entryVariableAddSpaceWorkspace"); + b.addClass("entryRemove"); var c = Entry.createElement("div"); c.addClass("entryVariableAddSpaceNameWrapperWorkspace"); - a.appendChild(c); + b.appendChild(c); var d = Entry.createElement("input"); d.addClass("entryVariableAddSpaceInputWorkspace"); d.setAttribute("placeholder", Lang.Workspace.Variable_placeholder_name); d.variableContainer = this; - d.onkeypress = function(a) { - 13 == a.keyCode && (Entry.variableContainer.addVariable(), b.updateSelectedVariable(b.variables_[0]), a = b.variables_[0].listElement, a.editButton.addClass("entryRemove"), a.editSaveButton.removeClass("entryRemove"), a.nameField.removeAttribute("disabled")); + d.onkeypress = function(b) { + 13 == b.keyCode && (Entry.variableContainer.addVariable(), a.updateSelectedVariable(a.variables_[0]), b = a.variables_[0].listElement, b.editButton.addClass("entryRemove"), b.editSaveButton.removeClass("entryRemove"), b.nameField.removeAttribute("disabled")); }; this.variableAddPanel.view.name = d; c.appendChild(d); c = Entry.createElement("div"); c.addClass("entryVariableAddSpaceGlobalWrapperWorkspace"); - c.bindOnClick(function(a) { - b.variableAddPanel.info.object = null; - b.updateVariableAddView("variable"); + c.bindOnClick(function(b) { + a.variableAddPanel.info.object = null; + a.updateVariableAddView("variable"); }); - a.appendChild(c); + b.appendChild(c); d = Entry.createElement("span"); d.innerHTML = Lang.Workspace.Variable_use_all_objects; c.appendChild(d); @@ -14230,10 +15658,10 @@ Entry.VariableContainer.prototype.generateVariableAddView = function() { c.appendChild(d); c = Entry.createElement("div"); c.addClass("entryVariableAddSpaceLocalWrapperWorkspace"); - c.bindOnClick(function(a) { - Entry.playground.object && (a = b.variableAddPanel.info, a.object = Entry.playground.object.id, a.isCloud = !1, b.updateVariableAddView("variable")); + c.bindOnClick(function(b) { + Entry.playground.object && (b = a.variableAddPanel.info, b.object = Entry.playground.object.id, b.isCloud = !1, a.updateVariableAddView("variable")); }); - a.appendChild(c); + b.appendChild(c); d = Entry.createElement("span"); d.innerHTML = Lang.Workspace.Variable_use_this_object; c.appendChild(d); @@ -14243,13 +15671,13 @@ Entry.VariableContainer.prototype.generateVariableAddView = function() { this.variableAddPanel.info.object && d.addClass("entryVariableAddChecked"); c.appendChild(d); c = Entry.createElement("div"); - a.cloudWrapper = c; + b.cloudWrapper = c; c.addClass("entryVariableAddSpaceCloudWrapperWorkspace"); - c.bindOnClick(function(a) { - a = b.variableAddPanel.info; - a.object || (a.isCloud = !a.isCloud, b.updateVariableAddView("variable")); + c.bindOnClick(function(b) { + b = a.variableAddPanel.info; + b.object || (b.isCloud = !b.isCloud, a.updateVariableAddView("variable")); }); - a.appendChild(c); + b.appendChild(c); d = Entry.createElement("span"); d.addClass("entryVariableAddSpaceCloudSpanWorkspace"); d.innerHTML = Lang.Workspace.Variable_create_cloud; @@ -14262,57 +15690,57 @@ Entry.VariableContainer.prototype.generateVariableAddView = function() { c.appendChild(d); c = Entry.createElement("div"); c.addClass("entryVariableAddSpaceButtonWrapperWorkspace"); - a.appendChild(c); - a = Entry.createElement("span"); - a.addClass("entryVariableAddSpaceCancelWorkspace"); - a.addClass("entryVariableAddSpaceButtonWorkspace"); - a.innerHTML = Lang.Buttons.cancel; - a.bindOnClick(function(a) { - b.variableAddPanel.view.addClass("entryRemove"); - b.resetVariableAddPanel("variable"); + b.appendChild(c); + b = Entry.createElement("span"); + b.addClass("entryVariableAddSpaceCancelWorkspace"); + b.addClass("entryVariableAddSpaceButtonWorkspace"); + b.innerHTML = Lang.Buttons.cancel; + b.bindOnClick(function(b) { + a.variableAddPanel.view.addClass("entryRemove"); + a.resetVariableAddPanel("variable"); }); - c.appendChild(a); - a = Entry.createElement("span"); - a.addClass("entryVariableAddSpaceConfirmWorkspace"); - a.addClass("entryVariableAddSpaceButtonWorkspace"); - a.innerHTML = Lang.Buttons.save; - a.variableContainer = this; - a.bindOnClick(function(a) { + c.appendChild(b); + b = Entry.createElement("span"); + b.addClass("entryVariableAddSpaceConfirmWorkspace"); + b.addClass("entryVariableAddSpaceButtonWorkspace"); + b.innerHTML = Lang.Buttons.save; + b.variableContainer = this; + b.bindOnClick(function(b) { Entry.variableContainer.addVariable(); - b.updateSelectedVariable(b.variables_[0]); - a = b.variables_[0].listElement; - a.editButton.addClass("entryRemove"); - a.editSaveButton.removeClass("entryRemove"); - a.nameField.removeAttribute("disabled"); + a.updateSelectedVariable(a.variables_[0]); + b = a.variables_[0].listElement; + b.editButton.addClass("entryRemove"); + b.editSaveButton.removeClass("entryRemove"); + b.nameField.removeAttribute("disabled"); }); - c.appendChild(a); + c.appendChild(b); }; Entry.VariableContainer.prototype.generateListAddView = function() { - var b = this, a = Entry.createElement("li"); - this.listAddPanel.view = a; + var a = this, b = Entry.createElement("li"); + this.listAddPanel.view = b; this.listAddPanel.isOpen = !1; - a.addClass("entryVariableAddSpaceWorkspace"); - a.addClass("entryRemove"); + b.addClass("entryVariableAddSpaceWorkspace"); + b.addClass("entryRemove"); var c = Entry.createElement("div"); c.addClass("entryVariableAddSpaceNameWrapperWorkspace"); c.addClass("entryListAddSpaceNameWrapperWorkspace"); - a.appendChild(c); + b.appendChild(c); var d = Entry.createElement("input"); d.addClass("entryVariableAddSpaceInputWorkspace"); d.setAttribute("placeholder", Lang.Workspace.list_name); this.listAddPanel.view.name = d; d.variableContainer = this; - d.onkeypress = function(a) { - 13 == a.keyCode && (b.addList(), a = b.lists_[0], b.updateSelectedVariable(a), a = a.listElement, a.editButton.addClass("entryRemove"), a.editSaveButton.removeClass("entryRemove"), a.nameField.removeAttribute("disabled")); + d.onkeypress = function(b) { + 13 == b.keyCode && (a.addList(), b = a.lists_[0], a.updateSelectedVariable(b), b = b.listElement, b.editButton.addClass("entryRemove"), b.editSaveButton.removeClass("entryRemove"), b.nameField.removeAttribute("disabled")); }; c.appendChild(d); c = Entry.createElement("div"); c.addClass("entryVariableAddSpaceGlobalWrapperWorkspace"); - c.bindOnClick(function(a) { - b.listAddPanel.info.object = null; - b.updateVariableAddView("list"); + c.bindOnClick(function(b) { + a.listAddPanel.info.object = null; + a.updateVariableAddView("list"); }); - a.appendChild(c); + b.appendChild(c); d = Entry.createElement("span"); d.innerHTML = Lang.Workspace.use_all_objects; c.appendChild(d); @@ -14323,10 +15751,10 @@ Entry.VariableContainer.prototype.generateListAddView = function() { c.appendChild(d); c = Entry.createElement("div"); c.addClass("entryVariableAddSpaceLocalWrapperWorkspace"); - c.bindOnClick(function(a) { - Entry.playground.object && (a = b.listAddPanel.info, a.object = Entry.playground.object.id, a.isCloud = !1, b.updateVariableAddView("list")); + c.bindOnClick(function(b) { + Entry.playground.object && (b = a.listAddPanel.info, b.object = Entry.playground.object.id, b.isCloud = !1, a.updateVariableAddView("list")); }); - a.appendChild(c); + b.appendChild(c); d = Entry.createElement("span"); d.innerHTML = Lang.Workspace.Variable_use_this_object; c.appendChild(d); @@ -14336,13 +15764,13 @@ Entry.VariableContainer.prototype.generateListAddView = function() { this.variableAddPanel.info.object && addVariableLocalCheck.addClass("entryVariableAddChecked"); c.appendChild(d); c = Entry.createElement("div"); - a.cloudWrapper = c; + b.cloudWrapper = c; c.addClass("entryVariableAddSpaceCloudWrapperWorkspace"); - c.bindOnClick(function(a) { - a = b.listAddPanel.info; - a.object || (a.isCloud = !a.isCloud, b.updateVariableAddView("list")); + c.bindOnClick(function(b) { + b = a.listAddPanel.info; + b.object || (b.isCloud = !b.isCloud, a.updateVariableAddView("list")); }); - a.appendChild(c); + b.appendChild(c); d = Entry.createElement("span"); d.addClass("entryVariableAddSpaceCloudSpanWorkspace"); d.innerHTML = Lang.Workspace.List_create_cloud; @@ -14355,167 +15783,158 @@ Entry.VariableContainer.prototype.generateListAddView = function() { c.appendChild(d); c = Entry.createElement("div"); c.addClass("entryVariableAddSpaceButtonWrapperWorkspace"); - a.appendChild(c); - a = Entry.createElement("span"); - a.addClass("entryVariableAddSpaceCancelWorkspace"); - a.addClass("entryVariableAddSpaceButtonWorkspace"); - a.innerHTML = Lang.Buttons.cancel; - a.bindOnClick(function(a) { - b.listAddPanel.view.addClass("entryRemove"); - b.resetVariableAddPanel("list"); + b.appendChild(c); + b = Entry.createElement("span"); + b.addClass("entryVariableAddSpaceCancelWorkspace"); + b.addClass("entryVariableAddSpaceButtonWorkspace"); + b.innerHTML = Lang.Buttons.cancel; + b.bindOnClick(function(b) { + a.listAddPanel.view.addClass("entryRemove"); + a.resetVariableAddPanel("list"); }); - c.appendChild(a); - a = Entry.createElement("span"); - a.addClass("entryVariableAddSpaceConfirmWorkspace"); - a.addClass("entryVariableAddSpaceButtonWorkspace"); - a.innerHTML = Lang.Buttons.save; - a.variableContainer = this; - a.bindOnClick(function(a) { - b.addList(); - a = b.lists_[0]; - b.updateSelectedVariable(a); - a = a.listElement; - a.editButton.addClass("entryRemove"); - a.editSaveButton.removeClass("entryRemove"); - a.nameField.removeAttribute("disabled"); + c.appendChild(b); + b = Entry.createElement("span"); + b.addClass("entryVariableAddSpaceConfirmWorkspace"); + b.addClass("entryVariableAddSpaceButtonWorkspace"); + b.innerHTML = Lang.Buttons.save; + b.variableContainer = this; + b.bindOnClick(function(b) { + a.addList(); + b = a.lists_[0]; + a.updateSelectedVariable(b); + b = b.listElement; + b.editButton.addClass("entryRemove"); + b.editSaveButton.removeClass("entryRemove"); + b.nameField.removeAttribute("disabled"); }); - c.appendChild(a); + c.appendChild(b); }; Entry.VariableContainer.prototype.generateVariableSplitterView = function() { - var b = Entry.createElement("li"); - b.addClass("entryVariableSplitterWorkspace"); var a = Entry.createElement("li"); a.addClass("entryVariableSplitterWorkspace"); - this.variableSplitters = {top:b, bottom:a}; + var b = Entry.createElement("li"); + b.addClass("entryVariableSplitterWorkspace"); + this.variableSplitters = {top:a, bottom:b}; }; -Entry.VariableContainer.prototype.openVariableAddPanel = function(b) { - b = b ? b : "variable"; +Entry.VariableContainer.prototype.openVariableAddPanel = function(a) { + a = a ? a : "variable"; Entry.playground.toggleOnVariableView(); Entry.playground.changeViewMode("variable"); - "variable" == b ? this.variableAddPanel.isOpen = !0 : this.listAddPanel.isOpen = !0; - this.selectFilter(b); - this.updateVariableAddView(b); + "variable" == a ? this.variableAddPanel.isOpen = !0 : this.listAddPanel.isOpen = !0; + this.selectFilter(a); + this.updateVariableAddView(a); }; -Entry.VariableContainer.prototype.getMenuXml = function(b) { - for (var a = [], c = 0 !== this.variables_.length, d = 0 !== this.lists_.length, e, f = 0, g;g = b[f];f++) { +Entry.VariableContainer.prototype.getMenuXml = function(a) { + for (var b = [], c = 0 !== this.variables_.length, d = 0 !== this.lists_.length, e, f = 0, g;g = a[f];f++) { var h = g.tagName; - h && "BLOCK" == h.toUpperCase() ? (e = g.getAttribute("bCategory"), !c && "variable" == e || !d && "list" == e || a.push(g)) : !h || "SPLITTER" != h.toUpperCase() && "BTN" != h.toUpperCase() || !c && "variable" == e || (d || "list" != e) && a.push(g); + h && "BLOCK" == h.toUpperCase() ? (e = g.getAttribute("bCategory"), !c && "variable" == e || !d && "list" == e || b.push(g)) : !h || "SPLITTER" != h.toUpperCase() && "BTN" != h.toUpperCase() || !c && "variable" == e || (d || "list" != e) && b.push(g); } - return a; + return b; }; -Entry.VariableContainer.prototype.addCloneLocalVariables = function(b) { - var a = [], c = this; - this.mapVariable(function(b, c) { - if (b.object_ && b.object_ == c.objectId) { - var f = b.toJSON(); - f.originId = f.id; - f.id = Entry.generateHash(); - f.object = c.newObjectId; - delete f.x; - delete f.y; - a.push(f); - c.json.script = c.json.script.replace(new RegExp(f.originId, "g"), f.id); - } - }, b); - a.map(function(a) { +Entry.VariableContainer.prototype.addCloneLocalVariables = function(a) { + var b = [], c = this; + this.mapVariable(function(a, c) { + a.object_ && a.object_ == c.objectId && (a = a.toJSON(), a.originId = a.id, a.id = Entry.generateHash(), a.object = c.newObjectId, delete a.x, delete a.y, b.push(a), c.json.script = c.json.script.replace(new RegExp(a.originId, "g"), a.id)); + }, a); + b.map(function(a) { c.addVariable(a); }); }; -Entry.VariableContainer.prototype.generateTimer = function(b) { - b || (b = {}, b.id = Entry.generateHash(), b.name = Lang.Workspace.Variable_Timer, b.value = 0, b.variableType = "timer", b.visible = !1, b.x = 150, b.y = -70, b = new Entry.Variable(b)); - b.generateView(); - b.tick = null; - Entry.engine.projectTimer = b; +Entry.VariableContainer.prototype.generateTimer = function(a) { + a || (a = {}, a.id = Entry.generateHash(), a.name = Lang.Workspace.Variable_Timer, a.value = 0, a.variableType = "timer", a.visible = !1, a.x = 150, a.y = -70, a = new Entry.Variable(a)); + a.generateView(); + a.tick = null; + Entry.engine.projectTimer = a; Entry.addEventListener("stop", function() { Entry.engine.stopProjectTimer(); }); }; -Entry.VariableContainer.prototype.generateAnswer = function(b) { - b || (b = new Entry.Variable({id:Entry.generateHash(), name:Lang.Blocks.VARIABLE_get_canvas_input_value, value:0, variableType:"answer", visible:!1, x:150, y:-100})); - b.generateView(); - Entry.container.inputValue = b; +Entry.VariableContainer.prototype.generateAnswer = function(a) { + a || (a = new Entry.Variable({id:Entry.generateHash(), name:Lang.Blocks.VARIABLE_get_canvas_input_value, value:0, variableType:"answer", visible:!1, x:150, y:-100})); + a.generateView(); + Entry.container.inputValue = a; }; Entry.VariableContainer.prototype.generateVariableSettingView = function() { - var b = this, a = Entry.createElement("div"); - a.bindOnClick(function(a) { + var a = this, b = Entry.createElement("div"); + b.bindOnClick(function(a) { a.stopPropagation(); }); - this.variableSettingView = a; - a.addClass("entryVariableSettingWorkspace"); - this.listView_.appendChild(a); - a.addClass("entryRemove"); + this.variableSettingView = b; + b.addClass("entryVariableSettingWorkspace"); + this.listView_.appendChild(b); + b.addClass("entryRemove"); var c = Entry.createElement("div"); c.addClass("entryVariableSettingVisibleWrapperWorkspace"); - c.bindOnClick(function(a) { - a = b.selectedVariable; - var c = b.variableSettingView.visibleCheck; - a.setVisible(!a.isVisible()); - a.isVisible() ? c.addClass("entryVariableSettingChecked") : c.removeClass("entryVariableSettingChecked"); + c.bindOnClick(function(b) { + b = a.selectedVariable; + var c = a.variableSettingView.visibleCheck; + b.setVisible(!b.isVisible()); + b.isVisible() ? c.addClass("entryVariableSettingChecked") : c.removeClass("entryVariableSettingChecked"); }); - a.appendChild(c); + b.appendChild(c); var d = Entry.createElement("span"); d.innerHTML = Lang.Workspace.show_variable; c.appendChild(d); d = Entry.createElement("span"); d.addClass("entryVariableSettingCheckWorkspace"); - a.visibleCheck = d; + b.visibleCheck = d; c.appendChild(d); c = Entry.createElement("div"); c.addClass("entryVariableSettingInitValueWrapperWorkspace"); - a.appendChild(c); + b.appendChild(c); d = Entry.createElement("span"); d.innerHTML = Lang.Workspace.default_value; c.appendChild(d); d = Entry.createElement("input"); d.addClass("entryVariableSettingInitValueInputWorkspace"); - a.initValueInput = d; + b.initValueInput = d; d.value = 0; - d.onkeyup = function(a) { - b.selectedVariable.setValue(this.value); + d.onkeyup = function(b) { + a.selectedVariable.setValue(this.value); }; - d.onblur = function(a) { - b.selectedVariable.setValue(this.value); + d.onblur = function(b) { + a.selectedVariable.setValue(this.value); }; - a.initValueInput = d; + b.initValueInput = d; c.appendChild(d); c = Entry.createElement("div"); c.addClass("entryVariableSettingSplitterWorkspace"); - a.appendChild(c); + b.appendChild(c); c = Entry.createElement("div"); c.addClass("entryVariableSettingSlideWrapperWorkspace"); - a.appendChild(c); + b.appendChild(c); d = Entry.createElement("span"); d.innerHTML = Lang.Workspace.slide; c.appendChild(d); d = Entry.createElement("span"); d.addClass("entryVariableSettingCheckWorkspace"); - a.slideCheck = d; + b.slideCheck = d; c.appendChild(d); - c.bindOnClick(function(a) { + c.bindOnClick(function(b) { var c; - a = b.selectedVariable; - var d = b.variables_, f = a.getType(); - "variable" == f ? (c = a.toJSON(), c.variableType = "slide", c = new Entry.Variable(c), d.splice(d.indexOf(a), 0, c), 0 > c.getValue() && c.setValue(0), 100 < c.getValue() && c.setValue(100), e.removeAttribute("disabled"), g.removeAttribute("disabled")) : "slide" == f && (c = a.toJSON(), c.variableType = "variable", c = new Entry.Variable(c), d.splice(d.indexOf(a), 0, c), e.setAttribute("disabled", "disabled"), g.setAttribute("disabled", "disabled")); - b.createVariableView(c); - b.removeVariable(a); - b.updateSelectedVariable(c); + b = a.selectedVariable; + var d = a.variables_, f = b.getType(); + "variable" == f ? (c = b.toJSON(), c.variableType = "slide", c = new Entry.Variable(c), d.splice(d.indexOf(b), 0, c), 0 > c.getValue() && c.setValue(0), 100 < c.getValue() && c.setValue(100), e.removeAttribute("disabled"), g.removeAttribute("disabled")) : "slide" == f && (c = b.toJSON(), c.variableType = "variable", c = new Entry.Variable(c), d.splice(d.indexOf(b), 0, c), e.setAttribute("disabled", "disabled"), g.setAttribute("disabled", "disabled")); + a.createVariableView(c); + a.removeVariable(b); + a.updateSelectedVariable(c); c.generateView(); }); c = Entry.createElement("div"); - a.minMaxWrapper = c; + b.minMaxWrapper = c; c.addClass("entryVariableSettingMinMaxWrapperWorkspace"); - a.appendChild(c); + b.appendChild(c); d = Entry.createElement("span"); d.innerHTML = Lang.Workspace.min_value; c.appendChild(d); var e = Entry.createElement("input"); e.addClass("entryVariableSettingMinValueInputWorkspace"); - d = b.selectedVariable; + d = a.selectedVariable; e.value = d && "slide" == d.type ? d.minValue_ : 0; - e.onblur = function(a) { - isNaN(this.value) || (a = b.selectedVariable, a.setMinValue(this.value), b.updateVariableSettingView(a)); + e.onblur = function(b) { + isNaN(this.value) || (b = a.selectedVariable, b.setMinValue(this.value), a.updateVariableSettingView(b)); }; - a.minValueInput = e; + b.minValueInput = e; c.appendChild(e); var f = Entry.createElement("span"); f.addClass("entryVariableSettingMaxValueSpanWorkspace"); @@ -14524,46 +15943,46 @@ Entry.VariableContainer.prototype.generateVariableSettingView = function() { var g = Entry.createElement("input"); g.addClass("entryVariableSettingMaxValueInputWorkspace"); g.value = d && "slide" == d.type ? d.maxValue_ : 100; - g.onblur = function(a) { - isNaN(this.value) || (a = b.selectedVariable, a.setMaxValue(this.value), b.updateVariableSettingView(a)); + g.onblur = function(b) { + isNaN(this.value) || (b = a.selectedVariable, b.setMaxValue(this.value), a.updateVariableSettingView(b)); }; - a.maxValueInput = g; + b.maxValueInput = g; c.appendChild(g); }; -Entry.VariableContainer.prototype.updateVariableSettingView = function(b) { - var a = this.variableSettingView, c = a.visibleCheck, d = a.initValueInput, e = a.slideCheck, f = a.minValueInput, g = a.maxValueInput, h = a.minMaxWrapper; +Entry.VariableContainer.prototype.updateVariableSettingView = function(a) { + var b = this.variableSettingView, c = b.visibleCheck, d = b.initValueInput, e = b.slideCheck, f = b.minValueInput, g = b.maxValueInput, h = b.minMaxWrapper; c.removeClass("entryVariableSettingChecked"); - b.isVisible() && c.addClass("entryVariableSettingChecked"); + a.isVisible() && c.addClass("entryVariableSettingChecked"); e.removeClass("entryVariableSettingChecked"); - "slide" == b.getType() ? (e.addClass("entryVariableSettingChecked"), f.removeAttribute("disabled"), g.removeAttribute("disabled"), f.value = b.getMinValue(), g.value = b.getMaxValue(), h.removeClass("entryVariableMinMaxDisabledWorkspace")) : (h.addClass("entryVariableMinMaxDisabledWorkspace"), f.setAttribute("disabled", "disabled"), g.setAttribute("disabled", "disabled")); - d.value = b.getValue(); - b.listElement.appendChild(a); - a.removeClass("entryRemove"); + "slide" == a.getType() ? (e.addClass("entryVariableSettingChecked"), f.removeAttribute("disabled"), g.removeAttribute("disabled"), f.value = a.getMinValue(), g.value = a.getMaxValue(), h.removeClass("entryVariableMinMaxDisabledWorkspace")) : (h.addClass("entryVariableMinMaxDisabledWorkspace"), f.setAttribute("disabled", "disabled"), g.setAttribute("disabled", "disabled")); + d.value = a.getValue(); + a.listElement.appendChild(b); + b.removeClass("entryRemove"); }; Entry.VariableContainer.prototype.generateListSettingView = function() { - var b = this, a = Entry.createElement("div"); - a.bindOnClick(function(a) { + var a = this, b = Entry.createElement("div"); + b.bindOnClick(function(a) { a.stopPropagation(); }); - this.listSettingView = a; - a.addClass("entryListSettingWorkspace"); - this.listView_.appendChild(a); - a.addClass("entryRemove"); + this.listSettingView = b; + b.addClass("entryListSettingWorkspace"); + this.listView_.appendChild(b); + b.addClass("entryRemove"); var c = Entry.createElement("div"); c.addClass("entryListSettingVisibleWrapperWorkspace"); - c.bindOnClick(function(a) { - a = b.selectedList; - var c = b.listSettingView.visibleCheck; - a.setVisible(!a.isVisible()); - a.isVisible() ? c.addClass("entryListSettingCheckedWorkspace") : c.removeClass("entryListSettingCheckedWorkspace"); + c.bindOnClick(function(b) { + b = a.selectedList; + var c = a.listSettingView.visibleCheck; + b.setVisible(!b.isVisible()); + b.isVisible() ? c.addClass("entryListSettingCheckedWorkspace") : c.removeClass("entryListSettingCheckedWorkspace"); }); - a.appendChild(c); + b.appendChild(c); var d = Entry.createElement("span"); d.innerHTML = Lang.Workspace.show_list_workspace; c.appendChild(d); d = Entry.createElement("span"); d.addClass("entryListSettingCheckWorkspace"); - a.visibleCheck = d; + b.visibleCheck = d; c.appendChild(d); d = Entry.createElement("div"); d.addClass("entryListSettingLengthWrapperWorkspace"); @@ -14571,54 +15990,54 @@ Entry.VariableContainer.prototype.generateListSettingView = function() { c.addClass("entryListSettingLengthSpanWorkspace"); c.innerHTML = Lang.Workspace.number_of_list; d.appendChild(c); - a.appendChild(d); + b.appendChild(d); c = Entry.createElement("div"); c.addClass("entryListSettingLengthControllerWorkspace"); d.appendChild(c); d = Entry.createElement("span"); d.addClass("entryListSettingMinusWorkspace"); - d.bindOnClick(function(a) { - b.selectedList.array_.pop(); - b.updateListSettingView(b.selectedList); + d.bindOnClick(function(b) { + a.selectedList.array_.pop(); + a.updateListSettingView(a.selectedList); }); c.appendChild(d); d = Entry.createElement("input"); d.addClass("entryListSettingLengthInputWorkspace"); d.onblur = function() { - b.setListLength(this.value); + a.setListLength(this.value); }; d.onkeypress = function(a) { 13 == a.keyCode && this.blur(); }; - a.lengthInput = d; + b.lengthInput = d; c.appendChild(d); d = Entry.createElement("span"); d.addClass("entryListSettingPlusWorkspace"); - d.bindOnClick(function(a) { - b.selectedList.array_.push({data:0}); - b.updateListSettingView(b.selectedList); + d.bindOnClick(function(b) { + a.selectedList.array_.push({data:0}); + a.updateListSettingView(a.selectedList); }); c.appendChild(d); c = Entry.createElement("div"); - a.seperator = c; - a.appendChild(c); + b.seperator = c; + b.appendChild(c); c.addClass("entryListSettingSeperatorWorkspace"); c = Entry.createElement("div"); c.addClass("entryListSettingListValuesWorkspace"); - a.listValues = c; - a.appendChild(c); + b.listValues = c; + b.appendChild(c); }; -Entry.VariableContainer.prototype.updateListSettingView = function(b) { - var a = this; - b = b || this.selectedList; +Entry.VariableContainer.prototype.updateListSettingView = function(a) { + var b = this; + a = a || 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;) { + a.isVisible() && e.addClass("entryListSettingCheckedWorkspace"); + f.value = a.array_.length; + for (a.listElement.appendChild(c);d.firstChild;) { d.removeChild(d.firstChild); } - var h = b.array_; + var h = a.array_; 0 === h.length ? g.addClass("entryRemove") : g.removeClass("entryRemove"); for (e = 0;e < h.length;e++) { (function(c) { @@ -14632,7 +16051,7 @@ Entry.VariableContainer.prototype.updateListSettingView = function(b) { f.value = h[c].data; f.onblur = function() { h[c].data = this.value; - b.updateView(); + a.updateView(); }; f.onkeypress = function(a) { 13 == a.keyCode && this.blur(); @@ -14642,105 +16061,106 @@ Entry.VariableContainer.prototype.updateListSettingView = function(b) { f = Entry.createElement("span"); f.bindOnClick(function() { h.splice(c, 1); - a.updateListSettingView(); + b.updateListSettingView(); }); f.addClass("entryListSettingValueRemoveWorkspace"); e.appendChild(f); d.appendChild(e); })(e); } - b.updateView(); + a.updateView(); c.removeClass("entryRemove"); }; -Entry.VariableContainer.prototype.setListLength = function(b) { - b = Number(b); - var a = this.selectedList.array_; - if (!isNaN(b)) { - var c = a.length; - if (c < b) { - for (b -= c, c = 0;c < b;c++) { - a.push({data:0}); +Entry.VariableContainer.prototype.setListLength = function(a) { + a = Number(a); + var b = this.selectedList.array_; + if (!isNaN(a)) { + var c = b.length; + if (c < a) { + for (a -= c, c = 0;c < a;c++) { + b.push({data:0}); } } else { - c > b && (a.length = b); + c > a && (b.length = a); } } this.updateListSettingView(); }; Entry.VariableContainer.prototype.updateViews = function() { - var b = this.lists_; + var a = this.lists_; this.variables_.map(function(a) { a.updateView(); }); - b.map(function(a) { + a.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.updateSelectedVariable = function(a, b) { + a ? "variable" == a.type ? (this.selectedVariable = a, this.updateVariableSettingView(a)) : "slide" == a.type ? (this.selectedVariable = a, this.updateVariableSettingView(a)) : "list" == a.type && (this.selectedList = a, this.updateListSettingView(a)) : (this.selectedVariable = null, "variable" == (b || "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) { +Entry.VariableContainer.prototype.removeLocalVariables = function(a) { + var b = [], c = this; + this.mapVariable(function(a, c) { + a.object_ && a.object_ == c && b.push(a); + }, a); + b.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) { + var a = Entry.projectId; + if (Entry.cloudSavable && a) { + var b = Entry.variableContainer, a = b.variables_.filter(function(a) { return a.isCloud_; - }), b = b.map(function(a) { + }), a = a.map(function(a) { return a.toJSON(); - }), a = a.lists_.filter(function(a) { + }), b = b.lists_.filter(function(a) { return a.isCloud_; - }), a = a.map(function(a) { + }), b = b.map(function(a) { return a.toJSON(); }); - $.ajax({url:"/api/project/variable/" + Entry.projectId, type:"PUT", data:{variables:b, lists:a}}).done(function() { + $.ajax({url:"/api/project/variable/" + Entry.projectId, type:"PUT", data:{variables:a, lists:b}}).done(function() { }); } }; -Entry.VariableContainer.prototype.addRef = function(b, a) { +Entry.VariableContainer.prototype.addRef = function(a, b) { if (this.view_ && Entry.playground.mainWorkspace && Entry.playground.mainWorkspace.getMode() === Entry.Workspace.MODE_BOARD) { - var c = {object:a.getCode().object, block:a}; - a.funcBlock && (c.funcBlock = a.funcBlock, delete a.funcBlock); - this[b].push(c); - if ("_functionRefs" == b) { - for (var d = a.type.substr(5), e = Entry.variableContainer.functions_[d].content.getBlockList(), f = 0;f < e.length;f++) { - a = e[f]; - var g = a.events; - -1 < a.type.indexOf("func_") && a.type.substr(5) == d || (g && g.viewAdd && g.viewAdd.forEach(function(b) { - a.getCode().object = c.object; - b && (a.funcBlock = c.block, b(a)); - }), g && g.dataAdd && g.dataAdd.forEach(function(b) { - a.getCode().object = c.object; - b && (a.funcBlock = c.block, b(a)); + var c = {object:b.getCode().object, block:b}; + b.funcBlock && (c.funcBlock = b.funcBlock, delete b.funcBlock); + this[a].push(c); + if ("_functionRefs" == a) { + a = b.type.substr(5); + for (var d = Entry.variableContainer.functions_[a].content.getBlockList(), e = 0;e < d.length;e++) { + b = d[e]; + var f = b.events; + -1 < b.type.indexOf("func_") && b.type.substr(5) == a || (f && f.viewAdd && f.viewAdd.forEach(function(a) { + b.getCode().object = c.object; + a && (b.funcBlock = c.block, a(b)); + }), f && f.dataAdd && f.dataAdd.forEach(function(a) { + b.getCode().object = c.object; + a && (b.funcBlock = c.block, a(b)); })); } } return c; } }; -Entry.VariableContainer.prototype.removeRef = function(b, a) { +Entry.VariableContainer.prototype.removeRef = function(a, b) { if (Entry.playground.mainWorkspace && Entry.playground.mainWorkspace.getMode() === Entry.Workspace.MODE_BOARD) { - for (var c = this[b], d = 0;d < c.length;d++) { - if (c[d].block == a) { + for (var c = this[a], d = 0;d < c.length;d++) { + if (c[d].block == b) { c.splice(d, 1); break; } } - if ("_functionRefs" == b && (c = a.type.substr(5), d = Entry.variableContainer.functions_[c])) { - for (var e = d.content.getBlockList(), d = 0;d < e.length;d++) { - a = e[d]; - var f = a.events; - -1 < a.type.indexOf("func_") && a.type.substr(5) == c || (f && f.viewDestroy && f.viewDestroy.forEach(function(b) { - b && b(a); - }), f && f.dataDestroy && f.dataDestroy.forEach(function(b) { - b && b(a); + if ("_functionRefs" == a && (a = b.type.substr(5), d = Entry.variableContainer.functions_[a])) { + for (c = d.content.getBlockList(), d = 0;d < c.length;d++) { + b = c[d]; + var e = b.events; + -1 < b.type.indexOf("func_") && b.type.substr(5) == a || (e && e.viewDestroy && e.viewDestroy.forEach(function(a) { + a && a(b); + }), e && e.dataDestroy && e.dataDestroy.forEach(function(a) { + a && a(b); })); } } @@ -14749,10 +16169,10 @@ Entry.VariableContainer.prototype.removeRef = function(b, a) { Entry.VariableContainer.prototype._getBlockMenu = function() { return Entry.playground.mainWorkspace.getBlockMenu(); }; -Entry.VariableContainer.prototype._truncName = function(b, a) { - b = b.substring(0, this._maxNameLength); - Entry.toast.warning(Lang.Workspace[a + "_name_auto_edited_title"], Lang.Workspace[a + "_name_auto_edited_content"]); - return b; +Entry.VariableContainer.prototype._truncName = function(a, b) { + a = a.substring(0, this._maxNameLength); + Entry.toast.warning(Lang.Workspace[b + "_name_auto_edited_title"], Lang.Workspace[b + "_name_auto_edited_content"]); + return a; }; Entry.VariableContainer.prototype._maxNameLength = 10; Entry.block.run = {skeleton:"basic", color:"#3BBD70", contents:["this is", "basic block"], func:function() { @@ -14760,9 +16180,9 @@ Entry.block.run = {skeleton:"basic", color:"#3BBD70", contents:["this is", "basi Entry.block.mutant = {skeleton:"basic", event:"start", color:"#3BBD70", template:"test mutant block", params:[], func:function() { }, changeEvent:new Entry.Event}; Entry.block.jr_start = {skeleton:"pebble_event", event:"start", color:"#3BBD70", template:"%1", params:[{type:"Indicator", img:"/img/assets/ntry/bitmap/jr/block_play_image.png", highlightColor:"#3BBD70", position:{x:0, y:0}, size:22}], func:function() { - var b = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), a; - for (a in b) { - this._unit = b[a]; + var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), b; + for (b in a) { + this._unit = a[b]; } Ntry.unitComp = Ntry.entityManager.getComponent(this._unit.id, Ntry.STATIC.UNIT); }}; @@ -14772,9 +16192,9 @@ Entry.block.jr_repeat = {skeleton:"pebble_loop", color:"#127CDB", template:"%1 \ } if (0 < this.repeatCount) { this.repeatCount--; - var b = this.block.statements[0]; - if (0 !== b.getBlocks().length) { - return this.executor.stepInto(b), Entry.STATIC.CONTINUE; + var a = this.block.statements[0]; + if (0 !== a.getBlocks().length) { + return this.executor.stepInto(a), Entry.STATIC.CONTINUE; } } else { delete this.repeatCount; @@ -14789,10 +16209,10 @@ Entry.block.jr_item = {skeleton:"pebble_basic", color:"#F46C6C", template:"\uaf4 delete this.isContinue; } else { this.isAction = this.isContinue = !0; - var b = this; + var a = this; Ntry.dispatchEvent("unitAction", Ntry.STATIC.GET_ITEM, function() { Ntry.dispatchEvent("getItem"); - b.isAction = !1; + a.isAction = !1; }); return Entry.STATIC.CONTINUE; } @@ -14806,10 +16226,10 @@ Entry.block.cparty_jr_item = {skeleton:"pebble_basic", color:"#8ABC1D", template delete this.isContinue; } else { this.isAction = this.isContinue = !0; - var b = this; + var a = this; Ntry.dispatchEvent("unitAction", Ntry.STATIC.GET_ITEM, function() { Ntry.dispatchEvent("getItem"); - b.isAction = !1; + a.isAction = !1; }); return Entry.STATIC.CONTINUE; } @@ -14823,22 +16243,22 @@ Entry.block.jr_north = {skeleton:"pebble_basic", color:"#A751E3", template:"%1 % delete this.isContinue; } else { this.isAction = this.isContinue = !0; - var b = Ntry.STATIC, a = this, c = function() { + var a = Ntry.STATIC, b = this, c = function() { window.setTimeout(function() { Ntry.dispatchEvent("unitAction", Ntry.STATIC.WALK, function() { - a.isAction = !1; + b.isAction = !1; }); }, 3); }, d; switch(Ntry.unitComp.direction) { case Ntry.STATIC.EAST: - d = b.TURN_LEFT; + d = a.TURN_LEFT; break; case Ntry.STATIC.SOUTH: - d = b.HALF_ROTATION; + d = a.HALF_ROTATION; break; case Ntry.STATIC.WEST: - d = b.TURN_RIGHT; + d = a.TURN_RIGHT; break; default: c(); @@ -14848,7 +16268,7 @@ Entry.block.jr_north = {skeleton:"pebble_basic", color:"#A751E3", template:"%1 % } }}; Entry.block.jr_east = {skeleton:"pebble_basic", color:"#A751E3", template:"%1 %2", params:[{type:"Text", text:Lang.Menus.go_right}, {type:"Indicator", img:"/img/assets/ntry/bitmap/jr/block_right_image.png", position:{x:83, y:0}, size:22}], func:function() { - var b = Ntry.STATIC; + var a = Ntry.STATIC; if (this.isContinue) { if (this.isAction) { return Entry.STATIC.CONTINUE; @@ -14857,22 +16277,22 @@ Entry.block.jr_east = {skeleton:"pebble_basic", color:"#A751E3", template:"%1 %2 delete this.isContinue; } else { this.isAction = this.isContinue = !0; - var a = this, c = function() { + var b = this, c = function() { window.setTimeout(function() { - Ntry.dispatchEvent("unitAction", b.WALK, function() { - a.isAction = !1; + Ntry.dispatchEvent("unitAction", a.WALK, function() { + b.isAction = !1; }); }, 3); }, d; switch(Ntry.unitComp.direction) { - case b.SOUTH: - d = b.TURN_LEFT; + case a.SOUTH: + d = a.TURN_LEFT; break; - case b.WEST: - d = b.HALF_ROTATION; + case a.WEST: + d = a.HALF_ROTATION; break; - case b.NORTH: - d = b.TURN_RIGHT; + case a.NORTH: + d = a.TURN_RIGHT; break; default: c(); @@ -14890,22 +16310,22 @@ Entry.block.jr_south = {skeleton:"pebble_basic", color:"#A751E3", template:"%1 % delete this.isContinue; } else { this.isAction = this.isContinue = !0; - var b = Ntry.STATIC, a = this, c = function() { + var a = Ntry.STATIC, b = this, c = function() { window.setTimeout(function() { Ntry.dispatchEvent("unitAction", Ntry.STATIC.WALK, function() { - a.isAction = !1; + b.isAction = !1; }); }, 3); }, d; switch(Ntry.unitComp.direction) { - case b.EAST: - d = b.TURN_RIGHT; + case a.EAST: + d = a.TURN_RIGHT; break; - case b.NORTH: - d = b.HALF_ROTATION; + case a.NORTH: + d = a.HALF_ROTATION; break; - case b.WEST: - d = b.TURN_LEFT; + case a.WEST: + d = a.TURN_LEFT; break; default: c(); @@ -14923,22 +16343,22 @@ Entry.block.jr_west = {skeleton:"pebble_basic", color:"#A751E3", template:"%1 %2 delete this.isContinue; } else { this.isAction = this.isContinue = !0; - var b = Ntry.STATIC, a = this, c = function() { + var a = Ntry.STATIC, b = this, c = function() { window.setTimeout(function() { - Ntry.dispatchEvent("unitAction", b.WALK, function() { - a.isAction = !1; + Ntry.dispatchEvent("unitAction", a.WALK, function() { + b.isAction = !1; }); }, 3); }, d; switch(Ntry.unitComp.direction) { - case b.SOUTH: - d = b.TURN_RIGHT; + case a.SOUTH: + d = a.TURN_RIGHT; break; - case b.EAST: - d = b.HALF_ROTATION; + case a.EAST: + d = a.HALF_ROTATION; break; - case b.NORTH: - d = b.TURN_LEFT; + case a.NORTH: + d = a.TURN_LEFT; break; default: c(); @@ -14948,9 +16368,9 @@ Entry.block.jr_west = {skeleton:"pebble_basic", color:"#A751E3", template:"%1 %2 } }}; Entry.block.jr_start_basic = {skeleton:"basic_event", event:"start", color:"#3BBD70", template:"%1 %2", params:[{type:"Indicator", boxMultiplier:2, img:"/img/assets/block_icon/start_icon_play.png", highlightColor:"#3BBD70", size:17, position:{x:0, y:-2}}, Lang.Menus.maze_when_run], func:function() { - var b = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), a; - for (a in b) { - this._unit = b[a]; + var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), b; + for (b in a) { + this._unit = a[b]; } Ntry.unitComp = Ntry.entityManager.getComponent(this._unit.id, Ntry.STATIC.UNIT); }}; @@ -14963,9 +16383,9 @@ Entry.block.jr_go_straight = {skeleton:"basic", color:"#A751E3", template:"%1 %2 delete this.isContinue; } else { this.isAction = this.isContinue = !0; - var b = this; + var a = this; Ntry.dispatchEvent("unitAction", Ntry.STATIC.WALK, function() { - b.isAction = !1; + a.isAction = !1; }); return Entry.STATIC.CONTINUE; } @@ -14979,9 +16399,9 @@ Entry.block.jr_turn_left = {skeleton:"basic", color:"#A751E3", template:"%1 %2", delete this.isContinue; } else { this.isAction = this.isContinue = !0; - var b = this; + var a = this; Ntry.dispatchEvent("unitAction", Ntry.STATIC.TURN_LEFT, function() { - b.isAction = !1; + a.isAction = !1; }); return Entry.STATIC.CONTINUE; } @@ -14995,9 +16415,9 @@ Entry.block.jr_turn_right = {skeleton:"basic", color:"#A751E3", template:"%1 %2" delete this.isContinue; } else { this.isAction = this.isContinue = !0; - var b = this; + var a = this; Ntry.dispatchEvent("unitAction", Ntry.STATIC.TURN_RIGHT, function() { - b.isAction = !1; + a.isAction = !1; }); return Entry.STATIC.CONTINUE; } @@ -15011,59 +16431,59 @@ Entry.block.jr_go_slow = {skeleton:"basic", color:"#f46c6c", template:"%1 %2", p delete this.isContinue; } else { this.isAction = this.isContinue = !0; - var b = this; + var a = this; Ntry.dispatchEvent("unitAction", Ntry.STATIC.GO_SLOW, function() { - b.isAction = !1; + a.isAction = !1; }); return Entry.STATIC.CONTINUE; } }}; Entry.block.jr_repeat_until_dest = {skeleton:"basic_loop", color:"#498DEB", template:"%1 %2 %3 %4", syntax:["BasicWhile", "true"], params:[Lang.Menus.repeat_until_reach_2, {type:"Image", img:"/img/assets/ntry/bitmap/jr/jr_goal_image.png", size:18}, Lang.Menus.repeat_until_reach_1, {type:"Image", img:"/img/assets/week/blocks/for.png", size:24}], statements:[{accept:"basic"}], func:function() { - var b = this.block.statements[0]; - if (0 !== b.getBlocks().length) { - return this.executor.stepInto(b), Entry.STATIC.CONTINUE; + var a = this.block.statements[0]; + if (0 !== a.getBlocks().length) { + return this.executor.stepInto(a), Entry.STATIC.CONTINUE; } }}; Entry.block.jr_if_construction = {skeleton:"basic_loop", color:"#498DEB", template:"%1 %2 %3 %4", params:[Lang.Menus.jr_if_1, {type:"Image", img:"/img/assets/ntry/bitmap/jr/jr_construction_image.png", size:18}, Lang.Menus.jr_if_2, {type:"Image", img:"/img/assets/week/blocks/for.png", size:24}], statements:[{accept:"basic"}], func:function() { if (!this.isContinue) { - var b = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), a, c; - for (c in b) { - a = b[c]; + var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), b, c; + for (c in a) { + b = a[c]; } - b = Ntry.entityManager.getComponent(a.id, Ntry.STATIC.UNIT); - a = Ntry.entityManager.getComponent(a.id, Ntry.STATIC.GRID); - a = {x:a.x, y:a.y}; - Ntry.addVectorByDirection(a, b.direction, 1); - a = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:a.x, y:a.y}, {type:Ntry.STATIC.TILE, tileType:Ntry.STATIC.OBSTACLE_REPAIR}); + a = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.UNIT); + b = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.GRID); + b = {x:b.x, y:b.y}; + Ntry.addVectorByDirection(b, a.direction, 1); + b = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:b.x, y:b.y}, {type:Ntry.STATIC.TILE, tileType:Ntry.STATIC.OBSTACLE_REPAIR}); this.isContinue = !0; - b = this.block.statements[0]; - if (0 !== a.length && 0 !== b.getBlocks().length) { - return this.executor.stepInto(b), Entry.STATIC.CONTINUE; + a = this.block.statements[0]; + if (0 !== b.length && 0 !== a.getBlocks().length) { + return this.executor.stepInto(a), Entry.STATIC.CONTINUE; } } }}; Entry.block.jr_if_speed = {skeleton:"basic_loop", color:"#498DEB", template:Lang.Menus.jr_if_1 + " %1 " + Lang.Menus.jr_if_2 + " %2", params:[{type:"Image", img:"/img/assets/ntry/bitmap/jr/jr_speed_image.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/for.png", size:24}], statements:[{accept:"basic"}], func:function() { if (!this.isContinue) { - var b = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), a, c; - for (c in b) { - a = b[c]; + var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), b, c; + for (c in a) { + b = a[c]; } - b = Ntry.entityManager.getComponent(a.id, Ntry.STATIC.UNIT); - a = Ntry.entityManager.getComponent(a.id, Ntry.STATIC.GRID); - a = {x:a.x, y:a.y}; - Ntry.addVectorByDirection(a, b.direction, 1); - a = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:a.x, y:a.y}, {type:Ntry.STATIC.TILE, tileType:Ntry.STATIC.OBSTACLE_SLOW}); + a = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.UNIT); + b = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.GRID); + b = {x:b.x, y:b.y}; + Ntry.addVectorByDirection(b, a.direction, 1); + b = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:b.x, y:b.y}, {type:Ntry.STATIC.TILE, tileType:Ntry.STATIC.OBSTACLE_SLOW}); this.isContinue = !0; - b = this.block.statements[0]; - if (0 !== a.length && 0 !== b.getBlocks().length) { - return this.executor.stepInto(b), Entry.STATIC.CONTINUE; + a = this.block.statements[0]; + if (0 !== b.length && 0 !== a.getBlocks().length) { + return this.executor.stepInto(a), Entry.STATIC.CONTINUE; } } }}; Entry.block.maze_step_start = {skeleton:"basic_event", mode:"maze", event:"start", color:"#3BBD70", template:"%1 \uc2dc\uc791\ud558\uae30\ub97c \ud074\ub9ad\ud588\uc744 \ub54c", syntax:["Program"], params:[{type:"Indicator", boxMultiplier:2, img:"/img/assets/block_icon/start_icon_play.png", highlightColor:"#3BBD70", size:17, position:{x:0, y:-2}}], func:function() { - var b = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), a; - for (a in b) { - this._unit = b[a]; + var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), b; + for (b in a) { + this._unit = a[b]; } Ntry.unitComp = Ntry.entityManager.getComponent(this._unit.id, Ntry.STATIC.UNIT); }}; @@ -15076,9 +16496,9 @@ Entry.block.maze_step_jump = {skeleton:"basic", mode:"maze", color:"#FF6E4B", te delete this.isContinue; } else { this.isAction = this.isContinue = !0; - var b = this; + var a = this; Ntry.dispatchEvent("unitAction", Ntry.STATIC.JUMP, function() { - b.isAction = !1; + a.isAction = !1; }); return Entry.STATIC.CONTINUE; } @@ -15089,9 +16509,9 @@ Entry.block.maze_step_for = {skeleton:"basic_loop", mode:"maze", color:"#498DEB" } if (0 < this.repeatCount) { this.repeatCount--; - var b = this.block.statements[0]; - if (0 !== b.getBlocks().length) { - return this.executor.stepInto(b), Entry.STATIC.CONTINUE; + var a = this.block.statements[0]; + if (0 !== a.getBlocks().length) { + return this.executor.stepInto(a), Entry.STATIC.CONTINUE; } } else { delete this.repeatCount; @@ -15100,62 +16520,62 @@ Entry.block.maze_step_for = {skeleton:"basic_loop", mode:"maze", color:"#498DEB" Entry.block.test = {skeleton:"basic_boolean_field", mode:"maze", color:"#127CDB", template:"%1 this is test block %2", params:[{type:"Angle", value:"90"}, {type:"Dropdown", options:[[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]], value:1}], func:function() { }}; Entry.block.maze_repeat_until_1 = {skeleton:"basic_loop", mode:"maze", color:"#498DEB", template:"%1 \ub9cc\ub0a0 \ub54c \uae4c\uc9c0 \ubc18\ubcf5%2", syntax:["BasicWhile", "true"], params:[{type:"Image", img:"/img/assets/ntry/block_inner/repeat_goal_1.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/for.png", size:24}], statements:[{accept:"basic"}], func:function() { - var b = this.block.statements[0]; - if (0 !== b.getBlocks().length) { - return this.executor.stepInto(b), Entry.STATIC.CONTINUE; + var a = this.block.statements[0]; + if (0 !== a.getBlocks().length) { + return this.executor.stepInto(a), Entry.STATIC.CONTINUE; } }}; Entry.block.maze_repeat_until_2 = {skeleton:"basic_loop", mode:"maze", color:"#498DEB", template:"\ubaa8\ub4e0 %1 \ub9cc\ub0a0 \ub54c \uae4c\uc9c0 \ubc18\ubcf5%2", syntax:["BasicWhile", "true"], params:[{type:"Image", img:"/img/assets/ntry/block_inner/repeat_goal_1.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/for.png", size:24}], statements:[{accept:"basic"}], func:function() { - var b = this.block.statements[0]; - if (0 !== b.getBlocks().length) { - return this.executor.stepInto(b), Entry.STATIC.CONTINUE; + var a = this.block.statements[0]; + if (0 !== a.getBlocks().length) { + return this.executor.stepInto(a), Entry.STATIC.CONTINUE; } }}; Entry.block.maze_step_if_1 = {skeleton:"basic_loop", mode:"maze", color:"#498DEB", template:"\ub9cc\uc57d \uc55e\uc5d0 %1 \uc788\ub2e4\uba74%2", syntax:["BasicIf", 'front == "wall"'], params:[{type:"Image", img:"/img/assets/ntry/block_inner/if_target_1.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/if.png", size:24}], statements:[{accept:"basic"}], func:function() { if (!this.isContinue) { - var b = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), a, c; - for (c in b) { - a = b[c]; - } - b = Ntry.entityManager.getComponent(a.id, Ntry.STATIC.UNIT); - a = Ntry.entityManager.getComponent(a.id, Ntry.STATIC.GRID); - a = {x:a.x, y:a.y}; - Ntry.addVectorByDirection(a, b.direction, 1); - c = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:a.x, y:a.y}); - b = this.block.statements[0]; + var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), b, c; + for (c in a) { + b = a[c]; + } + a = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.UNIT); + b = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.GRID); + b = {x:b.x, y:b.y}; + Ntry.addVectorByDirection(b, a.direction, 1); + c = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:b.x, y:b.y}); + a = this.block.statements[0]; if (0 === c.length) { - return this.executor.stepInto(b), Entry.STATIC.CONTINUE; + return this.executor.stepInto(a), Entry.STATIC.CONTINUE; } - a = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:a.x, y:a.y}, {type:Ntry.STATIC.TILE, tileType:Ntry.STATIC.WALL}); + b = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:b.x, y:b.y}, {type:Ntry.STATIC.TILE, tileType:Ntry.STATIC.WALL}); this.isContinue = !0; - if (0 !== a.length && 0 !== b.getBlocks().length) { - return this.executor.stepInto(b), Entry.STATIC.CONTINUE; + if (0 !== b.length && 0 !== a.getBlocks().length) { + return this.executor.stepInto(a), Entry.STATIC.CONTINUE; } } }}; Entry.block.maze_step_if_2 = {skeleton:"basic_loop", mode:"maze", color:"#498DEB", template:"\ub9cc\uc57d \uc55e\uc5d0 %1 \uc788\ub2e4\uba74%2", syntax:["BasicIf", 'front == "bee"'], params:[{type:"Image", img:"/img/assets/ntry/bitmap/maze2/obstacle_01.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/if.png", size:24}], statements:[{accept:"basic"}], func:function() { if (!this.isContinue) { - var b = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), a, c; - for (c in b) { - a = b[c]; + var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), b, c; + for (c in a) { + b = a[c]; } - b = Ntry.entityManager.getComponent(a.id, Ntry.STATIC.UNIT); - a = Ntry.entityManager.getComponent(a.id, Ntry.STATIC.GRID); - a = {x:a.x, y:a.y}; - Ntry.addVectorByDirection(a, b.direction, 1); - a = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:a.x, y:a.y}, {type:Ntry.STATIC.TILE, tileType:Ntry.STATIC.OBSTACLE_BEE}); + a = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.UNIT); + b = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.GRID); + b = {x:b.x, y:b.y}; + Ntry.addVectorByDirection(b, a.direction, 1); + b = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:b.x, y:b.y}, {type:Ntry.STATIC.TILE, tileType:Ntry.STATIC.OBSTACLE_BEE}); this.isContinue = !0; - b = this.block.statements[0]; - if (0 !== a.length && 0 !== b.getBlocks().length) { - return this.executor.stepInto(b), Entry.STATIC.CONTINUE; + a = this.block.statements[0]; + if (0 !== b.length && 0 !== a.getBlocks().length) { + return this.executor.stepInto(a), Entry.STATIC.CONTINUE; } } }}; Entry.block.maze_call_function = {skeleton:"basic", mode:"maze", color:"#B57242", template:"\uc57d\uc18d \ubd88\ub7ec\uc624\uae30%1", syntax:["Scope", "promise"], params:[{type:"Image", img:"/img/assets/week/blocks/function.png", size:24}], func:function() { if (!this.funcExecutor) { - var b = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.CODE), a; - for (a in b) { - this.funcExecutor = new Entry.Executor(b[a].components[Ntry.STATIC.CODE].code.getEventMap("define")[0]); + var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.CODE), b; + for (b in a) { + this.funcExecutor = new Entry.Executor(a[b].components[Ntry.STATIC.CODE].code.getEventMap("define")[0]); } } this.funcExecutor.execute(); @@ -15163,44 +16583,44 @@ Entry.block.maze_call_function = {skeleton:"basic", mode:"maze", color:"#B57242" return Entry.STATIC.CONTINUE; } }}; -Entry.block.maze_define_function = {skeleton:"basic_define", mode:"maze", color:"#B57242", event:"define", template:"\uc57d\uc18d\ud558\uae30%1", syntax:["BasicFunction"], params:[{type:"Image", img:"/img/assets/week/blocks/function.png", size:24}], statements:[{accept:"basic"}], func:function(b) { - if (!this.executed && (b = this.block.statements[0], 0 !== b.getBlocks().length)) { - return this.executor.stepInto(b), this.executed = !0, Entry.STATIC.CONTINUE; +Entry.block.maze_define_function = {skeleton:"basic_define", mode:"maze", color:"#B57242", event:"define", template:"\uc57d\uc18d\ud558\uae30%1", syntax:["BasicFunction"], params:[{type:"Image", img:"/img/assets/week/blocks/function.png", size:24}], statements:[{accept:"basic"}], func:function(a) { + if (!this.executed && (a = this.block.statements[0], 0 !== a.getBlocks().length)) { + return this.executor.stepInto(a), this.executed = !0, Entry.STATIC.CONTINUE; } }}; Entry.block.maze_step_if_3 = {skeleton:"basic_loop", mode:"maze", color:"#498DEB", template:"\ub9cc\uc57d \uc55e\uc5d0 %1 \uc788\ub2e4\uba74%2", syntax:["BasicIf", 'front == "banana"'], params:[{type:"Image", img:"/img/assets/ntry/block_inner/if_target_3.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/if.png", size:24}], statements:[{accept:"basic"}], func:function() { if (!this.isContinue) { - var b = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), a, c; - for (c in b) { - a = b[c]; + var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), b, c; + for (c in a) { + b = a[c]; } - b = Ntry.entityManager.getComponent(a.id, Ntry.STATIC.UNIT); - a = Ntry.entityManager.getComponent(a.id, Ntry.STATIC.GRID); - a = {x:a.x, y:a.y}; - Ntry.addVectorByDirection(a, b.direction, 1); - a = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:a.x, y:a.y}, {type:Ntry.STATIC.TILE, tileType:Ntry.STATIC.OBSTACLE_BANANA}); + a = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.UNIT); + b = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.GRID); + b = {x:b.x, y:b.y}; + Ntry.addVectorByDirection(b, a.direction, 1); + b = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:b.x, y:b.y}, {type:Ntry.STATIC.TILE, tileType:Ntry.STATIC.OBSTACLE_BANANA}); this.isContinue = !0; - b = this.block.statements[0]; - if (0 !== a.length && 0 !== b.getBlocks().length) { - return this.executor.stepInto(b), Entry.STATIC.CONTINUE; + a = this.block.statements[0]; + if (0 !== b.length && 0 !== a.getBlocks().length) { + return this.executor.stepInto(a), Entry.STATIC.CONTINUE; } } }}; Entry.block.maze_step_if_4 = {skeleton:"basic_loop", mode:"maze", color:"#498DEB", template:"\ub9cc\uc57d \uc55e\uc5d0 %1 \uc788\ub2e4\uba74%2", syntax:["BasicIf", 'front == "wall"'], params:[{type:"Image", img:"/img/assets/ntry/block_inner/if_target_2.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/if.png", size:24}], statements:[{accept:"basic"}], func:function() { if (!this.isContinue) { - var b = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), a, c; - for (c in b) { - a = b[c]; + var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), b, c; + for (c in a) { + b = a[c]; } - b = Ntry.entityManager.getComponent(a.id, Ntry.STATIC.UNIT); - a = Ntry.entityManager.getComponent(a.id, Ntry.STATIC.GRID); - a = {x:a.x, y:a.y}; - Ntry.addVectorByDirection(a, b.direction, 1); - a = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:a.x, y:a.y}, {type:Ntry.STATIC.TILE, tileType:Ntry.STATIC.WALL}); + a = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.UNIT); + b = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.GRID); + b = {x:b.x, y:b.y}; + Ntry.addVectorByDirection(b, a.direction, 1); + b = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:b.x, y:b.y}, {type:Ntry.STATIC.TILE, tileType:Ntry.STATIC.WALL}); this.isContinue = !0; - b = this.block.statements[0]; - if (0 !== a.length && 0 !== b.getBlocks().length) { - return this.executor.stepInto(b), Entry.STATIC.CONTINUE; + a = this.block.statements[0]; + if (0 !== b.length && 0 !== a.getBlocks().length) { + return this.executor.stepInto(a), Entry.STATIC.CONTINUE; } } }}; @@ -15213,9 +16633,9 @@ Entry.block.maze_step_move_step = {skeleton:"basic", mode:"maze", color:"#A751E3 delete this.isContinue; } else { this.isAction = this.isContinue = !0; - var b = this; + var a = this; Ntry.dispatchEvent("unitAction", Ntry.STATIC.WALK, function() { - b.isAction = !1; + a.isAction = !1; }); return Entry.STATIC.CONTINUE; } @@ -15229,9 +16649,9 @@ Entry.block.maze_step_rotate_left = {skeleton:"basic", mode:"maze", color:"#A751 delete this.isContinue; } else { this.isAction = this.isContinue = !0; - var b = this; + var a = this; Ntry.dispatchEvent("unitAction", Ntry.STATIC.TURN_LEFT, function() { - b.isAction = !1; + a.isAction = !1; }); return Entry.STATIC.CONTINUE; } @@ -15245,9 +16665,9 @@ Entry.block.maze_step_rotate_right = {skeleton:"basic", mode:"maze", color:"#A75 delete this.isContinue; } else { this.isAction = this.isContinue = !0; - var b = this; + var a = this; Ntry.dispatchEvent("unitAction", Ntry.STATIC.TURN_RIGHT, function() { - b.isAction = !1; + a.isAction = !1; }); return Entry.STATIC.CONTINUE; } @@ -15256,2635 +16676,1972 @@ Entry.block.test_wrapper = {skeleton:"basic", mode:"maze", color:"#3BBD70", temp }}; Entry.block.basic_button = {skeleton:"basic_button", color:"#eee", template:"%1", params:[{type:"Text", text:"basic button", color:"#333", align:"center"}], func:function() { }}; -Entry.BlockMenu = function(b, a, c, d) { - Entry.Model(this, !1); - this._align = a || "CENTER"; - this._scroll = void 0 !== d ? d : !1; - this._bannedClass = []; - this._categories = []; - this.suffix = "blockMenu"; - b = "string" === typeof b ? $("#" + b) : $(b); - if ("DIV" !== b.prop("tagName")) { - return console.error("Dom is not div element"); - } - this.view = b; - this.visible = !0; - this._svgId = "blockMenu" + (new Date).getTime(); - this._clearCategory(); - this._categoryData = c; - this._generateView(c); - this._splitters = []; - this.setWidth(); - this.svg = Entry.SVG(this._svgId); - Entry.Utils.addFilters(this.svg, this.suffix); - a = Entry.Utils.addBlockPattern(this.svg, this.suffix); - this.patternRect = a.rect; - this.pattern = a.pattern; - this.svgGroup = this.svg.elem("g"); - this.svgThreadGroup = this.svgGroup.elem("g"); - this.svgThreadGroup.board = this; - this.svgBlockGroup = this.svgGroup.elem("g"); - this.svgBlockGroup.board = this; +Entry.Thread = function(a, b, c) { + this._data = new Entry.Collection; + this._code = b; this.changeEvent = new Entry.Event(this); - c && this._generateCategoryCodes(c); - this.observe(this, "_handleDragBlock", ["dragBlock"]); - this._scroll && (this._scroller = new Entry.BlockMenuScroller(this), this._addControl(b)); - Entry.documentMousedown && Entry.documentMousedown.attach(this, this.setSelectedBlock); - this._categoryCodes && Entry.keyPressed && Entry.keyPressed.attach(this, this._captureKeyEvent); - Entry.windowResized && (b = _.debounce(this.updateOffset, 200), Entry.windowResized.attach(this, b)); -}; -(function(b) { - b.schema = {code:null, dragBlock:null, closeBlock:null, selectedBlockView:null}; - b._generateView = function(a) { - var b = this.view, d = this; - a && (this._categoryCol = Entry.Dom("ul", {class:"entryCategoryListWorkspace", parent:b}), this._generateCategoryView(a)); - this.blockMenuContainer = Entry.Dom("div", {"class":"blockMenuContainer", parent:b}); - this.svgDom = Entry.Dom($(''), {parent:this.blockMenuContainer}); - this.svgDom.mouseenter(function(a) { - d._scroller && d._scroller.setOpacity(1); - a = d.workspace.selectedBlockView; - !Entry.playground || Entry.playground.resizing || a && a.dragMode === Entry.DRAG_MODE_DRAG || (Entry.playground.focusBlockMenu = !0, a = d.svgGroup.getBBox(), a = a.width + a.x + 64, a > Entry.interfaceState.menuWidth && (this.widthBackup = Entry.interfaceState.menuWidth - 64, $(this).stop().animate({width:a - 62}, 200))); - }); - this.svgDom.mouseleave(function(a) { - Entry.playground && !Entry.playground.resizing && (d._scroller && d._scroller.setOpacity(0), (a = this.widthBackup) && $(this).stop().animate({width:a}, 200), delete this.widthBackup, delete Entry.playground.focusBlockMenu); - }); - $(window).scroll(function() { - d.updateOffset(); - }); - }; - b.changeCode = function(a) { - if (!(a instanceof Entry.Code)) { - return console.error("You must inject code instance"); - } - this.codeListener && this.code.changeEvent.detach(this.codeListener); - var b = this; - this.set({code:a}); - this.codeListener = this.code.changeEvent.attach(this, function() { - b.changeEvent.notify(); - }); - a.createView(this); - this.align(); - }; - b.bindCodeView = function(a) { - this.svgBlockGroup.remove(); - this.svgThreadGroup.remove(); - this.svgBlockGroup = a.svgBlockGroup; - this.svgThreadGroup = a.svgThreadGroup; - this.svgGroup.appendChild(this.svgThreadGroup); - this.svgGroup.appendChild(this.svgBlockGroup); - this._scroller && this.svgGroup.appendChild(this._scroller.svgGroup); - }; - b.align = function(a) { - var b = this.code; - if (b) { - this._clearSplitters(); - b.view && !a && b.view.reDraw(); - a = b.getThreads(); - for (var b = 10, d = "LEFT" == this._align ? 10 : this.svgDom.width() / 2, e, f = 0, g = a.length;f < g;f++) { - var h = a[f].getFirstBlock(), k = h.view, h = Entry.block[h.type]; - this.checkBanClass(h) ? k.set({display:!1}) : (k.set({display:!0}), h = h.class, e && e !== h && (this._createSplitter(b), b += 15), e = h, h = d - k.offsetX, "CENTER" == this._align && (h -= k.width / 2), b -= k.offsetY, k._moveTo(h, b, !1), b += k.height + 15); - } - this.updateSplitters(); - this.changeEvent.notify(); - } - }; - b.cloneToGlobal = function(a) { - if (!this._boardBlockView && null !== this.dragBlock) { - var b = this.workspace, d = b.getMode(), e = this.dragBlock, f = this._svgWidth, g = b.selectedBoard; - if (!g || d != Entry.Workspace.MODE_BOARD && d != Entry.Workspace.MODE_OVERLAYBOARD) { - Entry.GlobalSvg.setView(e, b.getMode()) && Entry.GlobalSvg.addControl(a); - } else { - if (g.code && (b = e.block, d = b.getThread(), b && d)) { - b = d.toJSON(!0); - this._boardBlockView = Entry.do("addThread", b).value.getFirstBlock().view; - var g = this.offset().top - g.offset().top, h, k; - if (b = this.dragBlock.mouseDownCoordinate) { - h = a.pageX - b.x, k = a.pageY - b.y; - } - this._boardBlockView._moveTo(e.x - f + (h || 0), e.y + g + (k || 0), !1); - this._boardBlockView.onMouseDown.call(this._boardBlockView, a); - this._boardBlockView.dragInstance.set({isNew:!0}); - } - } - } - }; - b.terminateDrag = function() { - if (this._boardBlockView) { - var a = 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 b < a - d; - } + this.changeEvent.attach(this, this.handleChange); + this._event = null; + this.parent = c ? c : b; + this.load(a); +}; +(function(a) { + a.load = function(a, c) { + void 0 === a && (a = []); + if (!(a instanceof Array)) { + return console.error("thread must be array"); } - }; - b.getCode = function(a) { - return this._code; - }; - b.setSelectedBlock = function(a) { - var b = this.selectedBlockView; - b && b.removeSelected(); - a instanceof Entry.BlockView ? a.addSelected() : a = null; - this.set({selectedBlockView:a}); - }; - b.hide = function() { - this.view.addClass("entryRemove"); - }; - b.show = function() { - this.view.removeClass("entryRemove"); - }; - b.renderText = function() { - for (var a = this.code.getThreads(), b = 0;b < a.length;b++) { - a[b].view.renderText(); + for (var d = 0;d < a.length;d++) { + var e = a[d]; + e instanceof Entry.Block || e.isDummy ? (e.setThread(this), this._data.push(e)) : this._data.push(new Entry.Block(e, this)); } + (a = this._code.view) && this.createView(a.board, c); }; - b.renderBlock = function() { - for (var a = this.code.getThreads(), b = 0;b < a.length;b++) { - a[b].view.renderBlock(); - } + a.registerEvent = function(a, c) { + this._event = c; + this._code.registerEvent(a, c); }; - b._createSplitter = function(a) { - a = this.svgBlockGroup.elem("line", {x1:20, y1:a, x2:this._svgWidth - 20, y2:a, stroke:"#b5b5b5"}); - this._splitters.push(a); + a.unregisterEvent = function(a, c) { + this._code.unregisterEvent(a, c); }; - b.updateSplitters = function(a) { - a = void 0 === a ? 0 : a; - var b = this._svgWidth - 20, d; - this._splitters.forEach(function(e) { - d = parseFloat(e.getAttribute("y1")) + a; - e.attr({x2:b, y1:d, y2:d}); + a.createView = function(a, c) { + this.view || (this.view = new Entry.ThreadView(this, a)); + this._data.map(function(d) { + d.createView(a, c); }); }; - b._clearSplitters = function() { - for (var a = this._splitters, b = a.length - 1;0 <= b;b--) { - a[b].remove(), a.pop(); - } - }; - b.setWidth = function() { - this._svgWidth = this.blockMenuContainer.width(); - this.updateSplitters(); - }; - b.setMenu = function() { - var a = this._categoryCodes, b = this._categoryElems, d; - for (d in a) { - for (var e = a[d], e = e instanceof Entry.Code ? e.getThreads() : e, f = e.length, g = 0;g < e.length;g++) { - var h = e[g], h = h instanceof Entry.Thread ? h.getFirstBlock().type : h[0].type; - this.checkBanClass(Entry.block[h]) && f--; - } - 0 === f ? b[d].addClass("entryRemove") : b[d].removeClass("entryRemove"); - } - }; - b.getCategoryCodes = function(a) { - a = this._convertSelector(a); - var b = this._categoryCodes[a]; - b || (this._generateCategoryElement(a), b = []); - b instanceof Entry.Code || (b = this._categoryCodes[a] = new Entry.Code(b)); - return b; - }; - b._convertSelector = function(a) { - if (isNaN(a)) { - return a; - } - a = Number(a); - for (var b = this._categories, d = this._categoryElems, e = 0;e < b.length;e++) { - var f = b[e]; - if (!d[f].hasClass("entryRemove") && 0 === a--) { - return f; - } - } - }; - b.selectMenu = function(a, b) { - var d = this._convertSelector(a); - if (d) { - "variable" == d && Entry.playground.checkVariables(); - "arduino" == d && this._generateHwCode(); - var e = this._categoryElems[d], f = this._selectedCategoryView, g = !1, h = this.workspace.board, k = h.view; - f && f.removeClass("entrySelectedCategory"); - e != f || b ? f || (this.visible || (g = !0, k.addClass("foldOut"), Entry.playground.showTabs()), k.removeClass("folding"), this.visible = !0) : (k.addClass("folding"), this._selectedCategoryView = null, e.removeClass("entrySelectedCategory"), Entry.playground.hideTabs(), g = !0, this.visible = !1); - g && Entry.bindAnimationCallbackOnce(k, function() { - h.scroller.resizeScrollBar.call(h.scroller); - k.removeClass("foldOut"); - Entry.windowResized.notify(); - }); - this.visible && (f = this._categoryCodes[d], this._selectedCategoryView = e, e.addClass("entrySelectedCategory"), f.constructor !== Entry.Code && (f = this._categoryCodes[d] = new Entry.Code(f)), this.changeCode(f)); - this.lastSelector = d; - } - }; - b._generateCategoryCodes = function(a) { - this._categoryCodes = {}; - for (var b = 0;b < a.length;b++) { - var d = a[b], e = []; - d.blocks.forEach(function(a) { - var b = Entry.block[a]; - if (b && b.def) { - if (b.defs) { - for (a = 0;a < b.defs.length;a++) { - e.push([b.defs[a]]); - } - } else { - e.push([b.def]); - } - } else { - e.push([{type:a}]); - } - }); - d = d.category; - this._categories.push(d); - this._categoryCodes[d] = e; - } - }; - b.banClass = function(a, b) { - 0 > this._bannedClass.indexOf(a) && this._bannedClass.push(a); - this.align(b); + a.separate = function(a, c) { + this._data.has(a.id) && (a = this._data.splice(this._data.indexOf(a), c), this._code.createThread(a), this.changeEvent.notify()); }; - b.unbanClass = function(a, b) { - var d = this._bannedClass.indexOf(a); - -1 < d && this._bannedClass.splice(d, 1); - this.align(b); + a.cut = function(a) { + a = this._data.indexOf(a); + a = this._data.splice(a); + this.changeEvent.notify(); + return a; }; - b.checkBanClass = function(a) { - if (a) { - a = a.isNotFor; - for (var b in this._bannedClass) { - if (a && -1 < a.indexOf(this._bannedClass[b])) { - return !0; - } - } - return !1; + a.insertByBlock = function(a, c) { + a = a ? this._data.indexOf(a) : -1; + for (var d = 0;d < c.length;d++) { + c[d].setThread(this); } + this._data.splice.apply(this._data, [a + 1, 0].concat(c)); + this.changeEvent.notify(); }; - b._addControl = function(a) { - var b = this; - a.on("wheel", function() { - b._mouseWheel.apply(b, arguments); - }); - }; - b._mouseWheel = function(a) { - a = a.originalEvent; - a.preventDefault(); - var b = Entry.disposeEvent; - b && b.notify(a); - this._scroller.scroll(-a.wheelDeltaY || a.deltaY / 3); - }; - b.dominate = function(a) { - this.svgBlockGroup.appendChild(a.view.svgGroup); - }; - b.reDraw = function() { - this.selectMenu(this.lastSelector, !0); - }; - b._handleDragBlock = function() { - this._boardBlockView = null; - this._scroller && this._scroller.setOpacity(0); - }; - b._captureKeyEvent = function(a) { - var b = a.keyCode, d = Entry.type; - a.ctrlKey && "workspace" == d && 48 < b && 58 > b && (a.preventDefault(), this.selectMenu(b - 49)); - }; - b.setPatternRectFill = function(a) { - this.patternRect.attr({fill:a}); - this.pattern.attr({style:""}); - }; - b.disablePattern = function() { - this.pattern.attr({style:"display: none"}); + a.insertToTop = function(a) { + a.setThread(this); + this._data.unshift.apply(this._data, [a]); + this.changeEvent.notify(); }; - b._clearCategory = function() { - this._selectedCategoryView = null; - this._categories = []; - var a = this._categoryElems, b; - for (b in a) { - a[b].remove(); - } - this._categoryElems = {}; - a = this._categoryCodes; - for (b in a) { - var d = a[b]; - d.constructor == Entry.Code && d.clear(); + a.clone = function(a, c) { + a = a || this._code; + a = new Entry.Thread([], a); + for (var d = this._data, e = [], f = 0, g = d.length;f < g;f++) { + e.push(d[f].clone(a)); } - this._categoryCodes = null; - }; - b.setCategoryData = function(a) { - this._clearCategory(); - this._categoryData = a; - this._generateCategoryView(a); - this._generateCategoryCodes(a); - }; - b._generateCategoryView = function(a) { - if (a) { - for (var b = 0;b < a.length;b++) { - this._generateCategoryElement(a[b].category); - } + a.load(e, c); + return a; + }; + a.toJSON = function(a, c) { + var d = []; + for (c = void 0 === c ? 0 : c;c < this._data.length;c++) { + this._data[c] instanceof Entry.Block && d.push(this._data[c].toJSON(a)); } + return d; }; - b._generateCategoryElement = function(a) { - var b = this; - (function(a, e) { - a.text(Lang.Blocks[e.toUpperCase()]); - b._categoryElems[e] = a; - a.bindOnClick(function(a) { - b.selectMenu(e); - }); - })(Entry.Dom("li", {id:"entryCategory" + a, class:"entryCategoryElementWorkspace", parent:this._categoryCol}), a); + a.destroy = function(a) { + this._code.destroyThread(this, !1); + this.view && this.view.destroy(a); + for (var c = this._data, d = c.length - 1;0 <= d;d--) { + c[d].destroy(a); + } }; - b.updateOffset = function() { - this._offset = this.svgDom.offset(); + a.getBlock = function(a) { + return this._data[a]; }; - b.offset = function() { - (!this._offset || 0 === this._offset.top && 0 === this._offset.left) && this.updateOffset(); - return this._offset; + a.getBlocks = function() { + return this._data.map(function(a) { + return a; + }); }; - b._generateHwCode = function() { - var a = this._categoryCodes.arduino; - a instanceof Entry.Code && a.clear(); - for (var b = this._categoryData, d, a = b.length - 1;0 <= a;a--) { - if ("arduino" === b[a].category) { - d = b[a].blocks; - break; - } - } - b = []; - for (a = 0;a < d.length;a++) { - var e = d[a], f = Entry.block[e]; - if (!this.checkBanClass(f)) { - if (f && f.def) { - if (f.defs) { - for (a = 0;a < f.defs.length;a++) { - b.push([f.defs[a]]); - } - } else { - b.push([f.def]); - } - } else { - b.push([{type:e}]); + a.countBlock = function() { + for (var a = 0, c = 0;c < this._data.length;c++) { + var d = this._data[c]; + if (d.type && (a++, d = d.statements)) { + for (var e = 0;e < d.length;e++) { + a += d[e].countBlock(); } } } - this._categoryCodes.arduino = b; - }; -})(Entry.BlockMenu.prototype); -Entry.BlockMenuScroller = function(b) { - var a = this; - this.board = b; - this.board.changeEvent.attach(this, this._reset); - this.svgGroup = null; - this.vRatio = this.vY = this.vWidth = this.hX = 0; - this._visible = !0; - this._opacity = -1; - this.mouseHandler = function() { - a.onMouseDown.apply(a, arguments); - }; - this.createScrollBar(); - this.setOpacity(0); - this._addControl(); - Entry.windowResized && Entry.windowResized.attach(this, this.resizeScrollBar); -}; -Entry.BlockMenuScroller.RADIUS = 7; -(function(b) { - b.createScrollBar = function() { - this.svgGroup = this.board.svgGroup.elem("g", {class:"boardScrollbar"}); - this.vScrollbar = this.svgGroup.elem("rect", {rx:4, ry:4}); - this.resizeScrollBar(); + return a; }; - b.resizeScrollBar = function() { - this._updateRatio(); - if (this._visible && 0 !== this.vRatio) { - var a = this.board.blockMenuContainer; - this.vScrollbar.attr({width:9, height:a.height() / this.vRatio, x:a.width() - 9}); - } + a.handleChange = function() { + 0 === this._data.length && this.destroy(); }; - b.updateScrollBar = function(a) { - this.vY += a; - this.vScrollbar.attr({y:this.vY}); + a.getCode = function() { + return this._code; }; - b.scroll = function(a) { - this.isVisible() && (a = this._adjustValue(a) - this.vY, 0 !== a && (this.board.code.moveBy(0, -a * this.vRatio), this.updateScrollBar(a))); + a.setCode = function(a) { + this._code = a; }; - b._adjustValue = function(a) { - var b = this.board.svgDom.height(), b = b - b / this.vRatio; - a = this.vY + a; - a = Math.max(0, a); - return a = Math.min(b, a); + a.spliceBlock = function(a) { + var c = this._data; + c.remove(a); + 0 === c.length && this.view.getParent().constructor !== Entry.FieldStatement && this.destroy(); + this.changeEvent.notify(); }; - b.setVisible = function(a) { - a != this.isVisible() && (this._visible = a, this.svgGroup.attr({display:!0 === a ? "block" : "none"})); + a.getFirstBlock = function() { + return this._data[0]; }; - b.setOpacity = function(a) { - this._opacity != a && (this.vScrollbar.attr({opacity:a}), this._opacity = a); + a.getPrevBlock = function(a) { + a = this._data.indexOf(a); + return this._data.at(a - 1); }; - b.isVisible = function() { - return this._visible; + a.getNextBlock = function(a) { + a = this._data.indexOf(a); + return this._data.at(a + 1); }; - b._updateRatio = function() { - var a = this.board, b = a.svgBlockGroup.getBoundingClientRect(), d = a.blockMenuContainer.height(), a = a.offset(); - this.vRatio = b = (b.height + (b.top - a.top) + 10) / d; - 1 >= b ? this.setVisible(!1) : this.setVisible(!0); + a.getLastBlock = function() { + return this._data.at(this._data.length - 1); }; - b._reset = function() { - this.vY = 0; - this.vScrollbar.attr({y:this.vY}); - this.resizeScrollBar(); + a.getRootBlock = function() { + return this._data.at(0); }; - b.onMouseDown = function(a) { - function b(a) { - a.stopPropagation && a.stopPropagation(); - a.preventDefault && a.preventDefault(); - a = a.originalEvent && a.originalEvent.touches ? a.originalEvent.touches[0] : a; - var c = e.dragInstance; - e.scroll(a.pageY - c.offsetY); - c.set({offsetY:a.pageY}); + a.hasBlockType = function(a) { + function c(d) { + if (a == d.type) { + return !0; + } + for (var f = d.params, g = 0;g < f.length;g++) { + var h = f[g]; + if (h && h.constructor == Entry.Block && c(h)) { + return !0; + } + } + if (d = d.statements) { + for (f = 0;f < d.length;f++) { + if (d[f].hasBlockType(a)) { + return !0; + } + } + } + return !1; } - function d(a) { - $(document).unbind(".scroll"); - delete e.dragInstance; + for (var d = 0;d < this._data.length;d++) { + if (c(this._data[d])) { + return !0; + } } - var e = this; - a.stopPropagation && a.stopPropagation(); - a.preventDefault && a.preventDefault(); - if (0 === a.button || a.originalEvent && a.originalEvent.touches) { - Entry.documentMousedown && Entry.documentMousedown.notify(a); - var f; - f = a.originalEvent && a.originalEvent.touches ? a.originalEvent.touches[0] : a; - var g = $(document); - g.bind("mousemove.scroll", b); - g.bind("mouseup.scroll", d); - g.bind("touchmove.scroll", b); - g.bind("touchend.scroll", d); - e.dragInstance = new Entry.DragInstance({startY:f.pageY, offsetY:f.pageY}); + return !1; + }; + a.getCount = function(a) { + var c = this._data.length; + a && (c -= this._data.indexOf(a)); + return c; + }; + a.indexOf = function(a) { + return this._data.indexOf(a); + }; + a.pointer = function(a, c) { + c = this.indexOf(c); + a.unshift(c); + this.parent instanceof Entry.Block && a.unshift(this.parent.indexOfStatements(this)); + return this._code === this.parent ? (a.unshift(this._code.indexOf(this)), c = this._data[0], a.unshift(c.y), a.unshift(c.x), a) : this.parent.pointer(a); + }; + a.getBlockList = function(a) { + for (var c = [], d = 0;d < this._data.length;d++) { + c = c.concat(this._data[d].getBlockList(a)); } - a.stopPropagation(); + return c; }; - b._addControl = function() { - $(this.vScrollbar).bind("mousedown touchstart", this.mouseHandler); + a.stringify = function() { + return JSON.stringify(this.toJSON()); }; -})(Entry.BlockMenuScroller.prototype); -Entry.BlockView = function(b, a, c) { +})(Entry.Thread.prototype); +Entry.skeleton = function() { +}; +Entry.skeleton.basic = {path:function(a) { + var b = a.contentWidth; + a = a.contentHeight; + a = Math.max(30, a + 2); + b = Math.max(0, b + 9 - a / 2); + return "m -8,0 l 8,8 8,-8 h %w a %h,%h 0 0,1 0,%wh h -%w l -8,8 -8,-8 v -%wh z".replace(/%wh/gi, a).replace(/%w/gi, b).replace(/%h/gi, a / 2); +}, box:function(a) { + return {offsetX:-8, offsetY:0, width:(a ? a.contentWidth : 150) + 30, height:Math.max(30, (a ? a.contentHeight : 28) + 2), marginBottom:0}; +}, magnets:function(a) { + return {previous:{x:0, y:0}, next:{x:0, y:(a ? Math.max(a.height, 30) : 30) + 1 + a.offsetY}}; +}, contentPos:function(a) { + return {x:14, y:Math.max(a.contentHeight, 28) / 2 + 1}; +}}; +Entry.skeleton.basic_create = {path:function(a) { + var b = a.contentWidth; + a = a.contentHeight; + a = Math.max(30, a + 2); + b = Math.max(0, b + 9 - a / 2); + return "m -8,0 l 16,0 h %w a %h,%h 0 0,1 0,%wh h -%w l -8,8 -8,-8 v -%wh z".replace(/%wh/gi, a).replace(/%w/gi, b).replace(/%h/gi, a / 2); +}, box:function(a) { + return {offsetX:-8, offsetY:0, width:(a ? a.contentWidth : 150) + 30, height:Math.max(30, (a ? a.contentHeight : 28) + 2), marginBottom:0}; +}, magnets:function(a) { + return {next:{x:0, y:(a ? Math.max(a.height, 30) : 30) + 1 + a.offsetY}}; +}, contentPos:function(a) { + return {x:14, y:Math.max(a.contentHeight, 28) / 2 + 1}; +}}; +Entry.skeleton.basic_event = {path:function(a) { + a = a.contentWidth; + a = Math.max(0, a); + return "m -8,0 m 0,-5 a 19.5,19.5 0, 0,1 16,0 c 10,5 15,5 20,5 h %w a 15,15 0 0,1 0,30 H 8 l -8,8 -8,-8 l 0,0.5 a 19.5,19.5 0, 0,1 0,-35 z".replace(/%w/gi, a - 30); +}, box:function(a) { + return {offsetX:-19, offsetY:-7, width:a.contentWidth + 30, height:30, marginBottom:0}; +}, magnets:function(a) { + return {next:{x:0, y:(a ? Math.max(a.height + a.offsetY + 7, 30) : 30) + 1}}; +}, contentPos:function(a) { + return {x:1, y:15}; +}}; +Entry.skeleton.basic_loop = {path:function(a) { + var b = a.contentWidth, c = a.contentHeight, c = Math.max(30, c + 2), b = Math.max(0, b + 9 - c / 2); + a = a._statements[0] ? a._statements[0].height : 20; + a = Math.max(a, 20); + return "m -8,0 l 8,8 8,-8 h %w a %h,%h 0 0,1 0,%wh H 24 l -8,8 -8,-8 h -0.4 v %sh h 0.4 l 8,8 8,-8 h %bw a 8,8 0 0,1 0,16 H 8 l -8,8 -8,-8 z".replace(/%wh/gi, c).replace(/%w/gi, b).replace(/%bw/gi, b - 8).replace(/%h/gi, c / 2).replace(/%sh/gi, a + 1); +}, magnets:function(a) { + var b = Math.max(a.contentHeight + 2, 30), c = a._statements[0] ? a._statements[0].height : 20, c = Math.max(c, 20); + return {previous:{x:0, y:0}, next:{x:0, y:c + b + 18 + a.offsetY}}; +}, box:function(a) { + var b = a.contentWidth, c = Math.max(a.contentHeight + 2, 30); + a = a._statements[0] ? a._statements[0].height : 20; + a = Math.max(a, 20); + return {offsetX:-8, offsetY:0, width:b + 30, height:c + a + 17, marginBottom:0}; +}, statementPos:function(a) { + return [{x:16, y:Math.max(30, a.contentHeight + 2) + 1}]; +}, contentPos:function(a) { + return {x:14, y:Math.max(a.contentHeight, 28) / 2 + 1}; +}}; +Entry.skeleton.basic_define = {path:function(a) { + var b = a.contentWidth, c = a.contentHeight, c = Math.max(30, c + 2), b = Math.max(0, b + 9 - c / 2); + a = a._statements[0] ? a._statements[0].height : 30; + a = Math.max(a, 20); + return "m -8,0 l 16,0 h %w a %h,%h 0 0,1 0,%wh H 24 l -8,8 -8,-8 h -0.4 v %sh h 0.4 l 8,8 8,-8 h %bw a 8,8 0 0,1 0,16 H -8 z".replace(/%wh/gi, c).replace(/%w/gi, b).replace(/%h/gi, c / 2).replace(/%bw/gi, b - 8).replace(/%sh/gi, a + 1); +}, magnets:function() { + return {}; +}, box:function(a) { + return {offsetX:0, offsetY:0, width:a.contentWidth, height:Math.max(a.contentHeight, 25) + 46, marginBottom:0}; +}, statementPos:function(a) { + return [{x:16, y:Math.max(30, a.contentHeight + 2)}]; +}, contentPos:function() { + return {x:14, y:15}; +}}; +Entry.skeleton.pebble_event = {path:function(a) { + return "m 0,0 a 25,25 0 0,1 9,48.3 a 9,9 0 0,1 -18,0 a 25,25 0 0,1 9,-48.3 z"; +}, box:function(a) { + return {offsetX:-25, offsetY:0, width:50, height:48.3, marginBottom:0}; +}, magnets:function(a) { + return {next:{x:0, y:(a ? Math.max(a.height, 49.3) : 49.3) + a.offsetY}}; +}, contentPos:function() { + return {x:0, y:25}; +}}; +Entry.skeleton.pebble_loop = {fontSize:16, dropdownHeight:23, path:function(a) { + a = Math.max(a._statements[0] ? a._statements[0].height : 50, 50); + return "M 0,9 a 9,9 0 0,0 9,-9 h %cw q 25,0 25,25 v %ch q 0,25 -25,25 h -%cw a 9,9 0 0,1 -18,0 h -%cw q -25,0 -25,-25 v -%ch q 0,-25 25,-25 h %cw a 9,9 0 0,0 9,9 M 0,49 a 9,9 0 0,1 -9,-9 h -28 a 25,25 0 0,0 -25,25 v %cih a 25,25 0 0,0 25,25 h 28 a 9,9 0 0,0 18,0 h 28 a 25,25 0 0,0 25,-25 v -%cih a 25,25 0 0,0 -25,-25 h -28 a 9,9 0 0,1 -9,9 z".replace(/%cw/gi, 41).replace(/%ch/gi, a + 4).replace(/%cih/gi, a - 50); +}, magnets:function(a) { + var b = Math.max(a.contentHeight + 2, 41), c = a._statements[0] ? a._statements[0].height : 20, c = Math.max(c, 51); + return {previous:{x:0, y:0}, next:{x:0, y:c + b + 13 + a.offsetY}}; +}, box:function(a) { + var b = a.contentWidth, c = Math.max(a.contentHeight + 2, 41); + a = a._statements[0] ? a._statements[0].height : 20; + a = Math.max(a, 51); + return {offsetX:-(b / 2 + 13), offsetY:0, width:b + 30, height:c + a + 13, marginBottom:0}; +}, statementPos:function(a) { + return [{x:0, y:Math.max(39, a.contentHeight + 2) + 1.5}]; +}, contentPos:function() { + return {x:-46, y:25}; +}}; +Entry.skeleton.pebble_basic = {fontSize:15, morph:["prev", "next"], path:function(a) { + return "m 0,9 a 9,9 0 0,0 9,-9 h 28 q 25,0 25,25q 0,25 -25,25h -28 a 9,9 0 0,1 -18,0 h -28 q -25,0 -25,-25q 0,-25 25,-25h 28 a 9,9 0 0,0 9,9 z"; +}, magnets:function(a) { + return {previous:{x:0, y:0}, next:{x:0, y:(a ? Math.max(a.height, 51) : 51) + a.offsetY}}; +}, box:function() { + return {offsetX:-62, offsetY:0, width:124, height:50, marginBottom:0}; +}, contentPos:function() { + return {x:-46, y:25}; +}}; +Entry.skeleton.basic_string_field = {path:function(a) { + var b = a.contentWidth; + a = a.contentHeight; + a = Math.max(18, a + 2); + b = Math.max(0, b - a + 12); + return "m %h,0 h %w a %h,%h 0 1,1 0,%wh H %h A %h,%h 0 1,1 %h,0 z".replace(/%wh/gi, a).replace(/%w/gi, b).replace(/%h/gi, a / 2); +}, color:"#000", outerLine:"#768dce", box:function(a) { + return {offsetX:0, offsetY:0, width:(a ? a.contentWidth : 5) + 12, height:Math.max((a ? a.contentHeight : 18) + 2, 18), marginBottom:0}; +}, magnets:function() { + return {string:{}}; +}, contentPos:function(a) { + return {x:6, y:Math.max(a.contentHeight, 16) / 2 + 1}; +}}; +Entry.skeleton.basic_boolean_field = {path:function(a) { + var b = a.contentWidth; + a = a.contentHeight; + a = Math.max(18, a + 2); + b = Math.max(0, b - a + 19); + return "m %h,0 h %w l %h,%h -%h,%h H %h l -%h,-%h %h,-%h z".replace(/%wh/gi, a).replace(/%w/gi, b).replace(/%h/gi, a / 2); +}, color:"#000", outerLine:"#768dce", box:function(a) { + return {offsetX:0, offsetY:0, width:(a ? a.contentWidth : 5) + 19, height:Math.max((a ? a.contentHeight : 18) + 2, 18), marginBottom:0}; +}, magnets:function() { + return {boolean:{}}; +}, contentPos:function(a) { + return {x:10, y:Math.max(a.contentHeight, 16) / 2 + 1}; +}}; +Entry.skeleton.basic_param = {path:function(a) { + var b = a.contentWidth; + (a = a._contents[a._contents.length - 1]) && (b -= a.box.width + Entry.BlockView.PARAM_SPACE - 2); + b = Math.max(0, b); + return "m 4,0 h 10 h %w l 2,2 0,3 3,0 1,1 0,12 -1,1 -3,0 0,3 -2,2h -%w h -10 l -2,-2 0,-3 3,0 1,-1 0,-12 -1,-1 -3,0 0,-3 2,-2".replace(/%w/gi, b); +}, outerLine:"#768dce", box:function(a) { + return {offsetX:0, offsetY:0, width:(a ? a.contentWidth : 5) + 11, height:24, marginBottom:0}; +}, magnets:function() { + return {param:{}}; +}, contentPos:function(a) { + return {x:11, y:12}; +}}; +Entry.skeleton.basic_button = {path:function() { + return "m -64,0 h 128 a 6,6 0, 0,1 6,6 v 18 a 6,6 0, 0,1 -6,6 h -128 a 6,6 0, 0,1 -6,-6 v -18 a 6,6 0, 0,1 6,-6 z"; +}, box:function() { + return {offsetX:-80, offsetY:0, width:140, height:30}; +}, contentPos:function() { + return {x:0, y:15}; +}, movable:!1, readOnly:!0, nextShadow:!0, classes:["basicButtonView"]}; +Entry.skeleton.basic_without_next = {box:Entry.skeleton.basic.box, contentPos:Entry.skeleton.basic.contentPos, path:function(a) { + var b = a.contentWidth; + a = a.contentHeight; + a = Math.max(30, a + 2); + b = Math.max(0, b + 9 - a / 2); + return "m -8,0 l 8,8 8,-8 h %w a %h,%h 0 0,1 0, %wh H -8 z".replace(/%wh/gi, a).replace(/%w/gi, b).replace(/%h/gi, a / 2); +}, magnets:function(a) { + return {previous:{x:0, y:0}}; +}}; +Entry.skeleton.basic_double_loop = {path:function(a) { + var b = a.contentWidth, c = a.contentHeight % 1E3, d = Math.floor(a.contentHeight / 1E3), c = Math.max(30, c + 2), d = Math.max(30, d + 2), b = Math.max(0, b + 5 - c / 2), e = a._statements; + a = e[0] ? e[0].height : 20; + e = e[1] ? e[1].height : 20; + a = Math.max(a, 20); + e = Math.max(e, 20); + return "m -8,0 l 8,8 8,-8 h %w a %h1,%h1 0 0,1 0,%wh1 H 24 l -8,8 -8,-8 h -0.4 v %sh1 h 0.4 l 8,8 8,-8 h %bw a %h2,%h2 0 0,1 0,%wh2 H 24 l -8,8 -8,-8 h -0.4 v %sh2 h 0.4 l 8,8 8,-8 h %bw a 8,8 0 0,1 0,16 H 8 l -8,8 -8,-8 z".replace(/%wh1/gi, c).replace(/%wh2/gi, d).replace(/%w/gi, b).replace(/%bw/gi, b - 8).replace(/%h1/gi, c / 2).replace(/%h2/gi, d / 2).replace(/%sh1/gi, a + 1).replace(/%sh2/gi, e + 1); +}, magnets:function(a) { + var b = Math.max(a.contentHeight % 1E3 + 2, 30), c = Math.max(Math.floor(a.contentHeight / 1E3) + 2, 30), d = a._statements[0] ? a._statements[0].height : 20, e = a._statements[1] ? a._statements[1].height : 20, d = Math.max(d, 20), e = Math.max(e, 20); + return {previous:{x:0, y:0}, next:{x:0, y:d + e + b + c + 19 + a.offsetY}}; +}, box:function(a) { + var b = a.contentWidth, c = Math.max(Math.floor(a.contentHeight / 1E3) + 2, 30), d = Math.max(a.contentHeight % 1E3 + 2, 30), e = a._statements[0] ? a._statements[0].height % 1E3 : 20; + a = a._statements[1] ? a._statements[1].height : 20; + e = Math.max(e, 20); + a = Math.max(a, 20); + return {offsetX:-8, offsetY:0, width:b + 30, height:c + d + e + a + 17, marginBottom:0}; +}, statementPos:function(a) { + var b = Math.max(30, a.contentHeight % 1E3 + 2) + 1; + return [{x:16, y:b}, {x:16, y:b + Math.max(a._statements[0] ? a._statements[0].height % 1E3 : 20, 20) + Math.max(Math.floor(a.contentHeight / 1E3) + 2, 30) + 1}]; +}, contentPos:function(a) { + return {x:14, y:Math.max(a.contentHeight % 1E3, 28) / 2 + 1}; +}}; +Entry.Block = function(a, b) { + var c = this; Entry.Model(this, !1); - this.block = b; - this._lazyUpdatePos = _.debounce(b._updatePos.bind(b), 200); - this._board = a; - this._observers = []; - this.set(b); - this.svgGroup = a.svgBlockGroup.elem("g"); - this._schema = Entry.block[b.type]; - this._schema.changeEvent && (this._schemaChangeEvent = this._schema.changeEvent.attach(this, this._updateSchema)); - var d = this._skeleton = Entry.skeleton[this._schema.skeleton]; - this._contents = []; - this._statements = []; - this.magnet = {}; - this._paramMap = {}; - d.magnets && d.magnets(this).next && (this.svgGroup.nextMagnet = this.block, this._nextGroup = this.svgGroup.elem("g"), this._observers.push(this.observe(this, "_updateMagnet", ["contentHeight"]))); - this.isInBlockMenu = this.getBoard() instanceof Entry.BlockMenu; - var e = this; - this.mouseHandler = function() { - var a = e.block.events; - a && a.mousedown && a.mousedown.forEach(function(a) { - a(e); - }); - e.onMouseDown.apply(e, arguments); - }; - this._startRender(b, c); - this._observers.push(this.block.observe(this, "_setMovable", ["movable"])); - this._observers.push(this.block.observe(this, "_setReadOnly", ["movable"])); - this._observers.push(this.block.observe(this, "_setCopyable", ["copyable"])); - this._observers.push(this.block.observe(this, "_updateColor", ["deletable"], !1)); - this._observers.push(this.observe(this, "_updateBG", ["magneting"], !1)); - this._observers.push(this.observe(this, "_updateOpacity", ["visible"], !1)); - this._observers.push(this.observe(this, "_updateDisplay", ["display"], !1)); - this._observers.push(this.observe(this, "_updateShadow", ["shadow"])); - this._observers.push(this.observe(this, "_updateMagnet", ["offsetY"])); - this._observers.push(a.code.observe(this, "_setBoard", ["board"], !1)); - this.dragMode = Entry.DRAG_MODE_NONE; - Entry.Utils.disableContextmenu(this.svgGroup.node); - a = b.events.viewAdd; - "workspace" == Entry.type && a && !this.isInBlockMenu && a.forEach(function(a) { - Entry.Utils.isFunction(a) && a(b); + this._schema = null; + this.setThread(b); + this.load(a); + a = this.getCode(); + a.registerBlock(this); + (b = this.events.dataAdd) && a.object && b.forEach(function(a) { + Entry.Utils.isFunction(a) && a(c); }); }; -Entry.BlockView.PARAM_SPACE = 5; -Entry.BlockView.DRAG_RADIUS = 5; -Entry.BlockView.pngMap = {}; -(function(b) { - b.schema = {id:0, type:Entry.STATIC.BLOCK_RENDER_MODEL, x:0, y:0, offsetX:0, offsetY:0, width:0, height:0, contentWidth:0, contentHeight:0, magneting:!1, visible:!0, animating:!1, shadow:!0, display:!0}; - b._startRender = function(a, b) { - var d = this, e = this._skeleton; - this.svgGroup.attr({class:"block"}); - var f = e.classes; - f && 0 !== f.length && f.forEach(function(a) { - d.svgGroup.addClass(a); - }); - f = e.path(this); - this.pathGroup = this.svgGroup.elem("g"); - this._updateMagnet(); - this._path = this.pathGroup.elem("path"); - this.getBoard().patternRect && ($(this._path).mouseenter(function(a) { - d._mouseEnable && d._changeFill(!0); - }), $(this._path).mouseleave(function(a) { - d._mouseEnable && d._changeFill(!1); - })); - var g = this._schema.color; - this.block.deletable === Entry.Block.DELETABLE_FALSE_LIGHTEN && (g = Entry.Utils.colorLighten(g)); - this._fillColor = g; - f = {d:f, fill:g, class:"blockPath"}; - if (this.magnet.next || this._skeleton.nextShadow) { - g = this.getBoard().suffix, this.pathGroup.attr({filter:"url(#entryBlockShadowFilter_" + g + ")"}); - } else { - if (this.magnet.string || this.magnet.boolean) { - f.stroke = e.outerLine; - } - } - e.outerLine && (f["stroke-width"] = "0.6"); - this._path.attr(f); - this._moveTo(this.x, this.y, !1); - this._startContentRender(b); - !0 !== this._board.disableMouseEvent && this._addControl(); - this.bindPrev(); - }; - b._startContentRender = function(a) { - a = void 0 === a ? Entry.Workspace.MODE_BOARD : a; - this.contentSvgGroup && this.contentSvgGroup.remove(); - var b = this._schema; - b.statements && b.statements.length && this.statementSvgGroup && this.statementSvgGroup.remove(); - this._contents = []; - this.contentSvgGroup = this.svgGroup.elem("g"); - b.statements && b.statements.length && (this.statementSvgGroup = this.svgGroup.elem("g")); - switch(a) { - case Entry.Workspace.MODE_BOARD: - ; - case Entry.Workspace.MODE_OVERLAYBOARD: - for (var d = /(%\d)/mi, e = (b.template ? b.template : Lang.template[this.block.type]).split(d), f = b.params, g = 0;g < e.length;g++) { - 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); - this._contents.push(h); - this._paramMap[k] = h; - } else { - this._contents.push(new Entry.FieldText({text:h}, this)); - } +Entry.Block.MAGNET_RANGE = 10; +Entry.Block.MAGNET_OFFSET = .4; +Entry.Block.DELETABLE_TRUE = 1; +Entry.Block.DELETABLE_FALSE = 2; +Entry.Block.DELETABLE_FALSE_LIGHTEN = 3; +(function(a) { + a.schema = {id:null, x:0, y:0, type:null, params:[], statements:[], view:null, thread:null, movable:null, deletable:Entry.Block.DELETABLE_TRUE, readOnly:null, copyable:!0, events:{}}; + a.load = function(a) { + a.id || (a.id = Entry.Utils.generateId()); + this.set(a); + this.loadSchema(); + }; + a.changeSchema = function(a) { + this.set({params:[]}); + this.loadSchema(); + }; + a.getSchema = function() { + this._schema || this.loadSchema(); + return this._schema; + }; + a.loadSchema = function() { + if (this._schema = Entry.block[this.type]) { + !this._schemaChangeEvent && this._schema.changeEvent && (this._schemaChangeEvent = this._schema.changeEvent.attach(this, this.changeSchema)); + var a = this._schema.events; + if (a) { + for (var c in a) { + this.events[c] || (this.events[c] = []); + for (var d = a[c], e = 0;e < d.length;e++) { + var f = d[e]; + f && 0 > this.events[c].indexOf(f) && this.events[c].push(f); } } - if ((a = b.statements) && a.length) { - for (g = 0;g < a.length;g++) { - this._statements.push(new Entry.FieldStatement(a[g], this, g)); - } + } + this._schema.event && this.thread.registerEvent(this, this._schema.event); + a = this.params; + c = this._schema.params; + for (e = 0;c && e < c.length;e++) { + d = void 0 === a[e] || null === a[e] ? c[e].value : a[e], f = a[e] || e < a.length, !d || "Output" !== c[e].type && "Block" !== c[e].type || (d = new Entry.Block(d, this.thread)), f ? a.splice(e, 1, d) : a.push(d); + } + if (a = this._schema.statements) { + for (e = 0;e < a.length;e++) { + this.statements.splice(e, 1, new Entry.Thread(this.statements[e], this.getCode(), this)); } - break; - case Entry.Workspace.MODE_VIMBOARD: - g = this.getBoard().workspace.getCodeToText(this.block), this._contents.push(new Entry.FieldText({text:g, color:"white"}, this)); + } } - this.alignContent(!1); - }; - b._updateSchema = function() { - this._startContentRender(); }; - b.changeType = function(a) { + a.changeType = function(a) { this._schemaChangeEvent && this._schemaChangeEvent.destroy(); - this._schema = Entry.block[a]; - this._schema.changeEvent && (this._schemaChangeEvent = this._schema.changeEvent.attach(this, this._updateSchema)); - this._updateSchema(); - }; - b.alignContent = function(a) { - !0 !== a && (a = !1); - for (var b = 0, d = 0, e = 0, f = 0, g = 0, h = 0, k = 0;k < this._contents.length;k++) { - var l = this._contents[k]; - l instanceof Entry.FieldLineBreak ? (this._alignStatement(a, f), l.align(f), f++, d = l.box.y, b = 8) : (l.align(b, d, a), k === this._contents.length - 1 || l instanceof Entry.FieldText && 0 == l._text.length || (b += Entry.BlockView.PARAM_SPACE)); - l = l.box; - 0 !== f ? h = Math.max(1E3 * Math.round(l.height), h) : e = Math.max(l.height, e); - b += l.width; - g = Math.max(g, b); - this.set({contentWidth:g, contentHeight:e}); - } - this.set({contentHeight:e + h}); - this._statements.length != f && this._alignStatement(a, f); - a = this.getContentPos(); - this.contentSvgGroup.attr("transform", "translate(" + a.x + "," + a.y + ")"); - this.contentPos = a; - this._render(); - this._updateMagnet(); - }; - b._alignStatement = function(a, b) { - var d = this._skeleton.statementPos ? this._skeleton.statementPos(this) : [], e = this._statements[b]; - e && (d = d[b]) && e.align(d.x, d.y, a); + this.set({type:a}); + this.loadSchema(); + this.view && this.view.changeType(a); }; - b._render = function() { - this._renderPath(); - this.set(this._skeleton.box(this)); + a.setThread = function(a) { + this.set({thread:a}); }; - b._renderPath = function() { - var a = this._skeleton.path(this); - this._path.attr({d:a}); - this.set({animating:!1}); + a.getThread = function() { + return this.thread; }; - b._setPosition = function(a) { - this.svgGroup.attr("transform", "translate(" + this.x + "," + this.y + ")"); + a.insertAfter = function(a) { + this.thread.insertByBlock(this, a); }; - b._toLocalCoordinate = function(a) { - this._moveTo(0, 0, !1); - a.appendChild(this.svgGroup); + a._updatePos = function() { + this.view && this.set({x:this.view.x, y:this.view.y}); }; - b._toGlobalCoordinate = function(a) { - a = this.getAbsoluteCoordinate(a); - this._moveTo(a.x, a.y, !1); - this.getBoard().svgBlockGroup.appendChild(this.svgGroup); + a.moveTo = function(a, c) { + this.view && this.view._moveTo(a, c); + this._updatePos(); + this.getCode().changeEvent.notify(); }; - b._moveTo = function(a, b, d) { - this.set({x:a, y:b}); - this._lazyUpdatePos(); - this.visible && this.display && this._setPosition(d); + a.createView = function(a, c) { + this.view || (this.set({view:new Entry.BlockView(this, a, c)}), this._updatePos()); }; - b._moveBy = function(a, b, d) { - return this._moveTo(this.x + a, this.y + b, d); + a.clone = function(a) { + return new Entry.Block(this.toJSON(!0), a); }; - b._addControl = function() { - var a = this; - this._mouseEnable = !0; - $(this.svgGroup).bind("mousedown.blockViewMousedown touchstart.blockViewMousedown", a.mouseHandler); - var b = a.block.events; - b && b.dblclick && $(this.svgGroup).dblclick(function() { - b.dblclick.forEach(function(b) { - b && b(a); - }); + a.toJSON = function(a) { + var c = this._toJSON(); + delete c.view; + delete c.thread; + delete c.events; + a && delete c.id; + c.params = c.params.map(function(c) { + c instanceof Entry.Block && (c = c.toJSON(a)); + return c; }); + c.statements = c.statements.map(function(c) { + return c.toJSON(a); + }); + c.x = this.x; + c.y = this.y; + c.movable = this.movable; + c.deletable = this.deletable; + c.readOnly = this.readOnly; + return c; }; - b.removeControl = function() { - this._mouseEnable = !1; - $(this.svgGroup).unbind(".blockViewMousedown"); - }; - b.onMouseDown = function(a) { - function c(a) { - a.stopPropagation(); - var c = e.workspace.getMode(), d; - c === Entry.Workspace.MODE_VIMBOARD && b.vimBoardEvent(a, "dragOver"); - d = a.originalEvent && a.originalEvent.touches ? a.originalEvent.touches[0] : a; - var f = m.mouseDownCoordinate, f = Math.sqrt(Math.pow(d.pageX - f.x, 2) + Math.pow(d.pageY - f.y, 2)); - (m.dragMode == Entry.DRAG_MODE_DRAG || f > Entry.BlockView.DRAG_RADIUS) && m.movable && (m.isInBlockMenu ? e.cloneToGlobal(a) : (a = !1, m.dragMode != Entry.DRAG_MODE_DRAG && (m._toGlobalCoordinate(), m.dragMode = Entry.DRAG_MODE_DRAG, m.block.getThread().changeEvent.notify(), Entry.GlobalSvg.setView(m, c), a = !0), this.animating && this.set({animating:!1}), 0 === m.dragInstance.height && m.dragInstance.set({height:-1 + m.height}), c = m.dragInstance, m._moveBy(d.pageX - c.offsetX, d.pageY - - c.offsetY, !1), c.set({offsetX:d.pageX, offsetY:d.pageY}), Entry.GlobalSvg.position(), m.originPos || (m.originPos = {x:m.x, y:m.y}), a && e.generateCodeMagnetMap(), m._updateCloseBlock())); - } - function d(a) { - $(document).unbind(".block"); - m.terminateDrag(a); - e && e.set({dragBlock:null}); - m._changeFill(!1); - Entry.GlobalSvg.remove(); - delete this.mouseDownCoordinate; - delete m.dragInstance; - } - a.stopPropagation && a.stopPropagation(); - a.preventDefault && a.preventDefault(); - this._changeFill(!1); - var e = this.getBoard(); - Entry.documentMousedown && Entry.documentMousedown.notify(a); - if (!this.readOnly && !e.viewOnly) { - e.setSelectedBlock(this); - this.dominate(); - if (0 === a.button || a.originalEvent && a.originalEvent.touches) { - var f; - f = a.originalEvent && a.originalEvent.touches ? a.originalEvent.touches[0] : a; - this.mouseDownCoordinate = {x:f.pageX, y:f.pageY}; - var g = $(document); - g.bind("mousemove.block touchmove.block", c); - g.bind("mouseup.block touchend.block", d); - this.dragInstance = new Entry.DragInstance({startX:f.pageX, startY:f.pageY, offsetX:f.pageX, offsetY:f.pageY, height:0, mode:!0}); - e.set({dragBlock:this}); - this.addDragging(); - this.dragMode = Entry.DRAG_MODE_MOUSEDOWN; - } else { - if (Entry.Utils.isRightButton(a)) { - var h = this, k = h.block; - if (this.isInBlockMenu) { - return; - } - f = []; - var g = {text:Lang.Blocks.Duplication_option, enable:this.copyable, callback:function() { - Entry.do("cloneBlock", k); - }}, l = {text:Lang.Blocks.CONTEXT_COPY_option, enable:this.copyable, callback:function() { - h.block.copyToClipboard(); - }}, q = {text:Lang.Blocks.Delete_Blocks, enable:k.isDeletable(), callback:function() { - Entry.do("destroyBlock", h.block); - }}, n = {text:Lang.Menus.save_as_image, callback:function() { - h.downloadAsImage(); - }}; - f.push(g); - f.push(l); - f.push(q); - Entry.Utils.isChrome() && "workspace" == Entry.type && f.push(n); - Entry.ContextMenu.show(f); - } - } - var m = this; - e.workspace.getMode() === Entry.Workspace.MODE_VIMBOARD && a && document.getElementsByClassName("CodeMirror")[0].dispatchEvent(Entry.Utils.createMouseEvent("dragStart", event)); - } - }; - b.vimBoardEvent = function(a, b, d) { - a && (a = Entry.Utils.createMouseEvent(b, a), d && (a.block = d), document.getElementsByClassName("CodeMirror")[0].dispatchEvent(a)); - }; - b.terminateDrag = function(a) { - var b = this.getBoard(), d = this.dragMode, e = this.block, f = b.workspace.getMode(); - this.removeDragging(); - this.set({visible:!0}); - this.dragMode = Entry.DRAG_MODE_NONE; - if (f === Entry.Workspace.MODE_VIMBOARD) { - b instanceof Entry.BlockMenu ? (b.terminateDrag(), this.vimBoardEvent(a, "dragEnd", e)) : b.clear(); - } else { - if (d === Entry.DRAG_MODE_DRAG) { - var f = this.dragInstance && this.dragInstance.isNew, g = Entry.GlobalSvg; - a = !1; - var h = this.block.getPrevBlock(this.block); - a = !1; - switch(Entry.GlobalSvg.terminateDrag(this)) { - case g.DONE: - g = b.magnetedBlockView; - g instanceof Entry.BlockView && (g = g.block); - h && !g ? Entry.do("separateBlock", e) : h || g || f ? g ? ("next" === g.view.magneting ? (h = e.getLastBlock(), this.dragMode = d, b.separate(e), this.dragMode = Entry.DRAG_MODE_NONE, Entry.do("insertBlock", g, h).isPass(f), Entry.ConnectionRipple.setView(g.view).dispose()) : (Entry.do("insertBlock", e, g).isPass(f), a = !0), createjs.Sound.play("entryMagneting")) : Entry.do("moveBlock", e).isPass(f) : e.getThread().view.isGlobal() ? Entry.do("moveBlock", e) : Entry.do("separateBlock", - e); - break; - case g.RETURN: - e = this.block; - d = this.originPos; - h ? (this.set({animating:!1}), createjs.Sound.play("entryMagneting"), this.bindPrev(h), e.insert(h)) : (f = e.getThread().view.getParent(), f instanceof Entry.Board ? this._moveTo(d.x, d.y, !1) : (createjs.Sound.play("entryMagneting"), Entry.do("insertBlock", e, f))); - break; - case g.REMOVE: - createjs.Sound.play("entryDelete"), f ? this.block.destroy(!1, !0) : this.block.doDestroyBelow(!1); - } - b.setMagnetedBlock(null); - a && Entry.ConnectionRipple.setView(e.view).dispose(); + a.destroy = function(a, c) { + var d = this, e = this.params; + if (e) { + for (var f = 0;f < e.length;f++) { + var g = e[f]; + g instanceof Entry.Block && (g.doNotSplice = !0, g.destroy(a)); } } - this.destroyShadow(); - delete this.originPos; - this.dominate(); - }; - b._updateCloseBlock = function() { - var a = this.getBoard(), b; - if (this._skeleton.magnets) { - for (var d in this.magnet) { - if (b = "next" === d ? this.getBoard().getNearestMagnet(this.x, this.y + this.getBelowHeight(), d) : this.getBoard().getNearestMagnet(this.x, this.y, d)) { - return a.setMagnetedBlock(b.view, d); - } + if (e = this.statements) { + for (f = 0;f < e.length;f++) { + e[f].destroy(a); } - a.setMagnetedBlock(null); - } - }; - b.dominate = function() { - this.block.getThread().view.dominate(); - }; - b.getSvgRoot = function() { - for (var a = this.getBoard().svgBlockGroup, b = this.svgGroup;b.parentNode !== a;) { - b = b.parentNode; } - return b; - }; - b.getBoard = function() { - return this._board; - }; - b._setBoard = function() { - this._board = this._board.code.board; - }; - b.destroy = function(a) { - $(this.svgGroup).unbind(".blockViewMousedown"); - this._destroyObservers(); - var b = this.svgGroup; - a ? $(b).fadeOut(100, function() { - b.remove(); - }) : b.remove(); - this._contents.forEach(function(a) { - a.constructor !== Entry.Block && a.destroy(); - }); - var d = this.block; - a = d.events.viewDestroy; - "workspace" == Entry.type && a && !this.isInBlockMenu && a.forEach(function(a) { + g = this.getPrevBlock(); + f = this.getNextBlock(); + this.getCode().unregisterBlock(this); + e = this.getThread(); + this._schema.event && e.unregisterEvent(this, this._schema.event); + f && (c ? f.destroy(a, c) : g ? f.view.bindPrev(g) : (c = this.getThread().view.getParent(), c.constructor === Entry.FieldStatement ? (f.view.bindPrev(c), c.insertTopBlock(f)) : c.constructor === Entry.FieldStatement ? f.replace(c._valueBlock) : f.view._toGlobalCoordinate())); + !this.doNotSplice && e.spliceBlock ? e.spliceBlock(this) : delete this.doNotSplice; + this.view && this.view.destroy(a); + this._schemaChangeEvent && this._schemaChangeEvent.destroy(); + (a = this.events.dataDestroy) && this.getCode().object && a.forEach(function(a) { Entry.Utils.isFunction(a) && a(d); }); - this._schemaChangeEvent && this._schemaChangeEvent.destroy(); - }; - b.getShadow = function() { - this._shadow || (this._shadow = Entry.SVG.createElement(this.svgGroup.cloneNode(!0), {opacity:.5}), this.getBoard().svgGroup.appendChild(this._shadow)); - return this._shadow; }; - b.destroyShadow = function() { - this._shadow && (this._shadow.remove(), delete this._shadow); - }; - b._updateMagnet = function() { - if (this._skeleton.magnets) { - var a = this._skeleton.magnets(this); - a.next && this._nextGroup.attr("transform", "translate(" + a.next.x + "," + a.next.y + ")"); - this.magnet = a; - this.block.getThread().changeEvent.notify(); - } - }; - b._updateBG = function() { - if (this._board.dragBlock && this._board.dragBlock.dragInstance) { - var a = this.svgGroup; - if (this.magnet.next) { - if (a = this.magneting) { - var b = this._board.dragBlock.getShadow(), d = this.getAbsoluteCoordinate(), e; - if ("previous" === a) { - e = this.magnet.next, e = "translate(" + (d.x + e.x) + "," + (d.y + e.y) + ")"; - } else { - if ("next" === a) { - e = this.magnet.previous; - var f = this._board.dragBlock.getBelowHeight(); - e = "translate(" + (d.x + e.x) + "," + (d.y + e.y - f) + ")"; - } - } - $(b).attr({transform:e, display:"block"}); - this._clonedShadow = b; - this.background && (this.background.remove(), this.nextBackground.remove(), delete this.background, delete this.nextBackground); - "previous" === a && (a = this._board.dragBlock.getBelowHeight() + this.offsetY, this.originalHeight = this.offsetY, this.set({offsetY:a})); - } else { - this._clonedShadow && (this._clonedShadow.attr({display:"none"}), delete this._clonedShadow), a = this.originalHeight, void 0 !== a && (this.background && (this.background.remove(), this.nextBackground.remove(), delete this.background, delete this.nextBackground), this.set({offsetY:a}), delete this.originalHeight); - } - (a = this.block.thread.changeEvent) && a.notify(); - } else { - this.magneting ? (a.attr({filter:"url(#entryBlockHighlightFilter_" + this.getBoard().suffix + ")"}), a.addClass("outputHighlight")) : (a.removeClass("outputHighlight"), a.removeAttr("filter")); - } - } + a.getView = function() { + return this.view; }; - b.addDragging = function() { - this.svgGroup.addClass("dragging"); + a.setMovable = function(a) { + this.movable != a && this.set({movable:a}); }; - b.removeDragging = function() { - this.svgGroup.removeClass("dragging"); + a.setCopyable = function(a) { + this.copyable != a && this.set({copyable:a}); }; - b.addSelected = function() { - this.svgGroup.addClass("selected"); + a.isMovable = function() { + return this.movable; }; - b.removeSelected = function() { - this.svgGroup.removeClass("selected"); + a.isCopyable = function() { + return this.copyable; }; - b.getSkeleton = function() { - return this._skeleton; + a.setDeletable = function(a) { + this.deletable != a && this.set({deletable:a}); }; - b.getContentPos = function() { - return this._skeleton.contentPos(this); + a.isDeletable = function() { + return this.deletable === Entry.Block.DELETABLE_TRUE; }; - b.renderText = function() { - this._startContentRender(Entry.Workspace.MODE_VIMBOARD); + a.isReadOnly = function() { + return this.readOnly; }; - b.renderBlock = function() { - this._startContentRender(Entry.Workspace.MODE_BOARD); + a.getCode = function() { + return this.thread.getCode(); }; - b._updateOpacity = function() { - this.svgGroup.attr({opacity:!1 === this.visible ? 0 : 1}); - this.visible && this._setPosition(); + a.doAdd = function() { + this.getCode().changeEvent.notify(); }; - b._updateShadow = function() { - this.shadow && Entry.Utils.colorDarken(this._schema.color, .7); + a.doMove = function() { + this._updatePos(); + this.getCode().changeEvent.notify(); }; - b._setMovable = function() { - this.movable = null !== this.block.isMovable() ? this.block.isMovable() : void 0 !== this._skeleton.movable ? this._skeleton.movable : !0; + a.doSeparate = function() { + this.separate(); }; - b._setReadOnly = function() { - this.readOnly = null !== this.block.isReadOnly() ? this.block.isReadOnly() : void 0 !== this._skeleton.readOnly ? this._skeleton.readOnly : !1; + a.doInsert = function(a) { + "basic" === this.getBlockType() ? this.insert(a) : this.replace(a); }; - b._setCopyable = function() { - this.copyable = null !== this.block.isCopyable() ? this.block.isCopyable() : void 0 !== this._skeleton.copyable ? this._skeleton.copyable : !0; + a.doDestroy = function(a) { + this.destroy(a); + this.getCode().changeEvent.notify(); + return this; }; - b.bumpAway = function(a, b) { - var d = this; - a = a || 15; - b ? window.setTimeout(function() { - d._moveBy(a, a, !1); - }, b) : d._moveBy(a, a, !1); + a.doDestroyBelow = function(a) { + console.log("destroyBelow", this.id, this.x, this.y); + this.destroy(a, !0); + this.getCode().changeEvent.notify(); + return this; }; - b.bindPrev = function(a) { - if (a) { - if (this._toLocalCoordinate(a.view._nextGroup), (a = a.getNextBlock()) && a !== this.block) { - var b = this.block.getLastBlock(); - b.view.magnet.next ? a.view._toLocalCoordinate(b.view._nextGroup) : (a.view._toGlobalCoordinate(), a.separate(), a.view.bumpAway(null, 100)); + a.copy = function() { + var a = this.getThread(), c = []; + if (a instanceof Entry.Thread) { + for (var d = a.getBlocks().indexOf(this), a = a.toJSON(!0, d), d = 0;d < a.length;d++) { + c.push(a[d]); } } else { - if (a = this.block.getPrevBlock()) { - this._toLocalCoordinate(a.view._nextGroup), (a = this.block.getNextBlock()) && a.view && a.view._toLocalCoordinate(this._nextGroup); - } + c.push(this.toJSON(!0)); } + a = this.view.getAbsoluteCoordinate(); + d = c[0]; + d.x = a.x + 15; + d.y = a.y + 15; + d.id = Entry.Utils.generateId(); + return c; }; - b.getAbsoluteCoordinate = function(a) { - a = void 0 !== a ? a : this.dragMode; - if (a === Entry.DRAG_MODE_DRAG) { - return {x:this.x, y:this.y}; - } - a = this.block.getThread().view.requestAbsoluteCoordinate(this); - a.x += this.x; - a.y += this.y; - return a; + a.copyToClipboard = function() { + Entry.clipboard = this.copy(); }; - b.getBelowHeight = function() { - return this.block.getThread().view.requestPartHeight(this); + a.separate = function(a) { + this.thread.separate(this, a); + this._updatePos(); + this.getCode().changeEvent.notify(); }; - b._updateDisplay = function() { - this.svgGroup.attr({display:!1 === this.display ? "none" : "block"}); - this.display && this._setPosition(); + a.insert = function(a) { + var c = this.thread.cut(this); + a instanceof Entry.Thread ? a.insertByBlock(null, c) : a.insertAfter(c); + this._updatePos(); + this.getCode().changeEvent.notify(); }; - b._updateColor = function() { - var a = this._schema.color; - this.block.deletable === Entry.Block.DELETABLE_FALSE_LIGHTEN && (a = Entry.Utils.colorLighten(a)); - this._fillColor = a; - this._path.attr({fill:a}); - this._updateContents(); + a.replace = function(a) { + this.thread.cut(this); + a.getThread().replace(this); + this.getCode().changeEvent.notify(); }; - b._updateContents = function() { - for (var a = 0;a < this._contents.length;a++) { - this._contents[a].renderStart(); - } - this.alignContent(!1); + a.getPrevBlock = function() { + return this.thread.getPrevBlock(this); }; - b._destroyObservers = function() { - for (var a = this._observers;a.length;) { - a.pop().destroy(); + a.getNextBlock = function() { + return this.thread.getNextBlock(this) || null; + }; + a.getLastBlock = function() { + return this.thread.getLastBlock(); + }; + a.getOutputBlock = function() { + for (var a = this._schema.params, c = 0;a && c < a.length;c++) { + if ("Output" === a[c].type) { + return this.params[c]; + } } + return null; }; - b._changeFill = function(a) { - var b = this.getBoard(); - if (b.patternRect && !b.dragBlock) { - var d = this._fillColor, e = this._path, b = this.getBoard(); - a ? (b.setPatternRectFill(d), d = "url(#blockHoverPattern_" + this.getBoard().suffix + ")") : b.disablePattern(); - e.attr({fill:d}); + a.getTerminateOutputBlock = function() { + for (var a = this;;) { + var c = a.getOutputBlock(); + if (!c) { + return a; + } + a = c; } }; - b.addActivated = function() { - this.svgGroup.addClass("activated"); + a.getBlockType = function() { + if (!this.view) { + return null; + } + var a = Entry.skeleton[this._schema.skeleton].magnets(this.view); + return a.next || a.previous ? "basic" : a.boolean || a.string ? "field" : a.output ? "output" : null; }; - b.removeActivated = function() { - this.svgGroup.removeClass("activated"); + a.indexOfStatements = function(a) { + return this.statements.indexOf(a); }; - b.reDraw = function() { - if (this.visible) { - var a = this.block; - requestAnimationFrame(this._updateContents.bind(this)); - var b = a.params; - if (b) { - for (var d = 0;d < b.length;d++) { - var e = b[d]; - e instanceof Entry.Block && e.view.reDraw(); - } - } - if (a = a.statements) { - for (d = 0;d < a.length;d++) { - a[d].view.reDraw(); - } - } - } + a.pointer = function(a) { + a || (a = []); + return this.thread.pointer(a, this); }; - b.getParam = function(a) { - return this._paramMap[a]; + a.targetPointer = function() { + var a = this.thread.pointer([], this); + 4 === a.length && 0 === a[3] && a.pop(); + return a; }; - b.getDataUrl = function(a, b) { - function d() { - g = g.replace("(svgGroup)", (new XMLSerializer).serializeToString(k)).replace("%W", h.width * q).replace("%H", h.height * q).replace("(defs)", (new XMLSerializer).serializeToString(m[0])).replace(/>\s+/g, ">").replace(/\s+'), {parent:this.blockMenuContainer}); + this.svgDom.mouseenter(function(a) { + d._scroller && d._scroller.setOpacity(1); + a = d.workspace.selectedBlockView; + !Entry.playground || Entry.playground.resizing || a && a.dragMode === Entry.DRAG_MODE_DRAG || (Entry.playground.focusBlockMenu = !0, a = d.svgGroup.getBBox(), a = a.width + a.x + 64, a > Entry.interfaceState.menuWidth && (this.widthBackup = Entry.interfaceState.menuWidth - 64, $(this).stop().animate({width:a - 62}, 200))); + }); + this.svgDom.mouseleave(function(a) { + Entry.playground && !Entry.playground.resizing && (d._scroller && d._scroller.setOpacity(0), (a = this.widthBackup) && $(this).stop().animate({width:a}, 200), delete this.widthBackup, delete Entry.playground.focusBlockMenu); + }); + $(window).scroll(function() { + d.updateOffset(); + }); }; - b.clear = function() { - for (var a = this._data.length - 1;0 <= a;a--) { - this._data[a].destroy(!1); + a.changeCode = function(a) { + if (!(a instanceof Entry.Code)) { + return console.error("You must inject code instance"); } - this.clearExecutors(); - this._eventMap = {}; - }; - b.createView = function(a) { - null === this.view ? this.set({view:new Entry.CodeView(this, a), board:a}) : (this.set({board:a}), a.bindCodeView(this.view)); + this.codeListener && this.code.changeEvent.detach(this.codeListener); + var c = this; + this.set({code:a}); + this.codeListener = this.code.changeEvent.attach(this, function() { + c.changeEvent.notify(); + }); + a.createView(this); + this.align(); }; - b.registerEvent = function(a, b) { - this._eventMap[b] || (this._eventMap[b] = []); - this._eventMap[b].push(a); + a.bindCodeView = function(a) { + this.svgBlockGroup.remove(); + this.svgThreadGroup.remove(); + this.svgBlockGroup = a.svgBlockGroup; + this.svgThreadGroup = a.svgThreadGroup; + this.svgGroup.appendChild(this.svgThreadGroup); + this.svgGroup.appendChild(this.svgBlockGroup); + this._scroller && this.svgGroup.appendChild(this._scroller.svgGroup); }; - b.unregisterEvent = function(a, b) { - var d = this._eventMap[b]; - if (d && 0 !== d.length) { - var e = d.indexOf(a); - 0 > e || d.splice(e, 1); + a.align = function(a) { + var c = this.code; + if (c) { + this._clearSplitters(); + c.view && !a && c.view.reDraw(); + a = c.getThreads(); + for (var c = 10, d = "LEFT" == this._align ? 10 : this.svgDom.width() / 2, e, f = 0, g = a.length;f < g;f++) { + var h = a[f].getFirstBlock(), k = h.view, h = Entry.block[h.type]; + this.checkBanClass(h) ? k.set({display:!1}) : (k.set({display:!0}), h = h.class, e && e !== h && (this._createSplitter(c), c += 15), e = h, h = d - k.offsetX, "CENTER" == this._align && (h -= k.width / 2), c -= k.offsetY, k._moveTo(h, c, !1), c += k.height + 15); + } + this.updateSplitters(); + this.changeEvent.notify(); } }; - b.raiseEvent = function(a, b, d) { - a = this._eventMap[a]; - var e = []; - if (void 0 !== a) { - for (var f = 0;f < a.length;f++) { - var g = a[f]; - if (void 0 === d || -1 < g.params.indexOf(d)) { - g = new Entry.Executor(a[f], b), this.executors.push(g), e.push(g); + a.cloneToGlobal = function(a) { + if (!this._boardBlockView && null !== this.dragBlock) { + var c = this.workspace, d = c.getMode(), e = this.dragBlock, f = this._svgWidth, g = c.selectedBoard; + if (!g || d != Entry.Workspace.MODE_BOARD && d != Entry.Workspace.MODE_OVERLAYBOARD) { + Entry.GlobalSvg.setView(e, c.getMode()) && Entry.GlobalSvg.addControl(a); + } else { + if (g.code && (c = e.block, d = c.getThread(), c && d)) { + c = d.toJSON(!0); + this._boardBlockView = Entry.do("addThread", c).value.getFirstBlock().view; + var g = this.offset().top - g.offset().top, h, k; + if (c = this.dragBlock.mouseDownCoordinate) { + h = a.pageX - c.x, k = a.pageY - c.y; + } + this._boardBlockView._moveTo(e.x - f + (h || 0), e.y + g + (k || 0), !1); + this._boardBlockView.onMouseDown.call(this._boardBlockView, a); + this._boardBlockView.dragInstance.set({isNew:!0}); } } - return e; } }; - b.getEventMap = function(a) { - return this._eventMap[a]; - }; - b.map = function(a) { - this._data.map(a); - }; - b.tick = function() { - for (var a = this.executors, b = 0;b < a.length;b++) { - var d = a[b]; - d.isEnd() ? (a.splice(b--, 1), 0 === a.length && this.executeEndEvent.notify()) : d.execute(); + a.terminateDrag = function() { + if (this._boardBlockView) { + var a = this._boardBlockView; + if (a) { + this.workspace.getBoard(); + this._boardBlockView = null; + var c = Entry.GlobalSvg.left, d = Entry.GlobalSvg.width / 2, a = a.getBoard().offset().left; + return c < a - d; + } } }; - b.removeExecutor = function(a) { - a = this.executors.indexOf(a); - -1 < a && this.executors.splice(a, 1); + a.getCode = function(a) { + return this._code; }; - b.clearExecutors = function() { - this.executors.forEach(function(a) { - a.end(); - }); - this.executors = []; + a.setSelectedBlock = function(a) { + var c = this.selectedBlockView; + c && c.removeSelected(); + a instanceof Entry.BlockView ? a.addSelected() : a = null; + this.set({selectedBlockView:a}); }; - b.clearExecutorsByEntity = function(a) { - for (var b = this.executors, d = 0;d < b.length;d++) { - var e = b[d]; - e.entity === a && e.end(); - } + a.hide = function() { + this.view.addClass("entryRemove"); }; - b.addExecutor = function(a) { - this.executors.push(a); + a.show = function() { + this.view.removeClass("entryRemove"); }; - b.createThread = function(a, b) { - if (!(a instanceof Array)) { - return console.error("blocks must be array"); + a.renderText = function() { + for (var a = this.code.getThreads(), c = 0;c < a.length;c++) { + a[c].view.renderText(); } - var d = new Entry.Thread(a, this); - void 0 === b ? this._data.push(d) : this._data.insert(d, b); - return d; }; - b.cloneThread = function(a, b) { - var d = a.clone(this, b); - this._data.push(d); - return d; - }; - b.destroyThread = function(a, b) { - var d = this._data, e = d.indexOf(a); - 0 > e || d.splice(e, 1); + a.renderBlock = function() { + for (var a = this.code.getThreads(), c = 0;c < a.length;c++) { + a[c].view.renderBlock(); + } }; - b.doDestroyThread = function(a, b) { - var d = this._data, e = d.indexOf(a); - 0 > e || d.splice(e, 1); + a._createSplitter = function(a) { + a = this.svgBlockGroup.elem("line", {x1:20, y1:a, x2:this._svgWidth - 20, y2:a, stroke:"#b5b5b5"}); + this._splitters.push(a); }; - b.getThreads = function() { - return this._data.map(function(a) { - return a; + a.updateSplitters = function(a) { + a = void 0 === a ? 0 : a; + var c = this._svgWidth - 20, d; + this._splitters.forEach(function(e) { + d = parseFloat(e.getAttribute("y1")) + a; + e.attr({x2:c, y1:d, y2:d}); }); }; - b.toJSON = function() { - for (var a = this.getThreads(), b = [], d = 0, e = a.length;d < e;d++) { - b.push(a[d].toJSON()); - } - return b; - }; - b.countBlock = function() { - for (var a = this.getThreads(), b = 0, d = 0;d < a.length;d++) { - b += a[d].countBlock(); - } - return b; - }; - b.moveBy = function(a, b) { - for (var d = this.getThreads(), e = 0, f = d.length;e < f;e++) { - var g = d[e].getFirstBlock(); - g && g.view._moveBy(a, b, !1); + a._clearSplitters = function() { + for (var a = this._splitters, c = a.length - 1;0 <= c;c--) { + a[c].remove(), a.pop(); } - d = this.board; - d instanceof Entry.BlockMenu && d.updateSplitters(b); - }; - b.stringify = function() { - return JSON.stringify(this.toJSON()); }; - b.dominate = function(a) { - a.view.setZIndex(this._maxZIndex++); - }; - b.indexOf = function(a) { - return this._data.indexOf(a); - }; - b._handleChange = function() { - Entry.creationChangedEvent && Entry.creationChangedEvent.notify(); + a.setWidth = function() { + this._svgWidth = this.blockMenuContainer.width(); + this.updateSplitters(); }; - b.hasBlockType = function(a) { - for (var b = this.getThreads(), d = 0;d < b.length;d++) { - if (b[d].hasBlockType(a)) { - return !0; + a.setMenu = function() { + var a = this._categoryCodes, c = this._categoryElems, d; + for (d in a) { + for (var e = a[d], e = e instanceof Entry.Code ? e.getThreads() : e, f = e.length, g = 0;g < e.length;g++) { + var h = e[g], h = h instanceof Entry.Thread ? h.getFirstBlock().type : h[0].type; + this.checkBanClass(Entry.block[h]) && f--; } + 0 === f ? c[d].addClass("entryRemove") : c[d].removeClass("entryRemove"); } - return !1; - }; - b.findById = function(a) { - return this._blockMap[a]; - }; - b.registerBlock = function(a) { - this._blockMap[a.id] = a; }; - b.unregisterBlock = function(a) { - delete this._blockMap[a.id]; + a.getCategoryCodes = function(a) { + a = this._convertSelector(a); + var c = this._categoryCodes[a]; + c || (this._generateCategoryElement(a), c = []); + c instanceof Entry.Code || (c = this._categoryCodes[a] = new Entry.Code(c)); + return c; }; - b.getByPointer = function(a) { - a = a.concat(); - a.shift(); - a.shift(); - for (var b = this._data[a.shift()].getBlock(a.shift());a.length;) { - b instanceof Entry.Block || (b = b.getValueBlock()); - var d = a.shift(), e = a.shift(); - -1 < d ? b = b.statements[d].getBlock(e) : -1 === d && (b = b.view.getParam(e)); + a._convertSelector = function(a) { + if (isNaN(a)) { + return a; } - return b; - }; - b.getTargetByPointer = function(a) { - a = a.concat(); - a.shift(); - a.shift(); - var b = this._data[a.shift()], d; - if (1 === a.length) { - d = b.getBlock(a.shift() - 1); - } else { - for (d = b.getBlock(a.shift());a.length;) { - d instanceof Entry.Block || (d = d.getValueBlock()); - var e = a.shift(), b = a.shift(); - -1 < e ? (d = d.statements[e], d = a.length ? d.getBlock(b) : 0 === b ? d.view.getParent() : d.getBlock(b - 1)) : -1 === e && (d = d.view.getParam(b)); + a = Number(a); + for (var c = this._categories, d = this._categoryElems, e = 0;e < c.length;e++) { + var f = c[e]; + if (!d[f].hasClass("entryRemove") && 0 === a--) { + return f; } } - return d; }; - b.getBlockList = function(a) { - for (var b = this.getThreads(), d = [], e = 0;e < b.length;e++) { - d = d.concat(b[e].getBlockList(a)); + a.selectMenu = function(a, c) { + if (a = this._convertSelector(a)) { + "variable" == a && Entry.playground.checkVariables(); + "arduino" == a && this._generateHwCode(); + var d = this._categoryElems[a], e = this._selectedCategoryView, f = !1, g = this.workspace.board, h = g.view; + e && e.removeClass("entrySelectedCategory"); + d != e || c ? e || (this.visible || (f = !0, h.addClass("foldOut"), Entry.playground.showTabs()), h.removeClass("folding"), this.visible = !0) : (h.addClass("folding"), this._selectedCategoryView = null, d.removeClass("entrySelectedCategory"), Entry.playground.hideTabs(), f = !0, this.visible = !1); + f && Entry.bindAnimationCallbackOnce(h, function() { + g.scroller.resizeScrollBar.call(g.scroller); + h.removeClass("foldOut"); + Entry.windowResized.notify(); + }); + this.visible && (c = this._categoryCodes[a], this._selectedCategoryView = d, d.addClass("entrySelectedCategory"), c.constructor !== Entry.Code && (c = this._categoryCodes[a] = new Entry.Code(c)), this.changeCode(c)); + this.lastSelector = a; } - return d; - }; -})(Entry.Code.prototype); -Entry.CodeView = function(b, a) { - Entry.Model(this, !1); - this.code = b; - this.set({board:a}); - this.svgThreadGroup = a.svgGroup.elem("g"); - this.svgThreadGroup.attr({class:"svgThreadGroup"}); - this.svgThreadGroup.board = a; - this.svgBlockGroup = a.svgGroup.elem("g"); - this.svgBlockGroup.attr({class:"svgBlockGroup"}); - this.svgBlockGroup.board = a; - a.bindCodeView(this); - this.code.map(function(b) { - b.createView(a); - }); - b.observe(this, "_setBoard", ["board"]); -}; -(function(b) { - b.schema = {board:null, scrollX:0, scrollY:0}; - b._setBoard = function() { - this.set({board:this.code.board}); - }; - b.reDraw = function() { - this.code.map(function(a) { - a.view.reDraw(); - }); - }; -})(Entry.CodeView.prototype); -Entry.ConnectionRipple = {}; -(function(b) { - b.createDom = function(a) { - this.svgDom || (this._ripple = a.getBoard().svgGroup.elem("circle", {cx:0, cy:0, r:0, stroke:"#888", "stroke-width":10})); - }; - b.setView = function(a) { - this._ripple || this.createDom(a); - var b = this._ripple, d = a.getBoard().svgGroup; - b.remove(); - a = a.getAbsoluteCoordinate(); - b.attr({cx:a.x, cy:a.y}); - d.appendChild(b); - b._startTime = new Date; - return this; - }; - b.dispose = function() { - var a = this, b = this._ripple, d = (new Date - b._startTime) / 150; - 1 < d ? b.remove() : (b.attr({r:25 * d, opacity:1 - d}), window.setTimeout(function() { - a.dispose(); - }, 10)); }; -})(Entry.ConnectionRipple); -Entry.Executor = function(b, a) { - this.scope = new Entry.Scope(b, this); - this.entity = a; - this._callStack = []; - this.register = {}; -}; -(function(b) { - b.execute = function() { - if (!this.isEnd()) { - for (;;) { - var a = null; - try { - a = this.scope.block.getSchema().func.call(this.scope, this.entity, this.scope); - } catch (b) { - if ("AsyncError" === b.name) { - a = Entry.STATIC.BREAK; - } else { - var c = !1; - "\ub7f0\ud0c0\uc784 \uc5d0\ub7ec" != b.message && (c = !0); - Entry.Utils.stopProjectWithToast(this.scope, "\ub7f0\ud0c0\uc784 \uc5d0\ub7ec", c); - } - } - if (this.isEnd()) { - break; - } - if (void 0 === a || null === a || a === Entry.STATIC.PASS) { - if (this.scope = new Entry.Scope(this.scope.block.getNextBlock(), this), null === this.scope.block) { - if (this._callStack.length) { - if (a = this.scope, this.scope = this._callStack.pop(), this.scope.isLooped !== a.isLooped) { - break; - } - } else { - break; + a._generateCategoryCodes = function(a) { + this._categoryCodes = {}; + for (var c = 0;c < a.length;c++) { + var d = a[c], e = []; + d.blocks.forEach(function(a) { + var b = Entry.block[a]; + if (b && b.def) { + if (b.defs) { + for (a = 0;a < b.defs.length;a++) { + e.push([b.defs[a]]); } + } else { + e.push([b.def]); } } else { - if (a !== Entry.STATIC.CONTINUE && (a === Entry.STATIC.BREAK || this.scope === a)) { - break; - } + e.push([{type:a}]); } - } + }); + d = d.category; + this._categories.push(d); + this._categoryCodes[d] = e; } }; - b.stepInto = function(a) { - a instanceof Entry.Thread || console.error("Must step in to thread"); - a = a.getFirstBlock(); - if (!a) { - return Entry.STATIC.BREAK; - } - this._callStack.push(this.scope); - this.scope = new Entry.Scope(a, this); - return Entry.STATIC.CONTINUE; + a.banClass = function(a, c) { + 0 > this._bannedClass.indexOf(a) && this._bannedClass.push(a); + this.align(c); }; - b.break = function() { - this._callStack.length && (this.scope = this._callStack.pop()); - return Entry.STATIC.PASS; + a.unbanClass = function(a, c) { + a = this._bannedClass.indexOf(a); + -1 < a && this._bannedClass.splice(a, 1); + this.align(c); }; - b.breakLoop = function() { - this._callStack.length && (this.scope = this._callStack.pop()); - for (;this._callStack.length && "repeat" !== Entry.block[this.scope.block.type].class;) { - this.scope = this._callStack.pop(); + a.checkBanClass = function(a) { + if (a) { + a = a.isNotFor; + for (var c in this._bannedClass) { + if (a && -1 < a.indexOf(this._bannedClass[c])) { + return !0; + } + } + return !1; } - return Entry.STATIC.PASS; }; - b.end = function() { - this.scope.block = null; + a._addControl = function(a) { + var c = this; + a.on("wheel", function() { + c._mouseWheel.apply(c, arguments); + }); }; - b.isEnd = function() { - return null === this.scope.block; + a._mouseWheel = function(a) { + a = a.originalEvent; + a.preventDefault(); + var c = Entry.disposeEvent; + c && c.notify(a); + this._scroller.scroll(-a.wheelDeltaY || a.deltaY / 3); }; -})(Entry.Executor.prototype); -Entry.Scope = function(b, a) { - this.type = (this.block = b) ? b.type : null; - this.executor = a; - this.entity = a.entity; -}; -(function(b) { - b.callReturn = function() { + a.dominate = function(a) { + this.svgBlockGroup.appendChild(a.view.svgGroup); }; - b.getParam = function(a) { - a = this.block.params[a]; - var b = new Entry.Scope(a, this.executor); - return Entry.block[a.type].func.call(b, this.entity, b); + a.reDraw = function() { + this.selectMenu(this.lastSelector, !0); }; - b.getParams = function() { - var a = this; - return this.block.params.map(function(b) { - if (b instanceof Entry.Block) { - var d = new Entry.Scope(b, a.executor); - return Entry.block[b.type].func.call(d, a.entity, d); - } - return b; - }); + a._handleDragBlock = function() { + this._boardBlockView = null; + this._scroller && this._scroller.setOpacity(0); }; - b.getValue = function(a, b) { - var d = this.block.params[this._getParamIndex(a, b)], e = new Entry.Scope(d, this.executor); - return Entry.block[d.type].func.call(e, this.entity, e); + a._captureKeyEvent = function(a) { + var c = a.keyCode, d = Entry.type; + a.ctrlKey && "workspace" == d && 48 < c && 58 > c && (a.preventDefault(), this.selectMenu(c - 49)); }; - b.getStringValue = function(a, b) { - return String(this.getValue(a, b)); + a.setPatternRectFill = function(a) { + this.patternRect.attr({fill:a}); + this.pattern.attr({style:""}); }; - b.getNumberValue = function(a, b) { - return Number(this.getValue(a)); + a.disablePattern = function() { + this.pattern.attr({style:"display: none"}); }; - b.getBooleanValue = function(a, b) { - return Number(this.getValue(a, b)) ? !0 : !1; + a._clearCategory = function() { + this._selectedCategoryView = null; + this._categories = []; + var a = this._categoryElems, c; + for (c in a) { + a[c].remove(); + } + this._categoryElems = {}; + a = this._categoryCodes; + for (c in a) { + var d = a[c]; + d.constructor == Entry.Code && d.clear(); + } + this._categoryCodes = null; }; - b.getField = function(a, b) { - return this.block.params[this._getParamIndex(a)]; + a.setCategoryData = function(a) { + this._clearCategory(); + this._categoryData = a; + this._generateCategoryView(a); + this._generateCategoryCodes(a); }; - b.getStringField = function(a, b) { - return String(this.getField(a)); + a._generateCategoryView = function(a) { + if (a) { + for (var c = 0;c < a.length;c++) { + this._generateCategoryElement(a[c].category); + } + } }; - b.getNumberField = function(a) { - return Number(this.getField(a)); + a._generateCategoryElement = function(a) { + var c = this; + (function(a, b) { + a.text(Lang.Blocks[b.toUpperCase()]); + c._categoryElems[b] = a; + a.bindOnClick(function(a) { + c.selectMenu(b); + }); + })(Entry.Dom("li", {id:"entryCategory" + a, class:"entryCategoryElementWorkspace", parent:this._categoryCol}), a); }; - b.getStatement = function(a, b) { - return this.executor.stepInto(this.block.statements[this._getStatementIndex(a, b)]); + a.updateOffset = function() { + this._offset = this.svgDom.offset(); }; - b._getParamIndex = function(a) { - this._schema || (this._schema = Entry.block[this.type]); - return this._schema.paramsKeyMap[a]; + a.offset = function() { + (!this._offset || 0 === this._offset.top && 0 === this._offset.left) && this.updateOffset(); + return this._offset; }; - b._getStatementIndex = function(a) { - this._schema || (this._schema = Entry.block[this.type]); - return this._schema.statementsKeyMap[a]; + a._generateHwCode = function() { + var a = this._categoryCodes.arduino; + a instanceof Entry.Code && a.clear(); + for (var c = this._categoryData, d, a = c.length - 1;0 <= a;a--) { + if ("arduino" === c[a].category) { + d = c[a].blocks; + break; + } + } + c = []; + for (a = 0;a < d.length;a++) { + var e = d[a], f = Entry.block[e]; + if (!this.checkBanClass(f)) { + if (f && f.def) { + if (f.defs) { + for (a = 0;a < f.defs.length;a++) { + c.push([f.defs[a]]); + } + } else { + c.push([f.def]); + } + } else { + c.push([{type:e}]); + } + } + } + this._categoryCodes.arduino = c; }; - b.die = function() { - this.block = null; - return Entry.STATIC.BREAK; +})(Entry.BlockMenu.prototype); +Entry.BlockMenuScroller = function(a) { + var b = this; + this.board = a; + this.board.changeEvent.attach(this, this._reset); + this.svgGroup = null; + this.vRatio = this.vY = this.vWidth = this.hX = 0; + this._visible = !0; + this._opacity = -1; + this.mouseHandler = function() { + b.onMouseDown.apply(b, arguments); }; -})(Entry.Scope.prototype); -Entry.Field = function() { + this.createScrollBar(); + this.setOpacity(0); + this._addControl(); + Entry.windowResized && Entry.windowResized.attach(this, this.resizeScrollBar); }; -(function(b) { - b.TEXT_LIMIT_LENGTH = 20; - b.destroy = function() { - $(this.svgGroup).unbind("mouseup touchend"); - this.destroyOption(); - }; - b.command = function() { - this._startValue && (this._startValue === this.getValue() || this._blockView.isInBlockMenu || Entry.do("setFieldValue", this._block, this, this.pointer(), this._startValue, this.getValue())); - delete this._startValue; - }; - b.destroyOption = function() { - this.documentDownEvent && (Entry.documentMousedown.detach(this.documentDownEvent), delete this.documentDownEvent); - this.disposeEvent && (Entry.disposeEvent.detach(this.disposeEvent), delete this.documentDownEvent); - this.optionGroup && (this.optionGroup.remove(), delete this.optionGroup); - this.command(); +Entry.BlockMenuScroller.RADIUS = 7; +(function(a) { + a.createScrollBar = function() { + this.svgGroup = this.board.svgGroup.elem("g", {class:"boardScrollbar"}); + this.vScrollbar = this.svgGroup.elem("rect", {rx:4, ry:4}); + this.resizeScrollBar(); }; - b._attachDisposeEvent = function(a) { - var b = this; - b.disposeEvent = Entry.disposeEvent.attach(b, a || function() { - b.destroyOption(); - }); + a.resizeScrollBar = function() { + this._updateRatio(); + if (this._visible && 0 !== this.vRatio) { + var a = this.board.blockMenuContainer; + this.vScrollbar.attr({width:9, height:a.height() / this.vRatio, x:a.width() - 9}); + } }; - 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 = "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}); + a.updateScrollBar = function(a) { + this.vY += a; + this.vScrollbar.attr({y:this.vY}); }; - b.getAbsolutePosFromBoard = function() { - var a = this._block.view, b = a.getContentPos(), a = a.getAbsoluteCoordinate(); - return {x:a.x + this.box.x + b.x, y:a.y + this.box.y + b.y}; + a.scroll = function(a) { + this.isVisible() && (a = this._adjustValue(a) - this.vY, 0 !== a && (this.board.code.moveBy(0, -a * this.vRatio), this.updateScrollBar(a))); }; - b.getAbsolutePosFromDocument = function() { - var a = this._block.view, b = a.getContentPos(), d = a.getAbsoluteCoordinate(), a = a.getBoard().svgDom.offset(); - return {x:d.x + this.box.x + b.x + a.left, y:d.y + this.box.y + b.y + a.top}; + a._adjustValue = function(a) { + var c = this.board.svgDom.height(), c = c - c / this.vRatio; + a = this.vY + a; + a = Math.max(0, a); + return a = Math.min(c, a); }; - b.getRelativePos = function() { - var a = this._block.view.getContentPos(), b = this.box; - return {x:b.x + a.x, y:b.y + a.y}; + a.setVisible = function(a) { + a != this.isVisible() && (this._visible = a, this.svgGroup.attr({display:!0 === a ? "block" : "none"})); }; - b.truncate = function() { - var a = String(this.getValue()), b = this.TEXT_LIMIT_LENGTH, d = a.substring(0, b); - a.length > b && (d += "..."); - return d; + a.setOpacity = function(a) { + this._opacity != a && (this.vScrollbar.attr({opacity:a}), this._opacity = a); }; - b.appendSvgOptionGroup = function() { - return this._block.view.getBoard().svgGroup.elem("g"); + a.isVisible = function() { + return this._visible; }; - b.getValue = function() { - return this._block.params[this._index]; + a._updateRatio = function() { + var a = this.board, c = a.svgBlockGroup.getBoundingClientRect(), d = a.blockMenuContainer.height(), a = a.offset(); + this.vRatio = c = (c.height + (c.top - a.top) + 10) / d; + 1 >= c ? this.setVisible(!1) : this.setVisible(!0); }; - b.setValue = function(a, b) { - this.value != a && (this.value = a, this._block.params[this._index] = a, b && this._blockView.reDraw()); + a._reset = function() { + this.vY = 0; + this.vScrollbar.attr({y:this.vY}); + this.resizeScrollBar(); }; - b._isEditable = function() { - if (this._block.view.dragMode == Entry.DRAG_MODE_DRAG) { - return !1; + a.onMouseDown = function(a) { + function c(a) { + a.stopPropagation && a.stopPropagation(); + a.preventDefault && a.preventDefault(); + a = a.originalEvent && a.originalEvent.touches ? a.originalEvent.touches[0] : a; + var b = e.dragInstance; + e.scroll(a.pageY - b.offsetY); + b.set({offsetY:a.pageY}); } - var a = this._block.view, b = a.getBoard(); - if (!0 === b.disableMouseEvent) { - return !1; + function d(a) { + $(document).unbind(".scroll"); + delete e.dragInstance; } - var d = b.workspace.selectedBlockView; - if (!d || b != d.getBoard()) { - return !1; + var e = this; + a.stopPropagation && a.stopPropagation(); + a.preventDefault && a.preventDefault(); + if (0 === a.button || a.originalEvent && a.originalEvent.touches) { + Entry.documentMousedown && Entry.documentMousedown.notify(a); + var f; + f = a.originalEvent && a.originalEvent.touches ? a.originalEvent.touches[0] : a; + var g = $(document); + g.bind("mousemove.scroll", c); + g.bind("mouseup.scroll", d); + g.bind("touchmove.scroll", c); + g.bind("touchend.scroll", d); + e.dragInstance = new Entry.DragInstance({startY:f.pageY, offsetY:f.pageY}); } - b = a.getSvgRoot(); - return b == d.svgGroup || $(b).has($(a.svgGroup)); + a.stopPropagation(); }; - b._selectBlockView = function() { - var a = this._block.view; - a.getBoard().setSelectedBlock(a); + a._addControl = function() { + $(this.vScrollbar).bind("mousedown touchstart", this.mouseHandler); }; - b._bindRenderOptions = function() { - var a = this; - $(this.svgGroup).bind("mouseup touchend", function(b) { - a._isEditable() && (a.destroyOption(), a._startValue = a.getValue(), a.renderOptions()); +})(Entry.BlockMenuScroller.prototype); +Entry.BlockView = function(a, b, c) { + Entry.Model(this, !1); + this.block = a; + this._lazyUpdatePos = _.debounce(a._updatePos.bind(a), 200); + this._board = b; + this._observers = []; + this.set(a); + this.svgGroup = b.svgBlockGroup.elem("g"); + this._schema = Entry.block[a.type]; + this._schema.changeEvent && (this._schemaChangeEvent = this._schema.changeEvent.attach(this, this._updateSchema)); + var d = this._skeleton = Entry.skeleton[this._schema.skeleton]; + this._contents = []; + this._statements = []; + this.magnet = {}; + this._paramMap = {}; + d.magnets && d.magnets(this).next && (this.svgGroup.nextMagnet = this.block, this._nextGroup = this.svgGroup.elem("g"), this._observers.push(this.observe(this, "_updateMagnet", ["contentHeight"]))); + this.isInBlockMenu = this.getBoard() instanceof Entry.BlockMenu; + var e = this; + this.mouseHandler = function() { + var a = e.block.events; + a && a.mousedown && a.mousedown.forEach(function(a) { + a(e); }); + e.onMouseDown.apply(e, arguments); }; - b.pointer = function(a) { - a = a || []; - a.unshift(this._index); - a.unshift(Entry.PARAM); - return this._block.pointer(a); - }; -})(Entry.Field.prototype); -Entry.FieldAngle = function(b, a, c) { - this._block = a.block; - this._blockView = a; - this.box = new Entry.BoxModel; - this.svgGroup = null; - this.position = b.position; - this._contents = b; - this._index = c; - b = this.getValue(); - this.setValue(this.modValue(void 0 !== b ? b : 90)); - this.renderStart(); + this._startRender(a, c); + this._observers.push(this.block.observe(this, "_setMovable", ["movable"])); + this._observers.push(this.block.observe(this, "_setReadOnly", ["movable"])); + this._observers.push(this.block.observe(this, "_setCopyable", ["copyable"])); + this._observers.push(this.block.observe(this, "_updateColor", ["deletable"], !1)); + this._observers.push(this.observe(this, "_updateBG", ["magneting"], !1)); + this._observers.push(this.observe(this, "_updateOpacity", ["visible"], !1)); + this._observers.push(this.observe(this, "_updateDisplay", ["display"], !1)); + this._observers.push(this.observe(this, "_updateShadow", ["shadow"])); + this._observers.push(this.observe(this, "_updateMagnet", ["offsetY"])); + this._observers.push(b.code.observe(this, "_setBoard", ["board"], !1)); + this.dragMode = Entry.DRAG_MODE_NONE; + Entry.Utils.disableContextmenu(this.svgGroup.node); + b = a.events.viewAdd; + "workspace" == Entry.type && b && !this.isInBlockMenu && b.forEach(function(b) { + Entry.Utils.isFunction(b) && b(a); + }); }; -Entry.Utils.inherit(Entry.Field, Entry.FieldAngle); -(function(b) { - b.renderStart = function() { - this.svgGroup && $(this.svgGroup).remove(); - this.svgGroup = this._blockView.contentSvgGroup.elem("g", {class:"entry-input-field"}); - this.textElement = this.svgGroup.elem("text", {x:4, y:4, "font-size":"11px"}); - this.textElement.textContent = this.getText(); - var a = this.getTextWidth(), b = this.position && this.position.y ? this.position.y : 0; - this._header = this.svgGroup.elem("rect", {x:0, y:b - 8, rx:3, ry:3, width:a, height:16, rx:3, ry:3, fill:"#fff", "fill-opacity":.4}); - this.svgGroup.appendChild(this.textElement); - this._bindRenderOptions(); - this.box.set({x:0, y:0, width:a, height:16}); - }; - b.renderOptions = function() { - var a = this; - this._attachDisposeEvent(function() { - a.applyValue(); - a.destroyOption(); - }); - this.optionGroup = Entry.Dom("input", {class:"entry-widget-input-field", parent:$("body")}); - this.optionGroup.val(this.value); - this.optionGroup.on("mousedown", function(a) { - a.stopPropagation(); - }); - this.optionGroup.on("keyup", function(b) { - var c = b.keyCode || b.which; - a.applyValue(b); - -1 < [13, 27].indexOf(c) && a.destroyOption(); - }); - var b = this.getAbsolutePosFromDocument(); - b.y -= this.box.height / 2; - this.optionGroup.css({height:16, left:b.x, top:b.y, width:a.box.width}); - this.optionGroup.select(); - this.svgOptionGroup = this.appendSvgOptionGroup(); - this.svgOptionGroup.elem("circle", {x:0, y:0, r:49, class:"entry-field-angle-circle"}); - this._dividerGroup = this.svgOptionGroup.elem("g"); - for (b = 0;360 > b;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 : 0 < d && (e += 360); - return 15 * Math.round(e / 15); - }(d, [b.clientX, b.clientY]))); - a.applyValue(); +Entry.BlockView.PARAM_SPACE = 5; +Entry.BlockView.DRAG_RADIUS = 5; +Entry.BlockView.pngMap = {}; +(function(a) { + a.schema = {id:0, type:Entry.STATIC.BLOCK_RENDER_MODEL, x:0, y:0, offsetX:0, offsetY:0, width:0, height:0, contentWidth:0, contentHeight:0, magneting:!1, visible:!0, animating:!1, shadow:!0, display:!0}; + a._startRender = function(a, c) { + var d = this; + a = this._skeleton; + this.svgGroup.attr({class:"block"}); + var e = a.classes; + e && 0 !== e.length && e.forEach(function(a) { + d.svgGroup.addClass(a); }); - this.updateGraph(); - }; - b.updateGraph = function() { - this._fillPath && this._fillPath.remove(); - var a = Entry.toRadian(this.getValue()), b = 49 * Math.sin(a), d = -49 * Math.cos(a), a = a > Math.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"}); + e = a.path(this); + this.pathGroup = this.svgGroup.elem("g"); + this._updateMagnet(); + this._path = this.pathGroup.elem("path"); + this.getBoard().patternRect && ($(this._path).mouseenter(function(a) { + d._mouseEnable && d._changeFill(!0); + }), $(this._path).mouseleave(function(a) { + d._mouseEnable && d._changeFill(!1); + })); + var f = this._schema.color; + this.block.deletable === Entry.Block.DELETABLE_FALSE_LIGHTEN && (f = Entry.Utils.colorLighten(f)); + this._fillColor = f; + e = {d:e, fill:f, class:"blockPath"}; + if (this.magnet.next || this._skeleton.nextShadow) { + f = this.getBoard().suffix, this.pathGroup.attr({filter:"url(#entryBlockShadowFilter_" + f + ")"}); + } else { + if (this.magnet.string || this.magnet.boolean) { + e.stroke = a.outerLine; + } + } + a.outerLine && (e["stroke-width"] = "0.6"); + this._path.attr(e); + this._moveTo(this.x, this.y, !1); + this._startContentRender(c); + !0 !== this._board.disableMouseEvent && this._addControl(); + this.bindPrev(); }; - 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()); + a._startContentRender = function(a) { + a = void 0 === a ? Entry.Workspace.MODE_BOARD : a; + this.contentSvgGroup && this.contentSvgGroup.remove(); + var c = this._schema; + c.statements && c.statements.length && this.statementSvgGroup && this.statementSvgGroup.remove(); + this._contents = []; + this.contentSvgGroup = this.svgGroup.elem("g"); + c.statements && c.statements.length && (this.statementSvgGroup = this.svgGroup.elem("g")); + switch(a) { + case Entry.Workspace.MODE_BOARD: + ; + case Entry.Workspace.MODE_OVERLAYBOARD: + for (var d = /(%\d)/mi, e = (c.template ? c.template : Lang.template[this.block.type]).split(d), f = c.params, g = 0;g < e.length;g++) { + 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); + this._contents.push(h); + this._paramMap[k] = h; + } else { + this._contents.push(new Entry.FieldText({text:h}, this)); + } + } + } + if ((a = c.statements) && a.length) { + for (g = 0;g < a.length;g++) { + this._statements.push(new Entry.FieldStatement(a[g], this, g)); + } + } + break; + case Entry.Workspace.MODE_VIMBOARD: + g = this.getBoard().workspace.getCodeToText(this.block), this._contents.push(new Entry.FieldText({text:g, color:"white"}, this)); + } + this.alignContent(!1); }; - 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(); + a._updateSchema = function() { + this._startContentRender(); }; - b.getTextWidth = function() { - return this.textElement ? this.textElement.getComputedTextLength() + 8 : 8; + a.changeType = function(a) { + this._schemaChangeEvent && this._schemaChangeEvent.destroy(); + this._schema = Entry.block[a]; + this._schema.changeEvent && (this._schemaChangeEvent = this._schema.changeEvent.attach(this, this._updateSchema)); + this._updateSchema(); }; - b.getText = function() { - return this.getValue() + "\u00b0"; + a.alignContent = function(a) { + !0 !== a && (a = !1); + for (var c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, k = 0;k < this._contents.length;k++) { + var l = this._contents[k]; + l instanceof Entry.FieldLineBreak ? (this._alignStatement(a, f), l.align(f), f++, d = l.box.y, c = 8) : (l.align(c, d, a), k === this._contents.length - 1 || l instanceof Entry.FieldText && 0 == l._text.length || (c += Entry.BlockView.PARAM_SPACE)); + l = l.box; + 0 !== f ? h = Math.max(1E3 * Math.round(l.height), h) : e = Math.max(l.height, e); + c += l.width; + g = Math.max(g, c); + this.set({contentWidth:g, contentHeight:e}); + } + this.set({contentHeight:e + h}); + this._statements.length != f && this._alignStatement(a, f); + a = this.getContentPos(); + this.contentSvgGroup.attr("transform", "translate(" + a.x + "," + a.y + ")"); + this.contentPos = a; + this._render(); + this._updateMagnet(); }; - b.modValue = function(a) { - return a % 360; + a._alignStatement = function(a, c) { + var d = this._skeleton.statementPos ? this._skeleton.statementPos(this) : [], e = this._statements[c]; + e && (c = d[c]) && e.align(c.x, c.y, a); }; - 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(); + a._render = function() { + this._renderPath(); + this.set(this._skeleton.box(this)); }; -})(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(); + a._renderPath = function() { + var a = this._skeleton.path(this); + this._path.attr({d:a}); + this.set({animating:!1}); }; - 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}); + a._setPosition = function(a) { + this.svgGroup.attr("transform", "translate(" + this.x + "," + this.y + ")"); }; - 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}); + a._toLocalCoordinate = function(a) { + this._moveTo(0, 0, !1); + a.appendChild(this.svgGroup); }; - b.calcHeight = b.calcWH; - b.destroy = function() { + a._toGlobalCoordinate = function(a) { + a = this.getAbsoluteCoordinate(a); + this._moveTo(a.x, a.y, !1); + this.getBoard().svgBlockGroup.appendChild(this.svgGroup); }; - b.inspectBlock = function() { - var a = null; - if (this._originBlock) { - a = this._originBlock.type, delete this._originBlock; - } else { - switch(this.acceptType) { - case "boolean": - a = "True"; - break; - case "string": - a = "text"; - break; - case "param": - a = "function_field_label"; + a._moveTo = function(a, c, d) { + this.set({x:a, y:c}); + this._lazyUpdatePos(); + this.visible && this.display && this._setPosition(d); + }; + a._moveBy = function(a, c, d) { + return this._moveTo(this.x + a, this.y + c, d); + }; + a._addControl = function() { + var a = this; + this._mouseEnable = !0; + $(this.svgGroup).bind("mousedown.blockViewMousedown touchstart.blockViewMousedown", a.mouseHandler); + var c = a.block.events; + c && c.dblclick && $(this.svgGroup).dblclick(function() { + c.dblclick.forEach(function(c) { + c && c(a); + }); + }); + }; + a.removeControl = function() { + this._mouseEnable = !1; + $(this.svgGroup).unbind(".blockViewMousedown"); + }; + a.onMouseDown = function(b) { + function c(b) { + b.stopPropagation(); + var c = e.workspace.getMode(), d; + c === Entry.Workspace.MODE_VIMBOARD && a.vimBoardEvent(b, "dragOver"); + d = b.originalEvent && b.originalEvent.touches ? b.originalEvent.touches[0] : b; + var f = m.mouseDownCoordinate, f = Math.sqrt(Math.pow(d.pageX - f.x, 2) + Math.pow(d.pageY - f.y, 2)); + (m.dragMode == Entry.DRAG_MODE_DRAG || f > Entry.BlockView.DRAG_RADIUS) && m.movable && (m.isInBlockMenu ? e.cloneToGlobal(b) : (b = !1, m.dragMode != Entry.DRAG_MODE_DRAG && (m._toGlobalCoordinate(), m.dragMode = Entry.DRAG_MODE_DRAG, m.block.getThread().changeEvent.notify(), Entry.GlobalSvg.setView(m, c), b = !0), this.animating && this.set({animating:!1}), 0 === m.dragInstance.height && m.dragInstance.set({height:-1 + m.height}), c = m.dragInstance, m._moveBy(d.pageX - c.offsetX, d.pageY - + c.offsetY, !1), c.set({offsetX:d.pageX, offsetY:d.pageY}), Entry.GlobalSvg.position(), m.originPos || (m.originPos = {x:m.x, y:m.y}), b && e.generateCodeMagnetMap(), m._updateCloseBlock())); + } + function d(a) { + $(document).unbind(".block"); + m.terminateDrag(a); + e && e.set({dragBlock:null}); + m._changeFill(!1); + Entry.GlobalSvg.remove(); + delete this.mouseDownCoordinate; + delete m.dragInstance; + } + b.stopPropagation && b.stopPropagation(); + b.preventDefault && b.preventDefault(); + this._changeFill(!1); + var e = this.getBoard(); + Entry.documentMousedown && Entry.documentMousedown.notify(b); + if (!this.readOnly && !e.viewOnly) { + e.setSelectedBlock(this); + this.dominate(); + if (0 === b.button || b.originalEvent && b.originalEvent.touches) { + var f; + f = b.originalEvent && b.originalEvent.touches ? b.originalEvent.touches[0] : b; + this.mouseDownCoordinate = {x:f.pageX, y:f.pageY}; + var g = $(document); + g.bind("mousemove.block touchmove.block", c); + g.bind("mouseup.block touchend.block", d); + this.dragInstance = new Entry.DragInstance({startX:f.pageX, startY:f.pageY, offsetX:f.pageX, offsetY:f.pageY, height:0, mode:!0}); + e.set({dragBlock:this}); + this.addDragging(); + this.dragMode = Entry.DRAG_MODE_MOUSEDOWN; + } else { + if (Entry.Utils.isRightButton(b)) { + var h = this, k = h.block; + if (this.isInBlockMenu) { + return; + } + f = []; + var g = {text:Lang.Blocks.Duplication_option, enable:this.copyable, callback:function() { + Entry.do("cloneBlock", k); + }}, l = {text:Lang.Blocks.CONTEXT_COPY_option, enable:this.copyable, callback:function() { + h.block.copyToClipboard(); + }}, q = {text:Lang.Blocks.Delete_Blocks, enable:k.isDeletable(), callback:function() { + Entry.do("destroyBlock", h.block); + }}, n = {text:Lang.Menus.save_as_image, callback:function() { + h.downloadAsImage(); + }}; + f.push(g); + f.push(l); + f.push(q); + Entry.Utils.isChrome() && "workspace" == Entry.type && f.push(n); + Entry.ContextMenu.show(f); + } } + var m = this; + e.workspace.getMode() === Entry.Workspace.MODE_VIMBOARD && b && document.getElementsByClassName("CodeMirror")[0].dispatchEvent(Entry.Utils.createMouseEvent("dragStart", event)); } - return this._createBlockByType(a); }; - b._setValueBlock = function(a) { - this._restoreCurrent && (this._originBlock = this._valueBlock); - a || (a = this.inspectBlock()); - this._valueBlock = a; - this.setValue(a); - a.setThread(this); - a.getThread().view.setParent(this); - return this._valueBlock; + a.vimBoardEvent = function(a, c, d) { + a && (a = Entry.Utils.createMouseEvent(c, a), d && (a.block = d), document.getElementsByClassName("CodeMirror")[0].dispatchEvent(a)); }; - b.getValueBlock = function() { - return this._valueBlock; + a.terminateDrag = function(a) { + var c = this.getBoard(), d = this.dragMode, e = this.block, f = c.workspace.getMode(); + this.removeDragging(); + this.set({visible:!0}); + this.dragMode = Entry.DRAG_MODE_NONE; + if (f === Entry.Workspace.MODE_VIMBOARD) { + c instanceof Entry.BlockMenu ? (c.terminateDrag(), this.vimBoardEvent(a, "dragEnd", e)) : c.clear(); + } else { + if (d === Entry.DRAG_MODE_DRAG) { + var f = this.dragInstance && this.dragInstance.isNew, g = Entry.GlobalSvg, h = this.block.getPrevBlock(this.block); + a = !1; + switch(Entry.GlobalSvg.terminateDrag(this)) { + case g.DONE: + g = c.magnetedBlockView; + g instanceof Entry.BlockView && (g = g.block); + h && !g ? Entry.do("separateBlock", e) : h || g || f ? g ? ("next" === g.view.magneting ? (h = e.getLastBlock(), this.dragMode = d, c.separate(e), this.dragMode = Entry.DRAG_MODE_NONE, Entry.do("insertBlock", g, h).isPass(f), Entry.ConnectionRipple.setView(g.view).dispose()) : (Entry.do("insertBlock", e, g).isPass(f), a = !0), createjs.Sound.play("entryMagneting")) : Entry.do("moveBlock", e).isPass(f) : e.getThread().view.isGlobal() ? Entry.do("moveBlock", e) : Entry.do("separateBlock", + e); + break; + case g.RETURN: + e = this.block; + d = this.originPos; + h ? (this.set({animating:!1}), createjs.Sound.play("entryMagneting"), this.bindPrev(h), e.insert(h)) : (f = e.getThread().view.getParent(), f instanceof Entry.Board ? this._moveTo(d.x, d.y, !1) : (createjs.Sound.play("entryMagneting"), Entry.do("insertBlock", e, f))); + break; + case g.REMOVE: + createjs.Sound.play("entryDelete"), f ? this.block.destroy(!1, !0) : this.block.doDestroyBelow(!1); + } + c.setMagnetedBlock(null); + a && Entry.ConnectionRipple.setView(e.view).dispose(); + } + } + this.destroyShadow(); + delete this.originPos; + this.dominate(); }; - b.updateValueBlock = function(a) { - a instanceof Entry.Block || (a = void 0); - this._destroyObservers(); - a = this._setValueBlock(a).view; - a.bindPrev(this); - this._blockView.alignContent(); - this._posObserver = a.observe(this, "updateValueBlock", ["x", "y"], !1); - this._sizeObserver = a.observe(this, "calcWH", ["width", "height"]); - a = this._blockView.getBoard(); - a.constructor === Entry.Board && a.generateCodeMagnetMap(); + a._updateCloseBlock = function() { + var a = this.getBoard(), c; + if (this._skeleton.magnets) { + for (var d in this.magnet) { + if (c = "next" === d ? this.getBoard().getNearestMagnet(this.x, this.y + this.getBelowHeight(), d) : this.getBoard().getNearestMagnet(this.x, this.y, d)) { + return a.setMagnetedBlock(c.view, d); + } + } + a.setMagnetedBlock(null); + } }; - b._destroyObservers = function() { - this._sizeObserver && this._sizeObserver.destroy(); - this._posObserver && this._posObserver.destroy(); + a.dominate = function() { + this.block.getThread().view.dominate(); }; - b.getPrevBlock = function(a) { - return this._valueBlock === a ? this : null; + a.getSvgRoot = function() { + for (var a = this.getBoard().svgBlockGroup, c = this.svgGroup;c.parentNode !== a;) { + c = c.parentNode; + } + return c; }; - b.getNextBlock = function() { - return null; + a.getBoard = function() { + return this._board; }; - b.requestAbsoluteCoordinate = function(a) { - a = this._blockView; - var b = a.contentPos; - a = a.getAbsoluteCoordinate(); - a.x += this.box.x + b.x; - a.y += this.box.y + b.y; - return a; + a._setBoard = function() { + this._board = this._board.code.board; }; - b.dominate = function() { - this._blockView.dominate(); + a.destroy = function(a) { + $(this.svgGroup).unbind(".blockViewMousedown"); + this._destroyObservers(); + var c = this.svgGroup; + a ? $(c).fadeOut(100, function() { + c.remove(); + }) : c.remove(); + this._contents.forEach(function(a) { + a.constructor !== Entry.Block && a.destroy(); + }); + var d = this.block; + a = d.events.viewDestroy; + "workspace" == Entry.type && a && !this.isInBlockMenu && a.forEach(function(a) { + Entry.Utils.isFunction(a) && a(d); + }); + this._schemaChangeEvent && this._schemaChangeEvent.destroy(); }; - b.isGlobal = function() { - return !1; + a.getShadow = function() { + this._shadow || (this._shadow = Entry.SVG.createElement(this.svgGroup.cloneNode(!0), {opacity:.5}), this.getBoard().svgGroup.appendChild(this._shadow)); + return this._shadow; }; - b.separate = function(a) { - this.getCode().createThread([a]); - this.calcWH(); - this.changeEvent.notify(); + a.destroyShadow = function() { + this._shadow && (this._shadow.remove(), delete this._shadow); }; - b.getCode = function() { - return this._block.thread.getCode(); + a._updateMagnet = function() { + if (this._skeleton.magnets) { + var a = this._skeleton.magnets(this); + a.next && this._nextGroup.attr("transform", "translate(" + a.next.x + "," + a.next.y + ")"); + this.magnet = a; + this.block.getThread().changeEvent.notify(); + } }; - b.cut = function(a) { - return this._valueBlock === a ? [a] : null; + a._updateBG = function() { + if (this._board.dragBlock && this._board.dragBlock.dragInstance) { + var a = this.svgGroup; + if (this.magnet.next) { + if (a = this.magneting) { + var c = this._board.dragBlock.getShadow(), d = this.getAbsoluteCoordinate(), e; + if ("previous" === a) { + e = this.magnet.next, e = "translate(" + (d.x + e.x) + "," + (d.y + e.y) + ")"; + } else { + if ("next" === a) { + e = this.magnet.previous; + var f = this._board.dragBlock.getBelowHeight(); + e = "translate(" + (d.x + e.x) + "," + (d.y + e.y - f) + ")"; + } + } + $(c).attr({transform:e, display:"block"}); + this._clonedShadow = c; + this.background && (this.background.remove(), this.nextBackground.remove(), delete this.background, delete this.nextBackground); + "previous" === a && (a = this._board.dragBlock.getBelowHeight() + this.offsetY, this.originalHeight = this.offsetY, this.set({offsetY:a})); + } else { + this._clonedShadow && (this._clonedShadow.attr({display:"none"}), delete this._clonedShadow), a = this.originalHeight, void 0 !== a && (this.background && (this.background.remove(), this.nextBackground.remove(), delete this.background, delete this.nextBackground), this.set({offsetY:a}), delete this.originalHeight); + } + (a = this.block.thread.changeEvent) && a.notify(); + } else { + this.magneting ? (a.attr({filter:"url(#entryBlockHighlightFilter_" + this.getBoard().suffix + ")"}), a.addClass("outputHighlight")) : (a.removeClass("outputHighlight"), a.removeAttr("filter")); + } + } }; - b.replace = function(a) { - "string" === typeof a && (a = this._createBlockByType(a)); - var b = this._valueBlock; - Entry.block[b.type].isPrimitive ? (b.doNotSplice = !0, b.destroy()) : "param" === this.acceptType ? (this._destroyObservers(), b.view._toGlobalCoordinate(), a.getTerminateOutputBlock().view._contents[1].replace(b)) : (this._destroyObservers(), b.view._toGlobalCoordinate(), this.separate(b), b.view.bumpAway(30, 150)); - this.updateValueBlock(a); - a.view._toLocalCoordinate(this.svgGroup); - this.calcWH(); - this.changeEvent.notify(); + a.addDragging = function() { + this.svgGroup.addClass("dragging"); }; - b.setParent = function(a) { - this._parent = a; + a.removeDragging = function() { + this.svgGroup.removeClass("dragging"); }; - b.getParent = function() { - return this._parent; + a.addSelected = function() { + this.svgGroup.addClass("selected"); }; - b._createBlockByType = function(a) { - this._block.getThread(); - var b = this._blockView.getBoard(); - a = new Entry.Block({type:a}, this); - var d = b.workspace, e; - d && (e = d.getMode()); - a.createView(b, e); - return a; + a.removeSelected = function() { + this.svgGroup.removeClass("selected"); }; - b.spliceBlock = function() { - this.updateValueBlock(); + a.getSkeleton = function() { + return this._skeleton; }; - b._updateBG = function() { - this.magneting ? this._bg = this.svgGroup.elem("path", {d:"m 8,12 l -4,0 -2,-2 0,-3 3,0 1,-1 0,-12 -1,-1 -3,0 0,-3 2,-2 l 4,0 z", fill:"#fff", stroke:"#fff", "fill-opacity":.7, transform:"translate(0,12)"}) : this._bg && (this._bg.remove(), delete this._bg); + a.getContentPos = function() { + return this._skeleton.contentPos(this); }; - b.getThread = function() { - return this; + a.renderText = function() { + this._startContentRender(Entry.Workspace.MODE_VIMBOARD); }; - b.pointer = function(a) { - a.unshift(this._index); - a.unshift(Entry.PARAM); - return this._block.pointer(a); + a.renderBlock = function() { + this._startContentRender(Entry.Workspace.MODE_BOARD); }; -})(Entry.FieldBlock.prototype); -Entry.FieldColor = function(b, a, c) { - this._block = a.block; - this._blockView = a; - this.box = new Entry.BoxModel; - this.svgGroup = null; - this._contents = b; - this._index = c; - this._position = b.position; - this.key = b.key; - this.setValue(this.getValue() || "#FF0000"); - this.renderStart(a); -}; -Entry.Utils.inherit(Entry.Field, Entry.FieldColor); -(function(b) { - b.renderStart = function() { - this.svgGroup && $(this.svgGroup).remove(); - this.svgGroup = this._blockView.contentSvgGroup.elem("g", {class:"entry-field-color"}); - var a = this._position, b; - a ? (b = a.x || 0, a = a.y || 0) : (b = 0, a = -8); - this._header = this.svgGroup.elem("rect", {x:b, y:a, width:14.5, height:16, fill:this.getValue()}); - this._bindRenderOptions(); - this.box.set({x:b, y:a, width:14.5, height:16}); + a._updateOpacity = function() { + this.svgGroup.attr({opacity:!1 === this.visible ? 0 : 1}); + this.visible && this._setPosition(); }; - b.renderOptions = function() { - var a = this; - this._attachDisposeEvent(); - var b = Entry.FieldColor.getWidgetColorList(); - this.optionGroup = Entry.Dom("table", {class:"entry-widget-color-table", parent:$("body")}); - for (var d = 0;d < b.length;d++) { - for (var e = Entry.Dom("tr", {class:"entry-widget-color-row", parent:this.optionGroup}), f = 0;f < b[d].length;f++) { - var g = Entry.Dom("td", {class:"entry-widget-color-cell", parent:e}), h = b[d][f]; - g.css({"background-color":h}); - g.attr({"data-color-value":h}); - (function(b, c) { - b.mousedown(function(a) { - a.stopPropagation(); - }); - b.mouseup(function(b) { - a.applyValue(c); - a.destroyOption(); - a._selectBlockView(); - }); - })(g, h); - } - } - b = this.getAbsolutePosFromDocument(); - b.y += this.box.height / 2 + 1; - this.optionGroup.css({left:b.x, top:b.y}); + a._updateShadow = function() { + this.shadow && Entry.Utils.colorDarken(this._schema.color, .7); }; - b.applyValue = function(a) { - this.value != a && (this.setValue(a), this._header.attr({fill:a})); + a._setMovable = function() { + this.movable = null !== this.block.isMovable() ? this.block.isMovable() : void 0 !== this._skeleton.movable ? this._skeleton.movable : !0; + }; + a._setReadOnly = function() { + this.readOnly = null !== this.block.isReadOnly() ? this.block.isReadOnly() : void 0 !== this._skeleton.readOnly ? this._skeleton.readOnly : !1; }; -})(Entry.FieldColor.prototype); -Entry.FieldColor.getWidgetColorList = function() { - return ["#FFFFFF #CCCCCC #C0C0C0 #999999 #666666 #333333 #000000".split(" "), "#FFCCCC #FF6666 #FF0000 #CC0000 #990000 #660000 #330000".split(" "), "#FFCC99 #FF9966 #FF9900 #FF6600 #CC6600 #993300 #663300".split(" "), "#FFFF99 #FFFF66 #FFCC66 #FFCC33 #CC9933 #996633 #663333".split(" "), "#FFFFCC #FFFF33 #FFFF00 #FFCC00 #999900 #666600 #333300".split(" "), "#99FF99 #66FF99 #33FF33 #33CC00 #009900 #006600 #003300".split(" "), "#99FFFF #33FFFF #66CCCC #00CCCC #339999 #336666 #003333".split(" "), "#CCFFFF #66FFFF #33CCFF #3366FF #3333FF #000099 #000066".split(" "), - "#CCCCFF #9999FF #6666CC #6633FF #6609CC #333399 #330099".split(" "), "#FFCCFF #FF99FF #CC66CC #CC33CC #993399 #663366 #330033".split(" ")]; -}; -Entry.FieldDropdown = function(b, a, c) { - this._block = a.block; - this._blockView = a; - this.box = new Entry.BoxModel; - this.svgGroup = null; - this._contents = b; - this._noArrow = b.noArrow; - this._arrowColor = b.arrowColor; - this._index = c; - this.setValue(this.getValue()); - this._CONTENT_HEIGHT = b.dropdownHeight || a.getSkeleton().dropdownHeight || 16; - this._FONT_SIZE = b.fontSize || a.getSkeleton().fontSize || 12; - this._ROUND = b.roundValue || 3; - this.renderStart(); -}; -Entry.Utils.inherit(Entry.Field, Entry.FieldDropdown); -(function(b) { - b.renderStart = function() { - this.svgGroup && $(this.svgGroup).remove(); - this instanceof Entry.FieldDropdownDynamic && this._updateValue(); - var a = this._blockView; - this.svgGroup = a.contentSvgGroup.elem("g", {class:"entry-field-dropdown"}); - this.textElement = this.svgGroup.elem("text", {x:2}); - this.textElement.textContent = this.getTextByValue(this.getValue()); - var b = this.textElement.getBBox(); - this.textElement.attr({style:"white-space: pre;", "font-size":+this._FONT_SIZE + "px", y:.25 * b.height}); - b = this.textElement.getComputedTextLength() + 16; - this._noArrow && (b -= 12); - var d = this._CONTENT_HEIGHT; - this._header = this.svgGroup.elem("rect", {width:b, height:d, y:-d / 2, rx:this._ROUND, ry:this._ROUND, fill:"#fff", "fill-opacity":.4}); - this.svgGroup.appendChild(this.textElement); - this._noArrow || (a = this._arrowColor || a._schema.color, this._arrow = this.svgGroup.elem("polygon", {points:"0,-2.1 6.4,-2.1 3.2,2.1", fill:a, stroke:a, transform:"translate(" + (b - 11) + ",0)"})); - this._bindRenderOptions(); - this.box.set({x:0, y:0, width:b, height:d}); + a._setCopyable = function() { + this.copyable = null !== this.block.isCopyable() ? this.block.isCopyable() : void 0 !== this._skeleton.copyable ? this._skeleton.copyable : !0; }; - b.resize = function() { - var a = this.textElement.getComputedTextLength() + 18; - this._noArrow ? a -= 14 : this._arrow.attr({transform:"translate(" + (a - 11) + ",0)"}); - this._header.attr({width:a}); - this.box.set({width:a}); - this._block.view.alignContent(); + a.bumpAway = function(a, c) { + var d = this; + a = a || 15; + c ? window.setTimeout(function() { + d._moveBy(a, a, !1); + }, c) : d._moveBy(a, a, !1); }; - b.renderOptions = function() { - var a = this; - this._attachDisposeEvent(); - this.optionGroup = Entry.Dom("ul", {class:"entry-widget-dropdown", parent:$("body")}); - this.optionGroup.bind("mousedown touchstart", function(a) { - a.stopPropagation(); - }); - for (var b = this._contents.options, b = this._contents.options, d = 0, e = b.length;d < e;d++) { - var f = b[d], g = f[0], f = f[1], h = Entry.Dom("li", {class:"rect", parent:this.optionGroup}), k = Entry.Dom("span", {class:"left", parent:h}); - Entry.Dom("span", {class:"right", parent:h}).text(g); - this.getValue() == f && k.text("\u2713"); - (function(b, c) { - b.bind("mousedown touchstart", function(a) { - a.stopPropagation(); - }); - b.bind("mouseup touchend", function(b) { - b.stopPropagation(); - a.applyValue(c); - a.destroyOption(); - a._selectBlockView(); - }); - })(h, f); + a.bindPrev = function(a) { + if (a) { + if (this._toLocalCoordinate(a.view._nextGroup), (a = a.getNextBlock()) && a !== this.block) { + var c = this.block.getLastBlock(); + c.view.magnet.next ? a.view._toLocalCoordinate(c.view._nextGroup) : (a.view._toGlobalCoordinate(), a.separate(), a.view.bumpAway(null, 100)); + } + } else { + if (a = this.block.getPrevBlock()) { + this._toLocalCoordinate(a.view._nextGroup), (a = this.block.getNextBlock()) && a.view && a.view._toLocalCoordinate(this._nextGroup); + } } - this._position(); }; - b._position = function() { - var a = this.getAbsolutePosFromDocument(); - a.y += this.box.height / 2; - var b = $(document).height(), d = this.optionGroup.height(), e = this.optionGroup.width() + 30; - if (b < a.y + d + 30) { - var b = this._blockView.getBoard().svgDom.height(), f = this.getAbsolutePosFromBoard(); - this._blockView.y < b / 2 ? (a.x += this.box.width / 2 - e / 2, b -= f.y + 30, this.optionGroup.height(b)) : (a.x += this.box.width + 1, b -= b - f.y, b - 30 < d && this.optionGroup.height(b - b % 30), a.y -= this.optionGroup.height()); - } else { - a.x += this.box.width / 2 - e / 2; + a.getAbsoluteCoordinate = function(a) { + a = void 0 !== a ? a : this.dragMode; + if (a === Entry.DRAG_MODE_DRAG) { + return {x:this.x, y:this.y}; } - this.optionGroup.addClass("rendered"); - this.optionGroup.css({left:a.x, top:a.y, width:e}); - this.optionGroup.find(".right").width(e - 20); + a = this.block.getThread().view.requestAbsoluteCoordinate(this); + a.x += this.x; + a.y += this.y; + return a; }; - b.applyValue = function(a) { - this.value != a && this.setValue(a); - this.textElement.textContent = this.getTextByValue(a); - this.resize(); + a.getBelowHeight = function() { + return this.block.getThread().view.requestPartHeight(this); }; - b.getTextByValue = function(a) { - if (!a || "null" === a) { - return Lang.Blocks.no_target; - } - for (var b = this._contents.options, d = 0, e = b.length;d < e;d++) { - var f = b[d]; - if (f[1] == a) { - return f[0]; - } - } - return Lang.Blocks.no_target; + a._updateDisplay = function() { + this.svgGroup.attr({display:!1 === this.display ? "none" : "block"}); + this.display && this._setPosition(); }; -})(Entry.FieldDropdown.prototype); -Entry.FieldDropdownDynamic = function(b, a, c) { - this._block = a.block; - this._blockView = a; - this.box = new Entry.BoxModel; - this.svgGroup = null; - this._contents = b; - this._index = c; - this._arrowColor = b.arrowColor; - c = this._contents.menuName; - Entry.Utils.isFunction(c) ? this._menuGenerator = c : this._menuName = c; - this._CONTENT_HEIGHT = b.dropdownHeight || a.getSkeleton().dropdownHeight || 16; - this._FONT_SIZE = b.fontSize || a.getSkeleton().fontSize || 12; - this._ROUND = b.roundValue || 3; - this.renderStart(a); -}; -Entry.Utils.inherit(Entry.FieldDropdown, Entry.FieldDropdownDynamic); -(function(b) { - b.constructor = Entry.FieldDropDownDynamic; - b._updateValue = function() { - var a = this._block.getCode().object, b = []; - Entry.container && (b = this._menuName ? Entry.container.getDropdownList(this._menuName, a) : this._menuGenerator()); - this._contents.options = b; - (a = this.getValue()) && "null" != a || (a = 0 !== b.length ? b[0][1] : null); - this.setValue(a); + a._updateColor = function() { + var a = this._schema.color; + this.block.deletable === Entry.Block.DELETABLE_FALSE_LIGHTEN && (a = Entry.Utils.colorLighten(a)); + this._fillColor = a; + this._path.attr({fill:a}); + this._updateContents(); }; - b.renderOptions = function() { - var a = this; - this._attachDisposeEvent(); - this.optionGroup = Entry.Dom("ul", {class:"entry-widget-dropdown", parent:$("body")}); - this.optionGroup.bind("mousedown touchstart", function(a) { - a.stopPropagation(); - }); - var b; - b = this._menuName ? Entry.container.getDropdownList(this._contents.menuName) : this._menuGenerator(); - this._contents.options = b; - for (var d = 0;d < b.length;d++) { - var e = b[d], f = e[0], e = e[1], g = Entry.Dom("li", {class:"rect", parent:this.optionGroup}), h = Entry.Dom("span", {class:"left", parent:g}); - Entry.Dom("span", {class:"right", parent:g}).text(f); - this.getValue() == e && h.text("\u2713"); - (function(b, c) { - b.mousedown(function(a) { - a.stopPropagation(); - }); - b.mouseup(function(b) { - b.stopPropagation(); - a.applyValue(c); - a.destroyOption(); - a._selectBlockView(); - }); - })(g, e); + a._updateContents = function() { + for (var a = 0;a < this._contents.length;a++) { + this._contents[a].renderStart(); } - this._position(); + this.alignContent(!1); }; -})(Entry.FieldDropdownDynamic.prototype); -Entry.FieldImage = function(b, a, c) { - this._block = a.block; - this._blockView = a; - this._content = b; - this.box = new Entry.BoxModel; - this._size = b.size; - this._highlightColor = b.highlightColor ? b.highlightColor : "#F59900"; - this._position = b.position; - this._imgElement = this._path = this.svgGroup = null; - this._index = c; - this.setValue(null); - this.renderStart(); -}; -Entry.Utils.inherit(Entry.Field, Entry.FieldImage); -(function(b) { - b.renderStart = function() { - this.svgGroup && this.svgGroup.remove(); - this._imgUrl = this._block.deletable === Entry.Block.DELETABLE_FALSE_LIGHTEN ? this._content.img.replace(".png", "_un.png") : this._content.img; - this.svgGroup = this._blockView.contentSvgGroup.elem("g"); - this._imgElement = this.svgGroup.elem("image", {href:this._imgUrl, x:0, y:-.5 * this._size, width:this._size, height:this._size}); - this.box.set({x:this._size, y:0, width:this._size, height:this._size}); + a._destroyObservers = function() { + for (var a = this._observers;a.length;) { + a.pop().destroy(); + } }; -})(Entry.FieldImage.prototype); -Entry.FieldIndicator = function(b, a, c) { - this._block = a.block; - this._blockView = a; - this.box = new Entry.BoxModel; - this._size = b.size; - this._imgUrl = this._block.deletable === Entry.Block.DELETABLE_FALSE_LIGHTEN ? b.img.replace(".png", "_un.png") : b.img; - this._boxMultiplier = b.boxMultiplier || 2; - this._highlightColor = b.highlightColor ? b.highlightColor : "#F59900"; - this._position = b.position; - this._index = c; - this._imgElement = this._path = this.svgGroup = null; - this.setValue(null); - this.renderStart(); -}; -Entry.Utils.inherit(Entry.Field, Entry.FieldIndicator); -(function(b) { - b.renderStart = function() { - this.svgGroup && this.svgGroup.remove(); - this.svgGroup = this._blockView.contentSvgGroup.elem("g"); - this._imgElement = this.svgGroup.elem("image", {href:Entry.mediaFilePath + this._imgUrl, x:this._position ? -1 * this._size : 0, y:-1 * this._size, width:2 * this._size, height:2 * this._size}); - var a = "m 0,-%s a %s,%s 0 1,1 -0.1,0 z".replace(/%s/gi, this._size); - this._path = this.svgGroup.elem("path", {d:a, stroke:"none", fill:"none"}); - this.box.set({width:this._size * this._boxMultiplier + (this._position ? -this._size : 0), height:this._size * this._boxMultiplier}); + a._changeFill = function(a) { + var c = this.getBoard(); + if (c.patternRect && !c.dragBlock) { + var d = this._fillColor, e = this._path, c = this.getBoard(); + a ? (c.setPatternRectFill(d), d = "url(#blockHoverPattern_" + this.getBoard().suffix + ")") : c.disablePattern(); + e.attr({fill:d}); + } }; - b.enableHighlight = function() { - var a = this._path.getTotalLength(), b = this._path; - this._path.attr({stroke:this._highlightColor, strokeWidth:2, "stroke-linecap":"round", "stroke-dasharray":a + " " + a, "stroke-dashoffset":a}); - setInterval(function() { - b.attr({"stroke-dashoffset":a}).animate({"stroke-dashoffset":0}, 300); - }, 1400, mina.easeout); - setTimeout(function() { - setInterval(function() { - b.animate({"stroke-dashoffset":-a}, 300); - }, 1400, mina.easeout); - }, 500); + a.addActivated = function() { + this.svgGroup.addClass("activated"); }; -})(Entry.FieldIndicator.prototype); -Entry.Keyboard = {}; -Entry.FieldKeyboard = function(b, a, c) { - this._block = a.block; - this._blockView = a; - this.box = new Entry.BoxModel; - this.svgGroup = null; - this.position = b.position; - this._contents = b; - this._index = c; - this.setValue(String(this.getValue())); - this._optionVisible = !1; - this.renderStart(a); -}; -Entry.Utils.inherit(Entry.Field, Entry.FieldKeyboard); -(function(b) { - b.renderStart = function() { - this.svgGroup && $(this.svgGroup).remove(); - this.svgGroup = this._blockView.contentSvgGroup.elem("g", {class:"entry-input-field"}); - this.textElement = this.svgGroup.elem("text").attr({x:4, y:4, "font-size":"11px"}); - this.textElement.textContent = Entry.getKeyCodeMap()[this.getValue()]; - var a = this.getTextWidth(), b = this.position && this.position.y ? this.position.y : 0; - this._header = this.svgGroup.elem("rect", {x:0, y:b - 8, width:a, height:16, rx:3, ry:3, fill:"#fff", "fill-opacity":.4}); - this.svgGroup.appendChild(this.textElement); - this._bindRenderOptions(); - this.box.set({x:0, y:0, width:a, height:16}); + a.removeActivated = function() { + this.svgGroup.removeClass("activated"); }; - b.renderOptions = function() { - Entry.keyPressed && (this.keyPressed = Entry.keyPressed.attach(this, this._keyboardControl)); - this._optionVisible = !0; - this._attachDisposeEvent(); - var a = this.getAbsolutePosFromDocument(); - a.x -= this.box.width / 2; - a.y += this.box.height / 2 + 1; - this.optionGroup = Entry.Dom("img", {class:"entry-widget-keyboard-input", src:Entry.mediaFilePath + "/media/keyboard_workspace.png", parent:$("body")}); - this.optionGroup.css({left:a.x, top:a.y}); + a.reDraw = function() { + if (this.visible) { + var a = this.block; + requestAnimationFrame(this._updateContents.bind(this)); + var c = a.params; + if (c) { + for (var d = 0;d < c.length;d++) { + var e = c[d]; + e instanceof Entry.Block && e.view.reDraw(); + } + } + if (a = a.statements) { + for (d = 0;d < a.length;d++) { + a[d].view.reDraw(); + } + } + } }; - b.destroyOption = function() { - this.disposeEvent && (Entry.disposeEvent.detach(this.disposeEvent), delete this.disposeEvent); - this.optionGroup && (this.optionGroup.remove(), delete this.optionGroup); - this._optionVisible = !1; - this.command(); - this.keyPressed && (Entry.keyPressed.detach(this.keyPressed), delete this.keyPressed); + a.getParam = function(a) { + return this._paramMap[a]; }; - b._keyboardControl = function(a) { - a.stopPropagation(); - if (this._optionVisible) { - a = a.keyCode; - var b = Entry.getKeyCodeMap()[a]; - void 0 !== b && this.applyValue(b, a); + a.getDataUrl = function(a, c) { + function d() { + g = g.replace("(svgGroup)", (new XMLSerializer).serializeToString(k)).replace("%W", h.width * l).replace("%H", h.height * l).replace("(defs)", (new XMLSerializer).serializeToString(n[0])).replace(/>\s+/g, ">").replace(/\s+ c && (d += "..."); + return d; }; - b._updateBG = function() { - this.magneting ? this._bg = this.svgGroup.elem("path", {d:"m -4,-12 h 3 l 2,2 0,3 3,0 1,1 0,12 -1,1 -3,0 0,3 -2,2 h -3 ", fill:"#fff", stroke:"#fff", "fill-opacity":.7, transform:"translate(0," + (this._valueBlock ? 12 : 0) + ")"}) : this._bg && (this._bg.remove(), delete this._bg); + a.appendSvgOptionGroup = function() { + return this._block.view.getBoard().svgGroup.elem("g"); }; - b.replace = function(a) { - var b = this._valueBlock; - b && (b.view._toGlobalCoordinate(), a.getTerminateOutputBlock().view._contents[1].replace(b)); - this._updateValueBlock(a); - a.view._toLocalCoordinate(this.svgGroup); - this.calcWH(); + a.getValue = function() { + return this._block.params[this._index]; }; - b.setParent = function(a) { - this._parent = a; + a.setValue = function(a, c) { + this.value != a && (this.value = a, this._block.params[this._index] = a, c && this._blockView.reDraw()); }; - b.getParent = function() { - return this._parent; + a._isEditable = function() { + if (this._block.view.dragMode == Entry.DRAG_MODE_DRAG) { + return !1; + } + var a = this._block.view, c = a.getBoard(); + if (!0 === c.disableMouseEvent) { + return !1; + } + var d = c.workspace.selectedBlockView; + if (!d || c != d.getBoard()) { + return !1; + } + c = a.getSvgRoot(); + return c == d.svgGroup || $(c).has($(a.svgGroup)); }; - b.getThread = function() { - return this; + a._selectBlockView = function() { + var a = this._block.view; + a.getBoard().setSelectedBlock(a); }; - b.getValueBlock = function() { - return this._valueBlock; + a._bindRenderOptions = function() { + var a = this; + $(this.svgGroup).bind("mouseup touchend", function(c) { + a._isEditable() && (a.destroyOption(), a._startValue = a.getValue(), a.renderOptions()); + }); }; - b.pointer = function(a) { + a.pointer = function(a) { + a = a || []; a.unshift(this._index); a.unshift(Entry.PARAM); return this._block.pointer(a); }; -})(Entry.FieldOutput.prototype); -Entry.FieldStatement = function(b, a, c) { +})(Entry.Field.prototype); +Entry.FieldBlock = function(a, b, c, d, e) { Entry.Model(this, !1); - this._blockView = a; - this.block = a.block; - this.view = this; - this._index = c; - this.acceptType = b.accept; - this._thread = this.statementSvgGroup = this.svgGroup = null; - this._position = b.position; - this.observe(a, "alignContent", ["height"], !1); - this.observe(this, "_updateBG", ["magneting"], !1); - this.renderStart(a.getBoard()); -}; -(function(b) { - b.schema = {x:0, y:0, width:100, height:20, magneting:!1}; - b.magnet = {next:{x:0, y:0}}; - b.renderStart = function(a) { - this.svgGroup = this._blockView.statementSvgGroup.elem("g"); - this._nextGroup = this.statementSvgGroup = this.svgGroup.elem("g"); - this._initThread(a); - this._board = a; - }; - b._initThread = function(a) { - var b = this.getValue(); - this._thread = b; - b.createView(a); - b.view.setParent(this); - if (a = b.getFirstBlock()) { - a.view._toLocalCoordinate(this.statementSvgGroup), this.firstBlock = a; - } - b.changeEvent.attach(this, this.calcHeight); - b.changeEvent.attach(this, this.checkTopBlock); - this.calcHeight(); - }; - b.align = function(a, b, d) { - d = void 0 === d ? !0 : d; - var e = this.svgGroup; - this._position && (this._position.x && (a = this._position.x), this._position.y && (b = this._position.y)); - var f = "translate(" + a + "," + b + ")"; - this.set({x:a, y:b}); - d ? e.animate({transform:f}, 300, mina.easeinout) : e.attr({transform:f}); - }; - b.calcHeight = function() { - var a = this._thread.view.requestPartHeight(null); - this.set({height:a}); - }; - b.getValue = function() { - return this.block.statements[this._index]; - }; - b.requestAbsoluteCoordinate = function() { - var a = this._blockView.getAbsoluteCoordinate(); - a.x += this.x; - a.y += this.y; - return a; - }; - b.dominate = function() { - this._blockView.dominate(); - }; - b.destroy = function() { - }; - b._updateBG = function() { - if (this._board.dragBlock && this._board.dragBlock.dragInstance) { - if (this.magneting) { - var a = this._board.dragBlock.getShadow(), b = this.requestAbsoluteCoordinate(), b = "translate(" + b.x + "," + b.y + ")"; - $(a).attr({transform:b, display:"block"}); - this._clonedShadow = a; - this.background && (this.background.remove(), this.nextBackground.remove(), delete this.background, delete this.nextBackground); - a = this._board.dragBlock.getBelowHeight(); - this.statementSvgGroup.attr({transform:"translate(0," + a + ")"}); - this.set({height:this.height + a}); - } else { - this._clonedShadow && (this._clonedShadow.attr({display:"none"}), delete this._clonedShadow), a = this.originalHeight, void 0 !== a && (this.background && (this.background.remove(), this.nextBackground.remove(), delete this.background, delete this.nextBackground), delete this.originalHeight), this.statementSvgGroup.attr({transform:"translate(0,0)"}), this.calcHeight(); - } - (a = this.block.thread.changeEvent) && a.notify(); - } - }; - b.insertTopBlock = function(a) { - this._posObserver && this._posObserver.destroy(); - var b = this.firstBlock; - (this.firstBlock = a) && a.doInsert(this._thread); - return b; - }; - b.getNextBlock = function() { - return this.firstBlock; - }; - b.checkTopBlock = function() { - var a = this._thread.getFirstBlock(); - a && this.firstBlock !== a ? (this.firstBlock = a, a.view.bindPrev(this), a._updatePos()) : a || (this.firstBlock = null); - }; -})(Entry.FieldStatement.prototype); -Entry.FieldText = function(b, a, c) { - this._block = a.block; - this._blockView = a; - this._index = c; - this.box = new Entry.BoxModel; - this._fontSize = b.fontSize || a.getSkeleton().fontSize || 12; - this._color = b.color || this._block.getSchema().fontColor || a.getSkeleton().color || "white"; - this._align = b.align || "left"; - this._text = this.getValue() || b.text; - this.setValue(null); - this.textElement = null; - this.renderStart(a); -}; -Entry.Utils.inherit(Entry.Field, Entry.FieldText); -(function(b) { - b.renderStart = function() { - this.svgGroup && $(this.svgGroup).remove(); - this.svgGroup = this._blockView.contentSvgGroup.elem("g"); - this._text = this._text.replace(/(\r\n|\n|\r)/gm, " "); - this.textElement = this.svgGroup.elem("text").attr({style:"white-space: pre;", "font-size":this._fontSize + "px", "font-family":"nanumBarunRegular", "class":"dragNone", fill:this._color}); - this.textElement.textContent = this._text; - var a = 0, b = this.textElement.getBoundingClientRect(); - "center" == this._align && (a = -b.width / 2); - this.textElement.attr({x:a, y:.25 * b.height}); - this.box.set({x:0, y:0, width:b.width, height:b.height}); - }; -})(Entry.FieldText.prototype); -Entry.FieldTextInput = function(b, a, c) { - this._blockView = a; - this._block = a.block; + this._blockView = b; + this._block = b.block; + this._valueBlock = null; this.box = new Entry.BoxModel; - this.svgGroup = null; - this.position = b.position; - this._contents = b; + this.changeEvent = new Entry.Event(this); this._index = c; - this.value = this.getValue() || ""; - this.renderStart(); + this.contentIndex = e; + this._content = a; + this.acceptType = a.accept; + this._restoreCurrent = a.restore; + this.view = this; + this.svgGroup = null; + this._position = a.position; + this.box.observe(b, "alignContent", ["width", "height"]); + this.observe(this, "_updateBG", ["magneting"], !1); + this.renderStart(b.getBoard(), d); }; -Entry.Utils.inherit(Entry.Field, Entry.FieldTextInput); -(function(b) { - b.renderStart = function() { - this.svgGroup && $(this.svgGroup).remove(); +Entry.Utils.inherit(Entry.Field, Entry.FieldBlock); +(function(a) { + a.schema = {magneting:!1}; + a.renderStart = function(a, c) { this.svgGroup = this._blockView.contentSvgGroup.elem("g"); - this.svgGroup.attr({class:"entry-input-field"}); - this.textElement = this.svgGroup.elem("text", {x:3, y:4, "font-size":"12px"}); - this.textElement.textContent = this.truncate(); - var a = this.getTextWidth(), b = this.position && this.position.y ? this.position.y : 0; - this._header = this.svgGroup.elem("rect", {width:a, height:16, y:b - 8, rx:3, ry:3, fill:"transparent"}); - this.svgGroup.appendChild(this.textElement); - this._bindRenderOptions(); - this.box.set({x:0, y:0, width:a, height:16}); - }; - b.renderOptions = function() { - var a = this; - this._attachDisposeEvent(function() { - a.applyValue(); - a.destroyOption(); - }); - this.optionGroup = Entry.Dom("input", {class:"entry-widget-input-field", parent:$("body")}); - this.optionGroup.val(this.getValue()); - this.optionGroup.on("mousedown", function(a) { - a.stopPropagation(); - }); - this.optionGroup.on("keyup", function(b) { - var c = b.keyCode || b.which; - a.applyValue(b); - -1 < [13, 27].indexOf(c) && a.destroyOption(); - }); - var b = this.getAbsolutePosFromDocument(); - b.y -= this.box.height / 2; - this.optionGroup.css({height:16, left:b.x, top:b.y, width:a.box.width}); - this.optionGroup.focus(); - b = this.optionGroup[0]; - b.setSelectionRange(0, b.value.length, "backward"); + 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, c), d.getThread().view.setParent(this)); + this.updateValueBlock(d); + this._blockView.getBoard().constructor !== Entry.Board && this._valueBlock.view.removeControl(); }; - b.applyValue = function(a) { - a = this.optionGroup.val(); - this.setValue(a); - this.textElement.textContent = this.truncate(); - this.resize(); + a.align = function(a, c, d) { + var e = this.svgGroup; + this._position && (this._position.x && (a = this._position.x), this._position.y && (c = this._position.y)); + var f = this._valueBlock; + f && (c = -.5 * f.view.height); + f = "translate(" + a + "," + c + ")"; + void 0 === d || d ? e.animate({transform:f}, 300, mina.easeinout) : e.attr({transform:f}); + this.box.set({x:a, y:c}); }; - b.resize = function() { - var a = this.getTextWidth(); - this._header.attr({width:a}); - this.optionGroup.css({width:a}); - this.box.set({width:a}); - this._blockView.alignContent(); + a.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.getTextWidth = function() { - return this.textElement.getComputedTextLength() + 6 + 2; + a.calcHeight = a.calcWH; + a.destroy = function() { }; -})(Entry.FieldTextInput.prototype); -Entry.GlobalSvg = {}; -(function(b) { - b.DONE = 0; - b._inited = !1; - b.REMOVE = 1; - b.RETURN = 2; - b.createDom = function() { - if (!this.inited) { - $("#globalSvgSurface").remove(); - $("#globalSvg").remove(); - var a = $("body"); - this._container = Entry.Dom("div", {classes:["globalSvgSurface", "entryRemove"], id:"globalSvgSurface", parent:a}); - this.svgDom = Entry.Dom($(''), {parent:this._container}); - this.svg = Entry.SVG("globalSvg"); - this.top = this.left = 0; - this._inited = !0; + a.inspectBlock = function() { + var a = null; + if (this._originBlock) { + a = this._originBlock.type, delete this._originBlock; + } else { + switch(this.acceptType) { + case "boolean": + a = "True"; + break; + case "string": + a = "text"; + break; + case "param": + a = "function_field_label"; + } } + return this._createBlockByType(a); }; - b.setView = function(a, b) { - if (a != this._view && !a.block.isReadOnly() && a.movable) { - return this._view = a, this._mode = b, b !== Entry.Workspace.MODE_VIMBOARD && a.set({visible:!1}), this.draw(), this.show(), this.align(), this.position(), !0; - } + a._setValueBlock = function(a) { + this._restoreCurrent && (this._originBlock = this._valueBlock); + a || (a = this.inspectBlock()); + this._valueBlock = a; + this.setValue(a); + a.setThread(this); + a.getThread().view.setParent(this); + return this._valueBlock; }; - b.draw = function() { - var a = this._view; - this._svg && this.remove(); - var b = this._mode == Entry.Workspace.MODE_VIMBOARD; - this.svgGroup = Entry.SVG.createElement(a.svgGroup.cloneNode(!0), {opacity:1}); - this.svg.appendChild(this.svgGroup); - b && (a = $(this.svgGroup), a.find("g").css({filter:"none"}), a.find("path").velocity({opacity:0}, {duration:500}), a.find("text").velocity({fill:"#000000"}, {duration:530})); + a.getValueBlock = function() { + return this._valueBlock; }; - b.remove = function() { - this.svgGroup && (this.svgGroup.remove(), delete this.svgGroup, delete this._view, delete this._offsetX, delete this._offsetY, delete this._startX, delete this._startY, this.hide()); + a.updateValueBlock = function(a) { + a instanceof Entry.Block || (a = void 0); + this._destroyObservers(); + a = this._setValueBlock(a).view; + a.bindPrev(this); + this._blockView.alignContent(); + this._posObserver = a.observe(this, "updateValueBlock", ["x", "y"], !1); + this._sizeObserver = a.observe(this, "calcWH", ["width", "height"]); + a = this._blockView.getBoard(); + a.constructor === Entry.Board && a.generateCodeMagnetMap(); }; - b.align = function() { - var a = this._view.getSkeleton().box(this._view).offsetX || 0, b = this._view.getSkeleton().box(this._view).offsetY || 0, a = -1 * a + 1, b = -1 * b + 1; - this._offsetX = a; - this._offsetY = b; - this.svgGroup.attr({transform:"translate(" + a + "," + b + ")"}); + a._destroyObservers = function() { + this._sizeObserver && this._sizeObserver.destroy(); + this._posObserver && this._posObserver.destroy(); }; - b.show = function() { - this._container.removeClass("entryRemove"); + a.getPrevBlock = function(a) { + return this._valueBlock === a ? this : null; }; - b.hide = function() { - this._container.addClass("entryRemove"); + a.getNextBlock = function() { + return null; }; - b.position = function() { - var a = this._view; - if (a) { - var b = a.getAbsoluteCoordinate(), a = a.getBoard().offset(); - this.left = b.x + a.left - this._offsetX; - this.top = b.y + a.top - this._offsetY; - this.svgDom.css({transform:"translate3d(" + this.left + "px," + this.top + "px, 0px)"}); - } + a.requestAbsoluteCoordinate = function(a) { + a = this._blockView; + var c = a.contentPos; + a = a.getAbsoluteCoordinate(); + a.x += this.box.x + c.x; + a.y += this.box.y + c.y; + return a; }; - b.terminateDrag = function(a) { - var b = Entry.mouseCoordinate, d = a.getBoard(), e = d.workspace.blockMenu, f = e.offset().left, g = e.offset().top, h = e.visible ? e.svgDom.width() : 0; - return b.y > d.offset().top - 20 && b.x > f + h ? this.DONE : b.y > g && b.x > f && e.visible ? a.block.isDeletable() ? this.REMOVE : this.RETURN : this.RETURN; + a.dominate = function() { + this._blockView.dominate(); }; - b.addControl = function(a) { - this.onMouseDown.apply(this, arguments); + a.isGlobal = function() { + return !1; }; - b.onMouseDown = function(a) { - function b(a) { - var c = a.pageX; - a = a.pageY; - var d = e.left + (c - e._startX), f = e.top + (a - e._startY); - e.svgDom.css({left:d, top:f}); - e._startX = c; - e._startY = a; - e.left = d; - e.top = f; - } - function d(a) { - $(document).unbind(".block"); - } - this._startY = a.pageY; - var e = this; - a.stopPropagation(); - a.preventDefault(); - var f = $(document); - f.bind("mousemove.block", b); - f.bind("mouseup.block", d); - f.bind("touchmove.block", b); - f.bind("touchend.block", d); - this._startX = a.pageX; - this._startY = a.pageY; + a.separate = function(a) { + this.getCode().createThread([a]); + this.calcWH(); + this.changeEvent.notify(); }; -})(Entry.GlobalSvg); -Entry.Mutator = function() { -}; -(function(b) { - b.mutate = function(a, b) { - var d = Entry.block[a]; - void 0 === d.changeEvent && (d.changeEvent = new Entry.Event); - d.template = b.template; - d.params = b.params; - d.changeEvent.notify(1); + a.getCode = function() { + return this._block.thread.getCode(); }; -})(Entry.Mutator); -(function(b) { -})(Entry.Mutator.prototype); -Entry.RenderView = function(b, a) { - this._align = a || "CENTER"; - b = "string" === typeof b ? $("#" + b) : $(b); - if ("DIV" !== b.prop("tagName")) { - return console.error("Dom is not div element"); - } - this.view = b; - this.viewOnly = !0; - this.suffix = "renderView"; - this.disableMouseEvent = this.visible = !0; - this._svgId = "renderView_" + (new Date).getTime(); - this._generateView(); - this.offset = this.svgDom.offset(); - this.setWidth(); - this.svg = Entry.SVG(this._svgId); - Entry.Utils.addFilters(this.svg, this.suffix); - this.svg && (this.svgGroup = this.svg.elem("g"), this.svgThreadGroup = this.svgGroup.elem("g"), this.svgThreadGroup.board = this, this.svgBlockGroup = this.svgGroup.elem("g"), this.svgBlockGroup.board = this); -}; -(function(b) { - b.schema = {code:null, dragBlock:null, closeBlock:null, selectedBlockView:null}; - b._generateView = function() { - this.renderViewContainer = Entry.Dom("div", {"class":"renderViewContainer", parent:this.view}); - this.svgDom = Entry.Dom($(''), {parent:this.renderViewContainer}); + a.cut = function(a) { + return this._valueBlock === a ? [a] : null; }; - b.changeCode = function(a) { - if (!(a instanceof Entry.Code)) { - return console.error("You must inject code instance"); - } - this.code = a; - this.svg || (this.svg = Entry.SVG(this._svgId), this.svgGroup = this.svg.elem("g"), this.svgThreadGroup = this.svgGroup.elem("g"), this.svgThreadGroup.board = this, this.svgBlockGroup = this.svgGroup.elem("g"), this.svgBlockGroup.board = this); - a.createView(this); - this.align(); - this.resize(); + a.replace = function(a) { + "string" === typeof a && (a = this._createBlockByType(a)); + var c = this._valueBlock; + Entry.block[c.type].isPrimitive ? (c.doNotSplice = !0, c.destroy()) : "param" === this.acceptType ? (this._destroyObservers(), c.view._toGlobalCoordinate(), a.getTerminateOutputBlock().view._contents[1].replace(c)) : (this._destroyObservers(), c.view._toGlobalCoordinate(), this.separate(c), c.view.bumpAway(30, 150)); + this.updateValueBlock(a); + a.view._toLocalCoordinate(this.svgGroup); + this.calcWH(); + this.changeEvent.notify(); }; - b.align = function() { - var a = this.code.getThreads(); - if (a && 0 !== a.length) { - for (var b = 0, d = "LEFT" == this._align ? 20 : this.svgDom.width() / 2, e = 0, f = a.length;e < f;e++) { - var g = a[e].getFirstBlock().view; - g._moveTo(d, b - g.offsetY, !1); - g = g.svgGroup.getBBox().height; - b += g + 15; - } - this._bBox = this.svgGroup.getBBox(); - this.height = this._bBox.height; - } + a.setParent = function(a) { + this._parent = a; }; - b.hide = function() { - this.view.addClass("entryRemove"); + a.getParent = function() { + return this._parent; }; - b.show = function() { - this.view.removeClass("entryRemove"); + a._createBlockByType = function(a) { + this._block.getThread(); + var c = this._blockView.getBoard(); + a = new Entry.Block({type:a}, this); + var d = c.workspace, e; + d && (e = d.getMode()); + a.createView(c, e); + return a; }; - b.setWidth = function() { - this._svgWidth = this.svgDom.width(); - this.offset = this.svgDom.offset(); + a.spliceBlock = function() { + this.updateValueBlock(); }; - b.bindCodeView = function(a) { - this.svgBlockGroup.remove(); - this.svgThreadGroup.remove(); - this.svgBlockGroup = a.svgBlockGroup; - this.svgThreadGroup = a.svgThreadGroup; - this.svgGroup.appendChild(this.svgThreadGroup); - this.svgGroup.appendChild(this.svgBlockGroup); + a._updateBG = function() { + this.magneting ? this._bg = this.svgGroup.elem("path", {d:"m 8,12 l -4,0 -2,-2 0,-3 3,0 1,-1 0,-12 -1,-1 -3,0 0,-3 2,-2 l 4,0 z", fill:"#fff", stroke:"#fff", "fill-opacity":.7, transform:"translate(0,12)"}) : this._bg && (this._bg.remove(), delete this._bg); }; - b.resize = function() { - this.svg && this._bBox && $(this.svg).css("height", this._bBox.height + 10); + a.getThread = function() { + return this; }; -})(Entry.RenderView.prototype); -Entry.Scroller = function(b, a, c) { - this._horizontal = void 0 === a ? !0 : a; + a.pointer = function(a) { + a.unshift(this._index); + a.unshift(Entry.PARAM); + return this._block.pointer(a); + }; +})(Entry.FieldBlock.prototype); +Entry.Scroller = function(a, b, c) { + this._horizontal = void 0 === b ? !0 : b; this._vertical = void 0 === c ? !0 : c; - this.board = b; + this.board = a; this.svgGroup = null; this.vRatio = this.vY = this.vWidth = this.hRatio = this.hX = this.hWidth = 0; this._visible = !0; @@ -17895,93 +18652,93 @@ Entry.Scroller = function(b, a, c) { this._scrollCommand = _.debounce(Entry.do, 200); }; Entry.Scroller.RADIUS = 7; -(function(b) { - b.createScrollBar = function() { - var a = Entry.Scroller.RADIUS, b = this; +(function(a) { + a.createScrollBar = function() { + var a = Entry.Scroller.RADIUS, c = this; this.svgGroup = this.board.svg.elem("g").attr({class:"boardScrollbar"}); this._horizontal && (this.hScrollbar = this.svgGroup.elem("rect", {height:2 * a, rx:a, ry:a}), this.hScrollbar.mousedown = function(a) { - function e(a) { + function b(a) { a.stopPropagation(); a.preventDefault(); a.originalEvent.touches && (a = a.originalEvent.touches[0]); - var d = b.dragInstance; - b.scroll((a.pageX - d.offsetX) / b.hRatio, 0); + var d = c.dragInstance; + c.scroll((a.pageX - d.offsetX) / c.hRatio, 0); d.set({offsetX:a.pageX, offsetY:a.pageY}); } function f(a) { $(document).unbind(".scroll"); - delete b.dragInstance; + delete c.dragInstance; } if (0 === a.button || a instanceof Touch) { Entry.documentMousedown && Entry.documentMousedown.notify(a); var g = $(document); - g.bind("mousemove.scroll", e); + g.bind("mousemove.scroll", b); g.bind("mouseup.scroll", f); - g.bind("touchmove.scroll", e); + g.bind("touchmove.scroll", b); g.bind("touchend.scroll", f); - b.dragInstance = new Entry.DragInstance({startX:a.pageX, startY:a.pageY, offsetX:a.pageX, offsetY:a.pageY}); + c.dragInstance = new Entry.DragInstance({startX:a.pageX, startY:a.pageY, offsetX:a.pageX, offsetY:a.pageY}); } a.stopPropagation(); }); this._vertical && (this.vScrollbar = this.svgGroup.elem("rect", {width:2 * a, rx:a, ry:a}), this.vScrollbar.mousedown = function(a) { - function e(a) { + function b(a) { a.stopPropagation(); a.preventDefault(); a.originalEvent.touches && (a = a.originalEvent.touches[0]); - var d = b.dragInstance; - b.scroll(0, (a.pageY - d.offsetY) / b.vRatio); + var d = c.dragInstance; + c.scroll(0, (a.pageY - d.offsetY) / c.vRatio); d.set({offsetX:a.pageX, offsetY:a.pageY}); } function f(a) { $(document).unbind(".scroll"); - delete b.dragInstance; + delete c.dragInstance; } if (0 === a.button || a instanceof Touch) { Entry.documentMousedown && Entry.documentMousedown.notify(a); var g = $(document); - g.bind("mousemove.scroll", e); + g.bind("mousemove.scroll", b); g.bind("mouseup.scroll", f); - g.bind("touchmove.scroll", e); + g.bind("touchmove.scroll", b); g.bind("touchend.scroll", f); - b.dragInstance = new Entry.DragInstance({startX:a.pageX, startY:a.pageY, offsetX:a.pageX, offsetY:a.pageY}); + c.dragInstance = new Entry.DragInstance({startX:a.pageX, startY:a.pageY, offsetX:a.pageX, offsetY:a.pageY}); } a.stopPropagation(); }); }; - b.updateScrollBar = function(a, b) { + a.updateScrollBar = function(a, c) { this._horizontal && (this.hX += a * this.hRatio, this.hScrollbar.attr({x:this.hX})); - this._vertical && (this.vY += b * this.vRatio, this.vScrollbar.attr({y:this.vY})); + this._vertical && (this.vY += c * this.vRatio, this.vScrollbar.attr({y:this.vY})); }; - b.scroll = function(a, b) { + a.scroll = function(a, c) { if (this.board.code) { var d = this.board.svgBlockGroup.getBoundingClientRect(), e = this.board.svgDom, f = d.left - this.board.offset().left, g = d.top - this.board.offset().top, h = d.height; a = Math.max(-d.width + Entry.BOARD_PADDING - f, a); - b = Math.max(-h + Entry.BOARD_PADDING - g, b); + c = Math.max(-h + Entry.BOARD_PADDING - g, c); a = Math.min(e.width() - Entry.BOARD_PADDING - f, a); - b = Math.min(e.height() - Entry.BOARD_PADDING - g, b); - this._scroll(a, b); + c = Math.min(e.height() - Entry.BOARD_PADDING - g, c); + this._scroll(a, c); this._diffs || (this._diffs = [0, 0]); this._diffs[0] += a; - this._diffs[1] += b; + this._diffs[1] += c; this._scrollCommand("scrollBoard", this._diffs[0], this._diffs[1], !0); } }; - b._scroll = function(a, b) { - this.board.code.moveBy(a, b); - this.updateScrollBar(a, b); + a._scroll = function(a, c) { + this.board.code.moveBy(a, c); + this.updateScrollBar(a, c); }; - b.setVisible = function(a) { + a.setVisible = function(a) { a != this.isVisible() && (this._visible = a, this.svgGroup.attr({display:!0 === a ? "block" : "none"})); }; - b.isVisible = function() { + a.isVisible = function() { return this._visible; }; - b.setOpacity = function(a) { + a.setOpacity = function(a) { this._opacity != a && (this.hScrollbar.attr({opacity:a}), this.vScrollbar.attr({opacity:a}), this._opacity = a); }; - b.resizeScrollBar = function() { + a.resizeScrollBar = function() { if (this._visible) { - var a = this.board, b = a.svgBlockGroup.getBoundingClientRect(), d = a.svgDom, e = d.width(), d = d.height(), f = b.left - a.offset().left, a = b.top - a.offset().top, g = b.width, b = b.height; + var a = this.board, c = a.svgBlockGroup.getBoundingClientRect(), d = a.svgDom, e = d.width(), d = d.height(), f = c.left - a.offset().left, a = c.top - a.offset().top, g = c.width, c = c.height; if (this._horizontal) { var h = -g + Entry.BOARD_PADDING, k = e - Entry.BOARD_PADDING, g = (e + 2 * Entry.Scroller.RADIUS) * g / (k - h + g); isNaN(g) && (g = 0); @@ -17989,19 +18746,19 @@ Entry.Scroller.RADIUS = 7; this.hScrollbar.attr({width:g, x:this.hX, y:d - 2 * Entry.Scroller.RADIUS}); this.hRatio = (e - g - 2 * Entry.Scroller.RADIUS) / (k - h); } - this._vertical && (f = -b + Entry.BOARD_PADDING, g = d - Entry.BOARD_PADDING, b = (d + 2 * Entry.Scroller.RADIUS) * b / (g - f + b), this.vY = (a - f) / (g - f) * (d - b - 2 * Entry.Scroller.RADIUS), this.vScrollbar.attr({height:b, y:this.vY, x:e - 2 * Entry.Scroller.RADIUS}), this.vRatio = (d - b - 2 * Entry.Scroller.RADIUS) / (g - f)); + this._vertical && (f = -c + Entry.BOARD_PADDING, g = d - Entry.BOARD_PADDING, c = (d + 2 * Entry.Scroller.RADIUS) * c / (g - f + c), this.vY = (a - f) / (g - f) * (d - c - 2 * Entry.Scroller.RADIUS), this.vScrollbar.attr({height:c, y:this.vY, x:e - 2 * Entry.Scroller.RADIUS}), this.vRatio = (d - c - 2 * Entry.Scroller.RADIUS) / (g - f)); } }; - b._bindEvent = function() { + a._bindEvent = function() { var a = _.debounce(this.resizeScrollBar, 200); this.board.changeEvent.attach(this, a); Entry.windowResized && Entry.windowResized.attach(this, a); }; })(Entry.Scroller.prototype); -Entry.Board = function(b) { +Entry.Board = function(a) { Entry.Model(this, !1); this.changeEvent = new Entry.Event(this); - this.createView(b); + this.createView(a); this.updateOffset(); this.scroller = new Entry.Scroller(this, !0, !0); this._magnetMap = {}; @@ -18016,18 +18773,18 @@ Entry.Board.OPTION_PASTE = 0; Entry.Board.OPTION_ALIGN = 1; Entry.Board.OPTION_CLEAR = 2; Entry.Board.OPTION_DOWNLOAD = 3; -(function(b) { - b.schema = {code:null, dragBlock:null, magnetedBlockView:null, selectedBlockView:null}; - b.createView = function(a) { - var b = a.dom, b = "string" === typeof b ? $("#" + b) : $(b); - if ("DIV" !== b.prop("tagName")) { +(function(a) { + a.schema = {code:null, dragBlock:null, magnetedBlockView:null, selectedBlockView:null}; + a.createView = function(a) { + var c = a.dom, c = "string" === typeof c ? $("#" + c) : $(c); + if ("DIV" !== c.prop("tagName")) { return console.error("Dom is not div element"); } - this.view = b; + this.view = c; this._svgId = "play" + (new Date).getTime(); this.workspace = a.workspace; this._activatedBlockView = null; - this.wrapper = Entry.Dom("div", {parent:b, class:"entryBoardWrapper"}); + this.wrapper = Entry.Dom("div", {parent:c, class:"entryBoardWrapper"}); this.svgDom = Entry.Dom($(''), {parent:this.wrapper}); this.visible = !0; var d = this; @@ -18046,16 +18803,16 @@ Entry.Board.OPTION_DOWNLOAD = 3; this.patternRect = a.rect; this.pattern = a.pattern; }; - b.changeCode = function(a) { + a.changeCode = function(a) { this.code && this.codeListener && this.code.changeEvent.detach(this.codeListener); this.set({code:a}); - var b = this; + var c = this; a && (this.codeListener = this.code.changeEvent.attach(this, function() { - b.changeEvent.notify(); + c.changeEvent.notify(); }), a.createView(this)); this.scroller.resizeScrollBar(); }; - b.bindCodeView = function(a) { + a.bindCodeView = function(a) { this.svgBlockGroup.remove(); this.svgThreadGroup.remove(); this.svgBlockGroup = a.svgBlockGroup; @@ -18063,7 +18820,7 @@ Entry.Board.OPTION_DOWNLOAD = 3; this.svgGroup.appendChild(this.svgThreadGroup); this.svgGroup.appendChild(this.svgBlockGroup); }; - b.setMagnetedBlock = function(a, b) { + a.setMagnetedBlock = function(a, c) { if (this.magnetedBlockView) { if (this.magnetedBlockView === a) { return; @@ -18071,40 +18828,40 @@ Entry.Board.OPTION_DOWNLOAD = 3; this.magnetedBlockView.set({magneting:!1}); } this.set({magnetedBlockView:a}); - a && (a.set({magneting:b}), a.dominate()); + a && (a.set({magneting:c}), a.dominate()); }; - b.getCode = function() { + a.getCode = function() { return this.code; }; - b.findById = function(a) { + a.findById = function(a) { return this.code.findById(a); }; - b._addControl = function() { - var a = this.svgDom, b = this; + a._addControl = function() { + var a = this.svgDom, c = this; a.mousedown(function() { - b.onMouseDown.apply(b, arguments); + c.onMouseDown.apply(c, arguments); }); a.bind("touchstart", function() { - b.onMouseDown.apply(b, arguments); + c.onMouseDown.apply(c, arguments); }); a.on("wheel", function() { - b.mouseWheel.apply(b, arguments); + c.mouseWheel.apply(c, arguments); }); - var d = b.scroller; + var d = c.scroller; d && (a.mouseenter(function(a) { d.setOpacity(1); }), a.mouseleave(function(a) { d.setOpacity(0); })); }; - b.onMouseDown = function(a) { - function b(a) { + a.onMouseDown = function(a) { + function c(a) { a.stopPropagation && a.stopPropagation(); a.preventDefault && a.preventDefault(); a = a.originalEvent && a.originalEvent.touches ? a.originalEvent.touches[0] : a; - var c = f.dragInstance; - f.scroller.scroll(a.pageX - c.offsetX, a.pageY - c.offsetY); - c.set({offsetX:a.pageX, offsetY:a.pageY}); + var b = f.dragInstance; + f.scroller.scroll(a.pageX - b.offsetX, a.pageY - b.offsetY); + b.set({offsetX:a.pageX, offsetY:a.pageY}); } function d(a) { $(document).unbind(".entryBoard"); @@ -18117,9 +18874,9 @@ Entry.Board.OPTION_DOWNLOAD = 3; a = a.originalEvent && a.originalEvent.touches ? a.originalEvent.touches[0] : a; Entry.documentMousedown && Entry.documentMousedown.notify(a); var e = $(document); - e.bind("mousemove.entryBoard", b); + e.bind("mousemove.entryBoard", c); e.bind("mouseup.entryBoard", d); - e.bind("touchmove.entryBoard", b); + e.bind("touchmove.entryBoard", c); e.bind("touchend.entryBoard", d); this.dragInstance = new Entry.DragInstance({startX:a.pageX, startY:a.pageY, offsetX:a.pageX, offsetY:a.pageY}); } else { @@ -18139,34 +18896,34 @@ Entry.Board.OPTION_DOWNLOAD = 3; var f = this; } }; - b.mouseWheel = function(a) { + a.mouseWheel = function(a) { a = a.originalEvent; a.preventDefault(); - var b = Entry.disposeEvent; - b && b.notify(a); + var c = Entry.disposeEvent; + c && c.notify(a); this.scroller.scroll(a.wheelDeltaX || -a.deltaX, a.wheelDeltaY || -a.deltaY); }; - b.setSelectedBlock = function(a) { - var b = this.selectedBlockView; - b && b.removeSelected(); + a.setSelectedBlock = function(a) { + var c = this.selectedBlockView; + c && c.removeSelected(); a instanceof Entry.BlockView ? a.addSelected() : a = null; this.set({selectedBlockView:a}); }; - b._keyboardControl = function(a) { - var b = this.selectedBlockView; - b && 46 == a.keyCode && b.block && (Entry.do("destroyBlock", b.block), this.set({selectedBlockView:null})); + a._keyboardControl = function(a) { + var c = this.selectedBlockView; + c && 46 == a.keyCode && c.block && (Entry.do("destroyBlock", c.block), this.set({selectedBlockView:null})); }; - b.hide = function() { + a.hide = function() { this.wrapper.addClass("entryRemove"); this.visible = !1; }; - b.show = function() { + a.show = function() { this.wrapper.removeClass("entryRemove"); this.visible = !0; }; - b.alignThreads = function() { - for (var a = this.svgDom.height(), b = this.code.getThreads(), d = 15, e = 0, a = a - 30, f = 50, g = 0;g < b.length;g++) { - var h = b[g].getFirstBlock(); + a.alignThreads = function() { + for (var a = this.svgDom.height(), c = this.code.getThreads(), d = 15, e = 0, a = a - 30, f = 50, g = 0;g < c.length;g++) { + var h = c[g].getFirstBlock(); if (h) { var h = h.view, k = h.svgGroup.getBBox(), l = d + 15; l > a && (f = f + e + 10, e = 0, d = 15); @@ -18178,48 +18935,48 @@ Entry.Board.OPTION_DOWNLOAD = 3; } this.scroller.resizeScrollBar(); }; - b.clear = function() { + a.clear = function() { this.svgBlockGroup.remove(); this.svgThreadGroup.remove(); }; - b.updateOffset = function() { + a.updateOffset = function() { this._offset = this.svg.getBoundingClientRect(); - var a = $(window), b = a.scrollTop(), a = a.scrollLeft(), d = this._offset; - this.relativeOffset = {top:d.top - b, left:d.left - a}; + var a = $(window), c = a.scrollTop(), a = a.scrollLeft(), d = this._offset; + this.relativeOffset = {top:d.top - c, left:d.left - a}; this.btnWrapper && this.btnWrapper.attr({transform:"translate(" + (d.width / 2 - 65) + "," + (d.height - 200) + ")"}); }; - b.generateButtons = function() { - var a = this, b = this.svgGroup.elem("g"); - this.btnWrapper = b; - var d = b.elem("text", {x:27, y:33, class:"entryFunctionButtonText"}); + a.generateButtons = function() { + var a = this, c = this.svgGroup.elem("g"); + this.btnWrapper = c; + var d = c.elem("text", {x:27, y:33, class:"entryFunctionButtonText"}); d.textContent = Lang.Buttons.save; - var e = b.elem("text", {x:102.5, y:33, class:"entryFunctionButtonText"}); + var e = c.elem("text", {x:102.5, y:33, class:"entryFunctionButtonText"}); e.textContent = Lang.Buttons.cancel; - var f = b.elem("circle", {cx:27.5, cy:27.5, r:27.5, class:"entryFunctionButton"}), b = b.elem("circle", {cx:102.5, cy:27.5, r:27.5, class:"entryFunctionButton"}); + var f = c.elem("circle", {cx:27.5, cy:27.5, r:27.5, class:"entryFunctionButton"}), c = c.elem("circle", {cx:102.5, cy:27.5, r:27.5, class:"entryFunctionButton"}); $(f).bind("mousedown touchstart", function() { a.save(); }); $(d).bind("mousedown touchstart", function() { a.save(); }); - $(b).bind("mousedown touchstart", function() { + $(c).bind("mousedown touchstart", function() { a.cancelEdit(); }); $(e).bind("mousedown touchstart", function() { a.cancelEdit(); }); }; - b.cancelEdit = function() { + a.cancelEdit = function() { this.workspace.setMode(Entry.Workspace.MODE_BOARD, "cancelEdit"); }; - b.save = function() { + a.save = function() { this.workspace.setMode(Entry.Workspace.MODE_BOARD, "save"); }; - b.generateCodeMagnetMap = function() { + a.generateCodeMagnetMap = function() { var a = this.code; if (a && this.dragBlock) { - for (var b in this.dragBlock.magnet) { - var d = this._getCodeBlocks(a, b); + for (var c in this.dragBlock.magnet) { + var d = this._getCodeBlocks(a, c); d.sort(function(a, b) { return a.point - b.point; }); @@ -18234,44 +18991,45 @@ Entry.Board.OPTION_DOWNLOAD = 3; f.endPoint = Number.MAX_VALUE; d[e - 1].endPoint = f.point; } - this._magnetMap[b] = d; + this._magnetMap[c] = d; } } }; - b._getCodeBlocks = function(a, b) { - var d = a.getThreads(), e = [], f; - switch(b) { + a._getCodeBlocks = function(a, c) { + a = a.getThreads(); + var d = [], e; + switch(c) { case "previous": - f = this._getNextMagnets; + e = this._getNextMagnets; break; case "next": - f = this._getPreviousMagnets; + e = this._getPreviousMagnets; break; case "string": - f = this._getFieldMagnets; + e = this._getFieldMagnets; break; case "boolean": - f = this._getFieldMagnets; + e = this._getFieldMagnets; break; case "param": - f = this._getOutputMagnets; + e = this._getOutputMagnets; break; default: return []; } - for (var g = 0;g < d.length;g++) { - var h = d[g], e = e.concat(f.call(this, h, h.view.zIndex, null, b)) + for (var f = 0;f < a.length;f++) { + var g = a[f], d = d.concat(e.call(this, g, g.view.zIndex, null, c)) } - return e; + return d; }; - b._getNextMagnets = function(a, b, d, e) { + a._getNextMagnets = function(a, c, d, e) { var f = a.getBlocks(), g = [], h = []; d || (d = {x:0, y:0}); var k = d.x; d = d.y; for (var l = 0;l < f.length;l++) { var q = f[l], n = q.view; - n.zIndex = b; + n.zIndex = c; if (n.dragInstance) { break; } @@ -18279,37 +19037,37 @@ Entry.Board.OPTION_DOWNLOAD = 3; k += n.x; a = d + 1; n.magnet.next && (a += n.height, h.push({point:d, endPoint:a, startBlock:q, blocks:[]}), h.push({point:a, blocks:[]}), n.absX = k); - q.statements && (b += .01); + q.statements && (c += .01); for (var m = 0;m < q.statements.length;m++) { a = q.statements[m]; var r = q.view._statements[m]; - r.zIndex = b; + r.zIndex = c; r.absX = k + r.x; h.push({point:r.y + d - 30, endPoint:r.y + d, startBlock:r, blocks:[]}); h.push({point:r.y + d + r.height, blocks:[]}); - b += .01; - g = g.concat(this._getNextMagnets(a, b, {x:r.x + k, y:r.y + d}, e)); + c += .01; + g = g.concat(this._getNextMagnets(a, c, {x:r.x + k, y:r.y + d}, e)); } n.magnet.next && (d += n.magnet.next.y, k += n.magnet.next.x); } return g.concat(h); }; - b._getPreviousMagnets = function(a, b, d, e) { + a._getPreviousMagnets = function(a, c, d, e) { var f = a.getBlocks(); a = []; d || (d = {x:0, y:0}); e = d.x; d = d.y; var f = f[0], g = f.view; - g.zIndex = b; + g.zIndex = c; if (g.dragInstance) { return []; } d += g.y - 15; e += g.x; - return g.magnet.previous ? (b = d + 1 + g.height, a.push({point:d, endPoint:b, startBlock:f, blocks:[]}), a.push({point:b, blocks:[]}), g.absX = e, a) : []; + return g.magnet.previous ? (c = d + 1 + g.height, a.push({point:d, endPoint:c, startBlock:f, blocks:[]}), a.push({point:c, blocks:[]}), g.absX = e, a) : []; }; - b._getFieldMagnets = function(a, b, d, e) { + a._getFieldMagnets = function(a, c, d, e) { var f = a.getBlocks(), g = [], h = []; d || (d = {x:0, y:0}); var k = d.x; @@ -18319,20 +19077,20 @@ Entry.Board.OPTION_DOWNLOAD = 3; if (n.dragInstance) { break; } - n.zIndex = b; + n.zIndex = c; d += n.y; k += n.x; - h = h.concat(this._getFieldBlockMetaData(n, k, d, b, e)); - q.statements && (b += .01); + h = h.concat(this._getFieldBlockMetaData(n, k, d, c, e)); + q.statements && (c += .01); for (var m = 0;m < q.statements.length;m++) { a = q.statements[m]; - var r = q.view._statements[m], g = g.concat(this._getFieldMagnets(a, b, {x:r.x + k, y:r.y + d}, e)); + var r = q.view._statements[m], g = g.concat(this._getFieldMagnets(a, c, {x:r.x + k, y:r.y + d}, e)); } n.magnet.next && (d += n.magnet.next.y, k += n.magnet.next.x); } return g.concat(h); }; - b._getFieldBlockMetaData = function(a, b, d, e, f) { + a._getFieldBlockMetaData = function(a, c, d, e, f) { var g = a._contents, h = []; d += a.contentPos.y; for (var k = 0;k < g.length;k++) { @@ -18340,7 +19098,7 @@ Entry.Board.OPTION_DOWNLOAD = 3; if (l instanceof Entry.FieldBlock) { var q = l._valueBlock; if (!q.view.dragInstance && (l.acceptType === f || "boolean" === l.acceptType)) { - var n = b + l.box.x, m = d + l.box.y + a.contentHeight % 1E3 * -.5, r = d + l.box.y + l.box.height; + var n = c + l.box.x, m = d + l.box.y + a.contentHeight % 1E3 * -.5, r = d + l.box.y + l.box.height; l.acceptType === f && (h.push({point:m, endPoint:r, startBlock:q, blocks:[]}), h.push({point:r, blocks:[]})); l = q.view; l.absX = n; @@ -18351,7 +19109,7 @@ Entry.Board.OPTION_DOWNLOAD = 3; } return h; }; - b._getOutputMagnets = function(a, b, d, e) { + a._getOutputMagnets = function(a, c, d, e) { var f = a.getBlocks(), g = [], h = []; d || (d = {x:0, y:0}); var k = d.x; @@ -18361,35 +19119,35 @@ Entry.Board.OPTION_DOWNLOAD = 3; if (n.dragInstance) { break; } - n.zIndex = b; + n.zIndex = c; d += n.y; k += n.x; - h = h.concat(this._getOutputMetaData(n, k, d, b, e)); - q.statements && (b += .01); + h = h.concat(this._getOutputMetaData(n, k, d, c, e)); + q.statements && (c += .01); for (var m = 0;m < q.statements.length;m++) { a = q.statements[m]; - var r = q.view._statements[m], g = g.concat(this._getOutputMagnets(a, b, {x:r.x + k, y:r.y + d}, e)); + var r = q.view._statements[m], g = g.concat(this._getOutputMagnets(a, c, {x:r.x + k, y:r.y + d}, e)); } n.magnet.next && (d += n.magnet.next.y, k += n.magnet.next.x); } return g.concat(h); }; - b._getOutputMetaData = function(a, b, d, e, f) { + a._getOutputMetaData = function(a, c, d, e, f) { var g = a._contents, h = []; - b += a.contentPos.x; + c += a.contentPos.x; d += a.contentPos.y; for (a = 0;a < g.length;a++) { - var k = g[a], l = b + k.box.x, q = d - 24, n = d; + var k = g[a], l = c + k.box.x, q = d - 24, n = d; k instanceof Entry.FieldBlock ? (k.acceptType === f && (h.push({point:q, endPoint:n, startBlock:k, blocks:[]}), h.push({point:n, blocks:[]}), k.absX = l, k.zIndex = e, k.width = 20), (q = k._valueBlock) && (h = h.concat(this._getOutputMetaData(q.view, l, d + k.box.y, e + .01, f)))) : k instanceof Entry.FieldOutput && k.acceptType === f && (h.push({point:q, endPoint:n, startBlock:k, blocks:[]}), h.push({point:n, blocks:[]}), k.absX = l, k.zIndex = e, k.width = 20, (q = k._valueBlock) && (q.view.dragInstance || - (h = h.concat(this._getOutputMetaData(q.view, b + k.box.x, d + k.box.y, e + .01, f))))); + (h = h.concat(this._getOutputMetaData(q.view, c + k.box.x, d + k.box.y, e + .01, f))))); } return h; }; - b.getNearestMagnet = function(a, b, d) { + a.getNearestMagnet = function(a, c, d) { var e = this._magnetMap[d]; if (e && 0 !== e.length) { - var f = 0, g = e.length - 1, h, k = null, l = "previous" === d ? b - 15 : b; - for (b = -1 < ["previous", "next"].indexOf(d) ? 20 : 0;f <= g;) { + var f = 0, g = e.length - 1, h, k = null, l = "previous" === d ? c - 15 : c; + for (c = -1 < ["previous", "next"].indexOf(d) ? 20 : 0;f <= g;) { if (h = (f + g) / 2 | 0, d = e[h], l < d.point) { g = h - 1; } else { @@ -18398,7 +19156,7 @@ Entry.Board.OPTION_DOWNLOAD = 3; } else { e = d.blocks; for (f = 0;f < e.length;f++) { - if (g = e[f].view, g.absX - b < a && a < g.absX + g.width && (g = d.blocks[f], !k || k.view.zIndex < g.view.zIndex)) { + if (g = e[f].view, g.absX - c < a && a < g.absX + g.width && (g = d.blocks[f], !k || k.view.zIndex < g.view.zIndex)) { k = d.blocks[f]; } } @@ -18409,48 +19167,48 @@ Entry.Board.OPTION_DOWNLOAD = 3; return null; } }; - b.dominate = function(a) { + a.dominate = function(a) { a && (a = a.getFirstBlock()) && (this.svgBlockGroup.appendChild(a.view.svgGroup), this.code.dominate(a.thread)); }; - b.setPatternRectFill = function(a) { + a.setPatternRectFill = function(a) { this.patternRect.attr({fill:a}); this.pattern.attr({style:""}); }; - b.disablePattern = function() { + a.disablePattern = function() { this.pattern.attr({style:"display: none"}); }; - b._removeActivated = function() { + a._removeActivated = function() { this._activatedBlockView && (this._activatedBlockView.removeActivated(), this._activatedBlockView = null); }; - b.activateBlock = function(a) { + a.activateBlock = function(a) { a = a.view; - var b = a.getAbsoluteCoordinate(), d = this.svgDom, e = b.x, b = b.y, e = d.width() / 2 - e, d = d.height() / 2 - b - 100; + var c = a.getAbsoluteCoordinate(), d = this.svgDom, e = c.x, c = c.y, e = d.width() / 2 - e, d = d.height() / 2 - c - 100; this.scroller.scroll(e, d); a.addActivated(); this._activatedBlockView = a; }; - b.reDraw = function() { + a.reDraw = function() { this.code.view.reDraw(); }; - b.separate = function(a, b) { + a.separate = function(a, c) { "string" === typeof a && (a = this.findById(a)); a.view && a.view._toGlobalCoordinate(); var d = a.getPrevBlock(); - a.separate(b); + a.separate(c); d && d.getNextBlock() && d.getNextBlock().view.bindPrev(); }; - b.insert = function(a, b, d) { + a.insert = function(a, c, d) { "string" === typeof a && (a = this.findById(a)); this.separate(a, d); - 3 === b.length ? a.moveTo(b[0], b[1]) : 4 === b.length && 0 === b[3] ? (b = this.code.getThreads()[b[2]], a.thread.cut(a), b.insertToTop(a), a.getNextBlock().view.bindPrev()) : (b = b instanceof Array ? this.code.getTargetByPointer(b) : b, b instanceof Entry.Block ? ("basic" === a.getBlockType() && a.view.bindPrev(b), a.doInsert(b)) : b instanceof Entry.FieldStatement ? (a.view.bindPrev(b), b.insertTopBlock(a)) : a.doInsert(b)); + 3 === c.length ? a.moveTo(c[0], c[1]) : 4 === c.length && 0 === c[3] ? (c = this.code.getThreads()[c[2]], a.thread.cut(a), c.insertToTop(a), a.getNextBlock().view.bindPrev()) : (c = c instanceof Array ? this.code.getTargetByPointer(c) : c, c instanceof Entry.Block ? ("basic" === a.getBlockType() && a.view.bindPrev(c), a.doInsert(c)) : c instanceof Entry.FieldStatement ? (a.view.bindPrev(c), c.insertTopBlock(a)) : a.doInsert(c)); }; - b.adjustThreadsPosition = function() { + a.adjustThreadsPosition = function() { var a = this.code; a && (a = a.getThreads()) && 0 !== a.length && (a = a.sort(function(a, b) { return a.getFirstBlock().view.x - b.getFirstBlock().view.x; }), a = a[0].getFirstBlock()) && (a = a.view, a = a.getAbsoluteCoordinate(), this.scroller.scroll(50 - a.x, 30 - a.y)); }; - b._initContextOptions = function() { + a._initContextOptions = function() { var a = this; this._contextOptions = [{activated:!0, option:{text:Lang.Blocks.Paste_blocks, enable:!!Entry.clipboard, callback:function() { Entry.do("addThread", Entry.clipboard).value.getFirstBlock().copyToClipboard(); @@ -18464,13 +19222,13 @@ Entry.Board.OPTION_DOWNLOAD = 3; }); }}}]; }; - b.activateContextOption = function(a) { + a.activateContextOption = function(a) { this._contextOptions[a].activated = !0; }; - b.deActivateContextOption = function(a) { + a.deActivateContextOption = function(a) { this._contextOptions[a].activated = !1; }; - b._bindEvent = function() { + a._bindEvent = function() { Entry.documentMousedown && (Entry.documentMousedown.attach(this, this.setSelectedBlock), Entry.documentMousedown.attach(this, this._removeActivated)); Entry.keyPressed && Entry.keyPressed.attach(this, this._keyboardControl); if (Entry.windowResized) { @@ -18478,2004 +19236,1611 @@ Entry.Board.OPTION_DOWNLOAD = 3; Entry.windowResized.attach(this, a); } }; - b.offset = function() { + a.offset = function() { (!this._offset || 0 === this._offset.top && 0 === this._offset.left) && this.updateOffset(); return this._offset; }; })(Entry.Board.prototype); -Entry.skeleton = function() { -}; -Entry.skeleton.basic = {path:function(b) { - var a = b.contentWidth; - b = b.contentHeight; - b = Math.max(30, b + 2); - a = Math.max(0, a + 9 - b / 2); - return "m -8,0 l 8,8 8,-8 h %w a %h,%h 0 0,1 0,%wh h -%w l -8,8 -8,-8 v -%wh z".replace(/%wh/gi, b).replace(/%w/gi, a).replace(/%h/gi, b / 2); -}, box:function(b) { - return {offsetX:-8, offsetY:0, width:(b ? b.contentWidth : 150) + 30, height:Math.max(30, (b ? b.contentHeight : 28) + 2), marginBottom:0}; -}, magnets:function(b) { - return {previous:{x:0, y:0}, next:{x:0, y:(b ? Math.max(b.height, 30) : 30) + 1 + b.offsetY}}; -}, contentPos:function(b) { - return {x:14, y:Math.max(b.contentHeight, 28) / 2 + 1}; -}}; -Entry.skeleton.basic_create = {path:function(b) { - var a = b.contentWidth; - b = b.contentHeight; - b = Math.max(30, b + 2); - a = Math.max(0, a + 9 - b / 2); - return "m -8,0 l 16,0 h %w a %h,%h 0 0,1 0,%wh h -%w l -8,8 -8,-8 v -%wh z".replace(/%wh/gi, b).replace(/%w/gi, a).replace(/%h/gi, b / 2); -}, box:function(b) { - return {offsetX:-8, offsetY:0, width:(b ? b.contentWidth : 150) + 30, height:Math.max(30, (b ? b.contentHeight : 28) + 2), marginBottom:0}; -}, magnets:function(b) { - return {next:{x:0, y:(b ? Math.max(b.height, 30) : 30) + 1 + b.offsetY}}; -}, contentPos:function(b) { - return {x:14, y:Math.max(b.contentHeight, 28) / 2 + 1}; -}}; -Entry.skeleton.basic_event = {path:function(b) { - b = b.contentWidth; - b = Math.max(0, b); - return "m -8,0 m 0,-5 a 19.5,19.5 0, 0,1 16,0 c 10,5 15,5 20,5 h %w a 15,15 0 0,1 0,30 H 8 l -8,8 -8,-8 l 0,0.5 a 19.5,19.5 0, 0,1 0,-35 z".replace(/%w/gi, b - 30); -}, box:function(b) { - return {offsetX:-19, offsetY:-7, width:b.contentWidth + 30, height:30, marginBottom:0}; -}, magnets:function(b) { - return {next:{x:0, y:(b ? Math.max(b.height + b.offsetY + 7, 30) : 30) + 1}}; -}, contentPos:function(b) { - return {x:1, y:15}; -}}; -Entry.skeleton.basic_loop = {path:function(b) { - var a = b.contentWidth, c = b.contentHeight, c = Math.max(30, c + 2), a = Math.max(0, a + 9 - c / 2); - b = b._statements[0] ? b._statements[0].height : 20; - b = Math.max(b, 20); - return "m -8,0 l 8,8 8,-8 h %w a %h,%h 0 0,1 0,%wh H 24 l -8,8 -8,-8 h -0.4 v %sh h 0.4 l 8,8 8,-8 h %bw a 8,8 0 0,1 0,16 H 8 l -8,8 -8,-8 z".replace(/%wh/gi, c).replace(/%w/gi, a).replace(/%bw/gi, a - 8).replace(/%h/gi, c / 2).replace(/%sh/gi, b + 1); -}, magnets:function(b) { - var a = Math.max(b.contentHeight + 2, 30), c = b._statements[0] ? b._statements[0].height : 20, c = Math.max(c, 20); - return {previous:{x:0, y:0}, next:{x:0, y:c + a + 18 + b.offsetY}}; -}, box:function(b) { - var a = b.contentWidth, c = Math.max(b.contentHeight + 2, 30); - b = b._statements[0] ? b._statements[0].height : 20; - b = Math.max(b, 20); - return {offsetX:-8, offsetY:0, width:a + 30, height:c + b + 17, marginBottom:0}; -}, statementPos:function(b) { - return [{x:16, y:Math.max(30, b.contentHeight + 2) + 1}]; -}, contentPos:function(b) { - return {x:14, y:Math.max(b.contentHeight, 28) / 2 + 1}; -}}; -Entry.skeleton.basic_define = {path:function(b) { - var a = b.contentWidth, c = b.contentHeight, c = Math.max(30, c + 2), a = Math.max(0, a + 9 - c / 2); - b = b._statements[0] ? b._statements[0].height : 30; - b = Math.max(b, 20); - return "m -8,0 l 16,0 h %w a %h,%h 0 0,1 0,%wh H 24 l -8,8 -8,-8 h -0.4 v %sh h 0.4 l 8,8 8,-8 h %bw a 8,8 0 0,1 0,16 H -8 z".replace(/%wh/gi, c).replace(/%w/gi, a).replace(/%h/gi, c / 2).replace(/%bw/gi, a - 8).replace(/%sh/gi, b + 1); -}, magnets:function() { - return {}; -}, box:function(b) { - return {offsetX:0, offsetY:0, width:b.contentWidth, height:Math.max(b.contentHeight, 25) + 46, marginBottom:0}; -}, statementPos:function(b) { - return [{x:16, y:Math.max(30, b.contentHeight + 2)}]; -}, contentPos:function() { - return {x:14, y:15}; -}}; -Entry.skeleton.pebble_event = {path:function(b) { - return "m 0,0 a 25,25 0 0,1 9,48.3 a 9,9 0 0,1 -18,0 a 25,25 0 0,1 9,-48.3 z"; -}, box:function(b) { - return {offsetX:-25, offsetY:0, width:50, height:48.3, marginBottom:0}; -}, magnets:function(b) { - return {next:{x:0, y:(b ? Math.max(b.height, 49.3) : 49.3) + b.offsetY}}; -}, contentPos:function() { - return {x:0, y:25}; -}}; -Entry.skeleton.pebble_loop = {fontSize:16, dropdownHeight:23, path:function(b) { - b = Math.max(b._statements[0] ? b._statements[0].height : 50, 50); - return "M 0,9 a 9,9 0 0,0 9,-9 h %cw q 25,0 25,25 v %ch q 0,25 -25,25 h -%cw a 9,9 0 0,1 -18,0 h -%cw q -25,0 -25,-25 v -%ch q 0,-25 25,-25 h %cw a 9,9 0 0,0 9,9 M 0,49 a 9,9 0 0,1 -9,-9 h -28 a 25,25 0 0,0 -25,25 v %cih a 25,25 0 0,0 25,25 h 28 a 9,9 0 0,0 18,0 h 28 a 25,25 0 0,0 25,-25 v -%cih a 25,25 0 0,0 -25,-25 h -28 a 9,9 0 0,1 -9,9 z".replace(/%cw/gi, 41).replace(/%ch/gi, b + 4).replace(/%cih/gi, b - 50); -}, magnets:function(b) { - var a = Math.max(b.contentHeight + 2, 41), c = b._statements[0] ? b._statements[0].height : 20, c = Math.max(c, 51); - return {previous:{x:0, y:0}, next:{x:0, y:c + a + 13 + b.offsetY}}; -}, box:function(b) { - var a = b.contentWidth, c = Math.max(b.contentHeight + 2, 41); - b = b._statements[0] ? b._statements[0].height : 20; - b = Math.max(b, 51); - return {offsetX:-(a / 2 + 13), offsetY:0, width:a + 30, height:c + b + 13, marginBottom:0}; -}, statementPos:function(b) { - return [{x:0, y:Math.max(39, b.contentHeight + 2) + 1.5}]; -}, contentPos:function() { - return {x:-46, y:25}; -}}; -Entry.skeleton.pebble_basic = {fontSize:15, morph:["prev", "next"], path:function(b) { - return "m 0,9 a 9,9 0 0,0 9,-9 h 28 q 25,0 25,25q 0,25 -25,25h -28 a 9,9 0 0,1 -18,0 h -28 q -25,0 -25,-25q 0,-25 25,-25h 28 a 9,9 0 0,0 9,9 z"; -}, magnets:function(b) { - return {previous:{x:0, y:0}, next:{x:0, y:(b ? Math.max(b.height, 51) : 51) + b.offsetY}}; -}, box:function() { - return {offsetX:-62, offsetY:0, width:124, height:50, marginBottom:0}; -}, contentPos:function() { - return {x:-46, y:25}; -}}; -Entry.skeleton.basic_string_field = {path:function(b) { - var a = b.contentWidth; - b = b.contentHeight; - b = Math.max(18, b + 2); - a = Math.max(0, a - b + 12); - return "m %h,0 h %w a %h,%h 0 1,1 0,%wh H %h A %h,%h 0 1,1 %h,0 z".replace(/%wh/gi, b).replace(/%w/gi, a).replace(/%h/gi, b / 2); -}, color:"#000", outerLine:"#768dce", box:function(b) { - return {offsetX:0, offsetY:0, width:(b ? b.contentWidth : 5) + 12, height:Math.max((b ? b.contentHeight : 18) + 2, 18), marginBottom:0}; -}, magnets:function() { - return {string:{}}; -}, contentPos:function(b) { - return {x:6, y:Math.max(b.contentHeight, 16) / 2 + 1}; -}}; -Entry.skeleton.basic_boolean_field = {path:function(b) { - var a = b.contentWidth; - b = b.contentHeight; - b = Math.max(18, b + 2); - a = Math.max(0, a - b + 19); - return "m %h,0 h %w l %h,%h -%h,%h H %h l -%h,-%h %h,-%h z".replace(/%wh/gi, b).replace(/%w/gi, a).replace(/%h/gi, b / 2); -}, color:"#000", outerLine:"#768dce", box:function(b) { - return {offsetX:0, offsetY:0, width:(b ? b.contentWidth : 5) + 19, height:Math.max((b ? b.contentHeight : 18) + 2, 18), marginBottom:0}; -}, magnets:function() { - return {boolean:{}}; -}, contentPos:function(b) { - return {x:10, y:Math.max(b.contentHeight, 16) / 2 + 1}; -}}; -Entry.skeleton.basic_param = {path:function(b) { - var a = b.contentWidth; - (b = b._contents[b._contents.length - 1]) && (a -= b.box.width + Entry.BlockView.PARAM_SPACE - 2); - a = Math.max(0, a); - return "m 4,0 h 10 h %w l 2,2 0,3 3,0 1,1 0,12 -1,1 -3,0 0,3 -2,2h -%w h -10 l -2,-2 0,-3 3,0 1,-1 0,-12 -1,-1 -3,0 0,-3 2,-2".replace(/%w/gi, a); -}, outerLine:"#768dce", box:function(b) { - return {offsetX:0, offsetY:0, width:(b ? b.contentWidth : 5) + 11, height:24, marginBottom:0}; -}, magnets:function() { - return {param:{}}; -}, contentPos:function(b) { - return {x:11, y:12}; -}}; -Entry.skeleton.basic_button = {path:function() { - return "m -64,0 h 128 a 6,6 0, 0,1 6,6 v 18 a 6,6 0, 0,1 -6,6 h -128 a 6,6 0, 0,1 -6,-6 v -18 a 6,6 0, 0,1 6,-6 z"; -}, box:function() { - return {offsetX:-80, offsetY:0, width:140, height:30}; -}, contentPos:function() { - return {x:0, y:15}; -}, movable:!1, readOnly:!0, nextShadow:!0, classes:["basicButtonView"]}; -Entry.skeleton.basic_without_next = {box:Entry.skeleton.basic.box, contentPos:Entry.skeleton.basic.contentPos, path:function(b) { - var a = b.contentWidth; - b = b.contentHeight; - b = Math.max(30, b + 2); - a = Math.max(0, a + 9 - b / 2); - return "m -8,0 l 8,8 8,-8 h %w a %h,%h 0 0,1 0, %wh H -8 z".replace(/%wh/gi, b).replace(/%w/gi, a).replace(/%h/gi, b / 2); -}, magnets:function(b) { - return {previous:{x:0, y:0}}; -}}; -Entry.skeleton.basic_double_loop = {path:function(b) { - var a = b.contentWidth, c = b.contentHeight % 1E3, d = Math.floor(b.contentHeight / 1E3), c = Math.max(30, c + 2), d = Math.max(30, d + 2), a = Math.max(0, a + 5 - c / 2), e = b._statements; - b = e[0] ? e[0].height : 20; - e = e[1] ? e[1].height : 20; - b = Math.max(b, 20); - e = Math.max(e, 20); - return "m -8,0 l 8,8 8,-8 h %w a %h1,%h1 0 0,1 0,%wh1 H 24 l -8,8 -8,-8 h -0.4 v %sh1 h 0.4 l 8,8 8,-8 h %bw a %h2,%h2 0 0,1 0,%wh2 H 24 l -8,8 -8,-8 h -0.4 v %sh2 h 0.4 l 8,8 8,-8 h %bw a 8,8 0 0,1 0,16 H 8 l -8,8 -8,-8 z".replace(/%wh1/gi, c).replace(/%wh2/gi, d).replace(/%w/gi, a).replace(/%bw/gi, a - 8).replace(/%h1/gi, c / 2).replace(/%h2/gi, d / 2).replace(/%sh1/gi, b + 1).replace(/%sh2/gi, e + 1); -}, magnets:function(b) { - var a = Math.max(b.contentHeight % 1E3 + 2, 30), c = Math.max(Math.floor(b.contentHeight / 1E3) + 2, 30), d = b._statements[0] ? b._statements[0].height : 20, e = b._statements[1] ? b._statements[1].height : 20, d = Math.max(d, 20), e = Math.max(e, 20); - return {previous:{x:0, y:0}, next:{x:0, y:d + e + a + c + 19 + b.offsetY}}; -}, box:function(b) { - var a = b.contentWidth, c = Math.max(Math.floor(b.contentHeight / 1E3) + 2, 30), d = Math.max(b.contentHeight % 1E3 + 2, 30), e = b._statements[0] ? b._statements[0].height % 1E3 : 20; - b = b._statements[1] ? b._statements[1].height : 20; - e = Math.max(e, 20); - b = Math.max(b, 20); - return {offsetX:-8, offsetY:0, width:a + 30, height:c + d + e + b + 17, marginBottom:0}; -}, statementPos:function(b) { - var a = Math.max(30, b.contentHeight % 1E3 + 2) + 1; - return [{x:16, y:a}, {x:16, y:a + Math.max(b._statements[0] ? b._statements[0].height % 1E3 : 20, 20) + Math.max(Math.floor(b.contentHeight / 1E3) + 2, 30) + 1}]; -}, contentPos:function(b) { - return {x:14, y:Math.max(b.contentHeight % 1E3, 28) / 2 + 1}; -}}; -Entry.Thread = function(b, a, c) { +Entry.Code = function(a, b) { + Entry.Model(this, !1); + b && (this.object = b); this._data = new Entry.Collection; - this._code = a; + this._eventMap = {}; + this._blockMap = {}; + this.executors = []; + this.executeEndEvent = new Entry.Event(this); this.changeEvent = new Entry.Event(this); - this.changeEvent.attach(this, this.handleChange); - this._event = null; - this.parent = c ? c : a; - this.load(b); + this.changeEvent.attach(this, this._handleChange); + this._maxZIndex = 0; + this.load(a); }; -(function(b) { - b.load = function(a, b) { - void 0 === a && (a = []); - if (!(a instanceof Array)) { - return console.error("thread must be array"); +Entry.STATEMENT = 0; +Entry.PARAM = -1; +(function(a) { + a.schema = {view:null, board:null}; + a.load = function(a) { + a instanceof Array || (a = JSON.parse(a)); + this.clear(); + for (var c = 0;c < a.length;c++) { + this._data.push(new Entry.Thread(a[c], this)); } - for (var d = 0;d < a.length;d++) { - var e = a[d]; - e instanceof Entry.Block || e.isDummy ? (e.setThread(this), this._data.push(e)) : this._data.push(new Entry.Block(e, this)); + return this; + }; + a.clear = function() { + for (var a = this._data.length - 1;0 <= a;a--) { + this._data[a].destroy(!1); } - (d = this._code.view) && this.createView(d.board, b); + this.clearExecutors(); + this._eventMap = {}; }; - b.registerEvent = function(a, b) { - this._event = b; - this._code.registerEvent(a, b); + a.createView = function(a) { + null === this.view ? this.set({view:new Entry.CodeView(this, a), board:a}) : (this.set({board:a}), a.bindCodeView(this.view)); }; - b.unregisterEvent = function(a, b) { - this._code.unregisterEvent(a, b); + a.registerEvent = function(a, c) { + this._eventMap[c] || (this._eventMap[c] = []); + this._eventMap[c].push(a); }; - b.createView = function(a, b) { - this.view || (this.view = new Entry.ThreadView(this, a)); - this._data.map(function(d) { - d.createView(a, b); - }); + a.unregisterEvent = function(a, c) { + (c = this._eventMap[c]) && 0 !== c.length && (a = c.indexOf(a), 0 > a || c.splice(a, 1)); }; - b.separate = function(a, b) { - if (this._data.has(a.id)) { - var d = this._data.splice(this._data.indexOf(a), b); - this._code.createThread(d); - this.changeEvent.notify(); + a.raiseEvent = function(a, c, d) { + a = this._eventMap[a]; + var e = []; + if (void 0 !== a) { + for (var f = 0;f < a.length;f++) { + var g = a[f]; + if (void 0 === d || -1 < g.params.indexOf(d)) { + g = new Entry.Executor(a[f], c), this.executors.push(g), e.push(g); + } + } + return e; } }; - b.cut = function(a) { - a = this._data.indexOf(a); - a = this._data.splice(a); - this.changeEvent.notify(); - return a; + a.getEventMap = function(a) { + return this._eventMap[a]; + }; + a.map = function(a) { + this._data.map(a); }; - b.insertByBlock = function(a, b) { - for (var d = a ? this._data.indexOf(a) : -1, e = 0;e < b.length;e++) { - b[e].setThread(this); + a.tick = function() { + for (var a = this.executors, c = 0;c < a.length;c++) { + var d = a[c]; + d.isEnd() ? (a.splice(c--, 1), 0 === a.length && this.executeEndEvent.notify()) : d.execute(); } - this._data.splice.apply(this._data, [d + 1, 0].concat(b)); - this.changeEvent.notify(); }; - b.insertToTop = function(a) { - a.setThread(this); - this._data.unshift.apply(this._data, [a]); - this.changeEvent.notify(); + a.removeExecutor = function(a) { + a = this.executors.indexOf(a); + -1 < a && this.executors.splice(a, 1); }; - b.clone = function(a, b) { - a = a || this._code; - for (var d = new Entry.Thread([], a), e = this._data, f = [], g = 0, h = e.length;g < h;g++) { - f.push(e[g].clone(d)); - } - d.load(f, b); - return d; + a.clearExecutors = function() { + this.executors.forEach(function(a) { + a.end(); + }); + this.executors = []; }; - b.toJSON = function(a, b) { - for (var d = [], e = void 0 === b ? 0 : b;e < this._data.length;e++) { - this._data[e] instanceof Entry.Block && d.push(this._data[e].toJSON(a)); + a.clearExecutorsByEntity = function(a) { + for (var c = this.executors, d = 0;d < c.length;d++) { + var e = c[d]; + e.entity === a && e.end(); } - return d; }; - b.destroy = function(a) { - this._code.destroyThread(this, !1); - this.view && this.view.destroy(a); - for (var b = this._data, d = b.length - 1;0 <= d;d--) { - b[d].destroy(a); + a.addExecutor = function(a) { + this.executors.push(a); + }; + a.createThread = function(a, c) { + if (!(a instanceof Array)) { + return console.error("blocks must be array"); } + a = new Entry.Thread(a, this); + void 0 === c ? this._data.push(a) : this._data.insert(a, c); + return a; + }; + a.cloneThread = function(a, c) { + a = a.clone(this, c); + this._data.push(a); + return a; }; - b.getBlock = function(a) { - return this._data[a]; + a.destroyThread = function(a, c) { + c = this._data; + a = c.indexOf(a); + 0 > a || c.splice(a, 1); + }; + a.doDestroyThread = function(a, c) { + c = this._data; + a = c.indexOf(a); + 0 > a || c.splice(a, 1); }; - b.getBlocks = function() { + a.getThreads = function() { return this._data.map(function(a) { return a; }); }; - b.countBlock = function() { - for (var a = 0, b = 0;b < this._data.length;b++) { - var d = this._data[b]; - if (d.type && (a++, d = d.statements)) { - for (var e = 0;e < d.length;e++) { - a += d[e].countBlock(); - } - } + a.toJSON = function() { + for (var a = this.getThreads(), c = [], d = 0, e = a.length;d < e;d++) { + c.push(a[d].toJSON()); } - return a; - }; - b.handleChange = function() { - 0 === this._data.length && this.destroy(); - }; - b.getCode = function() { - return this._code; - }; - b.setCode = function(a) { - this._code = a; + return c; }; - b.spliceBlock = function(a) { - var b = this._data; - b.remove(a); - 0 === b.length && this.view.getParent().constructor !== Entry.FieldStatement && this.destroy(); - this.changeEvent.notify(); + a.countBlock = function() { + for (var a = this.getThreads(), c = 0, d = 0;d < a.length;d++) { + c += a[d].countBlock(); + } + return c; }; - b.getFirstBlock = function() { - return this._data[0]; + a.moveBy = function(a, c) { + for (var d = this.getThreads(), e = 0, f = d.length;e < f;e++) { + var g = d[e].getFirstBlock(); + g && g.view._moveBy(a, c, !1); + } + a = this.board; + a instanceof Entry.BlockMenu && a.updateSplitters(c); }; - b.getPrevBlock = function(a) { - a = this._data.indexOf(a); - return this._data.at(a - 1); + a.stringify = function() { + return JSON.stringify(this.toJSON()); }; - b.getNextBlock = function(a) { - a = this._data.indexOf(a); - return this._data.at(a + 1); + a.dominate = function(a) { + a.view.setZIndex(this._maxZIndex++); }; - b.getLastBlock = function() { - return this._data.at(this._data.length - 1); + a.indexOf = function(a) { + return this._data.indexOf(a); }; - b.getRootBlock = function() { - return this._data.at(0); + a._handleChange = function() { + Entry.creationChangedEvent && Entry.creationChangedEvent.notify(); }; - b.hasBlockType = function(a) { - function b(d) { - if (a == d.type) { - return !0; - } - for (var f = d.params, g = 0;g < f.length;g++) { - var h = f[g]; - if (h && h.constructor == Entry.Block && b(h)) { - return !0; - } - } - if (d = d.statements) { - for (f = 0;f < d.length;f++) { - if (d[f].hasBlockType(a)) { - return !0; - } - } - } - return !1; - } - for (var d = 0;d < this._data.length;d++) { - if (b(this._data[d])) { + a.hasBlockType = function(a) { + for (var c = this.getThreads(), d = 0;d < c.length;d++) { + if (c[d].hasBlockType(a)) { return !0; } } return !1; }; - b.getCount = function(a) { - var b = this._data.length; - a && (b -= this._data.indexOf(a)); - return b; + a.findById = function(a) { + return this._blockMap[a]; }; - b.indexOf = function(a) { - return this._data.indexOf(a); + a.registerBlock = function(a) { + this._blockMap[a.id] = a; }; - b.pointer = function(a, b) { - var d = this.indexOf(b); - a.unshift(d); - this.parent instanceof Entry.Block && a.unshift(this.parent.indexOfStatements(this)); - return this._code === this.parent ? (a.unshift(this._code.indexOf(this)), d = this._data[0], a.unshift(d.y), a.unshift(d.x), a) : this.parent.pointer(a); + a.unregisterBlock = function(a) { + delete this._blockMap[a.id]; }; - b.getBlockList = function(a) { - for (var b = [], d = 0;d < this._data.length;d++) { - b = b.concat(this._data[d].getBlockList(a)); + a.getByPointer = function(a) { + a = a.concat(); + a.shift(); + a.shift(); + for (var c = this._data[a.shift()].getBlock(a.shift());a.length;) { + c instanceof Entry.Block || (c = c.getValueBlock()); + var d = a.shift(), e = a.shift(); + -1 < d ? c = c.statements[d].getBlock(e) : -1 === d && (c = c.view.getParam(e)); } - return b; + return c; }; - b.stringify = function() { - return JSON.stringify(this.toJSON()); + a.getTargetByPointer = function(a) { + a = a.concat(); + a.shift(); + a.shift(); + var c = this._data[a.shift()], d; + if (1 === a.length) { + d = c.getBlock(a.shift() - 1); + } else { + for (d = c.getBlock(a.shift());a.length;) { + d instanceof Entry.Block || (d = d.getValueBlock()); + var e = a.shift(), c = a.shift(); + -1 < e ? (d = d.statements[e], d = a.length ? d.getBlock(c) : 0 === c ? d.view.getParent() : d.getBlock(c - 1)) : -1 === e && (d = d.view.getParam(c)); + } + } + return d; }; -})(Entry.Thread.prototype); -Entry.Block = function(b, a) { - var c = this; + a.getBlockList = function(a) { + for (var c = this.getThreads(), d = [], e = 0;e < c.length;e++) { + d = d.concat(c[e].getBlockList(a)); + } + return d; + }; +})(Entry.Code.prototype); +Entry.CodeView = function(a, b) { Entry.Model(this, !1); - this._schema = null; - this.setThread(a); - this.load(b); - var d = this.getCode(); - d.registerBlock(this); - var e = this.events.dataAdd; - e && d.object && e.forEach(function(a) { - Entry.Utils.isFunction(a) && a(c); + this.code = a; + this.set({board:b}); + this.svgThreadGroup = b.svgGroup.elem("g"); + this.svgThreadGroup.attr({class:"svgThreadGroup"}); + this.svgThreadGroup.board = b; + this.svgBlockGroup = b.svgGroup.elem("g"); + this.svgBlockGroup.attr({class:"svgBlockGroup"}); + this.svgBlockGroup.board = b; + b.bindCodeView(this); + this.code.map(function(a) { + a.createView(b); }); + a.observe(this, "_setBoard", ["board"]); }; -Entry.Block.MAGNET_RANGE = 10; -Entry.Block.MAGNET_OFFSET = .4; -Entry.Block.DELETABLE_TRUE = 1; -Entry.Block.DELETABLE_FALSE = 2; -Entry.Block.DELETABLE_FALSE_LIGHTEN = 3; -(function(b) { - b.schema = {id:null, x:0, y:0, type:null, params:[], statements:[], view:null, thread:null, movable:null, deletable:Entry.Block.DELETABLE_TRUE, readOnly:null, copyable:!0, events:{}}; - b.load = function(a) { - a.id || (a.id = Entry.Utils.generateId()); - this.set(a); - this.loadSchema(); +(function(a) { + a.schema = {board:null, scrollX:0, scrollY:0}; + a._setBoard = function() { + this.set({board:this.code.board}); }; - b.changeSchema = function(a) { - this.set({params:[]}); - this.loadSchema(); + a.reDraw = function() { + this.code.map(function(a) { + a.view.reDraw(); + }); }; - b.getSchema = function() { - this._schema || this.loadSchema(); - return this._schema; +})(Entry.CodeView.prototype); +Entry.ConnectionRipple = {}; +(function(a) { + a.createDom = function(a) { + this.svgDom || (this._ripple = a.getBoard().svgGroup.elem("circle", {cx:0, cy:0, r:0, stroke:"#888", "stroke-width":10})); }; - b.loadSchema = function() { - if (this._schema = Entry.block[this.type]) { - !this._schemaChangeEvent && this._schema.changeEvent && (this._schemaChangeEvent = this._schema.changeEvent.attach(this, this.changeSchema)); - var a = this._schema.events; - if (a) { - for (var b in a) { - this.events[b] || (this.events[b] = []); - for (var d = a[b], e = 0;e < d.length;e++) { - var f = d[e]; - f && 0 > this.events[b].indexOf(f) && this.events[b].push(f); + a.setView = function(a) { + this._ripple || this.createDom(a); + var c = this._ripple, d = a.getBoard().svgGroup; + c.remove(); + a = a.getAbsoluteCoordinate(); + c.attr({cx:a.x, cy:a.y}); + d.appendChild(c); + c._startTime = new Date; + return this; + }; + a.dispose = function() { + var a = this, c = this._ripple, d = (new Date - c._startTime) / 150; + 1 < d ? c.remove() : (c.attr({r:25 * d, opacity:1 - d}), window.setTimeout(function() { + a.dispose(); + }, 10)); + }; +})(Entry.ConnectionRipple); +Entry.Executor = function(a, b) { + this.scope = new Entry.Scope(a, this); + this.entity = b; + this._callStack = []; + this.register = {}; +}; +(function(a) { + a.execute = function() { + if (!this.isEnd()) { + for (;;) { + var a = null; + try { + a = this.scope.block.getSchema().func.call(this.scope, this.entity, this.scope); + } catch (d) { + if ("AsyncError" === d.name) { + a = Entry.STATIC.BREAK; + } else { + var c = !1; + "\ub7f0\ud0c0\uc784 \uc5d0\ub7ec" != d.message && (c = !0); + Entry.Utils.stopProjectWithToast(this.scope, "\ub7f0\ud0c0\uc784 \uc5d0\ub7ec", c); } } - } - this._schema.event && this.thread.registerEvent(this, this._schema.event); - a = this.params; - b = this._schema.params; - for (e = 0;b && e < b.length;e++) { - d = void 0 === a[e] || null === a[e] ? b[e].value : a[e], f = a[e] || e < a.length, !d || "Output" !== b[e].type && "Block" !== b[e].type || (d = new Entry.Block(d, this.thread)), f ? a.splice(e, 1, d) : a.push(d); - } - if (a = this._schema.statements) { - for (e = 0;e < a.length;e++) { - this.statements.splice(e, 1, new Entry.Thread(this.statements[e], this.getCode(), this)); + if (this.isEnd()) { + break; + } + if (void 0 === a || null === a || a === Entry.STATIC.PASS) { + if (this.scope = new Entry.Scope(this.scope.block.getNextBlock(), this), null === this.scope.block) { + if (this._callStack.length) { + if (a = this.scope, this.scope = this._callStack.pop(), this.scope.isLooped !== a.isLooped) { + break; + } + } else { + break; + } + } + } else { + if (a !== Entry.STATIC.CONTINUE && (a === Entry.STATIC.BREAK || this.scope === a)) { + break; + } } } } }; - b.changeType = function(a) { - this._schemaChangeEvent && this._schemaChangeEvent.destroy(); - this.set({type:a}); - this.loadSchema(); - this.view && this.view.changeType(a); - }; - b.setThread = function(a) { - this.set({thread:a}); + a.stepInto = function(a) { + a instanceof Entry.Thread || console.error("Must step in to thread"); + a = a.getFirstBlock(); + if (!a) { + return Entry.STATIC.BREAK; + } + this._callStack.push(this.scope); + this.scope = new Entry.Scope(a, this); + return Entry.STATIC.CONTINUE; }; - b.getThread = function() { - return this.thread; + a.break = function() { + this._callStack.length && (this.scope = this._callStack.pop()); + return Entry.STATIC.PASS; }; - b.insertAfter = function(a) { - this.thread.insertByBlock(this, a); + a.breakLoop = function() { + this._callStack.length && (this.scope = this._callStack.pop()); + for (;this._callStack.length && "repeat" !== Entry.block[this.scope.block.type].class;) { + this.scope = this._callStack.pop(); + } + return Entry.STATIC.PASS; }; - b._updatePos = function() { - this.view && this.set({x:this.view.x, y:this.view.y}); + a.end = function() { + this.scope.block = null; }; - b.moveTo = function(a, b) { - this.view && this.view._moveTo(a, b); - this._updatePos(); - this.getCode().changeEvent.notify(); + a.isEnd = function() { + return null === this.scope.block; }; - b.createView = function(a, b) { - this.view || (this.set({view:new Entry.BlockView(this, a, b)}), this._updatePos()); +})(Entry.Executor.prototype); +Entry.Scope = function(a, b) { + this.type = (this.block = a) ? a.type : null; + this.executor = b; + this.entity = b.entity; +}; +(function(a) { + a.callReturn = function() { }; - b.clone = function(a) { - return new Entry.Block(this.toJSON(!0), a); + a.getParam = function(a) { + a = this.block.params[a]; + var c = new Entry.Scope(a, this.executor); + return Entry.block[a.type].func.call(c, this.entity, c); }; - b.toJSON = function(a) { - var b = this._toJSON(); - delete b.view; - delete b.thread; - delete b.events; - a && delete b.id; - b.params = b.params.map(function(b) { - b instanceof Entry.Block && (b = b.toJSON(a)); - return b; - }); - b.statements = b.statements.map(function(b) { - return b.toJSON(a); + a.getParams = function() { + var a = this; + return this.block.params.map(function(c) { + if (c instanceof Entry.Block) { + var d = new Entry.Scope(c, a.executor); + return Entry.block[c.type].func.call(d, a.entity, d); + } + return c; }); - b.x = this.x; - b.y = this.y; - b.movable = this.movable; - b.deletable = this.deletable; - b.readOnly = this.readOnly; - return b; }; - b.destroy = function(a, b) { - var d = this, e = this.params; - if (e) { - for (var f = 0;f < e.length;f++) { - var g = e[f]; - g instanceof Entry.Block && (g.doNotSplice = !0, g.destroy(a)); - } - } - if (e = this.statements) { - for (f = 0;f < e.length;f++) { - e[f].destroy(a); - } - } - g = this.getPrevBlock(); - f = this.getNextBlock(); - this.getCode().unregisterBlock(this); - e = this.getThread(); - this._schema.event && e.unregisterEvent(this, this._schema.event); - f && (b ? f.destroy(a, b) : g ? f.view.bindPrev(g) : (g = this.getThread().view.getParent(), g.constructor === Entry.FieldStatement ? (f.view.bindPrev(g), g.insertTopBlock(f)) : g.constructor === Entry.FieldStatement ? f.replace(g._valueBlock) : f.view._toGlobalCoordinate())); - !this.doNotSplice && e.spliceBlock ? e.spliceBlock(this) : delete this.doNotSplice; - this.view && this.view.destroy(a); - this._schemaChangeEvent && this._schemaChangeEvent.destroy(); - (f = this.events.dataDestroy) && this.getCode().object && f.forEach(function(a) { - Entry.Utils.isFunction(a) && a(d); + a.getValue = function(a, c) { + a = this.block.params[this._getParamIndex(a, c)]; + c = new Entry.Scope(a, this.executor); + return Entry.block[a.type].func.call(c, this.entity, c); + }; + a.getStringValue = function(a, c) { + return String(this.getValue(a, c)); + }; + a.getNumberValue = function(a, c) { + return Number(this.getValue(a)); + }; + a.getBooleanValue = function(a, c) { + return Number(this.getValue(a, c)) ? !0 : !1; + }; + a.getField = function(a, c) { + return this.block.params[this._getParamIndex(a)]; + }; + a.getStringField = function(a, c) { + return String(this.getField(a)); + }; + a.getNumberField = function(a) { + return Number(this.getField(a)); + }; + a.getStatement = function(a, c) { + return this.executor.stepInto(this.block.statements[this._getStatementIndex(a, c)]); + }; + a._getParamIndex = function(a) { + this._schema || (this._schema = Entry.block[this.type]); + return this._schema.paramsKeyMap[a]; + }; + a._getStatementIndex = function(a) { + this._schema || (this._schema = Entry.block[this.type]); + return this._schema.statementsKeyMap[a]; + }; + a.die = function() { + this.block = null; + return Entry.STATIC.BREAK; + }; +})(Entry.Scope.prototype); +Entry.FieldAngle = function(a, b, c) { + this._block = b.block; + this._blockView = b; + this.box = new Entry.BoxModel; + this.svgGroup = null; + this.position = a.position; + this._contents = a; + this._index = c; + a = this.getValue(); + this.setValue(this.modValue(void 0 !== a ? a : 90)); + this.renderStart(); +}; +Entry.Utils.inherit(Entry.Field, Entry.FieldAngle); +(function(a) { + a.renderStart = function() { + this.svgGroup && $(this.svgGroup).remove(); + this.svgGroup = this._blockView.contentSvgGroup.elem("g", {class:"entry-input-field"}); + this.textElement = this.svgGroup.elem("text", {x:4, y:4, "font-size":"11px"}); + this.textElement.textContent = this.getText(); + var a = this.getTextWidth(), c = this.position && this.position.y ? this.position.y : 0; + this._header = this.svgGroup.elem("rect", {x:0, y:c - 8, rx:3, ry:3, width:a, height:16, rx:3, ry:3, fill:"#fff", "fill-opacity":.4}); + this.svgGroup.appendChild(this.textElement); + this._bindRenderOptions(); + this.box.set({x:0, y:0, width:a, height:16}); + }; + a.renderOptions = function() { + var a = this; + this._attachDisposeEvent(function() { + a.applyValue(); + a.destroyOption(); + }); + this.optionGroup = Entry.Dom("input", {class:"entry-widget-input-field", parent:$("body")}); + this.optionGroup.val(this.value); + this.optionGroup.on("mousedown", function(a) { + a.stopPropagation(); + }); + this.optionGroup.on("keyup", function(c) { + var d = c.keyCode || c.which; + a.applyValue(c); + -1 < [13, 27].indexOf(d) && a.destroyOption(); + }); + var c = this.getAbsolutePosFromDocument(); + c.y -= this.box.height / 2; + this.optionGroup.css({height:16, left:c.x, top:c.y, width:a.box.width}); + this.optionGroup.select(); + this.svgOptionGroup = this.appendSvgOptionGroup(); + this.svgOptionGroup.elem("circle", {x:0, y:0, r:49, class:"entry-field-angle-circle"}); + this._dividerGroup = this.svgOptionGroup.elem("g"); + for (c = 0;360 > c;c += 15) { + this._dividerGroup.elem("line", {x1:49, y1:0, x2:49 - (0 === c % 45 ? 10 : 5), y2:0, transform:"rotate(" + c + ", 0, 0)", class:"entry-angle-divider"}); + } + c = this.getAbsolutePosFromBoard(); + c.x += this.box.width / 2; + c.y = c.y + this.box.height / 2 + 49 + 1; + this.svgOptionGroup.attr({class:"entry-field-angle", transform:"translate(" + c.x + "," + c.y + ")"}); + var c = a.getAbsolutePosFromDocument(), d = [c.x + a.box.width / 2, c.y + a.box.height / 2 + 1]; + $(this.svgOptionGroup).mousemove(function(c) { + a.optionGroup.val(a.modValue(function(a, b) { + var c = b[0] - a[0]; + a = b[1] - a[1] - 49 - 1; + b = Math.atan(-a / c); + b = Entry.toDegrees(b); + b = 90 - b; + 0 > c ? b += 180 : 0 < a && (b += 360); + return 15 * Math.round(b / 15); + }(d, [c.clientX, c.clientY]))); + a.applyValue(); }); + this.updateGraph(); }; - b.getView = function() { - return this.view; + a.updateGraph = function() { + this._fillPath && this._fillPath.remove(); + var a = Entry.toRadian(this.getValue()), c = 49 * Math.sin(a), d = -49 * Math.cos(a), a = a > Math.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", c).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:c, y2:d}); + this._indicator.attr({class:"entry-angle-indicator"}); }; - b.setMovable = function(a) { - this.movable != a && this.set({movable:a}); + a.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.setCopyable = function(a) { - this.copyable != a && this.set({copyable:a}); + a.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.isMovable = function() { - return this.movable; + a.getTextWidth = function() { + return this.textElement ? this.textElement.getComputedTextLength() + 8 : 8; }; - b.isCopyable = function() { - return this.copyable; + a.getText = function() { + return this.getValue() + "\u00b0"; }; - b.setDeletable = function(a) { - this.deletable != a && this.set({deletable:a}); + a.modValue = function(a) { + return a % 360; }; - b.isDeletable = function() { - return this.deletable === Entry.Block.DELETABLE_TRUE; + a.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(); }; - b.isReadOnly = function() { - return this.readOnly; +})(Entry.FieldAngle.prototype); +Entry.FieldColor = function(a, b, c) { + this._block = b.block; + this._blockView = b; + this.box = new Entry.BoxModel; + this.svgGroup = null; + this._contents = a; + this._index = c; + this._position = a.position; + this.key = a.key; + this.setValue(this.getValue() || "#FF0000"); + this.renderStart(b); +}; +Entry.Utils.inherit(Entry.Field, Entry.FieldColor); +(function(a) { + a.renderStart = function() { + this.svgGroup && $(this.svgGroup).remove(); + this.svgGroup = this._blockView.contentSvgGroup.elem("g", {class:"entry-field-color"}); + var a = this._position, c; + a ? (c = a.x || 0, a = a.y || 0) : (c = 0, a = -8); + this._header = this.svgGroup.elem("rect", {x:c, y:a, width:14.5, height:16, fill:this.getValue()}); + this._bindRenderOptions(); + this.box.set({x:c, y:a, width:14.5, height:16}); }; - b.getCode = function() { - return this.thread.getCode(); + a.renderOptions = function() { + var a = this; + this._attachDisposeEvent(); + var c = Entry.FieldColor.getWidgetColorList(); + this.optionGroup = Entry.Dom("table", {class:"entry-widget-color-table", parent:$("body")}); + for (var d = 0;d < c.length;d++) { + for (var e = Entry.Dom("tr", {class:"entry-widget-color-row", parent:this.optionGroup}), f = 0;f < c[d].length;f++) { + var g = Entry.Dom("td", {class:"entry-widget-color-cell", parent:e}), h = c[d][f]; + g.css({"background-color":h}); + g.attr({"data-color-value":h}); + (function(c, d) { + c.mousedown(function(a) { + a.stopPropagation(); + }); + c.mouseup(function(c) { + a.applyValue(d); + a.destroyOption(); + a._selectBlockView(); + }); + })(g, h); + } + } + c = this.getAbsolutePosFromDocument(); + c.y += this.box.height / 2 + 1; + this.optionGroup.css({left:c.x, top:c.y}); }; - b.doAdd = function() { - this.getCode().changeEvent.notify(); + a.applyValue = function(a) { + this.value != a && (this.setValue(a), this._header.attr({fill:a})); }; - b.doMove = function() { - this._updatePos(); - this.getCode().changeEvent.notify(); +})(Entry.FieldColor.prototype); +Entry.FieldColor.getWidgetColorList = function() { + return ["#FFFFFF #CCCCCC #C0C0C0 #999999 #666666 #333333 #000000".split(" "), "#FFCCCC #FF6666 #FF0000 #CC0000 #990000 #660000 #330000".split(" "), "#FFCC99 #FF9966 #FF9900 #FF6600 #CC6600 #993300 #663300".split(" "), "#FFFF99 #FFFF66 #FFCC66 #FFCC33 #CC9933 #996633 #663333".split(" "), "#FFFFCC #FFFF33 #FFFF00 #FFCC00 #999900 #666600 #333300".split(" "), "#99FF99 #66FF99 #33FF33 #33CC00 #009900 #006600 #003300".split(" "), "#99FFFF #33FFFF #66CCCC #00CCCC #339999 #336666 #003333".split(" "), "#CCFFFF #66FFFF #33CCFF #3366FF #3333FF #000099 #000066".split(" "), + "#CCCCFF #9999FF #6666CC #6633FF #6609CC #333399 #330099".split(" "), "#FFCCFF #FF99FF #CC66CC #CC33CC #993399 #663366 #330033".split(" ")]; +}; +Entry.FieldDropdown = function(a, b, c) { + this._block = b.block; + this._blockView = b; + this.box = new Entry.BoxModel; + this.svgGroup = null; + this._contents = a; + this._noArrow = a.noArrow; + this._arrowColor = a.arrowColor; + this._index = c; + this.setValue(this.getValue()); + this._CONTENT_HEIGHT = a.dropdownHeight || b.getSkeleton().dropdownHeight || 16; + this._FONT_SIZE = a.fontSize || b.getSkeleton().fontSize || 12; + this._ROUND = a.roundValue || 3; + this.renderStart(); +}; +Entry.Utils.inherit(Entry.Field, Entry.FieldDropdown); +(function(a) { + a.renderStart = function() { + this.svgGroup && $(this.svgGroup).remove(); + this instanceof Entry.FieldDropdownDynamic && this._updateValue(); + var a = this._blockView; + this.svgGroup = a.contentSvgGroup.elem("g", {class:"entry-field-dropdown"}); + this.textElement = this.svgGroup.elem("text", {x:2}); + this.textElement.textContent = this.getTextByValue(this.getValue()); + var c = this.textElement.getBBox(); + this.textElement.attr({style:"white-space: pre;", "font-size":+this._FONT_SIZE + "px", y:.25 * c.height}); + c = this.textElement.getComputedTextLength() + 16; + this._noArrow && (c -= 12); + var d = this._CONTENT_HEIGHT; + this._header = this.svgGroup.elem("rect", {width:c, height:d, y:-d / 2, rx:this._ROUND, ry:this._ROUND, fill:"#fff", "fill-opacity":.4}); + this.svgGroup.appendChild(this.textElement); + this._noArrow || (a = this._arrowColor || a._schema.color, this._arrow = this.svgGroup.elem("polygon", {points:"0,-2.1 6.4,-2.1 3.2,2.1", fill:a, stroke:a, transform:"translate(" + (c - 11) + ",0)"})); + this._bindRenderOptions(); + this.box.set({x:0, y:0, width:c, height:d}); }; - b.doSeparate = function() { - this.separate(); + a.resize = function() { + var a = this.textElement.getComputedTextLength() + 18; + this._noArrow ? a -= 14 : this._arrow.attr({transform:"translate(" + (a - 11) + ",0)"}); + this._header.attr({width:a}); + this.box.set({width:a}); + this._block.view.alignContent(); }; - b.doInsert = function(a) { - "basic" === this.getBlockType() ? this.insert(a) : this.replace(a); + a.renderOptions = function() { + var a = this; + this._attachDisposeEvent(); + this.optionGroup = Entry.Dom("ul", {class:"entry-widget-dropdown", parent:$("body")}); + this.optionGroup.bind("mousedown touchstart", function(a) { + a.stopPropagation(); + }); + for (var c = this._contents.options, c = this._contents.options, d = 0, e = c.length;d < e;d++) { + var f = c[d], g = f[0], f = f[1], h = Entry.Dom("li", {class:"rect", parent:this.optionGroup}), k = Entry.Dom("span", {class:"left", parent:h}); + Entry.Dom("span", {class:"right", parent:h}).text(g); + this.getValue() == f && k.text("\u2713"); + (function(c, d) { + c.bind("mousedown touchstart", function(a) { + a.stopPropagation(); + }); + c.bind("mouseup touchend", function(c) { + c.stopPropagation(); + a.applyValue(d); + a.destroyOption(); + a._selectBlockView(); + }); + })(h, f); + } + this._position(); }; - b.doDestroy = function(a) { - this.destroy(a); - this.getCode().changeEvent.notify(); - return this; + a._position = function() { + var a = this.getAbsolutePosFromDocument(); + a.y += this.box.height / 2; + var c = $(document).height(), d = this.optionGroup.height(), e = this.optionGroup.width() + 30; + if (c < a.y + d + 30) { + var c = this._blockView.getBoard().svgDom.height(), f = this.getAbsolutePosFromBoard(); + this._blockView.y < c / 2 ? (a.x += this.box.width / 2 - e / 2, c -= f.y + 30, this.optionGroup.height(c)) : (a.x += this.box.width + 1, c -= c - f.y, c - 30 < d && this.optionGroup.height(c - c % 30), a.y -= this.optionGroup.height()); + } else { + a.x += this.box.width / 2 - e / 2; + } + this.optionGroup.addClass("rendered"); + this.optionGroup.css({left:a.x, top:a.y, width:e}); + this.optionGroup.find(".right").width(e - 20); }; - b.doDestroyBelow = function(a) { - console.log("destroyBelow", this.id, this.x, this.y); - this.destroy(a, !0); - this.getCode().changeEvent.notify(); - return this; + a.applyValue = function(a) { + this.value != a && this.setValue(a); + this.textElement.textContent = this.getTextByValue(a); + this.resize(); }; - b.copy = function() { - var a = this.getThread(), b = []; - if (a instanceof Entry.Thread) { - for (var d = a.getBlocks().indexOf(this), a = a.toJSON(!0, d), d = 0;d < a.length;d++) { - b.push(a[d]); + a.getTextByValue = function(a) { + if (!a || "null" === a) { + return Lang.Blocks.no_target; + } + for (var c = this._contents.options, d = 0, e = c.length;d < e;d++) { + var f = c[d]; + if (f[1] == a) { + return f[0]; } - } else { - b.push(this.toJSON(!0)); } - a = this.view.getAbsoluteCoordinate(); - d = b[0]; - d.x = a.x + 15; - d.y = a.y + 15; - d.id = Entry.Utils.generateId(); - return b; - }; - b.copyToClipboard = function() { - Entry.clipboard = this.copy(); + return Lang.Blocks.no_target; }; - b.separate = function(a) { - this.thread.separate(this, a); - this._updatePos(); - this.getCode().changeEvent.notify(); +})(Entry.FieldDropdown.prototype); +Entry.FieldDropdownDynamic = function(a, b, c) { + this._block = b.block; + this._blockView = b; + this.box = new Entry.BoxModel; + this.svgGroup = null; + this._contents = a; + this._index = c; + this._arrowColor = a.arrowColor; + c = this._contents.menuName; + Entry.Utils.isFunction(c) ? this._menuGenerator = c : this._menuName = c; + this._CONTENT_HEIGHT = a.dropdownHeight || b.getSkeleton().dropdownHeight || 16; + this._FONT_SIZE = a.fontSize || b.getSkeleton().fontSize || 12; + this._ROUND = a.roundValue || 3; + this.renderStart(b); +}; +Entry.Utils.inherit(Entry.FieldDropdown, Entry.FieldDropdownDynamic); +(function(a) { + a.constructor = Entry.FieldDropDownDynamic; + a._updateValue = function() { + var a = this._block.getCode().object, c = []; + Entry.container && (c = this._menuName ? Entry.container.getDropdownList(this._menuName, a) : this._menuGenerator()); + this._contents.options = c; + (a = this.getValue()) && "null" != a || (a = 0 !== c.length ? c[0][1] : null); + this.setValue(a); }; - b.insert = function(a) { - var b = this.thread.cut(this); - a instanceof Entry.Thread ? a.insertByBlock(null, b) : a.insertAfter(b); - this._updatePos(); - this.getCode().changeEvent.notify(); + a.renderOptions = function() { + var a = this; + this._attachDisposeEvent(); + this.optionGroup = Entry.Dom("ul", {class:"entry-widget-dropdown", parent:$("body")}); + this.optionGroup.bind("mousedown touchstart", function(a) { + a.stopPropagation(); + }); + var c; + c = this._menuName ? Entry.container.getDropdownList(this._contents.menuName) : this._menuGenerator(); + this._contents.options = c; + for (var d = 0;d < c.length;d++) { + var e = c[d], f = e[0], e = e[1], g = Entry.Dom("li", {class:"rect", parent:this.optionGroup}), h = Entry.Dom("span", {class:"left", parent:g}); + Entry.Dom("span", {class:"right", parent:g}).text(f); + this.getValue() == e && h.text("\u2713"); + (function(c, d) { + c.mousedown(function(a) { + a.stopPropagation(); + }); + c.mouseup(function(c) { + c.stopPropagation(); + a.applyValue(d); + a.destroyOption(); + a._selectBlockView(); + }); + })(g, e); + } + this._position(); }; - b.replace = function(a) { - this.thread.cut(this); - a.getThread().replace(this); - this.getCode().changeEvent.notify(); +})(Entry.FieldDropdownDynamic.prototype); +Entry.FieldImage = function(a, b, c) { + this._block = b.block; + this._blockView = b; + this._content = a; + this.box = new Entry.BoxModel; + this._size = a.size; + this._highlightColor = a.highlightColor ? a.highlightColor : "#F59900"; + this._position = a.position; + this._imgElement = this._path = this.svgGroup = null; + this._index = c; + this.setValue(null); + this.renderStart(); +}; +Entry.Utils.inherit(Entry.Field, Entry.FieldImage); +(function(a) { + a.renderStart = function() { + this.svgGroup && this.svgGroup.remove(); + this._imgUrl = this._block.deletable === Entry.Block.DELETABLE_FALSE_LIGHTEN ? this._content.img.replace(".png", "_un.png") : this._content.img; + this.svgGroup = this._blockView.contentSvgGroup.elem("g"); + this._imgElement = this.svgGroup.elem("image", {href:this._imgUrl, x:0, y:-.5 * this._size, width:this._size, height:this._size}); + this.box.set({x:this._size, y:0, width:this._size, height:this._size}); }; - b.getPrevBlock = function() { - return this.thread.getPrevBlock(this); +})(Entry.FieldImage.prototype); +Entry.FieldIndicator = function(a, b, c) { + this._block = b.block; + this._blockView = b; + this.box = new Entry.BoxModel; + this._size = a.size; + this._imgUrl = this._block.deletable === Entry.Block.DELETABLE_FALSE_LIGHTEN ? a.img.replace(".png", "_un.png") : a.img; + this._boxMultiplier = a.boxMultiplier || 2; + this._highlightColor = a.highlightColor ? a.highlightColor : "#F59900"; + this._position = a.position; + this._index = c; + this._imgElement = this._path = this.svgGroup = null; + this.setValue(null); + this.renderStart(); +}; +Entry.Utils.inherit(Entry.Field, Entry.FieldIndicator); +(function(a) { + a.renderStart = function() { + this.svgGroup && this.svgGroup.remove(); + this.svgGroup = this._blockView.contentSvgGroup.elem("g"); + this._imgElement = this.svgGroup.elem("image", {href:Entry.mediaFilePath + this._imgUrl, x:this._position ? -1 * this._size : 0, y:-1 * this._size, width:2 * this._size, height:2 * this._size}); + var a = "m 0,-%s a %s,%s 0 1,1 -0.1,0 z".replace(/%s/gi, this._size); + this._path = this.svgGroup.elem("path", {d:a, stroke:"none", fill:"none"}); + this.box.set({width:this._size * this._boxMultiplier + (this._position ? -this._size : 0), height:this._size * this._boxMultiplier}); }; - b.getNextBlock = function() { - return this.thread.getNextBlock(this) || null; + a.enableHighlight = function() { + var a = this._path.getTotalLength(), c = this._path; + this._path.attr({stroke:this._highlightColor, strokeWidth:2, "stroke-linecap":"round", "stroke-dasharray":a + " " + a, "stroke-dashoffset":a}); + setInterval(function() { + c.attr({"stroke-dashoffset":a}).animate({"stroke-dashoffset":0}, 300); + }, 1400, mina.easeout); + setTimeout(function() { + setInterval(function() { + c.animate({"stroke-dashoffset":-a}, 300); + }, 1400, mina.easeout); + }, 500); }; - b.getLastBlock = function() { - return this.thread.getLastBlock(); +})(Entry.FieldIndicator.prototype); +Entry.Keyboard = {}; +Entry.FieldKeyboard = function(a, b, c) { + this._block = b.block; + this._blockView = b; + this.box = new Entry.BoxModel; + this.svgGroup = null; + this.position = a.position; + this._contents = a; + this._index = c; + this.setValue(String(this.getValue())); + this._optionVisible = !1; + this.renderStart(b); +}; +Entry.Utils.inherit(Entry.Field, Entry.FieldKeyboard); +(function(a) { + a.renderStart = function() { + this.svgGroup && $(this.svgGroup).remove(); + this.svgGroup = this._blockView.contentSvgGroup.elem("g", {class:"entry-input-field"}); + this.textElement = this.svgGroup.elem("text").attr({x:4, y:4, "font-size":"11px"}); + this.textElement.textContent = Entry.getKeyCodeMap()[this.getValue()]; + var a = this.getTextWidth(), c = this.position && this.position.y ? this.position.y : 0; + this._header = this.svgGroup.elem("rect", {x:0, y:c - 8, width:a, height:16, rx:3, ry:3, fill:"#fff", "fill-opacity":.4}); + this.svgGroup.appendChild(this.textElement); + this._bindRenderOptions(); + this.box.set({x:0, y:0, width:a, height:16}); }; - b.getOutputBlock = function() { - for (var a = this._schema.params, b = 0;a && b < a.length;b++) { - if ("Output" === a[b].type) { - return this.params[b]; - } - } - return null; + a.renderOptions = function() { + Entry.keyPressed && (this.keyPressed = Entry.keyPressed.attach(this, this._keyboardControl)); + this._optionVisible = !0; + this._attachDisposeEvent(); + var a = this.getAbsolutePosFromDocument(); + a.x -= this.box.width / 2; + a.y += this.box.height / 2 + 1; + this.optionGroup = Entry.Dom("img", {class:"entry-widget-keyboard-input", src:Entry.mediaFilePath + "/media/keyboard_workspace.png", parent:$("body")}); + this.optionGroup.css({left:a.x, top:a.y}); }; - b.getTerminateOutputBlock = function() { - for (var a = this;;) { - var b = a.getOutputBlock(); - if (!b) { - return a; - } - a = b; - } + a.destroyOption = function() { + this.disposeEvent && (Entry.disposeEvent.detach(this.disposeEvent), delete this.disposeEvent); + this.optionGroup && (this.optionGroup.remove(), delete this.optionGroup); + this._optionVisible = !1; + this.command(); + this.keyPressed && (Entry.keyPressed.detach(this.keyPressed), delete this.keyPressed); }; - b.getBlockType = function() { - if (!this.view) { - return null; + a._keyboardControl = function(a) { + a.stopPropagation(); + if (this._optionVisible) { + a = a.keyCode; + var c = Entry.getKeyCodeMap()[a]; + void 0 !== c && this.applyValue(c, a); } - var a = Entry.skeleton[this._schema.skeleton].magnets(this.view); - return a.next || a.previous ? "basic" : a.boolean || a.string ? "field" : a.output ? "output" : null; - }; - b.indexOfStatements = function(a) { - return this.statements.indexOf(a); }; - b.pointer = function(a) { - a || (a = []); - return this.thread.pointer(a, this); + a.applyValue = function(a, c) { + this.setValue(String(c)); + this.destroyOption(); + this.textElement.textContent = a; + this.resize(); }; - b.targetPointer = function() { - var a = this.thread.pointer([], this); - 4 === a.length && 0 === a[3] && a.pop(); - return a; + a.resize = function() { + var a = this.getTextWidth(); + this._header.attr({width:a}); + this.box.set({width:a}); + this._blockView.alignContent(); }; - b.getBlockList = function(a) { - var b = []; - if (!this._schema) { - return []; - } - if (a && this._schema.isPrimitive) { - return b; - } - b.push(this); - for (var d = this.params, e = 0;e < d.length;e++) { - var f = d[e]; - f && f.constructor == Entry.Block && (b = b.concat(f.getBlockList(a))); - } - if (d = this.statements) { - for (e = 0;e < d.length;e++) { - b = b.concat(d[e].getBlockList(a)); - } - } - return b; + a.getTextWidth = function() { + return this.textElement.getComputedTextLength() + 8; }; - b.stringify = function() { - return JSON.stringify(this.toJSON()); + a.destroy = function() { + this.destroyOption(); + Entry.keyPressed && this.keyPressed && Entry.keyPressed.detach(this.keyPressed); }; -})(Entry.Block.prototype); -Entry.ThreadView = function(b, a) { - Entry.Model(this, !1); - this.thread = b; - this.svgGroup = a.svgThreadGroup.elem("g"); - this.parent = a; +})(Entry.FieldKeyboard.prototype); +Entry.FieldLineBreak = function(a, b, c) { + this._block = b.block; + this._blockView = b; + this._index = c; + this.box = new Entry.BoxModel; + this.setValue(null); + this.renderStart(); }; -(function(b) { - b.schema = {height:0, zIndex:0}; - b.destroy = function() { - this.svgGroup.remove(); - }; - b.setParent = function(a) { - this.parent = a; - }; - b.getParent = function() { - return this.parent; +Entry.Utils.inherit(Entry.Field, Entry.FieldLineBreak); +(function(a) { + a.renderStart = function() { }; - b.renderText = function() { - for (var a = this.thread.getBlocks(), b = 0;b < a.length;b++) { - a[b].view.renderText(); - } + a.align = function(a) { + var c = this._blockView; + 0 !== c._statements.length && this.box.set({y:(c._statements[a].height || 20) + Math.max(c.contentHeight % 1E3, 30)}); }; - b.renderBlock = function() { - for (var a = this.thread.getBlocks(), b = 0;b < a.length;b++) { - a[b].view.renderBlock(); - } +})(Entry.FieldLineBreak.prototype); +Entry.FieldOutput = function(a, b, c, d, e) { + Entry.Model(this, !1); + this._blockView = b; + this._block = b.block; + this._valueBlock = null; + this.box = new Entry.BoxModel; + this.changeEvent = new Entry.Event(this); + this._index = c; + this.contentIndex = e; + this._content = a; + this.acceptType = a.accept; + this.view = this; + this.svgGroup = null; + this._position = a.position; + this.box.observe(b, "alignContent", ["width", "height"]); + this.observe(this, "_updateBG", ["magneting"], !1); + this.renderStart(b.getBoard(), d); +}; +Entry.Utils.inherit(Entry.Field, Entry.FieldOutput); +(function(a) { + a.schema = {magneting:!1}; + a.renderStart = function(a, c) { + 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, c)); + this._updateValueBlock(d); + this._blockView.getBoard().constructor == Entry.BlockMenu && this._valueBlock && this._valueBlock.view.removeControl(); }; - b.requestAbsoluteCoordinate = function(a) { - var b = this.thread.getBlocks(), d = b.shift(), e = {x:0, y:0}; - for (this.parent instanceof Entry.Board || this.parent instanceof Entry.BlockMenu || (e = this.parent.requestAbsoluteCoordinate());d && d.view !== a && d.view;) { - d = d.view, e.x += d.x + d.magnet.next.x, e.y += d.y + d.magnet.next.y, d = b.shift(); - } - return e; + a.align = function(a, c, d) { + var e = this.svgGroup; + this._position && (this._position.x && (a = this._position.x), this._position.y && (c = this._position.y)); + var f = this._valueBlock; + f && (c = -.5 * f.view.height); + f = "translate(" + a + "," + c + ")"; + void 0 === d || d ? e.animate({transform:f}, 300, mina.easeinout) : e.attr({transform:f}); + this.box.set({x:a, y:c}); }; - b.requestPartHeight = function(a, b) { - for (var d = this.thread.getBlocks(), e = d.pop(), f = a ? a.magnet.next ? a.magnet.next.y : a.height : 0;e && e.view !== a && e.view;) { - e = e.view, f = e.magnet.next ? f + e.magnet.next.y : f + e.height, e.dragMode === Entry.DRAG_MODE_DRAG && (f = 0), e = d.pop(); - } - return f; + a.calcWH = function() { + var a = this._valueBlock; + a ? (a = a.view, this.box.set({width:a.width, height:a.height})) : this.box.set({width:0, height:20}); }; - b.dominate = function() { - this.parent.dominate(this.thread); + a.calcHeight = a.calcWH; + a.destroy = function() { }; - b.isGlobal = function() { - return this.parent instanceof Entry.Board; + a._inspectBlock = function() { }; - b.reDraw = function() { - for (var a = this.thread._data, b = a.length - 1;0 <= b;b--) { - a[b].view.reDraw(); + a._setValueBlock = function(a) { + if (a != this._valueBlock || !this._valueBlock) { + return this._valueBlock = a, this.setValue(a), a && a.setThread(this), this._valueBlock; } }; - b.setZIndex = function(a) { - this.set({zIndex:a}); + a._updateValueBlock = function(a) { + a instanceof Entry.Block || (a = void 0); + this._sizeObserver && this._sizeObserver.destroy(); + this._posObserver && this._posObserver.destroy(); + (a = this._setValueBlock(a)) ? (a = a.view, a.bindPrev(), this._posObserver = a.observe(this, "_updateValueBlock", ["x", "y"], !1), this._sizeObserver = a.observe(this, "calcWH", ["width", "height"])) : this.calcWH(); + this._blockView.alignContent(); + a = this._blockView.getBoard(); + a.constructor === Entry.Board && a.generateCodeMagnetMap(); }; -})(Entry.ThreadView.prototype); -Entry.FieldTrashcan = function(b) { - b && this.setBoard(b); - this.dragBlockObserver = this.dragBlock = null; - this.isOver = !1; - Entry.windowResized && Entry.windowResized.attach(this, this.setPosition); -}; -(function(b) { - b._generateView = function() { - this.svgGroup = this.board.svg.elem("g"); - this.renderStart(); - this._addControl(); + a.getPrevBlock = function(a) { + return this._valueBlock === a ? this : null; }; - b.renderStart = function() { - var a = Entry.mediaFilePath + "delete_"; - this.trashcanTop = this.svgGroup.elem("image", {href:a + "cover.png", width:60, height:20}); - this.svgGroup.elem("image", {href:a + "body.png", y:20, width:60, height:60}); + a.getNextBlock = function() { + return null; }; - b._addControl = function() { - $(this.svgGroup).bind("mousedown", function(a) { - Entry.Utils.isRightButton(a) && (a.stopPropagation(), $("#entryWorkspaceBoard").css("background", "white")); - }); + a.requestAbsoluteCoordinate = function(a) { + a = this._blockView; + var c = a.contentPos; + a = a.getAbsoluteCoordinate(); + a.x += this.box.x + c.x; + a.y += this.box.y + c.y; + return a; }; - b.updateDragBlock = function() { - var a = this.board.dragBlock, b = this.dragBlockObserver; - b && (b.destroy(), this.dragBlockObserver = null); - a ? this.dragBlockObserver = a.observe(this, "checkBlock", ["x", "y"]) : (this.isOver && this.dragBlock && !this.dragBlock.block.getPrevBlock() && (this.dragBlock.block.doDestroyBelow(!0), createjs.Sound.play("entryDelete")), this.tAnimation(!1)); - this.dragBlock = a; - }; - b.checkBlock = function() { - var a = this.dragBlock; - if (a && a.block.isDeletable()) { - var b = this.board.offset(), d = this.getPosition(), e = d.x + b.left, b = d.y + b.top, f, g; - if (a = a.dragInstance) { - f = a.offsetX, g = a.offsetY; - } - this.tAnimation(f >= e && g >= b); - } + a.dominate = function() { + this._blockView.dominate(); }; - b.align = function() { - var a = this.getPosition(); - this.svgGroup.attr({transform:"translate(" + a.x + "," + a.y + ")"}); + a.isGlobal = function() { + return !1; }; - b.setPosition = function() { - if (this.board) { - var a = this.board.svgDom; - this._x = a.width() - 110; - this._y = a.height() - 110; - this.align(); - } + a.separate = function(a) { + this.getCode().createThread([a]); + this.changeEvent.notify(); }; - b.getPosition = function() { - return {x:this._x, y:this._y}; + a.getCode = function() { + return this._block.thread.getCode(); }; - b.tAnimation = function(a) { - if (a !== this.isOver) { - a = void 0 === a ? !0 : a; - var b, d = this.trashcanTop; - b = a ? {translateX:15, translateY:-25, rotateZ:30} : {translateX:0, translateY:0, rotateZ:0}; - $(d).velocity(b, {duration:50}); - this.isOver = a; - } + a.cut = function(a) { + return this._valueBlock === a ? (delete this._valueBlock, [a]) : null; }; - b.setBoard = function(a) { - this._dragBlockObserver && this._dragBlockObserver.destroy(); - this.board = a; - this.svgGroup || this._generateView(); - var b = a.svg, d = b.firstChild; - d ? b.insertBefore(this.svgGroup, d) : b.appendChild(this.svgGroup); - this._dragBlockObserver = a.observe(this, "updateDragBlock", ["dragBlock"]); - this.svgGroup.attr({filter:"url(#entryTrashcanFilter_" + a.suffix + ")"}); - this.setPosition(); + a._updateBG = function() { + this.magneting ? this._bg = this.svgGroup.elem("path", {d:"m -4,-12 h 3 l 2,2 0,3 3,0 1,1 0,12 -1,1 -3,0 0,3 -2,2 h -3 ", fill:"#fff", stroke:"#fff", "fill-opacity":.7, transform:"translate(0," + (this._valueBlock ? 12 : 0) + ")"}) : this._bg && (this._bg.remove(), delete this._bg); }; -})(Entry.FieldTrashcan.prototype); -Entry.Vim = function(b) { - b = "string" === typeof b ? $("#" + b) : $(b); - if ("DIV" !== b.prop("tagName")) { - return console.error("Dom is not div element"); - } - this.createDom(b); - this._parser = new Entry.Parser("maze", "js", this.codeMirror); - this._blockParser = new Entry.Parser("maze", "block"); - Entry.Model(this, !1); - window.eventset = []; -}; -(function(b) { - b.createDom = function(a) { - function b(a) { - var c = e.getCodeToText(a.block); - e.codeMirror.display.dragFunctions.leave(a); - var d = Entry.Utils.createMouseEvent("mousedown", a); - e.codeMirror.display.scroller.dispatchEvent(d); - var c = c.split("\n"), k = c.length - 1, l = 0; - c.forEach(function(a, b) { - e.codeMirror.replaceSelection(a); - l = e.doc.getCursor().line; - e.codeMirror.indentLine(l); - 0 !== b && k === b || e.codeMirror.replaceSelection("\n"); - }); - a = Entry.Utils.createMouseEvent("mouseup", a); - e.codeMirror.display.scroller.dispatchEvent(a); - } - 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); + a.replace = function(a) { + var c = this._valueBlock; + c && (c.view._toGlobalCoordinate(), a.getTerminateOutputBlock().view._contents[1].replace(c)); + this._updateValueBlock(a); + a.view._toLocalCoordinate(this.svgGroup); + this.calcWH(); }; - b.hide = function() { - this.view.addClass("entryRemove"); + a.setParent = function(a) { + this._parent = a; }; - b.show = function() { - this.view.removeClass("entryRemove"); + a.getParent = function() { + return this._parent; }; - 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; + a.getThread = function() { + return this; }; - b.codeToText = function(a) { - a = this._blockParser.parse(a); - this.codeMirror.setValue(a); + a.getValueBlock = function() { + return this._valueBlock; }; - b.getCodeToText = function(a) { - return this._blockParser.parse(a); + a.pointer = function(a) { + a.unshift(this._index); + a.unshift(Entry.PARAM); + return this._block.pointer(a); }; -})(Entry.Vim.prototype); -Entry.Workspace = function(b) { +})(Entry.FieldOutput.prototype); +Entry.FieldStatement = function(a, b, c) { 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); + this._blockView = b; + this.block = b.block; + this.view = this; + this._index = c; + this.acceptType = a.accept; + this._thread = this.statementSvgGroup = this.svgGroup = null; + this._position = a.position; + this.observe(b, "alignContent", ["height"], !1); + this.observe(this, "_updateBG", ["magneting"], !1); + this.renderStart(b.getBoard()); }; -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; +(function(a) { + a.schema = {x:0, y:0, width:100, height:20, magneting:!1}; + a.magnet = {next:{x:0, y:0}}; + a.renderStart = function(a) { + this.svgGroup = this._blockView.statementSvgGroup.elem("g"); + this._nextGroup = this.statementSvgGroup = this.svgGroup.elem("g"); + this._initThread(a); + this._board = a; }; - b.getBlockMenu = function() { - return this.blockMenu; + a._initThread = function(a) { + var c = this.getValue(); + this._thread = c; + c.createView(a); + c.view.setParent(this); + if (a = c.getFirstBlock()) { + a.view._toLocalCoordinate(this.statementSvgGroup), this.firstBlock = a; + } + c.changeEvent.attach(this, this.calcHeight); + c.changeEvent.attach(this, this.checkTopBlock); + this.calcHeight(); }; - b.getVimBoard = function() { - return this.vimBoard; + a.align = function(a, c, d) { + d = void 0 === d ? !0 : d; + var e = this.svgGroup; + this._position && (this._position.x && (a = this._position.x), this._position.y && (c = this._position.y)); + var f = "translate(" + a + "," + c + ")"; + this.set({x:a, y:c}); + d ? e.animate({transform:f}, 300, mina.easeinout) : e.attr({transform:f}); }; - b.getMode = function() { - return this.mode; + a.calcHeight = function() { + var a = this._thread.view.requestPartHeight(null); + this.set({height:a}); }; - 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}); - 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); + a.getValue = function() { + return this.block.statements[this._index]; }; - b.changeBoardCode = function(a) { - this.board.changeCode(a); + a.requestAbsoluteCoordinate = function() { + var a = this._blockView.getAbsoluteCoordinate(); + a.x += this.x; + a.y += this.y; + return a; }; - b.changeOverlayBoardCode = function(a) { - this.overlayBoard && this.overlayBoard.changeCode(a); + a.dominate = function() { + this._blockView.dominate(); }; - b.changeBlockMenuCode = function(a) { - this.blockMenu.changeCode(a); + a.destroy = function() { }; - 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(); + a._updateBG = function() { + if (this._board.dragBlock && this._board.dragBlock.dragInstance) { + if (this.magneting) { + var a = this._board.dragBlock.getShadow(), c = this.requestAbsoluteCoordinate(), c = "translate(" + c.x + "," + c.y + ")"; + $(a).attr({transform:c, display:"block"}); + this._clonedShadow = a; + this.background && (this.background.remove(), this.nextBackground.remove(), delete this.background, delete this.nextBackground); + a = this._board.dragBlock.getBelowHeight(); + this.statementSvgGroup.attr({transform:"translate(0," + a + ")"}); + this.set({height:this.height + a}); + } else { + this._clonedShadow && (this._clonedShadow.attr({display:"none"}), delete this._clonedShadow), a = this.originalHeight, void 0 !== a && (this.background && (this.background.remove(), this.nextBackground.remove(), delete this.background, delete this.nextBackground), delete this.originalHeight), this.statementSvgGroup.attr({transform:"translate(0,0)"}), this.calcHeight(); + } + (a = this.block.thread.changeEvent) && a.notify(); } }; - 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)}); + a.insertTopBlock = function(a) { + this._posObserver && this._posObserver.destroy(); + var c = this.firstBlock; + (this.firstBlock = a) && a.doInsert(this._thread); + return c; }; - b.initOverlayBoard = function() { - this.overlayBoard = new Entry.Board({dom:this.board.view, workspace:this, isOverlay:!0}); - this.overlayBoard.changeCode(new Entry.Code([])); - this.overlayBoard.workspace = this; - this.overlayBoard.observe(this, "_setSelectedBlockView", ["selectedBlockView"], !1); + a.getNextBlock = function() { + return this.firstBlock; }; - b._keyboardControl = function(a) { - var b = a.keyCode || a.which, d = a.ctrlKey; - if (!Entry.Utils.isInInput(a)) { - var e = this.selectedBlockView; - e && !e.isInBlockMenu && e.block.isDeletable() && (8 == b || 46 == b ? (Entry.do("destroyBlock", e.block), a.preventDefault()) : d && (67 == b ? e.block.copyToClipboard() : 88 == b && (a = e.block, a.copyToClipboard(), a.destroy(!0, !0), e.getBoard().setSelectedBlock(null)))); - d && 86 == b && (b = this.selectedBoard) && b instanceof Entry.Board && Entry.clipboard && Entry.do("addThread", Entry.clipboard).value.getFirstBlock().copyToClipboard(); - } + a.checkTopBlock = function() { + var a = this._thread.getFirstBlock(); + a && this.firstBlock !== a ? (this.firstBlock = a, a.view.bindPrev(this), a._updatePos()) : a || (this.firstBlock = null); }; - b._handleChangeBoard = function() { - var a = this.selectedBoard; - a && a.constructor === Entry.Board && this.trashcan.setBoard(a); +})(Entry.FieldStatement.prototype); +Entry.FieldText = function(a, b, c) { + this._block = b.block; + this._blockView = b; + this._index = c; + this.box = new Entry.BoxModel; + this._fontSize = a.fontSize || b.getSkeleton().fontSize || 12; + this._color = a.color || this._block.getSchema().fontColor || b.getSkeleton().color || "white"; + this._align = a.align || "left"; + this._text = this.getValue() || a.text; + this.setValue(null); + this.textElement = null; + this.renderStart(b); +}; +Entry.Utils.inherit(Entry.Field, Entry.FieldText); +(function(a) { + a.renderStart = function() { + this.svgGroup && $(this.svgGroup).remove(); + this.svgGroup = this._blockView.contentSvgGroup.elem("g"); + this._text = this._text.replace(/(\r\n|\n|\r)/gm, " "); + this.textElement = this.svgGroup.elem("text").attr({style:"white-space: pre;", "font-size":this._fontSize + "px", "font-family":"nanumBarunRegular", "class":"dragNone", fill:this._color}); + this.textElement.textContent = this._text; + var a = 0, c = this.textElement.getBoundingClientRect(); + "center" == this._align && (a = -c.width / 2); + this.textElement.attr({x:a, y:.25 * c.height}); + this.box.set({x:0, y:0, width:c.width, height:c.height}); }; -})(Entry.Workspace.prototype); -Entry.Playground = function() { - this.enableArduino = this.isTextBGMode_ = !1; - this.viewMode_ = "default"; - Entry.addEventListener("textEdited", this.injectText); - Entry.addEventListener("hwChanged", this.updateHW); +})(Entry.FieldText.prototype); +Entry.FieldTextInput = function(a, b, c) { + this._blockView = b; + this._block = b.block; + this.box = new Entry.BoxModel; + this.svgGroup = null; + this.position = a.position; + this._contents = a; + this._index = c; + this.value = this.getValue() || ""; + this.renderStart(); }; -Entry.Playground.prototype.generateView = function(b, a) { - this.view_ = b; - this.view_.addClass("entryPlayground"); - if (a && "workspace" != a) { - "phone" == a && (this.view_.addClass("entryPlaygroundPhone"), c = Entry.createElement("div", "entryCategoryTab"), c.addClass("entryPlaygroundTabPhone"), Entry.view_.insertBefore(c, this.view_), this.generateTabView(c), this.tabView_ = c, c = Entry.createElement("div", "entryCurtain"), c.addClass("entryPlaygroundCurtainPhone"), c.addClass("entryRemove"), c.innerHTML = Lang.Workspace.cannot_edit_click_to_stop, c.bindOnClick(function() { - Entry.engine.toggleStop(); - }), this.view_.appendChild(c), this.curtainView_ = c, Entry.pictureEditable && (c = Entry.createElement("div", "entryPicture"), c.addClass("entryPlaygroundPicturePhone"), c.addClass("entryRemove"), this.view_.appendChild(c), this.generatePictureView(c), this.pictureView_ = c), c = Entry.createElement("div", "entryText"), c.addClass("entryRemove"), this.view_.appendChild(c), this.generateTextView(c), this.textView_ = c, Entry.soundEditable && (c = Entry.createElement("div", "entrySound"), c.addClass("entryPlaygroundSoundWorkspacePhone"), - c.addClass("entryRemove"), this.view_.appendChild(c), this.generateSoundView(c), this.soundView_ = c), c = Entry.createElement("div", "entryDefault"), this.view_.appendChild(c), this.generateDefaultView(c), this.defaultView_ = c, c = Entry.createElement("div", "entryCode"), c.addClass("entryPlaygroundCodePhone"), this.view_.appendChild(c), this.generateCodeView(c), this.codeView_ = this.codeView_ = c, Entry.addEventListener("run", function(a) { - Entry.playground.curtainView_.removeClass("entryRemove"); - }), Entry.addEventListener("stop", function(a) { - Entry.playground.curtainView_.addClass("entryRemove"); - })); - } else { - this.view_.addClass("entryPlaygroundWorkspace"); - var c = Entry.createElement("div", "entryCategoryTab"); - c.addClass("entryPlaygroundTabWorkspace"); - this.view_.appendChild(c); - this.generateTabView(c); - this.tabView_ = c; - c = Entry.createElement("div", "entryCurtain"); - c.addClass("entryPlaygroundCurtainWorkspace"); - c.addClass("entryRemove"); - var d = Lang.Workspace.cannot_edit_click_to_stop.split("."); - c.innerHTML = d[0] + ".
" + d[1]; - c.addEventListener("click", function() { - Entry.engine.toggleStop(); - }); - this.view_.appendChild(c); - this.curtainView_ = c; - Entry.pictureEditable && (c = Entry.createElement("div", "entryPicture"), c.addClass("entryPlaygroundPictureWorkspace"), c.addClass("entryRemove"), this.view_.appendChild(c), this.generatePictureView(c), this.pictureView_ = c); - c = Entry.createElement("div", "entryText"); - c.addClass("entryPlaygroundTextWorkspace"); - c.addClass("entryRemove"); - this.view_.appendChild(c); - this.generateTextView(c); - this.textView_ = c; - Entry.soundEditable && (c = Entry.createElement("div", "entrySound"), c.addClass("entryPlaygroundSoundWorkspace"), c.addClass("entryRemove"), this.view_.appendChild(c), this.generateSoundView(c), this.soundView_ = c); - c = Entry.createElement("div", "entryDefault"); - c.addClass("entryPlaygroundDefaultWorkspace"); - this.view_.appendChild(c); - this.generateDefaultView(c); - this.defaultView_ = c; - c = Entry.createElement("div", "entryCode"); - c.addClass("entryPlaygroundCodeWorkspace"); - c.addClass("entryRemove"); - this.view_.appendChild(c); - this.generateCodeView(c); - this.codeView_ = c; - d = Entry.createElement("div"); - d.addClass("entryPlaygroundResizeWorkspace", "entryRemove"); - this.resizeHandle_ = d; - this.view_.appendChild(d); - this.initializeResizeHandle(d); - this.codeView_ = c; - Entry.addEventListener("run", function(a) { - Entry.playground.curtainView_.removeClass("entryRemove"); +Entry.Utils.inherit(Entry.Field, Entry.FieldTextInput); +(function(a) { + a.renderStart = function() { + this.svgGroup && $(this.svgGroup).remove(); + this.svgGroup = this._blockView.contentSvgGroup.elem("g"); + this.svgGroup.attr({class:"entry-input-field"}); + this.textElement = this.svgGroup.elem("text", {x:3, y:4, "font-size":"12px"}); + this.textElement.textContent = this.truncate(); + var a = this.getTextWidth(), c = this.position && this.position.y ? this.position.y : 0; + this._header = this.svgGroup.elem("rect", {width:a, height:16, y:c - 8, rx:3, ry:3, fill:"transparent"}); + this.svgGroup.appendChild(this.textElement); + this._bindRenderOptions(); + this.box.set({x:0, y:0, width:a, height:16}); + }; + a.renderOptions = function() { + var a = this; + this._attachDisposeEvent(function() { + a.applyValue(); + a.destroyOption(); }); - Entry.addEventListener("stop", function(a) { - Entry.playground.curtainView_.addClass("entryRemove"); + this.optionGroup = Entry.Dom("input", {class:"entry-widget-input-field", parent:$("body")}); + this.optionGroup.val(this.getValue()); + this.optionGroup.on("mousedown", function(a) { + a.stopPropagation(); }); - } -}; -Entry.Playground.prototype.generateDefaultView = function(b) { - return b; -}; -Entry.Playground.prototype.generateTabView = function(b) { - var a = this, c = Entry.createElement("ul"); - c.addClass("entryTabListWorkspace"); - this.tabList_ = c; - b.appendChild(c); - this.tabViewElements = {}; - b = Entry.createElement("li", "entryCodeTab"); - b.innerHTML = Lang.Workspace.tab_code; - b.addClass("entryTabListItemWorkspace"); - b.addClass("entryTabSelected"); - c.appendChild(b); - b.bindOnClick(function(b) { - a.changeViewMode("code"); - a.blockMenu.reDraw(); - }); - this.tabViewElements.code = b; - Entry.pictureEditable && (b = Entry.createElement("li", "entryPictureTab"), b.innerHTML = Lang.Workspace.tab_picture, b.addClass("entryTabListItemWorkspace"), c.appendChild(b), b.bindOnClick(function(a) { - Entry.playground.changeViewMode("picture"); - }), this.tabViewElements.picture = b, b = Entry.createElement("li", "entryTextboxTab"), b.innerHTML = Lang.Workspace.tab_text, b.addClass("entryTabListItemWorkspace"), c.appendChild(b), b.bindOnClick(function(a) { - Entry.playground.changeViewMode("text"); - }), this.tabViewElements.text = b, b.addClass("entryRemove")); - Entry.soundEditable && (b = Entry.createElement("li", "entrySoundTab"), b.innerHTML = Lang.Workspace.tab_sound, b.addClass("entryTabListItemWorkspace"), c.appendChild(b), b.bindOnClick(function(a) { - Entry.playground.changeViewMode("sound"); - }), this.tabViewElements.sound = b); - Entry.hasVariableManager && (b = Entry.createElement("li", "entryVariableTab"), b.innerHTML = Lang.Workspace.tab_attribute, b.addClass("entryTabListItemWorkspace"), b.addClass("entryVariableTabWorkspace"), c.appendChild(b), b.bindOnClick(function(a) { - Entry.playground.toggleOnVariableView(); - Entry.playground.changeViewMode("variable"); - }), this.tabViewElements.variable = b); -}; -Entry.Playground.prototype.generateCodeView = function(b) { - var a = this.createVariableView(); - b.appendChild(a); - this.variableView_ = a; - b = Entry.Dom(b); - a = Entry.Dom("div", {parent:b, id:"entryWorkspaceBoard", class:"entryWorkspaceBoard"}); - b = Entry.Dom("div", {parent:b, id:"entryWorkspaceBlockMenu", class:"entryWorkspaceBlockMenu"}); - this.mainWorkspace = new Entry.Workspace({blockMenu:{dom:b, align:"LEFT", categoryData:EntryStatic.getAllBlocks(), scroll:!0}, board:{dom:a}}); - this.blockMenu = this.mainWorkspace.blockMenu; - this.board = this.mainWorkspace.board; - Entry.hw && this.updateHW(); -}; -Entry.Playground.prototype.generatePictureView = function(b) { - if ("workspace" == Entry.type) { - var a = Entry.createElement("div", "entryAddPicture"); - a.addClass("entryPlaygroundAddPicture"); - a.bindOnClick(function(a) { - Entry.dispatchEvent("openPictureManager"); + this.optionGroup.on("keyup", function(c) { + var e = c.keyCode || c.which; + a.applyValue(c); + -1 < [13, 27].indexOf(e) && a.destroyOption(); }); - var c = Entry.createElement("div", "entryAddPictureInner"); - c.addClass("entryPlaygroundAddPictureInner"); - c.innerHTML = Lang.Workspace.picture_add; - a.appendChild(c); - b.appendChild(a); - a = Entry.createElement("ul", "entryPictureList"); - a.addClass("entryPlaygroundPictureList"); - $ && $(a).sortable({start:function(a, b) { - b.item.data("start_pos", b.item.index()); - }, stop:function(a, b) { - var c = b.item.data("start_pos"), g = b.item.index(); - Entry.playground.movePicture(c, g); - }, axis:"y"}); - b.appendChild(a); - this.pictureListView_ = a; - a = Entry.createElement("div", "entryPainter"); - a.addClass("entryPlaygroundPainter"); - b.appendChild(a); - this.painter = new Entry.Painter; - this.painter.initialize(a); - } else { - "phone" == Entry.type && (a = Entry.createElement("div", "entryAddPicture"), a.addClass("entryPlaygroundAddPicturePhone"), a.bindOnClick(function(a) { - Entry.dispatchEvent("openPictureManager"); - }), c = Entry.createElement("div", "entryAddPictureInner"), c.addClass("entryPlaygroundAddPictureInnerPhone"), c.innerHTML = Lang.Workspace.picture_add, a.appendChild(c), b.appendChild(a), a = Entry.createElement("ul", "entryPictureList"), a.addClass("entryPlaygroundPictureListPhone"), $ && $(a).sortable({start:function(a, b) { - b.item.data("start_pos", b.item.index()); - }, stop:function(a, b) { - var c = b.item.data("start_pos"), g = b.item.index(); - Entry.playground.movePicture(c, g); - }, axis:"y"}), b.appendChild(a), this.pictureListView_ = a); - } -}; -Entry.Playground.prototype.generateTextView = function(b) { - var a = Entry.createElement("div"); - b.appendChild(a); - b = Entry.createElement("div"); - b.addClass("textProperties"); - a.appendChild(b); - var c = Entry.createElement("div"); - c.addClass("entryTextFontSelect"); - b.appendChild(c); - var d = Entry.createElement("select", "entryPainterAttrFontName"); - d.addClass("entryPlaygroundPainterAttrFontName", "entryTextFontSelecter"); - d.size = "1"; - d.onchange = function(a) { - Entry.playground.object.entity.setFontType(a.target.value); + var c = this.getAbsolutePosFromDocument(); + c.y -= this.box.height / 2; + this.optionGroup.css({height:16, left:c.x, top:c.y, width:a.box.width}); + this.optionGroup.focus(); + c = this.optionGroup[0]; + c.setSelectionRange(0, c.value.length, "backward"); }; - for (var e = 0;e < Entry.fonts.length;e++) { - var f = Entry.fonts[e], g = Entry.createElement("option"); - g.value = f.family; - g.innerHTML = f.name; - d.appendChild(g); - } - this.fontName_ = d; - c.appendChild(d); - e = Entry.createElement("ul"); - e.addClass("entryPlayground_text_buttons"); - b.appendChild(e); - c = Entry.createElement("li"); - c.addClass("entryPlaygroundTextAlignLeft"); - c.bindOnClick(function(a) { - Entry.playground.setFontAlign(Entry.TEXT_ALIGN_LEFT); - }); - e.appendChild(c); - this.alignLeftBtn = c; - c = Entry.createElement("li"); - c.addClass("entryPlaygroundTextAlignCenter"); - c.bindOnClick(function(a) { - Entry.playground.setFontAlign(Entry.TEXT_ALIGN_CENTER); - }); - e.appendChild(c); - this.alignCenterBtn = c; - c = Entry.createElement("li"); - c.addClass("entryPlaygroundTextAlignRight"); - c.bindOnClick(function(a) { - Entry.playground.setFontAlign(Entry.TEXT_ALIGN_RIGHT); - }); - e.appendChild(c); - this.alignRightBtn = c; - c = Entry.createElement("li"); - e.appendChild(c); - d = Entry.createElement("a"); - c.appendChild(d); - d.bindOnClick(function() { - Entry.playground.object.entity.toggleFontBold() ? h.src = Entry.mediaFilePath + "text_button_bold_true.png" : h.src = Entry.mediaFilePath + "text_button_bold_false.png"; - }); - var h = Entry.createElement("img", "entryPlaygroundText_boldImage"); - d.appendChild(h); - h.src = Entry.mediaFilePath + "text_button_bold_false.png"; - c = Entry.createElement("li"); - e.appendChild(c); - d = Entry.createElement("a"); - c.appendChild(d); - d.bindOnClick(function() { - var a = !Entry.playground.object.entity.getUnderLine() || !1; - k.src = Entry.mediaFilePath + "text_button_underline_" + a + ".png"; - Entry.playground.object.entity.setUnderLine(a); - }); - var k = Entry.createElement("img", "entryPlaygroundText_underlineImage"); - d.appendChild(k); - k.src = Entry.mediaFilePath + "text_button_underline_false.png"; - c = Entry.createElement("li"); - e.appendChild(c); - d = Entry.createElement("a"); - c.appendChild(d); - d.bindOnClick(function() { - Entry.playground.object.entity.toggleFontItalic() ? l.src = Entry.mediaFilePath + "text_button_italic_true.png" : l.src = Entry.mediaFilePath + "/text_button_italic_false.png"; - }); - var l = Entry.createElement("img", "entryPlaygroundText_italicImage"); - d.appendChild(l); - l.src = Entry.mediaFilePath + "text_button_italic_false.png"; - c = Entry.createElement("li"); - e.appendChild(c); - d = Entry.createElement("a"); - c.appendChild(d); - d.bindOnClick(function() { - var a = !Entry.playground.object.entity.getStrike() || !1; - Entry.playground.object.entity.setStrike(a); - q.src = Entry.mediaFilePath + "text_button_strike_" + a + ".png"; - }); - var q = Entry.createElement("img", "entryPlaygroundText_strikeImage"); - d.appendChild(q); - q.src = Entry.mediaFilePath + "text_button_strike_false.png"; - d = Entry.createElement("li"); - e.appendChild(d); - c = Entry.createElement("a"); - d.appendChild(c); - c.bindOnClick(function() { - Entry.playground.toggleColourChooser("foreground"); - }); - d = Entry.createElement("img"); - c.appendChild(d); - d.src = Entry.mediaFilePath + "text_button_color_false.png"; - c = Entry.createElement("li"); - e.appendChild(c); - e = Entry.createElement("a"); - c.appendChild(e); - e.bindOnClick(function() { - Entry.playground.toggleColourChooser("background"); - }); - c = Entry.createElement("img"); - e.appendChild(c); - c.src = Entry.mediaFilePath + "text_button_background_false.png"; - e = Entry.createElement("div"); - e.addClass("entryPlayground_fgColorDiv"); - c = Entry.createElement("div"); - c.addClass("entryPlayground_bgColorDiv"); - b.appendChild(e); - b.appendChild(c); - d = Entry.createElement("div"); - d.addClass("entryPlaygroundTextColoursWrapper"); - this.coloursWrapper = d; - a.appendChild(d); - b = Entry.getColourCodes(); - for (e = 0;e < b.length;e++) { - c = Entry.createElement("div"), c.addClass("modal_colour"), c.setAttribute("colour", b[e]), c.style.backgroundColor = b[e], 0 === e && c.addClass("modalColourTrans"), c.bindOnClick(function(a) { - Entry.playground.setTextColour(a.target.getAttribute("colour")); - }), d.appendChild(c); - } - d.style.display = "none"; - d = Entry.createElement("div"); - d.addClass("entryPlaygroundTextBackgroundsWrapper"); - this.backgroundsWrapper = d; - a.appendChild(d); - for (e = 0;e < b.length;e++) { - c = Entry.createElement("div"), c.addClass("modal_colour"), c.setAttribute("colour", b[e]), c.style.backgroundColor = b[e], 0 === e && c.addClass("modalColourTrans"), c.bindOnClick(function(a) { - Entry.playground.setBackgroundColour(a.target.getAttribute("colour")); - }), d.appendChild(c); - } - d.style.display = "none"; - b = Entry.createElement("input"); - b.addClass("entryPlayground_textBox"); - b.onkeyup = function() { - Entry.playground.object.setText(this.value); - Entry.playground.object.entity.setText(this.value); + a.applyValue = function(a) { + a = this.optionGroup.val(); + this.setValue(a); + this.textElement.textContent = this.truncate(); + this.resize(); + }; + a.resize = function() { + var a = this.getTextWidth(); + this._header.attr({width:a}); + this.optionGroup.css({width:a}); + this.box.set({width:a}); + this._blockView.alignContent(); + }; + a.getTextWidth = function() { + return this.textElement.getComputedTextLength() + 6 + 2; + }; +})(Entry.FieldTextInput.prototype); +Entry.GlobalSvg = {}; +(function(a) { + a.DONE = 0; + a._inited = !1; + a.REMOVE = 1; + a.RETURN = 2; + a.createDom = function() { + if (!this.inited) { + $("#globalSvgSurface").remove(); + $("#globalSvg").remove(); + var a = $("body"); + this._container = Entry.Dom("div", {classes:["globalSvgSurface", "entryRemove"], id:"globalSvgSurface", parent:a}); + this.svgDom = Entry.Dom($(''), {parent:this._container}); + this.svg = Entry.SVG("globalSvg"); + this.top = this.left = 0; + this._inited = !0; + } }; - b.onblur = function() { - Entry.dispatchEvent("textEdited"); + a.setView = function(a, c) { + if (a != this._view && !a.block.isReadOnly() && a.movable) { + return this._view = a, this._mode = c, c !== Entry.Workspace.MODE_VIMBOARD && a.set({visible:!1}), this.draw(), this.show(), this.align(), this.position(), !0; + } }; - this.textEditInput = b; - a.appendChild(b); - b = Entry.createElement("textarea"); - b.addClass("entryPlayground_textArea"); - b.style.display = "none"; - b.onkeyup = function() { - Entry.playground.object.setText(this.value); - Entry.playground.object.entity.setText(this.value); + a.draw = function() { + var a = this._view; + this._svg && this.remove(); + var c = this._mode == Entry.Workspace.MODE_VIMBOARD; + this.svgGroup = Entry.SVG.createElement(a.svgGroup.cloneNode(!0), {opacity:1}); + this.svg.appendChild(this.svgGroup); + c && (a = $(this.svgGroup), a.find("g").css({filter:"none"}), a.find("path").velocity({opacity:0}, {duration:500}), a.find("text").velocity({fill:"#000000"}, {duration:530})); }; - b.onblur = function() { - Entry.dispatchEvent("textEdited"); + a.remove = function() { + this.svgGroup && (this.svgGroup.remove(), delete this.svgGroup, delete this._view, delete this._offsetX, delete this._offsetY, delete this._startX, delete this._startY, this.hide()); }; - this.textEditArea = b; - a.appendChild(b); - b = Entry.createElement("div"); - b.addClass("entryPlaygroundFontSizeWrapper"); - a.appendChild(b); - this.fontSizeWrapper = b; - var n = Entry.createElement("div"); - n.addClass("entryPlaygroundFontSizeSlider"); - b.appendChild(n); - var m = Entry.createElement("div"); - m.addClass("entryPlaygroundFontSizeIndicator"); - n.appendChild(m); - this.fontSizeIndiciator = m; - var r = Entry.createElement("div"); - r.addClass("entryPlaygroundFontSizeKnob"); - n.appendChild(r); - this.fontSizeKnob = r; - e = Entry.createElement("div"); - e.addClass("entryPlaygroundFontSizeLabel"); - e.innerHTML = "\uae00\uc790 \ud06c\uae30"; - b.appendChild(e); - var v = !1, u = 0; - r.onmousedown = function(a) { - v = !0; - u = $(n).offset().left; + a.align = function() { + var a = this._view.getSkeleton().box(this._view).offsetX || 0, c = this._view.getSkeleton().box(this._view).offsetY || 0, a = -1 * a + 1, c = -1 * c + 1; + this._offsetX = a; + this._offsetY = c; + this.svgGroup.attr({transform:"translate(" + a + "," + c + ")"}); }; - document.addEventListener("mousemove", function(a) { - v && (a = a.pageX - u, a = Math.max(a, 5), a = Math.min(a, 88), r.style.left = a + "px", a /= .88, m.style.width = a + "%", Entry.playground.object.entity.setFontSize(a)); - }); - document.addEventListener("mouseup", function(a) { - v = !1; - }); - b = Entry.createElement("div"); - b.addClass("entryPlaygroundLinebreakWrapper"); - a.appendChild(b); - a = Entry.createElement("hr"); - a.addClass("entryPlaygroundLinebreakHorizontal"); - b.appendChild(a); - a = Entry.createElement("div"); - a.addClass("entryPlaygroundLinebreakButtons"); - b.appendChild(a); - e = Entry.createElement("img"); - e.bindOnClick(function() { - Entry.playground.toggleLineBreak(!1); - t.innerHTML = Lang.Menus.linebreak_off_desc_1; - x.innerHTML = Lang.Menus.linebreak_off_desc_2; - y.innerHTML = Lang.Menus.linebreak_off_desc_3; - }); - e.src = Entry.mediaFilePath + "text-linebreak-off-true.png"; - a.appendChild(e); - this.linebreakOffImage = e; - e = Entry.createElement("img"); - e.bindOnClick(function() { - Entry.playground.toggleLineBreak(!0); - t.innerHTML = Lang.Menus.linebreak_on_desc_1; - x.innerHTML = Lang.Menus.linebreak_on_desc_2; - y.innerHTML = Lang.Menus.linebreak_on_desc_3; - }); - e.src = Entry.mediaFilePath + "text-linebreak-on-false.png"; - a.appendChild(e); - this.linebreakOnImage = e; - a = Entry.createElement("div"); - a.addClass("entryPlaygroundLinebreakDescription"); - b.appendChild(a); - var t = Entry.createElement("p"); - t.innerHTML = Lang.Menus.linebreak_off_desc_1; - a.appendChild(t); - b = Entry.createElement("ul"); - a.appendChild(b); - var x = Entry.createElement("li"); - x.innerHTML = Lang.Menus.linebreak_off_desc_2; - b.appendChild(x); - var y = Entry.createElement("li"); - y.innerHTML = Lang.Menus.linebreak_off_desc_3; - b.appendChild(y); -}; -Entry.Playground.prototype.generateSoundView = function(b) { - if ("workspace" == Entry.type) { - var a = Entry.createElement("div", "entryAddSound"); - a.addClass("entryPlaygroundAddSound"); - a.bindOnClick(function(a) { - Entry.dispatchEvent("openSoundManager"); - }); - var c = Entry.createElement("div", "entryAddSoundInner"); - c.addClass("entryPlaygroundAddSoundInner"); - c.innerHTML = Lang.Workspace.sound_add; - a.appendChild(c); - b.appendChild(a); - a = Entry.createElement("ul", "entrySoundList"); - a.addClass("entryPlaygroundSoundList"); - $ && $(a).sortable({start:function(a, b) { - b.item.data("start_pos", b.item.index()); - }, stop:function(a, b) { - var c = b.item.data("start_pos"), g = b.item.index(); - Entry.playground.moveSound(c, g); - }, axis:"y"}); - b.appendChild(a); - this.soundListView_ = a; - } else { - "phone" == Entry.type && (a = Entry.createElement("div", "entryAddSound"), a.addClass("entryPlaygroundAddSoundPhone"), a.bindOnClick(function(a) { - Entry.dispatchEvent("openSoundManager"); - }), c = Entry.createElement("div", "entryAddSoundInner"), c.addClass("entryPlaygroundAddSoundInnerPhone"), c.innerHTML = Lang.Workspace.sound_add, a.appendChild(c), b.appendChild(a), a = Entry.createElement("ul", "entrySoundList"), a.addClass("entryPlaygroundSoundListPhone"), $ && $(a).sortable({start:function(a, b) { - b.item.data("start_pos", b.item.index()); - }, stop:function(a, b) { - var c = b.item.data("start_pos"), g = b.item.index(); - Entry.playground.moveSound(c, g); - }, axis:"y"}), b.appendChild(a), this.soundListView_ = a); - } -}; -Entry.Playground.prototype.injectObject = function(b) { - if (!b) { - this.changeViewMode("code"), this.object = null; - } else { - if (b !== this.object) { - this.object && this.object.toggleInformation(!1); - this.object = b; - this.setMenu(b.objectType); - this.injectCode(); - "sprite" == b.objectType && Entry.pictureEditable ? (this.tabViewElements.text && this.tabViewElements.text.addClass("entryRemove"), this.tabViewElements.picture && this.tabViewElements.picture.removeClass("entryRemove")) : "textBox" == b.objectType && (this.tabViewElements.picture && this.tabViewElements.picture.addClass("entryRemove"), this.tabViewElements.text && this.tabViewElements.text.removeClass("entryRemove")); - var a = this.viewMode_; - "default" == a ? this.changeViewMode("code") : "picture" != a && "text" != a || "textBox" != b.objectType ? "text" != a && "picture" != a || "sprite" != b.objectType ? "sound" == a && this.changeViewMode("sound") : this.changeViewMode("picture") : this.changeViewMode("text"); - this.reloadPlayground(); - } - } -}; -Entry.Playground.prototype.injectCode = function() { - var b = this.mainWorkspace; - b.changeBoardCode(this.object.script); - b.getBoard().adjustThreadsPosition(); -}; -Entry.Playground.prototype.injectPicture = function() { - var b = this.pictureListView_; - if (b) { - for (;b.hasChildNodes();) { - b.removeChild(b.lastChild); + a.show = function() { + this._container.removeClass("entryRemove"); + }; + a.hide = function() { + this._container.addClass("entryRemove"); + }; + a.position = function() { + var a = this._view; + if (a) { + var c = a.getAbsoluteCoordinate(), a = a.getBoard().offset(); + this.left = c.x + a.left - this._offsetX; + this.top = c.y + a.top - this._offsetY; + this.svgDom.css({transform:"translate3d(" + this.left + "px," + this.top + "px, 0px)"}); } - if (this.object) { - for (var a = this.object.pictures, c = 0, d = a.length;c < d;c++) { - var e = a[c].view; - e || console.log(e); - e.orderHolder.innerHTML = c + 1; - b.appendChild(e); - } - this.selectPicture(this.object.selectedPicture); - } else { - Entry.dispatchEvent("pictureClear"); + }; + a.terminateDrag = function(a) { + var c = Entry.mouseCoordinate, d = a.getBoard(), e = d.workspace.blockMenu, f = e.offset().left, g = e.offset().top, h = e.visible ? e.svgDom.width() : 0; + return c.y > d.offset().top - 20 && c.x > f + h ? this.DONE : c.y > g && c.x > f && e.visible ? a.block.isDeletable() ? this.REMOVE : this.RETURN : this.RETURN; + }; + a.addControl = function(a) { + this.onMouseDown.apply(this, arguments); + }; + a.onMouseDown = function(a) { + function c(a) { + var b = a.pageX; + a = a.pageY; + var c = e.left + (b - e._startX), d = e.top + (a - e._startY); + e.svgDom.css({left:c, top:d}); + e._startX = b; + e._startY = a; + e.left = c; + e.top = d; } - } -}; -Entry.Playground.prototype.addPicture = function(b, a) { - var c = Entry.cloneSimpleObject(b); - delete c.id; - delete c.view; - b = JSON.parse(JSON.stringify(c)); - b.id = Entry.generateHash(); - b.name = Entry.getOrderedName(b.name, this.object.pictures); - this.generatePictureElement(b); - this.object.addPicture(b); - this.injectPicture(); - this.selectPicture(b); -}; -Entry.Playground.prototype.setPicture = function(b) { - var a = Entry.container.getPictureElement(b.id, b.objectId), c = $(a); - if (a) { - b.view = a; - a.picture = b; - a = c.find("#t_" + b.id)[0]; - if (b.fileurl) { - a.style.backgroundImage = 'url("' + b.fileurl + '")'; - } else { - var d = b.filename; - a.style.backgroundImage = 'url("' + Entry.defaultPath + "/uploads/" + d.substring(0, 2) + "/" + d.substring(2, 4) + "/thumb/" + d + '.png")'; + function d(a) { + $(document).unbind(".block"); } - c.find("#s_" + b.id)[0].innerHTML = b.dimension.width + " X " + b.dimension.height; - } - Entry.container.setPicture(b); -}; -Entry.Playground.prototype.clonePicture = function(b) { - b = Entry.playground.object.getPicture(b); - this.addPicture(b, !0); -}; -Entry.Playground.prototype.selectPicture = function(b) { - for (var a = this.object.pictures, c = 0, d = a.length;c < d;c++) { - var e = a[c]; - e.id === b.id ? e.view.addClass("entryPictureSelected") : e.view.removeClass("entryPictureSelected"); - } - var f; - b && b.id && (f = Entry.container.selectPicture(b.id, b.objectId)); - this.object.id === f && Entry.dispatchEvent("pictureSelected", b); -}; -Entry.Playground.prototype.movePicture = function(b, a) { - this.object.pictures.splice(a, 0, this.object.pictures.splice(b, 1)[0]); - this.injectPicture(); - Entry.stage.sortZorder(); -}; -Entry.Playground.prototype.injectText = function() { - if (Entry.playground.object) { - Entry.playground.textEditInput.value = Entry.playground.object.entity.getText(); - Entry.playground.textEditArea.value = Entry.playground.object.entity.getText(); - Entry.playground.fontName_.value = Entry.playground.object.entity.getFontName(); - if (Entry.playground.object.entity.font) { - var b = -1 < Entry.playground.object.entity.font.indexOf("bold") || !1; - $("#entryPlaygroundText_boldImage").attr("src", Entry.mediaFilePath + "text_button_bold_" + b + ".png"); - b = -1 < Entry.playground.object.entity.font.indexOf("italic") || !1; - $("#entryPlaygroundText_italicImage").attr("src", Entry.mediaFilePath + "text_button_italic_" + b + ".png"); - } - b = Entry.playground.object.entity.getUnderLine() || !1; - $("#entryPlaygroundText_underlineImage").attr("src", Entry.mediaFilePath + "text_button_underline_" + b + ".png"); - b = Entry.playground.object.entity.getStrike() || !1; - $("#entryPlaygroundText_strikeImage").attr("src", Entry.mediaFilePath + "text_button_strike_" + b + ".png"); - $(".entryPlayground_fgColorDiv").css("backgroundColor", Entry.playground.object.entity.colour); - $(".entryPlayground_bgColorDiv").css("backgroundColor", Entry.playground.object.entity.bgColour); - Entry.playground.toggleLineBreak(Entry.playground.object.entity.getLineBreak()); - Entry.playground.object.entity.getLineBreak() && ($(".entryPlaygroundLinebreakDescription > p").html(Lang.Menus.linebreak_on_desc_1), $(".entryPlaygroundLinebreakDescription > ul > li").eq(0).html(Lang.Menus.linebreak_on_desc_2), $(".entryPlaygroundLinebreakDescription > ul > li").eq(1).html(Lang.Menus.linebreak_on_desc_3)); - Entry.playground.setFontAlign(Entry.playground.object.entity.getTextAlign()); - b = Entry.playground.object.entity.getFontSize(); - Entry.playground.fontSizeIndiciator.style.width = b + "%"; - Entry.playground.fontSizeKnob.style.left = .88 * b + "px"; - } + this._startY = a.pageY; + var e = this; + a.stopPropagation(); + a.preventDefault(); + var f = $(document); + f.bind("mousemove.block", c); + f.bind("mouseup.block", d); + f.bind("touchmove.block", c); + f.bind("touchend.block", d); + this._startX = a.pageX; + this._startY = a.pageY; + }; +})(Entry.GlobalSvg); +Entry.Mutator = function() { }; -Entry.Playground.prototype.injectSound = function() { - var b = this.soundListView_; - if (b) { - for (;b.hasChildNodes();) { - b.removeChild(b.lastChild); - } - if (this.object) { - for (var a = this.object.sounds, c = 0, d = a.length;c < d;c++) { - var e = a[c].view; - e.orderHolder.innerHTML = c + 1; - b.appendChild(e); - } - } +(function(a) { + a.mutate = function(a, c) { + a = Entry.block[a]; + void 0 === a.changeEvent && (a.changeEvent = new Entry.Event); + a.template = c.template; + a.params = c.params; + a.changeEvent.notify(1); + }; +})(Entry.Mutator); +(function(a) { +})(Entry.Mutator.prototype); +Entry.RenderView = function(a, b) { + this._align = b || "CENTER"; + a = "string" === typeof a ? $("#" + a) : $(a); + if ("DIV" !== a.prop("tagName")) { + return console.error("Dom is not div element"); } + this.view = a; + this.viewOnly = !0; + this.suffix = "renderView"; + this.disableMouseEvent = this.visible = !0; + this._svgId = "renderView_" + (new Date).getTime(); + this._generateView(); + this.offset = this.svgDom.offset(); + this.setWidth(); + this.svg = Entry.SVG(this._svgId); + Entry.Utils.addFilters(this.svg, this.suffix); + this.svg && (this.svgGroup = this.svg.elem("g"), this.svgThreadGroup = this.svgGroup.elem("g"), this.svgThreadGroup.board = this, this.svgBlockGroup = this.svgGroup.elem("g"), this.svgBlockGroup.board = this); }; -Entry.Playground.prototype.moveSound = function(b, a) { - this.object.sounds.splice(a, 0, this.object.sounds.splice(b, 1)[0]); - this.updateListViewOrder("sound"); - Entry.stage.sortZorder(); -}; -Entry.Playground.prototype.addSound = function(b, a) { - var c = Entry.cloneSimpleObject(b); - delete c.view; - delete c.id; - b = JSON.parse(JSON.stringify(c)); - b.id = Entry.generateHash(); - b.name = Entry.getOrderedName(b.name, this.object.sounds); - this.generateSoundElement(b); - this.object.addSound(b); - this.injectSound(); -}; -Entry.Playground.prototype.changeViewMode = function(b) { - for (var a in this.tabViewElements) { - this.tabViewElements[a].removeClass("entryTabSelected"); - } - "default" != b && this.tabViewElements[b].addClass("entryTabSelected"); - if ("variable" != b) { - var c = this.view_.children; - for (a = 0;a < c.length;a++) { - var d = c[a]; - -1 < d.id.toUpperCase().indexOf(b.toUpperCase()) ? d.removeClass("entryRemove") : d.addClass("entryRemove"); +(function(a) { + a.schema = {code:null, dragBlock:null, closeBlock:null, selectedBlockView:null}; + a._generateView = function() { + this.renderViewContainer = Entry.Dom("div", {"class":"renderViewContainer", parent:this.view}); + this.svgDom = Entry.Dom($(''), {parent:this.renderViewContainer}); + }; + a.changeCode = function(a) { + if (!(a instanceof Entry.Code)) { + return console.error("You must inject code instance"); } - if ("picture" == b && (!this.pictureView_.object || this.pictureView_.object != this.object)) { - this.pictureView_.object = this.object, this.injectPicture(); - } else { - if ("sound" == b && (!this.soundView_.object || this.soundView_.object != this.object)) { - this.soundView_.object = this.object, this.injectSound(); - } else { - if ("text" == b && "textBox" == this.object.objectType || this.textView_.object != this.object) { - this.textView_.object = this.object, this.injectText(); - } + this.code = a; + this.svg || (this.svg = Entry.SVG(this._svgId), this.svgGroup = this.svg.elem("g"), this.svgThreadGroup = this.svgGroup.elem("g"), this.svgThreadGroup.board = this, this.svgBlockGroup = this.svgGroup.elem("g"), this.svgBlockGroup.board = this); + a.createView(this); + this.align(); + this.resize(); + }; + a.align = function() { + var a = this.code.getThreads(); + if (a && 0 !== a.length) { + for (var c = 0, d = "LEFT" == this._align ? 20 : this.svgDom.width() / 2, e = 0, f = a.length;e < f;e++) { + var g = a[e].getFirstBlock().view; + g._moveTo(d, c - g.offsetY, !1); + g = g.svgGroup.getBBox().height; + c += g + 15; } + this._bBox = this.svgGroup.getBBox(); + this.height = this._bBox.height; } - "code" == b && this.resizeHandle_ && this.resizeHandle_.removeClass("entryRemove"); - Entry.engine.isState("run") && this.curtainView_.removeClass("entryRemove"); - this.viewMode_ = b; - this.toggleOffVariableView(); - } -}; -Entry.Playground.prototype.createVariableView = function() { - var b = Entry.createElement("div"); - Entry.type && "workspace" != Entry.type ? "phone" == Entry.type && b.addClass("entryVariablePanelPhone") : b.addClass("entryVariablePanelWorkspace"); - this.variableViewWrapper_ = b; - Entry.variableContainer.createDom(b); - return b; -}; -Entry.Playground.prototype.toggleOnVariableView = function() { - Entry.playground.changeViewMode("code"); - this.hideBlockMenu(); - Entry.variableContainer.updateList(); - this.variableView_.removeClass("entryRemove"); - this.resizeHandle_.removeClass("entryRemove"); -}; -Entry.Playground.prototype.toggleOffVariableView = function() { - this.showBlockMenu(); - this.variableView_.addClass("entryRemove"); -}; -Entry.Playground.prototype.editBlock = function() { - var b = Entry.playground; - Entry.stateManager && Entry.stateManager.addCommand("edit block", b, b.restoreBlock, b.object, b.object.getScriptText()); -}; -Entry.Playground.prototype.mouseupBlock = function() { - if (Entry.reporter) { - var b = Entry.playground, a = b.object; - Entry.reporter.report(new Entry.State("edit block mouseup", b, b.restoreBlock, a, a.getScriptText())); - } -}; -Entry.Playground.prototype.restoreBlock = function(b, a) { - Entry.container.selectObject(b.id); - Entry.stateManager && Entry.stateManager.addCommand("restore block", this, this.restoreBlock, this.object, this.object.getScriptText()); - Blockly.Xml.textToDom(a); -}; -Entry.Playground.prototype.setMenu = function(b) { - if (this.currentObjectType != b) { - var a = this.blockMenu; - a.unbanClass(this.currentObjectType); - a.banClass(b); - a.setMenu(); - a.selectMenu(0, !0); - this.currentObjectType = b; - } -}; -Entry.Playground.prototype.hideTabs = function() { - var b = ["picture", "text", "sound", "variable"], a; - for (a in b) { - this.hideTab([b[a]]); - } -}; -Entry.Playground.prototype.hideTab = function(b) { - this.tabViewElements[b] && (this.tabViewElements[b].addClass("hideTab"), this.tabViewElements[b].removeClass("showTab")); -}; -Entry.Playground.prototype.showTabs = function() { - var b = ["picture", "text", "sound", "variable"], a; - for (a in b) { - this.showTab(b[a]); - } -}; -Entry.Playground.prototype.showTab = function(b) { - this.tabViewElements[b] && (this.tabViewElements[b].addClass("showTab"), this.tabViewElements[b].removeClass("hideTab")); + }; + a.hide = function() { + this.view.addClass("entryRemove"); + }; + a.show = function() { + this.view.removeClass("entryRemove"); + }; + a.setWidth = function() { + this._svgWidth = this.svgDom.width(); + this.offset = this.svgDom.offset(); + }; + a.bindCodeView = function(a) { + this.svgBlockGroup.remove(); + this.svgThreadGroup.remove(); + this.svgBlockGroup = a.svgBlockGroup; + this.svgThreadGroup = a.svgThreadGroup; + this.svgGroup.appendChild(this.svgThreadGroup); + this.svgGroup.appendChild(this.svgBlockGroup); + }; + a.resize = function() { + this.svg && this._bBox && $(this.svg).css("height", this._bBox.height + 10); + }; +})(Entry.RenderView.prototype); +Entry.ThreadView = function(a, b) { + Entry.Model(this, !1); + this.thread = a; + this.svgGroup = b.svgThreadGroup.elem("g"); + this.parent = b; }; -Entry.Playground.prototype.initializeResizeHandle = function(b) { - b.onmousedown = function(a) { - Entry.playground.resizing = !0; - Entry.documentMousemove && (Entry.playground.resizeEvent = Entry.documentMousemove.attach(this, function(a) { - Entry.playground.resizing && Entry.resizeElement({menuWidth:a.clientX - Entry.interfaceState.canvasWidth}); - })); +(function(a) { + a.schema = {height:0, zIndex:0}; + a.destroy = function() { + this.svgGroup.remove(); }; - document.addEventListener("mouseup", function(a) { - if (a = Entry.playground.resizeEvent) { - Entry.playground.resizing = !1, Entry.documentMousemove.detach(a), delete Entry.playground.resizeEvent; + a.setParent = function(a) { + this.parent = a; + }; + a.getParent = function() { + return this.parent; + }; + a.renderText = function() { + for (var a = this.thread.getBlocks(), c = 0;c < a.length;c++) { + a[c].view.renderText(); } - }); -}; -Entry.Playground.prototype.reloadPlayground = function() { - var b = this.mainWorkspace; - b && (b.getBlockMenu().reDraw(), this.object && this.object.script.view.reDraw()); -}; -Entry.Playground.prototype.flushPlayground = function() { - this.object = null; - if (Entry.playground && Entry.playground.view_) { - this.injectPicture(); - this.injectSound(); - var b = Entry.playground.mainWorkspace.getBoard(); - b.clear(); - b.changeCode(null); - } -}; -Entry.Playground.prototype.refreshPlayground = function() { - Entry.playground && Entry.playground.view_ && ("picture" === this.getViewMode() && this.injectPicture(), "sound" === this.getViewMode() && this.injectSound()); -}; -Entry.Playground.prototype.updateListViewOrder = function(b) { - b = "picture" == b ? this.pictureListView_.childNodes : this.soundListView_.childNodes; - for (var a = 0, c = b.length;a < c;a++) { - b[a].orderHolder.innerHTML = a + 1; - } -}; -Entry.Playground.prototype.generatePictureElement = function(b) { - function a() { - if ("" === this.value.trim()) { - Entry.deAttachEventListener(this, "blur", a), alert("\uc774\ub984\uc744 \uc785\ub825\ud558\uc5ec \uc8fc\uc138\uc694."), this.focus(), Entry.attachEventListener(this, "blur", a); - } else { - for (var b = $(".entryPlaygroundPictureName"), c = 0;c < b.length;c++) { - if (b.eq(c).val() == f.value && b[c] != this) { - Entry.deAttachEventListener(this, "blur", a); - alert("\uc774\ub984\uc774 \uc911\ubcf5 \ub418\uc5c8\uc2b5\ub2c8\ub2e4."); - this.focus(); - Entry.attachEventListener(this, "blur", a); - return; - } - } - this.picture.name = this.value; - Entry.playground.reloadPlayground(); - Entry.dispatchEvent("pictureNameChanged", this.picture); + }; + a.renderBlock = function() { + for (var a = this.thread.getBlocks(), c = 0;c < a.length;c++) { + a[c].view.renderBlock(); } - } - var c = Entry.createElement("li", b.id); - b.view = c; - c.addClass("entryPlaygroundPictureElement"); - c.picture = b; - c.bindOnClick(function(a) { - Entry.playground.selectPicture(this.picture); - }); - Entry.Utils.disableContextmenu(b.view); - $(b.view).on("contextmenu", function() { - Entry.ContextMenu.show([{text:Lang.Workspace.context_rename, callback:function() { - f.focus(); - }}, {text:Lang.Workspace.context_duplicate, callback:function() { - Entry.playground.clonePicture(b.id); - }}, {text:Lang.Workspace.context_remove, callback:function() { - Entry.playground.object.removePicture(b.id) ? (Entry.removeElement(c), Entry.toast.success(Lang.Workspace.shape_remove_ok, b.name + " " + Lang.Workspace.shape_remove_ok_msg)) : Entry.toast.alert(Lang.Workspace.shape_remove_fail, Lang.Workspace.shape_remove_fail_msg); - }}, {divider:!0}, {text:Lang.Workspace.context_download, callback:function() { - b.fileurl ? window.open(b.fileurl) : window.open("/api/sprite/download/image/" + encodeURIComponent(b.filename) + "/" + encodeURIComponent(b.name) + ".png"); - }}], "workspace-contextmenu"); - }); - var d = Entry.createElement("div"); - d.addClass("entryPlaygroundPictureOrder"); - c.orderHolder = d; - c.appendChild(d); - d = Entry.createElement("div", "t_" + b.id); - d.addClass("entryPlaygroundPictureThumbnail"); - if (b.fileurl) { - d.style.backgroundImage = 'url("' + b.fileurl + '")'; - } else { - var e = b.filename; - d.style.backgroundImage = 'url("' + Entry.defaultPath + "/uploads/" + e.substring(0, 2) + "/" + e.substring(2, 4) + "/thumb/" + e + '.png")'; - } - c.appendChild(d); - var f = Entry.createElement("input"); - f.addClass("entryPlaygroundPictureName"); - f.addClass("entryEllipsis"); - f.picture = b; - f.value = b.name; - Entry.attachEventListener(f, "blur", a); - f.onkeypress = function(a) { - 13 == a.keyCode && this.blur(); }; - c.appendChild(f); - d = Entry.createElement("div", "s_" + b.id); - d.addClass("entryPlaygroundPictureSize"); - d.innerHTML = b.dimension.width + " X " + b.dimension.height; - c.appendChild(d); -}; -Entry.Playground.prototype.generateSoundElement = function(b) { - var a = Entry.createElement("sound", b.id); - b.view = a; - a.addClass("entryPlaygroundSoundElement"); - a.sound = b; - Entry.Utils.disableContextmenu(b.view); - $(b.view).on("contextmenu", function() { - Entry.ContextMenu.show([{text:Lang.Workspace.context_rename, callback:function() { - g.focus(); - }}, {text:Lang.Workspace.context_duplicate, callback:function() { - Entry.playground.addSound(b, !0); - }}, {text:Lang.Workspace.context_remove, callback:function() { - Entry.playground.object.removeSound(b.id) ? (Entry.removeElement(a), Entry.toast.success(Lang.Workspace.sound_remove_ok, b.name + " " + Lang.Workspace.sound_remove_ok_msg)) : Entry.toast.alert(Lang.Workspace.sound_remove_fail, ""); - Entry.removeElement(a); - }}], "workspace-contextmenu"); - }); - var c = Entry.createElement("div"); - c.addClass("entryPlaygroundSoundOrder"); - a.orderHolder = c; - a.appendChild(c); - var d = Entry.createElement("div"); - d.addClass("entryPlaygroundSoundThumbnail"); - d.addClass("entryPlaygroundSoundPlay"); - var e = !1, f; - d.addEventListener("click", function() { - e ? (e = !1, d.removeClass("entryPlaygroundSoundStop"), d.addClass("entryPlaygroundSoundPlay"), f.stop()) : (e = !0, d.removeClass("entryPlaygroundSoundPlay"), d.addClass("entryPlaygroundSoundStop"), f = createjs.Sound.play(b.id), f.addEventListener("complete", function(a) { - d.removeClass("entryPlaygroundSoundStop"); - d.addClass("entryPlaygroundSoundPlay"); - e = !1; - }), f.addEventListener("loop", function(a) { - }), f.addEventListener("failed", function(a) { - })); - }); - a.appendChild(d); - var g = Entry.createElement("input"); - g.addClass("entryPlaygroundSoundName"); - g.sound = b; - g.value = b.name; - var h = document.getElementsByClassName("entryPlaygroundSoundName"); - g.onblur = function() { - if ("" === this.value) { - alert("\uc774\ub984\uc744 \uc785\ub825\ud558\uc5ec \uc8fc\uc138\uc694."), this.focus(); - } else { - for (var a = 0, b = 0;b < h.length;b++) { - if (h[b].value == g.value && (a += 1, 1 < a)) { - alert("\uc774\ub984\uc774 \uc911\ubcf5 \ub418\uc5c8\uc2b5\ub2c8\ub2e4."); - this.focus(); - return; - } - } - this.sound.name = this.value; - Entry.playground.reloadPlayground(); + a.requestAbsoluteCoordinate = function(a) { + var c = this.thread.getBlocks(), d = c.shift(), e = {x:0, y:0}; + for (this.parent instanceof Entry.Board || this.parent instanceof Entry.BlockMenu || (e = this.parent.requestAbsoluteCoordinate());d && d.view !== a && d.view;) { + d = d.view, e.x += d.x + d.magnet.next.x, e.y += d.y + d.magnet.next.y, d = c.shift(); } + return e; }; - g.onkeypress = function(a) { - 13 == a.keyCode && this.blur(); + a.requestPartHeight = function(a, c) { + c = this.thread.getBlocks(); + for (var d = c.pop(), e = a ? a.magnet.next ? a.magnet.next.y : a.height : 0;d && d.view !== a && d.view;) { + d = d.view, e = d.magnet.next ? e + d.magnet.next.y : e + d.height, d.dragMode === Entry.DRAG_MODE_DRAG && (e = 0), d = c.pop(); + } + return e; }; - a.appendChild(g); - c = Entry.createElement("div"); - c.addClass("entryPlaygroundSoundLength"); - c.innerHTML = b.duration + " \ucd08"; - a.appendChild(c); -}; -Entry.Playground.prototype.toggleColourChooser = function(b) { - "foreground" === b ? "none" === this.coloursWrapper.style.display ? (this.coloursWrapper.style.display = "block", this.backgroundsWrapper.style.display = "none") : this.coloursWrapper.style.display = "none" : "background" === b && ("none" === this.backgroundsWrapper.style.display ? (this.backgroundsWrapper.style.display = "block", this.coloursWrapper.style.display = "none") : this.backgroundsWrapper.style.display = "none"); -}; -Entry.Playground.prototype.setTextColour = function(b) { - Entry.playground.object.entity.setColour(b); - Entry.playground.toggleColourChooser("foreground"); - $(".entryPlayground_fgColorDiv").css("backgroundColor", b); -}; -Entry.Playground.prototype.setBackgroundColour = function(b) { - Entry.playground.object.entity.setBGColour(b); - Entry.playground.toggleColourChooser("background"); - $(".entryPlayground_bgColorDiv").css("backgroundColor", b); -}; -Entry.Playground.prototype.isTextBGMode = function() { - return this.isTextBGMode_; -}; -Entry.Playground.prototype.checkVariables = function() { - Entry.forEBS || (Entry.variableContainer.lists_.length ? this.blockMenu.unbanClass("listNotExist") : this.blockMenu.banClass("listNotExist"), Entry.variableContainer.variables_.length ? this.blockMenu.unbanClass("variableNotExist") : this.blockMenu.banClass("variableNotExist")); -}; -Entry.Playground.prototype.getViewMode = function() { - return this.viewMode_; -}; -Entry.Playground.prototype.updateHW = function() { - var b = Entry.playground.mainWorkspace.blockMenu; - if (b) { - var a = Entry.hw; - a && a.connected ? (b.unbanClass("arduinoConnected", !0), b.banClass("arduinoDisconnected", !0), a.banHW(), a.hwModule && b.unbanClass(a.hwModule.name)) : (b.banClass("arduinoConnected", !0), b.unbanClass("arduinoDisconnected", !0), Entry.hw.banHW()); - b.reDraw(); - } -}; -Entry.Playground.prototype.toggleLineBreak = function(b) { - this.object && "textBox" == this.object.objectType && (b ? (Entry.playground.object.entity.setLineBreak(!0), $(".entryPlayground_textArea").css("display", "block"), $(".entryPlayground_textBox").css("display", "none"), this.linebreakOffImage.src = Entry.mediaFilePath + "text-linebreak-off-false.png", this.linebreakOnImage.src = Entry.mediaFilePath + "text-linebreak-on-true.png", this.fontSizeWrapper.removeClass("entryHide")) : (Entry.playground.object.entity.setLineBreak(!1), $(".entryPlayground_textArea").css("display", - "none"), $(".entryPlayground_textBox").css("display", "block"), this.linebreakOffImage.src = Entry.mediaFilePath + "text-linebreak-off-true.png", this.linebreakOnImage.src = Entry.mediaFilePath + "text-linebreak-on-false.png", this.fontSizeWrapper.addClass("entryHide"))); -}; -Entry.Playground.prototype.setFontAlign = function(b) { - if ("textBox" == this.object.objectType) { - this.alignLeftBtn.removeClass("toggle"); - this.alignCenterBtn.removeClass("toggle"); - this.alignRightBtn.removeClass("toggle"); - switch(b) { - case Entry.TEXT_ALIGN_LEFT: - this.alignLeftBtn.addClass("toggle"); - break; - case Entry.TEXT_ALIGN_CENTER: - this.alignCenterBtn.addClass("toggle"); - break; - case Entry.TEXT_ALIGN_RIGHT: - this.alignRightBtn.addClass("toggle"); + a.dominate = function() { + this.parent.dominate(this.thread); + }; + a.isGlobal = function() { + return this.parent instanceof Entry.Board; + }; + a.reDraw = function() { + for (var a = this.thread._data, c = a.length - 1;0 <= c;c--) { + a[c].view.reDraw(); } - this.object.entity.setTextAlign(b); + }; + a.setZIndex = function(a) { + this.set({zIndex:a}); + }; +})(Entry.ThreadView.prototype); +Entry.Vim = function(a) { + a = "string" === typeof a ? $("#" + a) : $(a); + if ("DIV" !== a.prop("tagName")) { + return console.error("Dom is not div element"); } + this.createDom(a); + this._parser = new Entry.Parser("maze", "js", this.codeMirror); + this._blockParser = new Entry.Parser("maze", "block"); + Entry.Model(this, !1); + window.eventset = []; }; -Entry.Playground.prototype.hideBlockMenu = function() { - this.mainWorkspace.getBlockMenu().hide(); -}; -Entry.Playground.prototype.showBlockMenu = function() { - this.mainWorkspace.getBlockMenu().show(); -}; +(function(a) { + a.createDom = function(a) { + function c(a) { + var b = e.getCodeToText(a.block); + e.codeMirror.display.dragFunctions.leave(a); + var c = Entry.Utils.createMouseEvent("mousedown", a); + e.codeMirror.display.scroller.dispatchEvent(c); + var b = b.split("\n"), d = b.length - 1, l = 0; + b.forEach(function(a, b) { + e.codeMirror.replaceSelection(a); + l = e.doc.getCursor().line; + e.codeMirror.indentLine(l); + 0 !== b && d === b || e.codeMirror.replaceSelection("\n"); + }); + a = Entry.Utils.createMouseEvent("mouseup", a); + e.codeMirror.display.scroller.dispatchEvent(a); + } + 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", c); + a.removeEventListener("dragOver", d); + a.addEventListener("dragEnd", c); + a.addEventListener("dragOver", d); + }; + a.hide = function() { + this.view.addClass("entryRemove"); + }; + a.show = function() { + this.view.removeClass("entryRemove"); + }; + a.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; + }; + a.codeToText = function(a) { + a = this._blockParser.parse(a); + this.codeMirror.setValue(a); + }; + a.getCodeToText = function(a) { + return this._blockParser.parse(a); + }; +})(Entry.Vim.prototype); Entry.Xml = {}; -Entry.Xml.isTypeOf = function(b, a) { - return a.getAttribute("type") == b; +Entry.Xml.isTypeOf = function(a, b) { + return b.getAttribute("type") == a; }; -Entry.Xml.getNextBlock = function(b) { - b = b.childNodes; - for (var a = 0;a < b.length;a++) { - if ("NEXT" == b[a].tagName.toUpperCase()) { - return b[a].children[0]; +Entry.Xml.getNextBlock = function(a) { + a = a.childNodes; + for (var b = 0;b < a.length;b++) { + if ("NEXT" == a[b].tagName.toUpperCase()) { + return a[b].children[0]; } } return null; }; -Entry.Xml.getStatementBlock = function(b, a) { - var c = a.getElementsByTagName("statement"); +Entry.Xml.getStatementBlock = function(a, b) { + var c = b.getElementsByTagName("statement"); if (!c.length) { - return a; + return b; } for (var d in c) { - if (c[d].getAttribute("name") == b) { + if (c[d].getAttribute("name") == a) { return c[d].children[0]; } } return null; }; -Entry.Xml.getParentLoop = function(b) { +Entry.Xml.getParentLoop = function(a) { for (;;) { - if (!b) { + if (!a) { return null; } - if ((b = b.parentNode) && "STATEMENT" == b.tagName.toUpperCase()) { - return b.parentNode; + if ((a = a.parentNode) && "STATEMENT" == a.tagName.toUpperCase()) { + return a.parentNode; } - if (b) { - b = b.parentNode; + if (a) { + a = a.parentNode; } else { return null; } } }; -Entry.Xml.getParentIterateLoop = function(b) { +Entry.Xml.getParentIterateLoop = function(a) { for (;;) { - if (!b) { + if (!a) { return null; } - if ((b = b.parentNode) && b.getAttribute("type") && "REPEAT" == b.getAttribute("type").toUpperCase().substr(0, 6)) { - return b; + if ((a = a.parentNode) && a.getAttribute("type") && "REPEAT" == a.getAttribute("type").toUpperCase().substr(0, 6)) { + return a; } - if (!b) { + if (!a) { return null; } } }; -Entry.Xml.getParentBlock = function(b) { - return (b = b.parentNode) ? b.parentNode : null; +Entry.Xml.getParentBlock = function(a) { + return (a = a.parentNode) ? a.parentNode : null; }; -Entry.Xml.callReturn = function(b) { - var a = Entry.Xml.getNextBlock(b); - return a ? a : Entry.Xml.getParentLoop(b); +Entry.Xml.callReturn = function(a) { + var b = Entry.Xml.getNextBlock(a); + return b ? b : Entry.Xml.getParentLoop(a); }; -Entry.Xml.isRootBlock = function(b) { +Entry.Xml.isRootBlock = function(a) { }; -Entry.Xml.getValue = function(b, a) { - var c = a.childNodes; - if (!c.length) { +Entry.Xml.getValue = function(a, b) { + b = b.childNodes; + if (!b.length) { return null; } - for (var d in c) { - if ("VALUE" == c[d].tagName.toUpperCase() && c[d].getAttribute("name") == b) { - return c[d].children[0]; + for (var c in b) { + if ("VALUE" == b[c].tagName.toUpperCase() && b[c].getAttribute("name") == a) { + return b[c].children[0]; } } return null; }; -Entry.Xml.getNumberValue = function(b, a, c) { +Entry.Xml.getNumberValue = function(a, b, c) { c = c.childNodes; if (!c.length) { return null; } 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])); + if (c[d].tagName && "VALUE" == c[d].tagName.toUpperCase() && c[d].getAttribute("name") == b) { + return Number(Entry.Xml.operate(a, c[d].children[0])); } } return null; }; -Entry.Xml.getField = function(b, a) { - var c = a.childNodes; - if (!c.length) { +Entry.Xml.getField = function(a, b) { + b = b.childNodes; + if (!b.length) { return null; } - for (var d in c) { - if (c[d].tagName && "FIELD" == c[d].tagName.toUpperCase() && c[d].getAttribute("name") == b) { - return c[d].textContent; + for (var c in b) { + if (b[c].tagName && "FIELD" == b[c].tagName.toUpperCase() && b[c].getAttribute("name") == a) { + return b[c].textContent; } } }; -Entry.Xml.getNumberField = function(b, a) { - var c = a.childNodes; - if (!c.length) { +Entry.Xml.getNumberField = function(a, b) { + b = b.childNodes; + if (!b.length) { return null; } - for (var d in c) { - if ("FIELD" == c[d].tagName.toUpperCase() && c[d].getAttribute("name") == b) { - return Number(c[d].textContent); + for (var c in b) { + if ("FIELD" == b[c].tagName.toUpperCase() && b[c].getAttribute("name") == a) { + return Number(b[c].textContent); } } }; -Entry.Xml.getBooleanValue = function(b, a, c) { +Entry.Xml.getBooleanValue = function(a, b, c) { c = c.getElementsByTagName("value"); if (!c.length) { return null; } for (var d in c) { - if (c[d].getAttribute("name") == a) { - return Entry.Xml.operate(b, c[d].children[0]); + if (c[d].getAttribute("name") == b) { + return Entry.Xml.operate(a, c[d].children[0]); } } return null; }; -Entry.Xml.operate = function(b, a) { - return Entry.block[a.getAttribute("type")](b, a); +Entry.Xml.operate = function(a, b) { + return Entry.block[b.getAttribute("type")](a, b); }; -Entry.Xml.cloneBlock = function(b, a, c) { - var d = b.cloneNode(); - b.parentNode && "xml" != b.parentNode.tagName && Entry.Xml.cloneBlock(b.parentNode, d, "parent"); - for (var e = 0;e < b.childNodes.length;e++) { - var f = b.childNodes[e]; - f instanceof Text ? d.textContent = f.textContent : "parent" == c ? d.appendChild(a) : d.appendChild(Entry.Xml.cloneBlock(f, d, "child")); +Entry.Xml.cloneBlock = function(a, b, c) { + var d = a.cloneNode(); + a.parentNode && "xml" != a.parentNode.tagName && Entry.Xml.cloneBlock(a.parentNode, d, "parent"); + for (var e = 0;e < a.childNodes.length;e++) { + var f = a.childNodes[e]; + f instanceof Text ? d.textContent = f.textContent : "parent" == c ? d.appendChild(b) : d.appendChild(Entry.Xml.cloneBlock(f, d, "child")); } return d; }; -Entry.Youtube = function(b) { - this.generateView(b); +Entry.Youtube = function(a) { + this.generateView(a); }; p = Entry.Youtube.prototype; -p.init = function(b) { - this.youtubeHash = b; +p.init = function(a) { + this.youtubeHash = a; this.generateView(); }; -p.generateView = function(b) { - var a = Entry.createElement("div"); - a.addClass("entryContainerMovieWorkspace"); - a.addClass("entryRemove"); - this.movieContainer = a; - a = Entry.createElement("iframe"); - a.setAttribute("id", "youtubeIframe"); - a.setAttribute("allowfullscreen", ""); - a.setAttribute("frameborder", 0); - a.setAttribute("src", "https://www.youtube.com/embed/" + b); - this.movieFrame = a; - this.movieContainer.appendChild(a); +p.generateView = function(a) { + var b = Entry.createElement("div"); + b.addClass("entryContainerMovieWorkspace"); + b.addClass("entryRemove"); + this.movieContainer = b; + b = Entry.createElement("iframe"); + b.setAttribute("id", "youtubeIframe"); + b.setAttribute("allowfullscreen", ""); + b.setAttribute("frameborder", 0); + b.setAttribute("src", "https://www.youtube.com/embed/" + a); + this.movieFrame = b; + this.movieContainer.appendChild(b); }; p.getView = function() { return this.movieContainer; }; p.resize = function() { - var b = document.getElementsByClassName("propertyContent")[0], a = document.getElementById("youtubeIframe"); - w = b.offsetWidth; - a.width = w + "px"; - a.height = 9 * w / 16 + "px"; + var a = document.getElementsByClassName("propertyContent")[0], b = document.getElementById("youtubeIframe"); + w = a.offsetWidth; + b.width = w + "px"; + b.height = 9 * w / 16 + "px"; }; diff --git a/dist/entry.min.js b/dist/entry.min.js index 2dca498db7..35137bbe40 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -1,2232 +1,2272 @@ -Entry={block:{},TEXT_ALIGN_CENTER:0,TEXT_ALIGN_LEFT:1,TEXT_ALIGN_RIGHT:2,TEXT_ALIGNS:["center","left","right"],clipboard:null,loadProject:function(b){b||(b=Entry.getStartProject(Entry.mediaFilePath));"workspace"==this.type&&Entry.stateManager.startIgnore();Entry.projectId=b._id;Entry.variableContainer.setVariables(b.variables);Entry.variableContainer.setMessages(b.messages);Entry.scene.addScenes(b.scenes);Entry.stage.initObjectContainers();Entry.variableContainer.setFunctions(b.functions);Entry.container.setObjects(b.objects); -Entry.FPS=b.speed?b.speed:60;createjs.Ticker.setFPS(Entry.FPS);"workspace"==this.type&&setTimeout(function(){Entry.stateManager.endIgnore()},300);Entry.engine.projectTimer||Entry.variableContainer.generateTimer();0===Object.keys(Entry.container.inputValue).length&&Entry.variableContainer.generateAnswer();Entry.start();return b},exportProject:function(b){b||(b={});Entry.engine.isState("stop")||Entry.engine.toggleStop();Entry.Func&&Entry.Func.workspace&&Entry.Func.workspace.visible&&Entry.Func.cancelEdit(); -b.objects=Entry.container.toJSON();b.scenes=Entry.scene.toJSON();b.variables=Entry.variableContainer.getVariableJSON();b.messages=Entry.variableContainer.getMessageJSON();b.functions=Entry.variableContainer.getFunctionJSON();b.scenes=Entry.scene.toJSON();b.speed=Entry.FPS;return b},setBlockByText:function(b,a){for(var c=[],d=jQuery.parseXML(a).getElementsByTagName("category"),e=0;ea?a=325:720a?a=244:400svg").css({width:a-64+"px"});Entry.playground.mainWorkspace.blockMenu.setWidth(); -$(".entryWorkspaceBoard").css({left:a+"px"});Entry.playground.resizeHandle_.style.left=a+"px";Entry.playground.variableViewWrapper_.style.width=a+"px";this.interfaceState=b}Entry.windowResized.notify()},getUpTime:function(){return(new Date).getTime()-this.startTime},addActivity:function(b){Entry.stateManager&&Entry.stateManager.addActivity(b)},startActivityLogging:function(){Entry.reporter&&Entry.reporter.start(Entry.projectId,window.user?window.user._id:null,Entry.startTime)},getActivityLog:function(){var b= -{};Entry.stateManager&&(b.activityLog=Entry.stateManager.activityLog_);return b},DRAG_MODE_NONE:0,DRAG_MODE_MOUSEDOWN:1,DRAG_MODE_DRAG:2,cancelObjectEdit:function(b){var a=Entry.playground.object;if(a){var c=b.target;b=0!==$(a.view_).find(c).length;c=c.tagName.toUpperCase();!a.isEditing||"INPUT"===c&&b||a.editObjectValues(!1)}}};window.Entry=Entry;Entry.Albert={PORT_MAP:{leftWheel:0,rightWheel:0,buzzer:0,leftEye:0,rightEye:0,note:0,bodyLed:0,frontLed:0,padWidth:0,padHeight:0},setZero:function(){var b=Entry.Albert.PORT_MAP,a=Entry.hw.sendQueue,c;for(c in b)a[c]=b[c];Entry.hw.update();b=Entry.Albert;b.tempo=60;b.removeAllTimeouts()},monitorTemplate:{imgPath:"hw/albert.png",width:387,height:503,listPorts:{oid:{name:"OID",type:"input",pos:{x:0,y:0}},buzzer:{name:Lang.Hw.buzzer,type:"output",pos:{x:0,y:0}},note:{name:Lang.Hw.note,type:"output", +Entry={block:{},TEXT_ALIGN_CENTER:0,TEXT_ALIGN_LEFT:1,TEXT_ALIGN_RIGHT:2,TEXT_ALIGNS:["center","left","right"],clipboard:null,loadProject:function(a){a||(a=Entry.getStartProject(Entry.mediaFilePath));"workspace"==this.type&&Entry.stateManager.startIgnore();Entry.projectId=a._id;Entry.variableContainer.setVariables(a.variables);Entry.variableContainer.setMessages(a.messages);Entry.scene.addScenes(a.scenes);Entry.stage.initObjectContainers();Entry.variableContainer.setFunctions(a.functions);Entry.container.setObjects(a.objects); +Entry.FPS=a.speed?a.speed:60;createjs.Ticker.setFPS(Entry.FPS);"workspace"==this.type&&setTimeout(function(){Entry.stateManager.endIgnore()},300);Entry.engine.projectTimer||Entry.variableContainer.generateTimer();0===Object.keys(Entry.container.inputValue).length&&Entry.variableContainer.generateAnswer();Entry.start();return a},exportProject:function(a){a||(a={});Entry.engine.isState("stop")||Entry.engine.toggleStop();Entry.Func&&Entry.Func.workspace&&Entry.Func.workspace.visible&&Entry.Func.cancelEdit(); +a.objects=Entry.container.toJSON();a.scenes=Entry.scene.toJSON();a.variables=Entry.variableContainer.getVariableJSON();a.messages=Entry.variableContainer.getMessageJSON();a.functions=Entry.variableContainer.getFunctionJSON();a.scenes=Entry.scene.toJSON();a.speed=Entry.FPS;return a},setBlockByText:function(a,b){a=[];b=jQuery.parseXML(b).getElementsByTagName("category");for(var c=0;cb?b=325:720b?b=244:400svg").css({width:b-64+"px"});Entry.playground.mainWorkspace.blockMenu.setWidth(); +$(".entryWorkspaceBoard").css({left:b+"px"});Entry.playground.resizeHandle_.style.left=b+"px";Entry.playground.variableViewWrapper_.style.width=b+"px";this.interfaceState=a}Entry.windowResized.notify()},getUpTime:function(){return(new Date).getTime()-this.startTime},addActivity:function(a){Entry.stateManager&&Entry.stateManager.addActivity(a)},startActivityLogging:function(){Entry.reporter&&Entry.reporter.start(Entry.projectId,window.user?window.user._id:null,Entry.startTime)},getActivityLog:function(){var a= +{};Entry.stateManager&&(a.activityLog=Entry.stateManager.activityLog_);return a},DRAG_MODE_NONE:0,DRAG_MODE_MOUSEDOWN:1,DRAG_MODE_DRAG:2,cancelObjectEdit:function(a){var b=Entry.playground.object;if(b){var c=a.target;a=0!==$(b.view_).find(c).length;c=c.tagName.toUpperCase();!b.isEditing||"INPUT"===c&&a||b.editObjectValues(!1)}}};window.Entry=Entry;Entry.Albert={PORT_MAP:{leftWheel:0,rightWheel:0,buzzer:0,leftEye:0,rightEye:0,note:0,bodyLed:0,frontLed:0,padWidth:0,padHeight:0},setZero:function(){var a=Entry.Albert.PORT_MAP,b=Entry.hw.sendQueue,c;for(c in a)b[c]=a[c];Entry.hw.update();a=Entry.Albert;a.tempo=60;a.removeAllTimeouts()},monitorTemplate:{imgPath:"hw/albert.png",width:387,height:503,listPorts:{oid:{name:"OID",type:"input",pos:{x:0,y:0}},buzzer:{name:Lang.Hw.buzzer,type:"output",pos:{x:0,y:0}},note:{name:Lang.Hw.note,type:"output", pos:{x:0,y:0}}},ports:{leftProximity:{name:Lang.Blocks.ALBERT_sensor_leftProximity,type:"input",pos:{x:178,y:401}},rightProximity:{name:Lang.Blocks.ALBERT_sensor_rightProximity,type:"input",pos:{x:66,y:359}},battery:{name:Lang.Blocks.ALBERT_sensor_battery,type:"input",pos:{x:88,y:368}},light:{name:Lang.Blocks.ALBERT_sensor_light,type:"input",pos:{x:127,y:391}},leftWheel:{name:Lang.Hw.leftWheel,type:"output",pos:{x:299,y:406}},rightWheel:{name:Lang.Hw.rightWheel,type:"output",pos:{x:22,y:325}},leftEye:{name:Lang.Hw.leftEye, -type:"output",pos:{x:260,y:26}},rightEye:{name:Lang.Hw.rightEye,type:"output",pos:{x:164,y:13}},bodyLed:{name:Lang.Hw.body+" "+Lang.Hw.led,type:"output",pos:{x:367,y:308}},frontLed:{name:Lang.Hw.front+" "+Lang.Hw.led,pos:{x:117,y:410}}},mode:"both"},tempo:60,timeouts:[],removeTimeout:function(b){clearTimeout(b);var a=this.timeouts;b=a.indexOf(b);0<=b&&a.splice(b,1)},removeAllTimeouts:function(){var b=this.timeouts,a;for(a in b)clearTimeout(b[a]);this.timeouts=[]},name:"albert"}; -Blockly.Blocks.albert_hand_found={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_hand_found);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.albert_hand_found=function(b,a){var c=Entry.hw.portData;return 40Entry.Albert.tempo&&(Entry.Albert.tempo=1);return a.callReturn()}; +Entry.block.albert_change_tempo_by=function(a,b){Entry.Albert.tempo+=b.getNumberValue("VALUE");1>Entry.Albert.tempo&&(Entry.Albert.tempo=1);return b.callReturn()}; Blockly.Blocks.albert_set_tempo_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_tempo_to_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ALBERT_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.albert_set_tempo_to=function(b,a){Entry.Albert.tempo=a.getNumberValue("VALUE");1>Entry.Albert.tempo&&(Entry.Albert.tempo=1);return a.callReturn()};Blockly.Blocks.albert_move_forward={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_move_forward).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.albert_move_forward=function(b,a){var c=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return 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;c.leftWheel=30;c.rightWheel=30;setTimeout(function(){a.timeFlag=0},1E3);return a}; +Entry.block.albert_set_tempo_to=function(a,b){Entry.Albert.tempo=b.getNumberValue("VALUE");1>Entry.Albert.tempo&&(Entry.Albert.tempo=1);return b.callReturn()};Blockly.Blocks.albert_move_forward={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_move_forward).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; +Entry.block.albert_move_forward=function(a,b){a=Entry.hw.sendQueue;if(b.isStart){if(1==b.timeFlag)return b;delete b.timeFlag;delete b.isStart;Entry.engine.isContinue=!1;a.leftWheel=0;a.rightWheel=0;return b.callReturn()}b.isStart=!0;b.timeFlag=1;a.leftWheel=30;a.rightWheel=30;setTimeout(function(){b.timeFlag=0},1E3);return b}; Blockly.Blocks.albert_move_backward={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_move_backward).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.albert_move_backward=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}; +Entry.block.albert_move_backward=function(a,b){a=Entry.hw.sendQueue;if(b.isStart){if(1==b.timeFlag)return a.leftWheel=-30,a.rightWheel=-30,b;delete b.timeFlag;delete b.isStart;Entry.engine.isContinue=!1;a.leftWheel=0;a.rightWheel=0;return b.callReturn()}b.isStart=!0;b.timeFlag=1;setTimeout(function(){b.timeFlag=0},1E3);return b}; 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}; +Entry.block.albert_turn_around=function(a,b){a=Entry.hw.sendQueue;if(b.isStart){if(1==b.timeFlag)return a.leftWheel=b.leftValue,a.rightWheel=b.rightValue,b;delete b.timeFlag;delete b.isStart;delete b.leftValue;delete b.rightValue;Entry.engine.isContinue=!1;a.leftWheel=0;a.rightWheel=0;return b.callReturn()}a="LEFT"==b.getField("DIRECTION",b);b.leftValue=a?-30:30;b.rightValue=a?30:-30;b.isStart=!0;b.timeFlag=1;setTimeout(function(){b.timeFlag=0},1E3);return b}; 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(a,b){a=Entry.hw.sendQueue;var c=b.getField("DIRECTION",b),d=Number(b.getField("COLOR",b));"FRONT"==c?(a.leftEye=d,a.rightEye=d):"LEFT"==c?a.leftEye=d:a.rightEye=d;return b.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()}; +Entry.block.albert_clear_led=function(a,b){a=Entry.hw.sendQueue;var c=b.getField("DIRECTION",b);"FRONT"==c?(a.leftEye=0,a.rightEye=0):"LEFT"==c?a.leftEye=0:a.rightEye=0;return b.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+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.albert_change_wheels_by=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()}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.albert_change_wheels_by=function(a,b){a=Entry.hw.sendQueue;var c=Entry.hw.portData,d=b.getField("DIRECTION"),e=b.getNumberValue("VALUE");"LEFT"==d?a.leftWheel=void 0!=a.leftWheel?a.leftWheel+e:c.leftWheel+e:("RIGHT"!=d&&(a.leftWheel=void 0!=a.leftWheel?a.leftWheel+e:c.leftWheel+e),a.rightWheel=void 0!=a.rightWheel?a.rightWheel+e:c.rightWheel+e);return b.callReturn()}; Blockly.Blocks.albert_set_wheels_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_wheels_to_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"FRONT"]]),"DIRECTION").appendField(Lang.Blocks.HAMSTER_set_wheels_to_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_wheels_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_wheels_to=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()};Entry.Arduino={name:"arduino",setZero:function(){Entry.hw.sendQueue.readablePorts=[];for(var b=0;20>b;b++)Entry.hw.sendQueue[b]=0,Entry.hw.sendQueue.readablePorts.push(b);Entry.hw.update()},monitorTemplate:{imgPath:"hw/arduino.png",width:605,height:434,listPorts:{2:{name:Lang.Hw.port_en+" 2 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},3:{name:Lang.Hw.port_en+" 3 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},4:{name:Lang.Hw.port_en+" 4 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},5:{name:Lang.Hw.port_en+ +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.albert_set_wheels_to=function(a,b){a=Entry.hw.sendQueue;var c=b.getField("DIRECTION"),d=b.getNumberValue("VALUE");"LEFT"==c?a.leftWheel=d:("RIGHT"!=c&&(a.leftWheel=d),a.rightWheel=d);return b.callReturn()};Entry.Arduino={name:"arduino",setZero:function(){Entry.hw.sendQueue.readablePorts=[];for(var a=0;20>a;a++)Entry.hw.sendQueue[a]=0,Entry.hw.sendQueue.readablePorts.push(a);Entry.hw.update()},monitorTemplate:{imgPath:"hw/arduino.png",width:605,height:434,listPorts:{2:{name:Lang.Hw.port_en+" 2 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},3:{name:Lang.Hw.port_en+" 3 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},4:{name:Lang.Hw.port_en+" 4 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},5:{name:Lang.Hw.port_en+ " 5 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},6:{name:Lang.Hw.port_en+" 6 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},7:{name:Lang.Hw.port_en+" 7 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},8:{name:Lang.Hw.port_en+" 8 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},9:{name:Lang.Hw.port_en+" 9 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},10:{name:Lang.Hw.port_en+" 10 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},11:{name:Lang.Hw.port_en+" 11 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},12:{name:Lang.Hw.port_en+ " 12 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},13:{name:Lang.Hw.port_en+" 13 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},a0:{name:Lang.Hw.port_en+" A0 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},a1:{name:Lang.Hw.port_en+" A1 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},a2:{name:Lang.Hw.port_en+" A2 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},a3:{name:Lang.Hw.port_en+" A3 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},a4:{name:Lang.Hw.port_en+" A4 "+Lang.Hw.port_ko,type:"input",pos:{x:0, y:0}},a5:{name:Lang.Hw.port_en+" A5 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}}},mode:"both"}}; -Entry.ArduinoExt={name:"ArduinoExt",getSensorKey:function(){return"xxxxxxxx".replace(/[xy]/g,function(b){var a=16*Math.random()|0;return("x"==b?a:a&0|0).toString(16)}).toUpperCase()},getSensorTime:function(b){return(new Date).getTime()+b},setZero:function(){Entry.hw.sendQueue.SET?Object.keys(Entry.hw.sendQueue.SET).forEach(function(b){Entry.hw.sendQueue.SET[b].data=0;Entry.hw.sendQueue.TIME=Entry.ArduinoExt.getSensorTime(Entry.hw.sendQueue.SET[b].type);Entry.hw.sendQueue.KEY=Entry.ArduinoExt.getSensorKey()}): +Entry.ArduinoExt={name:"ArduinoExt",getSensorKey:function(){return"xxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0;return("x"==a?b:b&0|0).toString(16)}).toUpperCase()},getSensorTime:function(a){return(new Date).getTime()+a},setZero:function(){Entry.hw.sendQueue.SET?Object.keys(Entry.hw.sendQueue.SET).forEach(function(a){Entry.hw.sendQueue.SET[a].data=0;Entry.hw.sendQueue.TIME=Entry.ArduinoExt.getSensorTime(Entry.hw.sendQueue.SET[a].type);Entry.hw.sendQueue.KEY=Entry.ArduinoExt.getSensorKey()}): Entry.hw.sendQueue={SET:{0:{type:Entry.ArduinoExt.sensorTypes.DIGITAL,data:0},1:{type:Entry.ArduinoExt.sensorTypes.DIGITAL,data:0},2:{type:Entry.ArduinoExt.sensorTypes.DIGITAL,data:0},3:{type:Entry.ArduinoExt.sensorTypes.DIGITAL,data:0},4:{type:Entry.ArduinoExt.sensorTypes.DIGITAL,data:0},5:{type:Entry.ArduinoExt.sensorTypes.DIGITAL,data:0},6:{type:Entry.ArduinoExt.sensorTypes.DIGITAL,data:0},7:{type:Entry.ArduinoExt.sensorTypes.DIGITAL,data:0},8:{type:Entry.ArduinoExt.sensorTypes.DIGITAL,data:0}, 9:{type:Entry.ArduinoExt.sensorTypes.DIGITAL,data:0},10:{type:Entry.ArduinoExt.sensorTypes.DIGITAL,data:0},11:{type:Entry.ArduinoExt.sensorTypes.DIGITAL,data:0},12:{type:Entry.ArduinoExt.sensorTypes.DIGITAL,data:0},13:{type:Entry.ArduinoExt.sensorTypes.DIGITAL,data:0}},TIME:Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.DIGITAL),KEY:Entry.ArduinoExt.getSensorKey()};Entry.hw.update()},sensorTypes:{ALIVE:0,DIGITAL:1,ANALOG:2,PWM:3,SERVO_PIN:4,TONE:5,PULSEIN:6,ULTRASONIC:7,TIMER:8},toneMap:{1:[33, 65,131,262,523,1046,2093,4186],2:[35,69,139,277,554,1109,2217,4435],3:[37,73,147,294,587,1175,2349,4699],4:[39,78,156,311,622,1245,2849,4978],5:[41,82,165,330,659,1319,2637,5274],6:[44,87,175,349,698,1397,2794,5588],7:[46,92,185,370,740,1480,2960,5920],8:[49,98,196,392,784,1568,3136,6272],9:[52,104,208,415,831,1661,3322,6645],10:[55,110,220,440,880,1760,3520,7040],11:[58,117,233,466,932,1865,3729,7459],12:[62,123,247,494,988,1976,3951,7902]},BlockState:{}};Entry.SensorBoard={name:"sensorBoard",setZero:Entry.Arduino.setZero}; -Entry.ardublock={name:"ardublock",setZero:Entry.Arduino.setZero};Entry.dplay={name:"dplay",vel_value:255,Left_value:255,Right_value:255,setZero:Entry.Arduino.setZero,timeouts:[],removeTimeout:function(b){clearTimeout(b);var a=this.timeouts;b=a.indexOf(b);0<=b&&a.splice(b,1)},removeAllTimeouts:function(){var b=this.timeouts,a;for(a in b)clearTimeout(b[a]);this.timeouts=[]}};Entry.nemoino={name:"nemoino",setZero:Entry.Arduino.setZero};Entry.joystick={name:"joystick",setZero:Entry.Arduino.setZero}; -Entry.CODEino={name:"CODEino",setZero:Entry.Arduino.setZero,monitorTemplate:Entry.Arduino.monitorTemplate};Blockly.Blocks.arduino_text={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldTextInput("Arduino"),"NAME");this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.arduino_text=function(b,a){return a.getStringField("NAME")}; +Entry.ardublock={name:"ardublock",setZero:Entry.Arduino.setZero};Entry.dplay={name:"dplay",vel_value:255,Left_value:255,Right_value:255,setZero:Entry.Arduino.setZero,timeouts:[],removeTimeout:function(a){clearTimeout(a);var b=this.timeouts;a=b.indexOf(a);0<=a&&b.splice(a,1)},removeAllTimeouts:function(){var a=this.timeouts,b;for(b in a)clearTimeout(a[b]);this.timeouts=[]}};Entry.nemoino={name:"nemoino",setZero:Entry.Arduino.setZero};Entry.joystick={name:"joystick",setZero:Entry.Arduino.setZero}; +Entry.CODEino={name:"CODEino",setZero:Entry.Arduino.setZero,monitorTemplate:Entry.Arduino.monitorTemplate};Blockly.Blocks.arduino_text={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldTextInput("Arduino"),"NAME");this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.arduino_text=function(a,b){return b.getStringField("NAME")}; 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()}; +Entry.block.arduino_send=function(a,b){a=b.getValue("VALUE",b);var c=new XMLHttpRequest;c.open("POST","http://localhost:23518/arduino/",!1);c.send(String(a));Entry.assert(200==c.status,"arduino is not connected");return b.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(a,b){a=b.getValue("VALUE",b);b=new XMLHttpRequest;b.open("POST","http://localhost:23518/arduino/",!1);b.send(String(a));Entry.assert(200==b.status,"arduino is not connected");return Number(b.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}; +Entry.block.arduino_get_string=function(a,b){a=b.getValue("VALUE",b);b=new XMLHttpRequest;b.open("POST","http://localhost:23518/arduino/",!1);b.send(String(a));Entry.assert(200==b.status,"arduino is not connected");return b.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(" "); -this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.arduino_get_sensor_number=function(b,a){return a.getStringField("PORT")}; -Blockly.Blocks.arduino_get_port_number={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["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"]]),"PORT");this.appendDummyInput().appendField(" ");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.arduino_get_port_number=function(b,a){return a.getStringField("PORT")}; -Blockly.Blocks.arduino_get_pwm_port_number={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["3","3"],["5","5"],["6","6"],["9","9"],["10","10"],["11","11"]]),"PORT");this.appendDummyInput().appendField(" ");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.arduino_get_pwm_port_number=function(b,a){return a.getStringField("PORT")}; -Blockly.Blocks.arduino_get_number_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_sensor_value_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_sensor_value_2).appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.arduino_get_number_sensor_value=function(b,a){var c=a.getValue("VALUE",a);return Entry.hw.getAnalogPortValue(c[1])}; -Blockly.Blocks.arduino_get_digital_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_get_digital_value_1);this.appendValueInput("VALUE").setCheck("Number");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_sensor_value_2).appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}};Entry.block.arduino_get_digital_value=function(b,a){var c=a.getNumberValue("VALUE",a);return Entry.hw.getDigitalPortValue(c)}; +this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.arduino_get_sensor_number=function(a,b){return b.getStringField("PORT")}; +Blockly.Blocks.arduino_get_port_number={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["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"]]),"PORT");this.appendDummyInput().appendField(" ");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.arduino_get_port_number=function(a,b){return b.getStringField("PORT")}; +Blockly.Blocks.arduino_get_pwm_port_number={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["3","3"],["5","5"],["6","6"],["9","9"],["10","10"],["11","11"]]),"PORT");this.appendDummyInput().appendField(" ");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.arduino_get_pwm_port_number=function(a,b){return b.getStringField("PORT")}; +Blockly.Blocks.arduino_get_number_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_sensor_value_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_sensor_value_2).appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.arduino_get_number_sensor_value=function(a,b){a=b.getValue("VALUE",b);return Entry.hw.getAnalogPortValue(a[1])}; +Blockly.Blocks.arduino_get_digital_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_get_digital_value_1);this.appendValueInput("VALUE").setCheck("Number");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_sensor_value_2).appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}};Entry.block.arduino_get_digital_value=function(a,b){a=b.getNumberValue("VALUE",b);return Entry.hw.getDigitalPortValue(a)}; Blockly.Blocks.arduino_toggle_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_pin_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_pin_2);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.ARDUINO_on,"on"],[Lang.Blocks.ARDUINO_off,"off"]]),"OPERATOR").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*")); -this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.arduino_toggle_led=function(b,a){var c=a.getNumberValue("VALUE"),d="on"==a.getField("OPERATOR")?255:0;Entry.hw.setDigitalPortValue(c,d);return a.callReturn()}; +this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.arduino_toggle_led=function(a,b){a=b.getNumberValue("VALUE");var c=b.getField("OPERATOR");Entry.hw.setDigitalPortValue(a,"on"==c?255:0);return b.callReturn()}; Blockly.Blocks.arduino_toggle_pwm={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_toggle_pwm_1);this.appendValueInput("PORT").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_toggle_pwm_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_toggle_pwm_3);this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png", -"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.arduino_toggle_pwm=function(b,a){var c=a.getNumberValue("PORT"),d=a.getNumberValue("VALUE"),d=Math.round(d),d=Math.max(d,0),d=Math.min(d,255);Entry.hw.setDigitalPortValue(c,d);return a.callReturn()}; +"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.arduino_toggle_pwm=function(a,b){a=b.getNumberValue("PORT");var c=b.getNumberValue("VALUE"),c=Math.round(c),c=Math.max(c,0),c=Math.min(c,255);Entry.hw.setDigitalPortValue(a,c);return b.callReturn()}; Blockly.Blocks.arduino_convert_scale={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_1);this.appendValueInput("VALUE1").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_2);this.appendValueInput("VALUE2").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_3);this.appendValueInput("VALUE3").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_4); this.appendValueInput("VALUE4").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_5);this.appendValueInput("VALUE5").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_6);this.appendDummyInput().appendField(" ");this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.arduino_convert_scale=function(b,a){var c=a.getNumberValue("VALUE1",a),d=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a),f=a.getNumberValue("VALUE4",a),g=a.getNumberValue("VALUE5",a);if(d>e)var h=d,d=e,e=h;f>g&&(h=f,f=g,g=h);c-=d;c*=(g-f)/(e-d);c+=f;c=Math.min(g,c);c=Math.max(f,c);return Math.round(c)}; -Blockly.Blocks.sensorBoard_get_named_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["\uc18c\ub9ac","0"],["\ube5b \uac10\uc9c0","1"],["\uc2ac\ub77c\uc774\ub354","2"],["\uc628\ub3c4","3"]]),"PORT").appendField(" \uc13c\uc11c\uac12");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.sensorBoard_get_named_sensor_value=function(b,a){return Entry.hw.getAnalogPortValue(a.getField("PORT",a))}; +Entry.block.arduino_convert_scale=function(a,b){var c=b.getNumberValue("VALUE1",b),d=b.getNumberValue("VALUE2",b),e=b.getNumberValue("VALUE3",b);a=b.getNumberValue("VALUE4",b);b=b.getNumberValue("VALUE5",b);if(d>e)var f=d,d=e,e=f;a>b&&(f=a,a=b,b=f);c=(b-a)/(e-d)*(c-d);c+=a;c=Math.min(b,c);c=Math.max(a,c);return Math.round(c)}; +Blockly.Blocks.sensorBoard_get_named_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["\uc18c\ub9ac","0"],["\ube5b \uac10\uc9c0","1"],["\uc2ac\ub77c\uc774\ub354","2"],["\uc628\ub3c4","3"]]),"PORT").appendField(" \uc13c\uc11c\uac12");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.sensorBoard_get_named_sensor_value=function(a,b){return Entry.hw.getAnalogPortValue(b.getField("PORT",b))}; Blockly.Blocks.sensorBoard_is_button_pressed={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["\ube68\uac04","8"],["\ud30c\ub780","9"],["\ub178\ub780","10"],["\ucd08\ub85d","11"]]),"PORT");this.appendDummyInput().appendField(" \ubc84\ud2bc\uc744 \ub20c\ub800\ub294\uac00?");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}}; -Entry.block.sensorBoard_is_button_pressed=function(b,a){return Entry.hw.getDigitalPortValue(a.getNumberField("PORT",a))}; +Entry.block.sensorBoard_is_button_pressed=function(a,b){return Entry.hw.getDigitalPortValue(b.getNumberField("PORT",b))}; Blockly.Blocks.sensorBoard_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["\ube68\uac04","2"],["\ucd08\ub85d","3"],["\ud30c\ub780","4"],["\ud770\uc0c9","5"]]),"PORT").appendField(" LED").appendField(new Blockly.FieldDropdown([["\ucf1c\uae30","255"],["\ub044\uae30","0"]]),"OPERATOR").appendField(" ").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0); -this.setNextStatement(!0)}};Entry.block.sensorBoard_led=function(b,a){Entry.hw.setDigitalPortValue(a.getField("PORT"),a.getNumberField("OPERATOR"));return a.callReturn()};Entry.block.arduino_download_connector={skeleton:"basic_button",color:"#eee",template:"%1",params:[{type:"Text",text:"\uc5f0\uacb0 \ud504\ub85c\uadf8\ub7a8 \ub2e4\uc6b4\ub85c\ub4dc",color:"#333",align:"center"}],func:function(){},events:{mousedown:[function(){console.log("download connector")}]}}; +this.setNextStatement(!0)}};Entry.block.sensorBoard_led=function(a,b){Entry.hw.setDigitalPortValue(b.getField("PORT"),b.getNumberField("OPERATOR"));return b.callReturn()};Entry.block.arduino_download_connector={skeleton:"basic_button",color:"#eee",template:"%1",params:[{type:"Text",text:"\uc5f0\uacb0 \ud504\ub85c\uadf8\ub7a8 \ub2e4\uc6b4\ub85c\ub4dc",color:"#333",align:"center"}],func:function(){},events:{mousedown:[function(){console.log("download connector")}]}}; Entry.block.arduino_download_source={skeleton:"basic_button",color:"#eee",template:"%1",params:[{type:"Text",text:"\uc5d4\ud2b8\ub9ac \uc544\ub450\uc774\ub178 \uc18c\uc2a4",color:"#333",align:"center"}],func:function(){},events:{mousedown:[function(){console.log("download source")}]}};Entry.block.arduino_connected={skeleton:"basic_button",color:"#eee",template:"%1",params:[{type:"Text",text:"\uc5f0\uacb0 \ub428",color:"#333",align:"center"}],func:function(){},events:{mousedown:[function(){console.log("download source")}]}}; Entry.block.arduino_reconnect={skeleton:"basic_button",color:"#eee",template:"%1",params:[{type:"Text",text:"\ub2e4\uc2dc \uc5f0\uacb0\ud558\uae30",color:"#333",align:"center"}],func:function(){},events:{mousedown:[function(){console.log("download source")}]}}; Blockly.Blocks.CODEino_get_sensor_number={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.CODEino_get_sensor_number_0,"A0"],[Lang.Blocks.CODEino_get_sensor_number_1,"A1"],[Lang.Blocks.CODEino_get_sensor_number_2,"A2"],[Lang.Blocks.CODEino_get_sensor_number_3,"A3"],[Lang.Blocks.CODEino_get_sensor_number_4,"A4"],[Lang.Blocks.CODEino_get_sensor_number_5,"A5"],[Lang.Blocks.CODEino_get_sensor_number_6,"A6"]]),"PORT");this.appendDummyInput().appendField(" "); -this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.CODEino_get_sensor_number=function(b,a){return a.getStringField("PORT")}; +this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.CODEino_get_sensor_number=function(a,b){return b.getStringField("PORT")}; Blockly.Blocks.CODEino_get_named_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(" ").appendField(new Blockly.FieldDropdown([[Lang.Blocks.CODEino_sensor_name_0,"0"],[Lang.Blocks.CODEino_sensor_name_1,"1"],[Lang.Blocks.CODEino_sensor_name_2,"2"],[Lang.Blocks.CODEino_sensor_name_3,"3"],[Lang.Blocks.CODEino_sensor_name_4,"4"],[Lang.Blocks.CODEino_sensor_name_5,"5"],[Lang.Blocks.CODEino_sensor_name_6,"6"]]),"PORT").appendField(Lang.Blocks.CODEino_string_1); -this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.CODEino_get_named_sensor_value=function(b,a){return Entry.hw.getAnalogPortValue(a.getField("PORT",a))}; +this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.CODEino_get_named_sensor_value=function(a,b){return Entry.hw.getAnalogPortValue(b.getField("PORT",b))}; Blockly.Blocks.CODEino_get_sound_status={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.CODEino_string_10).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CODEino_string_11,"GREAT"],[Lang.Blocks.CODEino_string_12,"SMALL"]]),"STATUS").appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}}; -Entry.block.CODEino_get_sound_status=function(b,a){return"GREAT"==a.getField("STATUS",a)?600Entry.hw.getAnalogPortValue(0)?1:0}; +Entry.block.CODEino_get_sound_status=function(a,b){return"GREAT"==b.getField("STATUS",b)?600Entry.hw.getAnalogPortValue(0)?1:0}; Blockly.Blocks.CODEino_get_light_status={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.CODEino_string_13).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CODEino_string_14,"BRIGHT"],[Lang.Blocks.CODEino_string_15,"DARK"]]),"STATUS").appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}}; -Entry.block.CODEino_get_light_status=function(b,a){return"DARK"==a.getField("STATUS",a)?800Entry.hw.getAnalogPortValue(1)?1:0}; +Entry.block.CODEino_get_light_status=function(a,b){return"DARK"==b.getField("STATUS",b)?800Entry.hw.getAnalogPortValue(1)?1:0}; Blockly.Blocks.CODEino_is_button_pressed={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.CODEino_string_2).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CODEino_string_3,"4"],[Lang.Blocks.CODEino_string_4,"17"],[Lang.Blocks.CODEino_string_5,"18"],[Lang.Blocks.CODEino_string_6,"19"],[Lang.Blocks.CODEino_string_7,"20"]]),"PORT").appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}}; -Entry.block.CODEino_is_button_pressed=function(b,a){var c=a.getNumberField("PORT",a);return 14d?1:0;if("RIGHT"==c||"FRONT"==c)return 30d?1:0}; +Entry.block.CODEino_get_accelerometer_direction=function(a,b){a=b.getField("DIRECTION",b);b=0;"LEFT"==a||"RIGHT"==a?b=3:"FRONT"==a||"REAR"==a?b=4:"REVERSE"==a&&(b=5);b=Entry.hw.getAnalogPortValue(b)-265;b=Math.min(90,180/137*b+-90);b=Math.max(-90,b);b=Math.round(b);if("LEFT"==a||"REAR"==a)return-30>b?1:0;if("RIGHT"==a||"FRONT"==a)return 30b?1:0}; Blockly.Blocks.CODEino_get_accelerometer_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.CODEino_string_8).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CODEino_accelerometer_X,"3"],[Lang.Blocks.CODEino_accelerometer_Y,"4"],[Lang.Blocks.CODEino_accelerometer_Z,"5"]]),"PORT").appendField(Lang.Blocks.CODEino_string_9);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.CODEino_get_accelerometer_value=function(b,a){var c=265,d=402,e=-90,f=90,g=Entry.hw.getAnalogPortValue(a.getField("PORT",a));if(c>d)var h=c,c=d,d=h;e>f&&(h=e,e=f,f=h);g=(f-e)/(d-c)*(g-c);g+=e;g=Math.min(f,g);g=Math.max(e,g);return Math.round(g)}; +Entry.block.CODEino_get_accelerometer_value=function(a,b){var c=Entry.hw.getAnalogPortValue(b.getField("PORT",b)),d=265,e=402;a=-90;b=90;if(d>e)var f=d,d=e,e=f;a>b&&(f=a,a=b,b=f);c=(b-a)/(e-d)*(c-d);c+=a;c=Math.min(b,c);c=Math.max(a,c);return Math.round(c)}; Blockly.Blocks.dplay_select_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_pin_1);this.appendDummyInput().appendField(new Blockly.FieldDropdown([["7","7"],["8","8"],["9","9"],["10","10"]]),"PORT");this.appendDummyInput().appendField(Lang.Blocks.dplay_num_pin_1);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.ARDUINO_on,"on"],[Lang.Blocks.ARDUINO_off,"off"]]),"OPERATOR").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dplay_select_led=function(b,a){var c=a.getField("PORT"),d=7;"7"==c?d=7:"8"==c?d=8:"9"==c?d=9:"10"==c&&(d=10);c="on"==a.getField("OPERATOR")?255:0;Entry.hw.setDigitalPortValue(d,c);return a.callReturn()}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dplay_select_led=function(a,b){var c=b.getField("PORT");a=7;"7"==c?a=7:"8"==c?a=8:"9"==c?a=9:"10"==c&&(a=10);c=b.getField("OPERATOR");Entry.hw.setDigitalPortValue(a,"on"==c?255:0);return b.callReturn()}; Blockly.Blocks.dplay_get_switch_status={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ub514\uc9c0\ud138 ");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["2","2"],["4","4"]]),"PORT");this.appendDummyInput().appendField(Lang.Blocks.dplay_num_pin_2).appendField(new Blockly.FieldDropdown([[Lang.Blocks.dplay_string_5,"ON"],[Lang.Blocks.dplay_string_6,"OFF"]]),"STATUS").appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}}; -Entry.block.dplay_get_switch_status=function(b,a){var c=a.getField("PORT"),d=2;"2"==c?d=2:"4"==c&&(d=4);return"OFF"==a.getField("STATUS")?1==Entry.hw.getDigitalPortValue(d)?1:0:0==Entry.hw.getDigitalPortValue(d)?1:0}; +Entry.block.dplay_get_switch_status=function(a,b){a=b.getField("PORT");var c=2;"2"==a?c=2:"4"==a&&(c=4);return"OFF"==b.getField("STATUS")?1==Entry.hw.getDigitalPortValue(c)?1:0:0==Entry.hw.getDigitalPortValue(c)?1:0}; Blockly.Blocks.dplay_get_light_status={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.dplay_light).appendField(new Blockly.FieldDropdown([[Lang.Blocks.dplay_string_3,"BRIGHT"],[Lang.Blocks.dplay_string_4,"DARK"]]),"STATUS").appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}}; -Entry.block.dplay_get_light_status=function(b,a){return"DARK"==a.getField("STATUS",a)?800Entry.hw.getAnalogPortValue(1)?1:0}; +Entry.block.dplay_get_light_status=function(a,b){return"DARK"==b.getField("STATUS",b)?800Entry.hw.getAnalogPortValue(1)?1:0}; Blockly.Blocks.dplay_get_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.dplay_num_pin_3);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField("\ubc88 ");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["\uac00\ubcc0\uc800\ud56d","ADJU"],["\ube5b\uc13c\uc11c","LIGHT"],["\uc628\ub3c4\uc13c\uc11c","TEMP"],["\uc870\uc774\uc2a4\ud2f1 X","JOYS"],["\uc870\uc774\uc2a4\ud2f1 Y","JOYS"],["\uc801\uc678\uc120", -"INFR"]]),"OPERATOR");this.appendDummyInput().appendField(Lang.Blocks.dplay_num_pin_5);this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.dplay_get_value=function(b,a){var c=a.getValue("VALUE",a);return Entry.hw.getAnalogPortValue(c[1])}; +"INFR"]]),"OPERATOR");this.appendDummyInput().appendField(Lang.Blocks.dplay_num_pin_5);this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.dplay_get_value=function(a,b){a=b.getValue("VALUE",b);return Entry.hw.getAnalogPortValue(a[1])}; Blockly.Blocks.dplay_get_tilt={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.dplay_tilt).appendField(new Blockly.FieldDropdown([["\uc67c\ucabd \uae30\uc6b8\uc784","LEFT"],["\uc624\ub978\ucabd \uae30\uc6b8\uc784","LIGHT"]]),"STATUS").appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}}; -Entry.block.dplay_get_tilt=function(b,a){return"LIGHT"==a.getField("STATUS",a)?1==Entry.hw.getDigitalPortValue(12)?1:0:0==Entry.hw.getDigitalPortValue(12)?1:0}; +Entry.block.dplay_get_tilt=function(a,b){return"LIGHT"==b.getField("STATUS",b)?1==Entry.hw.getDigitalPortValue(12)?1:0:0==Entry.hw.getDigitalPortValue(12)?1:0}; Blockly.Blocks.dplay_DCmotor={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["\uc67c\ucabd","3"],["\uc624\ub978\ucabd","6"]]),"PORT");this.appendDummyInput().appendField(" DC\ubaa8\ud130 \uc0c1\ud0dc\ub97c");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["\uc815\ubc29\ud5a5","FRONT"],["\uc5ed\ubc29\ud5a5","REAR"],["\uc815\uc9c0","OFF"]]),"OPERATOR").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png", -"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dplay_DCmotor=function(b,a){var c=a.getField("PORT"),d=0;"3"==c?d=5:"6"==c&&(d=11);var e=a.getField("OPERATOR"),f=0,g=0;"FRONT"==e?(f=255,g=0):"REAR"==e?(f=0,g=255):"OFF"==e&&(g=f=0);Entry.hw.setDigitalPortValue(c,f);Entry.hw.setDigitalPortValue(d,g);return a.callReturn()}; +"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dplay_DCmotor=function(a,b){a=b.getField("PORT");var c=0;"3"==a?c=5:"6"==a&&(c=11);var d=b.getField("OPERATOR"),e=0,f=0;"FRONT"==d?(e=255,f=0):"REAR"==d?(e=0,f=255):"OFF"==d&&(f=e=0);Entry.hw.setDigitalPortValue(a,e);Entry.hw.setDigitalPortValue(c,f);return b.callReturn()}; Blockly.Blocks.dplay_buzzer={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ubd80\uc800\ub97c ");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["\ub3c4","1"],["\ub808","2"],["\ubbf8","3"]]),"PORT");this.appendDummyInput().appendField("\ub85c");this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField("\ubc15\uc790\ub85c \uc5f0\uc8fc\ud558\uae30");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dplay_buzzer=function(b,a){var c=a.getField("PORT"),d=2;"1"==c?d=2:"2"==c?d=4:"3"==c&&(d=7);c=a.getNumberValue("VALUE");c=Math.round(c);c=Math.max(c,0);c=Math.min(c,100);Entry.hw.setDigitalPortValue(d,c);return a.callReturn()}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dplay_buzzer=function(a,b){var c=b.getField("PORT");a=2;"1"==c?a=2:"2"==c?a=4:"3"==c&&(a=7);c=b.getNumberValue("VALUE");c=Math.round(c);c=Math.max(c,0);c=Math.min(c,100);Entry.hw.setDigitalPortValue(a,c);return b.callReturn()}; Blockly.Blocks.dplay_servo={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc11c\ubcf4\ubaa8\ud130 \uac01\ub3c4\ub97c");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("\ub85c \uc774\ub3d9");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.dplay_servo=function(b,a){var c=a.getNumberValue("VALUE"),c=Math.round(c),c=Math.max(c,0),c=Math.min(c,180);Entry.hw.setDigitalPortValue(9,c);return a.callReturn()};Entry.Bitbrick={SENSOR_MAP:{1:"light",2:"IR",3:"touch",4:"potentiometer",5:"MIC",21:"UserSensor",11:"UserInput",20:"LED",19:"SERVO",18:"DC"},PORT_MAP:{buzzer:2,5:4,6:6,7:8,8:10,LEDR:12,LEDG:14,LEDB:16},sensorList:function(){for(var b=[],a=Entry.hw.portData,c=1;5>c;c++){var d=a[c];d&&(d.value||0===d.value)&&b.push([c+" - "+Lang.Blocks["BITBRICK_"+d.type],c.toString()])}return 0==b.length?[[Lang.Blocks.no_target,"null"]]:b},touchList:function(){for(var b=[],a=Entry.hw.portData,c=1;5>c;c++){var d=a[c]; -d&&"touch"===d.type&&b.push([c.toString(),c.toString()])}return 0==b.length?[[Lang.Blocks.no_target,"null"]]:b},servoList:function(){for(var b=[],a=Entry.hw.portData,c=5;9>c;c++){var d=a[c];d&&"SERVO"===d.type&&b.push(["ABCD"[c-5],c.toString()])}return 0==b.length?[[Lang.Blocks.no_target,"null"]]:b},dcList:function(){for(var b=[],a=Entry.hw.portData,c=5;9>c;c++){var d=a[c];d&&"DC"===d.type&&b.push(["ABCD"[c-5],c.toString()])}return 0==b.length?[[Lang.Blocks.no_target,"null"]]:b},setZero:function(){var b= -Entry.hw.sendQueue,a;for(a in Entry.Bitbrick.PORT_MAP)b[a]=0;Entry.hw.update()},name:"bitbrick",servoMaxValue:181,servoMinValue:1,dcMaxValue:100,dcMinValue:-100,monitorTemplate:{keys:["value"],imgPath:"hw/bitbrick.png",width:400,height:400,listPorts:{1:{name:Lang.Hw.port_en+" 1 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},2:{name:Lang.Hw.port_en+" 2 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},3:{name:Lang.Hw.port_en+" 3 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},4:{name:Lang.Hw.port_en+" 4 "+ +Entry.block.dplay_servo=function(a,b){a=b.getNumberValue("VALUE");a=Math.round(a);a=Math.max(a,0);a=Math.min(a,180);Entry.hw.setDigitalPortValue(9,a);return b.callReturn()};Entry.Bitbrick={SENSOR_MAP:{1:"light",2:"IR",3:"touch",4:"potentiometer",5:"MIC",21:"UserSensor",11:"UserInput",20:"LED",19:"SERVO",18:"DC"},PORT_MAP:{buzzer:2,5:4,6:6,7:8,8:10,LEDR:12,LEDG:14,LEDB:16},sensorList:function(){for(var a=[],b=Entry.hw.portData,c=1;5>c;c++){var d=b[c];d&&(d.value||0===d.value)&&a.push([c+" - "+Lang.Blocks["BITBRICK_"+d.type],c.toString()])}return 0==a.length?[[Lang.Blocks.no_target,"null"]]:a},touchList:function(){for(var a=[],b=Entry.hw.portData,c=1;5>c;c++){var d=b[c]; +d&&"touch"===d.type&&a.push([c.toString(),c.toString()])}return 0==a.length?[[Lang.Blocks.no_target,"null"]]:a},servoList:function(){for(var a=[],b=Entry.hw.portData,c=5;9>c;c++){var d=b[c];d&&"SERVO"===d.type&&a.push(["ABCD"[c-5],c.toString()])}return 0==a.length?[[Lang.Blocks.no_target,"null"]]:a},dcList:function(){for(var a=[],b=Entry.hw.portData,c=5;9>c;c++){var d=b[c];d&&"DC"===d.type&&a.push(["ABCD"[c-5],c.toString()])}return 0==a.length?[[Lang.Blocks.no_target,"null"]]:a},setZero:function(){var a= +Entry.hw.sendQueue,b;for(b in Entry.Bitbrick.PORT_MAP)a[b]=0;Entry.hw.update()},name:"bitbrick",servoMaxValue:181,servoMinValue:1,dcMaxValue:100,dcMinValue:-100,monitorTemplate:{keys:["value"],imgPath:"hw/bitbrick.png",width:400,height:400,listPorts:{1:{name:Lang.Hw.port_en+" 1 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},2:{name:Lang.Hw.port_en+" 2 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},3:{name:Lang.Hw.port_en+" 3 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},4:{name:Lang.Hw.port_en+" 4 "+ Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},A:{name:Lang.Hw.port_en+" A "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},B:{name:Lang.Hw.port_en+" B "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},C:{name:Lang.Hw.port_en+" C "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},D:{name:Lang.Hw.port_en+" D "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}}},mode:"both"}}; -Blockly.Blocks.bitbrick_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.sensorList),"PORT").appendField(" \uac12");this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.bitbrick_sensor_value=function(b,a){var c=a.getStringField("PORT");return Entry.hw.portData[c].value}; -Blockly.Blocks.bitbrick_is_touch_pressed={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.BITBRICK_touch).appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.touchList),"PORT").appendField("\uc774(\uac00) \ub20c\ub838\ub294\uac00?");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.bitbrick_is_touch_pressed=function(b,a){return 0===Entry.hw.portData[a.getStringField("PORT")].value}; -Blockly.Blocks.bitbrick_turn_off_color_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uceec\ub7ec LED \ub044\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.bitbrick_turn_off_color_led=function(b,a){Entry.hw.sendQueue.LEDR=0;Entry.hw.sendQueue.LEDG=0;Entry.hw.sendQueue.LEDB=0;return a.callReturn()}; +Blockly.Blocks.bitbrick_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.sensorList),"PORT").appendField(" \uac12");this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.bitbrick_sensor_value=function(a,b){a=b.getStringField("PORT");return Entry.hw.portData[a].value}; +Blockly.Blocks.bitbrick_is_touch_pressed={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.BITBRICK_touch).appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.touchList),"PORT").appendField("\uc774(\uac00) \ub20c\ub838\ub294\uac00?");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.bitbrick_is_touch_pressed=function(a,b){return 0===Entry.hw.portData[b.getStringField("PORT")].value}; +Blockly.Blocks.bitbrick_turn_off_color_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uceec\ub7ec LED \ub044\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.bitbrick_turn_off_color_led=function(a,b){Entry.hw.sendQueue.LEDR=0;Entry.hw.sendQueue.LEDG=0;Entry.hw.sendQueue.LEDB=0;return b.callReturn()}; Blockly.Blocks.bitbrick_turn_on_color_led_by_rgb={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uceec\ub7ec LED \ucf1c\uae30 R");this.appendValueInput("rValue").setCheck(["Number","String"]);this.appendDummyInput().appendField("G");this.appendValueInput("gValue").setCheck(["Number","String"]);this.appendDummyInput().appendField("B");this.appendValueInput("bValue").setCheck(["Number","String"]);this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.bitbrick_turn_on_color_led_by_rgb=function(b,a){var c=a.getNumberValue("rValue"),d=a.getNumberValue("gValue"),e=a.getNumberValue("bValue"),f=Entry.adjustValueWithMaxMin,g=Entry.hw.sendQueue;g.LEDR=f(c,0,255);g.LEDG=f(d,0,255);g.LEDB=f(e,0,255);return a.callReturn()}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.bitbrick_turn_on_color_led_by_rgb=function(a,b){a=b.getNumberValue("rValue");var c=b.getNumberValue("gValue"),d=b.getNumberValue("bValue"),e=Entry.adjustValueWithMaxMin,f=Entry.hw.sendQueue;f.LEDR=e(a,0,255);f.LEDG=e(c,0,255);f.LEDB=e(d,0,255);return b.callReturn()}; Blockly.Blocks.bitbrick_turn_on_color_led_by_picker={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uceec\ub7ec LED \uc0c9 ").appendField(new Blockly.FieldColour("#ff0000"),"VALUE").appendField("\ub85c \uc815\ud558\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.bitbrick_turn_on_color_led_by_picker=function(b,a){var c=a.getStringField("VALUE");Entry.hw.sendQueue.LEDR=parseInt(c.substr(1,2),16);Entry.hw.sendQueue.LEDG=parseInt(c.substr(3,2),16);Entry.hw.sendQueue.LEDB=parseInt(c.substr(5,2),16);return a.callReturn()}; +Entry.block.bitbrick_turn_on_color_led_by_picker=function(a,b){a=b.getStringField("VALUE");Entry.hw.sendQueue.LEDR=parseInt(a.substr(1,2),16);Entry.hw.sendQueue.LEDG=parseInt(a.substr(3,2),16);Entry.hw.sendQueue.LEDB=parseInt(a.substr(5,2),16);return b.callReturn()}; Blockly.Blocks.bitbrick_turn_on_color_led_by_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uceec\ub7ec LED \ucf1c\uae30 \uc0c9");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("\ub85c \uc815\ud558\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.bitbrick_turn_on_color_led_by_value=function(b,a){var c=a.getNumberValue("VALUE"),d,e,f,c=c%200;67>c?(d=200-3*c,e=3*c,f=0):134>c?(c-=67,d=0,e=200-3*c,f=3*c):201>c&&(c-=134,d=3*c,e=0,f=200-3*c);Entry.hw.sendQueue.LEDR=d;Entry.hw.sendQueue.LEDG=e;Entry.hw.sendQueue.LEDB=f;return a.callReturn()}; +Entry.block.bitbrick_turn_on_color_led_by_value=function(a,b){a=b.getNumberValue("VALUE");var c,d,e;a%=200;67>a?(c=200-3*a,d=3*a,e=0):134>a?(a-=67,c=0,d=200-3*a,e=3*a):201>a&&(a-=134,c=3*a,d=0,e=200-3*a);Entry.hw.sendQueue.LEDR=c;Entry.hw.sendQueue.LEDG=d;Entry.hw.sendQueue.LEDB=e;return b.callReturn()}; Blockly.Blocks.bitbrick_buzzer={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ubc84\uc800\uc74c ");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("\ub0b4\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.bitbrick_buzzer=function(b,a){if(a.isStart)return Entry.hw.sendQueue.buzzer=0,delete a.isStart,a.callReturn();var c=a.getNumberValue("VALUE");Entry.hw.sendQueue.buzzer=c;a.isStart=!0;return a}; +Entry.block.bitbrick_buzzer=function(a,b){if(b.isStart)return Entry.hw.sendQueue.buzzer=0,delete b.isStart,b.callReturn();a=b.getNumberValue("VALUE");Entry.hw.sendQueue.buzzer=a;b.isStart=!0;return b}; Blockly.Blocks.bitbrick_turn_off_all_motors={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ubaa8\ub4e0 \ubaa8\ud130 \ub044\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.bitbrick_turn_off_all_motors=function(b,a){var c=Entry.hw.sendQueue,d=Entry.Bitbrick;d.servoList().map(function(a){c[a[1]]=0});d.dcList().map(function(a){c[a[1]]=128});return a.callReturn()}; +Entry.block.bitbrick_turn_off_all_motors=function(a,b){var c=Entry.hw.sendQueue;a=Entry.Bitbrick;a.servoList().map(function(b){c[b[1]]=0});a.dcList().map(function(b){c[b[1]]=128});return b.callReturn()}; Blockly.Blocks.bitbrick_dc_speed={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("DC \ubaa8\ud130").appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.dcList),"PORT").appendField(" \uc18d\ub3c4");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setPreviousStatement(!0);this.setNextStatement(!0);this.setInputsInline(!0)}}; -Entry.block.bitbrick_dc_speed=function(b,a){var c=a.getNumberValue("VALUE"),c=Math.min(c,Entry.Bitbrick.dcMaxValue),c=Math.max(c,Entry.Bitbrick.dcMinValue);Entry.hw.sendQueue[a.getStringField("PORT")]=c+128;return a.callReturn()}; +Entry.block.bitbrick_dc_speed=function(a,b){a=b.getNumberValue("VALUE");a=Math.min(a,Entry.Bitbrick.dcMaxValue);a=Math.max(a,Entry.Bitbrick.dcMinValue);Entry.hw.sendQueue[b.getStringField("PORT")]=a+128;return b.callReturn()}; Blockly.Blocks.bitbrick_dc_direction_speed={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("DC \ubaa8\ud130").appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.dcList),"PORT").appendField(" ").appendField(new Blockly.FieldDropdown([[Lang.Blocks.BITBRICK_dc_direction_cw,"CW"],[Lang.Blocks.BITBRICK_dc_direction_ccw,"CCW"]]),"DIRECTION").appendField(" \ubc29\ud5a5").appendField(" \uc18d\ub825");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setPreviousStatement(!0);this.setNextStatement(!0);this.setInputsInline(!0)}};Entry.block.bitbrick_dc_direction_speed=function(b,a){var c="CW"===a.getStringField("DIRECTION"),d=a.getNumberValue("VALUE"),d=Math.min(d,Entry.Bitbrick.dcMaxValue),d=Math.max(d,0);Entry.hw.sendQueue[a.getStringField("PORT")]=c?d+128:128-d;return a.callReturn()}; +"block_icon/hardware_03.png","*"));this.setPreviousStatement(!0);this.setNextStatement(!0);this.setInputsInline(!0)}};Entry.block.bitbrick_dc_direction_speed=function(a,b){a="CW"===b.getStringField("DIRECTION");var c=b.getNumberValue("VALUE"),c=Math.min(c,Entry.Bitbrick.dcMaxValue),c=Math.max(c,0);Entry.hw.sendQueue[b.getStringField("PORT")]=a?c+128:128-c;return b.callReturn()}; Blockly.Blocks.bitbrick_servomotor_angle={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc11c\ubcf4 \ubaa8\ud130").appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.servoList),"PORT").appendField(" \uac01\ub3c4");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setPreviousStatement(!0);this.setNextStatement(!0); -this.setInputsInline(!0)}};Entry.block.bitbrick_servomotor_angle=function(b,a){var c=a.getNumberValue("VALUE")+1,c=Math.min(c,Entry.Bitbrick.servoMaxValue),c=Math.max(c,Entry.Bitbrick.servoMinValue);Entry.hw.sendQueue[a.getStringField("PORT")]=c;return a.callReturn()}; +this.setInputsInline(!0)}};Entry.block.bitbrick_servomotor_angle=function(a,b){a=b.getNumberValue("VALUE")+1;a=Math.min(a,Entry.Bitbrick.servoMaxValue);a=Math.max(a,Entry.Bitbrick.servoMinValue);Entry.hw.sendQueue[b.getStringField("PORT")]=a;return b.callReturn()}; Blockly.Blocks.bitbrick_convert_scale={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ubcc0\ud658");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.sensorList),"PORT");this.appendDummyInput().appendField("\uac12");this.appendValueInput("VALUE2").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_3);this.appendValueInput("VALUE3").setCheck(["Number","String",null]); this.appendDummyInput().appendField("\uc5d0\uc11c");this.appendValueInput("VALUE4").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_5);this.appendValueInput("VALUE5").setCheck(["Number","String",null]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.bitbrick_convert_scale=function(b,a){var c=a.getNumberField("PORT"),d=Entry.hw.portData[c].value,c=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a),f=a.getNumberValue("VALUE4",a),g=a.getNumberValue("VALUE5",a);if(f>g)var h=f,f=g,g=h;d-=c;d*=(g-f)/(e-c);d+=f;d=Math.min(g,d);d=Math.max(f,d);return Math.round(d)};var categoryColor="#FF9E20";Blockly.Blocks.start_drawing={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_start_drawing).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.start_drawing=function(b,a){b.brush?b.brush.stop=!1:Entry.setBasicBrush(b);Entry.stage.sortZorder();b.brush.moveTo(b.getX(),-1*b.getY());return a.callReturn()}; -Blockly.Blocks.stop_drawing={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_stop_drawing).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.stop_drawing=function(b,a){b.brush&&b.shape&&(b.brush.stop=!0);return a.callReturn()}; +Entry.block.bitbrick_convert_scale=function(a,b){a=b.getNumberField("PORT");var c=Entry.hw.portData[a].value,d=b.getNumberValue("VALUE2",b),e=b.getNumberValue("VALUE3",b);a=b.getNumberValue("VALUE4",b);b=b.getNumberValue("VALUE5",b);if(a>b){var f=a;a=b;b=f}c=(b-a)/(e-d)*(c-d);c+=a;c=Math.min(b,c);c=Math.max(a,c);return Math.round(c)};var categoryColor="#FF9E20";Blockly.Blocks.start_drawing={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_start_drawing).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.start_drawing=function(a,b){a.brush?a.brush.stop=!1:Entry.setBasicBrush(a);Entry.stage.sortZorder();a.brush.moveTo(a.getX(),-1*a.getY());return b.callReturn()}; +Blockly.Blocks.stop_drawing={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_stop_drawing).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.stop_drawing=function(a,b){a.brush&&a.shape&&(a.brush.stop=!0);return b.callReturn()}; Blockly.Blocks.set_color={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_color_1);this.appendDummyInput().appendField(new Blockly.FieldColour("#ff0000"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_color_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_color=function(b,a){var c=a.getField("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(c=Entry.hex2rgb(c),b.brush.rgb=c,b.brush.endStroke(),b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; +Entry.block.set_color=function(a,b){var c=b.getField("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(c=Entry.hex2rgb(c),a.brush.rgb=c,a.brush.endStroke(),a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}; Blockly.Blocks.set_random_color={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_random_color).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_random_color=function(b,a){b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);if(b.brush){var c=Entry.generateRgb();b.brush.rgb=c;b.brush.endStroke();b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")");b.brush.moveTo(b.getX(),-1*b.getY())}return a.callReturn()}; +Entry.block.set_random_color=function(a,b){a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);if(a.brush){var c=Entry.generateRgb();a.brush.rgb=c;a.brush.endStroke();a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")");a.brush.moveTo(a.getX(),-1*a.getY())}return b.callReturn()}; Blockly.Blocks.change_thickness={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_change_thickness_1);this.appendValueInput("VALUE").setCheck(["Number","Boolean"]);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_change_thickness_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_thickness=function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.thickness+=c,1>b.brush.thickness&&(b.brush.thickness=1),b.brush.setStrokeStyle(b.brush.thickness),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; +Entry.block.change_thickness=function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(a.brush.thickness+=c,1>a.brush.thickness&&(a.brush.thickness=1),a.brush.setStrokeStyle(a.brush.thickness),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}; Blockly.Blocks.set_thickness={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_thickness_1);this.appendValueInput("VALUE").setCheck(["Number","Boolean"]);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_thickness_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_thickness=function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.thickness=c,b.brush.setStrokeStyle(b.brush.thickness),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; +Entry.block.set_thickness=function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(a.brush.thickness=c,a.brush.setStrokeStyle(a.brush.thickness),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}; Blockly.Blocks.change_opacity={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_change_opacity_1);this.appendValueInput("VALUE").setCheck(["Number","Boolean"]);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_change_opacity_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_opacity=function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);c=Entry.adjustValueWithMaxMin(b.brush.opacity+c,0,100);b.brush&&(b.brush.opacity=c,b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; +Entry.block.change_opacity=function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);c=Entry.adjustValueWithMaxMin(a.brush.opacity+c,0,100);a.brush&&(a.brush.opacity=c,a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}; Blockly.Blocks.set_opacity={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_opacity_1);this.appendValueInput("VALUE").setCheck(["Number","Boolean"]);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_opacity_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_opacity=function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; +Entry.block.set_opacity=function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(a.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}; Blockly.Blocks.brush_erase_all={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_brush_erase_all).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.brush_erase_all=function(b,a){var c=b.brush;if(c){var d=c._stroke.style,e=c._strokeStyle.width;c.clear().setStrokeStyle(e).beginStroke(d);c.moveTo(b.getX(),-1*b.getY())}c=b.parent.getStampEntities();c.map(function(a){a.removeClone()});c=null;return a.callReturn()}; -Blockly.Blocks.brush_stamp={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_stamp).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.brush_stamp=function(b,a){b.parent.addStampEntity(b);return a.callReturn()}; +Entry.block.brush_erase_all=function(a,b){var c=a.brush;if(c){var d=c._stroke.style,e=c._strokeStyle.width;c.clear().setStrokeStyle(e).beginStroke(d);c.moveTo(a.getX(),-1*a.getY())}a=a.parent.getStampEntities();a.map(function(b){b.removeClone()});a=null;return b.callReturn()}; +Blockly.Blocks.brush_stamp={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_stamp).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.brush_stamp=function(a,b){a.parent.addStampEntity(a);return b.callReturn()}; Blockly.Blocks.change_brush_transparency={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_change_brush_transparency_1);this.appendValueInput("VALUE").setCheck(["Number","Boolean"]);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_change_brush_transparency_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_brush_transparency=function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);c=Entry.adjustValueWithMaxMin(b.brush.opacity-c,0,100);b.brush&&(b.brush.opacity=c,b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; +Entry.block.change_brush_transparency=function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);c=Entry.adjustValueWithMaxMin(a.brush.opacity-c,0,100);a.brush&&(a.brush.opacity=c,a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}; Blockly.Blocks.set_brush_tranparency={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_brush_transparency_1);this.appendValueInput("VALUE").setCheck(["Number","Boolean"]);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_brush_transparency_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_brush_tranparency=function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+(1-b.brush.opacity/100)+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()};var calcArrowColor="#e8b349",calcBlockColor="#FFD974",calcFontColor="#3D3D3D";Blockly.Blocks.number={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(new Blockly.FieldTextInput(""),"NUM");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.number=function(b,a){return a.getField("NUM",a)}; -Blockly.Blocks.angle={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(new Blockly.FieldAngle("90"),"ANGLE");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.angle=function(b,a){return a.getNumberField("ANGLE")};Blockly.Blocks.get_x_coordinate={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_x_coordinate,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.get_x_coordinate=function(b,a){return b.getX()};Blockly.Blocks.get_y_coordinate={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_y_coordinate,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.get_y_coordinate=function(b,a){return b.getY()}; -Blockly.Blocks.get_angle={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_angle,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.get_angle=function(b,a){return parseFloat(b.getRotation().toFixed(1))}; +Entry.block.set_brush_tranparency=function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(a.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+(1-a.brush.opacity/100)+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()};var calcArrowColor="#e8b349",calcBlockColor="#FFD974",calcFontColor="#3D3D3D";Blockly.Blocks.number={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(new Blockly.FieldTextInput(""),"NUM");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.number=function(a,b){return b.getField("NUM",b)}; +Blockly.Blocks.angle={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(new Blockly.FieldAngle("90"),"ANGLE");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.angle=function(a,b){return b.getNumberField("ANGLE")};Blockly.Blocks.get_x_coordinate={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_x_coordinate,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; +Entry.block.get_x_coordinate=function(a,b){return a.getX()};Blockly.Blocks.get_y_coordinate={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_y_coordinate,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.get_y_coordinate=function(a,b){return a.getY()}; +Blockly.Blocks.get_angle={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_angle,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.get_angle=function(a,b){return parseFloat(a.getRotation().toFixed(1))}; Blockly.Blocks.get_rotation_direction={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.CALC_rotation_value,"ROTATION"],[Lang.Blocks.CALC_direction_value,"DIRECTION"]],null,!0,calcArrowColor),"OPERATOR");this.appendDummyInput().appendField(" ");this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -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))}; +Entry.block.get_rotation_direction=function(a,b){return"DIRECTION"==b.getField("OPERATOR",b).toUpperCase()?parseFloat(a.getDirection().toFixed(1)):parseFloat(a.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)}; +Entry.block.distance_something=function(a,b){b=b.getField("VALUE",b);if("mouse"==b)return b=Entry.stage.mouseCoordinate,Math.sqrt(Math.pow(a.getX()-b.x,2)+Math.pow(a.getY()-b.y,2));b=Entry.container.getEntity(b);return Math.sqrt(Math.pow(a.getX()-b.getX(),2)+Math.pow(a.getY()-b.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(a,b){return"x"===b.getField("VALUE",b)?Number(Entry.stage.mouseCoordinate.x):Number(Entry.stage.mouseCoordinate.y)}; Blockly.Blocks.coordinate_object={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_coordinate_object_1,calcFontColor).appendField(new Blockly.FieldDropdownDynamic("spritesWithSelf",null,!0,calcArrowColor),"VALUE").appendField(Lang.Blocks.CALC_coordinate_object_2,calcFontColor).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CALC_coordinate_x_value,"x"],[Lang.Blocks.CALC_coordinate_y_value,"y"],[Lang.Blocks.CALC_coordinate_rotation_value,"rotation"], [Lang.Blocks.CALC_coordinate_direction_value,"direction"],[Lang.Blocks.CALC_coordinate_size_value,"size"],[Lang.Blocks.CALC_picture_index,"picture_index"],[Lang.Blocks.CALC_picture_name,"picture_name"]],null,!0,calcArrowColor),"COORDINATE").appendField(Lang.Blocks.CALC_coordinate_object_3,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.coordinate_object=function(b,a){var c=a.getField("VALUE",a),c="self"==c?b:Entry.container.getEntity(c);switch(a.getField("COORDINATE",a)){case "x":return c.getX();case "y":return c.getY();case "rotation":return c.getRotation();case "direction":return c.getDirection();case "picture_index":var d=c.parent,d=d.pictures;return d.indexOf(c.picture)+1;case "size":return 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(a,b){var c=b.getField("VALUE",b);a="self"==c?a:Entry.container.getEntity(c);switch(b.getField("COORDINATE",b)){case "x":return a.getX();case "y":return a.getY();case "rotation":return a.getRotation();case "direction":return a.getDirection();case "picture_index":return b=a.parent,b=b.pictures,b.indexOf(a.picture)+1;case "size":return Number(a.getSize().toFixed(1));case "picture_name":return b=a.parent,b=b.pictures,b[b.indexOf(a.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)}}; -Entry.block.calc_minus=function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c-d};Blockly.Blocks.calc_times={init:function(){this.setColour(calcBlockColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("x",calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.calc_times=function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c*d};Blockly.Blocks.calc_divide={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_divide=function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c/d}; +Entry.block.calc_basic=function(a,b){a=b.getField("OPERATOR",b);var c=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return"PLUS"==a?c+b:"MINUS"==a?c-b:"MULTI"==a?c*b:c/b};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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a+b};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)}}; +Entry.block.calc_minus=function(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a-b};Blockly.Blocks.calc_times={init:function(){this.setColour(calcBlockColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("x",calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; +Entry.block.calc_times=function(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a*b};Blockly.Blocks.calc_divide={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_divide=function(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a/b}; Blockly.Blocks.calc_mod={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_calc_mod_1,calcFontColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_mod_2,calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_mod_3,calcFontColor);this.setInputsInline(!0)}}; -Entry.block.calc_mod=function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c%d}; +Entry.block.calc_mod=function(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a%b}; Blockly.Blocks.calc_share={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_calc_share_1,calcFontColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.CALC_calc_share_2,calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_share_3,calcFontColor);this.setInputsInline(!0)}}; -Entry.block.calc_share=function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return Math.floor(c/d)}; +Entry.block.calc_share=function(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return Math.floor(a/b)}; Blockly.Blocks.calc_operation={init:function(){this.setColour(calcBlockColor);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_operation_of_1,calcFontColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_operation_of_2,calcFontColor);this.appendDummyInput("VALUE").appendField(new Blockly.FieldDropdown([[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"]],null,!0,calcArrowColor),"VALUE");this.setOutput(!0,"Number");this.appendDummyInput().appendField(" ");this.setInputsInline(!0)}}; -Entry.block.calc_operation=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}; +Entry.block.calc_operation=function(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getField("VALUE",b);if(-1<["asin_radian","acos_radian"].indexOf(b)&&(1a))throw Error("x range exceeded");b.indexOf("_")&&(b=b.split("_")[0]);-1<["sin","cos","tan"].indexOf(b)&&(a=Entry.toRadian(a));switch(b){case "square":b=a*a;break;case "factorial":b=Entry.factorial(a);break;case "root":b=Math.sqrt(a);break;case "log":b=Math.log(a)/Math.LN10;break;case "ln":b=Math.log(a);break;case "asin":case "acos":case "atan":b= +Entry.toDegrees(Math[b](a));break;case "unnatural":b=a-Math.floor(a);0>a&&(b=1-b);break;default:b=Math[b](a)}return Math.round(1E3*b)/1E3}; Blockly.Blocks.calc_rand={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_calc_rand_1,calcFontColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_rand_2,calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_rand_3,calcFontColor);this.setInputsInline(!0)}}; -Entry.block.calc_rand=function(b,a){var c=a.getStringValue("LEFTHAND",a),d=a.getStringValue("RIGHTHAND",a),e=Math.min(c,d),f=Math.max(c,d),c=Entry.isFloat(c);return Entry.isFloat(d)||c?(Math.random()*(f-e)+e).toFixed(2):Math.floor(Math.random()*(f-e+1)+e)}; +Entry.block.calc_rand=function(a,b){a=b.getStringValue("LEFTHAND",b);b=b.getStringValue("RIGHTHAND",b);var c=Math.min(a,b),d=Math.max(a,b);a=Entry.isFloat(a);return Entry.isFloat(b)||a?(Math.random()*(d-c)+c).toFixed(2):Math.floor(Math.random()*(d-c+1)+c)}; Blockly.Blocks.get_date={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_date_1,calcFontColor).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CALC_get_date_year,"YEAR"],[Lang.Blocks.CALC_get_date_month,"MONTH"],[Lang.Blocks.CALC_get_date_day,"DAY"],[Lang.Blocks.CALC_get_date_hour,"HOUR"],[Lang.Blocks.CALC_get_date_minute,"MINUTE"],[Lang.Blocks.CALC_get_date_second,"SECOND"]],null,!0,calcArrowColor),"VALUE");this.appendDummyInput().appendField(" ").appendField(Lang.Blocks.CALC_get_date_2, -calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.get_date=function(b,a){var c=a.getField("VALUE",a),d=new Date;return"YEAR"==c?d.getFullYear():"MONTH"==c?d.getMonth()+1:"DAY"==c?d.getDate():"HOUR"==c?d.getHours():"MINUTE"==c?d.getMinutes():d.getSeconds()}; +calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.get_date=function(a,b){a=b.getField("VALUE",b);b=new Date;return"YEAR"==a?b.getFullYear():"MONTH"==a?b.getMonth()+1:"DAY"==a?b.getDate():"HOUR"==a?b.getHours():"MINUTE"==a?b.getMinutes():b.getSeconds()}; Blockly.Blocks.get_sound_duration={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_sound_duration_1,calcFontColor);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("sounds",null,!0,calcArrowColor),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.CALC_get_sound_duration_2,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.get_sound_duration=function(b,a){for(var c=a.getField("VALUE",a),d=b.parent.sounds,e=0;ed||d>c.length-1)throw Error();return c[d]}; -Blockly.Blocks.length_of_string={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_length_of_string_1,calcFontColor);this.appendValueInput("STRING").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_length_of_string_2,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.length_of_string=function(b,a){return a.getStringValue("STRING",a).length}; +Entry.block.char_at=function(a,b){a=b.getStringValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b)-1;if(0>b||b>a.length-1)throw Error();return a[b]}; +Blockly.Blocks.length_of_string={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_length_of_string_1,calcFontColor);this.appendValueInput("STRING").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_length_of_string_2,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.length_of_string=function(a,b){return b.getStringValue("STRING",b).length}; Blockly.Blocks.substring={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_substring_1,calcFontColor);this.appendValueInput("STRING").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_substring_2,calcFontColor);this.appendValueInput("START").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_substring_3,calcFontColor);this.appendValueInput("END").setCheck(["Number","String"]); -this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_substring_4,calcFontColor);this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.substring=function(b,a){var c=a.getStringValue("STRING",a),d=a.getNumberValue("START",a)-1,e=a.getNumberValue("END",a)-1,f=c.length-1;if(0>d||0>e||d>f||e>f)throw Error();return c.substring(Math.min(d,e),Math.max(d,e)+1)}; +this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_substring_4,calcFontColor);this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.substring=function(a,b){a=b.getStringValue("STRING",b);var c=b.getNumberValue("START",b)-1;b=b.getNumberValue("END",b)-1;var d=a.length-1;if(0>c||0>b||c>d||b>d)throw Error();return a.substring(Math.min(c,b),Math.max(c,b)+1)}; Blockly.Blocks.replace_string={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_replace_string_1,calcFontColor);this.appendValueInput("STRING").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_replace_string_2,calcFontColor);this.appendValueInput("OLD_WORD").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_replace_string_3,calcFontColor);this.appendValueInput("NEW_WORD").setCheck(["Number", -"String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_replace_string_4,calcFontColor);this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.replace_string=function(b,a){return a.getStringValue("STRING",a).replace(new RegExp(a.getStringValue("OLD_WORD",a),"gm"),a.getStringValue("NEW_WORD",a))}; +"String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_replace_string_4,calcFontColor);this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.replace_string=function(a,b){return b.getStringValue("STRING",b).replace(new RegExp(b.getStringValue("OLD_WORD",b),"gm"),b.getStringValue("NEW_WORD",b))}; Blockly.Blocks.change_string_case={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_change_string_case_1,calcFontColor);this.appendValueInput("STRING").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.CALC_change_string_case_2,calcFontColor);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.CALC_change_string_case_sub_1,"toUpperCase"],[Lang.Blocks.CALC_change_string_case_sub_2,"toLowerCase"]], -null,!0,calcArrowColor),"CASE");this.appendDummyInput().appendField(Lang.Blocks.CALC_change_string_case_3,calcFontColor);this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.change_string_case=function(b,a){return a.getStringValue("STRING",a)[a.getField("CASE",a)]()}; +null,!0,calcArrowColor),"CASE");this.appendDummyInput().appendField(Lang.Blocks.CALC_change_string_case_3,calcFontColor);this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.change_string_case=function(a,b){return b.getStringValue("STRING",b)[b.getField("CASE",b)]()}; Blockly.Blocks.index_of_string={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_index_of_string_1,calcFontColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_index_of_string_2,calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_index_of_string_3,calcFontColor); -this.setInputsInline(!0)}};Entry.block.index_of_string=function(b,a){var c=a.getStringValue("LEFTHAND",a),d=a.getStringValue("RIGHTHAND",a),c=c.indexOf(d);return-1a;a++)Entry.hw.sendQueue[a]=0;Entry.hw.update()}};Blockly.Blocks.cobl_read_ultrason={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ucd08\uc74c\ud30c \uac70\ub9ac\uc7ac\uae30(0~400)");this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.cobl_read_ultrason=function(a,b){return Entry.hw.getAnalogPortValue("ultrason")}; +Blockly.Blocks.cobl_read_potenmeter={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uac00\ubcc0\uc800\ud56d \uc77d\uae30(0~1023)");this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.cobl_read_potenmeter=function(a,b){console.log("cobl_read_potenmeter");return Entry.hw.getAnalogPortValue("potenmeter")}; +Blockly.Blocks.cobl_read_irread1={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("IR1 \uc77d\uae30(0~1023)");this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.cobl_read_irread1=function(a,b){return Entry.hw.getAnalogPortValue("potenmeter")};Blockly.Blocks.cobl_read_irread2={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("IR2 \uc77d\uae30(0~1023)");this.setInputsInline(!0);this.setOutput(!0,"Number")}}; +Entry.block.cobl_read_irread2=function(a,b){b.getValue("irread2",b);return Entry.hw.getAnalogPortValue("irread2")};Blockly.Blocks.cobl_read_joyx={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc870\uc774\uc2a4\ud2f1X\ucd95 \uc77d\uae30(1,0,-1)");this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.cobl_read_joyx=function(a,b){return Entry.hw.getAnalogPortValue("joyx")}; +Blockly.Blocks.cobl_read_joyy={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc870\uc774\uc2a4\ud2f1Y\ucd95 \uc77d\uae30(1,0,-1)");this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.cobl_read_joyy=function(a,b){return Entry.hw.getAnalogPortValue("joyy")};Blockly.Blocks.cobl_read_sens1={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc13c\uc11c1 \uc77d\uae30(0~1023)");this.setInputsInline(!0);this.setOutput(!0,"Number")}}; +Entry.block.cobl_read_sens1=function(a,b){return Entry.hw.getAnalogPortValue("sens1")};Blockly.Blocks.cobl_read_sens2={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc13c\uc11c2 \uc77d\uae30(0~1023)");this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.cobl_read_sens2=function(a,b){return Entry.hw.getAnalogPortValue("sens2")}; +Blockly.Blocks.cobl_read_tilt={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uae30\uc6b8\uae30\uc13c\uc11c \uc77d\uae30(0~4)");this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.cobl_read_tilt=function(a,b){return Entry.hw.getAnalogPortValue("tilt")}; +Blockly.Blocks.cobl_get_port_number={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1","1"],["2","2"]]),"PORT");this.appendDummyInput().appendField(" ");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.cobl_get_port_number=function(a,b){return b.getStringField("PORT")}; +Blockly.Blocks.cobl_read_temps={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc628\ub3c4\uc13c\uc11c \uc77d\uae30@\ud3ec\ud2b8");this.appendValueInput("VALUE").setCheck("Number");this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.cobl_read_temps=function(a,b){a=b.getValue("VALUE",b);if(1==a)return Entry.hw.getAnalogPortValue("temps1");if(2==a)return Entry.hw.getAnalogPortValue("temps2")}; +Blockly.Blocks.cobl_read_light={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ubc1d\uae30\uc13c\uc11c \uc77d\uae30@\ud3ec\ud2b8");this.appendValueInput("VALUE").setCheck("Number");this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.cobl_read_light=function(a,b){a=b.getValue("VALUE",b);if(1==a)return Entry.hw.getAnalogPortValue("light1");if(2==a)return Entry.hw.getAnalogPortValue("light2")}; +Blockly.Blocks.cobl_read_btn={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ubc84\ud2bc\uc13c\uc11c \uc77d\uae30@\ud3ec\ud2b8");this.appendValueInput("VALUE").setCheck("Number");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}};Entry.block.cobl_read_btn=function(a,b){a=b.getValue("VALUE",b);if(1==a)return Entry.hw.getDigitalPortValue("btn1");if(2==a)return Entry.hw.getDigitalPortValue("btn2")}; +Blockly.Blocks.cobl_led_control={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("Rainbow LED");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1","1"],["2","2"],["3","3"]]),"PORT");this.appendDummyInput().appendField(" ");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["OFF","OFF"],["Red","Red"],["Orange","Orange"],["Yellow","Yellow"],["Green","Green"],["Blue","Blue"],["Dark Blue","Dark Blue"],["Purple","Purple"],["White","White"]]), +"OPERATOR");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.cobl_led_control=function(a,b){a=b.getStringField("PORT");var c=b.getStringField("OPERATOR");Entry.hw.setDigitalPortValue("RainBowLED_IDX",a);Entry.hw.setDigitalPortValue("RainBowLED_COL",c);return b.callReturn()};Blockly.Blocks.cobl_text={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldTextInput("cobl"),"NAME");this.setOutput(!0,"String");this.setInputsInline(!0)}}; +Entry.block.cobl_text=function(a,b){return b.getStringField("NAME")};Blockly.Blocks.cobl_servo_angle_control={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("Servo");this.appendValueInput("PORT").setCheck(["Number","String"]);this.appendDummyInput().appendField("Angle-");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("(15~165)");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; +Entry.block.cobl_servo_angle_control=function(a,b){console.log("servo - test");a=b.getNumberValue("PORT");var c=b.getNumberValue("VALUE"),c=Math.round(c),c=Math.max(c,15),c=Math.min(c,165);1==a&&(console.log("servo 1 degree "+c),Entry.hw.setDigitalPortValue("Servo1",c));2==a&&(console.log("servo 2 degree "+c),Entry.hw.setDigitalPortValue("Servo2",c));return b.callReturn()}; +Blockly.Blocks.cobl_melody={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("Melody");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["(Low)So","L_So"],["(Low)So#","L_So#"],["(Low)La","L_La"],["(Low)La#","L_La#"],["(Low)Ti","L_Ti"],["Do","Do"],["Do#","Do#"],["Re","Re"],["Re#","Re#"],["Mi","Mi"],["Fa","Fa"],["Fa#","Fa#"],["So","So"],["So#","So#"],["La","La"],["La#","La#"],["Ti","Ti"],["(High)Do","H_Do"],["(High)Do#","H_Do#"],["(High)Re","H_Re"],["(High)R2#", +"H_Re#"],["(High)Mi","H_Mi"],["(High)Fa","H_Fa"]]),"MELODY");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.cobl_melody=function(a,b){a=b.getStringField("MELODY");console.log("cobl_melody"+a);Entry.hw.setDigitalPortValue("Melody",a);return b.callReturn()}; +Blockly.Blocks.cobl_dcmotor={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("DcMotor");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1","1"],["2","2"]]),"MOTOR");this.appendDummyInput().appendField(" ");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1.Clockwise","1"],["2.Counter Clockwise","2"],["3.Stop","3"]]),"DIRECTION");this.appendDummyInput().appendField(" Speed");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1", +"1"],["2","2"],["3","3"],["4","4"],["5","5"]]),"SPEED");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; +Entry.block.cobl_dcmotor=function(a,b){a=b.getStringField("MOTOR");var c=b.getStringField("DIRECTION"),d=b.getStringField("SPEED");console.log("MOTOR"+a+" Direction"+c+" speed"+d);1==a&&(Entry.hw.setDigitalPortValue("DC1_DIR",c),Entry.hw.setDigitalPortValue("DC1_SPEED",d));2==a&&(Entry.hw.setDigitalPortValue("DC2_DIR",c),Entry.hw.setDigitalPortValue("DC2_SPEED",d));return b.callReturn()}; +Blockly.Blocks.cobl_extention_port={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("Extention Port");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1","1"],["2","2"]]),"PORT");this.appendDummyInput().appendField(" Level");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1","1"],["2","2"],["3","3"],["4","4"],["5","5"]]),"LEVEL");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; +Entry.block.cobl_extention_port=function(a,b){a=b.getStringField("PORT");var c=b.getStringField("LEVEL");1==a&&Entry.hw.setDigitalPortValue("EXUSB1",c);2==a&&Entry.hw.setDigitalPortValue("EXUSB2",c);return b.callReturn()}; +Blockly.Blocks.cobl_external_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("External LED ");this.appendValueInput("LED").setCheck(["Number","String"]);this.appendDummyInput().appendField(" (1~64)");this.appendDummyInput().appendField(" R ");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"]]),"RED");this.appendDummyInput().appendField(" G ");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1", +"1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"]]),"GREEN");this.appendDummyInput().appendField(" B ");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"]]),"BLUE");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; +Entry.block.cobl_external_led=function(a,b){a=b.getNumberValue("LED");var c=b.getStringField("RED"),d=b.getStringField("GREEN"),e=b.getStringField("BLUE");Entry.hw.setDigitalPortValue("ELED_IDX",a);Entry.hw.setDigitalPortValue("ELED_R",c);Entry.hw.setDigitalPortValue("ELED_G",d);Entry.hw.setDigitalPortValue("ELED_B",e);return b.callReturn()}; +Blockly.Blocks.cobl_7_segment={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("7 Segment");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("(0~9999)");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.cobl_7_segment=function(a,b){a=b.getNumberValue("VALUE");Entry.hw.setDigitalPortValue("7SEG",a);return b.callReturn()};Blockly.Blocks.wait_second={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_wait_second_1);this.appendValueInput("SECOND").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.FLOW_wait_second_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; +Entry.block.wait_second=function(a,b){if(b.isStart){if(1==b.timeFlag)return b;delete b.timeFlag;delete b.isStart;Entry.engine.isContinue=!1;return b.callReturn()}b.isStart=!0;b.timeFlag=1;a=b.getNumberValue("SECOND",b);setTimeout(function(){b.timeFlag=0},60/(Entry.FPS||60)*a*1E3);return b}; Blockly.Blocks.repeat_basic={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_basic_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_basic_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.appendStatementInput("DO");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.repeat_basic=function(b,a){var c;if(!a.isLooped){a.isLooped=!0;c=a.getNumberValue("VALUE",a);if(0>c)throw Error(Lang.Blocks.FLOW_repeat_basic_errorMsg);a.iterCount=Math.floor(c)}if(0==a.iterCount||0>a.iterCount)return delete a.isLooped,delete a.iterCount,a.callReturn();a.iterCount--;return a.getStatement("DO",a)}; -Blockly.Blocks.repeat_inf={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_inf).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.appendStatementInput("DO");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.repeat_inf=function(b,a){a.isLooped=!0;return a.getStatement("DO")}; -Blockly.Blocks.stop_repeat={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_stop_repeat).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.stop_repeat=function(b,a){return this.executor.break()}; +Entry.block.repeat_basic=function(a,b){if(!b.isLooped){b.isLooped=!0;a=b.getNumberValue("VALUE",b);if(0>a)throw Error(Lang.Blocks.FLOW_repeat_basic_errorMsg);b.iterCount=Math.floor(a)}if(0==b.iterCount||0>b.iterCount)return delete b.isLooped,delete b.iterCount,b.callReturn();b.iterCount--;return b.getStatement("DO",b)}; +Blockly.Blocks.repeat_inf={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_inf).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.appendStatementInput("DO");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.repeat_inf=function(a,b){b.isLooped=!0;return b.getStatement("DO")}; +Blockly.Blocks.stop_repeat={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_stop_repeat).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.stop_repeat=function(a,b){return this.executor.break()}; Blockly.Blocks.wait_until_true={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_wait_until_true_1);this.appendValueInput("BOOL").setCheck("Boolean");this.appendDummyInput().appendField(Lang.Blocks.FLOW_wait_until_true_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.wait_until_true=function(b,a){return a.getBooleanValue("BOOL",a)?a.callReturn():a}; +Entry.block.wait_until_true=function(a,b){return b.getBooleanValue("BOOL",b)?b.callReturn():b}; Blockly.Blocks._if={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW__if_1);this.appendValueInput("BOOL").setCheck("Boolean");this.appendDummyInput().appendField(Lang.Blocks.FLOW__if_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.appendStatementInput("STACK");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block._if=function(b,a){return a.isLooped?(delete a.isLooped,a.callReturn()):a.getBooleanValue("BOOL",a)?(a.isLooped=!0,a.getStatement("STACK",a)):a.callReturn()}; +Entry.block._if=function(a,b){return b.isLooped?(delete b.isLooped,b.callReturn()):b.getBooleanValue("BOOL",b)?(b.isLooped=!0,b.getStatement("STACK",b)):b.callReturn()}; Blockly.Blocks.if_else={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_if_else_1);this.appendValueInput("BOOL").setCheck("Boolean");this.appendDummyInput().appendField(Lang.Blocks.FLOW_if_else_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.appendStatementInput("STACK_IF");this.appendDummyInput().appendField(Lang.Blocks.FLOW_if_else_3);this.appendStatementInput("STACK_ELSE");this.setInputsInline(!0);this.setPreviousStatement(!0); -this.setNextStatement(!0)}};Entry.block.if_else=function(b,a){if(a.isLooped)return delete a.isLooped,a.callReturn();var c=a.getBooleanValue("BOOL",a);a.isLooped=!0;return c?a.getStatement("STACK_IF",a):a.getStatement("STACK_ELSE",a)}; +this.setNextStatement(!0)}};Entry.block.if_else=function(a,b){if(b.isLooped)return delete b.isLooped,b.callReturn();a=b.getBooleanValue("BOOL",b);b.isLooped=!0;return a?b.getStatement("STACK_IF",b):b.getStatement("STACK_ELSE",b)}; Blockly.Blocks.create_clone={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_create_clone_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("clone"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.FLOW_create_clone_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.create_clone=function(b,a){var c=a.getField("VALUE",a),d=a.callReturn();"self"==c?b.parent.addCloneEntity(b.parent,b,null):Entry.container.getObject(c).addCloneEntity(b.parent,null,null);return d};Blockly.Blocks.delete_clone={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_delete_clone).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0)}}; -Entry.block.delete_clone=function(b,a){if(!b.isClone)return a.callReturn();b.removeClone()};Blockly.Blocks.when_clone_start={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_clone.png","*","start")).appendField(Lang.Blocks.FLOW_when_clone_start);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_clone_start=function(b,a){return a.callReturn()}; -Blockly.Blocks.stop_run={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_stop_run).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.stop_run=function(b,a){return Entry.engine.toggleStop()}; +Entry.block.create_clone=function(a,b){var c=b.getField("VALUE",b);b=b.callReturn();"self"==c?a.parent.addCloneEntity(a.parent,a,null):Entry.container.getObject(c).addCloneEntity(a.parent,null,null);return b};Blockly.Blocks.delete_clone={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_delete_clone).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0)}}; +Entry.block.delete_clone=function(a,b){if(!a.isClone)return b.callReturn();a.removeClone()};Blockly.Blocks.when_clone_start={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_clone.png","*","start")).appendField(Lang.Blocks.FLOW_when_clone_start);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_clone_start=function(a,b){return b.callReturn()}; +Blockly.Blocks.stop_run={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_stop_run).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.stop_run=function(a,b){return Entry.engine.toggleStop()}; Blockly.Blocks.repeat_while_true={init:function(){this.setColour("#498deb");"ko"==Lang.type?(this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_while_true_1),this.appendValueInput("BOOL").setCheck("Boolean"),this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.FLOW_repeat_while_true_until,"until"],[Lang.Blocks.FLOW_repeat_while_true_while,"while"]]),"OPTION").appendField(Lang.Blocks.FLOW_repeat_while_true_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png", "*"))):(this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_while_true_1),this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.FLOW_repeat_while_true_until,"until"],[Lang.Blocks.FLOW_repeat_while_true_while,"while"]]),"OPTION"),this.appendValueInput("BOOL").setCheck("Boolean"),this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_while_true_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*")));this.appendStatementInput("DO"); -this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.repeat_while_true=function(b,a){var c=a.getBooleanValue("BOOL",a);"until"==a.getField("OPTION",a)&&(c=!c);return(a.isLooped=c)?a.getStatement("DO",a):a.callReturn()}; +this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.repeat_while_true=function(a,b){a=b.getBooleanValue("BOOL",b);"until"==b.getField("OPTION",b)&&(a=!a);return(b.isLooped=a)?b.getStatement("DO",b):b.callReturn()}; Blockly.Blocks.stop_object={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_stop_object_1);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.FLOW_stop_object_all,"all"],[Lang.Blocks.FLOW_stop_object_this_object,"thisOnly"],[Lang.Blocks.FLOW_stop_object_this_thread,"thisThread"],[Lang.Blocks.FLOW_stop_object_other_thread,"otherThread"]]),"TARGET");this.appendDummyInput().appendField(Lang.Blocks.FLOW_stop_object_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.stop_object=function(b,a){var c=a.getField("TARGET",a),d=Entry.container;switch(c){case "all":return d.clearRunningState(),this.die();case "thisOnly":return b.parent.script.clearExecutorsByEntity(b),this.die();case "thisThread":return this.die();case "otherThread":b.parent.script.clearExecutors(),b.parent.script.addExecutor(this.executor)}}; -Blockly.Blocks.restart_project={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_restart).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0)}};Entry.block.restart_project=function(b,a){Entry.engine.toggleStop();Entry.engine.toggleRun()}; -Blockly.Blocks.remove_all_clones={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_delete_clone_all).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.remove_all_clones=function(b,a){var c=b.parent.getClonedEntities();c.map(function(a){a.removeClone()});c=null;return a.callReturn()};Entry.block.functionAddButton={skeleton:"basic_button",color:"#eee",isNotFor:["functionInit"],template:"%1",params:[{type:"Text",text:"\ud568\uc218 \ucd94\uac00",color:"#333",align:"center"}],events:{mousedown:[function(){Entry.variableContainer.createFunction()}]}}; +"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.stop_object=function(a,b){b=b.getField("TARGET",b);var c=Entry.container;switch(b){case "all":return c.clearRunningState(),this.die();case "thisOnly":return a.parent.script.clearExecutorsByEntity(a),this.die();case "thisThread":return this.die();case "otherThread":a.parent.script.clearExecutors(),a.parent.script.addExecutor(this.executor)}}; +Blockly.Blocks.restart_project={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_restart).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0)}};Entry.block.restart_project=function(a,b){Entry.engine.toggleStop();Entry.engine.toggleRun()}; +Blockly.Blocks.remove_all_clones={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_delete_clone_all).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.remove_all_clones=function(a,b){a=a.parent.getClonedEntities();a.map(function(b){b.removeClone()});a=null;return b.callReturn()};Entry.block.functionAddButton={skeleton:"basic_button",color:"#eee",isNotFor:["functionInit"],template:"%1",params:[{type:"Text",text:"\ud568\uc218 \ucd94\uac00",color:"#333",align:"center"}],events:{mousedown:[function(){Entry.variableContainer.createFunction()}]}}; Blockly.Blocks.function_field_label={init:function(){this.setColour("#f9c535");this.appendDummyInput().appendField(new Blockly.FieldTextInput(Lang.Blocks.FUNCTION_explanation_1),"NAME");this.appendValueInput("NEXT").setCheck(["Param"]);this.setOutput(!0,"Param");this.setInputsInline(!0)}};Entry.block.function_field_label={skeleton:"basic_param",isNotFor:["functionEdit"],color:"#f9c535",template:"%1%2",params:[{type:"TextInput",value:"\ud568\uc218"},{type:"Output",accept:"paramMagnet"}]}; Blockly.Blocks.function_field_string={init:function(){this.setColour("#FFD974");this.appendValueInput("PARAM").setCheck(["String"]);this.appendValueInput("NEXT").setCheck(["Param"]);this.setOutput(!0,"Param");this.setInputsInline(!0)}};Entry.block.function_field_string={skeleton:"basic_param",isNotFor:["functionEdit"],color:"#ffd974",template:"%1%2",params:[{type:"Block",accept:"stringMagnet",restore:!0},{type:"Output",accept:"paramMagnet"}]}; Blockly.Blocks.function_field_boolean={init:function(){this.setColour("#AEB8FF");this.appendValueInput("PARAM").setCheck(["Boolean"]);this.appendValueInput("NEXT").setCheck(["Param"]);this.setOutput(!0,"Param");this.setInputsInline(!0)}};Entry.block.function_field_boolean={skeleton:"basic_param",isNotFor:["functionEdit"],color:"#aeb8ff",template:"%1%2",params:[{type:"Block",accept:"booleanMagnet",restore:!0},{type:"Output",accept:"paramMagnet"}]}; -Blockly.Blocks.function_param_string={init:function(){this.setEditable(!1);this.setColour("#FFD974");this.setOutput(!0,["String","Number"]);this.setInputsInline(!0)},domToMutation:function(b){b.getElementsByTagName("field");this.hashId=b.getAttribute("hashid");(b=Entry.Func.targetFunc.stringHash[this.hashId])||(b="");this.appendDummyInput().appendField(new Blockly.FieldTextInput(Lang.Blocks.FUNCTION_character_variable+b),"")},mutationToDom:function(){var b=document.createElement("mutation");b.setAttribute("hashid", -this.hashId);return b}};Entry.block.function_param_string=function(b,a,c){return a.register[a.hashId].run()};Entry.block.function_param_string={skeleton:"basic_string_field",color:"#ffd974",template:"\ubb38\uc790/\uc22b\uc790\uac12",func:function(){return this.executor.register.params[this.executor.register.paramMap[this.block.type]]}}; -Blockly.Blocks.function_param_boolean={init:function(){this.setEditable(!1);this.setColour("#AEB8FF");this.setOutput(!0,"Boolean");this.setInputsInline(!0)},domToMutation:function(b){b.getElementsByTagName("field");this.hashId=b.getAttribute("hashid");(b=Entry.Func.targetFunc.booleanHash[this.hashId])||(b="");this.appendDummyInput().appendField(new Blockly.FieldTextInput(Lang.Blocks.FUNCTION_logical_variable+b),"")},mutationToDom:function(){var b=document.createElement("mutation");b.setAttribute("hashid", -this.hashId);return b}};Entry.block.function_param_boolean=function(b,a,c){return a.register[a.hashId].run()};Entry.block.function_param_boolean={skeleton:"basic_boolean_field",color:"#aeb8ff",template:"\ud310\ub2e8\uac12",func:function(){return this.executor.register.params[this.executor.register.paramMap[this.block.type]]}}; -Blockly.Blocks.function_create={init:function(){this.appendDummyInput().appendField(Lang.Blocks.FUNCTION_define);this.setColour("#cc7337");this.appendValueInput("FIELD").setCheck(["Param"]);this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/function_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.function_create=function(b,a){return a.callReturn()}; +Blockly.Blocks.function_param_string={init:function(){this.setEditable(!1);this.setColour("#FFD974");this.setOutput(!0,["String","Number"]);this.setInputsInline(!0)},domToMutation:function(a){a.getElementsByTagName("field");this.hashId=a.getAttribute("hashid");(a=Entry.Func.targetFunc.stringHash[this.hashId])||(a="");this.appendDummyInput().appendField(new Blockly.FieldTextInput(Lang.Blocks.FUNCTION_character_variable+a),"")},mutationToDom:function(){var a=document.createElement("mutation");a.setAttribute("hashid", +this.hashId);return a}};Entry.block.function_param_string=function(a,b,c){return b.register[b.hashId].run()};Entry.block.function_param_string={skeleton:"basic_string_field",color:"#ffd974",template:"\ubb38\uc790/\uc22b\uc790\uac12",func:function(){return this.executor.register.params[this.executor.register.paramMap[this.block.type]]}}; +Blockly.Blocks.function_param_boolean={init:function(){this.setEditable(!1);this.setColour("#AEB8FF");this.setOutput(!0,"Boolean");this.setInputsInline(!0)},domToMutation:function(a){a.getElementsByTagName("field");this.hashId=a.getAttribute("hashid");(a=Entry.Func.targetFunc.booleanHash[this.hashId])||(a="");this.appendDummyInput().appendField(new Blockly.FieldTextInput(Lang.Blocks.FUNCTION_logical_variable+a),"")},mutationToDom:function(){var a=document.createElement("mutation");a.setAttribute("hashid", +this.hashId);return a}};Entry.block.function_param_boolean=function(a,b,c){return b.register[b.hashId].run()};Entry.block.function_param_boolean={skeleton:"basic_boolean_field",color:"#aeb8ff",template:"\ud310\ub2e8\uac12",func:function(){return this.executor.register.params[this.executor.register.paramMap[this.block.type]]}}; +Blockly.Blocks.function_create={init:function(){this.appendDummyInput().appendField(Lang.Blocks.FUNCTION_define);this.setColour("#cc7337");this.appendValueInput("FIELD").setCheck(["Param"]);this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/function_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.function_create=function(a,b){return b.callReturn()}; Entry.block.function_create={skeleton:"basic",color:"#cc7337",event:"funcDef",template:"\ud568\uc218 \uc815\uc758\ud558\uae30 %1 %2",params:[{type:"Block",accept:"paramMagnet",value:{type:"function_field_label"}},{type:"Indicator",img:"/lib/entryjs/images/block_icon/function_03.png",size:12}],func:function(){}}; -Blockly.Blocks.function_general={init:function(){this.setColour("#cc7337");this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)},domToMutation:function(b){var a=b.getElementsByTagName("field");this.appendDummyInput().appendField("");a.length||this.appendDummyInput().appendField(Lang.Blocks.FUNCTION_function);for(var c=0;ca.count?(50>d.leftFloor&&50>d.rightFloor?a.count++:a.count=0,d=d.leftFloor-d.rightFloor,c.leftWheel=45+.25*d,c.rightWheel=45-.25*d):(a.count=0,a.boardState=2);break;case 2:d=d.leftFloor-d.rightFloor;c.leftWheel=45+.25*d;c.rightWheel=45-.25*d;a.boardState=3;var e=setTimeout(function(){a.boardState=4;Entry.Hamster.removeTimeout(e)},250);Entry.Hamster.timeouts.push(e); -break;case 3:d=d.leftFloor-d.rightFloor;c.leftWheel=45+.25*d;c.rightWheel=45-.25*d;break;case 4:c.leftWheel=0,c.rightWheel=0,a.boardState=0,a.isMoving=!1}return a}delete a.isStart;delete a.isMoving;delete a.count;delete a.boardState;Entry.engine.isContinue=!1;c.leftWheel=0;c.rightWheel=0;return a.callReturn()}a.isStart=!0;a.isMoving=!0;a.count=0;a.boardState=1;c.leftWheel=45;c.rightWheel=45;Entry.Hamster.setLineTracerMode(c,0);return a}; +Entry.block.hamster_move_forward_once=function(a,b){a=Entry.hw.sendQueue;var c=Entry.hw.portData;if(b.isStart){if(b.isMoving){switch(b.boardState){case 1:2>b.count?(50>c.leftFloor&&50>c.rightFloor?b.count++:b.count=0,c=c.leftFloor-c.rightFloor,a.leftWheel=45+.25*c,a.rightWheel=45-.25*c):(b.count=0,b.boardState=2);break;case 2:c=c.leftFloor-c.rightFloor;a.leftWheel=45+.25*c;a.rightWheel=45-.25*c;b.boardState=3;var d=setTimeout(function(){b.boardState=4;Entry.Hamster.removeTimeout(d)},250);Entry.Hamster.timeouts.push(d); +break;case 3:c=c.leftFloor-c.rightFloor;a.leftWheel=45+.25*c;a.rightWheel=45-.25*c;break;case 4:a.leftWheel=0,a.rightWheel=0,b.boardState=0,b.isMoving=!1}return b}delete b.isStart;delete b.isMoving;delete b.count;delete b.boardState;Entry.engine.isContinue=!1;a.leftWheel=0;a.rightWheel=0;return b.callReturn()}b.isStart=!0;b.isMoving=!0;b.count=0;b.boardState=1;a.leftWheel=45;a.rightWheel=45;Entry.Hamster.setLineTracerMode(a,0);return b}; Blockly.Blocks.hamster_turn_once={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_turn_once_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"]]),"DIRECTION").appendField(Lang.Blocks.HAMSTER_turn_once_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.hamster_turn_once=function(b,a){var c=Entry.hw.sendQueue,d=Entry.hw.portData;if(a.isStart){if(a.isMoving){if(a.isLeft)switch(a.boardState){case 1:2>a.count?50d.leftFloor&&(a.boardState=3);break;case 3:2>a.count?20>d.leftFloor&&a.count++:(a.count=0,a.boardState=4);break;case 4:50a.count?50d.rightFloor&&(a.boardState=3);break;case 3:2>a.count?20>d.rightFloor&&a.count++:(a.count=0,a.boardState=4);break;case 4:50b.count?50c.leftFloor&&(b.boardState=3);break;case 3:2>b.count?20>c.leftFloor&&b.count++:(b.count=0,b.boardState=4);break;case 4:50b.count?50c.rightFloor&&(b.boardState=3);break;case 3:2>b.count?20>c.rightFloor&&b.count++:(b.count=0,b.boardState=4);break;case 4:50Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return a.callReturn()}; +Entry.block.hamster_change_tempo_by=function(a,b){Entry.Hamster.tempo+=b.getNumberValue("VALUE");1>Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return b.callReturn()}; 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()}; +Entry.block.hamster_set_tempo_to=function(a,b){Entry.Hamster.tempo=b.getNumberValue("VALUE");1>Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return b.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(a,b){a=Entry.hw.sendQueue;var c=b.getField("PORT",b),d=Number(b.getField("MODE",b));"A"==c?a.ioModeA=d:("B"!=c&&(a.ioModeA=d),a.ioModeB=d);return b.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()}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_change_output_by=function(a,b){a=Entry.hw.sendQueue;var c=b.getField("PORT"),d=b.getNumberValue("VALUE");"A"==c?a.outputA=void 0!=a.outputA?a.outputA+d:d:("B"!=c&&(a.outputA=void 0!=a.outputA?a.outputA+d:d),a.outputB=void 0!=a.outputB?a.outputB+d:d);return b.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)}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_set_output_to=function(a,b){a=Entry.hw.sendQueue;var c=b.getField("PORT"),d=b.getNumberValue("VALUE");"A"==c?a.outputA=d:("B"!=c&&(a.outputA=d),a.outputB=d);return b.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(a,b){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(a,b){a=Number(b.getField("VALUE",b));return 0<=Entry.pressedKeys.indexOf(a)}; 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","BIGGER"]]),"OPERATOR");this.appendValueInput("RIGHTHAND").setCheck(["String","Number"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; -Entry.block.boolean_comparison=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","#3D3D3D");this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; -Entry.block.boolean_bigger=function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c>d};Blockly.Blocks.boolean_smaller={init:function(){this.setColour("#AEB8FF");this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("<","#3D3D3D");this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; -Entry.block.boolean_smaller=function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c","BIGGER"]]),"OPERATOR");this.appendValueInput("RIGHTHAND").setCheck(["String","Number"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; +Entry.block.boolean_comparison=function(a,b){a=b.getField("OPERATOR",b);var c=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return"EQUAL"==a?c==b:"BIGGER"==a?c>b:c","#3D3D3D");this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; +Entry.block.boolean_bigger=function(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a>b};Blockly.Blocks.boolean_smaller={init:function(){this.setColour("#AEB8FF");this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("<","#3D3D3D");this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; +Entry.block.boolean_smaller=function(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a","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()}; -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()}; +Entry.block.boolean_basic_operator=function(a,b){a=b.getField("OPERATOR",b);var c=b.getStringValue("LEFTHAND",b);b=b.getStringValue("RIGHTHAND",b);switch(a){case "EQUAL":return c==b;case "GREATER":return Number(c)>Number(b);case "LESS":return Number(c)=Number(b);case "LESS_OR_EQUAL":return Number(c)<=Number(b)}};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(a,b){a.setVisible(!0);return b.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(a,b){a.setVisible(!1);return b.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)}}; -Entry.block.dialog_time=function(b,a){if(!a.isStart){var c=a.getNumberValue("SECOND",a),d=a.getStringValue("VALUE",a),e=a.getField("OPTION",a);a.isStart=!0;a.timeFlag=1;d||"number"==typeof d||(d=" ");d=Entry.convertToRoundedDecimals(d,3);new Entry.Dialog(b,d,e);b.syncDialogVisible(b.getVisible());setTimeout(function(){a.timeFlag=0},1E3*c)}return 0==a.timeFlag?(delete a.timeFlag,delete a.isStart,b.dialog&&b.dialog.remove(),a.callReturn()):a}; +Entry.block.dialog_time=function(a,b){if(!b.isStart){var c=b.getNumberValue("SECOND",b),d=b.getStringValue("VALUE",b),e=b.getField("OPTION",b);b.isStart=!0;b.timeFlag=1;d||"number"==typeof d||(d=" ");d=Entry.convertToRoundedDecimals(d,3);new Entry.Dialog(a,d,e);a.syncDialogVisible(a.getVisible());setTimeout(function(){b.timeFlag=0},1E3*c)}return 0==b.timeFlag?(delete b.timeFlag,delete b.isStart,a.dialog&&a.dialog.remove(),b.callReturn()):b}; Blockly.Blocks.dialog={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_1);this.appendValueInput("VALUE").setCheck(["String","Number",null]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_2);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.speak,"speak"]]),"OPTION");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png", -"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dialog=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()}; -Blockly.Blocks.remove_dialog={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_remove_dialog).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.remove_dialog=function(b,a){b.dialog&&b.dialog.remove();return a.callReturn()}; +"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dialog=function(a,b){var c=b.getStringValue("VALUE",b);c||"number"==typeof c||(c=" ");var d=b.getField("OPTION",b),c=Entry.convertToRoundedDecimals(c,3);new Entry.Dialog(a,c,d);a.syncDialogVisible(a.getVisible());return b.callReturn()}; +Blockly.Blocks.remove_dialog={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_remove_dialog).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.remove_dialog=function(a,b){a.dialog&&a.dialog.remove();return b.callReturn()}; Blockly.Blocks.change_to_nth_shape={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_to_nth_shape_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("pictures"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_to_nth_shape_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_to_nth_shape=function(b,a){var c=a.getField("VALUE",a),c=b.parent.getPicture(c);b.setImage(c);return a.callReturn()}; +Entry.block.change_to_nth_shape=function(a,b){var c=b.getField("VALUE",b),c=a.parent.getPicture(c);a.setImage(c);return b.callReturn()}; Blockly.Blocks.change_to_next_shape={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_to_near_shape_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.LOOKS_change_shape_next,"next"],[Lang.Blocks.LOOKS_change_shape_prev,"prev"]]),"DRIECTION").appendField(Lang.Blocks.LOOKS_change_to_near_shape_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_to_next_shape=function(b,a){var c;c=a.fields&&"prev"===a.getStringField("DRIECTION")?b.parent.getPrevPicture(b.picture.id):b.parent.getNextPicture(b.picture.id);b.setImage(c);return a.callReturn()}; +Entry.block.change_to_next_shape=function(a,b){var c;c=b.fields&&"prev"===b.getStringField("DRIECTION")?a.parent.getPrevPicture(a.picture.id):a.parent.getNextPicture(a.picture.id);a.setImage(c);return b.callReturn()}; Blockly.Blocks.set_effect_volume={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_effect_volume_1);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity,"opacity"]]),"EFFECT");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_effect_volume_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_effect_volume_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.set_effect_volume=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()}; +"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.set_effect_volume=function(a,b){var c=b.getField("EFFECT",b),d=b.getNumberValue("VALUE",b);"color"==c?a.effect.hue=d+a.effect.hue:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?a.effect.brightness=d+a.effect.brightness:"blur"!=c&&"opacity"==c&&(a.effect.alpha+=d/100));a.applyFilter();return b.callReturn()}; Blockly.Blocks.set_effect={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_effect_1);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity,"opacity"]]),"EFFECT");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_effect_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_effect_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.set_effect=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()}; -Blockly.Blocks.erase_all_effects={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_erase_all_effects).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.erase_all_effects=function(b,a){b.resetFilter();return a.callReturn()}; +"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.set_effect=function(a,b){var c=b.getField("EFFECT",b),d=b.getNumberValue("VALUE",b);"color"==c?a.effect.hue=d:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?a.effect.brightness=d:"blur"!=c&&"opacity"==c&&(a.effect.alpha=d/100));a.applyFilter();return b.callReturn()}; +Blockly.Blocks.erase_all_effects={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_erase_all_effects).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.erase_all_effects=function(a,b){a.resetFilter();return b.callReturn()}; Blockly.Blocks.change_scale_percent={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_scale_percent_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_scale_percent_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_scale_percent=function(b,a){var c=(a.getNumberValue("VALUE",a)+100)/100;b.setScaleX(b.getScaleX()*c);b.setScaleY(b.getScaleY()*c);return a.callReturn()}; +Entry.block.change_scale_percent=function(a,b){var c=(b.getNumberValue("VALUE",b)+100)/100;a.setScaleX(a.getScaleX()*c);a.setScaleY(a.getScaleY()*c);return b.callReturn()}; Blockly.Blocks.set_scale_percent={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_scale_percent_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_scale_percent_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_scale_percent=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()}; +Entry.block.set_scale_percent=function(a,b){var c=b.getNumberValue("VALUE",b)/100,d=a.snapshot_;a.setScaleX(c*d.scaleX);a.setScaleY(c*d.scaleY);return b.callReturn()}; Blockly.Blocks.change_scale_size={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_scale_percent_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_scale_percent_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_scale_size=function(b,a){var c=a.getNumberValue("VALUE",a);b.setSize(b.getSize()+c);return a.callReturn()}; +Entry.block.change_scale_size=function(a,b){var c=b.getNumberValue("VALUE",b);a.setSize(a.getSize()+c);return b.callReturn()}; Blockly.Blocks.set_scale_size={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_scale_percent_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_scale_percent_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_scale_size=function(b,a){var c=a.getNumberValue("VALUE",a);b.setSize(c);return a.callReturn()};Blockly.Blocks.flip_y={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_flip_y).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_y=function(b,a){b.setScaleX(-1*b.getScaleX());return a.callReturn()}; -Blockly.Blocks.flip_x={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_flip_x).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_x=function(b,a){b.setScaleY(-1*b.getScaleY());return a.callReturn()}; +Entry.block.set_scale_size=function(a,b){var c=b.getNumberValue("VALUE",b);a.setSize(c);return b.callReturn()};Blockly.Blocks.flip_y={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_flip_y).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_y=function(a,b){a.setScaleX(-1*a.getScaleX());return b.callReturn()}; +Blockly.Blocks.flip_x={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_flip_x).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_x=function(a,b){a.setScaleY(-1*a.getScaleY());return b.callReturn()}; Blockly.Blocks.set_object_order={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_object_order_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("objectSequence"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_object_order_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_object_order=function(b,a){var c=a.getField("VALUE",a),d=Entry.container.getCurrentObjects().indexOf(b.parent);if(-1f)throw Error("object is not available for current scene");switch(d){case "FRONT":c=0;break;case "FORWARD":c=Math.max(0,f-1);break;case "BACKWARD":c=Math.min(e,f+1);break;case "BACK":c=e}Entry.container.moveElementByBlock(f,c);return a.callReturn()};Blockly.Blocks.move_direction={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.move_direction=function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(b.getX()+c*Math.cos((b.getRotation()+b.getDirection()-90)/180*Math.PI));b.setY(b.getY()-c*Math.sin((b.getRotation()+b.getDirection()-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; +"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.change_object_index=function(a,b){var c,d=b.getField("LOCATION",b),e=Entry.container.getCurrentObjects();a=e.indexOf(a.parent);e=e.length-1;if(0>a)throw Error("object is not available for current scene");switch(d){case "FRONT":c=0;break;case "FORWARD":c=Math.max(0,a-1);break;case "BACKWARD":c=Math.min(e,a+1);break;case "BACK":c=e}Entry.container.moveElementByBlock(a,c);return b.callReturn()};Blockly.Blocks.move_direction={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; +Entry.block.move_direction=function(a,b){var c=b.getNumberValue("VALUE",b);a.setX(a.getX()+c*Math.cos((a.getRotation()+a.getDirection()-90)/180*Math.PI));a.setY(a.getY()-c*Math.sin((a.getRotation()+a.getDirection()-90)/180*Math.PI));a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}; Blockly.Blocks.move_x={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_x_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_x_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.move_x=function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(b.getX()+c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; +Entry.block.move_x=function(a,b){var c=b.getNumberValue("VALUE",b);a.setX(a.getX()+c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}; Blockly.Blocks.move_y={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_y_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_y_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.move_y=function(b,a){var c=a.getNumberValue("VALUE",a);b.setY(b.getY()+c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; +Entry.block.move_y=function(a,b){var c=b.getNumberValue("VALUE",b);a.setY(a.getY()+c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}; Blockly.Blocks.locate_xy_time={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_xy_time_1);this.appendValueInput("VALUE1").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_xy_time_2);this.appendValueInput("VALUE2").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_xy_time_3);this.appendValueInput("VALUE3").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_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.locate_xy_time=function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE1",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.x=a.getNumberValue("VALUE2",a);a.y=a.getNumberValue("VALUE3",a)}if(0!=a.frameCount){c=a.x-b.getX();var d=a.y-b.getY();c/=a.frameCount;d/=a.frameCount;b.setX(b.getX()+c);b.setY(b.getY()+d);a.frameCount--;b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a}delete a.isStart;delete a.frameCount;return a.callReturn()}; +Entry.block.locate_xy_time=function(a,b){if(!b.isStart){var c;c=b.getNumberValue("VALUE1",b);b.isStart=!0;b.frameCount=Math.floor(c*Entry.FPS);b.x=b.getNumberValue("VALUE2",b);b.y=b.getNumberValue("VALUE3",b)}if(0!=b.frameCount){c=b.x-a.getX();var d=b.y-a.getY();c/=b.frameCount;d/=b.frameCount;a.setX(a.getX()+c);a.setY(a.getY()+d);b.frameCount--;a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b}delete b.isStart;delete b.frameCount;return b.callReturn()}; 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()}; +Entry.block.rotate_by_angle=function(a,b){var c=b.getNumberValue("VALUE",b);a.setRotation(a.getRotation()+c);return b.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(a,b){var c=b.getField("VALUE",b);a.setRotation(a.getRotation()+Number(c));return b.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()}; +Entry.block.see_angle=function(a,b){var c=b.getNumberValue("VALUE",b);a.setDirection(c);return b.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)}}; -Entry.block.see_direction=function(b,a){var c=a.getField("VALUE",a),d=Entry.container.getEntity(c),c=d.getX()-b.getX(),d=d.getY()-b.getY();0<=c?b.setRotation(Math.atan(d/c)/Math.PI*180+90):b.setRotation(Math.atan(d/c)/Math.PI*180+270);return a.callReturn()}; +Entry.block.see_direction=function(a,b){var c=b.getField("VALUE",b),d=Entry.container.getEntity(c),c=d.getX()-a.getX(),d=d.getY()-a.getY();0<=c?a.setRotation(Math.atan(d/c)/Math.PI*180+90):a.setRotation(Math.atan(d/c)/Math.PI*180+270);return b.callReturn()}; Blockly.Blocks.locate_xy={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_xy_1);this.appendValueInput("VALUE1").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_xy_2);this.appendValueInput("VALUE2").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_xy_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0); -this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.locate_xy=function(b,a){var c=a.getNumberValue("VALUE1",a);b.setX(c);c=a.getNumberValue("VALUE2",a);b.setY(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; +this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.locate_xy=function(a,b){var c=b.getNumberValue("VALUE1",b);a.setX(c);c=b.getNumberValue("VALUE2",b);a.setY(c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}; Blockly.Blocks.locate_x={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_x_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_x_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.locate_x=function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; +Entry.block.locate_x=function(a,b){var c=b.getNumberValue("VALUE",b);a.setX(c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}; 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()}; +Entry.block.locate_y=function(a,b){var c=b.getNumberValue("VALUE",b);a.setY(c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.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(a,b){var c=b.getField("VALUE",b),d;"mouse"==c?(c=Entry.stage.mouseCoordinate.x,d=Entry.stage.mouseCoordinate.y):(d=Entry.container.getEntity(c),c=d.getX(),d=d.getY());a.setX(Number(c));a.setY(Number(d));a.brush&&!a.brush.stop&&a.brush.lineTo(c,-1*d);return b.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()}; +Entry.block.move_xy_time=function(a,b){if(!b.isStart){var c;c=b.getNumberValue("VALUE1",b);var d=b.getNumberValue("VALUE2",b),e=b.getNumberValue("VALUE3",b);b.isStart=!0;b.frameCount=Math.floor(c*Entry.FPS);b.dX=d/b.frameCount;b.dY=e/b.frameCount}if(0!=b.frameCount)return a.setX(a.getX()+b.dX),a.setY(a.getY()+b.dY),b.frameCount--,a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY()),b;delete b.isStart;delete b.frameCount;return b.callReturn()}; Blockly.Blocks.locate_time={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_time_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_time_2);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("sprites"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_time_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png", "*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Blockly.Blocks.rotate_by_angle_time={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_time_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_time_2);this.appendDummyInput().appendField(new Blockly.FieldAngle("90"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_time_3).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_time=function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE",a);var d=a.getNumberField("VALUE",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dAngle=d/a.frameCount}if(0!=a.frameCount)return b.setRotation(b.getRotation()+a.dAngle),a.frameCount--,a;delete a.isStart;delete a.frameCount;return a.callReturn()}; +"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.rotate_by_angle_time=function(a,b){if(!b.isStart){var c;c=b.getNumberValue("VALUE",b);var d=b.getNumberField("VALUE",b);b.isStart=!0;b.frameCount=Math.floor(c*Entry.FPS);b.dAngle=d/b.frameCount}if(0!=b.frameCount)return a.setRotation(a.getRotation()+b.dAngle),b.frameCount--,b;delete b.isStart;delete b.frameCount;return b.callReturn()}; Blockly.Blocks.bounce_when={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_bounce_when_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("bounce"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.MOVING_bounce_when_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setPreviousStatement(!0);this.setInputsInline(!0);this.setNextStatement(!0)}}; Blockly.Blocks.bounce_wall={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_bounce_wall).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.bounce_wall=function(b,a){var c=b.parent.getRotateMethod(),d="free"==c?(b.getRotation()+b.getDirection()).mod(360):b.getDirection(),e=Entry.Utils.COLLISION.NONE;if(90>d&&0<=d||360>d&&270<=d){var e=b.collision==Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,b.object,0,!1);!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE);f&&e&&(f=!1);f?("free"==c?b.setRotation(-b.getRotation()-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&&e&&(f=!1),f&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN))}else 270>d&&90<=d&&(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&&e&&(f= -!1),f?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN):(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)));360>d&&180<=d?(e=b.collision==Entry.Utils.COLLISION.LEFT, -d=ndgmr.checkPixelCollision(Entry.stage.wall.left,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.LEFT):(e=b.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()): -b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.RIGHT))):180>d&&0<=d&&(e=b.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.RIGHT):(e=b.collision==Entry.Utils.COLLISION.LEFT,d=ndgmr.checkPixelCollision(Entry.stage.wall.left, -b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.LEFT)));return a.callReturn()}; -Blockly.Blocks.flip_arrow_horizontal={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_flip_arrow_horizontal).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_arrow_horizontal=function(b,a){b.setDirection(b.getDirection()+180);return a.callReturn()}; -Blockly.Blocks.flip_arrow_vertical={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_flip_arrow_vertical).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_arrow_vertical=function(b,a){b.setDirection(b.getDirection()+180);return a.callReturn()}; +Entry.block.bounce_wall=function(a,b){var c=a.parent.getRotateMethod(),d="free"==c?(a.getRotation()+a.getDirection()).mod(360):a.getDirection(),e;if(90>d&&0<=d||360>d&&270<=d){e=a.collision==Entry.Utils.COLLISION.UP;var f=ndgmr.checkPixelCollision(Entry.stage.wall.up,a.object,0,!1);!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE);f&&e&&(f=!1);f?("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+180),a.collision=Entry.Utils.COLLISION.UP):(e=a.collision== +Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,a.object,0,!1),!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+180),a.collision=Entry.Utils.COLLISION.DOWN))}else 270>d&&90<=d&&(e=a.collision==Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,a.object,0,!1),!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f?("free"==c? +a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+180),a.collision=Entry.Utils.COLLISION.DOWN):(e=a.collision==Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,a.object,0,!1),!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+180),a.collision=Entry.Utils.COLLISION.UP)));360>d&&180<=d?(e=a.collision==Entry.Utils.COLLISION.LEFT, +d=ndgmr.checkPixelCollision(Entry.stage.wall.left,a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()):a.setDirection(-a.getDirection()+360),a.collision=Entry.Utils.COLLISION.LEFT):(e=a.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()): +a.setDirection(-a.getDirection()+360),a.collision=Entry.Utils.COLLISION.RIGHT))):180>d&&0<=d&&(e=a.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()):a.setDirection(-a.getDirection()+360),a.collision=Entry.Utils.COLLISION.RIGHT):(e=a.collision==Entry.Utils.COLLISION.LEFT,d=ndgmr.checkPixelCollision(Entry.stage.wall.left, +a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()):a.setDirection(-a.getDirection()+360),a.collision=Entry.Utils.COLLISION.LEFT)));return b.callReturn()}; +Blockly.Blocks.flip_arrow_horizontal={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_flip_arrow_horizontal).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_arrow_horizontal=function(a,b){a.setDirection(a.getDirection()+180);return b.callReturn()}; +Blockly.Blocks.flip_arrow_vertical={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_flip_arrow_vertical).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_arrow_vertical=function(a,b){a.setDirection(a.getDirection()+180);return b.callReturn()}; Blockly.Blocks.see_angle_object={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_object_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("spritesWithMouse"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_object_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_object=function(b,a){var c=a.getField("VALUE",a),d=b.getX(),e=b.getY();if(b.parent.id==c)return a.callReturn();"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()}; +Entry.block.see_angle_object=function(a,b){var c=b.getField("VALUE",b),d=a.getX(),e=a.getY();if(a.parent.id==c)return b.callReturn();"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?a.getDirection()+a.getRotation():0<=d?-Math.atan(e/d)/Math.PI*180+90:-Math.atan(e/d)/Math.PI*180+270;d=a.getDirection()+a.getRotation();a.setRotation(a.getRotation()+e-d);return b.callReturn()}; Blockly.Blocks.see_angle_direction={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_direction_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_direction_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_direction=function(b,a){var c=a.getNumberValue("VALUE",a),d=b.getDirection()+b.getRotation();b.setRotation(b.getRotation()+c-d);return a.callReturn()}; +Entry.block.see_angle_direction=function(a,b){var c=b.getNumberValue("VALUE",b),d=a.getDirection()+a.getRotation();a.setRotation(a.getRotation()+c-d);return b.callReturn()}; Blockly.Blocks.rotate_direction={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_direction_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_direction_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.rotate_direction=function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c+b.getDirection());return a.callReturn()}; +Entry.block.rotate_direction=function(a,b){var c=b.getNumberValue("VALUE",b);a.setDirection(c+a.getDirection());return b.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(a,b){if(!b.isStart){var c,d,e;d=b.getField("TARGET",b);c=b.getNumberValue("VALUE",b);c=Math.floor(c*Entry.FPS);e=Entry.stage.mouseCoordinate;if(0!=c)"mouse"==d?(d=e.x-a.getX(),e=e.y-a.getY()):(e=Entry.container.getEntity(d),d=e.getX()-a.getX(),e=e.getY()-a.getY()),b.isStart=!0,b.frameCount=c,b.dX=d/b.frameCount,b.dY=e/b.frameCount;else return"mouse"==d?(d=Number(e.x),e=Number(e.y)):(e=Entry.container.getEntity(d),d=e.getX(),e=e.getY()),a.setX(d),a.setY(e),a.brush&& +!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY()),b.callReturn()}if(0!=b.frameCount)return a.setX(a.getX()+b.dX),a.setY(a.getY()+b.dY),b.frameCount--,a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY()),b;delete b.isStart;delete b.frameCount;return b.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()}; +Entry.block.rotate_absolute=function(a,b){var c=b.getNumberValue("VALUE",b);a.setRotation(c);return b.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)}}; -Entry.block.rotate_relative=function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c+b.getRotation());return a.callReturn()}; +Entry.block.rotate_relative=function(a,b){var c=b.getNumberValue("VALUE",b);a.setRotation(c+a.getRotation());return b.callReturn()}; Blockly.Blocks.direction_absolute={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.direction_absolute=function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}; +Entry.block.direction_absolute=function(a,b){var c=b.getNumberValue("VALUE",b);a.setDirection(c);return b.callReturn()}; Blockly.Blocks.direction_relative={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_direction_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_direction_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.direction_relative=function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c+b.getDirection());return a.callReturn()}; +Entry.block.direction_relative=function(a,b){var c=b.getNumberValue("VALUE",b);a.setDirection(c+a.getDirection());return b.callReturn()}; Blockly.Blocks.move_to_angle={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_angle_1);this.appendValueInput("ANGLE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_angle_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_angle_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png", -"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.move_to_angle=function(b,a){var c=a.getNumberValue("VALUE",a),d=a.getNumberValue("ANGLE",a);b.setX(b.getX()+c*Math.cos((d-90)/180*Math.PI));b.setY(b.getY()-c*Math.sin((d-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; +"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.move_to_angle=function(a,b){var c=b.getNumberValue("VALUE",b),d=b.getNumberValue("ANGLE",b);a.setX(a.getX()+c*Math.cos((d-90)/180*Math.PI));a.setY(a.getY()-c*Math.sin((d-90)/180*Math.PI));a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}; Blockly.Blocks.rotate_by_time={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_add_direction_by_angle_time_explain_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_add_direction_by_angle_time_2);this.appendDummyInput().appendField(Lang.Blocks.MOVING_add_direction_by_angle_time_1);this.appendValueInput("ANGLE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_add_direction_by_angle_time_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.rotate_by_time=function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE",a);var d=a.getNumberValue("ANGLE",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dAngle=d/a.frameCount}if(0!=a.frameCount)return b.setRotation(b.getRotation()+a.dAngle),a.frameCount--,a;delete a.isStart;delete a.frameCount;return a.callReturn()}; +"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.rotate_by_time=function(a,b){if(!b.isStart){var c;c=b.getNumberValue("VALUE",b);var d=b.getNumberValue("ANGLE",b);b.isStart=!0;b.frameCount=Math.floor(c*Entry.FPS);b.dAngle=d/b.frameCount}if(0!=b.frameCount)return a.setRotation(a.getRotation()+b.dAngle),b.frameCount--,b;delete b.isStart;delete b.frameCount;return b.callReturn()}; Blockly.Blocks.direction_relative_duration={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_direction_relative_duration_1);this.appendValueInput("DURATION").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_direction_relative_duration_2);this.appendValueInput("AMOUNT").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_direction_relative_duration_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.direction_relative_duration=function(b,a){if(!a.isStart){var c;c=a.getNumberValue("DURATION",a);var d=a.getNumberValue("AMOUNT",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dDirection=d/a.frameCount}if(0!=a.frameCount)return b.setDirection(b.getDirection()+a.dDirection),a.frameCount--,a;delete a.isStart;delete a.frameCount;delete a.dDirection;return a.callReturn()};Entry.Neobot={name:"neobot",LOCAL_MAP:["IN1","IN2","IN3","IR","BAT"],REMOTE_MAP:"OUT1 OUT2 OUT3 DCR DCL SND FND OPT".split(" "),setZero:function(){for(var b in Entry.Neobot.REMOTE_MAP)Entry.hw.sendQueue[Entry.Neobot.REMOTE_MAP[b]]=0;Entry.hw.update()},name:"neobot",monitorTemplate:{imgPath:"hw/neobot.png",width:700,height:700,listPorts:{IR:{name:"\ub9ac\ubaa8\ucee8",type:"input",pos:{x:0,y:0}},BAT:{name:"\ubca0\ud130\ub9ac",type:"input",pos:{x:0,y:0}},SND:{name:Lang.Hw.buzzer,type:"output",pos:{x:0, +"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.direction_relative_duration=function(a,b){if(!b.isStart){var c;c=b.getNumberValue("DURATION",b);var d=b.getNumberValue("AMOUNT",b);b.isStart=!0;b.frameCount=Math.floor(c*Entry.FPS);b.dDirection=d/b.frameCount}if(0!=b.frameCount)return a.setDirection(a.getDirection()+b.dDirection),b.frameCount--,b;delete b.isStart;delete b.frameCount;delete b.dDirection;return b.callReturn()};Entry.Neobot={name:"neobot",LOCAL_MAP:["IN1","IN2","IN3","IR","BAT"],REMOTE_MAP:"OUT1 OUT2 OUT3 DCR DCL SND FND OPT".split(" "),setZero:function(){for(var a in Entry.Neobot.REMOTE_MAP)Entry.hw.sendQueue[Entry.Neobot.REMOTE_MAP[a]]=0;Entry.hw.update()},name:"neobot",monitorTemplate:{imgPath:"hw/neobot.png",width:700,height:700,listPorts:{IR:{name:"\ub9ac\ubaa8\ucee8",type:"input",pos:{x:0,y:0}},BAT:{name:"\ubca0\ud130\ub9ac",type:"input",pos:{x:0,y:0}},SND:{name:Lang.Hw.buzzer,type:"output",pos:{x:0, y:0}},FND:{name:"FND",type:"output",pos:{x:0,y:0}}},ports:{IN1:{name:"IN1",type:"input",pos:{x:270,y:200}},IN2:{name:"IN2",type:"input",pos:{x:325,y:200}},IN3:{name:"IN3",type:"input",pos:{x:325,y:500}},DCL:{name:"L-Motor",type:"output",pos:{x:270,y:500}},DCR:{name:"R-Motor",type:"output",pos:{x:435,y:500}},OUT1:{name:"OUT1",type:"output",pos:{x:380,y:200}},OUT2:{name:"OUT2",type:"output",pos:{x:435,y:200}},OUT3:{name:"OUT3",type:"output",pos:{x:380,y:500}}},mode:"both"}}; -Blockly.Blocks.neobot_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["1\ubc88 \ud3ec\ud2b8","IN1"],["2\ubc88 \ud3ec\ud2b8","IN2"],["3\ubc88 \ud3ec\ud2b8","IN3"],["\ub9ac\ubaa8\ucee8","IR"],["\ubc30\ud130\ub9ac","BAT"]]),"PORT").appendField(" \uac12");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.neobot_sensor_value=function(b,a){var c=a.getStringField("PORT");return Entry.hw.portData[c]}; +Blockly.Blocks.neobot_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["1\ubc88 \ud3ec\ud2b8","IN1"],["2\ubc88 \ud3ec\ud2b8","IN2"],["3\ubc88 \ud3ec\ud2b8","IN3"],["\ub9ac\ubaa8\ucee8","IR"],["\ubc30\ud130\ub9ac","BAT"]]),"PORT").appendField(" \uac12");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.neobot_sensor_value=function(a,b){a=b.getStringField("PORT");return Entry.hw.portData[a]}; Blockly.Blocks.neobot_left_motor={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc67c\ucabd\ubaa8\ud130\ub97c").appendField(new Blockly.FieldDropdown([["\uc55e\uc73c\ub85c","16"],["\ub4a4\ub85c","32"]]),"DIRECTION").appendField(new Blockly.FieldDropdown([["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"],["14","14"],["15","15"]]),"SPEED").appendField("\uc758 \uc18d\ub3c4\ub85c \ud68c\uc804").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_left_motor=function(b,a){var c=a.getNumberField("SPEED"),d=a.getNumberField("DIRECTION");Entry.hw.sendQueue.DCL=c+d;return a.callReturn()}; -Blockly.Blocks.neobot_stop_left_motor={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc67c\ucabd\ubaa8\ud130 \uc815\uc9c0").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_stop_left_motor=function(b,a){Entry.hw.sendQueue.DCL=0;return a.callReturn()}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_left_motor=function(a,b){a=b.getNumberField("SPEED");var c=b.getNumberField("DIRECTION");Entry.hw.sendQueue.DCL=a+c;return b.callReturn()}; +Blockly.Blocks.neobot_stop_left_motor={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc67c\ucabd\ubaa8\ud130 \uc815\uc9c0").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_stop_left_motor=function(a,b){Entry.hw.sendQueue.DCL=0;return b.callReturn()}; Blockly.Blocks.neobot_right_motor={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc624\ub978\ucabd\ubaa8\ud130\ub97c").appendField(new Blockly.FieldDropdown([["\uc55e\uc73c\ub85c","16"],["\ub4a4\ub85c","32"]]),"DIRECTION").appendField(new Blockly.FieldDropdown([["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"],["14","14"],["15","15"]]),"SPEED").appendField("\uc758 \uc18d\ub3c4\ub85c \ud68c\uc804").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_right_motor=function(b,a){var c=a.getNumberField("SPEED"),d=a.getNumberField("DIRECTION");Entry.hw.sendQueue.DCR=c+d;return a.callReturn()}; -Blockly.Blocks.neobot_stop_right_motor={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc624\ub978\ucabd\ubaa8\ud130 \uc815\uc9c0").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_stop_right_motor=function(b,a){Entry.hw.sendQueue.DCR=0;return a.callReturn()}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_right_motor=function(a,b){a=b.getNumberField("SPEED");var c=b.getNumberField("DIRECTION");Entry.hw.sendQueue.DCR=a+c;return b.callReturn()}; +Blockly.Blocks.neobot_stop_right_motor={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc624\ub978\ucabd\ubaa8\ud130 \uc815\uc9c0").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_stop_right_motor=function(a,b){Entry.hw.sendQueue.DCR=0;return b.callReturn()}; Blockly.Blocks.neobot_all_motor={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc591\ucabd \ubaa8\ud130\ub97c ");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["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"],["14","14"],["15","15"]]),"SPEED").appendField(" \uc758 \uc18d\ub3c4\ub85c ").appendField(new Blockly.FieldDropdown([["\uc804\uc9c4","1"],["\ud6c4\uc9c4", "2"],["\uc81c\uc790\ub9ac \uc88c\ud68c\uc804","3"],["\uc81c\uc790\ub9ac \uc6b0\ud68c\uc804","4"],["\uc88c\ud68c\uc804","5"],["\uc6b0\ud68c\uc804","6"]]),"DIRECTION").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.neobot_all_motor=function(b,a){a.getNumberField("TYPE");var c=a.getNumberField("SPEED");switch(a.getNumberField("DIRECTION")){case 1:Entry.hw.sendQueue.DCL=16+c;Entry.hw.sendQueue.DCR=16+c;break;case 2:Entry.hw.sendQueue.DCL=32+c;Entry.hw.sendQueue.DCR=32+c;break;case 3:Entry.hw.sendQueue.DCL=32+c;Entry.hw.sendQueue.DCR=16+c;break;case 4:Entry.hw.sendQueue.DCL=16+c;Entry.hw.sendQueue.DCR=32+c;break;case 5:Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR=16+c;break;case 6:Entry.hw.sendQueue.DCL= -16+c,Entry.hw.sendQueue.DCR=0}return a.callReturn()}; +Entry.block.neobot_all_motor=function(a,b){b.getNumberField("TYPE");a=b.getNumberField("SPEED");switch(b.getNumberField("DIRECTION")){case 1:Entry.hw.sendQueue.DCL=16+a;Entry.hw.sendQueue.DCR=16+a;break;case 2:Entry.hw.sendQueue.DCL=32+a;Entry.hw.sendQueue.DCR=32+a;break;case 3:Entry.hw.sendQueue.DCL=32+a;Entry.hw.sendQueue.DCR=16+a;break;case 4:Entry.hw.sendQueue.DCL=16+a;Entry.hw.sendQueue.DCR=32+a;break;case 5:Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR=16+a;break;case 6:Entry.hw.sendQueue.DCL= +16+a,Entry.hw.sendQueue.DCR=0}return b.callReturn()}; Blockly.Blocks.neobot_set_servo={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["OUT1","1"],["OUT2","2"],["OUT3","3"]]),"PORT").appendField("\ud3ec\ud2b8\uc758 \uc11c\ubcf4\ubaa8\ud130\ub97c").appendField(new Blockly.FieldDropdown([["0\ub3c4","0"],["10\ub3c4","10"],["20\ub3c4","20"],["30\ub3c4","30"],["40\ub3c4","40"],["50\ub3c4","50"],["60\ub3c4","60"],["70\ub3c4","70"],["80\ub3c4","80"],["90\ub3c4","90"],["100\ub3c4","100"],["110\ub3c4", "110"],["120\ub3c4","120"],["130\ub3c4","130"],["140\ub3c4","140"],["150\ub3c4","150"],["160\ub3c4","160"],["170\ub3c4","170"],["180\ub3c4","180"]]),"DEGREE").appendField(" \uc774\ub3d9").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.neobot_set_servo=function(b,a){var c=a.getNumberField("PORT"),d=a.getNumberField("DEGREE");Entry.hw.sendQueue["OUT"+c]=d;3===c&&(c=4);Entry.hw.sendQueue.OPT|=c;return a.callReturn()}; +Entry.block.neobot_set_servo=function(a,b){a=b.getNumberField("PORT");var c=b.getNumberField("DEGREE");Entry.hw.sendQueue["OUT"+a]=c;3===a&&(a=4);Entry.hw.sendQueue.OPT|=a;return b.callReturn()}; Blockly.Blocks.neobot_set_output={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["OUT1","1"],["OUT2","2"],["OUT3","3"]]),"PORT").appendField("\ubc88 \ud3ec\ud2b8\uc758 \uac12\uc744");this.appendValueInput("VALUE").setCheck(["Number"]);this.appendDummyInput().appendField("\ub9cc\ud07c \ucd9c\ub825").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0); -this.setNextStatement(!0)}};Entry.block.neobot_set_output=function(b,a){var c=a.getStringField("PORT",a),d=a.getNumberValue("VALUE",a),e=c;0>d?d=0:255c?c=0:255c&&(c=0);Entry.hw.sendQueue.FND=c;return a.callReturn()}; +Entry.block.neobot_set_fnd=function(a,b){a=b.getNumberValue("VALUE",b);255a&&(a=0);Entry.hw.sendQueue.FND=a;return b.callReturn()}; Blockly.Blocks.neobot_play_note_for={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uba5c\ub85c\ub514").appendField(new Blockly.FieldDropdown([["\ubb34\uc74c","0"],[Lang.General.note_c,"1"],[Lang.General.note_c+"#","2"],[Lang.General.note_d,"3"],[Lang.General.note_d+"#","4"],[Lang.General.note_e,"5"],[Lang.General.note_f,"6"],[Lang.General.note_f+"#","7"],[Lang.General.note_g,"8"],[Lang.General.note_g+"#","9"],[Lang.General.note_a,"10"],[Lang.General.note_a+"#","11"], [Lang.General.note_b,"12"]]),"NOTE").appendField("\uc744(\ub97c)").appendField(new Blockly.FieldDropdown([["1","0"],["2","1"],["3","2"],["4","3"],["5","4"],["6","5"]]),"OCTAVE").appendField("\uc625\ud0c0\ube0c\ub85c").appendField(new Blockly.FieldDropdown([["2\ubd84\uc74c\ud45c","2"],["4\ubd84\uc74c\ud45c","4"],["8\ubd84\uc74c\ud45c","8"],["16\ubd84\uc74c\ud45c","16"]]),"DURATION");this.appendDummyInput().appendField("\uae38\uc774\ub9cc\ud07c \uc18c\ub9ac\ub0b4\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ "block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.neobot_play_note_for=function(b,a){var c=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return a;delete a.timeFlag;delete a.isStart;Entry.hw.sendQueue.SND=0;Entry.engine.isContinue=!1;return a.callReturn()}var d=a.getNumberField("NOTE",a),e=a.getNumberField("OCTAVE",a),f=a.getNumberField("DURATION",a),d=d+12*e;a.isStart=!0;a.timeFlag=1;65=c)return this.setRobotisData(a),this.update(),b.callReturn();if(b.isStart){if(1==b.timeFlag)return this.setRobotisData(null),b;delete b.timeFlag;delete b.isStart;Entry.engine.isContinue=!1;this.update();return b.callReturn()}b.isStart=!0;b.timeFlag=1;this.setRobotisData(a);setTimeout(function(){b.timeFlag= -0},c);return b},wait:function(b,a){Entry.hw.socket.send(JSON.stringify(b));for(var c=(new Date).getTime(),d=c;d=c)return this.setRobotisData(b),this.update(),a.callReturn();if(a.isStart){if(1==a.timeFlag)return this.setRobotisData(null),a;delete a.timeFlag;delete a.isStart;Entry.engine.isContinue=!1;this.update();return a.callReturn()}a.isStart=!0;a.timeFlag=1;this.setRobotisData(b);setTimeout(function(){a.timeFlag= +0},c);return a},wait:function(a,b){Entry.hw.socket.send(JSON.stringify(a));for(var c=a=(new Date).getTime();cd&&(d=0);return Entry.Robotis_carCont.postCallReturn(a,[[e,f+(c-1)*g,g,d]],Entry.Robotis_openCM70.delay)}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.robotis_openCM70_aux_servo_position=function(a,b){a=b.getField("PORT",b);var c=b.getNumberValue("VALUE"),d=Entry.Robotis_openCM70.INSTRUCTION.WRITE,e,f;e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0];f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1];1023c&&(c=0);return Entry.Robotis_carCont.postCallReturn(b,[[d,e+(a-1)*f,f,c]],Entry.Robotis_openCM70.delay)}; Blockly.Blocks.robotis_openCM70_aux_led_module={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.robotis_common_port_3,"3"],[Lang.Blocks.robotis_common_port_4,"4"],[Lang.Blocks.robotis_common_port_5,"5"],[Lang.Blocks.robotis_common_port_6,"6"]]),"PORT").appendField(Lang.Blocks.robotis_openCM70_aux_led_module_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.robotis_cm_led_both+Lang.Blocks.robotis_common_off,"0"],[Lang.Blocks.robotis_cm_led_right+ Lang.Blocks.robotis_common_on,"1"],[Lang.Blocks.robotis_cm_led_left+Lang.Blocks.robotis_common_on,"2"],[Lang.Blocks.robotis_cm_led_both+Lang.Blocks.robotis_common_on,"3"]]),"LED_MODULE");this.appendDummyInput().appendField(Lang.Blocks.robotis_common_set).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.robotis_openCM70_aux_led_module=function(b,a){var c=a.getField("PORT",a),d=a.getField("LED_MODULE",a),e=Entry.Robotis_openCM70.INSTRUCTION.WRITE,f=0,g=0,f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[1];return Entry.Robotis_carCont.postCallReturn(a,[[e,f+(c-1)*g,g,d]],Entry.Robotis_openCM70.delay)}; +Entry.block.robotis_openCM70_aux_led_module=function(a,b){a=b.getField("PORT",b);var c=b.getField("LED_MODULE",b),d=Entry.Robotis_openCM70.INSTRUCTION.WRITE,e,f;e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[0];f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[1];return Entry.Robotis_carCont.postCallReturn(b,[[d,e+(a-1)*f,f,c]],Entry.Robotis_openCM70.delay)}; Blockly.Blocks.robotis_openCM70_aux_custom={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.robotis_common_port_3,"3"],[Lang.Blocks.robotis_common_port_4,"4"],[Lang.Blocks.robotis_common_port_5,"5"],[Lang.Blocks.robotis_common_port_6,"6"]]),"PORT").appendField(Lang.Blocks.robotis_openCM70_aux_custom_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.robotis_common_set).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.robotis_openCM70_aux_custom=function(b,a){var c=a.getField("PORT",a),d=a.getNumberValue("VALUE"),e=Entry.Robotis_openCM70.INSTRUCTION.WRITE,f=0,g=0,f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1];return Entry.Robotis_carCont.postCallReturn(a,[[e,f+(c-1)*g,g,d]],Entry.Robotis_openCM70.delay)}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.robotis_openCM70_aux_custom=function(a,b){a=b.getField("PORT",b);var c=b.getNumberValue("VALUE"),d=Entry.Robotis_openCM70.INSTRUCTION.WRITE,e,f;e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0];f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1];return Entry.Robotis_carCont.postCallReturn(b,[[d,e+(a-1)*f,f,c]],Entry.Robotis_openCM70.delay)}; Blockly.Blocks.robotis_openCM70_cm_custom={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.robotis_cm_custom);this.appendDummyInput().appendField("(");this.appendValueInput("ADDRESS").setCheck(["Number","String"]);this.appendDummyInput().appendField(")");this.appendDummyInput().appendField(Lang.Blocks.robotis_common_case_01);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.robotis_common_set).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.robotis_openCM70_cm_custom=function(b,a){var c=Entry.Robotis_openCM70.INSTRUCTION.WRITE,d=0,e=0,d=a.getNumberValue("ADDRESS"),e=a.getNumberValue("VALUE");return Entry.Robotis_carCont.postCallReturn(a,[[c,d,65535c&&(c=0);createjs.Sound.setVolume(c);return a.callReturn()}; +Entry.block.sound_volume_change=function(a,b){a=b.getNumberValue("VALUE",b)/100;a+=createjs.Sound.getVolume();1a&&(a=0);createjs.Sound.setVolume(a);return b.callReturn()}; Blockly.Blocks.sound_volume_set={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_volume_set_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_volume_set_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; -Entry.block.sound_volume_set=function(b,a){var c=a.getNumberValue("VALUE",a)/100;1c&&(c=0);createjs.Sound.setVolume(c);return a.callReturn()};Blockly.Blocks.sound_silent_all={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_silent_all).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; -Entry.block.sound_silent_all=function(b,a){createjs.Sound.stop();return a.callReturn()};Blockly.Blocks.get_sounds={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField("");this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("sounds"),"VALUE");this.appendDummyInput().appendField(" ");this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.get_sounds=function(b,a){return a.getStringField("VALUE")}; +Entry.block.sound_volume_set=function(a,b){a=b.getNumberValue("VALUE",b)/100;1a&&(a=0);createjs.Sound.setVolume(a);return b.callReturn()};Blockly.Blocks.sound_silent_all={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_silent_all).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; +Entry.block.sound_silent_all=function(a,b){createjs.Sound.stop();return b.callReturn()};Blockly.Blocks.get_sounds={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField("");this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("sounds"),"VALUE");this.appendDummyInput().appendField(" ");this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.get_sounds=function(a,b){return b.getStringField("VALUE")}; Blockly.Blocks.sound_something_with_block={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_1);this.appendValueInput("VALUE").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; -Entry.block.sound_something_with_block=function(b,a){var c=a.getStringValue("VALUE",a);(c=b.parent.getSound(c))&&createjs.Sound.play(c.id);return a.callReturn()}; +Entry.block.sound_something_with_block=function(a,b){var c=b.getStringValue("VALUE",b);(a=a.parent.getSound(c))&&createjs.Sound.play(a.id);return b.callReturn()}; Blockly.Blocks.sound_something_second_with_block={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_second_1);this.appendValueInput("VALUE").setCheck(["String","Number"]);this.appendDummyInput().appendField(" ").appendField(Lang.Blocks.SOUND_sound_something_second_2);this.appendValueInput("SECOND").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_second_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}};Entry.block.sound_something_second_with_block=function(b,a){var c=a.getStringValue("VALUE",a),d=a.getNumberValue("SECOND",a);(c=b.parent.getSound(c))&&createjs.Sound.play(c.id,{startTime:0,duration:1E3*d});return a.callReturn()}; +"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}};Entry.block.sound_something_second_with_block=function(a,b){var c=b.getStringValue("VALUE",b),d=b.getNumberValue("SECOND",b);(a=a.parent.getSound(c))&&createjs.Sound.play(a.id,{startTime:0,duration:1E3*d});return b.callReturn()}; Blockly.Blocks.sound_something_wait_with_block={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_wait_1);this.appendValueInput("VALUE").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_wait_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; -Entry.block.sound_something_wait_with_block=function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.playState;delete a.isPlay;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(c=b.parent.getSound(c))createjs.Sound.play(c.id),setTimeout(function(){a.playState=0},1E3*c.duration);return a}; +Entry.block.sound_something_wait_with_block=function(a,b){if(b.isPlay){if(1==b.playState)return b;delete b.playState;delete b.isPlay;return b.callReturn()}b.isPlay=!0;b.playState=1;var c=b.getStringValue("VALUE",b);if(a=a.parent.getSound(c))createjs.Sound.play(a.id),setTimeout(function(){b.playState=0},1E3*a.duration);return b}; Blockly.Blocks.sound_something_second_wait_with_block={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_second_wait_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_second_wait_2).appendField(" ");this.appendValueInput("SECOND").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_second_wait_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ "block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; -Entry.block.sound_something_second_wait_with_block=function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.isPlay;delete a.playState;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(c=b.parent.getSound(c)){var d=createjs.Sound.play(c.id),c=a.getNumberValue("SECOND",a);setTimeout(function(){d.stop();a.playState=0},1E3*c);d.addEventListener("complete",function(a){})}return a}; +Entry.block.sound_something_second_wait_with_block=function(a,b){if(b.isPlay){if(1==b.playState)return b;delete b.isPlay;delete b.playState;return b.callReturn()}b.isPlay=!0;b.playState=1;var c=b.getStringValue("VALUE",b);if(a=a.parent.getSound(c)){var d=createjs.Sound.play(a.id);a=b.getNumberValue("SECOND",b);setTimeout(function(){d.stop();b.playState=0},1E3*a);d.addEventListener("complete",function(b){})}return b}; Blockly.Blocks.sound_from_to={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_2);this.appendValueInput("START").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_3);this.appendValueInput("END").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}};Entry.block.sound_from_to=function(b,a){var c=a.getStringValue("VALUE",a);if(c=b.parent.getSound(c)){var d=1E3*a.getNumberValue("START",a),e=1E3*a.getNumberValue("END",a);createjs.Sound.play(c.id,{startTime:Math.min(d,e),duration:Math.max(d,e)-Math.min(d,e)})}return a.callReturn()}; +"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}};Entry.block.sound_from_to=function(a,b){var c=b.getStringValue("VALUE",b);if(a=a.parent.getSound(c)){var c=1E3*b.getNumberValue("START",b),d=1E3*b.getNumberValue("END",b);createjs.Sound.play(a.id,{startTime:Math.min(c,d),duration:Math.max(c,d)-Math.min(c,d)})}return b.callReturn()}; Blockly.Blocks.sound_from_to_and_wait={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_and_wait_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_and_wait_2);this.appendValueInput("START").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_and_wait_3);this.appendValueInput("END").setCheck(["String","Number"]); this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_and_wait_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; -Entry.block.sound_from_to_and_wait=function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.isPlay;delete a.playState;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(c=b.parent.getSound(c)){var d=1E3*a.getNumberValue("START",a),e=1E3*a.getNumberValue("END",a),f=Math.min(d,e),d=Math.max(d,e)-f;createjs.Sound.play(c.id,{startTime:f,duration:d});setTimeout(function(){a.playState=0},d)}return a};Blockly.Blocks.when_run_button_click={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_play.png","*","start")).appendField(Lang.Blocks.START_when_run_button_click);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_run_button_click=function(b,a){return a.callReturn()}; +Entry.block.sound_from_to_and_wait=function(a,b){if(b.isPlay){if(1==b.playState)return b;delete b.isPlay;delete b.playState;return b.callReturn()}b.isPlay=!0;b.playState=1;var c=b.getStringValue("VALUE",b);if(a=a.parent.getSound(c)){var d=1E3*b.getNumberValue("START",b),e=1E3*b.getNumberValue("END",b),c=Math.min(d,e),d=Math.max(d,e)-c;createjs.Sound.play(a.id,{startTime:c,duration:d});setTimeout(function(){b.playState=0},d)}return b};Blockly.Blocks.when_run_button_click={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_play.png","*","start")).appendField(Lang.Blocks.START_when_run_button_click);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_run_button_click=function(a,b){return b.callReturn()}; Blockly.Blocks.press_some_key={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_keyboard.png","*","start")).appendField(Lang.Blocks.START_press_some_key_1).appendField(new Blockly.FieldDropdown([["q","81"],["w","87"],["e","69"],["r","82"],["a","65"],["s","83"],["d","68"],[Lang.Blocks.START_press_some_key_up,"38"],[Lang.Blocks.START_press_some_key_down,"40"],[Lang.Blocks.START_press_some_key_left,"37"],[Lang.Blocks.START_press_some_key_right, -"39"],[Lang.Blocks.START_press_some_key_enter,"13"],[Lang.Blocks.START_press_some_key_space,"32"]]),"VALUE").appendField(Lang.Blocks.START_press_some_key_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.press_some_key=function(b,a){return a.callReturn()}; -Blockly.Blocks.when_some_key_pressed={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_keyboard.png","*","start")).appendField(Lang.Blocks.START_press_some_key_1).appendField(new Blockly.FieldKeydownInput("81"),"VALUE").appendField(Lang.Blocks.START_press_some_key_2);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_some_key_pressed=function(b,a){return a.callReturn()}; -Blockly.Blocks.mouse_clicked={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_mouse.png","*","start")).appendField(Lang.Blocks.START_mouse_clicked);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.mouse_clicked=function(b,a){return a.callReturn()}; -Blockly.Blocks.mouse_click_cancled={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_mouse.png","*","start")).appendField(Lang.Blocks.START_mouse_click_cancled);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.mouse_click_cancled=function(b,a){return a.callReturn()}; -Blockly.Blocks.when_object_click={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_mouse.png","*","start")).appendField(Lang.Blocks.START_when_object_click);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_object_click=function(b,a){return a.callReturn()}; -Blockly.Blocks.when_object_click_canceled={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_mouse.png","*","start")).appendField(Lang.Blocks.START_when_object_click_canceled);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_object_click_canceled=function(b,a){return a.callReturn()}; -Blockly.Blocks.when_some_key_click={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_keyboard.png","*","start")).appendField(Lang.Blocks.START_when_some_key_click);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_some_key_click=function(b,a){return a.callReturn()}; -Blockly.Blocks.when_message_cast={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_signal.png","*","start")).appendField(Lang.Blocks.START_when_message_cast_1).appendField(new Blockly.FieldDropdownDynamic("messages"),"VALUE").appendField(Lang.Blocks.START_when_message_cast_2);this.setInputsInline(!0);this.setNextStatement(!0)},whenAdd:function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs",b)}, -whenRemove:function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}};Entry.block.when_message_cast=function(b,a){return a.callReturn()}; -Blockly.Blocks.message_cast={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(Lang.Blocks.START_message_cast_1).appendField(new Blockly.FieldDropdownDynamic("messages"),"VALUE").appendField(Lang.Blocks.START_message_cast_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_03.png","*"));this.setInputsInline(!0);this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)},whenAdd:function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs", -b)},whenRemove:function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}};Entry.block.message_cast=function(b,a){var c=a.getField("VALUE",a),d=Entry.isExist(c,"id",Entry.variableContainer.messages_);if("null"==c||!d)throw Error("value can not be null or undefined");Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent,["when_message_cast",c]);return a.callReturn()}; -Blockly.Blocks.message_cast_wait={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(Lang.Blocks.START_message_send_wait_1).appendField(new Blockly.FieldDropdownDynamic("messages"),"VALUE").appendField(Lang.Blocks.START_message_send_wait_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)},whenAdd:function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs", -b)},whenRemove:function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}}; -Entry.block.message_cast_wait=function(b,a){if(a.runningScript){for(var c=a.runningScript,d=c.length,e=0;ec.array_.length)throw Error("can not remove value from array");c.array_.splice(d-1,1);c.updateView();return a.callReturn()}; +"block_icon/variable_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.remove_value_from_list=function(a,b){var c=b.getField("LIST",b),d=b.getValue("VALUE",b);a=Entry.variableContainer.getList(c,a);if(!a.array_||isNaN(d)||d>a.array_.length)throw Error("can not remove value from array");a.array_.splice(d-1,1);a.updateView();return b.callReturn()}; Blockly.Blocks.insert_value_to_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_insert_value_to_list_1);this.appendValueInput("DATA").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_insert_value_to_list_2);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_insert_value_to_list_3);this.appendValueInput("INDEX").setCheck(["Number", "String"]);this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_insert_value_to_list_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/variable_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.insert_value_to_list=function(b,a){var c=a.getField("LIST",a),d=a.getValue("DATA",a),e=a.getValue("INDEX",a),c=Entry.variableContainer.getList(c,b);if(!c.array_||isNaN(e)||0==e||e>c.array_.length+1)throw Error("can not insert value to array");c.array_.splice(e-1,0,{data:d});c.updateView();return a.callReturn()}; +Entry.block.insert_value_to_list=function(a,b){var c=b.getField("LIST",b),d=b.getValue("DATA",b),e=b.getValue("INDEX",b);a=Entry.variableContainer.getList(c,a);if(!a.array_||isNaN(e)||0==e||e>a.array_.length+1)throw Error("can not insert value to array");a.array_.splice(e-1,0,{data:d});a.updateView();return b.callReturn()}; Blockly.Blocks.change_value_list_index={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_change_value_list_index_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_change_value_list_index_2);this.appendValueInput("INDEX").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_change_value_list_index_3);this.appendValueInput("DATA").setCheck(["Number", "String"]);this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_change_value_list_index_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/variable_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_value_list_index=function(b,a){var c=a.getField("LIST",a),d=a.getValue("DATA",a),e=a.getValue("INDEX",a),c=Entry.variableContainer.getList(c,b);if(!c.array_||isNaN(e)||e>c.array_.length)throw Error("can not insert value to array");c.array_[e-1].data=d;c.updateView();return a.callReturn()}; +Entry.block.change_value_list_index=function(a,b){var c=b.getField("LIST",b),d=b.getValue("DATA",b),e=b.getValue("INDEX",b);a=Entry.variableContainer.getList(c,a);if(!a.array_||isNaN(e)||e>a.array_.length)throw Error("can not insert value to array");a.array_[e-1].data=d;a.updateView();return b.callReturn()}; Blockly.Blocks.value_of_index_from_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_value_of_index_from_list_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_value_of_index_from_list_2);this.appendValueInput("INDEX").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_value_of_index_from_list_3);this.setOutput(!0, -"String");this.setInputsInline(!0)}};Entry.block.value_of_index_from_list=function(b,a){var c=a.getField("LIST",a),d=a.getValue("INDEX",a),c=Entry.variableContainer.getList(c,b),d=Entry.getListRealIndex(d,c);if(!c.array_||isNaN(d)||d>c.array_.length)throw Error("can not insert value to array");return c.array_[d-1].data}; -Blockly.Blocks.length_of_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_length_of_list_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_length_of_list_2);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.length_of_list=function(b,a){var c=a.getField("LIST",a);return Entry.variableContainer.getList(c).array_.length}; +"String");this.setInputsInline(!0)}};Entry.block.value_of_index_from_list=function(a,b){var c=b.getField("LIST",b);b=b.getValue("INDEX",b);a=Entry.variableContainer.getList(c,a);b=Entry.getListRealIndex(b,a);if(!a.array_||isNaN(b)||b>a.array_.length)throw Error("can not insert value to array");return a.array_[b-1].data}; +Blockly.Blocks.length_of_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_length_of_list_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_length_of_list_2);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.length_of_list=function(a,b){a=b.getField("LIST",b);return Entry.variableContainer.getList(a).array_.length}; Blockly.Blocks.show_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_show_list_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST").appendField(Lang.Blocks.VARIABLE_show_list_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/variable_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.show_list=function(b,a){var c=a.getField("LIST",a);Entry.variableContainer.getList(c).setVisible(!0);return a.callReturn()}; +Entry.block.show_list=function(a,b){a=b.getField("LIST",b);Entry.variableContainer.getList(a).setVisible(!0);return b.callReturn()}; Blockly.Blocks.hide_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_hide_list_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST").appendField(Lang.Blocks.VARIABLE_hide_list_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/variable_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.hide_list=function(b,a){var c=a.getField("LIST",a);Entry.variableContainer.getList(c).setVisible(!1);return a.callReturn()}; +Entry.block.hide_list=function(a,b){a=b.getField("LIST",b);Entry.variableContainer.getList(a).setVisible(!1);return b.callReturn()}; Blockly.Blocks.options_for_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField("");this.appendDummyInput("VALUE").appendField(new Blockly.FieldDropdown([[Lang.Blocks.VARIABLE_list_option_first,"FIRST"],[Lang.Blocks.VARIABLE_list_option_last,"LAST"],[Lang.Blocks.VARIABLE_list_option_random,"RANDOM"]]),"OPERATOR");this.appendDummyInput().appendField(" ");this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.options_for_list=function(b,a){return a.getField("OPERATOR",a)}; +Entry.block.options_for_list=function(a,b){return b.getField("OPERATOR",b)}; Blockly.Blocks.set_visible_answer={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_get_canvas_input_value);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.CALC_timer_visible_show,"SHOW"],[Lang.Blocks.CALC_timer_visible_hide,"HIDE"]]),"BOOL");this.appendDummyInput().appendField("").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/variable_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0); -this.setNextStatement(!0)},whenAdd:function(){Entry.container&&Entry.container.showProjectAnswer()},whenRemove:function(b){Entry.container&&Entry.container.hideProjectAnswer(b)}};Entry.block.set_visible_answer=function(b,a){"HIDE"==a.getField("BOOL",a)?Entry.container.inputValue.setVisible(!1):Entry.container.inputValue.setVisible(!0);return a.callReturn()}; +this.setNextStatement(!0)},whenAdd:function(){Entry.container&&Entry.container.showProjectAnswer()},whenRemove:function(a){Entry.container&&Entry.container.hideProjectAnswer(a)}};Entry.block.set_visible_answer=function(a,b){"HIDE"==b.getField("BOOL",b)?Entry.container.inputValue.setVisible(!1):Entry.container.inputValue.setVisible(!0);return b.callReturn()}; Blockly.Blocks.is_included_in_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_is_included_in_list_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_is_included_in_list_2);this.appendValueInput("DATA").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_is_included_in_list_3);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; -Entry.block.is_included_in_list=function(b,a){var c=a.getField("LIST",a),d=a.getStringValue("DATA",a),c=Entry.variableContainer.getList(c);if(!c)return!1;for(var c=c.array_,e=0,f=c.length;eb||0>d||b>e||d>e||a.splice.call(this,d,0,a.splice.call(this,b,1)[0])};b.sort=function(){};b.fromJSON=function(){};b.toJSON=function(){for(var a=[],b=0,e=this.length;b/,d;d=b instanceof HTMLElement?$(b):b instanceof jQuery?b:c.test(b)?$(b):$("<"+b+">");if(void 0===a)return d;a.id&&d.attr("id",a.id);a.class&&d.addClass(a.class);a.classes&&a.classes.map(function(a){d.addClass(a)});a.src&&d.attr("src",a.src);a.parent&&a.parent.append(d);d.bindOnClick=function(){var a,b,c=function(a){a.stopImmediatePropagation();a.handled||(a.handled=!0,b.call(this,a))};1b.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= +this.setNextStatement(!0)}};Entry.block.xbot_lcd=function(a,b){a=Entry.hw.sendQueue;var c=b.getNumberField("LINE",b),d=b.getStringValue("VALUE",b);0==c?(a.lcdNum=0,a.lcdTxt=d):1==c&&(a.lcdNum=1,a.lcdTxt=d);return b.callReturn()};Entry.Collection=function(a){this.length=0;this._hashMap={};this._observers=[];this.set(a)}; +(function(a,b){a.set=function(a){for(;this.length;)b.pop.call(this);var d=this._hashMap,e;for(e in d)delete d[e];if(void 0!==a){e=0;for(var f=a.length;ea||0>d||a>e||d>e||b.splice.call(this,d,0,b.splice.call(this,a,1)[0])};a.sort=function(){};a.fromJSON=function(){};a.toJSON=function(){for(var b=[],a=0,e=this.length;a=b.x&&e-c<=b.y&&e+a.height+c>=b.y}; +Entry.Utils.colorDarken=function(a,b){function c(b){2!=b.length&&(b="0"+b);return b}var d,e;7===a.length?(d=parseInt(a.substr(1,2),16),e=parseInt(a.substr(3,2),16),a=parseInt(a.substr(5,2),16)):(d=parseInt(a.substr(1,2),16),e=parseInt(a.substr(2,2),16),a=parseInt(a.substr(3,2),16));b=void 0===b?.7:b;d=c(Math.floor(d*b).toString(16));e=c(Math.floor(e*b).toString(16));a=c(Math.floor(a*b).toString(16));return"#"+d+e+a}; +Entry.Utils.colorLighten=function(a,b){b=0===b?0:b||20;a=Entry.Utils.hexToHsl(a);a.l+=b/100;a.l=Math.min(1,Math.max(0,a.l));return Entry.Utils.hslToHex(a)};Entry.Utils.bound01=function(a,b){var c=a;"string"==typeof c&&-1!=c.indexOf(".")&&1===parseFloat(c)&&(a="100%");c="string"===typeof a&&-1!=a.indexOf("%");a=Math.min(b,Math.max(0,parseFloat(a)));c&&(a=parseInt(a*b,10)/100);return 1E-6>Math.abs(a-b)?1:a%b/parseFloat(b)}; +Entry.Utils.hexToHsl=function(a){var b,c;7===a.length?(b=parseInt(a.substr(1,2),16),c=parseInt(a.substr(3,2),16),a=parseInt(a.substr(5,2),16)):(b=parseInt(a.substr(1,2),16),c=parseInt(a.substr(2,2),16),a=parseInt(a.substr(3,2),16));b=Entry.Utils.bound01(b,255);c=Entry.Utils.bound01(c,255);a=Entry.Utils.bound01(a,255);var d=Math.max(b,c,a),e=Math.min(b,c,a),f,g=(d+e)/2;if(d==e)f=e=0;else{var h=d-e,e=.5c&&(c+=1);1c?a:c<2/3?b+(a-b)*(2/3-c)*6:b}function c(b){return 1==b.length?"0"+b:""+b}var d,e;e=Entry.Utils.bound01(a.h,360);d=Entry.Utils.bound01(a.s,1);a=Entry.Utils.bound01(a.l,1);if(0===d)d=a=e=a;else{var f=.5>a?a*(1+d):a+d-a*d,g=2*a-f;d=b(g,f,e+1/3);a=b(g,f,e);e=b(g,f,e-1/3)}a*=255;e*=255;return"#"+[c(Math.round(255*d).toString(16)),c(Math.round(a).toString(16)),c(Math.round(e).toString(16))].join("")}; +Entry.Utils.bindGlobalEvent=function(a){var b=$(document);void 0===a&&(a="resize mousedown mousemove keydown keyup dispose".split(" "));-1Entry.pressedKeys.indexOf(a)&&Entry.pressedKeys.push(a);Entry.keyPressed.notify(b)}));-1$1://$2").replace(/([xA1-xFEa-z0-9_-]+@[xA1-xFEa-z0-9-]+.[a-z0-9-]+)/gi,"$1"):""};Entry.generateHash=function(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).substr(-4)}; +Entry.addEventListener=function(a,b){this.events_||(this.events_={});this.events_[a]||(this.events_[a]=[]);b instanceof Function&&this.events_[a].push(b);return!0};Entry.dispatchEvent=function(a,b){this.events_||(this.events_={});if(this.events_[a])for(var c=0,d=this.events_[a].length;c=f?(parseFloat(a)+parseFloat(b)).toFixed(e):(parseFloat(a)+parseFloat(b)).toFixed(f):parseInt(a)+parseInt(b)}; +Entry.hex2rgb=function(a){return(a=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a))?{r:parseInt(a[1],16),g:parseInt(a[2],16),b:parseInt(a[3],16)}:null};Entry.rgb2hex=function(a,b,c){return"#"+(16777216+(a<<16)+(b<<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(a,b,c){return a>c?c:ab.y+b.height||a.x+a.widthb.x+b.width)};Entry.bindAnimationCallback=function(a,b){a.addEventListener("webkitAnimationEnd",b,!1);a.addEventListener("animationend",b,!1);a.addEventListener("oanimationend",b,!1)};Entry.cloneSimpleObject=function(a){var b={},c;for(c in a)b[c]=a[c];return b};Entry.nodeListToArray=function(a){for(var b=Array(a.length),c=-1,d=a.length;++c!==d;b[c]=a[c]);return b}; +Entry.computeInputWidth=function(a){var b=document.createElement("span");b.className="tmp-element";b.innerHTML=a.replace(/&/g,"&").replace(//g,">");document.body.appendChild(b);a=b.offsetWidth;document.body.removeChild(b);return Number(a+10)+"px"};Entry.isArrowOrBackspace=function(a){return-1<[37,38,39,40,8].indexOf(a)};Entry.hexStringToBin=function(a){for(var b=[],c=0;cd&&(d=h.index)}return 0b&&(b=e))}return Math.min(b,20)};Entry.convertToRoundedDecimals=function(a,b){return isNaN(a)||!this.isFloat(a)?a:Number(Math.round(a+"e"+b)+"e-"+b)};Entry.attachEventListener=function(a,b,c){setTimeout(function(){a.addEventListener(b,c)},0)};Entry.deAttachEventListener=function(a,b,c){a.removeEventListener(b,c)}; +Entry.isEmpty=function(a){if(!a)return!0;for(var b in a)if(a.hasOwnProperty(b))return!1;return!0};Entry.Utils.disableContextmenu=function(a){if(a)$(a).on("contextmenu",function(b){b.stopPropagation();b.preventDefault();return!1})};Entry.Utils.isRightButton=function(a){return 2==a.button||a.ctrlKey};Entry.Utils.isTouchEvent=function(a){return"mousedown"!==a.type.toLowerCase()};Entry.Utils.inherit=function(a,b){function c(){}c.prototype=a.prototype;b.prototype=new c;return b}; +Entry.bindAnimationCallbackOnce=function(a,b){a.one("webkitAnimationEnd animationendo animationend",b)};Entry.Utils.isInInput=function(a){return"textarea"==a.target.type||"text"==a.target.type};Entry.Utils.isFunction=function(a){return"function"===typeof a}; +Entry.Utils.addFilters=function(a,b){a=a.elem("defs");var c=a.elem("filter",{id:"entryTrashcanFilter_"+b});c.elem("feGaussianBlur",{"in":"SourceAlpha",stdDeviation:2,result:"blur"});c.elem("feOffset",{"in":"blur",dx:1,dy:1,result:"offsetBlur"});c=c.elem("feMerge");c.elem("feMergeNode",{"in":"offsetBlur"});c.elem("feMergeNode",{"in":"SourceGraphic"},c);c=a.elem("filter",{id:"entryBlockShadowFilter_"+b,height:"200%"});c.elem("feOffset",{result:"offOut",in:"SourceGraphic",dx:0,dy:1});c.elem("feColorMatrix", +{result:"matrixOut",in:"offOut",type:"matrix",values:"0.7 0 0 0 0 0 0.7 0 0 0 0 0 0.7 0 0 0 0 0 1 0"});c.elem("feBlend",{in:"SourceGraphic",in1:"offOut",mode:"normal"});b=a.elem("filter",{id:"entryBlockHighlightFilter_"+b});b.elem("feOffset",{result:"offOut",in:"SourceGraphic",dx:0,dy:0});b.elem("feColorMatrix",{result:"matrixOut",in:"offOut",type:"matrix",values:"1.3 0 0 0 0 0 1.3 0 0 0 0 0 1.3 0 0 0 0 0 1 0"})}; +Entry.Utils.addBlockPattern=function(a,b){a=a.elem("pattern",{id:"blockHoverPattern_"+b,class:"blockHoverPattern",patternUnits:"userSpaceOnUse",patternTransform:"translate(12, 0)",x:0,y:0,width:125,height:33,style:"display: none"});b=a.elem("g");for(var c=b.elem("rect",{x:0,y:0,width:125,height:33}),d=Entry.mediaFilePath+"block_pattern_(order).png",e=1;5>e;e++)b.elem("image",{class:"pattern"+e,href:d.replace("(order)",e),x:0,y:0,width:125,height:33});return{pattern:a,rect:c}}; +Entry.Utils.COLLISION={NONE:0,UP:1,RIGHT:2,LEFT:3,DOWN:4};Entry.Utils.createMouseEvent=function(a,b){var c=document.createEvent("MouseEvent");c.initMouseEvent(a,!0,!0,window,0,0,0,b.clientX,b.clientY,!1,!1,!1,!1,0,null);return c};Entry.Utils.xmlToJsonData=function(a){a=$.parseXML(a);var b=[];a=a.childNodes[0].childNodes;for(var c in a){var d=a[c];if(d.tagName){var e={category:d.getAttribute("id"),blocks:[]},d=d.childNodes;for(c in d){var f=d[c];f.tagName&&(f=f.getAttribute("type"))&&e.blocks.push(f)}b.push(e)}}return b}; +Entry.Utils.stopProjectWithToast=function(a,b,c){var d=a.block;b=b||"\ub7f0\ud0c0\uc784 \uc5d0\ub7ec \ubc1c\uc0dd";Entry.toast&&!c&&Entry.toast.alert(Lang.Msgs.warn,Lang.Workspace.check_runtime_error,!0);Entry.engine&&Entry.engine.toggleStop();"workspace"===Entry.type&&(a.block&&"funcBlock"in a.block?d=a.block.funcBlock:a.funcExecutor&&(d=a.funcExecutor.scope.block,a=a.type.replace("func_",""),Entry.Func.edit(Entry.variableContainer.functions_[a])),d&&(Entry.container.selectObject(d.getCode().object.id, +!0),d.view.getBoard().activateBlock(d)));throw Error(b);};Entry.Utils.AsyncError=function(a){this.name="AsyncError";this.message=a||"\ube44\ub3d9\uae30 \ud638\ucd9c \ub300\uae30"};Entry.Utils.AsyncError.prototype=Error();Entry.Utils.AsyncError.prototype.constructor=Entry.Utils.AsyncError;Entry.Utils.isChrome=function(){return/chrom(e|ium)/.test(navigator.userAgent.toLowerCase())}; +Entry.Utils.waitForWebfonts=function(a,b){for(var c=0,d=0,e=a.length;d=a.length&&(l&&clearInterval(l),c==a.length))return b(),!0}var h=document.createElement("span");h.innerHTML="giItT1WQy@!-/#";h.style.position="absolute";h.style.left="-10000px";h.style.top="-10000px";h.style.fontSize="300px";h.style.fontFamily="sans-serif";h.style.fontVariant="normal";h.style.fontStyle="normal";h.style.fontWeight= +"normal";h.style.letterSpacing="0";document.body.appendChild(h);var k=h.offsetWidth;h.style.fontFamily=d;var l;e()||(l=setInterval(e,50))})(a[d])};window.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(a){window.setTimeout(a,1E3/60)}}();Entry.Model=function(a,b){var c=Entry.Model;c.generateSchema(a);c.generateSetter(a);c.generateObserve(a);(void 0===b||b)&&Object.seal(a);return a}; +(function(a){a.generateSchema=function(b){var a=b.schema;if(void 0!==a){a=JSON.parse(JSON.stringify(a));b.data={};for(var d in a)(function(d){b.data[d]=a[d];Object.defineProperty(b,d,{get:function(){return b.data[d]}})})(d);b._toJSON=this._toJSON}};a.generateSetter=function(b){b.set=this.set};a.set=function(b,a){var d={},e;for(e in this.data)void 0!==b[e]&&(b[e]===this.data[e]?delete b[e]:(d[e]=this.data[e],this.data[e]=b[e]instanceof Array?b[e].concat():b[e]));a||this.notify(Object.keys(b),d)};a.generateObserve= +function(b){b.observers=[];b.observe=this.observe;b.unobserve=this.unobserve;b.notify=this.notify};a.observe=function(b,a,d,e){d=new Entry.Observer(this.observers,b,a,d);if(!1!==e)b[a]([]);return d};a.unobserve=function(b){b.destroy()};a.notify=function(b,a){"string"===typeof b&&(b=[b]);var d=this;d.observers.map(function(e){var f=b;void 0!==e.attrs&&(f=Entry.Utils.intersectArray(e.attrs,b));if(f.length)e.object[e.funcName](f.map(function(b){return{name:b,object:d,oldValue:a[b]}}))})};a._toJSON=function(){var b= +{},a;for(a in this.data)b[a]=this.data[a];return b}})(Entry.Model);Entry.Observer=function(a,b,c,d){this.parent=a;this.object=b;this.funcName=c;this.attrs=d;a.push(this)};(function(a){a.destroy=function(){var b=this.parent,a=b.indexOf(this);-1/,d;d=a instanceof HTMLElement?$(a):a instanceof jQuery?a:c.test(a)?$(a):$("<"+a+">");if(void 0===b)return d;b.id&&d.attr("id",b.id);b.class&&d.addClass(b.class);b.classes&&b.classes.map(function(b){d.addClass(b)});b.src&&d.attr("src",b.src);b.parent&&b.parent.append(d);d.bindOnClick=function(){var b,a,c=function(b){b.stopImmediatePropagation();b.handled||(b.handled=!0,a.call(this,b))};1a.x+a.width+this.width?(this.object.x=a.x+a.width+this.width/2,b+="e"):(this.object.x=a.x-this.width/2,b+="w");this.notch.type!=b&&(this.object.removeChild(this.notch),this.notch=this.createSpeakNotch(b),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.requestUpdate=!0};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()||-1c;c++)(function(c){var e=Entry.createElement("td","progressCell"+c);e.bindOnClick(function(){Entry.engine.setSpeedMeter(a[c])});b.appendChild(e)})(c);this.view_.insertBefore(this.speedProgress_,this.maximizeButton);this.speedProgress_.appendChild(b);this.speedHandle_=Entry.createElement("div","entrySpeedHandleWorkspace");c=(Entry.interfaceState.canvasWidth-84)/5;$(this.speedHandle_).draggable({axis:"x",grid:[c,c],containment:[80,0,4*c+80,0],drag:function(a,b){var c=(b.position.left-80)/(Entry.interfaceState.canvasWidth- -84)*5,c=Math.floor(c);0>c||Entry.engine.setSpeedMeter(Entry.engine.speeds[c])}});this.view_.insertBefore(this.speedHandle_,this.maximizeButton);this.setSpeedMeter(Entry.FPS)}}; -Entry.Engine.prototype.setSpeedMeter=function(b){var a=this.speeds.indexOf(b);0>a||(a=Math.min(4,a),a=Math.max(0,a),this.speedPanelOn&&(this.speedHandle_.style.left=(Entry.interfaceState.canvasWidth-80)/10*(2*a+1)+80-9+"px"),Entry.FPS!=b&&(clearInterval(this.ticker),this.ticker=setInterval(this.update,Math.floor(1E3/b)),Entry.FPS=b))};Entry.Engine.prototype.start=function(b){createjs.Ticker.setFPS(Entry.FPS);this.ticker=setInterval(this.update,Math.floor(1E3/Entry.FPS))}; -Entry.Engine.prototype.stop=function(){clearInterval(this.ticker);this.ticker=null};Entry.Engine.prototype.update=function(){Entry.engine.isState("run")&&(Entry.engine.computeObjects(),Entry.hw.update())};Entry.Engine.prototype.computeObjects=function(){Entry.container.mapObjectOnScene(this.computeFunction)};Entry.Engine.prototype.computeFunction=function(b){b.script.tick()}; -Entry.Engine.computeThread=function(b,a){Entry.engine.isContinue=!0;for(var c=!1;a&&Entry.engine.isContinue&&!c;){Entry.engine.isContinue=!a.isRepeat;var d=a.run(),c=d&&d===a;a=d}return a};Entry.Engine.prototype.isState=function(b){return-1c;c++)(function(c){var e=Entry.createElement("td","progressCell"+c);e.bindOnClick(function(){Entry.engine.setSpeedMeter(b[c])});a.appendChild(e)})(c);this.view_.insertBefore(this.speedProgress_,this.maximizeButton);this.speedProgress_.appendChild(a);this.speedHandle_=Entry.createElement("div","entrySpeedHandleWorkspace");c=(Entry.interfaceState.canvasWidth-84)/5;$(this.speedHandle_).draggable({axis:"x",grid:[c,c],containment:[80,0,4*c+80,0],drag:function(b,a){b=(a.position.left-80)/(Entry.interfaceState.canvasWidth- +84)*5;b=Math.floor(b);0>b||Entry.engine.setSpeedMeter(Entry.engine.speeds[b])}});this.view_.insertBefore(this.speedHandle_,this.maximizeButton);this.setSpeedMeter(Entry.FPS)}}; +Entry.Engine.prototype.setSpeedMeter=function(a){var b=this.speeds.indexOf(a);0>b||(b=Math.min(4,b),b=Math.max(0,b),this.speedPanelOn&&(this.speedHandle_.style.left=(Entry.interfaceState.canvasWidth-80)/10*(2*b+1)+80-9+"px"),Entry.FPS!=a&&(clearInterval(this.ticker),this.ticker=setInterval(this.update,Math.floor(1E3/a)),Entry.FPS=a))};Entry.Engine.prototype.start=function(a){createjs.Ticker.setFPS(Entry.FPS);this.ticker=setInterval(this.update,Math.floor(1E3/Entry.FPS))}; +Entry.Engine.prototype.stop=function(){clearInterval(this.ticker);this.ticker=null};Entry.Engine.prototype.update=function(){Entry.engine.isState("run")&&(Entry.engine.computeObjects(),Entry.hw.update())};Entry.Engine.prototype.computeObjects=function(){Entry.container.mapObjectOnScene(this.computeFunction)};Entry.Engine.prototype.computeFunction=function(a){a.script.tick()}; +Entry.Engine.computeThread=function(a,b){Entry.engine.isContinue=!0;for(a=!1;b&&Entry.engine.isContinue&&!a;){Entry.engine.isContinue=!b.isRepeat;var c=b.run();a=c&&c===b;b=c}return b};Entry.Engine.prototype.isState=function(a){return-1=a&&Entry.stage.moveSprite(b)}; -Entry.Engine.prototype.raiseKeyEvent=function(b,a){return b.parent.script.raiseEvent(a[0],b,String(a[1]))};Entry.Engine.prototype.updateMouseView=function(){var b=Entry.stage.mouseCoordinate;this.mouseView.textContent="X : "+b.x+", Y : "+b.y;this.mouseView.removeClass("entryRemove")};Entry.Engine.prototype.hideMouseView=function(){this.mouseView.addClass("entryRemove")}; -Entry.Engine.prototype.toggleFullscreen=function(){if(this.popup)this.popup.remove(),this.popup=null;else{this.popup=new Entry.Popup;if("workspace"!=Entry.type){var b=$(document);$(this.popup.body_).css("top",b.scrollTop());$("body").css("overflow","hidden");popup.window_.appendChild(Entry.stage.canvas.canvas);popup.window_.appendChild(Entry.engine.runButton[0])}popup.window_.appendChild(Entry.engine.view_)}Entry.windowResized.notify()}; +Entry.Engine.prototype.togglePause=function(){var a=Entry.engine.projectTimer;"pause"==this.state?(a.pausedTime+=(new Date).getTime()-a.pauseStart,a.isPaused?a.pauseStart=(new Date).getTime():delete a.pauseStart,this.state="run",this.pauseButton.innerHTML=Lang.Workspace.pause,this.runButton.addClass("entryRemove"),this.runButton2&&this.runButton2.addClass("entryRemove")):(this.state="pause",a.isPaused&&(a.pausedTime+=(new Date).getTime()-a.pauseStart),a.pauseStart=(new Date).getTime(),this.pauseButton.innerHTML= +Lang.Workspace.restart,this.runButton.removeClass("entryRemove"),this.stopButton.removeClass("entryRemove"),this.runButton2&&this.runButton2.removeClass("entryRemove"))};Entry.Engine.prototype.fireEvent=function(a){"run"==this.state&&Entry.container.mapEntityIncludeCloneOnScene(this.raiseEvent,a)};Entry.Engine.prototype.raiseEvent=function(a,b){a.parent.script.raiseEvent(b,a)}; +Entry.Engine.prototype.fireEventOnEntity=function(a,b){"run"==this.state&&Entry.container.mapEntityIncludeCloneOnScene(this.raiseEventOnEntity,[b,a])};Entry.Engine.prototype.raiseEventOnEntity=function(a,b){a===b[0]&&a.parent.script.raiseEvent(b[1],a)}; +Entry.Engine.prototype.captureKeyEvent=function(a){var b=a.keyCode,c=Entry.type;a.ctrlKey&&"workspace"==c?83==b?(a.preventDefault(),Entry.dispatchEvent("saveWorkspace")):82==b?(a.preventDefault(),Entry.engine.run()):90==b&&(a.preventDefault(),console.log("engine"),Entry.dispatchEvent(a.shiftKey?"redo":"undo")):Entry.engine.isState("run")&&Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent,["keyPress",b]);Entry.engine.isState("stop")&&"workspace"===c&&37<=b&&40>=b&&Entry.stage.moveSprite(a)}; +Entry.Engine.prototype.raiseKeyEvent=function(a,b){return a.parent.script.raiseEvent(b[0],a,String(b[1]))};Entry.Engine.prototype.updateMouseView=function(){var a=Entry.stage.mouseCoordinate;this.mouseView.textContent="X : "+a.x+", Y : "+a.y;this.mouseView.removeClass("entryRemove")};Entry.Engine.prototype.hideMouseView=function(){this.mouseView.addClass("entryRemove")}; +Entry.Engine.prototype.toggleFullscreen=function(){if(this.popup)this.popup.remove(),this.popup=null;else{this.popup=new Entry.Popup;if("workspace"!=Entry.type){var a=$(document);$(this.popup.body_).css("top",a.scrollTop());$("body").css("overflow","hidden");popup.window_.appendChild(Entry.stage.canvas.canvas);popup.window_.appendChild(Entry.engine.runButton[0])}popup.window_.appendChild(Entry.engine.view_)}Entry.windowResized.notify()}; Entry.Engine.prototype.exitFullScreen=function(){document.webkitIsFullScreen||document.mozIsFullScreen||document.isFullScreen||(Entry.engine.footerView_.removeClass("entryRemove"),Entry.engine.headerView_.removeClass("entryRemove"));Entry.windowResized.notify()};Entry.Engine.prototype.showProjectTimer=function(){Entry.engine.projectTimer&&this.projectTimer.setVisible(!0)}; -Entry.Engine.prototype.hideProjectTimer=function(){var b=this.projectTimer;if(b&&b.isVisible()&&!this.isState("run")){for(var a=Entry.container.getAllObjects(),c=["get_project_timer_value","reset_project_timer","set_visible_project_timer","choose_project_timer_action"],d=0,e=a.length;dthis.direction)==(0<=b&&180>b)||(this.setScaleX(-this.getScaleX()),Entry.stage.updateObject(),this.flip=!this.flip);this.direction=b.mod(360);this.object.direction=this.direction;this.isClone||this.parent.updateRotationView();Entry.dispatchEvent("updateObject");Entry.requestUpdate=!0}; -Entry.EntityObject.prototype.setRotation=function(b){"free"!=this.parent.getRotateMethod()&&(b=0);this.rotation=b.mod(360);this.object.rotation=this.rotation;this.updateDialog();this.isClone||this.parent.updateRotationView();Entry.dispatchEvent("updateObject");Entry.requestUpdate=!0};Entry.EntityObject.prototype.getRotation=function(){return this.rotation};Entry.EntityObject.prototype.setRegX=function(b){"textBox"==this.type&&(b=0);this.regX=b;this.object.regX=this.regX;Entry.requestUpdate=!0}; -Entry.EntityObject.prototype.getRegX=function(){return this.regX};Entry.EntityObject.prototype.setRegY=function(b){"textBox"==this.type&&(b=0);this.regY=b;this.object.regY=this.regY;Entry.requestUpdate=!0};Entry.EntityObject.prototype.getRegY=function(){return this.regY};Entry.EntityObject.prototype.setScaleX=function(b){this.scaleX=b;this.object.scaleX=this.scaleX;this.parent.updateCoordinateView();this.updateDialog();Entry.requestUpdate=!0};Entry.EntityObject.prototype.getScaleX=function(){return this.scaleX}; -Entry.EntityObject.prototype.setScaleY=function(b){this.scaleY=b;this.object.scaleY=this.scaleY;this.parent.updateCoordinateView();this.updateDialog();Entry.requestUpdate=!0};Entry.EntityObject.prototype.getScaleY=function(){return this.scaleY};Entry.EntityObject.prototype.setSize=function(b){1>b&&(b=1);b/=this.getSize();this.setScaleX(this.getScaleX()*b);this.setScaleY(this.getScaleY()*b);this.isClone||this.parent.updateCoordinateView();Entry.requestUpdate=!0}; -Entry.EntityObject.prototype.getSize=function(){return(this.getWidth()*Math.abs(this.getScaleX())+this.getHeight()*Math.abs(this.getScaleY()))/2};Entry.EntityObject.prototype.setWidth=function(b){this.width=b;this.object.width=this.width;this.textObject&&this.getLineBreak()&&(this.textObject.lineWidth=this.width);this.updateDialog();this.updateBG();Entry.requestUpdate=!0};Entry.EntityObject.prototype.getWidth=function(){return this.width}; -Entry.EntityObject.prototype.setHeight=function(b){this.height=b;this.textObject&&(this.object.height=this.height,this.alignTextBox());this.updateDialog();this.updateBG();Entry.requestUpdate=!0};Entry.EntityObject.prototype.getHeight=function(){return this.height};Entry.EntityObject.prototype.setColour=function(b){b||(b="#000000");this.colour=b;this.textObject&&(this.textObject.color=this.colour);Entry.requestUpdate=!0};Entry.EntityObject.prototype.getColour=function(){return this.colour}; -Entry.EntityObject.prototype.setBGColour=function(b){b||(b="transparent");this.bgColor=b;this.updateBG();Entry.requestUpdate=!0};Entry.EntityObject.prototype.getBGColour=function(){return this.bgColor};Entry.EntityObject.prototype.setUnderLine=function(b){void 0===b&&(b=!1);this.underLine=b;this.textObject.underLine=b;Entry.requestUpdate=!0};Entry.EntityObject.prototype.getUnderLine=function(){return this.underLine}; -Entry.EntityObject.prototype.setStrike=function(b){void 0===b&&(b=!1);this.strike=b;this.textObject.strike=b;Entry.requestUpdate=!0};Entry.EntityObject.prototype.getStrike=function(){return this.strike};Entry.EntityObject.prototype.getFont=function(){var b=[];this.fontBold&&b.push("bold");this.fontItalic&&b.push("italic");b.push(this.getFontSize()+"px");b.push(this.fontType);return b.join(" ")}; -Entry.EntityObject.prototype.setFont=function(b){if("textBox"==this.parent.objectType&&this.font!==b){b||(b="20px Nanum Gothic");var a=b.split(" "),c=0;if(c=-1this.direction)==(0<=a&&180>a)||(this.setScaleX(-this.getScaleX()),Entry.stage.updateObject(),this.flip=!this.flip);this.direction=a.mod(360);this.object.direction=this.direction;this.isClone||this.parent.updateRotationView();Entry.dispatchEvent("updateObject");Entry.requestUpdate=!0}; +Entry.EntityObject.prototype.setRotation=function(a){"free"!=this.parent.getRotateMethod()&&(a=0);this.rotation=a.mod(360);this.object.rotation=this.rotation;this.updateDialog();this.isClone||this.parent.updateRotationView();Entry.dispatchEvent("updateObject");Entry.requestUpdate=!0};Entry.EntityObject.prototype.getRotation=function(){return this.rotation};Entry.EntityObject.prototype.setRegX=function(a){"textBox"==this.type&&(a=0);this.regX=a;this.object.regX=this.regX;Entry.requestUpdate=!0}; +Entry.EntityObject.prototype.getRegX=function(){return this.regX};Entry.EntityObject.prototype.setRegY=function(a){"textBox"==this.type&&(a=0);this.regY=a;this.object.regY=this.regY;Entry.requestUpdate=!0};Entry.EntityObject.prototype.getRegY=function(){return this.regY};Entry.EntityObject.prototype.setScaleX=function(a){this.scaleX=a;this.object.scaleX=this.scaleX;this.parent.updateCoordinateView();this.updateDialog();Entry.requestUpdate=!0};Entry.EntityObject.prototype.getScaleX=function(){return this.scaleX}; +Entry.EntityObject.prototype.setScaleY=function(a){this.scaleY=a;this.object.scaleY=this.scaleY;this.parent.updateCoordinateView();this.updateDialog();Entry.requestUpdate=!0};Entry.EntityObject.prototype.getScaleY=function(){return this.scaleY};Entry.EntityObject.prototype.setSize=function(a){1>a&&(a=1);a/=this.getSize();this.setScaleX(this.getScaleX()*a);this.setScaleY(this.getScaleY()*a);this.isClone||this.parent.updateCoordinateView();Entry.requestUpdate=!0}; +Entry.EntityObject.prototype.getSize=function(){return(this.getWidth()*Math.abs(this.getScaleX())+this.getHeight()*Math.abs(this.getScaleY()))/2};Entry.EntityObject.prototype.setWidth=function(a){this.width=a;this.object.width=this.width;this.textObject&&this.getLineBreak()&&(this.textObject.lineWidth=this.width);this.updateDialog();this.updateBG();Entry.requestUpdate=!0};Entry.EntityObject.prototype.getWidth=function(){return this.width}; +Entry.EntityObject.prototype.setHeight=function(a){this.height=a;this.textObject&&(this.object.height=this.height,this.alignTextBox());this.updateDialog();this.updateBG();Entry.requestUpdate=!0};Entry.EntityObject.prototype.getHeight=function(){return this.height};Entry.EntityObject.prototype.setColour=function(a){a||(a="#000000");this.colour=a;this.textObject&&(this.textObject.color=this.colour);Entry.requestUpdate=!0};Entry.EntityObject.prototype.getColour=function(){return this.colour}; +Entry.EntityObject.prototype.setBGColour=function(a){a||(a="transparent");this.bgColor=a;this.updateBG();Entry.requestUpdate=!0};Entry.EntityObject.prototype.getBGColour=function(){return this.bgColor};Entry.EntityObject.prototype.setUnderLine=function(a){void 0===a&&(a=!1);this.underLine=a;this.textObject.underLine=a;Entry.requestUpdate=!0};Entry.EntityObject.prototype.getUnderLine=function(){return this.underLine}; +Entry.EntityObject.prototype.setStrike=function(a){void 0===a&&(a=!1);this.strike=a;this.textObject.strike=a;Entry.requestUpdate=!0};Entry.EntityObject.prototype.getStrike=function(){return this.strike};Entry.EntityObject.prototype.getFont=function(){var a=[];this.fontBold&&a.push("bold");this.fontItalic&&a.push("italic");a.push(this.getFontSize()+"px");a.push(this.fontType);return a.join(" ")}; +Entry.EntityObject.prototype.setFont=function(a){if("textBox"==this.parent.objectType&&this.font!==a){a||(a="20px Nanum Gothic");var b=a.split(" "),c;if(c=-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(), +Entry.EntityObject.prototype.setFontType=function(a){"textBox"==this.parent.objectType&&(this.fontType=a?a:"Nanum Gothic",this.syncFont())};Entry.EntityObject.prototype.getFontSize=function(a){return this.fontSize};Entry.EntityObject.prototype.setFontSize=function(a){"textBox"==this.parent.objectType&&this.fontSize!=a&&(this.fontSize=a?a:20,this.syncFont(),this.alignTextBox())};Entry.EntityObject.prototype.setFontBold=function(a){this.fontBold=a;Entry.requestUpdate=!0}; +Entry.EntityObject.prototype.toggleFontBold=function(){this.fontBold=!this.fontBold;this.syncFont();return this.fontBold};Entry.EntityObject.prototype.setFontItalic=function(a){this.fontItalic=a;Entry.requestUpdate=!0};Entry.EntityObject.prototype.toggleFontItalic=function(){this.fontItalic=!this.fontItalic;this.syncFont();return this.fontItalic}; +Entry.EntityObject.prototype.setFontName=function(a){for(var b=this.font.split(" "),c=[],d=0,e=b.length;d=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);a.alpha=b.alpha=f(b.alpha,0,1);a.filters=e}(a,b),b.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.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.removeClone=function(){if(this.isClone){this.dialog&&this.dialog.remove();this.brush&&this.removeBrush();Entry.stage.unloadEntity(this);var a=this.parent.clonedEntities.indexOf(this);this.parent.clonedEntities.splice(a,1);Entry.Utils.isFunction(this.clearExecutor)&&this.clearExecutor()}};Entry.EntityObject.prototype.clearExecutor=function(){this.parent.script.clearExecutorsByEntity(this)}; +Entry.EntityObject.prototype.toJSON=function(){var a={};a.x=Entry.cutDecimal(this.getX());a.y=Entry.cutDecimal(this.getY());a.regX=Entry.cutDecimal(this.getRegX());a.regY=Entry.cutDecimal(this.getRegY());a.scaleX=this.getScaleX();a.scaleY=this.getScaleY();a.rotation=Entry.cutDecimal(this.getRotation());a.direction=Entry.cutDecimal(this.getDirection());a.width=Entry.cutDecimal(this.getWidth());a.height=Entry.cutDecimal(this.getHeight());a.font=this.getFont();a.visible=this.getVisible();"textBox"== +this.parent.objectType&&(a.colour=this.getColour(),a.text=this.getText(),a.textAlign=this.getTextAlign(),a.lineBreak=this.getLineBreak(),a.bgColor=this.getBGColour(),a.underLine=this.getUnderLine(),a.strike=this.getStrike(),a.fontSize=this.getFontSize());return a};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}; -Entry.EntityObject.prototype.updateBG=function(){if(this.bgObject){this.bgObject.graphics.clear();var b=this.getWidth(),a=this.getHeight();this.bgObject.graphics.setStrokeStyle(1).beginStroke().beginFill(this.getBGColour()).drawRect(-b/2,-a/2,b,a);if(this.getLineBreak())this.bgObject.x=0;else switch(this.getTextAlign()){case Entry.TEXT_ALIGN_LEFT:this.bgObject.x=b/2;break;case Entry.TEXT_ALIGN_CENTER:this.bgObject.x=0;break;case Entry.TEXT_ALIGN_RIGHT:this.bgObject.x=-b/2}}}; -Entry.EntityObject.prototype.alignTextBox=function(){if("textBox"==this.type){var b=this.textObject;if(this.lineBreak){var a=b.getMeasuredLineHeight();b.y=a/2-this.getHeight()/2;switch(this.textAlign){case Entry.TEXT_ALIGN_CENTER:b.x=0;break;case Entry.TEXT_ALIGN_LEFT:b.x=-this.getWidth()/2;break;case Entry.TEXT_ALIGN_RIGHT:b.x=this.getWidth()/2}b.maxHeight=this.getHeight()}else b.x=0,b.y=0}};Entry.EntityObject.prototype.syncDialogVisible=function(){this.dialog&&(this.dialog.object.visible=this.visible)};Entry.Helper=function(){this.visible=!1};p=Entry.Helper.prototype; -p.generateView=function(b,a){if(!this.parentView_){this.parentView_=b;this.blockHelpData=EntryStatic.blockInfo;var c=Entry.createElement("div","entryBlockHelperWorkspace");this.view=c;Entry.isForLecture&&c.addClass("lecture");this.parentView_.appendChild(c);var d=Entry.createElement("div","entryBlockHelperContentWorkspace");d.addClass("entryBlockHelperIntro");Entry.isForLecture&&d.addClass("lecture");c.appendChild(d);this.blockHelperContent_=d;this.blockHelperView_=c;c=Entry.createElement("div","entryBlockHelperBlockWorkspace"); -this.blockHelperContent_.appendChild(c);d=Entry.createElement("div","entryBlockHelperDescriptionWorkspace");this.blockHelperContent_.appendChild(d);d.innerHTML=Lang.Helper.Block_click_msg;this.blockHelperDescription_=d;this._renderView=new Entry.RenderView($(c),"LEFT");this.code=new Entry.Code([]);this._renderView.changeCode(this.code);this.first=!0}}; -p.bindWorkspace=function(b){b&&(this._blockViewObserver&&this._blockViewObserver.destroy(),this.workspace=b,this._blockViewObserver=b.observe(this,"_updateSelectedBlock",["selectedBlockView"]))};p._updateSelectedBlock=function(){var b=this.workspace.selectedBlockView;if(b&&this.visible&&b!=this._blockView){var a=b.block.type;this._blockView=b;this.renderBlock(a)}}; -p.renderBlock=function(b){var a=Lang.Helper[b];if(b&&this.visible&&a&&!Entry.block[b].isPrimitive){this.first&&(this.blockHelperContent_.removeClass("entryBlockHelperIntro"),this.first=!1);this.code.clear();var c=Entry.block[b].def,c=c||{type:b};this.code.createThread([c]);this.code.board.align();this.code.board.resize();var c=this.code.getThreads()[0].getFirstBlock().view,d=c.svgGroup.getBBox();b=d.width;d=d.height;c=c.getSkeleton().box(c).offsetX;isNaN(c)&&(c=0);this.blockHelperDescription_.innerHTML= -a;this._renderView.align();$(this.blockHelperDescription_).css({top:d+30});this._renderView.svgDom.css({"margin-left":-(b/2)-20-c})}};p.getView=function(){return this.view};p.resize=function(){};Entry.Activity=function(b,a){this.name=b;this.timestamp=new Date;var c=[];if(void 0!==a)for(var d=0,e=a.length;d"+a.block+"").childNodes[0]};Entry.Func.prototype.destroy=function(){this.blockMenuBlock.destroy()}; +Entry.Func.edit=function(a){this.cancelEdit();this.targetFunc=a;this.initEditView(a.content);this.bindFuncChangeEvent();this.updateMenu()};Entry.Func.initEditView=function(a){this.menuCode||this.setupMenuCode();var b=Entry.playground.mainWorkspace;b.setMode(Entry.Workspace.MODE_OVERLAYBOARD);b.changeOverlayBoardCode(a);this._workspaceStateEvent=b.changeEvent.attach(this,this.endEdit)}; +Entry.Func.endEdit=function(a){this.unbindFuncChangeEvent();this._workspaceStateEvent.destroy();delete this._workspaceStateEvent;switch(a){case "save":this.save();case "cancelEdit":this.cancelEdit()}};Entry.Func.save=function(){this.targetFunc.generateBlock(!0);Entry.variableContainer.saveFunction(this.targetFunc)}; +Entry.Func.syncFuncName=function(a){var b=0;a=a.split(" ");var c="",d;d=Blockly.mainWorkspace.getAllBlocks();for(var e=0;eBlockly.Block.dragMode_&&(a.updateMenu(),a.fieldText=b,a.workspaceLength=c)}}; +Entry.Func.setupMenuCode=function(){var a=Entry.playground.mainWorkspace;a&&(a=a.getBlockMenu().getCategoryCodes("func"),this._fieldLabel=a.createThread([{type:"function_field_label"}]).getFirstBlock(),this._fieldString=a.createThread([{type:"function_field_string",params:[{type:this.requestParamBlock("string")}]}]).getFirstBlock(),this._fieldBoolean=a.createThread([{type:"function_field_boolean",params:[{type:this.requestParamBlock("boolean")}]}]).getFirstBlock(),this.menuCode=a)}; +Entry.Func.refreshMenuCode=function(){if(Entry.playground.mainWorkspace){this.menuCode||this.setupMenuCode();var a=Entry.block[this._fieldString.params[0].type].changeEvent._listeners.length;2'));this._hwModule=a;var b=this;Entry.addEventListener("windowResized",function(){var a=b._hwModule.monitorTemplate.mode;"both"==a&&(b.resize(),b.resizeList());"list"==a?b.resizeList():b.resize()});Entry.addEventListener("hwModeChange",function(){b.changeMode()});this.changeOffset=0;this.scale=.5;this._listPortViews={}}; +(function(a){a.initView=function(){this.svgDom=Entry.Dom($(''))};a.generateView=function(){this.snap=Entry.SVG("hwMonitor");this._svgGroup=this.snap.elem("g");this._portMap={n:[],e:[],s:[],w:[]};var b=this._hwModule.monitorTemplate,a={href:Entry.mediaFilePath+b.imgPath,x:-b.width/2,y:-b.height/2,width:b.width,height:b.height};this._portViews={};this.hwView=this._svgGroup.elem("image");this.hwView= +this.hwView.attr(a);this._template=b;b=b.ports;this.pathGroup=null;this.pathGroup=this._svgGroup.elem("g");var a=[],d;for(d in b){var e=this.generatePortView(b[d],"_svgGroup");this._portViews[d]=e;a.push(e)}a.sort(function(b,a){return b.box.x-a.box.x});var f=this._portMap;a.map(function(b){(1>(Math.atan2(-b.box.y,b.box.x)/Math.PI+2)%2?f.n:f.s).push(b)});this.resize()};a.toggleMode=function(b){var a=this._hwModule.monitorTemplate;"list"==b?(a.TempPort=null,this._hwModule.monitorTemplate.ports&&(this._hwModule.monitorTemplate.TempPort= +this._hwModule.monitorTemplate.ports,this._hwModule.monitorTemplate.listPorts=this.addPortEle(this._hwModule.monitorTemplate.listPorts,this._hwModule.monitorTemplate.ports)),$(this._svglistGroup).remove(),this._svgGroup&&$(this._svgGroup).remove(),$(this._pathGroup).remove(),this._hwModule.monitorTemplate.mode="list",this.generateListView()):(this._hwModule.monitorTemplate.TempPort&&(this._hwModule.monitorTemplate.ports=this._hwModule.monitorTemplate.TempPort,this._hwModule.monitorTemplate.listPorts= +this.removePortEle(this._hwModule.monitorTemplate.listPorts,this._hwModule.monitorTemplate.ports)),$(this._svglistGroup).remove(),this._hwModule.monitorTemplate.mode="both",this.generateListView(),this.generateView())};a.setHwmonitor=function(b){this._hwmodule=b};a.changeMode=function(b){"both"==this._hwModule.monitorTemplate.mode?this.toggleMode("list"):"list"==this._hwModule.monitorTemplate.mode&&this.toggleMode("both")};a.addPortEle=function(b,a){if("object"!=typeof a)return b;for(var d in a)b[d]= +a[d];return b};a.removePortEle=function(b,a){if("object"!=typeof a)return b;for(var d in a)delete b[d];return b};a.generateListView=function(){this._portMapList={n:[]};this._svglistGroup=null;this.listsnap=Entry.SVG("hwMonitor");this._svglistGroup=this.listsnap.elem("g");var b=this._hwModule.monitorTemplate;this._template=b;b=b.listPorts;this.pathGroup=this._svglistGroup.elem("g");var a=[],d;for(d in b){var e=this.generatePortView(b[d],"_svglistGroup");this._listPortViews[d]=e;a.push(e)}var f=this._portMapList; +a.map(function(b){f.n.push(b)});this.resizeList()};a.generatePortView=function(b,a){a=this[a].elem("g");a.addClass("hwComponent");var d;d=this.pathGroup.elem("path").attr({d:"m0,0",fill:"none",stroke:"input"===b.type?"#00979d":"#A751E3","stroke-width":3});var e=a.elem("rect").attr({x:0,y:0,width:150,height:22,rx:4,ry:4,fill:"#fff",stroke:"#a0a1a1"}),f=a.elem("text").attr({x:4,y:12,fill:"#000","class":"hwComponentName","alignment-baseline":"central"});f.textContent=b.name;f=f.getComputedTextLength(); +a.elem("rect").attr({x:f+8,y:2,width:30,height:18,rx:9,ry:9,fill:"input"===b.type?"#00979d":"#A751E3"});var g=a.elem("text").attr({x:f+13,y:12,fill:"#fff","class":"hwComponentValue","alignment-baseline":"central"});g.textContent=0;f+=40;e.attr({width:f});return{group:a,value:g,type:b.type,path:d,box:{x:b.pos.x-this._template.width/2,y:b.pos.y-this._template.height/2,width:f},width:f}};a.getView=function(){return this.svgDom};a.update=function(){var b=Entry.hw.portData,a=Entry.hw.sendQueue,d=this._hwModule.monitorTemplate.mode, +e=this._hwModule.monitorTemplate.keys||[],f=[];if("list"==d)f=this._listPortViews;else if("both"==d){if(f=this._listPortViews,this._portViews)for(var g in this._portViews)f[g]=this._portViews[g]}else f=this._portViews;if(a)for(g in a)0!=a[g]&&f[g]&&(f[g].type="output");for(var h in f)if(d=f[h],"input"==d.type){var k=b[h];0=this._template.height||0>=b.height||(this.scale=b.height/this._template.height* +this._template.height/1E3,this.align())};a.resizeList=function(){var b=this.svgDom.get(0).getBoundingClientRect();this._svglistGroup.attr({transform:"translate("+b.width/2+","+b.height/2+")"});this._rect=b;this.alignList()};a.align=function(){var b;b=this._portMap.s.concat();this._alignNS(b,this.scale/3*this._template.height+5,27);b=this._portMap.n.concat();this._alignNS(b,-this._template.height*this.scale/3-32,-27);b=this._portMap.e.concat();this._alignEW(b,-this._template.width*this.scale/3-5,-27); +b=this._portMap.w.concat();this._alignEW(b,this._template.width*this.scale/3-32,-27)};a.alignList=function(){var b;b=this._hwModule.monitorTemplate.listPorts;for(var a=b.length,d=0;da-(k.width+l.width/2.2)&&(e+=1,initX=g,f=0)};a._movePort=function(b,a,d,e){var f=a,g=b.box.x*this.scale,h=b.box.y*this.scale; +a>e?(f=a-b.width,a=a>g&&g>e?"M"+g+","+d+"L"+g+","+h:"M"+(a+e)/2+","+d+"l0,"+(h>d?28:-3)+"H"+g+"L"+g+","+h):a=ad?28:-3)+"H"+g+"L"+g+","+h;b.group.attr({transform:"translate("+f+","+d+")"});b.path.attr({d:a})}})(Entry.HWMonitor.prototype);Entry.HW=function(){this.connectTrial=0;this.isFirstConnect=!0;this.initSocket();this.connected=!1;this.portData={};this.sendQueue={};this.outputQueue={};this.settingQueue={};this.socketType=this.hwModule=this.selectedDevice=null;Entry.addEventListener("stop",this.setZero);this.hwInfo={11:Entry.Arduino,19:Entry.ArduinoExt,12:Entry.SensorBoard,13:Entry.CODEino,14:Entry.joystick,15:Entry.dplay,16:Entry.nemoino,17:Entry.Xbot,18:Entry.ardublock,110:Entry.Cobl,24:Entry.Hamster,25:Entry.Albert,31:Entry.Bitbrick, +42:Entry.Arduino,51:Entry.Neobot,71:Entry.Robotis_carCont,72:Entry.Robotis_openCM70,81:Entry.Arduino}};Entry.HW.TRIAL_LIMIT=1;p=Entry.HW.prototype; +p.initSocket=function(){try{if(this.connectTrial>=Entry.HW.TRIAL_LIMIT)this.isFirstConnect||Entry.toast.alert(Lang.Menus.connect_hw,Lang.Menus.connect_fail,!1),this.isFirstConnect=!1;else{var a=this,b,c;this.connected=!1;this.connectTrial++;if(-1"+Lang.Menus[b]+"",{classes:["propertyTabElement","propertyTab"+b],parent:this._tabView}),f=this;e.bind("click",function(){f.select(b)});this.modes[b]&&(this.modes[b].tabDom.remove(),this.modes[b].contentDom.remove(),"hw"==b&&($(this.modes).removeClass(".propertyTabhw"),$(".propertyTabhw").unbind("dblclick")));this.modes[b]={obj:a,tabDom:e,contentDom:d};"hw"==b&&$(".propertyTabhw").bind("dblclick",function(){Entry.dispatchEvent("hwModeChange")})}; +a.resize=function(b){this._view.css({width:b+"px",top:9*b/16+123-22+"px"});430<=b?this._view.removeClass("collapsed"):this._view.addClass("collapsed");Entry.dispatchEvent("windowResized");b=this.selected;"hw"==b?this.modes.hw.obj.listPorts?this.modes[b].obj.resizeList():this.modes[b].obj.resize():this.modes[b].obj.resize()};a.select=function(b){for(var a in this.modes){var d=this.modes[a];d.tabDom.removeClass("selected");d.contentDom.addClass("entryRemove");d.obj.visible=!1}a=this.modes[b];a.tabDom.addClass("selected"); +a.contentDom.removeClass("entryRemove");a.obj.resize&&a.obj.resize();a.obj.visible=!0;this.selected=b};a.initializeSplitter=function(b){var a=this;b.bind("mousedown touchstart",function(b){a._cover.removeClass("entryRemove");Entry.container.disableSort();Entry.container.splitterEnable=!0;Entry.documentMousemove&&(Entry.container.resizeEvent=Entry.documentMousemove.attach(this,function(b){Entry.container.splitterEnable&&Entry.resizeElement({canvasWidth:b.clientX||b.x})}))});$(document).bind("mouseup touchend", +function(b){if(b=Entry.container.resizeEvent)Entry.container.splitterEnable=!1,Entry.documentMousemove.detach(b),a._cover.addClass("entryRemove"),delete Entry.container.resizeEvent;Entry.container.enableSort()})}})(Entry.PropertyPanel.prototype);Entry.init=function(a,b){Entry.assert("object"===typeof b,"Init option is not object");this.events_={};this.interfaceState={menuWidth:264};Entry.Utils.bindGlobalEvent("resize mousedown mousemove keydown keyup dispose".split(" "));this.options=b;this.parseOptions(b);this.mediaFilePath=(b.libDir?b.libDir:"/lib")+"/entryjs/images/";this.defaultPath=b.defaultDir||"";this.blockInjectPath=b.blockInjectDir||"";"workspace"==this.type&&this.isPhone()&&(this.type="phone");this.initialize_();this.view_=a;this.view_.setAttribute("class", +"entry");Entry.initFonts(b.fonts);this.createDom(a,this.type);this.loadInterfaceState();this.overridePrototype();this.maxCloneLimit=302;this.cloudSavable=!0;this.startTime=(new Date).getTime();document.onkeydown=function(b){Entry.dispatchEvent("keyPressed",b)};document.onkeyup=function(b){Entry.dispatchEvent("keyUpped",b)};window.onresize=function(b){Entry.dispatchEvent("windowResized",b)};window.onbeforeunload=this.beforeUnload;Entry.addEventListener("saveWorkspace",function(b){Entry.addActivity("save")}); +"IE"!=Entry.getBrowserType().substr(0,2)||window.flashaudio?createjs.Sound.registerPlugins([createjs.WebAudioPlugin]):(createjs.FlashAudioPlugin.swfPath=this.mediaFilePath+"media/",createjs.Sound.registerPlugins([createjs.FlashAudioPlugin]),window.flashaudio=!0);Entry.soundQueue=new createjs.LoadQueue;Entry.soundQueue.installPlugin(createjs.Sound);Entry.loadAudio_([Entry.mediaFilePath+"sounds/click.mp3",Entry.mediaFilePath+"sounds/click.wav",Entry.mediaFilePath+"sounds/click.ogg"],"entryMagneting"); +Entry.loadAudio_([Entry.mediaFilePath+"sounds/delete.mp3",Entry.mediaFilePath+"sounds/delete.ogg",Entry.mediaFilePath+"sounds/delete.wav"],"entryDelete");createjs.Sound.stop()};Entry.loadAudio_=function(a,b){if(window.Audio&&a.length)for(;0this.pictures.length)return!1;b=this.getPicture(b);var a=this.pictures.indexOf(b);Entry.stateManager&&Entry.stateManager.addCommand("remove sprite",this,this.addPicture,b,a);this.pictures.splice(a,1);b===this.selectedPicture&&Entry.playground.selectPicture(this.pictures[0]);Entry.playground.injectPicture(this);Entry.playground.reloadPlayground();return new Entry.State(this,this.addPicture,b,a)}; -Entry.EntryObject.prototype.getPicture=function(b){if(!b)return this.selectedPicture;b=b.trim();for(var a=this.pictures,c=a.length,d=0;d=b&&0Entry.maxCloneLimit||(b=new Entry.EntityObject(this),a?(b.injectModel(a.picture?a.picture:null,a.toJSON()),b.snapshot_=a.snapshot_,a.effect&&(b.effect=Entry.cloneSimpleObject(a.effect),b.applyFilter()),a.brush&&Entry.setCloneBrush(b,a.brush)):(b.injectModel(this.entity.picture?this.entity.picture:null,this.entity.toJSON(b)),b.snapshot_=this.entity.snapshot_,this.entity.effect&&(b.effect=Entry.cloneSimpleObject(this.entity.effect), -b.applyFilter()),this.entity.brush&&Entry.setCloneBrush(b,this.entity.brush)),Entry.engine.raiseEventOnEntity(b,[b,"when_clone_start"]),b.isClone=!0,b.isStarted=!0,this.addCloneVariables(this,b,a?a.variables:null,a?a.lists:null),this.clonedEntities.push(b),Entry.stage.loadEntity(b))}; -Entry.EntryObject.prototype.initializeSplitter=function(b){b.onmousedown=function(a){Entry.container.disableSort();Entry.container.splitterEnable=!0};document.addEventListener("mousemove",function(a){Entry.container.splitterEnable&&Entry.resizeElement({canvasWidth:a.x||a.clientX})});document.addEventListener("mouseup",function(a){Entry.container.splitterEnable=!1;Entry.container.enableSort()})};Entry.EntryObject.prototype.isSelected=function(){return this.isSelected_}; -Entry.EntryObject.prototype.toJSON=function(){var b={};b.id=this.id;b.name=this.name;"textBox"==this.objectType&&(b.text=this.text);b.script=this.getScriptText();"sprite"==this.objectType&&(b.selectedPictureId=this.selectedPicture.id);b.objectType=this.objectType;b.rotateMethod=this.getRotateMethod();b.scene=this.scene.id;b.sprite={pictures:Entry.getPicturesJSON(this.pictures),sounds:Entry.getSoundsJSON(this.sounds)};b.lock=this.lock;b.entity=this.entity.toJSON();return b}; -Entry.EntryObject.prototype.destroy=function(){Entry.stage.unloadEntity(this.entity);this.view_&&Entry.removeElement(this.view_)};Entry.EntryObject.prototype.getSound=function(b){b=b.trim();for(var a=this.sounds,c=a.length,d=0;d=b&&0this.pictures.length)return!1;a=this.getPicture(a);var b=this.pictures.indexOf(a);Entry.stateManager&&Entry.stateManager.addCommand("remove sprite",this,this.addPicture,a,b);this.pictures.splice(b,1);a===this.selectedPicture&&Entry.playground.selectPicture(this.pictures[0]);Entry.playground.injectPicture(this);Entry.playground.reloadPlayground();return new Entry.State(this,this.addPicture,a,b)}; +Entry.EntryObject.prototype.getPicture=function(a){if(!a)return this.selectedPicture;a=a.trim();for(var b=this.pictures,c=b.length,d=0;d=a&&0Entry.maxCloneLimit||(a=new Entry.EntityObject(this),b?(a.injectModel(b.picture?b.picture:null,b.toJSON()),a.snapshot_=b.snapshot_,b.effect&&(a.effect=Entry.cloneSimpleObject(b.effect),a.applyFilter()),b.brush&&Entry.setCloneBrush(a,b.brush)):(a.injectModel(this.entity.picture?this.entity.picture:null,this.entity.toJSON(a)),a.snapshot_=this.entity.snapshot_,this.entity.effect&&(a.effect=Entry.cloneSimpleObject(this.entity.effect), +a.applyFilter()),this.entity.brush&&Entry.setCloneBrush(a,this.entity.brush)),Entry.engine.raiseEventOnEntity(a,[a,"when_clone_start"]),a.isClone=!0,a.isStarted=!0,this.addCloneVariables(this,a,b?b.variables:null,b?b.lists:null),this.clonedEntities.push(a),Entry.stage.loadEntity(a))}; +Entry.EntryObject.prototype.initializeSplitter=function(a){a.onmousedown=function(b){Entry.container.disableSort();Entry.container.splitterEnable=!0};document.addEventListener("mousemove",function(b){Entry.container.splitterEnable&&Entry.resizeElement({canvasWidth:b.x||b.clientX})});document.addEventListener("mouseup",function(b){Entry.container.splitterEnable=!1;Entry.container.enableSort()})};Entry.EntryObject.prototype.isSelected=function(){return this.isSelected_}; +Entry.EntryObject.prototype.toJSON=function(){var a={};a.id=this.id;a.name=this.name;"textBox"==this.objectType&&(a.text=this.text);a.script=this.getScriptText();"sprite"==this.objectType&&(a.selectedPictureId=this.selectedPicture.id);a.objectType=this.objectType;a.rotateMethod=this.getRotateMethod();a.scene=this.scene.id;a.sprite={pictures:Entry.getPicturesJSON(this.pictures),sounds:Entry.getSoundsJSON(this.sounds)};a.lock=this.lock;a.entity=this.entity.toJSON();return a}; +Entry.EntryObject.prototype.destroy=function(){Entry.stage.unloadEntity(this.entity);this.view_&&Entry.removeElement(this.view_)};Entry.EntryObject.prototype.getSound=function(a){a=a.trim();for(var b=this.sounds,c=b.length,d=0;d=a&&0=a-e/100*a&&f<=a+e/100*a&&g>=c-e/100*c&&g<=c+e/100*c&&b>=d-e/100*d&&b<=d+e/100*d};Entry.Painter.prototype.matchColorOnly=function(b,a,c,d){return a===this.colorLayerData.data[b]&&c===this.colorLayerData.data[b+1]&&d===this.colorLayerData.data[b+2]?!0:!1}; -Entry.Painter.prototype.matchColor=function(b,a,c,d,e){return a===this.colorLayerData.data[b]&&c===this.colorLayerData.data[b+1]&&d===this.colorLayerData.data[b+2]&&e===this.colorLayerData.data[b+3]?!0:!1};Entry.Painter.prototype.colorPixel=function(b,a,c,d,e){e||(e=255);this.stroke.transparent&&(e=d=c=a=0);this.colorLayerData.data[b]=a;this.colorLayerData.data[b+1]=c;this.colorLayerData.data[b+2]=d;this.colorLayerData.data[b+3]=e}; -Entry.Painter.prototype.pickStrokeColor=function(b){b=4*(Math.round(b.stageY)*this.canvas.width+Math.round(b.stageX));this.stroke.lineColor=Entry.rgb2hex(this.colorLayerData.data[b],this.colorLayerData.data[b+1],this.colorLayerData.data[b+2]);document.getElementById("entryPainterAttrCircle").style.backgroundColor=this.stroke.lineColor;document.getElementById("entryPainterAttrCircleInput").value=this.stroke.lineColor}; -Entry.Painter.prototype.drawText=function(b){var a=document.getElementById("entryPainterAttrFontStyle").value,c=document.getElementById("entryPainterAttrFontName").value,d=document.getElementById("entryPainterAttrFontSize").value;b=new createjs.Text(b,a+" "+d+'px "'+c+'"',this.stroke.lineColor);b.textBaseline="top";b.x=this.oldPt.x;b.y=this.oldPt.y;this.objectContainer.addChild(b);this.selectTextObject(b);this.file.modified=!0}; -Entry.Painter.prototype.addImage=function(b){var a=new createjs.Bitmap(b);this.objectContainer.addChild(a);a.x=this.stage.canvas.width/2;a.y=this.stage.canvas.height/2;a.regX=a.image.width/2|0;a.regY=a.image.height/2|0;if(540=b-e/100*b&&f<=b+e/100*b&&g>=c-e/100*c&&g<=c+e/100*c&&a>=d-e/100*d&&a<=d+e/100*d};Entry.Painter.prototype.matchColorOnly=function(a,b,c,d){return b===this.colorLayerData.data[a]&&c===this.colorLayerData.data[a+1]&&d===this.colorLayerData.data[a+2]?!0:!1}; +Entry.Painter.prototype.matchColor=function(a,b,c,d,e){return b===this.colorLayerData.data[a]&&c===this.colorLayerData.data[a+1]&&d===this.colorLayerData.data[a+2]&&e===this.colorLayerData.data[a+3]?!0:!1};Entry.Painter.prototype.colorPixel=function(a,b,c,d,e){e||(e=255);this.stroke.transparent&&(e=d=c=b=0);this.colorLayerData.data[a]=b;this.colorLayerData.data[a+1]=c;this.colorLayerData.data[a+2]=d;this.colorLayerData.data[a+3]=e}; +Entry.Painter.prototype.pickStrokeColor=function(a){a=4*(Math.round(a.stageY)*this.canvas.width+Math.round(a.stageX));this.stroke.lineColor=Entry.rgb2hex(this.colorLayerData.data[a],this.colorLayerData.data[a+1],this.colorLayerData.data[a+2]);document.getElementById("entryPainterAttrCircle").style.backgroundColor=this.stroke.lineColor;document.getElementById("entryPainterAttrCircleInput").value=this.stroke.lineColor}; +Entry.Painter.prototype.drawText=function(a){var b=document.getElementById("entryPainterAttrFontStyle").value,c=document.getElementById("entryPainterAttrFontName").value,d=document.getElementById("entryPainterAttrFontSize").value;a=new createjs.Text(a,b+" "+d+'px "'+c+'"',this.stroke.lineColor);a.textBaseline="top";a.x=this.oldPt.x;a.y=this.oldPt.y;this.objectContainer.addChild(a);this.selectTextObject(a);this.file.modified=!0}; +Entry.Painter.prototype.addImage=function(a){var b=new createjs.Bitmap(a);this.objectContainer.addChild(b);b.x=this.stage.canvas.width/2;b.y=this.stage.canvas.height/2;b.regX=b.image.width/2|0;b.regY=b.image.height/2|0;if(540>1,this.oldPt.y+this.stage.mouseY>>1);this.brush.graphics.setStrokeStyle(this.stroke.thickness,"round").beginStroke(this.stroke.lineColor).moveTo(b.x,b.y).curveTo(this.oldPt.x,this.oldPt.y,this.oldMidPt.x,this.oldMidPt.y);this.oldPt.x=this.stage.mouseX;this.oldPt.y=this.stage.mouseY;this.oldMidPt.x=b.x;this.oldMidPt.y=b.y;this.file.modified=!0;this.stage.update()}; +Entry.Painter.prototype.fill=function(){if(!this.stroke.locked){this.stroke.locked=!0;this.initCommand();this.doCommand();this.clearHandle();var a=this.canvas.width,b=this.canvas.height;this.colorLayerData=this.ctx.getImageData(0,0,a,b);var c=new createjs.Point(this.stage.mouseX,this.stage.mouseY);c.x=Math.round(c.x);c.y=Math.round(c.y);for(var d=4*(c.y*a+c.x),e=this.colorLayerData.data[d],f=this.colorLayerData.data[d+1],g=this.colorLayerData.data[d+2],h=this.colorLayerData.data[d+3],k,l,c=[[c.x, +c.y]],q=Entry.hex2rgb(this.stroke.lineColor);c.length;){for(var d=c.pop(),m=d[0],n=d[1],d=4*(n*a+m);0<=n&&this.matchColor(d,e,f,g,h);)--n,d-=4*a;d+=4*a;n+=1;for(l=k=!1;n>1,this.oldPt.y+this.stage.mouseY>>1);this.brush.graphics.setStrokeStyle(this.stroke.thickness,"round").beginStroke(this.stroke.lineColor).moveTo(a.x,a.y).curveTo(this.oldPt.x,this.oldPt.y,this.oldMidPt.x,this.oldMidPt.y);this.oldPt.x=this.stage.mouseX;this.oldPt.y=this.stage.mouseY;this.oldMidPt.x=a.x;this.oldMidPt.y=a.y;this.file.modified=!0;this.stage.update()}; Entry.Painter.prototype.move_line=function(){this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").moveTo(this.oldPt.x,this.oldPt.y).lineTo(this.stage.mouseX,this.stage.mouseY);this.file.modified=!0;this.stage.update()}; -Entry.Painter.prototype.move_rect=function(){var b=this.stage.mouseX-this.oldPt.x,a=this.stage.mouseY-this.oldPt.y;event.shiftKey&&(a=b);this.stroke.fill?0===this.stroke.thickness?this.brush.graphics.clear().setStrokeStyle(this.stroke.thickness,"round").beginFill(this.stroke.fillColor).drawRect(this.oldPt.x,this.oldPt.y,b,a):this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").beginFill(this.stroke.fillColor).drawRect(this.oldPt.x,this.oldPt.y, -b,a):0===this.stroke.thickness?this.brush.graphics.clear().setStrokeStyle(this.stroke.thickness,"round").drawRect(this.oldPt.x,this.oldPt.y,b,a):this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").drawRect(this.oldPt.x,this.oldPt.y,b,a);this.file.modified=!0;this.stage.update()}; -Entry.Painter.prototype.move_circle=function(){var b=this.stage.mouseX-this.oldPt.x,a=this.stage.mouseY-this.oldPt.y;event.shiftKey&&(a=b);this.stroke.fill?0===this.stroke.thickness?this.brush.graphics.clear().beginStroke(this.stroke.fillColor).setStrokeStyle(this.stroke.thickness,"round").beginFill(this.stroke.fillColor).drawEllipse(this.oldPt.x,this.oldPt.y,b,a):this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").beginFill(this.stroke.fillColor).drawEllipse(this.oldPt.x, -this.oldPt.y,b,a):this.stroke.fill||(0===this.stroke.thickness?this.brush.graphics.clear().drawEllipse(this.oldPt.x,this.oldPt.y,b,a):this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").drawEllipse(this.oldPt.x,this.oldPt.y,b,a));this.file.modified=!0;this.stage.update()}; +Entry.Painter.prototype.move_rect=function(){var a=this.stage.mouseX-this.oldPt.x,b=this.stage.mouseY-this.oldPt.y;event.shiftKey&&(b=a);this.stroke.fill?0===this.stroke.thickness?this.brush.graphics.clear().setStrokeStyle(this.stroke.thickness,"round").beginFill(this.stroke.fillColor).drawRect(this.oldPt.x,this.oldPt.y,a,b):this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").beginFill(this.stroke.fillColor).drawRect(this.oldPt.x,this.oldPt.y, +a,b):0===this.stroke.thickness?this.brush.graphics.clear().setStrokeStyle(this.stroke.thickness,"round").drawRect(this.oldPt.x,this.oldPt.y,a,b):this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").drawRect(this.oldPt.x,this.oldPt.y,a,b);this.file.modified=!0;this.stage.update()}; +Entry.Painter.prototype.move_circle=function(){var a=this.stage.mouseX-this.oldPt.x,b=this.stage.mouseY-this.oldPt.y;event.shiftKey&&(b=a);this.stroke.fill?0===this.stroke.thickness?this.brush.graphics.clear().beginStroke(this.stroke.fillColor).setStrokeStyle(this.stroke.thickness,"round").beginFill(this.stroke.fillColor).drawEllipse(this.oldPt.x,this.oldPt.y,a,b):this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").beginFill(this.stroke.fillColor).drawEllipse(this.oldPt.x, +this.oldPt.y,a,b):this.stroke.fill||(0===this.stroke.thickness?this.brush.graphics.clear().drawEllipse(this.oldPt.x,this.oldPt.y,a,b):this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").drawEllipse(this.oldPt.x,this.oldPt.y,a,b));this.file.modified=!0;this.stage.update()}; Entry.Painter.prototype.edit_copy=function(){this.selectArea?(this.clearHandle(),this.selectedObject&&delete this.selectedObject,this.copyLayerData=this.ctx.getImageData(this.selectArea.x1,this.selectArea.y1,this.selectArea.x2,this.selectArea.y2),this.copy={},this.copy.width=this.selectArea.x2,this.copy.height=this.selectArea.y2,this.canvas_.width=this.copy.width,this.canvas_.height=this.copy.height,this.ctx_.clearRect(0,0,this.canvas_.width,this.canvas_.height),this.ctx_.putImageData(this.copyLayerData, 0,0)):alert("\ubcf5\uc0ac\ud560 \uc601\uc5ed\uc744 \uc120\ud0dd\ud558\uc138\uc694.")}; Entry.Painter.prototype.edit_cut=function(){this.selectArea?(this.clearHandle(),this.selectedObject&&delete this.selectedObject,this.copyLayerData=this.ctx.getImageData(this.selectArea.x1,this.selectArea.y1,this.selectArea.x2,this.selectArea.y2),this.copy={},this.copy.width=this.selectArea.x2,this.copy.height=this.selectArea.y2,this.canvas_.width=this.copy.width,this.canvas_.height=this.copy.height,this.ctx_.clearRect(0,0,this.canvas_.width,this.canvas_.height),this.ctx_.putImageData(this.copyLayerData, 0,0),this.ctx.clearRect(this.selectArea.x1,this.selectArea.y1,this.selectArea.x2,this.selectArea.y2),this.colorLayerData=this.ctx.getImageData(0,0,this.canvas.width,this.canvas.height),this.reloadContext(),this.file.modified=!0):alert("\uc790\ub97c \uc601\uc5ed\uc744 \uc120\ud0dd\ud558\uc138\uc694.")}; -Entry.Painter.prototype.edit_paste=function(){var b=new Image;b.src=this.canvas_.toDataURL();var a=this;b.onload=function(b){b=new createjs.Bitmap(b.target);b.x=a.canvas.width/2;b.y=a.canvas.height/2;b.regX=a.copy.width/2|0;b.regY=a.copy.height/2|0;b.id=Entry.generateHash();a.objectContainer.addChild(b);a.selectObject(b,!0)};this.file.modified=!0}; +Entry.Painter.prototype.edit_paste=function(){var a=new Image;a.src=this.canvas_.toDataURL();var b=this;a.onload=function(a){a=new createjs.Bitmap(a.target);a.x=b.canvas.width/2;a.y=b.canvas.height/2;a.regX=b.copy.width/2|0;a.regY=b.copy.height/2|0;a.id=Entry.generateHash();b.objectContainer.addChild(a);b.selectObject(a,!0)};this.file.modified=!0}; Entry.Painter.prototype.edit_select=function(){this.clearHandle();this.selectedObject&&delete this.selectedObject;this.copyLayerData=this.ctx.getImageData(this.selectArea.x1,this.selectArea.y1,this.selectArea.x2,this.selectArea.y2);this.copy={};this.copy.width=this.selectArea.x2;this.copy.height=this.selectArea.y2;this.canvas_.width=this.copy.width;this.canvas_.height=this.copy.height;this.ctx_.clearRect(0,0,this.canvas_.width,this.canvas_.height);this.ctx_.putImageData(this.copyLayerData,0,0);this.ctx.clearRect(this.selectArea.x1, -this.selectArea.y1,this.selectArea.x2,this.selectArea.y2);this.colorLayerData=this.ctx.getImageData(0,0,this.canvas.width,this.canvas.height);this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);this.ctx.putImageData(this.colorLayerData,0,0);var b=new Image;b.src=this.canvas.toDataURL();var a=this;b.onload=function(b){b=new createjs.Bitmap(b.target);a.objectContainer.removeAllChildren();a.objectContainer.addChild(b);b=new Image;b.src=a.canvas_.toDataURL();b.onload=function(b){b=new createjs.Bitmap(b.target); -b.x=a.selectArea.x1+a.copy.width/2;b.y=a.selectArea.y1+a.copy.height/2;b.regX=a.copy.width/2|0;b.regY=a.copy.height/2|0;b.id=Entry.generateHash();b.name=b.id;a.objectContainer.addChild(b);a.selectObject(b,!0)}}}; -Entry.Painter.prototype.move_erase=function(b){b=new createjs.Point(this.oldPt.x+this.stage.mouseX>>1,this.oldPt.y+this.stage.mouseY>>1);this.eraser.graphics.setStrokeStyle(this.stroke.thickness,"round").beginStroke("#ffffff").moveTo(b.x,b.y).curveTo(this.oldPt.x,this.oldPt.y,this.oldMidPt.x,this.oldMidPt.y);this.oldPt.x=this.stage.mouseX;this.oldPt.y=this.stage.mouseY;this.oldMidPt.x=b.x;this.oldMidPt.y=b.y;this.file.modified=!0;this.stage.update()}; +this.selectArea.y1,this.selectArea.x2,this.selectArea.y2);this.colorLayerData=this.ctx.getImageData(0,0,this.canvas.width,this.canvas.height);this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);this.ctx.putImageData(this.colorLayerData,0,0);var a=new Image;a.src=this.canvas.toDataURL();var b=this;a.onload=function(a){a=new createjs.Bitmap(a.target);b.objectContainer.removeAllChildren();b.objectContainer.addChild(a);a=new Image;a.src=b.canvas_.toDataURL();a.onload=function(a){a=new createjs.Bitmap(a.target); +a.x=b.selectArea.x1+b.copy.width/2;a.y=b.selectArea.y1+b.copy.height/2;a.regX=b.copy.width/2|0;a.regY=b.copy.height/2|0;a.id=Entry.generateHash();a.name=a.id;b.objectContainer.addChild(a);b.selectObject(a,!0)}}}; +Entry.Painter.prototype.move_erase=function(a){a=new createjs.Point(this.oldPt.x+this.stage.mouseX>>1,this.oldPt.y+this.stage.mouseY>>1);this.eraser.graphics.setStrokeStyle(this.stroke.thickness,"round").beginStroke("#ffffff").moveTo(a.x,a.y).curveTo(this.oldPt.x,this.oldPt.y,this.oldMidPt.x,this.oldMidPt.y);this.oldPt.x=this.stage.mouseX;this.oldPt.y=this.stage.mouseY;this.oldMidPt.x=a.x;this.oldMidPt.y=a.y;this.file.modified=!0;this.stage.update()}; Entry.Painter.prototype.settingShapeBlur=function(){this.objectWidthInput.blur();this.objectHeightInput.blur();this.objectRotateInput.blur()}; -Entry.Painter.prototype.stagemousedown=function(b){"picture"==Entry.playground.getViewMode()&&(this.settingShapeBlur(),this.oldPt=new createjs.Point(b.stageX,b.stageY),this.oldMidPt=this.oldPt.clone(),"select"===this.toolbox.selected?this.stage.addChild(this._handle):"spoid"===this.toolbox.selected?this.pickStrokeColor(b):"text"===this.toolbox.selected?(this.showInputField(b),this.stage.update()):"erase"===this.toolbox.selected?(this.createEraser(),this.stroke.enabled=!0):"fill"===this.toolbox.selected? +Entry.Painter.prototype.stagemousedown=function(a){"picture"==Entry.playground.getViewMode()&&(this.settingShapeBlur(),this.oldPt=new createjs.Point(a.stageX,a.stageY),this.oldMidPt=this.oldPt.clone(),"select"===this.toolbox.selected?this.stage.addChild(this._handle):"spoid"===this.toolbox.selected?this.pickStrokeColor(a):"text"===this.toolbox.selected?(this.showInputField(a),this.stage.update()):"erase"===this.toolbox.selected?(this.createEraser(),this.stroke.enabled=!0):"fill"===this.toolbox.selected? this.fill():"cursor"!==this.toolbox.selected&&(this.createBrush(),this.stroke.enabled=!0))}; -Entry.Painter.prototype.stagemousemove=function(b){"picture"==Entry.playground.getViewMode()&&("select"===this.toolbox.selected&&-1this.value&&(this.value=360+this.value%360);a.handle.rotation=this.value;a.updateImageHandle()};this.objectRotateInput.addClass("entryPlaygroundPainterNumberInput"); -this.objectRotateInput.defaultValue="0";d.appendChild(this.objectRotateInput);this.attrColorArea=Entry.createElement("fieldset","entryPainterAttrColor");this.attrColorArea.addClass("entryPlaygroundPainterAttrColor");g.appendChild(this.attrColorArea);var n=Entry.createElement("div");n.addClass("entryPlaygroundPainterAttrColorContainer");this.attrColorArea.appendChild(n);this.attrCircleArea=Entry.createElement("div");this.attrCircleArea.addClass("painterAttrCircleArea");g.appendChild(this.attrCircleArea); -d=Entry.createElement("div","entryPainterAttrCircle");d.addClass("painterAttrCircle");this.attrCircleArea.appendChild(d);this.attrCircleArea.painterAttrCircle=d;d=Entry.createElement("input","entryPainterAttrCircleInput");d.value="#000000";d.addClass("painterAttrCircleInput");this.attrCircleArea.appendChild(d);this.attrColorSpoid=Entry.createElement("div");this.attrColorSpoid.bindOnClick(function(){a.selectToolbox("spoid")});this.attrColorSpoid.addClass("painterAttrColorSpoid");g.appendChild(this.attrColorSpoid); -Entry.getColourCodes().forEach(function(b){var c=Entry.createElement("div");c.addClass("entryPlaygroundPainterAttrColorElement");"transparent"===b?c.style.backgroundImage="url("+(Entry.mediaFilePath+"/transparent.png")+")":c.style.backgroundColor=b;c.bindOnClick(function(c){"transparent"===b?(a.stroke.transparent=!0,a.stroke.lineColor="#ffffff"):(a.stroke.transparent=!1,r&&(document.getElementById("entryPainterShapeBackgroundColor").style.backgroundColor=b,a.stroke.fillColor=b),r||(document.getElementById("entryPainterShapeLineColor").style.backgroundColor= -b,a.stroke.lineColor=b));document.getElementById("entryPainterAttrCircle").style.backgroundColor=a.stroke.lineColor;document.getElementById("entryPainterAttrCircleInput").value=b});n.appendChild(c)});this.attrThickArea=Entry.createElement("div","painterAttrThickArea");this.attrThickArea.addClass("entryPlaygroundentryPlaygroundPainterAttrThickArea");g.appendChild(this.attrThickArea);d=Entry.createElement("legend");d.addClass("painterAttrThickName");d.innerHTML=Lang.Workspace.thickness;this.attrThickArea.appendChild(d); -var q=Entry.createElement("fieldset","entryPainterAttrThick");q.addClass("entryPlaygroundPainterAttrThick");this.attrThickArea.appendChild(q);d=Entry.createElement("div");d.addClass("paintAttrThickTop");q.appendChild(d);e=Entry.createElement("select","entryPainterAttrThick");e.addClass("entryPlaygroundPainterAttrThickInput");e.size="1";e.onchange=function(b){a.stroke.thickness=b.target.value};for(d=1;10>=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,e.appendChild(c);q.appendChild(e); -d=Entry.createElement("div","entryPainterShapeLineColor");d.addClass("painterAttrShapeLineColor");c=Entry.createElement("div","entryPainterShapeInnerBackground");c.addClass("painterAttrShapeInnerBackground");d.appendChild(c);q.appendChild(d);this.attrThickArea.painterAttrShapeLineColor=d;q.bindOnClick(function(){m.style.zIndex="1";this.style.zIndex="10";r=!1});this.attrBackgroundArea=Entry.createElement("div","painterAttrBackgroundArea");this.attrBackgroundArea.addClass("entryPlaygroundPainterBackgroundArea"); -g.appendChild(this.attrBackgroundArea);d=Entry.createElement("fieldset","entryPainterAttrbackground");d.addClass("entryPlaygroundPainterAttrBackground");this.attrBackgroundArea.appendChild(d);c=Entry.createElement("div");c.addClass("paintAttrBackgroundTop");d.appendChild(c);var m=Entry.createElement("div","entryPainterShapeBackgroundColor");m.addClass("painterAttrShapeBackgroundColor");this.attrBackgroundArea.painterAttrShapeBackgroundColor=m;c.appendChild(m);var r=!1;m.bindOnClick(function(a){q.style.zIndex= +this.attrRotateArea.appendChild(d);c=Entry.createElement("div");c.addClass("painterAttrRotateTop");c.innerHTML="\u03bf";d.appendChild(c);this.objectRotateInput=Entry.createElement("input","entryPainterAttrDegree");this.objectRotateInput.onblur=function(){if(isNaN(this.value))return alert("\uc22b\uc790\ub9cc \uc785\ub825 \uac00\ub2a5\ud569\ub2c8\ub2e4."),!1;360<=this.value?this.value%=360:0>this.value&&(this.value=360+this.value%360);b.handle.rotation=this.value;b.updateImageHandle()};this.objectRotateInput.addClass("entryPlaygroundPainterNumberInput"); +this.objectRotateInput.defaultValue="0";d.appendChild(this.objectRotateInput);this.attrColorArea=Entry.createElement("fieldset","entryPainterAttrColor");this.attrColorArea.addClass("entryPlaygroundPainterAttrColor");g.appendChild(this.attrColorArea);var q=Entry.createElement("div");q.addClass("entryPlaygroundPainterAttrColorContainer");this.attrColorArea.appendChild(q);this.attrCircleArea=Entry.createElement("div");this.attrCircleArea.addClass("painterAttrCircleArea");g.appendChild(this.attrCircleArea); +d=Entry.createElement("div","entryPainterAttrCircle");d.addClass("painterAttrCircle");this.attrCircleArea.appendChild(d);this.attrCircleArea.painterAttrCircle=d;d=Entry.createElement("input","entryPainterAttrCircleInput");d.value="#000000";d.addClass("painterAttrCircleInput");this.attrCircleArea.appendChild(d);this.attrColorSpoid=Entry.createElement("div");this.attrColorSpoid.bindOnClick(function(){b.selectToolbox("spoid")});this.attrColorSpoid.addClass("painterAttrColorSpoid");g.appendChild(this.attrColorSpoid); +Entry.getColourCodes().forEach(function(a){var c=Entry.createElement("div");c.addClass("entryPlaygroundPainterAttrColorElement");"transparent"===a?c.style.backgroundImage="url("+(Entry.mediaFilePath+"/transparent.png")+")":c.style.backgroundColor=a;c.bindOnClick(function(c){"transparent"===a?(b.stroke.transparent=!0,b.stroke.lineColor="#ffffff"):(b.stroke.transparent=!1,r&&(document.getElementById("entryPainterShapeBackgroundColor").style.backgroundColor=a,b.stroke.fillColor=a),r||(document.getElementById("entryPainterShapeLineColor").style.backgroundColor= +a,b.stroke.lineColor=a));document.getElementById("entryPainterAttrCircle").style.backgroundColor=b.stroke.lineColor;document.getElementById("entryPainterAttrCircleInput").value=a});q.appendChild(c)});this.attrThickArea=Entry.createElement("div","painterAttrThickArea");this.attrThickArea.addClass("entryPlaygroundentryPlaygroundPainterAttrThickArea");g.appendChild(this.attrThickArea);d=Entry.createElement("legend");d.addClass("painterAttrThickName");d.innerHTML=Lang.Workspace.thickness;this.attrThickArea.appendChild(d); +var m=Entry.createElement("fieldset","entryPainterAttrThick");m.addClass("entryPlaygroundPainterAttrThick");this.attrThickArea.appendChild(m);d=Entry.createElement("div");d.addClass("paintAttrThickTop");m.appendChild(d);e=Entry.createElement("select","entryPainterAttrThick");e.addClass("entryPlaygroundPainterAttrThickInput");e.size="1";e.onchange=function(a){b.stroke.thickness=a.target.value};for(d=1;10>=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,e.appendChild(c);m.appendChild(e); +d=Entry.createElement("div","entryPainterShapeLineColor");d.addClass("painterAttrShapeLineColor");c=Entry.createElement("div","entryPainterShapeInnerBackground");c.addClass("painterAttrShapeInnerBackground");d.appendChild(c);m.appendChild(d);this.attrThickArea.painterAttrShapeLineColor=d;m.bindOnClick(function(){n.style.zIndex="1";this.style.zIndex="10";r=!1});this.attrBackgroundArea=Entry.createElement("div","painterAttrBackgroundArea");this.attrBackgroundArea.addClass("entryPlaygroundPainterBackgroundArea"); +g.appendChild(this.attrBackgroundArea);d=Entry.createElement("fieldset","entryPainterAttrbackground");d.addClass("entryPlaygroundPainterAttrBackground");this.attrBackgroundArea.appendChild(d);c=Entry.createElement("div");c.addClass("paintAttrBackgroundTop");d.appendChild(c);var n=Entry.createElement("div","entryPainterShapeBackgroundColor");n.addClass("painterAttrShapeBackgroundColor");this.attrBackgroundArea.painterAttrShapeBackgroundColor=n;c.appendChild(n);var r=!1;n.bindOnClick(function(b){m.style.zIndex= "1";this.style.zIndex="10";r=!0});this.attrFontArea=Entry.createElement("div","painterAttrFont");this.attrFontArea.addClass("entryPlaygroundPainterAttrFont");g.appendChild(this.attrFontArea);e=Entry.createElement("div");e.addClass("entryPlaygroundPainterAttrTop");this.attrFontArea.appendChild(e);d=Entry.createElement("div");d.addClass("entryPlaygroundPaintAttrTop_");e.appendChild(d);d=Entry.createElement("legend");d.addClass("panterAttrFontTitle");d.innerHTML=Lang.Workspace.textStyle;k=Entry.createElement("select", -"entryPainterAttrFontName");k.addClass("entryPlaygroundPainterAttrFontName");k.size="1";k.onchange=function(b){a.font.name=b.target.value};for(d=0;d=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,k.appendChild(c);e.appendChild(k);e=Entry.createElement("div");e.addClass("entryPlaygroundPainterAttrFontStyleArea");this.attrFontArea.appendChild(e);d=Entry.createElement("div");d.addClass("entryPlaygroundPainterAttrFontTop");e.appendChild(d);k=Entry.createElement("select","entryPainterAttrFontStyle"); -k.addClass("entryPlaygroundPainterAttrFontStyle");k.size="1";k.onchange=function(b){a.font.style=b.target.value};h=[{label:"\ubcf4\ud1b5",value:"normal"},{label:"\uad75\uac8c",value:"bold"},{label:"\uae30\uc6b8\uc784",value:"italic"}];for(d=0;d=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,k.appendChild(c);e.appendChild(k);e=Entry.createElement("div");e.addClass("entryPlaygroundPainterAttrFontStyleArea");this.attrFontArea.appendChild(e);d=Entry.createElement("div");d.addClass("entryPlaygroundPainterAttrFontTop");e.appendChild(d);k=Entry.createElement("select","entryPainterAttrFontStyle"); +k.addClass("entryPlaygroundPainterAttrFontStyle");k.size="1";k.onchange=function(a){b.font.style=a.target.value};h=[{label:"\ubcf4\ud1b5",value:"normal"},{label:"\uad75\uac8c",value:"bold"},{label:"\uae30\uc6b8\uc784",value:"italic"}];for(d=0;d":h=b-d;break;case ">=":h=b+1-d}return this.BasicIteration(a,h,f)};b.BlockStatement=function(a){var b=[];a=a.body;for(var d=0;d >= << >> >>> + - * / % , ^ & in instanceof".split(" ")}; -b.AssignmentExpression=function(a){throw{message:a.operator+"\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub839\uc5b4 \uc785\ub2c8\ub2e4.",node:a};};b.AssignmentOperator=function(){return"= += -= *= /= %= <<= >>= >>>= ,= ^= &=".split(" ")};b.LogicalExpression=function(a){throw{message:a.operator+"\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub839\uc5b4 \uc785\ub2c8\ub2e4.",node:a};};b.LogicalOperator=function(){return["||","&&"]};b.MemberExpression=function(a){var b= -a.object,d=a.property;console.log(b.type);b=this[b.type](b);console.log(b);d=this[d.type](d,b);if(Object(b)!==b||Object.getPrototypeOf(b)!==Object.prototype)throw{message:b+"\uc740(\ub294) \uc798\ubabb\ub41c \uba64\ubc84 \ubcc0\uc218\uc785\ub2c8\ub2e4.",node:a};b=d;if(!b)throw{message:d+"\uc774(\uac00) \uc874\uc7ac\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.",node:a};return b};b.ConditionalExpression=function(a){throw{message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", -node:a};};b.UpdateExpression=function(a){throw{message:a.operator+"\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub801\uc5b4 \uc785\ub2c8\ub2e4.",node:a};};b.CallExpression=function(a){a=a.callee;return{type:this[a.type](a)}};b.NewExpression=function(a){throw{message:"new\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.",node:a};};b.SequenceExpression=function(a){throw{message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", -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":h=a-d;break;case ">=":h=a+1-d}return this.BasicIteration(b,h,f)};a.BlockStatement=function(b){var a=[];b=b.body;for(var d=0;d >= << >> >>> + - * / % , ^ & in instanceof".split(" ")}; +a.AssignmentExpression=function(b){throw{message:b.operator+"\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub839\uc5b4 \uc785\ub2c8\ub2e4.",node:b};};a.AssignmentOperator=function(){return"= += -= *= /= %= <<= >>= >>>= ,= ^= &=".split(" ")};a.LogicalExpression=function(b){throw{message:b.operator+"\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub839\uc5b4 \uc785\ub2c8\ub2e4.",node:b};};a.LogicalOperator=function(){return["||","&&"]};a.MemberExpression=function(b){var a= +b.object,d=b.property;console.log(a.type);a=this[a.type](a);console.log(a);d=this[d.type](d,a);if(Object(a)!==a||Object.getPrototypeOf(a)!==Object.prototype)throw{message:a+"\uc740(\ub294) \uc798\ubabb\ub41c \uba64\ubc84 \ubcc0\uc218\uc785\ub2c8\ub2e4.",node:b};a=d;if(!a)throw{message:d+"\uc774(\uac00) \uc874\uc7ac\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.",node:b};return a};a.ConditionalExpression=function(b){throw{message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", +node:b};};a.UpdateExpression=function(b){throw{message:b.operator+"\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub801\uc5b4 \uc785\ub2c8\ub2e4.",node:b};};a.CallExpression=function(b){b=b.callee;return{type:this[b.type](b)}};a.NewExpression=function(b){throw{message:"new\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.",node:b};};a.SequenceExpression=function(b){throw{message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", +node:b};};a.initScope=function(b){if(null===this.scope){var a=function(){};a.prototype=this.syntax.Scope}else a=function(){},a.prototype=this.scope;this.scope=new a;this.scopeChain.push(this.scope);return this.scanDefinition(b)};a.unloadScope=function(){this.scopeChain.pop();this.scope=this.scopeChain.length?this.scopeChain[this.scopeChain.length-1]:null};a.scanDefinition=function(b){b=b.body;for(var a=[],d=0;d=a.keyCode&&CodeMirror.showHint(b,null,{completeSingle:!1,globalScope:d})});break;case "block":this._parser=new Entry.BlockParser(this.syntax)}}; +(function(a){a.parse=function(b){var a=null;switch(this._lang){case "js":try{var d=acorn.parse(b),a=this._parser.Program(d)}catch(e){this.codeMirror&&(e instanceof SyntaxError?(b={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."):(b=this.getLineNumber(e.node.start,e.node.end),b.message=e.message,b.severity="error",this.codeMirror.markText(b.from,b.to,{className:"CodeMirror-lint-mark-error",__annotation:b, +clearOnEnter:!0})),Entry.toast.alert("Error",e.message)),a=[]}break;case "block":b=this._parser.Code(b).match(/(.*{.*[\S|\s]+?}|.+)/g),a=Array.isArray(b)?b.reduce(function(b,a,c){1===c&&(b+="\n");return(-1=e&&g>=a)}};a.align=function(){var b=this.getPosition();this.svgGroup.attr({transform:"translate("+b.x+","+b.y+")"})};a.setPosition=function(){if(this.board){var b=this.board.svgDom;this._x=b.width()-110;this._y=b.height()-110;this.align()}};a.getPosition=function(){return{x:this._x,y:this._y}};a.tAnimation=function(b){if(b!==this.isOver){b=void 0===b?!0:b;var a,d=this.trashcanTop;a=b?{translateX:15,translateY:-25, +rotateZ:30}:{translateX:0,translateY:0,rotateZ:0};$(d).velocity(a,{duration:50});this.isOver=b}};a.setBoard=function(b){this._dragBlockObserver&&this._dragBlockObserver.destroy();this.board=b;this.svgGroup||this._generateView();var a=b.svg,d=a.firstChild;d?a.insertBefore(this.svgGroup,d):a.appendChild(this.svgGroup);this._dragBlockObserver=b.observe(this,"updateDragBlock",["dragBlock"]);this.svgGroup.attr({filter:"url(#entryTrashcanFilter_"+b.suffix+")"});this.setPosition()}})(Entry.FieldTrashcan.prototype);Entry.Workspace=function(a){Entry.Model(this,!1);this.observe(this,"_handleChangeBoard",["selectedBoard"],!1);this.trashcan=new Entry.FieldTrashcan;var b=a.blockMenu;b&&(this.blockMenu=new Entry.BlockMenu(b.dom,b.align,b.categoryData,b.scroll),this.blockMenu.workspace=this,this.blockMenu.observe(this,"_setSelectedBlockView",["selectedBlockView"],!1));if(b=a.board)b.workspace=this,this.board=new Entry.Board(b),this.board.observe(this,"_setSelectedBlockView",["selectedBlockView"],!1),this.set({selectedBoard:this.board}); +if(b=a.vimBoard)this.vimBoard=new Entry.Vim(b.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(a){a.schema={selectedBlockView:null,selectedBoard:null};a.getBoard=function(){return this.board};a.getSelectedBoard=function(){return this.selectedBoard};a.getBlockMenu=function(){return this.blockMenu};a.getVimBoard=function(){return this.vimBoard};a.getMode=function(){return this.mode};a.setMode=function(b,a){b=Number(b);var d=this.mode;this.mode=b;switch(b){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(a)};a.changeBoardCode=function(b){this.board.changeCode(b)};a.changeOverlayBoardCode=function(b){this.overlayBoard&&this.overlayBoard.changeCode(b)};a.changeBlockMenuCode=function(b){this.blockMenu.changeCode(b)};a.textToCode=function(b){if(b==Entry.Workspace.MODE_VIMBOARD){b= +this.vimBoard.textToCode();var a=this.board,d=a.code;d.load(b);d.createView(a);a.reDraw();this.board.alignThreads()}};a.codeToText=function(b){return this.vimBoard.codeToText(b)};a.getCodeToText=function(b){return this.vimBoard.getCodeToText(b)};a._setSelectedBlockView=function(){this.set({selectedBlockView:this.board.selectedBlockView||this.blockMenu.selectedBlockView||(this.overlayBoard?this.overlayBoard.selectedBlockView:null)})};a.initOverlayBoard=function(){this.overlayBoard=new Entry.Board({dom:this.board.view, +workspace:this,isOverlay:!0});this.overlayBoard.changeCode(new Entry.Code([]));this.overlayBoard.workspace=this;this.overlayBoard.observe(this,"_setSelectedBlockView",["selectedBlockView"],!1)};a._keyboardControl=function(b){var a=b.keyCode||b.which,d=b.ctrlKey;if(!Entry.Utils.isInInput(b)){var e=this.selectedBlockView;e&&!e.isInBlockMenu&&e.block.isDeletable()&&(8==a||46==a?(Entry.do("destroyBlock",e.block),b.preventDefault()):d&&(67==a?e.block.copyToClipboard():88==a&&(b=e.block,b.copyToClipboard(), +b.destroy(!0,!0),e.getBoard().setSelectedBlock(null))));d&&86==a&&(a=this.selectedBoard)&&a instanceof Entry.Board&&Entry.clipboard&&Entry.do("addThread",Entry.clipboard).value.getFirstBlock().copyToClipboard()}};a._handleChangeBoard=function(){var b=this.selectedBoard;b&&b.constructor===Entry.Board&&this.trashcan.setBoard(b)}})(Entry.Workspace.prototype);Entry.BlockDriver=function(){}; +(function(a){a.convert=function(){var b=new Date,a;for(a in Entry.block)"function"===typeof Entry.block[a]&&this._convertBlock(a);console.log((new Date).getTime()-b.getTime())};a._convertBlock=function(b){function a(b){var d={type:b.getAttribute("type"),index:{}};b=$(b).children();if(!b)return d;for(var e=0;e"+b[1], +a.addEventListener("click",function(){Entry.engine.toggleStop()}),this.view_.appendChild(a),this.curtainView_=a,Entry.pictureEditable&&(a=Entry.createElement("div","entryPicture"),a.addClass("entryPlaygroundPictureWorkspace"),a.addClass("entryRemove"),this.view_.appendChild(a),this.generatePictureView(a),this.pictureView_=a),a=Entry.createElement("div","entryText"),a.addClass("entryPlaygroundTextWorkspace"),a.addClass("entryRemove"),this.view_.appendChild(a),this.generateTextView(a),this.textView_= +a,Entry.soundEditable&&(a=Entry.createElement("div","entrySound"),a.addClass("entryPlaygroundSoundWorkspace"),a.addClass("entryRemove"),this.view_.appendChild(a),this.generateSoundView(a),this.soundView_=a),a=Entry.createElement("div","entryDefault"),a.addClass("entryPlaygroundDefaultWorkspace"),this.view_.appendChild(a),this.generateDefaultView(a),this.defaultView_=a,a=Entry.createElement("div","entryCode"),a.addClass("entryPlaygroundCodeWorkspace"),a.addClass("entryRemove"),this.view_.appendChild(a), +this.generateCodeView(a),this.codeView_=a,b=Entry.createElement("div"),b.addClass("entryPlaygroundResizeWorkspace","entryRemove"),this.resizeHandle_=b,this.view_.appendChild(b),this.initializeResizeHandle(b),this.codeView_=a,Entry.addEventListener("run",function(b){Entry.playground.curtainView_.removeClass("entryRemove")}),Entry.addEventListener("stop",function(b){Entry.playground.curtainView_.addClass("entryRemove")}))};Entry.Playground.prototype.generateDefaultView=function(a){return a}; +Entry.Playground.prototype.generateTabView=function(a){var b=this,c=Entry.createElement("ul");c.addClass("entryTabListWorkspace");this.tabList_=c;a.appendChild(c);this.tabViewElements={};a=Entry.createElement("li","entryCodeTab");a.innerHTML=Lang.Workspace.tab_code;a.addClass("entryTabListItemWorkspace");a.addClass("entryTabSelected");c.appendChild(a);a.bindOnClick(function(a){b.changeViewMode("code");b.blockMenu.reDraw()});this.tabViewElements.code=a;Entry.pictureEditable&&(a=Entry.createElement("li", +"entryPictureTab"),a.innerHTML=Lang.Workspace.tab_picture,a.addClass("entryTabListItemWorkspace"),c.appendChild(a),a.bindOnClick(function(b){Entry.playground.changeViewMode("picture")}),this.tabViewElements.picture=a,a=Entry.createElement("li","entryTextboxTab"),a.innerHTML=Lang.Workspace.tab_text,a.addClass("entryTabListItemWorkspace"),c.appendChild(a),a.bindOnClick(function(b){Entry.playground.changeViewMode("text")}),this.tabViewElements.text=a,a.addClass("entryRemove"));Entry.soundEditable&&(a= +Entry.createElement("li","entrySoundTab"),a.innerHTML=Lang.Workspace.tab_sound,a.addClass("entryTabListItemWorkspace"),c.appendChild(a),a.bindOnClick(function(b){Entry.playground.changeViewMode("sound")}),this.tabViewElements.sound=a);Entry.hasVariableManager&&(a=Entry.createElement("li","entryVariableTab"),a.innerHTML=Lang.Workspace.tab_attribute,a.addClass("entryTabListItemWorkspace"),a.addClass("entryVariableTabWorkspace"),c.appendChild(a),a.bindOnClick(function(b){Entry.playground.toggleOnVariableView(); +Entry.playground.changeViewMode("variable")}),this.tabViewElements.variable=a)}; +Entry.Playground.prototype.generateCodeView=function(a){var b=this.createVariableView();a.appendChild(b);this.variableView_=b;a=Entry.Dom(a);b=Entry.Dom("div",{parent:a,id:"entryWorkspaceBoard",class:"entryWorkspaceBoard"});a=Entry.Dom("div",{parent:a,id:"entryWorkspaceBlockMenu",class:"entryWorkspaceBlockMenu"});this.mainWorkspace=new Entry.Workspace({blockMenu:{dom:a,align:"LEFT",categoryData:EntryStatic.getAllBlocks(),scroll:!0},board:{dom:b}});this.blockMenu=this.mainWorkspace.blockMenu;this.board= +this.mainWorkspace.board;Entry.hw&&this.updateHW()}; +Entry.Playground.prototype.generatePictureView=function(a){if("workspace"==Entry.type){var b=Entry.createElement("div","entryAddPicture");b.addClass("entryPlaygroundAddPicture");b.bindOnClick(function(b){Entry.dispatchEvent("openPictureManager")});var c=Entry.createElement("div","entryAddPictureInner");c.addClass("entryPlaygroundAddPictureInner");c.innerHTML=Lang.Workspace.picture_add;b.appendChild(c);a.appendChild(b);b=Entry.createElement("ul","entryPictureList");b.addClass("entryPlaygroundPictureList"); +$&&$(b).sortable({start:function(b,a){a.item.data("start_pos",a.item.index())},stop:function(b,a){b=a.item.data("start_pos");a=a.item.index();Entry.playground.movePicture(b,a)},axis:"y"});a.appendChild(b);this.pictureListView_=b;b=Entry.createElement("div","entryPainter");b.addClass("entryPlaygroundPainter");a.appendChild(b);this.painter=new Entry.Painter;this.painter.initialize(b)}else"phone"==Entry.type&&(b=Entry.createElement("div","entryAddPicture"),b.addClass("entryPlaygroundAddPicturePhone"), +b.bindOnClick(function(b){Entry.dispatchEvent("openPictureManager")}),c=Entry.createElement("div","entryAddPictureInner"),c.addClass("entryPlaygroundAddPictureInnerPhone"),c.innerHTML=Lang.Workspace.picture_add,b.appendChild(c),a.appendChild(b),b=Entry.createElement("ul","entryPictureList"),b.addClass("entryPlaygroundPictureListPhone"),$&&$(b).sortable({start:function(b,a){a.item.data("start_pos",a.item.index())},stop:function(b,a){b=a.item.data("start_pos");a=a.item.index();Entry.playground.movePicture(b, +a)},axis:"y"}),a.appendChild(b),this.pictureListView_=b)}; +Entry.Playground.prototype.generateTextView=function(a){var b=Entry.createElement("div");a.appendChild(b);a=Entry.createElement("div");a.addClass("textProperties");b.appendChild(a);var c=Entry.createElement("div");c.addClass("entryTextFontSelect");a.appendChild(c);var d=Entry.createElement("select","entryPainterAttrFontName");d.addClass("entryPlaygroundPainterAttrFontName","entryTextFontSelecter");d.size="1";d.onchange=function(b){Entry.playground.object.entity.setFontType(b.target.value)};for(var e= +0;e p").html(Lang.Menus.linebreak_on_desc_1),$(".entryPlaygroundLinebreakDescription > ul > li").eq(0).html(Lang.Menus.linebreak_on_desc_2),$(".entryPlaygroundLinebreakDescription > ul > li").eq(1).html(Lang.Menus.linebreak_on_desc_3)); +Entry.playground.setFontAlign(Entry.playground.object.entity.getTextAlign());a=Entry.playground.object.entity.getFontSize();Entry.playground.fontSizeIndiciator.style.width=a+"%";Entry.playground.fontSizeKnob.style.left=.88*a+"px"}};Entry.Playground.prototype.injectSound=function(){var a=this.soundListView_;if(a){for(;a.hasChildNodes();)a.removeChild(a.lastChild);if(this.object)for(var b=this.object.sounds,c=0,d=b.length;c"+Lang.Menus[a]+"",{classes:["propertyTabElement","propertyTab"+a],parent:this._tabView}),f=this;e.bind("click",function(){f.select(a)});this.modes[a]&&(this.modes[a].tabDom.remove(),this.modes[a].contentDom.remove(),"hw"==a&&($(this.modes).removeClass(".propertyTabhw"),$(".propertyTabhw").unbind("dblclick")));this.modes[a]={obj:b,tabDom:e,contentDom:d};"hw"==a&&$(".propertyTabhw").bind("dblclick",function(){Entry.dispatchEvent("hwModeChange")})}; -b.resize=function(a){this._view.css({width:a+"px",top:9*a/16+123-22+"px"});430<=a?this._view.removeClass("collapsed"):this._view.addClass("collapsed");Entry.dispatchEvent("windowResized");a=this.selected;"hw"==a?this.modes.hw.obj.listPorts?this.modes[a].obj.resizeList():this.modes[a].obj.resize():this.modes[a].obj.resize()};b.select=function(a){for(var b in this.modes){var d=this.modes[b];d.tabDom.removeClass("selected");d.contentDom.addClass("entryRemove");d.obj.visible=!1}b=this.modes[a];b.tabDom.addClass("selected"); -b.contentDom.removeClass("entryRemove");b.obj.resize&&b.obj.resize();b.obj.visible=!0;this.selected=a};b.initializeSplitter=function(a){var b=this;a.bind("mousedown touchstart",function(a){b._cover.removeClass("entryRemove");Entry.container.disableSort();Entry.container.splitterEnable=!0;Entry.documentMousemove&&(Entry.container.resizeEvent=Entry.documentMousemove.attach(this,function(a){Entry.container.splitterEnable&&Entry.resizeElement({canvasWidth:a.clientX||a.x})}))});$(document).bind("mouseup touchend", -function(a){if(a=Entry.container.resizeEvent)Entry.container.splitterEnable=!1,Entry.documentMousemove.detach(a),b._cover.addClass("entryRemove"),delete Entry.container.resizeEvent;Entry.container.enableSort()})}})(Entry.PropertyPanel.prototype);Entry.init=function(b,a){Entry.assert("object"===typeof a,"Init option is not object");this.events_={};this.interfaceState={menuWidth:264};Entry.Utils.bindGlobalEvent("resize mousedown mousemove keydown keyup dispose".split(" "));this.options=a;this.parseOptions(a);this.mediaFilePath=(a.libDir?a.libDir:"/lib")+"/entryjs/images/";this.defaultPath=a.defaultDir||"";this.blockInjectPath=a.blockInjectDir||"";"workspace"==this.type&&this.isPhone()&&(this.type="phone");this.initialize_();this.view_=b;this.view_.setAttribute("class", -"entry");Entry.initFonts(a.fonts);this.createDom(b,this.type);this.loadInterfaceState();this.overridePrototype();this.maxCloneLimit=302;this.cloudSavable=!0;this.startTime=(new Date).getTime();document.onkeydown=function(a){Entry.dispatchEvent("keyPressed",a)};document.onkeyup=function(a){Entry.dispatchEvent("keyUpped",a)};window.onresize=function(a){Entry.dispatchEvent("windowResized",a)};window.onbeforeunload=this.beforeUnload;Entry.addEventListener("saveWorkspace",function(a){Entry.addActivity("save")}); -"IE"!=Entry.getBrowserType().substr(0,2)||window.flashaudio?createjs.Sound.registerPlugins([createjs.WebAudioPlugin]):(createjs.FlashAudioPlugin.swfPath=this.mediaFilePath+"media/",createjs.Sound.registerPlugins([createjs.FlashAudioPlugin]),window.flashaudio=!0);Entry.soundQueue=new createjs.LoadQueue;Entry.soundQueue.installPlugin(createjs.Sound);Entry.loadAudio_([Entry.mediaFilePath+"sounds/click.mp3",Entry.mediaFilePath+"sounds/click.wav",Entry.mediaFilePath+"sounds/click.ogg"],"entryMagneting"); -Entry.loadAudio_([Entry.mediaFilePath+"sounds/delete.mp3",Entry.mediaFilePath+"sounds/delete.ogg",Entry.mediaFilePath+"sounds/delete.wav"],"entryDelete");createjs.Sound.stop()};Entry.loadAudio_=function(b,a){if(window.Audio&&b.length)for(;0d+55)&&a>40+b*(h-d)&&(h=c.getNextScene())&&(h=$(h.view),$(document).trigger("mouseup"), -h.trigger("mousedown"))});var d=Entry.createElement("ul");d.addClass("entrySceneListWorkspace");Entry.sceneEditable&&$&&$(d).sortable({start:function(a,b){b.item.data("start_pos",b.item.index());$(b.item[0]).clone(!0)},stop:function(a,b){var c=b.item.data("start_pos"),d=b.item.index();Entry.scene.moveScene(c,d)},axis:"x",tolerance:"pointer"});this.view_.appendChild(d);this.listView_=d;Entry.sceneEditable&&(d=Entry.createElement("span"),d.addClass("entrySceneElementWorkspace"),d.addClass("entrySceneAddButtonWorkspace"), -d.bindOnClick(function(a){Entry.engine.isState("run")||Entry.scene.addScene()}),this.view_.appendChild(d),this.addButton_=d)}}; -Entry.Scene.prototype.generateElement=function(b){var a=this,c=Entry.createElement("li",b.id);c.addClass("entrySceneElementWorkspace");c.addClass("entrySceneButtonWorkspace");c.addClass("minValue");$(c).on("mousedown",function(a){Entry.engine.isState("run")?a.preventDefault():Entry.scene.selectScene(b)});var d=Entry.createElement("input");d.addClass("entrySceneFieldWorkspace");d.value=b.name;Entry.sceneEditable||(d.disabled="disabled");var e=Entry.createElement("span");e.addClass("entrySceneLeftWorkspace"); -c.appendChild(e);var f=Entry.createElement("span");f.addClass("entrySceneInputCover");f.style.width=Entry.computeInputWidth(b.name);c.appendChild(f);b.inputWrapper=f;d.onkeyup=function(c){c=c.keyCode;Entry.isArrowOrBackspace(c)||(b.name=this.value,f.style.width=Entry.computeInputWidth(b.name),a.resize(),13==c&&this.blur(),10=this.getScenes().length)Entry.toast.alert(Lang.Msgs.runtime_error,Lang.Workspace.Scene_delete_error,!1);else{var a=this.getScenes().indexOf(this.getSceneById(b.id));this.getScenes().splice(a,1);for(var a=Entry.container.getSceneObjects(b),c=0;c=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;af+55)&&b>40+a*(g-f)&&(g=c.getNextScene())&&(g=$(g.view),$(document).trigger("mouseup"), +g.trigger("mousedown"))}),a=Entry.createElement("ul"),a.addClass("entrySceneListWorkspace"),Entry.sceneEditable&&$&&$(a).sortable({start:function(b,a){a.item.data("start_pos",a.item.index());$(a.item[0]).clone(!0)},stop:function(b,a){b=a.item.data("start_pos");a=a.item.index();Entry.scene.moveScene(b,a)},axis:"x",tolerance:"pointer"}),this.view_.appendChild(a),this.listView_=a,Entry.sceneEditable&&(a=Entry.createElement("span"),a.addClass("entrySceneElementWorkspace"),a.addClass("entrySceneAddButtonWorkspace"), +a.bindOnClick(function(b){Entry.engine.isState("run")||Entry.scene.addScene()}),this.view_.appendChild(a),this.addButton_=a))}; +Entry.Scene.prototype.generateElement=function(a){var b=this,c=Entry.createElement("li",a.id);c.addClass("entrySceneElementWorkspace");c.addClass("entrySceneButtonWorkspace");c.addClass("minValue");$(c).on("mousedown",function(b){Entry.engine.isState("run")?b.preventDefault():Entry.scene.selectScene(a)});var d=Entry.createElement("input");d.addClass("entrySceneFieldWorkspace");d.value=a.name;Entry.sceneEditable||(d.disabled="disabled");var e=Entry.createElement("span");e.addClass("entrySceneLeftWorkspace"); +c.appendChild(e);var f=Entry.createElement("span");f.addClass("entrySceneInputCover");f.style.width=Entry.computeInputWidth(a.name);c.appendChild(f);a.inputWrapper=f;d.onkeyup=function(c){c=c.keyCode;Entry.isArrowOrBackspace(c)||(a.name=this.value,f.style.width=Entry.computeInputWidth(a.name),b.resize(),13==c&&this.blur(),10=this.getScenes().length)Entry.toast.alert(Lang.Msgs.runtime_error,Lang.Workspace.Scene_delete_error,!1);else{var b=this.getScenes().indexOf(this.getSceneById(a.id));this.getScenes().splice(b,1);for(var b=Entry.container.getSceneObjects(a),c=0;c=this.maxCount)Entry.toast.alert(Lang.Msgs.runtime_error,Lang.Workspace.Scene_add_error,!1);else{var b={name:a.name+Lang.Workspace.replica_of_object,id:Entry.generateHash()};this.generateElement(b);this.addScene(b);a=Entry.container.getSceneObjects(a);for(var c=a.length-1;0<=c;c--)Entry.container.addCloneObject(a[c],b.id)}}; +Entry.Scene.prototype.resize=function(){var a=this.getScenes(),b=this.selectedScene,c=a[0];if(0!==a.length&&c){var d=$(c.view).offset().left,c=parseFloat($(b.view).css("margin-left")),e=$(this.view_).width()-d,f=0,g;for(g in a){var d=a[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-=$(b.view).width(),c=e/(a.length-1)-(Entry.Scene.viewBasicWidth+c),a)d=a[g],b.id!=d.id?(d.view.removeClass("minValue"),$(d.inputWrapper).width(c)): +d.view.addClass("minValue")}};Entry.Scene.prototype.getNextScene=function(){var a=this.getScenes();return a[a.indexOf(this.selectedScene)+1]};Entry.Script=function(a){this.entity=a};p=Entry.Script.prototype; +p.init=function(a,b,c){Entry.assert("BLOCK"==a.tagName.toUpperCase(),a.tagName);this.type=a.getAttribute("type");this.id=Number(a.getAttribute("id"));a.getElementsByTagName("mutation").length&&a.getElementsByTagName("mutation")[0].hasAttribute("hashid")&&(this.hashId=a.childNodes[0].getAttribute("hashid"));"REPEAT"==this.type.substr(0,6).toUpperCase()&&(this.isRepeat=!0);b instanceof Entry.Script&&(this.previousScript=b,b.parentScript&&(this.parentScript=b.parentScript));c instanceof Entry.Script&& +(this.parentScript=c);a=a.childNodes;for(b=0;bd.style.opacity&&(clearInterval(a),d.style.display="none",Entry.removeElement(d));d.style.opacity*=.9},20)},1E3)}; -Entry.Toast.prototype.success=function(b,a,c){var d=Entry.createElement("div","entryToast");d.addClass("entryToast");d.addClass("entryToastSuccess");d.bindOnClick(function(){Entry.toast.body_.removeChild(this)});var e=Entry.createElement("div","entryToast");e.addClass("entryToastTitle");e.innerHTML=b;d.appendChild(e);b=Entry.createElement("p","entryToast");b.addClass("entryToastMessage");b.innerHTML=a;d.appendChild(b);this.toasts_.push(d);this.body_.appendChild(d);c||window.setTimeout(function(){d.style.opacity= -1;var a=setInterval(function(){.05>d.style.opacity&&(clearInterval(a),d.style.display="none",Entry.removeElement(d));d.style.opacity*=.9},20)},1E3)}; -Entry.Toast.prototype.alert=function(b,a,c){var d=Entry.createElement("div","entryToast");d.addClass("entryToast");d.addClass("entryToastAlert");d.bindOnClick(function(){Entry.toast.body_.removeChild(this)});var e=Entry.createElement("div","entryToast");e.addClass("entryToastTitle");e.innerHTML=b;d.appendChild(e);b=Entry.createElement("p","entryToast");b.addClass("entryToastMessage");b.innerHTML=a;d.appendChild(b);this.toasts_.push(d);this.body_.appendChild(d);c||window.setTimeout(function(){d.style.opacity= -1;var a=setInterval(function(){.05>d.style.opacity&&(clearInterval(a),d.style.display="none",Entry.toast.body_.removeChild(d));d.style.opacity*=.9},20)},5E3)};Entry.TvCast=function(b){this.generateView(b)};p=Entry.TvCast.prototype;p.init=function(b){this.tvCastHash=b};p.generateView=function(b){var a=Entry.createElement("div");a.addClass("entryContainerMovieWorkspace");a.addClass("entryRemove");this.movieContainer=a;a=Entry.createElement("iframe");a.setAttribute("id","tvCastIframe");a.setAttribute("allowfullscreen","");a.setAttribute("frameborder",0);a.setAttribute("src",b);this.movieFrame=a;this.movieContainer.appendChild(this.movieFrame)};p.getView=function(){return this.movieContainer}; -p.resize=function(){document.getElementById("entryContainerWorkspaceId");var b=document.getElementById("tvCastIframe");w=this.movieContainer.offsetWidth;b.width=w+"px";b.height=9*w/16+"px"};Entry.BlockDriver=function(){}; -(function(b){b.convert=function(){var a=new Date,b;for(b in Entry.block)"function"===typeof Entry.block[b]&&this._convertBlock(b);console.log((new Date).getTime()-a.getTime())};b._convertBlock=function(a){function b(a){var d={type:a.getAttribute("type"),index:{}};a=$(a).children();if(!a)return d;for(var e=0;eg&&(a.x-=d+3);a.y+e>f&&(a.y-=e);b.css({left:a.x,top:a.y})};b.hide=function(){this.dom.empty();this.dom.addClass("entryRemove");this._className&&(this.dom.removeClass(this._className),delete this._className)}})(Entry.ContextMenu);Entry.Loader={queueCount:0,totalCount:0};Entry.Loader.addQueue=function(b){this.queueCount||Entry.dispatchEvent("loadStart");this.queueCount++;this.totalCount++};Entry.Loader.removeQueue=function(b){this.queueCount--;this.queueCount||(Entry.dispatchEvent("loadComplete"),this.totalCount=0)};Entry.Loader.getLoadedPercent=function(){return 0===this.totalCount?1:this.queueCount/this.totalCount};Entry.STATIC={OBJECT:0,ENTITY:1,SPRITE:2,SOUND:3,VARIABLE:4,FUNCTION:5,SCENE:6,MESSAGE:7,BLOCK_MODEL:8,BLOCK_RENDER_MODEL:9,BOX_MODEL:10,THREAD_MODEL:11,DRAG_INSTANCE:12,BLOCK_STATIC:0,BLOCK_MOVE:1,BLOCK_FOLLOW:2,RETURN:0,CONTINUE:1,BREAK:2,PASS:3};Entry.Utils={};Entry.overridePrototype=function(){Number.prototype.mod=function(b){return(this%b+b)%b}};Entry.Utils.generateId=function(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).substr(-4)};Entry.Utils.intersectArray=function(b,a){for(var c=[],d=0;d=a.x&&e-c<=a.y&&e+b.height+c>=a.y}; -Entry.Utils.colorDarken=function(b,a){function c(a){2!=a.length&&(a="0"+a);return a}var d,e,f;7===b.length?(d=parseInt(b.substr(1,2),16),e=parseInt(b.substr(3,2),16),f=parseInt(b.substr(5,2),16)):(d=parseInt(b.substr(1,2),16),e=parseInt(b.substr(2,2),16),f=parseInt(b.substr(3,2),16));a=void 0===a?.7:a;d=c(Math.floor(d*a).toString(16));e=c(Math.floor(e*a).toString(16));f=c(Math.floor(f*a).toString(16));return"#"+d+e+f}; -Entry.Utils.colorLighten=function(b,a){a=0===a?0:a||20;var c=Entry.Utils.hexToHsl(b);c.l+=a/100;c.l=Math.min(1,Math.max(0,c.l));return Entry.Utils.hslToHex(c)};Entry.Utils.bound01=function(b,a){var c=b;"string"==typeof c&&-1!=c.indexOf(".")&&1===parseFloat(c)&&(b="100%");c="string"===typeof b&&-1!=b.indexOf("%");b=Math.min(a,Math.max(0,parseFloat(b)));c&&(b=parseInt(b*a,10)/100);return 1E-6>Math.abs(b-a)?1:b%a/parseFloat(a)}; -Entry.Utils.hexToHsl=function(b){var a,c;7===b.length?(a=parseInt(b.substr(1,2),16),c=parseInt(b.substr(3,2),16),b=parseInt(b.substr(5,2),16)):(a=parseInt(b.substr(1,2),16),c=parseInt(b.substr(2,2),16),b=parseInt(b.substr(3,2),16));a=Entry.Utils.bound01(a,255);c=Entry.Utils.bound01(c,255);b=Entry.Utils.bound01(b,255);var d=Math.max(a,c,b),e=Math.min(a,c,b),f,g=(d+e)/2;if(d==e)f=e=0;else{var h=d-e,e=.5c&&(c+=1);1c?b:c<2/3?a+(b-a)*(2/3-c)*6:a}function c(a){return 1==a.length?"0"+a:""+a}var d,e;e=Entry.Utils.bound01(b.h,360);d=Entry.Utils.bound01(b.s,1);b=Entry.Utils.bound01(b.l,1);if(0===d)d=b=e=b;else{var f=.5>b?b*(1+d):b+d-b*d,g=2*b-f;d=a(g,f,e+1/3);b=a(g,f,e);e=a(g,f,e-1/3)}b*=255;e*=255;return"#"+[c(Math.round(255*d).toString(16)),c(Math.round(b).toString(16)),c(Math.round(e).toString(16))].join("")}; -Entry.Utils.bindGlobalEvent=function(b){var a=$(document);void 0===b&&(b="resize mousedown mousemove keydown keyup dispose".split(" "));-1Entry.pressedKeys.indexOf(b)&&Entry.pressedKeys.push(b);Entry.keyPressed.notify(a)}));-1$1://$2").replace(/([xA1-xFEa-z0-9_-]+@[xA1-xFEa-z0-9-]+.[a-z0-9-]+)/gi,"$1"):""};Entry.generateHash=function(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).substr(-4)}; -Entry.addEventListener=function(b,a){this.events_||(this.events_={});this.events_[b]||(this.events_[b]=[]);a instanceof Function&&this.events_[b].push(a);return!0};Entry.dispatchEvent=function(b,a){this.events_||(this.events_={});if(this.events_[b])for(var c=0,d=this.events_[b].length;c=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;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.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", -{result:"matrixOut",in:"offOut",type:"matrix",values:"0.7 0 0 0 0 0 0.7 0 0 0 0 0 0.7 0 0 0 0 0 1 0"});d.elem("feBlend",{in:"SourceGraphic",in1:"offOut",mode:"normal"});c=c.elem("filter",{id:"entryBlockHighlightFilter_"+a});c.elem("feOffset",{result:"offOut",in:"SourceGraphic",dx:0,dy:0});c.elem("feColorMatrix",{result:"matrixOut",in:"offOut",type:"matrix",values:"1.3 0 0 0 0 0 1.3 0 0 0 0 0 1.3 0 0 0 0 0 1 0"})}; -Entry.Utils.addBlockPattern=function(b,a){for(var c=b.elem("pattern",{id:"blockHoverPattern_"+a,class:"blockHoverPattern",patternUnits:"userSpaceOnUse",patternTransform:"translate(12, 0)",x:0,y:0,width:125,height:33,style:"display: none"}),d=c.elem("g"),e=d.elem("rect",{x:0,y:0,width:125,height:33}),f=Entry.mediaFilePath+"block_pattern_(order).png",g=1;5>g;g++)d.elem("image",{class:"pattern"+g,href:f.replace("(order)",g),x:0,y:0,width:125,height:33});return{pattern:c,rect:e}}; -Entry.Utils.COLLISION={NONE:0,UP:1,RIGHT:2,LEFT:3,DOWN:4};Entry.Utils.createMouseEvent=function(b,a){var c=document.createEvent("MouseEvent");c.initMouseEvent(b,!0,!0,window,0,0,0,a.clientX,a.clientY,!1,!1,!1,!1,0,null);return c};Entry.Utils.xmlToJsonData=function(b){b=$.parseXML(b);var a=[];b=b.childNodes[0].childNodes;for(var c in b){var d=b[c];if(d.tagName){var e={category:d.getAttribute("id"),blocks:[]},d=d.childNodes;for(c in d){var f=d[c];f.tagName&&(f=f.getAttribute("type"))&&e.blocks.push(f)}a.push(e)}}return a}; -Entry.Utils.stopProjectWithToast=function(b,a,c){var d=b.block;a=a||"\ub7f0\ud0c0\uc784 \uc5d0\ub7ec \ubc1c\uc0dd";Entry.toast&&!c&&Entry.toast.alert(Lang.Msgs.warn,Lang.Workspace.check_runtime_error,!0);Entry.engine&&Entry.engine.toggleStop();"workspace"===Entry.type&&(b.block&&"funcBlock"in b.block?d=b.block.funcBlock:b.funcExecutor&&(d=b.funcExecutor.scope.block,b=b.type.replace("func_",""),Entry.Func.edit(Entry.variableContainer.functions_[b])),d&&(Entry.container.selectObject(d.getCode().object.id, -!0),d.view.getBoard().activateBlock(d)));throw Error(a);};Entry.Utils.AsyncError=function(b){this.name="AsyncError";this.message=b||"\ube44\ub3d9\uae30 \ud638\ucd9c \ub300\uae30"};Entry.Utils.AsyncError.prototype=Error();Entry.Utils.AsyncError.prototype.constructor=Entry.Utils.AsyncError;Entry.Utils.isChrome=function(){return/chrom(e|ium)/.test(navigator.userAgent.toLowerCase())}; -Entry.Utils.waitForWebfonts=function(b,a){for(var c=0,d=0,e=b.length;d=b.length&&(l&&clearInterval(l),c==b.length))return a(),!0}var h=document.createElement("span");h.innerHTML="giItT1WQy@!-/#";h.style.position="absolute";h.style.left="-10000px";h.style.top="-10000px";h.style.fontSize="300px";h.style.fontFamily="sans-serif";h.style.fontVariant="normal";h.style.fontStyle="normal";h.style.fontWeight= -"normal";h.style.letterSpacing="0";document.body.appendChild(h);var k=h.offsetWidth;h.style.fontFamily=d;var l;e()||(l=setInterval(e,50))})(b[d])};window.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(b){window.setTimeout(b,1E3/60)}}();Entry.Model=function(b,a){var c=Entry.Model;c.generateSchema(b);c.generateSetter(b);c.generateObserve(b);(void 0===a||a)&&Object.seal(b);return b}; -(function(b){b.generateSchema=function(a){var b=a.schema;if(void 0!==b){b=JSON.parse(JSON.stringify(b));a.data={};for(var d in b)(function(d){a.data[d]=b[d];Object.defineProperty(a,d,{get:function(){return a.data[d]}})})(d);a._toJSON=this._toJSON}};b.generateSetter=function(a){a.set=this.set};b.set=function(a,b){var d={},e;for(e in this.data)void 0!==a[e]&&(a[e]===this.data[e]?delete a[e]:(d[e]=this.data[e],this.data[e]=a[e]instanceof Array?a[e].concat():a[e]));b||this.notify(Object.keys(a),d)};b.generateObserve= -function(a){a.observers=[];a.observe=this.observe;a.unobserve=this.unobserve;a.notify=this.notify};b.observe=function(a,b,d,e){d=new Entry.Observer(this.observers,a,b,d);if(!1!==e)a[b]([]);return d};b.unobserve=function(a){a.destroy()};b.notify=function(a,b){"string"===typeof a&&(a=[a]);var d=this;d.observers.map(function(e){var f=a;void 0!==e.attrs&&(f=Entry.Utils.intersectArray(e.attrs,a));if(f.length)e.object[e.funcName](f.map(function(a){return{name:a,object:d,oldValue:b[a]}}))})};b._toJSON=function(){var a= -{},b;for(b in this.data)a[b]=this.data[b];return a}})(Entry.Model);Entry.Func=function(b){this.id=b?b.id:Entry.generateHash();this.content=b?new Entry.Code(b.content):new Entry.Code([[{type:"function_create",copyable:!1,deletable:!1,x:40,y:40}]]);this.blockMenuBlock=this.block=null;this.hashMap={};this.paramMap={};var a=function(){};a.prototype=Entry.block.function_general;a=new a;a.changeEvent=new Entry.Event;a.template=Lang.template.function_general;Entry.block["func_"+this.id]=a;if(b){b=this.content._blockMap;for(var c in b)Entry.Func.registerParamBlock(b[c].type); -Entry.Func.generateWsBlock(this)}Entry.Func.registerFunction(this);Entry.Func.updateMenu()};Entry.Func.threads={};Entry.Func.registerFunction=function(b){if(Entry.playground){var a=Entry.playground.mainWorkspace;a&&(this._targetFuncBlock=a.getBlockMenu().getCategoryCodes("func").createThread([{type:"func_"+b.id}]),b.blockMenuBlock=this._targetFuncBlock)}}; -Entry.Func.executeFunction=function(b){var a=this.threads[b];if(a=Entry.Engine.computeThread(a.entity,a))return this.threads[b]=a,!0;delete this.threads[b];return!1};Entry.Func.clearThreads=function(){this.threads={}};Entry.Func.prototype.init=function(b){this.id=b.id;this.content=Blockly.Xml.textToDom(b.content);this.block=Blockly.Xml.textToDom(""+b.block+"").childNodes[0]};Entry.Func.prototype.destroy=function(){this.blockMenuBlock.destroy()}; -Entry.Func.edit=function(b){this.cancelEdit();this.targetFunc=b;this.initEditView(b.content);this.bindFuncChangeEvent();this.updateMenu()};Entry.Func.initEditView=function(b){this.menuCode||this.setupMenuCode();var a=Entry.playground.mainWorkspace;a.setMode(Entry.Workspace.MODE_OVERLAYBOARD);a.changeOverlayBoardCode(b);this._workspaceStateEvent=a.changeEvent.attach(this,this.endEdit)}; -Entry.Func.endEdit=function(b){this.unbindFuncChangeEvent();this._workspaceStateEvent.destroy();delete this._workspaceStateEvent;switch(b){case "save":this.save();case "cancelEdit":this.cancelEdit()}};Entry.Func.save=function(){this.targetFunc.generateBlock(!0);Entry.variableContainer.saveFunction(this.targetFunc)}; -Entry.Func.syncFuncName=function(b){var a=0,c=[],c=b.split(" "),d="";b=[];b=Blockly.mainWorkspace.getAllBlocks();for(var e=0;eBlockly.Block.dragMode_&&(b.updateMenu(),b.fieldText=a,b.workspaceLength=c)}}; -Entry.Func.setupMenuCode=function(){var b=Entry.playground.mainWorkspace;b&&(b=b.getBlockMenu().getCategoryCodes("func"),this._fieldLabel=b.createThread([{type:"function_field_label"}]).getFirstBlock(),this._fieldString=b.createThread([{type:"function_field_string",params:[{type:this.requestParamBlock("string")}]}]).getFirstBlock(),this._fieldBoolean=b.createThread([{type:"function_field_boolean",params:[{type:this.requestParamBlock("boolean")}]}]).getFirstBlock(),this.menuCode=b)}; -Entry.Func.refreshMenuCode=function(){if(Entry.playground.mainWorkspace){this.menuCode||this.setupMenuCode();var b=Entry.block[this._fieldString.params[0].type].changeEvent._listeners.length;2'));this._hwModule=b;var a=this;Entry.addEventListener("windowResized",function(){var b=a._hwModule.monitorTemplate.mode;"both"==b&&(a.resize(),a.resizeList());"list"==b?a.resizeList():a.resize()});Entry.addEventListener("hwModeChange",function(){a.changeMode()});this.changeOffset=0;this.scale=.5;this._listPortViews={}}; -(function(b){b.initView=function(){this.svgDom=Entry.Dom($(''))};b.generateView=function(){this.snap=Entry.SVG("hwMonitor");this._svgGroup=this.snap.elem("g");this._portMap={n:[],e:[],s:[],w:[]};var a=this._hwModule.monitorTemplate,b={href:Entry.mediaFilePath+a.imgPath,x:-a.width/2,y:-a.height/2,width:a.width,height:a.height};this._portViews={};this.hwView=this._svgGroup.elem("image");this.hwView= -this.hwView.attr(b);this._template=a;a=a.ports;this.pathGroup=null;this.pathGroup=this._svgGroup.elem("g");var b=[],d;for(d in a){var e=this.generatePortView(a[d],"_svgGroup");this._portViews[d]=e;b.push(e)}b.sort(function(a,b){return a.box.x-b.box.x});var f=this._portMap;b.map(function(a){(1>(Math.atan2(-a.box.y,a.box.x)/Math.PI+2)%2?f.n:f.s).push(a)});this.resize()};b.toggleMode=function(a){var b=this._hwModule.monitorTemplate;"list"==a?(b.TempPort=null,this._hwModule.monitorTemplate.ports&&(this._hwModule.monitorTemplate.TempPort= -this._hwModule.monitorTemplate.ports,this._hwModule.monitorTemplate.listPorts=this.addPortEle(this._hwModule.monitorTemplate.listPorts,this._hwModule.monitorTemplate.ports)),$(this._svglistGroup).remove(),this._svgGroup&&$(this._svgGroup).remove(),$(this._pathGroup).remove(),this._hwModule.monitorTemplate.mode="list",this.generateListView()):(this._hwModule.monitorTemplate.TempPort&&(this._hwModule.monitorTemplate.ports=this._hwModule.monitorTemplate.TempPort,this._hwModule.monitorTemplate.listPorts= -this.removePortEle(this._hwModule.monitorTemplate.listPorts,this._hwModule.monitorTemplate.ports)),$(this._svglistGroup).remove(),this._hwModule.monitorTemplate.mode="both",this.generateListView(),this.generateView())};b.setHwmonitor=function(a){this._hwmodule=a};b.changeMode=function(a){"both"==this._hwModule.monitorTemplate.mode?this.toggleMode("list"):"list"==this._hwModule.monitorTemplate.mode&&this.toggleMode("both")};b.addPortEle=function(a,b){if("object"!=typeof b)return a;for(var d in b)a[d]= -b[d];return a};b.removePortEle=function(a,b){if("object"!=typeof b)return a;for(var d in b)delete a[d];return a};b.generateListView=function(){this._portMapList={n:[]};this._svglistGroup=null;this.listsnap=Entry.SVG("hwMonitor");this._svglistGroup=this.listsnap.elem("g");var a=this._hwModule.monitorTemplate;this._template=a;a=a.listPorts;this.pathGroup=this._svglistGroup.elem("g");var b=[],d;for(d in a){var e=this.generatePortView(a[d],"_svglistGroup");this._listPortViews[d]=e;b.push(e)}var f=this._portMapList; -b.map(function(a){f.n.push(a)});this.resizeList()};b.generatePortView=function(a,b){var d=this[b].elem("g");d.addClass("hwComponent");var e=null,e=this.pathGroup.elem("path").attr({d:"m0,0",fill:"none",stroke:"input"===a.type?"#00979d":"#A751E3","stroke-width":3}),f=d.elem("rect").attr({x:0,y:0,width:150,height:22,rx:4,ry:4,fill:"#fff",stroke:"#a0a1a1"}),g=d.elem("text").attr({x:4,y:12,fill:"#000","class":"hwComponentName","alignment-baseline":"central"});g.textContent=a.name;g=g.getComputedTextLength(); -d.elem("rect").attr({x:g+8,y:2,width:30,height:18,rx:9,ry:9,fill:"input"===a.type?"#00979d":"#A751E3"});var h=d.elem("text").attr({x:g+13,y:12,fill:"#fff","class":"hwComponentValue","alignment-baseline":"central"});h.textContent=0;g+=40;f.attr({width:g});return{group:d,value:h,type:a.type,path:e,box:{x:a.pos.x-this._template.width/2,y:a.pos.y-this._template.height/2,width:g},width:g}};b.getView=function(){return this.svgDom};b.update=function(){var a=Entry.hw.portData,b=Entry.hw.sendQueue,d=this._hwModule.monitorTemplate.mode, -e=this._hwModule.monitorTemplate.keys||[],f=[];if("list"==d)f=this._listPortViews;else if("both"==d){if(f=this._listPortViews,this._portViews)for(var g in this._portViews)f[g]=this._portViews[g]}else f=this._portViews;if(b)for(g in b)0!=b[g]&&f[g]&&(f[g].type="output");for(var h in f)if(d=f[h],"input"==d.type){var k=a[h];0=this._template.height||0>=a.height||(this.scale=a.height/this._template.height* -this._template.height/1E3,this.align())};b.resizeList=function(){var a=this.svgDom.get(0).getBoundingClientRect();this._svglistGroup.attr({transform:"translate("+a.width/2+","+a.height/2+")"});this._rect=a;this.alignList()};b.align=function(){var a=[],a=this._portMap.s.concat();this._alignNS(a,this.scale/3*this._template.height+5,27);a=this._portMap.n.concat();this._alignNS(a,-this._template.height*this.scale/3-32,-27);a=this._portMap.e.concat();this._alignEW(a,-this._template.width*this.scale/3- -5,-27);a=this._portMap.w.concat();this._alignEW(a,this._template.width*this.scale/3-32,-27)};b.alignList=function(){for(var a={},a=this._hwModule.monitorTemplate.listPorts,b=a.length,d=0;dd-(l.width+n.width/2.2)&&(f+=1,initX=h,g=0)};b._movePort=function(a,b,d,e){var f=b,g=a.box.x*this.scale,h=a.box.y*this.scale; -b>e?(f=b-a.width,b=b>g&&g>e?"M"+g+","+d+"L"+g+","+h:"M"+(b+e)/2+","+d+"l0,"+(h>d?28:-3)+"H"+g+"L"+g+","+h):b=bd?28:-3)+"H"+g+"L"+g+","+h;a.group.attr({transform:"translate("+f+","+d+")"});a.path.attr({d:b})}})(Entry.HWMonitor.prototype);Entry.HW=function(){this.connectTrial=0;this.isFirstConnect=!0;this.initSocket();this.connected=!1;this.portData={};this.sendQueue={};this.outputQueue={};this.settingQueue={};this.socketType=this.hwModule=this.selectedDevice=null;Entry.addEventListener("stop",this.setZero);this.hwInfo={11:Entry.Arduino,19:Entry.ArduinoExt,12:Entry.SensorBoard,13:Entry.CODEino,14:Entry.joystick,15:Entry.dplay,16:Entry.nemoino,17:Entry.Xbot,18:Entry.ardublock,24:Entry.Hamster,25:Entry.Albert,31:Entry.Bitbrick,42:Entry.Arduino, -51:Entry.Neobot,71:Entry.Robotis_carCont,72:Entry.Robotis_openCM70,81:Entry.Arduino}};Entry.HW.TRIAL_LIMIT=1;p=Entry.HW.prototype; -p.initSocket=function(){try{if(this.connectTrial>=Entry.HW.TRIAL_LIMIT)this.isFirstConnect||Entry.toast.alert(Lang.Menus.connect_hw,Lang.Menus.connect_fail,!1),this.isFirstConnect=!1;else{var b=this,a,c;this.connected=!1;this.connectTrial++;if(-1this.offsetX?0:a+c.maxWidth+10>this.offsetX?this.offsetX-a:c.maxWidth+10))}});this.valueSetter_.on("pressup",function(a){c.isAdjusting=!1});this.view_.addChild(this.valueSetter_); -a=Entry.variableContainer.variables_.length;this.getX()&&this.getY()?(this.setX(this.getX()),this.setY(this.getY())):(this.setX(-230+80*Math.floor(a/11)),this.setY(24*b+20-135-264*Math.floor(a/11)))}else this.view_=new createjs.Container,this.rect_=new createjs.Shape,this.view_.addChild(this.rect_),this.view_.variable=this,this.titleView_=new createjs.Text("asdf",this.FONT,"#000"),this.titleView_.textBaseline="alphabetic",this.titleView_.textAlign="center",this.titleView_.width=this.width_-2*this.BORDER, -this.titleView_.y=this.BORDER+10,this.titleView_.x=this.width_/2,this.view_.addChild(this.titleView_),this.resizeHandle_=new createjs.Shape,this.resizeHandle_.graphics.f("#1bafea").ss(1,0,0).s("#1bafea").lt(0,-9).lt(-9,0).lt(0,0),this.view_.addChild(this.resizeHandle_),this.resizeHandle_.list=this,this.resizeHandle_.on("mouseover",function(a){this.cursor="nwse-resize"}),this.resizeHandle_.on("mousedown",function(a){this.list.isResizing=!0;this.offset={x:.75*a.stageX-this.list.getWidth(),y:.75*a.stageY- -this.list.getHeight()};this.parent.cursor="nwse-resize"}),this.resizeHandle_.on("pressmove",function(a){this.list.setWidth(.75*a.stageX-this.offset.x);this.list.setHeight(.75*a.stageY-this.offset.y);this.list.updateView()}),this.view_.on("mouseover",function(a){this.cursor="move"}),this.view_.on("mousedown",function(a){"workspace"!=Entry.type||this.variable.isResizing||(this.offset={x:this.x-(.75*a.stageX-240),y:this.y-(.75*a.stageY-135)},this.cursor="move")}),this.view_.on("pressup",function(a){this.cursor= -"initial";this.variable.isResizing=!1}),this.view_.on("pressmove",function(a){"workspace"!=Entry.type||this.variable.isResizing||(this.variable.setX(.75*a.stageX-240+this.offset.x),this.variable.setY(.75*a.stageY-135+this.offset.y),this.variable.updateView())}),this.elementView=new createjs.Container,a=new createjs.Text("asdf",this.FONT,"#000"),a.textBaseline="middle",a.y=5,this.elementView.addChild(a),this.elementView.indexView=a,a=new createjs.Shape,this.elementView.addChild(a),this.elementView.valueWrapper= -a,a=new createjs.Text("fdsa",this.FONT,"#eee"),a.x=24,a.y=6,a.textBaseline="middle",this.elementView.addChild(a),this.elementView.valueView=a,this.elementView.x=this.BORDER,this.scrollButton_=new createjs.Shape,this.scrollButton_.graphics.f("#aaa").rr(0,0,7,30,3.5),this.view_.addChild(this.scrollButton_),this.scrollButton_.y=23,this.scrollButton_.list=this,this.scrollButton_.on("mousedown",function(a){this.list.isResizing=!0;this.cursor="pointer";this.offsetY=isNaN(this.offsetY)||0>this.offsetY?a.rawY/ -2:this.offsetY}),this.scrollButton_.on("pressmove",function(a){void 0===this.moveAmount?(this.y=a.target.y,this.moveAmount=!0):this.y=a.rawY/2-this.offsetY+this.list.height_/100*23;23>this.y&&(this.y=23);this.y>this.list.getHeight()-40&&(this.y=this.list.getHeight()-40);this.list.updateView()}),this.scrollButton_.on("pressup",function(a){this.moveAmount=void 0}),this.getX()&&this.getY()?(this.setX(this.getX()),this.setY(this.getY())):(a=Entry.variableContainer.lists_.length,this.setX(110*-Math.floor(a/ -6)+120),this.setY(24*b+20-135-145*Math.floor(a/6)));this.setVisible(this.isVisible());this.updateView();Entry.stage.loadVariable(this)}; -Entry.Variable.prototype.updateView=function(){if(this.view_){if(this.isVisible())if("variable"==this.type){this.view_.x=this.getX();this.view_.y=this.getY();if(this.object_){var b=Entry.container.getObject(this.object_);this.textView_.text=b?b.name+":"+this.getName():this.getName()}else this.textView_.text=this.getName();null===this._nameWidth&&(this._nameWidth=this.textView_.getMeasuredWidth());this.valueView_.x=this._nameWidth+14;this.valueView_.y=1;this.isNumber()?this.valueView_.text=this.getValue().toFixed(2).replace(".00", -""):this.valueView_.text=this.getValue();null===this._valueWidth&&(this._valueWidth=this.valueView_.getMeasuredWidth());this.rect_.graphics.clear().f("#ffffff").ss(1,2,0).s("#A0A1A1").rc(0,-14,this._nameWidth+this._valueWidth+26,20,4,4,4,4);this.wrapper_.graphics.clear().f("#1bafea").ss(1,2,0).s("#1bafea").rc(this._nameWidth+7,-11,this._valueWidth+15,14,7,7,7,7)}else if("slide"==this.type)this.view_.x=this.getX(),this.view_.y=this.getY(),this.object_?(b=Entry.container.getObject(this.object_),this.textView_.text= -b?b.name+":"+this.getName():this.getName()):this.textView_.text=this.getName(),null===this._nameWidth&&(this._nameWidth=this.textView_.getMeasuredWidth()),this.valueView_.x=this._nameWidth+14,this.valueView_.y=1,this.isNumber()?this.valueView_.text=this.getValue().toFixed(2).replace(".00",""):this.valueView_.text=this.getValue(),null===this._valueWidth&&(this._valueWidth=this.valueView_.getMeasuredWidth()),b=this._nameWidth+this._valueWidth+26,b=Math.max(b,90),this.rect_.graphics.clear().f("#ffffff").ss(1, -2,0).s("#A0A1A1").rc(0,-14,b,33,4,4,4,4),this.wrapper_.graphics.clear().f("#1bafea").ss(1,2,0).s("#1bafea").rc(this._nameWidth+7,-11,this._valueWidth+15,14,7,7,7,7),b=this._nameWidth+this._valueWidth+26,b=Math.max(b,90),this.maxWidth=b-20,this.slideBar_.graphics.clear().beginFill("#A0A1A1").s("#A0A1A1").ss(1).dr(10,10,this.maxWidth,1.5),b=this.getSlidePosition(this.maxWidth),this.valueSetter_.graphics.clear().beginFill("#1bafea").s("#A0A1A1").ss(1).dc(b,10.5,3);else if("list"==this.type){this.view_.x= -this.getX();this.view_.y=this.getY();this.resizeHandle_.x=this.width_-2;this.resizeHandle_.y=this.height_-2;var a=this.getName();this.object_&&(b=Entry.container.getObject(this.object_))&&(a=b.name+":"+a);a=7this.getHeight()-40&&(this.scrollButton_.y=this.getHeight()-40),this.elementView.valueWrapper.graphics.clear().f("#1bafea").rr(20,-2,this.getWidth()-20-10-2*this.BORDER,17,2),this.scrollButton_.visible=!0,this.scrollButton_.x=this.getWidth()-12,this.scrollPosition=Math.floor((this.scrollButton_.y-23)/(this.getHeight()-23-40)*(this.array_.length-b))):(this.elementView.valueWrapper.graphics.clear().f("#1bafea").rr(20,-2,this.getWidth()-20-2*this.BORDER, -17,2),this.scrollButton_.visible=!1,this.scrollPosition=0);for(a=this.scrollPosition;ac.length?c+"..":c;this.elementView.valueView.text=c;c=this.elementView.clone(!0);c.y=20*(a-this.scrollPosition)+23;this.view_.addChild(c)}}else"answer"==this.type?(this.view_.x=this.getX(),this.view_.y= +Entry.Stage.prototype.initObjectContainers=function(){var a=Entry.scene.scenes_;if(a&&0!==a.length){for(var b=0;bd.style.opacity&&(clearInterval(b),d.style.display="none",Entry.removeElement(d));d.style.opacity*=.9},20)},1E3)}; +Entry.Toast.prototype.success=function(a,b,c){var d=Entry.createElement("div","entryToast");d.addClass("entryToast");d.addClass("entryToastSuccess");d.bindOnClick(function(){Entry.toast.body_.removeChild(this)});var e=Entry.createElement("div","entryToast");e.addClass("entryToastTitle");e.innerHTML=a;d.appendChild(e);a=Entry.createElement("p","entryToast");a.addClass("entryToastMessage");a.innerHTML=b;d.appendChild(a);this.toasts_.push(d);this.body_.appendChild(d);c||window.setTimeout(function(){d.style.opacity= +1;var b=setInterval(function(){.05>d.style.opacity&&(clearInterval(b),d.style.display="none",Entry.removeElement(d));d.style.opacity*=.9},20)},1E3)}; +Entry.Toast.prototype.alert=function(a,b,c){var d=Entry.createElement("div","entryToast");d.addClass("entryToast");d.addClass("entryToastAlert");d.bindOnClick(function(){Entry.toast.body_.removeChild(this)});var e=Entry.createElement("div","entryToast");e.addClass("entryToastTitle");e.innerHTML=a;d.appendChild(e);a=Entry.createElement("p","entryToast");a.addClass("entryToastMessage");a.innerHTML=b;d.appendChild(a);this.toasts_.push(d);this.body_.appendChild(d);c||window.setTimeout(function(){d.style.opacity= +1;var b=setInterval(function(){.05>d.style.opacity&&(clearInterval(b),d.style.display="none",Entry.toast.body_.removeChild(d));d.style.opacity*=.9},20)},5E3)};Entry.TvCast=function(a){this.generateView(a)};p=Entry.TvCast.prototype;p.init=function(a){this.tvCastHash=a};p.generateView=function(a){var b=Entry.createElement("div");b.addClass("entryContainerMovieWorkspace");b.addClass("entryRemove");this.movieContainer=b;b=Entry.createElement("iframe");b.setAttribute("id","tvCastIframe");b.setAttribute("allowfullscreen","");b.setAttribute("frameborder",0);b.setAttribute("src",a);this.movieFrame=b;this.movieContainer.appendChild(this.movieFrame)};p.getView=function(){return this.movieContainer}; +p.resize=function(){document.getElementById("entryContainerWorkspaceId");var a=document.getElementById("tvCastIframe");w=this.movieContainer.offsetWidth;a.width=w+"px";a.height=9*w/16+"px"};Entry.ContextMenu={}; +(function(a){a.createDom=function(){this.dom=Entry.Dom("ul",{id:"entry-contextmenu",parent:$("body")});Entry.Utils.disableContextmenu(this.dom);Entry.documentMousedown.attach(this,function(){this.hide()})};a.show=function(b,a){this.dom||this.createDom();if(0!==b.length){var d=this;void 0!==a&&(this._className=a,this.dom.addClass(a));a=this.dom;a.empty();for(var e=0,f=b.length;eg&&(b.x-=d+3);b.y+e>f&&(b.y-=e);a.css({left:b.x,top:b.y})};a.hide=function(){this.dom.empty();this.dom.addClass("entryRemove");this._className&&(this.dom.removeClass(this._className),delete this._className)}})(Entry.ContextMenu);Entry.Loader={queueCount:0,totalCount:0};Entry.Loader.addQueue=function(a){this.queueCount||Entry.dispatchEvent("loadStart");this.queueCount++;this.totalCount++};Entry.Loader.removeQueue=function(a){this.queueCount--;this.queueCount||(Entry.dispatchEvent("loadComplete"),this.totalCount=0)};Entry.Loader.getLoadedPercent=function(){return 0===this.totalCount?1:this.queueCount/this.totalCount};Entry.Variable=function(a){Entry.assert("string"==typeof a.name,"Variable name must be given");this.name_=a.name;this.id_=a.id?a.id:Entry.generateHash();this.type=a.variableType?a.variableType:"variable";this.object_=a.object||null;this.isCloud_=a.isCloud||!1;this._valueWidth=this._nameWidth=null;var b=Entry.parseNumber(a.value);this.value_="number"==typeof b?b:a.value?a.value:0;"slide"==this.type?(this.minValue_=Number(a.minValue?a.minValue:0),this.maxValue_=Number(a.maxValue?a.maxValue:100)):"list"== +this.type&&(this.array_=a.array?a.array:[]);a.isClone||(this.visible_=a.visible||"boolean"==typeof a.visible?a.visible:!0,this.x_=a.x?a.x:null,this.y_=a.y?a.y:null,"list"==this.type&&(this.width_=a.width?a.width:100,this.height_=a.height?a.height:120,this.scrollPosition=0),this.BORDER=6,this.FONT="10pt NanumGothic")}; +Entry.Variable.prototype.generateView=function(a){var b=this.type;if("variable"==b||"timer"==b||"answer"==b)this.view_=new createjs.Container,this.rect_=new createjs.Shape,this.view_.addChild(this.rect_),this.view_.variable=this,this.wrapper_=new createjs.Shape,this.view_.addChild(this.wrapper_),this.textView_=new createjs.Text("asdf",this.FONT,"#000000"),this.textView_.textBaseline="alphabetic",this.textView_.x=4,this.textView_.y=1,this.view_.addChild(this.textView_),this.valueView_=new createjs.Text("asdf", +"10pt NanumGothic","#ffffff"),this.valueView_.textBaseline="alphabetic",b=Entry.variableContainer.variables_.length,this.getX()&&this.getY()?(this.setX(this.getX()),this.setY(this.getY())):(this.setX(-230+80*Math.floor(b/11)),this.setY(24*a+20-135-264*Math.floor(b/11))),this.view_.visible=this.visible_,this.view_.addChild(this.valueView_),this.view_.on("mousedown",function(b){"workspace"==Entry.type&&(this.offset={x:this.x-(.75*b.stageX-240),y:this.y-(.75*b.stageY-135)},this.cursor="move")}),this.view_.on("pressmove", +function(b){"workspace"==Entry.type&&(this.variable.setX(.75*b.stageX-240+this.offset.x),this.variable.setY(.75*b.stageY-135+this.offset.y),this.variable.updateView())});else if("slide"==b){var c=this;this.view_=new createjs.Container;this.rect_=new createjs.Shape;this.view_.addChild(this.rect_);this.view_.variable=this;this.wrapper_=new createjs.Shape;this.view_.addChild(this.wrapper_);this.textView_=new createjs.Text("name",this.FONT,"#000000");this.textView_.textBaseline="alphabetic";this.textView_.x= +4;this.textView_.y=1;this.view_.addChild(this.textView_);this.valueView_=new createjs.Text("value","10pt NanumGothic","#ffffff");this.valueView_.textBaseline="alphabetic";this.view_.on("mousedown",function(b){"workspace"==Entry.type&&(this.offset={x:this.x-(.75*b.stageX-240),y:this.y-(.75*b.stageY-135)})});this.view_.on("pressmove",function(b){"workspace"!=Entry.type||c.isAdjusting||(this.variable.setX(.75*b.stageX-240+this.offset.x),this.variable.setY(.75*b.stageY-135+this.offset.y),this.variable.updateView())}); +this.view_.visible=this.visible_;this.view_.addChild(this.valueView_);b=this.textView_.getMeasuredWidth()+this.valueView_.getMeasuredWidth()+26;b=Math.max(b,90);this.maxWidth=b-20;this.slideBar_=new createjs.Shape;this.slideBar_.graphics.beginFill("#A0A1A1").s("#A0A1A1").ss(1).dr(10,10,this.maxWidth,1.5);this.view_.addChild(this.slideBar_);b=this.getSlidePosition(this.maxWidth);this.valueSetter_=new createjs.Shape;this.valueSetter_.graphics.beginFill("#1bafea").s("#A0A1A1").ss(1).dc(b,10.5,3);this.valueSetter_.cursor= +"pointer";this.valueSetter_.on("mousedown",function(b){Entry.engine.isState("run")&&(c.isAdjusting=!0,this.offsetX=-(this.x-.75*b.stageX+240))});this.valueSetter_.on("pressmove",function(b){if(Entry.engine.isState("run")){var a=this.offsetX;this.offsetX=-(this.x-.75*b.stageX+240);a!==this.offsetX&&(b=c.getX(),c.setSlideCommandX(b+10>this.offsetX?0:b+c.maxWidth+10>this.offsetX?this.offsetX-b:c.maxWidth+10))}});this.valueSetter_.on("pressup",function(b){c.isAdjusting=!1});this.view_.addChild(this.valueSetter_); +b=Entry.variableContainer.variables_.length;this.getX()&&this.getY()?(this.setX(this.getX()),this.setY(this.getY())):(this.setX(-230+80*Math.floor(b/11)),this.setY(24*a+20-135-264*Math.floor(b/11)))}else this.view_=new createjs.Container,this.rect_=new createjs.Shape,this.view_.addChild(this.rect_),this.view_.variable=this,this.titleView_=new createjs.Text("asdf",this.FONT,"#000"),this.titleView_.textBaseline="alphabetic",this.titleView_.textAlign="center",this.titleView_.width=this.width_-2*this.BORDER, +this.titleView_.y=this.BORDER+10,this.titleView_.x=this.width_/2,this.view_.addChild(this.titleView_),this.resizeHandle_=new createjs.Shape,this.resizeHandle_.graphics.f("#1bafea").ss(1,0,0).s("#1bafea").lt(0,-9).lt(-9,0).lt(0,0),this.view_.addChild(this.resizeHandle_),this.resizeHandle_.list=this,this.resizeHandle_.on("mouseover",function(b){this.cursor="nwse-resize"}),this.resizeHandle_.on("mousedown",function(b){this.list.isResizing=!0;this.offset={x:.75*b.stageX-this.list.getWidth(),y:.75*b.stageY- +this.list.getHeight()};this.parent.cursor="nwse-resize"}),this.resizeHandle_.on("pressmove",function(b){this.list.setWidth(.75*b.stageX-this.offset.x);this.list.setHeight(.75*b.stageY-this.offset.y);this.list.updateView()}),this.view_.on("mouseover",function(b){this.cursor="move"}),this.view_.on("mousedown",function(b){"workspace"!=Entry.type||this.variable.isResizing||(this.offset={x:this.x-(.75*b.stageX-240),y:this.y-(.75*b.stageY-135)},this.cursor="move")}),this.view_.on("pressup",function(b){this.cursor= +"initial";this.variable.isResizing=!1}),this.view_.on("pressmove",function(b){"workspace"!=Entry.type||this.variable.isResizing||(this.variable.setX(.75*b.stageX-240+this.offset.x),this.variable.setY(.75*b.stageY-135+this.offset.y),this.variable.updateView())}),this.elementView=new createjs.Container,b=new createjs.Text("asdf",this.FONT,"#000"),b.textBaseline="middle",b.y=5,this.elementView.addChild(b),this.elementView.indexView=b,b=new createjs.Shape,this.elementView.addChild(b),this.elementView.valueWrapper= +b,b=new createjs.Text("fdsa",this.FONT,"#eee"),b.x=24,b.y=6,b.textBaseline="middle",this.elementView.addChild(b),this.elementView.valueView=b,this.elementView.x=this.BORDER,this.scrollButton_=new createjs.Shape,this.scrollButton_.graphics.f("#aaa").rr(0,0,7,30,3.5),this.view_.addChild(this.scrollButton_),this.scrollButton_.y=23,this.scrollButton_.list=this,this.scrollButton_.on("mousedown",function(b){this.list.isResizing=!0;this.cursor="pointer";this.offsetY=isNaN(this.offsetY)||0>this.offsetY?b.rawY/ +2:this.offsetY}),this.scrollButton_.on("pressmove",function(b){void 0===this.moveAmount?(this.y=b.target.y,this.moveAmount=!0):this.y=b.rawY/2-this.offsetY+this.list.height_/100*23;23>this.y&&(this.y=23);this.y>this.list.getHeight()-40&&(this.y=this.list.getHeight()-40);this.list.updateView()}),this.scrollButton_.on("pressup",function(b){this.moveAmount=void 0}),this.getX()&&this.getY()?(this.setX(this.getX()),this.setY(this.getY())):(b=Entry.variableContainer.lists_.length,this.setX(110*-Math.floor(b/ +6)+120),this.setY(24*a+20-135-145*Math.floor(b/6)));this.setVisible(this.isVisible());this.updateView();Entry.stage.loadVariable(this)}; +Entry.Variable.prototype.updateView=function(){if(this.view_){if(this.isVisible())if("variable"==this.type){this.view_.x=this.getX();this.view_.y=this.getY();if(this.object_){var a=Entry.container.getObject(this.object_);this.textView_.text=a?a.name+":"+this.getName():this.getName()}else this.textView_.text=this.getName();null===this._nameWidth&&(this._nameWidth=this.textView_.getMeasuredWidth());this.valueView_.x=this._nameWidth+14;this.valueView_.y=1;this.isNumber()?this.valueView_.text=this.getValue().toFixed(2).replace(".00", +""):this.valueView_.text=this.getValue();null===this._valueWidth&&(this._valueWidth=this.valueView_.getMeasuredWidth());this.rect_.graphics.clear().f("#ffffff").ss(1,2,0).s("#A0A1A1").rc(0,-14,this._nameWidth+this._valueWidth+26,20,4,4,4,4);this.wrapper_.graphics.clear().f("#1bafea").ss(1,2,0).s("#1bafea").rc(this._nameWidth+7,-11,this._valueWidth+15,14,7,7,7,7)}else if("slide"==this.type)this.view_.x=this.getX(),this.view_.y=this.getY(),this.object_?(a=Entry.container.getObject(this.object_),this.textView_.text= +a?a.name+":"+this.getName():this.getName()):this.textView_.text=this.getName(),null===this._nameWidth&&(this._nameWidth=this.textView_.getMeasuredWidth()),this.valueView_.x=this._nameWidth+14,this.valueView_.y=1,this.isNumber()?this.valueView_.text=this.getValue().toFixed(2).replace(".00",""):this.valueView_.text=this.getValue(),null===this._valueWidth&&(this._valueWidth=this.valueView_.getMeasuredWidth()),a=this._nameWidth+this._valueWidth+26,a=Math.max(a,90),this.rect_.graphics.clear().f("#ffffff").ss(1, +2,0).s("#A0A1A1").rc(0,-14,a,33,4,4,4,4),this.wrapper_.graphics.clear().f("#1bafea").ss(1,2,0).s("#1bafea").rc(this._nameWidth+7,-11,this._valueWidth+15,14,7,7,7,7),a=this._nameWidth+this._valueWidth+26,a=Math.max(a,90),this.maxWidth=a-20,this.slideBar_.graphics.clear().beginFill("#A0A1A1").s("#A0A1A1").ss(1).dr(10,10,this.maxWidth,1.5),a=this.getSlidePosition(this.maxWidth),this.valueSetter_.graphics.clear().beginFill("#1bafea").s("#A0A1A1").ss(1).dc(a,10.5,3);else if("list"==this.type){this.view_.x= +this.getX();this.view_.y=this.getY();this.resizeHandle_.x=this.width_-2;this.resizeHandle_.y=this.height_-2;var b=this.getName();this.object_&&(a=Entry.container.getObject(this.object_))&&(b=a.name+":"+b);b=7this.getHeight()-40&&(this.scrollButton_.y=this.getHeight()-40),this.elementView.valueWrapper.graphics.clear().f("#1bafea").rr(20,-2,this.getWidth()-20-10-2*this.BORDER,17,2),this.scrollButton_.visible=!0,this.scrollButton_.x=this.getWidth()-12,this.scrollPosition=Math.floor((this.scrollButton_.y-23)/(this.getHeight()-23-40)*(this.array_.length-a))):(this.elementView.valueWrapper.graphics.clear().f("#1bafea").rr(20,-2,this.getWidth()-20-2*this.BORDER, +17,2),this.scrollButton_.visible=!1,this.scrollPosition=0);for(b=this.scrollPosition;bc.length?c+"..":c;this.elementView.valueView.text=c;c=this.elementView.clone(!0);c.y=20*(b-this.scrollPosition)+23;this.view_.addChild(c)}}else"answer"==this.type?(this.view_.x=this.getX(),this.view_.y= this.getY(),this.textView_.text=this.getName(),this.valueView_.y=1,this.isNumber()?parseInt(this.getValue(),10)==this.getValue()?this.valueView_.text=this.getValue():this.valueView_.text=this.getValue().toFixed(1).replace(".00",""):this.valueView_.text=this.getValue(),null===this._nameWidth&&(this._nameWidth=this.textView_.getMeasuredWidth()),null===this._valueWidth&&(this._valueWidth=this.valueView_.getMeasuredWidth()),this.valueView_.x=this._nameWidth+14,this.rect_.graphics.clear().f("#ffffff").ss(1, 2,0).s("#A0A1A1").rc(0,-14,this._nameWidth+this._valueWidth+26,20,4,4,4,4),this.wrapper_.graphics.clear().f("#E457DC").ss(1,2,0).s("#E457DC").rc(this._nameWidth+7,-11,this._valueWidth+15,14,7,7,7,7)):(this.view_.x=this.getX(),this.view_.y=this.getY(),this.textView_.text=this.getName(),null===this._nameWidth&&(this._nameWidth=this.textView_.getMeasuredWidth()),this.valueView_.x=this._nameWidth+14,this.valueView_.y=1,this.isNumber()?this.valueView_.text=this.getValue().toFixed(1).replace(".00",""): this.valueView_.text=this.getValue(),null===this._valueWidth&&(this._valueWidth=this.valueView_.getMeasuredWidth()),this.rect_.graphics.clear().f("#ffffff").ss(1,2,0).s("#A0A1A1").rc(0,-14,this._nameWidth+this._valueWidth+26,20,4,4,4,4),this.wrapper_.graphics.clear().f("#ffbb14").ss(1,2,0).s("orange").rc(this._nameWidth+7,-11,this._valueWidth+15,14,7,7,7,7));Entry.requestUpdate=!0}};Entry.Variable.prototype.getName=function(){return this.name_}; -Entry.Variable.prototype.setName=function(b){Entry.assert("string"==typeof b,"Variable name must be string");this.name_=b;this._nameWidth=null;this.updateView();Entry.requestUpdateTwice=!0};Entry.Variable.prototype.getId=function(){return this.id_};Entry.Variable.prototype.getValue=function(){return this.isNumber()?Number(this.value_):this.value_};Entry.Variable.prototype.isNumber=function(){return isNaN(this.value_)?!1:!0}; -Entry.Variable.prototype.setValue=function(b){"slide"!=this.type?this.value_=b:(b=Number(b),this.value_=bthis.maxValue_?this.maxValue_:b);this.isCloud_&&Entry.variableContainer.updateCloudVariables();this._valueWidth=null;this.updateView();Entry.requestUpdateTwice=!0};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!==b&&(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.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; -var c=b.view.name.value.trim();b.isOpen?c&&0!==c.length?a.addVariable():(b.view.addClass("entryRemove"),b.isOpen=!1):(b.view.removeClass("entryRemove"),b.view.name.focus(),b.isOpen=!0)});this.generateVariableAddView();this.generateListAddView();this.generateVariableSplitterView();this.generateVariableSettingView();this.generateListSettingView();c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.message_create; -this.messageAddButton_=c;c.bindOnClick(function(b){a.addMessage({name:Lang.Workspace.message+" "+(a.messages_.length+1)})});c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.list_create;this.listAddButton_=c;c.bindOnClick(function(b){b=f.listAddPanel;var c=b.view.name.value.trim();b.isOpen?c&&0!==c.length?a.addList():(b.view.addClass("entryRemove"),b.isOpen=!1):(b.view.removeClass("entryRemove"),b.view.name.focus(), -b.isOpen=!0)});c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.function_add;this.functionAddButton_=c;c.bindOnClick(function(b){b=a._getBlockMenu();Entry.playground.changeViewMode("code");"func"!=b.lastSelector&&b.selectMenu("func");a.createFunction()});return b}; -Entry.VariableContainer.prototype.createSelectButton=function(b,a){var c=this;void 0===a&&(a=!0);var d=Entry.createElement("td");d.addClass("entryVariableSelectButtonWorkspace",b);d.innerHTML=Lang.Workspace[b];a?d.bindOnClick(function(a){c.selectFilter(b);this.addClass("selected")}):d.addClass("disable");return d}; -Entry.VariableContainer.prototype.selectFilter=function(b){for(var a=this.view_.getElementsByTagName("td"),c=0;cb.x_&&a.xe?!0:!1}; -Entry.VariableContainer.prototype.getListById=function(b){var a=this.lists_,c=[];if(0this._maxNameLength&&(b=this._truncName(b,"variable"));b=this.checkAllVariableName(b,"variables_")?Entry.getOrderedName(b,this.variables_,"name_"):b;var c=a.info;b={name:b,isCloud:c.isCloud,object:c.object,variableType:"variable"};a.view.addClass("entryRemove");this.resetVariableAddPanel("variable")}b=new Entry.Variable(b);Entry.stateManager&& -Entry.stateManager.addCommand("add variable",this,this.removeVariable,b);b.generateView(this.variables_.length);this.createVariableView(b);this.variables_.unshift(b);Entry.playground.reloadPlayground();this.updateList();return new Entry.State(this,this.removeVariable,b)}; -Entry.VariableContainer.prototype.removeVariable=function(b){var a=this.variables_.indexOf(b),c=b.toJSON();this.selected==b&&this.select(null);b.remove();this.variables_.splice(a,1);Entry.stateManager&&Entry.stateManager.addCommand("remove variable",this,this.addVariable,c);Entry.playground.reloadPlayground();this.updateList();return new Entry.State(this,this.addVariable,c)}; -Entry.VariableContainer.prototype.changeVariableName=function(b,a){b.name_!=a&&(Entry.isExist(a,"name_",this.variables_)?(b.listElement.nameField.value=b.name_,Entry.toast.alert(Lang.Workspace.variable_rename_failed,Lang.Workspace.variable_dup)):10this._maxNameLength&&(b=this._truncName(b,"list"));b=this.checkAllVariableName(b,"lists_")?Entry.getOrderedName(b,this.lists_,"name_"):b;b={name:b,isCloud:c.isCloud,object:c.object,variableType:"list"};a.view.addClass("entryRemove");this.resetVariableAddPanel("list")}b=new Entry.Variable(b);Entry.stateManager&&Entry.stateManager.addCommand("add list", -this,this.removeList,b);b.generateView(this.lists_.length);this.createListView(b);this.lists_.unshift(b);Entry.playground.reloadPlayground();this.updateList();return new Entry.State(this,this.removelist,b)}; -Entry.VariableContainer.prototype.createListView=function(b){var a=this,c=Entry.createElement("li"),d=Entry.createElement("div");d.addClass("entryVariableListElementWrapperWorkspace");c.appendChild(d);c.addClass("entryVariableListElementWorkspace");b.object_?c.addClass("entryListLocalElementWorkspace"):b.isCloud_?c.addClass("entryListCloudElementWorkspace"):c.addClass("entryListGlobalElementWorkspace");c.bindOnClick(function(c){a.select(b)});var e=Entry.createElement("button");e.addClass("entryVariableListElementDeleteWorkspace"); -e.bindOnClick(function(c){c.stopPropagation();a.removeList(b);a.selectedList=null;a.listSettingView.addClass("entryRemove")});var f=Entry.createElement("button");f.addClass("entryVariableListElementEditWorkspace");f.bindOnClick(function(c){c.stopPropagation();h.removeAttribute("disabled");g.removeClass("entryRemove");this.addClass("entryRemove");a.updateSelectedVariable(b);h.focus()});c.editButton=f;var g=Entry.createElement("button");g.addClass("entryVariableListElementEditWorkspace");g.addClass("entryRemove"); -g.bindOnClick(function(c){c.stopPropagation();h.blur();h.setAttribute("disabled","disabled");f.removeClass("entryRemove");this.addClass("entryRemove");a.select(b);a.updateSelectedVariable(null,"list")});c.editSaveButton=g;var h=Entry.createElement("input");h.setAttribute("disabled","disabled");h.addClass("entryVariableListElementNameWorkspace");h.value=b.name_;h.bindOnClick(function(a){a.stopPropagation()});h.onblur=function(c){(c=this.value.trim())&&0!==c.length?a.changeListName(b,this.value):(Entry.toast.alert(Lang.Msgs.warn, -Lang.Msgs.list_can_not_space),this.value=b.getName())};h.onkeydown=function(a){13==a.keyCode&&this.blur()};c.nameField=h;d.appendChild(h);d.appendChild(f);d.appendChild(g);d.appendChild(e);b.listElement=c};Entry.VariableContainer.prototype.mapVariable=function(b,a){for(var c=this.variables_.length,d=0;dc.getValue()&&c.setValue(0),100b&&(a.length=b)}this.updateListSettingView()};Entry.VariableContainer.prototype.updateViews=function(){var b=this.lists_;this.variables_.map(function(a){a.updateView()});b.map(function(a){a.updateView()})}; -Entry.VariableContainer.prototype.updateSelectedVariable=function(b,a){b?"variable"==b.type?(this.selectedVariable=b,this.updateVariableSettingView(b)):"slide"==b.type?(this.selectedVariable=b,this.updateVariableSettingView(b)):"list"==b.type&&(this.selectedList=b,this.updateListSettingView(b)):(this.selectedVariable=null,"variable"==(a||"variable")?this.variableSettingView.addClass("entryRemove"):this.listSettingView.addClass("entryRemove"))}; -Entry.VariableContainer.prototype.removeLocalVariables=function(b){var a=[],c=this;this.mapVariable(function(b,c){b.object_&&b.object_==c&&a.push(b)},b);a.map(function(a){c.removeVariable(a)})}; -Entry.VariableContainer.prototype.updateCloudVariables=function(){var b=Entry.projectId;if(Entry.cloudSavable&&b){var a=Entry.variableContainer,b=a.variables_.filter(function(a){return a.isCloud_}),b=b.map(function(a){return a.toJSON()}),a=a.lists_.filter(function(a){return a.isCloud_}),a=a.map(function(a){return a.toJSON()});$.ajax({url:"/api/project/variable/"+Entry.projectId,type:"PUT",data:{variables:b,lists:a}}).done(function(){})}}; -Entry.VariableContainer.prototype.addRef=function(b,a){if(this.view_&&Entry.playground.mainWorkspace&&Entry.playground.mainWorkspace.getMode()===Entry.Workspace.MODE_BOARD){var c={object:a.getCode().object,block:a};a.funcBlock&&(c.funcBlock=a.funcBlock,delete a.funcBlock);this[b].push(c);if("_functionRefs"==b)for(var d=a.type.substr(5),e=Entry.variableContainer.functions_[d].content.getBlockList(),f=0;fthis.maxValue_?this.maxValue_:a);this.isCloud_&&Entry.variableContainer.updateCloudVariables();this._valueWidth=null;this.updateView();Entry.requestUpdateTwice=!0};Entry.Variable.prototype.isVisible=function(){return this.visible_}; +Entry.Variable.prototype.setVisible=function(a){Entry.assert("boolean"==typeof a,"Variable visible state must be boolean");this.visible!==a&&(this.visible_=this.view_.visible=a,this.updateView())};Entry.Variable.prototype.setX=function(a){this.x_=a;this.updateView()};Entry.Variable.prototype.getX=function(){return this.x_};Entry.Variable.prototype.setY=function(a){this.y_=a;this.updateView()};Entry.Variable.prototype.getY=function(){return this.y_}; +Entry.Variable.prototype.setWidth=function(a){this.width_=100>a?100:a;this.updateView()};Entry.Variable.prototype.getWidth=function(){return this.width_};Entry.Variable.prototype.isInList=function(a,b){this.getX();this.getY()};Entry.Variable.prototype.setHeight=function(a){this.height_=100>a?100:a;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(a){this.setX(a.x);this.setY(a.y);this.id_=a.id;this.setVisible(a.visible);this.setValue(a.value);this.setName(a.name);this.isCloud_=a.isCloud;"list"==this.type&&(this.setWidth(a.width),this.setHeight(a.height),this.array_=a.array)}; +Entry.Variable.prototype.toJSON=function(){var a={};a.name=this.name_;a.id=this.id_;a.visible=this.visible_;a.value=this.value_;a.variableType=this.type;"list"==this.type?(a.width=this.getWidth(),a.height=this.getHeight(),a.array=JSON.parse(JSON.stringify(this.array_))):"slide"==this.type&&(a.minValue=this.minValue_,a.maxValue=this.maxValue_);a.isCloud=this.isCloud_;a.object=this.object_;a.x=this.x_;a.y=this.y_;return a};Entry.Variable.prototype.remove=function(){Entry.stage.removeVariable(this)}; +Entry.Variable.prototype.clone=function(){var a=this.toJSON();a.isClone=!0;return a=new Entry.Variable(a)};Entry.Variable.prototype.getType=function(){return this.type};Entry.Variable.prototype.setType=function(a){this.type=a};Entry.Variable.prototype.getSlidePosition=function(a){var b=this.minValue_;return Math.abs(this.value_-b)/Math.abs(this.maxValue_-b)*a+10}; +Entry.Variable.prototype.setSlideCommandX=function(a){var b=this.valueSetter_.graphics.command;a=Math.max("undefined"==typeof a?10:a,10);a=Math.min(this.maxWidth+10,a);b.x=a;this.updateSlideValueByView()}; +Entry.Variable.prototype.updateSlideValueByView=function(){var a=Math.max(this.valueSetter_.graphics.command.x-10,0)/this.maxWidth;0>a&&(a=0);1c&&(a=this.maxValue_);this.isFloatPoint()||(a=Math.round(a));this.setValue(a)};Entry.Variable.prototype.getMinValue=function(){return this.minValue_}; +Entry.Variable.prototype.setMinValue=function(a){this.minValue_=a;this.value_a&&(this.value_=a);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(a){var b=this;this.view_=a;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(a){a=f.variableAddPanel; +var c=a.view.name.value.trim();a.isOpen?c&&0!==c.length?b.addVariable():(a.view.addClass("entryRemove"),a.isOpen=!1):(a.view.removeClass("entryRemove"),a.view.name.focus(),a.isOpen=!0)});this.generateVariableAddView();this.generateListAddView();this.generateVariableSplitterView();this.generateVariableSettingView();this.generateListSettingView();c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.message_create; +this.messageAddButton_=c;c.bindOnClick(function(a){b.addMessage({name:Lang.Workspace.message+" "+(b.messages_.length+1)})});c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.list_create;this.listAddButton_=c;c.bindOnClick(function(a){a=f.listAddPanel;var c=a.view.name.value.trim();a.isOpen?c&&0!==c.length?b.addList():(a.view.addClass("entryRemove"),a.isOpen=!1):(a.view.removeClass("entryRemove"),a.view.name.focus(), +a.isOpen=!0)});c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.function_add;this.functionAddButton_=c;c.bindOnClick(function(a){a=b._getBlockMenu();Entry.playground.changeViewMode("code");"func"!=a.lastSelector&&a.selectMenu("func");b.createFunction()});return a}; +Entry.VariableContainer.prototype.createSelectButton=function(a,b){var c=this;void 0===b&&(b=!0);var d=Entry.createElement("td");d.addClass("entryVariableSelectButtonWorkspace",a);d.innerHTML=Lang.Workspace[a];b?d.bindOnClick(function(b){c.selectFilter(a);this.addClass("selected")}):d.addClass("disable");return d}; +Entry.VariableContainer.prototype.selectFilter=function(a){for(var b=this.view_.getElementsByTagName("td"),c=0;ca.x_&&b.xe?!0:!1}; +Entry.VariableContainer.prototype.getListById=function(a){var b=this.lists_,c=[];if(0this._maxNameLength&&(a=this._truncName(a,"variable"));a=this.checkAllVariableName(a,"variables_")?Entry.getOrderedName(a,this.variables_,"name_"):a;var c=b.info;a={name:a,isCloud:c.isCloud,object:c.object,variableType:"variable"};b.view.addClass("entryRemove");this.resetVariableAddPanel("variable")}a=new Entry.Variable(a);Entry.stateManager&& +Entry.stateManager.addCommand("add variable",this,this.removeVariable,a);a.generateView(this.variables_.length);this.createVariableView(a);this.variables_.unshift(a);Entry.playground.reloadPlayground();this.updateList();return new Entry.State(this,this.removeVariable,a)}; +Entry.VariableContainer.prototype.removeVariable=function(a){var b=this.variables_.indexOf(a),c=a.toJSON();this.selected==a&&this.select(null);a.remove();this.variables_.splice(b,1);Entry.stateManager&&Entry.stateManager.addCommand("remove variable",this,this.addVariable,c);Entry.playground.reloadPlayground();this.updateList();return new Entry.State(this,this.addVariable,c)}; +Entry.VariableContainer.prototype.changeVariableName=function(a,b){a.name_!=b&&(Entry.isExist(b,"name_",this.variables_)?(a.listElement.nameField.value=a.name_,Entry.toast.alert(Lang.Workspace.variable_rename_failed,Lang.Workspace.variable_dup)):10this._maxNameLength&&(a=this._truncName(a,"list"));a=this.checkAllVariableName(a,"lists_")?Entry.getOrderedName(a,this.lists_,"name_"):a;a={name:a,isCloud:c.isCloud,object:c.object,variableType:"list"};b.view.addClass("entryRemove");this.resetVariableAddPanel("list")}a=new Entry.Variable(a);Entry.stateManager&&Entry.stateManager.addCommand("add list", +this,this.removeList,a);a.generateView(this.lists_.length);this.createListView(a);this.lists_.unshift(a);Entry.playground.reloadPlayground();this.updateList();return new Entry.State(this,this.removelist,a)}; +Entry.VariableContainer.prototype.createListView=function(a){var b=this,c=Entry.createElement("li"),d=Entry.createElement("div");d.addClass("entryVariableListElementWrapperWorkspace");c.appendChild(d);c.addClass("entryVariableListElementWorkspace");a.object_?c.addClass("entryListLocalElementWorkspace"):a.isCloud_?c.addClass("entryListCloudElementWorkspace"):c.addClass("entryListGlobalElementWorkspace");c.bindOnClick(function(c){b.select(a)});var e=Entry.createElement("button");e.addClass("entryVariableListElementDeleteWorkspace"); +e.bindOnClick(function(c){c.stopPropagation();b.removeList(a);b.selectedList=null;b.listSettingView.addClass("entryRemove")});var f=Entry.createElement("button");f.addClass("entryVariableListElementEditWorkspace");f.bindOnClick(function(c){c.stopPropagation();h.removeAttribute("disabled");g.removeClass("entryRemove");this.addClass("entryRemove");b.updateSelectedVariable(a);h.focus()});c.editButton=f;var g=Entry.createElement("button");g.addClass("entryVariableListElementEditWorkspace");g.addClass("entryRemove"); +g.bindOnClick(function(c){c.stopPropagation();h.blur();h.setAttribute("disabled","disabled");f.removeClass("entryRemove");this.addClass("entryRemove");b.select(a);b.updateSelectedVariable(null,"list")});c.editSaveButton=g;var h=Entry.createElement("input");h.setAttribute("disabled","disabled");h.addClass("entryVariableListElementNameWorkspace");h.value=a.name_;h.bindOnClick(function(b){b.stopPropagation()});h.onblur=function(c){(c=this.value.trim())&&0!==c.length?b.changeListName(a,this.value):(Entry.toast.alert(Lang.Msgs.warn, +Lang.Msgs.list_can_not_space),this.value=a.getName())};h.onkeydown=function(b){13==b.keyCode&&this.blur()};c.nameField=h;d.appendChild(h);d.appendChild(f);d.appendChild(g);d.appendChild(e);a.listElement=c};Entry.VariableContainer.prototype.mapVariable=function(a,b){for(var c=this.variables_.length,d=0;dc.getValue()&&c.setValue(0),100a&&(b.length=a)}this.updateListSettingView()};Entry.VariableContainer.prototype.updateViews=function(){var a=this.lists_;this.variables_.map(function(b){b.updateView()});a.map(function(b){b.updateView()})}; +Entry.VariableContainer.prototype.updateSelectedVariable=function(a,b){a?"variable"==a.type?(this.selectedVariable=a,this.updateVariableSettingView(a)):"slide"==a.type?(this.selectedVariable=a,this.updateVariableSettingView(a)):"list"==a.type&&(this.selectedList=a,this.updateListSettingView(a)):(this.selectedVariable=null,"variable"==(b||"variable")?this.variableSettingView.addClass("entryRemove"):this.listSettingView.addClass("entryRemove"))}; +Entry.VariableContainer.prototype.removeLocalVariables=function(a){var b=[],c=this;this.mapVariable(function(a,c){a.object_&&a.object_==c&&b.push(a)},a);b.map(function(b){c.removeVariable(b)})}; +Entry.VariableContainer.prototype.updateCloudVariables=function(){var a=Entry.projectId;if(Entry.cloudSavable&&a){var b=Entry.variableContainer,a=b.variables_.filter(function(b){return b.isCloud_}),a=a.map(function(b){return b.toJSON()}),b=b.lists_.filter(function(b){return b.isCloud_}),b=b.map(function(b){return b.toJSON()});$.ajax({url:"/api/project/variable/"+Entry.projectId,type:"PUT",data:{variables:a,lists:b}}).done(function(){})}}; +Entry.VariableContainer.prototype.addRef=function(a,b){if(this.view_&&Entry.playground.mainWorkspace&&Entry.playground.mainWorkspace.getMode()===Entry.Workspace.MODE_BOARD){var c={object:b.getCode().object,block:b};b.funcBlock&&(c.funcBlock=b.funcBlock,delete b.funcBlock);this[a].push(c);if("_functionRefs"==a){a=b.type.substr(5);for(var d=Entry.variableContainer.functions_[a].content.getBlockList(),e=0;ethis.events[a].indexOf(f)&&this.events[a].push(f)}}this._schema.event&&this.thread.registerEvent(this,this._schema.event);b=this.params;a=this._schema.params;for(e=0;a&&eEntry.Albert.tempo&&(Entry.Albert.tempo=1);return a.callReturn()}}, -albert_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:"albert_set_tempo_to"},paramsKeyMap:{VALUE:0},"class":"albert_buzzer",isNotFor:["albert"],func:function(b,a){Entry.Albert.tempo=a.getNumberValue("VALUE");1>Entry.Albert.tempo&&(Entry.Albert.tempo=1);return a.callReturn()}},albert_move_forward:{color:"#00979D",skeleton:"basic", -statements:[],params:[{type:"Indicator",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 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;c.leftWheel=30;c.rightWheel=30;setTimeout(function(){a.timeFlag=0},1E3);return a}},albert_move_backward:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator", -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", -"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", -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])}}, -arduino_get_digital_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[{type:"arduino_get_port_number"}],type:"arduino_get_digital_value"},paramsKeyMap:{VALUE:0},"class":"arduino_value",isNotFor:["arduino"],func:function(b,a){var c=a.getNumberValue("VALUE",a);return Entry.hw.getDigitalPortValue(c)}},arduino_toggle_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"}, -{type:"Dropdown",options:[[Lang.Blocks.ARDUINO_on,"on"],[Lang.Blocks.ARDUINO_off,"off"]],value:"on",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"arduino_get_port_number"},null,null],type:"arduino_toggle_led"},paramsKeyMap:{VALUE:0,OPERATOR:1},"class":"arduino_set",isNotFor:["arduino"],func:function(b,a){var c=a.getNumberValue("VALUE"),d="on"==a.getField("OPERATOR")?255:0;Entry.hw.setDigitalPortValue(c, -d);return a.callReturn()}},arduino_toggle_pwm:{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:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"arduino_toggle_pwm"},paramsKeyMap:{PORT:0,VALUE:1},"class":"arduino_set",isNotFor:["arduino"],func:function(b,a){var c=a.getNumberValue("PORT"),d=a.getNumberValue("VALUE"), -d=Math.round(d),d=Math.max(d,0),d=Math.min(d,255);Entry.hw.setDigitalPortValue(c,d);return a.callReturn()}},arduino_convert_scale:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number",id:"bl5e"}]},{type:"number", -params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"arduino_convert_scale"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2,VALUE4:3,VALUE5:4},"class":"arduino",isNotFor:["arduino"],func:function(b,a){var c=a.getNumberValue("VALUE1",a),d=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a),f=a.getNumberValue("VALUE4",a),g=a.getNumberValue("VALUE5",a);if(d>e)var h=d,d=e,e=h;f>g&&(h=f,f=g,g=h);c-=d;c*=(g-f)/(e-d);c+=f;c=Math.min(g,c);c=Math.max(f, -c);return Math.round(c)}},arduino_ext_get_analog_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["A0","0"],["A1","1"],["A2","2"],["A3","3"],["A4","4"],["A5","5"]],value:"0",fontSize:11}],events:{},def:{params:[null],type:"arduino_ext_get_analog_value"},paramsKeyMap:{PORT:0},"class":"ArduinoExtGet",isNotFor:["ArduinoExt"],func:function(b,a){var c=a.getField("PORT",a),d=Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.ANALOG), -e=Entry.hw.portData.TIME||0;Entry.ArduinoExt.BlockState[this.type]||(Entry.ArduinoExt.BlockState[this.type]={isStart:!1,stamp:0});var f=Entry.ArduinoExt.BlockState[this.type],g=Entry.hw.portData.ANALOG;if(f.isStart){if(e&&e===f.stamp||64Entry.hw.getAnalogPortValue(0)?1:0}},CODEino_get_light_status:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CODEino_string_14,"BRIGHT"],[Lang.Blocks.CODEino_string_15, -"DARK"]],value:"BRIGHT",fontSize:11}],events:{},def:{params:[null],type:"CODEino_get_light_status"},paramsKeyMap:{STATUS:0},"class":"CODEino",isNotFor:["CODEino"],func:function(b,a){return"DARK"==a.getField("STATUS",a)?800Entry.hw.getAnalogPortValue(1)?1:0}},CODEino_is_button_pressed:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CODEino_string_3,"4"],[Lang.Blocks.CODEino_string_4, -"17"],[Lang.Blocks.CODEino_string_5,"18"],[Lang.Blocks.CODEino_string_6,"19"],[Lang.Blocks.CODEino_string_7,"20"]],value:"4",fontSize:11}],events:{},def:{params:[null],type:"CODEino_is_button_pressed"},paramsKeyMap:{PORT:0},"class":"CODEino",isNotFor:["CODEino"],func:function(b,a){var c=a.getNumberField("PORT",a);return 14d?1:0;if("RIGHT"==c||"FRONT"==c)return 30d?1:0}},CODEino_get_accelerometer_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["X","3"],["Y","4"],["Z","5"]],value:"3",fontSize:11}],events:{},def:{params:[null],type:"CODEino_get_accelerometer_value"}, -paramsKeyMap:{PORT:0},"class":"CODEino",isNotFor:["CODEino"],func:function(b,a){var c=265,d=402,e=-90,f=90,g=Entry.hw.getAnalogPortValue(a.getField("PORT",a));if(c>d)var h=c,c=d,d=h;e>f&&(h=e,e=f,f=h);g=(f-e)/(d-c)*(g-c);g+=e;g=Math.min(f,g);g=Math.max(e,g);return Math.round(g)}},nemoino_get_named_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"%1 \uc13c\uc11c\uac12",params:[{type:"Dropdown",options:[["\uc18c\ub9ac","0"],["\ube5b","1"],["\uc2ac\ub77c\uc774\ub354", -"2"],["\uc800\ud56d-A","3"],["\uc800\ud56d-B","4"],["\uc800\ud56d-C","5"],["\uc800\ud56d-D","6"]],value:"0",fontSize:11}],events:{},def:{params:[null],type:"nemoino_get_named_sensor_value"},paramsKeyMap:{PORT:0},"class":"nemoino",isNotFor:["nemoino"],func:function(b,a){return Entry.hw.getAnalogPortValue(a.getField("PORT",a))}},nemoino_get_sound_status:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],template:"\uc18c\ub9ac\uc13c\uc11c %1",params:[{type:"Dropdown",options:[["\uc18c\ub9ac\ud07c", -"GREAT"],["\uc18c\ub9ac\uc791\uc74c","SMALL"]],value:"GREAT",fontSize:11}],events:{},def:{params:[null],type:"nemoino_get_sound_status"},paramsKeyMap:{STATUS:0},"class":"nemoino",isNotFor:["nemoino"],func:function(b,a){return"GREAT"==a.getField("STATUS",a)?600Entry.hw.getAnalogPortValue(0)?1:0}},nemoino_is_button_pressed:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],template:"\ubcf4\ub4dc\uc758 %1",params:[{type:"Dropdown",options:[["\ubc84\ud2bc\ub204\ub984", -"4"],["A\uc5f0\uacb0\ub428","17"],["B\uc5f0\uacb0\ub428","18"],["C\uc5f0\uacb0\ub428","19"],["D\uc5f0\uacb0\ub428","20"]],value:"4",fontSize:11}],events:{},def:{params:[null],type:"nemoino_is_button_pressed"},paramsKeyMap:{PORT:0},"class":"nemoino",isNotFor:["nemoino"],func:function(b,a){var c=a.getNumberField("PORT",a);return 14d?1:0;if("RIGHT"==c||"FRONT"==c)return 30d?1:0}},nemoino_get_accelerometer_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"3\ucd95 \uac00\uc18d\ub3c4\uc13c\uc11c %1 \ucd95\uc758 \uc13c\uc11c\uac12", -params:[{type:"Dropdown",options:[["X","3"],["Y","4"],["Z","5"]],value:"3",fontSize:11}],events:{},def:{params:[null],type:"nemoino_get_accelerometer_value"},paramsKeyMap:{PORT:0},"class":"nemoino",isNotFor:["nemoino"],func:function(b,a){var c=265,d=402,e=-90,f=90,g=Entry.hw.getAnalogPortValue(a.getField("PORT",a));if(c>d)var h=c,c=d,d=h;e>f&&(h=e,e=f,f=h);g=(f-e)/(d-c)*(g-c);g+=e;g=Math.min(f,g);g=Math.max(e,g);return Math.round(g)}},bitbrick_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field", -statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW,menuName:Entry.Bitbrick.sensorList}],events:{},def:{params:[null],type:"bitbrick_sensor_value"},paramsKeyMap:{PORT:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=a.getStringField("PORT");return Entry.hw.portData[c].value}},bitbrick_is_touch_pressed:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"DropdownDynamic",value:null, -fontSize:11,menuName:Entry.Bitbrick.touchList}],events:{},def:{params:[null],type:"bitbrick_is_touch_pressed"},paramsKeyMap:{PORT:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){return 0===Entry.hw.portData[a.getStringField("PORT")].value}},bitbrick_turn_off_color_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"bitbrick_turn_off_color_led",id:"i3je"},"class":"condition",isNotFor:["bitbrick"], -func:function(b,a){Entry.hw.sendQueue.LEDR=0;Entry.hw.sendQueue.LEDG=0;Entry.hw.sendQueue.LEDB=0;return a.callReturn()}},bitbrick_turn_on_color_led_by_rgb:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["255"]},{type:"text",params:["255"]},{type:"text",params:["255"]},null],type:"bitbrick_turn_on_color_led_by_rgb"}, -paramsKeyMap:{rValue:0,gValue:1,bValue:2},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=a.getNumberValue("rValue"),d=a.getNumberValue("gValue"),e=a.getNumberValue("bValue"),f=Entry.adjustValueWithMaxMin,g=Entry.hw.sendQueue;g.LEDR=f(c,0,255);g.LEDG=f(d,0,255);g.LEDB=f(e,0,255);return a.callReturn()}},bitbrick_turn_on_color_led_by_picker:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Color"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{}, -def:{params:[null],type:"bitbrick_turn_on_color_led_by_picker"},paramsKeyMap:{VALUE:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=a.getStringField("VALUE");Entry.hw.sendQueue.LEDR=parseInt(c.substr(1,2),16);Entry.hw.sendQueue.LEDG=parseInt(c.substr(3,2),16);Entry.hw.sendQueue.LEDB=parseInt(c.substr(5,2),16);return a.callReturn()}},bitbrick_turn_on_color_led_by_value:{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:["0"]},null],type:"bitbrick_turn_on_color_led_by_value"},paramsKeyMap:{VALUE:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=a.getNumberValue("VALUE"),d,e,f,c=c%200;67>c?(d=200-3*c,e=3*c,f=0):134>c?(c-=67,d=0,e=200-3*c,f=3*c):201>c&&(c-=134,d=3*c,e=0,f=200-3*c);Entry.hw.sendQueue.LEDR=d;Entry.hw.sendQueue.LEDG=e;Entry.hw.sendQueue.LEDB=f;return a.callReturn()}},bitbrick_buzzer:{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:"bitbrick_buzzer"},paramsKeyMap:{VALUE:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){if(a.isStart)return Entry.hw.sendQueue.buzzer=0,delete a.isStart,a.callReturn();var c=a.getNumberValue("VALUE");Entry.hw.sendQueue.buzzer=c;a.isStart=!0;return a}},bitbrick_turn_off_all_motors:{color:"#00979D",skeleton:"basic",statements:[], -params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"bitbrick_turn_off_all_motors"},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=Entry.hw.sendQueue,d=Entry.Bitbrick;d.servoList().map(function(a){c[a[1]]=0});d.dcList().map(function(a){c[a[1]]=128});return a.callReturn()}},bitbrick_dc_speed:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.dcList},{type:"Block", -accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"text",params:["60"]},null],type:"bitbrick_dc_speed"},paramsKeyMap:{PORT:0,VALUE:1},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=a.getNumberValue("VALUE"),c=Math.min(c,Entry.Bitbrick.dcMaxValue),c=Math.max(c,Entry.Bitbrick.dcMinValue);Entry.hw.sendQueue[a.getStringField("PORT")]=c+128;return a.callReturn()}},bitbrick_dc_direction_speed:{color:"#00979D",skeleton:"basic", -statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.dcList},{type:"Dropdown",options:[[Lang.Blocks.BITBRICK_dc_direction_cw,"CW"],[Lang.Blocks.BITBRICK_dc_direction_ccw,"CCW"]],value:"CW",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,{type:"text",params:["100"]},null],type:"bitbrick_dc_direction_speed"},paramsKeyMap:{PORT:0,DIRECTION:1,VALUE:2},"class":"condition",isNotFor:["bitbrick"], -func:function(b,a){var c="CW"===a.getStringField("DIRECTION"),d=a.getNumberValue("VALUE"),d=Math.min(d,Entry.Bitbrick.dcMaxValue),d=Math.max(d,0);Entry.hw.sendQueue[a.getStringField("PORT")]=c?d+128:128-d;return a.callReturn()}},bitbrick_servomotor_angle:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.servoList},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null, -{type:"text",params:["100"]},null],type:"bitbrick_servomotor_angle"},paramsKeyMap:{PORT:0,VALUE:1},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=Entry.Bitbrick.servoMaxValue-(a.getNumberValue("VALUE")+1),c=Math.min(c,Entry.Bitbrick.servoMaxValue),c=Math.max(c,Entry.Bitbrick.servoMinValue);Entry.hw.sendQueue[a.getStringField("PORT")]=c;return a.callReturn()}},bitbrick_convert_scale:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"DropdownDynamic", -value:null,fontSize:11,menuName:Entry.Bitbrick.sensorList},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"}],events:{},def:{params:[null,{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["-100"]},{type:"number",params:["100"]}],type:"bitbrick_convert_scale"},paramsKeyMap:{PORT:0,VALUE2:1,VALUE3:2,VALUE4:3,VALUE5:4},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=a.getNumberField("PORT"), -d=Entry.hw.portData[c].value,c=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a),f=a.getNumberValue("VALUE4",a),g=a.getNumberValue("VALUE5",a);if(f>g)var h=f,f=g,g=h;d-=c;d*=(g-f)/(e-c);d+=f;d=Math.min(g,d);d=Math.max(f,d);return Math.round(d)}},start_drawing:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"start_drawing"},"class":"brush_control",isNotFor:["textBox"],func:function(b,a){b.brush? -b.brush.stop=!1:Entry.setBasicBrush(b);Entry.stage.sortZorder();b.brush.moveTo(b.getX(),-1*b.getY());return a.callReturn()}},stop_drawing:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"stop_drawing"},"class":"brush_control",isNotFor:["textBox"],func:function(b,a){b.brush&&b.shape&&(b.brush.stop=!0);return a.callReturn()}},set_color:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Color"}, -{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"set_color"},paramsKeyMap:{VALUE:0},"class":"brush_color",isNotFor:["textBox"],func:function(b,a){var c=a.getField("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(c=Entry.hex2rgb(c),b.brush.rgb=c,b.brush.endStroke(),b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}},set_random_color:{color:"#FF9E20", -skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"set_random_color"},"class":"brush_color",isNotFor:["textBox"],func:function(b,a){b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);if(b.brush){var c=Entry.generateRgb();b.brush.rgb=c;b.brush.endStroke();b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")");b.brush.moveTo(b.getX(),-1*b.getY())}return a.callReturn()}},change_thickness:{color:"#FF9E20", -skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["1"]},null],type:"change_thickness"},paramsKeyMap:{VALUE:0},"class":"brush_thickness",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.thickness+=c,1>b.brush.thickness&&(b.brush.thickness=1),b.brush.setStrokeStyle(b.brush.thickness),b.brush.moveTo(b.getX(), --1*b.getY()));return a.callReturn()}},set_thickness:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["1"]},null],type:"set_thickness"},paramsKeyMap:{VALUE:0},"class":"brush_thickness",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.thickness=c,b.brush.setStrokeStyle(b.brush.thickness), -b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}},change_opacity:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_opacity"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);c=Entry.adjustValueWithMaxMin(b.brush.opacity+ -c,0,100);b.brush&&(b.brush.opacity=c,b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}},set_opacity:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["50"]},null],type:"set_opacity"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"], -func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}},brush_erase_all:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"brush_erase_all"}, -"class":"brush_clear",isNotFor:["textBox"],func:function(b,a){var c=b.brush;if(c){var d=c._stroke.style,e=c._strokeStyle.width;c.clear().setStrokeStyle(e).beginStroke(d);c.moveTo(b.getX(),-1*b.getY())}c=b.parent.getStampEntities();c.map(function(a){a.removeClone()});c=null;return a.callReturn()}},brush_stamp:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"brush_stamp"},"class":"stamp",isNotFor:["textBox"], -func:function(b,a){b.parent.addStampEntity(b);return a.callReturn()}},change_brush_transparency:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_brush_transparency"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop= -!0);c=Entry.adjustValueWithMaxMin(b.brush.opacity-c,0,100);b.brush&&(b.brush.opacity=c,b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}},set_brush_tranparency:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["50"]},null],type:"set_brush_tranparency"}, -paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+(1-b.brush.opacity/100)+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}},number:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"TextInput", -value:10}],events:{},def:{params:[]},paramsKeyMap:{NUM:0},func:function(b,a){return a.getField("NUM",a)},isPrimitive:!0},angle:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Angle"}],events:{},def:{params:[null],type:"angle"},paramsKeyMap:{ANGLE:0},func:function(b,a){return a.getNumberField("ANGLE")}},get_x_coordinate:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_x_coordinate,color:"#3D3D3D"}],events:{},def:{params:[null], -type:"get_x_coordinate"},"class":"calc",isNotFor:[],func:function(b,a){return b.getX()}},get_y_coordinate:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_y_coordinate,color:"#3D3D3D"}],events:{},def:{params:[null],type:"get_y_coordinate"},"class":"calc",isNotFor:[],func:function(b,a){return b.getY()}},get_angle:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_angle,color:"#3D3D3D"}], -events:{},def:{params:[null]},func:function(b,a){return parseFloat(b.getRotation().toFixed(1))}},get_rotation_direction:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CALC_rotation_value,"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,"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,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_rand_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"number",params:["0"]},null,{type:"number",params:["10"]},null],type:"calc_rand"},paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3},"class":"calc", -isNotFor:[],func:function(b,a){var c=a.getStringValue("LEFTHAND",a),d=a.getStringValue("RIGHTHAND",a),e=Math.min(c,d),f=Math.max(c,d),c=Entry.isFloat(c);return Entry.isFloat(d)||c?(Math.random()*(f-e)+e).toFixed(2):Math.floor(Math.random()*(f-e+1)+e)}},get_date:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_date_1,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_get_date_year,"YEAR"],[Lang.Blocks.CALC_get_date_month,"MONTH"], -[Lang.Blocks.CALC_get_date_day,"DAY"],[Lang.Blocks.CALC_get_date_hour,"HOUR"],[Lang.Blocks.CALC_get_date_minute,"MINUTE"],[Lang.Blocks.CALC_get_date_second,"SECOND"]],value:"YEAR",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_get_date_2,color:"#3D3D3D"}],events:{},def:{params:[null,"YEAR",null],type:"get_date"},paramsKeyMap:{VALUE:1},"class":"calc_date",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d=new Date;return"YEAR"==c?d.getFullYear():"MONTH"== -c?d.getMonth()+1:"DAY"==c?d.getDate():"HOUR"==c?d.getHours():"MINUTE"==c?d.getMinutes():d.getSeconds()}},get_sound_duration:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_sound_duration_1,color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"sounds",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_get_sound_duration_2,color:"#3D3D3D"}],events:{},def:{params:[null,null,null],type:"get_sound_duration"}, -paramsKeyMap:{VALUE:1},"class":"calc_duration",isNotFor:[],func:function(b,a){for(var c=a.getField("VALUE",a),d=b.parent.sounds,e=0;ed||d>c.length-1)throw Error();return c[d]}},length_of_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_length_of_string_1, -color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_length_of_string_2,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.entry]},null],type:"length_of_string"},paramsKeyMap:{STRING:1},"class":"calc_string",isNotFor:[],func:function(b,a){return a.getStringValue("STRING",a).length}},substring:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_substring_1,color:"#3D3D3D"},{type:"Block",accept:"string"}, -{type:"Text",text:Lang.Blocks.CALC_substring_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_substring_3,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_substring_4,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"number",params:["2"]},null,{type:"number",params:["5"]},null],type:"substring"},paramsKeyMap:{STRING:1,START:3,END:5},"class":"calc_string",isNotFor:[],func:function(b, -a){var c=a.getStringValue("STRING",a),d=a.getNumberValue("START",a)-1,e=a.getNumberValue("END",a)-1,f=c.length-1;if(0>d||0>e||d>f||e>f)throw Error();return c.substring(Math.min(d,e),Math.max(d,e)+1)}},replace_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_replace_string_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_3, -color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_4,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"text",params:[Lang.Blocks.hello]},null,{type:"text",params:[Lang.Blocks.nice]},null],type:"replace_string"},paramsKeyMap:{STRING:1,OLD_WORD:3,NEW_WORD:5},"class":"calc_string",isNotFor:[],func:function(b,a){return a.getStringValue("STRING",a).replace(new RegExp(a.getStringValue("OLD_WORD",a),"gm"), -a.getStringValue("NEW_WORD",a))}},change_string_case:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_change_string_case_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_change_string_case_2,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_change_string_case_sub_1,"toUpperCase"],[Lang.Blocks.CALC_change_string_case_sub_2,"toLowerCase"]],value:"toUpperCase",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}, -{type:"Text",text:Lang.Blocks.CALC_change_string_case_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:["Hello Entry!"]},null,null,null],type:"change_string_case"},paramsKeyMap:{STRING:1,CASE:3},"class":"calc_string",isNotFor:[],func:function(b,a){return a.getStringValue("STRING",a)[a.getField("CASE",a)]()}},index_of_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_index_of_string_1,color:"#3D3D3D"},{type:"Block",accept:"string"}, -{type:"Text",text:Lang.Blocks.CALC_index_of_string_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_index_of_string_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"text",params:[Lang.Blocks.entry]},null],type:"index_of_string"},paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3},"class":"calc_string",isNotFor:[],func:function(b,a){var c=a.getStringValue("LEFTHAND",a),d=a.getStringValue("RIGHTHAND",a),c=c.indexOf(d);return-1< -c?c+1:0}},combine_something:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_combine_something_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.VARIABLE_combine_something_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.VARIABLE_combine_something_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.block_hi]},null,{type:"text",params:[Lang.Blocks.entry]}, -null],type:"combine_something"},paramsKeyMap:{VALUE1:1,VALUE2:3},"class":"calc_string",isNotFor:[],func:function(b,a){var c=a.getStringValue("VALUE1",a),d=a.getStringValue("VALUE2",a);return c+d}},get_sound_volume:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_sound_volume,color:"#3D3D3D"},{type:"Text",text:"",color:"#3D3D3D"}],events:{},def:{params:[null,null],type:"get_sound_volume"},"class":"calc",isNotFor:[""],func:function(b,a){return 100* -createjs.Sound.getVolume()}},quotient_and_mod:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_quotient_and_mod_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_quotient_and_mod_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_quotient_and_mod_3,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_quotient_and_mod_sub_1,"QUOTIENT"],[Lang.Blocks.CALC_quotient_and_mod_sub_2, -"MOD"]],value:"QUOTIENT",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}],events:{},def:{params:[null,{type:"text",params:["10"]},null,{type:"text",params:["10"]},null,null],type:"quotient_and_mod"},paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3,OPERATOR:5},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);if(isNaN(c)||isNaN(d))throw Error();return"QUOTIENT"==a.getField("OPERATOR",a)?Math.floor(c/d):c%d}},choose_project_timer_action:{color:"#FFD974", -skeleton:"basic",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_choose_project_timer_action_1,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_choose_project_timer_action_sub_1,"START"],[Lang.Blocks.CALC_choose_project_timer_action_sub_2,"STOP"],[Lang.Blocks.CALC_choose_project_timer_action_sub_3,"RESET"]],value:"START",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_choose_project_timer_action_2,color:"#3D3D3D"},{type:"Indicator",img:"block_icon/calc_01.png", -size:12}],events:{viewAdd:[function(){Entry.engine&&Entry.engine.showProjectTimer()}],dataDestroy:[function(b){Entry.engine&&Entry.engine.hideProjectTimer(b)}]},def:{params:[null,"START",null,null],type:"choose_project_timer_action"},paramsKeyMap:{ACTION:1},"class":"calc_timer",isNotFor:[],func:function(b,a){var c=a.getField("ACTION"),d=Entry.engine,e=d.projectTimer;"START"==c?e.isInit?e.isInit&&e.isPaused&&(e.pauseStart&&(e.pausedTime+=(new Date).getTime()-e.pauseStart),delete e.pauseStart,e.isPaused= -!1):d.startProjectTimer():"STOP"==c?e.isInit&&!e.isPaused&&(e.isPaused=!0,e.pauseStart=(new Date).getTime()):"RESET"==c&&e.isInit&&(e.setValue(0),e.start=(new Date).getTime(),e.pausedTime=0,delete e.pauseStart);return a.callReturn()}},wait_second:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},null],type:"wait_second"},paramsKeyMap:{SECOND:0},"class":"delay", -isNotFor:[],func:function(b,a){if(a.isStart){if(1==a.timeFlag)return a;delete a.timeFlag;delete a.isStart;Entry.engine.isContinue=!1;return a.callReturn()}a.isStart=!0;a.timeFlag=1;var c=a.getNumberValue("SECOND",a),c=60/(Entry.FPS||60)*c*1E3;setTimeout(function(){a.timeFlag=0},c);return a}},repeat_basic:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"number", -params:["10"]},null],type:"repeat_basic"},paramsKeyMap:{VALUE:0},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(b,a){var c;if(!a.isLooped){a.isLooped=!0;c=a.getNumberValue("VALUE",a);if(0>c)throw Error(Lang.Blocks.FLOW_repeat_basic_errorMsg);a.iterCount=Math.floor(c)}if(0==a.iterCount||0>a.iterCount)return delete a.isLooped,delete a.iterCount,a.callReturn();a.iterCount--;return a.getStatement("DO",a)}},repeat_inf:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}], -params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null],type:"repeat_inf"},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(b,a){a.isLooped=!0;return a.getStatement("DO")}},stop_repeat:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null],type:"stop_repeat"},"class":"repeat",isNotFor:[],func:function(b,a){return this.executor.breakLoop()}},wait_until_true:{color:"#498deb", -skeleton:"basic",statements:[],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"},null],type:"wait_until_true"},paramsKeyMap:{BOOL:0},"class":"wait",isNotFor:[],func:function(b,a){return a.getBooleanValue("BOOL",a)?a.callReturn():a}},_if:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"}, -null],type:"_if"},paramsKeyMap:{BOOL:0},statementsKeyMap:{STACK:0},"class":"condition",isNotFor:[],func:function(b,a){return a.isCondition?(delete a.isCondition,a.callReturn()):a.getBooleanValue("BOOL",a)?(a.isCondition=!0,a.getStatement("STACK",a)):a.callReturn()}},if_else:{color:"#498deb",skeleton:"basic_double_loop",statements:[{accept:"basic"},{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12},{type:"LineBreak"}],events:{},def:{params:[{type:"True"}, -null],type:"if_else"},paramsKeyMap:{BOOL:0},statementsKeyMap:{STACK_IF:0,STACK_ELSE:1},"class":"condition",isNotFor:[],func:function(b,a){if(a.isCondition)return delete a.isCondition,a.callReturn();var c=a.getBooleanValue("BOOL",a);a.isCondition=!0;return c?a.getStatement("STACK_IF",a):a.getStatement("STACK_ELSE",a)}},create_clone:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"clone",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator", -img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null,null],type:"create_clone"},paramsKeyMap:{VALUE:0},"class":"clone",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d=a.callReturn();"self"==c?b.parent.addCloneEntity(b.parent,b,null):Entry.container.getObject(c).addCloneEntity(b.parent,null,null);return d}},delete_clone:{color:"#498deb",skeleton:"basic_without_next",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null], -type:"delete_clone"},"class":"clone",isNotFor:[],func:function(b,a){if(!b.isClone)return a.callReturn();b.removeClone();return this.die()}},when_clone_start:{color:"#498deb",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_clone.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"when_clone_start"},"class":"clone",isNotFor:[],func:function(b,a){return a.callReturn()},event:"when_clone_start"},stop_run:{color:"#498deb",skeleton:"basic",statements:[], -params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null]},func:function(b,a){return Entry.engine.toggleStop()}},repeat_while_true:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Dropdown",options:[[Lang.Blocks.FLOW_repeat_while_true_until,"until"],[Lang.Blocks.FLOW_repeat_while_true_while,"while"]],value:"until",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator",img:"block_icon/flow_03.png", -size:12}],events:{},def:{params:[{type:"True"},null,null],type:"repeat_while_true"},paramsKeyMap:{BOOL:0,OPTION:1},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(b,a){var c=a.getBooleanValue("BOOL",a);"until"==a.getField("OPTION",a)&&(c=!c);return(a.isLooped=c)?a.getStatement("DO",a):a.callReturn()}},stop_object:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.FLOW_stop_object_all,"all"],[Lang.Blocks.FLOW_stop_object_this_object,"thisOnly"], -[Lang.Blocks.FLOW_stop_object_this_thread,"thisThread"],[Lang.Blocks.FLOW_stop_object_other_thread,"otherThread"]],value:"all",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null,null],type:"stop_object"},paramsKeyMap:{TARGET:0},"class":"terminate",isNotFor:[],func:function(b,a){var c=a.getField("TARGET",a),d=Entry.container;switch(c){case "all":return d.clearRunningState(),this.die();case "thisOnly":return b.parent.script.clearExecutorsByEntity(b), -this.die();case "thisObject":return b.parent.script.clearExecutors(),this.die();case "thisThread":return this.die();case "otherThread":for(var c=this.executor,d=b.parent.script,e=d.executors,f=0;fa.count?(50>d.leftFloor&&50>d.rightFloor?a.count++:a.count=0,d=d.leftFloor-d.rightFloor,c.leftWheel=45+.25*d,c.rightWheel=45-.25*d):(a.count=0,a.boardState=2);break;case 2:d=d.leftFloor-d.rightFloor;c.leftWheel=45+.25*d;c.rightWheel= -45-.25*d;a.boardState=3;var e=setTimeout(function(){a.boardState=4;Entry.Hamster.removeTimeout(e)},250);Entry.Hamster.timeouts.push(e);break;case 3:d=d.leftFloor-d.rightFloor;c.leftWheel=45+.25*d;c.rightWheel=45-.25*d;break;case 4:c.leftWheel=0,c.rightWheel=0,a.boardState=0,a.isMoving=!1}return a}delete a.isStart;delete a.isMoving;delete a.count;delete a.boardState;Entry.engine.isContinue=!1;c.leftWheel=0;c.rightWheel=0;return a.callReturn()}a.isStart=!0;a.isMoving=!0;a.count=0;a.boardState=1;c.leftWheel= -45;c.rightWheel=45;Entry.Hamster.setLineTracerMode(c,0);return a}},hamster_turn_once:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null],type:"hamster_turn_once"},paramsKeyMap:{DIRECTION:0},"class":"hamster_board",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=Entry.hw.portData; -if(a.isStart){if(a.isMoving){if(a.isLeft)switch(a.boardState){case 1:2>a.count?50d.leftFloor&&(a.boardState=3);break;case 3:2>a.count?20>d.leftFloor&&a.count++:(a.count=0,a.boardState=4);break;case 4:50a.count?50d.rightFloor&&(a.boardState=3);break;case 3:2>a.count?20>d.rightFloor&&a.count++:(a.count=0,a.boardState=4);break;case 4:50Entry.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",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(-1f)throw Error("object is not available for current scene");switch(d){case "FRONT":c=0;break;case "FORWARD":c=Math.max(0,f-1);break;case "BACKWARD":c=Math.min(e,f+1);break;case "BACK":c=e}Entry.container.moveElementByBlock(f,c);return a.callReturn()}},move_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:["10"]},null],type:"move_direction"},paramsKeyMap:{VALUE:0},"class":"walk",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(b.getX()+c*Math.cos((b.getRotation()+b.getDirection()-90)/180*Math.PI));b.setY(b.getY()-c*Math.sin((b.getRotation()+b.getDirection()-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},move_x:{color:"#A751E3",skeleton:"basic", -statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"move_x"},paramsKeyMap:{VALUE:0},"class":"move_relative",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(b.getX()+c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},move_y:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator", -img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"move_y"},paramsKeyMap:{VALUE:0},"class":"move_relative",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setY(b.getY()+c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},locate_xy_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator", -img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"locate_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_absolute",isNotFor:[],func:function(b,a){function c(){var c=a.x-b.getX(),d=a.y-b.getY(),c=c/a.frameCount,d=d/a.frameCount;b.setX(b.getX()+c);b.setY(b.getY()+d);a.frameCount--;b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY())}if(!a.isStart){var d;d=a.getNumberValue("VALUE1", -a);a.isStart=!0;a.frameCount=Math.max(Math.floor(d*Entry.FPS),1);a.x=a.getNumberValue("VALUE2",a);a.y=a.getNumberValue("VALUE3",a);1==a.frameCount&&c()}if(0!=a.frameCount)return c(),a;delete a.isStart;delete a.frameCount;return a.callReturn()}},rotate_by_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"rotate_by_angle"},paramsKeyMap:{VALUE:0}, -"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(b.getRotation()+c);return a.callReturn()}},rotate_by_angle_dropdown:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["45","45"],["90","90"],["135","135"],["180","180"]],value:"45",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:["45",null],type:"rotate_by_angle_dropdown"},paramsKeyMap:{VALUE:0},"class":"ebs",isNotFor:[],func:function(b, -a){var c=a.getField("VALUE",a);b.setRotation(b.getRotation()+Number(c));return a.callReturn()}},see_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"see_angle"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}},see_direction:{color:"#A751E3", -skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"sprites",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{VALUE:0},func:function(b,a){var c=a.getField("VALUE",a),d=Entry.container.getEntity(c),c=d.getX()-b.getX(),d=d.getY()-b.getY();0<=c?b.setRotation(Math.atan(d/c)/Math.PI*180+90):b.setRotation(Math.atan(d/c)/Math.PI*180+270);return a.callReturn()}},locate_xy:{color:"#A751E3",skeleton:"basic", -statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["0"]},{type:"number",params:["0"]},null],type:"locate_xy"},paramsKeyMap:{VALUE1:0,VALUE2:1},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE1",a),d=a.getNumberValue("VALUE2",a);b.setX(c);b.setY(d);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}}, -locate_x:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_x"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},locate_y:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block", -accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_y"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setY(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},locate:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING}, -{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"locate"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d;"mouse"==c?(c=Entry.stage.mouseCoordinate.x,d=Entry.stage.mouseCoordinate.y):(d=Entry.container.getEntity(c),c=d.getX(),d=d.getY());b.setX(Number(c));b.setY(Number(d));b.brush&&!b.brush.stop&&b.brush.lineTo(c,-1*d);return a.callReturn()}},move_xy_time:{color:"#A751E3",skeleton:"basic", -statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"move_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_relative",isNotFor:[],func:function(b,a){function c(){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())}if(!a.isStart){var d;d=a.getNumberValue("VALUE1",a);var e=a.getNumberValue("VALUE2",a),f=a.getNumberValue("VALUE3",a);a.isStart=!0;a.frameCount=Math.max(Math.floor(d*Entry.FPS),1);a.dX=e/a.frameCount;a.dY=f/a.frameCount;1==a.frameCount&&c()}if(0!=a.frameCount)return c(),a;delete a.isStart;delete a.frameCount;return a.callReturn()}},rotate_by_angle_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Angle"},{type:"Indicator", -img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},null,null],type:"rotate_by_angle_time"},paramsKeyMap:{VALUE:1},"class":"rotate",isNotFor:[],func:function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE",a);var d=a.getNumberField("VALUE",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dAngle=d/a.frameCount}if(0!=a.frameCount)return b.setRotation(b.getRotation()+a.dAngle),a.frameCount--,a;delete a.isStart;delete a.frameCount;return a.callReturn()}}, -bounce_wall:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null],type:"bounce_wall"},"class":"walk",isNotFor:[],func:function(b,a){var c=b.parent.getRotateMethod(),d="free"==c?(b.getRotation()+b.getDirection()).mod(360):b.getDirection(),e=Entry.Utils.COLLISION.NONE;if(90>d&&0<=d||360>d&&270<=d){var e=b.collision==Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,b.object,0,!1);!f&&e&& -(b.collision=Entry.Utils.COLLISION.NONE);f&&e&&(f=!1);f?("free"==c?b.setRotation(-b.getRotation()-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&&e&&(f=!1),f&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN))}else 270> -d&&90<=d&&(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&&e&&(f=!1),f?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN):(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)));360>d&&180<=d?(e=b.collision==Entry.Utils.COLLISION.LEFT,d=ndgmr.checkPixelCollision(Entry.stage.wall.left,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.LEFT):(e=b.collision==Entry.Utils.COLLISION.RIGHT, -d=ndgmr.checkPixelCollision(Entry.stage.wall.right,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.RIGHT))):180>d&&0<=d&&(e=b.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?b.setRotation(-b.getRotation()- -2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.RIGHT):(e=b.collision==Entry.Utils.COLLISION.LEFT,d=ndgmr.checkPixelCollision(Entry.stage.wall.left,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.LEFT)));return a.callReturn()}},flip_arrow_horizontal:{color:"#A751E3",skeleton:"basic",statements:[], -params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null]},func:function(b,a){b.setDirection(b.getDirection()+180);return a.callReturn()}},flip_arrow_vertical:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null]},func:function(b,a){b.setDirection(b.getDirection()+180);return a.callReturn()}},see_angle_object:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic", -value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"see_angle_object"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d=b.getX(),e=b.getY();if(b.parent.id==c)return a.callReturn();"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",size:12}],events:{},def:{params:[{type:"angle"},null],type:"rotate_absolute"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute", -isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c);return a.callReturn()}},rotate_relative:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"rotate_relative"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c+b.getRotation());return a.callReturn()}},direction_absolute:{color:"#A751E3", -skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"direction_absolute"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}},direction_relative:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png", -size:12}],events:{},def:{params:[{type:"angle"},null],type:"direction_relative"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c+b.getDirection());return a.callReturn()}},move_to_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},{type:"number",params:["10"]}, -null],type:"move_to_angle"},paramsKeyMap:{ANGLE:0,VALUE:1},"class":"move_rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a),d=a.getNumberValue("ANGLE",a);b.setX(b.getX()+c*Math.cos((d-90)/180*Math.PI));b.setY(b.getY()-c*Math.sin((d-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},rotate_by_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator", -img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"angle"},null],type:"rotate_by_time"},paramsKeyMap:{VALUE:0,ANGLE:1},"class":"rotate",isNotFor:[],func:function(b,a){function c(){b.setRotation(b.getRotation()+a.dAngle);a.frameCount--}if(!a.isStart){var d;d=a.getNumberValue("VALUE",a);var e=a.getNumberValue("ANGLE",a);a.isStart=!0;a.frameCount=Math.max(Math.floor(d*Entry.FPS),1);a.dAngle=e/a.frameCount;1==a.frameCount&&c()}if(0!=a.frameCount)return c(), -a;delete a.isStart;delete a.frameCount;return a.callReturn()}},direction_relative_duration:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"text",params:["2"]},{type:"angle"},null],type:"direction_relative_duration"},paramsKeyMap:{DURATION:0,AMOUNT:1},"class":"rotate",isNotFor:[],func:function(b,a){function c(){b.setDirection(b.getDirection()+ -a.dDirection);a.frameCount--}if(!a.isStart){var d;d=a.getNumberValue("DURATION",a);var e=a.getNumberValue("AMOUNT",a);a.isStart=!0;a.frameCount=Math.max(Math.floor(d*Entry.FPS),1);a.dDirection=e/a.frameCount;1==a.frameCount&&c()}if(0!=a.frameCount)return c(),a;delete a.isStart;delete a.frameCount;delete a.dDirection;return a.callReturn()}},neobot_sensor_value:{color:"#00979D",skeleton:"basic_string_field",fontColor:"#fff",statements:[],template:"%1 \uac12",params:[{type:"Dropdown",options:[["1\ubc88 \ud3ec\ud2b8", -"IN1"],["2\ubc88 \ud3ec\ud2b8","IN2"],["3\ubc88 \ud3ec\ud2b8","IN3"],["\ub9ac\ubaa8\ucee8","IR"],["\ubc30\ud130\ub9ac","BAT"]],value:"IN1",fontSize:11}],events:{},def:{params:[null],type:"neobot_sensor_value"},paramsKeyMap:{PORT:0},"class":"neobot_value",isNotFor:["neobot"],func:function(b,a){var c=a.getStringField("PORT");return Entry.hw.portData[c]}},neobot_sensor_convert_scale:{color:"#00979D",skeleton:"basic_string_field",fontColor:"#fff",statements:[],template:"%1 \uac12\uc758 \ubc94\uc704\ub97c %2 ~ %3 \uc5d0\uc11c %4 ~ %5 (\uc73c)\ub85c \ubcc0\ud658", -params:[{type:"Dropdown",options:[["1\ubc88 \ud3ec\ud2b8","IN1"],["2\ubc88 \ud3ec\ud2b8","IN2"],["3\ubc88 \ud3ec\ud2b8","IN3"],["\ub9ac\ubaa8\ucee8","IR"],["\ubc30\ud130\ub9ac","BAT"]],value:"IN1",fontSize:11},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"}],events:{},def:{params:[null,{type:"number",params:["0"]},{type:"number",params:["255"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"neobot_sensor_convert_scale"}, -paramsKeyMap:{PORT:0,OMIN:1,OMAX:2,MIN:3,MAX:4},"class":"neobot_value",isNotFor:["neobot"],func:function(b,a){var c=a.getStringField("PORT"),c=Entry.hw.portData[c],d=a.getNumberValue("OMIN",a),e=a.getNumberValue("OMAX",a),f=a.getNumberValue("MIN",a),g=a.getNumberValue("MAX",a);if(d>e)var h=d,d=e,e=h;f>g&&(h=f,f=g,g=h);c=(g-f)/(e-d)*(c-d);c+=f;c=Math.min(g,c);c=Math.max(f,c);return Math.round(c)}},neobot_left_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc67c\ucabd \ubaa8\ud130\ub97c %1 %2 \uc758 \uc18d\ub3c4\ub85c \ud68c\uc804 %3", -params:[{type:"Dropdown",options:[["\uc55e\uc73c\ub85c","16"],["\ub4a4\ub85c","32"]],value:"16",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{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"],["14","14"],["15","15"]],value:"0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,"15", -null],type:"neobot_left_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){var c=a.getNumberField("SPEED"),d=a.getNumberField("DIRECTION");Entry.hw.sendQueue.DCL=c+d;return a.callReturn()}},neobot_stop_left_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc67c\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_left_motor"}, -"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){Entry.hw.sendQueue.DCL=0;return a.callReturn()}},neobot_right_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubaa8\ud130\ub97c %1 %2 \uc758 \uc18d\ub3c4\ub85c \ud68c\uc804 %3",params:[{type:"Dropdown",options:[["\uc55e\uc73c\ub85c","16"],["\ub4a4\ub85c","32"]],value:"16",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{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"],["14","14"],["15","15"]],value:"0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,"15",null],type:"neobot_right_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){var c=a.getNumberField("SPEED"),d=a.getNumberField("DIRECTION");Entry.hw.sendQueue.DCR=c+d;return a.callReturn()}}, -neobot_stop_right_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_right_motor"},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){Entry.hw.sendQueue.DCR=0;return a.callReturn()}},neobot_all_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc591\ucabd \ubaa8\ud130\ub97c %1 %2\uc758 \uc18d\ub3c4\ub85c %3\ucd08 \ub3d9\uc548 \ud68c\uc804 %4", -params:[{type:"Dropdown",options:[["\uc55e\uc73c\ub85c","1"],["\ub4a4\ub85c","2"],["\uc81c\uc790\ub9ac\uc5d0\uc11c \uc67c\ucabd \ub3cc\uae30","3"],["\uc81c\uc790\ub9ac\uc5d0\uc11c \uc624\ub978\ucabd \ub3cc\uae30","4"],["\uc67c\ucabd\uc73c\ub85c \ub3cc\uae30","5"],["\uc624\ub978\ucabd\uc73c\ub85c \ub3cc\uae30","6"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{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"],["14","14"],["15","15"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:["1","15",{type:"number",params:["0"]}],type:"neobot_all_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1,DURATION:2},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){if(a.isStart){if(1==a.timeFlag)return a;delete a.timeFlag;delete a.isStart;Entry.hw.sendQueue.DCL= -0;Entry.hw.sendQueue.DCR=0;Entry.engine.isContinue=!1;return a.callReturn()}var c=a.getNumberField("SPEED"),d=a.getNumberField("DIRECTION"),e=a.getNumberValue("DURATION");0>e&&(e=0);switch(d){case 1:Entry.hw.sendQueue.DCL=16+c;Entry.hw.sendQueue.DCR=16+c;break;case 2:Entry.hw.sendQueue.DCL=32+c;Entry.hw.sendQueue.DCR=32+c;break;case 3:Entry.hw.sendQueue.DCL=32+c;Entry.hw.sendQueue.DCR=16+c;break;case 4:Entry.hw.sendQueue.DCL=16+c;Entry.hw.sendQueue.DCR=32+c;break;case 5:Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR= -16+c;break;case 6:Entry.hw.sendQueue.DCL=16+c,Entry.hw.sendQueue.DCR=0}if(0===e)return a.callReturn();a.isStart=!0;a.timeFlag=1;setTimeout(function(){a.timeFlag=0},1E3*e);return a}},neobot_stop_all_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc591\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_all_motor"},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){Entry.hw.sendQueue.DCL= -0;Entry.hw.sendQueue.DCR=0;return a.callReturn()}},neobot_set_servo:{color:"#00979D",skeleton:"basic",statements:[],template:"%1 \ud3ec\ud2b8\uc758 \uc11c\ubcf4\ubaa8\ud130\ub97c %2 \ub3c4 \uc774\ub3d9 %3",params:[{type:"Dropdown",options:[["OUT1","1"],["OUT2","2"],["OUT3","3"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"neobot_set_servo"},paramsKeyMap:{PORT:0, -DEGREE:1},"class":"neobot_output",isNotFor:["neobot"],func:function(b,a){var c=a.getNumberField("PORT"),d=a.getNumberValue("DEGREE");0>d?d=0:180d?d=0:255c.count)throw c.count++, -new Entry.Utils.AsyncError;c.isStart=!1;d=Entry.hw.portData[c.data_default_address];c.data_default_address=void 0;return d}},robotis_openCM70_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.robotis_cm_sound_detected,"CM_SOUND_DETECTED"],[Lang.Blocks.robotis_cm_sound_detecting,"CM_SOUND_DETECTING"],[Lang.Blocks.robotis_cm_user_button,"CM_USER_BUTTON"]],value:"CM_SOUND_DETECTED",fontSize:11}],events:{},def:{params:[null], -type:"robotis_openCM70_sensor_value"},paramsKeyMap:{SENSOR:0},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(b,a){var c=a.executor.scope;if(!c.isStart){c.isStart=!0;c.count=0;var d=Entry.Robotis_openCM70.INSTRUCTION.READ,e=0,f=0,g=0,h=0,k=a.getStringField("SENSOR");"CM_SOUND_DETECTED"==k?(g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1]): -"CM_SOUND_DETECTING"==k?(g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1]):"CM_USER_BUTTON"==k&&(g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1]); -g+=0*h;Entry.Robotis_carCont.setRobotisData([[d,e,f,0,h]]);Entry.Robotis_carCont.update();c.data_default_address=g;throw new Entry.Utils.AsyncError;}if(2>c.count)throw c.count++,new Entry.Utils.AsyncError;c.isStart=!1;d=Entry.hw.portData[c.data_default_address];c.data_default_address=void 0;return d}},robotis_openCM70_aux_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["3","PORT_3"],["4","PORT_4"],["5","PORT_5"],["6","PORT_6"]], -value:"PORT_3",fontSize:11},{type:"Dropdown",options:[[Lang.Blocks.robotis_aux_servo_position,"AUX_SERVO_POSITION"],[Lang.Blocks.robotis_aux_ir,"AUX_IR"],[Lang.Blocks.robotis_aux_touch,"AUX_TOUCH"],[Lang.Blocks.robotis_aux_brightness,"AUX_BRIGHTNESS"],[Lang.Blocks.robotis_aux_hydro_themo_humidity,"AUX_HYDRO_THEMO_HUMIDITY"],[Lang.Blocks.robotis_aux_hydro_themo_temper,"AUX_HYDRO_THEMO_TEMPER"],[Lang.Blocks.robotis_aux_temperature,"AUX_TEMPERATURE"],[Lang.Blocks.robotis_aux_ultrasonic,"AUX_ULTRASONIC"], -[Lang.Blocks.robotis_aux_magnetic,"AUX_MAGNETIC"],[Lang.Blocks.robotis_aux_motion_detection,"AUX_MOTION_DETECTION"],[Lang.Blocks.robotis_aux_color,"AUX_COLOR"],[Lang.Blocks.robotis_aux_custom,"AUX_CUSTOM"]],value:"AUX_SERVO_POSITION",fontSize:11}],events:{},def:{params:[null,null],type:"robotis_openCM70_aux_sensor_value"},paramsKeyMap:{PORT:0,SENSOR:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(b,a){var c=a.executor.scope;if(!c.isStart){c.isStart=!0;c.count=0;var d= -Entry.Robotis_openCM70.INSTRUCTION.READ,e=0,f=0,g=0,h=0,k=a.getStringField("PORT"),l=a.getStringField("SENSOR"),n=0;"PORT_3"==k?n=2:"PORT_4"==k?n=3:"PORT_5"==k?n=4:"PORT_6"==k&&(n=5);"AUX_SERVO_POSITION"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1]):"AUX_IR"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0], -h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1]):"AUX_TOUCH"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1]):"AUX_TEMPERATURE"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1], -e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1]):"AUX_BRIGHTNESS"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1]):"AUX_HYDRO_THEMO_HUMIDITY"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1], -e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1]):"AUX_HYDRO_THEMO_TEMPER"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1]):"AUX_ULTRASONIC"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0], -h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1]):"AUX_MAGNETIC"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1]):"AUX_MOTION_DETECTION"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0], -h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1]):"AUX_COLOR"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1]):"AUX_CUSTOM"==l&&(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1], -e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1]);g+=n*h;0!=n&&(f=6*h);Entry.Robotis_carCont.setRobotisData([[d,e,f,0,h]]);Entry.Robotis_carCont.update();c.data_default_address=g;console.log(g);throw new Entry.Utils.AsyncError;}if(2>c.count)throw c.count++,new Entry.Utils.AsyncError;c.isStart=!1;d=Entry.hw.portData[c.data_default_address];c.data_default_address=void 0;return d}},robotis_openCM70_cm_buzzer_index:{color:"#00979D",skeleton:"basic", -statements:[],params:[{type:"Dropdown",options:[[Lang.General.note_a+"(0)","0"],[Lang.General.note_a+"#(1)","1"],[Lang.General.note_b+"(2)","2"],[Lang.General.note_c+"(3)","3"],[Lang.General.note_c+"#(4)","4"],[Lang.General.note_d+"(5)","5"],[Lang.General.note_d+"#(6)","6"],[Lang.General.note_e+"(7)","7"],[Lang.General.note_f+"(8)","8"],[Lang.General.note_f+"#(9)","9"],[Lang.General.note_g+"(10)","10"],[Lang.General.note_g+"#(11)","11"],[Lang.General.note_a+"(12)","12"],[Lang.General.note_a+"#(13)", -"13"],[Lang.General.note_b+"(14)","14"],[Lang.General.note_c+"(15)","15"],[Lang.General.note_c+"#(16)","16"],[Lang.General.note_d+"(17)","17"],[Lang.General.note_d+"#(18)","18"],[Lang.General.note_e+"(19)","19"],[Lang.General.note_f+"(20)","20"],[Lang.General.note_f+"#(21)","21"],[Lang.General.note_g+"(22)","22"],[Lang.General.note_g+"#(23)","23"],[Lang.General.note_a+"(24)","24"],[Lang.General.note_a+"#(25)","25"],[Lang.General.note_b+"(26)","26"],[Lang.General.note_c+"(27)","27"],[Lang.General.note_c+ -"#(28)","28"],[Lang.General.note_d+"(29)","29"],[Lang.General.note_d+"#(30)","30"],[Lang.General.note_e+"(31)","31"],[Lang.General.note_f+"(32)","32"],[Lang.General.note_f+"#(33)","33"],[Lang.General.note_g+"(34)","34"],[Lang.General.note_g+"#(35)","35"],[Lang.General.note_a+"(36)","36"],[Lang.General.note_a+"#(37)","37"],[Lang.General.note_b+"(38)","38"],[Lang.General.note_c+"(39)","39"],[Lang.General.note_c+"#(40)","40"],[Lang.General.note_d+"(41)","41"],[Lang.General.note_d+"#(42)","42"],[Lang.General.note_e+ -"(43)","43"],[Lang.General.note_f+"(44)","44"],[Lang.General.note_f+"#(45)","45"],[Lang.General.note_g+"(46)","46"],[Lang.General.note_g+"#(47)","47"],[Lang.General.note_a+"(48)","48"],[Lang.General.note_a+"#(49)","49"],[Lang.General.note_b+"(50)","50"],[Lang.General.note_c+"(51)","51"]],value:"0",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["1"]},null],type:"robotis_openCM70_cm_buzzer_index"}, -paramsKeyMap:{CM_BUZZER_INDEX:0,CM_BUZZER_TIME:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(b,a){var c=a.getField("CM_BUZZER_INDEX",a),d=a.getNumberValue("CM_BUZZER_TIME",a),e=Entry.Robotis_openCM70.INSTRUCTION.WRITE,f=0,g=0,h=0,k=0,l=0,f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[1],h=parseInt(10*d);50d&&(d=0);return Entry.Robotis_carCont.postCallReturn(a,[[e,f+(c-1)*g,g,d]],Entry.Robotis_openCM70.delay)}},robotis_openCM70_aux_led_module:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.robotis_common_port_3,"3"],[Lang.Blocks.robotis_common_port_4,"4"],[Lang.Blocks.robotis_common_port_5,"5"],[Lang.Blocks.robotis_common_port_6,"6"]],value:"3",fontSize:11},{type:"Dropdown",options:[[Lang.Blocks.robotis_cm_led_both+Lang.Blocks.robotis_common_off, -"0"],[Lang.Blocks.robotis_cm_led_right+Lang.Blocks.robotis_common_on,"1"],[Lang.Blocks.robotis_cm_led_left+Lang.Blocks.robotis_common_on,"2"],[Lang.Blocks.robotis_cm_led_both+Lang.Blocks.robotis_common_on,"3"]],value:"0",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"robotis_openCM70_aux_led_module"},paramsKeyMap:{PORT:0,LED_MODULE:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(b,a){var c=a.getField("PORT", -a),d=a.getField("LED_MODULE",a),e=Entry.Robotis_openCM70.INSTRUCTION.WRITE,f=0,g=0,f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[1];return Entry.Robotis_carCont.postCallReturn(a,[[e,f+(c-1)*g,g,d]],Entry.Robotis_openCM70.delay)}},robotis_openCM70_aux_custom:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.robotis_common_port_3,"3"],[Lang.Blocks.robotis_common_port_4,"4"],[Lang.Blocks.robotis_common_port_5, -"5"],[Lang.Blocks.robotis_common_port_6,"6"]],value:"3",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["0"]},null],type:"robotis_openCM70_aux_custom"},paramsKeyMap:{PORT:0,VALUE:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(b,a){var c=a.getField("PORT",a),d=a.getNumberValue("VALUE"),e=Entry.Robotis_openCM70.INSTRUCTION.WRITE,f=0,g=0,f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0], -g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1];return Entry.Robotis_carCont.postCallReturn(a,[[e,f+(c-1)*g,g,d]],Entry.Robotis_openCM70.delay)}},robotis_openCM70_cm_custom:{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:"number",params:["0"]},{type:"number",params:["0"]},null],type:"robotis_openCM70_cm_custom"},paramsKeyMap:{ADDRESS:0, -VALUE:1},"class":"robotis_openCM70_custom",isNotFor:["robotis_openCM70"],func:function(b,a){var c=Entry.Robotis_openCM70.INSTRUCTION.WRITE,d=0,e=0,d=a.getNumberValue("ADDRESS"),e=a.getNumberValue("VALUE");return Entry.Robotis_carCont.postCallReturn(a,[[c,d,65535c&&(c=0);createjs.Sound.setVolume(c);return a.callReturn()}},sound_volume_set:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"sound_volume_set"},paramsKeyMap:{VALUE:0},"class":"sound_volume",isNotFor:[],func:function(b,a){var c= -a.getNumberValue("VALUE",a)/100;1c&&(c=0);createjs.Sound.setVolume(c);return a.callReturn()}},sound_silent_all:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[null],type:"sound_silent_all"},"class":"sound_stop",isNotFor:[],func:function(b,a){createjs.Sound.stop();return a.callReturn()}},get_sounds:{color:"#A4D01D",skeleton:"basic_string_field",statements:[],params:[{type:"DropdownDynamic",value:null, -menuName:"sounds",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_SOUNDS}],events:{},def:{params:[null],type:"get_sounds"},paramsKeyMap:{VALUE:0},func:function(b,a){return a.getStringField("VALUE")}},sound_something_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},null],type:"sound_something_with_block"},paramsKeyMap:{VALUE:0},"class":"sound_play",isNotFor:[], -func:function(b,a){var c=a.getStringValue("VALUE",a);(c=b.parent.getSound(c))&&createjs.Sound.play(c.id);return a.callReturn()}},sound_something_second_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds",id:"95dw"},{type:"number",params:["1"]},null],type:"sound_something_second_with_block"},paramsKeyMap:{VALUE:0,SECOND:1}, -"class":"sound_play",isNotFor:[],func:function(b,a){var c=a.getStringValue("VALUE",a),d=a.getNumberValue("SECOND",a);(c=b.parent.getSound(c))&&createjs.Sound.play(c.id,{startTime:0,duration:1E3*d});return a.callReturn()}},sound_something_wait_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},null],type:"sound_something_wait_with_block"},paramsKeyMap:{VALUE:0}, -"class":"sound_wait",isNotFor:[],func:function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.playState;delete a.isPlay;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(c=b.parent.getSound(c))createjs.Sound.play(c.id),setTimeout(function(){a.playState=0},1E3*c.duration);return a}},sound_something_second_wait_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png", -size:12}],events:{},def:{params:[{type:"get_sounds"},{type:"number",params:["1"]},null],type:"sound_something_second_wait_with_block"},paramsKeyMap:{VALUE:0,SECOND:1},"class":"sound_wait",isNotFor:[],func:function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.isPlay;delete a.playState;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(c=b.parent.getSound(c)){var d=createjs.Sound.play(c.id),c=a.getNumberValue("SECOND",a);setTimeout(function(){d.stop();a.playState= -0},1E3*c);d.addEventListener("complete",function(a){})}return a}},sound_from_to:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},{type:"text",params:["1"]},{type:"text",params:["10"]},null],type:"sound_from_to"},paramsKeyMap:{VALUE:0,START:1,END:2},"class":"sound_play",isNotFor:[],func:function(b,a){var c= -a.getStringValue("VALUE",a);if(c=b.parent.getSound(c)){var d=1E3*a.getNumberValue("START",a),e=1E3*a.getNumberValue("END",a);createjs.Sound.play(c.id,{startTime:Math.min(d,e),duration:Math.max(d,e)-Math.min(d,e)})}return a.callReturn()}},sound_from_to_and_wait:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"}, -{type:"text",params:["1"]},{type:"text",params:["10"]},null],type:"sound_from_to_and_wait"},paramsKeyMap:{VALUE:0,START:1,END:2},"class":"sound_wait",isNotFor:[],func:function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.isPlay;delete a.playState;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(c=b.parent.getSound(c)){var d=1E3*a.getNumberValue("START",a),e=1E3*a.getNumberValue("END",a),f=Math.min(d,e),d=Math.max(d,e)-f;createjs.Sound.play(c.id,{startTime:f, -duration:d});setTimeout(function(){a.playState=0},d)}return a}},when_run_button_click:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_play.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"when_run_button_click"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"start"},press_some_key:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_keyboard.png", -size:17,position:{x:0,y:-2}},{type:"Dropdown",options:[["q","81"],["w","87"],["e","69"],["r","82"],["a","65"],["s","83"],["d","68"],["\uc704\ucabd \ud654\uc0b4\ud45c","38"],["\uc544\ub798\ucabd \ud654\uc0b4\ud45c","40"],["\uc67c\ucabd \ud654\uc0b4\ud45c","37"],["\uc624\ub978\ucabd \ud654\uc0b4\ud45c","39"],["\uc5d4\ud130","13"],["\uc2a4\ud398\uc774\uc2a4","32"]],value:"81",fontSize:11},{type:"Indicator",img:"block_icon/start_03.png",size:12}],events:{},def:{params:[null,null,null]},paramsKeyMap:{VALUE:1}, -func:function(b,a){return a.callReturn()}},when_some_key_pressed:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_keyboard.png",size:17,position:{x:0,y:-2}},{type:"Keyboard",value:"81"}],events:{},def:{params:[null,"81"],type:"when_some_key_pressed"},paramsKeyMap:{VALUE:1},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"keyPress"},mouse_clicked:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator", -img:"block_icon/start_icon_mouse.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"mouse_clicked"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"mouse_clicked"},mouse_click_cancled:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_mouse.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"mouse_click_cancled"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()}, -event:"mouse_click_cancled"},when_object_click:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_mouse.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"when_object_click"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"when_object_click"},when_object_click_canceled:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_mouse.png",size:17,position:{x:0, -y:-2}}],events:{},def:{params:[null],type:"when_object_click_canceled"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"when_object_click_canceled"},when_some_key_click:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_keyboard.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null]},func:function(b,a){return a.callReturn()},event:"keyPress"},when_message_cast:{color:"#3BBD70",skeleton:"basic_event",statements:[], -params:[{type:"Indicator",img:"block_icon/start_icon_signal.png",size:17,position:{x:0,y:-2}},{type:"DropdownDynamic",value:null,menuName:"messages",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_START}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs",b)}],viewDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}]},def:{params:[null,null],type:"when_message_cast"},paramsKeyMap:{VALUE:1},"class":"message",isNotFor:["message"],func:function(b, -a){return a.callReturn()},event:"when_message_cast"},message_cast:{color:"#3BBD70",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"messages",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_START},{type:"Indicator",img:"block_icon/start_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs",b)}],viewDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}]},def:{params:[null,null],type:"message_cast"}, -paramsKeyMap:{VALUE:0},"class":"message",isNotFor:["message"],func:function(b,a){var c=a.getField("VALUE",a),d=Entry.isExist(c,"id",Entry.variableContainer.messages_);if("null"==c||!d)throw Error("value can not be null or undefined");Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent,["when_message_cast",c]);return a.callReturn()}},message_cast_wait:{color:"#3BBD70",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"messages",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_START}, -{type:"Indicator",img:"block_icon/start_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}]},def:{params:[null,null],type:"message_cast_wait"},paramsKeyMap:{VALUE:0},"class":"message",isNotFor:["message"],func:function(b,a){if(a.runningScript){for(var c=a.runningScript,d=c.length,e=0;ec.array_.length)throw Error("can not remove value from array"); -c.array_.splice(d-1,1);c.updateView();return a.callReturn()}},insert_value_to_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer; -a&&a.removeRef("_variableRefs",b)}]},def:{params:[{type:"text",params:["10"]},null,{type:"text",params:["1"]},null],type:"insert_value_to_list"},paramsKeyMap:{DATA:0,LIST:1,INDEX:2},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a),d=a.getValue("DATA",a),e=a.getValue("INDEX",a),c=Entry.variableContainer.getList(c,b);if(!c.array_||isNaN(e)||0==e||e>c.array_.length+1)throw Error("can not insert value to array");c.array_.splice(e-1,0,{data:d});c.updateView(); -return a.callReturn()}},change_value_list_index:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs", -b)}]},def:{params:[null,{type:"text",params:["1"]},{type:"text",params:["10"]},null],type:"change_value_list_index"},paramsKeyMap:{LIST:0,INDEX:1,DATA:2},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a),d=a.getValue("DATA",a),e=a.getValue("INDEX",a),c=Entry.variableContainer.getList(c,b);if(!c.array_||isNaN(e)||e>c.array_.length)throw Error("can not insert value to array");c.array_[e-1].data=d;c.updateView();return a.callReturn()}},value_of_index_from_list:{color:"#E457DC", -skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_value_of_index_from_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Text",text:Lang.Blocks.VARIABLE_value_of_index_from_list_2,color:"white"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.VARIABLE_value_of_index_from_list_3,color:"white"}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs", -b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null,null,{type:"number",params:["1"]}],type:"value_of_index_from_list"},paramsKeyMap:{LIST:1,INDEX:3},"class":"list_element",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a),d=a.getValue("INDEX",a),c=Entry.variableContainer.getList(c,b),d=Entry.getListRealIndex(d,c);if(!c.array_||isNaN(d)||d>c.array_.length)throw Error("can not insert value to array");return c.array_[d- -1].data}},length_of_list:{color:"#E457DC",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_length_of_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Text",text:Lang.Blocks.VARIABLE_length_of_list_2,color:"white"}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs", -b)}]},def:{params:[null,null,null],type:"length_of_list"},paramsKeyMap:{LIST:1},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a);return Entry.variableContainer.getList(c,b).array_.length}},show_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a= -Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null],type:"show_list"},paramsKeyMap:{LIST:0},"class":"list_visibility",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a);Entry.variableContainer.getList(c).setVisible(!0);return a.callReturn()}},hide_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists", -fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null],type:"hide_list"},paramsKeyMap:{LIST:0},"class":"list_visibility",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a);Entry.variableContainer.getList(c).setVisible(!1); -return a.callReturn()}},options_for_list:{color:"#E457DC",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["\uccab\ubc88\uc9f8","FIRST"],["\ub9c8\uc9c0\ub9c9","LAST"],["\ubb34\uc791\uc704","RANDOM"]],value:"FIRST",fontSize:11}],events:{},def:{params:[null]},paramsKeyMap:{OPERATOR:0},func:function(b,a){return a.getField("OPERATOR",a)}},set_visible_answer:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CALC_timer_visible_show, -"SHOW"],[Lang.Blocks.CALC_timer_visible_hide,"HIDE"]],value:"SHOW",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{viewAdd:[function(b){Entry.container&&Entry.container.showProjectAnswer()}],viewDestroy:[function(b){Entry.container&&Entry.container.hideProjectAnswer(b)}]},def:{params:["HIDE",null],type:"set_visible_answer"},paramsKeyMap:{BOOL:0},"class":"ask",isNotFor:[],func:function(b,a){"HIDE"==a.getField("BOOL",a)?Entry.container.inputValue.setVisible(!1): -Entry.container.inputValue.setVisible(!0);return a.callReturn()}},is_included_in_list:{color:"#E457DC",skeleton:"basic_boolean_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_is_included_in_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Text",text:Lang.Blocks.VARIABLE_is_included_in_list_2,color:"white"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.VARIABLE_is_included_in_list_3, -color:"white"}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null,null,{type:"text",params:["10"]},null],type:"is_included_in_list"},paramsKeyMap:{LIST:1,DATA:3},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a),d=a.getStringValue("DATA",a),c=Entry.variableContainer.getList(c,b);if(!c)return!1;for(var c= -c.array_,e=0,f=c.length;ek&&(k=Math.round(k-155),g=-k,h=0,Entry.dplay.vel_value=g);if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11, -0),a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(c,g),Entry.hw.setDigitalPortValue(d,h),Entry.hw.setDigitalPortValue(e,g),Entry.hw.setDigitalPortValue(f,h),delete a.isStart,delete a.timeFlag,Entry.engine.isContinue=!1,a.callReturn()}else{a.isStart=!0;a.timeFlag=1;var l=setTimeout(function(){a.timeFlag=2;Entry.dplay.removeTimeout(l)},50);Entry.dplay.timeouts.push(l);return a}}},dplay_buzzer:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\ub514\uc9c0\ud138 10\ubc88 \ubd80\uc800\ub97c %1 %2 %3 \ubc15\uc790\ub85c \uc5f0\uc8fc\ud558\uae30", -params:[{type:"Dropdown",options:[["\ub3c4","1"],["\ub3c4#","2"],["\ub808","3"],["\ubbf8b","4"],["\ubbf8","5"],["\ud30c","6"],["\ud30c#","7"],["\uc194","8"],["\uc194#","9"],["\ub77c","10"],["\uc2dcb","11"],["\uc2dc","12"],["\ubb34\uc74c","100"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png", -size:12}],events:{},def:{params:["1","1",{type:"text",params:["0.5"]},null],type:"dplay_buzzer"},paramsKeyMap:{NOTE:0,OCTAVE:1,VALUE:2},"class":"dplay_set",isNotFor:["dplay"],func:function(b,a){if(a.isStart){if(1==a.timeFlag)return a;Entry.hw.setDigitalPortValue(10,100);delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;return a.callReturn()}var c=a.getNumberField("NOTE",a),d=a.getNumberField("OCTAVE",a),e=a.getNumberValue("VALUE"),d=c+12*(d-1),e=6E4*e/60;a.isStart=!0;a.timeFlag=1;100== -c?Entry.hw.setDigitalPortValue(10,100):Entry.hw.setDigitalPortValue(10,d);if(100m?(n=Math.round(m-155),g=-n,h=0,Entry.dplay.Left_value=g):0==m&&(h=g=0,Entry.dplay.Left_value=0));"2"==q&&(e=6,f=11,0m?(n=Math.round(m-155),k=-n,l=0,Entry.dplay.Right_value= -k):0==m&&(l=k=0,Entry.dplay.Right_value=k));"3"==q&&(c=3,d=5,e=6,f=11,0m?(n=Math.round(m-155),g=-n,h=0,k=-n,l=0,Entry.dplay.Left_value=g,Entry.dplay.Right_value=k):0==m&&(l=k=h=g=0,Entry.dplay.Left_value=0,Entry.dplay.Right_value=0));if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0), -a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(c,g),Entry.hw.setDigitalPortValue(d,h),Entry.hw.setDigitalPortValue(e,l),Entry.hw.setDigitalPortValue(f,k),delete a.isStart,delete a.timeFlag,Entry.engine.isContinue=!1,a.callReturn()}else{a.isStart=!0;a.timeFlag=1;var r=setTimeout(function(){a.timeFlag=2;Entry.dplay.removeTimeout(r)},50);Entry.dplay.timeouts.push(r);return a}}},dplay_robot_speed_set:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubc14\ud034 %1 \uc67c\ucabd \ubc14\ud034 %2(\uc73c)\ub85c \uc815\ud558\uae30 %3", -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:["100"]},{type:"text",params:["100"]},null],type:"dplay_robot_speed_set"},paramsKeyMap:{R_VALUE:0,L_VALUE:1},"class":"dplay_robot",isNotFor:["dplay"],func:function(b,a){var c=0,d=0,e=0,f=0,g=0,g=0,g=a.getNumberValue("L_VALUE",a),g=Math.max(g,-100),g=Math.min(g,100);0 -g?(g=Math.round(g-155),c=-g,d=0,Entry.dplay.Left_value=c):0==g&&(d=c=0,Entry.dplay.Left_value=0);g=a.getNumberValue("R_VALUE",a);g=Math.max(g,-100);g=Math.min(g,100);0g?(g=Math.round(g-155),e=-g,f=0,Entry.dplay.Right_value=e):0==g&&(f=e=0,Entry.dplay.Right_value=0);if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0), -a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(3,c),Entry.hw.setDigitalPortValue(5,d),Entry.hw.setDigitalPortValue(6,f),Entry.hw.setDigitalPortValue(11,e),delete a.isStart,delete a.timeFlag,Entry.engine.isContinue=!1,a.callReturn()}else{a.isStart=!0;a.timeFlag=1;var h=setTimeout(function(){a.timeFlag=2;Entry.dplay.removeTimeout(h)},50);Entry.dplay.timeouts.push(h);return a}}},dplay_robot_stop:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\ub85c\ubd07\uc744 \uc815\uc9c0\ud558\uae30 %1", -params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"dplay_robot_stop"},paramsKeyMap:{},"class":"dplay_robot",isNotFor:["dplay"],func:function(b,a){Entry.hw.setDigitalPortValue(3,0);Entry.hw.setDigitalPortValue(5,0);Entry.hw.setDigitalPortValue(11,0);Entry.hw.setDigitalPortValue(6,0);return a.callReturn()}},nemoino_get_number_sensor_value:{parent:"arduino_get_number_sensor_value",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_sensor_number"}], -type:"nemoino_get_number_sensor_value"},"class":"arduino_value"},nemoino_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_port_number"}],type:"nemoino_get_digital_value"},"class":"arduino_value"},nemoino_toggle_led:{parent:"arduino_toggle_led",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"nemoino_toggle_led"},"class":"arduino_set"},nemoino_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_pwm_port_number"}, -{type:"arduino_text",params:["255"]},null],type:"nemoino_toggle_pwm"},"class":"arduino_set"},nemoino_convert_scale:{parent:"arduino_convert_scale",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number"}]},{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"nemoino_convert_scale"},"class":"arduino"},sensorBoard_get_number_sensor_value:{parent:"arduino_get_number_sensor_value", -isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_sensor_number"}],type:"sensorBoard_get_number_sensor_value"},"class":"arduino_value"},sensorBoard_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_port_number"}],type:"sensorBoard_get_digital_value"},"class":"arduino_value"},sensorBoard_toggle_led:{parent:"arduino_toggle_led",isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"sensorBoard_toggle_led"}, -"class":"arduino_set"},sensorBoard_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"sensorBoard_toggle_pwm"},"class":"arduino_set"},sensorBoard_convert_scale:{parent:"arduino_convert_scale",isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number",id:"bl5e"}]},{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number", -params:["0"]},{type:"number",params:["100"]}],type:"sensorBoard_convert_scale"},"class":"arduino"},CODEino_get_number_sensor_value:{parent:"arduino_get_number_sensor_value",isNotFor:["CODEino"],def:{params:[{type:"arduino_get_sensor_number"}],type:"CODEino_get_number_sensor_value"},"class":"arduino_value"},CODEino_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["CODEino"],def:{params:[{type:"arduino_get_port_number"}],type:"CODEino_get_digital_value"},"class":"arduino_value"},CODEino_toggle_led:{parent:"arduino_toggle_led", -isNotFor:["CODEino"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"CODEino_toggle_led"},"class":"arduino_set"},CODEino_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["CODEino"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"CODEino_toggle_pwm"},"class":"arduino_set"},CODEino_convert_scale:{parent:"arduino_convert_scale",isNotFor:["CODEino"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number"}]}, -{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"CODEino_convert_scale"},"class":"arduino"},ardublock_get_number_sensor_value:{parent:"arduino_get_number_sensor_value",isNotFor:["ardublock"],def:{params:[{type:"arduino_get_sensor_number"}],type:"ardublock_get_number_sensor_value"},"class":"arduino_value"},ardublock_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["ardublock"],def:{params:[{type:"arduino_get_port_number"}], -type:"ardublock_get_digital_value"},"class":"arduino_value"},ardublock_toggle_led:{parent:"arduino_toggle_led",isNotFor:["ardublock"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"ardublock_toggle_led"},"class":"arduino_set"},ardublock_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["ardublock"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"ardublock_toggle_pwm"},"class":"arduino_set"},ardublock_convert_scale:{parent:"arduino_convert_scale", -isNotFor:["ardublock"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number"}]},{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"ardublock_convert_scale"},"class":"arduino"},joystick_get_number_sensor_value:{parent:"arduino_get_number_sensor_value",isNotFor:["joystick"],def:{params:[{type:"arduino_get_sensor_number"}],type:"joystick_get_number_sensor_value"},"class":"arduino_value"}, -joystick_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["joystick"],def:{params:[{type:"arduino_get_port_number"}],type:"joystick_get_digital_value"},"class":"arduino_value"},joystick_toggle_led:{parent:"arduino_toggle_led",isNotFor:["joystick"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"joystick_toggle_led"},"class":"arduino_set"},joystick_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["joystick"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text", -params:["255"]},null],type:"joystick_toggle_pwm"},"class":"arduino_set"},joystick_convert_scale:{parent:"arduino_convert_scale",isNotFor:["joystick"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number"}]},{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"joystick_convert_scale"},"class":"arduino"},ebs_if:{parent:"_if",def:{type:"_if",params:[{type:"reach_something",params:[null, -"wall"]}]}},ebs_if2:{parent:"_if",def:{type:"_if",params:[{type:"reach_something",params:[null,"cwz5"]}]}}};(function(){for(var b in Entry.block){var a=Entry.block[b];if(a.parent){var c=function(){};c.prototype=Entry.block[a.parent];var c=new c,d;for(d in a)c[d]=a[d];Entry.block[b]=c}}})();"object"==typeof exports&&(exports.block=Entry.block);Entry.BlockMenu=function(b,a,c,d){Entry.Model(this,!1);this._align=a||"CENTER";this._scroll=void 0!==d?d:!1;this._bannedClass=[];this._categories=[];this.suffix="blockMenu";b="string"===typeof b?$("#"+b):$(b);if("DIV"!==b.prop("tagName"))return console.error("Dom is not div element");this.view=b;this.visible=!0;this._svgId="blockMenu"+(new Date).getTime();this._clearCategory();this._categoryData=c;this._generateView(c);this._splitters=[];this.setWidth();this.svg=Entry.SVG(this._svgId);Entry.Utils.addFilters(this.svg, -this.suffix);a=Entry.Utils.addBlockPattern(this.svg,this.suffix);this.patternRect=a.rect;this.pattern=a.pattern;this.svgGroup=this.svg.elem("g");this.svgThreadGroup=this.svgGroup.elem("g");this.svgThreadGroup.board=this;this.svgBlockGroup=this.svgGroup.elem("g");this.svgBlockGroup.board=this;this.changeEvent=new Entry.Event(this);c&&this._generateCategoryCodes(c);this.observe(this,"_handleDragBlock",["dragBlock"]);this._scroll&&(this._scroller=new Entry.BlockMenuScroller(this),this._addControl(b)); -Entry.documentMousedown&&Entry.documentMousedown.attach(this,this.setSelectedBlock);this._categoryCodes&&Entry.keyPressed&&Entry.keyPressed.attach(this,this._captureKeyEvent);Entry.windowResized&&(b=_.debounce(this.updateOffset,200),Entry.windowResized.attach(this,b))}; -(function(b){b.schema={code:null,dragBlock:null,closeBlock:null,selectedBlockView:null};b._generateView=function(a){var b=this.view,d=this;a&&(this._categoryCol=Entry.Dom("ul",{class:"entryCategoryListWorkspace",parent:b}),this._generateCategoryView(a));this.blockMenuContainer=Entry.Dom("div",{"class":"blockMenuContainer",parent:b});this.svgDom=Entry.Dom($(''),{parent:this.blockMenuContainer});this.svgDom.mouseenter(function(a){d._scroller&& -d._scroller.setOpacity(1);a=d.workspace.selectedBlockView;!Entry.playground||Entry.playground.resizing||a&&a.dragMode===Entry.DRAG_MODE_DRAG||(Entry.playground.focusBlockMenu=!0,a=d.svgGroup.getBBox(),a=a.width+a.x+64,a>Entry.interfaceState.menuWidth&&(this.widthBackup=Entry.interfaceState.menuWidth-64,$(this).stop().animate({width:a-62},200)))});this.svgDom.mouseleave(function(a){Entry.playground&&!Entry.playground.resizing&&(d._scroller&&d._scroller.setOpacity(0),(a=this.widthBackup)&&$(this).stop().animate({width:a}, -200),delete this.widthBackup,delete Entry.playground.focusBlockMenu)});$(window).scroll(function(){d.updateOffset()})};b.changeCode=function(a){if(!(a instanceof Entry.Code))return console.error("You must inject code instance");this.codeListener&&this.code.changeEvent.detach(this.codeListener);var b=this;this.set({code:a});this.codeListener=this.code.changeEvent.attach(this,function(){b.changeEvent.notify()});a.createView(this);this.align()};b.bindCodeView=function(a){this.svgBlockGroup.remove(); -this.svgThreadGroup.remove();this.svgBlockGroup=a.svgBlockGroup;this.svgThreadGroup=a.svgThreadGroup;this.svgGroup.appendChild(this.svgThreadGroup);this.svgGroup.appendChild(this.svgBlockGroup);this._scroller&&this.svgGroup.appendChild(this._scroller.svgGroup)};b.align=function(a){var b=this.code;if(b){this._clearSplitters();b.view&&!a&&b.view.reDraw();a=b.getThreads();for(var b=10,d="LEFT"==this._align?10:this.svgDom.width()/2,e,f=0,g=a.length;fthis._bannedClass.indexOf(a)&&this._bannedClass.push(a);this.align(b)};b.unbanClass=function(a,b){var d=this._bannedClass.indexOf(a);-1b&&(a.preventDefault(),this.selectMenu(b-49))};b.setPatternRectFill=function(a){this.patternRect.attr({fill:a});this.pattern.attr({style:""})};b.disablePattern=function(){this.pattern.attr({style:"display: none"})};b._clearCategory=function(){this._selectedCategoryView=null;this._categories=[];var a=this._categoryElems,b;for(b in a)a[b].remove();this._categoryElems={};a=this._categoryCodes;for(b in a){var d=a[b];d.constructor== -Entry.Code&&d.clear()}this._categoryCodes=null};b.setCategoryData=function(a){this._clearCategory();this._categoryData=a;this._generateCategoryView(a);this._generateCategoryCodes(a)};b._generateCategoryView=function(a){if(a)for(var b=0;b=b?this.setVisible(!1):this.setVisible(!0)};b._reset=function(){this.vY=0;this.vScrollbar.attr({y:this.vY});this.resizeScrollBar()};b.onMouseDown=function(a){function b(a){a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();a=a.originalEvent&&a.originalEvent.touches?a.originalEvent.touches[0]:a;var c=e.dragInstance; -e.scroll(a.pageY-c.offsetY);c.set({offsetY:a.pageY})}function d(a){$(document).unbind(".scroll");delete e.dragInstance}var e=this;a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();if(0===a.button||a.originalEvent&&a.originalEvent.touches){Entry.documentMousedown&&Entry.documentMousedown.notify(a);var f;f=a.originalEvent&&a.originalEvent.touches?a.originalEvent.touches[0]:a;var g=$(document);g.bind("mousemove.scroll",b);g.bind("mouseup.scroll",d);g.bind("touchmove.scroll", -b);g.bind("touchend.scroll",d);e.dragInstance=new Entry.DragInstance({startY:f.pageY,offsetY:f.pageY})}a.stopPropagation()};b._addControl=function(){$(this.vScrollbar).bind("mousedown touchstart",this.mouseHandler)}})(Entry.BlockMenuScroller.prototype);Entry.BlockView=function(b,a,c){Entry.Model(this,!1);this.block=b;this._lazyUpdatePos=_.debounce(b._updatePos.bind(b),200);this._board=a;this._observers=[];this.set(b);this.svgGroup=a.svgBlockGroup.elem("g");this._schema=Entry.block[b.type];this._schema.changeEvent&&(this._schemaChangeEvent=this._schema.changeEvent.attach(this,this._updateSchema));var d=this._skeleton=Entry.skeleton[this._schema.skeleton];this._contents=[];this._statements=[];this.magnet={};this._paramMap={};d.magnets&&d.magnets(this).next&& -(this.svgGroup.nextMagnet=this.block,this._nextGroup=this.svgGroup.elem("g"),this._observers.push(this.observe(this,"_updateMagnet",["contentHeight"])));this.isInBlockMenu=this.getBoard()instanceof Entry.BlockMenu;var e=this;this.mouseHandler=function(){var a=e.block.events;a&&a.mousedown&&a.mousedown.forEach(function(a){a(e)});e.onMouseDown.apply(e,arguments)};this._startRender(b,c);this._observers.push(this.block.observe(this,"_setMovable",["movable"]));this._observers.push(this.block.observe(this, +{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,"4",{type:"text",params:["0.5"]},null],type:"albert_play_note_for"},paramsKeyMap:{NOTE:0,OCTAVE:1,VALUE:2},"class":"albert_buzzer",isNotFor:["albert"],func:function(a,b){var c=Entry.hw.sendQueue;if(b.isStart){if(1==b.timeFlag)return b;delete b.isStart;delete b.timeFlag;Entry.engine.isContinue=!1;c.note=0;return b.callReturn()}a=b.getNumberField("NOTE",b);var d=b.getNumberField("OCTAVE", +b),e=6E4*b.getNumberValue("VALUE",b)/Entry.Albert.tempo;b.isStart=!0;b.timeFlag=1;c.buzzer=0;c.note=a+12*(d-1);if(100Entry.Albert.tempo&&(Entry.Albert.tempo=1);return b.callReturn()}},albert_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:"albert_set_tempo_to"},paramsKeyMap:{VALUE:0},"class":"albert_buzzer",isNotFor:["albert"],func:function(a,b){Entry.Albert.tempo=b.getNumberValue("VALUE");1>Entry.Albert.tempo&&(Entry.Albert.tempo=1);return b.callReturn()}},albert_move_forward:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator", +img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null]},func:function(a,b){a=Entry.hw.sendQueue;if(b.isStart){if(1==b.timeFlag)return b;delete b.timeFlag;delete b.isStart;Entry.engine.isContinue=!1;a.leftWheel=0;a.rightWheel=0;return b.callReturn()}b.isStart=!0;b.timeFlag=1;a.leftWheel=30;a.rightWheel=30;setTimeout(function(){b.timeFlag=0},1E3);return b}},albert_move_backward:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png", +size:12}],events:{},def:{params:[null]},func:function(a,b){a=Entry.hw.sendQueue;if(b.isStart){if(1==b.timeFlag)return a.leftWheel=-30,a.rightWheel=-30,b;delete b.timeFlag;delete b.isStart;Entry.engine.isContinue=!1;a.leftWheel=0;a.rightWheel=0;return b.callReturn()}b.isStart=!0;b.timeFlag=1;setTimeout(function(){b.timeFlag=0},1E3);return b}},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(a,b){a=Entry.hw.sendQueue;if(b.isStart){if(1==b.timeFlag)return a.leftWheel=b.leftValue,a.rightWheel=b.rightValue,b;delete b.timeFlag;delete b.isStart;delete b.leftValue;delete b.rightValue;Entry.engine.isContinue=!1;a.leftWheel=0;a.rightWheel=0;return b.callReturn()}a="LEFT"==b.getField("DIRECTION",b);b.leftValue=a?-30:30;b.rightValue= +a?30:-30;b.isStart=!0;b.timeFlag=1;setTimeout(function(){b.timeFlag=0},1E3);return b}},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(a,b){a=Entry.hw.sendQueue;var c=b.getField("DIRECTION",b),d=Number(b.getField("COLOR",b));"FRONT"==c?(a.leftEye=d,a.rightEye=d):"LEFT"==c?a.leftEye=d:a.rightEye=d;return b.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(a,b){a=Entry.hw.sendQueue;var c=b.getField("DIRECTION",b);"FRONT"==c?(a.leftEye=0,a.rightEye=0):"LEFT"==c?a.leftEye=0:a.rightEye=0;return b.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(a,b){a=Entry.hw.sendQueue;var c=Entry.hw.portData,d=b.getField("DIRECTION"),e=b.getNumberValue("VALUE");"LEFT"==d?a.leftWheel=void 0!=a.leftWheel?a.leftWheel+e:c.leftWheel+e:("RIGHT"!=d&&(a.leftWheel=void 0!=a.leftWheel?a.leftWheel+e:c.leftWheel+e),a.rightWheel=void 0!= +a.rightWheel?a.rightWheel+e:c.rightWheel+e);return b.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(a,b){a=Entry.hw.sendQueue;var c=b.getField("DIRECTION"), +d=b.getNumberValue("VALUE");"LEFT"==c?a.leftWheel=d:("RIGHT"!=c&&(a.leftWheel=d),a.rightWheel=d);return b.callReturn()}},arduino_text:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"TextInput",value:10}],events:{},def:{params:[]},paramsKeyMap:{NAME:0},func:function(a,b){return b.getStringField("NAME")}},arduino_send:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[]},paramsKeyMap:{VALUE:0},func:function(a,b){a= +b.getValue("VALUE",b);var c=new XMLHttpRequest;c.open("POST","http://localhost:23518/arduino/",!1);c.send(String(a));Entry.assert(200==c.status,"arduino is not connected");return b.callReturn()}},arduino_get_number:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[]},paramsKeyMap:{VALUE:0},func:function(a,b){a=b.getValue("VALUE",b);b=new XMLHttpRequest;b.open("POST","http://localhost:23518/arduino/",!1);b.send(String(a));Entry.assert(200== +b.status,"arduino is not connected");return Number(b.responseText)}},arduino_get_string:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[]},paramsKeyMap:{VALUE:0},func:function(a,b){a=b.getValue("VALUE",b);b=new XMLHttpRequest;b.open("POST","http://localhost:23518/arduino/",!1);b.send(String(a));Entry.assert(200==b.status,"arduino is not connected");return b.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(a,b){return b.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(a,b){return b.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(a,b){return b.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(a,b){a=b.getValue("VALUE",b);return Entry.hw.getAnalogPortValue(a[1])}},arduino_get_digital_value:{color:"#00979D",fontColor:"#fff", +skeleton:"basic_boolean_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[{type:"arduino_get_port_number"}],type:"arduino_get_digital_value"},paramsKeyMap:{VALUE:0},"class":"arduino_value",isNotFor:["arduino"],func:function(a,b){a=b.getNumberValue("VALUE",b);return Entry.hw.getDigitalPortValue(a)}},arduino_toggle_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown",options:[[Lang.Blocks.ARDUINO_on,"on"],[Lang.Blocks.ARDUINO_off, +"off"]],value:"on",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"arduino_get_port_number"},null,null],type:"arduino_toggle_led"},paramsKeyMap:{VALUE:0,OPERATOR:1},"class":"arduino_set",isNotFor:["arduino"],func:function(a,b){a=b.getNumberValue("VALUE");var c=b.getField("OPERATOR");Entry.hw.setDigitalPortValue(a,"on"==c?255:0);return b.callReturn()}},arduino_toggle_pwm:{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:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"arduino_toggle_pwm"},paramsKeyMap:{PORT:0,VALUE:1},"class":"arduino_set",isNotFor:["arduino"],func:function(a,b){a=b.getNumberValue("PORT");var c=b.getNumberValue("VALUE"),c=Math.round(c),c=Math.max(c,0),c=Math.min(c,255);Entry.hw.setDigitalPortValue(a, +c);return b.callReturn()}},arduino_convert_scale:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number",id:"bl5e"}]},{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number", +params:["100"]}],type:"arduino_convert_scale"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2,VALUE4:3,VALUE5:4},"class":"arduino",isNotFor:["arduino"],func:function(a,b){var c=b.getNumberValue("VALUE1",b),d=b.getNumberValue("VALUE2",b),e=b.getNumberValue("VALUE3",b);a=b.getNumberValue("VALUE4",b);b=b.getNumberValue("VALUE5",b);if(d>e)var f=d,d=e,e=f;a>b&&(f=a,a=b,b=f);c=(b-a)/(e-d)*(c-d);c+=a;c=Math.min(b,c);c=Math.max(a,c);return Math.round(c)}},arduino_ext_get_analog_value:{color:"#00979D",fontColor:"#fff", +skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["A0","0"],["A1","1"],["A2","2"],["A3","3"],["A4","4"],["A5","5"]],value:"0",fontSize:11}],events:{},def:{params:[null],type:"arduino_ext_get_analog_value"},paramsKeyMap:{PORT:0},"class":"ArduinoExtGet",isNotFor:["ArduinoExt"],func:function(a,b){a=b.getField("PORT",b);b=Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.ANALOG);var c=Entry.hw.portData.TIME||0;Entry.ArduinoExt.BlockState[this.type]||(Entry.ArduinoExt.BlockState[this.type]= +{isStart:!1,stamp:0});var d=Entry.ArduinoExt.BlockState[this.type],e=Entry.hw.portData.ANALOG;if(d.isStart){if(c&&c===d.stamp||64Entry.hw.getAnalogPortValue(0)?1:0}},CODEino_get_light_status:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CODEino_string_14,"BRIGHT"],[Lang.Blocks.CODEino_string_15,"DARK"]],value:"BRIGHT",fontSize:11}],events:{},def:{params:[null],type:"CODEino_get_light_status"}, +paramsKeyMap:{STATUS:0},"class":"CODEino",isNotFor:["CODEino"],func:function(a,b){return"DARK"==b.getField("STATUS",b)?800Entry.hw.getAnalogPortValue(1)?1:0}},CODEino_is_button_pressed:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CODEino_string_3,"4"],[Lang.Blocks.CODEino_string_4,"17"],[Lang.Blocks.CODEino_string_5,"18"],[Lang.Blocks.CODEino_string_6,"19"],[Lang.Blocks.CODEino_string_7, +"20"]],value:"4",fontSize:11}],events:{},def:{params:[null],type:"CODEino_is_button_pressed"},paramsKeyMap:{PORT:0},"class":"CODEino",isNotFor:["CODEino"],func:function(a,b){a=b.getNumberField("PORT",b);return 14b?1:0;if("RIGHT"==a||"FRONT"==a)return 30b?1:0}},CODEino_get_accelerometer_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["X","3"],["Y","4"],["Z","5"]],value:"3",fontSize:11}],events:{},def:{params:[null],type:"CODEino_get_accelerometer_value"},paramsKeyMap:{PORT:0},"class":"CODEino",isNotFor:["CODEino"],func:function(a,b){var c=Entry.hw.getAnalogPortValue(b.getField("PORT", +b)),d=265,e=402;a=-90;b=90;if(d>e)var f=d,d=e,e=f;a>b&&(f=a,a=b,b=f);c=(b-a)/(e-d)*(c-d);c+=a;c=Math.min(b,c);c=Math.max(a,c);return Math.round(c)}},nemoino_get_named_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"%1 \uc13c\uc11c\uac12",params:[{type:"Dropdown",options:[["\uc18c\ub9ac","0"],["\ube5b","1"],["\uc2ac\ub77c\uc774\ub354","2"],["\uc800\ud56d-A","3"],["\uc800\ud56d-B","4"],["\uc800\ud56d-C","5"],["\uc800\ud56d-D","6"]],value:"0",fontSize:11}], +events:{},def:{params:[null],type:"nemoino_get_named_sensor_value"},paramsKeyMap:{PORT:0},"class":"nemoino",isNotFor:["nemoino"],func:function(a,b){return Entry.hw.getAnalogPortValue(b.getField("PORT",b))}},nemoino_get_sound_status:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],template:"\uc18c\ub9ac\uc13c\uc11c %1",params:[{type:"Dropdown",options:[["\uc18c\ub9ac\ud07c","GREAT"],["\uc18c\ub9ac\uc791\uc74c","SMALL"]],value:"GREAT",fontSize:11}],events:{},def:{params:[null], +type:"nemoino_get_sound_status"},paramsKeyMap:{STATUS:0},"class":"nemoino",isNotFor:["nemoino"],func:function(a,b){return"GREAT"==b.getField("STATUS",b)?600Entry.hw.getAnalogPortValue(0)?1:0}},nemoino_is_button_pressed:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],template:"\ubcf4\ub4dc\uc758 %1",params:[{type:"Dropdown",options:[["\ubc84\ud2bc\ub204\ub984","4"],["A\uc5f0\uacb0\ub428","17"],["B\uc5f0\uacb0\ub428","18"],["C\uc5f0\uacb0\ub428", +"19"],["D\uc5f0\uacb0\ub428","20"]],value:"4",fontSize:11}],events:{},def:{params:[null],type:"nemoino_is_button_pressed"},paramsKeyMap:{PORT:0},"class":"nemoino",isNotFor:["nemoino"],func:function(a,b){a=b.getNumberField("PORT",b);return 14b?1:0;if("RIGHT"==a||"FRONT"==a)return 30b?1:0}},nemoino_get_accelerometer_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"3\ucd95 \uac00\uc18d\ub3c4\uc13c\uc11c %1 \ucd95\uc758 \uc13c\uc11c\uac12",params:[{type:"Dropdown",options:[["X","3"],["Y","4"],["Z","5"]],value:"3",fontSize:11}], +events:{},def:{params:[null],type:"nemoino_get_accelerometer_value"},paramsKeyMap:{PORT:0},"class":"nemoino",isNotFor:["nemoino"],func:function(a,b){var c=Entry.hw.getAnalogPortValue(b.getField("PORT",b)),d=265,e=402;a=-90;b=90;if(d>e)var f=d,d=e,e=f;a>b&&(f=a,a=b,b=f);c=(b-a)/(e-d)*(c-d);c+=a;c=Math.min(b,c);c=Math.max(a,c);return Math.round(c)}},bitbrick_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11, +arrowColor:EntryStatic.ARROW_COLOR_HW,menuName:Entry.Bitbrick.sensorList}],events:{},def:{params:[null],type:"bitbrick_sensor_value"},paramsKeyMap:{PORT:0},"class":"condition",isNotFor:["bitbrick"],func:function(a,b){a=b.getStringField("PORT");return Entry.hw.portData[a].value}},bitbrick_is_touch_pressed:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.touchList}],events:{},def:{params:[null], +type:"bitbrick_is_touch_pressed"},paramsKeyMap:{PORT:0},"class":"condition",isNotFor:["bitbrick"],func:function(a,b){return 0===Entry.hw.portData[b.getStringField("PORT")].value}},bitbrick_turn_off_color_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"bitbrick_turn_off_color_led",id:"i3je"},"class":"condition",isNotFor:["bitbrick"],func:function(a,b){Entry.hw.sendQueue.LEDR=0;Entry.hw.sendQueue.LEDG= +0;Entry.hw.sendQueue.LEDB=0;return b.callReturn()}},bitbrick_turn_on_color_led_by_rgb:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["255"]},{type:"text",params:["255"]},{type:"text",params:["255"]},null],type:"bitbrick_turn_on_color_led_by_rgb"},paramsKeyMap:{rValue:0,gValue:1,bValue:2},"class":"condition", +isNotFor:["bitbrick"],func:function(a,b){a=b.getNumberValue("rValue");var c=b.getNumberValue("gValue"),d=b.getNumberValue("bValue"),e=Entry.adjustValueWithMaxMin,f=Entry.hw.sendQueue;f.LEDR=e(a,0,255);f.LEDG=e(c,0,255);f.LEDB=e(d,0,255);return b.callReturn()}},bitbrick_turn_on_color_led_by_picker:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Color"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"bitbrick_turn_on_color_led_by_picker"}, +paramsKeyMap:{VALUE:0},"class":"condition",isNotFor:["bitbrick"],func:function(a,b){a=b.getStringField("VALUE");Entry.hw.sendQueue.LEDR=parseInt(a.substr(1,2),16);Entry.hw.sendQueue.LEDG=parseInt(a.substr(3,2),16);Entry.hw.sendQueue.LEDB=parseInt(a.substr(5,2),16);return b.callReturn()}},bitbrick_turn_on_color_led_by_value:{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:["0"]},null],type:"bitbrick_turn_on_color_led_by_value"},paramsKeyMap:{VALUE:0},"class":"condition",isNotFor:["bitbrick"],func:function(a,b){a=b.getNumberValue("VALUE");var c,d,e;a%=200;67>a?(c=200-3*a,d=3*a,e=0):134>a?(a-=67,c=0,d=200-3*a,e=3*a):201>a&&(a-=134,c=3*a,d=0,e=200-3*a);Entry.hw.sendQueue.LEDR=c;Entry.hw.sendQueue.LEDG=d;Entry.hw.sendQueue.LEDB=e;return b.callReturn()}},bitbrick_buzzer:{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:"bitbrick_buzzer"},paramsKeyMap:{VALUE:0},"class":"condition",isNotFor:["bitbrick"],func:function(a,b){if(b.isStart)return Entry.hw.sendQueue.buzzer=0,delete b.isStart,b.callReturn();a=b.getNumberValue("VALUE");Entry.hw.sendQueue.buzzer=a;b.isStart=!0;return b}},bitbrick_turn_off_all_motors:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png", +size:12}],events:{},def:{params:[null],type:"bitbrick_turn_off_all_motors"},"class":"condition",isNotFor:["bitbrick"],func:function(a,b){var c=Entry.hw.sendQueue;a=Entry.Bitbrick;a.servoList().map(function(b){c[b[1]]=0});a.dcList().map(function(b){c[b[1]]=128});return b.callReturn()}},bitbrick_dc_speed:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.dcList},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png", +size:12}],events:{},def:{params:[null,{type:"text",params:["60"]},null],type:"bitbrick_dc_speed"},paramsKeyMap:{PORT:0,VALUE:1},"class":"condition",isNotFor:["bitbrick"],func:function(a,b){a=b.getNumberValue("VALUE");a=Math.min(a,Entry.Bitbrick.dcMaxValue);a=Math.max(a,Entry.Bitbrick.dcMinValue);Entry.hw.sendQueue[b.getStringField("PORT")]=a+128;return b.callReturn()}},bitbrick_dc_direction_speed:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11, +menuName:Entry.Bitbrick.dcList},{type:"Dropdown",options:[[Lang.Blocks.BITBRICK_dc_direction_cw,"CW"],[Lang.Blocks.BITBRICK_dc_direction_ccw,"CCW"]],value:"CW",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,{type:"text",params:["100"]},null],type:"bitbrick_dc_direction_speed"},paramsKeyMap:{PORT:0,DIRECTION:1,VALUE:2},"class":"condition",isNotFor:["bitbrick"],func:function(a,b){a="CW"===b.getStringField("DIRECTION"); +var c=b.getNumberValue("VALUE"),c=Math.min(c,Entry.Bitbrick.dcMaxValue),c=Math.max(c,0);Entry.hw.sendQueue[b.getStringField("PORT")]=a?c+128:128-c;return b.callReturn()}},bitbrick_servomotor_angle:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.servoList},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"text",params:["100"]},null],type:"bitbrick_servomotor_angle"}, +paramsKeyMap:{PORT:0,VALUE:1},"class":"condition",isNotFor:["bitbrick"],func:function(a,b){a=Entry.Bitbrick.servoMaxValue-(b.getNumberValue("VALUE")+1);a=Math.min(a,Entry.Bitbrick.servoMaxValue);a=Math.max(a,Entry.Bitbrick.servoMinValue);Entry.hw.sendQueue[b.getStringField("PORT")]=a;return b.callReturn()}},bitbrick_convert_scale:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.sensorList}, +{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"}],events:{},def:{params:[null,{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["-100"]},{type:"number",params:["100"]}],type:"bitbrick_convert_scale"},paramsKeyMap:{PORT:0,VALUE2:1,VALUE3:2,VALUE4:3,VALUE5:4},"class":"condition",isNotFor:["bitbrick"],func:function(a,b){a=b.getNumberField("PORT");var c=Entry.hw.portData[a].value,d=b.getNumberValue("VALUE2", +b),e=b.getNumberValue("VALUE3",b);a=b.getNumberValue("VALUE4",b);b=b.getNumberValue("VALUE5",b);if(a>b){var f=a;a=b;b=f}c=(b-a)/(e-d)*(c-d);c+=a;c=Math.min(b,c);c=Math.max(a,c);return Math.round(c)}},cobl_read_ultrason:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"1. \ucd08\uc74c\ud30c\uac70\ub9ac(0~400)",def:{type:"cobl_read_ultrason"},class:"test",func:function(a,b){return Entry.hw.getAnalogPortValue("ultrason")}},cobl_read_potenmeter:{color:"#00979D",fontColor:"#fff", +skeleton:"basic_string_field",template:"2.\uac00\ubcc0\uc800\ud56d(0~1023)",def:{type:"cobl_read_potenmeter"},class:"test",func:function(a,b){console.log("cobl_read_potenmeter");return Entry.hw.getAnalogPortValue("potenmeter")}},cobl_read_irread1:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"3.\uc801\uc678\uc120\uc13c\uc11c1(0~1023)",def:{type:"cobl_read_irread1"},class:"test",func:function(a,b){return Entry.hw.getAnalogPortValue("potenmeter")}},cobl_read_irread2:{color:"#00979D", +fontColor:"#fff",skeleton:"basic_string_field",template:"4.\uc801\uc678\uc120\uc13c\uc11c2(0~1023)",def:{type:"cobl_read_irread2"},class:"test",func:function(a,b){b.getValue("irread2",b);return Entry.hw.getAnalogPortValue("irread2")}},cobl_read_joyx:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"5.\uc870\uc774\uc2a4\ud2f1X\ucd95(1, 0, -1)",def:{type:"cobl_read_joyx"},class:"test",func:function(a,b){return Entry.hw.getAnalogPortValue("joyx")}},cobl_read_joyy:{color:"#00979D", +fontColor:"#fff",skeleton:"basic_string_field",template:"6.\uc870\uc774\uc2a4\ud2f1Y\ucd95(1, 0, -1)",def:{type:"cobl_read_joyy"},class:"test",func:function(a,b){return Entry.hw.getAnalogPortValue("joyy")}},cobl_read_tilt:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"7.\uae30\uc6b8\uae30\uc13c\uc11c(0~4)",def:{type:"cobl_read_tilt"},class:"test",func:function(a,b){return Entry.hw.getAnalogPortValue("tilt")}},cobl_read_temps:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field", +template:"8.\uc628\ub3c4\uc13c\uc11c@\ud3ec\ud2b8%1",params:[{type:"Dropdown",options:[["1","1"],["2","2"]],fontSize:11}],def:{params:["1"],type:"cobl_read_temps"},paramsKeyMap:{VALUE:0},class:"test",func:function(a,b){a=b.getValue("VALUE",b);if(1==a)return Entry.hw.getAnalogPortValue("temps1");if(2==a)return Entry.hw.getAnalogPortValue("temps2")}},cobl_read_light:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"9.\ube5b\uc13c\uc11c@\ud3ec\ud2b8%1",params:[{type:"Dropdown", +options:[["1","1"],["2","2"]],fontSize:11}],def:{params:["1"],type:"cobl_read_light"},paramsKeyMap:{VALUE:0},class:"test",func:function(a,b){a=b.getValue("VALUE",b);if(1==a)return Entry.hw.getAnalogPortValue("light1");if(2==a)return Entry.hw.getAnalogPortValue("light2")}},cobl_read_btn:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",template:"10.\ubc84\ud2bc\uc2a4\uc704\uce58@\ud3ec\ud2b8%1",params:[{type:"Dropdown",options:[["1","1"],["2","2"]],fontSize:11}],def:{params:["1"],type:"cobl_read_btn"}, +paramsKeyMap:{VALUE:0},class:"test",func:function(a,b){a=b.getValue("VALUE",b);if(1==a)return Entry.hw.getDigitalPortValue("btn1");if(2==a)return Entry.hw.getDigitalPortValue("btn2")}},cobl_led_control:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"11.\ubb34\uc9c0\uac1cLED%1%2",params:[{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"]],fontSize:11},{type:"Dropdown",options:[["OFF","OFF"],["Red","Red"],["Orange","Orange"],["Yellow","Yellow"],["Green","Green"],["Blue","Blue"],["Dark Blue", +"Dark Blue"],["Purple","Purple"],["White","White"]],fontSize:11}],def:{params:["1","OFF"],type:"cobl_led_control"},paramsKeyMap:{PORT:0,OPERATOR:0},class:"test",func:function(a,b){a=b.getStringField("PORT");var c=b.getStringField("OPERATOR");Entry.hw.setDigitalPortValue("RainBowLED_IDX",a);Entry.hw.setDigitalPortValue("RainBowLED_COL",c);return b.callReturn()}},cobl_servo_angle_control:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"12.\uac01\ub3c4\ubaa8\ud130 \uac01\ub3c4%1(15~165)", +params:[{type:"TextInput",value:0}],def:{type:"cobl_servo_angle_control"},paramsKeyMap:{VALUE:0},class:"test",func:function(a,b){PORT=1;console.log("servo - test");a=b.getNumberValue("PORT");var c=b.getNumberValue("VALUE"),c=Math.round(c),c=Math.max(c,15),c=Math.min(c,165);1==a&&(console.log("servo 1 degree "+c),Entry.hw.setDigitalPortValue("Servo1",c));2==a&&(console.log("servo 2 degree "+c),Entry.hw.setDigitalPortValue("Servo2",c));return b.callReturn()}},cobl_melody:{color:"#00979D",fontColor:"#fff", +skeleton:"basic",template:"13.\uba5c\ub85c\ub514%1",params:[{type:"Dropdown",options:[["(Low)So","L_So"],["(Low)So#","L_So#"],["(Low)La","L_La"],["(Low)La#","L_La#"],["(Low)Ti","L_Ti"],["Do","Do"],["Do#","Do#"],["Re","Re"],["Re#","Re#"],["Mi","Mi"],["Fa","Fa"],["Fa#","Fa#"],["So","So"],["So#","So#"],["La","La"],["La#","La#"],["Ti","Ti"],["(High)Do","H_Do"],["(High)Do#","H_Do#"],["(High)Re","H_Re"],["(High)R2#","H_Re#"],["(High)Mi","H_Mi"],["(High)Fa","H_Fa"]],fontSize:11}],def:{params:["Do"],type:"cobl_melody"}, +paramsKeyMap:{MELODY:0},class:"test",func:function(a,b){a=b.getStringField("MELODY");console.log("cobl_melody"+a);Entry.hw.setDigitalPortValue("Melody",a);return b.callReturn()}},cobl_dcmotor:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"14.\ud68c\uc804\ubaa8\ud130%1%2\uc18d\ub3c4%3",params:[{type:"Dropdown",options:[["1","1"],["2","2"]],fontSize:11},{type:"Dropdown",options:[["1.Clockwise","1"],["2.Counter Clockwise","2"],["3.Stop","3"]],fontSize:11},{type:"Dropdown",options:[["1", +"1"],["2","2"],["3","3"],["4","4"],["5","5"]],fontSize:11}],def:{params:["1","1","1"],type:"cobl_dcmotor"},paramsKeyMap:{MOTOR:0,DIRECTION:0,SPEED:0},class:"test",func:function(a,b){a=b.getStringField("MOTOR");var c=b.getStringField("DIRECTION"),d=b.getStringField("SPEED");console.log("MOTOR"+a+" Direction"+c+" speed"+d);1==a&&(Entry.hw.setDigitalPortValue("DC1_DIR",c),Entry.hw.setDigitalPortValue("DC1_SPEED",d));2==a&&(Entry.hw.setDigitalPortValue("DC2_DIR",c),Entry.hw.setDigitalPortValue("DC2_SPEED", +d));return b.callReturn()}},cobl_extention_port:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"15.USB\ud3ec\ud2b8%1\ub2e8\uacc4%2",params:[{type:"Dropdown",options:[["1","1"],["2","2"]],fontSize:11},{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"],["4","4"],["5","5"]],fontSize:11}],def:{params:["1","1"],type:"cobl_extention_port"},paramsKeyMap:{PORT:0,LEVEL:0},class:"test",func:function(a,b){a=b.getStringField("PORT");var c=b.getStringField("LEVEL");1==a&&Entry.hw.setDigitalPortValue("EXUSB1", +c);2==a&&Entry.hw.setDigitalPortValue("EXUSB2",c);return b.callReturn()}},cobl_external_led:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"16.\uc678\ubd80LED%1(1~64)R%2G%3B%4",params:[{type:"TextInput",value:0,fontSize:11},{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"]],fontSize:11},{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10", +"10"]],fontSize:11},{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"]],fontSize:11}],def:{params:["1","1","1","1"],type:"cobl_external_led"},paramsKeyMap:{LED:0,RED:0,GREEN:0,BLUE:0},class:"test",func:function(a,b){a=b.getNumberValue("LED");var c=b.getStringField("RED"),d=b.getStringField("GREEN"),e=b.getStringField("BLUE");Entry.hw.setDigitalPortValue("ELED_IDX",a);Entry.hw.setDigitalPortValue("ELED_R",c);Entry.hw.setDigitalPortValue("ELED_G", +d);Entry.hw.setDigitalPortValue("ELED_B",e);return b.callReturn()}},cobl_7_segment:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"17.\uc22b\uc790\uc804\uad11\ud310%1(0~9999)",params:[{type:"TextInput",value:0,color:"#fff"}],def:{type:"cobl_7_segment"},paramsKeyMap:{VALUE:0},class:"test",func:function(a,b){a=b.getNumberValue("VALUE");Entry.hw.setDigitalPortValue("7SEG",a);return b.callReturn()}},start_drawing:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png", +size:12}],events:{},def:{params:[null],type:"start_drawing"},"class":"brush_control",isNotFor:["textBox"],func:function(a,b){a.brush?a.brush.stop=!1:Entry.setBasicBrush(a);Entry.stage.sortZorder();a.brush.moveTo(a.getX(),-1*a.getY());return b.callReturn()}},stop_drawing:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"stop_drawing"},"class":"brush_control",isNotFor:["textBox"],func:function(a,b){a.brush&& +a.shape&&(a.brush.stop=!0);return b.callReturn()}},set_color:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Color"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"set_color"},paramsKeyMap:{VALUE:0},"class":"brush_color",isNotFor:["textBox"],func:function(a,b){var c=b.getField("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(c=Entry.hex2rgb(c),a.brush.rgb=c,a.brush.endStroke(),a.brush.beginStroke("rgba("+c.r+","+c.g+ +","+c.b+","+a.brush.opacity/100+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}},set_random_color:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"set_random_color"},"class":"brush_color",isNotFor:["textBox"],func:function(a,b){a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);if(a.brush){var c=Entry.generateRgb();a.brush.rgb=c;a.brush.endStroke();a.brush.beginStroke("rgba("+c.r+","+ +c.g+","+c.b+","+a.brush.opacity/100+")");a.brush.moveTo(a.getX(),-1*a.getY())}return b.callReturn()}},change_thickness:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["1"]},null],type:"change_thickness"},paramsKeyMap:{VALUE:0},"class":"brush_thickness",isNotFor:["textBox"],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a), +a.brush.stop=!0);a.brush&&(a.brush.thickness+=c,1>a.brush.thickness&&(a.brush.thickness=1),a.brush.setStrokeStyle(a.brush.thickness),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}},set_thickness:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["1"]},null],type:"set_thickness"},paramsKeyMap:{VALUE:0},"class":"brush_thickness",isNotFor:["textBox"], +func:function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(a.brush.thickness=c,a.brush.setStrokeStyle(a.brush.thickness),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}},change_opacity:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_opacity"},paramsKeyMap:{VALUE:0}, +"class":"brush_opacity",isNotFor:["textBox"],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);c=Entry.adjustValueWithMaxMin(a.brush.opacity+c,0,100);a.brush&&(a.brush.opacity=c,a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}},set_opacity:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"}, +{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["50"]},null],type:"set_opacity"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(a.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")"),a.brush.moveTo(a.getX(), +-1*a.getY()));return b.callReturn()}},brush_erase_all:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"brush_erase_all"},"class":"brush_clear",isNotFor:["textBox"],func:function(a,b){var c=a.brush;if(c){var d=c._stroke.style,e=c._strokeStyle.width;c.clear().setStrokeStyle(e).beginStroke(d);c.moveTo(a.getX(),-1*a.getY())}a=a.parent.getStampEntities();a.map(function(b){b.removeClone()});a=null;return b.callReturn()}}, +brush_stamp:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"brush_stamp"},"class":"stamp",isNotFor:["textBox"],func:function(a,b){a.parent.addStampEntity(a);return b.callReturn()}},change_brush_transparency:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]}, +null],type:"change_brush_transparency"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);c=Entry.adjustValueWithMaxMin(a.brush.opacity-c,0,100);a.brush&&(a.brush.opacity=c,a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}},set_brush_tranparency:{color:"#FF9E20", +skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["50"]},null],type:"set_brush_tranparency"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(a.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+ +c.r+","+c.g+","+c.b+","+(1-a.brush.opacity/100)+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}},number:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"TextInput",value:10}],events:{},def:{params:[]},paramsKeyMap:{NUM:0},func:function(a,b){return b.getField("NUM",b)},isPrimitive:!0},angle:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Angle"}],events:{},def:{params:[null],type:"angle"},paramsKeyMap:{ANGLE:0},func:function(a, +b){return b.getNumberField("ANGLE")}},get_x_coordinate:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_x_coordinate,color:"#3D3D3D"}],events:{},def:{params:[null],type:"get_x_coordinate"},"class":"calc",isNotFor:[],func:function(a,b){return a.getX()}},get_y_coordinate:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_y_coordinate,color:"#3D3D3D"}],events:{},def:{params:[null],type:"get_y_coordinate"}, +"class":"calc",isNotFor:[],func:function(a,b){return a.getY()}},get_angle:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_angle,color:"#3D3D3D"}],events:{},def:{params:[null]},func:function(a,b){return parseFloat(a.getRotation().toFixed(1))}},get_rotation_direction:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CALC_rotation_value,"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(a,b){return"DIRECTION"==b.getField("OPERATOR",b).toUpperCase()?parseFloat(a.getDirection().toFixed(1)):parseFloat(a.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(a,b){b=b.getField("VALUE",b);if("mouse"==b)return b=Entry.stage.mouseCoordinate,Math.sqrt(Math.pow(a.getX()-b.x,2)+Math.pow(a.getY()-b.y,2));b=Entry.container.getEntity(b);return Math.sqrt(Math.pow(a.getX()-b.getX(),2)+Math.pow(a.getY()- +b.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(a,b){return"x"===b.getField("VALUE", +b)?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(a,b){var c=b.getField("VALUE", +b);a="self"==c?a:Entry.container.getEntity(c);switch(b.getField("COORDINATE",b)){case "x":return a.getX();case "y":return a.getY();case "rotation":return a.getRotation();case "direction":return a.getDirection();case "picture_index":return b=a.parent,b=b.pictures,b.indexOf(a.picture)+1;case "size":return Number(a.getSize().toFixed(1));case "picture_name":return b=a.parent,b=b.pictures,b[b.indexOf(a.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(a,b){a=b.getField("OPERATOR",b);var c=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return"PLUS"==a?c+b:"MINUS"==a?c-b:"MULTI"==a?c*b:c/b}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a+b}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a-b}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a*b}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a/b}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a%b}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return Math.floor(a/b)}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getField("VALUE",b);if(-1<["asin_radian","acos_radian"].indexOf(b)&&(1a))throw Error("x range exceeded");b.indexOf("_")&&(b=b.split("_")[0]);-1<["sin","cos","tan"].indexOf(b)&&(a=Entry.toRadian(a));switch(b){case "square":b=a*a;break;case "factorial":b=Entry.factorial(a);break;case "root":b=Math.sqrt(a);break;case "log":b=Math.log(a)/Math.LN10;break;case "ln":b=Math.log(a);break; +case "asin":case "acos":case "atan":b=Entry.toDegrees(Math[b](a));break;case "unnatural":b=a-Math.floor(a);0>a&&(b=1-b);break;default:b=Math[b](a)}return Math.round(1E3*b)/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,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_rand_3,color:"#3D3D3D"}], +events:{},def:{params:[null,{type:"number",params:["0"]},null,{type:"number",params:["10"]},null],type:"calc_rand"},paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3},"class":"calc",isNotFor:[],func:function(a,b){a=b.getStringValue("LEFTHAND",b);b=b.getStringValue("RIGHTHAND",b);var c=Math.min(a,b),d=Math.max(a,b);a=Entry.isFloat(a);return Entry.isFloat(b)||a?(Math.random()*(d-c)+c).toFixed(2):Math.floor(Math.random()*(d-c+1)+c)}},get_date:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text", +text:Lang.Blocks.CALC_get_date_1,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_get_date_year,"YEAR"],[Lang.Blocks.CALC_get_date_month,"MONTH"],[Lang.Blocks.CALC_get_date_day,"DAY"],[Lang.Blocks.CALC_get_date_hour,"HOUR"],[Lang.Blocks.CALC_get_date_minute,"MINUTE"],[Lang.Blocks.CALC_get_date_second,"SECOND"]],value:"YEAR",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_get_date_2,color:"#3D3D3D"}],events:{},def:{params:[null,"YEAR",null],type:"get_date"}, +paramsKeyMap:{VALUE:1},"class":"calc_date",isNotFor:[],func:function(a,b){a=b.getField("VALUE",b);b=new Date;return"YEAR"==a?b.getFullYear():"MONTH"==a?b.getMonth()+1:"DAY"==a?b.getDate():"HOUR"==a?b.getHours():"MINUTE"==a?b.getMinutes():b.getSeconds()}},get_sound_duration:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_sound_duration_1,color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"sounds",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}, +{type:"Text",text:Lang.Blocks.CALC_get_sound_duration_2,color:"#3D3D3D"}],events:{},def:{params:[null,null,null],type:"get_sound_duration"},paramsKeyMap:{VALUE:1},"class":"calc_duration",isNotFor:[],func:function(a,b){b=b.getField("VALUE",b);a=a.parent.sounds;for(var c=0;cb||b>a.length-1)throw Error();return a[b]}}, +length_of_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_length_of_string_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_length_of_string_2,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.entry]},null],type:"length_of_string"},paramsKeyMap:{STRING:1},"class":"calc_string",isNotFor:[],func:function(a,b){return b.getStringValue("STRING",b).length}},substring:{color:"#FFD974", +skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_substring_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_substring_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_substring_3,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_substring_4,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"number",params:["2"]}, +null,{type:"number",params:["5"]},null],type:"substring"},paramsKeyMap:{STRING:1,START:3,END:5},"class":"calc_string",isNotFor:[],func:function(a,b){a=b.getStringValue("STRING",b);var c=b.getNumberValue("START",b)-1;b=b.getNumberValue("END",b)-1;var d=a.length-1;if(0>c||0>b||c>d||b>d)throw Error();return a.substring(Math.min(c,b),Math.max(c,b)+1)}},replace_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_replace_string_1,color:"#3D3D3D"}, +{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_3,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_4,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"text",params:[Lang.Blocks.hello]},null,{type:"text",params:[Lang.Blocks.nice]},null],type:"replace_string"},paramsKeyMap:{STRING:1, +OLD_WORD:3,NEW_WORD:5},"class":"calc_string",isNotFor:[],func:function(a,b){return b.getStringValue("STRING",b).replace(new RegExp(b.getStringValue("OLD_WORD",b),"gm"),b.getStringValue("NEW_WORD",b))}},change_string_case:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_change_string_case_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_change_string_case_2,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_change_string_case_sub_1, +"toUpperCase"],[Lang.Blocks.CALC_change_string_case_sub_2,"toLowerCase"]],value:"toUpperCase",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_change_string_case_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:["Hello Entry!"]},null,null,null],type:"change_string_case"},paramsKeyMap:{STRING:1,CASE:3},"class":"calc_string",isNotFor:[],func:function(a,b){return b.getStringValue("STRING",b)[b.getField("CASE",b)]()}},index_of_string:{color:"#FFD974", +skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_index_of_string_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_index_of_string_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_index_of_string_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"text",params:[Lang.Blocks.entry]},null],type:"index_of_string"},paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3}, +"class":"calc_string",isNotFor:[],func:function(a,b){a=b.getStringValue("LEFTHAND",b);b=b.getStringValue("RIGHTHAND",b);b=a.indexOf(b);return-1a)throw Error(Lang.Blocks.FLOW_repeat_basic_errorMsg);b.iterCount=Math.floor(a)}if(0==b.iterCount||0>b.iterCount)return delete b.isLooped, +delete b.iterCount,b.callReturn();b.iterCount--;return b.getStatement("DO",b)}},repeat_inf:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null],type:"repeat_inf"},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(a,b){b.isLooped=!0;return b.getStatement("DO")}},stop_repeat:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png", +size:12}],events:{},def:{params:[null],type:"stop_repeat"},"class":"repeat",isNotFor:[],func:function(a,b){return this.executor.breakLoop()}},wait_until_true:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"},null],type:"wait_until_true"},paramsKeyMap:{BOOL:0},"class":"wait",isNotFor:[],func:function(a,b){return b.getBooleanValue("BOOL",b)?b.callReturn():b}},_if:{color:"#498deb", +skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"},null],type:"_if"},paramsKeyMap:{BOOL:0},statementsKeyMap:{STACK:0},"class":"condition",isNotFor:[],func:function(a,b){return b.isCondition?(delete b.isCondition,b.callReturn()):b.getBooleanValue("BOOL",b)?(b.isCondition=!0,b.getStatement("STACK",b)):b.callReturn()}},if_else:{color:"#498deb",skeleton:"basic_double_loop", +statements:[{accept:"basic"},{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12},{type:"LineBreak"}],events:{},def:{params:[{type:"True"},null],type:"if_else"},paramsKeyMap:{BOOL:0},statementsKeyMap:{STACK_IF:0,STACK_ELSE:1},"class":"condition",isNotFor:[],func:function(a,b){if(b.isCondition)return delete b.isCondition,b.callReturn();a=b.getBooleanValue("BOOL",b);b.isCondition=!0;return a?b.getStatement("STACK_IF",b):b.getStatement("STACK_ELSE", +b)}},create_clone:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"clone",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null,null],type:"create_clone"},paramsKeyMap:{VALUE:0},"class":"clone",isNotFor:[],func:function(a,b){var c=b.getField("VALUE",b);b=b.callReturn();"self"==c?a.parent.addCloneEntity(a.parent,a,null):Entry.container.getObject(c).addCloneEntity(a.parent, +null,null);return b}},delete_clone:{color:"#498deb",skeleton:"basic_without_next",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null],type:"delete_clone"},"class":"clone",isNotFor:[],func:function(a,b){if(!a.isClone)return b.callReturn();a.removeClone();return this.die()}},when_clone_start:{color:"#498deb",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_clone.png",size:17,position:{x:0,y:-2}}],events:{}, +def:{params:[null],type:"when_clone_start"},"class":"clone",isNotFor:[],func:function(a,b){return b.callReturn()},event:"when_clone_start"},stop_run:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null]},func:function(a,b){return Entry.engine.toggleStop()}},repeat_while_true:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Dropdown",options:[[Lang.Blocks.FLOW_repeat_while_true_until, +"until"],[Lang.Blocks.FLOW_repeat_while_true_while,"while"]],value:"until",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"},null,null],type:"repeat_while_true"},paramsKeyMap:{BOOL:0,OPTION:1},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(a,b){a=b.getBooleanValue("BOOL",b);"until"==b.getField("OPTION",b)&&(a=!a);return(b.isLooped=a)?b.getStatement("DO",b):b.callReturn()}},stop_object:{color:"#498deb", +skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.FLOW_stop_object_all,"all"],[Lang.Blocks.FLOW_stop_object_this_object,"thisOnly"],[Lang.Blocks.FLOW_stop_object_this_thread,"thisThread"],[Lang.Blocks.FLOW_stop_object_other_thread,"otherThread"]],value:"all",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null,null],type:"stop_object"},paramsKeyMap:{TARGET:0},"class":"terminate",isNotFor:[], +func:function(a,b){var c=b.getField("TARGET",b),d=Entry.container;switch(c){case "all":return d.clearRunningState(),this.die();case "thisOnly":return a.parent.script.clearExecutorsByEntity(a),this.die();case "thisObject":return a.parent.script.clearExecutors(),this.die();case "thisThread":return this.die();case "otherThread":c=this.executor;a=a.parent.script;for(var d=a.executors,e=0;eb.count?(50>c.leftFloor&&50>c.rightFloor? +b.count++:b.count=0,c=c.leftFloor-c.rightFloor,a.leftWheel=45+.25*c,a.rightWheel=45-.25*c):(b.count=0,b.boardState=2);break;case 2:c=c.leftFloor-c.rightFloor;a.leftWheel=45+.25*c;a.rightWheel=45-.25*c;b.boardState=3;var d=setTimeout(function(){b.boardState=4;Entry.Hamster.removeTimeout(d)},250);Entry.Hamster.timeouts.push(d);break;case 3:c=c.leftFloor-c.rightFloor;a.leftWheel=45+.25*c;a.rightWheel=45-.25*c;break;case 4:a.leftWheel=0,a.rightWheel=0,b.boardState=0,b.isMoving=!1}return b}delete b.isStart; +delete b.isMoving;delete b.count;delete b.boardState;Entry.engine.isContinue=!1;a.leftWheel=0;a.rightWheel=0;return b.callReturn()}b.isStart=!0;b.isMoving=!0;b.count=0;b.boardState=1;a.leftWheel=45;a.rightWheel=45;Entry.Hamster.setLineTracerMode(a,0);return b}},hamster_turn_once:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}], +events:{},def:{params:[null,null],type:"hamster_turn_once"},paramsKeyMap:{DIRECTION:0},"class":"hamster_board",isNotFor:["hamster"],func:function(a,b){a=Entry.hw.sendQueue;var c=Entry.hw.portData;if(b.isStart){if(b.isMoving){if(b.isLeft)switch(b.boardState){case 1:2>b.count?50c.leftFloor&&(b.boardState=3);break;case 3:2>b.count?20>c.leftFloor&&b.count++:(b.count=0,b.boardState=4);break;case 4:50b.count?50c.rightFloor&&(b.boardState=3);break;case 3:2>b.count?20>c.rightFloor&&b.count++:(b.count=0,b.boardState=4);break;case 4:50Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return b.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(a,b){Entry.Hamster.tempo=b.getNumberValue("VALUE");1>Entry.Hamster.tempo&& +(Entry.Hamster.tempo=1);return b.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(a,b){a=Entry.hw.sendQueue;var c=b.getField("PORT",b),d=Number(b.getField("MODE",b));"A"==c?a.ioModeA=d:("B"!=c&&(a.ioModeA=d),a.ioModeB=d);return b.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(a,b){a=Entry.hw.sendQueue;var c=b.getField("PORT"),d=b.getNumberValue("VALUE");"A"==c?a.outputA=void 0!=a.outputA?a.outputA+d:d:("B"!= +c&&(a.outputA=void 0!=a.outputA?a.outputA+d:d),a.outputB=void 0!=a.outputB?a.outputB+d:d);return b.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(a,b){a=Entry.hw.sendQueue;var c=b.getField("PORT"),d=b.getNumberValue("VALUE");"A"==c?a.outputA=d:("B"!=c&&(a.outputA=d),a.outputB=d);return b.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(a,b){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(a,b){a=Number(b.getField("VALUE",b));return 0<=Entry.pressedKeys.indexOf(a)}},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(a,b){if(!a.getVisible())return!1;var c=b.getField("VALUE",b);b=a.object;var d=/wall/.test(c),e=ndgmr.checkPixelCollision; +if(d)switch(a=Entry.stage.wall,c){case "wall":if(e(b,a.up,.2,!0)||e(b,a.down,.2,!0)||e(b,a.left,.2,!0)||e(b,a.right,.2,!0))return!0;break;case "wall_up":if(e(b,a.up,.2,!0))return!0;break;case "wall_down":if(e(b,a.down,.2,!0))return!0;break;case "wall_right":if(e(b,a.right,.2,!0))return!0;break;case "wall_left":if(e(b,a.left,.2,!0))return!0}else{if("mouse"==c)return e=Entry.stage.canvas,e=b.globalToLocal(e.mouseX,e.mouseY),b.hitTest(e.x,e.y);c=Entry.container.getEntity(c);if("textBox"==c.type||"textBox"== +a.type){e=c.object.getTransformedBounds();b=b.getTransformedBounds();if(Entry.checkCollisionRect(b,e))return!0;a=c.parent.clonedEntities;c=0;for(d=a.length;c","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(a,b){a=b.getField("OPERATOR",b);var c=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return"EQUAL"==a?c==b:"BIGGER"==a?c>b:c",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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a>b}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a","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(a,b){a=b.getField("OPERATOR",b);var c=b.getStringValue("LEFTHAND",b);b=b.getStringValue("RIGHTHAND",b);switch(a){case "EQUAL":return c==b;case "GREATER":return Number(c)>Number(b);case "LESS":return Number(c)=Number(b);case "LESS_OR_EQUAL":return Number(c)<=Number(b)}}},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(a,b){a.setVisible(!0);return b.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(a,b){a.setVisible(!1);return b.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(a,b){if(!b.isStart){var c=b.getNumberValue("SECOND",b),d=b.getStringValue("VALUE",b),e=b.getField("OPTION",b);b.isStart=!0;b.timeFlag=1;d||"number"== +typeof d||(d=" ");d=Entry.convertToRoundedDecimals(d,3);new Entry.Dialog(a,d,e);a.syncDialogVisible(a.getVisible());setTimeout(function(){b.timeFlag=0},1E3*c)}if(0==b.timeFlag)return delete b.timeFlag,delete b.isStart,a.dialog&&a.dialog.remove(),b.callReturn();a.dialog||(d=b.getStringValue("VALUE",b),e=b.getField("OPTION",b),d||"number"==typeof d||(d=" "),d=Entry.convertToRoundedDecimals(d,3),new Entry.Dialog(a,d,e),a.syncDialogVisible(a.getVisible()));return b}},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(a,b){var c=b.getStringValue("VALUE",b);c||"number"==typeof c||(c=" ");var d=b.getField("OPTION", +b),c=Entry.convertToRoundedDecimals(c,3);new Entry.Dialog(a,c,d);a.syncDialogVisible(a.getVisible());return b.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(a,b){a.dialog&&a.dialog.remove();return b.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(a,b){var c=b.getField("VALUE",b),c=a.parent.getPicture(c);a.setImage(c);return b.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(a,b){var c;c="prev"!==b.getStringField("DRIECTION")?a.parent.getNextPicture(a.picture.id):a.parent.getPrevPicture(a.picture.id);a.setImage(c);return b.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(a,b){var c=b.getField("EFFECT",b),d=b.getNumberValue("VALUE",b);"color"==c?a.effect.hue= +d+a.effect.hue:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?a.effect.brightness=d+a.effect.brightness:"blur"!=c&&"opacity"==c&&(a.effect.alpha+=d/100));a.applyFilter();return b.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(a,b){var c=b.getField("EFFECT",b),d=b.getNumberValue("VALUE",b);"color"==c?a.effect.hue=d:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?a.effect.brightness=d:"blur"!=c&&"opacity"==c&&(a.effect.alpha=d/100));a.applyFilter();return b.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(a,b){a.resetFilter();return b.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(a,b){var c=(b.getNumberValue("VALUE",b)+100)/100;a.setScaleX(a.getScaleX()*c);a.setScaleY(a.getScaleY()*c);return b.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(a,b){var c=b.getNumberValue("VALUE", +b)/100,d=a.snapshot_;a.setScaleX(c*d.scaleX);a.setScaleY(c*d.scaleY);return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setSize(a.getSize()+c);return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setSize(c);return b.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(a,b){a.setScaleX(-1*a.getScaleX());return b.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(a,b){a.setScaleY(-1*a.getScaleY());return b.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(a,b){var c=b.getField("VALUE",b);a=Entry.container.getCurrentObjects().indexOf(a.parent);if(-1a)throw Error("object is not available for current scene");switch(d){case "FRONT":c=0;break;case "FORWARD":c=Math.max(0,a-1);break;case "BACKWARD":c=Math.min(e,a+1);break;case "BACK":c=e}Entry.container.moveElementByBlock(a,c);return b.callReturn()}}, +move_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:["10"]},null],type:"move_direction"},paramsKeyMap:{VALUE:0},"class":"walk",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.setX(a.getX()+c*Math.cos((a.getRotation()+a.getDirection()-90)/180*Math.PI));a.setY(a.getY()-c*Math.sin((a.getRotation()+a.getDirection()-90)/180*Math.PI)); +a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}},move_x:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"move_x"},paramsKeyMap:{VALUE:0},"class":"move_relative",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.setX(a.getX()+c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY()); +return b.callReturn()}},move_y:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"move_y"},paramsKeyMap:{VALUE:0},"class":"move_relative",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.setY(a.getY()+c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}},locate_xy_time:{color:"#A751E3",skeleton:"basic", +statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"locate_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_absolute",isNotFor:[],func:function(a,b){function c(){var c=b.x-a.getX(),d=b.y-a.getY(),c=c/b.frameCount,d=d/b.frameCount;a.setX(a.getX()+ +c);a.setY(a.getY()+d);b.frameCount--;a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY())}if(!b.isStart){var d;d=b.getNumberValue("VALUE1",b);b.isStart=!0;b.frameCount=Math.max(Math.floor(d*Entry.FPS),1);b.x=b.getNumberValue("VALUE2",b);b.y=b.getNumberValue("VALUE3",b);1==b.frameCount&&c()}if(0!=b.frameCount)return c(),b;delete b.isStart;delete b.frameCount;return b.callReturn()}},rotate_by_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator", +img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"rotate_by_angle"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.setRotation(a.getRotation()+c);return b.callReturn()}},rotate_by_angle_dropdown:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["45","45"],["90","90"],["135","135"],["180","180"]],value:"45",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png", +size:12}],events:{},def:{params:["45",null],type:"rotate_by_angle_dropdown"},paramsKeyMap:{VALUE:0},"class":"ebs",isNotFor:[],func:function(a,b){var c=b.getField("VALUE",b);a.setRotation(a.getRotation()+Number(c));return b.callReturn()}},see_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"see_angle"},paramsKeyMap:{VALUE:0},"class":"rotate", +isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.setDirection(c);return b.callReturn()}},see_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"sprites",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{VALUE:0},func:function(a,b){var c=b.getField("VALUE",b),d=Entry.container.getEntity(c),c=d.getX()-a.getX(),d=d.getY()-a.getY();0<=c?a.setRotation(Math.atan(d/ +c)/Math.PI*180+90):a.setRotation(Math.atan(d/c)/Math.PI*180+270);return b.callReturn()}},locate_xy:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["0"]},{type:"number",params:["0"]},null],type:"locate_xy"},paramsKeyMap:{VALUE1:0,VALUE2:1},"class":"move_absolute",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE1", +b),d=b.getNumberValue("VALUE2",b);a.setX(c);a.setY(d);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}},locate_x:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_x"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.setX(c);a.brush&& +!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}},locate_y:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_y"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.setY(c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}}, +locate:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"locate"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(a,b){var c=b.getField("VALUE",b),d;"mouse"==c?(c=Entry.stage.mouseCoordinate.x,d=Entry.stage.mouseCoordinate.y):(d=Entry.container.getEntity(c), +c=d.getX(),d=d.getY());a.setX(Number(c));a.setY(Number(d));a.brush&&!a.brush.stop&&a.brush.lineTo(c,-1*d);return b.callReturn()}},move_xy_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"move_xy_time"},paramsKeyMap:{VALUE1:0, +VALUE2:1,VALUE3:2},"class":"move_relative",isNotFor:[],func:function(a,b){function c(){a.setX(a.getX()+b.dX);a.setY(a.getY()+b.dY);b.frameCount--;a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY())}if(!b.isStart){var d;d=b.getNumberValue("VALUE1",b);var e=b.getNumberValue("VALUE2",b),f=b.getNumberValue("VALUE3",b);b.isStart=!0;b.frameCount=Math.max(Math.floor(d*Entry.FPS),1);b.dX=e/b.frameCount;b.dY=f/b.frameCount;1==b.frameCount&&c()}if(0!=b.frameCount)return c(),b;delete b.isStart;delete b.frameCount; +return b.callReturn()}},rotate_by_angle_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Angle"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},null,null],type:"rotate_by_angle_time"},paramsKeyMap:{VALUE:1},"class":"rotate",isNotFor:[],func:function(a,b){if(!b.isStart){var c;c=b.getNumberValue("VALUE",b);var d=b.getNumberField("VALUE",b);b.isStart=!0;b.frameCount=Math.floor(c*Entry.FPS); +b.dAngle=d/b.frameCount}if(0!=b.frameCount)return a.setRotation(a.getRotation()+b.dAngle),b.frameCount--,b;delete b.isStart;delete b.frameCount;return b.callReturn()}},bounce_wall:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null],type:"bounce_wall"},"class":"walk",isNotFor:[],func:function(a,b){var c=a.parent.getRotateMethod(),d="free"==c?(a.getRotation()+a.getDirection()).mod(360):a.getDirection(),e;if(90> +d&&0<=d||360>d&&270<=d){e=a.collision==Entry.Utils.COLLISION.UP;var f=ndgmr.checkPixelCollision(Entry.stage.wall.up,a.object,0,!1);!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE);f&&e&&(f=!1);f?("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+180),a.collision=Entry.Utils.COLLISION.UP):(e=a.collision==Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,a.object,0,!1),!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f= +!1),f&&("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+180),a.collision=Entry.Utils.COLLISION.DOWN))}else 270>d&&90<=d&&(e=a.collision==Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,a.object,0,!1),!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f?("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+180),a.collision=Entry.Utils.COLLISION.DOWN):(e=a.collision== +Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,a.object,0,!1),!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+180),a.collision=Entry.Utils.COLLISION.UP)));360>d&&180<=d?(e=a.collision==Entry.Utils.COLLISION.LEFT,d=ndgmr.checkPixelCollision(Entry.stage.wall.left,a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?a.setRotation(-a.getRotation()- +2*a.getDirection()):a.setDirection(-a.getDirection()+360),a.collision=Entry.Utils.COLLISION.LEFT):(e=a.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()):a.setDirection(-a.getDirection()+360),a.collision=Entry.Utils.COLLISION.RIGHT))):180>d&&0<=d&&(e=a.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right, +a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()):a.setDirection(-a.getDirection()+360),a.collision=Entry.Utils.COLLISION.RIGHT):(e=a.collision==Entry.Utils.COLLISION.LEFT,d=ndgmr.checkPixelCollision(Entry.stage.wall.left,a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()):a.setDirection(-a.getDirection()+360),a.collision= +Entry.Utils.COLLISION.LEFT)));return b.callReturn()}},flip_arrow_horizontal:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null]},func:function(a,b){a.setDirection(a.getDirection()+180);return b.callReturn()}},flip_arrow_vertical:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null]},func:function(a,b){a.setDirection(a.getDirection()+ +180);return b.callReturn()}},see_angle_object:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"see_angle_object"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(a,b){var c=b.getField("VALUE",b),d=a.getX(),e=a.getY();if(a.parent.id==c)return b.callReturn(); +"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?a.getDirection()+a.getRotation():0<=d?-Math.atan(e/d)/Math.PI*180+90:-Math.atan(e/d)/Math.PI*180+270;d=a.getDirection()+a.getRotation();a.setRotation(a.getRotation()+e-d);return b.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(a,b){var c=b.getNumberValue("VALUE",b),d=a.getDirection()+a.getRotation();a.setRotation(a.getRotation()+c-d);return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setDirection(c+a.getDirection());return b.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(a,b){if(!b.isStart){var c,d,e;d=b.getField("TARGET",b);c=b.getNumberValue("VALUE",b);c=Math.floor(c*Entry.FPS);e=Entry.stage.mouseCoordinate;if(0!=c)"mouse"==d?(d=e.x-a.getX(),e=e.y-a.getY()):(e=Entry.container.getEntity(d),d=e.getX()-a.getX(),e=e.getY()-a.getY()),b.isStart=!0,b.frameCount=c,b.dX=d/b.frameCount,b.dY=e/b.frameCount;else return"mouse"==d?(d=Number(e.x), +e=Number(e.y)):(e=Entry.container.getEntity(d),d=e.getX(),e=e.getY()),a.setX(d),a.setY(e),a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY()),b.callReturn()}if(0!=b.frameCount)return a.setX(a.getX()+b.dX),a.setY(a.getY()+b.dY),b.frameCount--,a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY()),b;delete b.isStart;delete b.frameCount;return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setRotation(c);return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setRotation(c+a.getRotation());return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setDirection(c);return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setDirection(c+a.getDirection());return b.callReturn()}},move_to_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"}, +{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},{type:"number",params:["10"]},null],type:"move_to_angle"},paramsKeyMap:{ANGLE:0,VALUE:1},"class":"move_rotate",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b),d=b.getNumberValue("ANGLE",b);a.setX(a.getX()+c*Math.cos((d-90)/180*Math.PI));a.setY(a.getY()-c*Math.sin((d-90)/180*Math.PI));a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}}, +rotate_by_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"angle"},null],type:"rotate_by_time"},paramsKeyMap:{VALUE:0,ANGLE:1},"class":"rotate",isNotFor:[],func:function(a,b){function c(){a.setRotation(a.getRotation()+b.dAngle);b.frameCount--}if(!b.isStart){var d;d=b.getNumberValue("VALUE",b);var e=b.getNumberValue("ANGLE", +b);b.isStart=!0;b.frameCount=Math.max(Math.floor(d*Entry.FPS),1);b.dAngle=e/b.frameCount;1==b.frameCount&&c()}if(0!=b.frameCount)return c(),b;delete b.isStart;delete b.frameCount;return b.callReturn()}},direction_relative_duration:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"text",params:["2"]},{type:"angle"},null],type:"direction_relative_duration"}, +paramsKeyMap:{DURATION:0,AMOUNT:1},"class":"rotate",isNotFor:[],func:function(a,b){function c(){a.setDirection(a.getDirection()+b.dDirection);b.frameCount--}if(!b.isStart){var d;d=b.getNumberValue("DURATION",b);var e=b.getNumberValue("AMOUNT",b);b.isStart=!0;b.frameCount=Math.max(Math.floor(d*Entry.FPS),1);b.dDirection=e/b.frameCount;1==b.frameCount&&c()}if(0!=b.frameCount)return c(),b;delete b.isStart;delete b.frameCount;delete b.dDirection;return b.callReturn()}},neobot_sensor_value:{color:"#00979D", +skeleton:"basic_string_field",fontColor:"#fff",statements:[],template:"%1 \uac12",params:[{type:"Dropdown",options:[["1\ubc88 \ud3ec\ud2b8","IN1"],["2\ubc88 \ud3ec\ud2b8","IN2"],["3\ubc88 \ud3ec\ud2b8","IN3"],["\ub9ac\ubaa8\ucee8","IR"],["\ubc30\ud130\ub9ac","BAT"]],value:"IN1",fontSize:11}],events:{},def:{params:[null],type:"neobot_sensor_value"},paramsKeyMap:{PORT:0},"class":"neobot_value",isNotFor:["neobot"],func:function(a,b){a=b.getStringField("PORT");return Entry.hw.portData[a]}},neobot_sensor_convert_scale:{color:"#00979D", +skeleton:"basic_string_field",fontColor:"#fff",statements:[],template:"%1 \uac12\uc758 \ubc94\uc704\ub97c %2 ~ %3 \uc5d0\uc11c %4 ~ %5 (\uc73c)\ub85c \ubcc0\ud658",params:[{type:"Dropdown",options:[["1\ubc88 \ud3ec\ud2b8","IN1"],["2\ubc88 \ud3ec\ud2b8","IN2"],["3\ubc88 \ud3ec\ud2b8","IN3"],["\ub9ac\ubaa8\ucee8","IR"],["\ubc30\ud130\ub9ac","BAT"]],value:"IN1",fontSize:11},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"}],events:{}, +def:{params:[null,{type:"number",params:["0"]},{type:"number",params:["255"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"neobot_sensor_convert_scale"},paramsKeyMap:{PORT:0,OMIN:1,OMAX:2,MIN:3,MAX:4},"class":"neobot_value",isNotFor:["neobot"],func:function(a,b){a=b.getStringField("PORT");a=Entry.hw.portData[a];var c=b.getNumberValue("OMIN",b),d=b.getNumberValue("OMAX",b),e=b.getNumberValue("MIN",b);b=b.getNumberValue("MAX",b);if(c>d)var f=c,c=d,d=f;e>b&&(f=e,e=b,b=f);a=Math.min(b, +(b-e)/(d-c)*(a-c)+e);a=Math.max(e,a);return Math.round(a)}},neobot_left_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc67c\ucabd \ubaa8\ud130\ub97c %1 %2 \uc758 \uc18d\ub3c4\ub85c \ud68c\uc804 %3",params:[{type:"Dropdown",options:[["\uc55e\uc73c\ub85c","16"],["\ub4a4\ub85c","32"]],value:"16",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{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"],["14","14"],["15","15"]],value:"0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,"15",null],type:"neobot_left_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1},"class":"neobot_motor",isNotFor:["neobot"],func:function(a,b){a=b.getNumberField("SPEED");var c=b.getNumberField("DIRECTION");Entry.hw.sendQueue.DCL=a+c;return b.callReturn()}},neobot_stop_left_motor:{color:"#00979D",skeleton:"basic", +statements:[],template:"\uc67c\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_left_motor"},"class":"neobot_motor",isNotFor:["neobot"],func:function(a,b){Entry.hw.sendQueue.DCL=0;return b.callReturn()}},neobot_right_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubaa8\ud130\ub97c %1 %2 \uc758 \uc18d\ub3c4\ub85c \ud68c\uc804 %3",params:[{type:"Dropdown", +options:[["\uc55e\uc73c\ub85c","16"],["\ub4a4\ub85c","32"]],value:"16",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{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"],["14","14"],["15","15"]],value:"0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,"15",null],type:"neobot_right_motor"}, +paramsKeyMap:{DIRECTION:0,SPEED:1},"class":"neobot_motor",isNotFor:["neobot"],func:function(a,b){a=b.getNumberField("SPEED");var c=b.getNumberField("DIRECTION");Entry.hw.sendQueue.DCR=a+c;return b.callReturn()}},neobot_stop_right_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_right_motor"},"class":"neobot_motor", +isNotFor:["neobot"],func:function(a,b){Entry.hw.sendQueue.DCR=0;return b.callReturn()}},neobot_all_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc591\ucabd \ubaa8\ud130\ub97c %1 %2\uc758 \uc18d\ub3c4\ub85c %3\ucd08 \ub3d9\uc548 \ud68c\uc804 %4",params:[{type:"Dropdown",options:[["\uc55e\uc73c\ub85c","1"],["\ub4a4\ub85c","2"],["\uc81c\uc790\ub9ac\uc5d0\uc11c \uc67c\ucabd \ub3cc\uae30","3"],["\uc81c\uc790\ub9ac\uc5d0\uc11c \uc624\ub978\ucabd \ub3cc\uae30","4"],["\uc67c\ucabd\uc73c\ub85c \ub3cc\uae30", +"5"],["\uc624\ub978\ucabd\uc73c\ub85c \ub3cc\uae30","6"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{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"],["14","14"],["15","15"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:["1","15", +{type:"number",params:["0"]}],type:"neobot_all_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1,DURATION:2},"class":"neobot_motor",isNotFor:["neobot"],func:function(a,b){if(b.isStart){if(1==b.timeFlag)return b;delete b.timeFlag;delete b.isStart;Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR=0;Entry.engine.isContinue=!1;return b.callReturn()}a=b.getNumberField("SPEED");var c=b.getNumberField("DIRECTION"),d=b.getNumberValue("DURATION");0>d&&(d=0);switch(c){case 1:Entry.hw.sendQueue.DCL=16+a;Entry.hw.sendQueue.DCR= +16+a;break;case 2:Entry.hw.sendQueue.DCL=32+a;Entry.hw.sendQueue.DCR=32+a;break;case 3:Entry.hw.sendQueue.DCL=32+a;Entry.hw.sendQueue.DCR=16+a;break;case 4:Entry.hw.sendQueue.DCL=16+a;Entry.hw.sendQueue.DCR=32+a;break;case 5:Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR=16+a;break;case 6:Entry.hw.sendQueue.DCL=16+a,Entry.hw.sendQueue.DCR=0}if(0===d)return b.callReturn();b.isStart=!0;b.timeFlag=1;setTimeout(function(){b.timeFlag=0},1E3*d);return b}},neobot_stop_all_motor:{color:"#00979D",skeleton:"basic", +statements:[],template:"\uc591\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_all_motor"},"class":"neobot_motor",isNotFor:["neobot"],func:function(a,b){Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR=0;return b.callReturn()}},neobot_set_servo:{color:"#00979D",skeleton:"basic",statements:[],template:"%1 \ud3ec\ud2b8\uc758 \uc11c\ubcf4\ubaa8\ud130\ub97c %2 \ub3c4 \uc774\ub3d9 %3",params:[{type:"Dropdown", +options:[["OUT1","1"],["OUT2","2"],["OUT3","3"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"neobot_set_servo"},paramsKeyMap:{PORT:0,DEGREE:1},"class":"neobot_output",isNotFor:["neobot"],func:function(a,b){a=b.getNumberField("PORT");var c=b.getNumberValue("DEGREE");0>c?c=0:180c?c=0:255a.count)throw a.count++,new Entry.Utils.AsyncError;a.isStart=!1;b=Entry.hw.portData[a.data_default_address];a.data_default_address=void 0;return b}},robotis_openCM70_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[], +params:[{type:"Dropdown",options:[[Lang.Blocks.robotis_cm_sound_detected,"CM_SOUND_DETECTED"],[Lang.Blocks.robotis_cm_sound_detecting,"CM_SOUND_DETECTING"],[Lang.Blocks.robotis_cm_user_button,"CM_USER_BUTTON"]],value:"CM_SOUND_DETECTED",fontSize:11}],events:{},def:{params:[null],type:"robotis_openCM70_sensor_value"},paramsKeyMap:{SENSOR:0},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(a,b){a=b.executor.scope;if(!a.isStart){a.isStart=!0;a.count=0;var c=Entry.Robotis_openCM70.INSTRUCTION.READ, +d=0,e=0,f=0,g=0;b=b.getStringField("SENSOR");"CM_SOUND_DETECTED"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1]):"CM_SOUND_DETECTING"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0], +e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1]):"CM_USER_BUTTON"==b&&(f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1]);f+=0*g;Entry.Robotis_carCont.setRobotisData([[c,d,e,0,g]]);Entry.Robotis_carCont.update();a.data_default_address=f;throw new Entry.Utils.AsyncError;}if(2>a.count)throw a.count++,new Entry.Utils.AsyncError; +a.isStart=!1;b=Entry.hw.portData[a.data_default_address];a.data_default_address=void 0;return b}},robotis_openCM70_aux_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["3","PORT_3"],["4","PORT_4"],["5","PORT_5"],["6","PORT_6"]],value:"PORT_3",fontSize:11},{type:"Dropdown",options:[[Lang.Blocks.robotis_aux_servo_position,"AUX_SERVO_POSITION"],[Lang.Blocks.robotis_aux_ir,"AUX_IR"],[Lang.Blocks.robotis_aux_touch,"AUX_TOUCH"], +[Lang.Blocks.robotis_aux_brightness,"AUX_BRIGHTNESS"],[Lang.Blocks.robotis_aux_hydro_themo_humidity,"AUX_HYDRO_THEMO_HUMIDITY"],[Lang.Blocks.robotis_aux_hydro_themo_temper,"AUX_HYDRO_THEMO_TEMPER"],[Lang.Blocks.robotis_aux_temperature,"AUX_TEMPERATURE"],[Lang.Blocks.robotis_aux_ultrasonic,"AUX_ULTRASONIC"],[Lang.Blocks.robotis_aux_magnetic,"AUX_MAGNETIC"],[Lang.Blocks.robotis_aux_motion_detection,"AUX_MOTION_DETECTION"],[Lang.Blocks.robotis_aux_color,"AUX_COLOR"],[Lang.Blocks.robotis_aux_custom,"AUX_CUSTOM"]], +value:"AUX_SERVO_POSITION",fontSize:11}],events:{},def:{params:[null,null],type:"robotis_openCM70_aux_sensor_value"},paramsKeyMap:{PORT:0,SENSOR:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(a,b){a=b.executor.scope;if(!a.isStart){a.isStart=!0;a.count=0;var c=Entry.Robotis_openCM70.INSTRUCTION.READ,d=0,e=0,f=0,g=0,h=b.getStringField("PORT");b=b.getStringField("SENSOR");var k=0;"PORT_3"==h?k=2:"PORT_4"==h?k=3:"PORT_5"==h?k=4:"PORT_6"==h&&(k=5);"AUX_SERVO_POSITION"==b? +(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1]):"AUX_IR"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1]):"AUX_TOUCH"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0], +g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1]):"AUX_TEMPERATURE"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1]):"AUX_BRIGHTNESS"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1], +d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1]):"AUX_HYDRO_THEMO_HUMIDITY"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1]):"AUX_HYDRO_THEMO_TEMPER"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0], +g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1]):"AUX_ULTRASONIC"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1]):"AUX_MAGNETIC"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0], +g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1]):"AUX_MOTION_DETECTION"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1]):"AUX_COLOR"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0], +g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1]):"AUX_CUSTOM"==b&&(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1]);f+=k*g;0!=k&&(e=6*g);Entry.Robotis_carCont.setRobotisData([[c,d,e,0,g]]);Entry.Robotis_carCont.update();a.data_default_address= +f;console.log(f);throw new Entry.Utils.AsyncError;}if(2>a.count)throw a.count++,new Entry.Utils.AsyncError;a.isStart=!1;c=Entry.hw.portData[a.data_default_address];a.data_default_address=void 0;return c}},robotis_openCM70_cm_buzzer_index:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.note_a+"(0)","0"],[Lang.General.note_a+"#(1)","1"],[Lang.General.note_b+"(2)","2"],[Lang.General.note_c+"(3)","3"],[Lang.General.note_c+"#(4)","4"],[Lang.General.note_d+ +"(5)","5"],[Lang.General.note_d+"#(6)","6"],[Lang.General.note_e+"(7)","7"],[Lang.General.note_f+"(8)","8"],[Lang.General.note_f+"#(9)","9"],[Lang.General.note_g+"(10)","10"],[Lang.General.note_g+"#(11)","11"],[Lang.General.note_a+"(12)","12"],[Lang.General.note_a+"#(13)","13"],[Lang.General.note_b+"(14)","14"],[Lang.General.note_c+"(15)","15"],[Lang.General.note_c+"#(16)","16"],[Lang.General.note_d+"(17)","17"],[Lang.General.note_d+"#(18)","18"],[Lang.General.note_e+"(19)","19"],[Lang.General.note_f+ +"(20)","20"],[Lang.General.note_f+"#(21)","21"],[Lang.General.note_g+"(22)","22"],[Lang.General.note_g+"#(23)","23"],[Lang.General.note_a+"(24)","24"],[Lang.General.note_a+"#(25)","25"],[Lang.General.note_b+"(26)","26"],[Lang.General.note_c+"(27)","27"],[Lang.General.note_c+"#(28)","28"],[Lang.General.note_d+"(29)","29"],[Lang.General.note_d+"#(30)","30"],[Lang.General.note_e+"(31)","31"],[Lang.General.note_f+"(32)","32"],[Lang.General.note_f+"#(33)","33"],[Lang.General.note_g+"(34)","34"],[Lang.General.note_g+ +"#(35)","35"],[Lang.General.note_a+"(36)","36"],[Lang.General.note_a+"#(37)","37"],[Lang.General.note_b+"(38)","38"],[Lang.General.note_c+"(39)","39"],[Lang.General.note_c+"#(40)","40"],[Lang.General.note_d+"(41)","41"],[Lang.General.note_d+"#(42)","42"],[Lang.General.note_e+"(43)","43"],[Lang.General.note_f+"(44)","44"],[Lang.General.note_f+"#(45)","45"],[Lang.General.note_g+"(46)","46"],[Lang.General.note_g+"#(47)","47"],[Lang.General.note_a+"(48)","48"],[Lang.General.note_a+"#(49)","49"],[Lang.General.note_b+ +"(50)","50"],[Lang.General.note_c+"(51)","51"]],value:"0",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["1"]},null],type:"robotis_openCM70_cm_buzzer_index"},paramsKeyMap:{CM_BUZZER_INDEX:0,CM_BUZZER_TIME:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(a,b){a=b.getField("CM_BUZZER_INDEX",b);var c=b.getNumberValue("CM_BUZZER_TIME",b),d=Entry.Robotis_openCM70.INSTRUCTION.WRITE, +e,f,g;e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[0];f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[1];g=parseInt(10*c);50c&&(c=0);return Entry.Robotis_carCont.postCallReturn(b,[[d,e+(a-1)*f,f,c]],Entry.Robotis_openCM70.delay)}},robotis_openCM70_aux_led_module:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.robotis_common_port_3, +"3"],[Lang.Blocks.robotis_common_port_4,"4"],[Lang.Blocks.robotis_common_port_5,"5"],[Lang.Blocks.robotis_common_port_6,"6"]],value:"3",fontSize:11},{type:"Dropdown",options:[[Lang.Blocks.robotis_cm_led_both+Lang.Blocks.robotis_common_off,"0"],[Lang.Blocks.robotis_cm_led_right+Lang.Blocks.robotis_common_on,"1"],[Lang.Blocks.robotis_cm_led_left+Lang.Blocks.robotis_common_on,"2"],[Lang.Blocks.robotis_cm_led_both+Lang.Blocks.robotis_common_on,"3"]],value:"0",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png", +size:12}],events:{},def:{params:[null,null,null],type:"robotis_openCM70_aux_led_module"},paramsKeyMap:{PORT:0,LED_MODULE:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(a,b){a=b.getField("PORT",b);var c=b.getField("LED_MODULE",b),d=Entry.Robotis_openCM70.INSTRUCTION.WRITE,e,f;e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[0];f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[1];return Entry.Robotis_carCont.postCallReturn(b,[[d,e+(a-1)*f,f,c]],Entry.Robotis_openCM70.delay)}}, +robotis_openCM70_aux_custom:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.robotis_common_port_3,"3"],[Lang.Blocks.robotis_common_port_4,"4"],[Lang.Blocks.robotis_common_port_5,"5"],[Lang.Blocks.robotis_common_port_6,"6"]],value:"3",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["0"]},null],type:"robotis_openCM70_aux_custom"},paramsKeyMap:{PORT:0, +VALUE:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(a,b){a=b.getField("PORT",b);var c=b.getNumberValue("VALUE"),d=Entry.Robotis_openCM70.INSTRUCTION.WRITE,e,f;e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0];f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1];return Entry.Robotis_carCont.postCallReturn(b,[[d,e+(a-1)*f,f,c]],Entry.Robotis_openCM70.delay)}},robotis_openCM70_cm_custom:{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:"number",params:["0"]},{type:"number",params:["0"]},null],type:"robotis_openCM70_cm_custom"},paramsKeyMap:{ADDRESS:0,VALUE:1},"class":"robotis_openCM70_custom",isNotFor:["robotis_openCM70"],func:function(a,b){a=Entry.Robotis_openCM70.INSTRUCTION.WRITE;var c,d;c=b.getNumberValue("ADDRESS");d=b.getNumberValue("VALUE");return Entry.Robotis_carCont.postCallReturn(b,[[a,c,65535a&&(a=0);createjs.Sound.setVolume(a);return b.callReturn()}},sound_volume_set:{color:"#A4D01D", +skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"sound_volume_set"},paramsKeyMap:{VALUE:0},"class":"sound_volume",isNotFor:[],func:function(a,b){a=b.getNumberValue("VALUE",b)/100;1a&&(a=0);createjs.Sound.setVolume(a);return b.callReturn()}},sound_silent_all:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/sound_03.png", +size:12}],events:{},def:{params:[null],type:"sound_silent_all"},"class":"sound_stop",isNotFor:[],func:function(a,b){createjs.Sound.stop();return b.callReturn()}},get_sounds:{color:"#A4D01D",skeleton:"basic_string_field",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"sounds",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_SOUNDS}],events:{},def:{params:[null],type:"get_sounds"},paramsKeyMap:{VALUE:0},func:function(a,b){return b.getStringField("VALUE")}},sound_something_with_block:{color:"#A4D01D", +skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},null],type:"sound_something_with_block"},paramsKeyMap:{VALUE:0},"class":"sound_play",isNotFor:[],func:function(a,b){var c=b.getStringValue("VALUE",b);(a=a.parent.getSound(c))&&createjs.Sound.play(a.id);return b.callReturn()}},sound_something_second_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block", +accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds",id:"95dw"},{type:"number",params:["1"]},null],type:"sound_something_second_with_block"},paramsKeyMap:{VALUE:0,SECOND:1},"class":"sound_play",isNotFor:[],func:function(a,b){var c=b.getStringValue("VALUE",b),d=b.getNumberValue("SECOND",b);(a=a.parent.getSound(c))&&createjs.Sound.play(a.id,{startTime:0,duration:1E3*d});return b.callReturn()}},sound_something_wait_with_block:{color:"#A4D01D", +skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},null],type:"sound_something_wait_with_block"},paramsKeyMap:{VALUE:0},"class":"sound_wait",isNotFor:[],func:function(a,b){if(b.isPlay){if(1==b.playState)return b;delete b.playState;delete b.isPlay;return b.callReturn()}b.isPlay=!0;b.playState=1;var c=b.getStringValue("VALUE",b);if(a=a.parent.getSound(c))createjs.Sound.play(a.id), +setTimeout(function(){b.playState=0},1E3*a.duration);return b}},sound_something_second_wait_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},{type:"number",params:["1"]},null],type:"sound_something_second_wait_with_block"},paramsKeyMap:{VALUE:0,SECOND:1},"class":"sound_wait",isNotFor:[],func:function(a,b){if(b.isPlay){if(1== +b.playState)return b;delete b.isPlay;delete b.playState;return b.callReturn()}b.isPlay=!0;b.playState=1;var c=b.getStringValue("VALUE",b);if(a=a.parent.getSound(c)){var d=createjs.Sound.play(a.id);a=b.getNumberValue("SECOND",b);setTimeout(function(){d.stop();b.playState=0},1E3*a);d.addEventListener("complete",function(b){})}return b}},sound_from_to:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator", +img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},{type:"text",params:["1"]},{type:"text",params:["10"]},null],type:"sound_from_to"},paramsKeyMap:{VALUE:0,START:1,END:2},"class":"sound_play",isNotFor:[],func:function(a,b){var c=b.getStringValue("VALUE",b);if(a=a.parent.getSound(c)){var c=1E3*b.getNumberValue("START",b),d=1E3*b.getNumberValue("END",b);createjs.Sound.play(a.id,{startTime:Math.min(c,d),duration:Math.max(c,d)-Math.min(c,d)})}return b.callReturn()}},sound_from_to_and_wait:{color:"#A4D01D", +skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},{type:"text",params:["1"]},{type:"text",params:["10"]},null],type:"sound_from_to_and_wait"},paramsKeyMap:{VALUE:0,START:1,END:2},"class":"sound_wait",isNotFor:[],func:function(a,b){if(b.isPlay){if(1==b.playState)return b;delete b.isPlay;delete b.playState;return b.callReturn()}b.isPlay= +!0;b.playState=1;var c=b.getStringValue("VALUE",b);if(a=a.parent.getSound(c)){var d=1E3*b.getNumberValue("START",b),e=1E3*b.getNumberValue("END",b),c=Math.min(d,e),d=Math.max(d,e)-c;createjs.Sound.play(a.id,{startTime:c,duration:d});setTimeout(function(){b.playState=0},d)}return b}},when_run_button_click:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_play.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"when_run_button_click"}, +"class":"event",isNotFor:[],func:function(a,b){return b.callReturn()},event:"start"},press_some_key:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_keyboard.png",size:17,position:{x:0,y:-2}},{type:"Dropdown",options:[["q","81"],["w","87"],["e","69"],["r","82"],["a","65"],["s","83"],["d","68"],["\uc704\ucabd \ud654\uc0b4\ud45c","38"],["\uc544\ub798\ucabd \ud654\uc0b4\ud45c","40"],["\uc67c\ucabd \ud654\uc0b4\ud45c","37"],["\uc624\ub978\ucabd \ud654\uc0b4\ud45c", +"39"],["\uc5d4\ud130","13"],["\uc2a4\ud398\uc774\uc2a4","32"]],value:"81",fontSize:11},{type:"Indicator",img:"block_icon/start_03.png",size:12}],events:{},def:{params:[null,null,null]},paramsKeyMap:{VALUE:1},func:function(a,b){return b.callReturn()}},when_some_key_pressed:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_keyboard.png",size:17,position:{x:0,y:-2}},{type:"Keyboard",value:"81"}],events:{},def:{params:[null,"81"],type:"when_some_key_pressed"}, +paramsKeyMap:{VALUE:1},"class":"event",isNotFor:[],func:function(a,b){return b.callReturn()},event:"keyPress"},mouse_clicked:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_mouse.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"mouse_clicked"},"class":"event",isNotFor:[],func:function(a,b){return b.callReturn()},event:"mouse_clicked"},mouse_click_cancled:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator", +img:"block_icon/start_icon_mouse.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"mouse_click_cancled"},"class":"event",isNotFor:[],func:function(a,b){return b.callReturn()},event:"mouse_click_cancled"},when_object_click:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_mouse.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"when_object_click"},"class":"event",isNotFor:[],func:function(a,b){return b.callReturn()}, +event:"when_object_click"},when_object_click_canceled:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_mouse.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"when_object_click_canceled"},"class":"event",isNotFor:[],func:function(a,b){return b.callReturn()},event:"when_object_click_canceled"},when_some_key_click:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_keyboard.png", +size:17,position:{x:0,y:-2}}],events:{},def:{params:[null]},func:function(a,b){return b.callReturn()},event:"keyPress"},when_message_cast:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_signal.png",size:17,position:{x:0,y:-2}},{type:"DropdownDynamic",value:null,menuName:"messages",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_START}],events:{dataAdd:[function(a){var b=Entry.variableContainer;b&&b.addRef("_messageRefs",a)}],viewDestroy:[function(a){var b= +Entry.variableContainer;b&&b.removeRef("_messageRefs",a)}]},def:{params:[null,null],type:"when_message_cast"},paramsKeyMap:{VALUE:1},"class":"message",isNotFor:["message"],func:function(a,b){return b.callReturn()},event:"when_message_cast"},message_cast:{color:"#3BBD70",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"messages",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_START},{type:"Indicator",img:"block_icon/start_03.png",size:12}],events:{dataAdd:[function(a){var b= +Entry.variableContainer;b&&b.addRef("_messageRefs",a)}],viewDestroy:[function(a){var b=Entry.variableContainer;b&&b.removeRef("_messageRefs",a)}]},def:{params:[null,null],type:"message_cast"},paramsKeyMap:{VALUE:0},"class":"message",isNotFor:["message"],func:function(a,b){a=b.getField("VALUE",b);var c=Entry.isExist(a,"id",Entry.variableContainer.messages_);if("null"==a||!c)throw Error("value can not be null or undefined");Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent,["when_message_cast", +a]);return b.callReturn()}},message_cast_wait:{color:"#3BBD70",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"messages",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_START},{type:"Indicator",img:"block_icon/start_03.png",size:12}],events:{dataAdd:[function(a){var b=Entry.variableContainer;b&&b.addRef("_messageRefs",a)}],dataDestroy:[function(a){var b=Entry.variableContainer;b&&b.removeRef("_messageRefs",a)}]},def:{params:[null,null],type:"message_cast_wait"}, +paramsKeyMap:{VALUE:0},"class":"message",isNotFor:["message"],func:function(a,b){if(b.runningScript){a=b.runningScript;for(var c=a.length,d=0;da.array_.length)throw Error("can not remove value from array");a.array_.splice(d-1,1);a.updateView();return b.callReturn()}},insert_value_to_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(a){var b=Entry.variableContainer; +b&&b.addRef("_variableRefs",a)}],dataDestroy:[function(a){var b=Entry.variableContainer;b&&b.removeRef("_variableRefs",a)}]},def:{params:[{type:"text",params:["10"]},null,{type:"text",params:["1"]},null],type:"insert_value_to_list"},paramsKeyMap:{DATA:0,LIST:1,INDEX:2},"class":"list",isNotFor:["list","listNotExist"],func:function(a,b){var c=b.getField("LIST",b),d=b.getValue("DATA",b),e=b.getValue("INDEX",b);a=Entry.variableContainer.getList(c,a);if(!a.array_||isNaN(e)||0==e||e>a.array_.length+1)throw Error("can not insert value to array"); +a.array_.splice(e-1,0,{data:d});a.updateView();return b.callReturn()}},change_value_list_index:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(a){var b=Entry.variableContainer;b&&b.addRef("_variableRefs",a)}],dataDestroy:[function(a){var b= +Entry.variableContainer;b&&b.removeRef("_variableRefs",a)}]},def:{params:[null,{type:"text",params:["1"]},{type:"text",params:["10"]},null],type:"change_value_list_index"},paramsKeyMap:{LIST:0,INDEX:1,DATA:2},"class":"list",isNotFor:["list","listNotExist"],func:function(a,b){var c=b.getField("LIST",b),d=b.getValue("DATA",b),e=b.getValue("INDEX",b);a=Entry.variableContainer.getList(c,a);if(!a.array_||isNaN(e)||e>a.array_.length)throw Error("can not insert value to array");a.array_[e-1].data=d;a.updateView(); +return b.callReturn()}},value_of_index_from_list:{color:"#E457DC",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_value_of_index_from_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Text",text:Lang.Blocks.VARIABLE_value_of_index_from_list_2,color:"white"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.VARIABLE_value_of_index_from_list_3,color:"white"}], +events:{dataAdd:[function(a){var b=Entry.variableContainer;b&&b.addRef("_variableRefs",a)}],dataDestroy:[function(a){var b=Entry.variableContainer;b&&b.removeRef("_variableRefs",a)}]},def:{params:[null,null,null,{type:"number",params:["1"]}],type:"value_of_index_from_list"},paramsKeyMap:{LIST:1,INDEX:3},"class":"list_element",isNotFor:["list","listNotExist"],func:function(a,b){var c=b.getField("LIST",b);b=b.getValue("INDEX",b);a=Entry.variableContainer.getList(c,a);b=Entry.getListRealIndex(b,a);if(!a.array_|| +isNaN(b)||b>a.array_.length)throw Error("can not insert value to array");return a.array_[b-1].data}},length_of_list:{color:"#E457DC",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_length_of_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Text",text:Lang.Blocks.VARIABLE_length_of_list_2,color:"white"}],events:{dataAdd:[function(a){var b=Entry.variableContainer;b&&b.addRef("_variableRefs", +a)}],dataDestroy:[function(a){var b=Entry.variableContainer;b&&b.removeRef("_variableRefs",a)}]},def:{params:[null,null,null],type:"length_of_list"},paramsKeyMap:{LIST:1},"class":"list",isNotFor:["list","listNotExist"],func:function(a,b){b=b.getField("LIST",b);return Entry.variableContainer.getList(b,a).array_.length}},show_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator", +img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(a){var b=Entry.variableContainer;b&&b.addRef("_variableRefs",a)}],dataDestroy:[function(a){var b=Entry.variableContainer;b&&b.removeRef("_variableRefs",a)}]},def:{params:[null,null],type:"show_list"},paramsKeyMap:{LIST:0},"class":"list_visibility",isNotFor:["list","listNotExist"],func:function(a,b){a=b.getField("LIST",b);Entry.variableContainer.getList(a).setVisible(!0);return b.callReturn()}},hide_list:{color:"#E457DC",skeleton:"basic", +statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(a){var b=Entry.variableContainer;b&&b.addRef("_variableRefs",a)}],dataDestroy:[function(a){var b=Entry.variableContainer;b&&b.removeRef("_variableRefs",a)}]},def:{params:[null,null],type:"hide_list"},paramsKeyMap:{LIST:0},"class":"list_visibility",isNotFor:["list","listNotExist"],func:function(a, +b){a=b.getField("LIST",b);Entry.variableContainer.getList(a).setVisible(!1);return b.callReturn()}},options_for_list:{color:"#E457DC",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["\uccab\ubc88\uc9f8","FIRST"],["\ub9c8\uc9c0\ub9c9","LAST"],["\ubb34\uc791\uc704","RANDOM"]],value:"FIRST",fontSize:11}],events:{},def:{params:[null]},paramsKeyMap:{OPERATOR:0},func:function(a,b){return b.getField("OPERATOR",b)}},set_visible_answer:{color:"#E457DC",skeleton:"basic",statements:[], +params:[{type:"Dropdown",options:[[Lang.Blocks.CALC_timer_visible_show,"SHOW"],[Lang.Blocks.CALC_timer_visible_hide,"HIDE"]],value:"SHOW",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{viewAdd:[function(a){Entry.container&&Entry.container.showProjectAnswer()}],viewDestroy:[function(a){Entry.container&&Entry.container.hideProjectAnswer(a)}]},def:{params:["HIDE",null],type:"set_visible_answer"},paramsKeyMap:{BOOL:0},"class":"ask", +isNotFor:[],func:function(a,b){"HIDE"==b.getField("BOOL",b)?Entry.container.inputValue.setVisible(!1):Entry.container.inputValue.setVisible(!0);return b.callReturn()}},is_included_in_list:{color:"#E457DC",skeleton:"basic_boolean_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_is_included_in_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Text",text:Lang.Blocks.VARIABLE_is_included_in_list_2, +color:"white"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.VARIABLE_is_included_in_list_3,color:"white"}],events:{dataAdd:[function(a){var b=Entry.variableContainer;b&&b.addRef("_variableRefs",a)}],dataDestroy:[function(a){var b=Entry.variableContainer;b&&b.removeRef("_variableRefs",a)}]},def:{params:[null,null,null,{type:"text",params:["10"]},null],type:"is_included_in_list"},paramsKeyMap:{LIST:1,DATA:3},"class":"list",isNotFor:["list","listNotExist"],func:function(a,b){var c=b.getField("LIST", +b);b=b.getStringValue("DATA",b);a=Entry.variableContainer.getList(c,a);if(!a)return!1;a=a.array_;for(var c=0,d=a.length;ch&&(h=Math.round(h-155),f=-h,g=0,Entry.dplay.vel_value=f);if(b.isStart){if(1==b.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0),b;if(2==b.timeFlag)return Entry.hw.setDigitalPortValue(a,f),Entry.hw.setDigitalPortValue(c,g),Entry.hw.setDigitalPortValue(d,f),Entry.hw.setDigitalPortValue(e,g),delete b.isStart,delete b.timeFlag, +Entry.engine.isContinue=!1,b.callReturn()}else{b.isStart=!0;b.timeFlag=1;var k=setTimeout(function(){b.timeFlag=2;Entry.dplay.removeTimeout(k)},50);Entry.dplay.timeouts.push(k);return b}}},dplay_buzzer:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\ub514\uc9c0\ud138 10\ubc88 \ubd80\uc800\ub97c %1 %2 %3 \ubc15\uc790\ub85c \uc5f0\uc8fc\ud558\uae30",params:[{type:"Dropdown",options:[["\ub3c4","1"],["\ub3c4#","2"],["\ub808","3"],["\ubbf8b","4"],["\ubbf8","5"],["\ud30c","6"], +["\ud30c#","7"],["\uc194","8"],["\uc194#","9"],["\ub77c","10"],["\uc2dcb","11"],["\uc2dc","12"],["\ubb34\uc74c","100"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:["1","1",{type:"text",params:["0.5"]},null],type:"dplay_buzzer"},paramsKeyMap:{NOTE:0,OCTAVE:1, +VALUE:2},"class":"dplay_set",isNotFor:["dplay"],func:function(a,b){if(b.isStart){if(1==b.timeFlag)return b;Entry.hw.setDigitalPortValue(10,100);delete b.isStart;delete b.timeFlag;Entry.engine.isContinue=!1;return b.callReturn()}a=b.getNumberField("NOTE",b);var c=b.getNumberField("OCTAVE",b),d=b.getNumberValue("VALUE"),c=a+12*(c-1),d=6E4*d/60;b.isStart=!0;b.timeFlag=1;100==a?Entry.hw.setDigitalPortValue(10,100):Entry.hw.setDigitalPortValue(10,c);if(100m?(l=Math.round(m-155),f=-l,g=0,Entry.dplay.Left_value=f):0==m&&(g=f=0,Entry.dplay.Left_value=0));"2"==q&&(d=6,e=11,0m?(l=Math.round(m-155),h=-l,k=0,Entry.dplay.Right_value=h):0==m&&(k=h=0,Entry.dplay.Right_value=h));"3"==q&&(a=3,c=5,d=6,e=11,0m?(l=Math.round(m-155),f=-l,g=0,h=-l,k=0,Entry.dplay.Left_value=f,Entry.dplay.Right_value=h):0==m&&(k=h=g=f=0,Entry.dplay.Left_value=0,Entry.dplay.Right_value=0));if(b.isStart){if(1==b.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0),b;if(2==b.timeFlag)return Entry.hw.setDigitalPortValue(a,f),Entry.hw.setDigitalPortValue(c,g),Entry.hw.setDigitalPortValue(d,k),Entry.hw.setDigitalPortValue(e, +h),delete b.isStart,delete b.timeFlag,Entry.engine.isContinue=!1,b.callReturn()}else{b.isStart=!0;b.timeFlag=1;var n=setTimeout(function(){b.timeFlag=2;Entry.dplay.removeTimeout(n)},50);Entry.dplay.timeouts.push(n);return b}}},dplay_robot_speed_set:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubc14\ud034 %1 \uc67c\ucabd \ubc14\ud034 %2(\uc73c)\ub85c \uc815\ud558\uae30 %3",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:["100"]},{type:"text",params:["100"]},null],type:"dplay_robot_speed_set"},paramsKeyMap:{R_VALUE:0,L_VALUE:1},"class":"dplay_robot",isNotFor:["dplay"],func:function(a,b){var c=a=0,d=0,e=0,f=0,f=0,f=b.getNumberValue("L_VALUE",b),f=Math.max(f,-100),f=Math.min(f,100);0f?(f=Math.round(f-155),a=-f,c=0,Entry.dplay.Left_value=a):0==f&&(c=a=0,Entry.dplay.Left_value= +0);f=b.getNumberValue("R_VALUE",b);f=Math.max(f,-100);f=Math.min(f,100);0f?(f=Math.round(f-155),d=-f,e=0,Entry.dplay.Right_value=d):0==f&&(e=d=0,Entry.dplay.Right_value=0);if(b.isStart){if(1==b.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0),b;if(2==b.timeFlag)return Entry.hw.setDigitalPortValue(3,a),Entry.hw.setDigitalPortValue(5,c), +Entry.hw.setDigitalPortValue(6,e),Entry.hw.setDigitalPortValue(11,d),delete b.isStart,delete b.timeFlag,Entry.engine.isContinue=!1,b.callReturn()}else{b.isStart=!0;b.timeFlag=1;var g=setTimeout(function(){b.timeFlag=2;Entry.dplay.removeTimeout(g)},50);Entry.dplay.timeouts.push(g);return b}}},dplay_robot_stop:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\ub85c\ubd07\uc744 \uc815\uc9c0\ud558\uae30 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}], +events:{},def:{params:[null],type:"dplay_robot_stop"},paramsKeyMap:{},"class":"dplay_robot",isNotFor:["dplay"],func:function(a,b){Entry.hw.setDigitalPortValue(3,0);Entry.hw.setDigitalPortValue(5,0);Entry.hw.setDigitalPortValue(11,0);Entry.hw.setDigitalPortValue(6,0);return b.callReturn()}},nemoino_get_number_sensor_value:{parent:"arduino_get_number_sensor_value",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_sensor_number"}],type:"nemoino_get_number_sensor_value"},"class":"arduino_value"},nemoino_get_digital_value:{parent:"arduino_get_digital_value", +isNotFor:["nemoino"],def:{params:[{type:"arduino_get_port_number"}],type:"nemoino_get_digital_value"},"class":"arduino_value"},nemoino_toggle_led:{parent:"arduino_toggle_led",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"nemoino_toggle_led"},"class":"arduino_set"},nemoino_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"nemoino_toggle_pwm"},"class":"arduino_set"}, +nemoino_convert_scale:{parent:"arduino_convert_scale",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number"}]},{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"nemoino_convert_scale"},"class":"arduino"},sensorBoard_get_number_sensor_value:{parent:"arduino_get_number_sensor_value",isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_sensor_number"}],type:"sensorBoard_get_number_sensor_value"}, +"class":"arduino_value"},sensorBoard_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_port_number"}],type:"sensorBoard_get_digital_value"},"class":"arduino_value"},sensorBoard_toggle_led:{parent:"arduino_toggle_led",isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"sensorBoard_toggle_led"},"class":"arduino_set"},sensorBoard_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_pwm_port_number"}, +{type:"arduino_text",params:["255"]},null],type:"sensorBoard_toggle_pwm"},"class":"arduino_set"},sensorBoard_convert_scale:{parent:"arduino_convert_scale",isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number",id:"bl5e"}]},{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"sensorBoard_convert_scale"},"class":"arduino"},CODEino_get_number_sensor_value:{parent:"arduino_get_number_sensor_value", +isNotFor:["CODEino"],def:{params:[{type:"arduino_get_sensor_number"}],type:"CODEino_get_number_sensor_value"},"class":"arduino_value"},CODEino_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["CODEino"],def:{params:[{type:"arduino_get_port_number"}],type:"CODEino_get_digital_value"},"class":"arduino_value"},CODEino_toggle_led:{parent:"arduino_toggle_led",isNotFor:["CODEino"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"CODEino_toggle_led"},"class":"arduino_set"},CODEino_toggle_pwm:{parent:"arduino_toggle_pwm", +isNotFor:["CODEino"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"CODEino_toggle_pwm"},"class":"arduino_set"},CODEino_convert_scale:{parent:"arduino_convert_scale",isNotFor:["CODEino"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number"}]},{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"CODEino_convert_scale"},"class":"arduino"}, +ardublock_get_number_sensor_value:{parent:"arduino_get_number_sensor_value",isNotFor:["ardublock"],def:{params:[{type:"arduino_get_sensor_number"}],type:"ardublock_get_number_sensor_value"},"class":"arduino_value"},ardublock_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["ardublock"],def:{params:[{type:"arduino_get_port_number"}],type:"ardublock_get_digital_value"},"class":"arduino_value"},ardublock_toggle_led:{parent:"arduino_toggle_led",isNotFor:["ardublock"],def:{params:[{type:"arduino_get_port_number"}, +null,null],type:"ardublock_toggle_led"},"class":"arduino_set"},ardublock_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["ardublock"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"ardublock_toggle_pwm"},"class":"arduino_set"},ardublock_convert_scale:{parent:"arduino_convert_scale",isNotFor:["ardublock"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number"}]},{type:"number",params:["0"]},{type:"number", +params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"ardublock_convert_scale"},"class":"arduino"},joystick_get_number_sensor_value:{parent:"arduino_get_number_sensor_value",isNotFor:["joystick"],def:{params:[{type:"arduino_get_sensor_number"}],type:"joystick_get_number_sensor_value"},"class":"arduino_value"},joystick_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["joystick"],def:{params:[{type:"arduino_get_port_number"}],type:"joystick_get_digital_value"}, +"class":"arduino_value"},joystick_toggle_led:{parent:"arduino_toggle_led",isNotFor:["joystick"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"joystick_toggle_led"},"class":"arduino_set"},joystick_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["joystick"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"joystick_toggle_pwm"},"class":"arduino_set"},joystick_convert_scale:{parent:"arduino_convert_scale",isNotFor:["joystick"],def:{params:[{type:"arduino_get_number_sensor_value", +params:[{type:"arduino_get_sensor_number"}]},{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"joystick_convert_scale"},"class":"arduino"},ebs_if:{parent:"_if",def:{type:"_if",params:[{type:"reach_something",params:[null,"wall"]}]}},ebs_if2:{parent:"_if",def:{type:"_if",params:[{type:"reach_something",params:[null,"cwz5"]}]}}}; +(function(){for(var a in Entry.block){var b=Entry.block[a];if(b.parent){var c=function(){};c.prototype=Entry.block[b.parent];var c=new c,d;for(d in b)c[d]=b[d];Entry.block[a]=c}}})();"object"==typeof exports&&(exports.block=Entry.block);Entry.BlockMenu=function(a,b,c,d){Entry.Model(this,!1);this._align=b||"CENTER";this._scroll=void 0!==d?d:!1;this._bannedClass=[];this._categories=[];this.suffix="blockMenu";a="string"===typeof a?$("#"+a):$(a);if("DIV"!==a.prop("tagName"))return console.error("Dom is not div element");this.view=a;this.visible=!0;this._svgId="blockMenu"+(new Date).getTime();this._clearCategory();this._categoryData=c;this._generateView(c);this._splitters=[];this.setWidth();this.svg=Entry.SVG(this._svgId);Entry.Utils.addFilters(this.svg, +this.suffix);b=Entry.Utils.addBlockPattern(this.svg,this.suffix);this.patternRect=b.rect;this.pattern=b.pattern;this.svgGroup=this.svg.elem("g");this.svgThreadGroup=this.svgGroup.elem("g");this.svgThreadGroup.board=this;this.svgBlockGroup=this.svgGroup.elem("g");this.svgBlockGroup.board=this;this.changeEvent=new Entry.Event(this);c&&this._generateCategoryCodes(c);this.observe(this,"_handleDragBlock",["dragBlock"]);this._scroll&&(this._scroller=new Entry.BlockMenuScroller(this),this._addControl(a)); +Entry.documentMousedown&&Entry.documentMousedown.attach(this,this.setSelectedBlock);this._categoryCodes&&Entry.keyPressed&&Entry.keyPressed.attach(this,this._captureKeyEvent);Entry.windowResized&&(a=_.debounce(this.updateOffset,200),Entry.windowResized.attach(this,a))}; +(function(a){a.schema={code:null,dragBlock:null,closeBlock:null,selectedBlockView:null};a._generateView=function(b){var a=this.view,d=this;b&&(this._categoryCol=Entry.Dom("ul",{class:"entryCategoryListWorkspace",parent:a}),this._generateCategoryView(b));this.blockMenuContainer=Entry.Dom("div",{"class":"blockMenuContainer",parent:a});this.svgDom=Entry.Dom($(''),{parent:this.blockMenuContainer});this.svgDom.mouseenter(function(b){d._scroller&& +d._scroller.setOpacity(1);b=d.workspace.selectedBlockView;!Entry.playground||Entry.playground.resizing||b&&b.dragMode===Entry.DRAG_MODE_DRAG||(Entry.playground.focusBlockMenu=!0,b=d.svgGroup.getBBox(),b=b.width+b.x+64,b>Entry.interfaceState.menuWidth&&(this.widthBackup=Entry.interfaceState.menuWidth-64,$(this).stop().animate({width:b-62},200)))});this.svgDom.mouseleave(function(b){Entry.playground&&!Entry.playground.resizing&&(d._scroller&&d._scroller.setOpacity(0),(b=this.widthBackup)&&$(this).stop().animate({width:b}, +200),delete this.widthBackup,delete Entry.playground.focusBlockMenu)});$(window).scroll(function(){d.updateOffset()})};a.changeCode=function(b){if(!(b instanceof Entry.Code))return console.error("You must inject code instance");this.codeListener&&this.code.changeEvent.detach(this.codeListener);var a=this;this.set({code:b});this.codeListener=this.code.changeEvent.attach(this,function(){a.changeEvent.notify()});b.createView(this);this.align()};a.bindCodeView=function(b){this.svgBlockGroup.remove(); +this.svgThreadGroup.remove();this.svgBlockGroup=b.svgBlockGroup;this.svgThreadGroup=b.svgThreadGroup;this.svgGroup.appendChild(this.svgThreadGroup);this.svgGroup.appendChild(this.svgBlockGroup);this._scroller&&this.svgGroup.appendChild(this._scroller.svgGroup)};a.align=function(b){var a=this.code;if(a){this._clearSplitters();a.view&&!b&&a.view.reDraw();b=a.getThreads();for(var a=10,d="LEFT"==this._align?10:this.svgDom.width()/2,e,f=0,g=b.length;fthis._bannedClass.indexOf(b)&&this._bannedClass.push(b);this.align(a)};a.unbanClass=function(b,a){b=this._bannedClass.indexOf(b);-1a&&(b.preventDefault(),this.selectMenu(a-49))};a.setPatternRectFill=function(b){this.patternRect.attr({fill:b});this.pattern.attr({style:""})};a.disablePattern=function(){this.pattern.attr({style:"display: none"})};a._clearCategory=function(){this._selectedCategoryView=null;this._categories=[];var b=this._categoryElems,a;for(a in b)b[a].remove();this._categoryElems={};b=this._categoryCodes;for(a in b){var d=b[a];d.constructor==Entry.Code&& +d.clear()}this._categoryCodes=null};a.setCategoryData=function(b){this._clearCategory();this._categoryData=b;this._generateCategoryView(b);this._generateCategoryCodes(b)};a._generateCategoryView=function(b){if(b)for(var a=0;a=a?this.setVisible(!1):this.setVisible(!0)};a._reset=function(){this.vY=0;this.vScrollbar.attr({y:this.vY});this.resizeScrollBar()};a.onMouseDown=function(b){function a(b){b.stopPropagation&&b.stopPropagation();b.preventDefault&&b.preventDefault();b=b.originalEvent&&b.originalEvent.touches?b.originalEvent.touches[0]:b;var c=e.dragInstance; +e.scroll(b.pageY-c.offsetY);c.set({offsetY:b.pageY})}function d(b){$(document).unbind(".scroll");delete e.dragInstance}var e=this;b.stopPropagation&&b.stopPropagation();b.preventDefault&&b.preventDefault();if(0===b.button||b.originalEvent&&b.originalEvent.touches){Entry.documentMousedown&&Entry.documentMousedown.notify(b);var f;f=b.originalEvent&&b.originalEvent.touches?b.originalEvent.touches[0]:b;var g=$(document);g.bind("mousemove.scroll",a);g.bind("mouseup.scroll",d);g.bind("touchmove.scroll", +a);g.bind("touchend.scroll",d);e.dragInstance=new Entry.DragInstance({startY:f.pageY,offsetY:f.pageY})}b.stopPropagation()};a._addControl=function(){$(this.vScrollbar).bind("mousedown touchstart",this.mouseHandler)}})(Entry.BlockMenuScroller.prototype);Entry.BlockView=function(a,b,c){Entry.Model(this,!1);this.block=a;this._lazyUpdatePos=_.debounce(a._updatePos.bind(a),200);this._board=b;this._observers=[];this.set(a);this.svgGroup=b.svgBlockGroup.elem("g");this._schema=Entry.block[a.type];this._schema.changeEvent&&(this._schemaChangeEvent=this._schema.changeEvent.attach(this,this._updateSchema));var d=this._skeleton=Entry.skeleton[this._schema.skeleton];this._contents=[];this._statements=[];this.magnet={};this._paramMap={};d.magnets&&d.magnets(this).next&& +(this.svgGroup.nextMagnet=this.block,this._nextGroup=this.svgGroup.elem("g"),this._observers.push(this.observe(this,"_updateMagnet",["contentHeight"])));this.isInBlockMenu=this.getBoard()instanceof Entry.BlockMenu;var e=this;this.mouseHandler=function(){var b=e.block.events;b&&b.mousedown&&b.mousedown.forEach(function(b){b(e)});e.onMouseDown.apply(e,arguments)};this._startRender(a,c);this._observers.push(this.block.observe(this,"_setMovable",["movable"]));this._observers.push(this.block.observe(this, "_setReadOnly",["movable"]));this._observers.push(this.block.observe(this,"_setCopyable",["copyable"]));this._observers.push(this.block.observe(this,"_updateColor",["deletable"],!1));this._observers.push(this.observe(this,"_updateBG",["magneting"],!1));this._observers.push(this.observe(this,"_updateOpacity",["visible"],!1));this._observers.push(this.observe(this,"_updateDisplay",["display"],!1));this._observers.push(this.observe(this,"_updateShadow",["shadow"]));this._observers.push(this.observe(this, -"_updateMagnet",["offsetY"]));this._observers.push(a.code.observe(this,"_setBoard",["board"],!1));this.dragMode=Entry.DRAG_MODE_NONE;Entry.Utils.disableContextmenu(this.svgGroup.node);a=b.events.viewAdd;"workspace"==Entry.type&&a&&!this.isInBlockMenu&&a.forEach(function(a){Entry.Utils.isFunction(a)&&a(b)})};Entry.BlockView.PARAM_SPACE=5;Entry.BlockView.DRAG_RADIUS=5;Entry.BlockView.pngMap={}; -(function(b){b.schema={id:0,type:Entry.STATIC.BLOCK_RENDER_MODEL,x:0,y:0,offsetX:0,offsetY:0,width:0,height:0,contentWidth:0,contentHeight:0,magneting:!1,visible:!0,animating:!1,shadow:!0,display:!0};b._startRender=function(a,b){var d=this,e=this._skeleton;this.svgGroup.attr({class:"block"});var f=e.classes;f&&0!==f.length&&f.forEach(function(a){d.svgGroup.addClass(a)});f=e.path(this);this.pathGroup=this.svgGroup.elem("g");this._updateMagnet();this._path=this.pathGroup.elem("path");this.getBoard().patternRect&& -($(this._path).mouseenter(function(a){d._mouseEnable&&d._changeFill(!0)}),$(this._path).mouseleave(function(a){d._mouseEnable&&d._changeFill(!1)}));var g=this._schema.color;this.block.deletable===Entry.Block.DELETABLE_FALSE_LIGHTEN&&(g=Entry.Utils.colorLighten(g));this._fillColor=g;f={d:f,fill:g,class:"blockPath"};if(this.magnet.next||this._skeleton.nextShadow)g=this.getBoard().suffix,this.pathGroup.attr({filter:"url(#entryBlockShadowFilter_"+g+")"});else if(this.magnet.string||this.magnet.boolean)f.stroke= -e.outerLine;e.outerLine&&(f["stroke-width"]="0.6");this._path.attr(f);this._moveTo(this.x,this.y,!1);this._startContentRender(b);!0!==this._board.disableMouseEvent&&this._addControl();this.bindPrev()};b._startContentRender=function(a){a=void 0===a?Entry.Workspace.MODE_BOARD:a;this.contentSvgGroup&&this.contentSvgGroup.remove();var b=this._schema;b.statements&&b.statements.length&&this.statementSvgGroup&&this.statementSvgGroup.remove();this._contents=[];this.contentSvgGroup=this.svgGroup.elem("g"); -b.statements&&b.statements.length&&(this.statementSvgGroup=this.svgGroup.elem("g"));switch(a){case Entry.Workspace.MODE_BOARD:case Entry.Workspace.MODE_OVERLAYBOARD:for(var d=/(%\d)/mi,e=(b.template?b.template:Lang.template[this.block.type]).split(d),f=b.params,g=0;gEntry.BlockView.DRAG_RADIUS)&&m.movable&&(m.isInBlockMenu?e.cloneToGlobal(a):(a=!1,m.dragMode!=Entry.DRAG_MODE_DRAG&&(m._toGlobalCoordinate(),m.dragMode= -Entry.DRAG_MODE_DRAG,m.block.getThread().changeEvent.notify(),Entry.GlobalSvg.setView(m,c),a=!0),this.animating&&this.set({animating:!1}),0===m.dragInstance.height&&m.dragInstance.set({height:-1+m.height}),c=m.dragInstance,m._moveBy(d.pageX-c.offsetX,d.pageY-c.offsetY,!1),c.set({offsetX:d.pageX,offsetY:d.pageY}),Entry.GlobalSvg.position(),m.originPos||(m.originPos={x:m.x,y:m.y}),a&&e.generateCodeMagnetMap(),m._updateCloseBlock()))}function d(a){$(document).unbind(".block");m.terminateDrag(a);e&&e.set({dragBlock:null}); -m._changeFill(!1);Entry.GlobalSvg.remove();delete this.mouseDownCoordinate;delete m.dragInstance}a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();this._changeFill(!1);var e=this.getBoard();Entry.documentMousedown&&Entry.documentMousedown.notify(a);if(!this.readOnly&&!e.viewOnly){e.setSelectedBlock(this);this.dominate();if(0===a.button||a.originalEvent&&a.originalEvent.touches){var f;f=a.originalEvent&&a.originalEvent.touches?a.originalEvent.touches[0]:a;this.mouseDownCoordinate= -{x:f.pageX,y:f.pageY};var g=$(document);g.bind("mousemove.block touchmove.block",c);g.bind("mouseup.block touchend.block",d);this.dragInstance=new Entry.DragInstance({startX:f.pageX,startY:f.pageY,offsetX:f.pageX,offsetY:f.pageY,height:0,mode:!0});e.set({dragBlock:this});this.addDragging();this.dragMode=Entry.DRAG_MODE_MOUSEDOWN}else if(Entry.Utils.isRightButton(a)){var h=this,k=h.block;if(this.isInBlockMenu)return;f=[];var g={text:Lang.Blocks.Duplication_option,enable:this.copyable,callback:function(){Entry.do("cloneBlock", -k)}},l={text:Lang.Blocks.CONTEXT_COPY_option,enable:this.copyable,callback:function(){h.block.copyToClipboard()}},n={text:Lang.Blocks.Delete_Blocks,enable:k.isDeletable(),callback:function(){Entry.do("destroyBlock",h.block)}},q={text:Lang.Menus.save_as_image,callback:function(){h.downloadAsImage()}};f.push(g);f.push(l);f.push(n);Entry.Utils.isChrome()&&"workspace"==Entry.type&&f.push(q);Entry.ContextMenu.show(f)}var m=this;e.workspace.getMode()===Entry.Workspace.MODE_VIMBOARD&&a&&document.getElementsByClassName("CodeMirror")[0].dispatchEvent(Entry.Utils.createMouseEvent("dragStart", -event))}};b.vimBoardEvent=function(a,b,d){a&&(a=Entry.Utils.createMouseEvent(b,a),d&&(a.block=d),document.getElementsByClassName("CodeMirror")[0].dispatchEvent(a))};b.terminateDrag=function(a){var b=this.getBoard(),d=this.dragMode,e=this.block,f=b.workspace.getMode();this.removeDragging();this.set({visible:!0});this.dragMode=Entry.DRAG_MODE_NONE;if(f===Entry.Workspace.MODE_VIMBOARD)b instanceof Entry.BlockMenu?(b.terminateDrag(),this.vimBoardEvent(a,"dragEnd",e)):b.clear();else if(d===Entry.DRAG_MODE_DRAG){var f= -this.dragInstance&&this.dragInstance.isNew,g=Entry.GlobalSvg;a=!1;var h=this.block.getPrevBlock(this.block);a=!1;switch(Entry.GlobalSvg.terminateDrag(this)){case g.DONE:g=b.magnetedBlockView;g instanceof Entry.BlockView&&(g=g.block);h&&!g?Entry.do("separateBlock",e):h||g||f?g?("next"===g.view.magneting?(h=e.getLastBlock(),this.dragMode=d,b.separate(e),this.dragMode=Entry.DRAG_MODE_NONE,Entry.do("insertBlock",g,h).isPass(f),Entry.ConnectionRipple.setView(g.view).dispose()):(Entry.do("insertBlock", -e,g).isPass(f),a=!0),createjs.Sound.play("entryMagneting")):Entry.do("moveBlock",e).isPass(f):e.getThread().view.isGlobal()?Entry.do("moveBlock",e):Entry.do("separateBlock",e);break;case g.RETURN:e=this.block;d=this.originPos;h?(this.set({animating:!1}),createjs.Sound.play("entryMagneting"),this.bindPrev(h),e.insert(h)):(f=e.getThread().view.getParent(),f instanceof Entry.Board?this._moveTo(d.x,d.y,!1):(createjs.Sound.play("entryMagneting"),Entry.do("insertBlock",e,f)));break;case g.REMOVE:createjs.Sound.play("entryDelete"), -f?this.block.destroy(!1,!0):this.block.doDestroyBelow(!1)}b.setMagnetedBlock(null);a&&Entry.ConnectionRipple.setView(e.view).dispose()}this.destroyShadow();delete this.originPos;this.dominate()};b._updateCloseBlock=function(){var a=this.getBoard(),b;if(this._skeleton.magnets){for(var d in this.magnet)if(b="next"===d?this.getBoard().getNearestMagnet(this.x,this.y+this.getBelowHeight(),d):this.getBoard().getNearestMagnet(this.x,this.y,d))return a.setMagnetedBlock(b.view,d);a.setMagnetedBlock(null)}}; -b.dominate=function(){this.block.getThread().view.dominate()};b.getSvgRoot=function(){for(var a=this.getBoard().svgBlockGroup,b=this.svgGroup;b.parentNode!==a;)b=b.parentNode;return b};b.getBoard=function(){return this._board};b._setBoard=function(){this._board=this._board.code.board};b.destroy=function(a){$(this.svgGroup).unbind(".blockViewMousedown");this._destroyObservers();var b=this.svgGroup;a?$(b).fadeOut(100,function(){b.remove()}):b.remove();this._contents.forEach(function(a){a.constructor!== -Entry.Block&&a.destroy()});var d=this.block;a=d.events.viewDestroy;"workspace"==Entry.type&&a&&!this.isInBlockMenu&&a.forEach(function(a){Entry.Utils.isFunction(a)&&a(d)});this._schemaChangeEvent&&this._schemaChangeEvent.destroy()};b.getShadow=function(){this._shadow||(this._shadow=Entry.SVG.createElement(this.svgGroup.cloneNode(!0),{opacity:.5}),this.getBoard().svgGroup.appendChild(this._shadow));return this._shadow};b.destroyShadow=function(){this._shadow&&(this._shadow.remove(),delete this._shadow)}; -b._updateMagnet=function(){if(this._skeleton.magnets){var a=this._skeleton.magnets(this);a.next&&this._nextGroup.attr("transform","translate("+a.next.x+","+a.next.y+")");this.magnet=a;this.block.getThread().changeEvent.notify()}};b._updateBG=function(){if(this._board.dragBlock&&this._board.dragBlock.dragInstance){var a=this.svgGroup;if(this.magnet.next){if(a=this.magneting){var b=this._board.dragBlock.getShadow(),d=this.getAbsoluteCoordinate(),e;if("previous"===a)e=this.magnet.next,e="translate("+ -(d.x+e.x)+","+(d.y+e.y)+")";else if("next"===a){e=this.magnet.previous;var f=this._board.dragBlock.getBelowHeight();e="translate("+(d.x+e.x)+","+(d.y+e.y-f)+")"}$(b).attr({transform:e,display:"block"});this._clonedShadow=b;this.background&&(this.background.remove(),this.nextBackground.remove(),delete this.background,delete this.nextBackground);"previous"===a&&(a=this._board.dragBlock.getBelowHeight()+this.offsetY,this.originalHeight=this.offsetY,this.set({offsetY:a}))}else this._clonedShadow&&(this._clonedShadow.attr({display:"none"}), -delete this._clonedShadow),a=this.originalHeight,void 0!==a&&(this.background&&(this.background.remove(),this.nextBackground.remove(),delete this.background,delete this.nextBackground),this.set({offsetY:a}),delete this.originalHeight);(a=this.block.thread.changeEvent)&&a.notify()}else this.magneting?(a.attr({filter:"url(#entryBlockHighlightFilter_"+this.getBoard().suffix+")"}),a.addClass("outputHighlight")):(a.removeClass("outputHighlight"),a.removeAttr("filter"))}};b.addDragging=function(){this.svgGroup.addClass("dragging")}; -b.removeDragging=function(){this.svgGroup.removeClass("dragging")};b.addSelected=function(){this.svgGroup.addClass("selected")};b.removeSelected=function(){this.svgGroup.removeClass("selected")};b.getSkeleton=function(){return this._skeleton};b.getContentPos=function(){return this._skeleton.contentPos(this)};b.renderText=function(){this._startContentRender(Entry.Workspace.MODE_VIMBOARD)};b.renderBlock=function(){this._startContentRender(Entry.Workspace.MODE_BOARD)};b._updateOpacity=function(){this.svgGroup.attr({opacity:!1=== -this.visible?0:1});this.visible&&this._setPosition()};b._updateShadow=function(){this.shadow&&Entry.Utils.colorDarken(this._schema.color,.7)};b._setMovable=function(){this.movable=null!==this.block.isMovable()?this.block.isMovable():void 0!==this._skeleton.movable?this._skeleton.movable:!0};b._setReadOnly=function(){this.readOnly=null!==this.block.isReadOnly()?this.block.isReadOnly():void 0!==this._skeleton.readOnly?this._skeleton.readOnly:!1};b._setCopyable=function(){this.copyable=null!==this.block.isCopyable()? -this.block.isCopyable():void 0!==this._skeleton.copyable?this._skeleton.copyable:!0};b.bumpAway=function(a,b){var d=this;a=a||15;b?window.setTimeout(function(){d._moveBy(a,a,!1)},b):d._moveBy(a,a,!1)};b.bindPrev=function(a){if(a){if(this._toLocalCoordinate(a.view._nextGroup),(a=a.getNextBlock())&&a!==this.block){var b=this.block.getLastBlock();b.view.magnet.next?a.view._toLocalCoordinate(b.view._nextGroup):(a.view._toGlobalCoordinate(),a.separate(),a.view.bumpAway(null,100))}}else if(a=this.block.getPrevBlock())this._toLocalCoordinate(a.view._nextGroup), -(a=this.block.getNextBlock())&&a.view&&a.view._toLocalCoordinate(this._nextGroup)};b.getAbsoluteCoordinate=function(a){a=void 0!==a?a:this.dragMode;if(a===Entry.DRAG_MODE_DRAG)return{x:this.x,y:this.y};a=this.block.getThread().view.requestAbsoluteCoordinate(this);a.x+=this.x;a.y+=this.y;return a};b.getBelowHeight=function(){return this.block.getThread().view.requestPartHeight(this)};b._updateDisplay=function(){this.svgGroup.attr({display:!1===this.display?"none":"block"});this.display&&this._setPosition()}; -b._updateColor=function(){var a=this._schema.color;this.block.deletable===Entry.Block.DELETABLE_FALSE_LIGHTEN&&(a=Entry.Utils.colorLighten(a));this._fillColor=a;this._path.attr({fill:a});this._updateContents()};b._updateContents=function(){for(var a=0;a\s+/g,">").replace(/\s+(svgGroup)(defs)',h=this.svgGroup.getBoundingClientRect(),k=a?this.svgGroup:this.svgGroup.cloneNode(!0),l=this._skeleton.box(this),n=b?1:1.5,q=function(){var a=window.platform;return a&&"windows"===a.name.toLowerCase()&&"7"===a.version[0]? -!0:!1}()?.9:.95;-1<=+-x/".split(""),t=0;te||d.splice(e,1)}};b.raiseEvent=function(a,b,d){a=this._eventMap[a];var e=[];if(void 0!==a){for(var f=0;fe||d.splice(e,1)};b.doDestroyThread=function(a,b){var d=this._data,e=d.indexOf(a);0>e||d.splice(e,1)};b.getThreads=function(){return this._data.map(function(a){return a})};b.toJSON=function(){for(var a= -this.getThreads(),b=[],d=0,e=a.length;db&&(d+="...");return d};b.appendSvgOptionGroup=function(){return this._block.view.getBoard().svgGroup.elem("g")};b.getValue=function(){return this._block.params[this._index]};b.setValue=function(a,b){this.value!=a&&(this.value=a,this._block.params[this._index]=a,b&&this._blockView.reDraw())};b._isEditable=function(){if(this._block.view.dragMode==Entry.DRAG_MODE_DRAG)return!1;var a= -this._block.view,b=a.getBoard();if(!0===b.disableMouseEvent)return!1;var d=b.workspace.selectedBlockView;if(!d||b!=d.getBoard())return!1;b=a.getSvgRoot();return b==d.svgGroup||$(b).has($(a.svgGroup))};b._selectBlockView=function(){var a=this._block.view;a.getBoard().setSelectedBlock(a)};b._bindRenderOptions=function(){var a=this;$(this.svgGroup).bind("mouseup touchend",function(b){a._isEditable()&&(a.destroyOption(),a._startValue=a.getValue(),a.renderOptions())})};b.pointer=function(a){a=a||[];a.unshift(this._index); -a.unshift(Entry.PARAM);return this._block.pointer(a)}})(Entry.Field.prototype);Entry.FieldAngle=function(b,a,c){this._block=a.block;this._blockView=a;this.box=new Entry.BoxModel;this.svgGroup=null;this.position=b.position;this._contents=b;this._index=c;b=this.getValue();this.setValue(this.modValue(void 0!==b?b:90));this.renderStart()};Entry.Utils.inherit(Entry.Field,Entry.FieldAngle); -(function(b){b.renderStart=function(){this.svgGroup&&$(this.svgGroup).remove();this.svgGroup=this._blockView.contentSvgGroup.elem("g",{class:"entry-input-field"});this.textElement=this.svgGroup.elem("text",{x:4,y:4,"font-size":"11px"});this.textElement.textContent=this.getText();var a=this.getTextWidth(),b=this.position&&this.position.y?this.position.y:0;this._header=this.svgGroup.elem("rect",{x:0,y:b-8,rx:3,ry:3,width:a,height:16,rx:3,ry:3,fill:"#fff","fill-opacity":.4});this.svgGroup.appendChild(this.textElement); -this._bindRenderOptions();this.box.set({x:0,y:0,width:a,height:16})};b.renderOptions=function(){var a=this;this._attachDisposeEvent(function(){a.applyValue();a.destroyOption()});this.optionGroup=Entry.Dom("input",{class:"entry-widget-input-field",parent:$("body")});this.optionGroup.val(this.value);this.optionGroup.on("mousedown",function(a){a.stopPropagation()});this.optionGroup.on("keyup",function(b){var c=b.keyCode||b.which;a.applyValue(b);-1<[13,27].indexOf(c)&&a.destroyOption()});var b=this.getAbsolutePosFromDocument(); -b.y-=this.box.height/2;this.optionGroup.css({height:16,left:b.x,top:b.y,width:a.box.width});this.optionGroup.select();this.svgOptionGroup=this.appendSvgOptionGroup();this.svgOptionGroup.elem("circle",{x:0,y:0,r:49,class:"entry-field-angle-circle"});this._dividerGroup=this.svgOptionGroup.elem("g");for(b=0;360>b;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||(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)}; +"_updateMagnet",["offsetY"]));this._observers.push(b.code.observe(this,"_setBoard",["board"],!1));this.dragMode=Entry.DRAG_MODE_NONE;Entry.Utils.disableContextmenu(this.svgGroup.node);b=a.events.viewAdd;"workspace"==Entry.type&&b&&!this.isInBlockMenu&&b.forEach(function(b){Entry.Utils.isFunction(b)&&b(a)})};Entry.BlockView.PARAM_SPACE=5;Entry.BlockView.DRAG_RADIUS=5;Entry.BlockView.pngMap={}; +(function(a){a.schema={id:0,type:Entry.STATIC.BLOCK_RENDER_MODEL,x:0,y:0,offsetX:0,offsetY:0,width:0,height:0,contentWidth:0,contentHeight:0,magneting:!1,visible:!0,animating:!1,shadow:!0,display:!0};a._startRender=function(b,a){var d=this;b=this._skeleton;this.svgGroup.attr({class:"block"});var e=b.classes;e&&0!==e.length&&e.forEach(function(b){d.svgGroup.addClass(b)});e=b.path(this);this.pathGroup=this.svgGroup.elem("g");this._updateMagnet();this._path=this.pathGroup.elem("path");this.getBoard().patternRect&& +($(this._path).mouseenter(function(b){d._mouseEnable&&d._changeFill(!0)}),$(this._path).mouseleave(function(b){d._mouseEnable&&d._changeFill(!1)}));var f=this._schema.color;this.block.deletable===Entry.Block.DELETABLE_FALSE_LIGHTEN&&(f=Entry.Utils.colorLighten(f));this._fillColor=f;e={d:e,fill:f,class:"blockPath"};if(this.magnet.next||this._skeleton.nextShadow)f=this.getBoard().suffix,this.pathGroup.attr({filter:"url(#entryBlockShadowFilter_"+f+")"});else if(this.magnet.string||this.magnet.boolean)e.stroke= +b.outerLine;b.outerLine&&(e["stroke-width"]="0.6");this._path.attr(e);this._moveTo(this.x,this.y,!1);this._startContentRender(a);!0!==this._board.disableMouseEvent&&this._addControl();this.bindPrev()};a._startContentRender=function(b){b=void 0===b?Entry.Workspace.MODE_BOARD:b;this.contentSvgGroup&&this.contentSvgGroup.remove();var a=this._schema;a.statements&&a.statements.length&&this.statementSvgGroup&&this.statementSvgGroup.remove();this._contents=[];this.contentSvgGroup=this.svgGroup.elem("g"); +a.statements&&a.statements.length&&(this.statementSvgGroup=this.svgGroup.elem("g"));switch(b){case Entry.Workspace.MODE_BOARD:case Entry.Workspace.MODE_OVERLAYBOARD:for(var d=/(%\d)/mi,e=(a.template?a.template:Lang.template[this.block.type]).split(d),f=a.params,g=0;gEntry.BlockView.DRAG_RADIUS)&&n.movable&&(n.isInBlockMenu?e.cloneToGlobal(b):(b=!1,n.dragMode!=Entry.DRAG_MODE_DRAG&&(n._toGlobalCoordinate(),n.dragMode= +Entry.DRAG_MODE_DRAG,n.block.getThread().changeEvent.notify(),Entry.GlobalSvg.setView(n,c),b=!0),this.animating&&this.set({animating:!1}),0===n.dragInstance.height&&n.dragInstance.set({height:-1+n.height}),c=n.dragInstance,n._moveBy(d.pageX-c.offsetX,d.pageY-c.offsetY,!1),c.set({offsetX:d.pageX,offsetY:d.pageY}),Entry.GlobalSvg.position(),n.originPos||(n.originPos={x:n.x,y:n.y}),b&&e.generateCodeMagnetMap(),n._updateCloseBlock()))}function d(b){$(document).unbind(".block");n.terminateDrag(b);e&&e.set({dragBlock:null}); +n._changeFill(!1);Entry.GlobalSvg.remove();delete this.mouseDownCoordinate;delete n.dragInstance}b.stopPropagation&&b.stopPropagation();b.preventDefault&&b.preventDefault();this._changeFill(!1);var e=this.getBoard();Entry.documentMousedown&&Entry.documentMousedown.notify(b);if(!this.readOnly&&!e.viewOnly){e.setSelectedBlock(this);this.dominate();if(0===b.button||b.originalEvent&&b.originalEvent.touches){var f;f=b.originalEvent&&b.originalEvent.touches?b.originalEvent.touches[0]:b;this.mouseDownCoordinate= +{x:f.pageX,y:f.pageY};var g=$(document);g.bind("mousemove.block touchmove.block",c);g.bind("mouseup.block touchend.block",d);this.dragInstance=new Entry.DragInstance({startX:f.pageX,startY:f.pageY,offsetX:f.pageX,offsetY:f.pageY,height:0,mode:!0});e.set({dragBlock:this});this.addDragging();this.dragMode=Entry.DRAG_MODE_MOUSEDOWN}else if(Entry.Utils.isRightButton(b)){var h=this,k=h.block;if(this.isInBlockMenu)return;f=[];var g={text:Lang.Blocks.Duplication_option,enable:this.copyable,callback:function(){Entry.do("cloneBlock", +k)}},l={text:Lang.Blocks.CONTEXT_COPY_option,enable:this.copyable,callback:function(){h.block.copyToClipboard()}},q={text:Lang.Blocks.Delete_Blocks,enable:k.isDeletable(),callback:function(){Entry.do("destroyBlock",h.block)}},m={text:Lang.Menus.save_as_image,callback:function(){h.downloadAsImage()}};f.push(g);f.push(l);f.push(q);Entry.Utils.isChrome()&&"workspace"==Entry.type&&f.push(m);Entry.ContextMenu.show(f)}var n=this;e.workspace.getMode()===Entry.Workspace.MODE_VIMBOARD&&b&&document.getElementsByClassName("CodeMirror")[0].dispatchEvent(Entry.Utils.createMouseEvent("dragStart", +event))}};a.vimBoardEvent=function(b,a,d){b&&(b=Entry.Utils.createMouseEvent(a,b),d&&(b.block=d),document.getElementsByClassName("CodeMirror")[0].dispatchEvent(b))};a.terminateDrag=function(b){var a=this.getBoard(),d=this.dragMode,e=this.block,f=a.workspace.getMode();this.removeDragging();this.set({visible:!0});this.dragMode=Entry.DRAG_MODE_NONE;if(f===Entry.Workspace.MODE_VIMBOARD)a instanceof Entry.BlockMenu?(a.terminateDrag(),this.vimBoardEvent(b,"dragEnd",e)):a.clear();else if(d===Entry.DRAG_MODE_DRAG){var f= +this.dragInstance&&this.dragInstance.isNew,g=Entry.GlobalSvg,h=this.block.getPrevBlock(this.block);b=!1;switch(Entry.GlobalSvg.terminateDrag(this)){case g.DONE:g=a.magnetedBlockView;g instanceof Entry.BlockView&&(g=g.block);h&&!g?Entry.do("separateBlock",e):h||g||f?g?("next"===g.view.magneting?(h=e.getLastBlock(),this.dragMode=d,a.separate(e),this.dragMode=Entry.DRAG_MODE_NONE,Entry.do("insertBlock",g,h).isPass(f),Entry.ConnectionRipple.setView(g.view).dispose()):(Entry.do("insertBlock",e,g).isPass(f), +b=!0),createjs.Sound.play("entryMagneting")):Entry.do("moveBlock",e).isPass(f):e.getThread().view.isGlobal()?Entry.do("moveBlock",e):Entry.do("separateBlock",e);break;case g.RETURN:e=this.block;d=this.originPos;h?(this.set({animating:!1}),createjs.Sound.play("entryMagneting"),this.bindPrev(h),e.insert(h)):(f=e.getThread().view.getParent(),f instanceof Entry.Board?this._moveTo(d.x,d.y,!1):(createjs.Sound.play("entryMagneting"),Entry.do("insertBlock",e,f)));break;case g.REMOVE:createjs.Sound.play("entryDelete"), +f?this.block.destroy(!1,!0):this.block.doDestroyBelow(!1)}a.setMagnetedBlock(null);b&&Entry.ConnectionRipple.setView(e.view).dispose()}this.destroyShadow();delete this.originPos;this.dominate()};a._updateCloseBlock=function(){var b=this.getBoard(),a;if(this._skeleton.magnets){for(var d in this.magnet)if(a="next"===d?this.getBoard().getNearestMagnet(this.x,this.y+this.getBelowHeight(),d):this.getBoard().getNearestMagnet(this.x,this.y,d))return b.setMagnetedBlock(a.view,d);b.setMagnetedBlock(null)}}; +a.dominate=function(){this.block.getThread().view.dominate()};a.getSvgRoot=function(){for(var b=this.getBoard().svgBlockGroup,a=this.svgGroup;a.parentNode!==b;)a=a.parentNode;return a};a.getBoard=function(){return this._board};a._setBoard=function(){this._board=this._board.code.board};a.destroy=function(b){$(this.svgGroup).unbind(".blockViewMousedown");this._destroyObservers();var a=this.svgGroup;b?$(a).fadeOut(100,function(){a.remove()}):a.remove();this._contents.forEach(function(b){b.constructor!== +Entry.Block&&b.destroy()});var d=this.block;b=d.events.viewDestroy;"workspace"==Entry.type&&b&&!this.isInBlockMenu&&b.forEach(function(b){Entry.Utils.isFunction(b)&&b(d)});this._schemaChangeEvent&&this._schemaChangeEvent.destroy()};a.getShadow=function(){this._shadow||(this._shadow=Entry.SVG.createElement(this.svgGroup.cloneNode(!0),{opacity:.5}),this.getBoard().svgGroup.appendChild(this._shadow));return this._shadow};a.destroyShadow=function(){this._shadow&&(this._shadow.remove(),delete this._shadow)}; +a._updateMagnet=function(){if(this._skeleton.magnets){var b=this._skeleton.magnets(this);b.next&&this._nextGroup.attr("transform","translate("+b.next.x+","+b.next.y+")");this.magnet=b;this.block.getThread().changeEvent.notify()}};a._updateBG=function(){if(this._board.dragBlock&&this._board.dragBlock.dragInstance){var b=this.svgGroup;if(this.magnet.next){if(b=this.magneting){var a=this._board.dragBlock.getShadow(),d=this.getAbsoluteCoordinate(),e;if("previous"===b)e=this.magnet.next,e="translate("+ +(d.x+e.x)+","+(d.y+e.y)+")";else if("next"===b){e=this.magnet.previous;var f=this._board.dragBlock.getBelowHeight();e="translate("+(d.x+e.x)+","+(d.y+e.y-f)+")"}$(a).attr({transform:e,display:"block"});this._clonedShadow=a;this.background&&(this.background.remove(),this.nextBackground.remove(),delete this.background,delete this.nextBackground);"previous"===b&&(b=this._board.dragBlock.getBelowHeight()+this.offsetY,this.originalHeight=this.offsetY,this.set({offsetY:b}))}else this._clonedShadow&&(this._clonedShadow.attr({display:"none"}), +delete this._clonedShadow),b=this.originalHeight,void 0!==b&&(this.background&&(this.background.remove(),this.nextBackground.remove(),delete this.background,delete this.nextBackground),this.set({offsetY:b}),delete this.originalHeight);(b=this.block.thread.changeEvent)&&b.notify()}else this.magneting?(b.attr({filter:"url(#entryBlockHighlightFilter_"+this.getBoard().suffix+")"}),b.addClass("outputHighlight")):(b.removeClass("outputHighlight"),b.removeAttr("filter"))}};a.addDragging=function(){this.svgGroup.addClass("dragging")}; +a.removeDragging=function(){this.svgGroup.removeClass("dragging")};a.addSelected=function(){this.svgGroup.addClass("selected")};a.removeSelected=function(){this.svgGroup.removeClass("selected")};a.getSkeleton=function(){return this._skeleton};a.getContentPos=function(){return this._skeleton.contentPos(this)};a.renderText=function(){this._startContentRender(Entry.Workspace.MODE_VIMBOARD)};a.renderBlock=function(){this._startContentRender(Entry.Workspace.MODE_BOARD)};a._updateOpacity=function(){this.svgGroup.attr({opacity:!1=== +this.visible?0:1});this.visible&&this._setPosition()};a._updateShadow=function(){this.shadow&&Entry.Utils.colorDarken(this._schema.color,.7)};a._setMovable=function(){this.movable=null!==this.block.isMovable()?this.block.isMovable():void 0!==this._skeleton.movable?this._skeleton.movable:!0};a._setReadOnly=function(){this.readOnly=null!==this.block.isReadOnly()?this.block.isReadOnly():void 0!==this._skeleton.readOnly?this._skeleton.readOnly:!1};a._setCopyable=function(){this.copyable=null!==this.block.isCopyable()? +this.block.isCopyable():void 0!==this._skeleton.copyable?this._skeleton.copyable:!0};a.bumpAway=function(b,a){var d=this;b=b||15;a?window.setTimeout(function(){d._moveBy(b,b,!1)},a):d._moveBy(b,b,!1)};a.bindPrev=function(b){if(b){if(this._toLocalCoordinate(b.view._nextGroup),(b=b.getNextBlock())&&b!==this.block){var a=this.block.getLastBlock();a.view.magnet.next?b.view._toLocalCoordinate(a.view._nextGroup):(b.view._toGlobalCoordinate(),b.separate(),b.view.bumpAway(null,100))}}else if(b=this.block.getPrevBlock())this._toLocalCoordinate(b.view._nextGroup), +(b=this.block.getNextBlock())&&b.view&&b.view._toLocalCoordinate(this._nextGroup)};a.getAbsoluteCoordinate=function(b){b=void 0!==b?b:this.dragMode;if(b===Entry.DRAG_MODE_DRAG)return{x:this.x,y:this.y};b=this.block.getThread().view.requestAbsoluteCoordinate(this);b.x+=this.x;b.y+=this.y;return b};a.getBelowHeight=function(){return this.block.getThread().view.requestPartHeight(this)};a._updateDisplay=function(){this.svgGroup.attr({display:!1===this.display?"none":"block"});this.display&&this._setPosition()}; +a._updateColor=function(){var b=this._schema.color;this.block.deletable===Entry.Block.DELETABLE_FALSE_LIGHTEN&&(b=Entry.Utils.colorLighten(b));this._fillColor=b;this._path.attr({fill:b});this._updateContents()};a._updateContents=function(){for(var b=0;b\s+/g,">").replace(/\s+(svgGroup)(defs)',h=this.svgGroup.getBoundingClientRect(),k=b?this.svgGroup:this.svgGroup.cloneNode(!0);b=this._skeleton.box(this);var l=a?1:1.5,q=function(){var b=window.platform;return b&&"windows"===b.name.toLowerCase()&&"7"===b.version[0]? +!0:!1}()?.9:.95;-1<=+-x/".split(""),t=0;ta&&(d+="...");return d};a.appendSvgOptionGroup=function(){return this._block.view.getBoard().svgGroup.elem("g")};a.getValue=function(){return this._block.params[this._index]};a.setValue=function(b,a){this.value!=b&&(this.value=b,this._block.params[this._index]=b,a&&this._blockView.reDraw())};a._isEditable=function(){if(this._block.view.dragMode==Entry.DRAG_MODE_DRAG)return!1;var b= +this._block.view,a=b.getBoard();if(!0===a.disableMouseEvent)return!1;var d=a.workspace.selectedBlockView;if(!d||a!=d.getBoard())return!1;a=b.getSvgRoot();return a==d.svgGroup||$(a).has($(b.svgGroup))};a._selectBlockView=function(){var b=this._block.view;b.getBoard().setSelectedBlock(b)};a._bindRenderOptions=function(){var b=this;$(this.svgGroup).bind("mouseup touchend",function(a){b._isEditable()&&(b.destroyOption(),b._startValue=b.getValue(),b.renderOptions())})};a.pointer=function(b){b=b||[];b.unshift(this._index); +b.unshift(Entry.PARAM);return this._block.pointer(b)}})(Entry.Field.prototype);Entry.FieldBlock=function(a,b,c,d,e){Entry.Model(this,!1);this._blockView=b;this._block=b.block;this._valueBlock=null;this.box=new Entry.BoxModel;this.changeEvent=new Entry.Event(this);this._index=c;this.contentIndex=e;this._content=a;this.acceptType=a.accept;this._restoreCurrent=a.restore;this.view=this;this.svgGroup=null;this._position=a.position;this.box.observe(b,"alignContent",["width","height"]);this.observe(this,"_updateBG",["magneting"],!1);this.renderStart(b.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, -delete this._originBlock;else switch(this.acceptType){case "boolean":a="True";break;case "string":a="text";break;case "param":a="function_field_label"}return this._createBlockByType(a)};b._setValueBlock=function(a){this._restoreCurrent&&(this._originBlock=this._valueBlock);a||(a=this.inspectBlock());this._valueBlock=a;this.setValue(a);a.setThread(this);a.getThread().view.setParent(this);return this._valueBlock};b.getValueBlock=function(){return this._valueBlock};b.updateValueBlock=function(a){a instanceof -Entry.Block||(a=void 0);this._destroyObservers();a=this._setValueBlock(a).view;a.bindPrev(this);this._blockView.alignContent();this._posObserver=a.observe(this,"updateValueBlock",["x","y"],!1);this._sizeObserver=a.observe(this,"calcWH",["width","height"]);a=this._blockView.getBoard();a.constructor===Entry.Board&&a.generateCodeMagnetMap()};b._destroyObservers=function(){this._sizeObserver&&this._sizeObserver.destroy();this._posObserver&&this._posObserver.destroy()};b.getPrevBlock=function(a){return this._valueBlock=== -a?this:null};b.getNextBlock=function(){return null};b.requestAbsoluteCoordinate=function(a){a=this._blockView;var b=a.contentPos;a=a.getAbsoluteCoordinate();a.x+=this.box.x+b.x;a.y+=this.box.y+b.y;return a};b.dominate=function(){this._blockView.dominate()};b.isGlobal=function(){return!1};b.separate=function(a){this.getCode().createThread([a]);this.calcWH();this.changeEvent.notify()};b.getCode=function(){return this._block.thread.getCode()};b.cut=function(a){return this._valueBlock===a?[a]:null};b.replace= -function(a){"string"===typeof a&&(a=this._createBlockByType(a));var b=this._valueBlock;Entry.block[b.type].isPrimitive?(b.doNotSplice=!0,b.destroy()):"param"===this.acceptType?(this._destroyObservers(),b.view._toGlobalCoordinate(),a.getTerminateOutputBlock().view._contents[1].replace(b)):(this._destroyObservers(),b.view._toGlobalCoordinate(),this.separate(b),b.view.bumpAway(30,150));this.updateValueBlock(a);a.view._toLocalCoordinate(this.svgGroup);this.calcWH();this.changeEvent.notify()};b.setParent= -function(a){this._parent=a};b.getParent=function(){return this._parent};b._createBlockByType=function(a){this._block.getThread();var b=this._blockView.getBoard();a=new Entry.Block({type:a},this);var d=b.workspace,e;d&&(e=d.getMode());a.createView(b,e);return a};b.spliceBlock=function(){this.updateValueBlock()};b._updateBG=function(){this.magneting?this._bg=this.svgGroup.elem("path",{d:"m 8,12 l -4,0 -2,-2 0,-3 3,0 1,-1 0,-12 -1,-1 -3,0 0,-3 2,-2 l 4,0 z",fill:"#fff",stroke:"#fff","fill-opacity":.7, -transform:"translate(0,12)"}):this._bg&&(this._bg.remove(),delete this._bg)};b.getThread=function(){return this};b.pointer=function(a){a.unshift(this._index);a.unshift(Entry.PARAM);return this._block.pointer(a)}})(Entry.FieldBlock.prototype);Entry.FieldColor=function(b,a,c){this._block=a.block;this._blockView=a;this.box=new Entry.BoxModel;this.svgGroup=null;this._contents=b;this._index=c;this._position=b.position;this.key=b.key;this.setValue(this.getValue()||"#FF0000");this.renderStart(a)};Entry.Utils.inherit(Entry.Field,Entry.FieldColor); -(function(b){b.renderStart=function(){this.svgGroup&&$(this.svgGroup).remove();this.svgGroup=this._blockView.contentSvgGroup.elem("g",{class:"entry-field-color"});var a=this._position,b;a?(b=a.x||0,a=a.y||0):(b=0,a=-8);this._header=this.svgGroup.elem("rect",{x:b,y:a,width:14.5,height:16,fill:this.getValue()});this._bindRenderOptions();this.box.set({x:b,y:a,width:14.5,height:16})};b.renderOptions=function(){var a=this;this._attachDisposeEvent();var b=Entry.FieldColor.getWidgetColorList();this.optionGroup= -Entry.Dom("table",{class:"entry-widget-color-table",parent:$("body")});for(var d=0;d'), +{parent:this.wrapper});this.visible=!0;var d=this;this.svg=Entry.SVG(this._svgId);$(window).scroll(function(){d.updateOffset()});this.svgGroup=this.svg.elem("g");this.svgThreadGroup=this.svgGroup.elem("g");this.svgThreadGroup.board=this;this.svgBlockGroup=this.svgGroup.elem("g");this.svgBlockGroup.board=this;b.isOverlay?(this.wrapper.addClass("entryOverlayBoard"),this.generateButtons(),this.suffix="overlayBoard"):this.suffix="board";Entry.Utils.addFilters(this.svg,this.suffix);b=Entry.Utils.addBlockPattern(this.svg, +this.suffix);this.patternRect=b.rect;this.pattern=b.pattern};a.changeCode=function(b){this.code&&this.codeListener&&this.code.changeEvent.detach(this.codeListener);this.set({code:b});var a=this;b&&(this.codeListener=this.code.changeEvent.attach(this,function(){a.changeEvent.notify()}),b.createView(this));this.scroller.resizeScrollBar()};a.bindCodeView=function(b){this.svgBlockGroup.remove();this.svgThreadGroup.remove();this.svgBlockGroup=b.svgBlockGroup;this.svgThreadGroup=b.svgThreadGroup;this.svgGroup.appendChild(this.svgThreadGroup); +this.svgGroup.appendChild(this.svgBlockGroup)};a.setMagnetedBlock=function(b,a){if(this.magnetedBlockView){if(this.magnetedBlockView===b)return;this.magnetedBlockView.set({magneting:!1})}this.set({magnetedBlockView:b});b&&(b.set({magneting:a}),b.dominate())};a.getCode=function(){return this.code};a.findById=function(b){return this.code.findById(b)};a._addControl=function(){var b=this.svgDom,a=this;b.mousedown(function(){a.onMouseDown.apply(a,arguments)});b.bind("touchstart",function(){a.onMouseDown.apply(a, +arguments)});b.on("wheel",function(){a.mouseWheel.apply(a,arguments)});var d=a.scroller;d&&(b.mouseenter(function(b){d.setOpacity(1)}),b.mouseleave(function(b){d.setOpacity(0)}))};a.onMouseDown=function(b){function a(b){b.stopPropagation&&b.stopPropagation();b.preventDefault&&b.preventDefault();b=b.originalEvent&&b.originalEvent.touches?b.originalEvent.touches[0]:b;var c=f.dragInstance;f.scroller.scroll(b.pageX-c.offsetX,b.pageY-c.offsetY);c.set({offsetX:b.pageX,offsetY:b.pageY})}function d(b){$(document).unbind(".entryBoard"); +delete f.dragInstance}if(this.workspace.getMode()!=Entry.Workspace.MODE_VIMBOARD){b.stopPropagation&&b.stopPropagation();b.preventDefault&&b.preventDefault();if(0===b.button||b.originalEvent&&b.originalEvent.touches){b=b.originalEvent&&b.originalEvent.touches?b.originalEvent.touches[0]:b;Entry.documentMousedown&&Entry.documentMousedown.notify(b);var e=$(document);e.bind("mousemove.entryBoard",a);e.bind("mouseup.entryBoard",d);e.bind("touchmove.entryBoard",a);e.bind("touchend.entryBoard",d);this.dragInstance= +new Entry.DragInstance({startX:b.pageX,startY:b.pageY,offsetX:b.pageX,offsetY:b.pageY})}else if(Entry.Utils.isRightButton(b)){if(!this.visible)return;b=[];this._contextOptions[Entry.Board.OPTION_PASTE].option.enable=!!Entry.clipboard;this._contextOptions[Entry.Board.OPTION_DOWNLOAD].option.enable=0!==this.code.getThreads().length;for(e=0;eb&&(f=f+e+10,e=0,d=15);e=Math.max(e,k.width);l=d+15;h._moveTo(f,l,!1);d=d+k.height+15}}this.scroller.resizeScrollBar()};a.clear=function(){this.svgBlockGroup.remove();this.svgThreadGroup.remove()};a.updateOffset= +function(){this._offset=this.svg.getBoundingClientRect();var b=$(window),a=b.scrollTop(),b=b.scrollLeft(),d=this._offset;this.relativeOffset={top:d.top-a,left:d.left-b};this.btnWrapper&&this.btnWrapper.attr({transform:"translate("+(d.width/2-65)+","+(d.height-200)+")"})};a.generateButtons=function(){var b=this,a=this.svgGroup.elem("g");this.btnWrapper=a;var d=a.elem("text",{x:27,y:33,class:"entryFunctionButtonText"});d.textContent=Lang.Buttons.save;var e=a.elem("text",{x:102.5,y:33,class:"entryFunctionButtonText"}); +e.textContent=Lang.Buttons.cancel;var f=a.elem("circle",{cx:27.5,cy:27.5,r:27.5,class:"entryFunctionButton"}),a=a.elem("circle",{cx:102.5,cy:27.5,r:27.5,class:"entryFunctionButton"});$(f).bind("mousedown touchstart",function(){b.save()});$(d).bind("mousedown touchstart",function(){b.save()});$(a).bind("mousedown touchstart",function(){b.cancelEdit()});$(e).bind("mousedown touchstart",function(){b.cancelEdit()})};a.cancelEdit=function(){this.workspace.setMode(Entry.Workspace.MODE_BOARD,"cancelEdit")}; +a.save=function(){this.workspace.setMode(Entry.Workspace.MODE_BOARD,"save")};a.generateCodeMagnetMap=function(){var b=this.code;if(b&&this.dragBlock)for(var a in this.dragBlock.magnet){var d=this._getCodeBlocks(b,a);d.sort(function(b,a){return b.point-a.point});d.unshift({point:-Number.MAX_VALUE,blocks:[]});for(var e=1;eg.point&&(g.blocks.push(h),l++,g=d[l],g););delete f.startBlock}f.endPoint=Number.MAX_VALUE;d[e-1].endPoint= +f.point}this._magnetMap[a]=d}};a._getCodeBlocks=function(b,a){b=b.getThreads();var d=[],e;switch(a){case "previous":e=this._getNextMagnets;break;case "next":e=this._getPreviousMagnets;break;case "string":e=this._getFieldMagnets;break;case "boolean":e=this._getFieldMagnets;break;case "param":e=this._getOutputMagnets;break;default:return[]}for(var f=0;fd.endPoint)f=h+1;else{e=d.blocks;for(f=0;fb||a.splice(b,1))};a.raiseEvent=function(b,a,d){b=this._eventMap[b];var e=[];if(void 0!==b){for(var f=0;fb||a.splice(b,1)};a.doDestroyThread=function(b,a){a=this._data;b=a.indexOf(b);0>b||a.splice(b,1)};a.getThreads=function(){return this._data.map(function(b){return b})};a.toJSON=function(){for(var b=this.getThreads(),a=[],d=0, +e=b.length;da;a+=15)this._dividerGroup.elem("line",{x1:49,y1:0,x2:49-(0===a%45?10:5),y2:0,transform:"rotate("+a+", 0, 0)",class:"entry-angle-divider"});a=this.getAbsolutePosFromBoard();a.x+=this.box.width/ +2;a.y=a.y+this.box.height/2+49+1;this.svgOptionGroup.attr({class:"entry-field-angle",transform:"translate("+a.x+","+a.y+")"});var a=b.getAbsolutePosFromDocument(),d=[a.x+b.box.width/2,a.y+b.box.height/2+1];$(this.svgOptionGroup).mousemove(function(a){b.optionGroup.val(b.modValue(function(b,a){var c=a[0]-b[0];b=a[1]-b[1]-49-1;a=Math.atan(-b/c);a=Entry.toDegrees(a);a=90-a;0>c?a+=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",a).replace("%Y",d).replace("%LARGE",b),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:a,y2:d});this._indicator.attr({class:"entry-angle-indicator"})}; +a.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())};a.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()};a.getTextWidth=function(){return this.textElement?this.textElement.getComputedTextLength()+ +8:8};a.getText=function(){return this.getValue()+"\u00b0"};a.modValue=function(a){return a%360};a.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.FieldColor=function(a,b,c){this._block=b.block;this._blockView=b;this.box=new Entry.BoxModel;this.svgGroup=null;this._contents=a;this._index=c;this._position=a.position;this.key=a.key;this.setValue(this.getValue()||"#FF0000");this.renderStart(b)};Entry.Utils.inherit(Entry.Field,Entry.FieldColor); +(function(a){a.renderStart=function(){this.svgGroup&&$(this.svgGroup).remove();this.svgGroup=this._blockView.contentSvgGroup.elem("g",{class:"entry-field-color"});var a=this._position,c;a?(c=a.x||0,a=a.y||0):(c=0,a=-8);this._header=this.svgGroup.elem("rect",{x:c,y:a,width:14.5,height:16,fill:this.getValue()});this._bindRenderOptions();this.box.set({x:c,y:a,width:14.5,height:16})};a.renderOptions=function(){var a=this;this._attachDisposeEvent();var c=Entry.FieldColor.getWidgetColorList();this.optionGroup= +Entry.Dom("table",{class:"entry-widget-color-table",parent:$("body")});for(var d=0;d'),{parent:this._container});this.svg=Entry.SVG("globalSvg");this.top=this.left=0;this._inited=!0}}; -b.setView=function(a,b){if(a!=this._view&&!a.block.isReadOnly()&&a.movable)return this._view=a,this._mode=b,b!==Entry.Workspace.MODE_VIMBOARD&&a.set({visible:!1}),this.draw(),this.show(),this.align(),this.position(),!0};b.draw=function(){var a=this._view;this._svg&&this.remove();var b=this._mode==Entry.Workspace.MODE_VIMBOARD;this.svgGroup=Entry.SVG.createElement(a.svgGroup.cloneNode(!0),{opacity:1});this.svg.appendChild(this.svgGroup);b&&(a=$(this.svgGroup),a.find("g").css({filter:"none"}),a.find("path").velocity({opacity:0}, -{duration:500}),a.find("text").velocity({fill:"#000000"},{duration:530}))};b.remove=function(){this.svgGroup&&(this.svgGroup.remove(),delete this.svgGroup,delete this._view,delete this._offsetX,delete this._offsetY,delete this._startX,delete this._startY,this.hide())};b.align=function(){var a=this._view.getSkeleton().box(this._view).offsetX||0,b=this._view.getSkeleton().box(this._view).offsetY||0,a=-1*a+1,b=-1*b+1;this._offsetX=a;this._offsetY=b;this.svgGroup.attr({transform:"translate("+a+","+b+ -")"})};b.show=function(){this._container.removeClass("entryRemove")};b.hide=function(){this._container.addClass("entryRemove")};b.position=function(){var a=this._view;if(a){var b=a.getAbsoluteCoordinate(),a=a.getBoard().offset();this.left=b.x+a.left-this._offsetX;this.top=b.y+a.top-this._offsetY;this.svgDom.css({transform:"translate3d("+this.left+"px,"+this.top+"px, 0px)"})}};b.terminateDrag=function(a){var b=Entry.mouseCoordinate,d=a.getBoard(),e=d.workspace.blockMenu,f=e.offset().left,g=e.offset().top, -h=e.visible?e.svgDom.width():0;return b.y>d.offset().top-20&&b.x>f+h?this.DONE:b.y>g&&b.x>f&&e.visible?a.block.isDeletable()?this.REMOVE:this.RETURN:this.RETURN};b.addControl=function(a){this.onMouseDown.apply(this,arguments)};b.onMouseDown=function(a){function b(a){var c=a.pageX;a=a.pageY;var d=e.left+(c-e._startX),f=e.top+(a-e._startY);e.svgDom.css({left:d,top:f});e._startX=c;e._startY=a;e.left=d;e.top=f}function d(a){$(document).unbind(".block")}this._startY=a.pageY;var e=this;a.stopPropagation(); -a.preventDefault();var f=$(document);f.bind("mousemove.block",b);f.bind("mouseup.block",d);f.bind("touchmove.block",b);f.bind("touchend.block",d);this._startX=a.pageX;this._startY=a.pageY}})(Entry.GlobalSvg);Entry.Mutator=function(){};(function(b){b.mutate=function(a,b){var d=Entry.block[a];void 0===d.changeEvent&&(d.changeEvent=new Entry.Event);d.template=b.template;d.params=b.params;d.changeEvent.notify(1)}})(Entry.Mutator);(function(b){})(Entry.Mutator.prototype);Entry.RenderView=function(b,a){this._align=a||"CENTER";b="string"===typeof b?$("#"+b):$(b);if("DIV"!==b.prop("tagName"))return console.error("Dom is not div element");this.view=b;this.viewOnly=!0;this.suffix="renderView";this.disableMouseEvent=this.visible=!0;this._svgId="renderView_"+(new Date).getTime();this._generateView();this.offset=this.svgDom.offset();this.setWidth();this.svg=Entry.SVG(this._svgId);Entry.Utils.addFilters(this.svg,this.suffix);this.svg&&(this.svgGroup=this.svg.elem("g"),this.svgThreadGroup= +(function(a){a.DONE=0;a._inited=!1;a.REMOVE=1;a.RETURN=2;a.createDom=function(){if(!this.inited){$("#globalSvgSurface").remove();$("#globalSvg").remove();var a=$("body");this._container=Entry.Dom("div",{classes:["globalSvgSurface","entryRemove"],id:"globalSvgSurface",parent:a});this.svgDom=Entry.Dom($(''),{parent:this._container});this.svg=Entry.SVG("globalSvg");this.top=this.left=0;this._inited=!0}}; +a.setView=function(a,c){if(a!=this._view&&!a.block.isReadOnly()&&a.movable)return this._view=a,this._mode=c,c!==Entry.Workspace.MODE_VIMBOARD&&a.set({visible:!1}),this.draw(),this.show(),this.align(),this.position(),!0};a.draw=function(){var a=this._view;this._svg&&this.remove();var c=this._mode==Entry.Workspace.MODE_VIMBOARD;this.svgGroup=Entry.SVG.createElement(a.svgGroup.cloneNode(!0),{opacity:1});this.svg.appendChild(this.svgGroup);c&&(a=$(this.svgGroup),a.find("g").css({filter:"none"}),a.find("path").velocity({opacity:0}, +{duration:500}),a.find("text").velocity({fill:"#000000"},{duration:530}))};a.remove=function(){this.svgGroup&&(this.svgGroup.remove(),delete this.svgGroup,delete this._view,delete this._offsetX,delete this._offsetY,delete this._startX,delete this._startY,this.hide())};a.align=function(){var a=this._view.getSkeleton().box(this._view).offsetX||0,c=this._view.getSkeleton().box(this._view).offsetY||0,a=-1*a+1,c=-1*c+1;this._offsetX=a;this._offsetY=c;this.svgGroup.attr({transform:"translate("+a+","+c+ +")"})};a.show=function(){this._container.removeClass("entryRemove")};a.hide=function(){this._container.addClass("entryRemove")};a.position=function(){var a=this._view;if(a){var c=a.getAbsoluteCoordinate(),a=a.getBoard().offset();this.left=c.x+a.left-this._offsetX;this.top=c.y+a.top-this._offsetY;this.svgDom.css({transform:"translate3d("+this.left+"px,"+this.top+"px, 0px)"})}};a.terminateDrag=function(a){var c=Entry.mouseCoordinate,d=a.getBoard(),e=d.workspace.blockMenu,f=e.offset().left,g=e.offset().top, +h=e.visible?e.svgDom.width():0;return c.y>d.offset().top-20&&c.x>f+h?this.DONE:c.y>g&&c.x>f&&e.visible?a.block.isDeletable()?this.REMOVE:this.RETURN:this.RETURN};a.addControl=function(a){this.onMouseDown.apply(this,arguments)};a.onMouseDown=function(a){function c(a){var b=a.pageX;a=a.pageY;var c=e.left+(b-e._startX),d=e.top+(a-e._startY);e.svgDom.css({left:c,top:d});e._startX=b;e._startY=a;e.left=c;e.top=d}function d(a){$(document).unbind(".block")}this._startY=a.pageY;var e=this;a.stopPropagation(); +a.preventDefault();var f=$(document);f.bind("mousemove.block",c);f.bind("mouseup.block",d);f.bind("touchmove.block",c);f.bind("touchend.block",d);this._startX=a.pageX;this._startY=a.pageY}})(Entry.GlobalSvg);Entry.Mutator=function(){};(function(a){a.mutate=function(a,c){a=Entry.block[a];void 0===a.changeEvent&&(a.changeEvent=new Entry.Event);a.template=c.template;a.params=c.params;a.changeEvent.notify(1)}})(Entry.Mutator);(function(a){})(Entry.Mutator.prototype);Entry.RenderView=function(a,b){this._align=b||"CENTER";a="string"===typeof a?$("#"+a):$(a);if("DIV"!==a.prop("tagName"))return console.error("Dom is not div element");this.view=a;this.viewOnly=!0;this.suffix="renderView";this.disableMouseEvent=this.visible=!0;this._svgId="renderView_"+(new Date).getTime();this._generateView();this.offset=this.svgDom.offset();this.setWidth();this.svg=Entry.SVG(this._svgId);Entry.Utils.addFilters(this.svg,this.suffix);this.svg&&(this.svgGroup=this.svg.elem("g"),this.svgThreadGroup= this.svgGroup.elem("g"),this.svgThreadGroup.board=this,this.svgBlockGroup=this.svgGroup.elem("g"),this.svgBlockGroup.board=this)}; -(function(b){b.schema={code:null,dragBlock:null,closeBlock:null,selectedBlockView:null};b._generateView=function(){this.renderViewContainer=Entry.Dom("div",{"class":"renderViewContainer",parent:this.view});this.svgDom=Entry.Dom($(''),{parent:this.renderViewContainer})};b.changeCode=function(a){if(!(a instanceof Entry.Code))return console.error("You must inject code instance");this.code=a;this.svg|| -(this.svg=Entry.SVG(this._svgId),this.svgGroup=this.svg.elem("g"),this.svgThreadGroup=this.svgGroup.elem("g"),this.svgThreadGroup.board=this,this.svgBlockGroup=this.svgGroup.elem("g"),this.svgBlockGroup.board=this);a.createView(this);this.align();this.resize()};b.align=function(){var a=this.code.getThreads();if(a&&0!==a.length){for(var b=0,d="LEFT"==this._align?20:this.svgDom.width()/2,e=0,f=a.length;e'), -{parent:this.wrapper});this.visible=!0;var d=this;this.svg=Entry.SVG(this._svgId);$(window).scroll(function(){d.updateOffset()});this.svgGroup=this.svg.elem("g");this.svgThreadGroup=this.svgGroup.elem("g");this.svgThreadGroup.board=this;this.svgBlockGroup=this.svgGroup.elem("g");this.svgBlockGroup.board=this;a.isOverlay?(this.wrapper.addClass("entryOverlayBoard"),this.generateButtons(),this.suffix="overlayBoard"):this.suffix="board";Entry.Utils.addFilters(this.svg,this.suffix);a=Entry.Utils.addBlockPattern(this.svg, -this.suffix);this.patternRect=a.rect;this.pattern=a.pattern};b.changeCode=function(a){this.code&&this.codeListener&&this.code.changeEvent.detach(this.codeListener);this.set({code:a});var b=this;a&&(this.codeListener=this.code.changeEvent.attach(this,function(){b.changeEvent.notify()}),a.createView(this));this.scroller.resizeScrollBar()};b.bindCodeView=function(a){this.svgBlockGroup.remove();this.svgThreadGroup.remove();this.svgBlockGroup=a.svgBlockGroup;this.svgThreadGroup=a.svgThreadGroup;this.svgGroup.appendChild(this.svgThreadGroup); -this.svgGroup.appendChild(this.svgBlockGroup)};b.setMagnetedBlock=function(a,b){if(this.magnetedBlockView){if(this.magnetedBlockView===a)return;this.magnetedBlockView.set({magneting:!1})}this.set({magnetedBlockView:a});a&&(a.set({magneting:b}),a.dominate())};b.getCode=function(){return this.code};b.findById=function(a){return this.code.findById(a)};b._addControl=function(){var a=this.svgDom,b=this;a.mousedown(function(){b.onMouseDown.apply(b,arguments)});a.bind("touchstart",function(){b.onMouseDown.apply(b, -arguments)});a.on("wheel",function(){b.mouseWheel.apply(b,arguments)});var d=b.scroller;d&&(a.mouseenter(function(a){d.setOpacity(1)}),a.mouseleave(function(a){d.setOpacity(0)}))};b.onMouseDown=function(a){function b(a){a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();a=a.originalEvent&&a.originalEvent.touches?a.originalEvent.touches[0]:a;var c=f.dragInstance;f.scroller.scroll(a.pageX-c.offsetX,a.pageY-c.offsetY);c.set({offsetX:a.pageX,offsetY:a.pageY})}function d(a){$(document).unbind(".entryBoard"); -delete f.dragInstance}if(this.workspace.getMode()!=Entry.Workspace.MODE_VIMBOARD){a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();if(0===a.button||a.originalEvent&&a.originalEvent.touches){a=a.originalEvent&&a.originalEvent.touches?a.originalEvent.touches[0]:a;Entry.documentMousedown&&Entry.documentMousedown.notify(a);var e=$(document);e.bind("mousemove.entryBoard",b);e.bind("mouseup.entryBoard",d);e.bind("touchmove.entryBoard",b);e.bind("touchend.entryBoard",d);this.dragInstance= -new Entry.DragInstance({startX:a.pageX,startY:a.pageY,offsetX:a.pageX,offsetY:a.pageY})}else if(Entry.Utils.isRightButton(a)){if(!this.visible)return;a=[];this._contextOptions[Entry.Board.OPTION_PASTE].option.enable=!!Entry.clipboard;this._contextOptions[Entry.Board.OPTION_DOWNLOAD].option.enable=0!==this.code.getThreads().length;for(e=0;ea&&(f=f+e+10,e=0,d=15);e=Math.max(e,k.width);l=d+15;h._moveTo(f,l,!1);d=d+k.height+15}}this.scroller.resizeScrollBar()};b.clear=function(){this.svgBlockGroup.remove();this.svgThreadGroup.remove()};b.updateOffset= -function(){this._offset=this.svg.getBoundingClientRect();var a=$(window),b=a.scrollTop(),a=a.scrollLeft(),d=this._offset;this.relativeOffset={top:d.top-b,left:d.left-a};this.btnWrapper&&this.btnWrapper.attr({transform:"translate("+(d.width/2-65)+","+(d.height-200)+")"})};b.generateButtons=function(){var a=this,b=this.svgGroup.elem("g");this.btnWrapper=b;var d=b.elem("text",{x:27,y:33,class:"entryFunctionButtonText"});d.textContent=Lang.Buttons.save;var e=b.elem("text",{x:102.5,y:33,class:"entryFunctionButtonText"}); -e.textContent=Lang.Buttons.cancel;var f=b.elem("circle",{cx:27.5,cy:27.5,r:27.5,class:"entryFunctionButton"}),b=b.elem("circle",{cx:102.5,cy:27.5,r:27.5,class:"entryFunctionButton"});$(f).bind("mousedown touchstart",function(){a.save()});$(d).bind("mousedown touchstart",function(){a.save()});$(b).bind("mousedown touchstart",function(){a.cancelEdit()});$(e).bind("mousedown touchstart",function(){a.cancelEdit()})};b.cancelEdit=function(){this.workspace.setMode(Entry.Workspace.MODE_BOARD,"cancelEdit")}; -b.save=function(){this.workspace.setMode(Entry.Workspace.MODE_BOARD,"save")};b.generateCodeMagnetMap=function(){var a=this.code;if(a&&this.dragBlock)for(var b in this.dragBlock.magnet){var d=this._getCodeBlocks(a,b);d.sort(function(a,b){return a.point-b.point});d.unshift({point:-Number.MAX_VALUE,blocks:[]});for(var e=1;eg.point&&(g.blocks.push(h),l++,g=d[l],g););delete f.startBlock}f.endPoint=Number.MAX_VALUE;d[e-1].endPoint= -f.point}this._magnetMap[b]=d}};b._getCodeBlocks=function(a,b){var d=a.getThreads(),e=[],f;switch(b){case "previous":f=this._getNextMagnets;break;case "next":f=this._getPreviousMagnets;break;case "string":f=this._getFieldMagnets;break;case "boolean":f=this._getFieldMagnets;break;case "param":f=this._getOutputMagnets;break;default:return[]}for(var g=0;gd.endPoint)f=h+1;else{e=d.blocks;for(f=0;fthis.events[b].indexOf(f)&&this.events[b].push(f)}}this._schema.event&&this.thread.registerEvent(this,this._schema.event);a=this.params;b=this._schema.params;for(e=0;b&&e=e&&g>=b)}};b.align=function(){var a=this.getPosition();this.svgGroup.attr({transform:"translate("+a.x+","+a.y+")"})};b.setPosition=function(){if(this.board){var a=this.board.svgDom;this._x=a.width()-110;this._y=a.height()-110;this.align()}};b.getPosition=function(){return{x:this._x,y:this._y}};b.tAnimation=function(a){if(a!==this.isOver){a=void 0===a?!0:a;var b,d=this.trashcanTop;b=a?{translateX:15,translateY:-25, -rotateZ:30}:{translateX:0,translateY:0,rotateZ:0};$(d).velocity(b,{duration:50});this.isOver=a}};b.setBoard=function(a){this._dragBlockObserver&&this._dragBlockObserver.destroy();this.board=a;this.svgGroup||this._generateView();var b=a.svg,d=b.firstChild;d?b.insertBefore(this.svgGroup,d):b.appendChild(this.svgGroup);this._dragBlockObserver=a.observe(this,"updateDragBlock",["dragBlock"]);this.svgGroup.attr({filter:"url(#entryTrashcanFilter_"+a.suffix+")"});this.setPosition()}})(Entry.FieldTrashcan.prototype);Entry.Vim=function(b){b="string"===typeof b?$("#"+b):$(b);if("DIV"!==b.prop("tagName"))return console.error("Dom is not div element");this.createDom(b);this._parser=new Entry.Parser("maze","js",this.codeMirror);this._blockParser=new Entry.Parser("maze","block");Entry.Model(this,!1);window.eventset=[]}; -(function(b){b.createDom=function(a){function b(a){var c=e.getCodeToText(a.block);e.codeMirror.display.dragFunctions.leave(a);var d=Entry.Utils.createMouseEvent("mousedown",a);e.codeMirror.display.scroller.dispatchEvent(d);var c=c.split("\n"),k=c.length-1,l=0;c.forEach(function(a,b){e.codeMirror.replaceSelection(a);l=e.doc.getCursor().line;e.codeMirror.indentLine(l);0!==b&&k===b||e.codeMirror.replaceSelection("\n")});a=Entry.Utils.createMouseEvent("mouseup",a);e.codeMirror.display.scroller.dispatchEvent(a)} +(function(a){a.schema={code:null,dragBlock:null,closeBlock:null,selectedBlockView:null};a._generateView=function(){this.renderViewContainer=Entry.Dom("div",{"class":"renderViewContainer",parent:this.view});this.svgDom=Entry.Dom($(''),{parent:this.renderViewContainer})};a.changeCode=function(a){if(!(a instanceof Entry.Code))return console.error("You must inject code instance");this.code=a;this.svg|| +(this.svg=Entry.SVG(this._svgId),this.svgGroup=this.svg.elem("g"),this.svgThreadGroup=this.svgGroup.elem("g"),this.svgThreadGroup.board=this,this.svgBlockGroup=this.svgGroup.elem("g"),this.svgBlockGroup.board=this);a.createView(this);this.align();this.resize()};a.align=function(){var a=this.code.getThreads();if(a&&0!==a.length){for(var c=0,d="LEFT"==this._align?20:this.svgDom.width()/2,e=0,f=a.length;e"+d[1];c.addEventListener("click",function(){Entry.engine.toggleStop()});this.view_.appendChild(c);this.curtainView_=c;Entry.pictureEditable&&(c=Entry.createElement("div","entryPicture"),c.addClass("entryPlaygroundPictureWorkspace"),c.addClass("entryRemove"),this.view_.appendChild(c),this.generatePictureView(c),this.pictureView_=c);c=Entry.createElement("div","entryText");c.addClass("entryPlaygroundTextWorkspace");c.addClass("entryRemove");this.view_.appendChild(c);this.generateTextView(c); -this.textView_=c;Entry.soundEditable&&(c=Entry.createElement("div","entrySound"),c.addClass("entryPlaygroundSoundWorkspace"),c.addClass("entryRemove"),this.view_.appendChild(c),this.generateSoundView(c),this.soundView_=c);c=Entry.createElement("div","entryDefault");c.addClass("entryPlaygroundDefaultWorkspace");this.view_.appendChild(c);this.generateDefaultView(c);this.defaultView_=c;c=Entry.createElement("div","entryCode");c.addClass("entryPlaygroundCodeWorkspace");c.addClass("entryRemove");this.view_.appendChild(c); -this.generateCodeView(c);this.codeView_=c;d=Entry.createElement("div");d.addClass("entryPlaygroundResizeWorkspace","entryRemove");this.resizeHandle_=d;this.view_.appendChild(d);this.initializeResizeHandle(d);this.codeView_=c;Entry.addEventListener("run",function(a){Entry.playground.curtainView_.removeClass("entryRemove")});Entry.addEventListener("stop",function(a){Entry.playground.curtainView_.addClass("entryRemove")})}};Entry.Playground.prototype.generateDefaultView=function(b){return b}; -Entry.Playground.prototype.generateTabView=function(b){var a=this,c=Entry.createElement("ul");c.addClass("entryTabListWorkspace");this.tabList_=c;b.appendChild(c);this.tabViewElements={};b=Entry.createElement("li","entryCodeTab");b.innerHTML=Lang.Workspace.tab_code;b.addClass("entryTabListItemWorkspace");b.addClass("entryTabSelected");c.appendChild(b);b.bindOnClick(function(b){a.changeViewMode("code");a.blockMenu.reDraw()});this.tabViewElements.code=b;Entry.pictureEditable&&(b=Entry.createElement("li", -"entryPictureTab"),b.innerHTML=Lang.Workspace.tab_picture,b.addClass("entryTabListItemWorkspace"),c.appendChild(b),b.bindOnClick(function(a){Entry.playground.changeViewMode("picture")}),this.tabViewElements.picture=b,b=Entry.createElement("li","entryTextboxTab"),b.innerHTML=Lang.Workspace.tab_text,b.addClass("entryTabListItemWorkspace"),c.appendChild(b),b.bindOnClick(function(a){Entry.playground.changeViewMode("text")}),this.tabViewElements.text=b,b.addClass("entryRemove"));Entry.soundEditable&&(b= -Entry.createElement("li","entrySoundTab"),b.innerHTML=Lang.Workspace.tab_sound,b.addClass("entryTabListItemWorkspace"),c.appendChild(b),b.bindOnClick(function(a){Entry.playground.changeViewMode("sound")}),this.tabViewElements.sound=b);Entry.hasVariableManager&&(b=Entry.createElement("li","entryVariableTab"),b.innerHTML=Lang.Workspace.tab_attribute,b.addClass("entryTabListItemWorkspace"),b.addClass("entryVariableTabWorkspace"),c.appendChild(b),b.bindOnClick(function(a){Entry.playground.toggleOnVariableView(); -Entry.playground.changeViewMode("variable")}),this.tabViewElements.variable=b)}; -Entry.Playground.prototype.generateCodeView=function(b){var a=this.createVariableView();b.appendChild(a);this.variableView_=a;b=Entry.Dom(b);a=Entry.Dom("div",{parent:b,id:"entryWorkspaceBoard",class:"entryWorkspaceBoard"});b=Entry.Dom("div",{parent:b,id:"entryWorkspaceBlockMenu",class:"entryWorkspaceBlockMenu"});this.mainWorkspace=new Entry.Workspace({blockMenu:{dom:b,align:"LEFT",categoryData:EntryStatic.getAllBlocks(),scroll:!0},board:{dom:a}});this.blockMenu=this.mainWorkspace.blockMenu;this.board= -this.mainWorkspace.board;Entry.hw&&this.updateHW()}; -Entry.Playground.prototype.generatePictureView=function(b){if("workspace"==Entry.type){var a=Entry.createElement("div","entryAddPicture");a.addClass("entryPlaygroundAddPicture");a.bindOnClick(function(a){Entry.dispatchEvent("openPictureManager")});var c=Entry.createElement("div","entryAddPictureInner");c.addClass("entryPlaygroundAddPictureInner");c.innerHTML=Lang.Workspace.picture_add;a.appendChild(c);b.appendChild(a);a=Entry.createElement("ul","entryPictureList");a.addClass("entryPlaygroundPictureList"); -$&&$(a).sortable({start:function(a,b){b.item.data("start_pos",b.item.index())},stop:function(a,b){var c=b.item.data("start_pos"),g=b.item.index();Entry.playground.movePicture(c,g)},axis:"y"});b.appendChild(a);this.pictureListView_=a;a=Entry.createElement("div","entryPainter");a.addClass("entryPlaygroundPainter");b.appendChild(a);this.painter=new Entry.Painter;this.painter.initialize(a)}else"phone"==Entry.type&&(a=Entry.createElement("div","entryAddPicture"),a.addClass("entryPlaygroundAddPicturePhone"), -a.bindOnClick(function(a){Entry.dispatchEvent("openPictureManager")}),c=Entry.createElement("div","entryAddPictureInner"),c.addClass("entryPlaygroundAddPictureInnerPhone"),c.innerHTML=Lang.Workspace.picture_add,a.appendChild(c),b.appendChild(a),a=Entry.createElement("ul","entryPictureList"),a.addClass("entryPlaygroundPictureListPhone"),$&&$(a).sortable({start:function(a,b){b.item.data("start_pos",b.item.index())},stop:function(a,b){var c=b.item.data("start_pos"),g=b.item.index();Entry.playground.movePicture(c, -g)},axis:"y"}),b.appendChild(a),this.pictureListView_=a)}; -Entry.Playground.prototype.generateTextView=function(b){var a=Entry.createElement("div");b.appendChild(a);b=Entry.createElement("div");b.addClass("textProperties");a.appendChild(b);var c=Entry.createElement("div");c.addClass("entryTextFontSelect");b.appendChild(c);var d=Entry.createElement("select","entryPainterAttrFontName");d.addClass("entryPlaygroundPainterAttrFontName","entryTextFontSelecter");d.size="1";d.onchange=function(a){Entry.playground.object.entity.setFontType(a.target.value)};for(var e= -0;e p").html(Lang.Menus.linebreak_on_desc_1),$(".entryPlaygroundLinebreakDescription > ul > li").eq(0).html(Lang.Menus.linebreak_on_desc_2),$(".entryPlaygroundLinebreakDescription > ul > li").eq(1).html(Lang.Menus.linebreak_on_desc_3)); -Entry.playground.setFontAlign(Entry.playground.object.entity.getTextAlign());b=Entry.playground.object.entity.getFontSize();Entry.playground.fontSizeIndiciator.style.width=b+"%";Entry.playground.fontSizeKnob.style.left=.88*b+"px"}};Entry.Playground.prototype.injectSound=function(){var b=this.soundListView_;if(b){for(;b.hasChildNodes();)b.removeChild(b.lastChild);if(this.object)for(var a=this.object.sounds,c=0,d=a.length;c Date: Fri, 29 Jul 2016 00:01:38 +0900 Subject: [PATCH 06/15] Cobl_bug_fix bug fix --- dist/entry.js | 21 +- dist/entry.min.js | 541 ++++++++++++++++++----------------- src/workspace/block_entry.js | 116 +++++--- 3 files changed, 355 insertions(+), 323 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index 14ed93bb16..04546e6f5b 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -10128,14 +10128,15 @@ Entry.EntryObject.prototype.generateView = function() { d.object = this; this.editView_ = d; this.view_.appendChild(d); - Entry.objectEditable ? ($(d).mousedown(function(a) { + $(d).mousedown(function(a) { var c = b.isEditing; a.stopPropagation(); Entry.documentMousedown.notify(a); Entry.engine.isState("run") || !1 !== c || (b.editObjectValues(!c), Entry.playground.object !== b && Entry.container.selectObject(b.id), b.nameView_.select()); - }), d.blur = function(a) { + }); + d.blur = function(a) { b.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(b) { Entry.engine.isState("run") || Entry.container.removeObject(this.object); })); @@ -17017,26 +17018,26 @@ Entry.skeleton.basic_without_next = {box:Entry.skeleton.basic.box, contentPos:En return {previous:{x:0, y:0}}; }}; Entry.skeleton.basic_double_loop = {path:function(a) { - var b = a.contentWidth, c = a.contentHeight % 1E3, d = Math.floor(a.contentHeight / 1E3), c = Math.max(30, c + 2), d = Math.max(30, d + 2), b = Math.max(0, b + 5 - c / 2), e = a._statements; + var b = a.contentWidth, c = a.contentHeight % 1E6, d = Math.floor(a.contentHeight / 1E6), c = Math.max(30, c + 2), d = Math.max(30, d + 2), b = Math.max(0, b + 5 - c / 2), e = a._statements; a = e[0] ? e[0].height : 20; e = e[1] ? e[1].height : 20; a = Math.max(a, 20); e = Math.max(e, 20); return "m -8,0 l 8,8 8,-8 h %w a %h1,%h1 0 0,1 0,%wh1 H 24 l -8,8 -8,-8 h -0.4 v %sh1 h 0.4 l 8,8 8,-8 h %bw a %h2,%h2 0 0,1 0,%wh2 H 24 l -8,8 -8,-8 h -0.4 v %sh2 h 0.4 l 8,8 8,-8 h %bw a 8,8 0 0,1 0,16 H 8 l -8,8 -8,-8 z".replace(/%wh1/gi, c).replace(/%wh2/gi, d).replace(/%w/gi, b).replace(/%bw/gi, b - 8).replace(/%h1/gi, c / 2).replace(/%h2/gi, d / 2).replace(/%sh1/gi, a + 1).replace(/%sh2/gi, e + 1); }, magnets:function(a) { - var b = Math.max(a.contentHeight % 1E3 + 2, 30), c = Math.max(Math.floor(a.contentHeight / 1E3) + 2, 30), d = a._statements[0] ? a._statements[0].height : 20, e = a._statements[1] ? a._statements[1].height : 20, d = Math.max(d, 20), e = Math.max(e, 20); + var b = Math.max(a.contentHeight % 1E6 + 2, 30), c = Math.max(Math.floor(a.contentHeight / 1E6) + 2, 30), d = a._statements[0] ? a._statements[0].height : 20, e = a._statements[1] ? a._statements[1].height : 20, d = Math.max(d, 20), e = Math.max(e, 20); return {previous:{x:0, y:0}, next:{x:0, y:d + e + b + c + 19 + a.offsetY}}; }, box:function(a) { - var b = a.contentWidth, c = Math.max(Math.floor(a.contentHeight / 1E3) + 2, 30), d = Math.max(a.contentHeight % 1E3 + 2, 30), e = a._statements[0] ? a._statements[0].height % 1E3 : 20; + var b = a.contentWidth, c = Math.max(Math.floor(a.contentHeight / 1E6) + 2, 30), d = Math.max(a.contentHeight % 1E6 + 2, 30), e = a._statements[0] ? a._statements[0].height % 1E6 : 20; a = a._statements[1] ? a._statements[1].height : 20; e = Math.max(e, 20); a = Math.max(a, 20); return {offsetX:-8, offsetY:0, width:b + 30, height:c + d + e + a + 17, marginBottom:0}; }, statementPos:function(a) { - var b = Math.max(30, a.contentHeight % 1E3 + 2) + 1; - return [{x:16, y:b}, {x:16, y:b + Math.max(a._statements[0] ? a._statements[0].height % 1E3 : 20, 20) + Math.max(Math.floor(a.contentHeight / 1E3) + 2, 30) + 1}]; + var b = Math.max(30, a.contentHeight % 1E6 + 2) + 1; + return [{x:16, y:b}, {x:16, y:b + Math.max(a._statements[0] ? a._statements[0].height % 1E6 : 20, 20) + Math.max(Math.floor(a.contentHeight / 1E6) + 2, 30) + 1}]; }, contentPos:function(a) { - return {x:14, y:Math.max(a.contentHeight % 1E3, 28) / 2 + 1}; + return {x:14, y:Math.max(a.contentHeight % 1E6, 28) / 2 + 1}; }}; Entry.Block = function(a, b) { var c = this; @@ -17919,7 +17920,7 @@ Entry.BlockView.pngMap = {}; var l = this._contents[k]; l instanceof Entry.FieldLineBreak ? (this._alignStatement(a, f), l.align(f), f++, d = l.box.y, c = 8) : (l.align(c, d, a), k === this._contents.length - 1 || l instanceof Entry.FieldText && 0 == l._text.length || (c += Entry.BlockView.PARAM_SPACE)); l = l.box; - 0 !== f ? h = Math.max(1E3 * Math.round(l.height), h) : e = Math.max(l.height, e); + 0 !== f ? h = Math.max(1E6 * Math.round(l.height), h) : e = Math.max(l.height, e); c += l.width; g = Math.max(g, c); this.set({contentWidth:g, contentHeight:e}); diff --git a/dist/entry.min.js b/dist/entry.min.js index 35137bbe40..a166c61694 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -954,15 +954,15 @@ Entry.EntryObject.prototype.generateView=function(){if("workspace"==Entry.type){ Entry.toast.alert(Lang.Workspace.add_object_alert,Lang.Workspace.object_not_found_for_paste)}}];Entry.ContextMenu.show(a,"workspace-contextmenu")});this.view_=a;var c=this,a=Entry.createElement("ul");a.addClass("objectInfoView");Entry.objectEditable||a.addClass("entryHide");var d=Entry.createElement("li");d.addClass("objectInfo_visible");this.entity.getVisible()||d.addClass("objectInfo_unvisible");d.bindOnClick(function(b){Entry.engine.isState("run")||(b=c.entity,b.setVisible(!b.getVisible())?this.removeClass("objectInfo_unvisible"): this.addClass("objectInfo_unvisible"))});var e=Entry.createElement("li");e.addClass("objectInfo_unlock");this.getLock()&&e.addClass("objectInfo_lock");e.bindOnClick(function(b){Entry.engine.isState("run")||(b=c,b.setLock(!b.getLock())?this.addClass("objectInfo_lock"):this.removeClass("objectInfo_lock"),b.updateInputViews(b.getLock()))});a.appendChild(d);a.appendChild(e);this.view_.appendChild(a);a=Entry.createElement("div");a.addClass("entryObjectThumbnailWorkspace");this.view_.appendChild(a);this.thumbnailView_= a;a=Entry.createElement("div");a.addClass("entryObjectWrapperWorkspace");this.view_.appendChild(a);d=Entry.createElement("input");d.bindOnClick(function(b){b.preventDefault();Entry.container.selectObject(c.id);this.readOnly||(this.focus(),this.select())});d.addClass("entryObjectNameWorkspace");a.appendChild(d);this.nameView_=d;this.nameView_.entryObject=this;d.setAttribute("readonly",!0);var f=this;this.nameView_.onblur=function(b){this.entryObject.name=this.value;Entry.playground.reloadPlayground()}; -this.nameView_.onkeypress=function(b){13==b.keyCode&&f.editObjectValues(!1)};this.nameView_.value=this.name;d=Entry.createElement("div");d.addClass("entryObjectEditWorkspace");d.object=this;this.editView_=d;this.view_.appendChild(d);Entry.objectEditable?($(d).mousedown(function(a){var c=b.isEditing;a.stopPropagation();Entry.documentMousedown.notify(a);Entry.engine.isState("run")||!1!==c||(b.editObjectValues(!c),Entry.playground.object!==b&&Entry.container.selectObject(b.id),b.nameView_.select())}), -d.blur=function(a){b.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(b){Entry.engine.isState("run")||Entry.container.removeObject(this.object)}));d=Entry.createElement("div");d.addClass("entryObjectInformationWorkspace");d.object=this;this.isInformationToggle=!1;a.appendChild(d);this.informationView_= -d;a=Entry.createElement("div");a.addClass("entryObjectRotationWrapperWorkspace");a.object=this;this.view_.appendChild(a);d=Entry.createElement("span");d.addClass("entryObjectCoordinateWorkspace");a.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(b){b.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(b){b.stopPropagation();this.select()});k.setAttribute("readonly",!0);var l=Entry.createElement("span");l.addClass("entryObjectCoordinateSizeWorkspace");l.innerHTML=Lang.Workspace.Size+" : ";var q=Entry.createElement("input");q.addClass("entryObjectCoordinateInputWorkspace","entryObjectCoordinateInputWorkspace_size"); -q.bindOnClick(function(b){b.stopPropagation();this.select()});q.setAttribute("readonly",!0);d.appendChild(e);d.appendChild(g);d.appendChild(h);d.appendChild(k);d.appendChild(l);d.appendChild(q);d.xInput_=g;d.yInput_=k;d.sizeInput_=q;this.coordinateView_=d;c=this;g.onkeypress=function(b){13==b.keyCode&&c.editObjectValues(!1)};g.onblur=function(b){isNaN(g.value)||c.entity.setX(Number(g.value));c.updateCoordinateView();Entry.stage.updateObject()};k.onkeypress=function(b){13==b.keyCode&&c.editObjectValues(!1)}; -k.onblur=function(b){isNaN(k.value)||c.entity.setY(Number(k.value));c.updateCoordinateView();Entry.stage.updateObject()};q.onkeypress=function(b){13==b.keyCode&&c.editObjectValues(!1)};q.onblur=function(b){isNaN(q.value)||c.entity.setSize(Number(q.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(b){b.stopPropagation();this.select()});this.rotateSpan_=e;this.rotateInput_=m;h=Entry.createElement("span");h.addClass("entryObjectDirectionSpanWorkspace");h.innerHTML=Lang.Workspace.direction+" : ";var n=Entry.createElement("input");n.addClass("entryObjectDirectionInputWorkspace");n.setAttribute("readonly",!0);n.bindOnClick(function(b){b.stopPropagation(); -this.select()});this.directionInput_=n;d.appendChild(e);d.appendChild(m);d.appendChild(h);d.appendChild(n);d.rotateInput_=m;d.directionInput_=n;c=this;m.onkeypress=function(b){13==b.keyCode&&c.editObjectValues(!1)};m.onblur=function(b){b=m.value;-1!=b.indexOf("\u02da")&&(b=b.substring(0,b.indexOf("\u02da")));isNaN(b)||c.entity.setRotation(Number(b));c.updateRotationView();Entry.stage.updateObject()};n.onkeypress=function(b){13==b.keyCode&&c.editObjectValues(!1)};n.onblur=function(b){b=n.value;-1!= -b.indexOf("\u02da")&&(b=b.substring(0,b.indexOf("\u02da")));isNaN(b)||c.entity.setDirection(Number(b));c.updateRotationView();Entry.stage.updateObject()};d=Entry.createElement("div");d.addClass("rotationMethodWrapper");a.appendChild(d);this.rotationMethodWrapper_=d;a=Entry.createElement("span");a.addClass("entryObjectRotateMethodLabelWorkspace");d.appendChild(a);a.innerHTML=Lang.Workspace.rotate_method+" : ";a=Entry.createElement("div");a.addClass("entryObjectRotateModeWorkspace");a.addClass("entryObjectRotateModeAWorkspace"); +this.nameView_.onkeypress=function(b){13==b.keyCode&&f.editObjectValues(!1)};this.nameView_.value=this.name;d=Entry.createElement("div");d.addClass("entryObjectEditWorkspace");d.object=this;this.editView_=d;this.view_.appendChild(d);$(d).mousedown(function(a){var c=b.isEditing;a.stopPropagation();Entry.documentMousedown.notify(a);Entry.engine.isState("run")||!1!==c||(b.editObjectValues(!c),Entry.playground.object!==b&&Entry.container.selectObject(b.id),b.nameView_.select())});d.blur=function(a){b.editObjectComplete()}; +Entry.objectEditable&&Entry.objectDeletable&&(d=Entry.createElement("div"),d.addClass("entryObjectDeleteWorkspace"),d.object=this,this.deleteView_=d,this.view_.appendChild(d),d.bindOnClick(function(b){Entry.engine.isState("run")||Entry.container.removeObject(this.object)}));d=Entry.createElement("div");d.addClass("entryObjectInformationWorkspace");d.object=this;this.isInformationToggle=!1;a.appendChild(d);this.informationView_=d;a=Entry.createElement("div");a.addClass("entryObjectRotationWrapperWorkspace"); +a.object=this;this.view_.appendChild(a);d=Entry.createElement("span");d.addClass("entryObjectCoordinateWorkspace");a.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(b){b.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(b){b.stopPropagation();this.select()});k.setAttribute("readonly",!0);var l=Entry.createElement("span");l.addClass("entryObjectCoordinateSizeWorkspace");l.innerHTML=Lang.Workspace.Size+" : ";var q=Entry.createElement("input");q.addClass("entryObjectCoordinateInputWorkspace","entryObjectCoordinateInputWorkspace_size");q.bindOnClick(function(b){b.stopPropagation(); +this.select()});q.setAttribute("readonly",!0);d.appendChild(e);d.appendChild(g);d.appendChild(h);d.appendChild(k);d.appendChild(l);d.appendChild(q);d.xInput_=g;d.yInput_=k;d.sizeInput_=q;this.coordinateView_=d;c=this;g.onkeypress=function(b){13==b.keyCode&&c.editObjectValues(!1)};g.onblur=function(b){isNaN(g.value)||c.entity.setX(Number(g.value));c.updateCoordinateView();Entry.stage.updateObject()};k.onkeypress=function(b){13==b.keyCode&&c.editObjectValues(!1)};k.onblur=function(b){isNaN(k.value)|| +c.entity.setY(Number(k.value));c.updateCoordinateView();Entry.stage.updateObject()};q.onkeypress=function(b){13==b.keyCode&&c.editObjectValues(!1)};q.onblur=function(b){isNaN(q.value)||c.entity.setSize(Number(q.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(b){b.stopPropagation();this.select()});this.rotateSpan_=e;this.rotateInput_=m;h=Entry.createElement("span");h.addClass("entryObjectDirectionSpanWorkspace");h.innerHTML=Lang.Workspace.direction+" : ";var n=Entry.createElement("input");n.addClass("entryObjectDirectionInputWorkspace");n.setAttribute("readonly",!0);n.bindOnClick(function(b){b.stopPropagation();this.select()}); +this.directionInput_=n;d.appendChild(e);d.appendChild(m);d.appendChild(h);d.appendChild(n);d.rotateInput_=m;d.directionInput_=n;c=this;m.onkeypress=function(b){13==b.keyCode&&c.editObjectValues(!1)};m.onblur=function(b){b=m.value;-1!=b.indexOf("\u02da")&&(b=b.substring(0,b.indexOf("\u02da")));isNaN(b)||c.entity.setRotation(Number(b));c.updateRotationView();Entry.stage.updateObject()};n.onkeypress=function(b){13==b.keyCode&&c.editObjectValues(!1)};n.onblur=function(b){b=n.value;-1!=b.indexOf("\u02da")&& +(b=b.substring(0,b.indexOf("\u02da")));isNaN(b)||c.entity.setDirection(Number(b));c.updateRotationView();Entry.stage.updateObject()};d=Entry.createElement("div");d.addClass("rotationMethodWrapper");a.appendChild(d);this.rotationMethodWrapper_=d;a=Entry.createElement("span");a.addClass("entryObjectRotateMethodLabelWorkspace");d.appendChild(a);a.innerHTML=Lang.Workspace.rotate_method+" : ";a=Entry.createElement("div");a.addClass("entryObjectRotateModeWorkspace");a.addClass("entryObjectRotateModeAWorkspace"); a.object=this;this.rotateModeAView_=a;d.appendChild(a);a.bindOnClick(function(b){Entry.engine.isState("run")||this.object.getLock()||(this.object.initRotateValue("free"),this.object.setRotateMethod("free"))});a=Entry.createElement("div");a.addClass("entryObjectRotateModeWorkspace");a.addClass("entryObjectRotateModeBWorkspace");a.object=this;this.rotateModeBView_=a;d.appendChild(a);a.bindOnClick(function(b){Entry.engine.isState("run")||this.object.getLock()||(this.object.initRotateValue("vertical"), this.object.setRotateMethod("vertical"))});a=Entry.createElement("div");a.addClass("entryObjectRotateModeWorkspace");a.addClass("entryObjectRotateModeCWorkspace");a.object=this;this.rotateModeCView_=a;d.appendChild(a);a.bindOnClick(function(b){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 a=Entry.createElement("li",this.id),a.addClass("entryContainerListElementWorkspace"),a.object=this,a.bindOnClick(function(b){Entry.container.getObject(this.id)&&Entry.container.selectObject(this.id)}),$&&(b=this,context.attach("#"+this.id,[{text:Lang.Workspace.context_rename,href:"/",action:function(b){b.preventDefault()}},{text:Lang.Workspace.context_duplicate,href:"/",action:function(a){a.preventDefault();Entry.container.addCloneObject(b)}}, @@ -1526,10 +1526,10 @@ Entry.skeleton.basic_boolean_field={path:function(a){var b=a.contentWidth;a=a.co Entry.skeleton.basic_param={path:function(a){var b=a.contentWidth;(a=a._contents[a._contents.length-1])&&(b-=a.box.width+Entry.BlockView.PARAM_SPACE-2);b=Math.max(0,b);return"m 4,0 h 10 h %w l 2,2 0,3 3,0 1,1 0,12 -1,1 -3,0 0,3 -2,2h -%w h -10 l -2,-2 0,-3 3,0 1,-1 0,-12 -1,-1 -3,0 0,-3 2,-2".replace(/%w/gi,b)},outerLine:"#768dce",box:function(a){return{offsetX:0,offsetY:0,width:(a?a.contentWidth:5)+11,height:24,marginBottom:0}},magnets:function(){return{param:{}}},contentPos:function(a){return{x:11,y:12}}}; Entry.skeleton.basic_button={path:function(){return"m -64,0 h 128 a 6,6 0, 0,1 6,6 v 18 a 6,6 0, 0,1 -6,6 h -128 a 6,6 0, 0,1 -6,-6 v -18 a 6,6 0, 0,1 6,-6 z"},box:function(){return{offsetX:-80,offsetY:0,width:140,height:30}},contentPos:function(){return{x:0,y:15}},movable:!1,readOnly:!0,nextShadow:!0,classes:["basicButtonView"]}; Entry.skeleton.basic_without_next={box:Entry.skeleton.basic.box,contentPos:Entry.skeleton.basic.contentPos,path:function(a){var b=a.contentWidth;a=a.contentHeight;a=Math.max(30,a+2);b=Math.max(0,b+9-a/2);return"m -8,0 l 8,8 8,-8 h %w a %h,%h 0 0,1 0, %wh H -8 z".replace(/%wh/gi,a).replace(/%w/gi,b).replace(/%h/gi,a/2)},magnets:function(a){return{previous:{x:0,y:0}}}}; -Entry.skeleton.basic_double_loop={path:function(a){var b=a.contentWidth,c=a.contentHeight%1E3,d=Math.floor(a.contentHeight/1E3),c=Math.max(30,c+2),d=Math.max(30,d+2),b=Math.max(0,b+5-c/2),e=a._statements;a=e[0]?e[0].height:20;e=e[1]?e[1].height:20;a=Math.max(a,20);e=Math.max(e,20);return"m -8,0 l 8,8 8,-8 h %w a %h1,%h1 0 0,1 0,%wh1 H 24 l -8,8 -8,-8 h -0.4 v %sh1 h 0.4 l 8,8 8,-8 h %bw a %h2,%h2 0 0,1 0,%wh2 H 24 l -8,8 -8,-8 h -0.4 v %sh2 h 0.4 l 8,8 8,-8 h %bw a 8,8 0 0,1 0,16 H 8 l -8,8 -8,-8 z".replace(/%wh1/gi, -c).replace(/%wh2/gi,d).replace(/%w/gi,b).replace(/%bw/gi,b-8).replace(/%h1/gi,c/2).replace(/%h2/gi,d/2).replace(/%sh1/gi,a+1).replace(/%sh2/gi,e+1)},magnets:function(a){var b=Math.max(a.contentHeight%1E3+2,30),c=Math.max(Math.floor(a.contentHeight/1E3)+2,30),d=a._statements[0]?a._statements[0].height:20,e=a._statements[1]?a._statements[1].height:20,d=Math.max(d,20),e=Math.max(e,20);return{previous:{x:0,y:0},next:{x:0,y:d+e+b+c+19+a.offsetY}}},box:function(a){var b=a.contentWidth,c=Math.max(Math.floor(a.contentHeight/ -1E3)+2,30),d=Math.max(a.contentHeight%1E3+2,30),e=a._statements[0]?a._statements[0].height%1E3:20;a=a._statements[1]?a._statements[1].height:20;e=Math.max(e,20);a=Math.max(a,20);return{offsetX:-8,offsetY:0,width:b+30,height:c+d+e+a+17,marginBottom:0}},statementPos:function(a){var b=Math.max(30,a.contentHeight%1E3+2)+1;return[{x:16,y:b},{x:16,y:b+Math.max(a._statements[0]?a._statements[0].height%1E3:20,20)+Math.max(Math.floor(a.contentHeight/1E3)+2,30)+1}]},contentPos:function(a){return{x:14,y:Math.max(a.contentHeight% -1E3,28)/2+1}}};Entry.Block=function(a,b){var c=this;Entry.Model(this,!1);this._schema=null;this.setThread(b);this.load(a);a=this.getCode();a.registerBlock(this);(b=this.events.dataAdd)&&a.object&&b.forEach(function(b){Entry.Utils.isFunction(b)&&b(c)})};Entry.Block.MAGNET_RANGE=10;Entry.Block.MAGNET_OFFSET=.4;Entry.Block.DELETABLE_TRUE=1;Entry.Block.DELETABLE_FALSE=2;Entry.Block.DELETABLE_FALSE_LIGHTEN=3; +Entry.skeleton.basic_double_loop={path:function(a){var b=a.contentWidth,c=a.contentHeight%1E6,d=Math.floor(a.contentHeight/1E6),c=Math.max(30,c+2),d=Math.max(30,d+2),b=Math.max(0,b+5-c/2),e=a._statements;a=e[0]?e[0].height:20;e=e[1]?e[1].height:20;a=Math.max(a,20);e=Math.max(e,20);return"m -8,0 l 8,8 8,-8 h %w a %h1,%h1 0 0,1 0,%wh1 H 24 l -8,8 -8,-8 h -0.4 v %sh1 h 0.4 l 8,8 8,-8 h %bw a %h2,%h2 0 0,1 0,%wh2 H 24 l -8,8 -8,-8 h -0.4 v %sh2 h 0.4 l 8,8 8,-8 h %bw a 8,8 0 0,1 0,16 H 8 l -8,8 -8,-8 z".replace(/%wh1/gi, +c).replace(/%wh2/gi,d).replace(/%w/gi,b).replace(/%bw/gi,b-8).replace(/%h1/gi,c/2).replace(/%h2/gi,d/2).replace(/%sh1/gi,a+1).replace(/%sh2/gi,e+1)},magnets:function(a){var b=Math.max(a.contentHeight%1E6+2,30),c=Math.max(Math.floor(a.contentHeight/1E6)+2,30),d=a._statements[0]?a._statements[0].height:20,e=a._statements[1]?a._statements[1].height:20,d=Math.max(d,20),e=Math.max(e,20);return{previous:{x:0,y:0},next:{x:0,y:d+e+b+c+19+a.offsetY}}},box:function(a){var b=a.contentWidth,c=Math.max(Math.floor(a.contentHeight/ +1E6)+2,30),d=Math.max(a.contentHeight%1E6+2,30),e=a._statements[0]?a._statements[0].height%1E6:20;a=a._statements[1]?a._statements[1].height:20;e=Math.max(e,20);a=Math.max(a,20);return{offsetX:-8,offsetY:0,width:b+30,height:c+d+e+a+17,marginBottom:0}},statementPos:function(a){var b=Math.max(30,a.contentHeight%1E6+2)+1;return[{x:16,y:b},{x:16,y:b+Math.max(a._statements[0]?a._statements[0].height%1E6:20,20)+Math.max(Math.floor(a.contentHeight/1E6)+2,30)+1}]},contentPos:function(a){return{x:14,y:Math.max(a.contentHeight% +1E6,28)/2+1}}};Entry.Block=function(a,b){var c=this;Entry.Model(this,!1);this._schema=null;this.setThread(b);this.load(a);a=this.getCode();a.registerBlock(this);(b=this.events.dataAdd)&&a.object&&b.forEach(function(b){Entry.Utils.isFunction(b)&&b(c)})};Entry.Block.MAGNET_RANGE=10;Entry.Block.MAGNET_OFFSET=.4;Entry.Block.DELETABLE_TRUE=1;Entry.Block.DELETABLE_FALSE=2;Entry.Block.DELETABLE_FALSE_LIGHTEN=3; (function(a){a.schema={id:null,x:0,y:0,type:null,params:[],statements:[],view:null,thread:null,movable:null,deletable:Entry.Block.DELETABLE_TRUE,readOnly:null,copyable:!0,events:{}};a.load=function(b){b.id||(b.id=Entry.Utils.generateId());this.set(b);this.loadSchema()};a.changeSchema=function(b){this.set({params:[]});this.loadSchema()};a.getSchema=function(){this._schema||this.loadSchema();return this._schema};a.loadSchema=function(){if(this._schema=Entry.block[this.type]){!this._schemaChangeEvent&& this._schema.changeEvent&&(this._schemaChangeEvent=this._schema.changeEvent.attach(this,this.changeSchema));var b=this._schema.events;if(b)for(var a in b){this.events[a]||(this.events[a]=[]);for(var d=b[a],e=0;ethis.events[a].indexOf(f)&&this.events[a].push(f)}}this._schema.event&&this.thread.registerEvent(this,this._schema.event);b=this.params;a=this._schema.params;for(e=0;a&&eb){var f=a;a=b;b=f}c=(b-a)/(e-d)*(c-d);c+=a;c=Math.min(b,c);c=Math.max(a,c);return Math.round(c)}},cobl_read_ultrason:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"1. \ucd08\uc74c\ud30c\uac70\ub9ac(0~400)",def:{type:"cobl_read_ultrason"},class:"test",func:function(a,b){return Entry.hw.getAnalogPortValue("ultrason")}},cobl_read_potenmeter:{color:"#00979D",fontColor:"#fff", -skeleton:"basic_string_field",template:"2.\uac00\ubcc0\uc800\ud56d(0~1023)",def:{type:"cobl_read_potenmeter"},class:"test",func:function(a,b){console.log("cobl_read_potenmeter");return Entry.hw.getAnalogPortValue("potenmeter")}},cobl_read_irread1:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"3.\uc801\uc678\uc120\uc13c\uc11c1(0~1023)",def:{type:"cobl_read_irread1"},class:"test",func:function(a,b){return Entry.hw.getAnalogPortValue("potenmeter")}},cobl_read_irread2:{color:"#00979D", -fontColor:"#fff",skeleton:"basic_string_field",template:"4.\uc801\uc678\uc120\uc13c\uc11c2(0~1023)",def:{type:"cobl_read_irread2"},class:"test",func:function(a,b){b.getValue("irread2",b);return Entry.hw.getAnalogPortValue("irread2")}},cobl_read_joyx:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"5.\uc870\uc774\uc2a4\ud2f1X\ucd95(1, 0, -1)",def:{type:"cobl_read_joyx"},class:"test",func:function(a,b){return Entry.hw.getAnalogPortValue("joyx")}},cobl_read_joyy:{color:"#00979D", -fontColor:"#fff",skeleton:"basic_string_field",template:"6.\uc870\uc774\uc2a4\ud2f1Y\ucd95(1, 0, -1)",def:{type:"cobl_read_joyy"},class:"test",func:function(a,b){return Entry.hw.getAnalogPortValue("joyy")}},cobl_read_tilt:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"7.\uae30\uc6b8\uae30\uc13c\uc11c(0~4)",def:{type:"cobl_read_tilt"},class:"test",func:function(a,b){return Entry.hw.getAnalogPortValue("tilt")}},cobl_read_temps:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field", -template:"8.\uc628\ub3c4\uc13c\uc11c@\ud3ec\ud2b8%1",params:[{type:"Dropdown",options:[["1","1"],["2","2"]],fontSize:11}],def:{params:["1"],type:"cobl_read_temps"},paramsKeyMap:{VALUE:0},class:"test",func:function(a,b){a=b.getValue("VALUE",b);if(1==a)return Entry.hw.getAnalogPortValue("temps1");if(2==a)return Entry.hw.getAnalogPortValue("temps2")}},cobl_read_light:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"9.\ube5b\uc13c\uc11c@\ud3ec\ud2b8%1",params:[{type:"Dropdown", -options:[["1","1"],["2","2"]],fontSize:11}],def:{params:["1"],type:"cobl_read_light"},paramsKeyMap:{VALUE:0},class:"test",func:function(a,b){a=b.getValue("VALUE",b);if(1==a)return Entry.hw.getAnalogPortValue("light1");if(2==a)return Entry.hw.getAnalogPortValue("light2")}},cobl_read_btn:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",template:"10.\ubc84\ud2bc\uc2a4\uc704\uce58@\ud3ec\ud2b8%1",params:[{type:"Dropdown",options:[["1","1"],["2","2"]],fontSize:11}],def:{params:["1"],type:"cobl_read_btn"}, -paramsKeyMap:{VALUE:0},class:"test",func:function(a,b){a=b.getValue("VALUE",b);if(1==a)return Entry.hw.getDigitalPortValue("btn1");if(2==a)return Entry.hw.getDigitalPortValue("btn2")}},cobl_led_control:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"11.\ubb34\uc9c0\uac1cLED%1%2",params:[{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"]],fontSize:11},{type:"Dropdown",options:[["OFF","OFF"],["Red","Red"],["Orange","Orange"],["Yellow","Yellow"],["Green","Green"],["Blue","Blue"],["Dark Blue", -"Dark Blue"],["Purple","Purple"],["White","White"]],fontSize:11}],def:{params:["1","OFF"],type:"cobl_led_control"},paramsKeyMap:{PORT:0,OPERATOR:0},class:"test",func:function(a,b){a=b.getStringField("PORT");var c=b.getStringField("OPERATOR");Entry.hw.setDigitalPortValue("RainBowLED_IDX",a);Entry.hw.setDigitalPortValue("RainBowLED_COL",c);return b.callReturn()}},cobl_servo_angle_control:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"12.\uac01\ub3c4\ubaa8\ud130 \uac01\ub3c4%1(15~165)", -params:[{type:"TextInput",value:0}],def:{type:"cobl_servo_angle_control"},paramsKeyMap:{VALUE:0},class:"test",func:function(a,b){PORT=1;console.log("servo - test");a=b.getNumberValue("PORT");var c=b.getNumberValue("VALUE"),c=Math.round(c),c=Math.max(c,15),c=Math.min(c,165);1==a&&(console.log("servo 1 degree "+c),Entry.hw.setDigitalPortValue("Servo1",c));2==a&&(console.log("servo 2 degree "+c),Entry.hw.setDigitalPortValue("Servo2",c));return b.callReturn()}},cobl_melody:{color:"#00979D",fontColor:"#fff", -skeleton:"basic",template:"13.\uba5c\ub85c\ub514%1",params:[{type:"Dropdown",options:[["(Low)So","L_So"],["(Low)So#","L_So#"],["(Low)La","L_La"],["(Low)La#","L_La#"],["(Low)Ti","L_Ti"],["Do","Do"],["Do#","Do#"],["Re","Re"],["Re#","Re#"],["Mi","Mi"],["Fa","Fa"],["Fa#","Fa#"],["So","So"],["So#","So#"],["La","La"],["La#","La#"],["Ti","Ti"],["(High)Do","H_Do"],["(High)Do#","H_Do#"],["(High)Re","H_Re"],["(High)R2#","H_Re#"],["(High)Mi","H_Mi"],["(High)Fa","H_Fa"]],fontSize:11}],def:{params:["Do"],type:"cobl_melody"}, -paramsKeyMap:{MELODY:0},class:"test",func:function(a,b){a=b.getStringField("MELODY");console.log("cobl_melody"+a);Entry.hw.setDigitalPortValue("Melody",a);return b.callReturn()}},cobl_dcmotor:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"14.\ud68c\uc804\ubaa8\ud130%1%2\uc18d\ub3c4%3",params:[{type:"Dropdown",options:[["1","1"],["2","2"]],fontSize:11},{type:"Dropdown",options:[["1.Clockwise","1"],["2.Counter Clockwise","2"],["3.Stop","3"]],fontSize:11},{type:"Dropdown",options:[["1", -"1"],["2","2"],["3","3"],["4","4"],["5","5"]],fontSize:11}],def:{params:["1","1","1"],type:"cobl_dcmotor"},paramsKeyMap:{MOTOR:0,DIRECTION:0,SPEED:0},class:"test",func:function(a,b){a=b.getStringField("MOTOR");var c=b.getStringField("DIRECTION"),d=b.getStringField("SPEED");console.log("MOTOR"+a+" Direction"+c+" speed"+d);1==a&&(Entry.hw.setDigitalPortValue("DC1_DIR",c),Entry.hw.setDigitalPortValue("DC1_SPEED",d));2==a&&(Entry.hw.setDigitalPortValue("DC2_DIR",c),Entry.hw.setDigitalPortValue("DC2_SPEED", -d));return b.callReturn()}},cobl_extention_port:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"15.USB\ud3ec\ud2b8%1\ub2e8\uacc4%2",params:[{type:"Dropdown",options:[["1","1"],["2","2"]],fontSize:11},{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"],["4","4"],["5","5"]],fontSize:11}],def:{params:["1","1"],type:"cobl_extention_port"},paramsKeyMap:{PORT:0,LEVEL:0},class:"test",func:function(a,b){a=b.getStringField("PORT");var c=b.getStringField("LEVEL");1==a&&Entry.hw.setDigitalPortValue("EXUSB1", -c);2==a&&Entry.hw.setDigitalPortValue("EXUSB2",c);return b.callReturn()}},cobl_external_led:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"16.\uc678\ubd80LED%1(1~64)R%2G%3B%4",params:[{type:"TextInput",value:0,fontSize:11},{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"]],fontSize:11},{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10", -"10"]],fontSize:11},{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"]],fontSize:11}],def:{params:["1","1","1","1"],type:"cobl_external_led"},paramsKeyMap:{LED:0,RED:0,GREEN:0,BLUE:0},class:"test",func:function(a,b){a=b.getNumberValue("LED");var c=b.getStringField("RED"),d=b.getStringField("GREEN"),e=b.getStringField("BLUE");Entry.hw.setDigitalPortValue("ELED_IDX",a);Entry.hw.setDigitalPortValue("ELED_R",c);Entry.hw.setDigitalPortValue("ELED_G", -d);Entry.hw.setDigitalPortValue("ELED_B",e);return b.callReturn()}},cobl_7_segment:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"17.\uc22b\uc790\uc804\uad11\ud310%1(0~9999)",params:[{type:"TextInput",value:0,color:"#fff"}],def:{type:"cobl_7_segment"},paramsKeyMap:{VALUE:0},class:"test",func:function(a,b){a=b.getNumberValue("VALUE");Entry.hw.setDigitalPortValue("7SEG",a);return b.callReturn()}},start_drawing:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png", -size:12}],events:{},def:{params:[null],type:"start_drawing"},"class":"brush_control",isNotFor:["textBox"],func:function(a,b){a.brush?a.brush.stop=!1:Entry.setBasicBrush(a);Entry.stage.sortZorder();a.brush.moveTo(a.getX(),-1*a.getY());return b.callReturn()}},stop_drawing:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"stop_drawing"},"class":"brush_control",isNotFor:["textBox"],func:function(a,b){a.brush&& -a.shape&&(a.brush.stop=!0);return b.callReturn()}},set_color:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Color"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"set_color"},paramsKeyMap:{VALUE:0},"class":"brush_color",isNotFor:["textBox"],func:function(a,b){var c=b.getField("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(c=Entry.hex2rgb(c),a.brush.rgb=c,a.brush.endStroke(),a.brush.beginStroke("rgba("+c.r+","+c.g+ -","+c.b+","+a.brush.opacity/100+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}},set_random_color:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"set_random_color"},"class":"brush_color",isNotFor:["textBox"],func:function(a,b){a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);if(a.brush){var c=Entry.generateRgb();a.brush.rgb=c;a.brush.endStroke();a.brush.beginStroke("rgba("+c.r+","+ -c.g+","+c.b+","+a.brush.opacity/100+")");a.brush.moveTo(a.getX(),-1*a.getY())}return b.callReturn()}},change_thickness:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["1"]},null],type:"change_thickness"},paramsKeyMap:{VALUE:0},"class":"brush_thickness",isNotFor:["textBox"],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a), -a.brush.stop=!0);a.brush&&(a.brush.thickness+=c,1>a.brush.thickness&&(a.brush.thickness=1),a.brush.setStrokeStyle(a.brush.thickness),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}},set_thickness:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["1"]},null],type:"set_thickness"},paramsKeyMap:{VALUE:0},"class":"brush_thickness",isNotFor:["textBox"], -func:function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(a.brush.thickness=c,a.brush.setStrokeStyle(a.brush.thickness),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}},change_opacity:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_opacity"},paramsKeyMap:{VALUE:0}, -"class":"brush_opacity",isNotFor:["textBox"],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);c=Entry.adjustValueWithMaxMin(a.brush.opacity+c,0,100);a.brush&&(a.brush.opacity=c,a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}},set_opacity:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"}, -{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["50"]},null],type:"set_opacity"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(a.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")"),a.brush.moveTo(a.getX(), --1*a.getY()));return b.callReturn()}},brush_erase_all:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"brush_erase_all"},"class":"brush_clear",isNotFor:["textBox"],func:function(a,b){var c=a.brush;if(c){var d=c._stroke.style,e=c._strokeStyle.width;c.clear().setStrokeStyle(e).beginStroke(d);c.moveTo(a.getX(),-1*a.getY())}a=a.parent.getStampEntities();a.map(function(b){b.removeClone()});a=null;return b.callReturn()}}, -brush_stamp:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"brush_stamp"},"class":"stamp",isNotFor:["textBox"],func:function(a,b){a.parent.addStampEntity(a);return b.callReturn()}},change_brush_transparency:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]}, -null],type:"change_brush_transparency"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);c=Entry.adjustValueWithMaxMin(a.brush.opacity-c,0,100);a.brush&&(a.brush.opacity=c,a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}},set_brush_tranparency:{color:"#FF9E20", -skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["50"]},null],type:"set_brush_tranparency"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(a.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+ -c.r+","+c.g+","+c.b+","+(1-a.brush.opacity/100)+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}},number:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"TextInput",value:10}],events:{},def:{params:[]},paramsKeyMap:{NUM:0},func:function(a,b){return b.getField("NUM",b)},isPrimitive:!0},angle:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Angle"}],events:{},def:{params:[null],type:"angle"},paramsKeyMap:{ANGLE:0},func:function(a, -b){return b.getNumberField("ANGLE")}},get_x_coordinate:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_x_coordinate,color:"#3D3D3D"}],events:{},def:{params:[null],type:"get_x_coordinate"},"class":"calc",isNotFor:[],func:function(a,b){return a.getX()}},get_y_coordinate:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_y_coordinate,color:"#3D3D3D"}],events:{},def:{params:[null],type:"get_y_coordinate"}, -"class":"calc",isNotFor:[],func:function(a,b){return a.getY()}},get_angle:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_angle,color:"#3D3D3D"}],events:{},def:{params:[null]},func:function(a,b){return parseFloat(a.getRotation().toFixed(1))}},get_rotation_direction:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CALC_rotation_value,"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(a,b){return"DIRECTION"==b.getField("OPERATOR",b).toUpperCase()?parseFloat(a.getDirection().toFixed(1)):parseFloat(a.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(a,b){b=b.getField("VALUE",b);if("mouse"==b)return b=Entry.stage.mouseCoordinate,Math.sqrt(Math.pow(a.getX()-b.x,2)+Math.pow(a.getY()-b.y,2));b=Entry.container.getEntity(b);return Math.sqrt(Math.pow(a.getX()-b.getX(),2)+Math.pow(a.getY()- -b.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(a,b){return"x"===b.getField("VALUE", -b)?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(a,b){var c=b.getField("VALUE", -b);a="self"==c?a:Entry.container.getEntity(c);switch(b.getField("COORDINATE",b)){case "x":return a.getX();case "y":return a.getY();case "rotation":return a.getRotation();case "direction":return a.getDirection();case "picture_index":return b=a.parent,b=b.pictures,b.indexOf(a.picture)+1;case "size":return Number(a.getSize().toFixed(1));case "picture_name":return b=a.parent,b=b.pictures,b[b.indexOf(a.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(a,b){a=b.getField("OPERATOR",b);var c=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return"PLUS"==a?c+b:"MINUS"==a?c-b:"MULTI"==a?c*b:c/b}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a+b}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a-b}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a*b}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a/b}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a%b}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return Math.floor(a/b)}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getField("VALUE",b);if(-1<["asin_radian","acos_radian"].indexOf(b)&&(1a))throw Error("x range exceeded");b.indexOf("_")&&(b=b.split("_")[0]);-1<["sin","cos","tan"].indexOf(b)&&(a=Entry.toRadian(a));switch(b){case "square":b=a*a;break;case "factorial":b=Entry.factorial(a);break;case "root":b=Math.sqrt(a);break;case "log":b=Math.log(a)/Math.LN10;break;case "ln":b=Math.log(a);break; -case "asin":case "acos":case "atan":b=Entry.toDegrees(Math[b](a));break;case "unnatural":b=a-Math.floor(a);0>a&&(b=1-b);break;default:b=Math[b](a)}return Math.round(1E3*b)/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,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_rand_3,color:"#3D3D3D"}], -events:{},def:{params:[null,{type:"number",params:["0"]},null,{type:"number",params:["10"]},null],type:"calc_rand"},paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3},"class":"calc",isNotFor:[],func:function(a,b){a=b.getStringValue("LEFTHAND",b);b=b.getStringValue("RIGHTHAND",b);var c=Math.min(a,b),d=Math.max(a,b);a=Entry.isFloat(a);return Entry.isFloat(b)||a?(Math.random()*(d-c)+c).toFixed(2):Math.floor(Math.random()*(d-c+1)+c)}},get_date:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text", -text:Lang.Blocks.CALC_get_date_1,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_get_date_year,"YEAR"],[Lang.Blocks.CALC_get_date_month,"MONTH"],[Lang.Blocks.CALC_get_date_day,"DAY"],[Lang.Blocks.CALC_get_date_hour,"HOUR"],[Lang.Blocks.CALC_get_date_minute,"MINUTE"],[Lang.Blocks.CALC_get_date_second,"SECOND"]],value:"YEAR",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_get_date_2,color:"#3D3D3D"}],events:{},def:{params:[null,"YEAR",null],type:"get_date"}, -paramsKeyMap:{VALUE:1},"class":"calc_date",isNotFor:[],func:function(a,b){a=b.getField("VALUE",b);b=new Date;return"YEAR"==a?b.getFullYear():"MONTH"==a?b.getMonth()+1:"DAY"==a?b.getDate():"HOUR"==a?b.getHours():"MINUTE"==a?b.getMinutes():b.getSeconds()}},get_sound_duration:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_sound_duration_1,color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"sounds",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}, -{type:"Text",text:Lang.Blocks.CALC_get_sound_duration_2,color:"#3D3D3D"}],events:{},def:{params:[null,null,null],type:"get_sound_duration"},paramsKeyMap:{VALUE:1},"class":"calc_duration",isNotFor:[],func:function(a,b){b=b.getField("VALUE",b);a=a.parent.sounds;for(var c=0;cb||b>a.length-1)throw Error();return a[b]}}, -length_of_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_length_of_string_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_length_of_string_2,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.entry]},null],type:"length_of_string"},paramsKeyMap:{STRING:1},"class":"calc_string",isNotFor:[],func:function(a,b){return b.getStringValue("STRING",b).length}},substring:{color:"#FFD974", -skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_substring_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_substring_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_substring_3,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_substring_4,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"number",params:["2"]}, -null,{type:"number",params:["5"]},null],type:"substring"},paramsKeyMap:{STRING:1,START:3,END:5},"class":"calc_string",isNotFor:[],func:function(a,b){a=b.getStringValue("STRING",b);var c=b.getNumberValue("START",b)-1;b=b.getNumberValue("END",b)-1;var d=a.length-1;if(0>c||0>b||c>d||b>d)throw Error();return a.substring(Math.min(c,b),Math.max(c,b)+1)}},replace_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_replace_string_1,color:"#3D3D3D"}, -{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_3,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_4,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"text",params:[Lang.Blocks.hello]},null,{type:"text",params:[Lang.Blocks.nice]},null],type:"replace_string"},paramsKeyMap:{STRING:1, -OLD_WORD:3,NEW_WORD:5},"class":"calc_string",isNotFor:[],func:function(a,b){return b.getStringValue("STRING",b).replace(new RegExp(b.getStringValue("OLD_WORD",b),"gm"),b.getStringValue("NEW_WORD",b))}},change_string_case:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_change_string_case_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_change_string_case_2,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_change_string_case_sub_1, -"toUpperCase"],[Lang.Blocks.CALC_change_string_case_sub_2,"toLowerCase"]],value:"toUpperCase",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_change_string_case_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:["Hello Entry!"]},null,null,null],type:"change_string_case"},paramsKeyMap:{STRING:1,CASE:3},"class":"calc_string",isNotFor:[],func:function(a,b){return b.getStringValue("STRING",b)[b.getField("CASE",b)]()}},index_of_string:{color:"#FFD974", -skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_index_of_string_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_index_of_string_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_index_of_string_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"text",params:[Lang.Blocks.entry]},null],type:"index_of_string"},paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3}, -"class":"calc_string",isNotFor:[],func:function(a,b){a=b.getStringValue("LEFTHAND",b);b=b.getStringValue("RIGHTHAND",b);b=a.indexOf(b);return-1a)throw Error(Lang.Blocks.FLOW_repeat_basic_errorMsg);b.iterCount=Math.floor(a)}if(0==b.iterCount||0>b.iterCount)return delete b.isLooped, -delete b.iterCount,b.callReturn();b.iterCount--;return b.getStatement("DO",b)}},repeat_inf:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null],type:"repeat_inf"},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(a,b){b.isLooped=!0;return b.getStatement("DO")}},stop_repeat:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png", -size:12}],events:{},def:{params:[null],type:"stop_repeat"},"class":"repeat",isNotFor:[],func:function(a,b){return this.executor.breakLoop()}},wait_until_true:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"},null],type:"wait_until_true"},paramsKeyMap:{BOOL:0},"class":"wait",isNotFor:[],func:function(a,b){return b.getBooleanValue("BOOL",b)?b.callReturn():b}},_if:{color:"#498deb", -skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"},null],type:"_if"},paramsKeyMap:{BOOL:0},statementsKeyMap:{STACK:0},"class":"condition",isNotFor:[],func:function(a,b){return b.isCondition?(delete b.isCondition,b.callReturn()):b.getBooleanValue("BOOL",b)?(b.isCondition=!0,b.getStatement("STACK",b)):b.callReturn()}},if_else:{color:"#498deb",skeleton:"basic_double_loop", -statements:[{accept:"basic"},{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12},{type:"LineBreak"}],events:{},def:{params:[{type:"True"},null],type:"if_else"},paramsKeyMap:{BOOL:0},statementsKeyMap:{STACK_IF:0,STACK_ELSE:1},"class":"condition",isNotFor:[],func:function(a,b){if(b.isCondition)return delete b.isCondition,b.callReturn();a=b.getBooleanValue("BOOL",b);b.isCondition=!0;return a?b.getStatement("STACK_IF",b):b.getStatement("STACK_ELSE", -b)}},create_clone:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"clone",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null,null],type:"create_clone"},paramsKeyMap:{VALUE:0},"class":"clone",isNotFor:[],func:function(a,b){var c=b.getField("VALUE",b);b=b.callReturn();"self"==c?a.parent.addCloneEntity(a.parent,a,null):Entry.container.getObject(c).addCloneEntity(a.parent, -null,null);return b}},delete_clone:{color:"#498deb",skeleton:"basic_without_next",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null],type:"delete_clone"},"class":"clone",isNotFor:[],func:function(a,b){if(!a.isClone)return b.callReturn();a.removeClone();return this.die()}},when_clone_start:{color:"#498deb",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_clone.png",size:17,position:{x:0,y:-2}}],events:{}, -def:{params:[null],type:"when_clone_start"},"class":"clone",isNotFor:[],func:function(a,b){return b.callReturn()},event:"when_clone_start"},stop_run:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null]},func:function(a,b){return Entry.engine.toggleStop()}},repeat_while_true:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Dropdown",options:[[Lang.Blocks.FLOW_repeat_while_true_until, -"until"],[Lang.Blocks.FLOW_repeat_while_true_while,"while"]],value:"until",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"},null,null],type:"repeat_while_true"},paramsKeyMap:{BOOL:0,OPTION:1},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(a,b){a=b.getBooleanValue("BOOL",b);"until"==b.getField("OPTION",b)&&(a=!a);return(b.isLooped=a)?b.getStatement("DO",b):b.callReturn()}},stop_object:{color:"#498deb", -skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.FLOW_stop_object_all,"all"],[Lang.Blocks.FLOW_stop_object_this_object,"thisOnly"],[Lang.Blocks.FLOW_stop_object_this_thread,"thisThread"],[Lang.Blocks.FLOW_stop_object_other_thread,"otherThread"]],value:"all",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null,null],type:"stop_object"},paramsKeyMap:{TARGET:0},"class":"terminate",isNotFor:[], -func:function(a,b){var c=b.getField("TARGET",b),d=Entry.container;switch(c){case "all":return d.clearRunningState(),this.die();case "thisOnly":return a.parent.script.clearExecutorsByEntity(a),this.die();case "thisObject":return a.parent.script.clearExecutors(),this.die();case "thisThread":return this.die();case "otherThread":c=this.executor;a=a.parent.script;for(var d=a.executors,e=0;eb.count?(50>c.leftFloor&&50>c.rightFloor? -b.count++:b.count=0,c=c.leftFloor-c.rightFloor,a.leftWheel=45+.25*c,a.rightWheel=45-.25*c):(b.count=0,b.boardState=2);break;case 2:c=c.leftFloor-c.rightFloor;a.leftWheel=45+.25*c;a.rightWheel=45-.25*c;b.boardState=3;var d=setTimeout(function(){b.boardState=4;Entry.Hamster.removeTimeout(d)},250);Entry.Hamster.timeouts.push(d);break;case 3:c=c.leftFloor-c.rightFloor;a.leftWheel=45+.25*c;a.rightWheel=45-.25*c;break;case 4:a.leftWheel=0,a.rightWheel=0,b.boardState=0,b.isMoving=!1}return b}delete b.isStart; -delete b.isMoving;delete b.count;delete b.boardState;Entry.engine.isContinue=!1;a.leftWheel=0;a.rightWheel=0;return b.callReturn()}b.isStart=!0;b.isMoving=!0;b.count=0;b.boardState=1;a.leftWheel=45;a.rightWheel=45;Entry.Hamster.setLineTracerMode(a,0);return b}},hamster_turn_once:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}], -events:{},def:{params:[null,null],type:"hamster_turn_once"},paramsKeyMap:{DIRECTION:0},"class":"hamster_board",isNotFor:["hamster"],func:function(a,b){a=Entry.hw.sendQueue;var c=Entry.hw.portData;if(b.isStart){if(b.isMoving){if(b.isLeft)switch(b.boardState){case 1:2>b.count?50c.leftFloor&&(b.boardState=3);break;case 3:2>b.count?20>c.leftFloor&&b.count++:(b.count=0,b.boardState=4);break;case 4:50b.count?50c.rightFloor&&(b.boardState=3);break;case 3:2>b.count?20>c.rightFloor&&b.count++:(b.count=0,b.boardState=4);break;case 4:50Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return b.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(a,b){Entry.Hamster.tempo=b.getNumberValue("VALUE");1>Entry.Hamster.tempo&& -(Entry.Hamster.tempo=1);return b.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(a,b){a=Entry.hw.sendQueue;var c=b.getField("PORT",b),d=Number(b.getField("MODE",b));"A"==c?a.ioModeA=d:("B"!=c&&(a.ioModeA=d),a.ioModeB=d);return b.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(a,b){a=Entry.hw.sendQueue;var c=b.getField("PORT"),d=b.getNumberValue("VALUE");"A"==c?a.outputA=void 0!=a.outputA?a.outputA+d:d:("B"!= -c&&(a.outputA=void 0!=a.outputA?a.outputA+d:d),a.outputB=void 0!=a.outputB?a.outputB+d:d);return b.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(a,b){a=Entry.hw.sendQueue;var c=b.getField("PORT"),d=b.getNumberValue("VALUE");"A"==c?a.outputA=d:("B"!=c&&(a.outputA=d),a.outputB=d);return b.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(a,b){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(a,b){a=Number(b.getField("VALUE",b));return 0<=Entry.pressedKeys.indexOf(a)}},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(a,b){if(!a.getVisible())return!1;var c=b.getField("VALUE",b);b=a.object;var d=/wall/.test(c),e=ndgmr.checkPixelCollision; -if(d)switch(a=Entry.stage.wall,c){case "wall":if(e(b,a.up,.2,!0)||e(b,a.down,.2,!0)||e(b,a.left,.2,!0)||e(b,a.right,.2,!0))return!0;break;case "wall_up":if(e(b,a.up,.2,!0))return!0;break;case "wall_down":if(e(b,a.down,.2,!0))return!0;break;case "wall_right":if(e(b,a.right,.2,!0))return!0;break;case "wall_left":if(e(b,a.left,.2,!0))return!0}else{if("mouse"==c)return e=Entry.stage.canvas,e=b.globalToLocal(e.mouseX,e.mouseY),b.hitTest(e.x,e.y);c=Entry.container.getEntity(c);if("textBox"==c.type||"textBox"== -a.type){e=c.object.getTransformedBounds();b=b.getTransformedBounds();if(Entry.checkCollisionRect(b,e))return!0;a=c.parent.clonedEntities;c=0;for(d=a.length;c","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(a,b){a=b.getField("OPERATOR",b);var c=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return"EQUAL"==a?c==b:"BIGGER"==a?c>b:c",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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a>b}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a","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(a,b){a=b.getField("OPERATOR",b);var c=b.getStringValue("LEFTHAND",b);b=b.getStringValue("RIGHTHAND",b);switch(a){case "EQUAL":return c==b;case "GREATER":return Number(c)>Number(b);case "LESS":return Number(c)=Number(b);case "LESS_OR_EQUAL":return Number(c)<=Number(b)}}},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(a,b){a.setVisible(!0);return b.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(a,b){a.setVisible(!1);return b.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(a,b){if(!b.isStart){var c=b.getNumberValue("SECOND",b),d=b.getStringValue("VALUE",b),e=b.getField("OPTION",b);b.isStart=!0;b.timeFlag=1;d||"number"== -typeof d||(d=" ");d=Entry.convertToRoundedDecimals(d,3);new Entry.Dialog(a,d,e);a.syncDialogVisible(a.getVisible());setTimeout(function(){b.timeFlag=0},1E3*c)}if(0==b.timeFlag)return delete b.timeFlag,delete b.isStart,a.dialog&&a.dialog.remove(),b.callReturn();a.dialog||(d=b.getStringValue("VALUE",b),e=b.getField("OPTION",b),d||"number"==typeof d||(d=" "),d=Entry.convertToRoundedDecimals(d,3),new Entry.Dialog(a,d,e),a.syncDialogVisible(a.getVisible()));return b}},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(a,b){var c=b.getStringValue("VALUE",b);c||"number"==typeof c||(c=" ");var d=b.getField("OPTION", -b),c=Entry.convertToRoundedDecimals(c,3);new Entry.Dialog(a,c,d);a.syncDialogVisible(a.getVisible());return b.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(a,b){a.dialog&&a.dialog.remove();return b.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(a,b){var c=b.getField("VALUE",b),c=a.parent.getPicture(c);a.setImage(c);return b.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(a,b){var c;c="prev"!==b.getStringField("DRIECTION")?a.parent.getNextPicture(a.picture.id):a.parent.getPrevPicture(a.picture.id);a.setImage(c);return b.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(a,b){var c=b.getField("EFFECT",b),d=b.getNumberValue("VALUE",b);"color"==c?a.effect.hue= -d+a.effect.hue:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?a.effect.brightness=d+a.effect.brightness:"blur"!=c&&"opacity"==c&&(a.effect.alpha+=d/100));a.applyFilter();return b.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(a,b){var c=b.getField("EFFECT",b),d=b.getNumberValue("VALUE",b);"color"==c?a.effect.hue=d:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?a.effect.brightness=d:"blur"!=c&&"opacity"==c&&(a.effect.alpha=d/100));a.applyFilter();return b.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(a,b){a.resetFilter();return b.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(a,b){var c=(b.getNumberValue("VALUE",b)+100)/100;a.setScaleX(a.getScaleX()*c);a.setScaleY(a.getScaleY()*c);return b.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(a,b){var c=b.getNumberValue("VALUE", -b)/100,d=a.snapshot_;a.setScaleX(c*d.scaleX);a.setScaleY(c*d.scaleY);return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setSize(a.getSize()+c);return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setSize(c);return b.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(a,b){a.setScaleX(-1*a.getScaleX());return b.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(a,b){a.setScaleY(-1*a.getScaleY());return b.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(a,b){var c=b.getField("VALUE",b);a=Entry.container.getCurrentObjects().indexOf(a.parent);if(-1a)throw Error("object is not available for current scene");switch(d){case "FRONT":c=0;break;case "FORWARD":c=Math.max(0,a-1);break;case "BACKWARD":c=Math.min(e,a+1);break;case "BACK":c=e}Entry.container.moveElementByBlock(a,c);return b.callReturn()}}, -move_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:["10"]},null],type:"move_direction"},paramsKeyMap:{VALUE:0},"class":"walk",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.setX(a.getX()+c*Math.cos((a.getRotation()+a.getDirection()-90)/180*Math.PI));a.setY(a.getY()-c*Math.sin((a.getRotation()+a.getDirection()-90)/180*Math.PI)); -a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}},move_x:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"move_x"},paramsKeyMap:{VALUE:0},"class":"move_relative",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.setX(a.getX()+c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY()); -return b.callReturn()}},move_y:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"move_y"},paramsKeyMap:{VALUE:0},"class":"move_relative",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.setY(a.getY()+c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}},locate_xy_time:{color:"#A751E3",skeleton:"basic", -statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"locate_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_absolute",isNotFor:[],func:function(a,b){function c(){var c=b.x-a.getX(),d=b.y-a.getY(),c=c/b.frameCount,d=d/b.frameCount;a.setX(a.getX()+ -c);a.setY(a.getY()+d);b.frameCount--;a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY())}if(!b.isStart){var d;d=b.getNumberValue("VALUE1",b);b.isStart=!0;b.frameCount=Math.max(Math.floor(d*Entry.FPS),1);b.x=b.getNumberValue("VALUE2",b);b.y=b.getNumberValue("VALUE3",b);1==b.frameCount&&c()}if(0!=b.frameCount)return c(),b;delete b.isStart;delete b.frameCount;return b.callReturn()}},rotate_by_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator", -img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"rotate_by_angle"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.setRotation(a.getRotation()+c);return b.callReturn()}},rotate_by_angle_dropdown:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["45","45"],["90","90"],["135","135"],["180","180"]],value:"45",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png", -size:12}],events:{},def:{params:["45",null],type:"rotate_by_angle_dropdown"},paramsKeyMap:{VALUE:0},"class":"ebs",isNotFor:[],func:function(a,b){var c=b.getField("VALUE",b);a.setRotation(a.getRotation()+Number(c));return b.callReturn()}},see_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"see_angle"},paramsKeyMap:{VALUE:0},"class":"rotate", -isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.setDirection(c);return b.callReturn()}},see_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"sprites",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{VALUE:0},func:function(a,b){var c=b.getField("VALUE",b),d=Entry.container.getEntity(c),c=d.getX()-a.getX(),d=d.getY()-a.getY();0<=c?a.setRotation(Math.atan(d/ -c)/Math.PI*180+90):a.setRotation(Math.atan(d/c)/Math.PI*180+270);return b.callReturn()}},locate_xy:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["0"]},{type:"number",params:["0"]},null],type:"locate_xy"},paramsKeyMap:{VALUE1:0,VALUE2:1},"class":"move_absolute",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE1", -b),d=b.getNumberValue("VALUE2",b);a.setX(c);a.setY(d);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}},locate_x:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_x"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.setX(c);a.brush&& -!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}},locate_y:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_y"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.setY(c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}}, -locate:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"locate"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(a,b){var c=b.getField("VALUE",b),d;"mouse"==c?(c=Entry.stage.mouseCoordinate.x,d=Entry.stage.mouseCoordinate.y):(d=Entry.container.getEntity(c), -c=d.getX(),d=d.getY());a.setX(Number(c));a.setY(Number(d));a.brush&&!a.brush.stop&&a.brush.lineTo(c,-1*d);return b.callReturn()}},move_xy_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"move_xy_time"},paramsKeyMap:{VALUE1:0, -VALUE2:1,VALUE3:2},"class":"move_relative",isNotFor:[],func:function(a,b){function c(){a.setX(a.getX()+b.dX);a.setY(a.getY()+b.dY);b.frameCount--;a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY())}if(!b.isStart){var d;d=b.getNumberValue("VALUE1",b);var e=b.getNumberValue("VALUE2",b),f=b.getNumberValue("VALUE3",b);b.isStart=!0;b.frameCount=Math.max(Math.floor(d*Entry.FPS),1);b.dX=e/b.frameCount;b.dY=f/b.frameCount;1==b.frameCount&&c()}if(0!=b.frameCount)return c(),b;delete b.isStart;delete b.frameCount; -return b.callReturn()}},rotate_by_angle_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Angle"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},null,null],type:"rotate_by_angle_time"},paramsKeyMap:{VALUE:1},"class":"rotate",isNotFor:[],func:function(a,b){if(!b.isStart){var c;c=b.getNumberValue("VALUE",b);var d=b.getNumberField("VALUE",b);b.isStart=!0;b.frameCount=Math.floor(c*Entry.FPS); -b.dAngle=d/b.frameCount}if(0!=b.frameCount)return a.setRotation(a.getRotation()+b.dAngle),b.frameCount--,b;delete b.isStart;delete b.frameCount;return b.callReturn()}},bounce_wall:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null],type:"bounce_wall"},"class":"walk",isNotFor:[],func:function(a,b){var c=a.parent.getRotateMethod(),d="free"==c?(a.getRotation()+a.getDirection()).mod(360):a.getDirection(),e;if(90> -d&&0<=d||360>d&&270<=d){e=a.collision==Entry.Utils.COLLISION.UP;var f=ndgmr.checkPixelCollision(Entry.stage.wall.up,a.object,0,!1);!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE);f&&e&&(f=!1);f?("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+180),a.collision=Entry.Utils.COLLISION.UP):(e=a.collision==Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,a.object,0,!1),!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f= -!1),f&&("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+180),a.collision=Entry.Utils.COLLISION.DOWN))}else 270>d&&90<=d&&(e=a.collision==Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,a.object,0,!1),!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f?("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+180),a.collision=Entry.Utils.COLLISION.DOWN):(e=a.collision== -Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,a.object,0,!1),!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+180),a.collision=Entry.Utils.COLLISION.UP)));360>d&&180<=d?(e=a.collision==Entry.Utils.COLLISION.LEFT,d=ndgmr.checkPixelCollision(Entry.stage.wall.left,a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?a.setRotation(-a.getRotation()- -2*a.getDirection()):a.setDirection(-a.getDirection()+360),a.collision=Entry.Utils.COLLISION.LEFT):(e=a.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()):a.setDirection(-a.getDirection()+360),a.collision=Entry.Utils.COLLISION.RIGHT))):180>d&&0<=d&&(e=a.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right, -a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()):a.setDirection(-a.getDirection()+360),a.collision=Entry.Utils.COLLISION.RIGHT):(e=a.collision==Entry.Utils.COLLISION.LEFT,d=ndgmr.checkPixelCollision(Entry.stage.wall.left,a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()):a.setDirection(-a.getDirection()+360),a.collision= -Entry.Utils.COLLISION.LEFT)));return b.callReturn()}},flip_arrow_horizontal:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null]},func:function(a,b){a.setDirection(a.getDirection()+180);return b.callReturn()}},flip_arrow_vertical:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null]},func:function(a,b){a.setDirection(a.getDirection()+ -180);return b.callReturn()}},see_angle_object:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"see_angle_object"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(a,b){var c=b.getField("VALUE",b),d=a.getX(),e=a.getY();if(a.parent.id==c)return b.callReturn(); -"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?a.getDirection()+a.getRotation():0<=d?-Math.atan(e/d)/Math.PI*180+90:-Math.atan(e/d)/Math.PI*180+270;d=a.getDirection()+a.getRotation();a.setRotation(a.getRotation()+e-d);return b.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(a,b){var c=b.getNumberValue("VALUE",b),d=a.getDirection()+a.getRotation();a.setRotation(a.getRotation()+c-d);return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setDirection(c+a.getDirection());return b.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(a,b){if(!b.isStart){var c,d,e;d=b.getField("TARGET",b);c=b.getNumberValue("VALUE",b);c=Math.floor(c*Entry.FPS);e=Entry.stage.mouseCoordinate;if(0!=c)"mouse"==d?(d=e.x-a.getX(),e=e.y-a.getY()):(e=Entry.container.getEntity(d),d=e.getX()-a.getX(),e=e.getY()-a.getY()),b.isStart=!0,b.frameCount=c,b.dX=d/b.frameCount,b.dY=e/b.frameCount;else return"mouse"==d?(d=Number(e.x), -e=Number(e.y)):(e=Entry.container.getEntity(d),d=e.getX(),e=e.getY()),a.setX(d),a.setY(e),a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY()),b.callReturn()}if(0!=b.frameCount)return a.setX(a.getX()+b.dX),a.setY(a.getY()+b.dY),b.frameCount--,a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY()),b;delete b.isStart;delete b.frameCount;return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setRotation(c);return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setRotation(c+a.getRotation());return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setDirection(c);return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setDirection(c+a.getDirection());return b.callReturn()}},move_to_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"}, -{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},{type:"number",params:["10"]},null],type:"move_to_angle"},paramsKeyMap:{ANGLE:0,VALUE:1},"class":"move_rotate",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b),d=b.getNumberValue("ANGLE",b);a.setX(a.getX()+c*Math.cos((d-90)/180*Math.PI));a.setY(a.getY()-c*Math.sin((d-90)/180*Math.PI));a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}}, -rotate_by_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"angle"},null],type:"rotate_by_time"},paramsKeyMap:{VALUE:0,ANGLE:1},"class":"rotate",isNotFor:[],func:function(a,b){function c(){a.setRotation(a.getRotation()+b.dAngle);b.frameCount--}if(!b.isStart){var d;d=b.getNumberValue("VALUE",b);var e=b.getNumberValue("ANGLE", -b);b.isStart=!0;b.frameCount=Math.max(Math.floor(d*Entry.FPS),1);b.dAngle=e/b.frameCount;1==b.frameCount&&c()}if(0!=b.frameCount)return c(),b;delete b.isStart;delete b.frameCount;return b.callReturn()}},direction_relative_duration:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"text",params:["2"]},{type:"angle"},null],type:"direction_relative_duration"}, -paramsKeyMap:{DURATION:0,AMOUNT:1},"class":"rotate",isNotFor:[],func:function(a,b){function c(){a.setDirection(a.getDirection()+b.dDirection);b.frameCount--}if(!b.isStart){var d;d=b.getNumberValue("DURATION",b);var e=b.getNumberValue("AMOUNT",b);b.isStart=!0;b.frameCount=Math.max(Math.floor(d*Entry.FPS),1);b.dDirection=e/b.frameCount;1==b.frameCount&&c()}if(0!=b.frameCount)return c(),b;delete b.isStart;delete b.frameCount;delete b.dDirection;return b.callReturn()}},neobot_sensor_value:{color:"#00979D", -skeleton:"basic_string_field",fontColor:"#fff",statements:[],template:"%1 \uac12",params:[{type:"Dropdown",options:[["1\ubc88 \ud3ec\ud2b8","IN1"],["2\ubc88 \ud3ec\ud2b8","IN2"],["3\ubc88 \ud3ec\ud2b8","IN3"],["\ub9ac\ubaa8\ucee8","IR"],["\ubc30\ud130\ub9ac","BAT"]],value:"IN1",fontSize:11}],events:{},def:{params:[null],type:"neobot_sensor_value"},paramsKeyMap:{PORT:0},"class":"neobot_value",isNotFor:["neobot"],func:function(a,b){a=b.getStringField("PORT");return Entry.hw.portData[a]}},neobot_sensor_convert_scale:{color:"#00979D", -skeleton:"basic_string_field",fontColor:"#fff",statements:[],template:"%1 \uac12\uc758 \ubc94\uc704\ub97c %2 ~ %3 \uc5d0\uc11c %4 ~ %5 (\uc73c)\ub85c \ubcc0\ud658",params:[{type:"Dropdown",options:[["1\ubc88 \ud3ec\ud2b8","IN1"],["2\ubc88 \ud3ec\ud2b8","IN2"],["3\ubc88 \ud3ec\ud2b8","IN3"],["\ub9ac\ubaa8\ucee8","IR"],["\ubc30\ud130\ub9ac","BAT"]],value:"IN1",fontSize:11},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"}],events:{}, -def:{params:[null,{type:"number",params:["0"]},{type:"number",params:["255"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"neobot_sensor_convert_scale"},paramsKeyMap:{PORT:0,OMIN:1,OMAX:2,MIN:3,MAX:4},"class":"neobot_value",isNotFor:["neobot"],func:function(a,b){a=b.getStringField("PORT");a=Entry.hw.portData[a];var c=b.getNumberValue("OMIN",b),d=b.getNumberValue("OMAX",b),e=b.getNumberValue("MIN",b);b=b.getNumberValue("MAX",b);if(c>d)var f=c,c=d,d=f;e>b&&(f=e,e=b,b=f);a=Math.min(b, -(b-e)/(d-c)*(a-c)+e);a=Math.max(e,a);return Math.round(a)}},neobot_left_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc67c\ucabd \ubaa8\ud130\ub97c %1 %2 \uc758 \uc18d\ub3c4\ub85c \ud68c\uc804 %3",params:[{type:"Dropdown",options:[["\uc55e\uc73c\ub85c","16"],["\ub4a4\ub85c","32"]],value:"16",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{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"],["14","14"],["15","15"]],value:"0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,"15",null],type:"neobot_left_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1},"class":"neobot_motor",isNotFor:["neobot"],func:function(a,b){a=b.getNumberField("SPEED");var c=b.getNumberField("DIRECTION");Entry.hw.sendQueue.DCL=a+c;return b.callReturn()}},neobot_stop_left_motor:{color:"#00979D",skeleton:"basic", -statements:[],template:"\uc67c\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_left_motor"},"class":"neobot_motor",isNotFor:["neobot"],func:function(a,b){Entry.hw.sendQueue.DCL=0;return b.callReturn()}},neobot_right_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubaa8\ud130\ub97c %1 %2 \uc758 \uc18d\ub3c4\ub85c \ud68c\uc804 %3",params:[{type:"Dropdown", -options:[["\uc55e\uc73c\ub85c","16"],["\ub4a4\ub85c","32"]],value:"16",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{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"],["14","14"],["15","15"]],value:"0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,"15",null],type:"neobot_right_motor"}, -paramsKeyMap:{DIRECTION:0,SPEED:1},"class":"neobot_motor",isNotFor:["neobot"],func:function(a,b){a=b.getNumberField("SPEED");var c=b.getNumberField("DIRECTION");Entry.hw.sendQueue.DCR=a+c;return b.callReturn()}},neobot_stop_right_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_right_motor"},"class":"neobot_motor", -isNotFor:["neobot"],func:function(a,b){Entry.hw.sendQueue.DCR=0;return b.callReturn()}},neobot_all_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc591\ucabd \ubaa8\ud130\ub97c %1 %2\uc758 \uc18d\ub3c4\ub85c %3\ucd08 \ub3d9\uc548 \ud68c\uc804 %4",params:[{type:"Dropdown",options:[["\uc55e\uc73c\ub85c","1"],["\ub4a4\ub85c","2"],["\uc81c\uc790\ub9ac\uc5d0\uc11c \uc67c\ucabd \ub3cc\uae30","3"],["\uc81c\uc790\ub9ac\uc5d0\uc11c \uc624\ub978\ucabd \ub3cc\uae30","4"],["\uc67c\ucabd\uc73c\ub85c \ub3cc\uae30", -"5"],["\uc624\ub978\ucabd\uc73c\ub85c \ub3cc\uae30","6"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{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"],["14","14"],["15","15"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:["1","15", -{type:"number",params:["0"]}],type:"neobot_all_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1,DURATION:2},"class":"neobot_motor",isNotFor:["neobot"],func:function(a,b){if(b.isStart){if(1==b.timeFlag)return b;delete b.timeFlag;delete b.isStart;Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR=0;Entry.engine.isContinue=!1;return b.callReturn()}a=b.getNumberField("SPEED");var c=b.getNumberField("DIRECTION"),d=b.getNumberValue("DURATION");0>d&&(d=0);switch(c){case 1:Entry.hw.sendQueue.DCL=16+a;Entry.hw.sendQueue.DCR= -16+a;break;case 2:Entry.hw.sendQueue.DCL=32+a;Entry.hw.sendQueue.DCR=32+a;break;case 3:Entry.hw.sendQueue.DCL=32+a;Entry.hw.sendQueue.DCR=16+a;break;case 4:Entry.hw.sendQueue.DCL=16+a;Entry.hw.sendQueue.DCR=32+a;break;case 5:Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR=16+a;break;case 6:Entry.hw.sendQueue.DCL=16+a,Entry.hw.sendQueue.DCR=0}if(0===d)return b.callReturn();b.isStart=!0;b.timeFlag=1;setTimeout(function(){b.timeFlag=0},1E3*d);return b}},neobot_stop_all_motor:{color:"#00979D",skeleton:"basic", -statements:[],template:"\uc591\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_all_motor"},"class":"neobot_motor",isNotFor:["neobot"],func:function(a,b){Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR=0;return b.callReturn()}},neobot_set_servo:{color:"#00979D",skeleton:"basic",statements:[],template:"%1 \ud3ec\ud2b8\uc758 \uc11c\ubcf4\ubaa8\ud130\ub97c %2 \ub3c4 \uc774\ub3d9 %3",params:[{type:"Dropdown", -options:[["OUT1","1"],["OUT2","2"],["OUT3","3"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"neobot_set_servo"},paramsKeyMap:{PORT:0,DEGREE:1},"class":"neobot_output",isNotFor:["neobot"],func:function(a,b){a=b.getNumberField("PORT");var c=b.getNumberValue("DEGREE");0>c?c=0:180c?c=0:255a.count)throw a.count++,new Entry.Utils.AsyncError;a.isStart=!1;b=Entry.hw.portData[a.data_default_address];a.data_default_address=void 0;return b}},robotis_openCM70_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[], -params:[{type:"Dropdown",options:[[Lang.Blocks.robotis_cm_sound_detected,"CM_SOUND_DETECTED"],[Lang.Blocks.robotis_cm_sound_detecting,"CM_SOUND_DETECTING"],[Lang.Blocks.robotis_cm_user_button,"CM_USER_BUTTON"]],value:"CM_SOUND_DETECTED",fontSize:11}],events:{},def:{params:[null],type:"robotis_openCM70_sensor_value"},paramsKeyMap:{SENSOR:0},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(a,b){a=b.executor.scope;if(!a.isStart){a.isStart=!0;a.count=0;var c=Entry.Robotis_openCM70.INSTRUCTION.READ, -d=0,e=0,f=0,g=0;b=b.getStringField("SENSOR");"CM_SOUND_DETECTED"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1]):"CM_SOUND_DETECTING"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0], -e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1]):"CM_USER_BUTTON"==b&&(f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1]);f+=0*g;Entry.Robotis_carCont.setRobotisData([[c,d,e,0,g]]);Entry.Robotis_carCont.update();a.data_default_address=f;throw new Entry.Utils.AsyncError;}if(2>a.count)throw a.count++,new Entry.Utils.AsyncError; -a.isStart=!1;b=Entry.hw.portData[a.data_default_address];a.data_default_address=void 0;return b}},robotis_openCM70_aux_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["3","PORT_3"],["4","PORT_4"],["5","PORT_5"],["6","PORT_6"]],value:"PORT_3",fontSize:11},{type:"Dropdown",options:[[Lang.Blocks.robotis_aux_servo_position,"AUX_SERVO_POSITION"],[Lang.Blocks.robotis_aux_ir,"AUX_IR"],[Lang.Blocks.robotis_aux_touch,"AUX_TOUCH"], -[Lang.Blocks.robotis_aux_brightness,"AUX_BRIGHTNESS"],[Lang.Blocks.robotis_aux_hydro_themo_humidity,"AUX_HYDRO_THEMO_HUMIDITY"],[Lang.Blocks.robotis_aux_hydro_themo_temper,"AUX_HYDRO_THEMO_TEMPER"],[Lang.Blocks.robotis_aux_temperature,"AUX_TEMPERATURE"],[Lang.Blocks.robotis_aux_ultrasonic,"AUX_ULTRASONIC"],[Lang.Blocks.robotis_aux_magnetic,"AUX_MAGNETIC"],[Lang.Blocks.robotis_aux_motion_detection,"AUX_MOTION_DETECTION"],[Lang.Blocks.robotis_aux_color,"AUX_COLOR"],[Lang.Blocks.robotis_aux_custom,"AUX_CUSTOM"]], -value:"AUX_SERVO_POSITION",fontSize:11}],events:{},def:{params:[null,null],type:"robotis_openCM70_aux_sensor_value"},paramsKeyMap:{PORT:0,SENSOR:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(a,b){a=b.executor.scope;if(!a.isStart){a.isStart=!0;a.count=0;var c=Entry.Robotis_openCM70.INSTRUCTION.READ,d=0,e=0,f=0,g=0,h=b.getStringField("PORT");b=b.getStringField("SENSOR");var k=0;"PORT_3"==h?k=2:"PORT_4"==h?k=3:"PORT_5"==h?k=4:"PORT_6"==h&&(k=5);"AUX_SERVO_POSITION"==b? -(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1]):"AUX_IR"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1]):"AUX_TOUCH"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0], -g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1]):"AUX_TEMPERATURE"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1]):"AUX_BRIGHTNESS"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1], -d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1]):"AUX_HYDRO_THEMO_HUMIDITY"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1]):"AUX_HYDRO_THEMO_TEMPER"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0], -g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1]):"AUX_ULTRASONIC"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1]):"AUX_MAGNETIC"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0], -g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1]):"AUX_MOTION_DETECTION"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1]):"AUX_COLOR"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0], -g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1]):"AUX_CUSTOM"==b&&(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1]);f+=k*g;0!=k&&(e=6*g);Entry.Robotis_carCont.setRobotisData([[c,d,e,0,g]]);Entry.Robotis_carCont.update();a.data_default_address= -f;console.log(f);throw new Entry.Utils.AsyncError;}if(2>a.count)throw a.count++,new Entry.Utils.AsyncError;a.isStart=!1;c=Entry.hw.portData[a.data_default_address];a.data_default_address=void 0;return c}},robotis_openCM70_cm_buzzer_index:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.note_a+"(0)","0"],[Lang.General.note_a+"#(1)","1"],[Lang.General.note_b+"(2)","2"],[Lang.General.note_c+"(3)","3"],[Lang.General.note_c+"#(4)","4"],[Lang.General.note_d+ -"(5)","5"],[Lang.General.note_d+"#(6)","6"],[Lang.General.note_e+"(7)","7"],[Lang.General.note_f+"(8)","8"],[Lang.General.note_f+"#(9)","9"],[Lang.General.note_g+"(10)","10"],[Lang.General.note_g+"#(11)","11"],[Lang.General.note_a+"(12)","12"],[Lang.General.note_a+"#(13)","13"],[Lang.General.note_b+"(14)","14"],[Lang.General.note_c+"(15)","15"],[Lang.General.note_c+"#(16)","16"],[Lang.General.note_d+"(17)","17"],[Lang.General.note_d+"#(18)","18"],[Lang.General.note_e+"(19)","19"],[Lang.General.note_f+ -"(20)","20"],[Lang.General.note_f+"#(21)","21"],[Lang.General.note_g+"(22)","22"],[Lang.General.note_g+"#(23)","23"],[Lang.General.note_a+"(24)","24"],[Lang.General.note_a+"#(25)","25"],[Lang.General.note_b+"(26)","26"],[Lang.General.note_c+"(27)","27"],[Lang.General.note_c+"#(28)","28"],[Lang.General.note_d+"(29)","29"],[Lang.General.note_d+"#(30)","30"],[Lang.General.note_e+"(31)","31"],[Lang.General.note_f+"(32)","32"],[Lang.General.note_f+"#(33)","33"],[Lang.General.note_g+"(34)","34"],[Lang.General.note_g+ -"#(35)","35"],[Lang.General.note_a+"(36)","36"],[Lang.General.note_a+"#(37)","37"],[Lang.General.note_b+"(38)","38"],[Lang.General.note_c+"(39)","39"],[Lang.General.note_c+"#(40)","40"],[Lang.General.note_d+"(41)","41"],[Lang.General.note_d+"#(42)","42"],[Lang.General.note_e+"(43)","43"],[Lang.General.note_f+"(44)","44"],[Lang.General.note_f+"#(45)","45"],[Lang.General.note_g+"(46)","46"],[Lang.General.note_g+"#(47)","47"],[Lang.General.note_a+"(48)","48"],[Lang.General.note_a+"#(49)","49"],[Lang.General.note_b+ -"(50)","50"],[Lang.General.note_c+"(51)","51"]],value:"0",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["1"]},null],type:"robotis_openCM70_cm_buzzer_index"},paramsKeyMap:{CM_BUZZER_INDEX:0,CM_BUZZER_TIME:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(a,b){a=b.getField("CM_BUZZER_INDEX",b);var c=b.getNumberValue("CM_BUZZER_TIME",b),d=Entry.Robotis_openCM70.INSTRUCTION.WRITE, -e,f,g;e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[0];f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[1];g=parseInt(10*c);50a.brush.thickness&&(a.brush.thickness=1),a.brush.setStrokeStyle(a.brush.thickness),a.brush.moveTo(a.getX(), +-1*a.getY()));return b.callReturn()}},set_thickness:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["1"]},null],type:"set_thickness"},paramsKeyMap:{VALUE:0},"class":"brush_thickness",isNotFor:["textBox"],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(a.brush.thickness=c,a.brush.setStrokeStyle(a.brush.thickness), +a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}},change_opacity:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_opacity"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);c=Entry.adjustValueWithMaxMin(a.brush.opacity+ +c,0,100);a.brush&&(a.brush.opacity=c,a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}},set_opacity:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["50"]},null],type:"set_opacity"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"], +func:function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(a.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}},brush_erase_all:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"brush_erase_all"}, +"class":"brush_clear",isNotFor:["textBox"],func:function(a,b){var c=a.brush;if(c){var d=c._stroke.style,e=c._strokeStyle.width;c.clear().setStrokeStyle(e).beginStroke(d);c.moveTo(a.getX(),-1*a.getY())}a=a.parent.getStampEntities();a.map(function(b){b.removeClone()});a=null;return b.callReturn()}},brush_stamp:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"brush_stamp"},"class":"stamp",isNotFor:["textBox"], +func:function(a,b){a.parent.addStampEntity(a);return b.callReturn()}},change_brush_transparency:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_brush_transparency"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop= +!0);c=Entry.adjustValueWithMaxMin(a.brush.opacity-c,0,100);a.brush&&(a.brush.opacity=c,a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}},set_brush_tranparency:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["50"]},null],type:"set_brush_tranparency"}, +paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(a.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+(1-a.brush.opacity/100)+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}},number:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"TextInput", +value:10}],events:{},def:{params:[]},paramsKeyMap:{NUM:0},func:function(a,b){return b.getField("NUM",b)},isPrimitive:!0},angle:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Angle"}],events:{},def:{params:[null],type:"angle"},paramsKeyMap:{ANGLE:0},func:function(a,b){return b.getNumberField("ANGLE")}},get_x_coordinate:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_x_coordinate,color:"#3D3D3D"}],events:{},def:{params:[null], +type:"get_x_coordinate"},"class":"calc",isNotFor:[],func:function(a,b){return a.getX()}},get_y_coordinate:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_y_coordinate,color:"#3D3D3D"}],events:{},def:{params:[null],type:"get_y_coordinate"},"class":"calc",isNotFor:[],func:function(a,b){return a.getY()}},get_angle:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_angle,color:"#3D3D3D"}], +events:{},def:{params:[null]},func:function(a,b){return parseFloat(a.getRotation().toFixed(1))}},get_rotation_direction:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CALC_rotation_value,"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(a,b){return"DIRECTION"==b.getField("OPERATOR", +b).toUpperCase()?parseFloat(a.getDirection().toFixed(1)):parseFloat(a.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(a,b){b=b.getField("VALUE",b);if("mouse"==b)return b=Entry.stage.mouseCoordinate,Math.sqrt(Math.pow(a.getX()-b.x,2)+Math.pow(a.getY()-b.y,2));b=Entry.container.getEntity(b);return Math.sqrt(Math.pow(a.getX()-b.getX(),2)+Math.pow(a.getY()-b.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(a,b){return"x"===b.getField("VALUE",b)?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(a,b){var c=b.getField("VALUE",b);a="self"==c?a:Entry.container.getEntity(c);switch(b.getField("COORDINATE",b)){case "x":return a.getX();case "y":return a.getY();case "rotation":return a.getRotation();case "direction":return a.getDirection(); +case "picture_index":return b=a.parent,b=b.pictures,b.indexOf(a.picture)+1;case "size":return Number(a.getSize().toFixed(1));case "picture_name":return b=a.parent,b=b.pictures,b[b.indexOf(a.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(a,b){a=b.getField("OPERATOR",b);var c=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return"PLUS"==a?c+b:"MINUS"==a?c-b:"MULTI"==a?c*b:c/b}},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(a,b){a=b.getNumberValue("LEFTHAND", +b);b=b.getNumberValue("RIGHTHAND",b);return a+b}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a-b}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a*b}},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(a, +b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a/b}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a%b}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return Math.floor(a/b)}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getField("VALUE",b);if(-1<["asin_radian","acos_radian"].indexOf(b)&&(1a))throw Error("x range exceeded");b.indexOf("_")&& +(b=b.split("_")[0]);-1<["sin","cos","tan"].indexOf(b)&&(a=Entry.toRadian(a));switch(b){case "square":b=a*a;break;case "factorial":b=Entry.factorial(a);break;case "root":b=Math.sqrt(a);break;case "log":b=Math.log(a)/Math.LN10;break;case "ln":b=Math.log(a);break;case "asin":case "acos":case "atan":b=Entry.toDegrees(Math[b](a));break;case "unnatural":b=a-Math.floor(a);0>a&&(b=1-b);break;default:b=Math[b](a)}return b}},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,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_rand_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"number",params:["0"]},null,{type:"number",params:["10"]},null],type:"calc_rand"},paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3},"class":"calc",isNotFor:[],func:function(a,b){a=b.getStringValue("LEFTHAND",b);b=b.getStringValue("RIGHTHAND", +b);var c=Math.min(a,b),d=Math.max(a,b);a=Entry.isFloat(a);return Entry.isFloat(b)||a?(Math.random()*(d-c)+c).toFixed(2):Math.floor(Math.random()*(d-c+1)+c)}},get_date:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_date_1,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_get_date_year,"YEAR"],[Lang.Blocks.CALC_get_date_month,"MONTH"],[Lang.Blocks.CALC_get_date_day,"DAY"],[Lang.Blocks.CALC_get_date_hour,"HOUR"],[Lang.Blocks.CALC_get_date_minute, +"MINUTE"],[Lang.Blocks.CALC_get_date_second,"SECOND"]],value:"YEAR",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_get_date_2,color:"#3D3D3D"}],events:{},def:{params:[null,"YEAR",null],type:"get_date"},paramsKeyMap:{VALUE:1},"class":"calc_date",isNotFor:[],func:function(a,b){a=b.getField("VALUE",b);b=new Date;return"YEAR"==a?b.getFullYear():"MONTH"==a?b.getMonth()+1:"DAY"==a?b.getDate():"HOUR"==a?b.getHours():"MINUTE"==a?b.getMinutes():b.getSeconds()}},get_sound_duration:{color:"#FFD974", +skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_sound_duration_1,color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"sounds",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_get_sound_duration_2,color:"#3D3D3D"}],events:{},def:{params:[null,null,null],type:"get_sound_duration"},paramsKeyMap:{VALUE:1},"class":"calc_duration",isNotFor:[],func:function(a,b){b=b.getField("VALUE",b);a=a.parent.sounds;for(var c= +0;cb||b>a.length-1)throw Error();return a[b]}},length_of_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_length_of_string_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_length_of_string_2, +color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.entry]},null],type:"length_of_string"},paramsKeyMap:{STRING:1},"class":"calc_string",isNotFor:[],func:function(a,b){return b.getStringValue("STRING",b).length}},substring:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_substring_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_substring_2,color:"#3D3D3D"},{type:"Block",accept:"string"}, +{type:"Text",text:Lang.Blocks.CALC_substring_3,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_substring_4,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"number",params:["2"]},null,{type:"number",params:["5"]},null],type:"substring"},paramsKeyMap:{STRING:1,START:3,END:5},"class":"calc_string",isNotFor:[],func:function(a,b){a=b.getStringValue("STRING",b);var c=b.getNumberValue("START",b)-1;b=b.getNumberValue("END", +b)-1;var d=a.length-1;if(0>c||0>b||c>d||b>d)throw Error();return a.substring(Math.min(c,b),Math.max(c,b)+1)}},replace_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_replace_string_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_3,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text", +text:Lang.Blocks.CALC_replace_string_4,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"text",params:[Lang.Blocks.hello]},null,{type:"text",params:[Lang.Blocks.nice]},null],type:"replace_string"},paramsKeyMap:{STRING:1,OLD_WORD:3,NEW_WORD:5},"class":"calc_string",isNotFor:[],func:function(a,b){return b.getStringValue("STRING",b).replace(new RegExp(b.getStringValue("OLD_WORD",b),"gm"),b.getStringValue("NEW_WORD",b))}},change_string_case:{color:"#FFD974", +skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_change_string_case_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_change_string_case_2,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_change_string_case_sub_1,"toUpperCase"],[Lang.Blocks.CALC_change_string_case_sub_2,"toLowerCase"]],value:"toUpperCase",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_change_string_case_3, +color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:["Hello Entry!"]},null,null,null],type:"change_string_case"},paramsKeyMap:{STRING:1,CASE:3},"class":"calc_string",isNotFor:[],func:function(a,b){return b.getStringValue("STRING",b)[b.getField("CASE",b)]()}},index_of_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_index_of_string_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_index_of_string_2, +color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_index_of_string_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"text",params:[Lang.Blocks.entry]},null],type:"index_of_string"},paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3},"class":"calc_string",isNotFor:[],func:function(a,b){a=b.getStringValue("LEFTHAND",b);b=b.getStringValue("RIGHTHAND",b);b=a.indexOf(b);return-1a)throw Error(Lang.Blocks.FLOW_repeat_basic_errorMsg);b.iterCount=Math.floor(a)}if(0==b.iterCount||0>b.iterCount)return delete b.isLooped,delete b.iterCount,b.callReturn();b.iterCount--;return b.getStatement("DO",b)}},repeat_inf:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null], +type:"repeat_inf"},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(a,b){b.isLooped=!0;return b.getStatement("DO")}},stop_repeat:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null],type:"stop_repeat"},"class":"repeat",isNotFor:[],func:function(a,b){return this.executor.breakLoop()}},wait_until_true:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Block",accept:"boolean"},{type:"Indicator", +img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"},null],type:"wait_until_true"},paramsKeyMap:{BOOL:0},"class":"wait",isNotFor:[],func:function(a,b){return b.getBooleanValue("BOOL",b)?b.callReturn():b}},_if:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"},null],type:"_if"},paramsKeyMap:{BOOL:0},statementsKeyMap:{STACK:0}, +"class":"condition",isNotFor:[],func:function(a,b){return b.isCondition?(delete b.isCondition,b.callReturn()):b.getBooleanValue("BOOL",b)?(b.isCondition=!0,b.getStatement("STACK",b)):b.callReturn()}},if_else:{color:"#498deb",skeleton:"basic_double_loop",statements:[{accept:"basic"},{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12},{type:"LineBreak"}],events:{},def:{params:[{type:"True"},null],type:"if_else"},paramsKeyMap:{BOOL:0},statementsKeyMap:{STACK_IF:0, +STACK_ELSE:1},"class":"condition",isNotFor:[],func:function(a,b){if(b.isCondition)return delete b.isCondition,b.callReturn();a=b.getBooleanValue("BOOL",b);b.isCondition=!0;return a?b.getStatement("STACK_IF",b):b.getStatement("STACK_ELSE",b)}},create_clone:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"clone",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null, +null],type:"create_clone"},paramsKeyMap:{VALUE:0},"class":"clone",isNotFor:[],func:function(a,b){var c=b.getField("VALUE",b);b=b.callReturn();"self"==c?a.parent.addCloneEntity(a.parent,a,null):Entry.container.getObject(c).addCloneEntity(a.parent,null,null);return b}},delete_clone:{color:"#498deb",skeleton:"basic_without_next",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null],type:"delete_clone"},"class":"clone",isNotFor:[],func:function(a, +b){if(!a.isClone)return b.callReturn();a.removeClone();return this.die()}},when_clone_start:{color:"#498deb",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_clone.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"when_clone_start"},"class":"clone",isNotFor:[],func:function(a,b){return b.callReturn()},event:"when_clone_start"},stop_run:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png", +size:12}],events:{},def:{params:[null]},func:function(a,b){return Entry.engine.toggleStop()}},repeat_while_true:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Dropdown",options:[[Lang.Blocks.FLOW_repeat_while_true_until,"until"],[Lang.Blocks.FLOW_repeat_while_true_while,"while"]],value:"until",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"}, +null,null],type:"repeat_while_true"},paramsKeyMap:{BOOL:0,OPTION:1},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(a,b){a=b.getBooleanValue("BOOL",b);"until"==b.getField("OPTION",b)&&(a=!a);return(b.isLooped=a)?b.getStatement("DO",b):b.callReturn()}},stop_object:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.FLOW_stop_object_all,"all"],[Lang.Blocks.FLOW_stop_object_this_object,"thisOnly"],[Lang.Blocks.FLOW_stop_object_this_thread, +"thisThread"],[Lang.Blocks.FLOW_stop_object_other_thread,"otherThread"]],value:"all",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null,null],type:"stop_object"},paramsKeyMap:{TARGET:0},"class":"terminate",isNotFor:[],func:function(a,b){var c=b.getField("TARGET",b),d=Entry.container;switch(c){case "all":return d.clearRunningState(),this.die();case "thisOnly":return a.parent.script.clearExecutorsByEntity(a),this.die(); +case "thisObject":return a.parent.script.clearExecutors(),this.die();case "thisThread":return this.die();case "otherThread":c=this.executor;a=a.parent.script;for(var d=a.executors,e=0;eb.count?(50>c.leftFloor&&50>c.rightFloor?b.count++:b.count=0,c=c.leftFloor-c.rightFloor,a.leftWheel=45+.25*c,a.rightWheel=45-.25*c):(b.count=0,b.boardState=2);break;case 2:c=c.leftFloor-c.rightFloor;a.leftWheel=45+.25*c;a.rightWheel=45-.25*c;b.boardState=3;var d=setTimeout(function(){b.boardState=4;Entry.Hamster.removeTimeout(d)},250); +Entry.Hamster.timeouts.push(d);break;case 3:c=c.leftFloor-c.rightFloor;a.leftWheel=45+.25*c;a.rightWheel=45-.25*c;break;case 4:a.leftWheel=0,a.rightWheel=0,b.boardState=0,b.isMoving=!1}return b}delete b.isStart;delete b.isMoving;delete b.count;delete b.boardState;Entry.engine.isContinue=!1;a.leftWheel=0;a.rightWheel=0;return b.callReturn()}b.isStart=!0;b.isMoving=!0;b.count=0;b.boardState=1;a.leftWheel=45;a.rightWheel=45;Entry.Hamster.setLineTracerMode(a,0);return b}},hamster_turn_once:{color:"#00979D", +skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null],type:"hamster_turn_once"},paramsKeyMap:{DIRECTION:0},"class":"hamster_board",isNotFor:["hamster"],func:function(a,b){a=Entry.hw.sendQueue;var c=Entry.hw.portData;if(b.isStart){if(b.isMoving){if(b.isLeft)switch(b.boardState){case 1:2>b.count?50c.leftFloor&&(b.boardState=3);break;case 3:2>b.count?20>c.leftFloor&&b.count++:(b.count=0,b.boardState=4);break;case 4:50b.count?50c.rightFloor&&(b.boardState=3);break;case 3:2>b.count? +20>c.rightFloor&&b.count++:(b.count=0,b.boardState=4);break;case 4:50Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return b.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(a,b){Entry.Hamster.tempo=b.getNumberValue("VALUE");1>Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return b.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(a,b){a=Entry.hw.sendQueue;var c=b.getField("PORT",b),d=Number(b.getField("MODE",b));"A"==c?a.ioModeA=d:("B"!=c&&(a.ioModeA=d),a.ioModeB=d); +return b.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(a,b){a=Entry.hw.sendQueue;var c=b.getField("PORT"),d=b.getNumberValue("VALUE");"A"==c?a.outputA=void 0!=a.outputA?a.outputA+d:d:("B"!=c&&(a.outputA=void 0!=a.outputA?a.outputA+d:d),a.outputB=void 0!=a.outputB?a.outputB+d:d);return b.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(a,b){a=Entry.hw.sendQueue;var c=b.getField("PORT"),d=b.getNumberValue("VALUE");"A"==c?a.outputA=d:("B"!=c&&(a.outputA=d),a.outputB=d);return b.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(a,b){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(a, +b){a=Number(b.getField("VALUE",b));return 0<=Entry.pressedKeys.indexOf(a)}},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(a,b){if(!a.getVisible())return!1;var c=b.getField("VALUE",b);b=a.object;var d=/wall/.test(c),e=ndgmr.checkPixelCollision;if(d)switch(a=Entry.stage.wall,c){case "wall":if(e(b,a.up,.2,!0)||e(b,a.down,.2,!0)||e(b,a.left,.2,!0)||e(b,a.right,.2,!0))return!0;break;case "wall_up":if(e(b,a.up,.2,!0))return!0;break;case "wall_down":if(e(b,a.down,.2,!0))return!0;break;case "wall_right":if(e(b,a.right,.2,!0))return!0;break;case "wall_left":if(e(b,a.left, +.2,!0))return!0}else{if("mouse"==c)return e=Entry.stage.canvas,e=b.globalToLocal(e.mouseX,e.mouseY),b.hitTest(e.x,e.y);c=Entry.container.getEntity(c);if("textBox"==c.type||"textBox"==a.type){e=c.object.getTransformedBounds();b=b.getTransformedBounds();if(Entry.checkCollisionRect(b,e))return!0;a=c.parent.clonedEntities;c=0;for(d=a.length;c","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(a, +b){a=b.getField("OPERATOR",b);var c=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return"EQUAL"==a?c==b:"BIGGER"==a?c>b:c",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(a, +b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a>b}},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(a,b){a=b.getNumberValue("LEFTHAND", +b);b=b.getNumberValue("RIGHTHAND",b);return a","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(a,b){a=b.getField("OPERATOR",b);var c=b.getStringValue("LEFTHAND",b);b=b.getStringValue("RIGHTHAND",b);switch(a){case "EQUAL":return c==b;case "GREATER":return Number(c)>Number(b);case "LESS":return Number(c)=Number(b);case "LESS_OR_EQUAL":return Number(c)<=Number(b)}}}, +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(a,b){a.setVisible(!0);return b.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(a,b){a.setVisible(!1);return b.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(a,b){if(!b.isStart){var c=b.getNumberValue("SECOND",b),d=b.getStringValue("VALUE",b),e=b.getField("OPTION",b);b.isStart=!0;b.timeFlag=1;d||"number"==typeof d||(d=" ");d=Entry.convertToRoundedDecimals(d,3);new Entry.Dialog(a,d,e);a.syncDialogVisible(a.getVisible());setTimeout(function(){b.timeFlag=0},1E3*c)}if(0==b.timeFlag)return delete b.timeFlag,delete b.isStart,a.dialog&&a.dialog.remove(),b.callReturn();a.dialog||(d=b.getStringValue("VALUE",b),e=b.getField("OPTION",b),d||"number"== +typeof d||(d=" "),d=Entry.convertToRoundedDecimals(d,3),new Entry.Dialog(a,d,e),a.syncDialogVisible(a.getVisible()));return b}},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(a,b){var c=b.getStringValue("VALUE",b);c||"number"==typeof c||(c=" ");var d=b.getField("OPTION",b),c=Entry.convertToRoundedDecimals(c,3);new Entry.Dialog(a,c,d);a.syncDialogVisible(a.getVisible());return b.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(a, +b){a.dialog&&a.dialog.remove();return b.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(a,b){var c=b.getField("VALUE",b),c=a.parent.getPicture(c);a.setImage(c);return b.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(a,b){var c;c="prev"!==b.getStringField("DRIECTION")?a.parent.getNextPicture(a.picture.id): +a.parent.getPrevPicture(a.picture.id);a.setImage(c);return b.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(a,b){var c=b.getField("EFFECT",b),d=b.getNumberValue("VALUE",b);"color"==c?a.effect.hue=d+a.effect.hue:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?a.effect.brightness=d+a.effect.brightness:"blur"!=c&&"opacity"==c&&(a.effect.alpha+=d/100));a.applyFilter();return b.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(a,b){var c=b.getField("EFFECT",b),d=b.getNumberValue("VALUE",b);"color"==c?a.effect.hue=d:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?a.effect.brightness= +d:"blur"!=c&&"opacity"==c&&(a.effect.alpha=d/100));a.applyFilter();return b.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(a,b){a.resetFilter();return b.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(a,b){var c=(b.getNumberValue("VALUE",b)+100)/100;a.setScaleX(a.getScaleX()*c);a.setScaleY(a.getScaleY()*c);return b.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(a,b){var c=b.getNumberValue("VALUE",b)/100,d=a.snapshot_;a.setScaleX(c*d.scaleX);a.setScaleY(c*d.scaleY);return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setSize(a.getSize()+c);return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setSize(c);return b.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(a,b){a.setScaleX(-1*a.getScaleX());return b.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(a,b){a.setScaleY(-1*a.getScaleY()); +return b.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(a,b){var c=b.getField("VALUE",b);a=Entry.container.getCurrentObjects().indexOf(a.parent);if(-1a)throw Error("object is not available for current scene");switch(d){case "FRONT":c=0;break;case "FORWARD":c=Math.max(0, +a-1);break;case "BACKWARD":c=Math.min(e,a+1);break;case "BACK":c=e}Entry.container.moveElementByBlock(a,c);return b.callReturn()}},move_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:["10"]},null],type:"move_direction"},paramsKeyMap:{VALUE:0},"class":"walk",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.setX(a.getX()+c*Math.cos((a.getRotation()+ +a.getDirection()-90)/180*Math.PI));a.setY(a.getY()-c*Math.sin((a.getRotation()+a.getDirection()-90)/180*Math.PI));a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}},move_x:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"move_x"},paramsKeyMap:{VALUE:0},"class":"move_relative",isNotFor:[],func:function(a, +b){var c=b.getNumberValue("VALUE",b);a.setX(a.getX()+c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}},move_y:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"move_y"},paramsKeyMap:{VALUE:0},"class":"move_relative",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.setY(a.getY()+c);a.brush&& +!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}},locate_xy_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"locate_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_absolute", +isNotFor:[],func:function(a,b){function c(){var c=b.x-a.getX(),d=b.y-a.getY(),c=c/b.frameCount,d=d/b.frameCount;a.setX(a.getX()+c);a.setY(a.getY()+d);b.frameCount--;a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY())}if(!b.isStart){var d;d=b.getNumberValue("VALUE1",b);b.isStart=!0;b.frameCount=Math.max(Math.floor(d*Entry.FPS),1);b.x=b.getNumberValue("VALUE2",b);b.y=b.getNumberValue("VALUE3",b);1==b.frameCount&&c()}if(0!=b.frameCount)return c(),b;delete b.isStart;delete b.frameCount;return b.callReturn()}}, +rotate_by_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"rotate_by_angle"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.setRotation(a.getRotation()+c);return b.callReturn()}},rotate_by_angle_dropdown:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Dropdown", +options:[["45","45"],["90","90"],["135","135"],["180","180"]],value:"45",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:["45",null],type:"rotate_by_angle_dropdown"},paramsKeyMap:{VALUE:0},"class":"ebs",isNotFor:[],func:function(a,b){var c=b.getField("VALUE",b);a.setRotation(a.getRotation()+Number(c));return b.callReturn()}},see_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png", +size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"see_angle"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.setDirection(c);return b.callReturn()}},see_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"sprites",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{VALUE:0},func:function(a, +b){var c=b.getField("VALUE",b),d=Entry.container.getEntity(c),c=d.getX()-a.getX(),d=d.getY()-a.getY();0<=c?a.setRotation(Math.atan(d/c)/Math.PI*180+90):a.setRotation(Math.atan(d/c)/Math.PI*180+270);return b.callReturn()}},locate_xy:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["0"]},{type:"number",params:["0"]},null],type:"locate_xy"}, +paramsKeyMap:{VALUE1:0,VALUE2:1},"class":"move_absolute",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE1",b),d=b.getNumberValue("VALUE2",b);a.setX(c);a.setY(d);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}},locate_x:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_x"},paramsKeyMap:{VALUE:0}, +"class":"move_absolute",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.setX(c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}},locate_y:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_y"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE", +b);a.setY(c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}},locate:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"locate"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(a,b){var c=b.getField("VALUE",b),d;"mouse"== +c?(c=Entry.stage.mouseCoordinate.x,d=Entry.stage.mouseCoordinate.y):(d=Entry.container.getEntity(c),c=d.getX(),d=d.getY());a.setX(Number(c));a.setY(Number(d));a.brush&&!a.brush.stop&&a.brush.lineTo(c,-1*d);return b.callReturn()}},move_xy_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]}, +{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"move_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_relative",isNotFor:[],func:function(a,b){function c(){a.setX(a.getX()+b.dX);a.setY(a.getY()+b.dY);b.frameCount--;a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY())}if(!b.isStart){var d;d=b.getNumberValue("VALUE1",b);var e=b.getNumberValue("VALUE2",b),f=b.getNumberValue("VALUE3",b);b.isStart=!0;b.frameCount=Math.max(Math.floor(d*Entry.FPS),1);b.dX= +e/b.frameCount;b.dY=f/b.frameCount;1==b.frameCount&&c()}if(0!=b.frameCount)return c(),b;delete b.isStart;delete b.frameCount;return b.callReturn()}},rotate_by_angle_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Angle"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},null,null],type:"rotate_by_angle_time"},paramsKeyMap:{VALUE:1},"class":"rotate",isNotFor:[],func:function(a,b){if(!b.isStart){var c; +c=b.getNumberValue("VALUE",b);var d=b.getNumberField("VALUE",b);b.isStart=!0;b.frameCount=Math.floor(c*Entry.FPS);b.dAngle=d/b.frameCount}if(0!=b.frameCount)return a.setRotation(a.getRotation()+b.dAngle),b.frameCount--,b;delete b.isStart;delete b.frameCount;return b.callReturn()}},bounce_wall:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null],type:"bounce_wall"},"class":"walk",isNotFor:[],func:function(a, +b){var c=a.parent.getRotateMethod(),d="free"==c?(a.getRotation()+a.getDirection()).mod(360):a.getDirection(),e;if(90>d&&0<=d||360>d&&270<=d){e=a.collision==Entry.Utils.COLLISION.UP;var f=ndgmr.checkPixelCollision(Entry.stage.wall.up,a.object,0,!1);!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE);f&&e&&(f=!1);f?("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+180),a.collision=Entry.Utils.COLLISION.UP):(e=a.collision==Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down, +a.object,0,!1),!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+180),a.collision=Entry.Utils.COLLISION.DOWN))}else 270>d&&90<=d&&(e=a.collision==Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,a.object,0,!1),!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f?("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+ +180),a.collision=Entry.Utils.COLLISION.DOWN):(e=a.collision==Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,a.object,0,!1),!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+180),a.collision=Entry.Utils.COLLISION.UP)));360>d&&180<=d?(e=a.collision==Entry.Utils.COLLISION.LEFT,d=ndgmr.checkPixelCollision(Entry.stage.wall.left,a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE), +d&&e&&(d=!1),d?("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()):a.setDirection(-a.getDirection()+360),a.collision=Entry.Utils.COLLISION.LEFT):(e=a.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()):a.setDirection(-a.getDirection()+360),a.collision=Entry.Utils.COLLISION.RIGHT))):180>d&&0<=d&&(e=a.collision== +Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()):a.setDirection(-a.getDirection()+360),a.collision=Entry.Utils.COLLISION.RIGHT):(e=a.collision==Entry.Utils.COLLISION.LEFT,d=ndgmr.checkPixelCollision(Entry.stage.wall.left,a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?a.setRotation(-a.getRotation()- +2*a.getDirection()):a.setDirection(-a.getDirection()+360),a.collision=Entry.Utils.COLLISION.LEFT)));return b.callReturn()}},flip_arrow_horizontal:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null]},func:function(a,b){a.setDirection(a.getDirection()+180);return b.callReturn()}},flip_arrow_vertical:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}], +events:{},def:{params:[null]},func:function(a,b){a.setDirection(a.getDirection()+180);return b.callReturn()}},see_angle_object:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"see_angle_object"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(a,b){var c= +b.getField("VALUE",b),d=a.getX(),e=a.getY();if(a.parent.id==c)return b.callReturn();"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?a.getDirection()+a.getRotation():0<=d?-Math.atan(e/d)/Math.PI*180+90:-Math.atan(e/d)/Math.PI*180+270;d=a.getDirection()+a.getRotation();a.setRotation(a.getRotation()+e-d);return b.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(a,b){var c=b.getNumberValue("VALUE",b),d=a.getDirection()+a.getRotation();a.setRotation(a.getRotation()+c-d);return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setDirection(c+a.getDirection());return b.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(a,b){if(!b.isStart){var c,d,e;d=b.getField("TARGET",b);c=b.getNumberValue("VALUE",b);c=Math.floor(c*Entry.FPS);e=Entry.stage.mouseCoordinate;if(0!=c)"mouse"==d?(d=e.x-a.getX(),e=e.y-a.getY()):(e=Entry.container.getEntity(d),d=e.getX()-a.getX(),e=e.getY()-a.getY()),b.isStart= +!0,b.frameCount=c,b.dX=d/b.frameCount,b.dY=e/b.frameCount;else return"mouse"==d?(d=Number(e.x),e=Number(e.y)):(e=Entry.container.getEntity(d),d=e.getX(),e=e.getY()),a.setX(d),a.setY(e),a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY()),b.callReturn()}if(0!=b.frameCount)return a.setX(a.getX()+b.dX),a.setY(a.getY()+b.dY),b.frameCount--,a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY()),b;delete b.isStart;delete b.frameCount;return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setRotation(c);return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setRotation(c+a.getRotation());return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setDirection(c);return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setDirection(c+a.getDirection());return b.callReturn()}}, +move_to_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},{type:"number",params:["10"]},null],type:"move_to_angle"},paramsKeyMap:{ANGLE:0,VALUE:1},"class":"move_rotate",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b),d=b.getNumberValue("ANGLE",b);a.setX(a.getX()+c*Math.cos((d-90)/180*Math.PI));a.setY(a.getY()-c* +Math.sin((d-90)/180*Math.PI));a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}},rotate_by_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"angle"},null],type:"rotate_by_time"},paramsKeyMap:{VALUE:0,ANGLE:1},"class":"rotate",isNotFor:[],func:function(a,b){function c(){a.setRotation(a.getRotation()+ +b.dAngle);b.frameCount--}if(!b.isStart){var d;d=b.getNumberValue("VALUE",b);var e=b.getNumberValue("ANGLE",b);b.isStart=!0;b.frameCount=Math.max(Math.floor(d*Entry.FPS),1);b.dAngle=e/b.frameCount;1==b.frameCount&&c()}if(0!=b.frameCount)return c(),b;delete b.isStart;delete b.frameCount;return b.callReturn()}},direction_relative_duration:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png", +size:12}],events:{},def:{params:[{type:"text",params:["2"]},{type:"angle"},null],type:"direction_relative_duration"},paramsKeyMap:{DURATION:0,AMOUNT:1},"class":"rotate",isNotFor:[],func:function(a,b){function c(){a.setDirection(a.getDirection()+b.dDirection);b.frameCount--}if(!b.isStart){var d;d=b.getNumberValue("DURATION",b);var e=b.getNumberValue("AMOUNT",b);b.isStart=!0;b.frameCount=Math.max(Math.floor(d*Entry.FPS),1);b.dDirection=e/b.frameCount;1==b.frameCount&&c()}if(0!=b.frameCount)return c(), +b;delete b.isStart;delete b.frameCount;delete b.dDirection;return b.callReturn()}},neobot_sensor_value:{color:"#00979D",skeleton:"basic_string_field",fontColor:"#fff",statements:[],template:"%1 \uac12",params:[{type:"Dropdown",options:[["1\ubc88 \ud3ec\ud2b8","IN1"],["2\ubc88 \ud3ec\ud2b8","IN2"],["3\ubc88 \ud3ec\ud2b8","IN3"],["\ub9ac\ubaa8\ucee8","IR"],["\ubc30\ud130\ub9ac","BAT"]],value:"IN1",fontSize:11}],events:{},def:{params:[null],type:"neobot_sensor_value"},paramsKeyMap:{PORT:0},"class":"neobot_value", +isNotFor:["neobot"],func:function(a,b){a=b.getStringField("PORT");return Entry.hw.portData[a]}},neobot_sensor_convert_scale:{color:"#00979D",skeleton:"basic_string_field",fontColor:"#fff",statements:[],template:"%1 \uac12\uc758 \ubc94\uc704\ub97c %2 ~ %3 \uc5d0\uc11c %4 ~ %5 (\uc73c)\ub85c \ubcc0\ud658",params:[{type:"Dropdown",options:[["1\ubc88 \ud3ec\ud2b8","IN1"],["2\ubc88 \ud3ec\ud2b8","IN2"],["3\ubc88 \ud3ec\ud2b8","IN3"],["\ub9ac\ubaa8\ucee8","IR"],["\ubc30\ud130\ub9ac","BAT"]],value:"IN1", +fontSize:11},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"}],events:{},def:{params:[null,{type:"number",params:["0"]},{type:"number",params:["255"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"neobot_sensor_convert_scale"},paramsKeyMap:{PORT:0,OMIN:1,OMAX:2,MIN:3,MAX:4},"class":"neobot_value",isNotFor:["neobot"],func:function(a,b){a=b.getStringField("PORT");a=Entry.hw.portData[a];var c=b.getNumberValue("OMIN", +b),d=b.getNumberValue("OMAX",b),e=b.getNumberValue("MIN",b);b=b.getNumberValue("MAX",b);if(c>d)var f=c,c=d,d=f;e>b&&(f=e,e=b,b=f);a=Math.min(b,(b-e)/(d-c)*(a-c)+e);a=Math.max(e,a);return Math.round(a)}},neobot_left_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc67c\ucabd \ubaa8\ud130\ub97c %1 %2 \uc758 \uc18d\ub3c4\ub85c \ud68c\uc804 %3",params:[{type:"Dropdown",options:[["\uc55e\uc73c\ub85c","16"],["\ub4a4\ub85c","32"]],value:"16",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}, +{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"],["14","14"],["15","15"]],value:"0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,"15",null],type:"neobot_left_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1},"class":"neobot_motor",isNotFor:["neobot"],func:function(a,b){a=b.getNumberField("SPEED"); +var c=b.getNumberField("DIRECTION");Entry.hw.sendQueue.DCL=a+c;return b.callReturn()}},neobot_stop_left_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc67c\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_left_motor"},"class":"neobot_motor",isNotFor:["neobot"],func:function(a,b){Entry.hw.sendQueue.DCL=0;return b.callReturn()}},neobot_right_motor:{color:"#00979D",skeleton:"basic", +statements:[],template:"\uc624\ub978\ucabd \ubaa8\ud130\ub97c %1 %2 \uc758 \uc18d\ub3c4\ub85c \ud68c\uc804 %3",params:[{type:"Dropdown",options:[["\uc55e\uc73c\ub85c","16"],["\ub4a4\ub85c","32"]],value:"16",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{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"],["14","14"],["15","15"]],value:"0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}, +{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,"15",null],type:"neobot_right_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1},"class":"neobot_motor",isNotFor:["neobot"],func:function(a,b){a=b.getNumberField("SPEED");var c=b.getNumberField("DIRECTION");Entry.hw.sendQueue.DCR=a+c;return b.callReturn()}},neobot_stop_right_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator", +img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_right_motor"},"class":"neobot_motor",isNotFor:["neobot"],func:function(a,b){Entry.hw.sendQueue.DCR=0;return b.callReturn()}},neobot_all_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc591\ucabd \ubaa8\ud130\ub97c %1 %2\uc758 \uc18d\ub3c4\ub85c %3\ucd08 \ub3d9\uc548 \ud68c\uc804 %4",params:[{type:"Dropdown",options:[["\uc55e\uc73c\ub85c","1"],["\ub4a4\ub85c","2"],["\uc81c\uc790\ub9ac\uc5d0\uc11c \uc67c\ucabd \ub3cc\uae30", +"3"],["\uc81c\uc790\ub9ac\uc5d0\uc11c \uc624\ub978\ucabd \ub3cc\uae30","4"],["\uc67c\ucabd\uc73c\ub85c \ub3cc\uae30","5"],["\uc624\ub978\ucabd\uc73c\ub85c \ub3cc\uae30","6"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{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"],["14","14"],["15","15"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block", +accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:["1","15",{type:"number",params:["0"]}],type:"neobot_all_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1,DURATION:2},"class":"neobot_motor",isNotFor:["neobot"],func:function(a,b){if(b.isStart){if(1==b.timeFlag)return b;delete b.timeFlag;delete b.isStart;Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR=0;Entry.engine.isContinue=!1;return b.callReturn()}a=b.getNumberField("SPEED");var c=b.getNumberField("DIRECTION"), +d=b.getNumberValue("DURATION");0>d&&(d=0);switch(c){case 1:Entry.hw.sendQueue.DCL=16+a;Entry.hw.sendQueue.DCR=16+a;break;case 2:Entry.hw.sendQueue.DCL=32+a;Entry.hw.sendQueue.DCR=32+a;break;case 3:Entry.hw.sendQueue.DCL=32+a;Entry.hw.sendQueue.DCR=16+a;break;case 4:Entry.hw.sendQueue.DCL=16+a;Entry.hw.sendQueue.DCR=32+a;break;case 5:Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR=16+a;break;case 6:Entry.hw.sendQueue.DCL=16+a,Entry.hw.sendQueue.DCR=0}if(0===d)return b.callReturn();b.isStart=!0;b.timeFlag= +1;setTimeout(function(){b.timeFlag=0},1E3*d);return b}},neobot_stop_all_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc591\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_all_motor"},"class":"neobot_motor",isNotFor:["neobot"],func:function(a,b){Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR=0;return b.callReturn()}},neobot_set_servo:{color:"#00979D",skeleton:"basic",statements:[], +template:"%1 \ud3ec\ud2b8\uc758 \uc11c\ubcf4\ubaa8\ud130\ub97c %2 \ub3c4 \uc774\ub3d9 %3",params:[{type:"Dropdown",options:[["OUT1","1"],["OUT2","2"],["OUT3","3"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"neobot_set_servo"},paramsKeyMap:{PORT:0,DEGREE:1},"class":"neobot_output",isNotFor:["neobot"],func:function(a,b){a=b.getNumberField("PORT"); +var c=b.getNumberValue("DEGREE");0>c?c=0:180c?c=0:255a.count)throw a.count++,new Entry.Utils.AsyncError;a.isStart=!1;b=Entry.hw.portData[a.data_default_address]; +a.data_default_address=void 0;return b}},robotis_openCM70_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.robotis_cm_sound_detected,"CM_SOUND_DETECTED"],[Lang.Blocks.robotis_cm_sound_detecting,"CM_SOUND_DETECTING"],[Lang.Blocks.robotis_cm_user_button,"CM_USER_BUTTON"]],value:"CM_SOUND_DETECTED",fontSize:11}],events:{},def:{params:[null],type:"robotis_openCM70_sensor_value"},paramsKeyMap:{SENSOR:0},"class":"robotis_openCM70_cm", +isNotFor:["robotis_openCM70"],func:function(a,b){a=b.executor.scope;if(!a.isStart){a.isStart=!0;a.count=0;var c=Entry.Robotis_openCM70.INSTRUCTION.READ,d=0,e=0,f=0,g=0;b=b.getStringField("SENSOR");"CM_SOUND_DETECTED"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1]):"CM_SOUND_DETECTING"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0], +g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1]):"CM_USER_BUTTON"==b&&(f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1]);f+=0*g;Entry.Robotis_carCont.setRobotisData([[c,d,e,0,g]]);Entry.Robotis_carCont.update(); +a.data_default_address=f;throw new Entry.Utils.AsyncError;}if(2>a.count)throw a.count++,new Entry.Utils.AsyncError;a.isStart=!1;b=Entry.hw.portData[a.data_default_address];a.data_default_address=void 0;return b}},robotis_openCM70_aux_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["3","PORT_3"],["4","PORT_4"],["5","PORT_5"],["6","PORT_6"]],value:"PORT_3",fontSize:11},{type:"Dropdown",options:[[Lang.Blocks.robotis_aux_servo_position, +"AUX_SERVO_POSITION"],[Lang.Blocks.robotis_aux_ir,"AUX_IR"],[Lang.Blocks.robotis_aux_touch,"AUX_TOUCH"],[Lang.Blocks.robotis_aux_brightness,"AUX_BRIGHTNESS"],[Lang.Blocks.robotis_aux_hydro_themo_humidity,"AUX_HYDRO_THEMO_HUMIDITY"],[Lang.Blocks.robotis_aux_hydro_themo_temper,"AUX_HYDRO_THEMO_TEMPER"],[Lang.Blocks.robotis_aux_temperature,"AUX_TEMPERATURE"],[Lang.Blocks.robotis_aux_ultrasonic,"AUX_ULTRASONIC"],[Lang.Blocks.robotis_aux_magnetic,"AUX_MAGNETIC"],[Lang.Blocks.robotis_aux_motion_detection, +"AUX_MOTION_DETECTION"],[Lang.Blocks.robotis_aux_color,"AUX_COLOR"],[Lang.Blocks.robotis_aux_custom,"AUX_CUSTOM"]],value:"AUX_SERVO_POSITION",fontSize:11}],events:{},def:{params:[null,null],type:"robotis_openCM70_aux_sensor_value"},paramsKeyMap:{PORT:0,SENSOR:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(a,b){a=b.executor.scope;if(!a.isStart){a.isStart=!0;a.count=0;var c=Entry.Robotis_openCM70.INSTRUCTION.READ,d=0,e=0,f=0,g=0,h=b.getStringField("PORT");b=b.getStringField("SENSOR"); +var k=0;"PORT_3"==h?k=2:"PORT_4"==h?k=3:"PORT_5"==h?k=4:"PORT_6"==h&&(k=5);"AUX_SERVO_POSITION"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1]):"AUX_IR"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0], +e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1]):"AUX_TOUCH"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1]):"AUX_TEMPERATURE"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1]): +"AUX_BRIGHTNESS"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1]):"AUX_HYDRO_THEMO_HUMIDITY"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1]): +"AUX_HYDRO_THEMO_TEMPER"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1]):"AUX_ULTRASONIC"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1]): +"AUX_MAGNETIC"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1]):"AUX_MOTION_DETECTION"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1]): +"AUX_COLOR"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1]):"AUX_CUSTOM"==b&&(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1]);f+=k*g;0!=k&&(e=6*g);Entry.Robotis_carCont.setRobotisData([[c, +d,e,0,g]]);Entry.Robotis_carCont.update();a.data_default_address=f;console.log(f);throw new Entry.Utils.AsyncError;}if(2>a.count)throw a.count++,new Entry.Utils.AsyncError;a.isStart=!1;c=Entry.hw.portData[a.data_default_address];a.data_default_address=void 0;return c}},robotis_openCM70_cm_buzzer_index:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.note_a+"(0)","0"],[Lang.General.note_a+"#(1)","1"],[Lang.General.note_b+"(2)","2"],[Lang.General.note_c+ +"(3)","3"],[Lang.General.note_c+"#(4)","4"],[Lang.General.note_d+"(5)","5"],[Lang.General.note_d+"#(6)","6"],[Lang.General.note_e+"(7)","7"],[Lang.General.note_f+"(8)","8"],[Lang.General.note_f+"#(9)","9"],[Lang.General.note_g+"(10)","10"],[Lang.General.note_g+"#(11)","11"],[Lang.General.note_a+"(12)","12"],[Lang.General.note_a+"#(13)","13"],[Lang.General.note_b+"(14)","14"],[Lang.General.note_c+"(15)","15"],[Lang.General.note_c+"#(16)","16"],[Lang.General.note_d+"(17)","17"],[Lang.General.note_d+ +"#(18)","18"],[Lang.General.note_e+"(19)","19"],[Lang.General.note_f+"(20)","20"],[Lang.General.note_f+"#(21)","21"],[Lang.General.note_g+"(22)","22"],[Lang.General.note_g+"#(23)","23"],[Lang.General.note_a+"(24)","24"],[Lang.General.note_a+"#(25)","25"],[Lang.General.note_b+"(26)","26"],[Lang.General.note_c+"(27)","27"],[Lang.General.note_c+"#(28)","28"],[Lang.General.note_d+"(29)","29"],[Lang.General.note_d+"#(30)","30"],[Lang.General.note_e+"(31)","31"],[Lang.General.note_f+"(32)","32"],[Lang.General.note_f+ +"#(33)","33"],[Lang.General.note_g+"(34)","34"],[Lang.General.note_g+"#(35)","35"],[Lang.General.note_a+"(36)","36"],[Lang.General.note_a+"#(37)","37"],[Lang.General.note_b+"(38)","38"],[Lang.General.note_c+"(39)","39"],[Lang.General.note_c+"#(40)","40"],[Lang.General.note_d+"(41)","41"],[Lang.General.note_d+"#(42)","42"],[Lang.General.note_e+"(43)","43"],[Lang.General.note_f+"(44)","44"],[Lang.General.note_f+"#(45)","45"],[Lang.General.note_g+"(46)","46"],[Lang.General.note_g+"#(47)","47"],[Lang.General.note_a+ +"(48)","48"],[Lang.General.note_a+"#(49)","49"],[Lang.General.note_b+"(50)","50"],[Lang.General.note_c+"(51)","51"]],value:"0",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["1"]},null],type:"robotis_openCM70_cm_buzzer_index"},paramsKeyMap:{CM_BUZZER_INDEX:0,CM_BUZZER_TIME:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(a,b){a=b.getField("CM_BUZZER_INDEX",b);var c= +b.getNumberValue("CM_BUZZER_TIME",b),d=Entry.Robotis_openCM70.INSTRUCTION.WRITE,e,f,g;e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[0];f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[1];g=parseInt(10*c);50a;a+=15)this._dividerGroup.elem("line",{x1:49,y1:0,x2:49-(0===a%45?10:5),y2:0,transform:"rotate("+a+", 0, 0)",class:"entry-angle-divider"});a=this.getAbsolutePosFromBoard();a.x+=this.box.width/ 2;a.y=a.y+this.box.height/2+49+1;this.svgOptionGroup.attr({class:"entry-field-angle",transform:"translate("+a.x+","+a.y+")"});var a=b.getAbsolutePosFromDocument(),d=[a.x+b.box.width/2,a.y+b.box.height/2+1];$(this.svgOptionGroup).mousemove(function(a){b.optionGroup.val(b.modValue(function(b,a){var c=a[0]-b[0];b=a[1]-b[1]-49-1;a=Math.atan(-b/c);a=Entry.toDegrees(a);a=90-a;0>c?a+=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",a).replace("%Y",d).replace("%LARGE",b),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:a,y2:d});this._indicator.attr({class:"entry-angle-indicator"})}; +function(){this._fillPath&&this._fillPath.remove();var a=Entry.toRadian(this.getValue()),c=49*Math.sin(a),d=-49*Math.cos(a),a=a>Math.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",c).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:c,y2:d});this._indicator.attr({class:"entry-angle-indicator"})}; a.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())};a.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()};a.getTextWidth=function(){return this.textElement?this.textElement.getComputedTextLength()+ 8:8};a.getText=function(){return this.getValue()+"\u00b0"};a.modValue=function(a){return a%360};a.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.FieldColor=function(a,b,c){this._block=b.block;this._blockView=b;this.box=new Entry.BoxModel;this.svgGroup=null;this._contents=a;this._index=c;this._position=a.position;this.key=a.key;this.setValue(this.getValue()||"#FF0000");this.renderStart(b)};Entry.Utils.inherit(Entry.Field,Entry.FieldColor); (function(a){a.renderStart=function(){this.svgGroup&&$(this.svgGroup).remove();this.svgGroup=this._blockView.contentSvgGroup.elem("g",{class:"entry-field-color"});var a=this._position,c;a?(c=a.x||0,a=a.y||0):(c=0,a=-8);this._header=this.svgGroup.elem("rect",{x:c,y:a,width:14.5,height:16,fill:this.getValue()});this._bindRenderOptions();this.box.set({x:c,y:a,width:14.5,height:16})};a.renderOptions=function(){var a=this;this._attachDisposeEvent();var c=Entry.FieldColor.getWidgetColorList();this.optionGroup= diff --git a/src/workspace/block_entry.js b/src/workspace/block_entry.js index 39c37f49f3..5a1cff3a84 100644 --- a/src/workspace/block_entry.js +++ b/src/workspace/block_entry.js @@ -3684,7 +3684,6 @@ Entry.block = { class: "test", // 블록 기능정의 "func": function(sprite, script) { - console.log("cobl_read_potenmeter"); return Entry.hw.getAnalogPortValue("potenmeter"); } }, @@ -3705,7 +3704,7 @@ Entry.block = { class: "test", // 블록 기능정의 "func": function(sprite, script) { - return Entry.hw.getAnalogPortValue("potenmeter"); + return Entry.hw.getAnalogPortValue("irread1"); } }, "cobl_read_irread2": { @@ -3725,7 +3724,6 @@ Entry.block = { class: "test", // 블록 기능정의 "func": function(sprite, script) { - var signal = script.getValue("irread2", script); return Entry.hw.getAnalogPortValue("irread2"); } }, @@ -3995,14 +3993,14 @@ Entry.block = { type: "Dropdown", options: [ ["OFF","OFF"], - ["Red","Red"], - ["Orange","Orange"], - ["Yellow","Yellow"], - ["Green","Green"], - ["Blue","Blue"], - ["Dark Blue","Dark Blue"], - ["Purple","Purple"], - ["White","White"] + ["빨강","Red"], + ["주황","Orange"], + ["노랑","Yellow"], + ["초록","Green"], + ["파랑","Blue"], + ["남색","Dark Blue"], + ["보라","Purple"], + ["흰색","White"] ], fontSize: 11 } @@ -4024,8 +4022,9 @@ Entry.block = { "func": function(sprite, script) { var port = script.getStringField("PORT"); var value = script.getStringField("OPERATOR"); - Entry.hw.setDigitalPortValue("RainBowLED_IDX", port); - Entry.hw.setDigitalPortValue("RainBowLED_COL", value); + Entry.hw.setDigitalPortValue("RainBowLED_" + port, value); + Entry.hw.update(); + delete Entry.hw.sendQueue["RainBowLED_" + port]; return script.callReturn(); } }, @@ -4070,11 +4069,15 @@ Entry.block = { { console.log("servo 1 degree "+value); Entry.hw.setDigitalPortValue("Servo1", value); + Entry.hw.update(); + delete Entry.hw.sendQueue["Servo1"]; } if(port == 2) { console.log("servo 2 degree "+value); Entry.hw.setDigitalPortValue("Servo2", value); + Entry.hw.update(); + delete Entry.hw.sendQueue["Servo2"]; } return script.callReturn(); } @@ -4092,29 +4095,29 @@ Entry.block = { { type: "Dropdown", options: [ - ["(Low)So","L_So"], - ["(Low)So#","L_So#"], - ["(Low)La","L_La"], - ["(Low)La#","L_La#"], - ["(Low)Ti","L_Ti"], - ["Do","Do"], - ["Do#","Do#"], - ["Re","Re"], - ["Re#","Re#"], - ["Mi","Mi"], - ["Fa","Fa"], - ["Fa#","Fa#"], - ["So","So"], - ["So#","So#"], - ["La","La"], - ["La#","La#"], - ["Ti","Ti"], - ["(High)Do","H_Do"], - ["(High)Do#","H_Do#"], - ["(High)Re","H_Re"], - ["(High)R2#","H_Re#"], - ["(High)Mi","H_Mi"], - ["(High)Fa","H_Fa"] + ["((낮은)솔","L_So"], + ["(낮은)솔#","L_So#"], + ["(낮은)라","L_La"], + ["(낮은)라#","L_La#"], + ["(낮은)시","L_Ti"], + ["도","Do"], + ["도#","Do#"], + ["레","Re"], + ["레#","Re#"], + ["미","Mi"], + ["파","Fa"], + ["파#","Fa#"], + ["솔","So"], + ["솔#","So#"], + ["라","La"], + ["라#","La#"], + ["시","Ti"], + ["(높은)도","H_Do"], + ["(높은)도#","H_Do#"], + ["(높은)레","H_Re"], + ["(높은)레#","H_Re#"], + ["(높은)미#","H_Mi"], + ["(높은)파","H_Fa"] ], fontSize: 11 } @@ -4135,6 +4138,9 @@ Entry.block = { var melody = script.getStringField("MELODY"); console.log("cobl_melody"+melody); Entry.hw.setDigitalPortValue("Melody", melody); + Entry.hw.update(); + delete Entry.hw.sendQueue["Melody"]; + return script.callReturn(); } }, @@ -4159,9 +4165,9 @@ Entry.block = { { type: "Dropdown", options: [ - ["1.Clockwise","1"], - ["2.Counter Clockwise","2"], - ["3.Stop","3"] + ["1.시계방향","1"], + ["2.반시계방향","2"], + ["3.정지","3"] ], fontSize: 11 }, @@ -4202,10 +4208,16 @@ Entry.block = { if (motor == 1) { Entry.hw.setDigitalPortValue("DC1_DIR", direction); Entry.hw.setDigitalPortValue("DC1_SPEED", speed); + Entry.hw.update(); + delete Entry.hw.sendQueue["DC1_DIR"]; + delete Entry.hw.sendQueue["DC1_SPEED"]; } if (motor == 2) { Entry.hw.setDigitalPortValue("DC2_DIR", direction); Entry.hw.setDigitalPortValue("DC2_SPEED", speed); + Entry.hw.update(); + delete Entry.hw.sendQueue["DC2_DIR"]; + delete Entry.hw.sendQueue["DC2_SPEED"]; } return script.callReturn(); } @@ -4232,6 +4244,7 @@ Entry.block = { { type: "Dropdown", options: [ + ["0","0"], ["1","1"], ["2","2"], ["3","3"], @@ -4244,7 +4257,7 @@ Entry.block = { def: { params: [ "1", - "1" + "0" ], type: "cobl_extention_port" }, @@ -4259,11 +4272,16 @@ Entry.block = { var port = script.getStringField("PORT"); var level = script.getStringField("LEVEL"); - if(port == 1) + if(port == 1){ Entry.hw.setDigitalPortValue("EXUSB1", level); - if(port == 2) + Entry.hw.update(); + delete Entry.hw.sendQueue["EXUSB1"]; + } + if(port == 2){ Entry.hw.setDigitalPortValue("EXUSB2", level); - + Entry.hw.update(); + delete Entry.hw.sendQueue["EXUSB2"]; + } return script.callReturn(); } }, @@ -4286,6 +4304,7 @@ Entry.block = { { type: "Dropdown", options: [ + ["0","0"], ["1","1"], ["2","2"], ["3","3"], @@ -4301,6 +4320,7 @@ Entry.block = { }, { type: "Dropdown", options: [ + ["0","0"], ["1","1"], ["2","2"], ["3","3"], @@ -4316,6 +4336,7 @@ Entry.block = { }, { type: "Dropdown", options: [ + ["0","0"], ["1","1"], ["2","2"], ["3","3"], @@ -4358,6 +4379,12 @@ Entry.block = { Entry.hw.setDigitalPortValue("ELED_R", r); Entry.hw.setDigitalPortValue("ELED_G", g); Entry.hw.setDigitalPortValue("ELED_B", b); + Entry.hw.update(); + + delete Entry.hw.sendQueue["ELED_IDX"]; + delete Entry.hw.sendQueue["ELED_R"]; + delete Entry.hw.sendQueue["ELED_G"]; + delete Entry.hw.sendQueue["ELED_B"]; return script.callReturn(); } @@ -4392,6 +4419,9 @@ Entry.block = { "func": function(sprite, script) { var value = script.getNumberValue("VALUE"); Entry.hw.setDigitalPortValue("7SEG", value); + Entry.hw.update(); + delete Entry.hw.sendQueue["7SEG"]; + return script.callReturn(); } }, From de436e3dc75fe09f43789c2d03fdf2233767dcf1 Mon Sep 17 00:00:00 2001 From: cobl Date: Sun, 7 Aug 2016 08:04:12 +0900 Subject: [PATCH 07/15] cobl change modify block_entry --- dist/entry.js | 4386 ++++++++++----------------------------------- dist/entry.min.js | 2094 +++++----------------- 2 files changed, 1404 insertions(+), 5076 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index 501c6b621b..f669207d12 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -6590,7 +6590,6 @@ Entry.Utils.hexToHsl = function(a) { } return {h:360 * f, s:e, l:g}; }; -<<<<<<< HEAD Entry.Utils.hslToHex = function(a) { function b(b, a, c) { 0 > c && (c += 1); @@ -6615,49 +6614,6 @@ Entry.Utils.hslToHex = function(a) { a *= 255; e *= 255; return "#" + [c(Math.round(255 * d).toString(16)), c(Math.round(a).toString(16)), c(Math.round(e).toString(16))].join(""); -======= -Entry.Container.prototype.generateView = function(b, a) { - var c = this; - this._view = b; - this._view.addClass("entryContainer"); - this._view.addClass("entryContainerWorkspace"); - this._view.setAttribute("id", "entryContainerWorkspaceId"); - var d = Entry.createElement("div"); - d.addClass("entryAddObjectWorkspace"); - d.innerHTML = Lang.Workspace.add_object; - d.bindOnClick(function(a) { - Entry.dispatchEvent("openSpriteManager"); - }); - var d = Entry.createElement("div"), e = "entryContainerListWorkspaceWrapper"; - Entry.isForLecture && (e += " lecture"); - d.addClass(e); - Entry.Utils.disableContextmenu(d); - $(d).bind("mousedown touchstart", function(a) { - function b(a) { - q && 5 < Math.sqrt(Math.pow(a.pageX - q.x, 2) + Math.pow(a.pageY - q.y, 2)) && e && (clearTimeout(e), e = null); - } - function d(a) { - a.stopPropagation(); - l.unbind(".container"); - e && (clearTimeout(e), e = null); - } - var e = null, l = $(document), n = a.type, m = !1; - if (Entry.Utils.isRightButton(a)) { - c._rightClick(a), m = !0; - } else { - var q = {x:a.clientX, y:a.clientY}; - "touchstart" !== n || m || (a.stopPropagation(), a = Entry.Utils.convertMouseEvent(a), e = setTimeout(function() { - e && (e = null, c._rightClick(a)); - }, 1E3), l.bind("mousemove.container touchmove.container", b), l.bind("mouseup.container touchend.container", d)); - } - }); - this._view.appendChild(d); - e = Entry.createElement("ul"); - e.addClass("entryContainerListWorkspace"); - d.appendChild(e); - this.listView_ = e; - this.enableSort(); ->>>>>>> entrylabs/master }; Entry.Utils.bindGlobalEvent = function(a) { var b = $(document); @@ -6994,48 +6950,9 @@ Entry.setCloneBrush = function(a, b) { Entry.isFloat = function(a) { return /\d+\.{1}\d+/.test(a); }; -<<<<<<< HEAD Entry.getStringIndex = function(a) { if (!a) { return ""; -======= -Entry.Container.prototype._rightClick = function(b) { - b.stopPropagation && b.stopPropagation(); - var a = [{text:Lang.Blocks.Paste_blocks, enable:!Entry.engine.isState("run") && !!Entry.container.copiedObject, callback:function() { - Entry.container.copiedObject ? Entry.container.addCloneObject(Entry.container.copiedObject) : Entry.toast.alert(Lang.Workspace.add_object_alert, Lang.Workspace.object_not_found_for_paste); - }}]; - Entry.ContextMenu.show(a, "workspace-contextmenu", {x:b.clientX, y:b.clientY}); -}; -Entry.db = {data:{}, typeMap:{}}; -(function(b) { - b.add = function(a) { - this.data[a.id] = a; - var b = a.type; - void 0 === this.typeMap[b] && (this.typeMap[b] = {}); - this.typeMap[b][a.id] = a; - }; - b.has = function(a) { - return this.data.hasOwnProperty(a); - }; - b.remove = function(a) { - this.has(a) && (delete this.typeMap[this.data[a].type][a], delete this.data[a]); - }; - b.get = function(a) { - return this.data[a]; - }; - b.find = function() { - }; - b.clear = function() { - this.data = {}; - this.typeMap = {}; - }; -})(Entry.db); -Entry.Dom = function(b, a) { - var c = /<(\w+)>/, d; - d = b instanceof HTMLElement ? $(b) : b instanceof jQuery ? b : c.test(b) ? $(b) : $("<" + b + ">"); - if (void 0 === a) { - return d; ->>>>>>> entrylabs/master } for (var b = {string:a, index:1}, c = 0, d = [], e = a.length - 1;0 < e;--e) { var f = a.charAt(e); @@ -7185,57 +7102,15 @@ Entry.Utils.stopProjectWithToast = function(a, b, c) { "workspace" === Entry.type && (a.block && "funcBlock" in a.block ? d = a.block.funcBlock : a.funcExecutor && (d = a.funcExecutor.scope.block, a = a.type.replace("func_", ""), Entry.Func.edit(Entry.variableContainer.functions_[a])), d && (Entry.container.selectObject(d.getCode().object.id, !0), d.view.getBoard().activateBlock(d))); throw Error(b); }; -<<<<<<< HEAD Entry.Utils.AsyncError = function(a) { this.name = "AsyncError"; this.message = a || "\ube44\ub3d9\uae30 \ud638\ucd9c \ub300\uae30"; -======= -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 < b.indexOf(d) && a.preventDefault(); - } - this.state = "stop"; - this.popup = null; - this.isUpdating = !0; - this.speeds = [1, 15, 30, 45, 60]; - this._mouseMoved = !1; - this.queue = []; - Entry.keyPressed && Entry.keyPressed.attach(this, this.captureKeyEvent); - Entry.addEventListener("canvasClick", function(a) { - Entry.engine.fireEvent("mouse_clicked"); - }); - Entry.addEventListener("canvasClickCanceled", function(a) { - Entry.engine.fireEvent("mouse_click_cancled"); - }); - Entry.addEventListener("entityClick", function(a) { - Entry.engine.fireEventOnEntity("when_object_click", a); - }); - Entry.addEventListener("entityClickCanceled", function(a) { - Entry.engine.fireEventOnEntity("when_object_click_canceled", a); - }); - "phone" != Entry.type && (Entry.addEventListener("stageMouseMove", function(a) { - this._mouseMoved = !0; - }.bind(this)), Entry.addEventListener("stageMouseOut", function(a) { - Entry.engine.hideMouseView(); - })); - Entry.addEventListener("run", function() { - $(window).bind("keydown", b); - }); - Entry.addEventListener("stop", function() { - $(window).unbind("keydown", b); - }); - setInterval(function() { - this._mouseMoved && (this.updateMouseView(), this._mouseMoved = !1); - }.bind(this), 100); ->>>>>>> entrylabs/master }; Entry.Utils.AsyncError.prototype = Error(); Entry.Utils.AsyncError.prototype.constructor = Entry.Utils.AsyncError; Entry.Utils.isChrome = function() { return /chrom(e|ium)/.test(navigator.userAgent.toLowerCase()); }; -<<<<<<< HEAD Entry.Utils.waitForWebfonts = function(a, b) { for (var c = 0, d = 0, e = a.length;d < e;++d) { (function(d) { @@ -7262,55 +7137,6 @@ Entry.Utils.waitForWebfonts = function(a, b) { var l; e() || (l = setInterval(e, 50)); })(a[d]); -======= -Entry.Engine.prototype.toggleSpeedPanel = function() { - if (this.speedPanelOn) { - this.speedPanelOn = !1, $(Entry.stage.canvas.canvas).animate({top:"24px"}), this.coordinateButton.removeClass("entryRemove"), this.maximizeButton.removeClass("entryRemove"), this.mouseView.removeClass("entryRemoveElement"), $(this.speedLabel_).remove(), delete this.speedLabel_, $(this.speedProgress_).fadeOut(null, function(a) { - $(this).remove(); - delete this.speedProgress_; - }), $(this.speedHandle_).remove(), delete this.speedHandle_; - } else { - this.speedPanelOn = !0; - $(Entry.stage.canvas.canvas).animate({top:"41px"}); - this.coordinateButton.addClass("entryRemove"); - this.maximizeButton.addClass("entryRemove"); - this.mouseView.addClass("entryRemoveElement"); - this.speedLabel_ = Entry.createElement("div", "entrySpeedLabelWorkspace"); - this.speedLabel_.innerHTML = Lang.Workspace.speed; - this.view_.insertBefore(this.speedLabel_, this.maximizeButton); - this.speedProgress_ = Entry.createElement("table", "entrySpeedProgressWorkspace"); - for (var b = Entry.createElement("tr"), a = this.speeds, c = 0;5 > c;c++) { - (function(c) { - var d = Entry.createElement("td", "progressCell" + c); - d.bindOnClick(function() { - Entry.engine.setSpeedMeter(a[c]); - }); - b.appendChild(d); - })(c); - } - this.view_.insertBefore(this.speedProgress_, this.maximizeButton); - this.speedProgress_.appendChild(b); - this.speedHandle_ = Entry.createElement("div", "entrySpeedHandleWorkspace"); - var d = (Entry.interfaceState.canvasWidth - 84) / 5; - $(this.speedHandle_).bind("mousedown.speedPanel touchstart.speedPanel", function(a) { - function b(a) { - a.stopPropagation(); - a = Entry.Utils.convertMouseEvent(a); - a = Math.floor((a.clientX - 80) / (5 * d) * 5); - 0 > a || 4 < a || Entry.engine.setSpeedMeter(Entry.engine.speeds[a]); - } - function c(a) { - $(document).unbind(".speedPanel"); - } - a.stopPropagation && a.stopPropagation(); - a.preventDefault && a.preventDefault(); - if (0 === a.button || a.originalEvent && a.originalEvent.touches) { - Entry.Utils.convertMouseEvent(a), a = $(document), a.bind("mousemove.speedPanel touchmove.speedPanel", b), a.bind("mouseup.speedPanel touchend.speedPanel", c); - } - }); - this.view_.insertBefore(this.speedHandle_, this.maximizeButton); - this.setSpeedMeter(Entry.FPS); ->>>>>>> entrylabs/master } }; window.requestAnimFrame = function() { @@ -7318,6 +7144,20 @@ window.requestAnimFrame = function() { window.setTimeout(a, 1E3 / 60); }; }(); +Entry.isMobile = function() { + if (Entry.device) { + return "tablet" === Entry.device; + } + var a = window.platform; + if (a && a.type && ("tablet" === a.type || "mobile" === a.type)) { + return Entry.device = "tablet", !0; + } + Entry.device = "desktop"; + return !1; +}; +Entry.Utils.convertMouseEvent = function(a) { + return a.originalEvent && a.originalEvent.touches ? a.originalEvent.touches[0] : a; +}; Entry.Model = function(a, b) { var c = Entry.Model; c.generateSchema(a); @@ -7427,7 +7267,6 @@ Entry.Commander = function(a) { this._tempStorage = null; Entry.Command.editor = this.editor; }; -<<<<<<< HEAD (function(a) { a.do = function(b) { var a = this, d = Array.prototype.slice.call(arguments); @@ -7609,24 +7448,49 @@ Entry.Container = function() { this.cachedPicture = {}; this.inputValue = {}; this.currentObjects_ = this.copiedObject = null; -======= -Entry.Engine.prototype.update = function() { - Entry.engine.isState("run") && (Entry.engine.computeObjects(), Entry.engine.executeQueue(), Entry.hw.update()); ->>>>>>> entrylabs/master }; Entry.Container.prototype.generateView = function(a, b) { + var c = this; this._view = a; this._view.addClass("entryContainer"); - b && "workspace" != b ? "phone" == b && (this._view.addClass("entryContainerPhone"), a = Entry.createElement("div"), a.addClass("entryAddObjectWorkspace"), a.innerHTML = Lang.Workspace.add_object, a.bindOnClick(function(b) { - Entry.dispatchEvent("openSpriteManager"); - }), a = Entry.createElement("div"), a.addClass("entryContainerListPhoneWrapper"), this._view.appendChild(a), b = Entry.createElement("ul"), b.addClass("entryContainerListPhone"), a.appendChild(b), this.listView_ = b) : (this._view.addClass("entryContainerWorkspace"), this._view.setAttribute("id", "entryContainerWorkspaceId"), a = Entry.createElement("div"), a.addClass("entryAddObjectWorkspace"), a.innerHTML = Lang.Workspace.add_object, a.bindOnClick(function(b) { + this._view.addClass("entryContainerWorkspace"); + this._view.setAttribute("id", "entryContainerWorkspaceId"); + a = Entry.createElement("div"); + a.addClass("entryAddObjectWorkspace"); + a.innerHTML = Lang.Workspace.add_object; + a.bindOnClick(function(b) { Entry.dispatchEvent("openSpriteManager"); - }), a = Entry.createElement("div"), a.addClass("entryContainerListWorkspaceWrapper"), Entry.isForLecture && a.addClass("lecture"), Entry.Utils.disableContextmenu(a), $(a).on("contextmenu", function(b) { - b = [{text:Lang.Blocks.Paste_blocks, enable:!Entry.engine.isState("run") && !!Entry.container.copiedObject, callback:function() { - Entry.container.copiedObject ? Entry.container.addCloneObject(Entry.container.copiedObject) : Entry.toast.alert(Lang.Workspace.add_object_alert, Lang.Workspace.object_not_found_for_paste); - }}]; - Entry.ContextMenu.show(b, "workspace-contextmenu"); - }), this._view.appendChild(a), b = Entry.createElement("ul"), b.addClass("entryContainerListWorkspace"), a.appendChild(b), this.listView_ = b, this.enableSort()); + }); + a = Entry.createElement("div"); + b = "entryContainerListWorkspaceWrapper"; + Entry.isForLecture && (b += " lecture"); + a.addClass(b); + Entry.Utils.disableContextmenu(a); + $(a).bind("mousedown touchstart", function(b) { + function a(b) { + n && 5 < Math.sqrt(Math.pow(b.pageX - n.x, 2) + Math.pow(b.pageY - n.y, 2)) && g && (clearTimeout(g), g = null); + } + function f(b) { + b.stopPropagation(); + h.unbind(".container"); + g && (clearTimeout(g), g = null); + } + var g = null, h = $(document), k = b.type, l = !1; + if (Entry.Utils.isRightButton(b)) { + c._rightClick(b), l = !0; + } else { + var n = {x:b.clientX, y:b.clientY}; + "touchstart" !== k || l || (b.stopPropagation(), b = Entry.Utils.convertMouseEvent(b), g = setTimeout(function() { + g && (g = null, c._rightClick(b)); + }, 1E3), h.bind("mousemove.container touchmove.container", a), h.bind("mouseup.container touchend.container", f)); + } + }); + this._view.appendChild(a); + b = Entry.createElement("ul"); + b.addClass("entryContainerListWorkspace"); + a.appendChild(b); + this.listView_ = b; + this.enableSort(); }; Entry.Container.prototype.enableSort = function() { $ && $(this.listView_).sortable({start:function(a, b) { @@ -7743,7 +7607,6 @@ Entry.Container.prototype.removeObject = function(a) { Entry.playground.reloadPlayground(); return c; }; -<<<<<<< HEAD Entry.Container.prototype.selectObject = function(a, b) { a = this.getObject(a); b && a && Entry.scene.selectScene(a.scene); @@ -7754,15 +7617,6 @@ Entry.Container.prototype.selectObject = function(a, b) { a && (a.view_ && a.view_.addClass("selectedObject"), a.isSelected_ = !0); Entry.playground && Entry.playground.injectObject(a); "minimize" != Entry.type && Entry.engine.isState("stop") && Entry.stage.selectObject(a); -======= -Entry.Engine.prototype.pushQueue = function(b, a) { - b === a[0] && this.queue.push({eventName:a[1], entity:b}); -}; -Entry.Engine.prototype.captureKeyEvent = function(b) { - var a = b.keyCode, c = Entry.type; - b.ctrlKey && "workspace" == c ? 83 == a ? (b.preventDefault(), Entry.dispatchEvent("saveWorkspace")) : 82 == a ? (b.preventDefault(), Entry.engine.run()) : 90 == a && (b.preventDefault(), console.log("engine"), Entry.dispatchEvent(b.shiftKey ? "redo" : "undo")) : Entry.engine.isState("run") && Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent, ["keyPress", a]); - Entry.engine.isState("stop") && "workspace" === c && 37 <= a && 40 >= a && Entry.stage.moveSprite(b); ->>>>>>> entrylabs/master }; Entry.Container.prototype.getAllObjects = function() { return this.objects_; @@ -7930,7 +7784,6 @@ Entry.Container.prototype.mapObjectOnScene = function(a, b) { } return e; }; -<<<<<<< HEAD Entry.Container.prototype.clearRunningStateOnScene = function() { this.mapObjectOnScene(function(a) { a.clearExecutor(); @@ -7938,37 +7791,6 @@ Entry.Container.prototype.clearRunningStateOnScene = function() { a.clonedEntities[b - 1].removeClone(); } a.clonedEntities = []; -======= -Entry.Engine.prototype.executeQueue = function() { - this.queue.forEach(function(b) { - b.entity.parent.script.raiseEvent(b.eventName, b.entity); - }.bind(this)); - this.queue = []; -}; -Entry.EntityObject = function(b) { - this.parent = b; - this.type = b.objectType; - this.flip = !1; - this.collision = Entry.Utils.COLLISION.NONE; - this.id = Entry.generateHash(); - "sprite" == this.type ? (this.object = new createjs.Bitmap, this.effect = {}, this.setInitialEffectValue()) : "textBox" == this.type && (this.object = new createjs.Container, this.textObject = new createjs.Text, this.textObject.font = "20px Nanum Gothic", this.textObject.textBaseline = "middle", this.textObject.textAlign = "center", this.bgObject = new createjs.Shape, this.bgObject.graphics.setStrokeStyle(1).beginStroke("#f00").drawRect(0, 0, 100, 100), this.object.addChild(this.bgObject), this.object.addChild(this.textObject), - this.fontType = "Nanum Gothic", this.fontSize = 20, this.strike = this.underLine = this.fontItalic = this.fontBold = !1); - this.object.entity = this; - this.object.cursor = "pointer"; - this.object.on("mousedown", function(a) { - var b = this.entity.parent.id; - Entry.dispatchEvent("entityClick", this.entity); - Entry.stage.isObjectClick = !0; - "minimize" != Entry.type && Entry.engine.isState("stop") && (this.offset = {x:-this.parent.x + this.entity.getX() - (.75 * a.stageX - 240), y:-this.parent.y - this.entity.getY() - (.75 * a.stageY - 135)}, this.cursor = "move", this.entity.initCommand(), Entry.container.selectObject(b)); - }); - this.object.on("pressup", function(a) { - Entry.dispatchEvent("entityClickCanceled", this.entity); - this.cursor = "pointer"; - this.entity.checkCommand(); - }); - this.object.on("pressmove", function(a) { - "minimize" != Entry.type && Entry.engine.isState("stop") && !this.entity.parent.getLock() && (this.entity.doCommand(), this.entity.setX(.75 * a.stageX - 240 + this.offset.x), this.entity.setY(-(.75 * a.stageY - 135) - this.offset.y), Entry.stage.updateObject()); ->>>>>>> entrylabs/master }); }; Entry.Container.prototype.mapEntity = function(a, b) { @@ -8112,6 +7934,13 @@ Entry.Container.prototype.getView = function() { }; Entry.Container.prototype.resize = function() { }; +Entry.Container.prototype._rightClick = function(a) { + a.stopPropagation && a.stopPropagation(); + var b = [{text:Lang.Blocks.Paste_blocks, enable:!Entry.engine.isState("run") && !!Entry.container.copiedObject, callback:function() { + Entry.container.copiedObject ? Entry.container.addCloneObject(Entry.container.copiedObject) : Entry.toast.alert(Lang.Workspace.add_object_alert, Lang.Workspace.object_not_found_for_paste); + }}]; + Entry.ContextMenu.show(b, "workspace-contextmenu", {x:a.clientX, y:a.clientY}); +}; Entry.db = {data:{}, typeMap:{}}; (function(a) { a.add = function(b) { @@ -8316,6 +8145,7 @@ Entry.Engine = function() { this.isUpdating = !0; this.speeds = [1, 15, 30, 45, 60]; this._mouseMoved = !1; + this.queue = []; Entry.keyPressed && Entry.keyPressed.attach(this, this.captureKeyEvent); Entry.addEventListener("canvasClick", function(b) { Entry.engine.fireEvent("mouse_clicked"); @@ -8344,7 +8174,6 @@ Entry.Engine = function() { this._mouseMoved && (this.updateMouseView(), this._mouseMoved = !1); }.bind(this), 100); }; -<<<<<<< HEAD Entry.Engine.prototype.generateView = function(a, b) { if (b && "workspace" != b) { "minimize" == b ? (this.view_ = a, this.view_.addClass("entryEngine"), this.view_.addClass("entryEngineMinimize"), this.maximizeButton = Entry.createElement("button"), this.maximizeButton.addClass("entryEngineButtonMinimize"), this.maximizeButton.addClass("entryMaximizeButtonMinimize"), this.view_.appendChild(this.maximizeButton), this.maximizeButton.bindOnClick(function(b) { @@ -8459,45 +8288,6 @@ Entry.Engine.prototype.generateView = function(a, b) { this.mouseView.addClass("entryRemove"); this.view_.appendChild(this.mouseView); } -======= -Entry.EntityObject.prototype.getLineBreak = function() { - return this.lineBreak; -}; -Entry.EntityObject.prototype.setVisible = function(b) { - void 0 === b && (b = !0); - this.visible = b; - this.object.visible = this.visible; - this.dialog && this.syncDialogVisible(); - Entry.requestUpdate = !0; - return this.visible; -}; -Entry.EntityObject.prototype.getVisible = function() { - return this.visible; -}; -Entry.EntityObject.prototype.setImage = function(b) { - var a = this; - delete b._id; - Entry.assert("sprite" == this.type, "Set image is only for sprite object"); - b.id || (b.id = Entry.generateHash()); - this.picture = b; - var c = this.picture.dimension, d = this.getRegX() - this.getWidth() / 2, e = this.getRegY() - this.getHeight() / 2; - this.setWidth(c.width); - this.setHeight(c.height); - c.scaleX || (c.scaleX = this.getScaleX(), c.scaleY = this.getScaleY()); - this.setScaleX(this.scaleX); - this.setScaleY(this.scaleY); - this.setRegX(this.width / 2 + d); - this.setRegY(this.height / 2 + e); - var f = b.id + this.id, g = Entry.container.getCachedPicture(f); - g ? (Entry.image = g, this.object.image = g, this.object.cache(0, 0, this.getWidth(), this.getHeight())) : (g = new Image, b.fileurl ? g.src = b.fileurl : (b = b.filename, g.src = Entry.defaultPath + "/uploads/" + b.substring(0, 2) + "/" + b.substring(2, 4) + "/image/" + b + ".png"), g.onload = function(b) { - Entry.container.cachePicture(f, g); - Entry.image = g; - a.object.image = g; - a.object.cache(0, 0, a.getWidth(), a.getHeight()); - Entry.requestUpdate = !0; - }); - Entry.dispatchEvent("updateObject"); ->>>>>>> entrylabs/master }; Entry.Engine.prototype.toggleSpeedPanel = function() { if (this.speedPanelOn) { @@ -8517,22 +8307,33 @@ Entry.Engine.prototype.toggleSpeedPanel = function() { this.speedProgress_ = Entry.createElement("table", "entrySpeedProgressWorkspace"); for (var a = Entry.createElement("tr"), b = this.speeds, c = 0;5 > c;c++) { (function(c) { - var e = Entry.createElement("td", "progressCell" + c); - e.bindOnClick(function() { + var d = Entry.createElement("td", "progressCell" + c); + d.bindOnClick(function() { Entry.engine.setSpeedMeter(b[c]); }); - a.appendChild(e); + a.appendChild(d); })(c); } this.view_.insertBefore(this.speedProgress_, this.maximizeButton); this.speedProgress_.appendChild(a); this.speedHandle_ = Entry.createElement("div", "entrySpeedHandleWorkspace"); - c = (Entry.interfaceState.canvasWidth - 84) / 5; - $(this.speedHandle_).draggable({axis:"x", grid:[c, c], containment:[80, 0, 4 * c + 80, 0], drag:function(b, a) { - b = (a.position.left - 80) / (Entry.interfaceState.canvasWidth - 84) * 5; - b = Math.floor(b); - 0 > b || Entry.engine.setSpeedMeter(Entry.engine.speeds[b]); - }}); + var d = (Entry.interfaceState.canvasWidth - 84) / 5; + $(this.speedHandle_).bind("mousedown.speedPanel touchstart.speedPanel", function(b) { + function a(b) { + b.stopPropagation(); + b = Entry.Utils.convertMouseEvent(b); + b = Math.floor((b.clientX - 80) / (5 * d) * 5); + 0 > b || 4 < b || Entry.engine.setSpeedMeter(Entry.engine.speeds[b]); + } + function c(b) { + $(document).unbind(".speedPanel"); + } + b.stopPropagation && b.stopPropagation(); + b.preventDefault && b.preventDefault(); + if (0 === b.button || b.originalEvent && b.originalEvent.touches) { + Entry.Utils.convertMouseEvent(b), b = $(document), b.bind("mousemove.speedPanel touchmove.speedPanel", a), b.bind("mouseup.speedPanel touchend.speedPanel", c); + } + }); this.view_.insertBefore(this.speedHandle_, this.maximizeButton); this.setSpeedMeter(Entry.FPS); } @@ -8550,7 +8351,7 @@ Entry.Engine.prototype.stop = function() { this.ticker = null; }; Entry.Engine.prototype.update = function() { - Entry.engine.isState("run") && (Entry.engine.computeObjects(), Entry.hw.update()); + Entry.engine.isState("run") && (Entry.engine.computeObjects(), Entry.engine.executeQueue(), Entry.hw.update()); }; Entry.Engine.prototype.computeObjects = function() { Entry.container.mapObjectOnScene(this.computeFunction); @@ -8637,6 +8438,9 @@ Entry.Engine.prototype.fireEventOnEntity = function(a, b) { Entry.Engine.prototype.raiseEventOnEntity = function(a, b) { a === b[0] && a.parent.script.raiseEvent(b[1], a); }; +Entry.Engine.prototype.pushQueue = function(a, b) { + a === b[0] && this.queue.push({eventName:b[1], entity:a}); +}; Entry.Engine.prototype.captureKeyEvent = function(a) { var b = a.keyCode, c = Entry.type; a.ctrlKey && "workspace" == c ? 83 == b ? (a.preventDefault(), Entry.dispatchEvent("saveWorkspace")) : 82 == b ? (a.preventDefault(), Entry.engine.run()) : 90 == b && (a.preventDefault(), console.log("engine"), Entry.dispatchEvent(a.shiftKey ? "redo" : "undo")) : Entry.engine.isState("run") && Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent, ["keyPress", b]); @@ -8710,6 +8514,12 @@ Entry.Engine.prototype.updateProjectTimer = function(a) { "undefined" == typeof a ? c.isPaused || b.isState("pause") || c.setValue((d - c.start - c.pausedTime) / 1E3) : (c.setValue(a), c.pausedTime = 0, c.start = d); } }; +Entry.Engine.prototype.executeQueue = function() { + this.queue.forEach(function(a) { + a.entity.parent.script.raiseEvent(a.eventName, a.entity); + }.bind(this)); + this.queue = []; +}; Entry.EntityObject = function(a) { this.parent = a; this.type = a.objectType; @@ -8835,336 +8645,12 @@ Entry.EntityObject.prototype.setScaleX = function(a) { Entry.EntityObject.prototype.getScaleX = function() { return this.scaleX; }; -<<<<<<< HEAD Entry.EntityObject.prototype.setScaleY = function(a) { this.scaleY = a; this.object.scaleY = this.scaleY; this.parent.updateCoordinateView(); this.updateDialog(); Entry.requestUpdate = !0; -======= -Entry.EntryObject.prototype.generateView = function() { - if ("workspace" == Entry.type) { - var b = Entry.createElement("li", this.id); - b.addClass("entryContainerListElementWorkspace"); - b.object = this; - Entry.Utils.disableContextmenu(b); - var a = this; - longPressTimer = null; - $(b).bind("mousedown touchstart", function(b) { - function c(a) { - a.stopPropagation(); - h && 5 < Math.sqrt(Math.pow(a.pageX - h.x, 2) + Math.pow(a.pageY - h.y, 2)) && longPressTimer && (clearTimeout(longPressTimer), longPressTimer = null); - } - function d(a) { - a.stopPropagation(); - e.unbind(".object"); - longPressTimer && (clearTimeout(longPressTimer), longPressTimer = null); - } - Entry.container.getObject(this.id) && Entry.container.selectObject(this.id); - var e = $(document), f = b.type, g = !1; - if (Entry.Utils.isRightButton(b)) { - b.stopPropagation(), Entry.documentMousedown.notify(b), g = !0, a._rightClick(b); - } else { - var h = {x:b.clientX, y:b.clientY}; - "touchstart" !== f || g || (b.stopPropagation(), Entry.documentMousedown.notify(b), longPressTimer = setTimeout(function() { - longPressTimer && (longPressTimer = null, a._rightClick(b)); - }, 1E3), e.bind("mousemove.object touchmove.object", c), e.bind("mouseup.object touchend.object", d)); - } - }); - this.view_ = b; - var c = this, b = Entry.createElement("ul"); - b.addClass("objectInfoView"); - Entry.objectEditable || b.addClass("entryHide"); - var d = Entry.createElement("li"); - d.addClass("objectInfo_visible"); - this.entity.getVisible() || d.addClass("objectInfo_unvisible"); - d.bindOnClick(function(a) { - Entry.engine.isState("run") || (a = c.entity, a.setVisible(!a.getVisible()) ? this.removeClass("objectInfo_unvisible") : this.addClass("objectInfo_unvisible")); - }); - var e = Entry.createElement("li"); - e.addClass("objectInfo_unlock"); - this.getLock() && e.addClass("objectInfo_lock"); - e.bindOnClick(function(a) { - Entry.engine.isState("run") || (a = c, a.setLock(!a.getLock()) ? this.addClass("objectInfo_lock") : this.removeClass("objectInfo_lock"), a.updateInputViews(a.getLock())); - }); - b.appendChild(d); - b.appendChild(e); - this.view_.appendChild(b); - b = Entry.createElement("div"); - b.addClass("entryObjectThumbnailWorkspace"); - this.view_.appendChild(b); - this.thumbnailView_ = b; - b = Entry.createElement("div"); - b.addClass("entryObjectWrapperWorkspace"); - this.view_.appendChild(b); - d = Entry.createElement("input"); - d.bindOnClick(function(a) { - a.preventDefault(); - Entry.container.selectObject(c.id); - this.readOnly || (this.focus(), this.select()); - }); - d.addClass("entryObjectNameWorkspace"); - b.appendChild(d); - this.nameView_ = d; - this.nameView_.entryObject = this; - d.setAttribute("readonly", !0); - var f = this; - this.nameView_.onblur = function(a) { - this.entryObject.name = this.value; - Entry.playground.reloadPlayground(); - }; - this.nameView_.onkeypress = function(a) { - 13 == a.keyCode && f.editObjectValues(!1); - }; - this.nameView_.value = this.name; - d = Entry.createElement("div"); - d.addClass("entryObjectEditWorkspace"); - d.object = this; - this.editView_ = d; - this.view_.appendChild(d); - $(d).mousedown(function(b) { - var c = a.isEditing; - b.stopPropagation(); - Entry.documentMousedown.notify(b); - Entry.engine.isState("run") || !1 !== c || (a.editObjectValues(!c), Entry.playground.object !== a && Entry.container.selectObject(a.id), a.nameView_.select()); - }); - d.blur = function(b) { - a.editObjectComplete(); - }; - 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"); - e.innerHTML = Lang.Workspace.rotation + " : "; - var m = Entry.createElement("input"); - m.addClass("entryObjectRotateInputWorkspace"); - m.setAttribute("readonly", !0); - m.bindOnClick(function(a) { - a.stopPropagation(); - this.select(); - }); - this.rotateSpan_ = e; - this.rotateInput_ = m; - h = Entry.createElement("span"); - h.addClass("entryObjectDirectionSpanWorkspace"); - h.innerHTML = Lang.Workspace.direction + " : "; - var q = Entry.createElement("input"); - q.addClass("entryObjectDirectionInputWorkspace"); - q.setAttribute("readonly", !0); - q.bindOnClick(function(a) { - a.stopPropagation(); - this.select(); - }); - this.directionInput_ = q; - d.appendChild(e); - d.appendChild(m); - d.appendChild(h); - d.appendChild(q); - d.rotateInput_ = m; - d.directionInput_ = q; - c = this; - m.onkeypress = function(a) { - 13 == a.keyCode && c.editObjectValues(!1); - }; - m.onblur = function(a) { - a = m.value; - -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))); - isNaN(a) || c.entity.setRotation(Number(a)); - c.updateRotationView(); - Entry.stage.updateObject(); - }; - q.onkeypress = function(a) { - 13 == a.keyCode && c.editObjectValues(!1); - }; - q.onblur = function(a) { - a = q.value; - -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))); - isNaN(a) || c.entity.setDirection(Number(a)); - c.updateRotationView(); - Entry.stage.updateObject(); - }; - d = Entry.createElement("div"); - d.addClass("rotationMethodWrapper"); - b.appendChild(d); - this.rotationMethodWrapper_ = d; - b = Entry.createElement("span"); - b.addClass("entryObjectRotateMethodLabelWorkspace"); - d.appendChild(b); - b.innerHTML = Lang.Workspace.rotate_method + " : "; - b = Entry.createElement("div"); - b.addClass("entryObjectRotateModeWorkspace"); - b.addClass("entryObjectRotateModeAWorkspace"); - b.object = this; - this.rotateModeAView_ = b; - d.appendChild(b); - b.bindOnClick(function(a) { - Entry.engine.isState("run") || this.object.getLock() || (this.object.initRotateValue("free"), this.object.setRotateMethod("free")); - }); - b = Entry.createElement("div"); - b.addClass("entryObjectRotateModeWorkspace"); - b.addClass("entryObjectRotateModeBWorkspace"); - b.object = this; - this.rotateModeBView_ = b; - d.appendChild(b); - b.bindOnClick(function(a) { - Entry.engine.isState("run") || this.object.getLock() || (this.object.initRotateValue("vertical"), this.object.setRotateMethod("vertical")); - }); - b = Entry.createElement("div"); - b.addClass("entryObjectRotateModeWorkspace"); - b.addClass("entryObjectRotateModeCWorkspace"); - b.object = this; - this.rotateModeCView_ = b; - d.appendChild(b); - b.bindOnClick(function(a) { - Entry.engine.isState("run") || this.object.getLock() || (this.object.initRotateValue("none"), this.object.setRotateMethod("none")); - }); - this.updateThumbnailView(); - this.updateCoordinateView(); - this.updateRotateMethodView(); - this.updateInputViews(); - this.updateCoordinateView(!0); - this.updateRotationView(!0); - return this.view_; - } - if ("phone" == Entry.type) { - return b = Entry.createElement("li", this.id), b.addClass("entryContainerListElementWorkspace"), b.object = this, b.bindOnClick(function(a) { - Entry.container.getObject(this.id) && Entry.container.selectObject(this.id); - }), $ && (a = this, context.attach("#" + this.id, [{text:Lang.Workspace.context_rename, href:"/", action:function(a) { - a.preventDefault(); - }}, {text:Lang.Workspace.context_duplicate, href:"/", action:function(b) { - b.preventDefault(); - Entry.container.addCloneObject(a); - }}, {text:Lang.Workspace.context_remove, href:"/", action:function(b) { - b.preventDefault(); - Entry.container.removeObject(a); - }}])), this.view_ = b, b = Entry.createElement("ul"), b.addClass("objectInfoView"), d = Entry.createElement("li"), d.addClass("objectInfo_visible"), e = Entry.createElement("li"), e.addClass("objectInfo_lock"), b.appendChild(d), b.appendChild(e), this.view_.appendChild(b), b = Entry.createElement("div"), b.addClass("entryObjectThumbnailWorkspace"), this.view_.appendChild(b), this.thumbnailView_ = b, b = Entry.createElement("div"), b.addClass("entryObjectWrapperWorkspace"), this.view_.appendChild(b), - d = Entry.createElement("input"), d.addClass("entryObjectNameWorkspace"), b.appendChild(d), this.nameView_ = d, this.nameView_.entryObject = this, this.nameView_.onblur = function() { - this.entryObject.name = this.value; - Entry.playground.reloadPlayground(); - }, this.nameView_.onkeypress = function(a) { - 13 == a.keyCode && c.editObjectValues(!1); - }, this.nameView_.value = this.name, Entry.objectEditable && Entry.objectDeletable && (d = Entry.createElement("div"), d.addClass("entryObjectDeletePhone"), d.object = this, this.deleteView_ = d, this.view_.appendChild(d), d.bindOnClick(function(a) { - Entry.engine.isState("run") || Entry.container.removeObject(this.object); - })), d = Entry.createElement("button"), d.addClass("entryObjectEditPhone"), d.object = this, d.bindOnClick(function(a) { - if (a = Entry.container.getObject(this.id)) { - Entry.container.selectObject(a.id), Entry.playground.injectObject(a); - } - }), this.view_.appendChild(d), d = Entry.createElement("div"), d.addClass("entryObjectInformationWorkspace"), d.object = this, this.isInformationToggle = !1, b.appendChild(d), this.informationView_ = d, d = Entry.createElement("div"), d.addClass("entryObjectRotateLabelWrapperWorkspace"), this.view_.appendChild(d), this.rotateLabelWrapperView_ = d, e = Entry.createElement("span"), e.addClass("entryObjectRotateSpanWorkspace"), e.innerHTML = Lang.Workspace.rotation + " : ", m = Entry.createElement("input"), - m.addClass("entryObjectRotateInputWorkspace"), this.rotateSpan_ = e, this.rotateInput_ = m, h = Entry.createElement("span"), h.addClass("entryObjectDirectionSpanWorkspace"), h.innerHTML = Lang.Workspace.direction + " : ", q = Entry.createElement("input"), q.addClass("entryObjectDirectionInputWorkspace"), this.directionInput_ = q, d.appendChild(e), d.appendChild(m), d.appendChild(h), d.appendChild(q), d.rotateInput_ = m, d.directionInput_ = q, c = this, m.onkeypress = function(a) { - 13 == a.keyCode && (a = m.value, -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))), isNaN(a) || c.entity.setRotation(Number(a)), c.updateRotationView(), m.blur()); - }, m.onblur = function(a) { - c.entity.setRotation(c.entity.getRotation()); - Entry.stage.updateObject(); - }, q.onkeypress = function(a) { - 13 == a.keyCode && (a = q.value, -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))), isNaN(a) || c.entity.setDirection(Number(a)), c.updateRotationView(), q.blur()); - }, q.onblur = function(a) { - c.entity.setDirection(c.entity.getDirection()); - Entry.stage.updateObject(); - }, b = Entry.createElement("div"), b.addClass("entryObjectRotationWrapperWorkspace"), b.object = this, this.view_.appendChild(b), d = Entry.createElement("span"), d.addClass("entryObjectCoordinateWorkspace"), b.appendChild(d), e = Entry.createElement("span"), e.addClass("entryObjectCoordinateSpanWorkspace"), e.innerHTML = "X:", g = Entry.createElement("input"), g.addClass("entryObjectCoordinateInputWorkspace"), h = Entry.createElement("span"), h.addClass("entryObjectCoordinateSpanWorkspace"), - h.innerHTML = "Y:", k = Entry.createElement("input"), k.addClass("entryObjectCoordinateInputWorkspace entryObjectCoordinateInputWorkspace_right"), l = Entry.createElement("span"), l.addClass("entryObjectCoordinateSpanWorkspace"), l.innerHTML = Lang.Workspace.Size, n = Entry.createElement("input"), n.addClass("entryObjectCoordinateInputWorkspace", "entryObjectCoordinateInputWorkspace_size"), d.appendChild(e), d.appendChild(g), d.appendChild(h), d.appendChild(k), d.appendChild(l), d.appendChild(n), - d.xInput_ = g, d.yInput_ = k, d.sizeInput_ = n, this.coordinateView_ = d, c = this, g.onkeypress = function(a) { - 13 == a.keyCode && (isNaN(g.value) || c.entity.setX(Number(g.value)), c.updateCoordinateView(), c.blur()); - }, g.onblur = function(a) { - c.entity.setX(c.entity.getX()); - Entry.stage.updateObject(); - }, k.onkeypress = function(a) { - 13 == a.keyCode && (isNaN(k.value) || c.entity.setY(Number(k.value)), c.updateCoordinateView(), c.blur()); - }, k.onblur = function(a) { - c.entity.setY(c.entity.getY()); - Entry.stage.updateObject(); - }, d = Entry.createElement("div"), d.addClass("rotationMethodWrapper"), b.appendChild(d), this.rotationMethodWrapper_ = d, b = Entry.createElement("span"), b.addClass("entryObjectRotateMethodLabelWorkspace"), d.appendChild(b), b.innerHTML = Lang.Workspace.rotate_method + " : ", b = Entry.createElement("div"), b.addClass("entryObjectRotateModeWorkspace"), b.addClass("entryObjectRotateModeAWorkspace"), b.object = this, this.rotateModeAView_ = b, d.appendChild(b), b.bindOnClick(function(a) { - Entry.engine.isState("run") || this.object.setRotateMethod("free"); - }), b = Entry.createElement("div"), b.addClass("entryObjectRotateModeWorkspace"), b.addClass("entryObjectRotateModeBWorkspace"), b.object = this, this.rotateModeBView_ = b, d.appendChild(b), b.bindOnClick(function(a) { - Entry.engine.isState("run") || this.object.setRotateMethod("vertical"); - }), b = Entry.createElement("div"), b.addClass("entryObjectRotateModeWorkspace"), b.addClass("entryObjectRotateModeCWorkspace"), b.object = this, this.rotateModeCView_ = b, d.appendChild(b), b.bindOnClick(function(a) { - Entry.engine.isState("run") || this.object.setRotateMethod("none"); - }), this.updateThumbnailView(), this.updateCoordinateView(), this.updateRotateMethodView(), this.updateInputViews(), this.view_; - } ->>>>>>> entrylabs/master }; Entry.EntityObject.prototype.getScaleY = function() { return this.scaleY; @@ -9295,15 +8781,9 @@ Entry.EntityObject.prototype.getFontSize = function(a) { Entry.EntityObject.prototype.setFontSize = function(a) { "textBox" == this.parent.objectType && this.fontSize != a && (this.fontSize = a ? a : 20, this.syncFont(), this.alignTextBox()); }; -<<<<<<< HEAD Entry.EntityObject.prototype.setFontBold = function(a) { this.fontBold = a; Entry.requestUpdate = !0; -======= -Entry.EntryObject.prototype.addCloneEntity = function(b, a, c) { - this.clonedEntities.length > Entry.maxCloneLimit || (b = new Entry.EntityObject(this), a ? (b.injectModel(a.picture ? a.picture : null, a.toJSON()), b.snapshot_ = a.snapshot_, a.effect && (b.effect = Entry.cloneSimpleObject(a.effect), b.applyFilter()), a.brush && Entry.setCloneBrush(b, a.brush)) : (b.injectModel(this.entity.picture ? this.entity.picture : null, this.entity.toJSON(b)), b.snapshot_ = this.entity.snapshot_, this.entity.effect && (b.effect = Entry.cloneSimpleObject(this.entity.effect), - b.applyFilter()), this.entity.brush && Entry.setCloneBrush(b, this.entity.brush)), Entry.engine.pushQueue(b, [b, "when_clone_start"]), b.isClone = !0, b.isStarted = !0, this.addCloneVariables(this, b, a ? a.variables : null, a ? a.lists : null), this.clonedEntities.push(b), Entry.stage.loadEntity(b)); ->>>>>>> entrylabs/master }; Entry.EntityObject.prototype.toggleFontBold = function() { this.fontBold = !this.fontBold; @@ -9372,34 +8852,27 @@ Entry.EntityObject.prototype.getVisible = function() { return this.visible; }; Entry.EntityObject.prototype.setImage = function(a) { + var b = this; delete a._id; Entry.assert("sprite" == this.type, "Set image is only for sprite object"); a.id || (a.id = Entry.generateHash()); this.picture = a; - var b = this.picture.dimension, c = this.getRegX() - this.getWidth() / 2, d = this.getRegY() - this.getHeight() / 2; - this.setWidth(b.width); - this.setHeight(b.height); - b.scaleX || (b.scaleX = this.getScaleX(), b.scaleY = this.getScaleY()); + var c = this.picture.dimension, d = this.getRegX() - this.getWidth() / 2, e = this.getRegY() - this.getHeight() / 2; + this.setWidth(c.width); + this.setHeight(c.height); + c.scaleX || (c.scaleX = this.getScaleX(), c.scaleY = this.getScaleY()); this.setScaleX(this.scaleX); this.setScaleY(this.scaleY); - this.setRegX(this.width / 2 + c); - this.setRegY(this.height / 2 + d); - var e = Entry.container.getCachedPicture(a.id); - if (e) { - Entry.image = e, this.object.image = e, this.object.cache(0, 0, this.getWidth(), this.getHeight()); - } else { - e = new Image; - a.fileurl ? e.src = a.fileurl : (b = a.filename, e.src = Entry.defaultPath + "/uploads/" + b.substring(0, 2) + "/" + b.substring(2, 4) + "/image/" + b + ".png"); - var f = this; - e.onload = function(b) { - Entry.container.cachePicture(a.id, e); - Entry.image = e; - f.object.image = e; - f.object.cache(0, 0, f.getWidth(), f.getHeight()); - f = null; - Entry.requestUpdate = !0; - }; - } + this.setRegX(this.width / 2 + d); + this.setRegY(this.height / 2 + e); + var f = a.id + this.id, g = Entry.container.getCachedPicture(f); + g ? (Entry.image = g, this.object.image = g, this.object.cache(0, 0, this.getWidth(), this.getHeight())) : (g = new Image, a.fileurl ? g.src = a.fileurl : (a = a.filename, g.src = Entry.defaultPath + "/uploads/" + a.substring(0, 2) + "/" + a.substring(2, 4) + "/image/" + a + ".png"), g.onload = function(a) { + Entry.container.cachePicture(f, g); + Entry.image = g; + b.object.image = g; + b.object.cache(0, 0, b.getWidth(), b.getHeight()); + Entry.requestUpdate = !0; + }); Entry.dispatchEvent("updateObject"); }; Entry.EntityObject.prototype.applyFilter = function() { @@ -9511,7 +8984,6 @@ Entry.EntityObject.prototype.updateBG = function() { } } }; -<<<<<<< HEAD Entry.EntityObject.prototype.alignTextBox = function() { if ("textBox" == this.type) { var a = this.textObject; @@ -9531,21 +9003,6 @@ Entry.EntityObject.prototype.alignTextBox = function() { a.maxHeight = this.getHeight(); } else { a.x = 0, a.y = 0; -======= -Entry.EntryObject.prototype.editObjectValues = function(b) { - var a; - a = this.getLock() ? [this.nameView_] : [this.coordinateView_.xInput_, this.coordinateView_.yInput_, this.rotateInput_, this.directionInput_, this.coordinateView_.sizeInput_]; - if (b) { - var c = this.nameView_; - $(a).removeClass("selectedNotEditingObject"); - $(c).removeClass("selectedNotEditingObject"); - window.setTimeout(function() { - $(c).removeAttr("readonly"); - c.addClass("selectedEditingObject"); - }); - for (b = 0;b < a.length;b++) { - $(a[b]).removeAttr("readonly"), a[b].addClass("selectedEditingObject"); ->>>>>>> entrylabs/master } } }; @@ -9570,13 +9027,7 @@ Entry.Func = function(a) { for (var c in a) { Entry.Func.registerParamBlock(a[c].type); } -<<<<<<< HEAD Entry.Func.generateWsBlock(this); -======= - this.nameView_.blur(!0); - this.blurAllInput(); - this.isEditing = !1; ->>>>>>> entrylabs/master } Entry.Func.registerFunction(this); Entry.Func.updateMenu(); @@ -9607,40 +9058,12 @@ Entry.Func.prototype.init = function(a) { Entry.Func.prototype.destroy = function() { this.blockMenuBlock.destroy(); }; -<<<<<<< HEAD Entry.Func.edit = function(a) { this.cancelEdit(); this.targetFunc = a; this.initEditView(a.content); this.bindFuncChangeEvent(); this.updateMenu(); -======= -Entry.EntryObject.prototype._rightClick = function(b) { - var a = this, c = [{text:Lang.Workspace.context_rename, callback:function(b) { - b.stopPropagation(); - a.setLock(!1); - a.editObjectValues(!0); - a.nameView_.select(); - }}, {text:Lang.Workspace.context_duplicate, enable:!Entry.engine.isState("run"), callback:function() { - Entry.container.addCloneObject(a); - }}, {text:Lang.Workspace.context_remove, callback:function() { - Entry.container.removeObject(a); - }}, {text:Lang.Workspace.copy_file, callback:function() { - Entry.container.setCopiedObject(a); - }}, {text:Lang.Blocks.Paste_blocks, enable:!Entry.engine.isState("run") && !!Entry.container.copiedObject, callback:function() { - Entry.container.copiedObject ? Entry.container.addCloneObject(Entry.container.copiedObject) : Entry.toast.alert(Lang.Workspace.add_object_alert, Lang.Workspace.object_not_found_for_paste); - }}]; - b = Entry.Utils.convertMouseEvent(b); - Entry.ContextMenu.show(c, "workspace-contextmenu", {x:b.clientX, y:b.clientY}); -}; -Entry.Painter = function() { - this.toolbox = {selected:"cursor"}; - this.stroke = {enabled:!1, fillColor:"#000000", lineColor:"#000000", thickness:1, fill:!0, transparent:!1, style:"line", locked:!1}; - this.file = {id:Entry.generateHash(), name:"\uc0c8\uadf8\ub9bc", modified:!1, mode:"new"}; - this.font = {name:"KoPub Batang", size:20, style:"normal"}; - this.selectArea = {}; - this.firstStatement = !1; ->>>>>>> entrylabs/master }; Entry.Func.initEditView = function(a) { this.menuCode || this.setupMenuCode(); @@ -9869,7 +9292,6 @@ p.getView = function() { }; p.resize = function() { }; -<<<<<<< HEAD Entry.HWMontior = {}; Entry.HWMonitor = function(a) { this.svgDom = Entry.Dom($('')); @@ -10004,27 +9426,6 @@ Entry.HWMonitor = function(a) { if (a) { for (g in a) { 0 != a[g] && f[g] && (f[g].type = "output"); -======= -Entry.Painter.prototype.fill = function() { - if (!this.stroke.locked) { - this.stroke.locked = !0; - this.initCommand(); - this.doCommand(); - this.clearHandle(); - var b = this.canvas.width, a = this.canvas.height; - this.colorLayerData = this.ctx.getImageData(0, 0, b, a); - var c = new createjs.Point(this.stage.mouseX, this.stage.mouseY); - c.x = Math.round(c.x); - c.y = Math.round(c.y); - for (var d = 4 * (c.y * b + c.x), e = this.colorLayerData.data[d], f = this.colorLayerData.data[d + 1], g = this.colorLayerData.data[d + 2], h = this.colorLayerData.data[d + 3], k, l, c = [[c.x, c.y]], n = Entry.hex2rgb(this.stroke.lineColor);c.length;) { - for (var d = c.pop(), m = d[0], q = d[1], d = 4 * (q * b + m);0 <= q && this.matchColor(d, e, f, g, h);) { - --q, d -= 4 * b; - } - d += 4 * b; - q += 1; - for (l = k = !1;q < a - 1 && this.matchColor(d, e, f, g, h);) { - q += 1, this.colorPixel(d, n.r, n.g, n.b), 0 < m && (this.matchColor(d - 4, e, f, g, h) ? k || (c.push([m - 1, q]), k = !0) : k && (k = !1)), m < b - 1 && (this.matchColor(d + 4, e, f, g, h) ? l || (c.push([m + 1, q]), l = !0) : l && (l = !1)), d += 4 * b; ->>>>>>> entrylabs/master } } for (var h in f) { @@ -10111,12 +9512,12 @@ Entry.Painter.prototype.fill = function() { } h < f - e && (f = h / 2 + 3, e = -h / 2 - 3); for (;1 < b.length;) { - var k = b.shift(), l = b.pop(), q = e, n = f, m = d; - h <= f - e ? (e += k.width + 5, f -= l.width + 5, m = 0) : 0 === b.length ? (e = (e + f) / 2 - 3, f = e + 6) : (e = Math.max(e, -g / 2 + k.width) + 15, f = Math.min(f, g / 2 - l.width) - 15); - this._movePort(k, e, a, q); - this._movePort(l, f, a, n); + var k = b.shift(), l = b.pop(), n = e, m = f, q = d; + h <= f - e ? (e += k.width + 5, f -= l.width + 5, q = 0) : 0 === b.length ? (e = (e + f) / 2 - 3, f = e + 6) : (e = Math.max(e, -g / 2 + k.width) + 15, f = Math.min(f, g / 2 - l.width) - 15); + this._movePort(k, e, a, n); + this._movePort(l, f, a, m); h -= k.width + l.width + 10; - a += m; + a += q; } b.length && this._movePort(b[0], (f + e - b[0].width) / 2, a, 100); }; @@ -10353,7 +9754,7 @@ Entry.init = function(a, b) { "workspace" == this.type && this.isPhone() && (this.type = "phone"); this.initialize_(); this.view_ = a; - this.view_.setAttribute("class", "entry"); + "tablet" === this.device ? this.view_.setAttribute("class", "entry tablet") : this.view_.setAttribute("class", "entry"); Entry.initFonts(b.fonts); this.createDom(a, this.type); this.loadInterfaceState(); @@ -10472,6 +9873,7 @@ Entry.start = function(a) { }; Entry.parseOptions = function(a) { this.type = a.type; + a.device && (this.device = a.device); this.projectSaveable = a.projectsaveable; void 0 === this.projectSaveable && (this.projectSaveable = !0); this.objectAddable = a.objectaddable; @@ -10717,28 +10119,29 @@ Entry.EntryObject.prototype.generateView = function() { var a = Entry.createElement("li", this.id); a.addClass("entryContainerListElementWorkspace"); a.object = this; - a.bindOnClick(function(b) { - Entry.container.getObject(this.id) && Entry.container.selectObject(this.id); - }); Entry.Utils.disableContextmenu(a); var b = this; - $(a).on("contextmenu", function(a) { - a = [{text:Lang.Workspace.context_rename, callback:function(a) { - a.stopPropagation(); - a = b; - a.setLock(!1); - a.editObjectValues(!0); - a.nameView_.select(); - }}, {text:Lang.Workspace.context_duplicate, enable:!Entry.engine.isState("run"), callback:function() { - Entry.container.addCloneObject(b); - }}, {text:Lang.Workspace.context_remove, callback:function() { - Entry.container.removeObject(b); - }}, {text:Lang.Workspace.copy_file, callback:function() { - Entry.container.setCopiedObject(b); - }}, {text:Lang.Blocks.Paste_blocks, enable:!Entry.engine.isState("run") && !!Entry.container.copiedObject, callback:function() { - Entry.container.copiedObject ? Entry.container.addCloneObject(Entry.container.copiedObject) : Entry.toast.alert(Lang.Workspace.add_object_alert, Lang.Workspace.object_not_found_for_paste); - }}]; - Entry.ContextMenu.show(a, "workspace-contextmenu"); + longPressTimer = null; + $(a).bind("mousedown touchstart", function(a) { + function c(b) { + b.stopPropagation(); + h && 5 < Math.sqrt(Math.pow(b.pageX - h.x, 2) + Math.pow(b.pageY - h.y, 2)) && longPressTimer && (clearTimeout(longPressTimer), longPressTimer = null); + } + function d(b) { + b.stopPropagation(); + e.unbind(".object"); + longPressTimer && (clearTimeout(longPressTimer), longPressTimer = null); + } + Entry.container.getObject(this.id) && Entry.container.selectObject(this.id); + var e = $(document), f = a.type, g = !1; + if (Entry.Utils.isRightButton(a)) { + a.stopPropagation(), Entry.documentMousedown.notify(a), g = !0, b._rightClick(a); + } else { + var h = {x:a.clientX, y:a.clientY}; + "touchstart" !== f || g || (a.stopPropagation(), Entry.documentMousedown.notify(a), longPressTimer = setTimeout(function() { + longPressTimer && (longPressTimer = null, b._rightClick(a)); + }, 1E3), e.bind("mousemove.object touchmove.object", c), e.bind("mouseup.object touchend.object", d)); + } }); this.view_ = a; var c = this, a = Entry.createElement("ul"); @@ -10839,22 +10242,22 @@ Entry.EntryObject.prototype.generateView = function() { var l = Entry.createElement("span"); l.addClass("entryObjectCoordinateSizeWorkspace"); l.innerHTML = Lang.Workspace.Size + " : "; - var q = Entry.createElement("input"); - q.addClass("entryObjectCoordinateInputWorkspace", "entryObjectCoordinateInputWorkspace_size"); - q.bindOnClick(function(b) { + var n = Entry.createElement("input"); + n.addClass("entryObjectCoordinateInputWorkspace", "entryObjectCoordinateInputWorkspace_size"); + n.bindOnClick(function(b) { b.stopPropagation(); this.select(); }); - q.setAttribute("readonly", !0); + n.setAttribute("readonly", !0); d.appendChild(e); d.appendChild(g); d.appendChild(h); d.appendChild(k); d.appendChild(l); - d.appendChild(q); + d.appendChild(n); d.xInput_ = g; d.yInput_ = k; - d.sizeInput_ = q; + d.sizeInput_ = n; this.coordinateView_ = d; c = this; g.onkeypress = function(b) { @@ -10873,11 +10276,11 @@ Entry.EntryObject.prototype.generateView = function() { c.updateCoordinateView(); Entry.stage.updateObject(); }; - q.onkeypress = function(b) { + n.onkeypress = function(b) { 13 == b.keyCode && c.editObjectValues(!1); }; - q.onblur = function(b) { - isNaN(q.value) || c.entity.setSize(Number(q.value)); + n.onblur = function(b) { + isNaN(n.value) || c.entity.setSize(Number(n.value)); c.updateCoordinateView(); Entry.stage.updateObject(); }; @@ -10888,48 +10291,48 @@ Entry.EntryObject.prototype.generateView = function() { e = Entry.createElement("span"); e.addClass("entryObjectRotateSpanWorkspace"); e.innerHTML = Lang.Workspace.rotation + " : "; - var n = Entry.createElement("input"); - n.addClass("entryObjectRotateInputWorkspace"); - n.setAttribute("readonly", !0); - n.bindOnClick(function(b) { + var m = Entry.createElement("input"); + m.addClass("entryObjectRotateInputWorkspace"); + m.setAttribute("readonly", !0); + m.bindOnClick(function(b) { b.stopPropagation(); this.select(); }); this.rotateSpan_ = e; - this.rotateInput_ = n; + this.rotateInput_ = m; h = Entry.createElement("span"); h.addClass("entryObjectDirectionSpanWorkspace"); h.innerHTML = Lang.Workspace.direction + " : "; - var m = Entry.createElement("input"); - m.addClass("entryObjectDirectionInputWorkspace"); - m.setAttribute("readonly", !0); - m.bindOnClick(function(b) { + var q = Entry.createElement("input"); + q.addClass("entryObjectDirectionInputWorkspace"); + q.setAttribute("readonly", !0); + q.bindOnClick(function(b) { b.stopPropagation(); this.select(); }); - this.directionInput_ = m; + this.directionInput_ = q; d.appendChild(e); - d.appendChild(n); - d.appendChild(h); d.appendChild(m); - d.rotateInput_ = n; - d.directionInput_ = m; + d.appendChild(h); + d.appendChild(q); + d.rotateInput_ = m; + d.directionInput_ = q; c = this; - n.onkeypress = function(b) { + m.onkeypress = function(b) { 13 == b.keyCode && c.editObjectValues(!1); }; - n.onblur = function(b) { - b = n.value; + m.onblur = function(b) { + b = m.value; -1 != b.indexOf("\u02da") && (b = b.substring(0, b.indexOf("\u02da"))); isNaN(b) || c.entity.setRotation(Number(b)); c.updateRotationView(); Entry.stage.updateObject(); }; - m.onkeypress = function(b) { + q.onkeypress = function(b) { 13 == b.keyCode && c.editObjectValues(!1); }; - m.onblur = function(b) { - b = m.value; + q.onblur = function(b) { + b = q.value; -1 != b.indexOf("\u02da") && (b = b.substring(0, b.indexOf("\u02da"))); isNaN(b) || c.entity.setDirection(Number(b)); c.updateRotationView(); @@ -11001,20 +10404,20 @@ Entry.EntryObject.prototype.generateView = function() { if (b = Entry.container.getObject(this.id)) { Entry.container.selectObject(b.id), Entry.playground.injectObject(b); } - }), this.view_.appendChild(d), d = Entry.createElement("div"), d.addClass("entryObjectInformationWorkspace"), d.object = this, this.isInformationToggle = !1, a.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 + " : ", n = Entry.createElement("input"), - n.addClass("entryObjectRotateInputWorkspace"), this.rotateSpan_ = e, this.rotateInput_ = n, h = Entry.createElement("span"), h.addClass("entryObjectDirectionSpanWorkspace"), h.innerHTML = Lang.Workspace.direction + " : ", m = Entry.createElement("input"), m.addClass("entryObjectDirectionInputWorkspace"), this.directionInput_ = m, d.appendChild(e), d.appendChild(n), d.appendChild(h), d.appendChild(m), d.rotateInput_ = n, d.directionInput_ = m, c = this, n.onkeypress = function(b) { - 13 == b.keyCode && (b = n.value, -1 != b.indexOf("\u02da") && (b = b.substring(0, b.indexOf("\u02da"))), isNaN(b) || c.entity.setRotation(Number(b)), c.updateRotationView(), n.blur()); - }, n.onblur = function(b) { + }), this.view_.appendChild(d), d = Entry.createElement("div"), d.addClass("entryObjectInformationWorkspace"), d.object = this, this.isInformationToggle = !1, a.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(b) { + 13 == b.keyCode && (b = m.value, -1 != b.indexOf("\u02da") && (b = b.substring(0, b.indexOf("\u02da"))), isNaN(b) || c.entity.setRotation(Number(b)), c.updateRotationView(), m.blur()); + }, m.onblur = function(b) { c.entity.setRotation(c.entity.getRotation()); Entry.stage.updateObject(); - }, m.onkeypress = function(b) { - 13 == b.keyCode && (b = m.value, -1 != b.indexOf("\u02da") && (b = b.substring(0, b.indexOf("\u02da"))), isNaN(b) || c.entity.setDirection(Number(b)), c.updateRotationView(), m.blur()); - }, m.onblur = function(b) { + }, q.onkeypress = function(b) { + 13 == b.keyCode && (b = q.value, -1 != b.indexOf("\u02da") && (b = b.substring(0, b.indexOf("\u02da"))), isNaN(b) || c.entity.setDirection(Number(b)), c.updateRotationView(), q.blur()); + }, q.onblur = function(b) { c.entity.setDirection(c.entity.getDirection()); Entry.stage.updateObject(); }, a = Entry.createElement("div"), a.addClass("entryObjectRotationWrapperWorkspace"), a.object = this, this.view_.appendChild(a), d = Entry.createElement("span"), d.addClass("entryObjectCoordinateWorkspace"), a.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, q = Entry.createElement("input"), q.addClass("entryObjectCoordinateInputWorkspace", "entryObjectCoordinateInputWorkspace_size"), d.appendChild(e), d.appendChild(g), d.appendChild(h), d.appendChild(k), d.appendChild(l), d.appendChild(q), - d.xInput_ = g, d.yInput_ = k, d.sizeInput_ = q, this.coordinateView_ = d, c = this, g.onkeypress = function(b) { + 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(b) { 13 == b.keyCode && (isNaN(g.value) || c.entity.setX(Number(g.value)), c.updateCoordinateView(), c.blur()); }, g.onblur = function(b) { c.entity.setX(c.entity.getX()); @@ -11069,7 +10472,6 @@ Entry.EntryObject.prototype.initEntity = function(a) { } else { b.underline = !1, b.strike = !1, b.font = "20px Nanum Gothic", b.colour = "#000000", b.bgColor = "#ffffff"; } -<<<<<<< HEAD } } return b; @@ -11081,123 +10483,6 @@ Entry.EntryObject.prototype.updateThumbnailView = function() { } else { var a = this.entity.picture.filename; this.thumbnailView_.style.backgroundImage = 'url("' + Entry.defaultPath + "/uploads/" + a.substring(0, 2) + "/" + a.substring(2, 4) + "/thumb/" + a + '.png")'; -======= - 360 <= this.value ? this.value %= 360 : 0 > this.value && (this.value = 360 + this.value % 360); - a.handle.rotation = this.value; - a.updateImageHandle(); - }; - this.objectRotateInput.addClass("entryPlaygroundPainterNumberInput"); - this.objectRotateInput.defaultValue = "0"; - d.appendChild(this.objectRotateInput); - this.attrColorArea = Entry.createElement("fieldset", "entryPainterAttrColor"); - this.attrColorArea.addClass("entryPlaygroundPainterAttrColor"); - g.appendChild(this.attrColorArea); - var n = Entry.createElement("div"); - n.addClass("entryPlaygroundPainterAttrColorContainer"); - this.attrColorArea.appendChild(n); - this.attrCircleArea = Entry.createElement("div"); - this.attrCircleArea.addClass("painterAttrCircleArea"); - g.appendChild(this.attrCircleArea); - d = Entry.createElement("div", "entryPainterAttrCircle"); - d.addClass("painterAttrCircle"); - this.attrCircleArea.appendChild(d); - this.attrCircleArea.painterAttrCircle = d; - d = Entry.createElement("input", "entryPainterAttrCircleInput"); - d.value = "#000000"; - d.addClass("painterAttrCircleInput"); - this.attrCircleArea.appendChild(d); - this.attrColorSpoid = Entry.createElement("div"); - this.attrColorSpoid.bindOnClick(function() { - a.selectToolbox("spoid"); - }); - this.attrColorSpoid.addClass("painterAttrColorSpoid"); - g.appendChild(this.attrColorSpoid); - Entry.getColourCodes().forEach(function(b) { - var c = Entry.createElement("div"); - c.addClass("entryPlaygroundPainterAttrColorElement"); - "transparent" === b ? c.style.backgroundImage = "url(" + (Entry.mediaFilePath + "/transparent.png") + ")" : c.style.backgroundColor = b; - c.bindOnClick(function(c) { - "transparent" === b ? (a.stroke.transparent = !0, a.stroke.lineColor = "#ffffff") : (a.stroke.transparent = !1, r && (document.getElementById("entryPainterShapeBackgroundColor").style.backgroundColor = b, a.stroke.fillColor = b), r || (document.getElementById("entryPainterShapeLineColor").style.backgroundColor = b, a.stroke.lineColor = b)); - document.getElementById("entryPainterAttrCircle").style.backgroundColor = a.stroke.lineColor; - document.getElementById("entryPainterAttrCircleInput").value = b; - }); - n.appendChild(c); - }); - this.attrThickArea = Entry.createElement("div", "painterAttrThickArea"); - this.attrThickArea.addClass("entryPlaygroundentryPlaygroundPainterAttrThickArea"); - g.appendChild(this.attrThickArea); - d = Entry.createElement("legend"); - d.addClass("painterAttrThickName"); - d.innerHTML = Lang.Workspace.thickness; - this.attrThickArea.appendChild(d); - var m = Entry.createElement("fieldset", "entryPainterAttrThick"); - m.addClass("entryPlaygroundPainterAttrThick"); - this.attrThickArea.appendChild(m); - d = Entry.createElement("div"); - d.addClass("paintAttrThickTop"); - m.appendChild(d); - e = Entry.createElement("select", "entryPainterAttrThick"); - e.addClass("entryPlaygroundPainterAttrThickInput"); - e.size = "1"; - e.onchange = function(b) { - a.stroke.thickness = b.target.value; - }; - for (d = 1;10 >= d;d++) { - c = Entry.createElement("option"), c.value = d, c.innerHTML = d, e.appendChild(c); - } - m.appendChild(e); - d = Entry.createElement("div", "entryPainterShapeLineColor"); - d.addClass("painterAttrShapeLineColor"); - c = Entry.createElement("div", "entryPainterShapeInnerBackground"); - c.addClass("painterAttrShapeInnerBackground"); - d.appendChild(c); - m.appendChild(d); - this.attrThickArea.painterAttrShapeLineColor = d; - m.bindOnClick(function() { - q.style.zIndex = "1"; - this.style.zIndex = "10"; - r = !1; - }); - this.attrBackgroundArea = Entry.createElement("div", "painterAttrBackgroundArea"); - this.attrBackgroundArea.addClass("entryPlaygroundPainterBackgroundArea"); - g.appendChild(this.attrBackgroundArea); - d = Entry.createElement("fieldset", "entryPainterAttrbackground"); - d.addClass("entryPlaygroundPainterAttrBackground"); - this.attrBackgroundArea.appendChild(d); - c = Entry.createElement("div"); - c.addClass("paintAttrBackgroundTop"); - d.appendChild(c); - var q = Entry.createElement("div", "entryPainterShapeBackgroundColor"); - q.addClass("painterAttrShapeBackgroundColor"); - this.attrBackgroundArea.painterAttrShapeBackgroundColor = q; - c.appendChild(q); - var r = !1; - q.bindOnClick(function(a) { - m.style.zIndex = "1"; - this.style.zIndex = "10"; - r = !0; - }); - this.attrFontArea = Entry.createElement("div", "painterAttrFont"); - this.attrFontArea.addClass("entryPlaygroundPainterAttrFont"); - g.appendChild(this.attrFontArea); - e = Entry.createElement("div"); - e.addClass("entryPlaygroundPainterAttrTop"); - this.attrFontArea.appendChild(e); - d = Entry.createElement("div"); - d.addClass("entryPlaygroundPaintAttrTop_"); - e.appendChild(d); - d = Entry.createElement("legend"); - d.addClass("panterAttrFontTitle"); - d.innerHTML = Lang.Workspace.textStyle; - k = Entry.createElement("select", "entryPainterAttrFontName"); - k.addClass("entryPlaygroundPainterAttrFontName"); - k.size = "1"; - k.onchange = function(b) { - a.font.name = b.target.value; - }; - for (d = 0;d < Entry.fonts.length;d++) { - h = Entry.fonts[d], c = Entry.createElement("option"), c.value = h.family, c.innerHTML = h.name, k.appendChild(c); ->>>>>>> entrylabs/master } } else { "textBox" == this.objectType && (this.thumbnailView_.style.backgroundImage = "url(" + (Entry.mediaFilePath + "/text_icon.png") + ")"); @@ -11253,47 +10538,6 @@ Entry.EntryObject.prototype.getPicture = function(a) { if (b[d].name == a) { return b[d]; } -<<<<<<< HEAD -======= - e.appendChild(k); - this.attrLineArea = Entry.createElement("div", "painterAttrLineStyle"); - this.attrLineArea.addClass("entryPlaygroundPainterAttrLineStyle"); - g.appendChild(this.attrLineArea); - var t = Entry.createElement("div"); - t.addClass("entryPlaygroundPainterAttrLineStyleLine"); - this.attrLineArea.appendChild(t); - var u = Entry.createElement("div"); - u.addClass("entryPlaygroundPaitnerAttrLineArea"); - this.attrLineArea.appendChild(u); - d = Entry.createElement("div"); - d.addClass("entryPlaygroundPainterAttrLineStyleLine1"); - u.appendChild(d); - d.value = "line"; - var v = Entry.createElement("div"); - v.addClass("painterAttrLineStyleBackgroundLine"); - t.bindOnClick(function(a) { - u.removeClass("entryRemove"); - }); - u.blur = function(a) { - this.addClass("entryRemove"); - }; - u.onmouseleave = function(a) { - this.addClass("entryRemove"); - }; - d.bindOnClick(function(a) { - this.attrLineArea.removeClass(t); - this.attrLineArea.appendChild(v); - this.attrLineArea.onchange(a); - u.blur(); - }); - v.bindOnClick(function(a) { - u.removeClass("entryRemove"); - }); - this.attrLineArea.onchange = function(b) { - a.stroke.style = b.target.value; - }; - u.blur(); ->>>>>>> entrylabs/master } a = Entry.parseNumber(a); if ((!1 !== a || "boolean" != typeof a) && c >= a && 0 < a) { @@ -11373,7 +10617,7 @@ Entry.EntryObject.prototype.toggleInformation = function(a) { }; Entry.EntryObject.prototype.addCloneEntity = function(a, b, c) { this.clonedEntities.length > Entry.maxCloneLimit || (a = new Entry.EntityObject(this), b ? (a.injectModel(b.picture ? b.picture : null, b.toJSON()), a.snapshot_ = b.snapshot_, b.effect && (a.effect = Entry.cloneSimpleObject(b.effect), a.applyFilter()), b.brush && Entry.setCloneBrush(a, b.brush)) : (a.injectModel(this.entity.picture ? this.entity.picture : null, this.entity.toJSON(a)), a.snapshot_ = this.entity.snapshot_, this.entity.effect && (a.effect = Entry.cloneSimpleObject(this.entity.effect), - a.applyFilter()), this.entity.brush && Entry.setCloneBrush(a, this.entity.brush)), Entry.engine.raiseEventOnEntity(a, [a, "when_clone_start"]), a.isClone = !0, a.isStarted = !0, this.addCloneVariables(this, a, b ? b.variables : null, b ? b.lists : null), this.clonedEntities.push(a), Entry.stage.loadEntity(a)); + a.applyFilter()), this.entity.brush && Entry.setCloneBrush(a, this.entity.brush)), Entry.engine.pushQueue(a, [a, "when_clone_start"]), a.isClone = !0, a.isStarted = !0, this.addCloneVariables(this, a, b ? b.variables : null, b ? b.lists : null), this.clonedEntities.push(a), Entry.stage.loadEntity(a)); }; Entry.EntryObject.prototype.initializeSplitter = function(a) { a.onmousedown = function(b) { @@ -11459,17 +10703,24 @@ Entry.EntryObject.prototype.updateInputViews = function(a) { }; Entry.EntryObject.prototype.editObjectValues = function(a) { var b; - b = this.getLock() ? [this.nameView_] : [this.nameView_, this.coordinateView_.xInput_, this.coordinateView_.yInput_, this.rotateInput_, this.directionInput_, this.coordinateView_.sizeInput_]; + b = this.getLock() ? [this.nameView_] : [this.coordinateView_.xInput_, this.coordinateView_.yInput_, this.rotateInput_, this.directionInput_, this.coordinateView_.sizeInput_]; if (a) { + var c = this.nameView_; $(b).removeClass("selectedNotEditingObject"); + $(c).removeClass("selectedNotEditingObject"); + window.setTimeout(function() { + $(c).removeAttr("readonly"); + c.addClass("selectedEditingObject"); + }); for (a = 0;a < b.length;a++) { - b[a].removeAttribute("readonly"), b[a].addClass("selectedEditingObject"); + $(b[a]).removeAttr("readonly"), b[a].addClass("selectedEditingObject"); } this.isEditing = !0; } else { for (a = 0;a < b.length;a++) { b[a].blur(!0); } + this.nameView_.blur(!0); this.blurAllInput(); this.isEditing = !1; } @@ -11504,6 +10755,24 @@ Entry.EntryObject.prototype.getStampEntities = function() { Entry.EntryObject.prototype.clearExecutor = function() { this.script.clearExecutors(); }; +Entry.EntryObject.prototype._rightClick = function(a) { + var b = this, c = [{text:Lang.Workspace.context_rename, callback:function(a) { + a.stopPropagation(); + b.setLock(!1); + b.editObjectValues(!0); + b.nameView_.select(); + }}, {text:Lang.Workspace.context_duplicate, enable:!Entry.engine.isState("run"), callback:function() { + Entry.container.addCloneObject(b); + }}, {text:Lang.Workspace.context_remove, callback:function() { + Entry.container.removeObject(b); + }}, {text:Lang.Workspace.copy_file, callback:function() { + Entry.container.setCopiedObject(b); + }}, {text:Lang.Blocks.Paste_blocks, enable:!Entry.engine.isState("run") && !!Entry.container.copiedObject, callback:function() { + Entry.container.copiedObject ? Entry.container.addCloneObject(Entry.container.copiedObject) : Entry.toast.alert(Lang.Workspace.add_object_alert, Lang.Workspace.object_not_found_for_paste); + }}]; + a = Entry.Utils.convertMouseEvent(a); + Entry.ContextMenu.show(c, "workspace-contextmenu", {x:a.clientX, y:a.clientY}); +}; Entry.Painter = function() { this.toolbox = {selected:"cursor"}; this.stroke = {enabled:!1, fillColor:"#000000", lineColor:"#000000", thickness:1, fill:!0, transparent:!1, style:"line", locked:!1}; @@ -11926,14 +11195,14 @@ Entry.Painter.prototype.fill = function() { var c = new createjs.Point(this.stage.mouseX, this.stage.mouseY); c.x = Math.round(c.x); c.y = Math.round(c.y); - for (var d = 4 * (c.y * a + c.x), e = this.colorLayerData.data[d], f = this.colorLayerData.data[d + 1], g = this.colorLayerData.data[d + 2], h = this.colorLayerData.data[d + 3], k, l, c = [[c.x, c.y]], q = Entry.hex2rgb(this.stroke.lineColor);c.length;) { - for (var d = c.pop(), n = d[0], m = d[1], d = 4 * (m * a + n);0 <= m && this.matchColor(d, e, f, g, h);) { - --m, d -= 4 * a; + for (var d = 4 * (c.y * a + c.x), e = this.colorLayerData.data[d], f = this.colorLayerData.data[d + 1], g = this.colorLayerData.data[d + 2], h = this.colorLayerData.data[d + 3], k, l, c = [[c.x, c.y]], n = Entry.hex2rgb(this.stroke.lineColor);c.length;) { + for (var d = c.pop(), m = d[0], q = d[1], d = 4 * (q * a + m);0 <= q && this.matchColor(d, e, f, g, h);) { + --q, d -= 4 * a; } d += 4 * a; - m += 1; - for (l = k = !1;m < b - 1 && this.matchColor(d, e, f, g, h);) { - m += 1, this.colorPixel(d, q.r, q.g, q.b), 0 < n && (this.matchColor(d - 4, e, f, g, h) ? k || (c.push([n - 1, m]), k = !0) : k && (k = !1)), n < a - 1 && (this.matchColor(d + 4, e, f, g, h) ? l || (c.push([n + 1, m]), l = !0) : l && (l = !1)), d += 4 * a; + q += 1; + for (l = k = !1;q < b - 1 && this.matchColor(d, e, f, g, h);) { + q += 1, this.colorPixel(d, n.r, n.g, n.b), 0 < m && (this.matchColor(d - 4, e, f, g, h) ? k || (c.push([m - 1, q]), k = !0) : k && (k = !1)), m < a - 1 && (this.matchColor(d + 4, e, f, g, h) ? l || (c.push([m + 1, q]), l = !0) : l && (l = !1)), d += 4 * a; } if (1080 < c.length) { break; @@ -12476,9 +11745,9 @@ Entry.Painter.prototype.generateView = function(a) { this.attrColorArea = Entry.createElement("fieldset", "entryPainterAttrColor"); this.attrColorArea.addClass("entryPlaygroundPainterAttrColor"); g.appendChild(this.attrColorArea); - var q = Entry.createElement("div"); - q.addClass("entryPlaygroundPainterAttrColorContainer"); - this.attrColorArea.appendChild(q); + var n = Entry.createElement("div"); + n.addClass("entryPlaygroundPainterAttrColorContainer"); + this.attrColorArea.appendChild(n); this.attrCircleArea = Entry.createElement("div"); this.attrCircleArea.addClass("painterAttrCircleArea"); g.appendChild(this.attrCircleArea); @@ -12505,7 +11774,7 @@ Entry.Painter.prototype.generateView = function(a) { document.getElementById("entryPainterAttrCircle").style.backgroundColor = b.stroke.lineColor; document.getElementById("entryPainterAttrCircleInput").value = a; }); - q.appendChild(c); + n.appendChild(c); }); this.attrThickArea = Entry.createElement("div", "painterAttrThickArea"); this.attrThickArea.addClass("entryPlaygroundentryPlaygroundPainterAttrThickArea"); @@ -12514,12 +11783,12 @@ Entry.Painter.prototype.generateView = function(a) { d.addClass("painterAttrThickName"); d.innerHTML = Lang.Workspace.thickness; this.attrThickArea.appendChild(d); - var n = Entry.createElement("fieldset", "entryPainterAttrThick"); - n.addClass("entryPlaygroundPainterAttrThick"); - this.attrThickArea.appendChild(n); + var m = Entry.createElement("fieldset", "entryPainterAttrThick"); + m.addClass("entryPlaygroundPainterAttrThick"); + this.attrThickArea.appendChild(m); d = Entry.createElement("div"); d.addClass("paintAttrThickTop"); - n.appendChild(d); + m.appendChild(d); e = Entry.createElement("select", "entryPainterAttrThick"); e.addClass("entryPlaygroundPainterAttrThickInput"); e.size = "1"; @@ -12529,16 +11798,16 @@ Entry.Painter.prototype.generateView = function(a) { for (d = 1;10 >= d;d++) { c = Entry.createElement("option"), c.value = d, c.innerHTML = d, e.appendChild(c); } - n.appendChild(e); + m.appendChild(e); d = Entry.createElement("div", "entryPainterShapeLineColor"); d.addClass("painterAttrShapeLineColor"); c = Entry.createElement("div", "entryPainterShapeInnerBackground"); c.addClass("painterAttrShapeInnerBackground"); d.appendChild(c); - n.appendChild(d); + m.appendChild(d); this.attrThickArea.painterAttrShapeLineColor = d; - n.bindOnClick(function() { - m.style.zIndex = "1"; + m.bindOnClick(function() { + q.style.zIndex = "1"; this.style.zIndex = "10"; r = !1; }); @@ -12551,13 +11820,13 @@ Entry.Painter.prototype.generateView = function(a) { c = Entry.createElement("div"); c.addClass("paintAttrBackgroundTop"); d.appendChild(c); - var m = Entry.createElement("div", "entryPainterShapeBackgroundColor"); - m.addClass("painterAttrShapeBackgroundColor"); - this.attrBackgroundArea.painterAttrShapeBackgroundColor = m; - c.appendChild(m); + var q = Entry.createElement("div", "entryPainterShapeBackgroundColor"); + q.addClass("painterAttrShapeBackgroundColor"); + this.attrBackgroundArea.painterAttrShapeBackgroundColor = q; + c.appendChild(q); var r = !1; - m.bindOnClick(function(b) { - n.style.zIndex = "1"; + q.bindOnClick(function(b) { + m.style.zIndex = "1"; this.style.zIndex = "10"; r = !0; }); @@ -12646,7 +11915,6 @@ Entry.Painter.prototype.generateView = function(a) { this.attrLineArea.onchange(b); t.blur(); }); -<<<<<<< HEAD v.bindOnClick(function(b) { t.removeClass("entryRemove"); }); @@ -12654,64 +11922,11 @@ Entry.Painter.prototype.generateView = function(a) { b.stroke.style = a.target.value; }; t.blur(); -======= - this.availableCode = this.availableCode.concat(d); - }; -})(Entry.Parser.prototype); -Entry.Pdf = function(b) { - this.generateView(b); -}; -p = Entry.Pdf.prototype; -p.generateView = function(b) { - var a = Entry.createElement("div", "entryPdfWorkspace"); - a.addClass("entryRemove"); - this._view = a; - var c = "/pdfjs/web/viewer.html"; - b && "" != b && (c += "?file=" + b); - pdfViewIframe = Entry.createElement("iframe", "entryPdfIframeWorkspace"); - pdfViewIframe.setAttribute("id", "pdfViewIframe"); - pdfViewIframe.setAttribute("frameborder", 0); - pdfViewIframe.setAttribute("src", c); - a.appendChild(pdfViewIframe); -}; -p.getView = function() { - return this._view; -}; -p.resize = function() { - var b = document.getElementById("entryContainerWorkspaceId"), a = document.getElementById("pdfViewIframe"); - w = b.offsetWidth; - a.width = w + "px"; - a.height = 9 * w / 16 + "px"; -}; -Entry.Popup = function() { - Entry.assert(!window.popup, "Popup exist"); - this.body_ = Entry.createElement("div"); - this.body_.addClass("entryPopup"); - this.body_.bindOnClick(function(b) { - b.target == this && this.popup.remove(); - }); - this.body_.popup = this; - document.body.appendChild(this.body_); - this.window_ = Entry.createElement("div"); - this.window_.addClass("entryPopupWindow"); - "tablet" === Entry.device && this.window_.addClass("tablet"); - this.window_.bindOnClick(function() { - }); - Entry.addEventListener("windowResized", this.resize); - window.popup = this; - this.resize(); - this.body_.appendChild(this.window_); -}; -Entry.Popup.prototype.remove = function() { - for (;this.window_.hasChildNodes();) { - "workspace" == Entry.type ? Entry.view_.insertBefore(this.window_.firstChild, Entry.container.view_) : Entry.view_.insertBefore(this.window_.lastChild, Entry.view_.firstChild); ->>>>>>> entrylabs/master } }; Entry.Painter.prototype.restoreHandle = function() { this.selectedObject && !1 === this.handle.visible && (this.handle.visible = !0, this.stage.update()); }; -<<<<<<< HEAD Entry.Painter.prototype.initDisplay = function() { this.stroke.enabled = !1; this.toolboxCursor.addClass("entryPlaygroundPainterToolboxCursor"); @@ -12749,43 +11964,6 @@ Entry.Painter.prototype.initDisplay = function() { this.attrBackgroundArea.painterAttrShapeBackgroundColor.addClass("entryRemove"); this.attrCircleArea.painterAttrCircle.addClass("entryRemove"); this.inputField && !this.inputField._isHidden && (this.inputField.hide(), this.stage.update()); -======= -Entry.popupHelper = function(b) { - this.popupList = {}; - this.nowContent; - b && (window.popupHelper = null); - Entry.assert(!window.popupHelper, "Popup exist"); - var a = ["confirm", "spinner"], c = ["entryPopupHelperTopSpan", "entryPopupHelperBottomSpan", "entryPopupHelperLeftSpan", "entryPopupHelperRightSpan"]; - this.body_ = Entry.Dom("div", {classes:["entryPopup", "hiddenPopup", "popupHelper"]}); - var d = this; - this.body_.bindOnClick(function(b) { - if (!(d.nowContent && -1 < a.indexOf(d.nowContent.prop("type")))) { - var f = $(b.target); - c.forEach(function(a) { - f.hasClass(a) && this.popup.hide(); - }.bind(this)); - b.target == this && this.popup.hide(); - } - }); - this.body_.bind("touchstart", function(b) { - if (!(d.nowContent && -1 < a.indexOf(d.nowContent.prop("type")))) { - var f = $(b.target); - c.forEach(function(a) { - f.hasClass(a) && this.popup.hide(); - }.bind(this)); - b.target == this && this.popup.hide(); - } - }); - window.popupHelper = this; - this.body_.prop("popup", this); - Entry.Dom("div", {class:"entryPopupHelperTopSpan", parent:this.body_}); - b = Entry.Dom("div", {class:"entryPopupHelperMiddleSpan", parent:this.body_}); - Entry.Dom("div", {class:"entryPopupHelperBottomSpan", parent:this.body_}); - Entry.Dom("div", {class:"entryPopupHelperLeftSpan", parent:b}); - this.window_ = Entry.Dom("div", {class:"entryPopupHelperWindow", parent:b}); - Entry.Dom("div", {class:"entryPopupHelperRightSpan", parent:b}); - $("body").append(this.body_); ->>>>>>> entrylabs/master }; Entry.Painter.prototype.selectToolbox = function(a) { this.toolbox.selected = a; @@ -12871,64 +12049,10 @@ Entry.Painter.prototype.selectToolbox = function(a) { this.toggleCoordinator(); } }; -<<<<<<< HEAD Entry.BlockParser = function(a) { this.syntax = a; this._iterVariableCount = 0; this._iterVariableChunk = ["i", "j", "k"]; -======= -Entry.popupHelper.prototype.addPopup = function(b, a) { - var c = Entry.Dom("div"), d = Entry.Dom("div", {class:"entryPopupHelperCloseButton"}); - d.bindOnClick(function() { - a.closeEvent ? a.closeEvent(this) : this.hide(); - }.bind(this)); - var e = this; - d.bind("touchstart", function() { - a.closeEvent ? a.closeEvent(e) : e.hide(); - }); - var f = Entry.Dom("div", {class:"entryPopupHelperWrapper"}); - f.append(d); - a.title && (d = Entry.Dom("div", {class:"entryPopupHelperTitle"}), f.append(d), d.text(a.title)); - c.addClass(b); - c.append(f); - c.popupWrapper_ = f; - c.prop("type", a.type); - "function" === typeof a.setPopupLayout && a.setPopupLayout(c); - this.popupList[b] = c; -}; -Entry.popupHelper.prototype.hasPopup = function(b) { - return !!this.popupList[b]; -}; -Entry.popupHelper.prototype.setPopup = function(b) { -}; -Entry.popupHelper.prototype.remove = function(b) { - 0 < this.window_.children().length && this.window_.children().remove(); - this.window_.remove(); - delete this.popupList[b]; - this.nowContent = void 0; - this.body_.addClass("hiddenPopup"); -}; -Entry.popupHelper.prototype.resize = function(b) { -}; -Entry.popupHelper.prototype.show = function(b) { - 0 < this.window_.children().length && this.window_.children().detach(); - this.window_.append(this.popupList[b]); - this.nowContent = this.popupList[b]; - this.body_.removeClass("hiddenPopup"); -}; -Entry.popupHelper.prototype.hide = function() { - this.nowContent = void 0; - this.body_.addClass("hiddenPopup"); -}; -Entry.getStartProject = function(b) { - return {category:"\uae30\ud0c0", scenes:[{name:"\uc7a5\uba74 1", id:"7dwq"}], variables:[{name:"\ucd08\uc2dc\uacc4", id:"brih", visible:!1, value:"0", variableType:"timer", x:150, y:-70, array:[], object:null, isCloud:!1}, {name:"\ub300\ub2f5", id:"1vu8", visible:!1, value:"0", variableType:"answer", x:150, y:-100, array:[], object:null, isCloud:!1}], objects:[{id:"7y0y", name:"\uc5d4\ud2b8\ub9ac\ubd07", script:[[{type:"when_run_button_click", x:40, y:50}, {type:"repeat_basic", statements:[[{type:"move_direction"}]]}]], - selectedPictureId:"vx80", objectType:"sprite", rotateMethod:"free", scene:"7dwq", sprite:{sounds:[{duration:1.3, ext:".mp3", id:"8el5", fileurl:b + "media/bark.mp3", name:"\uac15\uc544\uc9c0 \uc9d6\ub294\uc18c\ub9ac"}], pictures:[{id:"vx80", fileurl:b + "media/entrybot1.png", name:Lang.Blocks.walking_entryBot + "1", scale:100, dimension:{width:284, height:350}}, {id:"4t48", fileurl:b + "media/entrybot2.png", name:Lang.Blocks.walking_entryBot + "2", scale:100, dimension:{width:284, height:350}}]}, - entity:{x:0, y:0, regX:142, regY:175, scaleX:.3154574132492113, scaleY:.3154574132492113, rotation:0, direction:90, width:284, height:350, visible:!0}, lock:!1, active:!0}], speed:60}; -}; -Entry.PropertyPanel = function() { - this.modes = {}; - this.selected = null; ->>>>>>> entrylabs/master }; (function(a) { a.Code = function(b) { @@ -12981,36 +12105,9 @@ Entry.PropertyPanel = function() { var a = this.Thread(b.statements[0]); return "if (" + b._schema.syntax.concat()[1] + ") {\n" + this.indent(a) + "}\n"; }; -<<<<<<< HEAD a.BasicWhile = function(b) { var a = this.Thread(b.statements[0]); return "while (" + b._schema.syntax.concat()[1] + ") {\n" + this.indent(a) + "}\n"; -======= -})(Entry.PropertyPanel.prototype); -Entry.init = function(b, a) { - Entry.assert("object" === typeof a, "Init option is not object"); - this.events_ = {}; - this.interfaceState = {menuWidth:264}; - Entry.Utils.bindGlobalEvent("resize mousedown mousemove keydown keyup dispose".split(" ")); - this.options = a; - this.parseOptions(a); - this.mediaFilePath = (a.libDir ? a.libDir : "/lib") + "/entryjs/images/"; - this.defaultPath = a.defaultDir || ""; - this.blockInjectPath = a.blockInjectDir || ""; - "workspace" == this.type && this.isPhone() && (this.type = "phone"); - this.initialize_(); - this.view_ = b; - "tablet" === this.device ? this.view_.setAttribute("class", "entry tablet") : this.view_.setAttribute("class", "entry"); - Entry.initFonts(a.fonts); - this.createDom(b, this.type); - this.loadInterfaceState(); - this.overridePrototype(); - this.maxCloneLimit = 302; - this.cloudSavable = !0; - this.startTime = (new Date).getTime(); - document.onkeydown = function(a) { - Entry.dispatchEvent("keyPressed", a); ->>>>>>> entrylabs/master }; a.indent = function(b) { var a = " "; @@ -13084,89 +12181,12 @@ Entry.JSParser = function(a) { } f && a.push(f); } -<<<<<<< HEAD -======= - }); - this.canvas_ = c; - this.stage.initStage(this.canvas_); - c = Entry.createElement("div"); - this.propertyPanel.generateView(b, a); - this.containerView = c; - this.container.generateView(this.containerView, a); - this.propertyPanel.addMode("object", this.container); - this.helper.generateView(this.containerView, a); - this.propertyPanel.addMode("helper", this.helper); - c = Entry.createElement("div"); - b.appendChild(c); - this.playgroundView = c; - this.playground.generateView(this.playgroundView, a); - this.propertyPanel.select("object"); - this.helper.bindWorkspace(this.playground.mainWorkspace); - } -}; -Entry.start = function(b) { - this.FPS || (this.FPS = 60); - Entry.assert("number" == typeof this.FPS, "FPS must be number"); - Entry.engine.start(this.FPS); -}; -Entry.parseOptions = function(b) { - this.type = b.type; - b.device && (this.device = b.device); - this.projectSaveable = b.projectsaveable; - void 0 === this.projectSaveable && (this.projectSaveable = !0); - this.objectAddable = b.objectaddable; - void 0 === this.objectAddable && (this.objectAddable = !0); - this.objectEditable = b.objectEditable; - void 0 === this.objectEditable && (this.objectEditable = !0); - this.objectEditable || (this.objectAddable = !1); - this.objectDeletable = b.objectdeletable; - void 0 === this.objectDeletable && (this.objectDeletable = !0); - this.soundEditable = b.soundeditable; - void 0 === this.soundEditable && (this.soundEditable = !0); - this.pictureEditable = b.pictureeditable; - void 0 === this.pictureEditable && (this.pictureEditable = !0); - this.sceneEditable = b.sceneEditable; - void 0 === this.sceneEditable && (this.sceneEditable = !0); - this.functionEnable = b.functionEnable; - void 0 === this.functionEnable && (this.functionEnable = !0); - this.messageEnable = b.messageEnable; - void 0 === this.messageEnable && (this.messageEnable = !0); - this.variableEnable = b.variableEnable; - void 0 === this.variableEnable && (this.variableEnable = !0); - this.listEnable = b.listEnable; - void 0 === this.listEnable && (this.listEnable = !0); - this.hasVariableManager = b.hasvariablemanager; - this.variableEnable || this.messageEnable || this.listEnable || this.functionEnable ? void 0 === this.hasVariableManager && (this.hasVariableManager = !0) : this.hasVariableManager = !1; - this.isForLecture = b.isForLecture; -}; -Entry.initFonts = function(b) { - this.fonts = b; - b || (this.fonts = []); -}; -Entry.Reporter = function(b) { - this.projectId = this.userId = null; - this.isRealTime = b; - this.activities = []; -}; -Entry.Reporter.prototype.start = function(b, a, c) { - this.isRealTime && (-1 < window.location.href.indexOf("localhost") ? this.io = io("localhost:7000") : this.io = io("play04.play-entry.com:7000"), this.io.emit("activity", {message:"start", userId:a, projectId:b, time:c})); - this.userId = a; - this.projectId = b; -}; -Entry.Reporter.prototype.report = function(b) { - if (!this.isRealTime || this.io) { - var a = [], c; - for (c in b.params) { - var d = b.params[c]; - "object" !== typeof d ? a.push(d) : d.id && a.push(d.id); ->>>>>>> entrylabs/master } return a; }; a.EmptyStatement = function(b) { throw {message:"empty\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; }; -<<<<<<< HEAD a.DebuggerStatement = function(b) { throw {message:"debugger\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; }; @@ -13188,113 +12208,6 @@ Entry.Reporter.prototype.report = function(b) { a.IfStatement = function(b) { if (this.syntax.IfStatement) { throw {message:"if\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; -======= - f.appendChild(d); - e = Entry.createElement("span"); - e.addClass("entrySceneRemoveButtonCoverWorkspace"); - c.appendChild(e); - if (Entry.sceneEditable) { - var g = Entry.createElement("button"); - g.addClass("entrySceneRemoveButtonWorkspace"); - g.scene = b; - g.bindOnClick(function(a) { - a.stopPropagation(); - Entry.engine.isState("run") || confirm(Lang.Workspace.will_you_delete_scene) && Entry.scene.removeScene(this.scene); - }); - e.appendChild(g); - } - Entry.Utils.disableContextmenu(c); - $(c).on("contextmenu", function() { - var a = [{text:Lang.Workspace.duplicate_scene, enable:Entry.engine.isState("stop"), callback:function() { - Entry.scene.cloneScene(b); - }}]; - Entry.ContextMenu.show(a, "workspace-contextmenu"); - }); - return b.view = c; -}; -Entry.Scene.prototype.updateView = function() { - if (!Entry.type || "workspace" == Entry.type) { - for (var b = this.listView_, a = $(b).children().length;a < this.getScenes().length;a++) { - b.appendChild(this.getScenes()[a].view); - } - this.addButton_ && (this.getScenes().length < this.maxCount ? this.addButton_.removeClass("entryRemove") : this.addButton_.addClass("entryRemove")); - } - this.resize(); -}; -Entry.Scene.prototype.addScenes = function(b) { - if ((this.scenes_ = b) && 0 !== b.length) { - for (var a = 0, c = b.length;a < c;a++) { - this.generateElement(b[a]); - } - } else { - this.scenes_ = [], this.scenes_.push(this.createScene()); - } - this.selectScene(this.getScenes()[0]); - this.updateView(); -}; -Entry.Scene.prototype.addScene = function(b, a) { - void 0 === b && (b = this.createScene()); - b.view || this.generateElement(b); - a || "number" == typeof a ? this.getScenes().splice(a, 0, b) : this.getScenes().push(b); - Entry.stage.objectContainers.push(Entry.stage.createObjectContainer(b)); - Entry.playground.flushPlayground(); - this.selectScene(b); - this.updateView(); - return b; -}; -Entry.Scene.prototype.removeScene = function(b) { - if (1 >= this.getScenes().length) { - Entry.toast.alert(Lang.Msgs.runtime_error, Lang.Workspace.Scene_delete_error, !1); - } else { - var a = this.getScenes().indexOf(this.getSceneById(b.id)); - this.getScenes().splice(a, 1); - for (var a = Entry.container.getSceneObjects(b), c = 0;c < a.length;c++) { - Entry.container.removeObject(a[c]); - } - Entry.stage.removeObjectContainer(b); - $(b.view).remove(); - this.selectScene(); - } -}; -Entry.Scene.prototype.selectScene = function(b) { - b = b || this.getScenes()[0]; - if (!this.selectedScene || this.selectedScene.id != b.id) { - Entry.engine.isState("run") && Entry.container.resetSceneDuringRun(); - var a = this.selectedScene; - a && (a = a.view, a.removeClass("selectedScene"), a = $(a), a.find("input").blur()); - this.selectedScene = b; - b.view.addClass("selectedScene"); - Entry.container.setCurrentObjects(); - Entry.stage.objectContainers && 0 !== Entry.stage.objectContainers.length && Entry.stage.selectObjectContainer(b); - (b = Entry.container.getCurrentObjects()[0]) && "minimize" != Entry.type ? (Entry.container.selectObject(b.id), Entry.playground.refreshPlayground()) : (Entry.stage.selectObject(null), Entry.playground.flushPlayground(), Entry.variableContainer.updateList()); - Entry.container.listView_ || Entry.stage.sortZorder(); - Entry.container.updateListView(); - this.updateView(); - Entry.requestUpdate = !0; - } -}; -Entry.Scene.prototype.toJSON = function() { - for (var b = [], a = this.getScenes().length, c = 0;c < a;c++) { - var d = this.getScenes()[c], e = d.view, f = d.inputWrapper; - delete d.view; - delete d.inputWrapper; - b.push(JSON.parse(JSON.stringify(d))); - d.view = e; - d.inputWrapper = f; - } - return b; -}; -Entry.Scene.prototype.moveScene = function(b, a) { - this.getScenes().splice(a, 0, this.getScenes().splice(b, 1)[0]); - Entry.container.updateObjectsOrder(); - Entry.stage.sortZorder(); - $(".entrySceneElementWorkspace").removeAttr("style"); -}; -Entry.Scene.prototype.getSceneById = function(b) { - for (var a = this.getScenes(), c = 0;c < a.length;c++) { - if (a[c].id == b) { - return a[c]; ->>>>>>> entrylabs/master } return this.BasicIf(b); }; @@ -13789,15 +12702,9 @@ Entry.BlockDriver = function() { if (!b) { return d; } -<<<<<<< HEAD for (var e = 0;e < b.length;e++) { var f = b[e], g = f.tagName, h = $(f).children()[0], u = f.getAttribute("name"); "value" === g ? "block" == h.nodeName && (d.params || (d.params = []), d.params.push(a(h)), d.index[u] = d.params.length - 1) : "field" === g && (d.params || (d.params = []), d.params.push(f.textContent), d.index[u] = d.params.length - 1); -======= - for (var e = 0;e < a.length;e++) { - var f = a[e], g = f.tagName, h = $(f).children()[0], t = f.getAttribute("name"); - "value" === g ? "block" == h.nodeName && (d.params || (d.params = []), d.params.push(b(h)), d.index[t] = d.params.length - 1) : "field" === g && (d.params || (d.params = []), d.params.push(f.textContent), d.index[t] = d.params.length - 1); ->>>>>>> entrylabs/master } return d; } @@ -13857,306 +12764,68 @@ Entry.BlockMockup = function(a, b, c) { for (e in this.statementsKeyMap) { d.test(e) && delete this.statementsKeyMap[e]; } - return {color:this.color, skeleton:a, statements:this.statements, template:this.templates.filter(function(a) { - return "string" === typeof a; + return {color:this.color, skeleton:a, statements:this.statements, template:this.templates.filter(function(b) { + return "string" === typeof b; }).join(" "), params:this.params, events:this.events, def:this.def, paramsKeyMap:this.paramsKeyMap, statementsKeyMap:this.statementsKeyMap}; }; a.appendDummyInput = function() { return this; }; - a.appendValueInput = function(a) { - this.def && this.def.index && (void 0 !== this.def.index[a] ? this.definition.params.push(this.def.params[this.def.index[a]]) : this.definition.params.push(null)); + a.appendValueInput = function(b) { + this.def && this.def.index && (void 0 !== this.def.index[b] ? this.definition.params.push(this.def.params[this.def.index[b]]) : this.definition.params.push(null)); this.params.push({type:"Block", accept:"string"}); - this._addToParamsKeyMap(a); + this._addToParamsKeyMap(b); this.templates.push(this.getFieldCount()); return this; }; - a.appendStatementInput = function(a) { - this._addToStatementsKeyMap(a); + a.appendStatementInput = function(b) { + this._addToStatementsKeyMap(b); this.statements.push({accept:"basic"}); }; - a.setCheck = function(a) { - var c = this.params; - "Boolean" === a && (c[c.length - 1].accept = "boolean"); + a.setCheck = function(b) { + var a = this.params; + "Boolean" === b && (a[a.length - 1].accept = "boolean"); }; - a.appendField = function(a, c) { - if (!a) { + a.appendField = function(b, a) { + if (!b) { return this; } - "string" === typeof a && 0 < a.length ? c ? (a = {type:"Text", text:a, color:c}, this.params.push(a), this._addToParamsKeyMap(), this.templates.push(this.getFieldCount()), this.def && this.def.index && void 0 !== this.def.index[c] ? this.definition.params.push(this.def.params[this.def.index[c]]) : this.definition.params.push(void 0)) : this.templates.push(a) : a.constructor == Blockly.FieldIcon ? ("start" === a.type ? this.params.push({type:"Indicator", img:a.src_, size:17, position:{x:0, y:-2}}) : - this.params.push({type:"Indicator", img:a.src_, size:12}), this._addToParamsKeyMap(), this.templates.push(this.getFieldCount()), this.definition && this.definition.params.push(null)) : a.constructor == Blockly.FieldDropdown ? (this.params.push({type:"Dropdown", options:a.menuGenerator_, value:a.menuGenerator_[0][1], fontSize:11}), this._addToParamsKeyMap(c), this.templates.push(this.getFieldCount()), this.def && this.def.index && void 0 !== this.def.index[c] ? this.definition.params.push(this.def.params[this.def.index[c]]) : - this.definition.params.push(void 0)) : a.constructor == Blockly.FieldDropdownDynamic ? (this.params.push({type:"DropdownDynamic", value:null, menuName:a.menuName_, fontSize:11}), this.templates.push(this.getFieldCount()), this.def && this.def.index && void 0 !== this.def.index[c] ? this.definition.params.push(this.def.params[this.def.index[c]]) : this.definition.params.push(void 0), this._addToParamsKeyMap(c)) : a.constructor == Blockly.FieldTextInput ? (this.params.push({type:"TextInput", value:10}), - this.templates.push(this.getFieldCount()), this._addToParamsKeyMap(c)) : a.constructor == Blockly.FieldAngle ? (this.params.push({type:"Angle"}), this.templates.push(this.getFieldCount()), this.def && this.def.index && void 0 !== this.def.index[c] ? this.definition.params.push(this.def.params[this.def.index[c]]) : this.definition.params.push(null), this._addToParamsKeyMap(c)) : a.constructor == Blockly.FieldKeydownInput ? (this.params.push({type:"Keyboard", value:81}), this.templates.push(this.getFieldCount()), - void 0 !== this.def.index[c] ? this.definition.params.push(this.def.params[this.def.index[c]]) : this.definition.params.push(void 0), this._addToParamsKeyMap(c)) : a.constructor == Blockly.FieldColour ? (this.params.push({type:"Color"}), this.templates.push(this.getFieldCount()), this._addToParamsKeyMap(c)) : console.log("else", a); + "string" === typeof b && 0 < b.length ? a ? (b = {type:"Text", text:b, color:a}, this.params.push(b), this._addToParamsKeyMap(), this.templates.push(this.getFieldCount()), this.def && this.def.index && void 0 !== this.def.index[a] ? this.definition.params.push(this.def.params[this.def.index[a]]) : this.definition.params.push(void 0)) : this.templates.push(b) : b.constructor == Blockly.FieldIcon ? ("start" === b.type ? this.params.push({type:"Indicator", img:b.src_, size:17, position:{x:0, y:-2}}) : + this.params.push({type:"Indicator", img:b.src_, size:12}), this._addToParamsKeyMap(), this.templates.push(this.getFieldCount()), this.definition && this.definition.params.push(null)) : b.constructor == Blockly.FieldDropdown ? (this.params.push({type:"Dropdown", options:b.menuGenerator_, value:b.menuGenerator_[0][1], fontSize:11}), this._addToParamsKeyMap(a), this.templates.push(this.getFieldCount()), this.def && this.def.index && void 0 !== this.def.index[a] ? this.definition.params.push(this.def.params[this.def.index[a]]) : + this.definition.params.push(void 0)) : b.constructor == Blockly.FieldDropdownDynamic ? (this.params.push({type:"DropdownDynamic", value:null, menuName:b.menuName_, fontSize:11}), this.templates.push(this.getFieldCount()), this.def && this.def.index && void 0 !== this.def.index[a] ? this.definition.params.push(this.def.params[this.def.index[a]]) : this.definition.params.push(void 0), this._addToParamsKeyMap(a)) : b.constructor == Blockly.FieldTextInput ? (this.params.push({type:"TextInput", value:10}), + this.templates.push(this.getFieldCount()), this._addToParamsKeyMap(a)) : b.constructor == Blockly.FieldAngle ? (this.params.push({type:"Angle"}), this.templates.push(this.getFieldCount()), this.def && this.def.index && void 0 !== this.def.index[a] ? this.definition.params.push(this.def.params[this.def.index[a]]) : this.definition.params.push(null), this._addToParamsKeyMap(a)) : b.constructor == Blockly.FieldKeydownInput ? (this.params.push({type:"Keyboard", value:81}), this.templates.push(this.getFieldCount()), + void 0 !== this.def.index[a] ? this.definition.params.push(this.def.params[this.def.index[a]]) : this.definition.params.push(void 0), this._addToParamsKeyMap(a)) : b.constructor == Blockly.FieldColour ? (this.params.push({type:"Color"}), this.templates.push(this.getFieldCount()), this._addToParamsKeyMap(a)) : console.log("else", b); return this; }; - a.setColour = function(a) { - this.color = a; + a.setColour = function(b) { + this.color = b; }; a.setInputsInline = function() { }; - a.setOutput = function(a, c) { - a && (this.output = c); + a.setOutput = function(b, a) { + b && (this.output = a); }; - a.setPreviousStatement = function(a) { - this.isPrev = a; + a.setPreviousStatement = function(b) { + this.isPrev = b; }; - a.setNextStatement = function(a) { - this.isNext = a; + a.setNextStatement = function(b) { + this.isNext = b; }; - a.setEditable = function(a) { + a.setEditable = function(b) { }; a.getFieldCount = function() { this.fieldCount++; return "%" + this.fieldCount; }; - a._addToParamsKeyMap = function(a) { - a = a ? a : "dummy_" + Entry.Utils.generateId(); - var c = this.paramsKeyMap; - c[a] = Object.keys(c).length; - }; - a._addToStatementsKeyMap = function(a) { - a = a ? a : "dummy_" + Entry.Utils.generateId(); -<<<<<<< HEAD - var c = this.statementsKeyMap; - c[a] = Object.keys(c).length; -======= - var b = this.statementsKeyMap; - b[a] = Object.keys(b).length; - }; -})(Entry.BlockMockup.prototype); -Entry.ContextMenu = {}; -(function(b) { - b.visible = !1; - b.createDom = function() { - this.dom = Entry.Dom("ul", {id:"entry-contextmenu", parent:$("body")}); - this.dom.bind("mousedown touchstart", function(a) { - a.stopPropagation(); - }); - Entry.Utils.disableContextmenu(this.dom); - Entry.documentMousedown.attach(this, function() { - this.hide(); - }); - }; - b.show = function(a, b, d) { - this.dom || this.createDom(); - if (0 !== a.length) { - var e = this; - void 0 !== b && (this._className = b, this.dom.addClass(b)); - b = this.dom; - b.empty(); - for (var f = 0, g = a.length;f < g;f++) { - var h = a[f], k = h.text, l = !1 !== h.enable, n = Entry.Dom("li", {class:l ? "menuAble" : "menuDisable", parent:b}), n = Entry.Dom("span", {parent:n}); - n.text(k); - l && h.callback && function(a, b) { - a.mousedown(function(a) { - a.preventDefault(); - e.hide(); - b(a); - }); - }(n, h.callback); - } - b.removeClass("entryRemove"); - this.visible = !0; - this.position(d || Entry.mouseCoordinate); - } - }; - b.position = function(a) { - var b = this.dom; - b.css({left:0, top:0}); - var d = b.width(), e = b.height(), f = $(window), g = f.width(), f = f.height(); - a.x + d > g && (a.x -= d + 3); - a.y + e > f && (a.y -= e); - b.css({left:a.x, top:a.y}); - }; - b.hide = function() { - this.visible = !1; - this.dom.empty(); - this.dom.addClass("entryRemove"); - this._className && (this.dom.removeClass(this._className), delete this._className); - }; -})(Entry.ContextMenu); -Entry.Loader = {queueCount:0, totalCount:0}; -Entry.Loader.addQueue = function(b) { - this.queueCount || Entry.dispatchEvent("loadStart"); - this.queueCount++; - this.totalCount++; -}; -Entry.Loader.removeQueue = function(b) { - this.queueCount--; - this.queueCount || (Entry.dispatchEvent("loadComplete"), this.totalCount = 0); -}; -Entry.Loader.getLoadedPercent = function() { - return 0 === this.totalCount ? 1 : this.queueCount / this.totalCount; -}; -Entry.STATIC = {OBJECT:0, ENTITY:1, SPRITE:2, SOUND:3, VARIABLE:4, FUNCTION:5, SCENE:6, MESSAGE:7, BLOCK_MODEL:8, BLOCK_RENDER_MODEL:9, BOX_MODEL:10, THREAD_MODEL:11, DRAG_INSTANCE:12, BLOCK_STATIC:0, BLOCK_MOVE:1, BLOCK_FOLLOW:2, RETURN:0, CONTINUE:1, BREAK:2, PASS:3}; -Entry.Utils = {}; -Entry.overridePrototype = function() { - Number.prototype.mod = function(b) { - return (this % b + b) % b; - }; -}; -Entry.Utils.generateId = function() { - return ("0000" + (Math.random() * Math.pow(36, 4) << 0).toString(36)).substr(-4); -}; -Entry.Utils.intersectArray = function(b, a) { - for (var c = [], d = 0;d < b.length;d++) { - for (var e = 0;e < a.length;e++) { - if (b[d] == a[e]) { - c.push(b[d]); - break; - } - } - } - return c; -}; -Entry.Utils.isPointInMatrix = function(b, a, c) { - c = void 0 === c ? 0 : c; - var d = b.offsetX ? b.x + b.offsetX : b.x, e = b.offsetY ? b.y + b.offsety : b.y; - return d - c <= a.x && d + b.width + c >= a.x && e - c <= a.y && e + b.height + c >= a.y; -}; -Entry.Utils.colorDarken = function(b, a) { - function c(a) { - 2 != a.length && (a = "0" + a); - return a; - } - var d, e, f; - 7 === b.length ? (d = parseInt(b.substr(1, 2), 16), e = parseInt(b.substr(3, 2), 16), f = parseInt(b.substr(5, 2), 16)) : (d = parseInt(b.substr(1, 2), 16), e = parseInt(b.substr(2, 2), 16), f = parseInt(b.substr(3, 2), 16)); - a = void 0 === a ? .7 : a; - d = c(Math.floor(d * a).toString(16)); - e = c(Math.floor(e * a).toString(16)); - f = c(Math.floor(f * a).toString(16)); - return "#" + d + e + f; -}; -Entry.Utils.colorLighten = function(b, a) { - a = 0 === a ? 0 : a || 20; - var c = Entry.Utils.hexToHsl(b); - c.l += a / 100; - c.l = Math.min(1, Math.max(0, c.l)); - return Entry.Utils.hslToHex(c); -}; -Entry.Utils.bound01 = function(b, a) { - var c = b; - "string" == typeof c && -1 != c.indexOf(".") && 1 === parseFloat(c) && (b = "100%"); - c = "string" === typeof b && -1 != b.indexOf("%"); - b = Math.min(a, Math.max(0, parseFloat(b))); - c && (b = parseInt(b * a, 10) / 100); - return 1E-6 > Math.abs(b - a) ? 1 : b % a / parseFloat(a); -}; -Entry.Utils.hexToHsl = function(b) { - var a, c; - 7 === b.length ? (a = parseInt(b.substr(1, 2), 16), c = parseInt(b.substr(3, 2), 16), b = parseInt(b.substr(5, 2), 16)) : (a = parseInt(b.substr(1, 2), 16), c = parseInt(b.substr(2, 2), 16), b = parseInt(b.substr(3, 2), 16)); - a = Entry.Utils.bound01(a, 255); - c = Entry.Utils.bound01(c, 255); - b = Entry.Utils.bound01(b, 255); - var d = Math.max(a, c, b), e = Math.min(a, c, b), f, g = (d + e) / 2; - if (d == e) { - f = e = 0; - } else { - var h = d - e, e = .5 < g ? h / (2 - d - e) : h / (d + e); - switch(d) { - case a: - f = (c - b) / h + (c < b ? 6 : 0); - break; - case c: - f = (b - a) / h + 2; - break; - case b: - f = (a - c) / h + 4; - } - f /= 6; - } - return {h:360 * f, s:e, l:g}; -}; -Entry.Utils.hslToHex = function(b) { - function a(a, b, c) { - 0 > c && (c += 1); - 1 < c && --c; - return c < 1 / 6 ? a + 6 * (b - a) * c : .5 > c ? b : c < 2 / 3 ? a + (b - a) * (2 / 3 - c) * 6 : a; - } - function c(a) { - return 1 == a.length ? "0" + a : "" + a; - } - var d, e; - e = Entry.Utils.bound01(b.h, 360); - d = Entry.Utils.bound01(b.s, 1); - b = Entry.Utils.bound01(b.l, 1); - if (0 === d) { - d = b = e = b; - } else { - var f = .5 > b ? b * (1 + d) : b + d - b * d, g = 2 * b - f; - d = a(g, f, e + 1 / 3); - b = a(g, f, e); - e = a(g, f, e - 1 / 3); - } - b *= 255; - e *= 255; - return "#" + [c(Math.round(255 * d).toString(16)), c(Math.round(b).toString(16)), c(Math.round(e).toString(16))].join(""); -}; -Entry.Utils.bindGlobalEvent = function(b) { - var a = $(document); - void 0 === b && (b = "resize mousedown mousemove keydown keyup dispose".split(" ")); - -1 < b.indexOf("resize") && (Entry.windowReszied && ($(window).off("resize"), Entry.windowReszied.clear()), Entry.windowResized = new Entry.Event(window), $(window).on("resize", function(a) { - Entry.windowResized.notify(a); - })); - -1 < b.indexOf("mousedown") && (Entry.documentMousedown && (a.off("mousedown"), Entry.documentMousedown.clear()), Entry.documentMousedown = new Entry.Event(window), a.on("mousedown", function(a) { - Entry.documentMousedown.notify(a); - })); - -1 < b.indexOf("mousemove") && (Entry.documentMousemove && (a.off("touchmove mousemove"), Entry.documentMousemove.clear()), Entry.mouseCoordinate = {}, Entry.documentMousemove = new Entry.Event(window), a.on("touchmove mousemove", function(a) { - a.originalEvent && a.originalEvent.touches && (a = a.originalEvent.touches[0]); - Entry.documentMousemove.notify(a); - Entry.mouseCoordinate.x = a.clientX; - Entry.mouseCoordinate.y = a.clientY; - })); - -1 < b.indexOf("keydown") && (Entry.keyPressed && (a.off("keydown"), Entry.keyPressed.clear()), Entry.pressedKeys = [], Entry.keyPressed = new Entry.Event(window), a.on("keydown", function(a) { - var b = a.keyCode; - 0 > Entry.pressedKeys.indexOf(b) && Entry.pressedKeys.push(b); - Entry.keyPressed.notify(a); - })); - -1 < b.indexOf("keyup") && (Entry.keyUpped && (a.off("keyup"), Entry.keyUpped.clear()), Entry.keyUpped = new Entry.Event(window), a.on("keyup", function(a) { - var b = Entry.pressedKeys.indexOf(a.keyCode); - -1 < b && Entry.pressedKeys.splice(b, 1); - Entry.keyUpped.notify(a); - })); - -1 < b.indexOf("dispose") && (Entry.disposeEvent && Entry.disposeEvent.clear(), Entry.disposeEvent = new Entry.Event(window), Entry.documentMousedown && Entry.documentMousedown.attach(this, function(a) { - Entry.disposeEvent.notify(a); - })); -}; -Entry.Utils.makeActivityReporter = function() { - Entry.activityReporter = new Entry.ActivityReporter; - Entry.commander && Entry.commander.addReporter(Entry.activityReporter); - return Entry.activityReporter; -}; -Entry.Utils.initEntryEvent_ = function() { - Entry.events_ || (Entry.events_ = []); -}; -Entry.sampleColours = []; -Entry.assert = function(b, a) { - if (!b) { - throw Error(a || "Assert failed"); - } -}; -Entry.parseTexttoXML = function(b) { - var a; - window.ActiveXObject ? (a = new ActiveXObject("Microsoft.XMLDOM"), a.async = "false", a.loadXML(b)) : a = (new DOMParser).parseFromString(b, "text/xml"); - return a; -}; -Entry.createElement = function(b, a) { - var c = document.createElement(b); - a && (c.id = a); - c.hasClass = function(a) { - return this.className.match(new RegExp("(\\s|^)" + a + "(\\s|$)")); - }; - c.addClass = function(a) { - for (var b = 0;b < arguments.length;b++) { - a = arguments[b], this.hasClass(a) || (this.className += " " + a); - } + a._addToParamsKeyMap = function(b) { + b = b ? b : "dummy_" + Entry.Utils.generateId(); + var a = this.paramsKeyMap; + a[b] = Object.keys(a).length; }; - c.removeClass = function(a) { - for (var b = 0;b < arguments.length;b++) { - a = arguments[b], this.hasClass(a) && (this.className = this.className.replace(new RegExp("(\\s|^)" + a + "(\\s|$)"), " ")); - } ->>>>>>> entrylabs/master + a._addToStatementsKeyMap = function(b) { + b = b ? b : "dummy_" + Entry.Utils.generateId(); + var a = this.statementsKeyMap; + a[b] = Object.keys(a).length; }; })(Entry.BlockMockup.prototype); Entry.Playground = function() { @@ -14171,17 +12840,17 @@ Entry.Playground.prototype.generateView = function(a, b) { b && "workspace" != b ? "phone" == b && (this.view_.addClass("entryPlaygroundPhone"), a = Entry.createElement("div", "entryCategoryTab"), a.addClass("entryPlaygroundTabPhone"), Entry.view_.insertBefore(a, this.view_), this.generateTabView(a), this.tabView_ = a, a = Entry.createElement("div", "entryCurtain"), a.addClass("entryPlaygroundCurtainPhone"), a.addClass("entryRemove"), a.innerHTML = Lang.Workspace.cannot_edit_click_to_stop, a.bindOnClick(function() { Entry.engine.toggleStop(); }), this.view_.appendChild(a), this.curtainView_ = a, Entry.pictureEditable && (a = Entry.createElement("div", "entryPicture"), a.addClass("entryPlaygroundPicturePhone"), a.addClass("entryRemove"), this.view_.appendChild(a), this.generatePictureView(a), this.pictureView_ = a), a = Entry.createElement("div", "entryText"), a.addClass("entryRemove"), this.view_.appendChild(a), this.generateTextView(a), this.textView_ = a, Entry.soundEditable && (a = Entry.createElement("div", "entrySound"), a.addClass("entryPlaygroundSoundWorkspacePhone"), - a.addClass("entryRemove"), this.view_.appendChild(a), this.generateSoundView(a), this.soundView_ = a), a = Entry.createElement("div", "entryDefault"), this.view_.appendChild(a), this.generateDefaultView(a), this.defaultView_ = a, a = Entry.createElement("div", "entryCode"), a.addClass("entryPlaygroundCodePhone"), this.view_.appendChild(a), this.generateCodeView(a), this.codeView_ = this.codeView_ = a, Entry.addEventListener("run", function(a) { + a.addClass("entryRemove"), this.view_.appendChild(a), this.generateSoundView(a), this.soundView_ = a), a = Entry.createElement("div", "entryDefault"), this.view_.appendChild(a), this.generateDefaultView(a), this.defaultView_ = a, a = Entry.createElement("div", "entryCode"), a.addClass("entryPlaygroundCodePhone"), this.view_.appendChild(a), this.generateCodeView(a), this.codeView_ = this.codeView_ = a, Entry.addEventListener("run", function(b) { Entry.playground.curtainView_.removeClass("entryRemove"); - }), Entry.addEventListener("stop", function(a) { + }), Entry.addEventListener("stop", function(b) { Entry.playground.curtainView_.addClass("entryRemove"); })) : (this.view_.addClass("entryPlaygroundWorkspace"), a = Entry.createElement("div", "entryCategoryTab"), a.addClass("entryPlaygroundTabWorkspace"), this.view_.appendChild(a), this.generateTabView(a), this.tabView_ = a, a = Entry.createElement("div", "entryCurtain"), a.addClass("entryPlaygroundCurtainWorkspace"), a.addClass("entryRemove"), b = Lang.Workspace.cannot_edit_click_to_stop.split("."), a.innerHTML = b[0] + ".
" + b[1], a.addEventListener("click", function() { Entry.engine.toggleStop(); }), this.view_.appendChild(a), this.curtainView_ = a, Entry.pictureEditable && (a = Entry.createElement("div", "entryPicture"), a.addClass("entryPlaygroundPictureWorkspace"), a.addClass("entryRemove"), this.view_.appendChild(a), this.generatePictureView(a), this.pictureView_ = a), a = Entry.createElement("div", "entryText"), a.addClass("entryPlaygroundTextWorkspace"), a.addClass("entryRemove"), this.view_.appendChild(a), this.generateTextView(a), this.textView_ = a, Entry.soundEditable && (a = Entry.createElement("div", "entrySound"), a.addClass("entryPlaygroundSoundWorkspace"), a.addClass("entryRemove"), this.view_.appendChild(a), this.generateSoundView(a), this.soundView_ = a), a = Entry.createElement("div", "entryDefault"), a.addClass("entryPlaygroundDefaultWorkspace"), this.view_.appendChild(a), this.generateDefaultView(a), this.defaultView_ = a, a = Entry.createElement("div", "entryCode"), a.addClass("entryPlaygroundCodeWorkspace"), a.addClass("entryRemove"), this.view_.appendChild(a), - this.generateCodeView(a), this.codeView_ = a, b = Entry.createElement("div"), b.addClass("entryPlaygroundResizeWorkspace", "entryRemove"), this.resizeHandle_ = b, this.view_.appendChild(b), this.initializeResizeHandle(b), this.codeView_ = a, Entry.addEventListener("run", function(a) { + this.generateCodeView(a), this.codeView_ = a, b = Entry.createElement("div"), b.addClass("entryPlaygroundResizeWorkspace", "entryRemove"), this.resizeHandle_ = b, this.view_.appendChild(b), this.initializeResizeHandle(b), this.codeView_ = a, Entry.addEventListener("run", function(b) { Entry.playground.curtainView_.removeClass("entryRemove"); - }), Entry.addEventListener("stop", function(a) { + }), Entry.addEventListener("stop", function(b) { Entry.playground.curtainView_.addClass("entryRemove"); })); }; @@ -14204,15 +12873,15 @@ Entry.Playground.prototype.generateTabView = function(a) { b.blockMenu.reDraw(); }); this.tabViewElements.code = a; - Entry.pictureEditable && (a = Entry.createElement("li", "entryPictureTab"), a.innerHTML = Lang.Workspace.tab_picture, a.addClass("entryTabListItemWorkspace"), c.appendChild(a), a.bindOnClick(function(a) { + Entry.pictureEditable && (a = Entry.createElement("li", "entryPictureTab"), a.innerHTML = Lang.Workspace.tab_picture, a.addClass("entryTabListItemWorkspace"), c.appendChild(a), a.bindOnClick(function(b) { Entry.playground.changeViewMode("picture"); - }), this.tabViewElements.picture = a, a = Entry.createElement("li", "entryTextboxTab"), a.innerHTML = Lang.Workspace.tab_text, a.addClass("entryTabListItemWorkspace"), c.appendChild(a), a.bindOnClick(function(a) { + }), this.tabViewElements.picture = a, a = Entry.createElement("li", "entryTextboxTab"), a.innerHTML = Lang.Workspace.tab_text, a.addClass("entryTabListItemWorkspace"), c.appendChild(a), a.bindOnClick(function(b) { Entry.playground.changeViewMode("text"); }), this.tabViewElements.text = a, a.addClass("entryRemove")); - Entry.soundEditable && (a = Entry.createElement("li", "entrySoundTab"), a.innerHTML = Lang.Workspace.tab_sound, a.addClass("entryTabListItemWorkspace"), c.appendChild(a), a.bindOnClick(function(a) { + Entry.soundEditable && (a = Entry.createElement("li", "entrySoundTab"), a.innerHTML = Lang.Workspace.tab_sound, a.addClass("entryTabListItemWorkspace"), c.appendChild(a), a.bindOnClick(function(b) { Entry.playground.changeViewMode("sound"); }), this.tabViewElements.sound = a); - Entry.hasVariableManager && (a = Entry.createElement("li", "entryVariableTab"), a.innerHTML = Lang.Workspace.tab_attribute, a.addClass("entryTabListItemWorkspace"), a.addClass("entryVariableTabWorkspace"), c.appendChild(a), a.bindOnClick(function(a) { + Entry.hasVariableManager && (a = Entry.createElement("li", "entryVariableTab"), a.innerHTML = Lang.Workspace.tab_attribute, a.addClass("entryTabListItemWorkspace"), a.addClass("entryVariableTabWorkspace"), c.appendChild(a), a.bindOnClick(function(b) { Entry.playground.toggleOnVariableView(); Entry.playground.changeViewMode("variable"); }), this.tabViewElements.variable = a); @@ -14233,7 +12902,7 @@ Entry.Playground.prototype.generatePictureView = function(a) { if ("workspace" == Entry.type) { var b = Entry.createElement("div", "entryAddPicture"); b.addClass("entryPlaygroundAddPicture"); - b.bindOnClick(function(a) { + b.bindOnClick(function(b) { Entry.dispatchEvent("openPictureManager"); }); var c = Entry.createElement("div", "entryAddPictureInner"); @@ -14243,12 +12912,12 @@ Entry.Playground.prototype.generatePictureView = function(a) { a.appendChild(b); b = Entry.createElement("ul", "entryPictureList"); b.addClass("entryPlaygroundPictureList"); - $ && $(b).sortable({start:function(a, b) { - b.item.data("start_pos", b.item.index()); - }, stop:function(a, b) { - a = b.item.data("start_pos"); - b = b.item.index(); - Entry.playground.movePicture(a, b); + $ && $(b).sortable({start:function(b, a) { + a.item.data("start_pos", a.item.index()); + }, stop:function(b, a) { + b = a.item.data("start_pos"); + a = a.item.index(); + Entry.playground.movePicture(b, a); }, axis:"y"}); a.appendChild(b); this.pictureListView_ = b; @@ -14258,14 +12927,14 @@ Entry.Playground.prototype.generatePictureView = function(a) { this.painter = new Entry.Painter; this.painter.initialize(b); } else { - "phone" == Entry.type && (b = Entry.createElement("div", "entryAddPicture"), b.addClass("entryPlaygroundAddPicturePhone"), b.bindOnClick(function(a) { + "phone" == Entry.type && (b = Entry.createElement("div", "entryAddPicture"), b.addClass("entryPlaygroundAddPicturePhone"), b.bindOnClick(function(b) { Entry.dispatchEvent("openPictureManager"); - }), c = Entry.createElement("div", "entryAddPictureInner"), c.addClass("entryPlaygroundAddPictureInnerPhone"), c.innerHTML = Lang.Workspace.picture_add, b.appendChild(c), a.appendChild(b), b = Entry.createElement("ul", "entryPictureList"), b.addClass("entryPlaygroundPictureListPhone"), $ && $(b).sortable({start:function(a, b) { - b.item.data("start_pos", b.item.index()); - }, stop:function(a, b) { - a = b.item.data("start_pos"); - b = b.item.index(); - Entry.playground.movePicture(a, b); + }), c = Entry.createElement("div", "entryAddPictureInner"), c.addClass("entryPlaygroundAddPictureInnerPhone"), c.innerHTML = Lang.Workspace.picture_add, b.appendChild(c), a.appendChild(b), b = Entry.createElement("ul", "entryPictureList"), b.addClass("entryPlaygroundPictureListPhone"), $ && $(b).sortable({start:function(b, a) { + a.item.data("start_pos", a.item.index()); + }, stop:function(b, a) { + b = a.item.data("start_pos"); + a = a.item.index(); + Entry.playground.movePicture(b, a); }, axis:"y"}), a.appendChild(b), this.pictureListView_ = b); } }; @@ -14281,8 +12950,8 @@ Entry.Playground.prototype.generateTextView = function(a) { var d = Entry.createElement("select", "entryPainterAttrFontName"); d.addClass("entryPlaygroundPainterAttrFontName", "entryTextFontSelecter"); d.size = "1"; - d.onchange = function(a) { - Entry.playground.object.entity.setFontType(a.target.value); + d.onchange = function(b) { + Entry.playground.object.entity.setFontType(b.target.value); }; for (var e = 0;e < Entry.fonts.length;e++) { var f = Entry.fonts[e], g = Entry.createElement("option"); @@ -14297,21 +12966,21 @@ Entry.Playground.prototype.generateTextView = function(a) { a.appendChild(e); c = Entry.createElement("li"); c.addClass("entryPlaygroundTextAlignLeft"); - c.bindOnClick(function(a) { + c.bindOnClick(function(b) { Entry.playground.setFontAlign(Entry.TEXT_ALIGN_LEFT); }); e.appendChild(c); this.alignLeftBtn = c; c = Entry.createElement("li"); c.addClass("entryPlaygroundTextAlignCenter"); - c.bindOnClick(function(a) { + c.bindOnClick(function(b) { Entry.playground.setFontAlign(Entry.TEXT_ALIGN_CENTER); }); e.appendChild(c); this.alignCenterBtn = c; c = Entry.createElement("li"); c.addClass("entryPlaygroundTextAlignRight"); - c.bindOnClick(function(a) { + c.bindOnClick(function(b) { Entry.playground.setFontAlign(Entry.TEXT_ALIGN_RIGHT); }); e.appendChild(c); @@ -14331,9 +13000,9 @@ Entry.Playground.prototype.generateTextView = function(a) { d = Entry.createElement("a"); c.appendChild(d); d.bindOnClick(function() { - var a = !Entry.playground.object.entity.getUnderLine() || !1; - k.src = Entry.mediaFilePath + "text_button_underline_" + a + ".png"; - Entry.playground.object.entity.setUnderLine(a); + var b = !Entry.playground.object.entity.getUnderLine() || !1; + k.src = Entry.mediaFilePath + "text_button_underline_" + b + ".png"; + Entry.playground.object.entity.setUnderLine(b); }); var k = Entry.createElement("img", "entryPlaygroundText_underlineImage"); d.appendChild(k); @@ -14353,13 +13022,13 @@ Entry.Playground.prototype.generateTextView = function(a) { d = Entry.createElement("a"); c.appendChild(d); d.bindOnClick(function() { - var a = !Entry.playground.object.entity.getStrike() || !1; - Entry.playground.object.entity.setStrike(a); - q.src = Entry.mediaFilePath + "text_button_strike_" + a + ".png"; + var b = !Entry.playground.object.entity.getStrike() || !1; + Entry.playground.object.entity.setStrike(b); + n.src = Entry.mediaFilePath + "text_button_strike_" + b + ".png"; }); - var q = Entry.createElement("img", "entryPlaygroundText_strikeImage"); - d.appendChild(q); - q.src = Entry.mediaFilePath + "text_button_strike_false.png"; + var n = Entry.createElement("img", "entryPlaygroundText_strikeImage"); + d.appendChild(n); + n.src = Entry.mediaFilePath + "text_button_strike_false.png"; d = Entry.createElement("li"); e.appendChild(d); c = Entry.createElement("a"); @@ -14392,8 +13061,8 @@ Entry.Playground.prototype.generateTextView = function(a) { b.appendChild(d); a = Entry.getColourCodes(); for (e = 0;e < a.length;e++) { - c = Entry.createElement("div"), c.addClass("modal_colour"), c.setAttribute("colour", a[e]), c.style.backgroundColor = a[e], 0 === e && c.addClass("modalColourTrans"), c.bindOnClick(function(a) { - Entry.playground.setTextColour(a.target.getAttribute("colour")); + c = Entry.createElement("div"), c.addClass("modal_colour"), c.setAttribute("colour", a[e]), c.style.backgroundColor = a[e], 0 === e && c.addClass("modalColourTrans"), c.bindOnClick(function(b) { + Entry.playground.setTextColour(b.target.getAttribute("colour")); }), d.appendChild(c); } d.style.display = "none"; @@ -14402,8 +13071,8 @@ Entry.Playground.prototype.generateTextView = function(a) { this.backgroundsWrapper = d; b.appendChild(d); for (e = 0;e < a.length;e++) { - c = Entry.createElement("div"), c.addClass("modal_colour"), c.setAttribute("colour", a[e]), c.style.backgroundColor = a[e], 0 === e && c.addClass("modalColourTrans"), c.bindOnClick(function(a) { - Entry.playground.setBackgroundColour(a.target.getAttribute("colour")); + c = Entry.createElement("div"), c.addClass("modal_colour"), c.setAttribute("colour", a[e]), c.style.backgroundColor = a[e], 0 === e && c.addClass("modalColourTrans"), c.bindOnClick(function(b) { + Entry.playground.setBackgroundColour(b.target.getAttribute("colour")); }), d.appendChild(c); } d.style.display = "none"; @@ -14434,30 +13103,40 @@ Entry.Playground.prototype.generateTextView = function(a) { a.addClass("entryPlaygroundFontSizeWrapper"); b.appendChild(a); this.fontSizeWrapper = a; - var n = Entry.createElement("div"); - n.addClass("entryPlaygroundFontSizeSlider"); - a.appendChild(n); var m = Entry.createElement("div"); - m.addClass("entryPlaygroundFontSizeIndicator"); - n.appendChild(m); - this.fontSizeIndiciator = m; + m.addClass("entryPlaygroundFontSizeSlider"); + a.appendChild(m); + var q = Entry.createElement("div"); + q.addClass("entryPlaygroundFontSizeIndicator"); + m.appendChild(q); + this.fontSizeIndiciator = q; var r = Entry.createElement("div"); r.addClass("entryPlaygroundFontSizeKnob"); - n.appendChild(r); + m.appendChild(r); this.fontSizeKnob = r; e = Entry.createElement("div"); e.addClass("entryPlaygroundFontSizeLabel"); e.innerHTML = "\uae00\uc790 \ud06c\uae30"; a.appendChild(e); var u = !1, t = 0; - r.onmousedown = function(a) { + r.onmousedown = function(b) { u = !0; - t = $(n).offset().left; + t = $(m).offset().left; }; - document.addEventListener("mousemove", function(a) { - u && (a = a.pageX - t, a = Math.max(a, 5), a = Math.min(a, 88), r.style.left = a + "px", a /= .88, m.style.width = a + "%", Entry.playground.object.entity.setFontSize(a)); + r.addEventListener("touchstart", function(b) { + u = !0; + t = $(m).offset().left; + }); + document.addEventListener("mousemove", function(b) { + u && (b = b.pageX - t, b = Math.max(b, 5), b = Math.min(b, 88), r.style.left = b + "px", b /= .88, q.style.width = b + "%", Entry.playground.object.entity.setFontSize(b)); + }); + document.addEventListener("touchmove", function(b) { + u && (b = b.touches[0].pageX - t, b = Math.max(b, 5), b = Math.min(b, 88), r.style.left = b + "px", b /= .88, q.style.width = b + "%", Entry.playground.object.entity.setFontSize(b)); }); - document.addEventListener("mouseup", function(a) { + document.addEventListener("mouseup", function(b) { + u = !1; + }); + document.addEventListener("touchend", function(b) { u = !1; }); a = Entry.createElement("div"); @@ -14508,7 +13187,7 @@ Entry.Playground.prototype.generateSoundView = function(a) { if ("workspace" == Entry.type) { var b = Entry.createElement("div", "entryAddSound"); b.addClass("entryPlaygroundAddSound"); - b.bindOnClick(function(a) { + b.bindOnClick(function(b) { Entry.dispatchEvent("openSoundManager"); }); var c = Entry.createElement("div", "entryAddSoundInner"); @@ -14518,24 +13197,24 @@ Entry.Playground.prototype.generateSoundView = function(a) { a.appendChild(b); b = Entry.createElement("ul", "entrySoundList"); b.addClass("entryPlaygroundSoundList"); - $ && $(b).sortable({start:function(a, b) { - b.item.data("start_pos", b.item.index()); - }, stop:function(a, b) { - a = b.item.data("start_pos"); - b = b.item.index(); - Entry.playground.moveSound(a, b); + $ && $(b).sortable({start:function(b, a) { + a.item.data("start_pos", a.item.index()); + }, stop:function(b, a) { + b = a.item.data("start_pos"); + a = a.item.index(); + Entry.playground.moveSound(b, a); }, axis:"y"}); a.appendChild(b); this.soundListView_ = b; } else { - "phone" == Entry.type && (b = Entry.createElement("div", "entryAddSound"), b.addClass("entryPlaygroundAddSoundPhone"), b.bindOnClick(function(a) { + "phone" == Entry.type && (b = Entry.createElement("div", "entryAddSound"), b.addClass("entryPlaygroundAddSoundPhone"), b.bindOnClick(function(b) { Entry.dispatchEvent("openSoundManager"); - }), c = Entry.createElement("div", "entryAddSoundInner"), c.addClass("entryPlaygroundAddSoundInnerPhone"), c.innerHTML = Lang.Workspace.sound_add, b.appendChild(c), a.appendChild(b), b = Entry.createElement("ul", "entrySoundList"), b.addClass("entryPlaygroundSoundListPhone"), $ && $(b).sortable({start:function(a, b) { - b.item.data("start_pos", b.item.index()); - }, stop:function(a, b) { - a = b.item.data("start_pos"); - b = b.item.index(); - Entry.playground.moveSound(a, b); + }), c = Entry.createElement("div", "entryAddSoundInner"), c.addClass("entryPlaygroundAddSoundInnerPhone"), c.innerHTML = Lang.Workspace.sound_add, b.appendChild(c), a.appendChild(b), b = Entry.createElement("ul", "entrySoundList"), b.addClass("entryPlaygroundSoundListPhone"), $ && $(b).sortable({start:function(b, a) { + a.item.data("start_pos", a.item.index()); + }, stop:function(b, a) { + b = a.item.data("start_pos"); + a = a.item.index(); + Entry.playground.moveSound(b, a); }, axis:"y"}), a.appendChild(b), this.soundListView_ = b); } }; @@ -14771,15 +13450,15 @@ Entry.Playground.prototype.showTab = function(a) { this.tabViewElements[a] && (this.tabViewElements[a].addClass("showTab"), this.tabViewElements[a].removeClass("hideTab")); }; Entry.Playground.prototype.initializeResizeHandle = function(a) { - a.onmousedown = function(a) { + $(a).bind("mousedown touchstart", function(b) { Entry.playground.resizing = !0; - Entry.documentMousemove && (Entry.playground.resizeEvent = Entry.documentMousemove.attach(this, function(a) { - Entry.playground.resizing && Entry.resizeElement({menuWidth:a.clientX - Entry.interfaceState.canvasWidth}); + Entry.documentMousemove && (Entry.playground.resizeEvent = Entry.documentMousemove.attach(this, function(b) { + Entry.playground.resizing && Entry.resizeElement({menuWidth:b.clientX - Entry.interfaceState.canvasWidth}); })); - }; - document.addEventListener("mouseup", function(a) { - if (a = Entry.playground.resizeEvent) { - Entry.playground.resizing = !1, Entry.documentMousemove.detach(a), delete Entry.playground.resizeEvent; + }); + $(document).bind("mouseup touchend", function(b) { + if (b = Entry.playground.resizeEvent) { + Entry.playground.resizing = !1, Entry.documentMousemove.detach(b), delete Entry.playground.resizeEvent; } }); }; @@ -14797,37 +13476,8 @@ Entry.Playground.prototype.flushPlayground = function() { a.changeCode(null); } }; -<<<<<<< HEAD Entry.Playground.prototype.refreshPlayground = function() { Entry.playground && Entry.playground.view_ && ("picture" === this.getViewMode() && this.injectPicture(), "sound" === this.getViewMode() && this.injectSound()); -======= -window.requestAnimFrame = function() { - return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(b) { - window.setTimeout(b, 1E3 / 60); - }; -}(); -Entry.isMobile = function() { - if (Entry.device) { - return "tablet" === Entry.device; - } - var b = window.platform; - if (b && b.type && ("tablet" === b.type || "mobile" === b.type)) { - return Entry.device = "tablet", !0; - } - Entry.device = "desktop"; - return !1; -}; -Entry.Utils.convertMouseEvent = function(b) { - return b.originalEvent && b.originalEvent.touches ? b.originalEvent.touches[0] : b; -}; -Entry.Model = function(b, a) { - var c = Entry.Model; - c.generateSchema(b); - c.generateSetter(b); - c.generateObserve(b); - (void 0 === a || a) && Object.seal(b); - return b; ->>>>>>> entrylabs/master }; Entry.Playground.prototype.updateListViewOrder = function(a) { a = "picture" == a ? this.pictureListView_.childNodes : this.soundListView_.childNodes; @@ -14858,7 +13508,7 @@ Entry.Playground.prototype.generatePictureElement = function(a) { a.view = c; c.addClass("entryPlaygroundPictureElement"); c.picture = a; - c.bindOnClick(function(a) { + c.bindOnClick(function(b) { Entry.playground.selectPicture(this.picture); }); Entry.Utils.disableContextmenu(a.view); @@ -14892,8 +13542,8 @@ Entry.Playground.prototype.generatePictureElement = function(a) { f.picture = a; f.value = a.name; Entry.attachEventListener(f, "blur", b); - f.onkeypress = function(a) { - 13 == a.keyCode && this.blur(); + f.onkeypress = function(b) { + 13 == b.keyCode && this.blur(); }; c.appendChild(f); d = Entry.createElement("div", "s_" + a.id); @@ -14926,12 +13576,12 @@ Entry.Playground.prototype.generateSoundElement = function(a) { d.addClass("entryPlaygroundSoundPlay"); var e = !1, f; d.addEventListener("click", function() { - e ? (e = !1, d.removeClass("entryPlaygroundSoundStop"), d.addClass("entryPlaygroundSoundPlay"), f.stop()) : (e = !0, d.removeClass("entryPlaygroundSoundPlay"), d.addClass("entryPlaygroundSoundStop"), f = createjs.Sound.play(a.id), f.addEventListener("complete", function(a) { + e ? (e = !1, d.removeClass("entryPlaygroundSoundStop"), d.addClass("entryPlaygroundSoundPlay"), f.stop()) : (e = !0, d.removeClass("entryPlaygroundSoundPlay"), d.addClass("entryPlaygroundSoundStop"), f = createjs.Sound.play(a.id), f.addEventListener("complete", function(b) { d.removeClass("entryPlaygroundSoundStop"); d.addClass("entryPlaygroundSoundPlay"); e = !1; - }), f.addEventListener("loop", function(a) { - }), f.addEventListener("failed", function(a) { + }), f.addEventListener("loop", function(b) { + }), f.addEventListener("failed", function(b) { })); }); b.appendChild(d); @@ -14944,8 +13594,8 @@ Entry.Playground.prototype.generateSoundElement = function(a) { if ("" === this.value) { alert("\uc774\ub984\uc744 \uc785\ub825\ud558\uc5ec \uc8fc\uc138\uc694."), this.focus(); } else { - for (var a = 0, b = 0;b < h.length;b++) { - if (h[b].value == g.value && (a += 1, 1 < a)) { + for (var b = 0, a = 0;a < h.length;a++) { + if (h[a].value == g.value && (b += 1, 1 < b)) { alert("\uc774\ub984\uc774 \uc911\ubcf5 \ub418\uc5c8\uc2b5\ub2c8\ub2e4."); this.focus(); return; @@ -14955,8 +13605,8 @@ Entry.Playground.prototype.generateSoundElement = function(a) { Entry.playground.reloadPlayground(); } }; - g.onkeypress = function(a) { - 13 == a.keyCode && this.blur(); + g.onkeypress = function(b) { + 13 == b.keyCode && this.blur(); }; b.appendChild(g); c = Entry.createElement("div"); @@ -15033,6 +13683,7 @@ Entry.Popup = function() { document.body.appendChild(this.body_); this.window_ = Entry.createElement("div"); this.window_.addClass("entryPopupWindow"); + "tablet" === Entry.device && this.window_.addClass("tablet"); this.window_.bindOnClick(function() { }); Entry.addEventListener("windowResized", this.resize); @@ -15068,8 +13719,17 @@ Entry.popupHelper = function(a) { this.body_.bindOnClick(function(a) { if (!(d.nowContent && -1 < b.indexOf(d.nowContent.prop("type")))) { var f = $(a.target); - c.forEach(function(a) { - f.hasClass(a) && this.popup.hide(); + c.forEach(function(b) { + f.hasClass(b) && this.popup.hide(); + }.bind(this)); + a.target == this && this.popup.hide(); + } + }); + this.body_.bind("touchstart", function(a) { + if (!(d.nowContent && -1 < b.indexOf(d.nowContent.prop("type")))) { + var f = $(a.target); + c.forEach(function(b) { + f.hasClass(b) && this.popup.hide(); }.bind(this)); a.target == this && this.popup.hide(); } @@ -15094,14 +13754,18 @@ Entry.popupHelper.prototype.addPopup = function(a, b) { d.bindOnClick(function() { b.closeEvent ? b.closeEvent(this) : this.hide(); }.bind(this)); - var e = Entry.Dom("div", {class:"entryPopupHelperWrapper"}); - e.append(d); - b.title && (d = Entry.Dom("div", {class:"entryPopupHelperTitle"}), e.append(d), d.text(b.title)); - c.addClass(a); - c.append(e); - c.popupWrapper_ = e; - c.prop("type", b.type); - "function" === typeof b.setPopupLayout && b.setPopupLayout(c); + var e = this; + d.bind("touchstart", function() { + b.closeEvent ? b.closeEvent(e) : e.hide(); + }); + var f = Entry.Dom("div", {class:"entryPopupHelperWrapper"}); + f.append(d); + b.title && (d = Entry.Dom("div", {class:"entryPopupHelperTitle"}), f.append(d), d.text(b.title)); + c.addClass(a); + c.append(f); + c.popupWrapper_ = f; + c.prop("type", b.type); + "function" === typeof b.setPopupLayout && b.setPopupLayout(c); this.popupList[a] = c; }; Entry.popupHelper.prototype.hasPopup = function(a) { @@ -15163,27 +13827,26 @@ Entry.Scene = function() { a.resize(); }); }; -<<<<<<< HEAD Entry.Scene.viewBasicWidth = 70; Entry.Scene.prototype.generateView = function(a, b) { var c = this; this.view_ = a; this.view_.addClass("entryScene"); - b && "workspace" != b || (this.view_.addClass("entrySceneWorkspace"), $(this.view_).on("mousedown", function(a) { - var b = $(this).offset(), f = $(window), g = a.pageX - b.left + f.scrollLeft(); - a = a.pageY - b.top + f.scrollTop(); - a = 40 - a; - b = -40 / 55; + b && "workspace" != b || (this.view_.addClass("entrySceneWorkspace"), $(this.view_).on("mousedown", function(b) { + var a = $(this).offset(), f = $(window), g = b.pageX - a.left + f.scrollLeft(); + b = b.pageY - a.top + f.scrollTop(); + b = 40 - b; + a = -40 / 55; f = $(c.selectedScene.view).find(".entrySceneRemoveButtonCoverWorkspace").offset().left; - !(g < f || g > f + 55) && a > 40 + b * (g - f) && (g = c.getNextScene()) && (g = $(g.view), $(document).trigger("mouseup"), g.trigger("mousedown")); - }), a = Entry.createElement("ul"), a.addClass("entrySceneListWorkspace"), Entry.sceneEditable && $ && $(a).sortable({start:function(a, b) { - b.item.data("start_pos", b.item.index()); - $(b.item[0]).clone(!0); - }, stop:function(a, b) { - a = b.item.data("start_pos"); - b = b.item.index(); - Entry.scene.moveScene(a, b); - }, axis:"x", tolerance:"pointer"}), this.view_.appendChild(a), this.listView_ = a, Entry.sceneEditable && (a = Entry.createElement("span"), a.addClass("entrySceneElementWorkspace"), a.addClass("entrySceneAddButtonWorkspace"), a.bindOnClick(function(a) { + !(g < f || g > f + 55) && b > 40 + a * (g - f) && (g = c.getNextScene()) && (g = $(g.view), $(document).trigger("mouseup"), g.trigger("mousedown")); + }), a = Entry.createElement("ul"), a.addClass("entrySceneListWorkspace"), Entry.sceneEditable && $ && $(a).sortable({start:function(b, a) { + a.item.data("start_pos", a.item.index()); + $(a.item[0]).clone(!0); + }, stop:function(b, a) { + b = a.item.data("start_pos"); + a = a.item.index(); + Entry.scene.moveScene(b, a); + }, axis:"x", tolerance:"pointer"}), this.view_.appendChild(a), this.listView_ = a, Entry.sceneEditable && (a = Entry.createElement("span"), a.addClass("entrySceneElementWorkspace"), a.addClass("entrySceneAddButtonWorkspace"), a.bindOnClick(function(b) { Entry.engine.isState("run") || Entry.scene.addScene(); }), this.view_.appendChild(a), this.addButton_ = a)); }; @@ -15210,225 +13873,6 @@ Entry.Scene.prototype.generateElement = function(a) { d.onkeyup = function(c) { c = c.keyCode; Entry.isArrowOrBackspace(c) || (a.name = this.value, f.style.width = Entry.computeInputWidth(a.name), b.resize(), 13 == c && this.blur(), 10 < this.value.length && (this.value = this.value.substring(0, 10), this.blur())); -======= -(function(b) { - b.initView = function() { - this.svgDom = Entry.Dom($('')); - }; - b.generateView = function() { - this.snap = Entry.SVG("hwMonitor"); - this._svgGroup = this.snap.elem("g"); - this._portMap = {n:[], e:[], s:[], w:[]}; - var a = this._hwModule.monitorTemplate, b = {href:Entry.mediaFilePath + a.imgPath, x:-a.width / 2, y:-a.height / 2, width:a.width, height:a.height}; - this._portViews = {}; - this.hwView = this._svgGroup.elem("image"); - this.hwView = this.hwView.attr(b); - this._template = a; - a = a.ports; - this.pathGroup = null; - this.pathGroup = this._svgGroup.elem("g"); - var b = [], d; - for (d in a) { - var e = this.generatePortView(a[d], "_svgGroup"); - this._portViews[d] = e; - b.push(e); - } - b.sort(function(a, b) { - return a.box.x - b.box.x; - }); - var f = this._portMap; - b.map(function(a) { - (1 > (Math.atan2(-a.box.y, a.box.x) / Math.PI + 2) % 2 ? f.n : f.s).push(a); - }); - this.resize(); - }; - b.toggleMode = function(a) { - var b = this._hwModule.monitorTemplate; - "list" == a ? (b.TempPort = null, this._hwModule.monitorTemplate.ports && (this._hwModule.monitorTemplate.TempPort = this._hwModule.monitorTemplate.ports, this._hwModule.monitorTemplate.listPorts = this.addPortEle(this._hwModule.monitorTemplate.listPorts, this._hwModule.monitorTemplate.ports)), $(this._svglistGroup).remove(), this._svgGroup && $(this._svgGroup).remove(), $(this._pathGroup).remove(), this._hwModule.monitorTemplate.mode = "list", this.generateListView()) : (this._hwModule.monitorTemplate.TempPort && - (this._hwModule.monitorTemplate.ports = this._hwModule.monitorTemplate.TempPort, this._hwModule.monitorTemplate.listPorts = this.removePortEle(this._hwModule.monitorTemplate.listPorts, this._hwModule.monitorTemplate.ports)), $(this._svglistGroup).remove(), this._hwModule.monitorTemplate.mode = "both", this.generateListView(), this.generateView()); - }; - b.setHwmonitor = function(a) { - this._hwmodule = a; - }; - b.changeMode = function(a) { - "both" == this._hwModule.monitorTemplate.mode ? this.toggleMode("list") : "list" == this._hwModule.monitorTemplate.mode && this.toggleMode("both"); - }; - b.addPortEle = function(a, b) { - if ("object" != typeof b) { - return a; - } - for (var d in b) { - a[d] = b[d]; - } - return a; - }; - b.removePortEle = function(a, b) { - if ("object" != typeof b) { - return a; - } - for (var d in b) { - delete a[d]; - } - return a; - }; - b.generateListView = function() { - this._portMapList = {n:[]}; - this._svglistGroup = null; - this.listsnap = Entry.SVG("hwMonitor"); - this._svglistGroup = this.listsnap.elem("g"); - var a = this._hwModule.monitorTemplate; - this._template = a; - a = a.listPorts; - this.pathGroup = this._svglistGroup.elem("g"); - var b = [], d; - for (d in a) { - var e = this.generatePortView(a[d], "_svglistGroup"); - this._listPortViews[d] = e; - b.push(e); - } - var f = this._portMapList; - b.map(function(a) { - f.n.push(a); - }); - this.resizeList(); - }; - b.generatePortView = function(a, b) { - var d = this[b].elem("g"); - d.addClass("hwComponent"); - var e = null, e = this.pathGroup.elem("path").attr({d:"m0,0", fill:"none", stroke:"input" === a.type ? "#00979d" : "#A751E3", "stroke-width":3}), f = d.elem("rect").attr({x:0, y:0, width:150, height:22, rx:4, ry:4, fill:"#fff", stroke:"#a0a1a1"}), g = d.elem("text").attr({x:4, y:12, fill:"#000", "class":"hwComponentName", "alignment-baseline":"central"}); - g.textContent = a.name; - g = g.getComputedTextLength(); - d.elem("rect").attr({x:g + 8, y:2, width:30, height:18, rx:9, ry:9, fill:"input" === a.type ? "#00979d" : "#A751E3"}); - var h = d.elem("text").attr({x:g + 13, y:12, fill:"#fff", "class":"hwComponentValue", "alignment-baseline":"central"}); - h.textContent = 0; - g += 40; - f.attr({width:g}); - return {group:d, value:h, type:a.type, path:e, box:{x:a.pos.x - this._template.width / 2, y:a.pos.y - this._template.height / 2, width:g}, width:g}; - }; - b.getView = function() { - return this.svgDom; - }; - b.update = function() { - var a = Entry.hw.portData, b = Entry.hw.sendQueue, d = this._hwModule.monitorTemplate.mode, e = this._hwModule.monitorTemplate.keys || [], f = []; - if ("list" == d) { - f = this._listPortViews; - } else { - if ("both" == d) { - if (f = this._listPortViews, this._portViews) { - for (var g in this._portViews) { - f[g] = this._portViews[g]; - } - } - } else { - f = this._portViews; - } - } - if (b) { - for (g in b) { - 0 != b[g] && f[g] && (f[g].type = "output"); - } - } - for (var h in f) { - if (d = f[h], "input" == d.type) { - var k = a[h]; - 0 < e.length && $.each(e, function(a, b) { - if ($.isPlainObject(k)) { - k = k[b] || 0; - } else { - return !1; - } - }); - d.value.textContent = k ? k : 0; - d.group.getElementsByTagName("rect")[1].attr({fill:"#00979D"}); - } else { - k = b[h], 0 < e.length && $.each(e, function(a, b) { - if ($.isPlainObject(k)) { - k = k[b] || 0; - } else { - return !1; - } - }), d.value.textContent = k ? k : 0, d.group.getElementsByTagName("rect")[1].attr({fill:"#A751E3"}); - } - } - }; - b.resize = function() { - this.hwView && this.hwView.attr({transform:"scale(" + this.scale + ")"}); - if (this.svgDom) { - var a = this.svgDom.get(0).getBoundingClientRect() - } - this._svgGroup.attr({transform:"translate(" + a.width / 2 + "," + a.height / 1.8 + ")"}); - this._rect = a; - 0 >= this._template.height || 0 >= a.height || (this.scale = a.height / this._template.height * this._template.height / 1E3, this.align()); - }; - b.resizeList = function() { - var a = this.svgDom.get(0).getBoundingClientRect(); - this._svglistGroup.attr({transform:"translate(" + a.width / 2 + "," + a.height / 2 + ")"}); - this._rect = a; - this.alignList(); - }; - b.align = function() { - var a = [], a = this._portMap.s.concat(); - this._alignNS(a, this.scale / 3 * this._template.height + 5, 27); - a = this._portMap.n.concat(); - this._alignNS(a, -this._template.height * this.scale / 3 - 32, -27); - a = this._portMap.e.concat(); - this._alignEW(a, -this._template.width * this.scale / 3 - 5, -27); - a = this._portMap.w.concat(); - this._alignEW(a, this._template.width * this.scale / 3 - 32, -27); - }; - b.alignList = function() { - for (var a = {}, a = this._hwModule.monitorTemplate.listPorts, b = a.length, d = 0;d < a.length;d++) { - a[d].group.attr({transform:"translate(" + this._template.width * (d / b - .5) + "," + (-this._template.width / 2 - 30) + ")"}); - } - a = this._portMapList.n.concat(); - this._alignNSList(a, -this._template.width * this.scale / 2 - 32, -27); - }; - b._alignEW = function(a, b, d) { - var e = a.length, f = this._rect.height - 50; - tP = -f / 2; - bP = f / 2; - height = this._rect.height; - listVLine = wholeHeight = 0; - mode = this._hwModule.monitorTemplate; - for (f = 0;f < e;f++) { - wholeHeight += a[f].height + 5; - } - wholeHeight < bP - tP && (bP = wholeHeight / 2 + 3, tP = -wholeHeight / 2 - 3); - for (;1 < e;) { - var g = a.shift(), f = a.pop(), h = tP, k = bP, l = d; - wholeWidth <= bP - tP ? (tP += g.width + 5, bP -= f.width + 5, l = 0) : 0 === a.length ? (tP = (tP + bP) / 2 - 3, bP = tP + 6) : (tP = Math.max(tP, -width / 2 + g.width) + 15, bP = Math.min(bP, width / 2 - f.width) - 15); - wholeWidth -= g.width + f.width + 10; - b += l; - } - a.length && a[0].group.attr({transform:"translate(" + b + ",60)"}); - g && rPort && (this._movePort(g, b, tP, h), this._movePort(rPort, b, bP, k)); - }; - b._alignNS = function(a, b, d) { - for (var e = -this._rect.width / 2, f = this._rect.width / 2, g = this._rect.width, h = 0, k = 0;k < a.length;k++) { - h += a[k].width + 5; - } - h < f - e && (f = h / 2 + 3, e = -h / 2 - 3); - for (;1 < a.length;) { - var k = a.shift(), l = a.pop(), n = e, m = f, q = d; - h <= f - e ? (e += k.width + 5, f -= l.width + 5, q = 0) : 0 === a.length ? (e = (e + f) / 2 - 3, f = e + 6) : (e = Math.max(e, -g / 2 + k.width) + 15, f = Math.min(f, g / 2 - l.width) - 15); - this._movePort(k, e, b, n); - this._movePort(l, f, b, m); - h -= k.width + l.width + 10; - b += q; - } - a.length && this._movePort(a[0], (f + e - a[0].width) / 2, b, 100); - }; - b._alignNSList = function(a, b) { - var d = this._rect.width; - initX = -this._rect.width / 2 + 10; - initY = -this._rect.height / 2 + 10; - for (var e = listLine = wholeWidth = 0;e < a.length;e++) { - wholeWidth += a[e].width; - } - for (var f = 0, g = 0, h = initX, k = 0, l = 0, n = 0, e = 0;e < a.length;e++) { - l = a[e], e != a.length - 1 && (n = a[e + 1]), g += l.width, lP = initX, k = initY + 30 * f, l.group.attr({transform:"translate(" + lP + "," + k + ")"}), initX += l.width + 10, g > d - (l.width + n.width / 2.2) && (f += 1, initX = h, g = 0); - } ->>>>>>> entrylabs/master }; d.onblur = function(b) { d.value = this.value; @@ -15442,10 +13886,9 @@ Entry.Scene.prototype.generateElement = function(a) { if (Entry.sceneEditable) { var g = Entry.createElement("button"); g.addClass("entrySceneRemoveButtonWorkspace"); - g.innerHTML = "x"; g.scene = a; - g.bindOnClick(function(a) { - a.stopPropagation(); + g.bindOnClick(function(b) { + b.stopPropagation(); Entry.engine.isState("run") || confirm(Lang.Workspace.will_you_delete_scene) && Entry.scene.removeScene(this.scene); }); e.appendChild(g); @@ -15716,59 +14159,59 @@ Entry.Stage.prototype.initStage = function(a) { this.initHandle(); this.mouseCoordinate = {x:0, y:0}; if (Entry.isPhone()) { - a.ontouchstart = function(a) { - Entry.dispatchEvent("canvasClick", a); + a.ontouchstart = function(b) { + Entry.dispatchEvent("canvasClick", b); Entry.stage.isClick = !0; - }, a.ontouchend = function(a) { + }, a.ontouchend = function(b) { Entry.stage.isClick = !1; - Entry.dispatchEvent("canvasClickCanceled", a); + Entry.dispatchEvent("canvasClickCanceled", b); }; } else { - var b = function(a) { - Entry.dispatchEvent("canvasClick", a); + var b = function(b) { + Entry.dispatchEvent("canvasClick", b); Entry.stage.isClick = !0; }; a.onmousedown = b; a.ontouchstart = b; - b = function(a) { + b = function(b) { Entry.stage.isClick = !1; - Entry.dispatchEvent("canvasClickCanceled", a); + Entry.dispatchEvent("canvasClickCanceled", b); }; a.onmouseup = b; a.ontouchend = b; - $(document).click(function(a) { - Entry.stage.focused = "entryCanvas" === a.target.id ? !0 : !1; + $(document).click(function(b) { + Entry.stage.focused = "entryCanvas" === b.target.id ? !0 : !1; }); } - Entry.addEventListener("canvasClick", function(a) { + Entry.addEventListener("canvasClick", function(b) { Entry.stage.isObjectClick = !1; }); Entry.windowResized.attach(this, function() { Entry.stage.updateBoundRect(); }); - b = function(a) { - a.preventDefault(); - var b = Entry.stage.getBoundRect(), e; - -1 < Entry.getBrowserType().indexOf("IE") ? (e = 480 * ((a.pageX - b.left - document.documentElement.scrollLeft) / b.width - .5), a = -270 * ((a.pageY - b.top - document.documentElement.scrollTop) / b.height - .5)) : a.changedTouches ? (e = 480 * ((a.changedTouches[0].pageX - b.left - document.body.scrollLeft) / b.width - .5), a = -270 * ((a.changedTouches[0].pageY - b.top - document.body.scrollTop) / b.height - .5)) : (e = 480 * ((a.pageX - b.left - document.body.scrollLeft) / b.width - .5), - a = -270 * ((a.pageY - b.top - document.body.scrollTop) / b.height - .5)); - Entry.stage.mouseCoordinate = {x:e.toFixed(1), y:a.toFixed(1)}; + b = function(b) { + b.preventDefault(); + var a = Entry.stage.getBoundRect(), e; + -1 < Entry.getBrowserType().indexOf("IE") ? (e = 480 * ((b.pageX - a.left - document.documentElement.scrollLeft) / a.width - .5), b = -270 * ((b.pageY - a.top - document.documentElement.scrollTop) / a.height - .5)) : b.changedTouches ? (e = 480 * ((b.changedTouches[0].pageX - a.left - document.body.scrollLeft) / a.width - .5), b = -270 * ((b.changedTouches[0].pageY - a.top - document.body.scrollTop) / a.height - .5)) : (e = 480 * ((b.pageX - a.left - document.body.scrollLeft) / a.width - .5), + b = -270 * ((b.pageY - a.top - document.body.scrollTop) / a.height - .5)); + Entry.stage.mouseCoordinate = {x:e.toFixed(1), y:b.toFixed(1)}; Entry.dispatchEvent("stageMouseMove"); }; a.onmousemove = b; a.ontouchmove = b; - a.onmouseout = function(a) { + a.onmouseout = function(b) { Entry.dispatchEvent("stageMouseOut"); }; - Entry.addEventListener("updateObject", function(a) { + Entry.addEventListener("updateObject", function(b) { Entry.engine.isState("stop") && Entry.stage.updateObject(); }); - Entry.addEventListener("canvasInputComplete", function(a) { + Entry.addEventListener("canvasInputComplete", function(b) { try { - var b = Entry.stage.inputField.value(); + var a = Entry.stage.inputField.value(); Entry.stage.hideInputField(); - if (b) { + if (a) { var e = Entry.container; - e.setInputValue(b); + e.setInputValue(a); e.inputValue.complete = !0; } } catch (f) { @@ -15991,7 +14434,7 @@ Entry.Stage.prototype.showInputField = function(a) { c.cursor = "pointer"; c.image = b; a.addChild(c); - a.on("mousedown", function(a) { + a.on("mousedown", function(b) { Entry.dispatchEvent("canvasInputComplete"); }); this.inputSubmitButton || (this.inputField.value(""), this.canvas.addChild(a), this.inputSubmitButton = a); @@ -16121,8 +14564,8 @@ Entry.Toast.prototype.warning = function(a, b, c) { this.body_.appendChild(d); c || window.setTimeout(function() { d.style.opacity = 1; - var a = setInterval(function() { - .05 > d.style.opacity && (clearInterval(a), d.style.display = "none", Entry.removeElement(d)); + var b = setInterval(function() { + .05 > d.style.opacity && (clearInterval(b), d.style.display = "none", Entry.removeElement(d)); d.style.opacity *= .9; }, 20); }, 1E3); @@ -16146,8 +14589,8 @@ Entry.Toast.prototype.success = function(a, b, c) { this.body_.appendChild(d); c || window.setTimeout(function() { d.style.opacity = 1; - var a = setInterval(function() { - .05 > d.style.opacity && (clearInterval(a), d.style.display = "none", Entry.removeElement(d)); + var b = setInterval(function() { + .05 > d.style.opacity && (clearInterval(b), d.style.display = "none", Entry.removeElement(d)); d.style.opacity *= .9; }, 20); }, 1E3); @@ -16171,8 +14614,8 @@ Entry.Toast.prototype.alert = function(a, b, c) { this.body_.appendChild(d); c || window.setTimeout(function() { d.style.opacity = 1; - var a = setInterval(function() { - .05 > d.style.opacity && (clearInterval(a), d.style.display = "none", Entry.toast.body_.removeChild(d)); + var b = setInterval(function() { + .05 > d.style.opacity && (clearInterval(b), d.style.display = "none", Entry.toast.body_.removeChild(d)); d.style.opacity *= .9; }, 20); }, 5E3); @@ -16209,44 +14652,50 @@ p.resize = function() { }; Entry.ContextMenu = {}; (function(a) { + a.visible = !1; a.createDom = function() { this.dom = Entry.Dom("ul", {id:"entry-contextmenu", parent:$("body")}); + this.dom.bind("mousedown touchstart", function(b) { + b.stopPropagation(); + }); Entry.Utils.disableContextmenu(this.dom); Entry.documentMousedown.attach(this, function() { this.hide(); }); }; - a.show = function(a, c) { + a.show = function(b, a, d) { this.dom || this.createDom(); - if (0 !== a.length) { - var d = this; - void 0 !== c && (this._className = c, this.dom.addClass(c)); - c = this.dom; - c.empty(); - for (var e = 0, f = a.length;e < f;e++) { - var g = a[e], h = g.text, k = !1 !== g.enable, l = Entry.Dom("li", {class:k ? "menuAble" : "menuDisable", parent:c}); - l.text(h); - k && g.callback && function(a, b) { - a.mousedown(function(a) { - a.preventDefault(); - d.hide(); - b(a); + if (0 !== b.length) { + var e = this; + void 0 !== a && (this._className = a, this.dom.addClass(a)); + a = this.dom; + a.empty(); + for (var f = 0, g = b.length;f < g;f++) { + var h = b[f], k = h.text, l = !1 !== h.enable, n = Entry.Dom("li", {class:l ? "menuAble" : "menuDisable", parent:a}), n = Entry.Dom("span", {parent:n}); + n.text(k); + l && h.callback && function(b, a) { + b.mousedown(function(b) { + b.preventDefault(); + e.hide(); + a(b); }); - }(l, g.callback); + }(n, h.callback); } - c.removeClass("entryRemove"); - this.position(Entry.mouseCoordinate); + a.removeClass("entryRemove"); + this.visible = !0; + this.position(d || Entry.mouseCoordinate); } }; - a.position = function(a) { - var c = this.dom; - c.css({left:0, top:0}); - var d = c.width(), e = c.height(), f = $(window), g = f.width(), f = f.height(); - a.x + d > g && (a.x -= d + 3); - a.y + e > f && (a.y -= e); - c.css({left:a.x, top:a.y}); + a.position = function(b) { + var a = this.dom; + a.css({left:0, top:0}); + var d = a.width(), e = a.height(), f = $(window), g = f.width(), f = f.height(); + b.x + d > g && (b.x -= d + 3); + b.y + e > f && (b.y -= e); + a.css({left:b.x, top:b.y}); }; a.hide = function() { + this.visible = !1; this.dom.empty(); this.dom.addClass("entryRemove"); this._className && (this.dom.removeClass(this._className), delete this._className); @@ -16282,10 +14731,10 @@ Entry.Variable.prototype.generateView = function(a) { var b = this.type; if ("variable" == b || "timer" == b || "answer" == b) { this.view_ = new createjs.Container, this.rect_ = new createjs.Shape, this.view_.addChild(this.rect_), this.view_.variable = this, this.wrapper_ = new createjs.Shape, this.view_.addChild(this.wrapper_), this.textView_ = new createjs.Text("asdf", this.FONT, "#000000"), this.textView_.textBaseline = "alphabetic", this.textView_.x = 4, this.textView_.y = 1, this.view_.addChild(this.textView_), this.valueView_ = new createjs.Text("asdf", "10pt NanumGothic", "#ffffff"), this.valueView_.textBaseline = - "alphabetic", b = Entry.variableContainer.variables_.length, this.getX() && this.getY() ? (this.setX(this.getX()), this.setY(this.getY())) : (this.setX(-230 + 80 * Math.floor(b / 11)), this.setY(24 * a + 20 - 135 - 264 * Math.floor(b / 11))), this.view_.visible = this.visible_, this.view_.addChild(this.valueView_), this.view_.on("mousedown", function(a) { - "workspace" == Entry.type && (this.offset = {x:this.x - (.75 * a.stageX - 240), y:this.y - (.75 * a.stageY - 135)}, this.cursor = "move"); - }), this.view_.on("pressmove", function(a) { - "workspace" == Entry.type && (this.variable.setX(.75 * a.stageX - 240 + this.offset.x), this.variable.setY(.75 * a.stageY - 135 + this.offset.y), this.variable.updateView()); + "alphabetic", b = Entry.variableContainer.variables_.length, this.getX() && this.getY() ? (this.setX(this.getX()), this.setY(this.getY())) : (this.setX(-230 + 80 * Math.floor(b / 11)), this.setY(24 * a + 20 - 135 - 264 * Math.floor(b / 11))), this.view_.visible = this.visible_, this.view_.addChild(this.valueView_), this.view_.on("mousedown", function(b) { + "workspace" == Entry.type && (this.offset = {x:this.x - (.75 * b.stageX - 240), y:this.y - (.75 * b.stageY - 135)}, this.cursor = "move"); + }), this.view_.on("pressmove", function(b) { + "workspace" == Entry.type && (this.variable.setX(.75 * b.stageX - 240 + this.offset.x), this.variable.setY(.75 * b.stageY - 135 + this.offset.y), this.variable.updateView()); }); } else { if ("slide" == b) { @@ -16303,11 +14752,11 @@ Entry.Variable.prototype.generateView = function(a) { this.view_.addChild(this.textView_); this.valueView_ = new createjs.Text("value", "10pt NanumGothic", "#ffffff"); this.valueView_.textBaseline = "alphabetic"; - this.view_.on("mousedown", function(a) { - "workspace" == Entry.type && (this.offset = {x:this.x - (.75 * a.stageX - 240), y:this.y - (.75 * a.stageY - 135)}); + this.view_.on("mousedown", function(b) { + "workspace" == Entry.type && (this.offset = {x:this.x - (.75 * b.stageX - 240), y:this.y - (.75 * b.stageY - 135)}); }); - this.view_.on("pressmove", function(a) { - "workspace" != Entry.type || c.isAdjusting || (this.variable.setX(.75 * a.stageX - 240 + this.offset.x), this.variable.setY(.75 * a.stageY - 135 + this.offset.y), this.variable.updateView()); + this.view_.on("pressmove", function(b) { + "workspace" != Entry.type || c.isAdjusting || (this.variable.setX(.75 * b.stageX - 240 + this.offset.x), this.variable.setY(.75 * b.stageY - 135 + this.offset.y), this.variable.updateView()); }); this.view_.visible = this.visible_; this.view_.addChild(this.valueView_); @@ -16321,17 +14770,17 @@ Entry.Variable.prototype.generateView = function(a) { this.valueSetter_ = new createjs.Shape; this.valueSetter_.graphics.beginFill("#1bafea").s("#A0A1A1").ss(1).dc(b, 10.5, 3); this.valueSetter_.cursor = "pointer"; - this.valueSetter_.on("mousedown", function(a) { - Entry.engine.isState("run") && (c.isAdjusting = !0, this.offsetX = -(this.x - .75 * a.stageX + 240)); + this.valueSetter_.on("mousedown", function(b) { + Entry.engine.isState("run") && (c.isAdjusting = !0, this.offsetX = -(this.x - .75 * b.stageX + 240)); }); - this.valueSetter_.on("pressmove", function(a) { + this.valueSetter_.on("pressmove", function(b) { if (Entry.engine.isState("run")) { - var b = this.offsetX; - this.offsetX = -(this.x - .75 * a.stageX + 240); - b !== this.offsetX && (a = c.getX(), c.setSlideCommandX(a + 10 > this.offsetX ? 0 : a + c.maxWidth + 10 > this.offsetX ? this.offsetX - a : c.maxWidth + 10)); + var a = this.offsetX; + this.offsetX = -(this.x - .75 * b.stageX + 240); + a !== this.offsetX && (b = c.getX(), c.setSlideCommandX(b + 10 > this.offsetX ? 0 : b + c.maxWidth + 10 > this.offsetX ? this.offsetX - b : c.maxWidth + 10)); } }); - this.valueSetter_.on("pressup", function(a) { + this.valueSetter_.on("pressup", function(b) { c.isAdjusting = !1; }); this.view_.addChild(this.valueSetter_); @@ -16339,36 +14788,36 @@ Entry.Variable.prototype.generateView = function(a) { this.getX() && this.getY() ? (this.setX(this.getX()), this.setY(this.getY())) : (this.setX(-230 + 80 * Math.floor(b / 11)), this.setY(24 * a + 20 - 135 - 264 * Math.floor(b / 11))); } else { this.view_ = new createjs.Container, this.rect_ = new createjs.Shape, this.view_.addChild(this.rect_), this.view_.variable = this, this.titleView_ = new createjs.Text("asdf", this.FONT, "#000"), this.titleView_.textBaseline = "alphabetic", this.titleView_.textAlign = "center", this.titleView_.width = this.width_ - 2 * this.BORDER, this.titleView_.y = this.BORDER + 10, this.titleView_.x = this.width_ / 2, this.view_.addChild(this.titleView_), this.resizeHandle_ = new createjs.Shape, this.resizeHandle_.graphics.f("#1bafea").ss(1, - 0, 0).s("#1bafea").lt(0, -9).lt(-9, 0).lt(0, 0), this.view_.addChild(this.resizeHandle_), this.resizeHandle_.list = this, this.resizeHandle_.on("mouseover", function(a) { + 0, 0).s("#1bafea").lt(0, -9).lt(-9, 0).lt(0, 0), this.view_.addChild(this.resizeHandle_), this.resizeHandle_.list = this, this.resizeHandle_.on("mouseover", function(b) { this.cursor = "nwse-resize"; - }), this.resizeHandle_.on("mousedown", function(a) { + }), this.resizeHandle_.on("mousedown", function(b) { this.list.isResizing = !0; - this.offset = {x:.75 * a.stageX - this.list.getWidth(), y:.75 * a.stageY - this.list.getHeight()}; + this.offset = {x:.75 * b.stageX - this.list.getWidth(), y:.75 * b.stageY - this.list.getHeight()}; this.parent.cursor = "nwse-resize"; - }), this.resizeHandle_.on("pressmove", function(a) { - this.list.setWidth(.75 * a.stageX - this.offset.x); - this.list.setHeight(.75 * a.stageY - this.offset.y); + }), this.resizeHandle_.on("pressmove", function(b) { + this.list.setWidth(.75 * b.stageX - this.offset.x); + this.list.setHeight(.75 * b.stageY - this.offset.y); this.list.updateView(); - }), this.view_.on("mouseover", function(a) { + }), this.view_.on("mouseover", function(b) { this.cursor = "move"; - }), this.view_.on("mousedown", function(a) { - "workspace" != Entry.type || this.variable.isResizing || (this.offset = {x:this.x - (.75 * a.stageX - 240), y:this.y - (.75 * a.stageY - 135)}, this.cursor = "move"); - }), this.view_.on("pressup", function(a) { + }), this.view_.on("mousedown", function(b) { + "workspace" != Entry.type || this.variable.isResizing || (this.offset = {x:this.x - (.75 * b.stageX - 240), y:this.y - (.75 * b.stageY - 135)}, this.cursor = "move"); + }), this.view_.on("pressup", function(b) { this.cursor = "initial"; this.variable.isResizing = !1; - }), this.view_.on("pressmove", function(a) { - "workspace" != Entry.type || this.variable.isResizing || (this.variable.setX(.75 * a.stageX - 240 + this.offset.x), this.variable.setY(.75 * a.stageY - 135 + this.offset.y), this.variable.updateView()); + }), this.view_.on("pressmove", function(b) { + "workspace" != Entry.type || this.variable.isResizing || (this.variable.setX(.75 * b.stageX - 240 + this.offset.x), this.variable.setY(.75 * b.stageY - 135 + this.offset.y), this.variable.updateView()); }), this.elementView = new createjs.Container, b = new createjs.Text("asdf", this.FONT, "#000"), b.textBaseline = "middle", b.y = 5, this.elementView.addChild(b), this.elementView.indexView = b, b = new createjs.Shape, this.elementView.addChild(b), this.elementView.valueWrapper = b, b = new createjs.Text("fdsa", this.FONT, "#eee"), b.x = 24, b.y = 6, b.textBaseline = "middle", this.elementView.addChild(b), this.elementView.valueView = b, this.elementView.x = this.BORDER, this.scrollButton_ = - new createjs.Shape, this.scrollButton_.graphics.f("#aaa").rr(0, 0, 7, 30, 3.5), this.view_.addChild(this.scrollButton_), this.scrollButton_.y = 23, this.scrollButton_.list = this, this.scrollButton_.on("mousedown", function(a) { + new createjs.Shape, this.scrollButton_.graphics.f("#aaa").rr(0, 0, 7, 30, 3.5), this.view_.addChild(this.scrollButton_), this.scrollButton_.y = 23, this.scrollButton_.list = this, this.scrollButton_.on("mousedown", function(b) { this.list.isResizing = !0; this.cursor = "pointer"; - this.offsetY = isNaN(this.offsetY) || 0 > this.offsetY ? a.rawY / 2 : this.offsetY; - }), this.scrollButton_.on("pressmove", function(a) { - void 0 === this.moveAmount ? (this.y = a.target.y, this.moveAmount = !0) : this.y = a.rawY / 2 - this.offsetY + this.list.height_ / 100 * 23; + this.offsetY = isNaN(this.offsetY) || 0 > this.offsetY ? b.rawY / 2 : this.offsetY; + }), this.scrollButton_.on("pressmove", function(b) { + void 0 === this.moveAmount ? (this.y = b.target.y, this.moveAmount = !0) : this.y = b.rawY / 2 - this.offsetY + this.list.height_ / 100 * 23; 23 > this.y && (this.y = 23); this.y > this.list.getHeight() - 40 && (this.y = this.list.getHeight() - 40); this.list.updateView(); - }), this.scrollButton_.on("pressup", function(a) { + }), this.scrollButton_.on("pressup", function(b) { this.moveAmount = void 0; }), this.getX() && this.getY() ? (this.setX(this.getX()), this.setY(this.getY())) : (b = Entry.variableContainer.lists_.length, this.setX(110 * -Math.floor(b / 6) + 120), this.setY(24 * a + 20 - 135 - 145 * Math.floor(b / 6))); } @@ -17080,14 +15529,14 @@ Entry.VariableContainer.prototype.createVariableView = function(a) { h.addClass("entryVariableListElementNameWorkspace"); h.setAttribute("disabled", "disabled"); h.value = a.name_; - h.bindOnClick(function(a) { - a.stopPropagation(); + h.bindOnClick(function(b) { + b.stopPropagation(); }); h.onblur = function(c) { (c = this.value.trim()) && 0 !== c.length ? b.changeVariableName(a, this.value) : (Entry.toast.alert(Lang.Msgs.warn, Lang.Workspace.variable_can_not_space), this.value = a.getName()); }; - h.onkeydown = function(a) { - 13 == a.keyCode && this.blur(); + h.onkeydown = function(b) { + 13 == b.keyCode && this.blur(); }; c.nameField = h; d.appendChild(h); @@ -17133,8 +15582,8 @@ Entry.VariableContainer.prototype.createMessageView = function(a) { }); var e = Entry.createElement("button"); e.addClass("entryVariableListElementEditWorkspace"); - e.bindOnClick(function(a) { - a.stopPropagation(); + e.bindOnClick(function(b) { + b.stopPropagation(); g.removeAttribute("disabled"); g.focus(); f.removeClass("entryRemove"); @@ -17143,8 +15592,8 @@ Entry.VariableContainer.prototype.createMessageView = function(a) { var f = Entry.createElement("button"); f.addClass("entryVariableListElementEditWorkspace"); f.addClass("entryRemove"); - f.bindOnClick(function(a) { - a.stopPropagation(); + f.bindOnClick(function(b) { + b.stopPropagation(); g.blur(); e.removeClass("entryRemove"); this.addClass("entryRemove"); @@ -17152,14 +15601,14 @@ Entry.VariableContainer.prototype.createMessageView = function(a) { var g = Entry.createElement("input"); g.addClass("entryVariableListElementNameWorkspace"); g.value = a.name; - g.bindOnClick(function(a) { - a.stopPropagation(); + g.bindOnClick(function(b) { + b.stopPropagation(); }); g.onblur = function(c) { (c = this.value.trim()) && 0 !== c.length ? (b.changeMessageName(a, this.value), e.removeClass("entryRemove"), f.addClass("entryRemove"), g.setAttribute("disabled", "disabled")) : (Entry.toast.alert(Lang.Msgs.warn, Lang.Msgs.sign_can_not_space), this.value = a.name); }; - g.onkeydown = function(a) { - 13 == a.keyCode && this.blur(); + g.onkeydown = function(b) { + 13 == b.keyCode && this.blur(); }; c.nameField = g; c.appendChild(g); @@ -17234,14 +15683,14 @@ Entry.VariableContainer.prototype.createListView = function(a) { h.setAttribute("disabled", "disabled"); h.addClass("entryVariableListElementNameWorkspace"); h.value = a.name_; - h.bindOnClick(function(a) { - a.stopPropagation(); + h.bindOnClick(function(b) { + b.stopPropagation(); }); h.onblur = function(c) { (c = this.value.trim()) && 0 !== c.length ? b.changeListName(a, this.value) : (Entry.toast.alert(Lang.Msgs.warn, Lang.Msgs.list_can_not_space), this.value = a.getName()); }; - h.onkeydown = function(a) { - 13 == a.keyCode && this.blur(); + h.onkeydown = function(b) { + 13 == b.keyCode && this.blur(); }; c.nameField = h; d.appendChild(h); @@ -17508,8 +15957,8 @@ Entry.VariableContainer.prototype.addCloneLocalVariables = function(a) { this.mapVariable(function(a, c) { a.object_ && a.object_ == c.objectId && (a = a.toJSON(), a.originId = a.id, a.id = Entry.generateHash(), a.object = c.newObjectId, delete a.x, delete a.y, b.push(a), c.json.script = c.json.script.replace(new RegExp(a.originId, "g"), a.id)); }, a); - b.map(function(a) { - c.addVariable(a); + b.map(function(b) { + c.addVariable(b); }); }; Entry.VariableContainer.prototype.generateTimer = function(a) { @@ -17528,8 +15977,8 @@ Entry.VariableContainer.prototype.generateAnswer = function(a) { }; Entry.VariableContainer.prototype.generateVariableSettingView = function() { var a = this, b = Entry.createElement("div"); - b.bindOnClick(function(a) { - a.stopPropagation(); + b.bindOnClick(function(b) { + b.stopPropagation(); }); this.variableSettingView = b; b.addClass("entryVariableSettingWorkspace"); @@ -17633,8 +16082,8 @@ Entry.VariableContainer.prototype.updateVariableSettingView = function(a) { }; Entry.VariableContainer.prototype.generateListSettingView = function() { var a = this, b = Entry.createElement("div"); - b.bindOnClick(function(a) { - a.stopPropagation(); + b.bindOnClick(function(b) { + b.stopPropagation(); }); this.listSettingView = b; b.addClass("entryListSettingWorkspace"); @@ -17678,8 +16127,8 @@ Entry.VariableContainer.prototype.generateListSettingView = function() { d.onblur = function() { a.setListLength(this.value); }; - d.onkeypress = function(a) { - 13 == a.keyCode && this.blur(); + d.onkeypress = function(b) { + 13 == b.keyCode && this.blur(); }; b.lengthInput = d; c.appendChild(d); @@ -17725,8 +16174,8 @@ Entry.VariableContainer.prototype.updateListSettingView = function(a) { h[c].data = this.value; a.updateView(); }; - f.onkeypress = function(a) { - 13 == a.keyCode && this.blur(); + f.onkeypress = function(b) { + 13 == b.keyCode && this.blur(); }; f.addClass("entryListSettingEachInputWorkspace"); e.appendChild(f); @@ -17760,11 +16209,11 @@ Entry.VariableContainer.prototype.setListLength = function(a) { }; Entry.VariableContainer.prototype.updateViews = function() { var a = this.lists_; - this.variables_.map(function(a) { - a.updateView(); + this.variables_.map(function(b) { + b.updateView(); }); - a.map(function(a) { - a.updateView(); + a.map(function(b) { + b.updateView(); }); }; Entry.VariableContainer.prototype.updateSelectedVariable = function(a, b) { @@ -17775,21 +16224,21 @@ Entry.VariableContainer.prototype.removeLocalVariables = function(a) { this.mapVariable(function(a, c) { a.object_ && a.object_ == c && b.push(a); }, a); - b.map(function(a) { - c.removeVariable(a); + b.map(function(b) { + c.removeVariable(b); }); }; Entry.VariableContainer.prototype.updateCloudVariables = function() { var a = Entry.projectId; if (Entry.cloudSavable && a) { - var b = Entry.variableContainer, a = b.variables_.filter(function(a) { - return a.isCloud_; - }), a = a.map(function(a) { - return a.toJSON(); - }), b = b.lists_.filter(function(a) { - return a.isCloud_; - }), b = b.map(function(a) { - return a.toJSON(); + var b = Entry.variableContainer, a = b.variables_.filter(function(b) { + return b.isCloud_; + }), a = a.map(function(b) { + return b.toJSON(); + }), b = b.lists_.filter(function(b) { + return b.isCloud_; + }), b = b.map(function(b) { + return b.toJSON(); }); $.ajax({url:"/api/project/variable/" + Entry.projectId, type:"PUT", data:{variables:a, lists:b}}).done(function() { }); @@ -18358,159 +16807,93 @@ Entry.Thread = function(a, b, c) { this.load(a); }; (function(a) { - a.load = function(a, c) { - void 0 === a && (a = []); - if (!(a instanceof Array)) { + a.load = function(b, a) { + void 0 === b && (b = []); + if (!(b instanceof Array)) { return console.error("thread must be array"); } - for (var d = 0;d < a.length;d++) { - var e = a[d]; + for (var d = 0;d < b.length;d++) { + var e = b[d]; e instanceof Entry.Block || e.isDummy ? (e.setThread(this), this._data.push(e)) : this._data.push(new Entry.Block(e, this)); } - (a = this._code.view) && this.createView(a.board, c); + (b = this._code.view) && this.createView(b.board, a); }; - a.registerEvent = function(a, c) { - this._event = c; - this._code.registerEvent(a, c); + a.registerEvent = function(b, a) { + this._event = a; + this._code.registerEvent(b, a); }; - a.unregisterEvent = function(a, c) { - this._code.unregisterEvent(a, c); + a.unregisterEvent = function(b, a) { + this._code.unregisterEvent(b, a); }; - a.createView = function(a, c) { - this.view || (this.view = new Entry.ThreadView(this, a)); + a.createView = function(b, a) { + this.view || (this.view = new Entry.ThreadView(this, b)); this._data.map(function(d) { - d.createView(a, c); + d.createView(b, a); }); }; - a.separate = function(a, c) { - this._data.has(a.id) && (a = this._data.splice(this._data.indexOf(a), c), this._code.createThread(a), this.changeEvent.notify()); + a.separate = function(b, a) { + this._data.has(b.id) && (b = this._data.splice(this._data.indexOf(b), a), this._code.createThread(b), this.changeEvent.notify()); }; - a.cut = function(a) { - a = this._data.indexOf(a); - a = this._data.splice(a); + a.cut = function(b) { + b = this._data.indexOf(b); + b = this._data.splice(b); this.changeEvent.notify(); - return a; + return b; }; - a.insertByBlock = function(a, c) { - a = a ? this._data.indexOf(a) : -1; - for (var d = 0;d < c.length;d++) { - c[d].setThread(this); + a.insertByBlock = function(b, a) { + b = b ? this._data.indexOf(b) : -1; + for (var d = 0;d < a.length;d++) { + a[d].setThread(this); } - this._data.splice.apply(this._data, [a + 1, 0].concat(c)); + this._data.splice.apply(this._data, [b + 1, 0].concat(a)); this.changeEvent.notify(); }; -<<<<<<< HEAD - a.insertToTop = function(a) { - a.setThread(this); - this._data.unshift.apply(this._data, [a]); + a.insertToTop = function(b) { + b.setThread(this); + this._data.unshift.apply(this._data, [b]); this.changeEvent.notify(); -======= - b._addControl = function(a) { - var b = this; - a.on("wheel", function() { - b._mouseWheel.apply(b, arguments); - }); - b._scroller && $(this.svg).bind("mousedown touchstart", function(a) { - b.onMouseDown.apply(b, arguments); - }); - }; - b.onMouseDown = function(a) { - function b(a) { - a.stopPropagation && a.stopPropagation(); - a.preventDefault && a.preventDefault(); - a = Entry.Utils.convertMouseEvent(a); - var c = e.dragInstance; - e._scroller.scroll(-a.pageY + c.offsetY); - c.set({offsetY:a.pageY}); - } - function d(a) { - $(document).unbind(".blockMenu"); - delete e.dragInstance; - } - a.stopPropagation && a.stopPropagation(); - a.preventDefault && a.preventDefault(); - var e = this; - if (0 === a.button || a.originalEvent && a.originalEvent.touches) { - a = Entry.Utils.convertMouseEvent(a); - Entry.documentMousedown && Entry.documentMousedown.notify(a); - var f = $(document); - f.bind("mousemove.blockMenu", b); - f.bind("mouseup.blockMenu", d); - f.bind("touchmove.blockMenu", b); - f.bind("touchend.blockMenu", d); - this.dragInstance = new Entry.DragInstance({startY:a.pageY, offsetY:a.pageY}); - } - }; - b._mouseWheel = function(a) { - a = a.originalEvent; - a.preventDefault(); - var b = Entry.disposeEvent; - b && b.notify(a); - this._scroller.scroll(-a.wheelDeltaY || a.deltaY / 3); - }; - b.dominate = function(a) { - this.svgBlockGroup.appendChild(a.view.svgGroup); }; - b.reDraw = function() { - this.selectMenu(this.lastSelector, !0); - }; - b._handleDragBlock = function() { - this._boardBlockView = null; - this._scroller && this._scroller.setOpacity(0); - }; - b._captureKeyEvent = function(a) { - var b = a.keyCode, d = Entry.type; - a.ctrlKey && "workspace" == d && 48 < b && 58 > b && (a.preventDefault(), this.selectMenu(b - 49)); - }; - b.setPatternRectFill = function(a) { - this.patternRect.attr({fill:a}); - this.pattern.attr({style:""}); - }; - b.disablePattern = function() { - this.pattern.attr({style:"display: none"}); ->>>>>>> entrylabs/master - }; - a.clone = function(a, c) { - a = a || this._code; - a = new Entry.Thread([], a); + a.clone = function(b, a) { + b = b || this._code; + b = new Entry.Thread([], b); for (var d = this._data, e = [], f = 0, g = d.length;f < g;f++) { - e.push(d[f].clone(a)); + e.push(d[f].clone(b)); } - a.load(e, c); - return a; + b.load(e, a); + return b; }; - a.toJSON = function(a, c) { + a.toJSON = function(b, a) { var d = []; - for (c = void 0 === c ? 0 : c;c < this._data.length;c++) { - this._data[c] instanceof Entry.Block && d.push(this._data[c].toJSON(a)); + for (a = void 0 === a ? 0 : a;a < this._data.length;a++) { + this._data[a] instanceof Entry.Block && d.push(this._data[a].toJSON(b)); } return d; }; - a.destroy = function(a) { + a.destroy = function(b) { this._code.destroyThread(this, !1); - this.view && this.view.destroy(a); - for (var c = this._data, d = c.length - 1;0 <= d;d--) { - c[d].destroy(a); + this.view && this.view.destroy(b); + for (var a = this._data, d = a.length - 1;0 <= d;d--) { + a[d].destroy(b); } }; - a.getBlock = function(a) { - return this._data[a]; + a.getBlock = function(b) { + return this._data[b]; }; a.getBlocks = function() { - return this._data.map(function(a) { - return a; + return this._data.map(function(b) { + return b; }); }; a.countBlock = function() { - for (var a = 0, c = 0;c < this._data.length;c++) { - var d = this._data[c]; - if (d.type && (a++, d = d.statements)) { + for (var b = 0, a = 0;a < this._data.length;a++) { + var d = this._data[a]; + if (d.type && (b++, d = d.statements)) { for (var e = 0;e < d.length;e++) { - a += d[e].countBlock(); + b += d[e].countBlock(); } } } - return a; + return b; }; a.handleChange = function() { 0 === this._data.length && this.destroy(); @@ -18518,25 +16901,25 @@ Entry.Thread = function(a, b, c) { a.getCode = function() { return this._code; }; - a.setCode = function(a) { - this._code = a; + a.setCode = function(b) { + this._code = b; }; - a.spliceBlock = function(a) { - var c = this._data; - c.remove(a); - 0 === c.length && this.view.getParent().constructor !== Entry.FieldStatement && this.destroy(); + a.spliceBlock = function(b) { + var a = this._data; + a.remove(b); + 0 === a.length && this.view.getParent().constructor !== Entry.FieldStatement && this.destroy(); this.changeEvent.notify(); }; a.getFirstBlock = function() { return this._data[0]; }; - a.getPrevBlock = function(a) { - a = this._data.indexOf(a); - return this._data.at(a - 1); + a.getPrevBlock = function(b) { + b = this._data.indexOf(b); + return this._data.at(b - 1); }; - a.getNextBlock = function(a) { - a = this._data.indexOf(a); - return this._data.at(a + 1); + a.getNextBlock = function(b) { + b = this._data.indexOf(b); + return this._data.at(b + 1); }; a.getLastBlock = function() { return this._data.at(this._data.length - 1); @@ -18544,20 +16927,20 @@ Entry.Thread = function(a, b, c) { a.getRootBlock = function() { return this._data.at(0); }; - a.hasBlockType = function(a) { - function c(d) { - if (a == d.type) { + a.hasBlockType = function(b) { + function a(d) { + if (b == d.type) { return !0; } for (var f = d.params, g = 0;g < f.length;g++) { var h = f[g]; - if (h && h.constructor == Entry.Block && c(h)) { + if (h && h.constructor == Entry.Block && a(h)) { return !0; } } if (d = d.statements) { for (f = 0;f < d.length;f++) { - if (d[f].hasBlockType(a)) { + if (d[f].hasBlockType(b)) { return !0; } } @@ -18565,31 +16948,31 @@ Entry.Thread = function(a, b, c) { return !1; } for (var d = 0;d < this._data.length;d++) { - if (c(this._data[d])) { + if (a(this._data[d])) { return !0; } } return !1; }; - a.getCount = function(a) { - var c = this._data.length; - a && (c -= this._data.indexOf(a)); - return c; + a.getCount = function(b) { + var a = this._data.length; + b && (a -= this._data.indexOf(b)); + return a; }; - a.indexOf = function(a) { - return this._data.indexOf(a); + a.indexOf = function(b) { + return this._data.indexOf(b); }; - a.pointer = function(a, c) { - c = this.indexOf(c); - a.unshift(c); - this.parent instanceof Entry.Block && a.unshift(this.parent.indexOfStatements(this)); - return this._code === this.parent ? (a.unshift(this._code.indexOf(this)), c = this._data[0], a.unshift(c.y), a.unshift(c.x), a) : this.parent.pointer(a); + a.pointer = function(b, a) { + a = this.indexOf(a); + b.unshift(a); + this.parent instanceof Entry.Block && b.unshift(this.parent.indexOfStatements(this)); + return this._code === this.parent ? (b.unshift(this._code.indexOf(this)), a = this._data[0], b.unshift(a.y), b.unshift(a.x), b) : this.parent.pointer(b); }; - a.getBlockList = function(a) { - for (var c = [], d = 0;d < this._data.length;d++) { - c = c.concat(this._data[d].getBlockList(a)); + a.getBlockList = function(b) { + for (var a = [], d = 0;d < this._data.length;d++) { + a = a.concat(this._data[d].getBlockList(b)); } - return c; + return a; }; a.stringify = function() { return JSON.stringify(this.toJSON()); @@ -18784,8 +17167,8 @@ Entry.Block = function(a, b) { this.load(a); a = this.getCode(); a.registerBlock(this); - (b = this.events.dataAdd) && a.object && b.forEach(function(a) { - Entry.Utils.isFunction(a) && a(c); + (b = this.events.dataAdd) && a.object && b.forEach(function(b) { + Entry.Utils.isFunction(b) && b(c); }); }; Entry.Block.MAGNET_RANGE = 10; @@ -18795,12 +17178,12 @@ Entry.Block.DELETABLE_FALSE = 2; Entry.Block.DELETABLE_FALSE_LIGHTEN = 3; (function(a) { a.schema = {id:null, x:0, y:0, type:null, params:[], statements:[], view:null, thread:null, movable:null, deletable:Entry.Block.DELETABLE_TRUE, readOnly:null, copyable:!0, events:{}}; - a.load = function(a) { - a.id || (a.id = Entry.Utils.generateId()); - this.set(a); + a.load = function(b) { + b.id || (b.id = Entry.Utils.generateId()); + this.set(b); this.loadSchema(); }; - a.changeSchema = function(a) { + a.changeSchema = function(b) { this.set({params:[]}); this.loadSchema(); }; @@ -18811,180 +17194,89 @@ Entry.Block.DELETABLE_FALSE_LIGHTEN = 3; a.loadSchema = function() { if (this._schema = Entry.block[this.type]) { !this._schemaChangeEvent && this._schema.changeEvent && (this._schemaChangeEvent = this._schema.changeEvent.attach(this, this.changeSchema)); - var a = this._schema.events; - if (a) { - for (var c in a) { - this.events[c] || (this.events[c] = []); - for (var d = a[c], e = 0;e < d.length;e++) { + var b = this._schema.events; + if (b) { + for (var a in b) { + this.events[a] || (this.events[a] = []); + for (var d = b[a], e = 0;e < d.length;e++) { var f = d[e]; - f && 0 > this.events[c].indexOf(f) && this.events[c].push(f); + f && 0 > this.events[a].indexOf(f) && this.events[a].push(f); } } } this._schema.event && this.thread.registerEvent(this, this._schema.event); - a = this.params; - c = this._schema.params; - for (e = 0;c && e < c.length;e++) { - d = void 0 === a[e] || null === a[e] ? c[e].value : a[e], f = a[e] || e < a.length, !d || "Output" !== c[e].type && "Block" !== c[e].type || (d = new Entry.Block(d, this.thread)), f ? a.splice(e, 1, d) : a.push(d); + b = this.params; + a = this._schema.params; + for (e = 0;a && e < a.length;e++) { + d = void 0 === b[e] || null === b[e] ? a[e].value : b[e], f = b[e] || e < b.length, !d || "Output" !== a[e].type && "Block" !== a[e].type || (d = new Entry.Block(d, this.thread)), f ? b.splice(e, 1, d) : b.push(d); } - if (a = this._schema.statements) { - for (e = 0;e < a.length;e++) { + if (b = this._schema.statements) { + for (e = 0;e < b.length;e++) { this.statements.splice(e, 1, new Entry.Thread(this.statements[e], this.getCode(), this)); } } } }; - a.changeType = function(a) { + a.changeType = function(b) { this._schemaChangeEvent && this._schemaChangeEvent.destroy(); - this.set({type:a}); + this.set({type:b}); this.loadSchema(); - this.view && this.view.changeType(a); + this.view && this.view.changeType(b); }; - a.setThread = function(a) { - this.set({thread:a}); + a.setThread = function(b) { + this.set({thread:b}); }; a.getThread = function() { return this.thread; }; - a.insertAfter = function(a) { - this.thread.insertByBlock(this, a); + a.insertAfter = function(b) { + this.thread.insertByBlock(this, b); }; a._updatePos = function() { this.view && this.set({x:this.view.x, y:this.view.y}); }; - a.moveTo = function(a, c) { - this.view && this.view._moveTo(a, c); + a.moveTo = function(b, a) { + this.view && this.view._moveTo(b, a); this._updatePos(); this.getCode().changeEvent.notify(); }; - a.createView = function(a, c) { - this.view || (this.set({view:new Entry.BlockView(this, a, c)}), this._updatePos()); + a.createView = function(b, a) { + this.view || (this.set({view:new Entry.BlockView(this, b, a)}), this._updatePos()); }; - a.clone = function(a) { - return new Entry.Block(this.toJSON(!0), a); + a.clone = function(b) { + return new Entry.Block(this.toJSON(!0), b); }; - a.toJSON = function(a) { - var c = this._toJSON(); - delete c.view; - delete c.thread; - delete c.events; - a && delete c.id; - c.params = c.params.map(function(c) { - c instanceof Entry.Block && (c = c.toJSON(a)); - return c; + a.toJSON = function(b) { + var a = this._toJSON(); + delete a.view; + delete a.thread; + delete a.events; + b && delete a.id; + a.params = a.params.map(function(a) { + a instanceof Entry.Block && (a = a.toJSON(b)); + return a; }); - c.statements = c.statements.map(function(c) { - return c.toJSON(a); + a.statements = a.statements.map(function(a) { + return a.toJSON(b); }); - c.x = this.x; - c.y = this.y; - c.movable = this.movable; - c.deletable = this.deletable; - c.readOnly = this.readOnly; - return c; + a.x = this.x; + a.y = this.y; + a.movable = this.movable; + a.deletable = this.deletable; + a.readOnly = this.readOnly; + return a; }; -<<<<<<< HEAD - a.destroy = function(a, c) { + a.destroy = function(b, a) { var d = this, e = this.params; if (e) { for (var f = 0;f < e.length;f++) { var g = e[f]; - g instanceof Entry.Block && (g.doNotSplice = !0, g.destroy(a)); -======= - b.removeControl = function() { - this._mouseEnable = !1; - $(this.svgGroup).unbind(".blockViewMousedown"); - }; - b.onMouseDown = function(a) { - function c(a) { - a.stopPropagation(); - var c = g.workspace.getMode(), d; - c === Entry.Workspace.MODE_VIMBOARD && b.vimBoardEvent(a, "dragOver"); - d = a.originalEvent && a.originalEvent.touches ? a.originalEvent.touches[0] : a; - var h = f.mouseDownCoordinate, h = Math.sqrt(Math.pow(d.pageX - h.x, 2) + Math.pow(d.pageY - h.y, 2)); - if (f.dragMode == Entry.DRAG_MODE_DRAG || h > Entry.BlockView.DRAG_RADIUS) { - e && (clearTimeout(e), e = null), f.movable && (f.isInBlockMenu ? g.cloneToGlobal(a) : (a = !1, f.dragMode != Entry.DRAG_MODE_DRAG && (f._toGlobalCoordinate(), f.dragMode = Entry.DRAG_MODE_DRAG, f.block.getThread().changeEvent.notify(), Entry.GlobalSvg.setView(f, c), a = !0), this.animating && this.set({animating:!1}), 0 === f.dragInstance.height && f.dragInstance.set({height:-1 + f.height}), c = f.dragInstance, f._moveBy(d.pageX - c.offsetX, d.pageY - c.offsetY, !1), c.set({offsetX:d.pageX, - offsetY:d.pageY}), Entry.GlobalSvg.position(), f.originPos || (f.originPos = {x:f.x, y:f.y}), a && g.generateCodeMagnetMap(), f._updateCloseBlock())); - } - } - function d(a) { - e && (clearTimeout(e), e = null); - $(document).unbind(".block"); - f.terminateDrag(a); - g && g.set({dragBlock:null}); - f._changeFill(!1); - Entry.GlobalSvg.remove(); - delete this.mouseDownCoordinate; - delete f.dragInstance; - } - a.stopPropagation && a.stopPropagation(); - a.preventDefault && a.preventDefault(); - var e = null, f = this; - this._changeFill(!1); - var g = this.getBoard(); - Entry.documentMousedown && Entry.documentMousedown.notify(a); - if (!this.readOnly && !g.viewOnly) { - g.setSelectedBlock(this); - this.dominate(); - if (0 === a.button || a.originalEvent && a.originalEvent.touches) { - var h = a.type, k; - k = a.originalEvent && a.originalEvent.touches ? a.originalEvent.touches[0] : a; - this.mouseDownCoordinate = {x:k.pageX, y:k.pageY}; - var l = $(document); - l.bind("mousemove.block touchmove.block", c); - l.bind("mouseup.block touchend.block", d); - this.dragInstance = new Entry.DragInstance({startX:k.pageX, startY:k.pageY, offsetX:k.pageX, offsetY:k.pageY, height:0, mode:!0}); - g.set({dragBlock:this}); - this.addDragging(); - this.dragMode = Entry.DRAG_MODE_MOUSEDOWN; - "touchstart" === h && (e = setTimeout(function() { - e && (e = null, d(), f._rightClick(a)); - }, 1E3)); - } else { - Entry.Utils.isRightButton(a) && this._rightClick(a); - } - g.workspace.getMode() === Entry.Workspace.MODE_VIMBOARD && a && document.getElementsByClassName("CodeMirror")[0].dispatchEvent(Entry.Utils.createMouseEvent("dragStart", event)); - } - }; - b.vimBoardEvent = function(a, b, d) { - a && (a = Entry.Utils.createMouseEvent(b, a), d && (a.block = d), document.getElementsByClassName("CodeMirror")[0].dispatchEvent(a)); - }; - b.terminateDrag = function(a) { - var b = this.getBoard(), d = this.dragMode, e = this.block, f = b.workspace.getMode(); - this.removeDragging(); - this.set({visible:!0}); - this.dragMode = Entry.DRAG_MODE_NONE; - if (f === Entry.Workspace.MODE_VIMBOARD) { - b instanceof Entry.BlockMenu ? (b.terminateDrag(), this.vimBoardEvent(a, "dragEnd", e)) : b.clear(); - } else { - if (d === Entry.DRAG_MODE_DRAG) { - var f = this.dragInstance && this.dragInstance.isNew, g = Entry.GlobalSvg; - a = !1; - var h = this.block.getPrevBlock(this.block); - a = !1; - switch(Entry.GlobalSvg.terminateDrag(this)) { - case g.DONE: - g = b.magnetedBlockView; - g instanceof Entry.BlockView && (g = g.block); - h && !g ? Entry.do("separateBlock", e) : h || g || f ? g ? ("next" === g.view.magneting ? (h = e.getLastBlock(), this.dragMode = d, b.separate(e), this.dragMode = Entry.DRAG_MODE_NONE, Entry.do("insertBlock", g, h).isPass(f), Entry.ConnectionRipple.setView(g.view).dispose()) : (Entry.do("insertBlock", e, g).isPass(f), a = !0), createjs.Sound.play("entryMagneting")) : Entry.do("moveBlock", e).isPass(f) : e.getThread().view.isGlobal() ? Entry.do("moveBlock", e) : Entry.do("separateBlock", - e); - break; - case g.RETURN: - e = this.block; - d = this.originPos; - h ? (this.set({animating:!1}), createjs.Sound.play("entryMagneting"), this.bindPrev(h), e.insert(h)) : (f = e.getThread().view.getParent(), f instanceof Entry.Board ? this._moveTo(d.x, d.y, !1) : (createjs.Sound.play("entryMagneting"), Entry.do("insertBlock", e, f))); - break; - case g.REMOVE: - createjs.Sound.play("entryDelete"), f ? this.block.destroy(!1, !0) : this.block.doDestroyBelow(!1); - } - b.setMagnetedBlock(null); - a && Entry.ConnectionRipple.setView(e.view).dispose(); ->>>>>>> entrylabs/master + g instanceof Entry.Block && (g.doNotSplice = !0, g.destroy(b)); } } if (e = this.statements) { for (f = 0;f < e.length;f++) { - e[f].destroy(a); + e[f].destroy(b); } } g = this.getPrevBlock(); @@ -18992,22 +17284,22 @@ Entry.Block.DELETABLE_FALSE_LIGHTEN = 3; this.getCode().unregisterBlock(this); e = this.getThread(); this._schema.event && e.unregisterEvent(this, this._schema.event); - f && (c ? f.destroy(a, c) : g ? f.view.bindPrev(g) : (c = this.getThread().view.getParent(), c.constructor === Entry.FieldStatement ? (f.view.bindPrev(c), c.insertTopBlock(f)) : c.constructor === Entry.FieldStatement ? f.replace(c._valueBlock) : f.view._toGlobalCoordinate())); + f && (a ? f.destroy(b, a) : g ? f.view.bindPrev(g) : (a = this.getThread().view.getParent(), a.constructor === Entry.FieldStatement ? (f.view.bindPrev(a), a.insertTopBlock(f)) : a.constructor === Entry.FieldStatement ? f.replace(a._valueBlock) : f.view._toGlobalCoordinate())); !this.doNotSplice && e.spliceBlock ? e.spliceBlock(this) : delete this.doNotSplice; - this.view && this.view.destroy(a); + this.view && this.view.destroy(b); this._schemaChangeEvent && this._schemaChangeEvent.destroy(); - (a = this.events.dataDestroy) && this.getCode().object && a.forEach(function(a) { - Entry.Utils.isFunction(a) && a(d); + (b = this.events.dataDestroy) && this.getCode().object && b.forEach(function(b) { + Entry.Utils.isFunction(b) && b(d); }); }; a.getView = function() { return this.view; }; - a.setMovable = function(a) { - this.movable != a && this.set({movable:a}); + a.setMovable = function(b) { + this.movable != b && this.set({movable:b}); }; - a.setCopyable = function(a) { - this.copyable != a && this.set({copyable:a}); + a.setCopyable = function(b) { + this.copyable != b && this.set({copyable:b}); }; a.isMovable = function() { return this.movable; @@ -19015,8 +17307,8 @@ Entry.Block.DELETABLE_FALSE_LIGHTEN = 3; a.isCopyable = function() { return this.copyable; }; - a.setDeletable = function(a) { - this.deletable != a && this.set({deletable:a}); + a.setDeletable = function(b) { + this.deletable != b && this.set({deletable:b}); }; a.isDeletable = function() { return this.deletable === Entry.Block.DELETABLE_TRUE; @@ -19037,53 +17329,53 @@ Entry.Block.DELETABLE_FALSE_LIGHTEN = 3; a.doSeparate = function() { this.separate(); }; - a.doInsert = function(a) { - "basic" === this.getBlockType() ? this.insert(a) : this.replace(a); + a.doInsert = function(b) { + "basic" === this.getBlockType() ? this.insert(b) : this.replace(b); }; - a.doDestroy = function(a) { - this.destroy(a); + a.doDestroy = function(b) { + this.destroy(b); this.getCode().changeEvent.notify(); return this; }; - a.doDestroyBelow = function(a) { + a.doDestroyBelow = function(b) { console.log("destroyBelow", this.id, this.x, this.y); - this.destroy(a, !0); + this.destroy(b, !0); this.getCode().changeEvent.notify(); return this; }; a.copy = function() { - var a = this.getThread(), c = []; - if (a instanceof Entry.Thread) { - for (var d = a.getBlocks().indexOf(this), a = a.toJSON(!0, d), d = 0;d < a.length;d++) { - c.push(a[d]); + var b = this.getThread(), a = []; + if (b instanceof Entry.Thread) { + for (var d = b.getBlocks().indexOf(this), b = b.toJSON(!0, d), d = 0;d < b.length;d++) { + a.push(b[d]); } } else { - c.push(this.toJSON(!0)); + a.push(this.toJSON(!0)); } - a = this.view.getAbsoluteCoordinate(); - d = c[0]; - d.x = a.x + 15; - d.y = a.y + 15; + b = this.view.getAbsoluteCoordinate(); + d = a[0]; + d.x = b.x + 15; + d.y = b.y + 15; d.id = Entry.Utils.generateId(); - return c; + return a; }; a.copyToClipboard = function() { Entry.clipboard = this.copy(); }; - a.separate = function(a) { - this.thread.separate(this, a); + a.separate = function(b) { + this.thread.separate(this, b); this._updatePos(); this.getCode().changeEvent.notify(); }; - a.insert = function(a) { - var c = this.thread.cut(this); - a instanceof Entry.Thread ? a.insertByBlock(null, c) : a.insertAfter(c); + a.insert = function(b) { + var a = this.thread.cut(this); + b instanceof Entry.Thread ? b.insertByBlock(null, a) : b.insertAfter(a); this._updatePos(); this.getCode().changeEvent.notify(); }; - a.replace = function(a) { + a.replace = function(b) { this.thread.cut(this); - a.getThread().replace(this); + b.getThread().replace(this); this.getCode().changeEvent.notify(); }; a.getPrevBlock = function() { @@ -19096,164 +17388,66 @@ Entry.Block.DELETABLE_FALSE_LIGHTEN = 3; return this.thread.getLastBlock(); }; a.getOutputBlock = function() { - for (var a = this._schema.params, c = 0;a && c < a.length;c++) { - if ("Output" === a[c].type) { - return this.params[c]; + for (var b = this._schema.params, a = 0;b && a < b.length;a++) { + if ("Output" === b[a].type) { + return this.params[a]; } } return null; }; a.getTerminateOutputBlock = function() { - for (var a = this;;) { - var c = a.getOutputBlock(); - if (!c) { - return a; + for (var b = this;;) { + var a = b.getOutputBlock(); + if (!a) { + return b; } - a = c; + b = a; } }; a.getBlockType = function() { if (!this.view) { return null; } - var a = Entry.skeleton[this._schema.skeleton].magnets(this.view); - return a.next || a.previous ? "basic" : a.boolean || a.string ? "field" : a.output ? "output" : null; + var b = Entry.skeleton[this._schema.skeleton].magnets(this.view); + return b.next || b.previous ? "basic" : b.boolean || b.string ? "field" : b.output ? "output" : null; }; - a.indexOfStatements = function(a) { - return this.statements.indexOf(a); + a.indexOfStatements = function(b) { + return this.statements.indexOf(b); }; -<<<<<<< HEAD - a.pointer = function(a) { - a || (a = []); - return this.thread.pointer(a, this); -======= - b.reDraw = function() { - if (this.visible) { - var a = this.block; - requestAnimFrame(this._updateContents.bind(this)); - var b = a.params; - if (b) { - for (var d = 0;d < b.length;d++) { - var e = b[d]; - e instanceof Entry.Block && e.view.reDraw(); - } - } - if (a = a.statements) { - for (d = 0;d < a.length;d++) { - a[d].view.reDraw(); - } - } - } ->>>>>>> entrylabs/master + a.pointer = function(b) { + b || (b = []); + return this.thread.pointer(b, this); }; a.targetPointer = function() { - var a = this.thread.pointer([], this); - 4 === a.length && 0 === a[3] && a.pop(); - return a; + var b = this.thread.pointer([], this); + 4 === b.length && 0 === b[3] && b.pop(); + return b; }; -<<<<<<< HEAD - a.getBlockList = function(a) { - var c = []; + a.getBlockList = function(b) { + var a = []; if (!this._schema) { return []; -======= - b.getDataUrl = function(a, b) { - function d() { - g = g.replace("(svgGroup)", (new XMLSerializer).serializeToString(k)).replace("%W", h.width * n).replace("%H", h.height * n).replace("(defs)", (new XMLSerializer).serializeToString(q[0])).replace(/>\s+/g, ">").replace(/\s+>>>>>> entrylabs/master } - if (a && this._schema.isPrimitive) { - return c; + if (b && this._schema.isPrimitive) { + return a; } -<<<<<<< HEAD - c.push(this); + a.push(this); for (var d = this.params, e = 0;e < d.length;e++) { var f = d[e]; - f && f.constructor == Entry.Block && (c = c.concat(f.getBlockList(a))); + f && f.constructor == Entry.Block && (a = a.concat(f.getBlockList(b))); } if (d = this.statements) { for (e = 0;e < d.length;e++) { - c = c.concat(d[e].getBlockList(a)); -======= - var f = $.Deferred(), g = '(svgGroup)(defs)', h = this.svgGroup.getBoundingClientRect(), k = a ? this.svgGroup : this.svgGroup.cloneNode(!0), l = this._skeleton.box(this), n = b ? 1 : 1.5, m = function() { - var a = window.platform; - return a && "windows" === a.name.toLowerCase() && "7" === a.version[0] ? !0 : !1; - }() ? .9 : .95; - -1 < this.type.indexOf("func_") && (m *= .99); - k.setAttribute("transform", "scale(%SCALE) translate(%X,%Y)".replace("%X", -l.offsetX).replace("%Y", -l.offsetY).replace("%SCALE", n)); - for (var q = this.getBoard().svgDom.find("defs"), r = k.getElementsByTagName("image"), l = k.getElementsByTagName("text"), t = ["\u2265", "\u2264"], u = "\u2265\u2264-><=+-x/".split(""), v = 0;v < l.length;v++) { - (function(a) { - a.setAttribute("font-family", "'nanumBarunRegular', 'NanumGothic', '\ub098\ub214\uace0\ub515','NanumGothicWeb', '\ub9d1\uc740 \uace0\ub515', 'Malgun Gothic', Dotum"); - var b = parseInt(a.getAttribute("font-size")), c = $(a).text(); - -1 < t.indexOf(c) && a.setAttribute("font-weight", "500"); - if ("q" == c) { - var d = parseInt(a.getAttribute("y")); - a.setAttribute("y", d - 1); - } - -1 < u.indexOf(c) ? a.setAttribute("font-size", b + "px") : a.setAttribute("font-size", b * m + "px"); - a.setAttribute("alignment-baseline", "baseline"); - })(l[v]); - } - var x = 0; - if (0 === r.length) { - d(); - } else { - for (v = 0;v < r.length;v++) { - (function(a) { - var b = a.getAttribute("href"); - e(b, a.getAttribute("width"), a.getAttribute("height")).then(function(b) { - a.setAttribute("href", b); - if (++x == r.length) { - return d(); - } - }); - })(r[v]); ->>>>>>> entrylabs/master + a = a.concat(d[e].getBlockList(b)); } } - return c; + return a; }; a.stringify = function() { return JSON.stringify(this.toJSON()); }; -<<<<<<< HEAD })(Entry.Block.prototype); Entry.BlockMenu = function(a, b, c, d) { -======= - b._rightClick = function(a) { - var b = Entry.disposeEvent; - b && b.notify(a); - var d = this, e = d.block; - if (!this.isInBlockMenu) { - var b = [], f = {text:Lang.Blocks.Duplication_option, enable:this.copyable, callback:function() { - Entry.do("cloneBlock", e); - }}, g = {text:Lang.Blocks.CONTEXT_COPY_option, enable:this.copyable, callback:function() { - d.block.copyToClipboard(); - }}, h = {text:Lang.Blocks.Delete_Blocks, enable:e.isDeletable(), callback:function() { - Entry.do("destroyBlock", d.block); - }}, k = {text:Lang.Menus.save_as_image, callback:function() { - d.downloadAsImage(); - }}; - b.push(f); - b.push(g); - b.push(h); - Entry.Utils.isChrome() && "workspace" == Entry.type && !Entry.isMobile() && b.push(k); - a.originalEvent && a.originalEvent.touches && (a = a.originalEvent.touches[0]); - Entry.ContextMenu.show(b, null, {x:a.clientX, y:a.clientY}); - } - }; -})(Entry.BlockView.prototype); -Entry.Code = function(b, a) { ->>>>>>> entrylabs/master Entry.Model(this, !1); this._align = b || "CENTER"; this._scroll = void 0 !== d ? d : !1; @@ -19292,74 +17486,74 @@ Entry.Code = function(b, a) { }; (function(a) { a.schema = {code:null, dragBlock:null, closeBlock:null, selectedBlockView:null}; - a._generateView = function(a) { - var c = this.view, d = this; - a && (this._categoryCol = Entry.Dom("ul", {class:"entryCategoryListWorkspace", parent:c}), this._generateCategoryView(a)); - this.blockMenuContainer = Entry.Dom("div", {"class":"blockMenuContainer", parent:c}); + a._generateView = function(b) { + var a = this.view, d = this; + b && (this._categoryCol = Entry.Dom("ul", {class:"entryCategoryListWorkspace", parent:a}), this._generateCategoryView(b)); + this.blockMenuContainer = Entry.Dom("div", {"class":"blockMenuContainer", parent:a}); this.svgDom = Entry.Dom($(''), {parent:this.blockMenuContainer}); - this.svgDom.mouseenter(function(a) { + this.svgDom.mouseenter(function(b) { d._scroller && d._scroller.setOpacity(1); - a = d.workspace.selectedBlockView; - !Entry.playground || Entry.playground.resizing || a && a.dragMode === Entry.DRAG_MODE_DRAG || (Entry.playground.focusBlockMenu = !0, a = d.svgGroup.getBBox(), a = a.width + a.x + 64, a > Entry.interfaceState.menuWidth && (this.widthBackup = Entry.interfaceState.menuWidth - 64, $(this).stop().animate({width:a - 62}, 200))); + b = d.workspace.selectedBlockView; + !Entry.playground || Entry.playground.resizing || b && b.dragMode === Entry.DRAG_MODE_DRAG || (Entry.playground.focusBlockMenu = !0, b = d.svgGroup.getBBox(), b = b.width + b.x + 64, b > Entry.interfaceState.menuWidth && (this.widthBackup = Entry.interfaceState.menuWidth - 64, $(this).stop().animate({width:b - 62}, 200))); }); - this.svgDom.mouseleave(function(a) { - Entry.playground && !Entry.playground.resizing && (d._scroller && d._scroller.setOpacity(0), (a = this.widthBackup) && $(this).stop().animate({width:a}, 200), delete this.widthBackup, delete Entry.playground.focusBlockMenu); + this.svgDom.mouseleave(function(b) { + Entry.playground && !Entry.playground.resizing && (d._scroller && d._scroller.setOpacity(0), (b = this.widthBackup) && $(this).stop().animate({width:b}, 200), delete this.widthBackup, delete Entry.playground.focusBlockMenu); }); $(window).scroll(function() { d.updateOffset(); }); }; - a.changeCode = function(a) { - if (!(a instanceof Entry.Code)) { + a.changeCode = function(b) { + if (!(b instanceof Entry.Code)) { return console.error("You must inject code instance"); } this.codeListener && this.code.changeEvent.detach(this.codeListener); - var c = this; - this.set({code:a}); + var a = this; + this.set({code:b}); this.codeListener = this.code.changeEvent.attach(this, function() { - c.changeEvent.notify(); + a.changeEvent.notify(); }); - a.createView(this); + b.createView(this); this.align(); }; - a.bindCodeView = function(a) { + a.bindCodeView = function(b) { this.svgBlockGroup.remove(); this.svgThreadGroup.remove(); - this.svgBlockGroup = a.svgBlockGroup; - this.svgThreadGroup = a.svgThreadGroup; + this.svgBlockGroup = b.svgBlockGroup; + this.svgThreadGroup = b.svgThreadGroup; this.svgGroup.appendChild(this.svgThreadGroup); this.svgGroup.appendChild(this.svgBlockGroup); this._scroller && this.svgGroup.appendChild(this._scroller.svgGroup); }; - a.align = function(a) { - var c = this.code; - if (c) { + a.align = function(b) { + var a = this.code; + if (a) { this._clearSplitters(); - c.view && !a && c.view.reDraw(); - a = c.getThreads(); - for (var c = 10, d = "LEFT" == this._align ? 10 : this.svgDom.width() / 2, e, f = 0, g = a.length;f < g;f++) { - var h = a[f].getFirstBlock(), k = h.view, h = Entry.block[h.type]; - this.checkBanClass(h) ? k.set({display:!1}) : (k.set({display:!0}), h = h.class, e && e !== h && (this._createSplitter(c), c += 15), e = h, h = d - k.offsetX, "CENTER" == this._align && (h -= k.width / 2), c -= k.offsetY, k._moveTo(h, c, !1), c += k.height + 15); + a.view && !b && a.view.reDraw(); + b = a.getThreads(); + for (var a = 10, d = "LEFT" == this._align ? 10 : this.svgDom.width() / 2, e, f = 0, g = b.length;f < g;f++) { + var h = b[f].getFirstBlock(), k = h.view, h = Entry.block[h.type]; + this.checkBanClass(h) ? k.set({display:!1}) : (k.set({display:!0}), h = h.class, e && e !== h && (this._createSplitter(a), a += 15), e = h, h = d - k.offsetX, "CENTER" == this._align && (h -= k.width / 2), a -= k.offsetY, k._moveTo(h, a, !1), a += k.height + 15); } this.updateSplitters(); this.changeEvent.notify(); } }; - a.cloneToGlobal = function(a) { + a.cloneToGlobal = function(b) { if (!this._boardBlockView && null !== this.dragBlock) { - var c = this.workspace, d = c.getMode(), e = this.dragBlock, f = this._svgWidth, g = c.selectedBoard; + var a = this.workspace, d = a.getMode(), e = this.dragBlock, f = this._svgWidth, g = a.selectedBoard; if (!g || d != Entry.Workspace.MODE_BOARD && d != Entry.Workspace.MODE_OVERLAYBOARD) { - Entry.GlobalSvg.setView(e, c.getMode()) && Entry.GlobalSvg.addControl(a); + Entry.GlobalSvg.setView(e, a.getMode()) && Entry.GlobalSvg.addControl(b); } else { - if (g.code && (c = e.block, d = c.getThread(), c && d)) { - c = d.toJSON(!0); - this._boardBlockView = Entry.do("addThread", c).value.getFirstBlock().view; + if (g.code && (a = e.block, d = a.getThread(), a && d)) { + a = d.toJSON(!0); + this._boardBlockView = Entry.do("addThread", a).value.getFirstBlock().view; var g = this.offset().top - g.offset().top, h, k; - if (c = this.dragBlock.mouseDownCoordinate) { - h = a.pageX - c.x, k = a.pageY - c.y; + if (a = this.dragBlock.mouseDownCoordinate) { + h = b.pageX - a.x, k = b.pageY - a.y; } this._boardBlockView._moveTo(e.x - f + (h || 0), e.y + g + (k || 0), !1); - this._boardBlockView.onMouseDown.call(this._boardBlockView, a); + this._boardBlockView.onMouseDown.call(this._boardBlockView, b); this._boardBlockView.dragInstance.set({isNew:!0}); } } @@ -19367,23 +17561,23 @@ Entry.Code = function(b, a) { }; a.terminateDrag = function() { if (this._boardBlockView) { - var a = this._boardBlockView; - if (a) { + var b = this._boardBlockView; + if (b) { this.workspace.getBoard(); this._boardBlockView = null; - var c = Entry.GlobalSvg.left, d = Entry.GlobalSvg.width / 2, a = a.getBoard().offset().left; - return c < a - d; + var a = Entry.GlobalSvg.left, d = Entry.GlobalSvg.width / 2, b = b.getBoard().offset().left; + return a < b - d; } } }; - a.getCode = function(a) { + a.getCode = function(b) { return this._code; }; - a.setSelectedBlock = function(a) { - var c = this.selectedBlockView; - c && c.removeSelected(); - a instanceof Entry.BlockView ? a.addSelected() : a = null; - this.set({selectedBlockView:a}); + a.setSelectedBlock = function(b) { + var a = this.selectedBlockView; + a && a.removeSelected(); + b instanceof Entry.BlockView ? b.addSelected() : b = null; + this.set({selectedBlockView:b}); }; a.hide = function() { this.view.addClass("entryRemove"); @@ -19392,30 +17586,30 @@ Entry.Code = function(b, a) { this.view.removeClass("entryRemove"); }; a.renderText = function() { - for (var a = this.code.getThreads(), c = 0;c < a.length;c++) { - a[c].view.renderText(); + for (var b = this.code.getThreads(), a = 0;a < b.length;a++) { + b[a].view.renderText(); } }; a.renderBlock = function() { - for (var a = this.code.getThreads(), c = 0;c < a.length;c++) { - a[c].view.renderBlock(); + for (var b = this.code.getThreads(), a = 0;a < b.length;a++) { + b[a].view.renderBlock(); } }; - a._createSplitter = function(a) { - a = this.svgBlockGroup.elem("line", {x1:20, y1:a, x2:this._svgWidth - 20, y2:a, stroke:"#b5b5b5"}); - this._splitters.push(a); + a._createSplitter = function(b) { + b = this.svgBlockGroup.elem("line", {x1:20, y1:b, x2:this._svgWidth - 20, y2:b, stroke:"#b5b5b5"}); + this._splitters.push(b); }; - a.updateSplitters = function(a) { - a = void 0 === a ? 0 : a; - var c = this._svgWidth - 20, d; + a.updateSplitters = function(b) { + b = void 0 === b ? 0 : b; + var a = this._svgWidth - 20, d; this._splitters.forEach(function(e) { - d = parseFloat(e.getAttribute("y1")) + a; - e.attr({x2:c, y1:d, y2:d}); + d = parseFloat(e.getAttribute("y1")) + b; + e.attr({x2:a, y1:d, y2:d}); }); }; a._clearSplitters = function() { - for (var a = this._splitters, c = a.length - 1;0 <= c;c--) { - a[c].remove(), a.pop(); + for (var b = this._splitters, a = b.length - 1;0 <= a;a--) { + b[a].remove(), b.pop(); } }; a.setWidth = function() { @@ -19515,6 +17709,36 @@ Entry.Code = function(b, a) { a.on("wheel", function() { c._mouseWheel.apply(c, arguments); }); + c._scroller && $(this.svg).bind("mousedown touchstart", function(a) { + c.onMouseDown.apply(c, arguments); + }); + }; + a.onMouseDown = function(a) { + function c(a) { + a.stopPropagation && a.stopPropagation(); + a.preventDefault && a.preventDefault(); + a = Entry.Utils.convertMouseEvent(a); + var b = e.dragInstance; + e._scroller.scroll(-a.pageY + b.offsetY); + b.set({offsetY:a.pageY}); + } + function d(a) { + $(document).unbind(".blockMenu"); + delete e.dragInstance; + } + a.stopPropagation && a.stopPropagation(); + a.preventDefault && a.preventDefault(); + var e = this; + if (0 === a.button || a.originalEvent && a.originalEvent.touches) { + a = Entry.Utils.convertMouseEvent(a); + Entry.documentMousedown && Entry.documentMousedown.notify(a); + var f = $(document); + f.bind("mousemove.blockMenu", c); + f.bind("mouseup.blockMenu", d); + f.bind("touchmove.blockMenu", c); + f.bind("touchend.blockMenu", d); + this.dragInstance = new Entry.DragInstance({startY:a.pageY, offsetY:a.pageY}); + } }; a._mouseWheel = function(a) { a = a.originalEvent; @@ -19680,7 +17904,6 @@ Entry.BlockMenuScroller.RADIUS = 7; this.vScrollbar.attr({y:this.vY}); this.resizeScrollBar(); }; -<<<<<<< HEAD a.onMouseDown = function(a) { function c(a) { a.stopPropagation && a.stopPropagation(); @@ -19689,11 +17912,6 @@ Entry.BlockMenuScroller.RADIUS = 7; var b = e.dragInstance; e.scroll(a.pageY - b.offsetY); b.set({offsetY:a.pageY}); -======= - b._isEditable = function() { - if (Entry.ContextMenu.visible || this._block.view.dragMode == Entry.DRAG_MODE_DRAG) { - return !1; ->>>>>>> entrylabs/master } function d(a) { $(document).unbind(".scroll"); @@ -19744,7 +17962,6 @@ Entry.BlockView = function(a, b, c) { }); e.onMouseDown.apply(e, arguments); }; -<<<<<<< HEAD this._startRender(a, c); this._observers.push(this.block.observe(this, "_setMovable", ["movable"])); this._observers.push(this.block.observe(this, "_setReadOnly", ["movable"])); @@ -19802,105 +18019,6 @@ Entry.BlockView.pngMap = {}; this._startContentRender(c); !0 !== this._board.disableMouseEvent && this._addControl(); this.bindPrev(); -======= - b.pointer = function(a) { - a = a || []; - a.unshift(this._index); - a.unshift(Entry.PARAM); - return this._block.pointer(a); - }; - b.getFontSize = function(a) { - return a = a || this._blockView.getSkeleton().fontSize || 12; - }; - b.getContentHeight = function() { - return Entry.isMobile() ? 22 : 16; - }; -})(Entry.Field.prototype); -Entry.FieldAngle = function(b, a, c) { - this._block = a.block; - this._blockView = a; - this.box = new Entry.BoxModel; - this.svgGroup = null; - this.position = b.position; - this._contents = b; - this._index = c; - b = this.getValue(); - this.setValue(this.modValue(void 0 !== b ? b : 90)); - this._CONTENT_HEIGHT = this.getContentHeight(); - this.renderStart(); -}; -Entry.Utils.inherit(Entry.Field, Entry.FieldAngle); -(function(b) { - b.renderStart = function() { - this.svgGroup && $(this.svgGroup).remove(); - this.svgGroup = this._blockView.contentSvgGroup.elem("g", {class:"entry-input-field"}); - this.textElement = this.svgGroup.elem("text", {x:4, y:4, "font-size":"11px"}); - this.textElement.textContent = this.getText(); - var a = this.getTextWidth(), b = this._CONTENT_HEIGHT, d = this.position && this.position.y ? this.position.y : 0; - this._header = this.svgGroup.elem("rect", {x:0, y:d - b / 2, rx:3, ry:3, width:a, height:b, rx:3, ry:3, fill:"#fff", "fill-opacity":.4}); - this.svgGroup.appendChild(this.textElement); - this._bindRenderOptions(); - this.box.set({x:0, y:0, width:a, height:b}); - }; - b.renderOptions = function() { - var a = this; - this._attachDisposeEvent(function() { - a.applyValue(); - a.destroyOption(); - }); - this.optionGroup = Entry.Dom("input", {class:"entry-widget-input-field", parent:$("body")}); - this.optionGroup.val(this.value); - this.optionGroup.on("mousedown touchstart", function(a) { - a.stopPropagation(); - }); - this.optionGroup.on("keyup", function(b) { - var c = b.keyCode || b.which; - a.applyValue(b); - -1 < [13, 27].indexOf(c) && a.destroyOption(); - }); - var b = this.getAbsolutePosFromDocument(); - b.y -= this.box.height / 2; - this.optionGroup.css({height:this._CONTENT_HEIGHT, left:b.x, top:b.y, width:a.box.width}); - this.svgOptionGroup = this.appendSvgOptionGroup(); - this.svgOptionGroup.elem("circle", {x:0, y:0, r:49, class:"entry-field-angle-circle"}); - $(this.svgOptionGroup).on("mousedown touchstart", function(b) { - b.stopPropagation(); - a._updateByCoord(b); - }); - this._dividerGroup = this.svgOptionGroup.elem("g"); - for (b = 0;360 > b;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 + ")"}); - $(this.svgOptionGroup).bind("mousemove touchmove", this._updateByCoord.bind(this)); - $(this.svgOptionGroup).bind("mouseup touchend", this.destroyOption.bind(this)); - this.updateGraph(); - this.optionGroup.focus(); - this.optionGroup.select(); - }; - b._updateByCoord = function(a) { - a.originalEvent && a.originalEvent.touches && (a = a.originalEvent.touches[0]); - a = [a.clientX, a.clientY]; - var b = this.getAbsolutePosFromDocument(); - this.optionGroup.val(this.modValue(function(a, b) { - var c = b[0] - a[0], g = b[1] - a[1] - 49 - 1, h = Math.atan(-g / c), h = Entry.toDegrees(h), h = 90 - h; - 0 > c ? h += 180 : 0 < g && (h += 360); - return 15 * Math.round(h / 15); - }([b.x + this.box.width / 2, b.y + this.box.height / 2 + 1], a))); - this.applyValue(); - }; - b.updateGraph = function() { - this._fillPath && this._fillPath.remove(); - var a = Entry.toRadian(this.getValue()), b = 49 * Math.sin(a), d = -49 * Math.cos(a), a = a > Math.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"}); ->>>>>>> entrylabs/master }; a._startContentRender = function(a) { a = void 0 === a ? Entry.Workspace.MODE_BOARD : a; @@ -20016,66 +18134,52 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldAngle); a.onMouseDown = function(b) { function c(b) { b.stopPropagation(); - var c = e.workspace.getMode(), d; + var c = g.workspace.getMode(), d; c === Entry.Workspace.MODE_VIMBOARD && a.vimBoardEvent(b, "dragOver"); d = b.originalEvent && b.originalEvent.touches ? b.originalEvent.touches[0] : b; - var f = m.mouseDownCoordinate, f = Math.sqrt(Math.pow(d.pageX - f.x, 2) + Math.pow(d.pageY - f.y, 2)); - (m.dragMode == Entry.DRAG_MODE_DRAG || f > Entry.BlockView.DRAG_RADIUS) && m.movable && (m.isInBlockMenu ? e.cloneToGlobal(b) : (b = !1, m.dragMode != Entry.DRAG_MODE_DRAG && (m._toGlobalCoordinate(), m.dragMode = Entry.DRAG_MODE_DRAG, m.block.getThread().changeEvent.notify(), Entry.GlobalSvg.setView(m, c), b = !0), this.animating && this.set({animating:!1}), 0 === m.dragInstance.height && m.dragInstance.set({height:-1 + m.height}), c = m.dragInstance, m._moveBy(d.pageX - c.offsetX, d.pageY - - c.offsetY, !1), c.set({offsetX:d.pageX, offsetY:d.pageY}), Entry.GlobalSvg.position(), m.originPos || (m.originPos = {x:m.x, y:m.y}), b && e.generateCodeMagnetMap(), m._updateCloseBlock())); + var h = f.mouseDownCoordinate, h = Math.sqrt(Math.pow(d.pageX - h.x, 2) + Math.pow(d.pageY - h.y, 2)); + if (f.dragMode == Entry.DRAG_MODE_DRAG || h > Entry.BlockView.DRAG_RADIUS) { + e && (clearTimeout(e), e = null), f.movable && (f.isInBlockMenu ? g.cloneToGlobal(b) : (b = !1, f.dragMode != Entry.DRAG_MODE_DRAG && (f._toGlobalCoordinate(), f.dragMode = Entry.DRAG_MODE_DRAG, f.block.getThread().changeEvent.notify(), Entry.GlobalSvg.setView(f, c), b = !0), this.animating && this.set({animating:!1}), 0 === f.dragInstance.height && f.dragInstance.set({height:-1 + f.height}), c = f.dragInstance, f._moveBy(d.pageX - c.offsetX, d.pageY - c.offsetY, !1), c.set({offsetX:d.pageX, + offsetY:d.pageY}), Entry.GlobalSvg.position(), f.originPos || (f.originPos = {x:f.x, y:f.y}), b && g.generateCodeMagnetMap(), f._updateCloseBlock())); + } } function d(a) { + e && (clearTimeout(e), e = null); $(document).unbind(".block"); - m.terminateDrag(a); - e && e.set({dragBlock:null}); - m._changeFill(!1); + f.terminateDrag(a); + g && g.set({dragBlock:null}); + f._changeFill(!1); Entry.GlobalSvg.remove(); delete this.mouseDownCoordinate; - delete m.dragInstance; + delete f.dragInstance; } b.stopPropagation && b.stopPropagation(); b.preventDefault && b.preventDefault(); + var e = null, f = this; this._changeFill(!1); - var e = this.getBoard(); + var g = this.getBoard(); Entry.documentMousedown && Entry.documentMousedown.notify(b); - if (!this.readOnly && !e.viewOnly) { - e.setSelectedBlock(this); + if (!this.readOnly && !g.viewOnly) { + g.setSelectedBlock(this); this.dominate(); if (0 === b.button || b.originalEvent && b.originalEvent.touches) { - var f; - f = b.originalEvent && b.originalEvent.touches ? b.originalEvent.touches[0] : b; - this.mouseDownCoordinate = {x:f.pageX, y:f.pageY}; - var g = $(document); - g.bind("mousemove.block touchmove.block", c); - g.bind("mouseup.block touchend.block", d); - this.dragInstance = new Entry.DragInstance({startX:f.pageX, startY:f.pageY, offsetX:f.pageX, offsetY:f.pageY, height:0, mode:!0}); - e.set({dragBlock:this}); + var h = b.type, k; + k = b.originalEvent && b.originalEvent.touches ? b.originalEvent.touches[0] : b; + this.mouseDownCoordinate = {x:k.pageX, y:k.pageY}; + var l = $(document); + l.bind("mousemove.block touchmove.block", c); + l.bind("mouseup.block touchend.block", d); + this.dragInstance = new Entry.DragInstance({startX:k.pageX, startY:k.pageY, offsetX:k.pageX, offsetY:k.pageY, height:0, mode:!0}); + g.set({dragBlock:this}); this.addDragging(); this.dragMode = Entry.DRAG_MODE_MOUSEDOWN; + "touchstart" === h && (e = setTimeout(function() { + e && (e = null, d(), f._rightClick(b)); + }, 1E3)); } else { - if (Entry.Utils.isRightButton(b)) { - var h = this, k = h.block; - if (this.isInBlockMenu) { - return; - } - f = []; - var g = {text:Lang.Blocks.Duplication_option, enable:this.copyable, callback:function() { - Entry.do("cloneBlock", k); - }}, l = {text:Lang.Blocks.CONTEXT_COPY_option, enable:this.copyable, callback:function() { - h.block.copyToClipboard(); - }}, q = {text:Lang.Blocks.Delete_Blocks, enable:k.isDeletable(), callback:function() { - Entry.do("destroyBlock", h.block); - }}, n = {text:Lang.Menus.save_as_image, callback:function() { - h.downloadAsImage(); - }}; - f.push(g); - f.push(l); - f.push(q); - Entry.Utils.isChrome() && "workspace" == Entry.type && f.push(n); - Entry.ContextMenu.show(f); - } + Entry.Utils.isRightButton(b) && this._rightClick(b); } - var m = this; - e.workspace.getMode() === Entry.Workspace.MODE_VIMBOARD && b && document.getElementsByClassName("CodeMirror")[0].dispatchEvent(Entry.Utils.createMouseEvent("dragStart", event)); + g.workspace.getMode() === Entry.Workspace.MODE_VIMBOARD && b && document.getElementsByClassName("CodeMirror")[0].dispatchEvent(Entry.Utils.createMouseEvent("dragStart", event)); } }; a.vimBoardEvent = function(a, c, d) { @@ -20225,37 +18329,9 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldAngle); a.renderBlock = function() { this._startContentRender(Entry.Workspace.MODE_BOARD); }; -<<<<<<< HEAD a._updateOpacity = function() { this.svgGroup.attr({opacity:!1 === this.visible ? 0 : 1}); this.visible && this._setPosition(); -======= -})(Entry.FieldBlock.prototype); -Entry.FieldColor = function(b, a, c) { - this._block = a.block; - this._blockView = a; - this.box = new Entry.BoxModel; - this.svgGroup = null; - this._contents = b; - this._index = c; - this._position = b.position; - this.key = b.key; - this.setValue(this.getValue() || "#FF0000"); - this._CONTENT_HEIGHT = this.getContentHeight(); - this._CONTENT_WIDTH = this.getContentWidth(); - this.renderStart(a); -}; -Entry.Utils.inherit(Entry.Field, Entry.FieldColor); -(function(b) { - b.renderStart = function() { - this.svgGroup && $(this.svgGroup).remove(); - this.svgGroup = this._blockView.contentSvgGroup.elem("g", {class:"entry-field-color"}); - var a = this._CONTENT_HEIGHT, b = this._CONTENT_WIDTH, d = this._position, e; - d ? (e = d.x || 0, d = d.y || 0) : (e = 0, d = -a / 2); - this._header = this.svgGroup.elem("rect", {x:e, y:d, width:b, height:a, fill:this.getValue()}); - this._bindRenderOptions(); - this.box.set({x:e, y:d, width:b, height:a}); ->>>>>>> entrylabs/master }; a._updateShadow = function() { this.shadow && Entry.Utils.colorDarken(this._schema.color, .7); @@ -20266,7 +18342,6 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldColor); a._setReadOnly = function() { this.readOnly = null !== this.block.isReadOnly() ? this.block.isReadOnly() : void 0 !== this._skeleton.readOnly ? this._skeleton.readOnly : !1; }; -<<<<<<< HEAD a._setCopyable = function() { this.copyable = null !== this.block.isCopyable() ? this.block.isCopyable() : void 0 !== this._skeleton.copyable ? this._skeleton.copyable : !0; }; @@ -20276,57 +18351,6 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldColor); c ? window.setTimeout(function() { d._moveBy(a, a, !1); }, c) : d._moveBy(a, a, !1); -======= - b.getContentWidth = function() { - return Entry.isMobile() ? 20 : 14.5; - }; -})(Entry.FieldColor.prototype); -Entry.FieldColor.getWidgetColorList = function() { - return ["#FFFFFF #CCCCCC #C0C0C0 #999999 #666666 #333333 #000000".split(" "), "#FFCCCC #FF6666 #FF0000 #CC0000 #990000 #660000 #330000".split(" "), "#FFCC99 #FF9966 #FF9900 #FF6600 #CC6600 #993300 #663300".split(" "), "#FFFF99 #FFFF66 #FFCC66 #FFCC33 #CC9933 #996633 #663333".split(" "), "#FFFFCC #FFFF33 #FFFF00 #FFCC00 #999900 #666600 #333300".split(" "), "#99FF99 #66FF99 #33FF33 #33CC00 #009900 #006600 #003300".split(" "), "#99FFFF #33FFFF #66CCCC #00CCCC #339999 #336666 #003333".split(" "), "#CCFFFF #66FFFF #33CCFF #3366FF #3333FF #000099 #000066".split(" "), - "#CCCCFF #9999FF #6666CC #6633FF #6609CC #333399 #330099".split(" "), "#FFCCFF #FF99FF #CC66CC #CC33CC #993399 #663366 #330033".split(" ")]; -}; -Entry.FieldDropdown = function(b, a, c) { - this._block = a.block; - this._blockView = a; - this.box = new Entry.BoxModel; - this.svgGroup = null; - this._contents = b; - this._noArrow = b.noArrow; - this._arrowColor = b.arrowColor; - this._index = c; - this.setValue(this.getValue()); - this._CONTENT_HEIGHT = this.getContentHeight(b.dropdownHeight); - this._FONT_SIZE = this.getFontSize(b.fontSize); - this._ROUND = b.roundValue || 3; - this.renderStart(); -}; -Entry.Utils.inherit(Entry.Field, Entry.FieldDropdown); -(function(b) { - b.renderStart = function() { - this.svgGroup && $(this.svgGroup).remove(); - this instanceof Entry.FieldDropdownDynamic && this._updateValue(); - var a = this._blockView, b = Entry.isMobile(), d = b ? 33 : 20, b = b ? 24 : 10; - this.svgGroup = a.contentSvgGroup.elem("g", {class:"entry-field-dropdown"}); - this.textElement = this.svgGroup.elem("text", {x:5}); - this.textElement.textContent = this.getTextByValue(this.getValue()); - a = this.textElement.getBBox(); - this.textElement.attr({style:"white-space: pre;", "font-size":+this._FONT_SIZE + "px", y:.23 * a.height}); - d = this.textElement.getComputedTextLength() + d; - this._noArrow && (d -= b); - b = this._CONTENT_HEIGHT; - this._header = this.svgGroup.elem("rect", {width:d, height:b, y:-b / 2, rx:this._ROUND, ry:this._ROUND, fill:"#fff", "fill-opacity":.4}); - this.svgGroup.appendChild(this.textElement); - this._noArrow || (a = this.getArrow(), this._arrow = this.svgGroup.elem("polygon", {points:a.points, fill:a.color, stroke:a.color, transform:"translate(" + (d - a.width - 5) + "," + -a.height / 2 + ")"})); - this._bindRenderOptions(); - this.box.set({x:0, y:0, width:d, height:b}); - }; - b.resize = function() { - var a = Entry.isMobile(), b = a ? 33 : 20, a = a ? 24 : 10, b = this.textElement.getComputedTextLength() + b; - this._noArrow ? b -= a : (a = this.getArrow(), this._arrow.attr({transform:"translate(" + (b - a.width - 5) + "," + -a.height / 2 + ")"})); - this._header.attr({width:b}); - this.box.set({width:b}); - this._block.view.alignContent(); ->>>>>>> entrylabs/master }; a.bindPrev = function(a) { if (a) { @@ -20357,47 +18381,12 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldDropdown); this.svgGroup.attr({display:!1 === this.display ? "none" : "block"}); this.display && this._setPosition(); }; -<<<<<<< HEAD a._updateColor = function() { var a = this._schema.color; this.block.deletable === Entry.Block.DELETABLE_FALSE_LIGHTEN && (a = Entry.Utils.colorLighten(a)); this._fillColor = a; this._path.attr({fill:a}); this._updateContents(); -======= - b.getContentHeight = function(a) { - return a = a || this._blockView.getSkeleton().dropdownHeight || (Entry.isMobile() ? 22 : 16); - }; - b.getArrow = function() { - var a = Entry.isMobile(); - return {color:this._arrowColor || this._blockView._schema.color, points:a ? "0,0 19,0 9.5,13" : "0,0 6.4,0 3.2,4.2", height:a ? 13 : 4.2, width:a ? 19 : 6.4}; - }; -})(Entry.FieldDropdown.prototype); -Entry.FieldDropdownDynamic = function(b, a, c) { - this._block = a.block; - this._blockView = a; - this.box = new Entry.BoxModel; - this.svgGroup = null; - this._contents = b; - this._index = c; - this._arrowColor = b.arrowColor; - c = this._contents.menuName; - Entry.Utils.isFunction(c) ? this._menuGenerator = c : this._menuName = c; - this._CONTENT_HEIGHT = this.getContentHeight(b.dropdownHeight); - this._FONT_SIZE = this.getFontSize(b.fontSize); - this._ROUND = b.roundValue || 3; - this.renderStart(a); -}; -Entry.Utils.inherit(Entry.FieldDropdown, Entry.FieldDropdownDynamic); -(function(b) { - b.constructor = Entry.FieldDropDownDynamic; - b._updateValue = function() { - var a = this._block.getCode().object, b = []; - Entry.container && (b = this._menuName ? Entry.container.getDropdownList(this._menuName, a) : this._menuGenerator()); - this._contents.options = b; - (a = this.getValue()) && "null" != a || (a = 0 !== b.length ? b[0][1] : null); - this.setValue(a); ->>>>>>> entrylabs/master }; a._updateContents = function() { for (var a = 0;a < this._contents.length;a++) { @@ -20421,43 +18410,13 @@ Entry.Utils.inherit(Entry.FieldDropdown, Entry.FieldDropdownDynamic); a.addActivated = function() { this.svgGroup.addClass("activated"); }; -<<<<<<< HEAD a.removeActivated = function() { this.svgGroup.removeClass("activated"); -======= -})(Entry.FieldIndicator.prototype); -Entry.Keyboard = {}; -Entry.FieldKeyboard = function(b, a, c) { - this._block = a.block; - this._blockView = a; - this.box = new Entry.BoxModel; - this.svgGroup = null; - this.position = b.position; - this._contents = b; - this._index = c; - this.setValue(String(this.getValue())); - this._CONTENT_HEIGHT = this.getContentHeight(); - this._optionVisible = !1; - this.renderStart(a); -}; -Entry.Utils.inherit(Entry.Field, Entry.FieldKeyboard); -(function(b) { - b.renderStart = function() { - this.svgGroup && $(this.svgGroup).remove(); - this.svgGroup = this._blockView.contentSvgGroup.elem("g", {class:"entry-input-field"}); - this.textElement = this.svgGroup.elem("text").attr({x:5, y:4, "font-size":"11px"}); - this.textElement.textContent = Entry.getKeyCodeMap()[this.getValue()]; - var a = this.getTextWidth() + 1, b = this._CONTENT_HEIGHT, d = this.position && this.position.y ? this.position.y : 0; - this._header = this.svgGroup.elem("rect", {x:0, y:d - b / 2, width:a, height:b, rx:3, ry:3, fill:"#fff", "fill-opacity":.4}); - this.svgGroup.appendChild(this.textElement); - this._bindRenderOptions(); - this.box.set({x:0, y:0, width:a, height:b}); ->>>>>>> entrylabs/master }; a.reDraw = function() { if (this.visible) { var a = this.block; - requestAnimationFrame(this._updateContents.bind(this)); + requestAnimFrame(this._updateContents.bind(this)); var c = a.params; if (c) { for (var d = 0;d < c.length;d++) { @@ -20477,7 +18436,7 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldKeyboard); }; a.getDataUrl = function(a, c) { function d() { - g = g.replace("(svgGroup)", (new XMLSerializer).serializeToString(k)).replace("%W", h.width * l).replace("%H", h.height * l).replace("(defs)", (new XMLSerializer).serializeToString(n[0])).replace(/>\s+/g, ">").replace(/\s+\s+/g, ">").replace(/\s+>>>>>> entrylabs/master + a._rightClick = function(a) { + var c = Entry.disposeEvent; + c && c.notify(a); + var d = this, e = d.block; + if (!this.isInBlockMenu) { + var c = [], f = {text:Lang.Blocks.Duplication_option, enable:this.copyable, callback:function() { + Entry.do("cloneBlock", e); + }}, g = {text:Lang.Blocks.CONTEXT_COPY_option, enable:this.copyable, callback:function() { + d.block.copyToClipboard(); + }}, h = {text:Lang.Blocks.Delete_Blocks, enable:e.isDeletable(), callback:function() { + Entry.do("destroyBlock", d.block); + }}, k = {text:Lang.Menus.save_as_image, callback:function() { + d.downloadAsImage(); + }}; + c.push(f); + c.push(g); + c.push(h); + Entry.Utils.isChrome() && "workspace" == Entry.type && !Entry.isMobile() && c.push(k); + a.originalEvent && a.originalEvent.touches && (a = a.originalEvent.touches[0]); + Entry.ContextMenu.show(c, null, {x:a.clientX, y:a.clientY}); + } }; })(Entry.BlockView.prototype); Entry.Field = function() { @@ -20639,7 +18603,7 @@ Entry.Field = function() { this.value != a && (this.value = a, this._block.params[this._index] = a, c && this._blockView.reDraw()); }; a._isEditable = function() { - if (this._block.view.dragMode == Entry.DRAG_MODE_DRAG) { + if (Entry.ContextMenu.visible || this._block.view.dragMode == Entry.DRAG_MODE_DRAG) { return !1; } var a = this._block.view, c = a.getBoard(); @@ -20669,6 +18633,12 @@ Entry.Field = function() { a.unshift(Entry.PARAM); return this._block.pointer(a); }; + a.getFontSize = function(a) { + return a = a || this._blockView.getSkeleton().fontSize || 12; + }; + a.getContentHeight = function() { + return Entry.isMobile() ? 22 : 16; + }; })(Entry.Field.prototype); Entry.FieldBlock = function(a, b, c, d, e) { Entry.Model(this, !1); @@ -20678,7 +18648,6 @@ Entry.FieldBlock = function(a, b, c, d, e) { this.box = new Entry.BoxModel; this.changeEvent = new Entry.Event(this); this._index = c; -<<<<<<< HEAD this.contentIndex = e; this._content = a; this.acceptType = a.accept; @@ -20689,58 +18658,19 @@ Entry.FieldBlock = function(a, b, c, d, e) { this.box.observe(b, "alignContent", ["width", "height"]); this.observe(this, "_updateBG", ["magneting"], !1); this.renderStart(b.getBoard(), d); -======= - this.value = this.getValue() || ""; - this._CONTENT_HEIGHT = this.getContentHeight(); - this.renderStart(); ->>>>>>> entrylabs/master }; Entry.Utils.inherit(Entry.Field, Entry.FieldBlock); (function(a) { a.schema = {magneting:!1}; - a.renderStart = function(a, c) { - this.svgGroup = this._blockView.contentSvgGroup.elem("g"); -<<<<<<< HEAD - 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, c), d.getThread().view.setParent(this)); - this.updateValueBlock(d); - this._blockView.getBoard().constructor !== Entry.Board && this._valueBlock.view.removeControl(); -======= - this.svgGroup.attr({class:"entry-input-field"}); - this.textElement = this.svgGroup.elem("text", {x:3, y:4, "font-size":"12px"}); - this.textElement.textContent = this.truncate(); - var a = this.getTextWidth(), b = this.position && this.position.y ? this.position.y : 0, d = this._CONTENT_HEIGHT; - this._header = this.svgGroup.elem("rect", {width:a, height:d, y:b - d / 2, rx:3, ry:3, fill:"transparent"}); - this.svgGroup.appendChild(this.textElement); - this._bindRenderOptions(); - this.box.set({x:0, y:0, width:a, height:d}); - }; - b.renderOptions = function() { - var a = this; - this._attachDisposeEvent(function() { - a.applyValue(); - a.destroyOption(); - }); - this.optionGroup = Entry.Dom("input", {class:"entry-widget-input-field", parent:$("body")}); - this.optionGroup.val(this.getValue()); - this.optionGroup.on("mousedown", function(a) { - a.stopPropagation(); - }); - this.optionGroup.on("keyup", function(b) { - var c = b.keyCode || b.which; - a.applyValue(b); - -1 < [13, 27].indexOf(c) && a.destroyOption(); - }); - var b = this.getAbsolutePosFromDocument(); - b.y -= this.box.height / 2; - this.optionGroup.css({height:this._CONTENT_HEIGHT, left:b.x, top:b.y, width:a.box.width}); - this.optionGroup.focus(); - b = this.optionGroup[0]; - b.setSelectionRange(0, b.value.length, "backward"); ->>>>>>> entrylabs/master + a.renderStart = function(a, c) { + 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, c), d.getThread().view.setParent(this)); + this.updateValueBlock(d); + this._blockView.getBoard().constructor !== Entry.Board && this._valueBlock.view.removeControl(); }; a.align = function(a, c, d) { var e = this.svgGroup; @@ -21008,20 +18938,12 @@ Entry.Board.OPTION_PASTE = 0; Entry.Board.OPTION_ALIGN = 1; Entry.Board.OPTION_CLEAR = 2; Entry.Board.OPTION_DOWNLOAD = 3; -<<<<<<< HEAD +Entry.Board.DRAG_RADIUS = 5; (function(a) { a.schema = {code:null, dragBlock:null, magnetedBlockView:null, selectedBlockView:null}; a.createView = function(a) { var c = a.dom, c = "string" === typeof c ? $("#" + c) : $(c); if ("DIV" !== c.prop("tagName")) { -======= -Entry.Board.DRAG_RADIUS = 5; -(function(b) { - b.schema = {code:null, dragBlock:null, magnetedBlockView:null, selectedBlockView:null}; - b.createView = function(a) { - var b = a.dom, b = "string" === typeof b ? $("#" + b) : $(b); - if ("DIV" !== b.prop("tagName")) { ->>>>>>> entrylabs/master return console.error("Dom is not div element"); } this.view = c; @@ -21102,16 +19024,9 @@ Entry.Board.DRAG_RADIUS = 5; function c(a) { a.stopPropagation && a.stopPropagation(); a.preventDefault && a.preventDefault(); -<<<<<<< HEAD - a = a.originalEvent && a.originalEvent.touches ? a.originalEvent.touches[0] : a; - var b = f.dragInstance; - f.scroller.scroll(a.pageX - b.offsetX, a.pageY - b.offsetY); - b.set({offsetX:a.pageX, offsetY:a.pageY}); -======= a = Entry.Utils.convertMouseEvent(a); - var c = e.mouseDownCoordinate; - Math.sqrt(Math.pow(a.pageX - c.x, 2) + Math.pow(a.pageY - c.y, 2)) < Entry.Board.DRAG_RADIUS || (f && (clearTimeout(f), f = null), c = e.dragInstance, e.scroller.scroll(a.pageX - c.offsetX, a.pageY - c.offsetY), c.set({offsetX:a.pageX, offsetY:a.pageY})); ->>>>>>> entrylabs/master + var b = e.mouseDownCoordinate; + Math.sqrt(Math.pow(a.pageX - b.x, 2) + Math.pow(a.pageY - b.y, 2)) < Entry.Board.DRAG_RADIUS || (f && (clearTimeout(f), f = null), b = e.dragInstance, e.scroller.scroll(a.pageX - b.offsetX, a.pageY - b.offsetY), b.set({offsetX:a.pageX, offsetY:a.pageY})); } function d(a) { f && (clearTimeout(f), f = null); @@ -21124,29 +19039,18 @@ Entry.Board.DRAG_RADIUS = 5; a.preventDefault && a.preventDefault(); var e = this, f = null; if (0 === a.button || a.originalEvent && a.originalEvent.touches) { -<<<<<<< HEAD - a = a.originalEvent && a.originalEvent.touches ? a.originalEvent.touches[0] : a; - Entry.documentMousedown && Entry.documentMousedown.notify(a); - var e = $(document); - e.bind("mousemove.entryBoard", c); - e.bind("mouseup.entryBoard", d); - e.bind("touchmove.entryBoard", c); - e.bind("touchend.entryBoard", d); - this.dragInstance = new Entry.DragInstance({startX:a.pageX, startY:a.pageY, offsetX:a.pageX, offsetY:a.pageY}); -======= var g = a.type, h = Entry.Utils.convertMouseEvent(a); Entry.documentMousedown && Entry.documentMousedown.notify(h); var k = $(document); this.mouseDownCoordinate = {x:h.pageX, y:h.pageY}; - k.bind("mousemove.entryBoard", b); + k.bind("mousemove.entryBoard", c); k.bind("mouseup.entryBoard", d); - k.bind("touchmove.entryBoard", b); + k.bind("touchmove.entryBoard", c); k.bind("touchend.entryBoard", d); this.dragInstance = new Entry.DragInstance({startX:h.pageX, startY:h.pageY, offsetX:h.pageX, offsetY:h.pageY}); "touchstart" === g && (f = setTimeout(function() { f && (f = null, d(), e._rightClick(a)); }, 1E3)); ->>>>>>> entrylabs/master } else { Entry.Utils.isRightButton(a) && this._rightClick(a); } @@ -21165,15 +19069,9 @@ Entry.Board.DRAG_RADIUS = 5; a instanceof Entry.BlockView ? a.addSelected() : a = null; this.set({selectedBlockView:a}); }; -<<<<<<< HEAD a._keyboardControl = function(a) { var c = this.selectedBlockView; - c && 46 == a.keyCode && c.block && (Entry.do("destroyBlock", c.block), this.set({selectedBlockView:null})); -======= - b._keyboardControl = function(a) { - var b = this.selectedBlockView; - b && 46 == a.keyCode && b.block && !Entry.Utils.isInInput(a) && (Entry.do("destroyBlock", b.block), this.set({selectedBlockView:null})); ->>>>>>> entrylabs/master + c && 46 == a.keyCode && c.block && !Entry.Utils.isInInput(a) && (Entry.do("destroyBlock", c.block), this.set({selectedBlockView:null})); }; a.hide = function() { this.wrapper.addClass("entryRemove"); @@ -21290,35 +19188,20 @@ Entry.Board.DRAG_RADIUS = 5; var k = d.x; d = d.y; for (var l = 0;l < f.length;l++) { -<<<<<<< HEAD - var q = f[l], n = q.view; - n.zIndex = c; - if (n.dragInstance) { -======= var n = f[l], m = n.view; - m.zIndex = b; + m.zIndex = c; if (m.dragInstance) { ->>>>>>> entrylabs/master break; } d += m.y; k += m.x; a = d + 1; -<<<<<<< HEAD - n.magnet.next && (a += n.height, h.push({point:d, endPoint:a, startBlock:q, blocks:[]}), h.push({point:a, blocks:[]}), n.absX = k); - q.statements && (c += .01); - for (var m = 0;m < q.statements.length;m++) { - a = q.statements[m]; - var r = q.view._statements[m]; - r.zIndex = c; -======= m.magnet.next && (a += m.height, h.push({point:d, endPoint:a, startBlock:n, blocks:[]}), h.push({point:a, blocks:[]}), m.absX = k); - n.statements && (b += .01); + n.statements && (c += .01); for (var q = 0;q < n.statements.length;q++) { a = n.statements[q]; var r = n.view._statements[q]; - r.zIndex = b; ->>>>>>> entrylabs/master + r.zIndex = c; r.absX = k + r.x; h.push({point:r.y + d - 30, endPoint:r.y + d, startBlock:r, blocks:[]}); h.push({point:r.y + d + r.height, blocks:[]}); @@ -21354,25 +19237,14 @@ Entry.Board.DRAG_RADIUS = 5; if (m.dragInstance) { break; } -<<<<<<< HEAD - n.zIndex = c; - d += n.y; - k += n.x; - h = h.concat(this._getFieldBlockMetaData(n, k, d, c, e)); - q.statements && (c += .01); - for (var m = 0;m < q.statements.length;m++) { - a = q.statements[m]; - var r = q.view._statements[m], g = g.concat(this._getFieldMagnets(a, c, {x:r.x + k, y:r.y + d}, e)); -======= - m.zIndex = b; + m.zIndex = c; d += m.y; k += m.x; - h = h.concat(this._getFieldBlockMetaData(m, k, d, b, e)); - n.statements && (b += .01); + h = h.concat(this._getFieldBlockMetaData(m, k, d, c, e)); + n.statements && (c += .01); for (var q = 0;q < n.statements.length;q++) { a = n.statements[q]; - var r = n.view._statements[q], g = g.concat(this._getFieldMagnets(a, b, {x:r.x + k, y:r.y + d}, e)); ->>>>>>> entrylabs/master + var r = n.view._statements[q], g = g.concat(this._getFieldMagnets(a, c, {x:r.x + k, y:r.y + d}, e)); } m.magnet.next && (d += m.magnet.next.y, k += m.magnet.next.x); } @@ -21384,21 +19256,12 @@ Entry.Board.DRAG_RADIUS = 5; for (var k = 0;k < g.length;k++) { var l = g[k]; if (l instanceof Entry.FieldBlock) { -<<<<<<< HEAD - var q = l._valueBlock; - if (!q.view.dragInstance && (l.acceptType === f || "boolean" === l.acceptType)) { - var n = c + l.box.x, m = d + l.box.y + a.contentHeight % 1E3 * -.5, r = d + l.box.y + l.box.height; - l.acceptType === f && (h.push({point:m, endPoint:r, startBlock:q, blocks:[]}), h.push({point:r, blocks:[]})); - l = q.view; - l.absX = n; -======= var n = l._valueBlock; if (!n.view.dragInstance && (l.acceptType === f || "boolean" === l.acceptType)) { - var m = b + l.box.x, q = d + l.box.y + a.contentHeight % 1E3 * -.5, r = d + l.box.y + l.box.height; + var m = c + l.box.x, q = d + l.box.y + a.contentHeight % 1E3 * -.5, r = d + l.box.y + l.box.height; l.acceptType === f && (h.push({point:q, endPoint:r, startBlock:n, blocks:[]}), h.push({point:r, blocks:[]})); l = n.view; l.absX = m; ->>>>>>> entrylabs/master l.zIndex = e; h = h.concat(this._getFieldBlockMetaData(l, m + l.contentPos.x, q + l.contentPos.y, e + .01, f)); } @@ -21416,25 +19279,14 @@ Entry.Board.DRAG_RADIUS = 5; if (m.dragInstance) { break; } -<<<<<<< HEAD - n.zIndex = c; - d += n.y; - k += n.x; - h = h.concat(this._getOutputMetaData(n, k, d, c, e)); - q.statements && (c += .01); - for (var m = 0;m < q.statements.length;m++) { - a = q.statements[m]; - var r = q.view._statements[m], g = g.concat(this._getOutputMagnets(a, c, {x:r.x + k, y:r.y + d}, e)); -======= - m.zIndex = b; + m.zIndex = c; d += m.y; k += m.x; - h = h.concat(this._getOutputMetaData(m, k, d, b, e)); - n.statements && (b += .01); + h = h.concat(this._getOutputMetaData(m, k, d, c, e)); + n.statements && (c += .01); for (var q = 0;q < n.statements.length;q++) { a = n.statements[q]; - var r = n.view._statements[q], g = g.concat(this._getOutputMagnets(a, b, {x:r.x + k, y:r.y + d}, e)); ->>>>>>> entrylabs/master + var r = n.view._statements[q], g = g.concat(this._getOutputMagnets(a, c, {x:r.x + k, y:r.y + d}, e)); } m.magnet.next && (d += m.magnet.next.y, k += m.magnet.next.x); } @@ -21445,15 +19297,9 @@ Entry.Board.DRAG_RADIUS = 5; c += a.contentPos.x; d += a.contentPos.y; for (a = 0;a < g.length;a++) { -<<<<<<< HEAD - var k = g[a], l = c + k.box.x, q = d - 24, n = d; - k instanceof Entry.FieldBlock ? (k.acceptType === f && (h.push({point:q, endPoint:n, startBlock:k, blocks:[]}), h.push({point:n, blocks:[]}), k.absX = l, k.zIndex = e, k.width = 20), (q = k._valueBlock) && (h = h.concat(this._getOutputMetaData(q.view, l, d + k.box.y, e + .01, f)))) : k instanceof Entry.FieldOutput && k.acceptType === f && (h.push({point:q, endPoint:n, startBlock:k, blocks:[]}), h.push({point:n, blocks:[]}), k.absX = l, k.zIndex = e, k.width = 20, (q = k._valueBlock) && (q.view.dragInstance || - (h = h.concat(this._getOutputMetaData(q.view, c + k.box.x, d + k.box.y, e + .01, f))))); -======= - var k = g[a], l = b + k.box.x, n = d - 24, m = d; + var k = g[a], l = c + k.box.x, n = d - 24, m = d; k instanceof Entry.FieldBlock ? (k.acceptType === f && (h.push({point:n, endPoint:m, startBlock:k, blocks:[]}), h.push({point:m, blocks:[]}), k.absX = l, k.zIndex = e, k.width = 20), (n = k._valueBlock) && (h = h.concat(this._getOutputMetaData(n.view, l, d + k.box.y, e + .01, f)))) : k instanceof Entry.FieldOutput && k.acceptType === f && (h.push({point:n, endPoint:m, startBlock:k, blocks:[]}), h.push({point:m, blocks:[]}), k.absX = l, k.zIndex = e, k.width = 20, (n = k._valueBlock) && (n.view.dragInstance || - (h = h.concat(this._getOutputMetaData(n.view, b + k.box.x, d + k.box.y, e + .01, f))))); ->>>>>>> entrylabs/master + (h = h.concat(this._getOutputMetaData(n.view, c + k.box.x, d + k.box.y, e + .01, f))))); } return h; }; @@ -21554,18 +19400,18 @@ Entry.Board.DRAG_RADIUS = 5; (!this._offset || 0 === this._offset.top && 0 === this._offset.left) && this.updateOffset(); return this._offset; }; - b._rightClick = function(a) { - var b = Entry.disposeEvent; - b && b.notify(a); + a._rightClick = function(a) { + var c = Entry.disposeEvent; + c && c.notify(a); if (this.visible) { - var b = [], d = this._contextOptions; + var c = [], d = this._contextOptions; d[Entry.Board.OPTION_PASTE].option.enable = !!Entry.clipboard; d[Entry.Board.OPTION_DOWNLOAD].option.enable = 0 !== this.code.getThreads().length; for (var e = 0;e < this._contextOptions.length;e++) { - d[e].activated && b.push(d[e].option); + d[e].activated && c.push(d[e].option); } a = Entry.Utils.convertMouseEvent(a); - Entry.ContextMenu.show(b, null, {x:a.clientX, y:a.clientY}); + Entry.ContextMenu.show(c, null, {x:a.clientX, y:a.clientY}); } }; })(Entry.Board.prototype); @@ -21958,6 +19804,7 @@ Entry.FieldAngle = function(a, b, c) { this._index = c; a = this.getValue(); this.setValue(this.modValue(void 0 !== a ? a : 90)); + this._CONTENT_HEIGHT = this.getContentHeight(); this.renderStart(); }; Entry.Utils.inherit(Entry.Field, Entry.FieldAngle); @@ -21967,11 +19814,11 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldAngle); this.svgGroup = this._blockView.contentSvgGroup.elem("g", {class:"entry-input-field"}); this.textElement = this.svgGroup.elem("text", {x:4, y:4, "font-size":"11px"}); this.textElement.textContent = this.getText(); - var a = this.getTextWidth(), c = this.position && this.position.y ? this.position.y : 0; - this._header = this.svgGroup.elem("rect", {x:0, y:c - 8, rx:3, ry:3, width:a, height:16, rx:3, ry:3, fill:"#fff", "fill-opacity":.4}); + var a = this.getTextWidth(), c = this._CONTENT_HEIGHT; + this._header = this.svgGroup.elem("rect", {x:0, y:(this.position && this.position.y ? this.position.y : 0) - c / 2, rx:3, ry:3, width:a, height:c, rx:3, ry:3, fill:"#fff", "fill-opacity":.4}); this.svgGroup.appendChild(this.textElement); this._bindRenderOptions(); - this.box.set({x:0, y:0, width:a, height:16}); + this.box.set({x:0, y:0, width:a, height:c}); }; a.renderOptions = function() { var a = this; @@ -21981,20 +19828,23 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldAngle); }); this.optionGroup = Entry.Dom("input", {class:"entry-widget-input-field", parent:$("body")}); this.optionGroup.val(this.value); - this.optionGroup.on("mousedown", function(a) { + this.optionGroup.on("mousedown touchstart", function(a) { a.stopPropagation(); }); this.optionGroup.on("keyup", function(c) { - var d = c.keyCode || c.which; + var e = c.keyCode || c.which; a.applyValue(c); - -1 < [13, 27].indexOf(d) && a.destroyOption(); + -1 < [13, 27].indexOf(e) && a.destroyOption(); }); var c = this.getAbsolutePosFromDocument(); c.y -= this.box.height / 2; - this.optionGroup.css({height:16, left:c.x, top:c.y, width:a.box.width}); - this.optionGroup.select(); + this.optionGroup.css({height:this._CONTENT_HEIGHT, left:c.x, top:c.y, width:a.box.width}); this.svgOptionGroup = this.appendSvgOptionGroup(); this.svgOptionGroup.elem("circle", {x:0, y:0, r:49, class:"entry-field-angle-circle"}); + $(this.svgOptionGroup).on("mousedown touchstart", function(c) { + c.stopPropagation(); + a._updateByCoord(c); + }); this._dividerGroup = this.svgOptionGroup.elem("g"); for (c = 0;360 > c;c += 15) { this._dividerGroup.elem("line", {x1:49, y1:0, x2:49 - (0 === c % 45 ? 10 : 5), y2:0, transform:"rotate(" + c + ", 0, 0)", class:"entry-angle-divider"}); @@ -22003,20 +19853,26 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldAngle); c.x += this.box.width / 2; c.y = c.y + this.box.height / 2 + 49 + 1; this.svgOptionGroup.attr({class:"entry-field-angle", transform:"translate(" + c.x + "," + c.y + ")"}); - var c = a.getAbsolutePosFromDocument(), d = [c.x + a.box.width / 2, c.y + a.box.height / 2 + 1]; - $(this.svgOptionGroup).mousemove(function(c) { - a.optionGroup.val(a.modValue(function(a, b) { - var c = b[0] - a[0]; - a = b[1] - a[1] - 49 - 1; - b = Math.atan(-a / c); - b = Entry.toDegrees(b); - b = 90 - b; - 0 > c ? b += 180 : 0 < a && (b += 360); - return 15 * Math.round(b / 15); - }(d, [c.clientX, c.clientY]))); - a.applyValue(); - }); + $(this.svgOptionGroup).bind("mousemove touchmove", this._updateByCoord.bind(this)); + $(this.svgOptionGroup).bind("mouseup touchend", this.destroyOption.bind(this)); this.updateGraph(); + this.optionGroup.focus(); + this.optionGroup.select(); + }; + a._updateByCoord = function(a) { + a.originalEvent && a.originalEvent.touches && (a = a.originalEvent.touches[0]); + a = [a.clientX, a.clientY]; + var c = this.getAbsolutePosFromDocument(); + this.optionGroup.val(this.modValue(function(a, b) { + var c = b[0] - a[0]; + a = b[1] - a[1] - 49 - 1; + b = Math.atan(-a / c); + b = Entry.toDegrees(b); + b = 90 - b; + 0 > c ? b += 180 : 0 < a && (b += 360); + return 15 * Math.round(b / 15); + }([c.x + this.box.width / 2, c.y + this.box.height / 2 + 1], a))); + this.applyValue(); }; a.updateGraph = function() { this._fillPath && this._fillPath.remove(); @@ -22065,6 +19921,8 @@ Entry.FieldColor = function(a, b, c) { this._position = a.position; this.key = a.key; this.setValue(this.getValue() || "#FF0000"); + this._CONTENT_HEIGHT = this.getContentHeight(); + this._CONTENT_WIDTH = this.getContentWidth(); this.renderStart(b); }; Entry.Utils.inherit(Entry.Field, Entry.FieldColor); @@ -22072,11 +19930,11 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldColor); a.renderStart = function() { this.svgGroup && $(this.svgGroup).remove(); this.svgGroup = this._blockView.contentSvgGroup.elem("g", {class:"entry-field-color"}); - var a = this._position, c; - a ? (c = a.x || 0, a = a.y || 0) : (c = 0, a = -8); - this._header = this.svgGroup.elem("rect", {x:c, y:a, width:14.5, height:16, fill:this.getValue()}); + var a = this._CONTENT_HEIGHT, c = this._CONTENT_WIDTH, d = this._position, e; + d ? (e = d.x || 0, d = d.y || 0) : (e = 0, d = -a / 2); + this._header = this.svgGroup.elem("rect", {x:e, y:d, width:c, height:a, fill:this.getValue()}); this._bindRenderOptions(); - this.box.set({x:c, y:a, width:14.5, height:16}); + this.box.set({x:e, y:d, width:c, height:a}); }; a.renderOptions = function() { var a = this; @@ -22107,6 +19965,9 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldColor); a.applyValue = function(a) { this.value != a && (this.setValue(a), this._header.attr({fill:a})); }; + a.getContentWidth = function() { + return Entry.isMobile() ? 20 : 14.5; + }; })(Entry.FieldColor.prototype); Entry.FieldColor.getWidgetColorList = function() { return ["#FFFFFF #CCCCCC #C0C0C0 #999999 #666666 #333333 #000000".split(" "), "#FFCCCC #FF6666 #FF0000 #CC0000 #990000 #660000 #330000".split(" "), "#FFCC99 #FF9966 #FF9900 #FF6600 #CC6600 #993300 #663300".split(" "), "#FFFF99 #FFFF66 #FFCC66 #FFCC33 #CC9933 #996633 #663333".split(" "), "#FFFFCC #FFFF33 #FFFF00 #FFCC00 #999900 #666600 #333300".split(" "), "#99FF99 #66FF99 #33FF33 #33CC00 #009900 #006600 #003300".split(" "), "#99FFFF #33FFFF #66CCCC #00CCCC #339999 #336666 #003333".split(" "), "#CCFFFF #66FFFF #33CCFF #3366FF #3333FF #000099 #000066".split(" "), @@ -22122,8 +19983,8 @@ Entry.FieldDropdown = function(a, b, c) { this._arrowColor = a.arrowColor; this._index = c; this.setValue(this.getValue()); - this._CONTENT_HEIGHT = a.dropdownHeight || b.getSkeleton().dropdownHeight || 16; - this._FONT_SIZE = a.fontSize || b.getSkeleton().fontSize || 12; + this._CONTENT_HEIGHT = this.getContentHeight(a.dropdownHeight); + this._FONT_SIZE = this.getFontSize(a.fontSize); this._ROUND = a.roundValue || 3; this.renderStart(); }; @@ -22132,26 +19993,26 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldDropdown); a.renderStart = function() { this.svgGroup && $(this.svgGroup).remove(); this instanceof Entry.FieldDropdownDynamic && this._updateValue(); - var a = this._blockView; + var a = this._blockView, c = Entry.isMobile(), d = c ? 33 : 20, c = c ? 24 : 10; this.svgGroup = a.contentSvgGroup.elem("g", {class:"entry-field-dropdown"}); - this.textElement = this.svgGroup.elem("text", {x:2}); + this.textElement = this.svgGroup.elem("text", {x:5}); this.textElement.textContent = this.getTextByValue(this.getValue()); - var c = this.textElement.getBBox(); - this.textElement.attr({style:"white-space: pre;", "font-size":+this._FONT_SIZE + "px", y:.25 * c.height}); - c = this.textElement.getComputedTextLength() + 16; - this._noArrow && (c -= 12); - var d = this._CONTENT_HEIGHT; - this._header = this.svgGroup.elem("rect", {width:c, height:d, y:-d / 2, rx:this._ROUND, ry:this._ROUND, fill:"#fff", "fill-opacity":.4}); + a = this.textElement.getBBox(); + this.textElement.attr({style:"white-space: pre;", "font-size":+this._FONT_SIZE + "px", y:.23 * a.height}); + d = this.textElement.getComputedTextLength() + d; + this._noArrow && (d -= c); + c = this._CONTENT_HEIGHT; + this._header = this.svgGroup.elem("rect", {width:d, height:c, y:-c / 2, rx:this._ROUND, ry:this._ROUND, fill:"#fff", "fill-opacity":.4}); this.svgGroup.appendChild(this.textElement); - this._noArrow || (a = this._arrowColor || a._schema.color, this._arrow = this.svgGroup.elem("polygon", {points:"0,-2.1 6.4,-2.1 3.2,2.1", fill:a, stroke:a, transform:"translate(" + (c - 11) + ",0)"})); + this._noArrow || (a = this.getArrow(), this._arrow = this.svgGroup.elem("polygon", {points:a.points, fill:a.color, stroke:a.color, transform:"translate(" + (d - a.width - 5) + "," + -a.height / 2 + ")"})); this._bindRenderOptions(); - this.box.set({x:0, y:0, width:c, height:d}); + this.box.set({x:0, y:0, width:d, height:c}); }; a.resize = function() { - var a = this.textElement.getComputedTextLength() + 18; - this._noArrow ? a -= 14 : this._arrow.attr({transform:"translate(" + (a - 11) + ",0)"}); - this._header.attr({width:a}); - this.box.set({width:a}); + var a = Entry.isMobile(), c = a ? 33 : 20, a = a ? 24 : 10, c = this.textElement.getComputedTextLength() + c; + this._noArrow ? c -= a : (a = this.getArrow(), this._arrow.attr({transform:"translate(" + (c - a.width - 5) + "," + -a.height / 2 + ")"})); + this._header.attr({width:c}); + this.box.set({width:c}); this._block.view.alignContent(); }; a.renderOptions = function() { @@ -22210,6 +20071,13 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldDropdown); } return Lang.Blocks.no_target; }; + a.getContentHeight = function(a) { + return a = a || this._blockView.getSkeleton().dropdownHeight || (Entry.isMobile() ? 22 : 16); + }; + a.getArrow = function() { + var a = Entry.isMobile(); + return {color:this._arrowColor || this._blockView._schema.color, points:a ? "0,0 19,0 9.5,13" : "0,0 6.4,0 3.2,4.2", height:a ? 13 : 4.2, width:a ? 19 : 6.4}; + }; })(Entry.FieldDropdown.prototype); Entry.FieldDropdownDynamic = function(a, b, c) { this._block = b.block; @@ -22221,8 +20089,8 @@ Entry.FieldDropdownDynamic = function(a, b, c) { this._arrowColor = a.arrowColor; c = this._contents.menuName; Entry.Utils.isFunction(c) ? this._menuGenerator = c : this._menuName = c; - this._CONTENT_HEIGHT = a.dropdownHeight || b.getSkeleton().dropdownHeight || 16; - this._FONT_SIZE = a.fontSize || b.getSkeleton().fontSize || 12; + this._CONTENT_HEIGHT = this.getContentHeight(a.dropdownHeight); + this._FONT_SIZE = this.getFontSize(a.fontSize); this._ROUND = a.roundValue || 3; this.renderStart(b); }; @@ -22335,6 +20203,7 @@ Entry.FieldKeyboard = function(a, b, c) { this._contents = a; this._index = c; this.setValue(String(this.getValue())); + this._CONTENT_HEIGHT = this.getContentHeight(); this._optionVisible = !1; this.renderStart(b); }; @@ -22343,13 +20212,13 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldKeyboard); a.renderStart = function() { this.svgGroup && $(this.svgGroup).remove(); this.svgGroup = this._blockView.contentSvgGroup.elem("g", {class:"entry-input-field"}); - this.textElement = this.svgGroup.elem("text").attr({x:4, y:4, "font-size":"11px"}); + this.textElement = this.svgGroup.elem("text").attr({x:5, y:4, "font-size":"11px"}); this.textElement.textContent = Entry.getKeyCodeMap()[this.getValue()]; - var a = this.getTextWidth(), c = this.position && this.position.y ? this.position.y : 0; - this._header = this.svgGroup.elem("rect", {x:0, y:c - 8, width:a, height:16, rx:3, ry:3, fill:"#fff", "fill-opacity":.4}); + var a = this.getTextWidth() + 1, c = this._CONTENT_HEIGHT; + this._header = this.svgGroup.elem("rect", {x:0, y:(this.position && this.position.y ? this.position.y : 0) - c / 2, width:a, height:c, rx:3, ry:3, fill:"#fff", "fill-opacity":.4}); this.svgGroup.appendChild(this.textElement); this._bindRenderOptions(); - this.box.set({x:0, y:0, width:a, height:16}); + this.box.set({x:0, y:0, width:a, height:c}); }; a.renderOptions = function() { Entry.keyPressed && (this.keyPressed = Entry.keyPressed.attach(this, this._keyboardControl)); @@ -22383,13 +20252,13 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldKeyboard); this.resize(); }; a.resize = function() { - var a = this.getTextWidth(); + var a = this.getTextWidth() + 1; this._header.attr({width:a}); this.box.set({width:a}); this._blockView.alignContent(); }; a.getTextWidth = function() { - return this.textElement.getComputedTextLength() + 8; + return this.textElement.getComputedTextLength() + 10; }; a.destroy = function() { this.destroyOption(); @@ -22660,6 +20529,7 @@ Entry.FieldTextInput = function(a, b, c) { this._contents = a; this._index = c; this.value = this.getValue() || ""; + this._CONTENT_HEIGHT = this.getContentHeight(); this.renderStart(); }; Entry.Utils.inherit(Entry.Field, Entry.FieldTextInput); @@ -22670,11 +20540,11 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldTextInput); this.svgGroup.attr({class:"entry-input-field"}); this.textElement = this.svgGroup.elem("text", {x:3, y:4, "font-size":"12px"}); this.textElement.textContent = this.truncate(); - var a = this.getTextWidth(), c = this.position && this.position.y ? this.position.y : 0; - this._header = this.svgGroup.elem("rect", {width:a, height:16, y:c - 8, rx:3, ry:3, fill:"transparent"}); + var a = this.getTextWidth(), c = this._CONTENT_HEIGHT; + this._header = this.svgGroup.elem("rect", {width:a, height:c, y:(this.position && this.position.y ? this.position.y : 0) - c / 2, rx:3, ry:3, fill:"transparent"}); this.svgGroup.appendChild(this.textElement); this._bindRenderOptions(); - this.box.set({x:0, y:0, width:a, height:16}); + this.box.set({x:0, y:0, width:a, height:c}); }; a.renderOptions = function() { var a = this; @@ -22694,12 +20564,11 @@ Entry.Utils.inherit(Entry.Field, Entry.FieldTextInput); }); var c = this.getAbsolutePosFromDocument(); c.y -= this.box.height / 2; - this.optionGroup.css({height:16, left:c.x, top:c.y, width:a.box.width}); + this.optionGroup.css({height:this._CONTENT_HEIGHT, left:c.x, top:c.y, width:a.box.width}); this.optionGroup.focus(); c = this.optionGroup[0]; c.setSelectionRange(0, c.value.length, "backward"); }; -<<<<<<< HEAD a.applyValue = function(a) { a = this.optionGroup.val(); this.setValue(a); @@ -22734,136 +20603,6 @@ Entry.GlobalSvg = {}; this.top = this.left = 0; this._inited = !0; } -======= - for (var e = 0;e < Entry.fonts.length;e++) { - var f = Entry.fonts[e], g = Entry.createElement("option"); - g.value = f.family; - g.innerHTML = f.name; - d.appendChild(g); - } - this.fontName_ = d; - c.appendChild(d); - e = Entry.createElement("ul"); - e.addClass("entryPlayground_text_buttons"); - b.appendChild(e); - c = Entry.createElement("li"); - c.addClass("entryPlaygroundTextAlignLeft"); - c.bindOnClick(function(a) { - Entry.playground.setFontAlign(Entry.TEXT_ALIGN_LEFT); - }); - e.appendChild(c); - this.alignLeftBtn = c; - c = Entry.createElement("li"); - c.addClass("entryPlaygroundTextAlignCenter"); - c.bindOnClick(function(a) { - Entry.playground.setFontAlign(Entry.TEXT_ALIGN_CENTER); - }); - e.appendChild(c); - this.alignCenterBtn = c; - c = Entry.createElement("li"); - c.addClass("entryPlaygroundTextAlignRight"); - c.bindOnClick(function(a) { - Entry.playground.setFontAlign(Entry.TEXT_ALIGN_RIGHT); - }); - e.appendChild(c); - this.alignRightBtn = c; - c = Entry.createElement("li"); - e.appendChild(c); - d = Entry.createElement("a"); - c.appendChild(d); - d.bindOnClick(function() { - Entry.playground.object.entity.toggleFontBold() ? h.src = Entry.mediaFilePath + "text_button_bold_true.png" : h.src = Entry.mediaFilePath + "text_button_bold_false.png"; - }); - var h = Entry.createElement("img", "entryPlaygroundText_boldImage"); - d.appendChild(h); - h.src = Entry.mediaFilePath + "text_button_bold_false.png"; - c = Entry.createElement("li"); - e.appendChild(c); - d = Entry.createElement("a"); - c.appendChild(d); - d.bindOnClick(function() { - var a = !Entry.playground.object.entity.getUnderLine() || !1; - k.src = Entry.mediaFilePath + "text_button_underline_" + a + ".png"; - Entry.playground.object.entity.setUnderLine(a); - }); - var k = Entry.createElement("img", "entryPlaygroundText_underlineImage"); - d.appendChild(k); - k.src = Entry.mediaFilePath + "text_button_underline_false.png"; - c = Entry.createElement("li"); - e.appendChild(c); - d = Entry.createElement("a"); - c.appendChild(d); - d.bindOnClick(function() { - Entry.playground.object.entity.toggleFontItalic() ? l.src = Entry.mediaFilePath + "text_button_italic_true.png" : l.src = Entry.mediaFilePath + "/text_button_italic_false.png"; - }); - var l = Entry.createElement("img", "entryPlaygroundText_italicImage"); - d.appendChild(l); - l.src = Entry.mediaFilePath + "text_button_italic_false.png"; - c = Entry.createElement("li"); - e.appendChild(c); - d = Entry.createElement("a"); - c.appendChild(d); - d.bindOnClick(function() { - var a = !Entry.playground.object.entity.getStrike() || !1; - Entry.playground.object.entity.setStrike(a); - n.src = Entry.mediaFilePath + "text_button_strike_" + a + ".png"; - }); - var n = Entry.createElement("img", "entryPlaygroundText_strikeImage"); - d.appendChild(n); - n.src = Entry.mediaFilePath + "text_button_strike_false.png"; - d = Entry.createElement("li"); - e.appendChild(d); - c = Entry.createElement("a"); - d.appendChild(c); - c.bindOnClick(function() { - Entry.playground.toggleColourChooser("foreground"); - }); - d = Entry.createElement("img"); - c.appendChild(d); - d.src = Entry.mediaFilePath + "text_button_color_false.png"; - c = Entry.createElement("li"); - e.appendChild(c); - e = Entry.createElement("a"); - c.appendChild(e); - e.bindOnClick(function() { - Entry.playground.toggleColourChooser("background"); - }); - c = Entry.createElement("img"); - e.appendChild(c); - c.src = Entry.mediaFilePath + "text_button_background_false.png"; - e = Entry.createElement("div"); - e.addClass("entryPlayground_fgColorDiv"); - c = Entry.createElement("div"); - c.addClass("entryPlayground_bgColorDiv"); - b.appendChild(e); - b.appendChild(c); - d = Entry.createElement("div"); - d.addClass("entryPlaygroundTextColoursWrapper"); - this.coloursWrapper = d; - a.appendChild(d); - b = Entry.getColourCodes(); - for (e = 0;e < b.length;e++) { - c = Entry.createElement("div"), c.addClass("modal_colour"), c.setAttribute("colour", b[e]), c.style.backgroundColor = b[e], 0 === e && c.addClass("modalColourTrans"), c.bindOnClick(function(a) { - Entry.playground.setTextColour(a.target.getAttribute("colour")); - }), d.appendChild(c); - } - d.style.display = "none"; - d = Entry.createElement("div"); - d.addClass("entryPlaygroundTextBackgroundsWrapper"); - this.backgroundsWrapper = d; - a.appendChild(d); - for (e = 0;e < b.length;e++) { - c = Entry.createElement("div"), c.addClass("modal_colour"), c.setAttribute("colour", b[e]), c.style.backgroundColor = b[e], 0 === e && c.addClass("modalColourTrans"), c.bindOnClick(function(a) { - Entry.playground.setBackgroundColour(a.target.getAttribute("colour")); - }), d.appendChild(c); - } - d.style.display = "none"; - b = Entry.createElement("input"); - b.addClass("entryPlayground_textBox"); - b.onkeyup = function() { - Entry.playground.object.setText(this.value); - Entry.playground.object.entity.setText(this.value); ->>>>>>> entrylabs/master }; a.setView = function(a, c) { if (a != this._view && !a.block.isReadOnly() && a.movable) { @@ -22881,7 +20620,6 @@ Entry.GlobalSvg = {}; a.remove = function() { this.svgGroup && (this.svgGroup.remove(), delete this.svgGroup, delete this._view, delete this._offsetX, delete this._offsetY, delete this._startX, delete this._startY, this.hide()); }; -<<<<<<< HEAD a.align = function() { var a = this._view.getSkeleton().box(this._view).offsetX || 0, c = this._view.getSkeleton().box(this._view).offsetY || 0, a = -1 * a + 1, c = -1 * c + 1; this._offsetX = a; @@ -22901,153 +20639,6 @@ Entry.GlobalSvg = {}; this.left = c.x + a.left - this._offsetX; this.top = c.y + a.top - this._offsetY; this.svgDom.css({transform:"translate3d(" + this.left + "px," + this.top + "px, 0px)"}); -======= - this.textEditArea = b; - a.appendChild(b); - b = Entry.createElement("div"); - b.addClass("entryPlaygroundFontSizeWrapper"); - a.appendChild(b); - this.fontSizeWrapper = b; - var m = Entry.createElement("div"); - m.addClass("entryPlaygroundFontSizeSlider"); - b.appendChild(m); - var q = Entry.createElement("div"); - q.addClass("entryPlaygroundFontSizeIndicator"); - m.appendChild(q); - this.fontSizeIndiciator = q; - var r = Entry.createElement("div"); - r.addClass("entryPlaygroundFontSizeKnob"); - m.appendChild(r); - this.fontSizeKnob = r; - e = Entry.createElement("div"); - e.addClass("entryPlaygroundFontSizeLabel"); - e.innerHTML = "\uae00\uc790 \ud06c\uae30"; - b.appendChild(e); - var t = !1, u = 0; - r.onmousedown = function(a) { - t = !0; - u = $(m).offset().left; - }; - r.addEventListener("touchstart", function(a) { - t = !0; - u = $(m).offset().left; - }); - document.addEventListener("mousemove", function(a) { - t && (a = a.pageX - u, a = Math.max(a, 5), a = Math.min(a, 88), r.style.left = a + "px", a /= .88, q.style.width = a + "%", Entry.playground.object.entity.setFontSize(a)); - }); - document.addEventListener("touchmove", function(a) { - t && (a = a.touches[0].pageX - u, a = Math.max(a, 5), a = Math.min(a, 88), r.style.left = a + "px", a /= .88, q.style.width = a + "%", Entry.playground.object.entity.setFontSize(a)); - }); - document.addEventListener("mouseup", function(a) { - t = !1; - }); - document.addEventListener("touchend", function(a) { - t = !1; - }); - b = Entry.createElement("div"); - b.addClass("entryPlaygroundLinebreakWrapper"); - a.appendChild(b); - a = Entry.createElement("hr"); - a.addClass("entryPlaygroundLinebreakHorizontal"); - b.appendChild(a); - a = Entry.createElement("div"); - a.addClass("entryPlaygroundLinebreakButtons"); - b.appendChild(a); - e = Entry.createElement("img"); - e.bindOnClick(function() { - Entry.playground.toggleLineBreak(!1); - v.innerHTML = Lang.Menus.linebreak_off_desc_1; - x.innerHTML = Lang.Menus.linebreak_off_desc_2; - y.innerHTML = Lang.Menus.linebreak_off_desc_3; - }); - e.src = Entry.mediaFilePath + "text-linebreak-off-true.png"; - a.appendChild(e); - this.linebreakOffImage = e; - e = Entry.createElement("img"); - e.bindOnClick(function() { - Entry.playground.toggleLineBreak(!0); - v.innerHTML = Lang.Menus.linebreak_on_desc_1; - x.innerHTML = Lang.Menus.linebreak_on_desc_2; - y.innerHTML = Lang.Menus.linebreak_on_desc_3; - }); - e.src = Entry.mediaFilePath + "text-linebreak-on-false.png"; - a.appendChild(e); - this.linebreakOnImage = e; - a = Entry.createElement("div"); - a.addClass("entryPlaygroundLinebreakDescription"); - b.appendChild(a); - var v = Entry.createElement("p"); - v.innerHTML = Lang.Menus.linebreak_off_desc_1; - a.appendChild(v); - b = Entry.createElement("ul"); - a.appendChild(b); - var x = Entry.createElement("li"); - x.innerHTML = Lang.Menus.linebreak_off_desc_2; - b.appendChild(x); - var y = Entry.createElement("li"); - y.innerHTML = Lang.Menus.linebreak_off_desc_3; - b.appendChild(y); -}; -Entry.Playground.prototype.generateSoundView = function(b) { - if ("workspace" == Entry.type) { - var a = Entry.createElement("div", "entryAddSound"); - a.addClass("entryPlaygroundAddSound"); - a.bindOnClick(function(a) { - Entry.dispatchEvent("openSoundManager"); - }); - var c = Entry.createElement("div", "entryAddSoundInner"); - c.addClass("entryPlaygroundAddSoundInner"); - c.innerHTML = Lang.Workspace.sound_add; - a.appendChild(c); - b.appendChild(a); - a = Entry.createElement("ul", "entrySoundList"); - a.addClass("entryPlaygroundSoundList"); - $ && $(a).sortable({start:function(a, b) { - b.item.data("start_pos", b.item.index()); - }, stop:function(a, b) { - var c = b.item.data("start_pos"), g = b.item.index(); - Entry.playground.moveSound(c, g); - }, axis:"y"}); - b.appendChild(a); - this.soundListView_ = a; - } else { - "phone" == Entry.type && (a = Entry.createElement("div", "entryAddSound"), a.addClass("entryPlaygroundAddSoundPhone"), a.bindOnClick(function(a) { - Entry.dispatchEvent("openSoundManager"); - }), c = Entry.createElement("div", "entryAddSoundInner"), c.addClass("entryPlaygroundAddSoundInnerPhone"), c.innerHTML = Lang.Workspace.sound_add, a.appendChild(c), b.appendChild(a), a = Entry.createElement("ul", "entrySoundList"), a.addClass("entryPlaygroundSoundListPhone"), $ && $(a).sortable({start:function(a, b) { - b.item.data("start_pos", b.item.index()); - }, stop:function(a, b) { - var c = b.item.data("start_pos"), g = b.item.index(); - Entry.playground.moveSound(c, g); - }, axis:"y"}), b.appendChild(a), this.soundListView_ = a); - } -}; -Entry.Playground.prototype.injectObject = function(b) { - if (!b) { - this.changeViewMode("code"), this.object = null; - } else { - if (b !== this.object) { - this.object && this.object.toggleInformation(!1); - this.object = b; - this.setMenu(b.objectType); - this.injectCode(); - "sprite" == b.objectType && Entry.pictureEditable ? (this.tabViewElements.text && this.tabViewElements.text.addClass("entryRemove"), this.tabViewElements.picture && this.tabViewElements.picture.removeClass("entryRemove")) : "textBox" == b.objectType && (this.tabViewElements.picture && this.tabViewElements.picture.addClass("entryRemove"), this.tabViewElements.text && this.tabViewElements.text.removeClass("entryRemove")); - var a = this.viewMode_; - "default" == a ? this.changeViewMode("code") : "picture" != a && "text" != a || "textBox" != b.objectType ? "text" != a && "picture" != a || "sprite" != b.objectType ? "sound" == a && this.changeViewMode("sound") : this.changeViewMode("picture") : this.changeViewMode("text"); - this.reloadPlayground(); - } - } -}; -Entry.Playground.prototype.injectCode = function() { - var b = this.mainWorkspace; - b.changeBoardCode(this.object.script); - b.getBoard().adjustThreadsPosition(); -}; -Entry.Playground.prototype.injectPicture = function() { - var b = this.pictureListView_; - if (b) { - for (;b.hasChildNodes();) { - b.removeChild(b.lastChild); ->>>>>>> entrylabs/master } }; a.terminateDrag = function(a) { @@ -23172,7 +20763,6 @@ Entry.ThreadView = function(a, b) { this.svgGroup = b.svgThreadGroup.elem("g"); this.parent = b; }; -<<<<<<< HEAD (function(a) { a.schema = {height:0, zIndex:0}; a.destroy = function() { @@ -23187,18 +20777,6 @@ Entry.ThreadView = function(a, b) { a.renderText = function() { for (var a = this.thread.getBlocks(), c = 0;c < a.length;c++) { a[c].view.renderText(); -======= -Entry.Playground.prototype.initializeResizeHandle = function(b) { - $(b).bind("mousedown touchstart", function(a) { - Entry.playground.resizing = !0; - Entry.documentMousemove && (Entry.playground.resizeEvent = Entry.documentMousemove.attach(this, function(a) { - Entry.playground.resizing && Entry.resizeElement({menuWidth:a.clientX - Entry.interfaceState.canvasWidth}); - })); - }); - $(document).bind("mouseup touchend", function(a) { - if (a = Entry.playground.resizeEvent) { - Entry.playground.resizing = !1, Entry.documentMousemove.detach(a), delete Entry.playground.resizeEvent; ->>>>>>> entrylabs/master } }; a.renderBlock = function() { diff --git a/dist/entry.min.js b/dist/entry.min.js index c40152955f..f238622b4a 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -696,7 +696,6 @@ this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInp Entry.block.xbot_buzzer=function(a,b){a=Entry.hw.sendQueue;var c=b.getStringField("NOTE",b),d=b.getStringField("OCTAVE",b),e=b.getNumberValue("VALUE",b),c=c+d;a.note="C2"==c?65:"D2"==c?73:"E2"==c?82:"F2"==c?87:"G2"==c?98:"A2"==c?110:"B2"==c?123:"C3"==c?131:"D3"==c?147:"E3"==c?165:"F3"==c?175:"G3"==c?196:"A3"==c?220:"B3"==c?247:"C4"==c?262:"D4"==c?294:"E4"==c?330:"F4"==c?349:"G4"==c?392:"A4"==c?440:"B4"==c?494:"C5"==c?523:"D5"==c?587:"E5"==c?659:"F5"==c?698:"G5"==c?784:"A5"==c?880:"B5"==c?988:"C6"== c?1047:"D6"==c?1175:"E6"==c?1319:"F6"==c?1397:"G6"==c?1568:"A6"==c?1760:"B6"==c?1976:"C7"==c?2093:"D7"==c?2349:"E7"==c?2637:"F7"==c?2794:"G7"==c?3136:"A7"==c?3520:"B7"==c?3951:262;a.duration=40*e;return b.callReturn()}; Blockly.Blocks.xbot_lcd={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("LCD").appendField(new Blockly.FieldDropdown([["0","0"],["1","1"]]),"LINE").appendField(Lang.Blocks.XBOT_Line).appendField(", ").appendField(Lang.Blocks.XBOT_outputValue);this.appendValueInput("VALUE").setCheck(["String","Number"]);this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0); -<<<<<<< HEAD this.setNextStatement(!0)}};Entry.block.xbot_lcd=function(a,b){a=Entry.hw.sendQueue;var c=b.getNumberField("LINE",b),d=b.getStringValue("VALUE",b);0==c?(a.lcdNum=0,a.lcdTxt=d):1==c&&(a.lcdNum=1,a.lcdTxt=d);return b.callReturn()};Entry.Collection=function(a){this.length=0;this._hashMap={};this._observers=[];this.set(a)}; (function(a,b){a.set=function(a){for(;this.length;)b.pop.call(this);var d=this._hashMap,e;for(e in d)delete d[e];if(void 0!==a){e=0;for(var f=a.length;e=a.length&&(l&&clearInterval(l),c==a.length))return b(),!0}var h=document.createElement("span");h.innerHTML="giItT1WQy@!-/#";h.style.position="absolute";h.style.left="-10000px";h.style.top="-10000px";h.style.fontSize="300px";h.style.fontFamily="sans-serif";h.style.fontVariant="normal";h.style.fontStyle="normal";h.style.fontWeight= -"normal";h.style.letterSpacing="0";document.body.appendChild(h);var k=h.offsetWidth;h.style.fontFamily=d;var l;e()||(l=setInterval(e,50))})(a[d])};window.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(a){window.setTimeout(a,1E3/60)}}();Entry.Model=function(a,b){var c=Entry.Model;c.generateSchema(a);c.generateSetter(a);c.generateObserve(a);(void 0===b||b)&&Object.seal(a);return a}; +"normal";h.style.letterSpacing="0";document.body.appendChild(h);var k=h.offsetWidth;h.style.fontFamily=d;var l;e()||(l=setInterval(e,50))})(a[d])};window.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(a){window.setTimeout(a,1E3/60)}}(); +Entry.isMobile=function(){if(Entry.device)return"tablet"===Entry.device;var a=window.platform;if(a&&a.type&&("tablet"===a.type||"mobile"===a.type))return Entry.device="tablet",!0;Entry.device="desktop";return!1};Entry.Utils.convertMouseEvent=function(a){return a.originalEvent&&a.originalEvent.touches?a.originalEvent.touches[0]:a};Entry.Model=function(a,b){var c=Entry.Model;c.generateSchema(a);c.generateSetter(a);c.generateObserve(a);(void 0===b||b)&&Object.seal(a);return a}; (function(a){a.generateSchema=function(b){var a=b.schema;if(void 0!==a){a=JSON.parse(JSON.stringify(a));b.data={};for(var d in a)(function(d){b.data[d]=a[d];Object.defineProperty(b,d,{get:function(){return b.data[d]}})})(d);b._toJSON=this._toJSON}};a.generateSetter=function(b){b.set=this.set};a.set=function(b,a){var d={},e;for(e in this.data)void 0!==b[e]&&(b[e]===this.data[e]?delete b[e]:(d[e]=this.data[e],this.data[e]=b[e]instanceof Array?b[e].concat():b[e]));a||this.notify(Object.keys(b),d)};a.generateObserve= function(b){b.observers=[];b.observe=this.observe;b.unobserve=this.unobserve;b.notify=this.notify};a.observe=function(b,a,d,e){d=new Entry.Observer(this.observers,b,a,d);if(!1!==e)b[a]([]);return d};a.unobserve=function(b){b.destroy()};a.notify=function(b,a){"string"===typeof b&&(b=[b]);var d=this;d.observers.map(function(e){var f=b;void 0!==e.attrs&&(f=Entry.Utils.intersectArray(e.attrs,b));if(f.length)e.object[e.funcName](f.map(function(b){return{name:b,object:d,oldValue:a[b]}}))})};a._toJSON=function(){var b= {},a;for(a in this.data)b[a]=this.data[a];return b}})(Entry.Model);Entry.Observer=function(a,b,c,d){this.parent=a;this.object=b;this.funcName=c;this.attrs=d;a.push(this)};(function(a){a.destroy=function(){var b=this.parent,a=b.indexOf(this);-1/,d;d=a instanceof HTMLElement?$(a):a instanceof jQuery?a:c.test(a)?$(a):$("<"+a+">");if(void 0===b)return d;b.id&&d.attr("id",b.id);b.class&&d.addClass(b.class);b.classes&&b.classes.map(function(b){d.addClass(b)});b.src&&d.attr("src",b.src);b.parent&&b.parent.append(d);d.bindOnClick=function(){var b,a,c=function(b){b.stopImmediatePropagation();b.handled||(b.handled=!0,a.call(this,b))};1/,d;d=a instanceof HTMLElement?$(a):a instanceof jQuery?a:c.test(a)?$(a):$("<"+a+">");if(void 0===b)return d;b.id&&d.attr("id",b.id);b.class&&d.addClass(b.class);b.classes&&b.classes.map(function(b){d.addClass(b)});b.src&&d.attr("src",b.src);b.parent&&b.parent.append(d);d.bindOnClick=function(){var b,a,c=function(b){b.stopImmediatePropagation();b.handled||(b.handled=!0,a.call(this,b))};1c;c++)(function(c){var e=Entry.createElement("td","progressCell"+c);e.bindOnClick(function(){Entry.engine.setSpeedMeter(b[c])});a.appendChild(e)})(c);this.view_.insertBefore(this.speedProgress_,this.maximizeButton);this.speedProgress_.appendChild(a);this.speedHandle_=Entry.createElement("div","entrySpeedHandleWorkspace");c=(Entry.interfaceState.canvasWidth-84)/5;$(this.speedHandle_).draggable({axis:"x",grid:[c,c],containment:[80,0,4*c+80,0],drag:function(b,a){b=(a.position.left-80)/(Entry.interfaceState.canvasWidth- -84)*5;b=Math.floor(b);0>b||Entry.engine.setSpeedMeter(Entry.engine.speeds[b])}});this.view_.insertBefore(this.speedHandle_,this.maximizeButton);this.setSpeedMeter(Entry.FPS)}}; +0;5>c;c++)(function(c){var d=Entry.createElement("td","progressCell"+c);d.bindOnClick(function(){Entry.engine.setSpeedMeter(b[c])});a.appendChild(d)})(c);this.view_.insertBefore(this.speedProgress_,this.maximizeButton);this.speedProgress_.appendChild(a);this.speedHandle_=Entry.createElement("div","entrySpeedHandleWorkspace");var d=(Entry.interfaceState.canvasWidth-84)/5;$(this.speedHandle_).bind("mousedown.speedPanel touchstart.speedPanel",function(b){function a(b){b.stopPropagation();b=Entry.Utils.convertMouseEvent(b); +b=Math.floor((b.clientX-80)/(5*d)*5);0>b||4b||(b=Math.min(4,b),b=Math.max(0,b),this.speedPanelOn&&(this.speedHandle_.style.left=(Entry.interfaceState.canvasWidth-80)/10*(2*b+1)+80-9+"px"),Entry.FPS!=a&&(clearInterval(this.ticker),this.ticker=setInterval(this.update,Math.floor(1E3/a)),Entry.FPS=a))};Entry.Engine.prototype.start=function(a){createjs.Ticker.setFPS(Entry.FPS);this.ticker=setInterval(this.update,Math.floor(1E3/Entry.FPS))}; -Entry.Engine.prototype.stop=function(){clearInterval(this.ticker);this.ticker=null};Entry.Engine.prototype.update=function(){Entry.engine.isState("run")&&(Entry.engine.computeObjects(),Entry.hw.update())};Entry.Engine.prototype.computeObjects=function(){Entry.container.mapObjectOnScene(this.computeFunction)};Entry.Engine.prototype.computeFunction=function(a){a.script.tick()}; +Entry.Engine.prototype.stop=function(){clearInterval(this.ticker);this.ticker=null};Entry.Engine.prototype.update=function(){Entry.engine.isState("run")&&(Entry.engine.computeObjects(),Entry.engine.executeQueue(),Entry.hw.update())};Entry.Engine.prototype.computeObjects=function(){Entry.container.mapObjectOnScene(this.computeFunction)};Entry.Engine.prototype.computeFunction=function(a){a.script.tick()}; Entry.Engine.computeThread=function(a,b){Entry.engine.isContinue=!0;for(a=!1;b&&Entry.engine.isContinue&&!a;){Entry.engine.isContinue=!b.isRepeat;var c=b.run();a=c&&c===b;b=c}return b};Entry.Engine.prototype.isState=function(a){return-1b||0>d||b>e||d>e||a.splice.call(this,d,0,a.splice.call(this,b,1)[0])};b.sort=function(){};b.fromJSON=function(){};b.toJSON=function(){for(var a=[],b=0,e=this.length;b/,d;d=b instanceof HTMLElement?$(b):b instanceof jQuery?b:c.test(b)?$(b):$("<"+b+">");if(void 0===a)return d;a.id&&d.attr("id",a.id);a.class&&d.addClass(a.class);a.classes&&a.classes.map(function(a){d.addClass(a)});a.src&&d.attr("src",a.src);a.parent&&a.parent.append(d);d.bindOnClick=function(){var a,b,c=function(a){a.stopImmediatePropagation();a.handled||(a.handled=!0,b.call(this,a))};1b.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.requestUpdate=!0};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()||-1c;c++)(function(c){var d=Entry.createElement("td","progressCell"+c);d.bindOnClick(function(){Entry.engine.setSpeedMeter(a[c])});b.appendChild(d)})(c);this.view_.insertBefore(this.speedProgress_,this.maximizeButton);this.speedProgress_.appendChild(b);this.speedHandle_=Entry.createElement("div","entrySpeedHandleWorkspace");var d=(Entry.interfaceState.canvasWidth-84)/5;$(this.speedHandle_).bind("mousedown.speedPanel touchstart.speedPanel",function(a){function b(a){a.stopPropagation();a=Entry.Utils.convertMouseEvent(a); -a=Math.floor((a.clientX-80)/(5*d)*5);0>a||4a||(a=Math.min(4,a),a=Math.max(0,a),this.speedPanelOn&&(this.speedHandle_.style.left=(Entry.interfaceState.canvasWidth-80)/10*(2*a+1)+80-9+"px"),Entry.FPS!=b&&(clearInterval(this.ticker),this.ticker=setInterval(this.update,Math.floor(1E3/b)),Entry.FPS=b))};Entry.Engine.prototype.start=function(b){createjs.Ticker.setFPS(Entry.FPS);this.ticker=setInterval(this.update,Math.floor(1E3/Entry.FPS))}; -Entry.Engine.prototype.stop=function(){clearInterval(this.ticker);this.ticker=null};Entry.Engine.prototype.update=function(){Entry.engine.isState("run")&&(Entry.engine.computeObjects(),Entry.engine.executeQueue(),Entry.hw.update())};Entry.Engine.prototype.computeObjects=function(){Entry.container.mapObjectOnScene(this.computeFunction)};Entry.Engine.prototype.computeFunction=function(b){b.script.tick()}; -Entry.Engine.computeThread=function(b,a){Entry.engine.isContinue=!0;for(var c=!1;a&&Entry.engine.isContinue&&!c;){Entry.engine.isContinue=!a.isRepeat;var d=a.run(),c=d&&d===a;a=d}return a};Entry.Engine.prototype.isState=function(b){return-1>>>>>> entrylabs/master this.state="run","mobile"==Entry.type&&this.view_.addClass("entryEngineBlueWorkspace"),this.pauseButton.innerHTML=Lang.Workspace.pause,this.runButton.addClass("run"),this.runButton.addClass("entryRemove"),this.stopButton.removeClass("entryRemove"),this.pauseButton&&this.pauseButton.removeClass("entryRemove"),this.runButton2&&this.runButton2.addClass("entryRemove"),this.stopButton2&&this.stopButton2.removeClass("entryRemove"),this.isUpdating||(Entry.engine.update(),Entry.engine.isUpdating=!0),Entry.stage.selectObject(), Entry.dispatchEvent("run"))}; Entry.Engine.prototype.toggleStop=function(){Entry.addActivity("stop");var a=Entry.container,b=Entry.variableContainer;a.mapEntity(function(b){b.loadSnapshot();b.object.filters=[];b.resetFilter();b.dialog&&b.dialog.remove();b.brush&&b.removeBrush()});b.mapVariable(function(b){b.loadSnapshot()});b.mapList(function(b){b.loadSnapshot();b.updateView()});this.stopProjectTimer();a.clearRunningState();a.loadSequenceSnapshot();this.projectTimer.loadSnapshot();Entry.container.inputValue.loadSnapshot();Entry.scene.loadStartSceneSnapshot(); Entry.Func.clearThreads();createjs.Sound.setVolume(1);createjs.Sound.stop();this.view_.removeClass("entryEngineBlueWorkspace");this.runButton.removeClass("entryRemove");this.stopButton.addClass("entryRemove");this.pauseButton&&this.pauseButton.addClass("entryRemove");this.runButton2&&this.runButton2.removeClass("entryRemove");this.stopButton2&&this.stopButton2.addClass("entryRemove");this.state="stop";Entry.dispatchEvent("stop");Entry.stage.hideInputField()}; -<<<<<<< HEAD Entry.Engine.prototype.togglePause=function(){var a=Entry.engine.projectTimer;"pause"==this.state?(a.pausedTime+=(new Date).getTime()-a.pauseStart,a.isPaused?a.pauseStart=(new Date).getTime():delete a.pauseStart,this.state="run",this.pauseButton.innerHTML=Lang.Workspace.pause,this.runButton.addClass("entryRemove"),this.runButton2&&this.runButton2.addClass("entryRemove")):(this.state="pause",a.isPaused&&(a.pausedTime+=(new Date).getTime()-a.pauseStart),a.pauseStart=(new Date).getTime(),this.pauseButton.innerHTML= Lang.Workspace.restart,this.runButton.removeClass("entryRemove"),this.stopButton.removeClass("entryRemove"),this.runButton2&&this.runButton2.removeClass("entryRemove"))};Entry.Engine.prototype.fireEvent=function(a){"run"==this.state&&Entry.container.mapEntityIncludeCloneOnScene(this.raiseEvent,a)};Entry.Engine.prototype.raiseEvent=function(a,b){a.parent.script.raiseEvent(b,a)}; -Entry.Engine.prototype.fireEventOnEntity=function(a,b){"run"==this.state&&Entry.container.mapEntityIncludeCloneOnScene(this.raiseEventOnEntity,[b,a])};Entry.Engine.prototype.raiseEventOnEntity=function(a,b){a===b[0]&&a.parent.script.raiseEvent(b[1],a)}; +Entry.Engine.prototype.fireEventOnEntity=function(a,b){"run"==this.state&&Entry.container.mapEntityIncludeCloneOnScene(this.raiseEventOnEntity,[b,a])};Entry.Engine.prototype.raiseEventOnEntity=function(a,b){a===b[0]&&a.parent.script.raiseEvent(b[1],a)};Entry.Engine.prototype.pushQueue=function(a,b){a===b[0]&&this.queue.push({eventName:b[1],entity:a})}; Entry.Engine.prototype.captureKeyEvent=function(a){var b=a.keyCode,c=Entry.type;a.ctrlKey&&"workspace"==c?83==b?(a.preventDefault(),Entry.dispatchEvent("saveWorkspace")):82==b?(a.preventDefault(),Entry.engine.run()):90==b&&(a.preventDefault(),console.log("engine"),Entry.dispatchEvent(a.shiftKey?"redo":"undo")):Entry.engine.isState("run")&&Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent,["keyPress",b]);Entry.engine.isState("stop")&&"workspace"===c&&37<=b&&40>=b&&Entry.stage.moveSprite(a)}; Entry.Engine.prototype.raiseKeyEvent=function(a,b){return a.parent.script.raiseEvent(b[0],a,String(b[1]))};Entry.Engine.prototype.updateMouseView=function(){var a=Entry.stage.mouseCoordinate;this.mouseView.textContent="X : "+a.x+", Y : "+a.y;this.mouseView.removeClass("entryRemove")};Entry.Engine.prototype.hideMouseView=function(){this.mouseView.addClass("entryRemove")}; Entry.Engine.prototype.toggleFullscreen=function(){if(this.popup)this.popup.remove(),this.popup=null;else{this.popup=new Entry.Popup;if("workspace"!=Entry.type){var a=$(document);$(this.popup.body_).css("top",a.scrollTop());$("body").css("overflow","hidden");popup.window_.appendChild(Entry.stage.canvas.canvas);popup.window_.appendChild(Entry.engine.runButton[0])}popup.window_.appendChild(Entry.engine.view_)}Entry.windowResized.notify()}; Entry.Engine.prototype.exitFullScreen=function(){document.webkitIsFullScreen||document.mozIsFullScreen||document.isFullScreen||(Entry.engine.footerView_.removeClass("entryRemove"),Entry.engine.headerView_.removeClass("entryRemove"));Entry.windowResized.notify()};Entry.Engine.prototype.showProjectTimer=function(){Entry.engine.projectTimer&&this.projectTimer.setVisible(!0)}; Entry.Engine.prototype.hideProjectTimer=function(){var a=this.projectTimer;if(a&&a.isVisible()&&!this.isState("run")){for(var b=Entry.container.getAllObjects(),c=["get_project_timer_value","reset_project_timer","set_visible_project_timer","choose_project_timer_action"],d=0,e=b.length;d=a&&Entry.stage.moveSprite(b)}; -Entry.Engine.prototype.raiseKeyEvent=function(b,a){return b.parent.script.raiseEvent(a[0],b,String(a[1]))};Entry.Engine.prototype.updateMouseView=function(){var b=Entry.stage.mouseCoordinate;this.mouseView.textContent="X : "+b.x+", Y : "+b.y;this.mouseView.removeClass("entryRemove")};Entry.Engine.prototype.hideMouseView=function(){this.mouseView.addClass("entryRemove")}; -Entry.Engine.prototype.toggleFullscreen=function(){if(this.popup)this.popup.remove(),this.popup=null;else{this.popup=new Entry.Popup;if("workspace"!=Entry.type){var b=$(document);$(this.popup.body_).css("top",b.scrollTop());$("body").css("overflow","hidden");popup.window_.appendChild(Entry.stage.canvas.canvas);popup.window_.appendChild(Entry.engine.runButton[0])}popup.window_.appendChild(Entry.engine.view_)}Entry.windowResized.notify()}; -Entry.Engine.prototype.exitFullScreen=function(){document.webkitIsFullScreen||document.mozIsFullScreen||document.isFullScreen||(Entry.engine.footerView_.removeClass("entryRemove"),Entry.engine.headerView_.removeClass("entryRemove"));Entry.windowResized.notify()};Entry.Engine.prototype.showProjectTimer=function(){Entry.engine.projectTimer&&this.projectTimer.setVisible(!0)}; -Entry.Engine.prototype.hideProjectTimer=function(){var b=this.projectTimer;if(b&&b.isVisible()&&!this.isState("run")){for(var a=Entry.container.getAllObjects(),c=["get_project_timer_value","reset_project_timer","set_visible_project_timer","choose_project_timer_action"],d=0,e=a.length;d>>>>>> entrylabs/master Entry.EntityObject.prototype.initCommand=function(){Entry.engine.isState("stop")&&(this.isCommandValid=!1,Entry.stateManager&&Entry.stateManager.addCommand("edit entity",this,this.restoreEntity,this.toJSON()))};Entry.EntityObject.prototype.doCommand=function(){this.isCommandValid=!0};Entry.EntityObject.prototype.checkCommand=function(){Entry.engine.isState("stop")&&!this.isCommandValid&&Entry.dispatchEvent("cancelLastCommand")}; Entry.EntityObject.prototype.restoreEntity=function(a){var b=this.toJSON();this.syncModel_(a);Entry.dispatchEvent("updateObject");Entry.stateManager&&Entry.stateManager.addCommand("restore object",this,this.restoreEntity,b)};Entry.EntityObject.prototype.setX=function(a){"number"==typeof a&&(this.x=a,this.object.x=this.x,this.isClone||this.parent.updateCoordinateView(),this.updateDialog(),Entry.requestUpdate=!0)};Entry.EntityObject.prototype.getX=function(){return this.x}; Entry.EntityObject.prototype.setY=function(a){"number"==typeof a&&(this.y=a,this.object.y=-this.y,this.isClone||this.parent.updateCoordinateView(),this.updateDialog(),Entry.requestUpdate=!0)};Entry.EntityObject.prototype.getY=function(){return this.y};Entry.EntityObject.prototype.getDirection=function(){return this.direction}; @@ -958,7 +856,6 @@ Entry.EntityObject.prototype.setBGColour=function(a){a||(a="transparent");this.b Entry.EntityObject.prototype.setStrike=function(a){void 0===a&&(a=!1);this.strike=a;this.textObject.strike=a;Entry.requestUpdate=!0};Entry.EntityObject.prototype.getStrike=function(){return this.strike};Entry.EntityObject.prototype.getFont=function(){var a=[];this.fontBold&&a.push("bold");this.fontItalic&&a.push("italic");a.push(this.getFontSize()+"px");a.push(this.fontType);return a.join(" ")}; Entry.EntityObject.prototype.setFont=function(a){if("textBox"==this.parent.objectType&&this.font!==a){a||(a="20px Nanum Gothic");var b=a.split(" "),c;if(c=-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);a.alpha=b.alpha=f(b.alpha,0,1);a.filters=e}(a,b),b.cache(0,0,this.getWidth(), -======= -Entry.EntityObject.prototype.setFontType=function(b){"textBox"==this.parent.objectType&&(this.fontType=b?b:"Nanum Gothic",this.syncFont())};Entry.EntityObject.prototype.getFontSize=function(b){return this.fontSize};Entry.EntityObject.prototype.setFontSize=function(b){"textBox"==this.parent.objectType&&this.fontSize!=b&&(this.fontSize=b?b:20,this.syncFont(),this.alignTextBox())};Entry.EntityObject.prototype.setFontBold=function(b){this.fontBold=b;Entry.requestUpdate=!0}; -Entry.EntityObject.prototype.toggleFontBold=function(){this.fontBold=!this.fontBold;this.syncFont();return this.fontBold};Entry.EntityObject.prototype.setFontItalic=function(b){this.fontItalic=b;Entry.requestUpdate=!0};Entry.EntityObject.prototype.toggleFontItalic=function(){this.fontItalic=!this.fontItalic;this.syncFont();return this.fontItalic}; -Entry.EntityObject.prototype.setFontName=function(b){for(var a=this.font.split(" "),c=[],d=0,e=a.length;d=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(), ->>>>>>> entrylabs/master 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 a=this.parent.clonedEntities.indexOf(this);this.parent.clonedEntities.splice(a,1);Entry.Utils.isFunction(this.clearExecutor)&&this.clearExecutor()}};Entry.EntityObject.prototype.clearExecutor=function(){this.parent.script.clearExecutorsByEntity(this)}; @@ -1027,7 +911,7 @@ a[h],0a-(k.width+l.width/2.2)&&(e+=1,initX=g,f=0)};a._movePort=function(b,a,d,e){var f=a,g=b.box.x*this.scale,h=b.box.y*this.scale; a>e?(f=a-b.width,a=a>g&&g>e?"M"+g+","+d+"L"+g+","+h:"M"+(a+e)/2+","+d+"l0,"+(h>d?28:-3)+"H"+g+"L"+g+","+h):a=ad?28:-3)+"H"+g+"L"+g+","+h;b.group.attr({transform:"translate("+f+","+d+")"});b.path.attr({d:a})}})(Entry.HWMonitor.prototype);Entry.HW=function(){this.connectTrial=0;this.isFirstConnect=!0;this.initSocket();this.connected=!1;this.portData={};this.sendQueue={};this.outputQueue={};this.settingQueue={};this.socketType=this.hwModule=this.selectedDevice=null;Entry.addEventListener("stop",this.setZero);this.hwInfo={11:Entry.Arduino,19:Entry.ArduinoExt,12:Entry.SensorBoard,13:Entry.CODEino,14:Entry.joystick,15:Entry.dplay,16:Entry.nemoino,17:Entry.Xbot,18:Entry.ardublock,110:Entry.Cobl,24:Entry.Hamster,25:Entry.Albert,31:Entry.Bitbrick, 42:Entry.Arduino,51:Entry.Neobot,71:Entry.Robotis_carCont,72:Entry.Robotis_openCM70,81:Entry.Arduino}};Entry.HW.TRIAL_LIMIT=1;p=Entry.HW.prototype; @@ -1043,10 +927,10 @@ this.hwMonitor.initView()):this.hwMonitor=new Entry.HWMonitor(this.hwModule),Ent Entry.Dom(d,{parent:this._contentView}),e=Entry.Dom("
"+Lang.Menus[b]+"
",{classes:["propertyTabElement","propertyTab"+b],parent:this._tabView}),f=this;e.bind("click",function(){f.select(b)});this.modes[b]&&(this.modes[b].tabDom.remove(),this.modes[b].contentDom.remove(),"hw"==b&&($(this.modes).removeClass(".propertyTabhw"),$(".propertyTabhw").unbind("dblclick")));this.modes[b]={obj:a,tabDom:e,contentDom:d};"hw"==b&&$(".propertyTabhw").bind("dblclick",function(){Entry.dispatchEvent("hwModeChange")})}; a.resize=function(b){this._view.css({width:b+"px",top:9*b/16+123-22+"px"});430<=b?this._view.removeClass("collapsed"):this._view.addClass("collapsed");Entry.dispatchEvent("windowResized");b=this.selected;"hw"==b?this.modes.hw.obj.listPorts?this.modes[b].obj.resizeList():this.modes[b].obj.resize():this.modes[b].obj.resize()};a.select=function(b){for(var a in this.modes){var d=this.modes[a];d.tabDom.removeClass("selected");d.contentDom.addClass("entryRemove");d.obj.visible=!1}a=this.modes[b];a.tabDom.addClass("selected"); a.contentDom.removeClass("entryRemove");a.obj.resize&&a.obj.resize();a.obj.visible=!0;this.selected=b};a.initializeSplitter=function(b){var a=this;b.bind("mousedown touchstart",function(b){a._cover.removeClass("entryRemove");Entry.container.disableSort();Entry.container.splitterEnable=!0;Entry.documentMousemove&&(Entry.container.resizeEvent=Entry.documentMousemove.attach(this,function(b){Entry.container.splitterEnable&&Entry.resizeElement({canvasWidth:b.clientX||b.x})}))});$(document).bind("mouseup touchend", -function(b){if(b=Entry.container.resizeEvent)Entry.container.splitterEnable=!1,Entry.documentMousemove.detach(b),a._cover.addClass("entryRemove"),delete Entry.container.resizeEvent;Entry.container.enableSort()})}})(Entry.PropertyPanel.prototype);Entry.init=function(a,b){Entry.assert("object"===typeof b,"Init option is not object");this.events_={};this.interfaceState={menuWidth:264};Entry.Utils.bindGlobalEvent("resize mousedown mousemove keydown keyup dispose".split(" "));this.options=b;this.parseOptions(b);this.mediaFilePath=(b.libDir?b.libDir:"/lib")+"/entryjs/images/";this.defaultPath=b.defaultDir||"";this.blockInjectPath=b.blockInjectDir||"";"workspace"==this.type&&this.isPhone()&&(this.type="phone");this.initialize_();this.view_=a;this.view_.setAttribute("class", -"entry");Entry.initFonts(b.fonts);this.createDom(a,this.type);this.loadInterfaceState();this.overridePrototype();this.maxCloneLimit=302;this.cloudSavable=!0;this.startTime=(new Date).getTime();document.onkeydown=function(b){Entry.dispatchEvent("keyPressed",b)};document.onkeyup=function(b){Entry.dispatchEvent("keyUpped",b)};window.onresize=function(b){Entry.dispatchEvent("windowResized",b)};window.onbeforeunload=this.beforeUnload;Entry.addEventListener("saveWorkspace",function(b){Entry.addActivity("save")}); -"IE"!=Entry.getBrowserType().substr(0,2)||window.flashaudio?createjs.Sound.registerPlugins([createjs.WebAudioPlugin]):(createjs.FlashAudioPlugin.swfPath=this.mediaFilePath+"media/",createjs.Sound.registerPlugins([createjs.FlashAudioPlugin]),window.flashaudio=!0);Entry.soundQueue=new createjs.LoadQueue;Entry.soundQueue.installPlugin(createjs.Sound);Entry.loadAudio_([Entry.mediaFilePath+"sounds/click.mp3",Entry.mediaFilePath+"sounds/click.wav",Entry.mediaFilePath+"sounds/click.ogg"],"entryMagneting"); -Entry.loadAudio_([Entry.mediaFilePath+"sounds/delete.mp3",Entry.mediaFilePath+"sounds/delete.ogg",Entry.mediaFilePath+"sounds/delete.wav"],"entryDelete");createjs.Sound.stop()};Entry.loadAudio_=function(a,b){if(window.Audio&&a.length)for(;0Entry.maxCloneLimit||(a=new Entry.EntityObject(this),b?(a.injectModel(b.picture?b.picture:null,b.toJSON()),a.snapshot_=b.snapshot_,b.effect&&(a.effect=Entry.cloneSimpleObject(b.effect),a.applyFilter()),b.brush&&Entry.setCloneBrush(a,b.brush)):(a.injectModel(this.entity.picture?this.entity.picture:null,this.entity.toJSON(a)),a.snapshot_=this.entity.snapshot_,this.entity.effect&&(a.effect=Entry.cloneSimpleObject(this.entity.effect), -a.applyFilter()),this.entity.brush&&Entry.setCloneBrush(a,this.entity.brush)),Entry.engine.raiseEventOnEntity(a,[a,"when_clone_start"]),a.isClone=!0,a.isStarted=!0,this.addCloneVariables(this,a,b?b.variables:null,b?b.lists:null),this.clonedEntities.push(a),Entry.stage.loadEntity(a))}; +a.applyFilter()),this.entity.brush&&Entry.setCloneBrush(a,this.entity.brush)),Entry.engine.pushQueue(a,[a,"when_clone_start"]),a.isClone=!0,a.isStarted=!0,this.addCloneVariables(this,a,b?b.variables:null,b?b.lists:null),this.clonedEntities.push(a),Entry.stage.loadEntity(a))}; Entry.EntryObject.prototype.initializeSplitter=function(a){a.onmousedown=function(b){Entry.container.disableSort();Entry.container.splitterEnable=!0};document.addEventListener("mousemove",function(b){Entry.container.splitterEnable&&Entry.resizeElement({canvasWidth:b.x||b.clientX})});document.addEventListener("mouseup",function(b){Entry.container.splitterEnable=!1;Entry.container.enableSort()})};Entry.EntryObject.prototype.isSelected=function(){return this.isSelected_}; Entry.EntryObject.prototype.toJSON=function(){var a={};a.id=this.id;a.name=this.name;"textBox"==this.objectType&&(a.text=this.text);a.script=this.getScriptText();"sprite"==this.objectType&&(a.selectedPictureId=this.selectedPicture.id);a.objectType=this.objectType;a.rotateMethod=this.getRotateMethod();a.scene=this.scene.id;a.sprite={pictures:Entry.getPicturesJSON(this.pictures),sounds:Entry.getSoundsJSON(this.sounds)};a.lock=this.lock;a.entity=this.entity.toJSON();return a}; Entry.EntryObject.prototype.destroy=function(){Entry.stage.unloadEntity(this.entity);this.view_&&Entry.removeElement(this.view_)};Entry.EntryObject.prototype.getSound=function(a){a=a.trim();for(var b=this.sounds,c=b.length,d=0;d=a&&0this.pictures.length)return!1;b=this.getPicture(b);var a=this.pictures.indexOf(b);Entry.stateManager&&Entry.stateManager.addCommand("remove sprite",this,this.addPicture,b,a);this.pictures.splice(a,1);b===this.selectedPicture&&Entry.playground.selectPicture(this.pictures[0]);Entry.playground.injectPicture(this);Entry.playground.reloadPlayground();return new Entry.State(this,this.addPicture,b,a)}; -Entry.EntryObject.prototype.getPicture=function(b){if(!b)return this.selectedPicture;b=b.trim();for(var a=this.pictures,c=a.length,d=0;d=b&&0Entry.maxCloneLimit||(b=new Entry.EntityObject(this),a?(b.injectModel(a.picture?a.picture:null,a.toJSON()),b.snapshot_=a.snapshot_,a.effect&&(b.effect=Entry.cloneSimpleObject(a.effect),b.applyFilter()),a.brush&&Entry.setCloneBrush(b,a.brush)):(b.injectModel(this.entity.picture?this.entity.picture:null,this.entity.toJSON(b)),b.snapshot_=this.entity.snapshot_,this.entity.effect&&(b.effect=Entry.cloneSimpleObject(this.entity.effect), -b.applyFilter()),this.entity.brush&&Entry.setCloneBrush(b,this.entity.brush)),Entry.engine.pushQueue(b,[b,"when_clone_start"]),b.isClone=!0,b.isStarted=!0,this.addCloneVariables(this,b,a?a.variables:null,a?a.lists:null),this.clonedEntities.push(b),Entry.stage.loadEntity(b))}; -Entry.EntryObject.prototype.initializeSplitter=function(b){b.onmousedown=function(a){Entry.container.disableSort();Entry.container.splitterEnable=!0};document.addEventListener("mousemove",function(a){Entry.container.splitterEnable&&Entry.resizeElement({canvasWidth:a.x||a.clientX})});document.addEventListener("mouseup",function(a){Entry.container.splitterEnable=!1;Entry.container.enableSort()})};Entry.EntryObject.prototype.isSelected=function(){return this.isSelected_}; -Entry.EntryObject.prototype.toJSON=function(){var b={};b.id=this.id;b.name=this.name;"textBox"==this.objectType&&(b.text=this.text);b.script=this.getScriptText();"sprite"==this.objectType&&(b.selectedPictureId=this.selectedPicture.id);b.objectType=this.objectType;b.rotateMethod=this.getRotateMethod();b.scene=this.scene.id;b.sprite={pictures:Entry.getPicturesJSON(this.pictures),sounds:Entry.getSoundsJSON(this.sounds)};b.lock=this.lock;b.entity=this.entity.toJSON();return b}; -Entry.EntryObject.prototype.destroy=function(){Entry.stage.unloadEntity(this.entity);this.view_&&Entry.removeElement(this.view_)};Entry.EntryObject.prototype.getSound=function(b){b=b.trim();for(var a=this.sounds,c=a.length,d=0;d=b&&0>>>>>> entrylabs/master this.selectArea.x2,this.selectArea.y2,4);this.stage.update()};Entry.Painter.prototype.updateHandle_=function(){this.stage.getChildIndex(-1=b-e/100*b&&f<=b+e/100*b&&g>=c-e/100*c&&g<=c+e/100*c&&a>=d-e/100*d&&a<=d+e/100*d};Entry.Painter.prototype.matchColorOnly=function(a,b,c,d){return b===this.colorLayerData.data[a]&&c===this.colorLayerData.data[a+1]&&d===this.colorLayerData.data[a+2]?!0:!1}; Entry.Painter.prototype.matchColor=function(a,b,c,d,e){return b===this.colorLayerData.data[a]&&c===this.colorLayerData.data[a+1]&&d===this.colorLayerData.data[a+2]&&e===this.colorLayerData.data[a+3]?!0:!1};Entry.Painter.prototype.colorPixel=function(a,b,c,d,e){e||(e=255);this.stroke.transparent&&(e=d=c=b=0);this.colorLayerData.data[a]=b;this.colorLayerData.data[a+1]=c;this.colorLayerData.data[a+2]=d;this.colorLayerData.data[a+3]=e}; @@ -1249,17 +1046,10 @@ Entry.Painter.prototype.initCommand=function(){var a=!1;this.handle.visible&&(a= !0);(a||b)&&this.stage.update()};Entry.Painter.prototype.doCommand=function(){this.isCommandValid=!0};Entry.Painter.prototype.checkCommand=function(){this.isCommandValid||Entry.dispatchEvent("cancelLastCommand")}; Entry.Painter.prototype.restorePainter=function(a){this.clearHandle();var b=this.ctx.getImageData(0,0,this.canvas.width,this.canvas.height);this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);this.ctx.putImageData(a,0,0);a=new Image;a.src=this.canvas.toDataURL();var c=this;a.onload=function(b){b=new createjs.Bitmap(b.target);c.objectContainer.removeAllChildren();c.objectContainer.addChild(b)};Entry.stateManager&&Entry.stateManager.addCommand("restore sprite",this,this.restorePainter,b)}; Entry.Painter.prototype.platten=function(){this.colorLayerData=this.ctx.getImageData(0,0,this.canvas.width,this.canvas.height);this.reloadContext()}; -<<<<<<< HEAD Entry.Painter.prototype.fill=function(){if(!this.stroke.locked){this.stroke.locked=!0;this.initCommand();this.doCommand();this.clearHandle();var a=this.canvas.width,b=this.canvas.height;this.colorLayerData=this.ctx.getImageData(0,0,a,b);var c=new createjs.Point(this.stage.mouseX,this.stage.mouseY);c.x=Math.round(c.x);c.y=Math.round(c.y);for(var d=4*(c.y*a+c.x),e=this.colorLayerData.data[d],f=this.colorLayerData.data[d+1],g=this.colorLayerData.data[d+2],h=this.colorLayerData.data[d+3],k,l,c=[[c.x, -c.y]],q=Entry.hex2rgb(this.stroke.lineColor);c.length;){for(var d=c.pop(),m=d[0],n=d[1],d=4*(n*a+m);0<=n&&this.matchColor(d,e,f,g,h);)--n,d-=4*a;d+=4*a;n+=1;for(l=k=!1;n>1,this.oldPt.y+this.stage.mouseY>>1);this.brush.graphics.setStrokeStyle(this.stroke.thickness,"round").beginStroke(this.stroke.lineColor).moveTo(a.x,a.y).curveTo(this.oldPt.x,this.oldPt.y,this.oldMidPt.x,this.oldMidPt.y);this.oldPt.x=this.stage.mouseX;this.oldPt.y=this.stage.mouseY;this.oldMidPt.x=a.x;this.oldMidPt.y=a.y;this.file.modified=!0;this.stage.update()}; -======= -Entry.Painter.prototype.fill=function(){if(!this.stroke.locked){this.stroke.locked=!0;this.initCommand();this.doCommand();this.clearHandle();var b=this.canvas.width,a=this.canvas.height;this.colorLayerData=this.ctx.getImageData(0,0,b,a);var c=new createjs.Point(this.stage.mouseX,this.stage.mouseY);c.x=Math.round(c.x);c.y=Math.round(c.y);for(var d=4*(c.y*b+c.x),e=this.colorLayerData.data[d],f=this.colorLayerData.data[d+1],g=this.colorLayerData.data[d+2],h=this.colorLayerData.data[d+3],k,l,c=[[c.x, -c.y]],m=Entry.hex2rgb(this.stroke.lineColor);c.length;){for(var d=c.pop(),n=d[0],q=d[1],d=4*(q*b+n);0<=q&&this.matchColor(d,e,f,g,h);)--q,d-=4*b;d+=4*b;q+=1;for(l=k=!1;q>1,this.oldPt.y+this.stage.mouseY>>1);this.brush.graphics.setStrokeStyle(this.stroke.thickness,"round").beginStroke(this.stroke.lineColor).moveTo(b.x,b.y).curveTo(this.oldPt.x,this.oldPt.y,this.oldMidPt.x,this.oldMidPt.y);this.oldPt.x=this.stage.mouseX;this.oldPt.y=this.stage.mouseY;this.oldMidPt.x=b.x;this.oldMidPt.y=b.y;this.file.modified=!0;this.stage.update()}; ->>>>>>> entrylabs/master Entry.Painter.prototype.move_line=function(){this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").moveTo(this.oldPt.x,this.oldPt.y).lineTo(this.stage.mouseX,this.stage.mouseY);this.file.modified=!0;this.stage.update()}; Entry.Painter.prototype.move_rect=function(){var a=this.stage.mouseX-this.oldPt.x,b=this.stage.mouseY-this.oldPt.y;event.shiftKey&&(b=a);this.stroke.fill?0===this.stroke.thickness?this.brush.graphics.clear().setStrokeStyle(this.stroke.thickness,"round").beginFill(this.stroke.fillColor).drawRect(this.oldPt.x,this.oldPt.y,a,b):this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").beginFill(this.stroke.fillColor).drawRect(this.oldPt.x,this.oldPt.y, a,b):0===this.stroke.thickness?this.brush.graphics.clear().setStrokeStyle(this.stroke.thickness,"round").drawRect(this.oldPt.x,this.oldPt.y,a,b):this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").drawRect(this.oldPt.x,this.oldPt.y,a,b);this.file.modified=!0;this.stage.update()}; @@ -1310,37 +1100,20 @@ this.attrResizeArea=Entry.createElement("fieldset","painterAttrResize");this.att e.addClass("entryPlaygroundPainterAttrResizeXTop");e.innerHTML="X";c.appendChild(e);this.objectWidthInput=Entry.createElement("input","entryPainterAttrWidth");this.objectWidthInput.onblur=function(){if(isNaN(this.value))return alert("\uc22b\uc790\ub9cc \uc785\ub825 \uac00\ub2a5\ud569\ub2c8\ub2e4."),!1;b.handle.width=this.value;b.updateImageHandle()};this.objectWidthInput.addClass("entryPlaygroundPainterNumberInput");c.appendChild(this.objectWidthInput);c=Entry.createElement("div");c.addClass("entryPlaygroundPainterSizeText"); c.innerHTML="x";d.appendChild(c);c=Entry.createElement("div");c.addClass("entryPlaygroundAttrReiszeY");d.appendChild(c);d=Entry.createElement("div");d.addClass("entryPlaygroundPainterAttrResizeYTop");d.innerHTML="Y";c.appendChild(d);this.objectHeightInput=Entry.createElement("input","entryPainterAttrHeight");this.objectHeightInput.onblur=function(){if(isNaN(this.value))return alert("\uc22b\uc790\ub9cc \uc785\ub825 \uac00\ub2a5\ud569\ub2c8\ub2e4."),!1;b.handle.height=this.value;b.updateImageHandle()}; this.objectHeightInput.addClass("entryPlaygroundPainterNumberInput");c.appendChild(this.objectHeightInput);this.attrRotateArea=Entry.createElement("div","painterAttrRotateArea");this.attrRotateArea.addClass("painterAttrRotateArea");g.appendChild(this.attrRotateArea);d=Entry.createElement("div");d.addClass("painterAttrRotateName");d.innerHTML=Lang.Workspace.picture_rotation;this.attrRotateArea.appendChild(d);d=Entry.createElement("fieldset","entryPainterAttrRotate");d.addClass("entryPlaygroundPainterAttrRotate"); -<<<<<<< HEAD this.attrRotateArea.appendChild(d);c=Entry.createElement("div");c.addClass("painterAttrRotateTop");c.innerHTML="\u03bf";d.appendChild(c);this.objectRotateInput=Entry.createElement("input","entryPainterAttrDegree");this.objectRotateInput.onblur=function(){if(isNaN(this.value))return alert("\uc22b\uc790\ub9cc \uc785\ub825 \uac00\ub2a5\ud569\ub2c8\ub2e4."),!1;360<=this.value?this.value%=360:0>this.value&&(this.value=360+this.value%360);b.handle.rotation=this.value;b.updateImageHandle()};this.objectRotateInput.addClass("entryPlaygroundPainterNumberInput"); -this.objectRotateInput.defaultValue="0";d.appendChild(this.objectRotateInput);this.attrColorArea=Entry.createElement("fieldset","entryPainterAttrColor");this.attrColorArea.addClass("entryPlaygroundPainterAttrColor");g.appendChild(this.attrColorArea);var q=Entry.createElement("div");q.addClass("entryPlaygroundPainterAttrColorContainer");this.attrColorArea.appendChild(q);this.attrCircleArea=Entry.createElement("div");this.attrCircleArea.addClass("painterAttrCircleArea");g.appendChild(this.attrCircleArea); +this.objectRotateInput.defaultValue="0";d.appendChild(this.objectRotateInput);this.attrColorArea=Entry.createElement("fieldset","entryPainterAttrColor");this.attrColorArea.addClass("entryPlaygroundPainterAttrColor");g.appendChild(this.attrColorArea);var n=Entry.createElement("div");n.addClass("entryPlaygroundPainterAttrColorContainer");this.attrColorArea.appendChild(n);this.attrCircleArea=Entry.createElement("div");this.attrCircleArea.addClass("painterAttrCircleArea");g.appendChild(this.attrCircleArea); d=Entry.createElement("div","entryPainterAttrCircle");d.addClass("painterAttrCircle");this.attrCircleArea.appendChild(d);this.attrCircleArea.painterAttrCircle=d;d=Entry.createElement("input","entryPainterAttrCircleInput");d.value="#000000";d.addClass("painterAttrCircleInput");this.attrCircleArea.appendChild(d);this.attrColorSpoid=Entry.createElement("div");this.attrColorSpoid.bindOnClick(function(){b.selectToolbox("spoid")});this.attrColorSpoid.addClass("painterAttrColorSpoid");g.appendChild(this.attrColorSpoid); Entry.getColourCodes().forEach(function(a){var c=Entry.createElement("div");c.addClass("entryPlaygroundPainterAttrColorElement");"transparent"===a?c.style.backgroundImage="url("+(Entry.mediaFilePath+"/transparent.png")+")":c.style.backgroundColor=a;c.bindOnClick(function(c){"transparent"===a?(b.stroke.transparent=!0,b.stroke.lineColor="#ffffff"):(b.stroke.transparent=!1,r&&(document.getElementById("entryPainterShapeBackgroundColor").style.backgroundColor=a,b.stroke.fillColor=a),r||(document.getElementById("entryPainterShapeLineColor").style.backgroundColor= -a,b.stroke.lineColor=a));document.getElementById("entryPainterAttrCircle").style.backgroundColor=b.stroke.lineColor;document.getElementById("entryPainterAttrCircleInput").value=a});q.appendChild(c)});this.attrThickArea=Entry.createElement("div","painterAttrThickArea");this.attrThickArea.addClass("entryPlaygroundentryPlaygroundPainterAttrThickArea");g.appendChild(this.attrThickArea);d=Entry.createElement("legend");d.addClass("painterAttrThickName");d.innerHTML=Lang.Workspace.thickness;this.attrThickArea.appendChild(d); +a,b.stroke.lineColor=a));document.getElementById("entryPainterAttrCircle").style.backgroundColor=b.stroke.lineColor;document.getElementById("entryPainterAttrCircleInput").value=a});n.appendChild(c)});this.attrThickArea=Entry.createElement("div","painterAttrThickArea");this.attrThickArea.addClass("entryPlaygroundentryPlaygroundPainterAttrThickArea");g.appendChild(this.attrThickArea);d=Entry.createElement("legend");d.addClass("painterAttrThickName");d.innerHTML=Lang.Workspace.thickness;this.attrThickArea.appendChild(d); var m=Entry.createElement("fieldset","entryPainterAttrThick");m.addClass("entryPlaygroundPainterAttrThick");this.attrThickArea.appendChild(m);d=Entry.createElement("div");d.addClass("paintAttrThickTop");m.appendChild(d);e=Entry.createElement("select","entryPainterAttrThick");e.addClass("entryPlaygroundPainterAttrThickInput");e.size="1";e.onchange=function(a){b.stroke.thickness=a.target.value};for(d=1;10>=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,e.appendChild(c);m.appendChild(e); -d=Entry.createElement("div","entryPainterShapeLineColor");d.addClass("painterAttrShapeLineColor");c=Entry.createElement("div","entryPainterShapeInnerBackground");c.addClass("painterAttrShapeInnerBackground");d.appendChild(c);m.appendChild(d);this.attrThickArea.painterAttrShapeLineColor=d;m.bindOnClick(function(){n.style.zIndex="1";this.style.zIndex="10";r=!1});this.attrBackgroundArea=Entry.createElement("div","painterAttrBackgroundArea");this.attrBackgroundArea.addClass("entryPlaygroundPainterBackgroundArea"); -g.appendChild(this.attrBackgroundArea);d=Entry.createElement("fieldset","entryPainterAttrbackground");d.addClass("entryPlaygroundPainterAttrBackground");this.attrBackgroundArea.appendChild(d);c=Entry.createElement("div");c.addClass("paintAttrBackgroundTop");d.appendChild(c);var n=Entry.createElement("div","entryPainterShapeBackgroundColor");n.addClass("painterAttrShapeBackgroundColor");this.attrBackgroundArea.painterAttrShapeBackgroundColor=n;c.appendChild(n);var r=!1;n.bindOnClick(function(b){m.style.zIndex= +d=Entry.createElement("div","entryPainterShapeLineColor");d.addClass("painterAttrShapeLineColor");c=Entry.createElement("div","entryPainterShapeInnerBackground");c.addClass("painterAttrShapeInnerBackground");d.appendChild(c);m.appendChild(d);this.attrThickArea.painterAttrShapeLineColor=d;m.bindOnClick(function(){q.style.zIndex="1";this.style.zIndex="10";r=!1});this.attrBackgroundArea=Entry.createElement("div","painterAttrBackgroundArea");this.attrBackgroundArea.addClass("entryPlaygroundPainterBackgroundArea"); +g.appendChild(this.attrBackgroundArea);d=Entry.createElement("fieldset","entryPainterAttrbackground");d.addClass("entryPlaygroundPainterAttrBackground");this.attrBackgroundArea.appendChild(d);c=Entry.createElement("div");c.addClass("paintAttrBackgroundTop");d.appendChild(c);var q=Entry.createElement("div","entryPainterShapeBackgroundColor");q.addClass("painterAttrShapeBackgroundColor");this.attrBackgroundArea.painterAttrShapeBackgroundColor=q;c.appendChild(q);var r=!1;q.bindOnClick(function(b){m.style.zIndex= "1";this.style.zIndex="10";r=!0});this.attrFontArea=Entry.createElement("div","painterAttrFont");this.attrFontArea.addClass("entryPlaygroundPainterAttrFont");g.appendChild(this.attrFontArea);e=Entry.createElement("div");e.addClass("entryPlaygroundPainterAttrTop");this.attrFontArea.appendChild(e);d=Entry.createElement("div");d.addClass("entryPlaygroundPaintAttrTop_");e.appendChild(d);d=Entry.createElement("legend");d.addClass("panterAttrFontTitle");d.innerHTML=Lang.Workspace.textStyle;k=Entry.createElement("select", "entryPainterAttrFontName");k.addClass("entryPlaygroundPainterAttrFontName");k.size="1";k.onchange=function(a){b.font.name=a.target.value};for(d=0;d=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,k.appendChild(c);e.appendChild(k);e=Entry.createElement("div");e.addClass("entryPlaygroundPainterAttrFontStyleArea");this.attrFontArea.appendChild(e);d=Entry.createElement("div");d.addClass("entryPlaygroundPainterAttrFontTop");e.appendChild(d);k=Entry.createElement("select","entryPainterAttrFontStyle"); k.addClass("entryPlaygroundPainterAttrFontStyle");k.size="1";k.onchange=function(a){b.font.style=a.target.value};h=[{label:"\ubcf4\ud1b5",value:"normal"},{label:"\uad75\uac8c",value:"bold"},{label:"\uae30\uc6b8\uc784",value:"italic"}];for(d=0;dthis.value&&(this.value=360+this.value%360);a.handle.rotation=this.value;a.updateImageHandle()};this.objectRotateInput.addClass("entryPlaygroundPainterNumberInput"); -this.objectRotateInput.defaultValue="0";d.appendChild(this.objectRotateInput);this.attrColorArea=Entry.createElement("fieldset","entryPainterAttrColor");this.attrColorArea.addClass("entryPlaygroundPainterAttrColor");g.appendChild(this.attrColorArea);var m=Entry.createElement("div");m.addClass("entryPlaygroundPainterAttrColorContainer");this.attrColorArea.appendChild(m);this.attrCircleArea=Entry.createElement("div");this.attrCircleArea.addClass("painterAttrCircleArea");g.appendChild(this.attrCircleArea); -d=Entry.createElement("div","entryPainterAttrCircle");d.addClass("painterAttrCircle");this.attrCircleArea.appendChild(d);this.attrCircleArea.painterAttrCircle=d;d=Entry.createElement("input","entryPainterAttrCircleInput");d.value="#000000";d.addClass("painterAttrCircleInput");this.attrCircleArea.appendChild(d);this.attrColorSpoid=Entry.createElement("div");this.attrColorSpoid.bindOnClick(function(){a.selectToolbox("spoid")});this.attrColorSpoid.addClass("painterAttrColorSpoid");g.appendChild(this.attrColorSpoid); -Entry.getColourCodes().forEach(function(b){var c=Entry.createElement("div");c.addClass("entryPlaygroundPainterAttrColorElement");"transparent"===b?c.style.backgroundImage="url("+(Entry.mediaFilePath+"/transparent.png")+")":c.style.backgroundColor=b;c.bindOnClick(function(c){"transparent"===b?(a.stroke.transparent=!0,a.stroke.lineColor="#ffffff"):(a.stroke.transparent=!1,r&&(document.getElementById("entryPainterShapeBackgroundColor").style.backgroundColor=b,a.stroke.fillColor=b),r||(document.getElementById("entryPainterShapeLineColor").style.backgroundColor= -b,a.stroke.lineColor=b));document.getElementById("entryPainterAttrCircle").style.backgroundColor=a.stroke.lineColor;document.getElementById("entryPainterAttrCircleInput").value=b});m.appendChild(c)});this.attrThickArea=Entry.createElement("div","painterAttrThickArea");this.attrThickArea.addClass("entryPlaygroundentryPlaygroundPainterAttrThickArea");g.appendChild(this.attrThickArea);d=Entry.createElement("legend");d.addClass("painterAttrThickName");d.innerHTML=Lang.Workspace.thickness;this.attrThickArea.appendChild(d); -var n=Entry.createElement("fieldset","entryPainterAttrThick");n.addClass("entryPlaygroundPainterAttrThick");this.attrThickArea.appendChild(n);d=Entry.createElement("div");d.addClass("paintAttrThickTop");n.appendChild(d);e=Entry.createElement("select","entryPainterAttrThick");e.addClass("entryPlaygroundPainterAttrThickInput");e.size="1";e.onchange=function(b){a.stroke.thickness=b.target.value};for(d=1;10>=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,e.appendChild(c);n.appendChild(e); -d=Entry.createElement("div","entryPainterShapeLineColor");d.addClass("painterAttrShapeLineColor");c=Entry.createElement("div","entryPainterShapeInnerBackground");c.addClass("painterAttrShapeInnerBackground");d.appendChild(c);n.appendChild(d);this.attrThickArea.painterAttrShapeLineColor=d;n.bindOnClick(function(){q.style.zIndex="1";this.style.zIndex="10";r=!1});this.attrBackgroundArea=Entry.createElement("div","painterAttrBackgroundArea");this.attrBackgroundArea.addClass("entryPlaygroundPainterBackgroundArea"); -g.appendChild(this.attrBackgroundArea);d=Entry.createElement("fieldset","entryPainterAttrbackground");d.addClass("entryPlaygroundPainterAttrBackground");this.attrBackgroundArea.appendChild(d);c=Entry.createElement("div");c.addClass("paintAttrBackgroundTop");d.appendChild(c);var q=Entry.createElement("div","entryPainterShapeBackgroundColor");q.addClass("painterAttrShapeBackgroundColor");this.attrBackgroundArea.painterAttrShapeBackgroundColor=q;c.appendChild(q);var r=!1;q.bindOnClick(function(a){n.style.zIndex= -"1";this.style.zIndex="10";r=!0});this.attrFontArea=Entry.createElement("div","painterAttrFont");this.attrFontArea.addClass("entryPlaygroundPainterAttrFont");g.appendChild(this.attrFontArea);e=Entry.createElement("div");e.addClass("entryPlaygroundPainterAttrTop");this.attrFontArea.appendChild(e);d=Entry.createElement("div");d.addClass("entryPlaygroundPaintAttrTop_");e.appendChild(d);d=Entry.createElement("legend");d.addClass("panterAttrFontTitle");d.innerHTML=Lang.Workspace.textStyle;k=Entry.createElement("select", -"entryPainterAttrFontName");k.addClass("entryPlaygroundPainterAttrFontName");k.size="1";k.onchange=function(b){a.font.name=b.target.value};for(d=0;d=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,k.appendChild(c);e.appendChild(k);e=Entry.createElement("div");e.addClass("entryPlaygroundPainterAttrFontStyleArea");this.attrFontArea.appendChild(e);d=Entry.createElement("div");d.addClass("entryPlaygroundPainterAttrFontTop");e.appendChild(d);k=Entry.createElement("select","entryPainterAttrFontStyle"); -k.addClass("entryPlaygroundPainterAttrFontStyle");k.size="1";k.onchange=function(b){a.font.style=b.target.value};h=[{label:"\ubcf4\ud1b5",value:"normal"},{label:"\uad75\uac8c",value:"bold"},{label:"\uae30\uc6b8\uc784",value:"italic"}];for(d=0;d>>>>>> entrylabs/master Entry.Painter.prototype.initDisplay=function(){this.stroke.enabled=!1;this.toolboxCursor.addClass("entryPlaygroundPainterToolboxCursor");this.toolboxCursor.removeClass("entryToolboxCursorClicked");this.toolboxSelect.addClass("entryPlaygroundPainterToolboxSelect");this.toolboxSelect.removeClass("entryToolboxSelectClicked");this.toolboxPen.addClass("entryPlaygroundPainterToolboxPen");this.toolboxPen.removeClass("entryToolboxPenClicked");this.toolboxLine.addClass("entryPlaygroundPainterToolboxLine"); this.toolboxLine.removeClass("entryToolboxLineClicked");this.toolboxRect.addClass("entryPlaygroundPainterToolboxRect");this.toolboxRect.removeClass("entryToolboxRectClicked");this.toolboxCircle.addClass("entryPlaygroundPainterToolboxCircle");this.toolboxCircle.removeClass("entryToolBoxCircleClicked");this.toolboxText.addClass("entryPlaygroundPainterToolboxText");this.toolboxText.removeClass("entryToolBoxTextClicked");this.toolboxFill.addClass("entryPlaygroundPainterToolboxFill");this.toolboxFill.removeClass("entryToolBoxFillClicked"); this.toolboxErase.addClass("entryPlaygroundPainterToolboxErase");this.toolboxErase.removeClass("entryToolBoxEraseClicked");this.attrColorSpoid.addClass("painterAttrColorSpoid");this.attrColorSpoid.removeClass("painterAttrColorSpoidClicked");this.attrResizeArea.addClass("entryRemove");this.attrRotateArea.addClass("entryRemove");this.attrThickArea.addClass("entryRemove");this.attrFontArea.addClass("entryRemove");this.attrLineArea.addClass("entryRemove");this.attrColorArea.addClass("entryRemove");this.attrCircleArea.addClass("entryRemove"); @@ -1350,7 +1123,6 @@ break;case "pen":this.toolboxPen.addClass("entryToolboxPenClicked");this.attrThi this.attrColorSpoid.removeClass("entryRemove");this.attrThickArea.painterAttrShapeLineColor.removeClass("entryRemove");break;case "rect":this.toolboxRect.addClass("entryToolboxRectClicked");this.attrThickArea.removeClass("entryRemove");this.attrColorArea.removeClass("entryRemove");this.attrCircleArea.removeClass("entryRemove");this.attrColorSpoid.removeClass("entryRemove");this.attrBackgroundArea.removeClass("entryRemove");this.attrThickArea.painterAttrShapeLineColor.removeClass("entryRemove");this.attrBackgroundArea.painterAttrShapeBackgroundColor.removeClass("entryRemove"); break;case "circle":this.toolboxCircle.addClass("entryToolBoxCircleClicked");this.attrThickArea.removeClass("entryRemove");this.attrColorArea.removeClass("entryRemove");this.attrCircleArea.removeClass("entryRemove");this.attrColorSpoid.removeClass("entryRemove");this.attrThickArea.painterAttrShapeLineColor.removeClass("entryRemove");this.attrBackgroundArea.removeClass("entryRemove");this.attrBackgroundArea.painterAttrShapeBackgroundColor.removeClass("entryRemove");break;case "text":this.toolboxText.addClass("entryToolBoxTextClicked"); this.attrFontArea.removeClass("entryRemove");this.attrColorArea.removeClass("entryRemove");this.attrCircleArea.removeClass("entryRemove");this.attrColorSpoid.removeClass("entryRemove");this.attrCircleArea.painterAttrCircle.removeClass("entryRemove");break;case "fill":this.toolboxFill.addClass("entryToolBoxFillClicked");this.attrColorArea.removeClass("entryRemove");this.attrCircleArea.removeClass("entryRemove");this.attrColorSpoid.removeClass("entryRemove");this.attrCircleArea.painterAttrCircle.removeClass("entryRemove"); -<<<<<<< HEAD break;case "erase":$(".entryPlaygroundPainterContainer").addClass("dd");this.toolboxErase.addClass("entryToolBoxEraseClicked");this.attrThickArea.removeClass("entryRemove");break;case "spoid":this.attrColorArea.removeClass("entryRemove");this.attrCircleArea.removeClass("entryRemove");this.attrColorSpoid.removeClass("entryRemove");this.attrColorSpoid.removeClass("painterAttrColorSpoid");this.attrColorSpoid.addClass("painterAttrColorSpoidClicked");break;case "coordinate":this.toggleCoordinator()}};Entry.BlockParser=function(a){this.syntax=a;this._iterVariableCount=0;this._iterVariableChunk=["i","j","k"]}; (function(a){a.Code=function(b){if(b instanceof Entry.Thread)return this.Thread(b);if(b instanceof Entry.Block)return this.Block(b);var a="";b=b.getThreads();for(var d=0;d":h=b-d;break;case ">=":h=b+1-d}return this.BasicIteration(a,h,f)};b.BlockStatement=function(a){var b=[];a=a.body;for(var d=0;d >= << >> >>> + - * / % , ^ & in instanceof".split(" ")}; -b.AssignmentExpression=function(a){throw{message:a.operator+"\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub839\uc5b4 \uc785\ub2c8\ub2e4.",node:a};};b.AssignmentOperator=function(){return"= += -= *= /= %= <<= >>= >>>= ,= ^= &=".split(" ")};b.LogicalExpression=function(a){throw{message:a.operator+"\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub839\uc5b4 \uc785\ub2c8\ub2e4.",node:a};};b.LogicalOperator=function(){return["||","&&"]};b.MemberExpression=function(a){var b= -a.object,d=a.property;console.log(b.type);b=this[b.type](b);console.log(b);d=this[d.type](d,b);if(Object(b)!==b||Object.getPrototypeOf(b)!==Object.prototype)throw{message:b+"\uc740(\ub294) \uc798\ubabb\ub41c \uba64\ubc84 \ubcc0\uc218\uc785\ub2c8\ub2e4.",node:a};b=d;if(!b)throw{message:d+"\uc774(\uac00) \uc874\uc7ac\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.",node:a};return b};b.ConditionalExpression=function(a){throw{message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", -node:a};};b.UpdateExpression=function(a){throw{message:a.operator+"\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub801\uc5b4 \uc785\ub2c8\ub2e4.",node:a};};b.CallExpression=function(a){a=a.callee;return{type:this[a.type](a)}};b.NewExpression=function(a){throw{message:"new\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.",node:a};};b.SequenceExpression=function(a){throw{message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", -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"+Lang.Menus[a]+"",{classes:["propertyTabElement","propertyTab"+a],parent:this._tabView}),f=this;e.bind("click",function(){f.select(a)});this.modes[a]&&(this.modes[a].tabDom.remove(),this.modes[a].contentDom.remove(),"hw"==a&&($(this.modes).removeClass(".propertyTabhw"),$(".propertyTabhw").unbind("dblclick")));this.modes[a]={obj:b,tabDom:e,contentDom:d};"hw"==a&&$(".propertyTabhw").bind("dblclick",function(){Entry.dispatchEvent("hwModeChange")})}; -b.resize=function(a){this._view.css({width:a+"px",top:9*a/16+123-22+"px"});430<=a?this._view.removeClass("collapsed"):this._view.addClass("collapsed");Entry.dispatchEvent("windowResized");a=this.selected;"hw"==a?this.modes.hw.obj.listPorts?this.modes[a].obj.resizeList():this.modes[a].obj.resize():this.modes[a].obj.resize()};b.select=function(a){for(var b in this.modes){var d=this.modes[b];d.tabDom.removeClass("selected");d.contentDom.addClass("entryRemove");d.obj.visible=!1}b=this.modes[a];b.tabDom.addClass("selected"); -b.contentDom.removeClass("entryRemove");b.obj.resize&&b.obj.resize();b.obj.visible=!0;this.selected=a};b.initializeSplitter=function(a){var b=this;a.bind("mousedown touchstart",function(a){b._cover.removeClass("entryRemove");Entry.container.disableSort();Entry.container.splitterEnable=!0;Entry.documentMousemove&&(Entry.container.resizeEvent=Entry.documentMousemove.attach(this,function(a){Entry.container.splitterEnable&&Entry.resizeElement({canvasWidth:a.clientX||a.x})}))});$(document).bind("mouseup touchend", -function(a){if(a=Entry.container.resizeEvent)Entry.container.splitterEnable=!1,Entry.documentMousemove.detach(a),b._cover.addClass("entryRemove"),delete Entry.container.resizeEvent;Entry.container.enableSort()})}})(Entry.PropertyPanel.prototype);Entry.init=function(b,a){Entry.assert("object"===typeof a,"Init option is not object");this.events_={};this.interfaceState={menuWidth:264};Entry.Utils.bindGlobalEvent("resize mousedown mousemove keydown keyup dispose".split(" "));this.options=a;this.parseOptions(a);this.mediaFilePath=(a.libDir?a.libDir:"/lib")+"/entryjs/images/";this.defaultPath=a.defaultDir||"";this.blockInjectPath=a.blockInjectDir||"";"workspace"==this.type&&this.isPhone()&&(this.type="phone");this.initialize_();this.view_=b;"tablet"=== -this.device?this.view_.setAttribute("class","entry tablet"):this.view_.setAttribute("class","entry");Entry.initFonts(a.fonts);this.createDom(b,this.type);this.loadInterfaceState();this.overridePrototype();this.maxCloneLimit=302;this.cloudSavable=!0;this.startTime=(new Date).getTime();document.onkeydown=function(a){Entry.dispatchEvent("keyPressed",a)};document.onkeyup=function(a){Entry.dispatchEvent("keyUpped",a)};window.onresize=function(a){Entry.dispatchEvent("windowResized",a)};window.onbeforeunload= -this.beforeUnload;Entry.addEventListener("saveWorkspace",function(a){Entry.addActivity("save")});"IE"!=Entry.getBrowserType().substr(0,2)||window.flashaudio?createjs.Sound.registerPlugins([createjs.WebAudioPlugin]):(createjs.FlashAudioPlugin.swfPath=this.mediaFilePath+"media/",createjs.Sound.registerPlugins([createjs.FlashAudioPlugin]),window.flashaudio=!0);Entry.soundQueue=new createjs.LoadQueue;Entry.soundQueue.installPlugin(createjs.Sound);Entry.loadAudio_([Entry.mediaFilePath+"sounds/click.mp3", -Entry.mediaFilePath+"sounds/click.wav",Entry.mediaFilePath+"sounds/click.ogg"],"entryMagneting");Entry.loadAudio_([Entry.mediaFilePath+"sounds/delete.mp3",Entry.mediaFilePath+"sounds/delete.ogg",Entry.mediaFilePath+"sounds/delete.wav"],"entryDelete");createjs.Sound.stop()};Entry.loadAudio_=function(b,a){if(window.Audio&&b.length)for(;0d+55)&&a>40+b*(h-d)&&(h=c.getNextScene())&&(h=$(h.view),$(document).trigger("mouseup"), -h.trigger("mousedown"))});var d=Entry.createElement("ul");d.addClass("entrySceneListWorkspace");Entry.sceneEditable&&$&&$(d).sortable({start:function(a,b){b.item.data("start_pos",b.item.index());$(b.item[0]).clone(!0)},stop:function(a,b){var c=b.item.data("start_pos"),d=b.item.index();Entry.scene.moveScene(c,d)},axis:"x",tolerance:"pointer"});this.view_.appendChild(d);this.listView_=d;Entry.sceneEditable&&(d=Entry.createElement("span"),d.addClass("entrySceneElementWorkspace"),d.addClass("entrySceneAddButtonWorkspace"), -d.bindOnClick(function(a){Entry.engine.isState("run")||Entry.scene.addScene()}),this.view_.appendChild(d),this.addButton_=d)}}; -Entry.Scene.prototype.generateElement=function(b){var a=this,c=Entry.createElement("li",b.id);c.addClass("entrySceneElementWorkspace");c.addClass("entrySceneButtonWorkspace");c.addClass("minValue");$(c).on("mousedown",function(a){Entry.engine.isState("run")?a.preventDefault():Entry.scene.selectScene(b)});var d=Entry.createElement("input");d.addClass("entrySceneFieldWorkspace");d.value=b.name;Entry.sceneEditable||(d.disabled="disabled");var e=Entry.createElement("span");e.addClass("entrySceneLeftWorkspace"); -c.appendChild(e);var f=Entry.createElement("span");f.addClass("entrySceneInputCover");f.style.width=Entry.computeInputWidth(b.name);c.appendChild(f);b.inputWrapper=f;d.onkeyup=function(c){c=c.keyCode;Entry.isArrowOrBackspace(c)||(b.name=this.value,f.style.width=Entry.computeInputWidth(b.name),a.resize(),13==c&&this.blur(),10=this.getScenes().length)Entry.toast.alert(Lang.Msgs.runtime_error,Lang.Workspace.Scene_delete_error,!1);else{var a=this.getScenes().indexOf(this.getSceneById(b.id));this.getScenes().splice(a,1);for(var a=Entry.container.getSceneObjects(b),c=0;c=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;ad.style.opacity&&(clearInterval(a),d.style.display="none",Entry.removeElement(d));d.style.opacity*=.9},20)},1E3)}; -Entry.Toast.prototype.success=function(b,a,c){var d=Entry.createElement("div","entryToast");d.addClass("entryToast");d.addClass("entryToastSuccess");d.bindOnClick(function(){Entry.toast.body_.removeChild(this)});var e=Entry.createElement("div","entryToast");e.addClass("entryToastTitle");e.innerHTML=b;d.appendChild(e);b=Entry.createElement("p","entryToast");b.addClass("entryToastMessage");b.innerHTML=a;d.appendChild(b);this.toasts_.push(d);this.body_.appendChild(d);c||window.setTimeout(function(){d.style.opacity= -1;var a=setInterval(function(){.05>d.style.opacity&&(clearInterval(a),d.style.display="none",Entry.removeElement(d));d.style.opacity*=.9},20)},1E3)}; -Entry.Toast.prototype.alert=function(b,a,c){var d=Entry.createElement("div","entryToast");d.addClass("entryToast");d.addClass("entryToastAlert");d.bindOnClick(function(){Entry.toast.body_.removeChild(this)});var e=Entry.createElement("div","entryToast");e.addClass("entryToastTitle");e.innerHTML=b;d.appendChild(e);b=Entry.createElement("p","entryToast");b.addClass("entryToastMessage");b.innerHTML=a;d.appendChild(b);this.toasts_.push(d);this.body_.appendChild(d);c||window.setTimeout(function(){d.style.opacity= -1;var a=setInterval(function(){.05>d.style.opacity&&(clearInterval(a),d.style.display="none",Entry.toast.body_.removeChild(d));d.style.opacity*=.9},20)},5E3)};Entry.TvCast=function(b){this.generateView(b)};p=Entry.TvCast.prototype;p.init=function(b){this.tvCastHash=b};p.generateView=function(b){var a=Entry.createElement("div");a.addClass("entryContainerMovieWorkspace");a.addClass("entryRemove");this.movieContainer=a;a=Entry.createElement("iframe");a.setAttribute("id","tvCastIframe");a.setAttribute("allowfullscreen","");a.setAttribute("frameborder",0);a.setAttribute("src",b);this.movieFrame=a;this.movieContainer.appendChild(this.movieFrame)};p.getView=function(){return this.movieContainer}; -p.resize=function(){document.getElementById("entryContainerWorkspaceId");var b=document.getElementById("tvCastIframe");w=this.movieContainer.offsetWidth;b.width=w+"px";b.height=9*w/16+"px"};Entry.BlockDriver=function(){}; -(function(b){b.convert=function(){var a=new Date,b;for(b in Entry.block)"function"===typeof Entry.block[b]&&this._convertBlock(b);console.log((new Date).getTime()-a.getTime())};b._convertBlock=function(a){function b(a){var d={type:a.getAttribute("type"),index:{}};a=$(a).children();if(!a)return d;for(var e=0;eg&&(a.x-=d+3);a.y+e>f&&(a.y-=e);b.css({left:a.x,top:a.y})};b.hide=function(){this.visible= -!1;this.dom.empty();this.dom.addClass("entryRemove");this._className&&(this.dom.removeClass(this._className),delete this._className)}})(Entry.ContextMenu);Entry.Loader={queueCount:0,totalCount:0};Entry.Loader.addQueue=function(b){this.queueCount||Entry.dispatchEvent("loadStart");this.queueCount++;this.totalCount++};Entry.Loader.removeQueue=function(b){this.queueCount--;this.queueCount||(Entry.dispatchEvent("loadComplete"),this.totalCount=0)};Entry.Loader.getLoadedPercent=function(){return 0===this.totalCount?1:this.queueCount/this.totalCount};Entry.STATIC={OBJECT:0,ENTITY:1,SPRITE:2,SOUND:3,VARIABLE:4,FUNCTION:5,SCENE:6,MESSAGE:7,BLOCK_MODEL:8,BLOCK_RENDER_MODEL:9,BOX_MODEL:10,THREAD_MODEL:11,DRAG_INSTANCE:12,BLOCK_STATIC:0,BLOCK_MOVE:1,BLOCK_FOLLOW:2,RETURN:0,CONTINUE:1,BREAK:2,PASS:3};Entry.Utils={};Entry.overridePrototype=function(){Number.prototype.mod=function(b){return(this%b+b)%b}};Entry.Utils.generateId=function(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).substr(-4)};Entry.Utils.intersectArray=function(b,a){for(var c=[],d=0;d=a.x&&e-c<=a.y&&e+b.height+c>=a.y}; -Entry.Utils.colorDarken=function(b,a){function c(a){2!=a.length&&(a="0"+a);return a}var d,e,f;7===b.length?(d=parseInt(b.substr(1,2),16),e=parseInt(b.substr(3,2),16),f=parseInt(b.substr(5,2),16)):(d=parseInt(b.substr(1,2),16),e=parseInt(b.substr(2,2),16),f=parseInt(b.substr(3,2),16));a=void 0===a?.7:a;d=c(Math.floor(d*a).toString(16));e=c(Math.floor(e*a).toString(16));f=c(Math.floor(f*a).toString(16));return"#"+d+e+f}; -Entry.Utils.colorLighten=function(b,a){a=0===a?0:a||20;var c=Entry.Utils.hexToHsl(b);c.l+=a/100;c.l=Math.min(1,Math.max(0,c.l));return Entry.Utils.hslToHex(c)};Entry.Utils.bound01=function(b,a){var c=b;"string"==typeof c&&-1!=c.indexOf(".")&&1===parseFloat(c)&&(b="100%");c="string"===typeof b&&-1!=b.indexOf("%");b=Math.min(a,Math.max(0,parseFloat(b)));c&&(b=parseInt(b*a,10)/100);return 1E-6>Math.abs(b-a)?1:b%a/parseFloat(a)}; -Entry.Utils.hexToHsl=function(b){var a,c;7===b.length?(a=parseInt(b.substr(1,2),16),c=parseInt(b.substr(3,2),16),b=parseInt(b.substr(5,2),16)):(a=parseInt(b.substr(1,2),16),c=parseInt(b.substr(2,2),16),b=parseInt(b.substr(3,2),16));a=Entry.Utils.bound01(a,255);c=Entry.Utils.bound01(c,255);b=Entry.Utils.bound01(b,255);var d=Math.max(a,c,b),e=Math.min(a,c,b),f,g=(d+e)/2;if(d==e)f=e=0;else{var h=d-e,e=.5c&&(c+=1);1c?b:c<2/3?a+(b-a)*(2/3-c)*6:a}function c(a){return 1==a.length?"0"+a:""+a}var d,e;e=Entry.Utils.bound01(b.h,360);d=Entry.Utils.bound01(b.s,1);b=Entry.Utils.bound01(b.l,1);if(0===d)d=b=e=b;else{var f=.5>b?b*(1+d):b+d-b*d,g=2*b-f;d=a(g,f,e+1/3);b=a(g,f,e);e=a(g,f,e-1/3)}b*=255;e*=255;return"#"+[c(Math.round(255*d).toString(16)),c(Math.round(b).toString(16)),c(Math.round(e).toString(16))].join("")}; -Entry.Utils.bindGlobalEvent=function(b){var a=$(document);void 0===b&&(b="resize mousedown mousemove keydown keyup dispose".split(" "));-1Entry.pressedKeys.indexOf(b)&&Entry.pressedKeys.push(b);Entry.keyPressed.notify(a)}));-1$1://$2").replace(/([xA1-xFEa-z0-9_-]+@[xA1-xFEa-z0-9-]+.[a-z0-9-]+)/gi,"$1"):""};Entry.generateHash=function(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).substr(-4)}; -Entry.addEventListener=function(b,a){this.events_||(this.events_={});this.events_[b]||(this.events_[b]=[]);a instanceof Function&&this.events_[b].push(a);return!0};Entry.dispatchEvent=function(b,a){this.events_||(this.events_={});if(this.events_[b])for(var c=0,d=this.events_[b].length;c=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;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.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", -{result:"matrixOut",in:"offOut",type:"matrix",values:"0.7 0 0 0 0 0 0.7 0 0 0 0 0 0.7 0 0 0 0 0 1 0"});d.elem("feBlend",{in:"SourceGraphic",in1:"offOut",mode:"normal"});c=c.elem("filter",{id:"entryBlockHighlightFilter_"+a});c.elem("feOffset",{result:"offOut",in:"SourceGraphic",dx:0,dy:0});c.elem("feColorMatrix",{result:"matrixOut",in:"offOut",type:"matrix",values:"1.3 0 0 0 0 0 1.3 0 0 0 0 0 1.3 0 0 0 0 0 1 0"})}; -Entry.Utils.addBlockPattern=function(b,a){for(var c=b.elem("pattern",{id:"blockHoverPattern_"+a,class:"blockHoverPattern",patternUnits:"userSpaceOnUse",patternTransform:"translate(12, 0)",x:0,y:0,width:125,height:33,style:"display: none"}),d=c.elem("g"),e=d.elem("rect",{x:0,y:0,width:125,height:33}),f=Entry.mediaFilePath+"block_pattern_(order).png",g=1;5>g;g++)d.elem("image",{class:"pattern"+g,href:f.replace("(order)",g),x:0,y:0,width:125,height:33});return{pattern:c,rect:e}}; -Entry.Utils.COLLISION={NONE:0,UP:1,RIGHT:2,LEFT:3,DOWN:4};Entry.Utils.createMouseEvent=function(b,a){var c=document.createEvent("MouseEvent");c.initMouseEvent(b,!0,!0,window,0,0,0,a.clientX,a.clientY,!1,!1,!1,!1,0,null);return c};Entry.Utils.xmlToJsonData=function(b){b=$.parseXML(b);var a=[];b=b.childNodes[0].childNodes;for(var c in b){var d=b[c];if(d.tagName){var e={category:d.getAttribute("id"),blocks:[]},d=d.childNodes;for(c in d){var f=d[c];f.tagName&&(f=f.getAttribute("type"))&&e.blocks.push(f)}a.push(e)}}return a}; -Entry.Utils.stopProjectWithToast=function(b,a,c){var d=b.block;a=a||"\ub7f0\ud0c0\uc784 \uc5d0\ub7ec \ubc1c\uc0dd";Entry.toast&&!c&&Entry.toast.alert(Lang.Msgs.warn,Lang.Workspace.check_runtime_error,!0);Entry.engine&&Entry.engine.toggleStop();"workspace"===Entry.type&&(b.block&&"funcBlock"in b.block?d=b.block.funcBlock:b.funcExecutor&&(d=b.funcExecutor.scope.block,b=b.type.replace("func_",""),Entry.Func.edit(Entry.variableContainer.functions_[b])),d&&(Entry.container.selectObject(d.getCode().object.id, -!0),d.view.getBoard().activateBlock(d)));throw Error(a);};Entry.Utils.AsyncError=function(b){this.name="AsyncError";this.message=b||"\ube44\ub3d9\uae30 \ud638\ucd9c \ub300\uae30"};Entry.Utils.AsyncError.prototype=Error();Entry.Utils.AsyncError.prototype.constructor=Entry.Utils.AsyncError;Entry.Utils.isChrome=function(){return/chrom(e|ium)/.test(navigator.userAgent.toLowerCase())}; -Entry.Utils.waitForWebfonts=function(b,a){for(var c=0,d=0,e=b.length;d=b.length&&(l&&clearInterval(l),c==b.length))return a(),!0}var h=document.createElement("span");h.innerHTML="giItT1WQy@!-/#";h.style.position="absolute";h.style.left="-10000px";h.style.top="-10000px";h.style.fontSize="300px";h.style.fontFamily="sans-serif";h.style.fontVariant="normal";h.style.fontStyle="normal";h.style.fontWeight= -"normal";h.style.letterSpacing="0";document.body.appendChild(h);var k=h.offsetWidth;h.style.fontFamily=d;var l;e()||(l=setInterval(e,50))})(b[d])};window.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(b){window.setTimeout(b,1E3/60)}}(); -Entry.isMobile=function(){if(Entry.device)return"tablet"===Entry.device;var b=window.platform;if(b&&b.type&&("tablet"===b.type||"mobile"===b.type))return Entry.device="tablet",!0;Entry.device="desktop";return!1};Entry.Utils.convertMouseEvent=function(b){return b.originalEvent&&b.originalEvent.touches?b.originalEvent.touches[0]:b};Entry.Model=function(b,a){var c=Entry.Model;c.generateSchema(b);c.generateSetter(b);c.generateObserve(b);(void 0===a||a)&&Object.seal(b);return b}; -(function(b){b.generateSchema=function(a){var b=a.schema;if(void 0!==b){b=JSON.parse(JSON.stringify(b));a.data={};for(var d in b)(function(d){a.data[d]=b[d];Object.defineProperty(a,d,{get:function(){return a.data[d]}})})(d);a._toJSON=this._toJSON}};b.generateSetter=function(a){a.set=this.set};b.set=function(a,b){var d={},e;for(e in this.data)void 0!==a[e]&&(a[e]===this.data[e]?delete a[e]:(d[e]=this.data[e],this.data[e]=a[e]instanceof Array?a[e].concat():a[e]));b||this.notify(Object.keys(a),d)};b.generateObserve= -function(a){a.observers=[];a.observe=this.observe;a.unobserve=this.unobserve;a.notify=this.notify};b.observe=function(a,b,d,e){d=new Entry.Observer(this.observers,a,b,d);if(!1!==e)a[b]([]);return d};b.unobserve=function(a){a.destroy()};b.notify=function(a,b){"string"===typeof a&&(a=[a]);var d=this;d.observers.map(function(e){var f=a;void 0!==e.attrs&&(f=Entry.Utils.intersectArray(e.attrs,a));if(f.length)e.object[e.funcName](f.map(function(a){return{name:a,object:d,oldValue:b[a]}}))})};b._toJSON=function(){var a= -{},b;for(b in this.data)a[b]=this.data[b];return a}})(Entry.Model);Entry.Func=function(b){this.id=b?b.id:Entry.generateHash();this.content=b?new Entry.Code(b.content):new Entry.Code([[{type:"function_create",copyable:!1,deletable:!1,x:40,y:40}]]);this.blockMenuBlock=this.block=null;this.hashMap={};this.paramMap={};var a=function(){};a.prototype=Entry.block.function_general;a=new a;a.changeEvent=new Entry.Event;a.template=Lang.template.function_general;Entry.block["func_"+this.id]=a;if(b){b=this.content._blockMap;for(var c in b)Entry.Func.registerParamBlock(b[c].type); -Entry.Func.generateWsBlock(this)}Entry.Func.registerFunction(this);Entry.Func.updateMenu()};Entry.Func.threads={};Entry.Func.registerFunction=function(b){if(Entry.playground){var a=Entry.playground.mainWorkspace;a&&(this._targetFuncBlock=a.getBlockMenu().getCategoryCodes("func").createThread([{type:"func_"+b.id}]),b.blockMenuBlock=this._targetFuncBlock)}}; -Entry.Func.executeFunction=function(b){var a=this.threads[b];if(a=Entry.Engine.computeThread(a.entity,a))return this.threads[b]=a,!0;delete this.threads[b];return!1};Entry.Func.clearThreads=function(){this.threads={}};Entry.Func.prototype.init=function(b){this.id=b.id;this.content=Blockly.Xml.textToDom(b.content);this.block=Blockly.Xml.textToDom(""+b.block+"").childNodes[0]};Entry.Func.prototype.destroy=function(){this.blockMenuBlock.destroy()}; -Entry.Func.edit=function(b){this.cancelEdit();this.targetFunc=b;this.initEditView(b.content);this.bindFuncChangeEvent();this.updateMenu()};Entry.Func.initEditView=function(b){this.menuCode||this.setupMenuCode();var a=Entry.playground.mainWorkspace;a.setMode(Entry.Workspace.MODE_OVERLAYBOARD);a.changeOverlayBoardCode(b);this._workspaceStateEvent=a.changeEvent.attach(this,this.endEdit)}; -Entry.Func.endEdit=function(b){this.unbindFuncChangeEvent();this._workspaceStateEvent.destroy();delete this._workspaceStateEvent;switch(b){case "save":this.save();case "cancelEdit":this.cancelEdit()}};Entry.Func.save=function(){this.targetFunc.generateBlock(!0);Entry.variableContainer.saveFunction(this.targetFunc)}; -Entry.Func.syncFuncName=function(b){var a=0,c=[],c=b.split(" "),d="";b=[];b=Blockly.mainWorkspace.getAllBlocks();for(var e=0;eBlockly.Block.dragMode_&&(b.updateMenu(),b.fieldText=a,b.workspaceLength=c)}}; -Entry.Func.setupMenuCode=function(){var b=Entry.playground.mainWorkspace;b&&(b=b.getBlockMenu().getCategoryCodes("func"),this._fieldLabel=b.createThread([{type:"function_field_label"}]).getFirstBlock(),this._fieldString=b.createThread([{type:"function_field_string",params:[{type:this.requestParamBlock("string")}]}]).getFirstBlock(),this._fieldBoolean=b.createThread([{type:"function_field_boolean",params:[{type:this.requestParamBlock("boolean")}]}]).getFirstBlock(),this.menuCode=b)}; -Entry.Func.refreshMenuCode=function(){if(Entry.playground.mainWorkspace){this.menuCode||this.setupMenuCode();var b=Entry.block[this._fieldString.params[0].type].changeEvent._listeners.length;2'));this._hwModule=b;var a=this;Entry.addEventListener("windowResized",function(){var b=a._hwModule.monitorTemplate.mode;"both"==b&&(a.resize(),a.resizeList());"list"==b?a.resizeList():a.resize()});Entry.addEventListener("hwModeChange",function(){a.changeMode()});this.changeOffset=0;this.scale=.5;this._listPortViews={}}; -(function(b){b.initView=function(){this.svgDom=Entry.Dom($(''))};b.generateView=function(){this.snap=Entry.SVG("hwMonitor");this._svgGroup=this.snap.elem("g");this._portMap={n:[],e:[],s:[],w:[]};var a=this._hwModule.monitorTemplate,b={href:Entry.mediaFilePath+a.imgPath,x:-a.width/2,y:-a.height/2,width:a.width,height:a.height};this._portViews={};this.hwView=this._svgGroup.elem("image");this.hwView= -this.hwView.attr(b);this._template=a;a=a.ports;this.pathGroup=null;this.pathGroup=this._svgGroup.elem("g");var b=[],d;for(d in a){var e=this.generatePortView(a[d],"_svgGroup");this._portViews[d]=e;b.push(e)}b.sort(function(a,b){return a.box.x-b.box.x});var f=this._portMap;b.map(function(a){(1>(Math.atan2(-a.box.y,a.box.x)/Math.PI+2)%2?f.n:f.s).push(a)});this.resize()};b.toggleMode=function(a){var b=this._hwModule.monitorTemplate;"list"==a?(b.TempPort=null,this._hwModule.monitorTemplate.ports&&(this._hwModule.monitorTemplate.TempPort= -this._hwModule.monitorTemplate.ports,this._hwModule.monitorTemplate.listPorts=this.addPortEle(this._hwModule.monitorTemplate.listPorts,this._hwModule.monitorTemplate.ports)),$(this._svglistGroup).remove(),this._svgGroup&&$(this._svgGroup).remove(),$(this._pathGroup).remove(),this._hwModule.monitorTemplate.mode="list",this.generateListView()):(this._hwModule.monitorTemplate.TempPort&&(this._hwModule.monitorTemplate.ports=this._hwModule.monitorTemplate.TempPort,this._hwModule.monitorTemplate.listPorts= -this.removePortEle(this._hwModule.monitorTemplate.listPorts,this._hwModule.monitorTemplate.ports)),$(this._svglistGroup).remove(),this._hwModule.monitorTemplate.mode="both",this.generateListView(),this.generateView())};b.setHwmonitor=function(a){this._hwmodule=a};b.changeMode=function(a){"both"==this._hwModule.monitorTemplate.mode?this.toggleMode("list"):"list"==this._hwModule.monitorTemplate.mode&&this.toggleMode("both")};b.addPortEle=function(a,b){if("object"!=typeof b)return a;for(var d in b)a[d]= -b[d];return a};b.removePortEle=function(a,b){if("object"!=typeof b)return a;for(var d in b)delete a[d];return a};b.generateListView=function(){this._portMapList={n:[]};this._svglistGroup=null;this.listsnap=Entry.SVG("hwMonitor");this._svglistGroup=this.listsnap.elem("g");var a=this._hwModule.monitorTemplate;this._template=a;a=a.listPorts;this.pathGroup=this._svglistGroup.elem("g");var b=[],d;for(d in a){var e=this.generatePortView(a[d],"_svglistGroup");this._listPortViews[d]=e;b.push(e)}var f=this._portMapList; -b.map(function(a){f.n.push(a)});this.resizeList()};b.generatePortView=function(a,b){var d=this[b].elem("g");d.addClass("hwComponent");var e=null,e=this.pathGroup.elem("path").attr({d:"m0,0",fill:"none",stroke:"input"===a.type?"#00979d":"#A751E3","stroke-width":3}),f=d.elem("rect").attr({x:0,y:0,width:150,height:22,rx:4,ry:4,fill:"#fff",stroke:"#a0a1a1"}),g=d.elem("text").attr({x:4,y:12,fill:"#000","class":"hwComponentName","alignment-baseline":"central"});g.textContent=a.name;g=g.getComputedTextLength(); -d.elem("rect").attr({x:g+8,y:2,width:30,height:18,rx:9,ry:9,fill:"input"===a.type?"#00979d":"#A751E3"});var h=d.elem("text").attr({x:g+13,y:12,fill:"#fff","class":"hwComponentValue","alignment-baseline":"central"});h.textContent=0;g+=40;f.attr({width:g});return{group:d,value:h,type:a.type,path:e,box:{x:a.pos.x-this._template.width/2,y:a.pos.y-this._template.height/2,width:g},width:g}};b.getView=function(){return this.svgDom};b.update=function(){var a=Entry.hw.portData,b=Entry.hw.sendQueue,d=this._hwModule.monitorTemplate.mode, -e=this._hwModule.monitorTemplate.keys||[],f=[];if("list"==d)f=this._listPortViews;else if("both"==d){if(f=this._listPortViews,this._portViews)for(var g in this._portViews)f[g]=this._portViews[g]}else f=this._portViews;if(b)for(g in b)0!=b[g]&&f[g]&&(f[g].type="output");for(var h in f)if(d=f[h],"input"==d.type){var k=a[h];0=this._template.height||0>=a.height||(this.scale=a.height/this._template.height* -this._template.height/1E3,this.align())};b.resizeList=function(){var a=this.svgDom.get(0).getBoundingClientRect();this._svglistGroup.attr({transform:"translate("+a.width/2+","+a.height/2+")"});this._rect=a;this.alignList()};b.align=function(){var a=[],a=this._portMap.s.concat();this._alignNS(a,this.scale/3*this._template.height+5,27);a=this._portMap.n.concat();this._alignNS(a,-this._template.height*this.scale/3-32,-27);a=this._portMap.e.concat();this._alignEW(a,-this._template.width*this.scale/3- -5,-27);a=this._portMap.w.concat();this._alignEW(a,this._template.width*this.scale/3-32,-27)};b.alignList=function(){for(var a={},a=this._hwModule.monitorTemplate.listPorts,b=a.length,d=0;dd-(l.width+m.width/2.2)&&(f+=1,initX=h,g=0)};b._movePort=function(a,b,d,e){var f=b,g=a.box.x*this.scale,h=a.box.y*this.scale; -b>e?(f=b-a.width,b=b>g&&g>e?"M"+g+","+d+"L"+g+","+h:"M"+(b+e)/2+","+d+"l0,"+(h>d?28:-3)+"H"+g+"L"+g+","+h):b=bd?28:-3)+"H"+g+"L"+g+","+h;a.group.attr({transform:"translate("+f+","+d+")"});a.path.attr({d:b})}})(Entry.HWMonitor.prototype);Entry.HW=function(){this.connectTrial=0;this.isFirstConnect=!0;this.initSocket();this.connected=!1;this.portData={};this.sendQueue={};this.outputQueue={};this.settingQueue={};this.socketType=this.hwModule=this.selectedDevice=null;Entry.addEventListener("stop",this.setZero);this.hwInfo={11:Entry.Arduino,19:Entry.ArduinoExt,12:Entry.SensorBoard,13:Entry.CODEino,14:Entry.joystick,15:Entry.dplay,16:Entry.nemoino,17:Entry.Xbot,18:Entry.ardublock,24:Entry.Hamster,25:Entry.Albert,31:Entry.Bitbrick,42:Entry.Arduino, -51:Entry.Neobot,71:Entry.Robotis_carCont,72:Entry.Robotis_openCM70,81:Entry.Arduino}};Entry.HW.TRIAL_LIMIT=1;p=Entry.HW.prototype; -p.initSocket=function(){try{if(this.connectTrial>=Entry.HW.TRIAL_LIMIT)this.isFirstConnect||Entry.toast.alert(Lang.Menus.connect_hw,Lang.Menus.connect_fail,!1),this.isFirstConnect=!1;else{var b=this,a,c;this.connected=!1;this.connectTrial++;if(-1>>>>>> entrylabs/master Entry.Stage.prototype.initHandle=function(){this.handle=new EaselHandle(this.canvas);this.handle.setChangeListener(this,this.updateHandle);this.handle.setEditStartListener(this,this.startEdit);this.handle.setEditEndListener(this,this.endEdit)}; Entry.Stage.prototype.updateObject=function(){Entry.requestUpdate=!0;this.handle.setDraggable(!0);if(!this.editEntity){var a=this.selectedObject;if(a){"textBox"==a.objectType?this.handle.toggleCenter(!1):this.handle.toggleCenter(!0);"free"==a.getRotateMethod()?this.handle.toggleRotation(!0):this.handle.toggleRotation(!1);this.handle.toggleDirection(!0);a.getLock()?(this.handle.toggleRotation(!1),this.handle.toggleDirection(!1),this.handle.toggleResize(!1),this.handle.toggleCenter(!1),this.handle.setDraggable(!1)): this.handle.toggleResize(!0);this.handle.setVisible(!0);var b=a.entity;this.handle.setWidth(b.getScaleX()*b.getWidth());this.handle.setHeight(b.getScaleY()*b.getHeight());var c,d;if("textBox"==b.type)if(b.getLineBreak())c=b.regX*b.scaleX,d=-b.regY*b.scaleY;else{var e=b.getTextAlign();d=-b.regY*b.scaleY;switch(e){case Entry.TEXT_ALIGN_LEFT:c=-b.getWidth()/2*b.scaleX;break;case Entry.TEXT_ALIGN_CENTER:c=b.regX*b.scaleX;break;case Entry.TEXT_ALIGN_RIGHT:c=b.getWidth()/2*b.scaleX}}else c=(b.regX-b.width/ @@ -1753,8 +1322,9 @@ Entry.Toast.prototype.success=function(a,b,c){var d=Entry.createElement("div","e Entry.Toast.prototype.alert=function(a,b,c){var d=Entry.createElement("div","entryToast");d.addClass("entryToast");d.addClass("entryToastAlert");d.bindOnClick(function(){Entry.toast.body_.removeChild(this)});var e=Entry.createElement("div","entryToast");e.addClass("entryToastTitle");e.innerHTML=a;d.appendChild(e);a=Entry.createElement("p","entryToast");a.addClass("entryToastMessage");a.innerHTML=b;d.appendChild(a);this.toasts_.push(d);this.body_.appendChild(d);c||window.setTimeout(function(){d.style.opacity= 1;var b=setInterval(function(){.05>d.style.opacity&&(clearInterval(b),d.style.display="none",Entry.toast.body_.removeChild(d));d.style.opacity*=.9},20)},5E3)};Entry.TvCast=function(a){this.generateView(a)};p=Entry.TvCast.prototype;p.init=function(a){this.tvCastHash=a};p.generateView=function(a){var b=Entry.createElement("div");b.addClass("entryContainerMovieWorkspace");b.addClass("entryRemove");this.movieContainer=b;b=Entry.createElement("iframe");b.setAttribute("id","tvCastIframe");b.setAttribute("allowfullscreen","");b.setAttribute("frameborder",0);b.setAttribute("src",a);this.movieFrame=b;this.movieContainer.appendChild(this.movieFrame)};p.getView=function(){return this.movieContainer}; p.resize=function(){document.getElementById("entryContainerWorkspaceId");var a=document.getElementById("tvCastIframe");w=this.movieContainer.offsetWidth;a.width=w+"px";a.height=9*w/16+"px"};Entry.ContextMenu={}; -(function(a){a.createDom=function(){this.dom=Entry.Dom("ul",{id:"entry-contextmenu",parent:$("body")});Entry.Utils.disableContextmenu(this.dom);Entry.documentMousedown.attach(this,function(){this.hide()})};a.show=function(b,a){this.dom||this.createDom();if(0!==b.length){var d=this;void 0!==a&&(this._className=a,this.dom.addClass(a));a=this.dom;a.empty();for(var e=0,f=b.length;eg&&(b.x-=d+3);b.y+e>f&&(b.y-=e);a.css({left:b.x,top:b.y})};a.hide=function(){this.dom.empty();this.dom.addClass("entryRemove");this._className&&(this.dom.removeClass(this._className),delete this._className)}})(Entry.ContextMenu);Entry.Loader={queueCount:0,totalCount:0};Entry.Loader.addQueue=function(a){this.queueCount||Entry.dispatchEvent("loadStart");this.queueCount++;this.totalCount++};Entry.Loader.removeQueue=function(a){this.queueCount--;this.queueCount||(Entry.dispatchEvent("loadComplete"),this.totalCount=0)};Entry.Loader.getLoadedPercent=function(){return 0===this.totalCount?1:this.queueCount/this.totalCount};Entry.Variable=function(a){Entry.assert("string"==typeof a.name,"Variable name must be given");this.name_=a.name;this.id_=a.id?a.id:Entry.generateHash();this.type=a.variableType?a.variableType:"variable";this.object_=a.object||null;this.isCloud_=a.isCloud||!1;this._valueWidth=this._nameWidth=null;var b=Entry.parseNumber(a.value);this.value_="number"==typeof b?b:a.value?a.value:0;"slide"==this.type?(this.minValue_=Number(a.minValue?a.minValue:0),this.maxValue_=Number(a.maxValue?a.maxValue:100)):"list"== +(function(a){a.visible=!1;a.createDom=function(){this.dom=Entry.Dom("ul",{id:"entry-contextmenu",parent:$("body")});this.dom.bind("mousedown touchstart",function(b){b.stopPropagation()});Entry.Utils.disableContextmenu(this.dom);Entry.documentMousedown.attach(this,function(){this.hide()})};a.show=function(b,a,d){this.dom||this.createDom();if(0!==b.length){var e=this;void 0!==a&&(this._className=a,this.dom.addClass(a));a=this.dom;a.empty();for(var f=0,g=b.length;fg&&(b.x-=d+3);b.y+e>f&&(b.y-=e);a.css({left:b.x,top:b.y})};a.hide=function(){this.visible= +!1;this.dom.empty();this.dom.addClass("entryRemove");this._className&&(this.dom.removeClass(this._className),delete this._className)}})(Entry.ContextMenu);Entry.Loader={queueCount:0,totalCount:0};Entry.Loader.addQueue=function(a){this.queueCount||Entry.dispatchEvent("loadStart");this.queueCount++;this.totalCount++};Entry.Loader.removeQueue=function(a){this.queueCount--;this.queueCount||(Entry.dispatchEvent("loadComplete"),this.totalCount=0)};Entry.Loader.getLoadedPercent=function(){return 0===this.totalCount?1:this.queueCount/this.totalCount};Entry.Variable=function(a){Entry.assert("string"==typeof a.name,"Variable name must be given");this.name_=a.name;this.id_=a.id?a.id:Entry.generateHash();this.type=a.variableType?a.variableType:"variable";this.object_=a.object||null;this.isCloud_=a.isCloud||!1;this._valueWidth=this._nameWidth=null;var b=Entry.parseNumber(a.value);this.value_="number"==typeof b?b:a.value?a.value:0;"slide"==this.type?(this.minValue_=Number(a.minValue?a.minValue:0),this.maxValue_=Number(a.maxValue?a.maxValue:100)):"list"== this.type&&(this.array_=a.array?a.array:[]);a.isClone||(this.visible_=a.visible||"boolean"==typeof a.visible?a.visible:!0,this.x_=a.x?a.x:null,this.y_=a.y?a.y:null,"list"==this.type&&(this.width_=a.width?a.width:100,this.height_=a.height?a.height:120,this.scrollPosition=0),this.BORDER=6,this.FONT="10pt NanumGothic")}; Entry.Variable.prototype.generateView=function(a){var b=this.type;if("variable"==b||"timer"==b||"answer"==b)this.view_=new createjs.Container,this.rect_=new createjs.Shape,this.view_.addChild(this.rect_),this.view_.variable=this,this.wrapper_=new createjs.Shape,this.view_.addChild(this.wrapper_),this.textView_=new createjs.Text("asdf",this.FONT,"#000000"),this.textView_.textBaseline="alphabetic",this.textView_.x=4,this.textView_.y=1,this.view_.addChild(this.textView_),this.valueView_=new createjs.Text("asdf", "10pt NanumGothic","#ffffff"),this.valueView_.textBaseline="alphabetic",b=Entry.variableContainer.variables_.length,this.getX()&&this.getY()?(this.setX(this.getX()),this.setY(this.getY())):(this.setX(-230+80*Math.floor(b/11)),this.setY(24*a+20-135-264*Math.floor(b/11))),this.view_.visible=this.visible_,this.view_.addChild(this.valueView_),this.view_.on("mousedown",function(b){"workspace"==Entry.type&&(this.offset={x:this.x-(.75*b.stageX-240),y:this.y-(.75*b.stageY-135)},this.cursor="move")}),this.view_.on("pressmove", @@ -2003,7 +1573,6 @@ a.buzzer=0;return b.callReturn()}b.isStart=!0;b.timeFlag=1;a.buzzer=440;a.note=0 isNotFor:["albert"],func:function(a,b){a=Entry.hw.sendQueue;var c=b.getNumberValue("VALUE");a.buzzer=void 0!=a.buzzer?a.buzzer+c:c;a.note=0;return b.callReturn()}},albert_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:"albert_set_buzzer_to"},paramsKeyMap:{VALUE:0},"class":"albert_buzzer",isNotFor:["albert"],func:function(a, b){a=Entry.hw.sendQueue;a.buzzer=b.getNumberValue("VALUE");a.note=0;return b.callReturn()}},albert_clear_buzzer:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"albert_clear_buzzer"},"class":"albert_buzzer",isNotFor:["albert"],func:function(a,b){a=Entry.hw.sendQueue;a.buzzer=0;a.note=0;return b.callReturn()}},albert_play_note_for:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown", options:[[Lang.General.note_c+"","4"],[Lang.General.note_c+"#","5"],[Lang.General.note_d+"","6"],[Lang.General.note_e+"b","7"],[Lang.General.note_e+"","8"],[Lang.General.note_f+"","9"],[Lang.General.note_f+"#","10"],[Lang.General.note_g+"","11"],[Lang.General.note_g+"#","12"],[Lang.General.note_a+"","13"],[Lang.General.note_b+"b","14"],[Lang.General.note_b+"","15"]],value:"4",fontSize:11},{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"]],value:"1",fontSize:11}, -<<<<<<< HEAD {type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,"4",{type:"text",params:["0.5"]},null],type:"albert_play_note_for"},paramsKeyMap:{NOTE:0,OCTAVE:1,VALUE:2},"class":"albert_buzzer",isNotFor:["albert"],func:function(a,b){var c=Entry.hw.sendQueue;if(b.isStart){if(1==b.timeFlag)return b;delete b.isStart;delete b.timeFlag;Entry.engine.isContinue=!1;c.note=0;return b.callReturn()}a=b.getNumberField("NOTE",b);var d=b.getNumberField("OCTAVE", b),e=6E4*b.getNumberValue("VALUE",b)/Entry.Albert.tempo;b.isStart=!0;b.timeFlag=1;c.buzzer=0;c.note=a+12*(d-1);if(100b){var f=a;a=b;b=f}c=(b-a)/(e-d)*(c-d);c+=a;c=Math.min(b,c);c=Math.max(a,c);return Math.round(c)}},cobl_read_ultrason:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"1. \ucd08\uc74c\ud30c\uac70\ub9ac(0~400)",def:{type:"cobl_read_ultrason"},class:"test",func:function(a,b){return Entry.hw.getAnalogPortValue("ultrason")}},cobl_read_potenmeter:{color:"#00979D",fontColor:"#fff", -skeleton:"basic_string_field",template:"2.\uac00\ubcc0\uc800\ud56d(0~1023)",def:{type:"cobl_read_potenmeter"},class:"test",func:function(a,b){return Entry.hw.getAnalogPortValue("potenmeter")}},cobl_read_irread1:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"3.\uc801\uc678\uc120\uc13c\uc11c1(0~1023)",def:{type:"cobl_read_irread1"},class:"test",func:function(a,b){return Entry.hw.getAnalogPortValue("irread1")}},cobl_read_irread2:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field", -template:"4.\uc801\uc678\uc120\uc13c\uc11c2(0~1023)",def:{type:"cobl_read_irread2"},class:"test",func:function(a,b){return Entry.hw.getAnalogPortValue("irread2")}},cobl_read_joyx:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"5.\uc870\uc774\uc2a4\ud2f1X\ucd95(1, 0, -1)",def:{type:"cobl_read_joyx"},class:"test",func:function(a,b){return Entry.hw.getAnalogPortValue("joyx")}},cobl_read_joyy:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"6.\uc870\uc774\uc2a4\ud2f1Y\ucd95(1, 0, -1)", -def:{type:"cobl_read_joyy"},class:"test",func:function(a,b){return Entry.hw.getAnalogPortValue("joyy")}},cobl_read_tilt:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"7.\uae30\uc6b8\uae30\uc13c\uc11c(0~4)",def:{type:"cobl_read_tilt"},class:"test",func:function(a,b){return Entry.hw.getAnalogPortValue("tilt")}},cobl_read_temps:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"8.\uc628\ub3c4\uc13c\uc11c@\ud3ec\ud2b8%1",params:[{type:"Dropdown",options:[["1", -"1"],["2","2"]],fontSize:11}],def:{params:["1"],type:"cobl_read_temps"},paramsKeyMap:{VALUE:0},class:"test",func:function(a,b){a=b.getValue("VALUE",b);if(1==a)return Entry.hw.getAnalogPortValue("temps1");if(2==a)return Entry.hw.getAnalogPortValue("temps2")}},cobl_read_light:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"9.\ube5b\uc13c\uc11c@\ud3ec\ud2b8%1",params:[{type:"Dropdown",options:[["1","1"],["2","2"]],fontSize:11}],def:{params:["1"],type:"cobl_read_light"},paramsKeyMap:{VALUE:0}, -class:"test",func:function(a,b){a=b.getValue("VALUE",b);if(1==a)return Entry.hw.getAnalogPortValue("light1");if(2==a)return Entry.hw.getAnalogPortValue("light2")}},cobl_read_btn:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",template:"10.\ubc84\ud2bc\uc2a4\uc704\uce58@\ud3ec\ud2b8%1",params:[{type:"Dropdown",options:[["1","1"],["2","2"]],fontSize:11}],def:{params:["1"],type:"cobl_read_btn"},paramsKeyMap:{VALUE:0},class:"test",func:function(a,b){a=b.getValue("VALUE",b);if(1==a)return Entry.hw.getDigitalPortValue("btn1"); -if(2==a)return Entry.hw.getDigitalPortValue("btn2")}},cobl_led_control:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"11.\ubb34\uc9c0\uac1cLED%1%2",params:[{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"]],fontSize:11},{type:"Dropdown",options:[["OFF","OFF"],["\ube68\uac15","Red"],["\uc8fc\ud669","Orange"],["\ub178\ub791","Yellow"],["\ucd08\ub85d","Green"],["\ud30c\ub791","Blue"],["\ub0a8\uc0c9","Dark Blue"],["\ubcf4\ub77c","Purple"],["\ud770\uc0c9","White"]],fontSize:11}],def:{params:["1", -"OFF"],type:"cobl_led_control"},paramsKeyMap:{PORT:0,OPERATOR:0},class:"test",func:function(a,b){a=b.getStringField("PORT");var c=b.getStringField("OPERATOR");Entry.hw.setDigitalPortValue("RainBowLED_"+a,c);Entry.hw.update();delete Entry.hw.sendQueue["RainBowLED_"+a];return b.callReturn()}},cobl_servo_angle_control:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"12.\uac01\ub3c4\ubaa8\ud130 \uac01\ub3c4%1(15~165)",params:[{type:"TextInput",value:0}],def:{type:"cobl_servo_angle_control"}, -paramsKeyMap:{VALUE:0},class:"test",func:function(a,b){PORT=1;console.log("servo - test");a=b.getNumberValue("PORT");var c=b.getNumberValue("VALUE"),c=Math.round(c),c=Math.max(c,15),c=Math.min(c,165);1==a&&(console.log("servo 1 degree "+c),Entry.hw.setDigitalPortValue("Servo1",c),Entry.hw.update(),delete Entry.hw.sendQueue.Servo1);2==a&&(console.log("servo 2 degree "+c),Entry.hw.setDigitalPortValue("Servo2",c),Entry.hw.update(),delete Entry.hw.sendQueue.Servo2);return b.callReturn()}},cobl_melody:{color:"#00979D", -fontColor:"#fff",skeleton:"basic",template:"13.\uba5c\ub85c\ub514%1",params:[{type:"Dropdown",options:[["((\ub0ae\uc740)\uc194","L_So"],["(\ub0ae\uc740)\uc194#","L_So#"],["(\ub0ae\uc740)\ub77c","L_La"],["(\ub0ae\uc740)\ub77c#","L_La#"],["(\ub0ae\uc740)\uc2dc","L_Ti"],["\ub3c4","Do"],["\ub3c4#","Do#"],["\ub808","Re"],["\ub808#","Re#"],["\ubbf8","Mi"],["\ud30c","Fa"],["\ud30c#","Fa#"],["\uc194","So"],["\uc194#","So#"],["\ub77c","La"],["\ub77c#","La#"],["\uc2dc","Ti"],["(\ub192\uc740)\ub3c4","H_Do"], -["(\ub192\uc740)\ub3c4#","H_Do#"],["(\ub192\uc740)\ub808","H_Re"],["(\ub192\uc740)\ub808#","H_Re#"],["(\ub192\uc740)\ubbf8#","H_Mi"],["(\ub192\uc740)\ud30c","H_Fa"]],fontSize:11}],def:{params:["Do"],type:"cobl_melody"},paramsKeyMap:{MELODY:0},class:"test",func:function(a,b){a=b.getStringField("MELODY");console.log("cobl_melody"+a);Entry.hw.setDigitalPortValue("Melody",a);Entry.hw.update();delete Entry.hw.sendQueue.Melody;return b.callReturn()}},cobl_dcmotor:{color:"#00979D",fontColor:"#fff",skeleton:"basic", -template:"14.\ud68c\uc804\ubaa8\ud130%1%2\uc18d\ub3c4%3",params:[{type:"Dropdown",options:[["1","1"],["2","2"]],fontSize:11},{type:"Dropdown",options:[["1.\uc2dc\uacc4\ubc29\ud5a5","1"],["2.\ubc18\uc2dc\uacc4\ubc29\ud5a5","2"],["3.\uc815\uc9c0","3"]],fontSize:11},{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"],["4","4"],["5","5"]],fontSize:11}],def:{params:["1","1","1"],type:"cobl_dcmotor"},paramsKeyMap:{MOTOR:0,DIRECTION:0,SPEED:0},class:"test",func:function(a,b){a=b.getStringField("MOTOR"); +b),e=b.getNumberValue("VALUE3",b);a=b.getNumberValue("VALUE4",b);b=b.getNumberValue("VALUE5",b);if(a>b){var f=a;a=b;b=f}c=(b-a)/(e-d)*(c-d);c+=a;c=Math.min(b,c);c=Math.max(a,c);return Math.round(c)}},cobl_read_ultrason:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"1. \ucd08\uc74c\ud30c\uac70\ub9ac(0~400)",def:{type:"cobl_read_ultrason"},class:"test",isNotFor:["cobl"],func:function(a,b){return Entry.hw.getAnalogPortValue("ultrason")}},cobl_read_potenmeter:{color:"#00979D", +fontColor:"#fff",skeleton:"basic_string_field",template:"2.\uac00\ubcc0\uc800\ud56d(0~1023)",def:{type:"cobl_read_potenmeter"},class:"test",isNotFor:["cobl"],func:function(a,b){return Entry.hw.getAnalogPortValue("potenmeter")}},cobl_read_irread1:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"3.\uc801\uc678\uc120\uc13c\uc11c1(0~1023)",def:{type:"cobl_read_irread1"},class:"test",isNotFor:["cobl"],func:function(a,b){return Entry.hw.getAnalogPortValue("irread1")}},cobl_read_irread2:{color:"#00979D", +fontColor:"#fff",skeleton:"basic_string_field",template:"4.\uc801\uc678\uc120\uc13c\uc11c2(0~1023)",def:{type:"cobl_read_irread2"},class:"test",isNotFor:["cobl"],func:function(a,b){return Entry.hw.getAnalogPortValue("irread2")}},cobl_read_joyx:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"5.\uc870\uc774\uc2a4\ud2f1X\ucd95(1, 0, -1)",def:{type:"cobl_read_joyx"},class:"test",isNotFor:["cobl"],func:function(a,b){return Entry.hw.getAnalogPortValue("joyx")}},cobl_read_joyy:{color:"#00979D", +fontColor:"#fff",skeleton:"basic_string_field",template:"6.\uc870\uc774\uc2a4\ud2f1Y\ucd95(1, 0, -1)",def:{type:"cobl_read_joyy"},class:"test",isNotFor:["cobl"],func:function(a,b){return Entry.hw.getAnalogPortValue("joyy")}},cobl_read_tilt:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",template:"7.\uae30\uc6b8\uae30\uc13c\uc11c(0~4)",def:{type:"cobl_read_tilt"},class:"test",isNotFor:["cobl"],func:function(a,b){return Entry.hw.getAnalogPortValue("tilt")}},cobl_read_temps:{color:"#00979D", +fontColor:"#fff",skeleton:"basic_string_field",template:"8.\uc628\ub3c4\uc13c\uc11c@\ud3ec\ud2b8%1 %2",params:[{type:"Dropdown",options:[["1","1"],["2","2"]],fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],def:{params:["1"],type:"cobl_read_temps"},paramsKeyMap:{VALUE:0},class:"test",isNotFor:["cobl"],func:function(a,b){a=b.getValue("VALUE",b);if(1==a)return Entry.hw.getAnalogPortValue("temps1");if(2==a)return Entry.hw.getAnalogPortValue("temps2")}},cobl_read_light:{color:"#00979D", +fontColor:"#fff",skeleton:"basic_string_field",template:"9.\ube5b\uc13c\uc11c@\ud3ec\ud2b8%1 %2",params:[{type:"Dropdown",options:[["1","1"],["2","2"]],fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],def:{params:["1"],type:"cobl_read_light"},paramsKeyMap:{VALUE:0},class:"test",isNotFor:["cobl"],func:function(a,b){a=b.getValue("VALUE",b);if(1==a)return Entry.hw.getAnalogPortValue("light1");if(2==a)return Entry.hw.getAnalogPortValue("light2")}},cobl_read_btn:{color:"#00979D", +fontColor:"#fff",skeleton:"basic_boolean_field",template:"10.\ubc84\ud2bc\uc2a4\uc704\uce58@\ud3ec\ud2b8%1 %2",params:[{type:"Dropdown",options:[["1","1"],["2","2"]],fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],def:{params:["1"],type:"cobl_read_btn"},paramsKeyMap:{VALUE:0},class:"test",isNotFor:["cobl"],func:function(a,b){a=b.getValue("VALUE",b);if(1==a)return Entry.hw.getDigitalPortValue("btn1");if(2==a)return Entry.hw.getDigitalPortValue("btn2")}},cobl_led_control:{color:"#00979D", +fontColor:"#fff",skeleton:"basic",template:"11.\ubb34\uc9c0\uac1cLED%1%2 %3",params:[{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"]],fontSize:11},{type:"Dropdown",options:[["OFF","OFF"],["\ube68\uac15","Red"],["\uc8fc\ud669","Orange"],["\ub178\ub791","Yellow"],["\ucd08\ub85d","Green"],["\ud30c\ub791","Blue"],["\ub0a8\uc0c9","Dark Blue"],["\ubcf4\ub77c","Purple"],["\ud770\uc0c9","White"]],fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],def:{params:["1","OFF"],type:"cobl_led_control"}, +paramsKeyMap:{PORT:0,OPERATOR:1},class:"test",isNotFor:["cobl"],func:function(a,b){a=b.getStringField("PORT");var c=b.getStringField("OPERATOR");Entry.hw.setDigitalPortValue("RainBowLED_"+a,c);Entry.hw.update();delete Entry.hw.sendQueue["RainBowLED_"+a];return b.callReturn()}},cobl_servo_angle_control:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"12.\uac01\ub3c4\ubaa8\ud130 \uac01\ub3c4%1(15~165) %2",params:[{type:"TextInput",value:0},{type:"Indicator",img:"block_icon/hardware_03.png", +size:12}],def:{type:"cobl_servo_angle_control"},paramsKeyMap:{VALUE:0},class:"test",isNotFor:["cobl"],func:function(a,b){console.log("servo - test");a=b.getNumberField("VALUE");a=Math.round(a);a=Math.max(a,15);a=Math.min(a,165);console.log("servo 1 degree "+a);Entry.hw.setDigitalPortValue("Servo1",a);Entry.hw.update();delete Entry.hw.sendQueue.Servo1;return b.callReturn()}},cobl_melody:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"13.\uba5c\ub85c\ub514%1 ,%2",params:[{type:"Dropdown", +options:[["((\ub0ae\uc740)\uc194","L_So"],["(\ub0ae\uc740)\uc194#","L_So#"],["(\ub0ae\uc740)\ub77c","L_La"],["(\ub0ae\uc740)\ub77c#","L_La#"],["(\ub0ae\uc740)\uc2dc","L_Ti"],["\ub3c4","Do"],["\ub3c4#","Do#"],["\ub808","Re"],["\ub808#","Re#"],["\ubbf8","Mi"],["\ud30c","Fa"],["\ud30c#","Fa#"],["\uc194","So"],["\uc194#","So#"],["\ub77c","La"],["\ub77c#","La#"],["\uc2dc","Ti"],["(\ub192\uc740)\ub3c4","H_Do"],["(\ub192\uc740)\ub3c4#","H_Do#"],["(\ub192\uc740)\ub808","H_Re"],["(\ub192\uc740)\ub808#","H_Re#"], +["(\ub192\uc740)\ubbf8#","H_Mi"],["(\ub192\uc740)\ud30c","H_Fa"]],fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],def:{params:["Do"],type:"cobl_melody"},paramsKeyMap:{MELODY:0},class:"test",isNotFor:["cobl"],func:function(a,b){a=b.getStringField("MELODY");console.log("cobl_melody"+a);Entry.hw.setDigitalPortValue("Melody",a);Entry.hw.update();delete Entry.hw.sendQueue.Melody;return b.callReturn()}},cobl_dcmotor:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"14.\ud68c\uc804\ubaa8\ud130%1%2\uc18d\ub3c4%3 %4", +params:[{type:"Dropdown",options:[["1","1"],["2","2"]],fontSize:11},{type:"Dropdown",options:[["1.\uc2dc\uacc4\ubc29\ud5a5","1"],["2.\ubc18\uc2dc\uacc4\ubc29\ud5a5","2"],["3.\uc815\uc9c0","3"]],fontSize:11},{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"],["4","4"],["5","5"]],fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],def:{params:["1","1","1"],type:"cobl_dcmotor"},paramsKeyMap:{MOTOR:0,DIRECTION:1,SPEED:2},class:"test",isNotFor:["cobl"],func:function(a,b){a=b.getStringField("MOTOR"); var c=b.getStringField("DIRECTION"),d=b.getStringField("SPEED");console.log("MOTOR"+a+" Direction"+c+" speed"+d);1==a&&(Entry.hw.setDigitalPortValue("DC1_DIR",c),Entry.hw.setDigitalPortValue("DC1_SPEED",d),Entry.hw.update(),delete Entry.hw.sendQueue.DC1_DIR,delete Entry.hw.sendQueue.DC1_SPEED);2==a&&(Entry.hw.setDigitalPortValue("DC2_DIR",c),Entry.hw.setDigitalPortValue("DC2_SPEED",d),Entry.hw.update(),delete Entry.hw.sendQueue.DC2_DIR,delete Entry.hw.sendQueue.DC2_SPEED);return b.callReturn()}}, -cobl_extention_port:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"15.USB\ud3ec\ud2b8%1\ub2e8\uacc4%2",params:[{type:"Dropdown",options:[["1","1"],["2","2"]],fontSize:11},{type:"Dropdown",options:[["0","0"],["1","1"],["2","2"],["3","3"],["4","4"],["5","5"]],fontSize:11}],def:{params:["1","0"],type:"cobl_extention_port"},paramsKeyMap:{PORT:0,LEVEL:0},class:"test",func:function(a,b){a=b.getStringField("PORT");var c=b.getStringField("LEVEL");1==a&&(Entry.hw.setDigitalPortValue("EXUSB1", -c),Entry.hw.update(),delete Entry.hw.sendQueue.EXUSB1);2==a&&(Entry.hw.setDigitalPortValue("EXUSB2",c),Entry.hw.update(),delete Entry.hw.sendQueue.EXUSB2);return b.callReturn()}},cobl_external_led:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"16.\uc678\ubd80LED%1(1~64)R%2G%3B%4",params:[{type:"TextInput",value:0,fontSize:11},{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"]],fontSize:11},{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"]],fontSize:11},{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"]],fontSize:11}],def:{params:["1","1","1","1"],type:"cobl_external_led"},paramsKeyMap:{LED:0,RED:0,GREEN:0,BLUE:0},class:"test",func:function(a,b){a=b.getNumberValue("LED");var c=b.getStringField("RED"),d=b.getStringField("GREEN"), -e=b.getStringField("BLUE");Entry.hw.setDigitalPortValue("ELED_IDX",a);Entry.hw.setDigitalPortValue("ELED_R",c);Entry.hw.setDigitalPortValue("ELED_G",d);Entry.hw.setDigitalPortValue("ELED_B",e);Entry.hw.update();delete Entry.hw.sendQueue.ELED_IDX;delete Entry.hw.sendQueue.ELED_R;delete Entry.hw.sendQueue.ELED_G;delete Entry.hw.sendQueue.ELED_B;return b.callReturn()}},cobl_7_segment:{color:"#00979D",fontColor:"#fff",skeleton:"basic",template:"17.\uc22b\uc790\uc804\uad11\ud310%1(0~9999)",params:[{type:"TextInput", -value:0}],def:{type:"cobl_7_segment"},paramsKeyMap:{VALUE:0},class:"test",func:function(a,b){a=b.getNumberValue("VALUE");Entry.hw.setDigitalPortValue("7SEG",a);Entry.hw.update();delete Entry.hw.sendQueue["7SEG"];return b.callReturn()}},start_drawing:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"start_drawing"},"class":"brush_control",isNotFor:["textBox"],func:function(a,b){a.brush?a.brush.stop=!1: -Entry.setBasicBrush(a);Entry.stage.sortZorder();a.brush.moveTo(a.getX(),-1*a.getY());return b.callReturn()}},stop_drawing:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"stop_drawing"},"class":"brush_control",isNotFor:["textBox"],func:function(a,b){a.brush&&a.shape&&(a.brush.stop=!0);return b.callReturn()}},set_color:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Color"},{type:"Indicator", -img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"set_color"},paramsKeyMap:{VALUE:0},"class":"brush_color",isNotFor:["textBox"],func:function(a,b){var c=b.getField("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(c=Entry.hex2rgb(c),a.brush.rgb=c,a.brush.endStroke(),a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}},set_random_color:{color:"#FF9E20",skeleton:"basic", -statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"set_random_color"},"class":"brush_color",isNotFor:["textBox"],func:function(a,b){a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);if(a.brush){var c=Entry.generateRgb();a.brush.rgb=c;a.brush.endStroke();a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")");a.brush.moveTo(a.getX(),-1*a.getY())}return b.callReturn()}},change_thickness:{color:"#FF9E20",skeleton:"basic", -statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["1"]},null],type:"change_thickness"},paramsKeyMap:{VALUE:0},"class":"brush_thickness",isNotFor:["textBox"],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(a.brush.thickness+=c,1>a.brush.thickness&&(a.brush.thickness=1),a.brush.setStrokeStyle(a.brush.thickness),a.brush.moveTo(a.getX(), --1*a.getY()));return b.callReturn()}},set_thickness:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["1"]},null],type:"set_thickness"},paramsKeyMap:{VALUE:0},"class":"brush_thickness",isNotFor:["textBox"],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(a.brush.thickness=c,a.brush.setStrokeStyle(a.brush.thickness), -a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}},change_opacity:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_opacity"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);c=Entry.adjustValueWithMaxMin(a.brush.opacity+ -c,0,100);a.brush&&(a.brush.opacity=c,a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}},set_opacity:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["50"]},null],type:"set_opacity"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"], -func:function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(a.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}},brush_erase_all:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"brush_erase_all"}, -"class":"brush_clear",isNotFor:["textBox"],func:function(a,b){var c=a.brush;if(c){var d=c._stroke.style,e=c._strokeStyle.width;c.clear().setStrokeStyle(e).beginStroke(d);c.moveTo(a.getX(),-1*a.getY())}a=a.parent.getStampEntities();a.map(function(b){b.removeClone()});a=null;return b.callReturn()}},brush_stamp:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"brush_stamp"},"class":"stamp",isNotFor:["textBox"], -func:function(a,b){a.parent.addStampEntity(a);return b.callReturn()}},change_brush_transparency:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_brush_transparency"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop= -!0);c=Entry.adjustValueWithMaxMin(a.brush.opacity-c,0,100);a.brush&&(a.brush.opacity=c,a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}},set_brush_tranparency:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["50"]},null],type:"set_brush_tranparency"}, -paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(a.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+(1-a.brush.opacity/100)+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}},number:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"TextInput", -value:10}],events:{},def:{params:[]},paramsKeyMap:{NUM:0},func:function(a,b){return b.getField("NUM",b)},isPrimitive:!0},angle:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Angle"}],events:{},def:{params:[null],type:"angle"},paramsKeyMap:{ANGLE:0},func:function(a,b){return b.getNumberField("ANGLE")}},get_x_coordinate:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_x_coordinate,color:"#3D3D3D"}],events:{},def:{params:[null], -type:"get_x_coordinate"},"class":"calc",isNotFor:[],func:function(a,b){return a.getX()}},get_y_coordinate:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_y_coordinate,color:"#3D3D3D"}],events:{},def:{params:[null],type:"get_y_coordinate"},"class":"calc",isNotFor:[],func:function(a,b){return a.getY()}},get_angle:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_angle,color:"#3D3D3D"}], -events:{},def:{params:[null]},func:function(a,b){return parseFloat(a.getRotation().toFixed(1))}},get_rotation_direction:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CALC_rotation_value,"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(a,b){return"DIRECTION"==b.getField("OPERATOR", -b).toUpperCase()?parseFloat(a.getDirection().toFixed(1)):parseFloat(a.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(a,b){b=b.getField("VALUE",b);if("mouse"==b)return b=Entry.stage.mouseCoordinate,Math.sqrt(Math.pow(a.getX()-b.x,2)+Math.pow(a.getY()-b.y,2));b=Entry.container.getEntity(b);return Math.sqrt(Math.pow(a.getX()-b.getX(),2)+Math.pow(a.getY()-b.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(a,b){return"x"===b.getField("VALUE",b)?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(a,b){var c=b.getField("VALUE",b);a="self"==c?a:Entry.container.getEntity(c);switch(b.getField("COORDINATE",b)){case "x":return a.getX();case "y":return a.getY();case "rotation":return a.getRotation();case "direction":return a.getDirection(); -case "picture_index":return b=a.parent,b=b.pictures,b.indexOf(a.picture)+1;case "size":return Number(a.getSize().toFixed(1));case "picture_name":return b=a.parent,b=b.pictures,b[b.indexOf(a.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(a,b){a=b.getField("OPERATOR",b);var c=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return"PLUS"==a?c+b:"MINUS"==a?c-b:"MULTI"==a?c*b:c/b}},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(a,b){a=b.getNumberValue("LEFTHAND", -b);b=b.getNumberValue("RIGHTHAND",b);return a+b}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a-b}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a*b}},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(a, -b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a/b}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a%b}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return Math.floor(a/b)}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getField("VALUE",b);if(-1<["asin_radian","acos_radian"].indexOf(b)&&(1a))throw Error("x range exceeded");b.indexOf("_")&& -(b=b.split("_")[0]);-1<["sin","cos","tan"].indexOf(b)&&(a=Entry.toRadian(a));switch(b){case "square":b=a*a;break;case "factorial":b=Entry.factorial(a);break;case "root":b=Math.sqrt(a);break;case "log":b=Math.log(a)/Math.LN10;break;case "ln":b=Math.log(a);break;case "asin":case "acos":case "atan":b=Entry.toDegrees(Math[b](a));break;case "unnatural":b=a-Math.floor(a);0>a&&(b=1-b);break;default:b=Math[b](a)}return b}},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,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_rand_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"number",params:["0"]},null,{type:"number",params:["10"]},null],type:"calc_rand"},paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3},"class":"calc",isNotFor:[],func:function(a,b){a=b.getStringValue("LEFTHAND",b);b=b.getStringValue("RIGHTHAND", -b);var c=Math.min(a,b),d=Math.max(a,b);a=Entry.isFloat(a);return Entry.isFloat(b)||a?(Math.random()*(d-c)+c).toFixed(2):Math.floor(Math.random()*(d-c+1)+c)}},get_date:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_date_1,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_get_date_year,"YEAR"],[Lang.Blocks.CALC_get_date_month,"MONTH"],[Lang.Blocks.CALC_get_date_day,"DAY"],[Lang.Blocks.CALC_get_date_hour,"HOUR"],[Lang.Blocks.CALC_get_date_minute, -"MINUTE"],[Lang.Blocks.CALC_get_date_second,"SECOND"]],value:"YEAR",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_get_date_2,color:"#3D3D3D"}],events:{},def:{params:[null,"YEAR",null],type:"get_date"},paramsKeyMap:{VALUE:1},"class":"calc_date",isNotFor:[],func:function(a,b){a=b.getField("VALUE",b);b=new Date;return"YEAR"==a?b.getFullYear():"MONTH"==a?b.getMonth()+1:"DAY"==a?b.getDate():"HOUR"==a?b.getHours():"MINUTE"==a?b.getMinutes():b.getSeconds()}},get_sound_duration:{color:"#FFD974", -skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_sound_duration_1,color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"sounds",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_get_sound_duration_2,color:"#3D3D3D"}],events:{},def:{params:[null,null,null],type:"get_sound_duration"},paramsKeyMap:{VALUE:1},"class":"calc_duration",isNotFor:[],func:function(a,b){b=b.getField("VALUE",b);a=a.parent.sounds;for(var c= -0;cb||b>a.length-1)throw Error();return a[b]}},length_of_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_length_of_string_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_length_of_string_2, -color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.entry]},null],type:"length_of_string"},paramsKeyMap:{STRING:1},"class":"calc_string",isNotFor:[],func:function(a,b){return b.getStringValue("STRING",b).length}},substring:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_substring_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_substring_2,color:"#3D3D3D"},{type:"Block",accept:"string"}, -{type:"Text",text:Lang.Blocks.CALC_substring_3,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_substring_4,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"number",params:["2"]},null,{type:"number",params:["5"]},null],type:"substring"},paramsKeyMap:{STRING:1,START:3,END:5},"class":"calc_string",isNotFor:[],func:function(a,b){a=b.getStringValue("STRING",b);var c=b.getNumberValue("START",b)-1;b=b.getNumberValue("END", -b)-1;var d=a.length-1;if(0>c||0>b||c>d||b>d)throw Error();return a.substring(Math.min(c,b),Math.max(c,b)+1)}},replace_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_replace_string_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_3,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text", -text:Lang.Blocks.CALC_replace_string_4,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"text",params:[Lang.Blocks.hello]},null,{type:"text",params:[Lang.Blocks.nice]},null],type:"replace_string"},paramsKeyMap:{STRING:1,OLD_WORD:3,NEW_WORD:5},"class":"calc_string",isNotFor:[],func:function(a,b){return b.getStringValue("STRING",b).replace(new RegExp(b.getStringValue("OLD_WORD",b),"gm"),b.getStringValue("NEW_WORD",b))}},change_string_case:{color:"#FFD974", -skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_change_string_case_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_change_string_case_2,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_change_string_case_sub_1,"toUpperCase"],[Lang.Blocks.CALC_change_string_case_sub_2,"toLowerCase"]],value:"toUpperCase",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_change_string_case_3, -color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:["Hello Entry!"]},null,null,null],type:"change_string_case"},paramsKeyMap:{STRING:1,CASE:3},"class":"calc_string",isNotFor:[],func:function(a,b){return b.getStringValue("STRING",b)[b.getField("CASE",b)]()}},index_of_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_index_of_string_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_index_of_string_2, -color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_index_of_string_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"text",params:[Lang.Blocks.entry]},null],type:"index_of_string"},paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3},"class":"calc_string",isNotFor:[],func:function(a,b){a=b.getStringValue("LEFTHAND",b);b=b.getStringValue("RIGHTHAND",b);b=a.indexOf(b);return-1a)throw Error(Lang.Blocks.FLOW_repeat_basic_errorMsg);b.iterCount=Math.floor(a)}if(0==b.iterCount||0>b.iterCount)return delete b.isLooped,delete b.iterCount,b.callReturn();b.iterCount--;return b.getStatement("DO",b)}},repeat_inf:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null], -type:"repeat_inf"},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(a,b){b.isLooped=!0;return b.getStatement("DO")}},stop_repeat:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null],type:"stop_repeat"},"class":"repeat",isNotFor:[],func:function(a,b){return this.executor.breakLoop()}},wait_until_true:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Block",accept:"boolean"},{type:"Indicator", -img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"},null],type:"wait_until_true"},paramsKeyMap:{BOOL:0},"class":"wait",isNotFor:[],func:function(a,b){return b.getBooleanValue("BOOL",b)?b.callReturn():b}},_if:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"},null],type:"_if"},paramsKeyMap:{BOOL:0},statementsKeyMap:{STACK:0}, -"class":"condition",isNotFor:[],func:function(a,b){return b.isCondition?(delete b.isCondition,b.callReturn()):b.getBooleanValue("BOOL",b)?(b.isCondition=!0,b.getStatement("STACK",b)):b.callReturn()}},if_else:{color:"#498deb",skeleton:"basic_double_loop",statements:[{accept:"basic"},{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12},{type:"LineBreak"}],events:{},def:{params:[{type:"True"},null],type:"if_else"},paramsKeyMap:{BOOL:0},statementsKeyMap:{STACK_IF:0, -STACK_ELSE:1},"class":"condition",isNotFor:[],func:function(a,b){if(b.isCondition)return delete b.isCondition,b.callReturn();a=b.getBooleanValue("BOOL",b);b.isCondition=!0;return a?b.getStatement("STACK_IF",b):b.getStatement("STACK_ELSE",b)}},create_clone:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"clone",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null, -null],type:"create_clone"},paramsKeyMap:{VALUE:0},"class":"clone",isNotFor:[],func:function(a,b){var c=b.getField("VALUE",b);b=b.callReturn();"self"==c?a.parent.addCloneEntity(a.parent,a,null):Entry.container.getObject(c).addCloneEntity(a.parent,null,null);return b}},delete_clone:{color:"#498deb",skeleton:"basic_without_next",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null],type:"delete_clone"},"class":"clone",isNotFor:[],func:function(a, -b){if(!a.isClone)return b.callReturn();a.removeClone();return this.die()}},when_clone_start:{color:"#498deb",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_clone.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"when_clone_start"},"class":"clone",isNotFor:[],func:function(a,b){return b.callReturn()},event:"when_clone_start"},stop_run:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png", -size:12}],events:{},def:{params:[null]},func:function(a,b){return Entry.engine.toggleStop()}},repeat_while_true:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Dropdown",options:[[Lang.Blocks.FLOW_repeat_while_true_until,"until"],[Lang.Blocks.FLOW_repeat_while_true_while,"while"]],value:"until",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"}, -null,null],type:"repeat_while_true"},paramsKeyMap:{BOOL:0,OPTION:1},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(a,b){a=b.getBooleanValue("BOOL",b);"until"==b.getField("OPTION",b)&&(a=!a);return(b.isLooped=a)?b.getStatement("DO",b):b.callReturn()}},stop_object:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.FLOW_stop_object_all,"all"],[Lang.Blocks.FLOW_stop_object_this_object,"thisOnly"],[Lang.Blocks.FLOW_stop_object_this_thread, -"thisThread"],[Lang.Blocks.FLOW_stop_object_other_thread,"otherThread"]],value:"all",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null,null],type:"stop_object"},paramsKeyMap:{TARGET:0},"class":"terminate",isNotFor:[],func:function(a,b){var c=b.getField("TARGET",b),d=Entry.container;switch(c){case "all":return d.clearRunningState(),this.die();case "thisOnly":return a.parent.script.clearExecutorsByEntity(a),this.die(); -case "thisObject":return a.parent.script.clearExecutors(),this.die();case "thisThread":return this.die();case "otherThread":c=this.executor;a=a.parent.script;for(var d=a.executors,e=0;eb.count?(50>c.leftFloor&&50>c.rightFloor?b.count++:b.count=0,c=c.leftFloor-c.rightFloor,a.leftWheel=45+.25*c,a.rightWheel=45-.25*c):(b.count=0,b.boardState=2);break;case 2:c=c.leftFloor-c.rightFloor;a.leftWheel=45+.25*c;a.rightWheel=45-.25*c;b.boardState=3;var d=setTimeout(function(){b.boardState=4;Entry.Hamster.removeTimeout(d)},250); -Entry.Hamster.timeouts.push(d);break;case 3:c=c.leftFloor-c.rightFloor;a.leftWheel=45+.25*c;a.rightWheel=45-.25*c;break;case 4:a.leftWheel=0,a.rightWheel=0,b.boardState=0,b.isMoving=!1}return b}delete b.isStart;delete b.isMoving;delete b.count;delete b.boardState;Entry.engine.isContinue=!1;a.leftWheel=0;a.rightWheel=0;return b.callReturn()}b.isStart=!0;b.isMoving=!0;b.count=0;b.boardState=1;a.leftWheel=45;a.rightWheel=45;Entry.Hamster.setLineTracerMode(a,0);return b}},hamster_turn_once:{color:"#00979D", -skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null],type:"hamster_turn_once"},paramsKeyMap:{DIRECTION:0},"class":"hamster_board",isNotFor:["hamster"],func:function(a,b){a=Entry.hw.sendQueue;var c=Entry.hw.portData;if(b.isStart){if(b.isMoving){if(b.isLeft)switch(b.boardState){case 1:2>b.count?50c.leftFloor&&(b.boardState=3);break;case 3:2>b.count?20>c.leftFloor&&b.count++:(b.count=0,b.boardState=4);break;case 4:50b.count?50c.rightFloor&&(b.boardState=3);break;case 3:2>b.count? -20>c.rightFloor&&b.count++:(b.count=0,b.boardState=4);break;case 4:50Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return b.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(a,b){Entry.Hamster.tempo=b.getNumberValue("VALUE");1>Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return b.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(a,b){a=Entry.hw.sendQueue;var c=b.getField("PORT",b),d=Number(b.getField("MODE",b));"A"==c?a.ioModeA=d:("B"!=c&&(a.ioModeA=d),a.ioModeB=d); -return b.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(a,b){a=Entry.hw.sendQueue;var c=b.getField("PORT"),d=b.getNumberValue("VALUE");"A"==c?a.outputA=void 0!=a.outputA?a.outputA+d:d:("B"!=c&&(a.outputA=void 0!=a.outputA?a.outputA+d:d),a.outputB=void 0!=a.outputB?a.outputB+d:d);return b.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(a,b){a=Entry.hw.sendQueue;var c=b.getField("PORT"),d=b.getNumberValue("VALUE");"A"==c?a.outputA=d:("B"!=c&&(a.outputA=d),a.outputB=d);return b.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(a,b){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(a, -b){a=Number(b.getField("VALUE",b));return 0<=Entry.pressedKeys.indexOf(a)}},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(a,b){if(!a.getVisible())return!1;var c=b.getField("VALUE",b);b=a.object;var d=/wall/.test(c),e=ndgmr.checkPixelCollision;if(d)switch(a=Entry.stage.wall,c){case "wall":if(e(b,a.up,.2,!0)||e(b,a.down,.2,!0)||e(b,a.left,.2,!0)||e(b,a.right,.2,!0))return!0;break;case "wall_up":if(e(b,a.up,.2,!0))return!0;break;case "wall_down":if(e(b,a.down,.2,!0))return!0;break;case "wall_right":if(e(b,a.right,.2,!0))return!0;break;case "wall_left":if(e(b,a.left, -.2,!0))return!0}else{if("mouse"==c)return e=Entry.stage.canvas,e=b.globalToLocal(e.mouseX,e.mouseY),b.hitTest(e.x,e.y);c=Entry.container.getEntity(c);if("textBox"==c.type||"textBox"==a.type){e=c.object.getTransformedBounds();b=b.getTransformedBounds();if(Entry.checkCollisionRect(b,e))return!0;a=c.parent.clonedEntities;c=0;for(d=a.length;c","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(a, -b){a=b.getField("OPERATOR",b);var c=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return"EQUAL"==a?c==b:"BIGGER"==a?c>b:c",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(a, -b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a>b}},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(a,b){a=b.getNumberValue("LEFTHAND", -b);b=b.getNumberValue("RIGHTHAND",b);return a","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(a,b){a=b.getField("OPERATOR",b);var c=b.getStringValue("LEFTHAND",b);b=b.getStringValue("RIGHTHAND",b);switch(a){case "EQUAL":return c==b;case "GREATER":return Number(c)>Number(b);case "LESS":return Number(c)=Number(b);case "LESS_OR_EQUAL":return Number(c)<=Number(b)}}}, -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(a,b){a.setVisible(!0);return b.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(a,b){a.setVisible(!1);return b.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(a,b){if(!b.isStart){var c=b.getNumberValue("SECOND",b),d=b.getStringValue("VALUE",b),e=b.getField("OPTION",b);b.isStart=!0;b.timeFlag=1;d||"number"==typeof d||(d=" ");d=Entry.convertToRoundedDecimals(d,3);new Entry.Dialog(a,d,e);a.syncDialogVisible(a.getVisible());setTimeout(function(){b.timeFlag=0},1E3*c)}if(0==b.timeFlag)return delete b.timeFlag,delete b.isStart,a.dialog&&a.dialog.remove(),b.callReturn();a.dialog||(d=b.getStringValue("VALUE",b),e=b.getField("OPTION",b),d||"number"== -typeof d||(d=" "),d=Entry.convertToRoundedDecimals(d,3),new Entry.Dialog(a,d,e),a.syncDialogVisible(a.getVisible()));return b}},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(a,b){var c=b.getStringValue("VALUE",b);c||"number"==typeof c||(c=" ");var d=b.getField("OPTION",b),c=Entry.convertToRoundedDecimals(c,3);new Entry.Dialog(a,c,d);a.syncDialogVisible(a.getVisible());return b.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(a, -b){a.dialog&&a.dialog.remove();return b.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(a,b){var c=b.getField("VALUE",b),c=a.parent.getPicture(c);a.setImage(c);return b.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(a,b){var c;c="prev"!==b.getStringField("DRIECTION")?a.parent.getNextPicture(a.picture.id): -a.parent.getPrevPicture(a.picture.id);a.setImage(c);return b.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(a,b){var c=b.getField("EFFECT",b),d=b.getNumberValue("VALUE",b);"color"==c?a.effect.hue=d+a.effect.hue:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?a.effect.brightness=d+a.effect.brightness:"blur"!=c&&"opacity"==c&&(a.effect.alpha+=d/100));a.applyFilter();return b.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(a,b){var c=b.getField("EFFECT",b),d=b.getNumberValue("VALUE",b);"color"==c?a.effect.hue=d:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?a.effect.brightness= -d:"blur"!=c&&"opacity"==c&&(a.effect.alpha=d/100));a.applyFilter();return b.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(a,b){a.resetFilter();return b.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(a,b){var c=(b.getNumberValue("VALUE",b)+100)/100;a.setScaleX(a.getScaleX()*c);a.setScaleY(a.getScaleY()*c);return b.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(a,b){var c=b.getNumberValue("VALUE",b)/100,d=a.snapshot_;a.setScaleX(c*d.scaleX);a.setScaleY(c*d.scaleY);return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setSize(a.getSize()+c);return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setSize(c);return b.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(a,b){a.setScaleX(-1*a.getScaleX());return b.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(a,b){a.setScaleY(-1*a.getScaleY()); -return b.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(a,b){var c=b.getField("VALUE",b);a=Entry.container.getCurrentObjects().indexOf(a.parent);if(-1a)throw Error("object is not available for current scene");switch(d){case "FRONT":c=0;break;case "FORWARD":c=Math.max(0, -a-1);break;case "BACKWARD":c=Math.min(e,a+1);break;case "BACK":c=e}Entry.container.moveElementByBlock(a,c);return b.callReturn()}},move_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:["10"]},null],type:"move_direction"},paramsKeyMap:{VALUE:0},"class":"walk",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.setX(a.getX()+c*Math.cos((a.getRotation()+ -a.getDirection()-90)/180*Math.PI));a.setY(a.getY()-c*Math.sin((a.getRotation()+a.getDirection()-90)/180*Math.PI));a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}},move_x:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"move_x"},paramsKeyMap:{VALUE:0},"class":"move_relative",isNotFor:[],func:function(a, -b){var c=b.getNumberValue("VALUE",b);a.setX(a.getX()+c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}},move_y:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"move_y"},paramsKeyMap:{VALUE:0},"class":"move_relative",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.setY(a.getY()+c);a.brush&& -!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}},locate_xy_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"locate_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_absolute", -isNotFor:[],func:function(a,b){function c(){var c=b.x-a.getX(),d=b.y-a.getY(),c=c/b.frameCount,d=d/b.frameCount;a.setX(a.getX()+c);a.setY(a.getY()+d);b.frameCount--;a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY())}if(!b.isStart){var d;d=b.getNumberValue("VALUE1",b);b.isStart=!0;b.frameCount=Math.max(Math.floor(d*Entry.FPS),1);b.x=b.getNumberValue("VALUE2",b);b.y=b.getNumberValue("VALUE3",b);1==b.frameCount&&c()}if(0!=b.frameCount)return c(),b;delete b.isStart;delete b.frameCount;return b.callReturn()}}, -rotate_by_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"rotate_by_angle"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.setRotation(a.getRotation()+c);return b.callReturn()}},rotate_by_angle_dropdown:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Dropdown", -options:[["45","45"],["90","90"],["135","135"],["180","180"]],value:"45",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:["45",null],type:"rotate_by_angle_dropdown"},paramsKeyMap:{VALUE:0},"class":"ebs",isNotFor:[],func:function(a,b){var c=b.getField("VALUE",b);a.setRotation(a.getRotation()+Number(c));return b.callReturn()}},see_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png", -size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"see_angle"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.setDirection(c);return b.callReturn()}},see_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"sprites",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{VALUE:0},func:function(a, -b){var c=b.getField("VALUE",b),d=Entry.container.getEntity(c),c=d.getX()-a.getX(),d=d.getY()-a.getY();0<=c?a.setRotation(Math.atan(d/c)/Math.PI*180+90):a.setRotation(Math.atan(d/c)/Math.PI*180+270);return b.callReturn()}},locate_xy:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["0"]},{type:"number",params:["0"]},null],type:"locate_xy"}, -paramsKeyMap:{VALUE1:0,VALUE2:1},"class":"move_absolute",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE1",b),d=b.getNumberValue("VALUE2",b);a.setX(c);a.setY(d);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}},locate_x:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_x"},paramsKeyMap:{VALUE:0}, -"class":"move_absolute",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.setX(c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}},locate_y:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_y"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE", -b);a.setY(c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}},locate:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"locate"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(a,b){var c=b.getField("VALUE",b),d;"mouse"== -c?(c=Entry.stage.mouseCoordinate.x,d=Entry.stage.mouseCoordinate.y):(d=Entry.container.getEntity(c),c=d.getX(),d=d.getY());a.setX(Number(c));a.setY(Number(d));a.brush&&!a.brush.stop&&a.brush.lineTo(c,-1*d);return b.callReturn()}},move_xy_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]}, -{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"move_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_relative",isNotFor:[],func:function(a,b){function c(){a.setX(a.getX()+b.dX);a.setY(a.getY()+b.dY);b.frameCount--;a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY())}if(!b.isStart){var d;d=b.getNumberValue("VALUE1",b);var e=b.getNumberValue("VALUE2",b),f=b.getNumberValue("VALUE3",b);b.isStart=!0;b.frameCount=Math.max(Math.floor(d*Entry.FPS),1);b.dX= -e/b.frameCount;b.dY=f/b.frameCount;1==b.frameCount&&c()}if(0!=b.frameCount)return c(),b;delete b.isStart;delete b.frameCount;return b.callReturn()}},rotate_by_angle_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Angle"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},null,null],type:"rotate_by_angle_time"},paramsKeyMap:{VALUE:1},"class":"rotate",isNotFor:[],func:function(a,b){if(!b.isStart){var c; -c=b.getNumberValue("VALUE",b);var d=b.getNumberField("VALUE",b);b.isStart=!0;b.frameCount=Math.floor(c*Entry.FPS);b.dAngle=d/b.frameCount}if(0!=b.frameCount)return a.setRotation(a.getRotation()+b.dAngle),b.frameCount--,b;delete b.isStart;delete b.frameCount;return b.callReturn()}},bounce_wall:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null],type:"bounce_wall"},"class":"walk",isNotFor:[],func:function(a, -b){var c=a.parent.getRotateMethod(),d="free"==c?(a.getRotation()+a.getDirection()).mod(360):a.getDirection(),e;if(90>d&&0<=d||360>d&&270<=d){e=a.collision==Entry.Utils.COLLISION.UP;var f=ndgmr.checkPixelCollision(Entry.stage.wall.up,a.object,0,!1);!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE);f&&e&&(f=!1);f?("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+180),a.collision=Entry.Utils.COLLISION.UP):(e=a.collision==Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down, -a.object,0,!1),!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+180),a.collision=Entry.Utils.COLLISION.DOWN))}else 270>d&&90<=d&&(e=a.collision==Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,a.object,0,!1),!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f?("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+ -180),a.collision=Entry.Utils.COLLISION.DOWN):(e=a.collision==Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,a.object,0,!1),!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+180),a.collision=Entry.Utils.COLLISION.UP)));360>d&&180<=d?(e=a.collision==Entry.Utils.COLLISION.LEFT,d=ndgmr.checkPixelCollision(Entry.stage.wall.left,a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE), -d&&e&&(d=!1),d?("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()):a.setDirection(-a.getDirection()+360),a.collision=Entry.Utils.COLLISION.LEFT):(e=a.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()):a.setDirection(-a.getDirection()+360),a.collision=Entry.Utils.COLLISION.RIGHT))):180>d&&0<=d&&(e=a.collision== -Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()):a.setDirection(-a.getDirection()+360),a.collision=Entry.Utils.COLLISION.RIGHT):(e=a.collision==Entry.Utils.COLLISION.LEFT,d=ndgmr.checkPixelCollision(Entry.stage.wall.left,a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?a.setRotation(-a.getRotation()- -2*a.getDirection()):a.setDirection(-a.getDirection()+360),a.collision=Entry.Utils.COLLISION.LEFT)));return b.callReturn()}},flip_arrow_horizontal:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null]},func:function(a,b){a.setDirection(a.getDirection()+180);return b.callReturn()}},flip_arrow_vertical:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}], -events:{},def:{params:[null]},func:function(a,b){a.setDirection(a.getDirection()+180);return b.callReturn()}},see_angle_object:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"see_angle_object"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(a,b){var c= -b.getField("VALUE",b),d=a.getX(),e=a.getY();if(a.parent.id==c)return b.callReturn();"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?a.getDirection()+a.getRotation():0<=d?-Math.atan(e/d)/Math.PI*180+90:-Math.atan(e/d)/Math.PI*180+270;d=a.getDirection()+a.getRotation();a.setRotation(a.getRotation()+e-d);return b.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(a,b){var c=b.getNumberValue("VALUE",b),d=a.getDirection()+a.getRotation();a.setRotation(a.getRotation()+c-d);return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setDirection(c+a.getDirection());return b.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(a,b){if(!b.isStart){var c,d,e;d=b.getField("TARGET",b);c=b.getNumberValue("VALUE",b);c=Math.floor(c*Entry.FPS);e=Entry.stage.mouseCoordinate;if(0!=c)"mouse"==d?(d=e.x-a.getX(),e=e.y-a.getY()):(e=Entry.container.getEntity(d),d=e.getX()-a.getX(),e=e.getY()-a.getY()),b.isStart= -!0,b.frameCount=c,b.dX=d/b.frameCount,b.dY=e/b.frameCount;else return"mouse"==d?(d=Number(e.x),e=Number(e.y)):(e=Entry.container.getEntity(d),d=e.getX(),e=e.getY()),a.setX(d),a.setY(e),a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY()),b.callReturn()}if(0!=b.frameCount)return a.setX(a.getX()+b.dX),a.setY(a.getY()+b.dY),b.frameCount--,a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY()),b;delete b.isStart;delete b.frameCount;return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setRotation(c);return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setRotation(c+a.getRotation());return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setDirection(c);return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setDirection(c+a.getDirection());return b.callReturn()}}, -move_to_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},{type:"number",params:["10"]},null],type:"move_to_angle"},paramsKeyMap:{ANGLE:0,VALUE:1},"class":"move_rotate",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b),d=b.getNumberValue("ANGLE",b);a.setX(a.getX()+c*Math.cos((d-90)/180*Math.PI));a.setY(a.getY()-c* -Math.sin((d-90)/180*Math.PI));a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}},rotate_by_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"angle"},null],type:"rotate_by_time"},paramsKeyMap:{VALUE:0,ANGLE:1},"class":"rotate",isNotFor:[],func:function(a,b){function c(){a.setRotation(a.getRotation()+ -b.dAngle);b.frameCount--}if(!b.isStart){var d;d=b.getNumberValue("VALUE",b);var e=b.getNumberValue("ANGLE",b);b.isStart=!0;b.frameCount=Math.max(Math.floor(d*Entry.FPS),1);b.dAngle=e/b.frameCount;1==b.frameCount&&c()}if(0!=b.frameCount)return c(),b;delete b.isStart;delete b.frameCount;return b.callReturn()}},direction_relative_duration:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png", -size:12}],events:{},def:{params:[{type:"text",params:["2"]},{type:"angle"},null],type:"direction_relative_duration"},paramsKeyMap:{DURATION:0,AMOUNT:1},"class":"rotate",isNotFor:[],func:function(a,b){function c(){a.setDirection(a.getDirection()+b.dDirection);b.frameCount--}if(!b.isStart){var d;d=b.getNumberValue("DURATION",b);var e=b.getNumberValue("AMOUNT",b);b.isStart=!0;b.frameCount=Math.max(Math.floor(d*Entry.FPS),1);b.dDirection=e/b.frameCount;1==b.frameCount&&c()}if(0!=b.frameCount)return c(), -b;delete b.isStart;delete b.frameCount;delete b.dDirection;return b.callReturn()}},neobot_sensor_value:{color:"#00979D",skeleton:"basic_string_field",fontColor:"#fff",statements:[],template:"%1 \uac12",params:[{type:"Dropdown",options:[["1\ubc88 \ud3ec\ud2b8","IN1"],["2\ubc88 \ud3ec\ud2b8","IN2"],["3\ubc88 \ud3ec\ud2b8","IN3"],["\ub9ac\ubaa8\ucee8","IR"],["\ubc30\ud130\ub9ac","BAT"]],value:"IN1",fontSize:11}],events:{},def:{params:[null],type:"neobot_sensor_value"},paramsKeyMap:{PORT:0},"class":"neobot_value", -isNotFor:["neobot"],func:function(a,b){a=b.getStringField("PORT");return Entry.hw.portData[a]}},neobot_sensor_convert_scale:{color:"#00979D",skeleton:"basic_string_field",fontColor:"#fff",statements:[],template:"%1 \uac12\uc758 \ubc94\uc704\ub97c %2 ~ %3 \uc5d0\uc11c %4 ~ %5 (\uc73c)\ub85c \ubcc0\ud658",params:[{type:"Dropdown",options:[["1\ubc88 \ud3ec\ud2b8","IN1"],["2\ubc88 \ud3ec\ud2b8","IN2"],["3\ubc88 \ud3ec\ud2b8","IN3"],["\ub9ac\ubaa8\ucee8","IR"],["\ubc30\ud130\ub9ac","BAT"]],value:"IN1", -fontSize:11},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"}],events:{},def:{params:[null,{type:"number",params:["0"]},{type:"number",params:["255"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"neobot_sensor_convert_scale"},paramsKeyMap:{PORT:0,OMIN:1,OMAX:2,MIN:3,MAX:4},"class":"neobot_value",isNotFor:["neobot"],func:function(a,b){a=b.getStringField("PORT");a=Entry.hw.portData[a];var c=b.getNumberValue("OMIN", -b),d=b.getNumberValue("OMAX",b),e=b.getNumberValue("MIN",b);b=b.getNumberValue("MAX",b);if(c>d)var f=c,c=d,d=f;e>b&&(f=e,e=b,b=f);a=Math.min(b,(b-e)/(d-c)*(a-c)+e);a=Math.max(e,a);return Math.round(a)}},neobot_left_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc67c\ucabd \ubaa8\ud130\ub97c %1 %2 \uc758 \uc18d\ub3c4\ub85c \ud68c\uc804 %3",params:[{type:"Dropdown",options:[["\uc55e\uc73c\ub85c","16"],["\ub4a4\ub85c","32"]],value:"16",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}, -{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"],["14","14"],["15","15"]],value:"0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,"15",null],type:"neobot_left_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1},"class":"neobot_motor",isNotFor:["neobot"],func:function(a,b){a=b.getNumberField("SPEED"); -var c=b.getNumberField("DIRECTION");Entry.hw.sendQueue.DCL=a+c;return b.callReturn()}},neobot_stop_left_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc67c\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_left_motor"},"class":"neobot_motor",isNotFor:["neobot"],func:function(a,b){Entry.hw.sendQueue.DCL=0;return b.callReturn()}},neobot_right_motor:{color:"#00979D",skeleton:"basic", -statements:[],template:"\uc624\ub978\ucabd \ubaa8\ud130\ub97c %1 %2 \uc758 \uc18d\ub3c4\ub85c \ud68c\uc804 %3",params:[{type:"Dropdown",options:[["\uc55e\uc73c\ub85c","16"],["\ub4a4\ub85c","32"]],value:"16",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{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"],["14","14"],["15","15"]],value:"0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW}, -{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,"15",null],type:"neobot_right_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1},"class":"neobot_motor",isNotFor:["neobot"],func:function(a,b){a=b.getNumberField("SPEED");var c=b.getNumberField("DIRECTION");Entry.hw.sendQueue.DCR=a+c;return b.callReturn()}},neobot_stop_right_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator", -img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_right_motor"},"class":"neobot_motor",isNotFor:["neobot"],func:function(a,b){Entry.hw.sendQueue.DCR=0;return b.callReturn()}},neobot_all_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc591\ucabd \ubaa8\ud130\ub97c %1 %2\uc758 \uc18d\ub3c4\ub85c %3\ucd08 \ub3d9\uc548 \ud68c\uc804 %4",params:[{type:"Dropdown",options:[["\uc55e\uc73c\ub85c","1"],["\ub4a4\ub85c","2"],["\uc81c\uc790\ub9ac\uc5d0\uc11c \uc67c\ucabd \ub3cc\uae30", -"3"],["\uc81c\uc790\ub9ac\uc5d0\uc11c \uc624\ub978\ucabd \ub3cc\uae30","4"],["\uc67c\ucabd\uc73c\ub85c \ub3cc\uae30","5"],["\uc624\ub978\ucabd\uc73c\ub85c \ub3cc\uae30","6"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{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"],["14","14"],["15","15"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block", -accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:["1","15",{type:"number",params:["0"]}],type:"neobot_all_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1,DURATION:2},"class":"neobot_motor",isNotFor:["neobot"],func:function(a,b){if(b.isStart){if(1==b.timeFlag)return b;delete b.timeFlag;delete b.isStart;Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR=0;Entry.engine.isContinue=!1;return b.callReturn()}a=b.getNumberField("SPEED");var c=b.getNumberField("DIRECTION"), -d=b.getNumberValue("DURATION");0>d&&(d=0);switch(c){case 1:Entry.hw.sendQueue.DCL=16+a;Entry.hw.sendQueue.DCR=16+a;break;case 2:Entry.hw.sendQueue.DCL=32+a;Entry.hw.sendQueue.DCR=32+a;break;case 3:Entry.hw.sendQueue.DCL=32+a;Entry.hw.sendQueue.DCR=16+a;break;case 4:Entry.hw.sendQueue.DCL=16+a;Entry.hw.sendQueue.DCR=32+a;break;case 5:Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR=16+a;break;case 6:Entry.hw.sendQueue.DCL=16+a,Entry.hw.sendQueue.DCR=0}if(0===d)return b.callReturn();b.isStart=!0;b.timeFlag= -1;setTimeout(function(){b.timeFlag=0},1E3*d);return b}},neobot_stop_all_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc591\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_all_motor"},"class":"neobot_motor",isNotFor:["neobot"],func:function(a,b){Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR=0;return b.callReturn()}},neobot_set_servo:{color:"#00979D",skeleton:"basic",statements:[], -template:"%1 \ud3ec\ud2b8\uc758 \uc11c\ubcf4\ubaa8\ud130\ub97c %2 \ub3c4 \uc774\ub3d9 %3",params:[{type:"Dropdown",options:[["OUT1","1"],["OUT2","2"],["OUT3","3"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"neobot_set_servo"},paramsKeyMap:{PORT:0,DEGREE:1},"class":"neobot_output",isNotFor:["neobot"],func:function(a,b){a=b.getNumberField("PORT"); -var c=b.getNumberValue("DEGREE");0>c?c=0:180c?c=0:255a.count)throw a.count++,new Entry.Utils.AsyncError;a.isStart=!1;b=Entry.hw.portData[a.data_default_address]; -a.data_default_address=void 0;return b}},robotis_openCM70_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.robotis_cm_sound_detected,"CM_SOUND_DETECTED"],[Lang.Blocks.robotis_cm_sound_detecting,"CM_SOUND_DETECTING"],[Lang.Blocks.robotis_cm_user_button,"CM_USER_BUTTON"]],value:"CM_SOUND_DETECTED",fontSize:11}],events:{},def:{params:[null],type:"robotis_openCM70_sensor_value"},paramsKeyMap:{SENSOR:0},"class":"robotis_openCM70_cm", -isNotFor:["robotis_openCM70"],func:function(a,b){a=b.executor.scope;if(!a.isStart){a.isStart=!0;a.count=0;var c=Entry.Robotis_openCM70.INSTRUCTION.READ,d=0,e=0,f=0,g=0;b=b.getStringField("SENSOR");"CM_SOUND_DETECTED"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1]):"CM_SOUND_DETECTING"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0], -g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1]):"CM_USER_BUTTON"==b&&(f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1]);f+=0*g;Entry.Robotis_carCont.setRobotisData([[c,d,e,0,g]]);Entry.Robotis_carCont.update(); -a.data_default_address=f;throw new Entry.Utils.AsyncError;}if(2>a.count)throw a.count++,new Entry.Utils.AsyncError;a.isStart=!1;b=Entry.hw.portData[a.data_default_address];a.data_default_address=void 0;return b}},robotis_openCM70_aux_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["3","PORT_3"],["4","PORT_4"],["5","PORT_5"],["6","PORT_6"]],value:"PORT_3",fontSize:11},{type:"Dropdown",options:[[Lang.Blocks.robotis_aux_servo_position, -"AUX_SERVO_POSITION"],[Lang.Blocks.robotis_aux_ir,"AUX_IR"],[Lang.Blocks.robotis_aux_touch,"AUX_TOUCH"],[Lang.Blocks.robotis_aux_brightness,"AUX_BRIGHTNESS"],[Lang.Blocks.robotis_aux_hydro_themo_humidity,"AUX_HYDRO_THEMO_HUMIDITY"],[Lang.Blocks.robotis_aux_hydro_themo_temper,"AUX_HYDRO_THEMO_TEMPER"],[Lang.Blocks.robotis_aux_temperature,"AUX_TEMPERATURE"],[Lang.Blocks.robotis_aux_ultrasonic,"AUX_ULTRASONIC"],[Lang.Blocks.robotis_aux_magnetic,"AUX_MAGNETIC"],[Lang.Blocks.robotis_aux_motion_detection, -"AUX_MOTION_DETECTION"],[Lang.Blocks.robotis_aux_color,"AUX_COLOR"],[Lang.Blocks.robotis_aux_custom,"AUX_CUSTOM"]],value:"AUX_SERVO_POSITION",fontSize:11}],events:{},def:{params:[null,null],type:"robotis_openCM70_aux_sensor_value"},paramsKeyMap:{PORT:0,SENSOR:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(a,b){a=b.executor.scope;if(!a.isStart){a.isStart=!0;a.count=0;var c=Entry.Robotis_openCM70.INSTRUCTION.READ,d=0,e=0,f=0,g=0,h=b.getStringField("PORT");b=b.getStringField("SENSOR"); -var k=0;"PORT_3"==h?k=2:"PORT_4"==h?k=3:"PORT_5"==h?k=4:"PORT_6"==h&&(k=5);"AUX_SERVO_POSITION"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1]):"AUX_IR"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0], -e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1]):"AUX_TOUCH"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1]):"AUX_TEMPERATURE"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1]): -"AUX_BRIGHTNESS"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1]):"AUX_HYDRO_THEMO_HUMIDITY"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1]): -"AUX_HYDRO_THEMO_TEMPER"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1]):"AUX_ULTRASONIC"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1]): -"AUX_MAGNETIC"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1]):"AUX_MOTION_DETECTION"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1]): -"AUX_COLOR"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1]):"AUX_CUSTOM"==b&&(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1]);f+=k*g;0!=k&&(e=6*g);Entry.Robotis_carCont.setRobotisData([[c, -d,e,0,g]]);Entry.Robotis_carCont.update();a.data_default_address=f;console.log(f);throw new Entry.Utils.AsyncError;}if(2>a.count)throw a.count++,new Entry.Utils.AsyncError;a.isStart=!1;c=Entry.hw.portData[a.data_default_address];a.data_default_address=void 0;return c}},robotis_openCM70_cm_buzzer_index:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.note_a+"(0)","0"],[Lang.General.note_a+"#(1)","1"],[Lang.General.note_b+"(2)","2"],[Lang.General.note_c+ -"(3)","3"],[Lang.General.note_c+"#(4)","4"],[Lang.General.note_d+"(5)","5"],[Lang.General.note_d+"#(6)","6"],[Lang.General.note_e+"(7)","7"],[Lang.General.note_f+"(8)","8"],[Lang.General.note_f+"#(9)","9"],[Lang.General.note_g+"(10)","10"],[Lang.General.note_g+"#(11)","11"],[Lang.General.note_a+"(12)","12"],[Lang.General.note_a+"#(13)","13"],[Lang.General.note_b+"(14)","14"],[Lang.General.note_c+"(15)","15"],[Lang.General.note_c+"#(16)","16"],[Lang.General.note_d+"(17)","17"],[Lang.General.note_d+ -"#(18)","18"],[Lang.General.note_e+"(19)","19"],[Lang.General.note_f+"(20)","20"],[Lang.General.note_f+"#(21)","21"],[Lang.General.note_g+"(22)","22"],[Lang.General.note_g+"#(23)","23"],[Lang.General.note_a+"(24)","24"],[Lang.General.note_a+"#(25)","25"],[Lang.General.note_b+"(26)","26"],[Lang.General.note_c+"(27)","27"],[Lang.General.note_c+"#(28)","28"],[Lang.General.note_d+"(29)","29"],[Lang.General.note_d+"#(30)","30"],[Lang.General.note_e+"(31)","31"],[Lang.General.note_f+"(32)","32"],[Lang.General.note_f+ -"#(33)","33"],[Lang.General.note_g+"(34)","34"],[Lang.General.note_g+"#(35)","35"],[Lang.General.note_a+"(36)","36"],[Lang.General.note_a+"#(37)","37"],[Lang.General.note_b+"(38)","38"],[Lang.General.note_c+"(39)","39"],[Lang.General.note_c+"#(40)","40"],[Lang.General.note_d+"(41)","41"],[Lang.General.note_d+"#(42)","42"],[Lang.General.note_e+"(43)","43"],[Lang.General.note_f+"(44)","44"],[Lang.General.note_f+"#(45)","45"],[Lang.General.note_g+"(46)","46"],[Lang.General.note_g+"#(47)","47"],[Lang.General.note_a+ -"(48)","48"],[Lang.General.note_a+"#(49)","49"],[Lang.General.note_b+"(50)","50"],[Lang.General.note_c+"(51)","51"]],value:"0",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["1"]},null],type:"robotis_openCM70_cm_buzzer_index"},paramsKeyMap:{CM_BUZZER_INDEX:0,CM_BUZZER_TIME:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(a,b){a=b.getField("CM_BUZZER_INDEX",b);var c= -b.getNumberValue("CM_BUZZER_TIME",b),d=Entry.Robotis_openCM70.INSTRUCTION.WRITE,e,f,g;e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[0];f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[1];g=parseInt(10*c);50a.brush.thickness&&(a.brush.thickness=1),a.brush.setStrokeStyle(a.brush.thickness),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}},set_thickness:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["1"]},null],type:"set_thickness"}, +paramsKeyMap:{VALUE:0},"class":"brush_thickness",isNotFor:["textBox"],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(a.brush.thickness=c,a.brush.setStrokeStyle(a.brush.thickness),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}},change_opacity:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number", +params:["10"]},null],type:"change_opacity"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);c=Entry.adjustValueWithMaxMin(a.brush.opacity+c,0,100);a.brush&&(a.brush.opacity=c,a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}},set_opacity:{color:"#FF9E20",skeleton:"basic", +statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["50"]},null],type:"set_opacity"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(a.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+c.r+","+c.g+","+ +c.b+","+a.brush.opacity/100+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}},brush_erase_all:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"brush_erase_all"},"class":"brush_clear",isNotFor:["textBox"],func:function(a,b){var c=a.brush;if(c){var d=c._stroke.style,e=c._strokeStyle.width;c.clear().setStrokeStyle(e).beginStroke(d);c.moveTo(a.getX(),-1*a.getY())}a=a.parent.getStampEntities(); +a.map(function(b){b.removeClone()});a=null;return b.callReturn()}},brush_stamp:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"brush_stamp"},"class":"stamp",isNotFor:["textBox"],func:function(a,b){a.parent.addStampEntity(a);return b.callReturn()}},change_brush_transparency:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png", +size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_brush_transparency"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);c=Entry.adjustValueWithMaxMin(a.brush.opacity-c,0,100);a.brush&&(a.brush.opacity=c,a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")"),a.brush.moveTo(a.getX(),-1*a.getY())); +return b.callReturn()}},set_brush_tranparency:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["50"]},null],type:"set_brush_tranparency"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(a.brush.opacity=Entry.adjustValueWithMaxMin(c, +0,100),a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+(1-a.brush.opacity/100)+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}},number:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"TextInput",value:10}],events:{},def:{params:[]},paramsKeyMap:{NUM:0},func:function(a,b){return b.getField("NUM",b)},isPrimitive:!0},angle:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Angle"}],events:{},def:{params:[null], +type:"angle"},paramsKeyMap:{ANGLE:0},func:function(a,b){return b.getNumberField("ANGLE")}},get_x_coordinate:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_x_coordinate,color:"#3D3D3D"}],events:{},def:{params:[null],type:"get_x_coordinate"},"class":"calc",isNotFor:[],func:function(a,b){return a.getX()}},get_y_coordinate:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_y_coordinate, +color:"#3D3D3D"}],events:{},def:{params:[null],type:"get_y_coordinate"},"class":"calc",isNotFor:[],func:function(a,b){return a.getY()}},get_angle:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_angle,color:"#3D3D3D"}],events:{},def:{params:[null]},func:function(a,b){return parseFloat(a.getRotation().toFixed(1))}},get_rotation_direction:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CALC_rotation_value, +"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(a,b){return"DIRECTION"==b.getField("OPERATOR",b).toUpperCase()?parseFloat(a.getDirection().toFixed(1)):parseFloat(a.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(a,b){b=b.getField("VALUE",b);if("mouse"==b)return b=Entry.stage.mouseCoordinate,Math.sqrt(Math.pow(a.getX()-b.x,2)+Math.pow(a.getY()-b.y,2));b=Entry.container.getEntity(b); +return Math.sqrt(Math.pow(a.getX()-b.getX(),2)+Math.pow(a.getY()-b.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(a,b){return"x"===b.getField("VALUE",b)?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(a,b){var c=b.getField("VALUE",b);a="self"==c?a:Entry.container.getEntity(c);switch(b.getField("COORDINATE",b)){case "x":return a.getX();case "y":return a.getY();case "rotation":return a.getRotation();case "direction":return a.getDirection();case "picture_index":return b=a.parent,b=b.pictures,b.indexOf(a.picture)+1;case "size":return Number(a.getSize().toFixed(1));case "picture_name":return b=a.parent,b=b.pictures,b[b.indexOf(a.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(a,b){a=b.getField("OPERATOR",b);var c=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return"PLUS"==a?c+b:"MINUS"==a?c-b:"MULTI"==a?c*b:c/b}}, +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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a+b}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a-b}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND", +b);return a*b}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a/b}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a%b}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return Math.floor(a/b)}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getField("VALUE",b);if(-1<["asin_radian","acos_radian"].indexOf(b)&&(1a))throw Error("x range exceeded");b.indexOf("_")&&(b=b.split("_")[0]);-1<["sin","cos","tan"].indexOf(b)&&(a=Entry.toRadian(a));switch(b){case "square":b=a*a;break;case "factorial":b=Entry.factorial(a);break;case "root":b=Math.sqrt(a);break;case "log":b=Math.log(a)/ +Math.LN10;break;case "ln":b=Math.log(a);break;case "asin":case "acos":case "atan":b=Entry.toDegrees(Math[b](a));break;case "unnatural":b=a-Math.floor(a);0>a&&(b=1-b);break;default:b=Math[b](a)}return b}},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,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_rand_3, +color:"#3D3D3D"}],events:{},def:{params:[null,{type:"number",params:["0"]},null,{type:"number",params:["10"]},null],type:"calc_rand"},paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3},"class":"calc",isNotFor:[],func:function(a,b){a=b.getStringValue("LEFTHAND",b);b=b.getStringValue("RIGHTHAND",b);var c=Math.min(a,b),d=Math.max(a,b);a=Entry.isFloat(a);return Entry.isFloat(b)||a?(Math.random()*(d-c)+c).toFixed(2):Math.floor(Math.random()*(d-c+1)+c)}},get_date:{color:"#FFD974",skeleton:"basic_string_field",statements:[], +params:[{type:"Text",text:Lang.Blocks.CALC_get_date_1,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_get_date_year,"YEAR"],[Lang.Blocks.CALC_get_date_month,"MONTH"],[Lang.Blocks.CALC_get_date_day,"DAY"],[Lang.Blocks.CALC_get_date_hour,"HOUR"],[Lang.Blocks.CALC_get_date_minute,"MINUTE"],[Lang.Blocks.CALC_get_date_second,"SECOND"]],value:"YEAR",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_get_date_2,color:"#3D3D3D"}],events:{},def:{params:[null, +"YEAR",null],type:"get_date"},paramsKeyMap:{VALUE:1},"class":"calc_date",isNotFor:[],func:function(a,b){a=b.getField("VALUE",b);b=new Date;return"YEAR"==a?b.getFullYear():"MONTH"==a?b.getMonth()+1:"DAY"==a?b.getDate():"HOUR"==a?b.getHours():"MINUTE"==a?b.getMinutes():b.getSeconds()}},get_sound_duration:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_sound_duration_1,color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"sounds",fontSize:11, +arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_get_sound_duration_2,color:"#3D3D3D"}],events:{},def:{params:[null,null,null],type:"get_sound_duration"},paramsKeyMap:{VALUE:1},"class":"calc_duration",isNotFor:[],func:function(a,b){b=b.getField("VALUE",b);a=a.parent.sounds;for(var c=0;cb||b>a.length-1)throw Error();return a[b]}},length_of_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_length_of_string_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_length_of_string_2,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.entry]},null],type:"length_of_string"},paramsKeyMap:{STRING:1},"class":"calc_string",isNotFor:[], +func:function(a,b){return b.getStringValue("STRING",b).length}},substring:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_substring_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_substring_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_substring_3,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_substring_4,color:"#3D3D3D"}],events:{}, +def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"number",params:["2"]},null,{type:"number",params:["5"]},null],type:"substring"},paramsKeyMap:{STRING:1,START:3,END:5},"class":"calc_string",isNotFor:[],func:function(a,b){a=b.getStringValue("STRING",b);var c=b.getNumberValue("START",b)-1;b=b.getNumberValue("END",b)-1;var d=a.length-1;if(0>c||0>b||c>d||b>d)throw Error();return a.substring(Math.min(c,b),Math.max(c,b)+1)}},replace_string:{color:"#FFD974",skeleton:"basic_string_field", +statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_replace_string_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_3,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_4,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"text",params:[Lang.Blocks.hello]}, +null,{type:"text",params:[Lang.Blocks.nice]},null],type:"replace_string"},paramsKeyMap:{STRING:1,OLD_WORD:3,NEW_WORD:5},"class":"calc_string",isNotFor:[],func:function(a,b){return b.getStringValue("STRING",b).replace(new RegExp(b.getStringValue("OLD_WORD",b),"gm"),b.getStringValue("NEW_WORD",b))}},change_string_case:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_change_string_case_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text", +text:Lang.Blocks.CALC_change_string_case_2,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_change_string_case_sub_1,"toUpperCase"],[Lang.Blocks.CALC_change_string_case_sub_2,"toLowerCase"]],value:"toUpperCase",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_change_string_case_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:["Hello Entry!"]},null,null,null],type:"change_string_case"},paramsKeyMap:{STRING:1,CASE:3},"class":"calc_string", +isNotFor:[],func:function(a,b){return b.getStringValue("STRING",b)[b.getField("CASE",b)]()}},index_of_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_index_of_string_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_index_of_string_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_index_of_string_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]}, +null,{type:"text",params:[Lang.Blocks.entry]},null],type:"index_of_string"},paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3},"class":"calc_string",isNotFor:[],func:function(a,b){a=b.getStringValue("LEFTHAND",b);b=b.getStringValue("RIGHTHAND",b);b=a.indexOf(b);return-1a)throw Error(Lang.Blocks.FLOW_repeat_basic_errorMsg);b.iterCount= +Math.floor(a)}if(0==b.iterCount||0>b.iterCount)return delete b.isLooped,delete b.iterCount,b.callReturn();b.iterCount--;return b.getStatement("DO",b)}},repeat_inf:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null],type:"repeat_inf"},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(a,b){b.isLooped=!0;return b.getStatement("DO")}},stop_repeat:{color:"#498deb",skeleton:"basic", +statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null],type:"stop_repeat"},"class":"repeat",isNotFor:[],func:function(a,b){return this.executor.breakLoop()}},wait_until_true:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"},null],type:"wait_until_true"},paramsKeyMap:{BOOL:0},"class":"wait",isNotFor:[],func:function(a, +b){return b.getBooleanValue("BOOL",b)?b.callReturn():b}},_if:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"},null],type:"_if"},paramsKeyMap:{BOOL:0},statementsKeyMap:{STACK:0},"class":"condition",isNotFor:[],func:function(a,b){return b.isCondition?(delete b.isCondition,b.callReturn()):b.getBooleanValue("BOOL",b)?(b.isCondition=!0,b.getStatement("STACK", +b)):b.callReturn()}},if_else:{color:"#498deb",skeleton:"basic_double_loop",statements:[{accept:"basic"},{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12},{type:"LineBreak"}],events:{},def:{params:[{type:"True"},null],type:"if_else"},paramsKeyMap:{BOOL:0},statementsKeyMap:{STACK_IF:0,STACK_ELSE:1},"class":"condition",isNotFor:[],func:function(a,b){if(b.isCondition)return delete b.isCondition,b.callReturn();a=b.getBooleanValue("BOOL",b); +b.isCondition=!0;return a?b.getStatement("STACK_IF",b):b.getStatement("STACK_ELSE",b)}},create_clone:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"clone",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null,null],type:"create_clone"},paramsKeyMap:{VALUE:0},"class":"clone",isNotFor:[],func:function(a,b){var c=b.getField("VALUE",b);b=b.callReturn();"self"==c?a.parent.addCloneEntity(a.parent, +a,null):Entry.container.getObject(c).addCloneEntity(a.parent,null,null);return b}},delete_clone:{color:"#498deb",skeleton:"basic_without_next",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null],type:"delete_clone"},"class":"clone",isNotFor:[],func:function(a,b){if(!a.isClone)return b.callReturn();a.removeClone();return this.die()}},when_clone_start:{color:"#498deb",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_clone.png", +size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"when_clone_start"},"class":"clone",isNotFor:[],func:function(a,b){return b.callReturn()},event:"when_clone_start"},stop_run:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null]},func:function(a,b){return Entry.engine.toggleStop()}},repeat_while_true:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Block",accept:"boolean"}, +{type:"Dropdown",options:[[Lang.Blocks.FLOW_repeat_while_true_until,"until"],[Lang.Blocks.FLOW_repeat_while_true_while,"while"]],value:"until",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"},null,null],type:"repeat_while_true"},paramsKeyMap:{BOOL:0,OPTION:1},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(a,b){a=b.getBooleanValue("BOOL",b);"until"==b.getField("OPTION",b)&&(a=!a);return(b.isLooped= +a)?b.getStatement("DO",b):b.callReturn()}},stop_object:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.FLOW_stop_object_all,"all"],[Lang.Blocks.FLOW_stop_object_this_object,"thisOnly"],[Lang.Blocks.FLOW_stop_object_this_thread,"thisThread"],[Lang.Blocks.FLOW_stop_object_other_thread,"otherThread"]],value:"all",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null,null], +type:"stop_object"},paramsKeyMap:{TARGET:0},"class":"terminate",isNotFor:[],func:function(a,b){var c=b.getField("TARGET",b),d=Entry.container;switch(c){case "all":return d.clearRunningState(),this.die();case "thisOnly":return a.parent.script.clearExecutorsByEntity(a),this.die();case "thisObject":return a.parent.script.clearExecutors(),this.die();case "thisThread":return this.die();case "otherThread":c=this.executor;a=a.parent.script;for(var d=a.executors,e=0;eb.count?(50>c.leftFloor&&50>c.rightFloor? +b.count++:b.count=0,c=c.leftFloor-c.rightFloor,a.leftWheel=45+.25*c,a.rightWheel=45-.25*c):(b.count=0,b.boardState=2);break;case 2:c=c.leftFloor-c.rightFloor;a.leftWheel=45+.25*c;a.rightWheel=45-.25*c;b.boardState=3;var d=setTimeout(function(){b.boardState=4;Entry.Hamster.removeTimeout(d)},250);Entry.Hamster.timeouts.push(d);break;case 3:c=c.leftFloor-c.rightFloor;a.leftWheel=45+.25*c;a.rightWheel=45-.25*c;break;case 4:a.leftWheel=0,a.rightWheel=0,b.boardState=0,b.isMoving=!1}return b}delete b.isStart; +delete b.isMoving;delete b.count;delete b.boardState;Entry.engine.isContinue=!1;a.leftWheel=0;a.rightWheel=0;return b.callReturn()}b.isStart=!0;b.isMoving=!0;b.count=0;b.boardState=1;a.leftWheel=45;a.rightWheel=45;Entry.Hamster.setLineTracerMode(a,0);return b}},hamster_turn_once:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}], +events:{},def:{params:[null,null],type:"hamster_turn_once"},paramsKeyMap:{DIRECTION:0},"class":"hamster_board",isNotFor:["hamster"],func:function(a,b){a=Entry.hw.sendQueue;var c=Entry.hw.portData;if(b.isStart){if(b.isMoving){if(b.isLeft)switch(b.boardState){case 1:2>b.count?50c.leftFloor&&(b.boardState=3);break;case 3:2>b.count?20>c.leftFloor&&b.count++:(b.count=0,b.boardState=4);break;case 4:50b.count?50c.rightFloor&&(b.boardState=3);break;case 3:2>b.count?20>c.rightFloor&&b.count++:(b.count=0,b.boardState=4);break;case 4:50Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return b.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(a,b){Entry.Hamster.tempo=b.getNumberValue("VALUE");1>Entry.Hamster.tempo&& +(Entry.Hamster.tempo=1);return b.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(a,b){a=Entry.hw.sendQueue;var c=b.getField("PORT",b),d=Number(b.getField("MODE",b));"A"==c?a.ioModeA=d:("B"!=c&&(a.ioModeA=d),a.ioModeB=d);return b.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(a,b){a=Entry.hw.sendQueue;var c=b.getField("PORT"),d=b.getNumberValue("VALUE");"A"==c?a.outputA=void 0!=a.outputA?a.outputA+d:d:("B"!= +c&&(a.outputA=void 0!=a.outputA?a.outputA+d:d),a.outputB=void 0!=a.outputB?a.outputB+d:d);return b.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(a,b){a=Entry.hw.sendQueue;var c=b.getField("PORT"),d=b.getNumberValue("VALUE");"A"==c?a.outputA=d:("B"!=c&&(a.outputA=d),a.outputB=d);return b.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(a,b){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(a,b){a=Number(b.getField("VALUE",b));return 0<=Entry.pressedKeys.indexOf(a)}},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(a,b){if(!a.getVisible())return!1;var c=b.getField("VALUE",b);b=a.object;var d=/wall/.test(c),e=ndgmr.checkPixelCollision; +if(d)switch(a=Entry.stage.wall,c){case "wall":if(e(b,a.up,.2,!0)||e(b,a.down,.2,!0)||e(b,a.left,.2,!0)||e(b,a.right,.2,!0))return!0;break;case "wall_up":if(e(b,a.up,.2,!0))return!0;break;case "wall_down":if(e(b,a.down,.2,!0))return!0;break;case "wall_right":if(e(b,a.right,.2,!0))return!0;break;case "wall_left":if(e(b,a.left,.2,!0))return!0}else{if("mouse"==c)return e=Entry.stage.canvas,e=b.globalToLocal(e.mouseX,e.mouseY),b.hitTest(e.x,e.y);c=Entry.container.getEntity(c);if("textBox"==c.type||"textBox"== +a.type){e=c.object.getTransformedBounds();b=b.getTransformedBounds();if(Entry.checkCollisionRect(b,e))return!0;a=c.parent.clonedEntities;c=0;for(d=a.length;c","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(a,b){a=b.getField("OPERATOR",b);var c=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return"EQUAL"==a?c==b:"BIGGER"==a?c>b:c",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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a>b}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a","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(a,b){a=b.getField("OPERATOR",b);var c=b.getStringValue("LEFTHAND",b);b=b.getStringValue("RIGHTHAND",b);switch(a){case "EQUAL":return c==b;case "GREATER":return Number(c)>Number(b);case "LESS":return Number(c)=Number(b);case "LESS_OR_EQUAL":return Number(c)<=Number(b)}}},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(a,b){a.setVisible(!0);return b.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(a,b){a.setVisible(!1);return b.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(a,b){if(!b.isStart){var c=b.getNumberValue("SECOND",b),d=b.getStringValue("VALUE",b),e=b.getField("OPTION",b);b.isStart=!0;b.timeFlag=1;d||"number"== +typeof d||(d=" ");d=Entry.convertToRoundedDecimals(d,3);new Entry.Dialog(a,d,e);a.syncDialogVisible(a.getVisible());setTimeout(function(){b.timeFlag=0},1E3*c)}if(0==b.timeFlag)return delete b.timeFlag,delete b.isStart,a.dialog&&a.dialog.remove(),b.callReturn();a.dialog||(d=b.getStringValue("VALUE",b),e=b.getField("OPTION",b),d||"number"==typeof d||(d=" "),d=Entry.convertToRoundedDecimals(d,3),new Entry.Dialog(a,d,e),a.syncDialogVisible(a.getVisible()));return b}},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(a,b){var c=b.getStringValue("VALUE",b);c||"number"==typeof c||(c=" ");var d=b.getField("OPTION", +b),c=Entry.convertToRoundedDecimals(c,3);new Entry.Dialog(a,c,d);a.syncDialogVisible(a.getVisible());return b.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(a,b){a.dialog&&a.dialog.remove();return b.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(a,b){var c=b.getField("VALUE",b),c=a.parent.getPicture(c);a.setImage(c);return b.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(a,b){var c;c="prev"!==b.getStringField("DRIECTION")?a.parent.getNextPicture(a.picture.id):a.parent.getPrevPicture(a.picture.id);a.setImage(c);return b.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(a,b){var c=b.getField("EFFECT",b),d=b.getNumberValue("VALUE",b);"color"==c?a.effect.hue= +d+a.effect.hue:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?a.effect.brightness=d+a.effect.brightness:"blur"!=c&&"opacity"==c&&(a.effect.alpha+=d/100));a.applyFilter();return b.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(a,b){var c=b.getField("EFFECT",b),d=b.getNumberValue("VALUE",b);"color"==c?a.effect.hue=d:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?a.effect.brightness=d:"blur"!=c&&"opacity"==c&&(a.effect.alpha=d/100));a.applyFilter();return b.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(a,b){a.resetFilter();return b.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(a,b){var c=(b.getNumberValue("VALUE",b)+100)/100;a.setScaleX(a.getScaleX()*c);a.setScaleY(a.getScaleY()*c);return b.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(a,b){var c=b.getNumberValue("VALUE", +b)/100,d=a.snapshot_;a.setScaleX(c*d.scaleX);a.setScaleY(c*d.scaleY);return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setSize(a.getSize()+c);return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setSize(c);return b.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(a,b){a.setScaleX(-1*a.getScaleX());return b.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(a,b){a.setScaleY(-1*a.getScaleY());return b.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(a,b){var c=b.getField("VALUE",b);a=Entry.container.getCurrentObjects().indexOf(a.parent);if(-1a)throw Error("object is not available for current scene");switch(d){case "FRONT":c=0;break;case "FORWARD":c=Math.max(0,a-1);break;case "BACKWARD":c=Math.min(e,a+1);break;case "BACK":c=e}Entry.container.moveElementByBlock(a,c);return b.callReturn()}}, +move_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:["10"]},null],type:"move_direction"},paramsKeyMap:{VALUE:0},"class":"walk",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.setX(a.getX()+c*Math.cos((a.getRotation()+a.getDirection()-90)/180*Math.PI));a.setY(a.getY()-c*Math.sin((a.getRotation()+a.getDirection()-90)/180*Math.PI)); +a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}},move_x:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"move_x"},paramsKeyMap:{VALUE:0},"class":"move_relative",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.setX(a.getX()+c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY()); +return b.callReturn()}},move_y:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"move_y"},paramsKeyMap:{VALUE:0},"class":"move_relative",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.setY(a.getY()+c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}},locate_xy_time:{color:"#A751E3",skeleton:"basic", +statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"locate_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_absolute",isNotFor:[],func:function(a,b){function c(){var c=b.x-a.getX(),d=b.y-a.getY(),c=c/b.frameCount,d=d/b.frameCount;a.setX(a.getX()+ +c);a.setY(a.getY()+d);b.frameCount--;a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY())}if(!b.isStart){var d;d=b.getNumberValue("VALUE1",b);b.isStart=!0;b.frameCount=Math.max(Math.floor(d*Entry.FPS),1);b.x=b.getNumberValue("VALUE2",b);b.y=b.getNumberValue("VALUE3",b);1==b.frameCount&&c()}if(0!=b.frameCount)return c(),b;delete b.isStart;delete b.frameCount;return b.callReturn()}},rotate_by_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator", +img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"rotate_by_angle"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.setRotation(a.getRotation()+c);return b.callReturn()}},rotate_by_angle_dropdown:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["45","45"],["90","90"],["135","135"],["180","180"]],value:"45",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png", +size:12}],events:{},def:{params:["45",null],type:"rotate_by_angle_dropdown"},paramsKeyMap:{VALUE:0},"class":"ebs",isNotFor:[],func:function(a,b){var c=b.getField("VALUE",b);a.setRotation(a.getRotation()+Number(c));return b.callReturn()}},see_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"see_angle"},paramsKeyMap:{VALUE:0},"class":"rotate", +isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.setDirection(c);return b.callReturn()}},see_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"sprites",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{VALUE:0},func:function(a,b){var c=b.getField("VALUE",b),d=Entry.container.getEntity(c),c=d.getX()-a.getX(),d=d.getY()-a.getY();0<=c?a.setRotation(Math.atan(d/ +c)/Math.PI*180+90):a.setRotation(Math.atan(d/c)/Math.PI*180+270);return b.callReturn()}},locate_xy:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["0"]},{type:"number",params:["0"]},null],type:"locate_xy"},paramsKeyMap:{VALUE1:0,VALUE2:1},"class":"move_absolute",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE1", +b),d=b.getNumberValue("VALUE2",b);a.setX(c);a.setY(d);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}},locate_x:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_x"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.setX(c);a.brush&& +!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}},locate_y:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_y"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.setY(c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}}, +locate:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"locate"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(a,b){var c=b.getField("VALUE",b),d;"mouse"==c?(c=Entry.stage.mouseCoordinate.x,d=Entry.stage.mouseCoordinate.y):(d=Entry.container.getEntity(c), +c=d.getX(),d=d.getY());a.setX(Number(c));a.setY(Number(d));a.brush&&!a.brush.stop&&a.brush.lineTo(c,-1*d);return b.callReturn()}},move_xy_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"move_xy_time"},paramsKeyMap:{VALUE1:0, +VALUE2:1,VALUE3:2},"class":"move_relative",isNotFor:[],func:function(a,b){function c(){a.setX(a.getX()+b.dX);a.setY(a.getY()+b.dY);b.frameCount--;a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY())}if(!b.isStart){var d;d=b.getNumberValue("VALUE1",b);var e=b.getNumberValue("VALUE2",b),f=b.getNumberValue("VALUE3",b);b.isStart=!0;b.frameCount=Math.max(Math.floor(d*Entry.FPS),1);b.dX=e/b.frameCount;b.dY=f/b.frameCount;1==b.frameCount&&c()}if(0!=b.frameCount)return c(),b;delete b.isStart;delete b.frameCount; +return b.callReturn()}},rotate_by_angle_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Angle"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},null,null],type:"rotate_by_angle_time"},paramsKeyMap:{VALUE:1},"class":"rotate",isNotFor:[],func:function(a,b){if(!b.isStart){var c;c=b.getNumberValue("VALUE",b);var d=b.getNumberField("VALUE",b);b.isStart=!0;b.frameCount=Math.floor(c*Entry.FPS); +b.dAngle=d/b.frameCount}if(0!=b.frameCount)return a.setRotation(a.getRotation()+b.dAngle),b.frameCount--,b;delete b.isStart;delete b.frameCount;return b.callReturn()}},bounce_wall:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null],type:"bounce_wall"},"class":"walk",isNotFor:[],func:function(a,b){var c=a.parent.getRotateMethod(),d="free"==c?(a.getRotation()+a.getDirection()).mod(360):a.getDirection(),e;if(90> +d&&0<=d||360>d&&270<=d){e=a.collision==Entry.Utils.COLLISION.UP;var f=ndgmr.checkPixelCollision(Entry.stage.wall.up,a.object,0,!1);!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE);f&&e&&(f=!1);f?("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+180),a.collision=Entry.Utils.COLLISION.UP):(e=a.collision==Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,a.object,0,!1),!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f= +!1),f&&("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+180),a.collision=Entry.Utils.COLLISION.DOWN))}else 270>d&&90<=d&&(e=a.collision==Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,a.object,0,!1),!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f?("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+180),a.collision=Entry.Utils.COLLISION.DOWN):(e=a.collision== +Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,a.object,0,!1),!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+180),a.collision=Entry.Utils.COLLISION.UP)));360>d&&180<=d?(e=a.collision==Entry.Utils.COLLISION.LEFT,d=ndgmr.checkPixelCollision(Entry.stage.wall.left,a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?a.setRotation(-a.getRotation()- +2*a.getDirection()):a.setDirection(-a.getDirection()+360),a.collision=Entry.Utils.COLLISION.LEFT):(e=a.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()):a.setDirection(-a.getDirection()+360),a.collision=Entry.Utils.COLLISION.RIGHT))):180>d&&0<=d&&(e=a.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right, +a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()):a.setDirection(-a.getDirection()+360),a.collision=Entry.Utils.COLLISION.RIGHT):(e=a.collision==Entry.Utils.COLLISION.LEFT,d=ndgmr.checkPixelCollision(Entry.stage.wall.left,a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()):a.setDirection(-a.getDirection()+360),a.collision= +Entry.Utils.COLLISION.LEFT)));return b.callReturn()}},flip_arrow_horizontal:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null]},func:function(a,b){a.setDirection(a.getDirection()+180);return b.callReturn()}},flip_arrow_vertical:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null]},func:function(a,b){a.setDirection(a.getDirection()+ +180);return b.callReturn()}},see_angle_object:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"see_angle_object"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(a,b){var c=b.getField("VALUE",b),d=a.getX(),e=a.getY();if(a.parent.id==c)return b.callReturn(); +"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?a.getDirection()+a.getRotation():0<=d?-Math.atan(e/d)/Math.PI*180+90:-Math.atan(e/d)/Math.PI*180+270;d=a.getDirection()+a.getRotation();a.setRotation(a.getRotation()+e-d);return b.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(a,b){var c=b.getNumberValue("VALUE",b),d=a.getDirection()+a.getRotation();a.setRotation(a.getRotation()+c-d);return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setDirection(c+a.getDirection());return b.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(a,b){if(!b.isStart){var c,d,e;d=b.getField("TARGET",b);c=b.getNumberValue("VALUE",b);c=Math.floor(c*Entry.FPS);e=Entry.stage.mouseCoordinate;if(0!=c)"mouse"==d?(d=e.x-a.getX(),e=e.y-a.getY()):(e=Entry.container.getEntity(d),d=e.getX()-a.getX(),e=e.getY()-a.getY()),b.isStart=!0,b.frameCount=c,b.dX=d/b.frameCount,b.dY=e/b.frameCount;else return"mouse"==d?(d=Number(e.x), +e=Number(e.y)):(e=Entry.container.getEntity(d),d=e.getX(),e=e.getY()),a.setX(d),a.setY(e),a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY()),b.callReturn()}if(0!=b.frameCount)return a.setX(a.getX()+b.dX),a.setY(a.getY()+b.dY),b.frameCount--,a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY()),b;delete b.isStart;delete b.frameCount;return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setRotation(c);return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setRotation(c+a.getRotation());return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setDirection(c);return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setDirection(c+a.getDirection());return b.callReturn()}},move_to_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"}, +{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},{type:"number",params:["10"]},null],type:"move_to_angle"},paramsKeyMap:{ANGLE:0,VALUE:1},"class":"move_rotate",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b),d=b.getNumberValue("ANGLE",b);a.setX(a.getX()+c*Math.cos((d-90)/180*Math.PI));a.setY(a.getY()-c*Math.sin((d-90)/180*Math.PI));a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}}, +rotate_by_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"angle"},null],type:"rotate_by_time"},paramsKeyMap:{VALUE:0,ANGLE:1},"class":"rotate",isNotFor:[],func:function(a,b){function c(){a.setRotation(a.getRotation()+b.dAngle);b.frameCount--}if(!b.isStart){var d;d=b.getNumberValue("VALUE",b);var e=b.getNumberValue("ANGLE", +b);b.isStart=!0;b.frameCount=Math.max(Math.floor(d*Entry.FPS),1);b.dAngle=e/b.frameCount;1==b.frameCount&&c()}if(0!=b.frameCount)return c(),b;delete b.isStart;delete b.frameCount;return b.callReturn()}},direction_relative_duration:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"text",params:["2"]},{type:"angle"},null],type:"direction_relative_duration"}, +paramsKeyMap:{DURATION:0,AMOUNT:1},"class":"rotate",isNotFor:[],func:function(a,b){function c(){a.setDirection(a.getDirection()+b.dDirection);b.frameCount--}if(!b.isStart){var d;d=b.getNumberValue("DURATION",b);var e=b.getNumberValue("AMOUNT",b);b.isStart=!0;b.frameCount=Math.max(Math.floor(d*Entry.FPS),1);b.dDirection=e/b.frameCount;1==b.frameCount&&c()}if(0!=b.frameCount)return c(),b;delete b.isStart;delete b.frameCount;delete b.dDirection;return b.callReturn()}},neobot_sensor_value:{color:"#00979D", +skeleton:"basic_string_field",fontColor:"#fff",statements:[],template:"%1 \uac12",params:[{type:"Dropdown",options:[["1\ubc88 \ud3ec\ud2b8","IN1"],["2\ubc88 \ud3ec\ud2b8","IN2"],["3\ubc88 \ud3ec\ud2b8","IN3"],["\ub9ac\ubaa8\ucee8","IR"],["\ubc30\ud130\ub9ac","BAT"]],value:"IN1",fontSize:11}],events:{},def:{params:[null],type:"neobot_sensor_value"},paramsKeyMap:{PORT:0},"class":"neobot_value",isNotFor:["neobot"],func:function(a,b){a=b.getStringField("PORT");return Entry.hw.portData[a]}},neobot_sensor_convert_scale:{color:"#00979D", +skeleton:"basic_string_field",fontColor:"#fff",statements:[],template:"%1 \uac12\uc758 \ubc94\uc704\ub97c %2 ~ %3 \uc5d0\uc11c %4 ~ %5 (\uc73c)\ub85c \ubcc0\ud658",params:[{type:"Dropdown",options:[["1\ubc88 \ud3ec\ud2b8","IN1"],["2\ubc88 \ud3ec\ud2b8","IN2"],["3\ubc88 \ud3ec\ud2b8","IN3"],["\ub9ac\ubaa8\ucee8","IR"],["\ubc30\ud130\ub9ac","BAT"]],value:"IN1",fontSize:11},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"}],events:{}, +def:{params:[null,{type:"number",params:["0"]},{type:"number",params:["255"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"neobot_sensor_convert_scale"},paramsKeyMap:{PORT:0,OMIN:1,OMAX:2,MIN:3,MAX:4},"class":"neobot_value",isNotFor:["neobot"],func:function(a,b){a=b.getStringField("PORT");a=Entry.hw.portData[a];var c=b.getNumberValue("OMIN",b),d=b.getNumberValue("OMAX",b),e=b.getNumberValue("MIN",b);b=b.getNumberValue("MAX",b);if(c>d)var f=c,c=d,d=f;e>b&&(f=e,e=b,b=f);a=Math.min(b, +(b-e)/(d-c)*(a-c)+e);a=Math.max(e,a);return Math.round(a)}},neobot_left_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc67c\ucabd \ubaa8\ud130\ub97c %1 %2 \uc758 \uc18d\ub3c4\ub85c \ud68c\uc804 %3",params:[{type:"Dropdown",options:[["\uc55e\uc73c\ub85c","16"],["\ub4a4\ub85c","32"]],value:"16",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{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"],["14","14"],["15","15"]],value:"0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,"15",null],type:"neobot_left_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1},"class":"neobot_motor",isNotFor:["neobot"],func:function(a,b){a=b.getNumberField("SPEED");var c=b.getNumberField("DIRECTION");Entry.hw.sendQueue.DCL=a+c;return b.callReturn()}},neobot_stop_left_motor:{color:"#00979D",skeleton:"basic", +statements:[],template:"\uc67c\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_left_motor"},"class":"neobot_motor",isNotFor:["neobot"],func:function(a,b){Entry.hw.sendQueue.DCL=0;return b.callReturn()}},neobot_right_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubaa8\ud130\ub97c %1 %2 \uc758 \uc18d\ub3c4\ub85c \ud68c\uc804 %3",params:[{type:"Dropdown", +options:[["\uc55e\uc73c\ub85c","16"],["\ub4a4\ub85c","32"]],value:"16",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{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"],["14","14"],["15","15"]],value:"0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,"15",null],type:"neobot_right_motor"}, +paramsKeyMap:{DIRECTION:0,SPEED:1},"class":"neobot_motor",isNotFor:["neobot"],func:function(a,b){a=b.getNumberField("SPEED");var c=b.getNumberField("DIRECTION");Entry.hw.sendQueue.DCR=a+c;return b.callReturn()}},neobot_stop_right_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_right_motor"},"class":"neobot_motor", +isNotFor:["neobot"],func:function(a,b){Entry.hw.sendQueue.DCR=0;return b.callReturn()}},neobot_all_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc591\ucabd \ubaa8\ud130\ub97c %1 %2\uc758 \uc18d\ub3c4\ub85c %3\ucd08 \ub3d9\uc548 \ud68c\uc804 %4",params:[{type:"Dropdown",options:[["\uc55e\uc73c\ub85c","1"],["\ub4a4\ub85c","2"],["\uc81c\uc790\ub9ac\uc5d0\uc11c \uc67c\ucabd \ub3cc\uae30","3"],["\uc81c\uc790\ub9ac\uc5d0\uc11c \uc624\ub978\ucabd \ub3cc\uae30","4"],["\uc67c\ucabd\uc73c\ub85c \ub3cc\uae30", +"5"],["\uc624\ub978\ucabd\uc73c\ub85c \ub3cc\uae30","6"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{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"],["14","14"],["15","15"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:["1","15", +{type:"number",params:["0"]}],type:"neobot_all_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1,DURATION:2},"class":"neobot_motor",isNotFor:["neobot"],func:function(a,b){if(b.isStart){if(1==b.timeFlag)return b;delete b.timeFlag;delete b.isStart;Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR=0;Entry.engine.isContinue=!1;return b.callReturn()}a=b.getNumberField("SPEED");var c=b.getNumberField("DIRECTION"),d=b.getNumberValue("DURATION");0>d&&(d=0);switch(c){case 1:Entry.hw.sendQueue.DCL=16+a;Entry.hw.sendQueue.DCR= +16+a;break;case 2:Entry.hw.sendQueue.DCL=32+a;Entry.hw.sendQueue.DCR=32+a;break;case 3:Entry.hw.sendQueue.DCL=32+a;Entry.hw.sendQueue.DCR=16+a;break;case 4:Entry.hw.sendQueue.DCL=16+a;Entry.hw.sendQueue.DCR=32+a;break;case 5:Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR=16+a;break;case 6:Entry.hw.sendQueue.DCL=16+a,Entry.hw.sendQueue.DCR=0}if(0===d)return b.callReturn();b.isStart=!0;b.timeFlag=1;setTimeout(function(){b.timeFlag=0},1E3*d);return b}},neobot_stop_all_motor:{color:"#00979D",skeleton:"basic", +statements:[],template:"\uc591\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_all_motor"},"class":"neobot_motor",isNotFor:["neobot"],func:function(a,b){Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR=0;return b.callReturn()}},neobot_set_servo:{color:"#00979D",skeleton:"basic",statements:[],template:"%1 \ud3ec\ud2b8\uc758 \uc11c\ubcf4\ubaa8\ud130\ub97c %2 \ub3c4 \uc774\ub3d9 %3",params:[{type:"Dropdown", +options:[["OUT1","1"],["OUT2","2"],["OUT3","3"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"neobot_set_servo"},paramsKeyMap:{PORT:0,DEGREE:1},"class":"neobot_output",isNotFor:["neobot"],func:function(a,b){a=b.getNumberField("PORT");var c=b.getNumberValue("DEGREE");0>c?c=0:180c?c=0:255a.count)throw a.count++,new Entry.Utils.AsyncError;a.isStart=!1;b=Entry.hw.portData[a.data_default_address];a.data_default_address=void 0;return b}},robotis_openCM70_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[], +params:[{type:"Dropdown",options:[[Lang.Blocks.robotis_cm_sound_detected,"CM_SOUND_DETECTED"],[Lang.Blocks.robotis_cm_sound_detecting,"CM_SOUND_DETECTING"],[Lang.Blocks.robotis_cm_user_button,"CM_USER_BUTTON"]],value:"CM_SOUND_DETECTED",fontSize:11}],events:{},def:{params:[null],type:"robotis_openCM70_sensor_value"},paramsKeyMap:{SENSOR:0},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(a,b){a=b.executor.scope;if(!a.isStart){a.isStart=!0;a.count=0;var c=Entry.Robotis_openCM70.INSTRUCTION.READ, +d=0,e=0,f=0,g=0;b=b.getStringField("SENSOR");"CM_SOUND_DETECTED"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1]):"CM_SOUND_DETECTING"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0], +e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1]):"CM_USER_BUTTON"==b&&(f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1]);f+=0*g;Entry.Robotis_carCont.setRobotisData([[c,d,e,0,g]]);Entry.Robotis_carCont.update();a.data_default_address=f;throw new Entry.Utils.AsyncError;}if(2>a.count)throw a.count++,new Entry.Utils.AsyncError; +a.isStart=!1;b=Entry.hw.portData[a.data_default_address];a.data_default_address=void 0;return b}},robotis_openCM70_aux_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["3","PORT_3"],["4","PORT_4"],["5","PORT_5"],["6","PORT_6"]],value:"PORT_3",fontSize:11},{type:"Dropdown",options:[[Lang.Blocks.robotis_aux_servo_position,"AUX_SERVO_POSITION"],[Lang.Blocks.robotis_aux_ir,"AUX_IR"],[Lang.Blocks.robotis_aux_touch,"AUX_TOUCH"], +[Lang.Blocks.robotis_aux_brightness,"AUX_BRIGHTNESS"],[Lang.Blocks.robotis_aux_hydro_themo_humidity,"AUX_HYDRO_THEMO_HUMIDITY"],[Lang.Blocks.robotis_aux_hydro_themo_temper,"AUX_HYDRO_THEMO_TEMPER"],[Lang.Blocks.robotis_aux_temperature,"AUX_TEMPERATURE"],[Lang.Blocks.robotis_aux_ultrasonic,"AUX_ULTRASONIC"],[Lang.Blocks.robotis_aux_magnetic,"AUX_MAGNETIC"],[Lang.Blocks.robotis_aux_motion_detection,"AUX_MOTION_DETECTION"],[Lang.Blocks.robotis_aux_color,"AUX_COLOR"],[Lang.Blocks.robotis_aux_custom,"AUX_CUSTOM"]], +value:"AUX_SERVO_POSITION",fontSize:11}],events:{},def:{params:[null,null],type:"robotis_openCM70_aux_sensor_value"},paramsKeyMap:{PORT:0,SENSOR:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(a,b){a=b.executor.scope;if(!a.isStart){a.isStart=!0;a.count=0;var c=Entry.Robotis_openCM70.INSTRUCTION.READ,d=0,e=0,f=0,g=0,h=b.getStringField("PORT");b=b.getStringField("SENSOR");var k=0;"PORT_3"==h?k=2:"PORT_4"==h?k=3:"PORT_5"==h?k=4:"PORT_6"==h&&(k=5);"AUX_SERVO_POSITION"==b? +(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1]):"AUX_IR"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1]):"AUX_TOUCH"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0], +g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1]):"AUX_TEMPERATURE"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1]):"AUX_BRIGHTNESS"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1], +d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1]):"AUX_HYDRO_THEMO_HUMIDITY"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1]):"AUX_HYDRO_THEMO_TEMPER"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0], +g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1]):"AUX_ULTRASONIC"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1]):"AUX_MAGNETIC"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0], +g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1]):"AUX_MOTION_DETECTION"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1]):"AUX_COLOR"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0], +g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1]):"AUX_CUSTOM"==b&&(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1]);f+=k*g;0!=k&&(e=6*g);Entry.Robotis_carCont.setRobotisData([[c,d,e,0,g]]);Entry.Robotis_carCont.update();a.data_default_address= +f;console.log(f);throw new Entry.Utils.AsyncError;}if(2>a.count)throw a.count++,new Entry.Utils.AsyncError;a.isStart=!1;c=Entry.hw.portData[a.data_default_address];a.data_default_address=void 0;return c}},robotis_openCM70_cm_buzzer_index:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.note_a+"(0)","0"],[Lang.General.note_a+"#(1)","1"],[Lang.General.note_b+"(2)","2"],[Lang.General.note_c+"(3)","3"],[Lang.General.note_c+"#(4)","4"],[Lang.General.note_d+ +"(5)","5"],[Lang.General.note_d+"#(6)","6"],[Lang.General.note_e+"(7)","7"],[Lang.General.note_f+"(8)","8"],[Lang.General.note_f+"#(9)","9"],[Lang.General.note_g+"(10)","10"],[Lang.General.note_g+"#(11)","11"],[Lang.General.note_a+"(12)","12"],[Lang.General.note_a+"#(13)","13"],[Lang.General.note_b+"(14)","14"],[Lang.General.note_c+"(15)","15"],[Lang.General.note_c+"#(16)","16"],[Lang.General.note_d+"(17)","17"],[Lang.General.note_d+"#(18)","18"],[Lang.General.note_e+"(19)","19"],[Lang.General.note_f+ +"(20)","20"],[Lang.General.note_f+"#(21)","21"],[Lang.General.note_g+"(22)","22"],[Lang.General.note_g+"#(23)","23"],[Lang.General.note_a+"(24)","24"],[Lang.General.note_a+"#(25)","25"],[Lang.General.note_b+"(26)","26"],[Lang.General.note_c+"(27)","27"],[Lang.General.note_c+"#(28)","28"],[Lang.General.note_d+"(29)","29"],[Lang.General.note_d+"#(30)","30"],[Lang.General.note_e+"(31)","31"],[Lang.General.note_f+"(32)","32"],[Lang.General.note_f+"#(33)","33"],[Lang.General.note_g+"(34)","34"],[Lang.General.note_g+ +"#(35)","35"],[Lang.General.note_a+"(36)","36"],[Lang.General.note_a+"#(37)","37"],[Lang.General.note_b+"(38)","38"],[Lang.General.note_c+"(39)","39"],[Lang.General.note_c+"#(40)","40"],[Lang.General.note_d+"(41)","41"],[Lang.General.note_d+"#(42)","42"],[Lang.General.note_e+"(43)","43"],[Lang.General.note_f+"(44)","44"],[Lang.General.note_f+"#(45)","45"],[Lang.General.note_g+"(46)","46"],[Lang.General.note_g+"#(47)","47"],[Lang.General.note_a+"(48)","48"],[Lang.General.note_a+"#(49)","49"],[Lang.General.note_b+ +"(50)","50"],[Lang.General.note_c+"(51)","51"]],value:"0",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["1"]},null],type:"robotis_openCM70_cm_buzzer_index"},paramsKeyMap:{CM_BUZZER_INDEX:0,CM_BUZZER_TIME:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(a,b){a=b.getField("CM_BUZZER_INDEX",b);var c=b.getNumberValue("CM_BUZZER_TIME",b),d=Entry.Robotis_openCM70.INSTRUCTION.WRITE, +e,f,g;e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[0];f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[1];g=parseInt(10*c);50m?(l=Math.round(m-155),f=-l,g=0,Entry.dplay.Left_value=f):0==m&&(g=f=0,Entry.dplay.Left_value=0));"2"==q&&(d=6,e=11,0m?(l=Math.round(m-155),h=-l,k=0,Entry.dplay.Right_value=h):0==m&&(k=h=0,Entry.dplay.Right_value=h));"3"==q&&(a=3,c=5,d=6,e=11,0m?(l=Math.round(m-155),f=-l,g=0,Entry.dplay.Left_value=f):0==m&&(g=f=0,Entry.dplay.Left_value=0));"2"==n&&(d=6,e=11,0m?(l=Math.round(m-155),h=-l,k=0,Entry.dplay.Right_value=h):0==m&&(k=h=0,Entry.dplay.Right_value=h));"3"==n&&(a=3,c=5,d=6,e=11,0m?(l=Math.round(m-155),f=-l,g=0,h=-l,k=0,Entry.dplay.Left_value=f,Entry.dplay.Right_value=h):0==m&&(k=h=g=f=0,Entry.dplay.Left_value=0,Entry.dplay.Right_value=0));if(b.isStart){if(1==b.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0),b;if(2==b.timeFlag)return Entry.hw.setDigitalPortValue(a,f),Entry.hw.setDigitalPortValue(c,g),Entry.hw.setDigitalPortValue(d,k),Entry.hw.setDigitalPortValue(e, -h),delete b.isStart,delete b.timeFlag,Entry.engine.isContinue=!1,b.callReturn()}else{b.isStart=!0;b.timeFlag=1;var n=setTimeout(function(){b.timeFlag=2;Entry.dplay.removeTimeout(n)},50);Entry.dplay.timeouts.push(n);return b}}},dplay_robot_speed_set:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubc14\ud034 %1 \uc67c\ucabd \ubc14\ud034 %2(\uc73c)\ub85c \uc815\ud558\uae30 %3",params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator", +h),delete b.isStart,delete b.timeFlag,Entry.engine.isContinue=!1,b.callReturn()}else{b.isStart=!0;b.timeFlag=1;var q=setTimeout(function(){b.timeFlag=2;Entry.dplay.removeTimeout(q)},50);Entry.dplay.timeouts.push(q);return b}}},dplay_robot_speed_set:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubc14\ud034 %1 \uc67c\ucabd \ubc14\ud034 %2(\uc73c)\ub85c \uc815\ud558\uae30 %3",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:["100"]},{type:"text",params:["100"]},null],type:"dplay_robot_speed_set"},paramsKeyMap:{R_VALUE:0,L_VALUE:1},"class":"dplay_robot",isNotFor:["dplay"],func:function(a,b){var c=a=0,d=0,e=0,f=0,f=0,f=b.getNumberValue("L_VALUE",b),f=Math.max(f,-100),f=Math.min(f,100);0f?(f=Math.round(f-155),a=-f,c=0,Entry.dplay.Left_value=a):0==f&&(c=a=0,Entry.dplay.Left_value= 0);f=b.getNumberValue("R_VALUE",b);f=Math.max(f,-100);f=Math.min(f,100);0f?(f=Math.round(f-155),d=-f,e=0,Entry.dplay.Right_value=d):0==f&&(e=d=0,Entry.dplay.Right_value=0);if(b.isStart){if(1==b.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0),b;if(2==b.timeFlag)return Entry.hw.setDigitalPortValue(3,a),Entry.hw.setDigitalPortValue(5,c), Entry.hw.setDigitalPortValue(6,e),Entry.hw.setDigitalPortValue(11,d),delete b.isStart,delete b.timeFlag,Entry.engine.isContinue=!1,b.callReturn()}else{b.isStart=!0;b.timeFlag=1;var g=setTimeout(function(){b.timeFlag=2;Entry.dplay.removeTimeout(g)},50);Entry.dplay.timeouts.push(g);return b}}},dplay_robot_stop:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\ub85c\ubd07\uc744 \uc815\uc9c0\ud558\uae30 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}], @@ -2527,11 +2098,12 @@ a[d].removeClass("entryRemove")}};a.getCategoryCodes=function(b){b=this._convert b&&Entry.playground.checkVariables();"arduino"==b&&this._generateHwCode();var d=this._categoryElems[b],e=this._selectedCategoryView,f=!1,g=this.workspace.board,h=g.view;e&&e.removeClass("entrySelectedCategory");d!=e||a?e||(this.visible||(f=!0,h.addClass("foldOut"),Entry.playground.showTabs()),h.removeClass("folding"),this.visible=!0):(h.addClass("folding"),this._selectedCategoryView=null,d.removeClass("entrySelectedCategory"),Entry.playground.hideTabs(),f=!0,this.visible=!1);f&&Entry.bindAnimationCallbackOnce(h, function(){g.scroller.resizeScrollBar.call(g.scroller);h.removeClass("foldOut");Entry.windowResized.notify()});this.visible&&(a=this._categoryCodes[b],this._selectedCategoryView=d,d.addClass("entrySelectedCategory"),a.constructor!==Entry.Code&&(a=this._categoryCodes[b]=new Entry.Code(a)),this.changeCode(a));this.lastSelector=b}};a._generateCategoryCodes=function(b){this._categoryCodes={};for(var a=0;athis._bannedClass.indexOf(b)&&this._bannedClass.push(b);this.align(a)};a.unbanClass=function(b,a){b=this._bannedClass.indexOf(b);-1a&&(b.preventDefault(),this.selectMenu(a-49))};a.setPatternRectFill=function(b){this.patternRect.attr({fill:b});this.pattern.attr({style:""})};a.disablePattern=function(){this.pattern.attr({style:"display: none"})};a._clearCategory=function(){this._selectedCategoryView=null;this._categories=[];var b=this._categoryElems,a;for(a in b)b[a].remove();this._categoryElems={};b=this._categoryCodes;for(a in b){var d=b[a];d.constructor==Entry.Code&& -d.clear()}this._categoryCodes=null};a.setCategoryData=function(b){this._clearCategory();this._categoryData=b;this._generateCategoryView(b);this._generateCategoryCodes(b)};a._generateCategoryView=function(b){if(b)for(var a=0;aa&&(b.preventDefault(),this.selectMenu(a-49))};a.setPatternRectFill=function(b){this.patternRect.attr({fill:b}); +this.pattern.attr({style:""})};a.disablePattern=function(){this.pattern.attr({style:"display: none"})};a._clearCategory=function(){this._selectedCategoryView=null;this._categories=[];var b=this._categoryElems,a;for(a in b)b[a].remove();this._categoryElems={};b=this._categoryCodes;for(a in b){var d=b[a];d.constructor==Entry.Code&&d.clear()}this._categoryCodes=null};a.setCategoryData=function(b){this._clearCategory();this._categoryData=b;this._generateCategoryView(b);this._generateCategoryCodes(b)}; +a._generateCategoryView=function(b){if(b)for(var a=0;a=a?this.setVisible(!1):this.setVisible(!0)};a._reset=function(){this.vY=0;this.vScrollbar.attr({y:this.vY});this.resizeScrollBar()};a.onMouseDown=function(b){function a(b){b.stopPropagation&&b.stopPropagation();b.preventDefault&&b.preventDefault();b=b.originalEvent&&b.originalEvent.touches?b.originalEvent.touches[0]:b;var c=e.dragInstance; @@ -2549,38 +2121,39 @@ this))}if((b=a.statements)&&b.length)for(g=0;gEntry.BlockView.DRAG_RADIUS)&&n.movable&&(n.isInBlockMenu?e.cloneToGlobal(b):(b=!1,n.dragMode!=Entry.DRAG_MODE_DRAG&&(n._toGlobalCoordinate(),n.dragMode= -Entry.DRAG_MODE_DRAG,n.block.getThread().changeEvent.notify(),Entry.GlobalSvg.setView(n,c),b=!0),this.animating&&this.set({animating:!1}),0===n.dragInstance.height&&n.dragInstance.set({height:-1+n.height}),c=n.dragInstance,n._moveBy(d.pageX-c.offsetX,d.pageY-c.offsetY,!1),c.set({offsetX:d.pageX,offsetY:d.pageY}),Entry.GlobalSvg.position(),n.originPos||(n.originPos={x:n.x,y:n.y}),b&&e.generateCodeMagnetMap(),n._updateCloseBlock()))}function d(b){$(document).unbind(".block");n.terminateDrag(b);e&&e.set({dragBlock:null}); -n._changeFill(!1);Entry.GlobalSvg.remove();delete this.mouseDownCoordinate;delete n.dragInstance}b.stopPropagation&&b.stopPropagation();b.preventDefault&&b.preventDefault();this._changeFill(!1);var e=this.getBoard();Entry.documentMousedown&&Entry.documentMousedown.notify(b);if(!this.readOnly&&!e.viewOnly){e.setSelectedBlock(this);this.dominate();if(0===b.button||b.originalEvent&&b.originalEvent.touches){var f;f=b.originalEvent&&b.originalEvent.touches?b.originalEvent.touches[0]:b;this.mouseDownCoordinate= -{x:f.pageX,y:f.pageY};var g=$(document);g.bind("mousemove.block touchmove.block",c);g.bind("mouseup.block touchend.block",d);this.dragInstance=new Entry.DragInstance({startX:f.pageX,startY:f.pageY,offsetX:f.pageX,offsetY:f.pageY,height:0,mode:!0});e.set({dragBlock:this});this.addDragging();this.dragMode=Entry.DRAG_MODE_MOUSEDOWN}else if(Entry.Utils.isRightButton(b)){var h=this,k=h.block;if(this.isInBlockMenu)return;f=[];var g={text:Lang.Blocks.Duplication_option,enable:this.copyable,callback:function(){Entry.do("cloneBlock", -k)}},l={text:Lang.Blocks.CONTEXT_COPY_option,enable:this.copyable,callback:function(){h.block.copyToClipboard()}},q={text:Lang.Blocks.Delete_Blocks,enable:k.isDeletable(),callback:function(){Entry.do("destroyBlock",h.block)}},m={text:Lang.Menus.save_as_image,callback:function(){h.downloadAsImage()}};f.push(g);f.push(l);f.push(q);Entry.Utils.isChrome()&&"workspace"==Entry.type&&f.push(m);Entry.ContextMenu.show(f)}var n=this;e.workspace.getMode()===Entry.Workspace.MODE_VIMBOARD&&b&&document.getElementsByClassName("CodeMirror")[0].dispatchEvent(Entry.Utils.createMouseEvent("dragStart", -event))}};a.vimBoardEvent=function(b,a,d){b&&(b=Entry.Utils.createMouseEvent(a,b),d&&(b.block=d),document.getElementsByClassName("CodeMirror")[0].dispatchEvent(b))};a.terminateDrag=function(b){var a=this.getBoard(),d=this.dragMode,e=this.block,f=a.workspace.getMode();this.removeDragging();this.set({visible:!0});this.dragMode=Entry.DRAG_MODE_NONE;if(f===Entry.Workspace.MODE_VIMBOARD)a instanceof Entry.BlockMenu?(a.terminateDrag(),this.vimBoardEvent(b,"dragEnd",e)):a.clear();else if(d===Entry.DRAG_MODE_DRAG){var f= -this.dragInstance&&this.dragInstance.isNew,g=Entry.GlobalSvg,h=this.block.getPrevBlock(this.block);b=!1;switch(Entry.GlobalSvg.terminateDrag(this)){case g.DONE:g=a.magnetedBlockView;g instanceof Entry.BlockView&&(g=g.block);h&&!g?Entry.do("separateBlock",e):h||g||f?g?("next"===g.view.magneting?(h=e.getLastBlock(),this.dragMode=d,a.separate(e),this.dragMode=Entry.DRAG_MODE_NONE,Entry.do("insertBlock",g,h).isPass(f),Entry.ConnectionRipple.setView(g.view).dispose()):(Entry.do("insertBlock",e,g).isPass(f), -b=!0),createjs.Sound.play("entryMagneting")):Entry.do("moveBlock",e).isPass(f):e.getThread().view.isGlobal()?Entry.do("moveBlock",e):Entry.do("separateBlock",e);break;case g.RETURN:e=this.block;d=this.originPos;h?(this.set({animating:!1}),createjs.Sound.play("entryMagneting"),this.bindPrev(h),e.insert(h)):(f=e.getThread().view.getParent(),f instanceof Entry.Board?this._moveTo(d.x,d.y,!1):(createjs.Sound.play("entryMagneting"),Entry.do("insertBlock",e,f)));break;case g.REMOVE:createjs.Sound.play("entryDelete"), -f?this.block.destroy(!1,!0):this.block.doDestroyBelow(!1)}a.setMagnetedBlock(null);b&&Entry.ConnectionRipple.setView(e.view).dispose()}this.destroyShadow();delete this.originPos;this.dominate()};a._updateCloseBlock=function(){var b=this.getBoard(),a;if(this._skeleton.magnets){for(var d in this.magnet)if(a="next"===d?this.getBoard().getNearestMagnet(this.x,this.y+this.getBelowHeight(),d):this.getBoard().getNearestMagnet(this.x,this.y,d))return b.setMagnetedBlock(a.view,d);b.setMagnetedBlock(null)}}; -a.dominate=function(){this.block.getThread().view.dominate()};a.getSvgRoot=function(){for(var b=this.getBoard().svgBlockGroup,a=this.svgGroup;a.parentNode!==b;)a=a.parentNode;return a};a.getBoard=function(){return this._board};a._setBoard=function(){this._board=this._board.code.board};a.destroy=function(b){$(this.svgGroup).unbind(".blockViewMousedown");this._destroyObservers();var a=this.svgGroup;b?$(a).fadeOut(100,function(){a.remove()}):a.remove();this._contents.forEach(function(b){b.constructor!== -Entry.Block&&b.destroy()});var d=this.block;b=d.events.viewDestroy;"workspace"==Entry.type&&b&&!this.isInBlockMenu&&b.forEach(function(b){Entry.Utils.isFunction(b)&&b(d)});this._schemaChangeEvent&&this._schemaChangeEvent.destroy()};a.getShadow=function(){this._shadow||(this._shadow=Entry.SVG.createElement(this.svgGroup.cloneNode(!0),{opacity:.5}),this.getBoard().svgGroup.appendChild(this._shadow));return this._shadow};a.destroyShadow=function(){this._shadow&&(this._shadow.remove(),delete this._shadow)}; -a._updateMagnet=function(){if(this._skeleton.magnets){var b=this._skeleton.magnets(this);b.next&&this._nextGroup.attr("transform","translate("+b.next.x+","+b.next.y+")");this.magnet=b;this.block.getThread().changeEvent.notify()}};a._updateBG=function(){if(this._board.dragBlock&&this._board.dragBlock.dragInstance){var b=this.svgGroup;if(this.magnet.next){if(b=this.magneting){var a=this._board.dragBlock.getShadow(),d=this.getAbsoluteCoordinate(),e;if("previous"===b)e=this.magnet.next,e="translate("+ -(d.x+e.x)+","+(d.y+e.y)+")";else if("next"===b){e=this.magnet.previous;var f=this._board.dragBlock.getBelowHeight();e="translate("+(d.x+e.x)+","+(d.y+e.y-f)+")"}$(a).attr({transform:e,display:"block"});this._clonedShadow=a;this.background&&(this.background.remove(),this.nextBackground.remove(),delete this.background,delete this.nextBackground);"previous"===b&&(b=this._board.dragBlock.getBelowHeight()+this.offsetY,this.originalHeight=this.offsetY,this.set({offsetY:b}))}else this._clonedShadow&&(this._clonedShadow.attr({display:"none"}), -delete this._clonedShadow),b=this.originalHeight,void 0!==b&&(this.background&&(this.background.remove(),this.nextBackground.remove(),delete this.background,delete this.nextBackground),this.set({offsetY:b}),delete this.originalHeight);(b=this.block.thread.changeEvent)&&b.notify()}else this.magneting?(b.attr({filter:"url(#entryBlockHighlightFilter_"+this.getBoard().suffix+")"}),b.addClass("outputHighlight")):(b.removeClass("outputHighlight"),b.removeAttr("filter"))}};a.addDragging=function(){this.svgGroup.addClass("dragging")}; -a.removeDragging=function(){this.svgGroup.removeClass("dragging")};a.addSelected=function(){this.svgGroup.addClass("selected")};a.removeSelected=function(){this.svgGroup.removeClass("selected")};a.getSkeleton=function(){return this._skeleton};a.getContentPos=function(){return this._skeleton.contentPos(this)};a.renderText=function(){this._startContentRender(Entry.Workspace.MODE_VIMBOARD)};a.renderBlock=function(){this._startContentRender(Entry.Workspace.MODE_BOARD)};a._updateOpacity=function(){this.svgGroup.attr({opacity:!1=== -this.visible?0:1});this.visible&&this._setPosition()};a._updateShadow=function(){this.shadow&&Entry.Utils.colorDarken(this._schema.color,.7)};a._setMovable=function(){this.movable=null!==this.block.isMovable()?this.block.isMovable():void 0!==this._skeleton.movable?this._skeleton.movable:!0};a._setReadOnly=function(){this.readOnly=null!==this.block.isReadOnly()?this.block.isReadOnly():void 0!==this._skeleton.readOnly?this._skeleton.readOnly:!1};a._setCopyable=function(){this.copyable=null!==this.block.isCopyable()? -this.block.isCopyable():void 0!==this._skeleton.copyable?this._skeleton.copyable:!0};a.bumpAway=function(b,a){var d=this;b=b||15;a?window.setTimeout(function(){d._moveBy(b,b,!1)},a):d._moveBy(b,b,!1)};a.bindPrev=function(b){if(b){if(this._toLocalCoordinate(b.view._nextGroup),(b=b.getNextBlock())&&b!==this.block){var a=this.block.getLastBlock();a.view.magnet.next?b.view._toLocalCoordinate(a.view._nextGroup):(b.view._toGlobalCoordinate(),b.separate(),b.view.bumpAway(null,100))}}else if(b=this.block.getPrevBlock())this._toLocalCoordinate(b.view._nextGroup), -(b=this.block.getNextBlock())&&b.view&&b.view._toLocalCoordinate(this._nextGroup)};a.getAbsoluteCoordinate=function(b){b=void 0!==b?b:this.dragMode;if(b===Entry.DRAG_MODE_DRAG)return{x:this.x,y:this.y};b=this.block.getThread().view.requestAbsoluteCoordinate(this);b.x+=this.x;b.y+=this.y;return b};a.getBelowHeight=function(){return this.block.getThread().view.requestPartHeight(this)};a._updateDisplay=function(){this.svgGroup.attr({display:!1===this.display?"none":"block"});this.display&&this._setPosition()}; -a._updateColor=function(){var b=this._schema.color;this.block.deletable===Entry.Block.DELETABLE_FALSE_LIGHTEN&&(b=Entry.Utils.colorLighten(b));this._fillColor=b;this._path.attr({fill:b});this._updateContents()};a._updateContents=function(){for(var b=0;b\s+/g,">").replace(/\s+(svgGroup)(defs)',h=this.svgGroup.getBoundingClientRect(),k=b?this.svgGroup:this.svgGroup.cloneNode(!0);b=this._skeleton.box(this);var l=a?1:1.5,q=function(){var b=window.platform;return b&&"windows"===b.name.toLowerCase()&&"7"===b.version[0]? -!0:!1}()?.9:.95;-1<=+-x/".split(""),t=0;tEntry.BlockView.DRAG_RADIUS)e&&(clearTimeout(e),e=null),f.movable&&(f.isInBlockMenu?g.cloneToGlobal(b):(b=!1,f.dragMode!=Entry.DRAG_MODE_DRAG&&(f._toGlobalCoordinate(), +f.dragMode=Entry.DRAG_MODE_DRAG,f.block.getThread().changeEvent.notify(),Entry.GlobalSvg.setView(f,c),b=!0),this.animating&&this.set({animating:!1}),0===f.dragInstance.height&&f.dragInstance.set({height:-1+f.height}),c=f.dragInstance,f._moveBy(d.pageX-c.offsetX,d.pageY-c.offsetY,!1),c.set({offsetX:d.pageX,offsetY:d.pageY}),Entry.GlobalSvg.position(),f.originPos||(f.originPos={x:f.x,y:f.y}),b&&g.generateCodeMagnetMap(),f._updateCloseBlock()))}function d(b){e&&(clearTimeout(e),e=null);$(document).unbind(".block"); +f.terminateDrag(b);g&&g.set({dragBlock:null});f._changeFill(!1);Entry.GlobalSvg.remove();delete this.mouseDownCoordinate;delete f.dragInstance}b.stopPropagation&&b.stopPropagation();b.preventDefault&&b.preventDefault();var e=null,f=this;this._changeFill(!1);var g=this.getBoard();Entry.documentMousedown&&Entry.documentMousedown.notify(b);if(!this.readOnly&&!g.viewOnly){g.setSelectedBlock(this);this.dominate();if(0===b.button||b.originalEvent&&b.originalEvent.touches){var h=b.type,k;k=b.originalEvent&& +b.originalEvent.touches?b.originalEvent.touches[0]:b;this.mouseDownCoordinate={x:k.pageX,y:k.pageY};var l=$(document);l.bind("mousemove.block touchmove.block",c);l.bind("mouseup.block touchend.block",d);this.dragInstance=new Entry.DragInstance({startX:k.pageX,startY:k.pageY,offsetX:k.pageX,offsetY:k.pageY,height:0,mode:!0});g.set({dragBlock:this});this.addDragging();this.dragMode=Entry.DRAG_MODE_MOUSEDOWN;"touchstart"===h&&(e=setTimeout(function(){e&&(e=null,d(),f._rightClick(b))},1E3))}else Entry.Utils.isRightButton(b)&& +this._rightClick(b);g.workspace.getMode()===Entry.Workspace.MODE_VIMBOARD&&b&&document.getElementsByClassName("CodeMirror")[0].dispatchEvent(Entry.Utils.createMouseEvent("dragStart",event))}};a.vimBoardEvent=function(b,a,d){b&&(b=Entry.Utils.createMouseEvent(a,b),d&&(b.block=d),document.getElementsByClassName("CodeMirror")[0].dispatchEvent(b))};a.terminateDrag=function(b){var a=this.getBoard(),d=this.dragMode,e=this.block,f=a.workspace.getMode();this.removeDragging();this.set({visible:!0});this.dragMode= +Entry.DRAG_MODE_NONE;if(f===Entry.Workspace.MODE_VIMBOARD)a instanceof Entry.BlockMenu?(a.terminateDrag(),this.vimBoardEvent(b,"dragEnd",e)):a.clear();else if(d===Entry.DRAG_MODE_DRAG){var f=this.dragInstance&&this.dragInstance.isNew,g=Entry.GlobalSvg,h=this.block.getPrevBlock(this.block);b=!1;switch(Entry.GlobalSvg.terminateDrag(this)){case g.DONE:g=a.magnetedBlockView;g instanceof Entry.BlockView&&(g=g.block);h&&!g?Entry.do("separateBlock",e):h||g||f?g?("next"===g.view.magneting?(h=e.getLastBlock(), +this.dragMode=d,a.separate(e),this.dragMode=Entry.DRAG_MODE_NONE,Entry.do("insertBlock",g,h).isPass(f),Entry.ConnectionRipple.setView(g.view).dispose()):(Entry.do("insertBlock",e,g).isPass(f),b=!0),createjs.Sound.play("entryMagneting")):Entry.do("moveBlock",e).isPass(f):e.getThread().view.isGlobal()?Entry.do("moveBlock",e):Entry.do("separateBlock",e);break;case g.RETURN:e=this.block;d=this.originPos;h?(this.set({animating:!1}),createjs.Sound.play("entryMagneting"),this.bindPrev(h),e.insert(h)):(f= +e.getThread().view.getParent(),f instanceof Entry.Board?this._moveTo(d.x,d.y,!1):(createjs.Sound.play("entryMagneting"),Entry.do("insertBlock",e,f)));break;case g.REMOVE:createjs.Sound.play("entryDelete"),f?this.block.destroy(!1,!0):this.block.doDestroyBelow(!1)}a.setMagnetedBlock(null);b&&Entry.ConnectionRipple.setView(e.view).dispose()}this.destroyShadow();delete this.originPos;this.dominate()};a._updateCloseBlock=function(){var b=this.getBoard(),a;if(this._skeleton.magnets){for(var d in this.magnet)if(a= +"next"===d?this.getBoard().getNearestMagnet(this.x,this.y+this.getBelowHeight(),d):this.getBoard().getNearestMagnet(this.x,this.y,d))return b.setMagnetedBlock(a.view,d);b.setMagnetedBlock(null)}};a.dominate=function(){this.block.getThread().view.dominate()};a.getSvgRoot=function(){for(var b=this.getBoard().svgBlockGroup,a=this.svgGroup;a.parentNode!==b;)a=a.parentNode;return a};a.getBoard=function(){return this._board};a._setBoard=function(){this._board=this._board.code.board};a.destroy=function(b){$(this.svgGroup).unbind(".blockViewMousedown"); +this._destroyObservers();var a=this.svgGroup;b?$(a).fadeOut(100,function(){a.remove()}):a.remove();this._contents.forEach(function(b){b.constructor!==Entry.Block&&b.destroy()});var d=this.block;b=d.events.viewDestroy;"workspace"==Entry.type&&b&&!this.isInBlockMenu&&b.forEach(function(b){Entry.Utils.isFunction(b)&&b(d)});this._schemaChangeEvent&&this._schemaChangeEvent.destroy()};a.getShadow=function(){this._shadow||(this._shadow=Entry.SVG.createElement(this.svgGroup.cloneNode(!0),{opacity:.5}),this.getBoard().svgGroup.appendChild(this._shadow)); +return this._shadow};a.destroyShadow=function(){this._shadow&&(this._shadow.remove(),delete this._shadow)};a._updateMagnet=function(){if(this._skeleton.magnets){var b=this._skeleton.magnets(this);b.next&&this._nextGroup.attr("transform","translate("+b.next.x+","+b.next.y+")");this.magnet=b;this.block.getThread().changeEvent.notify()}};a._updateBG=function(){if(this._board.dragBlock&&this._board.dragBlock.dragInstance){var b=this.svgGroup;if(this.magnet.next){if(b=this.magneting){var a=this._board.dragBlock.getShadow(), +d=this.getAbsoluteCoordinate(),e;if("previous"===b)e=this.magnet.next,e="translate("+(d.x+e.x)+","+(d.y+e.y)+")";else if("next"===b){e=this.magnet.previous;var f=this._board.dragBlock.getBelowHeight();e="translate("+(d.x+e.x)+","+(d.y+e.y-f)+")"}$(a).attr({transform:e,display:"block"});this._clonedShadow=a;this.background&&(this.background.remove(),this.nextBackground.remove(),delete this.background,delete this.nextBackground);"previous"===b&&(b=this._board.dragBlock.getBelowHeight()+this.offsetY, +this.originalHeight=this.offsetY,this.set({offsetY:b}))}else this._clonedShadow&&(this._clonedShadow.attr({display:"none"}),delete this._clonedShadow),b=this.originalHeight,void 0!==b&&(this.background&&(this.background.remove(),this.nextBackground.remove(),delete this.background,delete this.nextBackground),this.set({offsetY:b}),delete this.originalHeight);(b=this.block.thread.changeEvent)&&b.notify()}else this.magneting?(b.attr({filter:"url(#entryBlockHighlightFilter_"+this.getBoard().suffix+")"}), +b.addClass("outputHighlight")):(b.removeClass("outputHighlight"),b.removeAttr("filter"))}};a.addDragging=function(){this.svgGroup.addClass("dragging")};a.removeDragging=function(){this.svgGroup.removeClass("dragging")};a.addSelected=function(){this.svgGroup.addClass("selected")};a.removeSelected=function(){this.svgGroup.removeClass("selected")};a.getSkeleton=function(){return this._skeleton};a.getContentPos=function(){return this._skeleton.contentPos(this)};a.renderText=function(){this._startContentRender(Entry.Workspace.MODE_VIMBOARD)}; +a.renderBlock=function(){this._startContentRender(Entry.Workspace.MODE_BOARD)};a._updateOpacity=function(){this.svgGroup.attr({opacity:!1===this.visible?0:1});this.visible&&this._setPosition()};a._updateShadow=function(){this.shadow&&Entry.Utils.colorDarken(this._schema.color,.7)};a._setMovable=function(){this.movable=null!==this.block.isMovable()?this.block.isMovable():void 0!==this._skeleton.movable?this._skeleton.movable:!0};a._setReadOnly=function(){this.readOnly=null!==this.block.isReadOnly()? +this.block.isReadOnly():void 0!==this._skeleton.readOnly?this._skeleton.readOnly:!1};a._setCopyable=function(){this.copyable=null!==this.block.isCopyable()?this.block.isCopyable():void 0!==this._skeleton.copyable?this._skeleton.copyable:!0};a.bumpAway=function(b,a){var d=this;b=b||15;a?window.setTimeout(function(){d._moveBy(b,b,!1)},a):d._moveBy(b,b,!1)};a.bindPrev=function(b){if(b){if(this._toLocalCoordinate(b.view._nextGroup),(b=b.getNextBlock())&&b!==this.block){var a=this.block.getLastBlock(); +a.view.magnet.next?b.view._toLocalCoordinate(a.view._nextGroup):(b.view._toGlobalCoordinate(),b.separate(),b.view.bumpAway(null,100))}}else if(b=this.block.getPrevBlock())this._toLocalCoordinate(b.view._nextGroup),(b=this.block.getNextBlock())&&b.view&&b.view._toLocalCoordinate(this._nextGroup)};a.getAbsoluteCoordinate=function(b){b=void 0!==b?b:this.dragMode;if(b===Entry.DRAG_MODE_DRAG)return{x:this.x,y:this.y};b=this.block.getThread().view.requestAbsoluteCoordinate(this);b.x+=this.x;b.y+=this.y; +return b};a.getBelowHeight=function(){return this.block.getThread().view.requestPartHeight(this)};a._updateDisplay=function(){this.svgGroup.attr({display:!1===this.display?"none":"block"});this.display&&this._setPosition()};a._updateColor=function(){var b=this._schema.color;this.block.deletable===Entry.Block.DELETABLE_FALSE_LIGHTEN&&(b=Entry.Utils.colorLighten(b));this._fillColor=b;this._path.attr({fill:b});this._updateContents()};a._updateContents=function(){for(var b=0;b\s+/g, +">").replace(/\s+(svgGroup)(defs)',h=this.svgGroup.getBoundingClientRect(),k=b?this.svgGroup:this.svgGroup.cloneNode(!0); +b=this._skeleton.box(this);var l=a?1:1.5,n=function(){var b=window.platform;return b&&"windows"===b.name.toLowerCase()&&"7"===b.version[0]?!0:!1}()?.9:.95;-1<=+-x/".split(""),t= +0;ta&&(d+="...");return d};a.appendSvgOptionGroup=function(){return this._block.view.getBoard().svgGroup.elem("g")};a.getValue=function(){return this._block.params[this._index]};a.setValue=function(b,a){this.value!=b&&(this.value=b,this._block.params[this._index]=b,a&&this._blockView.reDraw())};a._isEditable=function(){if(this._block.view.dragMode==Entry.DRAG_MODE_DRAG)return!1;var b= -this._block.view,a=b.getBoard();if(!0===a.disableMouseEvent)return!1;var d=a.workspace.selectedBlockView;if(!d||a!=d.getBoard())return!1;a=b.getSvgRoot();return a==d.svgGroup||$(a).has($(b.svgGroup))};a._selectBlockView=function(){var b=this._block.view;b.getBoard().setSelectedBlock(b)};a._bindRenderOptions=function(){var b=this;$(this.svgGroup).bind("mouseup touchend",function(a){b._isEditable()&&(b.destroyOption(),b._startValue=b.getValue(),b.renderOptions())})};a.pointer=function(b){b=b||[];b.unshift(this._index); -b.unshift(Entry.PARAM);return this._block.pointer(b)}})(Entry.Field.prototype);Entry.FieldBlock=function(a,b,c,d,e){Entry.Model(this,!1);this._blockView=b;this._block=b.block;this._valueBlock=null;this.box=new Entry.BoxModel;this.changeEvent=new Entry.Event(this);this._index=c;this.contentIndex=e;this._content=a;this.acceptType=a.accept;this._restoreCurrent=a.restore;this.view=this;this.svgGroup=null;this._position=a.position;this.box.observe(b,"alignContent",["width","height"]);this.observe(this,"_updateBG",["magneting"],!1);this.renderStart(b.getBoard(),d)}; +b.x,y:a.y+b.y}};a.truncate=function(){var b=String(this.getValue()),a=this.TEXT_LIMIT_LENGTH,d=b.substring(0,a);b.length>a&&(d+="...");return d};a.appendSvgOptionGroup=function(){return this._block.view.getBoard().svgGroup.elem("g")};a.getValue=function(){return this._block.params[this._index]};a.setValue=function(b,a){this.value!=b&&(this.value=b,this._block.params[this._index]=b,a&&this._blockView.reDraw())};a._isEditable=function(){if(Entry.ContextMenu.visible||this._block.view.dragMode==Entry.DRAG_MODE_DRAG)return!1; +var b=this._block.view,a=b.getBoard();if(!0===a.disableMouseEvent)return!1;var d=a.workspace.selectedBlockView;if(!d||a!=d.getBoard())return!1;a=b.getSvgRoot();return a==d.svgGroup||$(a).has($(b.svgGroup))};a._selectBlockView=function(){var b=this._block.view;b.getBoard().setSelectedBlock(b)};a._bindRenderOptions=function(){var b=this;$(this.svgGroup).bind("mouseup touchend",function(a){b._isEditable()&&(b.destroyOption(),b._startValue=b.getValue(),b.renderOptions())})};a.pointer=function(b){b=b|| +[];b.unshift(this._index);b.unshift(Entry.PARAM);return this._block.pointer(b)};a.getFontSize=function(b){return b=b||this._blockView.getSkeleton().fontSize||12};a.getContentHeight=function(){return Entry.isMobile()?22:16}})(Entry.Field.prototype);Entry.FieldBlock=function(a,b,c,d,e){Entry.Model(this,!1);this._blockView=b;this._block=b.block;this._valueBlock=null;this.box=new Entry.BoxModel;this.changeEvent=new Entry.Event(this);this._index=c;this.contentIndex=e;this._content=a;this.acceptType=a.accept;this._restoreCurrent=a.restore;this.view=this;this.svgGroup=null;this._position=a.position;this.box.observe(b,"alignContent",["width","height"]);this.observe(this,"_updateBG",["magneting"],!1);this.renderStart(b.getBoard(),d)}; Entry.Utils.inherit(Entry.Field,Entry.FieldBlock); (function(a){a.schema={magneting:!1};a.renderStart=function(b,a){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(b,a),d.getThread().view.setParent(this));this.updateValueBlock(d);this._blockView.getBoard().constructor!==Entry.Board&&this._valueBlock.view.removeControl()};a.align=function(b,a,d){var e=this.svgGroup;this._position&&(this._position.x&& (b=this._position.x),this._position.y&&(a=this._position.y));var f=this._valueBlock;f&&(a=-.5*f.view.height);f="translate("+b+","+a+")";void 0===d||d?e.animate({transform:f},300,mina.easeinout):e.attr({transform:f});this.box.set({x:b,y:a})};a.calcWH=function(){var b=this._valueBlock;b?(b=b.view,this.box.set({width:b.width,height:b.height})):this.box.set({width:15,height:20})};a.calcHeight=a.calcWH;a.destroy=function(){};a.inspectBlock=function(){var b=null;if(this._originBlock)b=this._originBlock.type, @@ -2597,33 +2170,34 @@ startY:b.pageY,offsetX:b.pageX,offsetY:b.pageY})}b.stopPropagation()})};a.update Entry.BOARD_PADDING-g,a);b=Math.min(e.width()-Entry.BOARD_PADDING-f,b);a=Math.min(e.height()-Entry.BOARD_PADDING-g,a);this._scroll(b,a);this._diffs||(this._diffs=[0,0]);this._diffs[0]+=b;this._diffs[1]+=a;this._scrollCommand("scrollBoard",this._diffs[0],this._diffs[1],!0)}};a._scroll=function(b,a){this.board.code.moveBy(b,a);this.updateScrollBar(b,a)};a.setVisible=function(b){b!=this.isVisible()&&(this._visible=b,this.svgGroup.attr({display:!0===b?"block":"none"}))};a.isVisible=function(){return this._visible}; a.setOpacity=function(b){this._opacity!=b&&(this.hScrollbar.attr({opacity:b}),this.vScrollbar.attr({opacity:b}),this._opacity=b)};a.resizeScrollBar=function(){if(this._visible){var b=this.board,a=b.svgBlockGroup.getBoundingClientRect(),d=b.svgDom,e=d.width(),d=d.height(),f=a.left-b.offset().left,b=a.top-b.offset().top,g=a.width,a=a.height;if(this._horizontal){var h=-g+Entry.BOARD_PADDING,k=e-Entry.BOARD_PADDING,g=(e+2*Entry.Scroller.RADIUS)*g/(k-h+g);isNaN(g)&&(g=0);this.hX=(f-h)/(k-h)*(e-g-2*Entry.Scroller.RADIUS); this.hScrollbar.attr({width:g,x:this.hX,y:d-2*Entry.Scroller.RADIUS});this.hRatio=(e-g-2*Entry.Scroller.RADIUS)/(k-h)}this._vertical&&(f=-a+Entry.BOARD_PADDING,g=d-Entry.BOARD_PADDING,a=(d+2*Entry.Scroller.RADIUS)*a/(g-f+a),this.vY=(b-f)/(g-f)*(d-a-2*Entry.Scroller.RADIUS),this.vScrollbar.attr({height:a,y:this.vY,x:e-2*Entry.Scroller.RADIUS}),this.vRatio=(d-a-2*Entry.Scroller.RADIUS)/(g-f))}};a._bindEvent=function(){var b=_.debounce(this.resizeScrollBar,200);this.board.changeEvent.attach(this,b); -Entry.windowResized&&Entry.windowResized.attach(this,b)}})(Entry.Scroller.prototype);Entry.Board=function(a){Entry.Model(this,!1);this.changeEvent=new Entry.Event(this);this.createView(a);this.updateOffset();this.scroller=new Entry.Scroller(this,!0,!0);this._magnetMap={};Entry.ANIMATION_DURATION=200;Entry.BOARD_PADDING=100;this._initContextOptions();Entry.Utils.disableContextmenu(this.svgDom);this._addControl();this._bindEvent()};Entry.Board.OPTION_PASTE=0;Entry.Board.OPTION_ALIGN=1;Entry.Board.OPTION_CLEAR=2;Entry.Board.OPTION_DOWNLOAD=3; +Entry.windowResized&&Entry.windowResized.attach(this,b)}})(Entry.Scroller.prototype);Entry.Board=function(a){Entry.Model(this,!1);this.changeEvent=new Entry.Event(this);this.createView(a);this.updateOffset();this.scroller=new Entry.Scroller(this,!0,!0);this._magnetMap={};Entry.ANIMATION_DURATION=200;Entry.BOARD_PADDING=100;this._initContextOptions();Entry.Utils.disableContextmenu(this.svgDom);this._addControl();this._bindEvent()};Entry.Board.OPTION_PASTE=0;Entry.Board.OPTION_ALIGN=1;Entry.Board.OPTION_CLEAR=2;Entry.Board.OPTION_DOWNLOAD=3;Entry.Board.DRAG_RADIUS=5; (function(a){a.schema={code:null,dragBlock:null,magnetedBlockView:null,selectedBlockView:null};a.createView=function(b){var a=b.dom,a="string"===typeof a?$("#"+a):$(a);if("DIV"!==a.prop("tagName"))return console.error("Dom is not div element");this.view=a;this._svgId="play"+(new Date).getTime();this.workspace=b.workspace;this._activatedBlockView=null;this.wrapper=Entry.Dom("div",{parent:a,class:"entryBoardWrapper"});this.svgDom=Entry.Dom($(''), {parent:this.wrapper});this.visible=!0;var d=this;this.svg=Entry.SVG(this._svgId);$(window).scroll(function(){d.updateOffset()});this.svgGroup=this.svg.elem("g");this.svgThreadGroup=this.svgGroup.elem("g");this.svgThreadGroup.board=this;this.svgBlockGroup=this.svgGroup.elem("g");this.svgBlockGroup.board=this;b.isOverlay?(this.wrapper.addClass("entryOverlayBoard"),this.generateButtons(),this.suffix="overlayBoard"):this.suffix="board";Entry.Utils.addFilters(this.svg,this.suffix);b=Entry.Utils.addBlockPattern(this.svg, this.suffix);this.patternRect=b.rect;this.pattern=b.pattern};a.changeCode=function(b){this.code&&this.codeListener&&this.code.changeEvent.detach(this.codeListener);this.set({code:b});var a=this;b&&(this.codeListener=this.code.changeEvent.attach(this,function(){a.changeEvent.notify()}),b.createView(this));this.scroller.resizeScrollBar()};a.bindCodeView=function(b){this.svgBlockGroup.remove();this.svgThreadGroup.remove();this.svgBlockGroup=b.svgBlockGroup;this.svgThreadGroup=b.svgThreadGroup;this.svgGroup.appendChild(this.svgThreadGroup); this.svgGroup.appendChild(this.svgBlockGroup)};a.setMagnetedBlock=function(b,a){if(this.magnetedBlockView){if(this.magnetedBlockView===b)return;this.magnetedBlockView.set({magneting:!1})}this.set({magnetedBlockView:b});b&&(b.set({magneting:a}),b.dominate())};a.getCode=function(){return this.code};a.findById=function(b){return this.code.findById(b)};a._addControl=function(){var b=this.svgDom,a=this;b.mousedown(function(){a.onMouseDown.apply(a,arguments)});b.bind("touchstart",function(){a.onMouseDown.apply(a, -arguments)});b.on("wheel",function(){a.mouseWheel.apply(a,arguments)});var d=a.scroller;d&&(b.mouseenter(function(b){d.setOpacity(1)}),b.mouseleave(function(b){d.setOpacity(0)}))};a.onMouseDown=function(b){function a(b){b.stopPropagation&&b.stopPropagation();b.preventDefault&&b.preventDefault();b=b.originalEvent&&b.originalEvent.touches?b.originalEvent.touches[0]:b;var c=f.dragInstance;f.scroller.scroll(b.pageX-c.offsetX,b.pageY-c.offsetY);c.set({offsetX:b.pageX,offsetY:b.pageY})}function d(b){$(document).unbind(".entryBoard"); -delete f.dragInstance}if(this.workspace.getMode()!=Entry.Workspace.MODE_VIMBOARD){b.stopPropagation&&b.stopPropagation();b.preventDefault&&b.preventDefault();if(0===b.button||b.originalEvent&&b.originalEvent.touches){b=b.originalEvent&&b.originalEvent.touches?b.originalEvent.touches[0]:b;Entry.documentMousedown&&Entry.documentMousedown.notify(b);var e=$(document);e.bind("mousemove.entryBoard",a);e.bind("mouseup.entryBoard",d);e.bind("touchmove.entryBoard",a);e.bind("touchend.entryBoard",d);this.dragInstance= -new Entry.DragInstance({startX:b.pageX,startY:b.pageY,offsetX:b.pageX,offsetY:b.pageY})}else if(Entry.Utils.isRightButton(b)){if(!this.visible)return;b=[];this._contextOptions[Entry.Board.OPTION_PASTE].option.enable=!!Entry.clipboard;this._contextOptions[Entry.Board.OPTION_DOWNLOAD].option.enable=0!==this.code.getThreads().length;for(e=0;eb&&(f=f+e+10,e=0,d=15);e=Math.max(e,k.width);l=d+15;h._moveTo(f,l,!1);d=d+k.height+15}}this.scroller.resizeScrollBar()};a.clear=function(){this.svgBlockGroup.remove();this.svgThreadGroup.remove()};a.updateOffset= function(){this._offset=this.svg.getBoundingClientRect();var b=$(window),a=b.scrollTop(),b=b.scrollLeft(),d=this._offset;this.relativeOffset={top:d.top-a,left:d.left-b};this.btnWrapper&&this.btnWrapper.attr({transform:"translate("+(d.width/2-65)+","+(d.height-200)+")"})};a.generateButtons=function(){var b=this,a=this.svgGroup.elem("g");this.btnWrapper=a;var d=a.elem("text",{x:27,y:33,class:"entryFunctionButtonText"});d.textContent=Lang.Buttons.save;var e=a.elem("text",{x:102.5,y:33,class:"entryFunctionButtonText"}); e.textContent=Lang.Buttons.cancel;var f=a.elem("circle",{cx:27.5,cy:27.5,r:27.5,class:"entryFunctionButton"}),a=a.elem("circle",{cx:102.5,cy:27.5,r:27.5,class:"entryFunctionButton"});$(f).bind("mousedown touchstart",function(){b.save()});$(d).bind("mousedown touchstart",function(){b.save()});$(a).bind("mousedown touchstart",function(){b.cancelEdit()});$(e).bind("mousedown touchstart",function(){b.cancelEdit()})};a.cancelEdit=function(){this.workspace.setMode(Entry.Workspace.MODE_BOARD,"cancelEdit")}; a.save=function(){this.workspace.setMode(Entry.Workspace.MODE_BOARD,"save")};a.generateCodeMagnetMap=function(){var b=this.code;if(b&&this.dragBlock)for(var a in this.dragBlock.magnet){var d=this._getCodeBlocks(b,a);d.sort(function(b,a){return b.point-a.point});d.unshift({point:-Number.MAX_VALUE,blocks:[]});for(var e=1;eg.point&&(g.blocks.push(h),l++,g=d[l],g););delete f.startBlock}f.endPoint=Number.MAX_VALUE;d[e-1].endPoint= f.point}this._magnetMap[a]=d}};a._getCodeBlocks=function(b,a){b=b.getThreads();var d=[],e;switch(a){case "previous":e=this._getNextMagnets;break;case "next":e=this._getPreviousMagnets;break;case "string":e=this._getFieldMagnets;break;case "boolean":e=this._getFieldMagnets;break;case "param":e=this._getOutputMagnets;break;default:return[]}for(var f=0;fd.endPoint)f=h+1;else{e=d.blocks;for(f=0;fd.endPoint)f=h+1;else{e=d.blocks;for(f=0;fb||a.splice(b,1))};a.raiseEvent=function(b,a,d){b=this._eventMap[b];var e=[];if(void 0!==b){for(var f=0;fa;a+=15)this._dividerGroup.elem("line",{x1:49,y1:0,x2:49-(0===a%45?10:5),y2:0,transform:"rotate("+a+", 0, 0)",class:"entry-angle-divider"});a=this.getAbsolutePosFromBoard();a.x+=this.box.width/ -2;a.y=a.y+this.box.height/2+49+1;this.svgOptionGroup.attr({class:"entry-field-angle",transform:"translate("+a.x+","+a.y+")"});var a=b.getAbsolutePosFromDocument(),d=[a.x+b.box.width/2,a.y+b.box.height/2+1];$(this.svgOptionGroup).mousemove(function(a){b.optionGroup.val(b.modValue(function(b,a){var c=a[0]-b[0];b=a[1]-b[1]-49-1;a=Math.atan(-b/c);a=Entry.toDegrees(a);a=90-a;0>c?a+=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",c).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:c,y2:d});this._indicator.attr({class:"entry-angle-indicator"})}; -a.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())};a.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()};a.getTextWidth=function(){return this.textElement?this.textElement.getComputedTextLength()+ -8:8};a.getText=function(){return this.getValue()+"\u00b0"};a.modValue=function(a){return a%360};a.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.FieldColor=function(a,b,c){this._block=b.block;this._blockView=b;this.box=new Entry.BoxModel;this.svgGroup=null;this._contents=a;this._index=c;this._position=a.position;this.key=a.key;this.setValue(this.getValue()||"#FF0000");this.renderStart(b)};Entry.Utils.inherit(Entry.Field,Entry.FieldColor); -(function(a){a.renderStart=function(){this.svgGroup&&$(this.svgGroup).remove();this.svgGroup=this._blockView.contentSvgGroup.elem("g",{class:"entry-field-color"});var a=this._position,c;a?(c=a.x||0,a=a.y||0):(c=0,a=-8);this._header=this.svgGroup.elem("rect",{x:c,y:a,width:14.5,height:16,fill:this.getValue()});this._bindRenderOptions();this.box.set({x:c,y:a,width:14.5,height:16})};a.renderOptions=function(){var a=this;this._attachDisposeEvent();var c=Entry.FieldColor.getWidgetColorList();this.optionGroup= -Entry.Dom("table",{class:"entry-widget-color-table",parent:$("body")});for(var d=0;da;a+=15)this._dividerGroup.elem("line",{x1:49,y1:0,x2:49-(0=== +a%45?10:5),y2:0,transform:"rotate("+a+", 0, 0)",class:"entry-angle-divider"});a=this.getAbsolutePosFromBoard();a.x+=this.box.width/2;a.y=a.y+this.box.height/2+49+1;this.svgOptionGroup.attr({class:"entry-field-angle",transform:"translate("+a.x+","+a.y+")"});$(this.svgOptionGroup).bind("mousemove touchmove",this._updateByCoord.bind(this));$(this.svgOptionGroup).bind("mouseup touchend",this.destroyOption.bind(this));this.updateGraph();this.optionGroup.focus();this.optionGroup.select()};a._updateByCoord= +function(b){b.originalEvent&&b.originalEvent.touches&&(b=b.originalEvent.touches[0]);b=[b.clientX,b.clientY];var a=this.getAbsolutePosFromDocument();this.optionGroup.val(this.modValue(function(b,a){var c=a[0]-b[0];b=a[1]-b[1]-49-1;a=Math.atan(-b/c);a=Entry.toDegrees(a);a=90-a;0>c?a+=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",a).replace("%Y",d).replace("%LARGE",b),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:a,y2:d});this._indicator.attr({class:"entry-angle-indicator"})};a.applyValue=function(){var b=this.optionGroup.val();isNaN(b)|| +""===b||(b=this.modValue(b),this.setValue(b),this.updateGraph(),this.textElement.textContent=this.getValue(),this.optionGroup&&this.optionGroup.val(b),this.resize())};a.resize=function(){var b=this.getTextWidth();this._header.attr({width:b});this.optionGroup&&this.optionGroup.css({width:b});this.box.set({width:b});this._block.view.alignContent()};a.getTextWidth=function(){return this.textElement?this.textElement.getComputedTextLength()+8:8};a.getText=function(){return this.getValue()+"\u00b0"};a.modValue= +function(b){return b%360};a.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.FieldColor=function(a,b,c){this._block=b.block;this._blockView=b;this.box=new Entry.BoxModel;this.svgGroup=null;this._contents=a;this._index=c;this._position=a.position;this.key=a.key;this.setValue(this.getValue()||"#FF0000");this._CONTENT_HEIGHT=this.getContentHeight();this._CONTENT_WIDTH=this.getContentWidth();this.renderStart(b)};Entry.Utils.inherit(Entry.Field,Entry.FieldColor); +(function(a){a.renderStart=function(){this.svgGroup&&$(this.svgGroup).remove();this.svgGroup=this._blockView.contentSvgGroup.elem("g",{class:"entry-field-color"});var b=this._CONTENT_HEIGHT,a=this._CONTENT_WIDTH,d=this._position,e;d?(e=d.x||0,d=d.y||0):(e=0,d=-b/2);this._header=this.svgGroup.elem("rect",{x:e,y:d,width:a,height:b,fill:this.getValue()});this._bindRenderOptions();this.box.set({x:e,y:d,width:a,height:b})};a.renderOptions=function(){var b=this;this._attachDisposeEvent();var a=Entry.FieldColor.getWidgetColorList(); +this.optionGroup=Entry.Dom("table",{class:"entry-widget-color-table",parent:$("body")});for(var d=0;d'),{parent:this._container});this.svg=Entry.SVG("globalSvg");this.top=this.left=0;this._inited=!0}}; a.setView=function(a,c){if(a!=this._view&&!a.block.isReadOnly()&&a.movable)return this._view=a,this._mode=c,c!==Entry.Workspace.MODE_VIMBOARD&&a.set({visible:!1}),this.draw(),this.show(),this.align(),this.position(),!0};a.draw=function(){var a=this._view;this._svg&&this.remove();var c=this._mode==Entry.Workspace.MODE_VIMBOARD;this.svgGroup=Entry.SVG.createElement(a.svgGroup.cloneNode(!0),{opacity:1});this.svg.appendChild(this.svgGroup);c&&(a=$(this.svgGroup),a.find("g").css({filter:"none"}),a.find("path").velocity({opacity:0}, {duration:500}),a.find("text").velocity({fill:"#000000"},{duration:530}))};a.remove=function(){this.svgGroup&&(this.svgGroup.remove(),delete this.svgGroup,delete this._view,delete this._offsetX,delete this._offsetY,delete this._startX,delete this._startY,this.hide())};a.align=function(){var a=this._view.getSkeleton().box(this._view).offsetX||0,c=this._view.getSkeleton().box(this._view).offsetY||0,a=-1*a+1,c=-1*c+1;this._offsetX=a;this._offsetY=c;this.svgGroup.attr({transform:"translate("+a+","+c+ @@ -2709,829 +2285,3 @@ Entry.Xml.getNumberValue=function(a,b,c){c=c.childNodes;if(!c.length)return null Entry.Xml.getNumberField=function(a,b){b=b.childNodes;if(!b.length)return null;for(var c in b)if("FIELD"==b[c].tagName.toUpperCase()&&b[c].getAttribute("name")==a)return Number(b[c].textContent)};Entry.Xml.getBooleanValue=function(a,b,c){c=c.getElementsByTagName("value");if(!c.length)return null;for(var d in c)if(c[d].getAttribute("name")==b)return Entry.Xml.operate(a,c[d].children[0]);return null};Entry.Xml.operate=function(a,b){return Entry.block[b.getAttribute("type")](a,b)}; Entry.Xml.cloneBlock=function(a,b,c){var d=a.cloneNode();a.parentNode&&"xml"!=a.parentNode.tagName&&Entry.Xml.cloneBlock(a.parentNode,d,"parent");for(var e=0;eEntry.Albert.tempo&&(Entry.Albert.tempo=1);return a.callReturn()}}, -albert_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:"albert_set_tempo_to"},paramsKeyMap:{VALUE:0},"class":"albert_buzzer",isNotFor:["albert"],func:function(b,a){Entry.Albert.tempo=a.getNumberValue("VALUE");1>Entry.Albert.tempo&&(Entry.Albert.tempo=1);return a.callReturn()}},albert_move_forward:{color:"#00979D",skeleton:"basic", -statements:[],params:[{type:"Indicator",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 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;c.leftWheel=30;c.rightWheel=30;setTimeout(function(){a.timeFlag=0},1E3);return a}},albert_move_backward:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator", -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", -"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", -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])}}, -arduino_get_digital_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[{type:"arduino_get_port_number"}],type:"arduino_get_digital_value"},paramsKeyMap:{VALUE:0},"class":"arduino_value",isNotFor:["arduino"],func:function(b,a){var c=a.getNumberValue("VALUE",a);return Entry.hw.getDigitalPortValue(c)}},arduino_toggle_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"}, -{type:"Dropdown",options:[[Lang.Blocks.ARDUINO_on,"on"],[Lang.Blocks.ARDUINO_off,"off"]],value:"on",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"arduino_get_port_number"},null,null],type:"arduino_toggle_led"},paramsKeyMap:{VALUE:0,OPERATOR:1},"class":"arduino_set",isNotFor:["arduino"],func:function(b,a){var c=a.getNumberValue("VALUE"),d=a.getField("OPERATOR");Entry.hw.setDigitalPortValue(c,"on"==d?255: -0);return a.callReturn()}},arduino_toggle_pwm:{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:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"arduino_toggle_pwm"},paramsKeyMap:{PORT:0,VALUE:1},"class":"arduino_set",isNotFor:["arduino"],func:function(b,a){var c=a.getNumberValue("PORT"),d=a.getNumberValue("VALUE"), -d=Math.round(d),d=Math.max(d,0),d=Math.min(d,255);Entry.hw.setDigitalPortValue(c,d);return a.callReturn()}},arduino_convert_scale:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number",id:"bl5e"}]},{type:"number", -params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"arduino_convert_scale"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2,VALUE4:3,VALUE5:4},"class":"arduino",isNotFor:["arduino"],func:function(b,a){var c=a.getNumberValue("VALUE1",a),d=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a),f=a.getNumberValue("VALUE4",a),g=a.getNumberValue("VALUE5",a);if(d>e)var h=d,d=e,e=h;f>g&&(h=f,f=g,g=h);c-=d;c*=(g-f)/(e-d);c+=f;c=Math.min(g,c);c=Math.max(f, -c);return Math.round(c)}},arduino_ext_get_analog_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["A0","0"],["A1","1"],["A2","2"],["A3","3"],["A4","4"],["A5","5"]],value:"0",fontSize:11}],events:{},def:{params:[null],type:"arduino_ext_get_analog_value"},paramsKeyMap:{PORT:0},"class":"ArduinoExtGet",isNotFor:["ArduinoExt"],func:function(b,a){var c=a.getField("PORT",a),d=Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.ANALOG), -e=Entry.hw.portData.TIME||0;Entry.ArduinoExt.BlockState[this.type]||(Entry.ArduinoExt.BlockState[this.type]={isStart:!1,stamp:0});var f=Entry.ArduinoExt.BlockState[this.type],g=Entry.hw.portData.ANALOG;if(f.isStart){if(e&&e===f.stamp||64Entry.hw.getAnalogPortValue(0)?1:0}},CODEino_get_light_status:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CODEino_string_14,"BRIGHT"],[Lang.Blocks.CODEino_string_15, -"DARK"]],value:"BRIGHT",fontSize:11}],events:{},def:{params:[null],type:"CODEino_get_light_status"},paramsKeyMap:{STATUS:0},"class":"CODEino",isNotFor:["CODEino"],func:function(b,a){return"DARK"==a.getField("STATUS",a)?800Entry.hw.getAnalogPortValue(1)?1:0}},CODEino_is_button_pressed:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CODEino_string_3,"4"],[Lang.Blocks.CODEino_string_4, -"17"],[Lang.Blocks.CODEino_string_5,"18"],[Lang.Blocks.CODEino_string_6,"19"],[Lang.Blocks.CODEino_string_7,"20"]],value:"4",fontSize:11}],events:{},def:{params:[null],type:"CODEino_is_button_pressed"},paramsKeyMap:{PORT:0},"class":"CODEino",isNotFor:["CODEino"],func:function(b,a){var c=a.getNumberField("PORT",a);return 14d?1:0;if("RIGHT"==c||"FRONT"==c)return 30d?1:0}},CODEino_get_accelerometer_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["X","3"],["Y","4"],["Z","5"]],value:"3",fontSize:11}],events:{},def:{params:[null],type:"CODEino_get_accelerometer_value"}, -paramsKeyMap:{PORT:0},"class":"CODEino",isNotFor:["CODEino"],func:function(b,a){var c=265,d=402,e=-90,f=90,g=Entry.hw.getAnalogPortValue(a.getField("PORT",a));if(c>d)var h=c,c=d,d=h;e>f&&(h=e,e=f,f=h);g=(f-e)/(d-c)*(g-c);g+=e;g=Math.min(f,g);g=Math.max(e,g);return Math.round(g)}},nemoino_get_named_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"%1 \uc13c\uc11c\uac12",params:[{type:"Dropdown",options:[["\uc18c\ub9ac","0"],["\ube5b","1"],["\uc2ac\ub77c\uc774\ub354", -"2"],["\uc800\ud56d-A","3"],["\uc800\ud56d-B","4"],["\uc800\ud56d-C","5"],["\uc800\ud56d-D","6"]],value:"0",fontSize:11}],events:{},def:{params:[null],type:"nemoino_get_named_sensor_value"},paramsKeyMap:{PORT:0},"class":"nemoino",isNotFor:["nemoino"],func:function(b,a){return Entry.hw.getAnalogPortValue(a.getField("PORT",a))}},nemoino_get_sound_status:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],template:"\uc18c\ub9ac\uc13c\uc11c %1",params:[{type:"Dropdown",options:[["\uc18c\ub9ac\ud07c", -"GREAT"],["\uc18c\ub9ac\uc791\uc74c","SMALL"]],value:"GREAT",fontSize:11}],events:{},def:{params:[null],type:"nemoino_get_sound_status"},paramsKeyMap:{STATUS:0},"class":"nemoino",isNotFor:["nemoino"],func:function(b,a){return"GREAT"==a.getField("STATUS",a)?600Entry.hw.getAnalogPortValue(0)?1:0}},nemoino_is_button_pressed:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],template:"\ubcf4\ub4dc\uc758 %1",params:[{type:"Dropdown",options:[["\ubc84\ud2bc\ub204\ub984", -"4"],["A\uc5f0\uacb0\ub428","17"],["B\uc5f0\uacb0\ub428","18"],["C\uc5f0\uacb0\ub428","19"],["D\uc5f0\uacb0\ub428","20"]],value:"4",fontSize:11}],events:{},def:{params:[null],type:"nemoino_is_button_pressed"},paramsKeyMap:{PORT:0},"class":"nemoino",isNotFor:["nemoino"],func:function(b,a){var c=a.getNumberField("PORT",a);return 14d?1:0;if("RIGHT"==c||"FRONT"==c)return 30d?1:0}},nemoino_get_accelerometer_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"3\ucd95 \uac00\uc18d\ub3c4\uc13c\uc11c %1 \ucd95\uc758 \uc13c\uc11c\uac12", -params:[{type:"Dropdown",options:[["X","3"],["Y","4"],["Z","5"]],value:"3",fontSize:11}],events:{},def:{params:[null],type:"nemoino_get_accelerometer_value"},paramsKeyMap:{PORT:0},"class":"nemoino",isNotFor:["nemoino"],func:function(b,a){var c=265,d=402,e=-90,f=90,g=Entry.hw.getAnalogPortValue(a.getField("PORT",a));if(c>d)var h=c,c=d,d=h;e>f&&(h=e,e=f,f=h);g=(f-e)/(d-c)*(g-c);g+=e;g=Math.min(f,g);g=Math.max(e,g);return Math.round(g)}},bitbrick_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field", -statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW,menuName:Entry.Bitbrick.sensorList}],events:{},def:{params:[null],type:"bitbrick_sensor_value"},paramsKeyMap:{PORT:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=a.getStringField("PORT");return Entry.hw.portData[c].value}},bitbrick_is_touch_pressed:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"DropdownDynamic",value:null, -fontSize:11,menuName:Entry.Bitbrick.touchList}],events:{},def:{params:[null],type:"bitbrick_is_touch_pressed"},paramsKeyMap:{PORT:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){return 0===Entry.hw.portData[a.getStringField("PORT")].value}},bitbrick_turn_off_color_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"bitbrick_turn_off_color_led",id:"i3je"},"class":"condition",isNotFor:["bitbrick"], -func:function(b,a){Entry.hw.sendQueue.LEDR=0;Entry.hw.sendQueue.LEDG=0;Entry.hw.sendQueue.LEDB=0;return a.callReturn()}},bitbrick_turn_on_color_led_by_rgb:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["255"]},{type:"text",params:["255"]},{type:"text",params:["255"]},null],type:"bitbrick_turn_on_color_led_by_rgb"}, -paramsKeyMap:{rValue:0,gValue:1,bValue:2},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=a.getNumberValue("rValue"),d=a.getNumberValue("gValue"),e=a.getNumberValue("bValue"),f=Entry.adjustValueWithMaxMin,g=Entry.hw.sendQueue;g.LEDR=f(c,0,255);g.LEDG=f(d,0,255);g.LEDB=f(e,0,255);return a.callReturn()}},bitbrick_turn_on_color_led_by_picker:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Color"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{}, -def:{params:[null],type:"bitbrick_turn_on_color_led_by_picker"},paramsKeyMap:{VALUE:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=a.getStringField("VALUE");Entry.hw.sendQueue.LEDR=parseInt(c.substr(1,2),16);Entry.hw.sendQueue.LEDG=parseInt(c.substr(3,2),16);Entry.hw.sendQueue.LEDB=parseInt(c.substr(5,2),16);return a.callReturn()}},bitbrick_turn_on_color_led_by_value:{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:["0"]},null],type:"bitbrick_turn_on_color_led_by_value"},paramsKeyMap:{VALUE:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=a.getNumberValue("VALUE"),d,e,f,c=c%200;67>c?(d=200-3*c,e=3*c,f=0):134>c?(c-=67,d=0,e=200-3*c,f=3*c):201>c&&(c-=134,d=3*c,e=0,f=200-3*c);Entry.hw.sendQueue.LEDR=d;Entry.hw.sendQueue.LEDG=e;Entry.hw.sendQueue.LEDB=f;return a.callReturn()}},bitbrick_buzzer:{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:"bitbrick_buzzer"},paramsKeyMap:{VALUE:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){if(a.isStart)return Entry.hw.sendQueue.buzzer=0,delete a.isStart,a.callReturn();var c=a.getNumberValue("VALUE");Entry.hw.sendQueue.buzzer=c;a.isStart=!0;return a}},bitbrick_turn_off_all_motors:{color:"#00979D",skeleton:"basic",statements:[], -params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"bitbrick_turn_off_all_motors"},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=Entry.hw.sendQueue,d=Entry.Bitbrick;d.servoList().map(function(a){c[a[1]]=0});d.dcList().map(function(a){c[a[1]]=128});return a.callReturn()}},bitbrick_dc_speed:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.dcList},{type:"Block", -accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"text",params:["60"]},null],type:"bitbrick_dc_speed"},paramsKeyMap:{PORT:0,VALUE:1},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=a.getNumberValue("VALUE"),c=Math.min(c,Entry.Bitbrick.dcMaxValue),c=Math.max(c,Entry.Bitbrick.dcMinValue);Entry.hw.sendQueue[a.getStringField("PORT")]=c+128;return a.callReturn()}},bitbrick_dc_direction_speed:{color:"#00979D",skeleton:"basic", -statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.dcList},{type:"Dropdown",options:[[Lang.Blocks.BITBRICK_dc_direction_cw,"CW"],[Lang.Blocks.BITBRICK_dc_direction_ccw,"CCW"]],value:"CW",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,{type:"text",params:["100"]},null],type:"bitbrick_dc_direction_speed"},paramsKeyMap:{PORT:0,DIRECTION:1,VALUE:2},"class":"condition",isNotFor:["bitbrick"], -func:function(b,a){var c="CW"===a.getStringField("DIRECTION"),d=a.getNumberValue("VALUE"),d=Math.min(d,Entry.Bitbrick.dcMaxValue),d=Math.max(d,0);Entry.hw.sendQueue[a.getStringField("PORT")]=c?d+128:128-d;return a.callReturn()}},bitbrick_servomotor_angle:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.servoList},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null, -{type:"text",params:["100"]},null],type:"bitbrick_servomotor_angle"},paramsKeyMap:{PORT:0,VALUE:1},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=Entry.Bitbrick.servoMaxValue-(a.getNumberValue("VALUE")+1),c=Math.min(c,Entry.Bitbrick.servoMaxValue),c=Math.max(c,Entry.Bitbrick.servoMinValue);Entry.hw.sendQueue[a.getStringField("PORT")]=c;return a.callReturn()}},bitbrick_convert_scale:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"DropdownDynamic", -value:null,fontSize:11,menuName:Entry.Bitbrick.sensorList},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"}],events:{},def:{params:[null,{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["-100"]},{type:"number",params:["100"]}],type:"bitbrick_convert_scale"},paramsKeyMap:{PORT:0,VALUE2:1,VALUE3:2,VALUE4:3,VALUE5:4},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=a.getNumberField("PORT"), -d=Entry.hw.portData[c].value,c=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a),f=a.getNumberValue("VALUE4",a),g=a.getNumberValue("VALUE5",a);if(f>g)var h=f,f=g,g=h;d-=c;d*=(g-f)/(e-c);d+=f;d=Math.min(g,d);d=Math.max(f,d);return Math.round(d)}},start_drawing:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"start_drawing"},"class":"brush_control",isNotFor:["textBox"],func:function(b,a){b.brush? -b.brush.stop=!1:Entry.setBasicBrush(b);Entry.stage.sortZorder();b.brush.moveTo(b.getX(),-1*b.getY());return a.callReturn()}},stop_drawing:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"stop_drawing"},"class":"brush_control",isNotFor:["textBox"],func:function(b,a){b.brush&&b.shape&&(b.brush.stop=!0);return a.callReturn()}},set_color:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Color"}, -{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"set_color"},paramsKeyMap:{VALUE:0},"class":"brush_color",isNotFor:["textBox"],func:function(b,a){var c=a.getField("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(c=Entry.hex2rgb(c),b.brush.rgb=c,b.brush.endStroke(),b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}},set_random_color:{color:"#FF9E20", -skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"set_random_color"},"class":"brush_color",isNotFor:["textBox"],func:function(b,a){b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);if(b.brush){var c=Entry.generateRgb();b.brush.rgb=c;b.brush.endStroke();b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")");b.brush.moveTo(b.getX(),-1*b.getY())}return a.callReturn()}},change_thickness:{color:"#FF9E20", -skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["1"]},null],type:"change_thickness"},paramsKeyMap:{VALUE:0},"class":"brush_thickness",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.thickness+=c,1>b.brush.thickness&&(b.brush.thickness=1),b.brush.setStrokeStyle(b.brush.thickness),b.brush.moveTo(b.getX(), --1*b.getY()));return a.callReturn()}},set_thickness:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["1"]},null],type:"set_thickness"},paramsKeyMap:{VALUE:0},"class":"brush_thickness",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.thickness=c,b.brush.setStrokeStyle(b.brush.thickness), -b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}},change_opacity:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_opacity"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);c=Entry.adjustValueWithMaxMin(b.brush.opacity+ -c,0,100);b.brush&&(b.brush.opacity=c,b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}},set_opacity:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["50"]},null],type:"set_opacity"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"], -func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}},brush_erase_all:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"brush_erase_all"}, -"class":"brush_clear",isNotFor:["textBox"],func:function(b,a){var c=b.brush;if(c){var d=c._stroke.style,e=c._strokeStyle.width;c.clear().setStrokeStyle(e).beginStroke(d);c.moveTo(b.getX(),-1*b.getY())}c=b.parent.getStampEntities();c.map(function(a){a.removeClone()});c=null;return a.callReturn()}},brush_stamp:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"brush_stamp"},"class":"stamp",isNotFor:["textBox"], -func:function(b,a){b.parent.addStampEntity(b);return a.callReturn()}},change_brush_transparency:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_brush_transparency"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop= -!0);c=Entry.adjustValueWithMaxMin(b.brush.opacity-c,0,100);b.brush&&(b.brush.opacity=c,b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}},set_brush_tranparency:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["50"]},null],type:"set_brush_tranparency"}, -paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+(1-b.brush.opacity/100)+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}},number:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"TextInput", -value:10}],events:{},def:{params:[]},paramsKeyMap:{NUM:0},func:function(b,a){return a.getField("NUM",a)},isPrimitive:!0},angle:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Angle"}],events:{},def:{params:[null],type:"angle"},paramsKeyMap:{ANGLE:0},func:function(b,a){return a.getNumberField("ANGLE")}},get_x_coordinate:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_x_coordinate,color:"#3D3D3D"}],events:{},def:{params:[null], -type:"get_x_coordinate"},"class":"calc",isNotFor:[],func:function(b,a){return b.getX()}},get_y_coordinate:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_y_coordinate,color:"#3D3D3D"}],events:{},def:{params:[null],type:"get_y_coordinate"},"class":"calc",isNotFor:[],func:function(b,a){return b.getY()}},get_angle:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_angle,color:"#3D3D3D"}], -events:{},def:{params:[null]},func:function(b,a){return parseFloat(b.getRotation().toFixed(1))}},get_rotation_direction:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CALC_rotation_value,"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,"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 e}},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,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_rand_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"number",params:["0"]},null,{type:"number",params:["10"]},null],type:"calc_rand"},paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3},"class":"calc",isNotFor:[],func:function(b, -a){var c=a.getStringValue("LEFTHAND",a),d=a.getStringValue("RIGHTHAND",a),e=Math.min(c,d),f=Math.max(c,d),c=Entry.isFloat(c);return Entry.isFloat(d)||c?(Math.random()*(f-e)+e).toFixed(2):Math.floor(Math.random()*(f-e+1)+e)}},get_date:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_date_1,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_get_date_year,"YEAR"],[Lang.Blocks.CALC_get_date_month,"MONTH"],[Lang.Blocks.CALC_get_date_day, -"DAY"],[Lang.Blocks.CALC_get_date_hour,"HOUR"],[Lang.Blocks.CALC_get_date_minute,"MINUTE"],[Lang.Blocks.CALC_get_date_second,"SECOND"]],value:"YEAR",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_get_date_2,color:"#3D3D3D"}],events:{},def:{params:[null,"YEAR",null],type:"get_date"},paramsKeyMap:{VALUE:1},"class":"calc_date",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d=new Date;return"YEAR"==c?d.getFullYear():"MONTH"==c?d.getMonth()+1:"DAY"== -c?d.getDate():"HOUR"==c?d.getHours():"MINUTE"==c?d.getMinutes():d.getSeconds()}},get_sound_duration:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_sound_duration_1,color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"sounds",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_get_sound_duration_2,color:"#3D3D3D"}],events:{},def:{params:[null,null,null],type:"get_sound_duration"},paramsKeyMap:{VALUE:1}, -"class":"calc_duration",isNotFor:[],func:function(b,a){for(var c=a.getField("VALUE",a),d=b.parent.sounds,e=0;ed||d>c.length-1)throw Error();return c[d]}},length_of_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_length_of_string_1, -color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_length_of_string_2,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.entry]},null],type:"length_of_string"},paramsKeyMap:{STRING:1},"class":"calc_string",isNotFor:[],func:function(b,a){return a.getStringValue("STRING",a).length}},substring:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_substring_1,color:"#3D3D3D"},{type:"Block",accept:"string"}, -{type:"Text",text:Lang.Blocks.CALC_substring_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_substring_3,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_substring_4,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"number",params:["2"]},null,{type:"number",params:["5"]},null],type:"substring"},paramsKeyMap:{STRING:1,START:3,END:5},"class":"calc_string",isNotFor:[],func:function(b, -a){var c=a.getStringValue("STRING",a),d=a.getNumberValue("START",a)-1,e=a.getNumberValue("END",a)-1,f=c.length-1;if(0>d||0>e||d>f||e>f)throw Error();return c.substring(Math.min(d,e),Math.max(d,e)+1)}},replace_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_replace_string_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_3, -color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_4,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"text",params:[Lang.Blocks.hello]},null,{type:"text",params:[Lang.Blocks.nice]},null],type:"replace_string"},paramsKeyMap:{STRING:1,OLD_WORD:3,NEW_WORD:5},"class":"calc_string",isNotFor:[],func:function(b,a){return a.getStringValue("STRING",a).replace(new RegExp(a.getStringValue("OLD_WORD",a),"gm"), -a.getStringValue("NEW_WORD",a))}},change_string_case:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_change_string_case_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_change_string_case_2,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_change_string_case_sub_1,"toUpperCase"],[Lang.Blocks.CALC_change_string_case_sub_2,"toLowerCase"]],value:"toUpperCase",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}, -{type:"Text",text:Lang.Blocks.CALC_change_string_case_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:["Hello Entry!"]},null,null,null],type:"change_string_case"},paramsKeyMap:{STRING:1,CASE:3},"class":"calc_string",isNotFor:[],func:function(b,a){return a.getStringValue("STRING",a)[a.getField("CASE",a)]()}},index_of_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_index_of_string_1,color:"#3D3D3D"},{type:"Block",accept:"string"}, -{type:"Text",text:Lang.Blocks.CALC_index_of_string_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_index_of_string_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"text",params:[Lang.Blocks.entry]},null],type:"index_of_string"},paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3},"class":"calc_string",isNotFor:[],func:function(b,a){var c=a.getStringValue("LEFTHAND",a),d=a.getStringValue("RIGHTHAND",a),c=c.indexOf(d);return-1< -c?c+1:0}},combine_something:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_combine_something_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.VARIABLE_combine_something_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.VARIABLE_combine_something_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.block_hi]},null,{type:"text",params:[Lang.Blocks.entry]}, -null],type:"combine_something"},paramsKeyMap:{VALUE1:1,VALUE2:3},"class":"calc_string",isNotFor:[],func:function(b,a){var c=a.getStringValue("VALUE1",a),d=a.getStringValue("VALUE2",a);return c+d}},get_sound_volume:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_sound_volume,color:"#3D3D3D"},{type:"Text",text:"",color:"#3D3D3D"}],events:{},def:{params:[null,null],type:"get_sound_volume"},"class":"calc",isNotFor:[""],func:function(b,a){return 100* -createjs.Sound.getVolume()}},quotient_and_mod:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_quotient_and_mod_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_quotient_and_mod_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_quotient_and_mod_3,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_quotient_and_mod_sub_1,"QUOTIENT"],[Lang.Blocks.CALC_quotient_and_mod_sub_2, -"MOD"]],value:"QUOTIENT",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}],events:{},def:{params:[null,{type:"text",params:["10"]},null,{type:"text",params:["10"]},null,null],type:"quotient_and_mod"},paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3,OPERATOR:5},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);if(isNaN(c)||isNaN(d))throw Error();return"QUOTIENT"==a.getField("OPERATOR",a)?Math.floor(c/d):c%d}},choose_project_timer_action:{color:"#FFD974", -skeleton:"basic",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_choose_project_timer_action_1,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_choose_project_timer_action_sub_1,"START"],[Lang.Blocks.CALC_choose_project_timer_action_sub_2,"STOP"],[Lang.Blocks.CALC_choose_project_timer_action_sub_3,"RESET"]],value:"START",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_choose_project_timer_action_2,color:"#3D3D3D"},{type:"Indicator",img:"block_icon/calc_01.png", -size:12}],events:{viewAdd:[function(){Entry.engine&&Entry.engine.showProjectTimer()}],dataDestroy:[function(b){Entry.engine&&Entry.engine.hideProjectTimer(b)}]},def:{params:[null,"START",null,null],type:"choose_project_timer_action"},paramsKeyMap:{ACTION:1},"class":"calc_timer",isNotFor:[],func:function(b,a){var c=a.getField("ACTION"),d=Entry.engine,e=d.projectTimer;"START"==c?e.isInit?e.isInit&&e.isPaused&&(e.pauseStart&&(e.pausedTime+=(new Date).getTime()-e.pauseStart),delete e.pauseStart,e.isPaused= -!1):d.startProjectTimer():"STOP"==c?e.isInit&&!e.isPaused&&(e.isPaused=!0,e.pauseStart=(new Date).getTime()):"RESET"==c&&e.isInit&&(e.setValue(0),e.start=(new Date).getTime(),e.pausedTime=0,delete e.pauseStart);return a.callReturn()}},wait_second:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},null],type:"wait_second"},paramsKeyMap:{SECOND:0},"class":"delay", -isNotFor:[],func:function(b,a){if(a.isStart){if(1==a.timeFlag)return a;delete a.timeFlag;delete a.isStart;Entry.engine.isContinue=!1;return a.callReturn()}a.isStart=!0;a.timeFlag=1;var c=a.getNumberValue("SECOND",a);setTimeout(function(){a.timeFlag=0},60/(Entry.FPS||60)*c*1E3);return a}},repeat_basic:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"number", -params:["10"]},null],type:"repeat_basic"},paramsKeyMap:{VALUE:0},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(b,a){var c;if(!a.isLooped){a.isLooped=!0;c=a.getNumberValue("VALUE",a);if(0>c)throw Error(Lang.Blocks.FLOW_repeat_basic_errorMsg);a.iterCount=Math.floor(c)}if(0==a.iterCount||0>a.iterCount)return delete a.isLooped,delete a.iterCount,a.callReturn();a.iterCount--;return a.getStatement("DO",a)}},repeat_inf:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}], -params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null],type:"repeat_inf"},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(b,a){a.isLooped=!0;return a.getStatement("DO")}},stop_repeat:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null],type:"stop_repeat"},"class":"repeat",isNotFor:[],func:function(b,a){return this.executor.breakLoop()}},wait_until_true:{color:"#498deb", -skeleton:"basic",statements:[],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"},null],type:"wait_until_true"},paramsKeyMap:{BOOL:0},"class":"wait",isNotFor:[],func:function(b,a){return a.getBooleanValue("BOOL",a)?a.callReturn():a}},_if:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"}, -null],type:"_if"},paramsKeyMap:{BOOL:0},statementsKeyMap:{STACK:0},"class":"condition",isNotFor:[],func:function(b,a){return a.isCondition?(delete a.isCondition,a.callReturn()):a.getBooleanValue("BOOL",a)?(a.isCondition=!0,a.getStatement("STACK",a)):a.callReturn()}},if_else:{color:"#498deb",skeleton:"basic_double_loop",statements:[{accept:"basic"},{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12},{type:"LineBreak"}],events:{},def:{params:[{type:"True"}, -null],type:"if_else"},paramsKeyMap:{BOOL:0},statementsKeyMap:{STACK_IF:0,STACK_ELSE:1},"class":"condition",isNotFor:[],func:function(b,a){if(a.isCondition)return delete a.isCondition,a.callReturn();var c=a.getBooleanValue("BOOL",a);a.isCondition=!0;return c?a.getStatement("STACK_IF",a):a.getStatement("STACK_ELSE",a)}},create_clone:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"clone",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator", -img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null,null],type:"create_clone"},paramsKeyMap:{VALUE:0},"class":"clone",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d=a.callReturn();"self"==c?b.parent.addCloneEntity(b.parent,b,null):Entry.container.getObject(c).addCloneEntity(b.parent,null,null);return d}},delete_clone:{color:"#498deb",skeleton:"basic_without_next",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null], -type:"delete_clone"},"class":"clone",isNotFor:[],func:function(b,a){if(!b.isClone)return a.callReturn();b.removeClone();return this.die()}},when_clone_start:{color:"#498deb",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_clone.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"when_clone_start"},"class":"clone",isNotFor:[],func:function(b,a){return a.callReturn()},event:"when_clone_start"},stop_run:{color:"#498deb",skeleton:"basic",statements:[], -params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null]},func:function(b,a){return Entry.engine.toggleStop()}},repeat_while_true:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Dropdown",options:[[Lang.Blocks.FLOW_repeat_while_true_until,"until"],[Lang.Blocks.FLOW_repeat_while_true_while,"while"]],value:"until",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator",img:"block_icon/flow_03.png", -size:12}],events:{},def:{params:[{type:"True"},null,null],type:"repeat_while_true"},paramsKeyMap:{BOOL:0,OPTION:1},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(b,a){var c=a.getBooleanValue("BOOL",a);"until"==a.getField("OPTION",a)&&(c=!c);return(a.isLooped=c)?a.getStatement("DO",a):a.callReturn()}},stop_object:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.FLOW_stop_object_all,"all"],[Lang.Blocks.FLOW_stop_object_this_object,"thisOnly"], -[Lang.Blocks.FLOW_stop_object_this_thread,"thisThread"],[Lang.Blocks.FLOW_stop_object_other_thread,"otherThread"]],value:"all",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null,null],type:"stop_object"},paramsKeyMap:{TARGET:0},"class":"terminate",isNotFor:[],func:function(b,a){var c=a.getField("TARGET",a),d=Entry.container;switch(c){case "all":return d.clearRunningState(),this.die();case "thisOnly":return b.parent.script.clearExecutorsByEntity(b), -this.die();case "thisObject":return b.parent.script.clearExecutors(),this.die();case "thisThread":return this.die();case "otherThread":for(var c=this.executor,d=b.parent.script,e=d.executors,f=0;fa.count?(50>d.leftFloor&&50>d.rightFloor?a.count++:a.count=0,d=d.leftFloor-d.rightFloor,c.leftWheel=45+.25*d,c.rightWheel=45-.25*d):(a.count=0,a.boardState=2);break;case 2:d=d.leftFloor-d.rightFloor;c.leftWheel=45+.25*d;c.rightWheel= -45-.25*d;a.boardState=3;var e=setTimeout(function(){a.boardState=4;Entry.Hamster.removeTimeout(e)},250);Entry.Hamster.timeouts.push(e);break;case 3:d=d.leftFloor-d.rightFloor;c.leftWheel=45+.25*d;c.rightWheel=45-.25*d;break;case 4:c.leftWheel=0,c.rightWheel=0,a.boardState=0,a.isMoving=!1}return a}delete a.isStart;delete a.isMoving;delete a.count;delete a.boardState;Entry.engine.isContinue=!1;c.leftWheel=0;c.rightWheel=0;return a.callReturn()}a.isStart=!0;a.isMoving=!0;a.count=0;a.boardState=1;c.leftWheel= -45;c.rightWheel=45;Entry.Hamster.setLineTracerMode(c,0);return a}},hamster_turn_once:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null],type:"hamster_turn_once"},paramsKeyMap:{DIRECTION:0},"class":"hamster_board",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=Entry.hw.portData; -if(a.isStart){if(a.isMoving){if(a.isLeft)switch(a.boardState){case 1:2>a.count?50d.leftFloor&&(a.boardState=3);break;case 3:2>a.count?20>d.leftFloor&&a.count++:(a.count=0,a.boardState=4);break;case 4:50a.count?50d.rightFloor&&(a.boardState=3);break;case 3:2>a.count?20>d.rightFloor&&a.count++:(a.count=0,a.boardState=4);break;case 4:50Entry.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",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(-1f)throw Error("object is not available for current scene");switch(d){case "FRONT":c=0;break;case "FORWARD":c=Math.max(0,f-1);break;case "BACKWARD":c=Math.min(e,f+1);break;case "BACK":c=e}Entry.container.moveElementByBlock(f,c);return a.callReturn()}},move_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:["10"]},null],type:"move_direction"},paramsKeyMap:{VALUE:0},"class":"walk",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(b.getX()+c*Math.cos((b.getRotation()+b.getDirection()-90)/180*Math.PI));b.setY(b.getY()-c*Math.sin((b.getRotation()+b.getDirection()-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},move_x:{color:"#A751E3",skeleton:"basic", -statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"move_x"},paramsKeyMap:{VALUE:0},"class":"move_relative",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(b.getX()+c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},move_y:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator", -img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"move_y"},paramsKeyMap:{VALUE:0},"class":"move_relative",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setY(b.getY()+c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},locate_xy_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator", -img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"locate_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_absolute",isNotFor:[],func:function(b,a){function c(){var c=a.x-b.getX(),d=a.y-b.getY(),c=c/a.frameCount,d=d/a.frameCount;b.setX(b.getX()+c);b.setY(b.getY()+d);a.frameCount--;b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY())}if(!a.isStart){var d;d=a.getNumberValue("VALUE1", -a);a.isStart=!0;a.frameCount=Math.max(Math.floor(d*Entry.FPS),1);a.x=a.getNumberValue("VALUE2",a);a.y=a.getNumberValue("VALUE3",a);1==a.frameCount&&c()}if(0!=a.frameCount)return c(),a;delete a.isStart;delete a.frameCount;return a.callReturn()}},rotate_by_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"rotate_by_angle"},paramsKeyMap:{VALUE:0}, -"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(b.getRotation()+c);return a.callReturn()}},rotate_by_angle_dropdown:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["45","45"],["90","90"],["135","135"],["180","180"]],value:"45",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:["45",null],type:"rotate_by_angle_dropdown"},paramsKeyMap:{VALUE:0},"class":"ebs",isNotFor:[],func:function(b, -a){var c=a.getField("VALUE",a);b.setRotation(b.getRotation()+Number(c));return a.callReturn()}},see_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"see_angle"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}},see_direction:{color:"#A751E3", -skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"sprites",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{VALUE:0},func:function(b,a){var c=a.getField("VALUE",a),d=Entry.container.getEntity(c),c=d.getX()-b.getX(),d=d.getY()-b.getY();0<=c?b.setRotation(Math.atan(d/c)/Math.PI*180+90):b.setRotation(Math.atan(d/c)/Math.PI*180+270);return a.callReturn()}},locate_xy:{color:"#A751E3",skeleton:"basic", -statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["0"]},{type:"number",params:["0"]},null],type:"locate_xy"},paramsKeyMap:{VALUE1:0,VALUE2:1},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE1",a),d=a.getNumberValue("VALUE2",a);b.setX(c);b.setY(d);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}}, -locate_x:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_x"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},locate_y:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block", -accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_y"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setY(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},locate:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING}, -{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"locate"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d;"mouse"==c?(c=Entry.stage.mouseCoordinate.x,d=Entry.stage.mouseCoordinate.y):(d=Entry.container.getEntity(c),c=d.getX(),d=d.getY());b.setX(Number(c));b.setY(Number(d));b.brush&&!b.brush.stop&&b.brush.lineTo(c,-1*d);return a.callReturn()}},move_xy_time:{color:"#A751E3",skeleton:"basic", -statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"move_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_relative",isNotFor:[],func:function(b,a){function c(){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())}if(!a.isStart){var d;d=a.getNumberValue("VALUE1",a);var e=a.getNumberValue("VALUE2",a),f=a.getNumberValue("VALUE3",a);a.isStart=!0;a.frameCount=Math.max(Math.floor(d*Entry.FPS),1);a.dX=e/a.frameCount;a.dY=f/a.frameCount;1==a.frameCount&&c()}if(0!=a.frameCount)return c(),a;delete a.isStart;delete a.frameCount;return a.callReturn()}},rotate_by_angle_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Angle"},{type:"Indicator", -img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},null,null],type:"rotate_by_angle_time"},paramsKeyMap:{VALUE:1},"class":"rotate",isNotFor:[],func:function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE",a);var d=a.getNumberField("VALUE",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dAngle=d/a.frameCount}if(0!=a.frameCount)return b.setRotation(b.getRotation()+a.dAngle),a.frameCount--,a;delete a.isStart;delete a.frameCount;return a.callReturn()}}, -bounce_wall:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null],type:"bounce_wall"},"class":"walk",isNotFor:[],func:function(b,a){var c=b.parent.getRotateMethod(),d="free"==c?(b.getRotation()+b.getDirection()).mod(360):b.getDirection(),e=Entry.Utils.COLLISION.NONE;if(90>d&&0<=d||360>d&&270<=d){var e=b.collision==Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,b.object,0,!1);!f&&e&& -(b.collision=Entry.Utils.COLLISION.NONE);f&&e&&(f=!1);f?("free"==c?b.setRotation(-b.getRotation()-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&&e&&(f=!1),f&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN))}else 270> -d&&90<=d&&(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&&e&&(f=!1),f?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN):(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)));360>d&&180<=d?(e=b.collision==Entry.Utils.COLLISION.LEFT,d=ndgmr.checkPixelCollision(Entry.stage.wall.left,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.LEFT):(e=b.collision==Entry.Utils.COLLISION.RIGHT, -d=ndgmr.checkPixelCollision(Entry.stage.wall.right,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.RIGHT))):180>d&&0<=d&&(e=b.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?b.setRotation(-b.getRotation()- -2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.RIGHT):(e=b.collision==Entry.Utils.COLLISION.LEFT,d=ndgmr.checkPixelCollision(Entry.stage.wall.left,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.LEFT)));return a.callReturn()}},flip_arrow_horizontal:{color:"#A751E3",skeleton:"basic",statements:[], -params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null]},func:function(b,a){b.setDirection(b.getDirection()+180);return a.callReturn()}},flip_arrow_vertical:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null]},func:function(b,a){b.setDirection(b.getDirection()+180);return a.callReturn()}},see_angle_object:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic", -value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"see_angle_object"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d=b.getX(),e=b.getY();if(b.parent.id==c)return a.callReturn();"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",size:12}],events:{},def:{params:[{type:"angle"},null],type:"rotate_absolute"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute", -isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c);return a.callReturn()}},rotate_relative:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"rotate_relative"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c+b.getRotation());return a.callReturn()}},direction_absolute:{color:"#A751E3", -skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"direction_absolute"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}},direction_relative:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png", -size:12}],events:{},def:{params:[{type:"angle"},null],type:"direction_relative"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c+b.getDirection());return a.callReturn()}},move_to_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},{type:"number",params:["10"]}, -null],type:"move_to_angle"},paramsKeyMap:{ANGLE:0,VALUE:1},"class":"move_rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a),d=a.getNumberValue("ANGLE",a);b.setX(b.getX()+c*Math.cos((d-90)/180*Math.PI));b.setY(b.getY()-c*Math.sin((d-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},rotate_by_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator", -img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"angle"},null],type:"rotate_by_time"},paramsKeyMap:{VALUE:0,ANGLE:1},"class":"rotate",isNotFor:[],func:function(b,a){function c(){b.setRotation(b.getRotation()+a.dAngle);a.frameCount--}if(!a.isStart){var d;d=a.getNumberValue("VALUE",a);var e=a.getNumberValue("ANGLE",a);a.isStart=!0;a.frameCount=Math.max(Math.floor(d*Entry.FPS),1);a.dAngle=e/a.frameCount;1==a.frameCount&&c()}if(0!=a.frameCount)return c(), -a;delete a.isStart;delete a.frameCount;return a.callReturn()}},direction_relative_duration:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"text",params:["2"]},{type:"angle"},null],type:"direction_relative_duration"},paramsKeyMap:{DURATION:0,AMOUNT:1},"class":"rotate",isNotFor:[],func:function(b,a){function c(){b.setDirection(b.getDirection()+ -a.dDirection);a.frameCount--}if(!a.isStart){var d;d=a.getNumberValue("DURATION",a);var e=a.getNumberValue("AMOUNT",a);a.isStart=!0;a.frameCount=Math.max(Math.floor(d*Entry.FPS),1);a.dDirection=e/a.frameCount;1==a.frameCount&&c()}if(0!=a.frameCount)return c(),a;delete a.isStart;delete a.frameCount;delete a.dDirection;return a.callReturn()}},neobot_sensor_value:{color:"#00979D",skeleton:"basic_string_field",fontColor:"#fff",statements:[],template:"%1 \uac12",params:[{type:"Dropdown",options:[["1\ubc88 \ud3ec\ud2b8", -"IN1"],["2\ubc88 \ud3ec\ud2b8","IN2"],["3\ubc88 \ud3ec\ud2b8","IN3"],["\ub9ac\ubaa8\ucee8","IR"],["\ubc30\ud130\ub9ac","BAT"]],value:"IN1",fontSize:11}],events:{},def:{params:[null],type:"neobot_sensor_value"},paramsKeyMap:{PORT:0},"class":"neobot_value",isNotFor:["neobot"],func:function(b,a){var c=a.getStringField("PORT");return Entry.hw.portData[c]}},neobot_sensor_convert_scale:{color:"#00979D",skeleton:"basic_string_field",fontColor:"#fff",statements:[],template:"%1 \uac12\uc758 \ubc94\uc704\ub97c %2 ~ %3 \uc5d0\uc11c %4 ~ %5 (\uc73c)\ub85c \ubcc0\ud658", -params:[{type:"Dropdown",options:[["1\ubc88 \ud3ec\ud2b8","IN1"],["2\ubc88 \ud3ec\ud2b8","IN2"],["3\ubc88 \ud3ec\ud2b8","IN3"],["\ub9ac\ubaa8\ucee8","IR"],["\ubc30\ud130\ub9ac","BAT"]],value:"IN1",fontSize:11},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"}],events:{},def:{params:[null,{type:"number",params:["0"]},{type:"number",params:["255"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"neobot_sensor_convert_scale"}, -paramsKeyMap:{PORT:0,OMIN:1,OMAX:2,MIN:3,MAX:4},"class":"neobot_value",isNotFor:["neobot"],func:function(b,a){var c=a.getStringField("PORT"),c=Entry.hw.portData[c],d=a.getNumberValue("OMIN",a),e=a.getNumberValue("OMAX",a),f=a.getNumberValue("MIN",a),g=a.getNumberValue("MAX",a);if(d>e)var h=d,d=e,e=h;f>g&&(h=f,f=g,g=h);c=(g-f)/(e-d)*(c-d);c+=f;c=Math.min(g,c);c=Math.max(f,c);return Math.round(c)}},neobot_left_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc67c\ucabd \ubaa8\ud130\ub97c %1 %2 \uc758 \uc18d\ub3c4\ub85c \ud68c\uc804 %3", -params:[{type:"Dropdown",options:[["\uc55e\uc73c\ub85c","16"],["\ub4a4\ub85c","32"]],value:"16",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{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"],["14","14"],["15","15"]],value:"0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,"15", -null],type:"neobot_left_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){var c=a.getNumberField("SPEED"),d=a.getNumberField("DIRECTION");Entry.hw.sendQueue.DCL=c+d;return a.callReturn()}},neobot_stop_left_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc67c\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_left_motor"}, -"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){Entry.hw.sendQueue.DCL=0;return a.callReturn()}},neobot_right_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubaa8\ud130\ub97c %1 %2 \uc758 \uc18d\ub3c4\ub85c \ud68c\uc804 %3",params:[{type:"Dropdown",options:[["\uc55e\uc73c\ub85c","16"],["\ub4a4\ub85c","32"]],value:"16",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{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"],["14","14"],["15","15"]],value:"0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,"15",null],type:"neobot_right_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){var c=a.getNumberField("SPEED"),d=a.getNumberField("DIRECTION");Entry.hw.sendQueue.DCR=c+d;return a.callReturn()}}, -neobot_stop_right_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_right_motor"},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){Entry.hw.sendQueue.DCR=0;return a.callReturn()}},neobot_all_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc591\ucabd \ubaa8\ud130\ub97c %1 %2\uc758 \uc18d\ub3c4\ub85c %3\ucd08 \ub3d9\uc548 \ud68c\uc804 %4", -params:[{type:"Dropdown",options:[["\uc55e\uc73c\ub85c","1"],["\ub4a4\ub85c","2"],["\uc81c\uc790\ub9ac\uc5d0\uc11c \uc67c\ucabd \ub3cc\uae30","3"],["\uc81c\uc790\ub9ac\uc5d0\uc11c \uc624\ub978\ucabd \ub3cc\uae30","4"],["\uc67c\ucabd\uc73c\ub85c \ub3cc\uae30","5"],["\uc624\ub978\ucabd\uc73c\ub85c \ub3cc\uae30","6"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{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"],["14","14"],["15","15"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:["1","15",{type:"number",params:["0"]}],type:"neobot_all_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1,DURATION:2},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){if(a.isStart){if(1==a.timeFlag)return a;delete a.timeFlag;delete a.isStart;Entry.hw.sendQueue.DCL= -0;Entry.hw.sendQueue.DCR=0;Entry.engine.isContinue=!1;return a.callReturn()}var c=a.getNumberField("SPEED"),d=a.getNumberField("DIRECTION"),e=a.getNumberValue("DURATION");0>e&&(e=0);switch(d){case 1:Entry.hw.sendQueue.DCL=16+c;Entry.hw.sendQueue.DCR=16+c;break;case 2:Entry.hw.sendQueue.DCL=32+c;Entry.hw.sendQueue.DCR=32+c;break;case 3:Entry.hw.sendQueue.DCL=32+c;Entry.hw.sendQueue.DCR=16+c;break;case 4:Entry.hw.sendQueue.DCL=16+c;Entry.hw.sendQueue.DCR=32+c;break;case 5:Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR= -16+c;break;case 6:Entry.hw.sendQueue.DCL=16+c,Entry.hw.sendQueue.DCR=0}if(0===e)return a.callReturn();a.isStart=!0;a.timeFlag=1;setTimeout(function(){a.timeFlag=0},1E3*e);return a}},neobot_stop_all_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc591\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_all_motor"},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){Entry.hw.sendQueue.DCL= -0;Entry.hw.sendQueue.DCR=0;return a.callReturn()}},neobot_set_servo:{color:"#00979D",skeleton:"basic",statements:[],template:"%1 \ud3ec\ud2b8\uc758 \uc11c\ubcf4\ubaa8\ud130\ub97c %2 \ub3c4 \uc774\ub3d9 %3",params:[{type:"Dropdown",options:[["OUT1","1"],["OUT2","2"],["OUT3","3"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"neobot_set_servo"},paramsKeyMap:{PORT:0, -DEGREE:1},"class":"neobot_output",isNotFor:["neobot"],func:function(b,a){var c=a.getNumberField("PORT"),d=a.getNumberValue("DEGREE");0>d?d=0:180d?d=0:255c.count)throw c.count++, -new Entry.Utils.AsyncError;c.isStart=!1;d=Entry.hw.portData[c.data_default_address];c.data_default_address=void 0;return d}},robotis_openCM70_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.robotis_cm_sound_detected,"CM_SOUND_DETECTED"],[Lang.Blocks.robotis_cm_sound_detecting,"CM_SOUND_DETECTING"],[Lang.Blocks.robotis_cm_user_button,"CM_USER_BUTTON"]],value:"CM_SOUND_DETECTED",fontSize:11}],events:{},def:{params:[null], -type:"robotis_openCM70_sensor_value"},paramsKeyMap:{SENSOR:0},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(b,a){var c=a.executor.scope;if(!c.isStart){c.isStart=!0;c.count=0;var d=Entry.Robotis_openCM70.INSTRUCTION.READ,e=0,f=0,g=0,h=0,k=a.getStringField("SENSOR");"CM_SOUND_DETECTED"==k?(g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1]): -"CM_SOUND_DETECTING"==k?(g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1]):"CM_USER_BUTTON"==k&&(g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1]); -g+=0*h;Entry.Robotis_carCont.setRobotisData([[d,e,f,0,h]]);Entry.Robotis_carCont.update();c.data_default_address=g;throw new Entry.Utils.AsyncError;}if(2>c.count)throw c.count++,new Entry.Utils.AsyncError;c.isStart=!1;d=Entry.hw.portData[c.data_default_address];c.data_default_address=void 0;return d}},robotis_openCM70_aux_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["3","PORT_3"],["4","PORT_4"],["5","PORT_5"],["6","PORT_6"]], -value:"PORT_3",fontSize:11},{type:"Dropdown",options:[[Lang.Blocks.robotis_aux_servo_position,"AUX_SERVO_POSITION"],[Lang.Blocks.robotis_aux_ir,"AUX_IR"],[Lang.Blocks.robotis_aux_touch,"AUX_TOUCH"],[Lang.Blocks.robotis_aux_brightness,"AUX_BRIGHTNESS"],[Lang.Blocks.robotis_aux_hydro_themo_humidity,"AUX_HYDRO_THEMO_HUMIDITY"],[Lang.Blocks.robotis_aux_hydro_themo_temper,"AUX_HYDRO_THEMO_TEMPER"],[Lang.Blocks.robotis_aux_temperature,"AUX_TEMPERATURE"],[Lang.Blocks.robotis_aux_ultrasonic,"AUX_ULTRASONIC"], -[Lang.Blocks.robotis_aux_magnetic,"AUX_MAGNETIC"],[Lang.Blocks.robotis_aux_motion_detection,"AUX_MOTION_DETECTION"],[Lang.Blocks.robotis_aux_color,"AUX_COLOR"],[Lang.Blocks.robotis_aux_custom,"AUX_CUSTOM"]],value:"AUX_SERVO_POSITION",fontSize:11}],events:{},def:{params:[null,null],type:"robotis_openCM70_aux_sensor_value"},paramsKeyMap:{PORT:0,SENSOR:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(b,a){var c=a.executor.scope;if(!c.isStart){c.isStart=!0;c.count=0;var d= -Entry.Robotis_openCM70.INSTRUCTION.READ,e=0,f=0,g=0,h=0,k=a.getStringField("PORT"),l=a.getStringField("SENSOR"),m=0;"PORT_3"==k?m=2:"PORT_4"==k?m=3:"PORT_5"==k?m=4:"PORT_6"==k&&(m=5);"AUX_SERVO_POSITION"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1]):"AUX_IR"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0], -h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1]):"AUX_TOUCH"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1]):"AUX_TEMPERATURE"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1], -e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1]):"AUX_BRIGHTNESS"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1]):"AUX_HYDRO_THEMO_HUMIDITY"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1], -e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1]):"AUX_HYDRO_THEMO_TEMPER"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1]):"AUX_ULTRASONIC"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0], -h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1]):"AUX_MAGNETIC"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1]):"AUX_MOTION_DETECTION"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0], -h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1]):"AUX_COLOR"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1]):"AUX_CUSTOM"==l&&(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1], -e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1]);g+=m*h;0!=m&&(f=6*h);Entry.Robotis_carCont.setRobotisData([[d,e,f,0,h]]);Entry.Robotis_carCont.update();c.data_default_address=g;console.log(g);throw new Entry.Utils.AsyncError;}if(2>c.count)throw c.count++,new Entry.Utils.AsyncError;c.isStart=!1;d=Entry.hw.portData[c.data_default_address];c.data_default_address=void 0;return d}},robotis_openCM70_cm_buzzer_index:{color:"#00979D",skeleton:"basic", -statements:[],params:[{type:"Dropdown",options:[[Lang.General.note_a+"(0)","0"],[Lang.General.note_a+"#(1)","1"],[Lang.General.note_b+"(2)","2"],[Lang.General.note_c+"(3)","3"],[Lang.General.note_c+"#(4)","4"],[Lang.General.note_d+"(5)","5"],[Lang.General.note_d+"#(6)","6"],[Lang.General.note_e+"(7)","7"],[Lang.General.note_f+"(8)","8"],[Lang.General.note_f+"#(9)","9"],[Lang.General.note_g+"(10)","10"],[Lang.General.note_g+"#(11)","11"],[Lang.General.note_a+"(12)","12"],[Lang.General.note_a+"#(13)", -"13"],[Lang.General.note_b+"(14)","14"],[Lang.General.note_c+"(15)","15"],[Lang.General.note_c+"#(16)","16"],[Lang.General.note_d+"(17)","17"],[Lang.General.note_d+"#(18)","18"],[Lang.General.note_e+"(19)","19"],[Lang.General.note_f+"(20)","20"],[Lang.General.note_f+"#(21)","21"],[Lang.General.note_g+"(22)","22"],[Lang.General.note_g+"#(23)","23"],[Lang.General.note_a+"(24)","24"],[Lang.General.note_a+"#(25)","25"],[Lang.General.note_b+"(26)","26"],[Lang.General.note_c+"(27)","27"],[Lang.General.note_c+ -"#(28)","28"],[Lang.General.note_d+"(29)","29"],[Lang.General.note_d+"#(30)","30"],[Lang.General.note_e+"(31)","31"],[Lang.General.note_f+"(32)","32"],[Lang.General.note_f+"#(33)","33"],[Lang.General.note_g+"(34)","34"],[Lang.General.note_g+"#(35)","35"],[Lang.General.note_a+"(36)","36"],[Lang.General.note_a+"#(37)","37"],[Lang.General.note_b+"(38)","38"],[Lang.General.note_c+"(39)","39"],[Lang.General.note_c+"#(40)","40"],[Lang.General.note_d+"(41)","41"],[Lang.General.note_d+"#(42)","42"],[Lang.General.note_e+ -"(43)","43"],[Lang.General.note_f+"(44)","44"],[Lang.General.note_f+"#(45)","45"],[Lang.General.note_g+"(46)","46"],[Lang.General.note_g+"#(47)","47"],[Lang.General.note_a+"(48)","48"],[Lang.General.note_a+"#(49)","49"],[Lang.General.note_b+"(50)","50"],[Lang.General.note_c+"(51)","51"]],value:"0",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["1"]},null],type:"robotis_openCM70_cm_buzzer_index"}, -paramsKeyMap:{CM_BUZZER_INDEX:0,CM_BUZZER_TIME:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(b,a){var c=a.getField("CM_BUZZER_INDEX",a),d=a.getNumberValue("CM_BUZZER_TIME",a),e=Entry.Robotis_openCM70.INSTRUCTION.WRITE,f=0,g=0,h=0,k=0,l=0,f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[1],h=parseInt(10*d);50d&&(d=0);return Entry.Robotis_carCont.postCallReturn(a,[[e,f+(c-1)*g,g,d]],Entry.Robotis_openCM70.delay)}},robotis_openCM70_aux_led_module:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.robotis_common_port_3,"3"],[Lang.Blocks.robotis_common_port_4,"4"],[Lang.Blocks.robotis_common_port_5,"5"],[Lang.Blocks.robotis_common_port_6,"6"]],value:"3",fontSize:11},{type:"Dropdown",options:[[Lang.Blocks.robotis_cm_led_both+Lang.Blocks.robotis_common_off, -"0"],[Lang.Blocks.robotis_cm_led_right+Lang.Blocks.robotis_common_on,"1"],[Lang.Blocks.robotis_cm_led_left+Lang.Blocks.robotis_common_on,"2"],[Lang.Blocks.robotis_cm_led_both+Lang.Blocks.robotis_common_on,"3"]],value:"0",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"robotis_openCM70_aux_led_module"},paramsKeyMap:{PORT:0,LED_MODULE:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(b,a){var c=a.getField("PORT", -a),d=a.getField("LED_MODULE",a),e=Entry.Robotis_openCM70.INSTRUCTION.WRITE,f=0,g=0,f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[1];return Entry.Robotis_carCont.postCallReturn(a,[[e,f+(c-1)*g,g,d]],Entry.Robotis_openCM70.delay)}},robotis_openCM70_aux_custom:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.robotis_common_port_3,"3"],[Lang.Blocks.robotis_common_port_4,"4"],[Lang.Blocks.robotis_common_port_5, -"5"],[Lang.Blocks.robotis_common_port_6,"6"]],value:"3",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["0"]},null],type:"robotis_openCM70_aux_custom"},paramsKeyMap:{PORT:0,VALUE:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(b,a){var c=a.getField("PORT",a),d=a.getNumberValue("VALUE"),e=Entry.Robotis_openCM70.INSTRUCTION.WRITE,f=0,g=0,f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0], -g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1];return Entry.Robotis_carCont.postCallReturn(a,[[e,f+(c-1)*g,g,d]],Entry.Robotis_openCM70.delay)}},robotis_openCM70_cm_custom:{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:"number",params:["0"]},{type:"number",params:["0"]},null],type:"robotis_openCM70_cm_custom"},paramsKeyMap:{ADDRESS:0, -VALUE:1},"class":"robotis_openCM70_custom",isNotFor:["robotis_openCM70"],func:function(b,a){var c=Entry.Robotis_openCM70.INSTRUCTION.WRITE,d=0,e=0,d=a.getNumberValue("ADDRESS"),e=a.getNumberValue("VALUE");return Entry.Robotis_carCont.postCallReturn(a,[[c,d,65535c&&(c=0);createjs.Sound.setVolume(c);return a.callReturn()}},sound_volume_set:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"sound_volume_set"},paramsKeyMap:{VALUE:0},"class":"sound_volume",isNotFor:[],func:function(b,a){var c= -a.getNumberValue("VALUE",a)/100;1c&&(c=0);createjs.Sound.setVolume(c);return a.callReturn()}},sound_silent_all:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[null],type:"sound_silent_all"},"class":"sound_stop",isNotFor:[],func:function(b,a){createjs.Sound.stop();return a.callReturn()}},get_sounds:{color:"#A4D01D",skeleton:"basic_string_field",statements:[],params:[{type:"DropdownDynamic",value:null, -menuName:"sounds",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_SOUNDS}],events:{},def:{params:[null],type:"get_sounds"},paramsKeyMap:{VALUE:0},func:function(b,a){return a.getStringField("VALUE")}},sound_something_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},null],type:"sound_something_with_block"},paramsKeyMap:{VALUE:0},"class":"sound_play",isNotFor:[], -func:function(b,a){var c=a.getStringValue("VALUE",a);(c=b.parent.getSound(c))&&createjs.Sound.play(c.id);return a.callReturn()}},sound_something_second_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds",id:"95dw"},{type:"number",params:["1"]},null],type:"sound_something_second_with_block"},paramsKeyMap:{VALUE:0,SECOND:1}, -"class":"sound_play",isNotFor:[],func:function(b,a){var c=a.getStringValue("VALUE",a),d=a.getNumberValue("SECOND",a);(c=b.parent.getSound(c))&&createjs.Sound.play(c.id,{startTime:0,duration:1E3*d});return a.callReturn()}},sound_something_wait_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},null],type:"sound_something_wait_with_block"},paramsKeyMap:{VALUE:0}, -"class":"sound_wait",isNotFor:[],func:function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.playState;delete a.isPlay;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(c=b.parent.getSound(c))createjs.Sound.play(c.id),setTimeout(function(){a.playState=0},1E3*c.duration);return a}},sound_something_second_wait_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png", -size:12}],events:{},def:{params:[{type:"get_sounds"},{type:"number",params:["1"]},null],type:"sound_something_second_wait_with_block"},paramsKeyMap:{VALUE:0,SECOND:1},"class":"sound_wait",isNotFor:[],func:function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.isPlay;delete a.playState;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(c=b.parent.getSound(c)){var d=createjs.Sound.play(c.id),c=a.getNumberValue("SECOND",a);setTimeout(function(){d.stop();a.playState= -0},1E3*c);d.addEventListener("complete",function(a){})}return a}},sound_from_to:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},{type:"text",params:["1"]},{type:"text",params:["10"]},null],type:"sound_from_to"},paramsKeyMap:{VALUE:0,START:1,END:2},"class":"sound_play",isNotFor:[],func:function(b,a){var c= -a.getStringValue("VALUE",a);if(c=b.parent.getSound(c)){var d=1E3*a.getNumberValue("START",a),e=1E3*a.getNumberValue("END",a);createjs.Sound.play(c.id,{startTime:Math.min(d,e),duration:Math.max(d,e)-Math.min(d,e)})}return a.callReturn()}},sound_from_to_and_wait:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"}, -{type:"text",params:["1"]},{type:"text",params:["10"]},null],type:"sound_from_to_and_wait"},paramsKeyMap:{VALUE:0,START:1,END:2},"class":"sound_wait",isNotFor:[],func:function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.isPlay;delete a.playState;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(c=b.parent.getSound(c)){var d=1E3*a.getNumberValue("START",a),e=1E3*a.getNumberValue("END",a),f=Math.min(d,e),d=Math.max(d,e)-f;createjs.Sound.play(c.id,{startTime:f, -duration:d});setTimeout(function(){a.playState=0},d)}return a}},when_run_button_click:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_play.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"when_run_button_click"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"start"},press_some_key:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_keyboard.png", -size:17,position:{x:0,y:-2}},{type:"Dropdown",options:[["q","81"],["w","87"],["e","69"],["r","82"],["a","65"],["s","83"],["d","68"],["\uc704\ucabd \ud654\uc0b4\ud45c","38"],["\uc544\ub798\ucabd \ud654\uc0b4\ud45c","40"],["\uc67c\ucabd \ud654\uc0b4\ud45c","37"],["\uc624\ub978\ucabd \ud654\uc0b4\ud45c","39"],["\uc5d4\ud130","13"],["\uc2a4\ud398\uc774\uc2a4","32"]],value:"81",fontSize:11},{type:"Indicator",img:"block_icon/start_03.png",size:12}],events:{},def:{params:[null,null,null]},paramsKeyMap:{VALUE:1}, -func:function(b,a){return a.callReturn()}},when_some_key_pressed:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_keyboard.png",size:17,position:{x:0,y:-2}},{type:"Keyboard",value:"81"}],events:{},def:{params:[null,"81"],type:"when_some_key_pressed"},paramsKeyMap:{VALUE:1},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"keyPress"},mouse_clicked:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator", -img:"block_icon/start_icon_mouse.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"mouse_clicked"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"mouse_clicked"},mouse_click_cancled:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_mouse.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"mouse_click_cancled"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()}, -event:"mouse_click_cancled"},when_object_click:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_mouse.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"when_object_click"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"when_object_click"},when_object_click_canceled:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_mouse.png",size:17,position:{x:0, -y:-2}}],events:{},def:{params:[null],type:"when_object_click_canceled"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"when_object_click_canceled"},when_some_key_click:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_keyboard.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null]},func:function(b,a){return a.callReturn()},event:"keyPress"},when_message_cast:{color:"#3BBD70",skeleton:"basic_event",statements:[], -params:[{type:"Indicator",img:"block_icon/start_icon_signal.png",size:17,position:{x:0,y:-2}},{type:"DropdownDynamic",value:null,menuName:"messages",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_START}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs",b)}],viewDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}]},def:{params:[null,null],type:"when_message_cast"},paramsKeyMap:{VALUE:1},"class":"message",isNotFor:["message"],func:function(b, -a){return a.callReturn()},event:"when_message_cast"},message_cast:{color:"#3BBD70",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"messages",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_START},{type:"Indicator",img:"block_icon/start_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs",b)}],viewDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}]},def:{params:[null,null],type:"message_cast"}, -paramsKeyMap:{VALUE:0},"class":"message",isNotFor:["message"],func:function(b,a){var c=a.getField("VALUE",a),d=Entry.isExist(c,"id",Entry.variableContainer.messages_);if("null"==c||!d)throw Error("value can not be null or undefined");Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent,["when_message_cast",c]);return a.callReturn()}},message_cast_wait:{color:"#3BBD70",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"messages",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_START}, -{type:"Indicator",img:"block_icon/start_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}]},def:{params:[null,null],type:"message_cast_wait"},paramsKeyMap:{VALUE:0},"class":"message",isNotFor:["message"],func:function(b,a){if(a.runningScript){for(var c=a.runningScript,d=c.length,e=0;ec.array_.length)throw Error("can not remove value from array"); -c.array_.splice(d-1,1);c.updateView();return a.callReturn()}},insert_value_to_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer; -a&&a.removeRef("_variableRefs",b)}]},def:{params:[{type:"text",params:["10"]},null,{type:"text",params:["1"]},null],type:"insert_value_to_list"},paramsKeyMap:{DATA:0,LIST:1,INDEX:2},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a),d=a.getValue("DATA",a),e=a.getValue("INDEX",a),c=Entry.variableContainer.getList(c,b);if(!c.array_||isNaN(e)||0==e||e>c.array_.length+1)throw Error("can not insert value to array");c.array_.splice(e-1,0,{data:d});c.updateView(); -return a.callReturn()}},change_value_list_index:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs", -b)}]},def:{params:[null,{type:"text",params:["1"]},{type:"text",params:["10"]},null],type:"change_value_list_index"},paramsKeyMap:{LIST:0,INDEX:1,DATA:2},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a),d=a.getValue("DATA",a),e=a.getValue("INDEX",a),c=Entry.variableContainer.getList(c,b);if(!c.array_||isNaN(e)||e>c.array_.length)throw Error("can not insert value to array");c.array_[e-1].data=d;c.updateView();return a.callReturn()}},value_of_index_from_list:{color:"#E457DC", -skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_value_of_index_from_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Text",text:Lang.Blocks.VARIABLE_value_of_index_from_list_2,color:"white"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.VARIABLE_value_of_index_from_list_3,color:"white"}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs", -b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null,null,{type:"number",params:["1"]}],type:"value_of_index_from_list"},paramsKeyMap:{LIST:1,INDEX:3},"class":"list_element",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a),d=a.getValue("INDEX",a),c=Entry.variableContainer.getList(c,b),d=Entry.getListRealIndex(d,c);if(!c.array_||isNaN(d)||d>c.array_.length)throw Error("can not insert value to array");return c.array_[d- -1].data}},length_of_list:{color:"#E457DC",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_length_of_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Text",text:Lang.Blocks.VARIABLE_length_of_list_2,color:"white"}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs", -b)}]},def:{params:[null,null,null],type:"length_of_list"},paramsKeyMap:{LIST:1},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a);return Entry.variableContainer.getList(c,b).array_.length}},show_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a= -Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null],type:"show_list"},paramsKeyMap:{LIST:0},"class":"list_visibility",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a);Entry.variableContainer.getList(c).setVisible(!0);return a.callReturn()}},hide_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists", -fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null],type:"hide_list"},paramsKeyMap:{LIST:0},"class":"list_visibility",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a);Entry.variableContainer.getList(c).setVisible(!1); -return a.callReturn()}},options_for_list:{color:"#E457DC",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["\uccab\ubc88\uc9f8","FIRST"],["\ub9c8\uc9c0\ub9c9","LAST"],["\ubb34\uc791\uc704","RANDOM"]],value:"FIRST",fontSize:11}],events:{},def:{params:[null]},paramsKeyMap:{OPERATOR:0},func:function(b,a){return a.getField("OPERATOR",a)}},set_visible_answer:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CALC_timer_visible_show, -"SHOW"],[Lang.Blocks.CALC_timer_visible_hide,"HIDE"]],value:"SHOW",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{viewAdd:[function(b){Entry.container&&Entry.container.showProjectAnswer()}],viewDestroy:[function(b){Entry.container&&Entry.container.hideProjectAnswer(b)}]},def:{params:["HIDE",null],type:"set_visible_answer"},paramsKeyMap:{BOOL:0},"class":"ask",isNotFor:[],func:function(b,a){"HIDE"==a.getField("BOOL",a)?Entry.container.inputValue.setVisible(!1): -Entry.container.inputValue.setVisible(!0);return a.callReturn()}},is_included_in_list:{color:"#E457DC",skeleton:"basic_boolean_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_is_included_in_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Text",text:Lang.Blocks.VARIABLE_is_included_in_list_2,color:"white"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.VARIABLE_is_included_in_list_3, -color:"white"}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null,null,{type:"text",params:["10"]},null],type:"is_included_in_list"},paramsKeyMap:{LIST:1,DATA:3},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a),d=a.getStringValue("DATA",a),c=Entry.variableContainer.getList(c,b);if(!c)return!1;for(var c= -c.array_,e=0,f=c.length;ek&&(k=Math.round(k-155),g=-k,h=0,Entry.dplay.vel_value=g);if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11, -0),a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(c,g),Entry.hw.setDigitalPortValue(d,h),Entry.hw.setDigitalPortValue(e,g),Entry.hw.setDigitalPortValue(f,h),delete a.isStart,delete a.timeFlag,Entry.engine.isContinue=!1,a.callReturn()}else{a.isStart=!0;a.timeFlag=1;var l=setTimeout(function(){a.timeFlag=2;Entry.dplay.removeTimeout(l)},50);Entry.dplay.timeouts.push(l);return a}}},dplay_buzzer:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\ub514\uc9c0\ud138 10\ubc88 \ubd80\uc800\ub97c %1 %2 %3 \ubc15\uc790\ub85c \uc5f0\uc8fc\ud558\uae30", -params:[{type:"Dropdown",options:[["\ub3c4","1"],["\ub3c4#","2"],["\ub808","3"],["\ubbf8b","4"],["\ubbf8","5"],["\ud30c","6"],["\ud30c#","7"],["\uc194","8"],["\uc194#","9"],["\ub77c","10"],["\uc2dcb","11"],["\uc2dc","12"],["\ubb34\uc74c","100"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png", -size:12}],events:{},def:{params:["1","1",{type:"text",params:["0.5"]},null],type:"dplay_buzzer"},paramsKeyMap:{NOTE:0,OCTAVE:1,VALUE:2},"class":"dplay_set",isNotFor:["dplay"],func:function(b,a){if(a.isStart){if(1==a.timeFlag)return a;Entry.hw.setDigitalPortValue(10,100);delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;return a.callReturn()}var c=a.getNumberField("NOTE",a),d=a.getNumberField("OCTAVE",a),e=a.getNumberValue("VALUE"),d=c+12*(d-1),e=6E4*e/60;a.isStart=!0;a.timeFlag=1;100== -c?Entry.hw.setDigitalPortValue(10,100):Entry.hw.setDigitalPortValue(10,d);if(100q?(m=Math.round(q-155),g=-m,h=0,Entry.dplay.Left_value=g):0==q&&(h=g=0,Entry.dplay.Left_value=0));"2"==n&&(e=6,f=11,0q?(m=Math.round(q-155),k=-m,l=0,Entry.dplay.Right_value= -k):0==q&&(l=k=0,Entry.dplay.Right_value=k));"3"==n&&(c=3,d=5,e=6,f=11,0q?(m=Math.round(q-155),g=-m,h=0,k=-m,l=0,Entry.dplay.Left_value=g,Entry.dplay.Right_value=k):0==q&&(l=k=h=g=0,Entry.dplay.Left_value=0,Entry.dplay.Right_value=0));if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0), -a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(c,g),Entry.hw.setDigitalPortValue(d,h),Entry.hw.setDigitalPortValue(e,l),Entry.hw.setDigitalPortValue(f,k),delete a.isStart,delete a.timeFlag,Entry.engine.isContinue=!1,a.callReturn()}else{a.isStart=!0;a.timeFlag=1;var r=setTimeout(function(){a.timeFlag=2;Entry.dplay.removeTimeout(r)},50);Entry.dplay.timeouts.push(r);return a}}},dplay_robot_speed_set:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubc14\ud034 %1 \uc67c\ucabd \ubc14\ud034 %2(\uc73c)\ub85c \uc815\ud558\uae30 %3", -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:["100"]},{type:"text",params:["100"]},null],type:"dplay_robot_speed_set"},paramsKeyMap:{R_VALUE:0,L_VALUE:1},"class":"dplay_robot",isNotFor:["dplay"],func:function(b,a){var c=0,d=0,e=0,f=0,g=0,g=0,g=a.getNumberValue("L_VALUE",a),g=Math.max(g,-100),g=Math.min(g,100);0 -g?(g=Math.round(g-155),c=-g,d=0,Entry.dplay.Left_value=c):0==g&&(d=c=0,Entry.dplay.Left_value=0);g=a.getNumberValue("R_VALUE",a);g=Math.max(g,-100);g=Math.min(g,100);0g?(g=Math.round(g-155),e=-g,f=0,Entry.dplay.Right_value=e):0==g&&(f=e=0,Entry.dplay.Right_value=0);if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0), -a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(3,c),Entry.hw.setDigitalPortValue(5,d),Entry.hw.setDigitalPortValue(6,f),Entry.hw.setDigitalPortValue(11,e),delete a.isStart,delete a.timeFlag,Entry.engine.isContinue=!1,a.callReturn()}else{a.isStart=!0;a.timeFlag=1;var h=setTimeout(function(){a.timeFlag=2;Entry.dplay.removeTimeout(h)},50);Entry.dplay.timeouts.push(h);return a}}},dplay_robot_stop:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\ub85c\ubd07\uc744 \uc815\uc9c0\ud558\uae30 %1", -params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"dplay_robot_stop"},paramsKeyMap:{},"class":"dplay_robot",isNotFor:["dplay"],func:function(b,a){Entry.hw.setDigitalPortValue(3,0);Entry.hw.setDigitalPortValue(5,0);Entry.hw.setDigitalPortValue(11,0);Entry.hw.setDigitalPortValue(6,0);return a.callReturn()}},nemoino_get_number_sensor_value:{parent:"arduino_get_number_sensor_value",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_sensor_number"}], -type:"nemoino_get_number_sensor_value"},"class":"arduino_value"},nemoino_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_port_number"}],type:"nemoino_get_digital_value"},"class":"arduino_value"},nemoino_toggle_led:{parent:"arduino_toggle_led",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"nemoino_toggle_led"},"class":"arduino_set"},nemoino_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_pwm_port_number"}, -{type:"arduino_text",params:["255"]},null],type:"nemoino_toggle_pwm"},"class":"arduino_set"},nemoino_convert_scale:{parent:"arduino_convert_scale",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number"}]},{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"nemoino_convert_scale"},"class":"arduino"},sensorBoard_get_number_sensor_value:{parent:"arduino_get_number_sensor_value", -isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_sensor_number"}],type:"sensorBoard_get_number_sensor_value"},"class":"arduino_value"},sensorBoard_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_port_number"}],type:"sensorBoard_get_digital_value"},"class":"arduino_value"},sensorBoard_toggle_led:{parent:"arduino_toggle_led",isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"sensorBoard_toggle_led"}, -"class":"arduino_set"},sensorBoard_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"sensorBoard_toggle_pwm"},"class":"arduino_set"},sensorBoard_convert_scale:{parent:"arduino_convert_scale",isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number",id:"bl5e"}]},{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number", -params:["0"]},{type:"number",params:["100"]}],type:"sensorBoard_convert_scale"},"class":"arduino"},CODEino_get_number_sensor_value:{parent:"arduino_get_number_sensor_value",isNotFor:["CODEino"],def:{params:[{type:"arduino_get_sensor_number"}],type:"CODEino_get_number_sensor_value"},"class":"arduino_value"},CODEino_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["CODEino"],def:{params:[{type:"arduino_get_port_number"}],type:"CODEino_get_digital_value"},"class":"arduino_value"},CODEino_toggle_led:{parent:"arduino_toggle_led", -isNotFor:["CODEino"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"CODEino_toggle_led"},"class":"arduino_set"},CODEino_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["CODEino"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"CODEino_toggle_pwm"},"class":"arduino_set"},CODEino_convert_scale:{parent:"arduino_convert_scale",isNotFor:["CODEino"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number"}]}, -{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"CODEino_convert_scale"},"class":"arduino"},ardublock_get_number_sensor_value:{parent:"arduino_get_number_sensor_value",isNotFor:["ardublock"],def:{params:[{type:"arduino_get_sensor_number"}],type:"ardublock_get_number_sensor_value"},"class":"arduino_value"},ardublock_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["ardublock"],def:{params:[{type:"arduino_get_port_number"}], -type:"ardublock_get_digital_value"},"class":"arduino_value"},ardublock_toggle_led:{parent:"arduino_toggle_led",isNotFor:["ardublock"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"ardublock_toggle_led"},"class":"arduino_set"},ardublock_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["ardublock"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"ardublock_toggle_pwm"},"class":"arduino_set"},ardublock_convert_scale:{parent:"arduino_convert_scale", -isNotFor:["ardublock"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number"}]},{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"ardublock_convert_scale"},"class":"arduino"},joystick_get_number_sensor_value:{parent:"arduino_get_number_sensor_value",isNotFor:["joystick"],def:{params:[{type:"arduino_get_sensor_number"}],type:"joystick_get_number_sensor_value"},"class":"arduino_value"}, -joystick_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["joystick"],def:{params:[{type:"arduino_get_port_number"}],type:"joystick_get_digital_value"},"class":"arduino_value"},joystick_toggle_led:{parent:"arduino_toggle_led",isNotFor:["joystick"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"joystick_toggle_led"},"class":"arduino_set"},joystick_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["joystick"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text", -params:["255"]},null],type:"joystick_toggle_pwm"},"class":"arduino_set"},joystick_convert_scale:{parent:"arduino_convert_scale",isNotFor:["joystick"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number"}]},{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"joystick_convert_scale"},"class":"arduino"},ebs_if:{parent:"_if",def:{type:"_if",params:[{type:"reach_something",params:[null, -"wall"]}]}},ebs_if2:{parent:"_if",def:{type:"_if",params:[{type:"reach_something",params:[null,"cwz5"]}]}}};(function(){for(var b in Entry.block){var a=Entry.block[b];if(a.parent){var c=function(){};c.prototype=Entry.block[a.parent];var c=new c,d;for(d in a)c[d]=a[d];Entry.block[b]=c}}})();"object"==typeof exports&&(exports.block=Entry.block);Entry.BlockMenu=function(b,a,c,d){Entry.Model(this,!1);this._align=a||"CENTER";this._scroll=void 0!==d?d:!1;this._bannedClass=[];this._categories=[];this.suffix="blockMenu";b="string"===typeof b?$("#"+b):$(b);if("DIV"!==b.prop("tagName"))return console.error("Dom is not div element");this.view=b;this.visible=!0;this._svgId="blockMenu"+(new Date).getTime();this._clearCategory();this._categoryData=c;this._generateView(c);this._splitters=[];this.setWidth();this.svg=Entry.SVG(this._svgId);Entry.Utils.addFilters(this.svg, -this.suffix);a=Entry.Utils.addBlockPattern(this.svg,this.suffix);this.patternRect=a.rect;this.pattern=a.pattern;this.svgGroup=this.svg.elem("g");this.svgThreadGroup=this.svgGroup.elem("g");this.svgThreadGroup.board=this;this.svgBlockGroup=this.svgGroup.elem("g");this.svgBlockGroup.board=this;this.changeEvent=new Entry.Event(this);c&&this._generateCategoryCodes(c);this.observe(this,"_handleDragBlock",["dragBlock"]);this._scroll&&(this._scroller=new Entry.BlockMenuScroller(this),this._addControl(b)); -Entry.documentMousedown&&Entry.documentMousedown.attach(this,this.setSelectedBlock);this._categoryCodes&&Entry.keyPressed&&Entry.keyPressed.attach(this,this._captureKeyEvent);Entry.windowResized&&(b=_.debounce(this.updateOffset,200),Entry.windowResized.attach(this,b))}; -(function(b){b.schema={code:null,dragBlock:null,closeBlock:null,selectedBlockView:null};b._generateView=function(a){var b=this.view,d=this;a&&(this._categoryCol=Entry.Dom("ul",{class:"entryCategoryListWorkspace",parent:b}),this._generateCategoryView(a));this.blockMenuContainer=Entry.Dom("div",{"class":"blockMenuContainer",parent:b});this.svgDom=Entry.Dom($(''),{parent:this.blockMenuContainer});this.svgDom.mouseenter(function(a){d._scroller&& -d._scroller.setOpacity(1);a=d.workspace.selectedBlockView;!Entry.playground||Entry.playground.resizing||a&&a.dragMode===Entry.DRAG_MODE_DRAG||(Entry.playground.focusBlockMenu=!0,a=d.svgGroup.getBBox(),a=a.width+a.x+64,a>Entry.interfaceState.menuWidth&&(this.widthBackup=Entry.interfaceState.menuWidth-64,$(this).stop().animate({width:a-62},200)))});this.svgDom.mouseleave(function(a){Entry.playground&&!Entry.playground.resizing&&(d._scroller&&d._scroller.setOpacity(0),(a=this.widthBackup)&&$(this).stop().animate({width:a}, -200),delete this.widthBackup,delete Entry.playground.focusBlockMenu)});$(window).scroll(function(){d.updateOffset()})};b.changeCode=function(a){if(!(a instanceof Entry.Code))return console.error("You must inject code instance");this.codeListener&&this.code.changeEvent.detach(this.codeListener);var b=this;this.set({code:a});this.codeListener=this.code.changeEvent.attach(this,function(){b.changeEvent.notify()});a.createView(this);this.align()};b.bindCodeView=function(a){this.svgBlockGroup.remove(); -this.svgThreadGroup.remove();this.svgBlockGroup=a.svgBlockGroup;this.svgThreadGroup=a.svgThreadGroup;this.svgGroup.appendChild(this.svgThreadGroup);this.svgGroup.appendChild(this.svgBlockGroup);this._scroller&&this.svgGroup.appendChild(this._scroller.svgGroup)};b.align=function(a){var b=this.code;if(b){this._clearSplitters();b.view&&!a&&b.view.reDraw();a=b.getThreads();for(var b=10,d="LEFT"==this._align?10:this.svgDom.width()/2,e,f=0,g=a.length;fthis._bannedClass.indexOf(a)&&this._bannedClass.push(a);this.align(b)};b.unbanClass=function(a,b){var d=this._bannedClass.indexOf(a);-1b&&(a.preventDefault(),this.selectMenu(b-49))};b.setPatternRectFill= -function(a){this.patternRect.attr({fill:a});this.pattern.attr({style:""})};b.disablePattern=function(){this.pattern.attr({style:"display: none"})};b._clearCategory=function(){this._selectedCategoryView=null;this._categories=[];var a=this._categoryElems,b;for(b in a)a[b].remove();this._categoryElems={};a=this._categoryCodes;for(b in a){var d=a[b];d.constructor==Entry.Code&&d.clear()}this._categoryCodes=null};b.setCategoryData=function(a){this._clearCategory();this._categoryData=a;this._generateCategoryView(a); -this._generateCategoryCodes(a)};b._generateCategoryView=function(a){if(a)for(var b=0;b=b?this.setVisible(!1):this.setVisible(!0)};b._reset=function(){this.vY=0;this.vScrollbar.attr({y:this.vY});this.resizeScrollBar()};b.onMouseDown=function(a){function b(a){a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();a=a.originalEvent&&a.originalEvent.touches?a.originalEvent.touches[0]:a;var c=e.dragInstance; -e.scroll(a.pageY-c.offsetY);c.set({offsetY:a.pageY})}function d(a){$(document).unbind(".scroll");delete e.dragInstance}var e=this;a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();if(0===a.button||a.originalEvent&&a.originalEvent.touches){Entry.documentMousedown&&Entry.documentMousedown.notify(a);var f;f=a.originalEvent&&a.originalEvent.touches?a.originalEvent.touches[0]:a;var g=$(document);g.bind("mousemove.scroll",b);g.bind("mouseup.scroll",d);g.bind("touchmove.scroll", -b);g.bind("touchend.scroll",d);e.dragInstance=new Entry.DragInstance({startY:f.pageY,offsetY:f.pageY})}a.stopPropagation()};b._addControl=function(){$(this.vScrollbar).bind("mousedown touchstart",this.mouseHandler)}})(Entry.BlockMenuScroller.prototype);Entry.BlockView=function(b,a,c){Entry.Model(this,!1);this.block=b;this._lazyUpdatePos=_.debounce(b._updatePos.bind(b),200);this._board=a;this._observers=[];this.set(b);this.svgGroup=a.svgBlockGroup.elem("g");this._schema=Entry.block[b.type];this._schema.changeEvent&&(this._schemaChangeEvent=this._schema.changeEvent.attach(this,this._updateSchema));var d=this._skeleton=Entry.skeleton[this._schema.skeleton];this._contents=[];this._statements=[];this.magnet={};this._paramMap={};d.magnets&&d.magnets(this).next&& -(this.svgGroup.nextMagnet=this.block,this._nextGroup=this.svgGroup.elem("g"),this._observers.push(this.observe(this,"_updateMagnet",["contentHeight"])));this.isInBlockMenu=this.getBoard()instanceof Entry.BlockMenu;var e=this;this.mouseHandler=function(){var a=e.block.events;a&&a.mousedown&&a.mousedown.forEach(function(a){a(e)});e.onMouseDown.apply(e,arguments)};this._startRender(b,c);this._observers.push(this.block.observe(this,"_setMovable",["movable"]));this._observers.push(this.block.observe(this, -"_setReadOnly",["movable"]));this._observers.push(this.block.observe(this,"_setCopyable",["copyable"]));this._observers.push(this.block.observe(this,"_updateColor",["deletable"],!1));this._observers.push(this.observe(this,"_updateBG",["magneting"],!1));this._observers.push(this.observe(this,"_updateOpacity",["visible"],!1));this._observers.push(this.observe(this,"_updateDisplay",["display"],!1));this._observers.push(this.observe(this,"_updateShadow",["shadow"]));this._observers.push(this.observe(this, -"_updateMagnet",["offsetY"]));this._observers.push(a.code.observe(this,"_setBoard",["board"],!1));this.dragMode=Entry.DRAG_MODE_NONE;Entry.Utils.disableContextmenu(this.svgGroup.node);a=b.events.viewAdd;"workspace"==Entry.type&&a&&!this.isInBlockMenu&&a.forEach(function(a){Entry.Utils.isFunction(a)&&a(b)})};Entry.BlockView.PARAM_SPACE=5;Entry.BlockView.DRAG_RADIUS=5;Entry.BlockView.pngMap={}; -(function(b){b.schema={id:0,type:Entry.STATIC.BLOCK_RENDER_MODEL,x:0,y:0,offsetX:0,offsetY:0,width:0,height:0,contentWidth:0,contentHeight:0,magneting:!1,visible:!0,animating:!1,shadow:!0,display:!0};b._startRender=function(a,b){var d=this,e=this._skeleton;this.svgGroup.attr({class:"block"});var f=e.classes;f&&0!==f.length&&f.forEach(function(a){d.svgGroup.addClass(a)});f=e.path(this);this.pathGroup=this.svgGroup.elem("g");this._updateMagnet();this._path=this.pathGroup.elem("path");this.getBoard().patternRect&& -($(this._path).mouseenter(function(a){d._mouseEnable&&d._changeFill(!0)}),$(this._path).mouseleave(function(a){d._mouseEnable&&d._changeFill(!1)}));var g=this._schema.color;this.block.deletable===Entry.Block.DELETABLE_FALSE_LIGHTEN&&(g=Entry.Utils.colorLighten(g));this._fillColor=g;f={d:f,fill:g,class:"blockPath"};if(this.magnet.next||this._skeleton.nextShadow)g=this.getBoard().suffix,this.pathGroup.attr({filter:"url(#entryBlockShadowFilter_"+g+")"});else if(this.magnet.string||this.magnet.boolean)f.stroke= -e.outerLine;e.outerLine&&(f["stroke-width"]="0.6");this._path.attr(f);this._moveTo(this.x,this.y,!1);this._startContentRender(b);!0!==this._board.disableMouseEvent&&this._addControl();this.bindPrev()};b._startContentRender=function(a){a=void 0===a?Entry.Workspace.MODE_BOARD:a;this.contentSvgGroup&&this.contentSvgGroup.remove();var b=this._schema;b.statements&&b.statements.length&&this.statementSvgGroup&&this.statementSvgGroup.remove();this._contents=[];this.contentSvgGroup=this.svgGroup.elem("g"); -b.statements&&b.statements.length&&(this.statementSvgGroup=this.svgGroup.elem("g"));switch(a){case Entry.Workspace.MODE_BOARD:case Entry.Workspace.MODE_OVERLAYBOARD:for(var d=/(%\d)/mi,e=(b.template?b.template:Lang.template[this.block.type]).split(d),f=b.params,g=0;gEntry.BlockView.DRAG_RADIUS)e&&(clearTimeout(e),e=null),f.movable&&(f.isInBlockMenu?g.cloneToGlobal(a):(a=!1,f.dragMode!=Entry.DRAG_MODE_DRAG&&(f._toGlobalCoordinate(), -f.dragMode=Entry.DRAG_MODE_DRAG,f.block.getThread().changeEvent.notify(),Entry.GlobalSvg.setView(f,c),a=!0),this.animating&&this.set({animating:!1}),0===f.dragInstance.height&&f.dragInstance.set({height:-1+f.height}),c=f.dragInstance,f._moveBy(d.pageX-c.offsetX,d.pageY-c.offsetY,!1),c.set({offsetX:d.pageX,offsetY:d.pageY}),Entry.GlobalSvg.position(),f.originPos||(f.originPos={x:f.x,y:f.y}),a&&g.generateCodeMagnetMap(),f._updateCloseBlock()))}function d(a){e&&(clearTimeout(e),e=null);$(document).unbind(".block"); -f.terminateDrag(a);g&&g.set({dragBlock:null});f._changeFill(!1);Entry.GlobalSvg.remove();delete this.mouseDownCoordinate;delete f.dragInstance}a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();var e=null,f=this;this._changeFill(!1);var g=this.getBoard();Entry.documentMousedown&&Entry.documentMousedown.notify(a);if(!this.readOnly&&!g.viewOnly){g.setSelectedBlock(this);this.dominate();if(0===a.button||a.originalEvent&&a.originalEvent.touches){var h=a.type,k;k=a.originalEvent&& -a.originalEvent.touches?a.originalEvent.touches[0]:a;this.mouseDownCoordinate={x:k.pageX,y:k.pageY};var l=$(document);l.bind("mousemove.block touchmove.block",c);l.bind("mouseup.block touchend.block",d);this.dragInstance=new Entry.DragInstance({startX:k.pageX,startY:k.pageY,offsetX:k.pageX,offsetY:k.pageY,height:0,mode:!0});g.set({dragBlock:this});this.addDragging();this.dragMode=Entry.DRAG_MODE_MOUSEDOWN;"touchstart"===h&&(e=setTimeout(function(){e&&(e=null,d(),f._rightClick(a))},1E3))}else Entry.Utils.isRightButton(a)&& -this._rightClick(a);g.workspace.getMode()===Entry.Workspace.MODE_VIMBOARD&&a&&document.getElementsByClassName("CodeMirror")[0].dispatchEvent(Entry.Utils.createMouseEvent("dragStart",event))}};b.vimBoardEvent=function(a,b,d){a&&(a=Entry.Utils.createMouseEvent(b,a),d&&(a.block=d),document.getElementsByClassName("CodeMirror")[0].dispatchEvent(a))};b.terminateDrag=function(a){var b=this.getBoard(),d=this.dragMode,e=this.block,f=b.workspace.getMode();this.removeDragging();this.set({visible:!0});this.dragMode= -Entry.DRAG_MODE_NONE;if(f===Entry.Workspace.MODE_VIMBOARD)b instanceof Entry.BlockMenu?(b.terminateDrag(),this.vimBoardEvent(a,"dragEnd",e)):b.clear();else if(d===Entry.DRAG_MODE_DRAG){var f=this.dragInstance&&this.dragInstance.isNew,g=Entry.GlobalSvg;a=!1;var h=this.block.getPrevBlock(this.block);a=!1;switch(Entry.GlobalSvg.terminateDrag(this)){case g.DONE:g=b.magnetedBlockView;g instanceof Entry.BlockView&&(g=g.block);h&&!g?Entry.do("separateBlock",e):h||g||f?g?("next"===g.view.magneting?(h=e.getLastBlock(), -this.dragMode=d,b.separate(e),this.dragMode=Entry.DRAG_MODE_NONE,Entry.do("insertBlock",g,h).isPass(f),Entry.ConnectionRipple.setView(g.view).dispose()):(Entry.do("insertBlock",e,g).isPass(f),a=!0),createjs.Sound.play("entryMagneting")):Entry.do("moveBlock",e).isPass(f):e.getThread().view.isGlobal()?Entry.do("moveBlock",e):Entry.do("separateBlock",e);break;case g.RETURN:e=this.block;d=this.originPos;h?(this.set({animating:!1}),createjs.Sound.play("entryMagneting"),this.bindPrev(h),e.insert(h)):(f= -e.getThread().view.getParent(),f instanceof Entry.Board?this._moveTo(d.x,d.y,!1):(createjs.Sound.play("entryMagneting"),Entry.do("insertBlock",e,f)));break;case g.REMOVE:createjs.Sound.play("entryDelete"),f?this.block.destroy(!1,!0):this.block.doDestroyBelow(!1)}b.setMagnetedBlock(null);a&&Entry.ConnectionRipple.setView(e.view).dispose()}this.destroyShadow();delete this.originPos;this.dominate()};b._updateCloseBlock=function(){var a=this.getBoard(),b;if(this._skeleton.magnets){for(var d in this.magnet)if(b= -"next"===d?this.getBoard().getNearestMagnet(this.x,this.y+this.getBelowHeight(),d):this.getBoard().getNearestMagnet(this.x,this.y,d))return a.setMagnetedBlock(b.view,d);a.setMagnetedBlock(null)}};b.dominate=function(){this.block.getThread().view.dominate()};b.getSvgRoot=function(){for(var a=this.getBoard().svgBlockGroup,b=this.svgGroup;b.parentNode!==a;)b=b.parentNode;return b};b.getBoard=function(){return this._board};b._setBoard=function(){this._board=this._board.code.board};b.destroy=function(a){$(this.svgGroup).unbind(".blockViewMousedown"); -this._destroyObservers();var b=this.svgGroup;a?$(b).fadeOut(100,function(){b.remove()}):b.remove();this._contents.forEach(function(a){a.constructor!==Entry.Block&&a.destroy()});var d=this.block;a=d.events.viewDestroy;"workspace"==Entry.type&&a&&!this.isInBlockMenu&&a.forEach(function(a){Entry.Utils.isFunction(a)&&a(d)});this._schemaChangeEvent&&this._schemaChangeEvent.destroy()};b.getShadow=function(){this._shadow||(this._shadow=Entry.SVG.createElement(this.svgGroup.cloneNode(!0),{opacity:.5}),this.getBoard().svgGroup.appendChild(this._shadow)); -return this._shadow};b.destroyShadow=function(){this._shadow&&(this._shadow.remove(),delete this._shadow)};b._updateMagnet=function(){if(this._skeleton.magnets){var a=this._skeleton.magnets(this);a.next&&this._nextGroup.attr("transform","translate("+a.next.x+","+a.next.y+")");this.magnet=a;this.block.getThread().changeEvent.notify()}};b._updateBG=function(){if(this._board.dragBlock&&this._board.dragBlock.dragInstance){var a=this.svgGroup;if(this.magnet.next){if(a=this.magneting){var b=this._board.dragBlock.getShadow(), -d=this.getAbsoluteCoordinate(),e;if("previous"===a)e=this.magnet.next,e="translate("+(d.x+e.x)+","+(d.y+e.y)+")";else if("next"===a){e=this.magnet.previous;var f=this._board.dragBlock.getBelowHeight();e="translate("+(d.x+e.x)+","+(d.y+e.y-f)+")"}$(b).attr({transform:e,display:"block"});this._clonedShadow=b;this.background&&(this.background.remove(),this.nextBackground.remove(),delete this.background,delete this.nextBackground);"previous"===a&&(a=this._board.dragBlock.getBelowHeight()+this.offsetY, -this.originalHeight=this.offsetY,this.set({offsetY:a}))}else this._clonedShadow&&(this._clonedShadow.attr({display:"none"}),delete this._clonedShadow),a=this.originalHeight,void 0!==a&&(this.background&&(this.background.remove(),this.nextBackground.remove(),delete this.background,delete this.nextBackground),this.set({offsetY:a}),delete this.originalHeight);(a=this.block.thread.changeEvent)&&a.notify()}else this.magneting?(a.attr({filter:"url(#entryBlockHighlightFilter_"+this.getBoard().suffix+")"}), -a.addClass("outputHighlight")):(a.removeClass("outputHighlight"),a.removeAttr("filter"))}};b.addDragging=function(){this.svgGroup.addClass("dragging")};b.removeDragging=function(){this.svgGroup.removeClass("dragging")};b.addSelected=function(){this.svgGroup.addClass("selected")};b.removeSelected=function(){this.svgGroup.removeClass("selected")};b.getSkeleton=function(){return this._skeleton};b.getContentPos=function(){return this._skeleton.contentPos(this)};b.renderText=function(){this._startContentRender(Entry.Workspace.MODE_VIMBOARD)}; -b.renderBlock=function(){this._startContentRender(Entry.Workspace.MODE_BOARD)};b._updateOpacity=function(){this.svgGroup.attr({opacity:!1===this.visible?0:1});this.visible&&this._setPosition()};b._updateShadow=function(){this.shadow&&Entry.Utils.colorDarken(this._schema.color,.7)};b._setMovable=function(){this.movable=null!==this.block.isMovable()?this.block.isMovable():void 0!==this._skeleton.movable?this._skeleton.movable:!0};b._setReadOnly=function(){this.readOnly=null!==this.block.isReadOnly()? -this.block.isReadOnly():void 0!==this._skeleton.readOnly?this._skeleton.readOnly:!1};b._setCopyable=function(){this.copyable=null!==this.block.isCopyable()?this.block.isCopyable():void 0!==this._skeleton.copyable?this._skeleton.copyable:!0};b.bumpAway=function(a,b){var d=this;a=a||15;b?window.setTimeout(function(){d._moveBy(a,a,!1)},b):d._moveBy(a,a,!1)};b.bindPrev=function(a){if(a){if(this._toLocalCoordinate(a.view._nextGroup),(a=a.getNextBlock())&&a!==this.block){var b=this.block.getLastBlock(); -b.view.magnet.next?a.view._toLocalCoordinate(b.view._nextGroup):(a.view._toGlobalCoordinate(),a.separate(),a.view.bumpAway(null,100))}}else if(a=this.block.getPrevBlock())this._toLocalCoordinate(a.view._nextGroup),(a=this.block.getNextBlock())&&a.view&&a.view._toLocalCoordinate(this._nextGroup)};b.getAbsoluteCoordinate=function(a){a=void 0!==a?a:this.dragMode;if(a===Entry.DRAG_MODE_DRAG)return{x:this.x,y:this.y};a=this.block.getThread().view.requestAbsoluteCoordinate(this);a.x+=this.x;a.y+=this.y; -return a};b.getBelowHeight=function(){return this.block.getThread().view.requestPartHeight(this)};b._updateDisplay=function(){this.svgGroup.attr({display:!1===this.display?"none":"block"});this.display&&this._setPosition()};b._updateColor=function(){var a=this._schema.color;this.block.deletable===Entry.Block.DELETABLE_FALSE_LIGHTEN&&(a=Entry.Utils.colorLighten(a));this._fillColor=a;this._path.attr({fill:a});this._updateContents()};b._updateContents=function(){for(var a=0;a\s+/g, -">").replace(/\s+(svgGroup)(defs)',h=this.svgGroup.getBoundingClientRect(),k=a?this.svgGroup:this.svgGroup.cloneNode(!0), -l=this._skeleton.box(this),m=b?1:1.5,n=function(){var a=window.platform;return a&&"windows"===a.name.toLowerCase()&&"7"===a.version[0]?!0:!1}()?.9:.95;-1<=+-x/".split(""),v=0;ve||d.splice(e,1)}};b.raiseEvent=function(a,b,d){a=this._eventMap[a];var e=[];if(void 0!==a){for(var f=0;fe||d.splice(e,1)};b.doDestroyThread=function(a,b){var d=this._data,e=d.indexOf(a);0>e||d.splice(e,1)};b.getThreads=function(){return this._data.map(function(a){return a})};b.toJSON=function(){for(var a= -this.getThreads(),b=[],d=0,e=a.length;db&&(d+="...");return d};b.appendSvgOptionGroup=function(){return this._block.view.getBoard().svgGroup.elem("g")};b.getValue=function(){return this._block.params[this._index]};b.setValue=function(a,b){this.value!=a&&(this.value=a,this._block.params[this._index]=a,b&&this._blockView.reDraw())};b._isEditable=function(){if(Entry.ContextMenu.visible||this._block.view.dragMode==Entry.DRAG_MODE_DRAG)return!1; -var a=this._block.view,b=a.getBoard();if(!0===b.disableMouseEvent)return!1;var d=b.workspace.selectedBlockView;if(!d||b!=d.getBoard())return!1;b=a.getSvgRoot();return b==d.svgGroup||$(b).has($(a.svgGroup))};b._selectBlockView=function(){var a=this._block.view;a.getBoard().setSelectedBlock(a)};b._bindRenderOptions=function(){var a=this;$(this.svgGroup).bind("mouseup touchend",function(b){a._isEditable()&&(a.destroyOption(),a._startValue=a.getValue(),a.renderOptions())})};b.pointer=function(a){a=a|| -[];a.unshift(this._index);a.unshift(Entry.PARAM);return this._block.pointer(a)};b.getFontSize=function(a){return a=a||this._blockView.getSkeleton().fontSize||12};b.getContentHeight=function(){return Entry.isMobile()?22:16}})(Entry.Field.prototype);Entry.FieldAngle=function(b,a,c){this._block=a.block;this._blockView=a;this.box=new Entry.BoxModel;this.svgGroup=null;this.position=b.position;this._contents=b;this._index=c;b=this.getValue();this.setValue(this.modValue(void 0!==b?b:90));this._CONTENT_HEIGHT=this.getContentHeight();this.renderStart()};Entry.Utils.inherit(Entry.Field,Entry.FieldAngle); -(function(b){b.renderStart=function(){this.svgGroup&&$(this.svgGroup).remove();this.svgGroup=this._blockView.contentSvgGroup.elem("g",{class:"entry-input-field"});this.textElement=this.svgGroup.elem("text",{x:4,y:4,"font-size":"11px"});this.textElement.textContent=this.getText();var a=this.getTextWidth(),b=this._CONTENT_HEIGHT,d=this.position&&this.position.y?this.position.y:0;this._header=this.svgGroup.elem("rect",{x:0,y:d-b/2,rx:3,ry:3,width:a,height:b,rx:3,ry:3,fill:"#fff","fill-opacity":.4}); -this.svgGroup.appendChild(this.textElement);this._bindRenderOptions();this.box.set({x:0,y:0,width:a,height:b})};b.renderOptions=function(){var a=this;this._attachDisposeEvent(function(){a.applyValue();a.destroyOption()});this.optionGroup=Entry.Dom("input",{class:"entry-widget-input-field",parent:$("body")});this.optionGroup.val(this.value);this.optionGroup.on("mousedown touchstart",function(a){a.stopPropagation()});this.optionGroup.on("keyup",function(b){var c=b.keyCode||b.which;a.applyValue(b);-1< -[13,27].indexOf(c)&&a.destroyOption()});var b=this.getAbsolutePosFromDocument();b.y-=this.box.height/2;this.optionGroup.css({height:this._CONTENT_HEIGHT,left:b.x,top:b.y,width:a.box.width});this.svgOptionGroup=this.appendSvgOptionGroup();this.svgOptionGroup.elem("circle",{x:0,y:0,r:49,class:"entry-field-angle-circle"});$(this.svgOptionGroup).on("mousedown touchstart",function(b){b.stopPropagation();a._updateByCoord(b)});this._dividerGroup=this.svgOptionGroup.elem("g");for(b=0;360>b;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+")"});$(this.svgOptionGroup).bind("mousemove touchmove",this._updateByCoord.bind(this));$(this.svgOptionGroup).bind("mouseup touchend",this.destroyOption.bind(this));this.updateGraph();this.optionGroup.focus();this.optionGroup.select()}; -b._updateByCoord=function(a){a.originalEvent&&a.originalEvent.touches&&(a=a.originalEvent.touches[0]);a=[a.clientX,a.clientY];var b=this.getAbsolutePosFromDocument();this.optionGroup.val(this.modValue(function(a,b){var c=b[0]-a[0],g=b[1]-a[1]-49-1,h=Math.atan(-g/c),h=Entry.toDegrees(h),h=90-h;0>c?h+=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||(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, -delete this._originBlock;else switch(this.acceptType){case "boolean":a="True";break;case "string":a="text";break;case "param":a="function_field_label"}return this._createBlockByType(a)};b._setValueBlock=function(a){this._restoreCurrent&&(this._originBlock=this._valueBlock);a||(a=this.inspectBlock());this._valueBlock=a;this.setValue(a);a.setThread(this);a.getThread().view.setParent(this);return this._valueBlock};b.getValueBlock=function(){return this._valueBlock};b.updateValueBlock=function(a){a instanceof -Entry.Block||(a=void 0);this._destroyObservers();a=this._setValueBlock(a).view;a.bindPrev(this);this._blockView.alignContent();this._posObserver=a.observe(this,"updateValueBlock",["x","y"],!1);this._sizeObserver=a.observe(this,"calcWH",["width","height"]);a=this._blockView.getBoard();a.constructor===Entry.Board&&a.generateCodeMagnetMap()};b._destroyObservers=function(){this._sizeObserver&&this._sizeObserver.destroy();this._posObserver&&this._posObserver.destroy()};b.getPrevBlock=function(a){return this._valueBlock=== -a?this:null};b.getNextBlock=function(){return null};b.requestAbsoluteCoordinate=function(a){a=this._blockView;var b=a.contentPos;a=a.getAbsoluteCoordinate();a.x+=this.box.x+b.x;a.y+=this.box.y+b.y;return a};b.dominate=function(){this._blockView.dominate()};b.isGlobal=function(){return!1};b.separate=function(a){this.getCode().createThread([a]);this.calcWH();this.changeEvent.notify()};b.getCode=function(){return this._block.thread.getCode()};b.cut=function(a){return this._valueBlock===a?[a]:null};b.replace= -function(a){"string"===typeof a&&(a=this._createBlockByType(a));var b=this._valueBlock;Entry.block[b.type].isPrimitive?(b.doNotSplice=!0,b.destroy()):"param"===this.acceptType?(this._destroyObservers(),b.view._toGlobalCoordinate(),a.getTerminateOutputBlock().view._contents[1].replace(b)):(this._destroyObservers(),b.view._toGlobalCoordinate(),this.separate(b),b.view.bumpAway(30,150));this.updateValueBlock(a);a.view._toLocalCoordinate(this.svgGroup);this.calcWH();this.changeEvent.notify()};b.setParent= -function(a){this._parent=a};b.getParent=function(){return this._parent};b._createBlockByType=function(a){this._block.getThread();var b=this._blockView.getBoard();a=new Entry.Block({type:a},this);var d=b.workspace,e;d&&(e=d.getMode());a.createView(b,e);return a};b.spliceBlock=function(){this.updateValueBlock()};b._updateBG=function(){this.magneting?this._bg=this.svgGroup.elem("path",{d:"m 8,12 l -4,0 -2,-2 0,-3 3,0 1,-1 0,-12 -1,-1 -3,0 0,-3 2,-2 l 4,0 z",fill:"#fff",stroke:"#fff","fill-opacity":.7, -transform:"translate(0,12)"}):this._bg&&(this._bg.remove(),delete this._bg)};b.getThread=function(){return this};b.pointer=function(a){a.unshift(this._index);a.unshift(Entry.PARAM);return this._block.pointer(a)}})(Entry.FieldBlock.prototype);Entry.FieldColor=function(b,a,c){this._block=a.block;this._blockView=a;this.box=new Entry.BoxModel;this.svgGroup=null;this._contents=b;this._index=c;this._position=b.position;this.key=b.key;this.setValue(this.getValue()||"#FF0000");this._CONTENT_HEIGHT=this.getContentHeight();this._CONTENT_WIDTH=this.getContentWidth();this.renderStart(a)};Entry.Utils.inherit(Entry.Field,Entry.FieldColor); -(function(b){b.renderStart=function(){this.svgGroup&&$(this.svgGroup).remove();this.svgGroup=this._blockView.contentSvgGroup.elem("g",{class:"entry-field-color"});var a=this._CONTENT_HEIGHT,b=this._CONTENT_WIDTH,d=this._position,e;d?(e=d.x||0,d=d.y||0):(e=0,d=-a/2);this._header=this.svgGroup.elem("rect",{x:e,y:d,width:b,height:a,fill:this.getValue()});this._bindRenderOptions();this.box.set({x:e,y:d,width:b,height:a})};b.renderOptions=function(){var a=this;this._attachDisposeEvent();var b=Entry.FieldColor.getWidgetColorList(); -this.optionGroup=Entry.Dom("table",{class:"entry-widget-color-table",parent:$("body")});for(var d=0;d'),{parent:this._container});this.svg=Entry.SVG("globalSvg");this.top=this.left=0;this._inited=!0}}; -b.setView=function(a,b){if(a!=this._view&&!a.block.isReadOnly()&&a.movable)return this._view=a,this._mode=b,b!==Entry.Workspace.MODE_VIMBOARD&&a.set({visible:!1}),this.draw(),this.show(),this.align(),this.position(),!0};b.draw=function(){var a=this._view;this._svg&&this.remove();var b=this._mode==Entry.Workspace.MODE_VIMBOARD;this.svgGroup=Entry.SVG.createElement(a.svgGroup.cloneNode(!0),{opacity:1});this.svg.appendChild(this.svgGroup);b&&(a=$(this.svgGroup),a.find("g").css({filter:"none"}),a.find("path").velocity({opacity:0}, -{duration:500}),a.find("text").velocity({fill:"#000000"},{duration:530}))};b.remove=function(){this.svgGroup&&(this.svgGroup.remove(),delete this.svgGroup,delete this._view,delete this._offsetX,delete this._offsetY,delete this._startX,delete this._startY,this.hide())};b.align=function(){var a=this._view.getSkeleton().box(this._view).offsetX||0,b=this._view.getSkeleton().box(this._view).offsetY||0,a=-1*a+1,b=-1*b+1;this._offsetX=a;this._offsetY=b;this.svgGroup.attr({transform:"translate("+a+","+b+ -")"})};b.show=function(){this._container.removeClass("entryRemove")};b.hide=function(){this._container.addClass("entryRemove")};b.position=function(){var a=this._view;if(a){var b=a.getAbsoluteCoordinate(),a=a.getBoard().offset();this.left=b.x+a.left-this._offsetX;this.top=b.y+a.top-this._offsetY;this.svgDom.css({transform:"translate3d("+this.left+"px,"+this.top+"px, 0px)"})}};b.terminateDrag=function(a){var b=Entry.mouseCoordinate,d=a.getBoard(),e=d.workspace.blockMenu,f=e.offset().left,g=e.offset().top, -h=e.visible?e.svgDom.width():0;return b.y>d.offset().top-20&&b.x>f+h?this.DONE:b.y>g&&b.x>f&&e.visible?a.block.isDeletable()?this.REMOVE:this.RETURN:this.RETURN};b.addControl=function(a){this.onMouseDown.apply(this,arguments)};b.onMouseDown=function(a){function b(a){var c=a.pageX;a=a.pageY;var d=e.left+(c-e._startX),f=e.top+(a-e._startY);e.svgDom.css({left:d,top:f});e._startX=c;e._startY=a;e.left=d;e.top=f}function d(a){$(document).unbind(".block")}this._startY=a.pageY;var e=this;a.stopPropagation(); -a.preventDefault();var f=$(document);f.bind("mousemove.block",b);f.bind("mouseup.block",d);f.bind("touchmove.block",b);f.bind("touchend.block",d);this._startX=a.pageX;this._startY=a.pageY}})(Entry.GlobalSvg);Entry.Mutator=function(){};(function(b){b.mutate=function(a,b){var d=Entry.block[a];void 0===d.changeEvent&&(d.changeEvent=new Entry.Event);d.template=b.template;d.params=b.params;d.changeEvent.notify(1)}})(Entry.Mutator);(function(b){})(Entry.Mutator.prototype);Entry.RenderView=function(b,a){this._align=a||"CENTER";b="string"===typeof b?$("#"+b):$(b);if("DIV"!==b.prop("tagName"))return console.error("Dom is not div element");this.view=b;this.viewOnly=!0;this.suffix="renderView";this.disableMouseEvent=this.visible=!0;this._svgId="renderView_"+(new Date).getTime();this._generateView();this.offset=this.svgDom.offset();this.setWidth();this.svg=Entry.SVG(this._svgId);Entry.Utils.addFilters(this.svg,this.suffix);this.svg&&(this.svgGroup=this.svg.elem("g"),this.svgThreadGroup= -this.svgGroup.elem("g"),this.svgThreadGroup.board=this,this.svgBlockGroup=this.svgGroup.elem("g"),this.svgBlockGroup.board=this)}; -(function(b){b.schema={code:null,dragBlock:null,closeBlock:null,selectedBlockView:null};b._generateView=function(){this.renderViewContainer=Entry.Dom("div",{"class":"renderViewContainer",parent:this.view});this.svgDom=Entry.Dom($(''),{parent:this.renderViewContainer})};b.changeCode=function(a){if(!(a instanceof Entry.Code))return console.error("You must inject code instance");this.code=a;this.svg|| -(this.svg=Entry.SVG(this._svgId),this.svgGroup=this.svg.elem("g"),this.svgThreadGroup=this.svgGroup.elem("g"),this.svgThreadGroup.board=this,this.svgBlockGroup=this.svgGroup.elem("g"),this.svgBlockGroup.board=this);a.createView(this);this.align();this.resize()};b.align=function(){var a=this.code.getThreads();if(a&&0!==a.length){for(var b=0,d="LEFT"==this._align?20:this.svgDom.width()/2,e=0,f=a.length;e'), -{parent:this.wrapper});this.visible=!0;var d=this;this.svg=Entry.SVG(this._svgId);$(window).scroll(function(){d.updateOffset()});this.svgGroup=this.svg.elem("g");this.svgThreadGroup=this.svgGroup.elem("g");this.svgThreadGroup.board=this;this.svgBlockGroup=this.svgGroup.elem("g");this.svgBlockGroup.board=this;a.isOverlay?(this.wrapper.addClass("entryOverlayBoard"),this.generateButtons(),this.suffix="overlayBoard"):this.suffix="board";Entry.Utils.addFilters(this.svg,this.suffix);a=Entry.Utils.addBlockPattern(this.svg, -this.suffix);this.patternRect=a.rect;this.pattern=a.pattern};b.changeCode=function(a){this.code&&this.codeListener&&this.code.changeEvent.detach(this.codeListener);this.set({code:a});var b=this;a&&(this.codeListener=this.code.changeEvent.attach(this,function(){b.changeEvent.notify()}),a.createView(this));this.scroller.resizeScrollBar()};b.bindCodeView=function(a){this.svgBlockGroup.remove();this.svgThreadGroup.remove();this.svgBlockGroup=a.svgBlockGroup;this.svgThreadGroup=a.svgThreadGroup;this.svgGroup.appendChild(this.svgThreadGroup); -this.svgGroup.appendChild(this.svgBlockGroup)};b.setMagnetedBlock=function(a,b){if(this.magnetedBlockView){if(this.magnetedBlockView===a)return;this.magnetedBlockView.set({magneting:!1})}this.set({magnetedBlockView:a});a&&(a.set({magneting:b}),a.dominate())};b.getCode=function(){return this.code};b.findById=function(a){return this.code.findById(a)};b._addControl=function(){var a=this.svgDom,b=this;a.mousedown(function(){b.onMouseDown.apply(b,arguments)});a.bind("touchstart",function(){b.onMouseDown.apply(b, -arguments)});a.on("wheel",function(){b.mouseWheel.apply(b,arguments)});var d=b.scroller;d&&(a.mouseenter(function(a){d.setOpacity(1)}),a.mouseleave(function(a){d.setOpacity(0)}))};b.onMouseDown=function(a){function b(a){a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();a=Entry.Utils.convertMouseEvent(a);var c=e.mouseDownCoordinate;Math.sqrt(Math.pow(a.pageX-c.x,2)+Math.pow(a.pageY-c.y,2))a&&(f=f+e+10,e=0,d=15);e=Math.max(e,k.width);l=d+15;h._moveTo(f,l,!1);d=d+k.height+15}}this.scroller.resizeScrollBar()};b.clear=function(){this.svgBlockGroup.remove();this.svgThreadGroup.remove()};b.updateOffset= -function(){this._offset=this.svg.getBoundingClientRect();var a=$(window),b=a.scrollTop(),a=a.scrollLeft(),d=this._offset;this.relativeOffset={top:d.top-b,left:d.left-a};this.btnWrapper&&this.btnWrapper.attr({transform:"translate("+(d.width/2-65)+","+(d.height-200)+")"})};b.generateButtons=function(){var a=this,b=this.svgGroup.elem("g");this.btnWrapper=b;var d=b.elem("text",{x:27,y:33,class:"entryFunctionButtonText"});d.textContent=Lang.Buttons.save;var e=b.elem("text",{x:102.5,y:33,class:"entryFunctionButtonText"}); -e.textContent=Lang.Buttons.cancel;var f=b.elem("circle",{cx:27.5,cy:27.5,r:27.5,class:"entryFunctionButton"}),b=b.elem("circle",{cx:102.5,cy:27.5,r:27.5,class:"entryFunctionButton"});$(f).bind("mousedown touchstart",function(){a.save()});$(d).bind("mousedown touchstart",function(){a.save()});$(b).bind("mousedown touchstart",function(){a.cancelEdit()});$(e).bind("mousedown touchstart",function(){a.cancelEdit()})};b.cancelEdit=function(){this.workspace.setMode(Entry.Workspace.MODE_BOARD,"cancelEdit")}; -b.save=function(){this.workspace.setMode(Entry.Workspace.MODE_BOARD,"save")};b.generateCodeMagnetMap=function(){var a=this.code;if(a&&this.dragBlock)for(var b in this.dragBlock.magnet){var d=this._getCodeBlocks(a,b);d.sort(function(a,b){return a.point-b.point});d.unshift({point:-Number.MAX_VALUE,blocks:[]});for(var e=1;eg.point&&(g.blocks.push(h),l++,g=d[l],g););delete f.startBlock}f.endPoint=Number.MAX_VALUE;d[e-1].endPoint= -f.point}this._magnetMap[b]=d}};b._getCodeBlocks=function(a,b){var d=a.getThreads(),e=[],f;switch(b){case "previous":f=this._getNextMagnets;break;case "next":f=this._getPreviousMagnets;break;case "string":f=this._getFieldMagnets;break;case "boolean":f=this._getFieldMagnets;break;case "param":f=this._getOutputMagnets;break;default:return[]}for(var g=0;gd.endPoint)f=h+1;else{e=d.blocks;for(f=0;fthis.events[b].indexOf(f)&&this.events[b].push(f)}}this._schema.event&&this.thread.registerEvent(this,this._schema.event);a=this.params;b=this._schema.params;for(e=0;b&&e=e&&g>=b)}};b.align=function(){var a=this.getPosition();this.svgGroup.attr({transform:"translate("+a.x+","+a.y+")"})};b.setPosition=function(){if(this.board){var a=this.board.svgDom;this._x=a.width()-110;this._y=a.height()-110;this.align()}};b.getPosition=function(){return{x:this._x,y:this._y}};b.tAnimation=function(a){if(a!==this.isOver){a=void 0===a?!0:a;var b,d=this.trashcanTop;b=a?{translateX:15,translateY:-25, -rotateZ:30}:{translateX:0,translateY:0,rotateZ:0};$(d).velocity(b,{duration:50});this.isOver=a}};b.setBoard=function(a){this._dragBlockObserver&&this._dragBlockObserver.destroy();this.board=a;this.svgGroup||this._generateView();var b=a.svg,d=b.firstChild;d?b.insertBefore(this.svgGroup,d):b.appendChild(this.svgGroup);this._dragBlockObserver=a.observe(this,"updateDragBlock",["dragBlock"]);this.svgGroup.attr({filter:"url(#entryTrashcanFilter_"+a.suffix+")"});this.setPosition()}})(Entry.FieldTrashcan.prototype);Entry.Vim=function(b){b="string"===typeof b?$("#"+b):$(b);if("DIV"!==b.prop("tagName"))return console.error("Dom is not div element");this.createDom(b);this._parser=new Entry.Parser("maze","js",this.codeMirror);this._blockParser=new Entry.Parser("maze","block");Entry.Model(this,!1);window.eventset=[]}; -(function(b){b.createDom=function(a){function b(a){var c=e.getCodeToText(a.block);e.codeMirror.display.dragFunctions.leave(a);var d=Entry.Utils.createMouseEvent("mousedown",a);e.codeMirror.display.scroller.dispatchEvent(d);var c=c.split("\n"),k=c.length-1,l=0;c.forEach(function(a,b){e.codeMirror.replaceSelection(a);l=e.doc.getCursor().line;e.codeMirror.indentLine(l);0!==b&&k===b||e.codeMirror.replaceSelection("\n")});a=Entry.Utils.createMouseEvent("mouseup",a);e.codeMirror.display.scroller.dispatchEvent(a)} -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}); -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, -workspace:this,isOverlay:!0});this.overlayBoard.changeCode(new Entry.Code([]));this.overlayBoard.workspace=this;this.overlayBoard.observe(this,"_setSelectedBlockView",["selectedBlockView"],!1)};b._keyboardControl=function(a){var b=a.keyCode||a.which,d=a.ctrlKey;if(!Entry.Utils.isInInput(a)){var e=this.selectedBlockView;e&&!e.isInBlockMenu&&e.block.isDeletable()&&(8==b||46==b?(Entry.do("destroyBlock",e.block),a.preventDefault()):d&&(67==b?e.block.copyToClipboard():88==b&&(a=e.block,a.copyToClipboard(), -a.destroy(!0,!0),e.getBoard().setSelectedBlock(null))));d&&86==b&&(b=this.selectedBoard)&&b instanceof Entry.Board&&Entry.clipboard&&Entry.do("addThread",Entry.clipboard).value.getFirstBlock().copyToClipboard()}};b._handleChangeBoard=function(){var a=this.selectedBoard;a&&a.constructor===Entry.Board&&this.trashcan.setBoard(a)}})(Entry.Workspace.prototype);Entry.Playground=function(){this.enableArduino=this.isTextBGMode_=!1;this.viewMode_="default";Entry.addEventListener("textEdited",this.injectText);Entry.addEventListener("hwChanged",this.updateHW)}; -Entry.Playground.prototype.generateView=function(b,a){this.view_=b;this.view_.addClass("entryPlayground");if(a&&"workspace"!=a)"phone"==a&&(this.view_.addClass("entryPlaygroundPhone"),c=Entry.createElement("div","entryCategoryTab"),c.addClass("entryPlaygroundTabPhone"),Entry.view_.insertBefore(c,this.view_),this.generateTabView(c),this.tabView_=c,c=Entry.createElement("div","entryCurtain"),c.addClass("entryPlaygroundCurtainPhone"),c.addClass("entryRemove"),c.innerHTML=Lang.Workspace.cannot_edit_click_to_stop, -c.bindOnClick(function(){Entry.engine.toggleStop()}),this.view_.appendChild(c),this.curtainView_=c,Entry.pictureEditable&&(c=Entry.createElement("div","entryPicture"),c.addClass("entryPlaygroundPicturePhone"),c.addClass("entryRemove"),this.view_.appendChild(c),this.generatePictureView(c),this.pictureView_=c),c=Entry.createElement("div","entryText"),c.addClass("entryRemove"),this.view_.appendChild(c),this.generateTextView(c),this.textView_=c,Entry.soundEditable&&(c=Entry.createElement("div","entrySound"), -c.addClass("entryPlaygroundSoundWorkspacePhone"),c.addClass("entryRemove"),this.view_.appendChild(c),this.generateSoundView(c),this.soundView_=c),c=Entry.createElement("div","entryDefault"),this.view_.appendChild(c),this.generateDefaultView(c),this.defaultView_=c,c=Entry.createElement("div","entryCode"),c.addClass("entryPlaygroundCodePhone"),this.view_.appendChild(c),this.generateCodeView(c),this.codeView_=this.codeView_=c,Entry.addEventListener("run",function(a){Entry.playground.curtainView_.removeClass("entryRemove")}), -Entry.addEventListener("stop",function(a){Entry.playground.curtainView_.addClass("entryRemove")}));else{this.view_.addClass("entryPlaygroundWorkspace");var c=Entry.createElement("div","entryCategoryTab");c.addClass("entryPlaygroundTabWorkspace");this.view_.appendChild(c);this.generateTabView(c);this.tabView_=c;c=Entry.createElement("div","entryCurtain");c.addClass("entryPlaygroundCurtainWorkspace");c.addClass("entryRemove");var d=Lang.Workspace.cannot_edit_click_to_stop.split(".");c.innerHTML=d[0]+ -".
"+d[1];c.addEventListener("click",function(){Entry.engine.toggleStop()});this.view_.appendChild(c);this.curtainView_=c;Entry.pictureEditable&&(c=Entry.createElement("div","entryPicture"),c.addClass("entryPlaygroundPictureWorkspace"),c.addClass("entryRemove"),this.view_.appendChild(c),this.generatePictureView(c),this.pictureView_=c);c=Entry.createElement("div","entryText");c.addClass("entryPlaygroundTextWorkspace");c.addClass("entryRemove");this.view_.appendChild(c);this.generateTextView(c); -this.textView_=c;Entry.soundEditable&&(c=Entry.createElement("div","entrySound"),c.addClass("entryPlaygroundSoundWorkspace"),c.addClass("entryRemove"),this.view_.appendChild(c),this.generateSoundView(c),this.soundView_=c);c=Entry.createElement("div","entryDefault");c.addClass("entryPlaygroundDefaultWorkspace");this.view_.appendChild(c);this.generateDefaultView(c);this.defaultView_=c;c=Entry.createElement("div","entryCode");c.addClass("entryPlaygroundCodeWorkspace");c.addClass("entryRemove");this.view_.appendChild(c); -this.generateCodeView(c);this.codeView_=c;d=Entry.createElement("div");d.addClass("entryPlaygroundResizeWorkspace","entryRemove");this.resizeHandle_=d;this.view_.appendChild(d);this.initializeResizeHandle(d);this.codeView_=c;Entry.addEventListener("run",function(a){Entry.playground.curtainView_.removeClass("entryRemove")});Entry.addEventListener("stop",function(a){Entry.playground.curtainView_.addClass("entryRemove")})}};Entry.Playground.prototype.generateDefaultView=function(b){return b}; -Entry.Playground.prototype.generateTabView=function(b){var a=this,c=Entry.createElement("ul");c.addClass("entryTabListWorkspace");this.tabList_=c;b.appendChild(c);this.tabViewElements={};b=Entry.createElement("li","entryCodeTab");b.innerHTML=Lang.Workspace.tab_code;b.addClass("entryTabListItemWorkspace");b.addClass("entryTabSelected");c.appendChild(b);b.bindOnClick(function(b){a.changeViewMode("code");a.blockMenu.reDraw()});this.tabViewElements.code=b;Entry.pictureEditable&&(b=Entry.createElement("li", -"entryPictureTab"),b.innerHTML=Lang.Workspace.tab_picture,b.addClass("entryTabListItemWorkspace"),c.appendChild(b),b.bindOnClick(function(a){Entry.playground.changeViewMode("picture")}),this.tabViewElements.picture=b,b=Entry.createElement("li","entryTextboxTab"),b.innerHTML=Lang.Workspace.tab_text,b.addClass("entryTabListItemWorkspace"),c.appendChild(b),b.bindOnClick(function(a){Entry.playground.changeViewMode("text")}),this.tabViewElements.text=b,b.addClass("entryRemove"));Entry.soundEditable&&(b= -Entry.createElement("li","entrySoundTab"),b.innerHTML=Lang.Workspace.tab_sound,b.addClass("entryTabListItemWorkspace"),c.appendChild(b),b.bindOnClick(function(a){Entry.playground.changeViewMode("sound")}),this.tabViewElements.sound=b);Entry.hasVariableManager&&(b=Entry.createElement("li","entryVariableTab"),b.innerHTML=Lang.Workspace.tab_attribute,b.addClass("entryTabListItemWorkspace"),b.addClass("entryVariableTabWorkspace"),c.appendChild(b),b.bindOnClick(function(a){Entry.playground.toggleOnVariableView(); -Entry.playground.changeViewMode("variable")}),this.tabViewElements.variable=b)}; -Entry.Playground.prototype.generateCodeView=function(b){var a=this.createVariableView();b.appendChild(a);this.variableView_=a;b=Entry.Dom(b);a=Entry.Dom("div",{parent:b,id:"entryWorkspaceBoard",class:"entryWorkspaceBoard"});b=Entry.Dom("div",{parent:b,id:"entryWorkspaceBlockMenu",class:"entryWorkspaceBlockMenu"});this.mainWorkspace=new Entry.Workspace({blockMenu:{dom:b,align:"LEFT",categoryData:EntryStatic.getAllBlocks(),scroll:!0},board:{dom:a}});this.blockMenu=this.mainWorkspace.blockMenu;this.board= -this.mainWorkspace.board;Entry.hw&&this.updateHW()}; -Entry.Playground.prototype.generatePictureView=function(b){if("workspace"==Entry.type){var a=Entry.createElement("div","entryAddPicture");a.addClass("entryPlaygroundAddPicture");a.bindOnClick(function(a){Entry.dispatchEvent("openPictureManager")});var c=Entry.createElement("div","entryAddPictureInner");c.addClass("entryPlaygroundAddPictureInner");c.innerHTML=Lang.Workspace.picture_add;a.appendChild(c);b.appendChild(a);a=Entry.createElement("ul","entryPictureList");a.addClass("entryPlaygroundPictureList"); -$&&$(a).sortable({start:function(a,b){b.item.data("start_pos",b.item.index())},stop:function(a,b){var c=b.item.data("start_pos"),g=b.item.index();Entry.playground.movePicture(c,g)},axis:"y"});b.appendChild(a);this.pictureListView_=a;a=Entry.createElement("div","entryPainter");a.addClass("entryPlaygroundPainter");b.appendChild(a);this.painter=new Entry.Painter;this.painter.initialize(a)}else"phone"==Entry.type&&(a=Entry.createElement("div","entryAddPicture"),a.addClass("entryPlaygroundAddPicturePhone"), -a.bindOnClick(function(a){Entry.dispatchEvent("openPictureManager")}),c=Entry.createElement("div","entryAddPictureInner"),c.addClass("entryPlaygroundAddPictureInnerPhone"),c.innerHTML=Lang.Workspace.picture_add,a.appendChild(c),b.appendChild(a),a=Entry.createElement("ul","entryPictureList"),a.addClass("entryPlaygroundPictureListPhone"),$&&$(a).sortable({start:function(a,b){b.item.data("start_pos",b.item.index())},stop:function(a,b){var c=b.item.data("start_pos"),g=b.item.index();Entry.playground.movePicture(c, -g)},axis:"y"}),b.appendChild(a),this.pictureListView_=a)}; -Entry.Playground.prototype.generateTextView=function(b){var a=Entry.createElement("div");b.appendChild(a);b=Entry.createElement("div");b.addClass("textProperties");a.appendChild(b);var c=Entry.createElement("div");c.addClass("entryTextFontSelect");b.appendChild(c);var d=Entry.createElement("select","entryPainterAttrFontName");d.addClass("entryPlaygroundPainterAttrFontName","entryTextFontSelecter");d.size="1";d.onchange=function(a){Entry.playground.object.entity.setFontType(a.target.value)};for(var e= -0;e p").html(Lang.Menus.linebreak_on_desc_1),$(".entryPlaygroundLinebreakDescription > ul > li").eq(0).html(Lang.Menus.linebreak_on_desc_2),$(".entryPlaygroundLinebreakDescription > ul > li").eq(1).html(Lang.Menus.linebreak_on_desc_3)); -Entry.playground.setFontAlign(Entry.playground.object.entity.getTextAlign());b=Entry.playground.object.entity.getFontSize();Entry.playground.fontSizeIndiciator.style.width=b+"%";Entry.playground.fontSizeKnob.style.left=.88*b+"px"}};Entry.Playground.prototype.injectSound=function(){var b=this.soundListView_;if(b){for(;b.hasChildNodes();)b.removeChild(b.lastChild);if(this.object)for(var a=this.object.sounds,c=0,d=a.length;c>>>>>> entrylabs/master From 1d153df44af55a9c41cb659ef5ebca8123a34922 Mon Sep 17 00:00:00 2001 From: cobl Date: Tue, 9 Aug 2016 15:11:59 +0900 Subject: [PATCH 08/15] cool merge latest --- dist/entry.js | 2243 +++++++++++---------------------------------- dist/entry.min.js | 1429 +---------------------------- src/hw.js | 24 +- 3 files changed, 585 insertions(+), 3111 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index 79315c8fd0..43535987cf 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -7158,6 +7158,9 @@ Entry.isMobile = function() { Entry.Utils.convertMouseEvent = function(a) { return a.originalEvent && a.originalEvent.touches ? a.originalEvent.touches[0] : a; }; +Entry.Utils.convertIntToHex = function(a) { + return a.toString(16).toUpperCase(); +}; Entry.Model = function(a, b) { var c = Entry.Model; c.generateSchema(a); @@ -8437,20 +8440,10 @@ Entry.Engine.prototype.fireEventOnEntity = function(a, b) { Entry.Engine.prototype.raiseEventOnEntity = function(a, b) { a === b[0] && a.parent.script.raiseEvent(b[1], a); }; -<<<<<<< HEAD -Entry.Engine.prototype.pushQueue = function(a, b) { - a === b[0] && this.queue.push({eventName:b[1], entity:a}); -}; Entry.Engine.prototype.captureKeyEvent = function(a) { var b = a.keyCode, c = Entry.type; a.ctrlKey && "workspace" == c ? 83 == b ? (a.preventDefault(), Entry.dispatchEvent("saveWorkspace")) : 82 == b ? (a.preventDefault(), Entry.engine.run()) : 90 == b && (a.preventDefault(), console.log("engine"), Entry.dispatchEvent(a.shiftKey ? "redo" : "undo")) : Entry.engine.isState("run") && Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent, ["keyPress", b]); Entry.engine.isState("stop") && "workspace" === c && 37 <= b && 40 >= b && Entry.stage.moveSprite(a); -======= -Entry.Engine.prototype.captureKeyEvent = function(b) { - var a = b.keyCode, c = Entry.type; - b.ctrlKey && "workspace" == c ? 83 == a ? (b.preventDefault(), Entry.dispatchEvent("saveWorkspace")) : 82 == a ? (b.preventDefault(), Entry.engine.run()) : 90 == a && (b.preventDefault(), console.log("engine"), Entry.dispatchEvent(b.shiftKey ? "redo" : "undo")) : Entry.engine.isState("run") && Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent, ["keyPress", a]); - Entry.engine.isState("stop") && "workspace" === c && 37 <= a && 40 >= a && Entry.stage.moveSprite(b); ->>>>>>> entrylabs/master }; Entry.Engine.prototype.raiseKeyEvent = function(a, b) { return a.parent.script.raiseEvent(b[0], a, String(b[1])); @@ -8520,21 +8513,9 @@ Entry.Engine.prototype.updateProjectTimer = function(a) { "undefined" == typeof a ? c.isPaused || b.isState("pause") || c.setValue((d - c.start - c.pausedTime) / 1E3) : (c.setValue(a), c.pausedTime = 0, c.start = d); } }; -<<<<<<< HEAD -Entry.Engine.prototype.executeQueue = function() { - this.queue.forEach(function(a) { - a.entity.parent.script.raiseEvent(a.eventName, a.entity); - }.bind(this)); - this.queue = []; -}; Entry.EntityObject = function(a) { this.parent = a; this.type = a.objectType; -======= -Entry.EntityObject = function(b) { - this.parent = b; - this.type = b.objectType; ->>>>>>> entrylabs/master this.flip = !1; this.collision = Entry.Utils.COLLISION.NONE; this.id = Entry.generateHash(); @@ -8877,13 +8858,8 @@ Entry.EntityObject.prototype.setImage = function(a) { this.setScaleY(this.scaleY); this.setRegX(this.width / 2 + d); this.setRegY(this.height / 2 + e); -<<<<<<< HEAD var f = a.id + this.id, g = Entry.container.getCachedPicture(f); - g ? (Entry.image = g, this.object.image = g, this.object.cache(0, 0, this.getWidth(), this.getHeight())) : (g = new Image, a.fileurl ? g.src = a.fileurl : (a = a.filename, g.src = Entry.defaultPath + "/uploads/" + a.substring(0, 2) + "/" + a.substring(2, 4) + "/image/" + a + ".png"), g.onload = function(a) { -======= - var f = b.id + this.id, g = Entry.container.getCachedPicture(f); - g ? (Entry.image = g, this.object.image = g, this.object.cache(0, 0, this.getWidth(), this.getHeight())) : (this.object.cache(0, 0, this.getWidth(), this.getHeight()), g = new Image, b.fileurl ? g.src = b.fileurl : (b = b.filename, g.src = Entry.defaultPath + "/uploads/" + b.substring(0, 2) + "/" + b.substring(2, 4) + "/image/" + b + ".png"), g.onload = function(b) { ->>>>>>> entrylabs/master + g ? (Entry.image = g, this.object.image = g, this.object.cache(0, 0, this.getWidth(), this.getHeight())) : (this.object.cache(0, 0, this.getWidth(), this.getHeight()), g = new Image, a.fileurl ? g.src = a.fileurl : (a = a.filename, g.src = Entry.defaultPath + "/uploads/" + a.substring(0, 2) + "/" + a.substring(2, 4) + "/image/" + a + ".png"), g.onload = function(a) { Entry.container.cachePicture(f, g); Entry.image = g; b.object.image = g; @@ -8892,71 +8868,39 @@ Entry.EntityObject.prototype.setImage = function(a) { }); Entry.dispatchEvent("updateObject"); }; -<<<<<<< HEAD -Entry.EntityObject.prototype.applyFilter = function() { - var a = this.effect, b = this.object; - (function(b, a) { - for (var e in b) { - if (b[e] !== a[e]) { -======= -Entry.EntityObject.prototype.applyFilter = function(b) { - function a(a, b) { - for (var c in a) { - if (a[c] !== b[c]) { ->>>>>>> entrylabs/master +Entry.EntityObject.prototype.applyFilter = function(a) { + function b(b, a) { + for (var c in b) { + if (b[c] !== a[c]) { return !1; } } return !0; -<<<<<<< HEAD - })(a, this.getInitialEffectValue()) || (function(b, a) { - var e = [], f = Entry.adjustValueWithMaxMin; - b.brightness = b.brightness; - var g = new createjs.ColorMatrix; - g.adjustColor(f(b.brightness, -100, 100), 0, 0, 0); - g = new createjs.ColorMatrixFilter(g); - e.push(g); - b.hue = b.hue.mod(360); - g = new createjs.ColorMatrix; - g.adjustColor(0, 0, 0, b.hue); - g = new createjs.ColorMatrixFilter(g); - e.push(g); - var g = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1], h = 10.8 * b.hsv * Math.PI / 180, k = Math.cos(h), h = Math.sin(h), l = Math.abs(b.hsv / 100); - 1 < l && (l -= Math.floor(l)); - 0 < l && .33 >= 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); - a.alpha = b.alpha = f(b.alpha, 0, 1); - a.filters = e; - }(a, b), b.cache(0, 0, this.getWidth(), this.getHeight()), Entry.requestUpdate = !0); -======= } var c = this.effect, d = this.object; - if (b || !a(c, this.getInitialEffectValue())) { - (function(a, b) { + if (a || !b(c, this.getInitialEffectValue())) { + (function(b, a) { var c = [], d = Entry.adjustValueWithMaxMin; - a.brightness = a.brightness; + b.brightness = b.brightness; var k = new createjs.ColorMatrix; - k.adjustColor(d(a.brightness, -100, 100), 0, 0, 0); + k.adjustColor(d(b.brightness, -100, 100), 0, 0, 0); k = new createjs.ColorMatrixFilter(k); c.push(k); - a.hue = a.hue.mod(360); + b.hue = b.hue.mod(360); k = new createjs.ColorMatrix; - k.adjustColor(0, 0, 0, a.hue); + k.adjustColor(0, 0, 0, b.hue); k = new createjs.ColorMatrixFilter(k); c.push(k); - var k = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1], l = 10.8 * a.hsv * Math.PI / 180, n = Math.cos(l), l = Math.sin(l), m = Math.abs(a.hsv / 100); + var k = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1], l = 10.8 * b.hsv * Math.PI / 180, n = Math.cos(l), l = Math.sin(l), m = Math.abs(b.hsv / 100); 1 < m && (m -= Math.floor(m)); 0 < m && .33 >= m ? k = [1, 0, 0, 0, 0, 0, n, l, 0, 0, 0, -1 * l, n, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1] : .66 >= m ? k = [n, 0, l, 0, 0, 0, 1, 0, 0, 0, l, 0, n, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1] : .99 >= m && (k = [n, l, 0, 0, 0, -1 * l, n, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1]); k = (new createjs.ColorMatrix).concat(k); k = new createjs.ColorMatrixFilter(k); c.push(k); - b.alpha = a.alpha = d(a.alpha, 0, 1); - b.filters = c; + a.alpha = b.alpha = d(b.alpha, 0, 1); + a.filters = c; })(c, d), d.cache(0, 0, this.getWidth(), this.getHeight()), Entry.requestUpdate = !0; } ->>>>>>> entrylabs/master }; 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); @@ -9361,7 +9305,6 @@ Entry.HWMonitor = function(a) { this.scale = .5; this._listPortViews = {}; }; -<<<<<<< HEAD (function(a) { a.initView = function() { this.svgDom = Entry.Dom($('')); @@ -9383,44 +9326,6 @@ Entry.HWMonitor = function(a) { var e = this.generatePortView(b[d], "_svgGroup"); this._portViews[d] = e; a.push(e); -======= -Entry.EntryObject = function(b) { - var a = this; - if (b) { - this.id = b.id; - this.name = b.name || b.sprite.name; - this.text = b.text || this.name; - this.objectType = b.objectType; - this.objectType || (this.objectType = "sprite"); - this.script = new Entry.Code(b.script ? b.script : [], this); - this.pictures = b.sprite.pictures; - this.sounds = []; - this.sounds = b.sprite.sounds; - for (var c = 0;c < this.sounds.length;c++) { - this.sounds[c].id || (this.sounds[c].id = Entry.generateHash()), Entry.initSound(this.sounds[c]); - } - this.lock = b.lock ? b.lock : !1; - this.isEditing = !1; - "sprite" == this.objectType && (this.selectedPicture = b.selectedPictureId ? this.getPicture(b.selectedPictureId) : this.pictures[0]); - this.scene = Entry.scene.getSceneById(b.scene) || Entry.scene.selectedScene; - this.setRotateMethod(b.rotateMethod); - this.entity = new Entry.EntityObject(this); - this.entity.injectModel(this.selectedPicture ? this.selectedPicture : null, b.entity ? b.entity : this.initEntity(b)); - this.clonedEntities = []; - Entry.stage.loadObject(this); - for (c in this.pictures) { - var d = this.pictures[c]; - d.objectId = this.id; - d.id || (d.id = Entry.generateHash()); - var e = new Image; - d.fileurl ? e.src = d.fileurl : d.fileurl ? e.src = d.fileurl : (b = d.filename, e.src = Entry.defaultPath + "/uploads/" + b.substring(0, 2) + "/" + b.substring(2, 4) + "/image/" + b + ".png"); - Entry.Loader.addQueue(); - e.onload = function(b) { - Entry.container.cachePicture(d.id + a.entity.id, e); - Entry.Loader.removeQueue(); - Entry.requestUpdate = !0; - }; ->>>>>>> entrylabs/master } a.sort(function(b, a) { return b.box.x - a.box.x; @@ -9641,7 +9546,7 @@ Entry.HW = function() { this.settingQueue = {}; this.socketType = this.hwModule = this.selectedDevice = null; Entry.addEventListener("stop", this.setZero); - this.hwInfo = {11:Entry.Arduino, 19:Entry.ArduinoExt, 12:Entry.SensorBoard, 13:Entry.CODEino, 14:Entry.joystick, 15:Entry.dplay, 16:Entry.nemoino, 17:Entry.Xbot, 18:Entry.ardublock, 110:Entry.Cobl, 24:Entry.Hamster, 25:Entry.Albert, 31:Entry.Bitbrick, 42:Entry.Arduino, 51:Entry.Neobot, 71:Entry.Robotis_carCont, 72:Entry.Robotis_openCM70, 81:Entry.Arduino}; + this.hwInfo = {"1.1":Entry.Arduino, "1.9":Entry.ArduinoExt, "1.2":Entry.SensorBoard, "1.3":Entry.CODEino, "1.4":Entry.joystick, "1.5":Entry.dplay, "1.6":Entry.nemoino, "1.7":Entry.Xbot, "1.8":Entry.ardublock, "1.A":Entry.Cobl, "2.4":Entry.Hamster, "2.5":Entry.Albert, "3.1":Entry.Bitbrick, "4.2":Entry.Arduino, "5.1":Entry.Neobot, "7.1":Entry.Robotis_carCont, "7.2":Entry.Robotis_openCM70, "8.1":Entry.Arduino}; }; Entry.HW.TRIAL_LIMIT = 1; p = Entry.HW.prototype; @@ -9743,15 +9648,9 @@ p.removePortReadable = function(a) { p.update = function() { this.socket && 1 == this.socket.readyState && this.socket.send(JSON.stringify(this.sendQueue)); }; -<<<<<<< HEAD p.updatePortData = function(a) { this.portData = a; this.hwMonitor && "hw" == Entry.propertyPanel.selected && this.hwMonitor.update(); -======= -Entry.EntryObject.prototype.addCloneEntity = function(b, a, c) { - this.clonedEntities.length > Entry.maxCloneLimit || (b = new Entry.EntityObject(this), a ? (b.injectModel(a.picture ? a.picture : null, a.toJSON()), b.snapshot_ = a.snapshot_, a.effect && (b.effect = Entry.cloneSimpleObject(a.effect), b.applyFilter()), a.brush && Entry.setCloneBrush(b, a.brush)) : (b.injectModel(this.entity.picture ? this.entity.picture : null, this.entity.toJSON(b)), b.snapshot_ = this.entity.snapshot_, this.entity.effect && (b.effect = Entry.cloneSimpleObject(this.entity.effect), - b.applyFilter()), this.entity.brush && Entry.setCloneBrush(b, this.entity.brush)), Entry.engine.raiseEventOnEntity(b, [b, "when_clone_start"]), b.isClone = !0, b.isStarted = !0, this.addCloneVariables(this, b, a ? a.variables : null, a ? a.lists : null), this.clonedEntities.push(b), Entry.stage.loadEntity(b)); ->>>>>>> entrylabs/master }; p.closeConnection = function() { this.socket && this.socket.close(); @@ -9766,8 +9665,8 @@ p.setZero = function() { Entry.hw.hwModule && Entry.hw.hwModule.setZero(); }; p.checkDevice = function(a) { - void 0 !== a.company && (a = "" + a.company + a.model, a != this.selectedDevice && (this.selectedDevice = a, this.hwModule = this.hwInfo[a], 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), a = this.hwModule.monitorTemplate, "both" == a.mode ? (a.mode = "list", this.hwMonitor.generateListView(), a.mode = "general", this.hwMonitor.generateView(), a.mode = "both") : "list" == a.mode ? this.hwMonitor.generateListView() : this.hwMonitor.generateView()))); + void 0 !== a.company && (a = [Entry.Utils.convertIntToHex(a.company), ".", Entry.Utils.convertIntToHex(a.model)].join(""), a != this.selectedDevice && (this.selectedDevice = a, this.hwModule = this.hwInfo[a], 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), a = this.hwModule.monitorTemplate, "both" == a.mode ? (a.mode = "list", this.hwMonitor.generateListView(), a.mode = "general", this.hwMonitor.generateView(), a.mode = "both") : "list" == a.mode ? this.hwMonitor.generateListView() : this.hwMonitor.generateView()))); }; p.banHW = function() { var a = this.hwInfo, b; @@ -10174,6 +10073,7 @@ Entry.ThreadModel = function() { }; Entry.ThreadModel.prototype.schema = {id:0, type:Entry.STATIC.THREAD_MODEL, x:0, y:0, width:0, minWidth:0, height:0}; Entry.EntryObject = function(a) { + var b = this; if (a) { this.id = a.id; this.name = a.name || a.sprite.name; @@ -10184,8 +10084,8 @@ Entry.EntryObject = function(a) { this.pictures = a.sprite.pictures; this.sounds = []; this.sounds = a.sprite.sounds; - for (var b = 0;b < this.sounds.length;b++) { - this.sounds[b].id || (this.sounds[b].id = Entry.generateHash()), Entry.initSound(this.sounds[b]); + for (var c = 0;c < this.sounds.length;c++) { + this.sounds[c].id || (this.sounds[c].id = Entry.generateHash()), Entry.initSound(this.sounds[c]); } this.lock = a.lock ? a.lock : !1; this.isEditing = !1; @@ -10196,15 +10096,15 @@ Entry.EntryObject = function(a) { this.entity.injectModel(this.selectedPicture ? this.selectedPicture : null, a.entity ? a.entity : this.initEntity(a)); this.clonedEntities = []; Entry.stage.loadObject(this); - for (b in this.pictures) { - var c = this.pictures[b]; - c.objectId = this.id; - c.id || (c.id = Entry.generateHash()); - var d = new Image; - c.fileurl ? d.src = c.fileurl : c.fileurl ? d.src = c.fileurl : (a = c.filename, d.src = Entry.defaultPath + "/uploads/" + a.substring(0, 2) + "/" + a.substring(2, 4) + "/image/" + a + ".png"); + for (c in this.pictures) { + var d = this.pictures[c]; + d.objectId = this.id; + d.id || (d.id = Entry.generateHash()); + var e = new Image; + d.fileurl ? e.src = d.fileurl : d.fileurl ? e.src = d.fileurl : (a = d.filename, e.src = Entry.defaultPath + "/uploads/" + a.substring(0, 2) + "/" + a.substring(2, 4) + "/image/" + a + ".png"); Entry.Loader.addQueue(); - d.onload = function(b) { - Entry.container.cachePicture(c.id, d); + e.onload = function(a) { + Entry.container.cachePicture(d.id + b.entity.id, e); Entry.Loader.removeQueue(); Entry.requestUpdate = !0; }; @@ -10714,7 +10614,7 @@ Entry.EntryObject.prototype.toggleInformation = function(a) { }; Entry.EntryObject.prototype.addCloneEntity = function(a, b, c) { this.clonedEntities.length > Entry.maxCloneLimit || (a = new Entry.EntityObject(this), b ? (a.injectModel(b.picture ? b.picture : null, b.toJSON()), a.snapshot_ = b.snapshot_, b.effect && (a.effect = Entry.cloneSimpleObject(b.effect), a.applyFilter()), b.brush && Entry.setCloneBrush(a, b.brush)) : (a.injectModel(this.entity.picture ? this.entity.picture : null, this.entity.toJSON(a)), a.snapshot_ = this.entity.snapshot_, this.entity.effect && (a.effect = Entry.cloneSimpleObject(this.entity.effect), - a.applyFilter()), this.entity.brush && Entry.setCloneBrush(a, this.entity.brush)), Entry.engine.pushQueue(a, [a, "when_clone_start"]), a.isClone = !0, a.isStarted = !0, this.addCloneVariables(this, a, b ? b.variables : null, b ? b.lists : null), this.clonedEntities.push(a), Entry.stage.loadEntity(a)); + a.applyFilter()), this.entity.brush && Entry.setCloneBrush(a, this.entity.brush)), Entry.engine.raiseEventOnEntity(a, [a, "when_clone_start"]), a.isClone = !0, a.isStarted = !0, this.addCloneVariables(this, a, b ? b.variables : null, b ? b.lists : null), this.clonedEntities.push(a), Entry.stage.loadEntity(a)); }; Entry.EntryObject.prototype.initializeSplitter = function(a) { a.onmousedown = function(b) { @@ -11309,7 +11209,6 @@ Entry.Painter.prototype.fill = function() { this.reloadContext(); } }; -<<<<<<< HEAD Entry.Painter.prototype.reloadContext = function() { delete this.selectedObject; this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height); @@ -11333,31 +11232,6 @@ Entry.Painter.prototype.move_pen = function() { this.oldMidPt.y = a.y; this.file.modified = !0; this.stage.update(); -======= -Entry.StampEntity = function(b, a) { - this.parent = b; - this.type = b.objectType; - this.isStamp = this.isClone = !0; - this.width = a.getWidth(); - this.height = a.getHeight(); - "sprite" == this.type && (this.object = a.object.clone(!0), this.object.filters = null, a.effect && (this.effect = Entry.cloneSimpleObject(a.effect), this.applyFilter())); - this.object.entity = this; -}; -(function(b, a) { - b.applyFilter = a.applyFilter; - b.removeClone = a.removeClone; - b.getWidth = a.getWidth; - b.getHeight = a.getHeight; - b.getInitialEffectValue = a.getInitialEffectValue; -})(Entry.StampEntity.prototype, Entry.EntityObject.prototype); -Entry.Toast = function() { - this.toasts_ = []; - var b = document.getElementById("entryToastContainer"); - b && document.body.removeChild(b); - this.body_ = Entry.createElement("div", "entryToastContainer"); - this.body_.addClass("entryToastContainer"); - document.body.appendChild(this.body_); ->>>>>>> entrylabs/master }; Entry.Painter.prototype.move_line = function() { this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness, "round").moveTo(this.oldPt.x, this.oldPt.y).lineTo(this.stage.mouseX, this.stage.mouseY); @@ -11556,262 +11430,6 @@ Entry.Painter.prototype.initDashedLine = function() { this.dashedLineTo(a, d - f, a, b + f, e); return this; }; -<<<<<<< HEAD -======= - b.setColour = function(a) { - this.color = a; - }; - b.setInputsInline = function() { - }; - b.setOutput = function(a, b) { - a && (this.output = b); - }; - b.setPreviousStatement = function(a) { - this.isPrev = a; - }; - b.setNextStatement = function(a) { - this.isNext = a; - }; - b.setEditable = function(a) { - }; - b.getFieldCount = function() { - this.fieldCount++; - return "%" + this.fieldCount; - }; - b._addToParamsKeyMap = function(a) { - a = a ? a : "dummy_" + Entry.Utils.generateId(); - var b = this.paramsKeyMap; - b[a] = Object.keys(b).length; - }; - b._addToStatementsKeyMap = function(a) { - a = a ? a : "dummy_" + Entry.Utils.generateId(); - var b = this.statementsKeyMap; - b[a] = Object.keys(b).length; - }; -})(Entry.BlockMockup.prototype); -Entry.ContextMenu = {}; -(function(b) { - b.visible = !1; - b.createDom = function() { - this.dom = Entry.Dom("ul", {id:"entry-contextmenu", parent:$("body")}); - this.dom.bind("mousedown touchstart", function(a) { - a.stopPropagation(); - }); - Entry.Utils.disableContextmenu(this.dom); - Entry.documentMousedown.attach(this, function() { - this.hide(); - }); - }; - b.show = function(a, b, d) { - this.dom || this.createDom(); - if (0 !== a.length) { - var e = this; - void 0 !== b && (this._className = b, this.dom.addClass(b)); - var f = this.dom; - f.empty(); - for (var g = 0, h = a.length;g < h;g++) { - var k = a[g], l = k.text, n = !1 !== k.enable, m = Entry.Dom("li", {parent:f}); - if (k.divider) { - b = "divider"; - } else { - b = n ? "menuAble" : "menuDisable"; - var q = Entry.Dom("span", {parent:m}); - q.text(l); - n && k.callback && function(a, b) { - a.mousedown(function(a) { - a.preventDefault(); - e.hide(); - b(a); - }); - }(q, k.callback); - } - m.addClass(b); - } - f.removeClass("entryRemove"); - this.visible = !0; - this.position(d || Entry.mouseCoordinate); - } - }; - b.position = function(a) { - var b = this.dom; - b.css({left:0, top:0}); - var d = b.width(), e = b.height(), f = $(window), g = f.width(), f = f.height(); - a.x + d > g && (a.x -= d + 3); - a.y + e > f && (a.y -= e); - b.css({left:a.x, top:a.y}); - }; - b.hide = function() { - this.visible = !1; - this.dom.empty(); - this.dom.addClass("entryRemove"); - this._className && (this.dom.removeClass(this._className), delete this._className); - }; -})(Entry.ContextMenu); -Entry.Loader = {queueCount:0, totalCount:0}; -Entry.Loader.addQueue = function(b) { - this.queueCount || Entry.dispatchEvent("loadStart"); - this.queueCount++; - this.totalCount++; -}; -Entry.Loader.removeQueue = function(b) { - this.queueCount--; - this.queueCount || (Entry.dispatchEvent("loadComplete"), this.totalCount = 0); -}; -Entry.Loader.getLoadedPercent = function() { - return 0 === this.totalCount ? 1 : this.queueCount / this.totalCount; -}; -Entry.STATIC = {OBJECT:0, ENTITY:1, SPRITE:2, SOUND:3, VARIABLE:4, FUNCTION:5, SCENE:6, MESSAGE:7, BLOCK_MODEL:8, BLOCK_RENDER_MODEL:9, BOX_MODEL:10, THREAD_MODEL:11, DRAG_INSTANCE:12, BLOCK_STATIC:0, BLOCK_MOVE:1, BLOCK_FOLLOW:2, RETURN:0, CONTINUE:1, BREAK:2, PASS:3}; -Entry.Utils = {}; -Entry.overridePrototype = function() { - Number.prototype.mod = function(b) { - return (this % b + b) % b; - }; -}; -Entry.Utils.generateId = function() { - return ("0000" + (Math.random() * Math.pow(36, 4) << 0).toString(36)).substr(-4); -}; -Entry.Utils.intersectArray = function(b, a) { - for (var c = [], d = 0;d < b.length;d++) { - for (var e = 0;e < a.length;e++) { - if (b[d] == a[e]) { - c.push(b[d]); - break; - } - } - } - return c; -}; -Entry.Utils.isPointInMatrix = function(b, a, c) { - c = void 0 === c ? 0 : c; - var d = b.offsetX ? b.x + b.offsetX : b.x, e = b.offsetY ? b.y + b.offsety : b.y; - return d - c <= a.x && d + b.width + c >= a.x && e - c <= a.y && e + b.height + c >= a.y; -}; -Entry.Utils.colorDarken = function(b, a) { - function c(a) { - 2 != a.length && (a = "0" + a); - return a; - } - var d, e, f; - 7 === b.length ? (d = parseInt(b.substr(1, 2), 16), e = parseInt(b.substr(3, 2), 16), f = parseInt(b.substr(5, 2), 16)) : (d = parseInt(b.substr(1, 2), 16), e = parseInt(b.substr(2, 2), 16), f = parseInt(b.substr(3, 2), 16)); - a = void 0 === a ? .7 : a; - d = c(Math.floor(d * a).toString(16)); - e = c(Math.floor(e * a).toString(16)); - f = c(Math.floor(f * a).toString(16)); - return "#" + d + e + f; -}; -Entry.Utils.colorLighten = function(b, a) { - a = 0 === a ? 0 : a || 20; - var c = Entry.Utils.hexToHsl(b); - c.l += a / 100; - c.l = Math.min(1, Math.max(0, c.l)); - return Entry.Utils.hslToHex(c); -}; -Entry.Utils.bound01 = function(b, a) { - var c = b; - "string" == typeof c && -1 != c.indexOf(".") && 1 === parseFloat(c) && (b = "100%"); - c = "string" === typeof b && -1 != b.indexOf("%"); - b = Math.min(a, Math.max(0, parseFloat(b))); - c && (b = parseInt(b * a, 10) / 100); - return 1E-6 > Math.abs(b - a) ? 1 : b % a / parseFloat(a); -}; -Entry.Utils.hexToHsl = function(b) { - var a, c; - 7 === b.length ? (a = parseInt(b.substr(1, 2), 16), c = parseInt(b.substr(3, 2), 16), b = parseInt(b.substr(5, 2), 16)) : (a = parseInt(b.substr(1, 2), 16), c = parseInt(b.substr(2, 2), 16), b = parseInt(b.substr(3, 2), 16)); - a = Entry.Utils.bound01(a, 255); - c = Entry.Utils.bound01(c, 255); - b = Entry.Utils.bound01(b, 255); - var d = Math.max(a, c, b), e = Math.min(a, c, b), f, g = (d + e) / 2; - if (d == e) { - f = e = 0; - } else { - var h = d - e, e = .5 < g ? h / (2 - d - e) : h / (d + e); - switch(d) { - case a: - f = (c - b) / h + (c < b ? 6 : 0); - break; - case c: - f = (b - a) / h + 2; - break; - case b: - f = (a - c) / h + 4; - } - f /= 6; - } - return {h:360 * f, s:e, l:g}; -}; -Entry.Utils.hslToHex = function(b) { - function a(a, b, c) { - 0 > c && (c += 1); - 1 < c && --c; - return c < 1 / 6 ? a + 6 * (b - a) * c : .5 > c ? b : c < 2 / 3 ? a + (b - a) * (2 / 3 - c) * 6 : a; - } - function c(a) { - return 1 == a.length ? "0" + a : "" + a; - } - var d, e; - e = Entry.Utils.bound01(b.h, 360); - d = Entry.Utils.bound01(b.s, 1); - b = Entry.Utils.bound01(b.l, 1); - if (0 === d) { - d = b = e = b; - } else { - var f = .5 > b ? b * (1 + d) : b + d - b * d, g = 2 * b - f; - d = a(g, f, e + 1 / 3); - b = a(g, f, e); - e = a(g, f, e - 1 / 3); - } - b *= 255; - e *= 255; - return "#" + [c(Math.round(255 * d).toString(16)), c(Math.round(b).toString(16)), c(Math.round(e).toString(16))].join(""); -}; -Entry.Utils.bindGlobalEvent = function(b) { - var a = $(document); - void 0 === b && (b = "resize mousedown mousemove keydown keyup dispose".split(" ")); - -1 < b.indexOf("resize") && (Entry.windowReszied && ($(window).off("resize"), Entry.windowReszied.clear()), Entry.windowResized = new Entry.Event(window), $(window).on("resize", function(a) { - Entry.windowResized.notify(a); - })); - -1 < b.indexOf("mousedown") && (Entry.documentMousedown && (a.off("mousedown"), Entry.documentMousedown.clear()), Entry.documentMousedown = new Entry.Event(window), a.on("mousedown", function(a) { - Entry.documentMousedown.notify(a); - })); - -1 < b.indexOf("mousemove") && (Entry.documentMousemove && (a.off("touchmove mousemove"), Entry.documentMousemove.clear()), Entry.mouseCoordinate = {}, Entry.documentMousemove = new Entry.Event(window), a.on("touchmove mousemove", function(a) { - a.originalEvent && a.originalEvent.touches && (a = a.originalEvent.touches[0]); - Entry.documentMousemove.notify(a); - Entry.mouseCoordinate.x = a.clientX; - Entry.mouseCoordinate.y = a.clientY; - })); - -1 < b.indexOf("keydown") && (Entry.keyPressed && (a.off("keydown"), Entry.keyPressed.clear()), Entry.pressedKeys = [], Entry.keyPressed = new Entry.Event(window), a.on("keydown", function(a) { - var b = a.keyCode; - 0 > Entry.pressedKeys.indexOf(b) && Entry.pressedKeys.push(b); - Entry.keyPressed.notify(a); - })); - -1 < b.indexOf("keyup") && (Entry.keyUpped && (a.off("keyup"), Entry.keyUpped.clear()), Entry.keyUpped = new Entry.Event(window), a.on("keyup", function(a) { - var b = Entry.pressedKeys.indexOf(a.keyCode); - -1 < b && Entry.pressedKeys.splice(b, 1); - Entry.keyUpped.notify(a); - })); - -1 < b.indexOf("dispose") && (Entry.disposeEvent && Entry.disposeEvent.clear(), Entry.disposeEvent = new Entry.Event(window), Entry.documentMousedown && Entry.documentMousedown.attach(this, function(a) { - Entry.disposeEvent.notify(a); - })); -}; -Entry.Utils.makeActivityReporter = function() { - Entry.activityReporter = new Entry.ActivityReporter; - Entry.commander && Entry.commander.addReporter(Entry.activityReporter); - return Entry.activityReporter; -}; -Entry.Utils.initEntryEvent_ = function() { - Entry.events_ || (Entry.events_ = []); -}; -Entry.sampleColours = []; -Entry.assert = function(b, a) { - if (!b) { - throw Error(a || "Assert failed"); - } -}; -Entry.parseTexttoXML = function(b) { - var a; - window.ActiveXObject ? (a = new ActiveXObject("Microsoft.XMLDOM"), a.async = "false", a.loadXML(b)) : a = (new DOMParser).parseFromString(b, "text/xml"); - return a; ->>>>>>> entrylabs/master }; Entry.Painter.prototype.generateView = function(a) { var b = this; @@ -11858,7 +11476,6 @@ Entry.Painter.prototype.generateView = function(a) { e.bindOnClick(function() { b.selectedObject && (b.selectedObject.scaleY *= -1, b.selectedObject.text ? b.selectTextObject(b.selectedObject) : b.selectObject(b.selectedObject), b.updateImageHandle(), b.stage.update()); }); -<<<<<<< HEAD e.addClass("entryPlaygroundPainterFlipY"); this.flipObject.appendChild(e); Entry.addEventListener("windowResized", function(b) { @@ -11870,205 +11487,6 @@ Entry.Painter.prototype.generateView = function(a) { f.style.height = d + "px"; g.style.top = d + 30 + "px"; g.style.height = b - d + "px"; -======= - } -}; -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", {result:"matrixOut", in:"offOut", type:"matrix", values:"0.7 0 0 0 0 0 0.7 0 0 0 0 0 0.7 0 0 0 0 0 1 0"}); - d.elem("feBlend", {in:"SourceGraphic", in1:"offOut", mode:"normal"}); - c = c.elem("filter", {id:"entryBlockHighlightFilter_" + a}); - c.elem("feOffset", {result:"offOut", in:"SourceGraphic", dx:0, dy:0}); - c.elem("feColorMatrix", {result:"matrixOut", in:"offOut", type:"matrix", values:"1.3 0 0 0 0 0 1.3 0 0 0 0 0 1.3 0 0 0 0 0 1 0"}); -}; -Entry.Utils.addBlockPattern = function(b, a) { - for (var c = b.elem("pattern", {id:"blockHoverPattern_" + a, class:"blockHoverPattern", patternUnits:"userSpaceOnUse", patternTransform:"translate(12, 0)", x:0, y:0, width:125, height:33, style:"display: none"}), d = c.elem("g"), e = d.elem("rect", {x:0, y:0, width:125, height:33}), f = Entry.mediaFilePath + "block_pattern_(order).png", g = 1;5 > g;g++) { - d.elem("image", {class:"pattern" + g, href:f.replace("(order)", g), x:0, y:0, width:125, height:33}); - } - return {pattern:c, rect:e}; -}; -Entry.Utils.COLLISION = {NONE:0, UP:1, RIGHT:2, LEFT:3, DOWN:4}; -Entry.Utils.createMouseEvent = function(b, a) { - var c = document.createEvent("MouseEvent"); - c.initMouseEvent(b, !0, !0, window, 0, 0, 0, a.clientX, a.clientY, !1, !1, !1, !1, 0, null); - return c; -}; -Entry.Utils.xmlToJsonData = function(b) { - b = $.parseXML(b); - var a = []; - b = b.childNodes[0].childNodes; - for (var c in b) { - var d = b[c]; - if (d.tagName) { - var e = {category:d.getAttribute("id"), blocks:[]}, d = d.childNodes; - for (c in d) { - var f = d[c]; - f.tagName && (f = f.getAttribute("type")) && e.blocks.push(f); - } - a.push(e); - } - } - return a; -}; -Entry.Utils.stopProjectWithToast = function(b, a, c) { - var d = b.block; - a = a || "\ub7f0\ud0c0\uc784 \uc5d0\ub7ec \ubc1c\uc0dd"; - Entry.toast && !c && Entry.toast.alert(Lang.Msgs.warn, Lang.Workspace.check_runtime_error, !0); - Entry.engine && Entry.engine.toggleStop(); - "workspace" === Entry.type && (b.block && "funcBlock" in b.block ? d = b.block.funcBlock : b.funcExecutor && (d = b.funcExecutor.scope.block, b = b.type.replace("func_", ""), Entry.Func.edit(Entry.variableContainer.functions_[b])), d && (Entry.container.selectObject(d.getCode().object.id, !0), d.view.getBoard().activateBlock(d))); - throw Error(a); -}; -Entry.Utils.AsyncError = function(b) { - this.name = "AsyncError"; - this.message = b || "\ube44\ub3d9\uae30 \ud638\ucd9c \ub300\uae30"; -}; -Entry.Utils.AsyncError.prototype = Error(); -Entry.Utils.AsyncError.prototype.constructor = Entry.Utils.AsyncError; -Entry.Utils.isChrome = function() { - return /chrom(e|ium)/.test(navigator.userAgent.toLowerCase()); -}; -Entry.Utils.waitForWebfonts = function(b, a) { - for (var c = 0, d = 0, e = b.length;d < e;++d) { - (function(d) { - function e() { - h && h.offsetWidth != k && (++c, h.parentNode.removeChild(h), h = null); - if (c >= b.length && (l && clearInterval(l), c == b.length)) { - return a(), !0; - } - } - var h = document.createElement("span"); - h.innerHTML = "giItT1WQy@!-/#"; - h.style.position = "absolute"; - h.style.left = "-10000px"; - h.style.top = "-10000px"; - h.style.fontSize = "300px"; - h.style.fontFamily = "sans-serif"; - h.style.fontVariant = "normal"; - h.style.fontStyle = "normal"; - h.style.fontWeight = "normal"; - h.style.letterSpacing = "0"; - document.body.appendChild(h); - var k = h.offsetWidth; - h.style.fontFamily = d; - var l; - e() || (l = setInterval(e, 50)); - })(b[d]); - } -}; -window.requestAnimFrame = function() { - return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(b) { - window.setTimeout(b, 1E3 / 60); - }; -}(); -Entry.isMobile = function() { - if (Entry.device) { - return "tablet" === Entry.device; - } - var b = window.platform; - if (b && b.type && ("tablet" === b.type || "mobile" === b.type)) { - return Entry.device = "tablet", !0; - } - Entry.device = "desktop"; - return !1; -}; -Entry.Utils.convertMouseEvent = function(b) { - return b.originalEvent && b.originalEvent.touches ? b.originalEvent.touches[0] : b; -}; -Entry.Utils.convertIntToHex = function(b) { - return b.toString(16).toUpperCase(); -}; -Entry.Model = function(b, a) { - var c = Entry.Model; - c.generateSchema(b); - c.generateSetter(b); - c.generateObserve(b); - (void 0 === a || a) && Object.seal(b); - return b; -}; -(function(b) { - b.generateSchema = function(a) { - var b = a.schema; - if (void 0 !== b) { - b = JSON.parse(JSON.stringify(b)); - a.data = {}; - for (var d in b) { - (function(d) { - a.data[d] = b[d]; - Object.defineProperty(a, d, {get:function() { - return a.data[d]; - }}); - })(d); - } - a._toJSON = this._toJSON; - } - }; - b.generateSetter = function(a) { - a.set = this.set; - }; - b.set = function(a, b) { - var d = {}, e; - for (e in this.data) { - void 0 !== a[e] && (a[e] === this.data[e] ? delete a[e] : (d[e] = this.data[e], this.data[e] = a[e] instanceof Array ? a[e].concat() : a[e])); - } - b || this.notify(Object.keys(a), d); - }; - b.generateObserve = function(a) { - a.observers = []; - a.observe = this.observe; - a.unobserve = this.unobserve; - a.notify = this.notify; - }; - b.observe = function(a, b, d, e) { - d = new Entry.Observer(this.observers, a, b, d); - if (!1 !== e) { - a[b]([]); - } - return d; - }; - b.unobserve = function(a) { - a.destroy(); - }; - b.notify = function(a, b) { - "string" === typeof a && (a = [a]); - var d = this; - d.observers.map(function(e) { - var f = a; - void 0 !== e.attrs && (f = Entry.Utils.intersectArray(e.attrs, a)); - if (f.length) { - e.object[e.funcName](f.map(function(a) { - return {name:a, object:d, oldValue:b[a]}; - })); - } ->>>>>>> entrylabs/master }); var h = Entry.createElement("nav", "entryPainterTopMenu"); h.addClass("entryPlaygroundPainterTopMenu"); @@ -12106,7 +11524,6 @@ Entry.Model = function(b, a) { b.file.mode = "new"; b.file_save(!1); }); -<<<<<<< HEAD k.addClass("entryPlaygroundPainterTopMenuFileSaveAs"); k.innerHTML = Lang.Workspace.painter_file_saveas; h.appendChild(k); @@ -12272,352 +11689,6 @@ Entry.Model = function(b, a) { } b.handle.width = this.value; b.updateImageHandle(); -======= - this.resizeList(); - }; - b.generatePortView = function(a, b) { - var d = this[b].elem("g"); - d.addClass("hwComponent"); - var e = null, e = this.pathGroup.elem("path").attr({d:"m0,0", fill:"none", stroke:"input" === a.type ? "#00979d" : "#A751E3", "stroke-width":3}), f = d.elem("rect").attr({x:0, y:0, width:150, height:22, rx:4, ry:4, fill:"#fff", stroke:"#a0a1a1"}), g = d.elem("text").attr({x:4, y:12, fill:"#000", "class":"hwComponentName", "alignment-baseline":"central"}); - g.textContent = a.name; - g = g.getComputedTextLength(); - d.elem("rect").attr({x:g + 8, y:2, width:30, height:18, rx:9, ry:9, fill:"input" === a.type ? "#00979d" : "#A751E3"}); - var h = d.elem("text").attr({x:g + 13, y:12, fill:"#fff", "class":"hwComponentValue", "alignment-baseline":"central"}); - h.textContent = 0; - g += 40; - f.attr({width:g}); - return {group:d, value:h, type:a.type, path:e, box:{x:a.pos.x - this._template.width / 2, y:a.pos.y - this._template.height / 2, width:g}, width:g}; - }; - b.getView = function() { - return this.svgDom; - }; - b.update = function() { - var a = Entry.hw.portData, b = Entry.hw.sendQueue, d = this._hwModule.monitorTemplate.mode, e = this._hwModule.monitorTemplate.keys || [], f = []; - if ("list" == d) { - f = this._listPortViews; - } else { - if ("both" == d) { - if (f = this._listPortViews, this._portViews) { - for (var g in this._portViews) { - f[g] = this._portViews[g]; - } - } - } else { - f = this._portViews; - } - } - if (b) { - for (g in b) { - 0 != b[g] && f[g] && (f[g].type = "output"); - } - } - for (var h in f) { - if (d = f[h], "input" == d.type) { - var k = a[h]; - 0 < e.length && $.each(e, function(a, b) { - if ($.isPlainObject(k)) { - k = k[b] || 0; - } else { - return !1; - } - }); - d.value.textContent = k ? k : 0; - d.group.getElementsByTagName("rect")[1].attr({fill:"#00979D"}); - } else { - k = b[h], 0 < e.length && $.each(e, function(a, b) { - if ($.isPlainObject(k)) { - k = k[b] || 0; - } else { - return !1; - } - }), d.value.textContent = k ? k : 0, d.group.getElementsByTagName("rect")[1].attr({fill:"#A751E3"}); - } - } - }; - b.resize = function() { - this.hwView && this.hwView.attr({transform:"scale(" + this.scale + ")"}); - if (this.svgDom) { - var a = this.svgDom.get(0).getBoundingClientRect() - } - this._svgGroup.attr({transform:"translate(" + a.width / 2 + "," + a.height / 1.8 + ")"}); - this._rect = a; - 0 >= this._template.height || 0 >= a.height || (this.scale = a.height / this._template.height * this._template.height / 1E3, this.align()); - }; - b.resizeList = function() { - var a = this.svgDom.get(0).getBoundingClientRect(); - this._svglistGroup.attr({transform:"translate(" + a.width / 2 + "," + a.height / 2 + ")"}); - this._rect = a; - this.alignList(); - }; - b.align = function() { - var a = [], a = this._portMap.s.concat(); - this._alignNS(a, this.scale / 3 * this._template.height + 5, 27); - a = this._portMap.n.concat(); - this._alignNS(a, -this._template.height * this.scale / 3 - 32, -27); - a = this._portMap.e.concat(); - this._alignEW(a, -this._template.width * this.scale / 3 - 5, -27); - a = this._portMap.w.concat(); - this._alignEW(a, this._template.width * this.scale / 3 - 32, -27); - }; - b.alignList = function() { - for (var a = {}, a = this._hwModule.monitorTemplate.listPorts, b = a.length, d = 0;d < a.length;d++) { - a[d].group.attr({transform:"translate(" + this._template.width * (d / b - .5) + "," + (-this._template.width / 2 - 30) + ")"}); - } - a = this._portMapList.n.concat(); - this._alignNSList(a, -this._template.width * this.scale / 2 - 32, -27); - }; - b._alignEW = function(a, b, d) { - var e = a.length, f = this._rect.height - 50; - tP = -f / 2; - bP = f / 2; - height = this._rect.height; - listVLine = wholeHeight = 0; - mode = this._hwModule.monitorTemplate; - for (f = 0;f < e;f++) { - wholeHeight += a[f].height + 5; - } - wholeHeight < bP - tP && (bP = wholeHeight / 2 + 3, tP = -wholeHeight / 2 - 3); - for (;1 < e;) { - var g = a.shift(), f = a.pop(), h = tP, k = bP, l = d; - wholeWidth <= bP - tP ? (tP += g.width + 5, bP -= f.width + 5, l = 0) : 0 === a.length ? (tP = (tP + bP) / 2 - 3, bP = tP + 6) : (tP = Math.max(tP, -width / 2 + g.width) + 15, bP = Math.min(bP, width / 2 - f.width) - 15); - wholeWidth -= g.width + f.width + 10; - b += l; - } - a.length && a[0].group.attr({transform:"translate(" + b + ",60)"}); - g && rPort && (this._movePort(g, b, tP, h), this._movePort(rPort, b, bP, k)); - }; - b._alignNS = function(a, b, d) { - for (var e = -this._rect.width / 2, f = this._rect.width / 2, g = this._rect.width, h = 0, k = 0;k < a.length;k++) { - h += a[k].width + 5; - } - h < f - e && (f = h / 2 + 3, e = -h / 2 - 3); - for (;1 < a.length;) { - var k = a.shift(), l = a.pop(), n = e, m = f, q = d; - h <= f - e ? (e += k.width + 5, f -= l.width + 5, q = 0) : 0 === a.length ? (e = (e + f) / 2 - 3, f = e + 6) : (e = Math.max(e, -g / 2 + k.width) + 15, f = Math.min(f, g / 2 - l.width) - 15); - this._movePort(k, e, b, n); - this._movePort(l, f, b, m); - h -= k.width + l.width + 10; - b += q; - } - a.length && this._movePort(a[0], (f + e - a[0].width) / 2, b, 100); - }; - b._alignNSList = function(a, b) { - var d = this._rect.width; - initX = -this._rect.width / 2 + 10; - initY = -this._rect.height / 2 + 10; - for (var e = listLine = wholeWidth = 0;e < a.length;e++) { - wholeWidth += a[e].width; - } - for (var f = 0, g = 0, h = initX, k = 0, l = 0, n = 0, e = 0;e < a.length;e++) { - l = a[e], e != a.length - 1 && (n = a[e + 1]), g += l.width, lP = initX, k = initY + 30 * f, l.group.attr({transform:"translate(" + lP + "," + k + ")"}), initX += l.width + 10, g > d - (l.width + n.width / 2.2) && (f += 1, initX = h, g = 0); - } - }; - b._movePort = function(a, b, d, e) { - var f = b, g = a.box.x * this.scale, h = a.box.y * this.scale; - b > e ? (f = b - a.width, b = b > g && g > e ? "M" + g + "," + d + "L" + g + "," + h : "M" + (b + e) / 2 + "," + d + "l0," + (h > d ? 28 : -3) + "H" + g + "L" + g + "," + h) : b = b < g && g < e ? "m" + g + "," + d + "L" + g + "," + h : "m" + (e + b) / 2 + "," + d + "l0," + (h > d ? 28 : -3) + "H" + g + "L" + g + "," + h; - a.group.attr({transform:"translate(" + f + "," + d + ")"}); - a.path.attr({d:b}); - }; -})(Entry.HWMonitor.prototype); -Entry.HW = function() { - this.connectTrial = 0; - this.isFirstConnect = !0; - this.initSocket(); - this.connected = !1; - this.portData = {}; - this.sendQueue = {}; - this.outputQueue = {}; - this.settingQueue = {}; - this.socketType = this.hwModule = this.selectedDevice = null; - Entry.addEventListener("stop", this.setZero); - this.hwInfo = {"1.1":Entry.Arduino, "1.9":Entry.ArduinoExt, "1.2":Entry.SensorBoard, "1.3":Entry.CODEino, "1.4":Entry.joystick, "1.5":Entry.dplay, "1.6":Entry.nemoino, "1.7":Entry.Xbot, "1.8":Entry.ardublock, "2.4":Entry.Hamster, "2.5":Entry.Albert, "3.1":Entry.Bitbrick, "4.2":Entry.Arduino, "5.1":Entry.Neobot, "7.1":Entry.Robotis_carCont, "7.2":Entry.Robotis_openCM70, "8.1":Entry.Arduino}; -}; -Entry.HW.TRIAL_LIMIT = 1; -p = Entry.HW.prototype; -p.initSocket = function() { - try { - if (this.connectTrial >= Entry.HW.TRIAL_LIMIT) { - this.isFirstConnect || Entry.toast.alert(Lang.Menus.connect_hw, Lang.Menus.connect_fail, !1), this.isFirstConnect = !1; - } else { - var b = this, a, c; - this.connected = !1; - this.connectTrial++; - if (-1 < location.protocol.indexOf("https")) { - c = new WebSocket("wss://hardware.play-entry.org:23518"); - } else { - try { - a = new WebSocket("ws://127.0.0.1:23518"), a.binaryType = "arraybuffer", a.onopen = function() { - b.socketType = "WebSocket"; - b.initHardware(a); - }.bind(this), a.onmessage = function(a) { - a = 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.updatePortData = function(b) { - this.portData = b; - this.hwMonitor && "hw" == Entry.propertyPanel.selected && 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.8_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 = [Entry.Utils.convertIntToHex(b.company), ".", Entry.Utils.convertIntToHex(b.model)].join(""), 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; -}; -Entry.Stage.prototype.initStage = function(b) { - this.canvas = new createjs.Stage(b.id); - this.canvas.x = 320; - this.canvas.y = 180; - this.canvas.scaleX = this.canvas.scaleY = 2 / 1.5; - createjs.Touch.enable(this.canvas); - this.canvas.enableMouseOver(10); - this.canvas.mouseMoveOutside = !0; - this.canvas.addChild(this.background); - this.canvas.addChild(this.variableContainer); - this.canvas.addChild(this.dialogContainer); - this.inputField = null; - this.initCoordinator(); - this.initHandle(); - this.mouseCoordinate = {x:0, y:0}; - if (Entry.isPhone()) { - b.ontouchstart = function(a) { - Entry.dispatchEvent("canvasClick", a); - Entry.stage.isClick = !0; - }, b.ontouchend = function(a) { - Entry.stage.isClick = !1; - Entry.dispatchEvent("canvasClickCanceled", a); - }; - } else { - var a = function(a) { - Entry.dispatchEvent("canvasClick", a); - Entry.stage.isClick = !0; ->>>>>>> entrylabs/master }; this.objectWidthInput.addClass("entryPlaygroundPainterNumberInput"); c.appendChild(this.objectWidthInput); @@ -13094,7 +12165,6 @@ Entry.JSParser = function(a) { case ">=": h = a + 1 - d; } -<<<<<<< HEAD return this.BasicIteration(b, h, f); }; a.BlockStatement = function(b) { @@ -13105,82 +12175,6 @@ Entry.JSParser = function(a) { if (f) { if (void 0 === f.type) { throw {message:"\ud574\ub2f9\ud558\ub294 \ube14\ub85d\uc774 \uc5c6\uc2b5\ub2c8\ub2e4.", node:e}; -======= - this.updateObject(); - } -}; -Entry.Stage.prototype.getBoundRect = function(b) { - this._boundRect || this.updateBoundRect(); - return this._boundRect; -}; -Entry.Stage.prototype.updateBoundRect = function(b) { - this._boundRect = this.canvas.canvas.getBoundingClientRect(); -}; -Entry.Variable = function(b) { - Entry.assert("string" == typeof b.name, "Variable name must be given"); - this.name_ = b.name; - this.id_ = b.id ? b.id : Entry.generateHash(); - this.type = b.variableType ? b.variableType : "variable"; - this.object_ = b.object || null; - this.isCloud_ = b.isCloud || !1; - 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.setMinValue(b.minValue), this.setMaxValue(b.maxValue)) : "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) { - var a = this.type; - if ("variable" == a || "timer" == a || "answer" == a) { - this.view_ = new createjs.Container, this.rect_ = new createjs.Shape, this.view_.addChild(this.rect_), this.view_.variable = this, this.wrapper_ = new createjs.Shape, this.view_.addChild(this.wrapper_), this.textView_ = new createjs.Text("asdf", this.FONT, "#000000"), this.textView_.textBaseline = "alphabetic", this.textView_.x = 4, this.textView_.y = 1, this.view_.addChild(this.textView_), this.valueView_ = new createjs.Text("asdf", "10pt NanumGothic", "#ffffff"), this.valueView_.textBaseline = - "alphabetic", a = Entry.variableContainer.variables_.length, this.getX() && this.getY() ? (this.setX(this.getX()), this.setY(this.getY())) : (this.setX(-230 + 80 * Math.floor(a / 11)), this.setY(24 * b + 20 - 135 - 264 * Math.floor(a / 11))), this.view_.visible = this.visible_, this.view_.addChild(this.valueView_), this.view_.on("mousedown", function(a) { - "workspace" == Entry.type && (this.offset = {x:this.x - (.75 * a.stageX - 240), y:this.y - (.75 * a.stageY - 135)}, this.cursor = "move"); - }), this.view_.on("pressmove", function(a) { - "workspace" == Entry.type && (this.variable.setX(.75 * a.stageX - 240 + this.offset.x), this.variable.setY(.75 * a.stageY - 135 + this.offset.y), this.variable.updateView()); - }); - } else { - if ("slide" == a) { - var c = this; - this.view_ = new createjs.Container; - this.rect_ = new createjs.Shape; - this.view_.addChild(this.rect_); - this.view_.variable = this; - this.wrapper_ = new createjs.Shape; - this.view_.addChild(this.wrapper_); - this.textView_ = new createjs.Text("name", this.FONT, "#000000"); - this.textView_.textBaseline = "alphabetic"; - this.textView_.x = 4; - this.textView_.y = 1; - this.view_.addChild(this.textView_); - this.valueView_ = new createjs.Text("value", "10pt NanumGothic", "#ffffff"); - this.valueView_.textBaseline = "alphabetic"; - this.view_.on("mousedown", function(a) { - "workspace" == Entry.type && (this.offset = {x:this.x - (.75 * a.stageX - 240), y:this.y - (.75 * a.stageY - 135)}); - }); - this.view_.on("pressmove", function(a) { - "workspace" != Entry.type || c.isAdjusting || (this.variable.setX(.75 * a.stageX - 240 + this.offset.x), this.variable.setY(.75 * a.stageY - 135 + this.offset.y), this.variable.updateView()); - }); - this.view_.visible = this.visible_; - this.view_.addChild(this.valueView_); - a = this.textView_.getMeasuredWidth() + this.valueView_.getMeasuredWidth() + 26; - a = Math.max(a, 90); - this.maxWidth = a - 20; - this.slideBar_ = new createjs.Shape; - this.slideBar_.graphics.beginFill("#A0A1A1").s("#A0A1A1").ss(1).dr(10, 10, this.maxWidth, 1.5); - this.view_.addChild(this.slideBar_); - a = this.getSlidePosition(this.maxWidth); - this.valueSetter_ = new createjs.Shape; - this.valueSetter_.graphics.beginFill("#1bafea").s("#A0A1A1").ss(1).dc(a, 10.5, 3); - this.valueSetter_.cursor = "pointer"; - this.valueSetter_.on("mousedown", function(a) { - Entry.engine.isState("run") && (c.isAdjusting = !0, this.offsetX = -(this.x - .75 * a.stageX + 240)); - }); - this.valueSetter_.on("pressmove", function(a) { - if (Entry.engine.isState("run")) { - var b = this.offsetX; - this.offsetX = -(this.x - .75 * a.stageX + 240); - b !== this.offsetX && (a = c.getX(), c.setSlideCommandX(a + 10 > this.offsetX ? 0 : a + c.maxWidth + 10 > this.offsetX ? this.offsetX - a : c.maxWidth + 10)); ->>>>>>> entrylabs/master } f && a.push(f); } @@ -13825,10 +12819,10 @@ Entry.BlockMockup = function(a, b, c) { var a = this.paramsKeyMap; a[b] = Object.keys(a).length; }; - a._addToStatementsKeyMap = function(b) { - b = b ? b : "dummy_" + Entry.Utils.generateId(); - var a = this.statementsKeyMap; - a[b] = Object.keys(a).length; + a._addToStatementsKeyMap = function(a) { + a = a ? a : "dummy_" + Entry.Utils.generateId(); + var c = this.statementsKeyMap; + c[a] = Object.keys(c).length; }; })(Entry.BlockMockup.prototype); Entry.Playground = function() { @@ -13837,38 +12831,29 @@ Entry.Playground = function() { Entry.addEventListener("textEdited", this.injectText); Entry.addEventListener("hwChanged", this.updateHW); }; -<<<<<<< HEAD Entry.Playground.prototype.generateView = function(a, b) { this.view_ = a; this.view_.addClass("entryPlayground"); b && "workspace" != b ? "phone" == b && (this.view_.addClass("entryPlaygroundPhone"), a = Entry.createElement("div", "entryCategoryTab"), a.addClass("entryPlaygroundTabPhone"), Entry.view_.insertBefore(a, this.view_), this.generateTabView(a), this.tabView_ = a, a = Entry.createElement("div", "entryCurtain"), a.addClass("entryPlaygroundCurtainPhone"), a.addClass("entryRemove"), a.innerHTML = Lang.Workspace.cannot_edit_click_to_stop, a.bindOnClick(function() { Entry.engine.toggleStop(); }), this.view_.appendChild(a), this.curtainView_ = a, Entry.pictureEditable && (a = Entry.createElement("div", "entryPicture"), a.addClass("entryPlaygroundPicturePhone"), a.addClass("entryRemove"), this.view_.appendChild(a), this.generatePictureView(a), this.pictureView_ = a), a = Entry.createElement("div", "entryText"), a.addClass("entryRemove"), this.view_.appendChild(a), this.generateTextView(a), this.textView_ = a, Entry.soundEditable && (a = Entry.createElement("div", "entrySound"), a.addClass("entryPlaygroundSoundWorkspacePhone"), - a.addClass("entryRemove"), this.view_.appendChild(a), this.generateSoundView(a), this.soundView_ = a), a = Entry.createElement("div", "entryDefault"), this.view_.appendChild(a), this.generateDefaultView(a), this.defaultView_ = a, a = Entry.createElement("div", "entryCode"), a.addClass("entryPlaygroundCodePhone"), this.view_.appendChild(a), this.generateCodeView(a), this.codeView_ = this.codeView_ = a, Entry.addEventListener("run", function(b) { + a.addClass("entryRemove"), this.view_.appendChild(a), this.generateSoundView(a), this.soundView_ = a), a = Entry.createElement("div", "entryDefault"), this.view_.appendChild(a), this.generateDefaultView(a), this.defaultView_ = a, a = Entry.createElement("div", "entryCode"), a.addClass("entryPlaygroundCodePhone"), this.view_.appendChild(a), this.generateCodeView(a), this.codeView_ = this.codeView_ = a, Entry.addEventListener("run", function(a) { Entry.playground.curtainView_.removeClass("entryRemove"); - }), Entry.addEventListener("stop", function(b) { + }), Entry.addEventListener("stop", function(a) { Entry.playground.curtainView_.addClass("entryRemove"); })) : (this.view_.addClass("entryPlaygroundWorkspace"), a = Entry.createElement("div", "entryCategoryTab"), a.addClass("entryPlaygroundTabWorkspace"), this.view_.appendChild(a), this.generateTabView(a), this.tabView_ = a, a = Entry.createElement("div", "entryCurtain"), a.addClass("entryPlaygroundCurtainWorkspace"), a.addClass("entryRemove"), b = Lang.Workspace.cannot_edit_click_to_stop.split("."), a.innerHTML = b[0] + ".
" + b[1], a.addEventListener("click", function() { Entry.engine.toggleStop(); }), this.view_.appendChild(a), this.curtainView_ = a, Entry.pictureEditable && (a = Entry.createElement("div", "entryPicture"), a.addClass("entryPlaygroundPictureWorkspace"), a.addClass("entryRemove"), this.view_.appendChild(a), this.generatePictureView(a), this.pictureView_ = a), a = Entry.createElement("div", "entryText"), a.addClass("entryPlaygroundTextWorkspace"), a.addClass("entryRemove"), this.view_.appendChild(a), this.generateTextView(a), this.textView_ = a, Entry.soundEditable && (a = Entry.createElement("div", "entrySound"), a.addClass("entryPlaygroundSoundWorkspace"), a.addClass("entryRemove"), this.view_.appendChild(a), this.generateSoundView(a), this.soundView_ = a), a = Entry.createElement("div", "entryDefault"), a.addClass("entryPlaygroundDefaultWorkspace"), this.view_.appendChild(a), this.generateDefaultView(a), this.defaultView_ = a, a = Entry.createElement("div", "entryCode"), a.addClass("entryPlaygroundCodeWorkspace"), a.addClass("entryRemove"), this.view_.appendChild(a), - this.generateCodeView(a), this.codeView_ = a, b = Entry.createElement("div"), b.addClass("entryPlaygroundResizeWorkspace", "entryRemove"), this.resizeHandle_ = b, this.view_.appendChild(b), this.initializeResizeHandle(b), this.codeView_ = a, Entry.addEventListener("run", function(b) { + this.generateCodeView(a), this.codeView_ = a, b = Entry.createElement("div"), b.addClass("entryPlaygroundResizeWorkspace", "entryRemove"), this.resizeHandle_ = b, this.view_.appendChild(b), this.initializeResizeHandle(b), this.codeView_ = a, Entry.addEventListener("run", function(a) { Entry.playground.curtainView_.removeClass("entryRemove"); - }), Entry.addEventListener("stop", function(b) { + }), Entry.addEventListener("stop", function(a) { Entry.playground.curtainView_.addClass("entryRemove"); })); -======= -Entry.Variable.prototype.setMinValue = function(b) { - this.minValue_ = b = b || 0; - this.value_ < b && (this.value_ = b); - this.updateView(); - this.isMinFloat = Entry.isFloat(this.minValue_); ->>>>>>> entrylabs/master }; Entry.Playground.prototype.generateDefaultView = function(a) { return a; }; -<<<<<<< HEAD Entry.Playground.prototype.generateTabView = function(a) { var b = this, c = Entry.createElement("ul"); c.addClass("entryTabListWorkspace"); @@ -13885,25 +12870,18 @@ Entry.Playground.prototype.generateTabView = function(a) { b.blockMenu.reDraw(); }); this.tabViewElements.code = a; - Entry.pictureEditable && (a = Entry.createElement("li", "entryPictureTab"), a.innerHTML = Lang.Workspace.tab_picture, a.addClass("entryTabListItemWorkspace"), c.appendChild(a), a.bindOnClick(function(b) { + Entry.pictureEditable && (a = Entry.createElement("li", "entryPictureTab"), a.innerHTML = Lang.Workspace.tab_picture, a.addClass("entryTabListItemWorkspace"), c.appendChild(a), a.bindOnClick(function(a) { Entry.playground.changeViewMode("picture"); - }), this.tabViewElements.picture = a, a = Entry.createElement("li", "entryTextboxTab"), a.innerHTML = Lang.Workspace.tab_text, a.addClass("entryTabListItemWorkspace"), c.appendChild(a), a.bindOnClick(function(b) { + }), this.tabViewElements.picture = a, a = Entry.createElement("li", "entryTextboxTab"), a.innerHTML = Lang.Workspace.tab_text, a.addClass("entryTabListItemWorkspace"), c.appendChild(a), a.bindOnClick(function(a) { Entry.playground.changeViewMode("text"); }), this.tabViewElements.text = a, a.addClass("entryRemove")); - Entry.soundEditable && (a = Entry.createElement("li", "entrySoundTab"), a.innerHTML = Lang.Workspace.tab_sound, a.addClass("entryTabListItemWorkspace"), c.appendChild(a), a.bindOnClick(function(b) { + Entry.soundEditable && (a = Entry.createElement("li", "entrySoundTab"), a.innerHTML = Lang.Workspace.tab_sound, a.addClass("entryTabListItemWorkspace"), c.appendChild(a), a.bindOnClick(function(a) { Entry.playground.changeViewMode("sound"); }), this.tabViewElements.sound = a); - Entry.hasVariableManager && (a = Entry.createElement("li", "entryVariableTab"), a.innerHTML = Lang.Workspace.tab_attribute, a.addClass("entryTabListItemWorkspace"), a.addClass("entryVariableTabWorkspace"), c.appendChild(a), a.bindOnClick(function(b) { + Entry.hasVariableManager && (a = Entry.createElement("li", "entryVariableTab"), a.innerHTML = Lang.Workspace.tab_attribute, a.addClass("entryTabListItemWorkspace"), a.addClass("entryVariableTabWorkspace"), c.appendChild(a), a.bindOnClick(function(a) { Entry.playground.toggleOnVariableView(); Entry.playground.changeViewMode("variable"); }), this.tabViewElements.variable = a); -======= -Entry.Variable.prototype.setMaxValue = function(b) { - this.maxValue_ = b = b || 100; - this.value_ > b && (this.value_ = b); - this.updateView(); - this.isMaxFloat = Entry.isFloat(this.maxValue_); ->>>>>>> entrylabs/master }; Entry.Playground.prototype.generateCodeView = function(a) { var b = this.createVariableView(); @@ -13921,7 +12899,7 @@ Entry.Playground.prototype.generatePictureView = function(a) { if ("workspace" == Entry.type) { var b = Entry.createElement("div", "entryAddPicture"); b.addClass("entryPlaygroundAddPicture"); - b.bindOnClick(function(b) { + b.bindOnClick(function(a) { Entry.dispatchEvent("openPictureManager"); }); var c = Entry.createElement("div", "entryAddPictureInner"); @@ -13931,12 +12909,12 @@ Entry.Playground.prototype.generatePictureView = function(a) { a.appendChild(b); b = Entry.createElement("ul", "entryPictureList"); b.addClass("entryPlaygroundPictureList"); - $ && $(b).sortable({start:function(b, a) { - a.item.data("start_pos", a.item.index()); - }, stop:function(b, a) { - b = a.item.data("start_pos"); - a = a.item.index(); - Entry.playground.movePicture(b, a); + $ && $(b).sortable({start:function(a, b) { + b.item.data("start_pos", b.item.index()); + }, stop:function(a, b) { + a = b.item.data("start_pos"); + b = b.item.index(); + Entry.playground.movePicture(a, b); }, axis:"y"}); a.appendChild(b); this.pictureListView_ = b; @@ -13946,14 +12924,14 @@ Entry.Playground.prototype.generatePictureView = function(a) { this.painter = new Entry.Painter; this.painter.initialize(b); } else { - "phone" == Entry.type && (b = Entry.createElement("div", "entryAddPicture"), b.addClass("entryPlaygroundAddPicturePhone"), b.bindOnClick(function(b) { + "phone" == Entry.type && (b = Entry.createElement("div", "entryAddPicture"), b.addClass("entryPlaygroundAddPicturePhone"), b.bindOnClick(function(a) { Entry.dispatchEvent("openPictureManager"); - }), c = Entry.createElement("div", "entryAddPictureInner"), c.addClass("entryPlaygroundAddPictureInnerPhone"), c.innerHTML = Lang.Workspace.picture_add, b.appendChild(c), a.appendChild(b), b = Entry.createElement("ul", "entryPictureList"), b.addClass("entryPlaygroundPictureListPhone"), $ && $(b).sortable({start:function(b, a) { - a.item.data("start_pos", a.item.index()); - }, stop:function(b, a) { - b = a.item.data("start_pos"); - a = a.item.index(); - Entry.playground.movePicture(b, a); + }), c = Entry.createElement("div", "entryAddPictureInner"), c.addClass("entryPlaygroundAddPictureInnerPhone"), c.innerHTML = Lang.Workspace.picture_add, b.appendChild(c), a.appendChild(b), b = Entry.createElement("ul", "entryPictureList"), b.addClass("entryPlaygroundPictureListPhone"), $ && $(b).sortable({start:function(a, b) { + b.item.data("start_pos", b.item.index()); + }, stop:function(a, b) { + a = b.item.data("start_pos"); + b = b.item.index(); + Entry.playground.movePicture(a, b); }, axis:"y"}), a.appendChild(b), this.pictureListView_ = b); } }; @@ -13969,8 +12947,8 @@ Entry.Playground.prototype.generateTextView = function(a) { var d = Entry.createElement("select", "entryPainterAttrFontName"); d.addClass("entryPlaygroundPainterAttrFontName", "entryTextFontSelecter"); d.size = "1"; - d.onchange = function(b) { - Entry.playground.object.entity.setFontType(b.target.value); + d.onchange = function(a) { + Entry.playground.object.entity.setFontType(a.target.value); }; for (var e = 0;e < Entry.fonts.length;e++) { var f = Entry.fonts[e], g = Entry.createElement("option"); @@ -13985,21 +12963,21 @@ Entry.Playground.prototype.generateTextView = function(a) { a.appendChild(e); c = Entry.createElement("li"); c.addClass("entryPlaygroundTextAlignLeft"); - c.bindOnClick(function(b) { + c.bindOnClick(function(a) { Entry.playground.setFontAlign(Entry.TEXT_ALIGN_LEFT); }); e.appendChild(c); this.alignLeftBtn = c; c = Entry.createElement("li"); c.addClass("entryPlaygroundTextAlignCenter"); - c.bindOnClick(function(b) { + c.bindOnClick(function(a) { Entry.playground.setFontAlign(Entry.TEXT_ALIGN_CENTER); }); e.appendChild(c); this.alignCenterBtn = c; c = Entry.createElement("li"); c.addClass("entryPlaygroundTextAlignRight"); - c.bindOnClick(function(b) { + c.bindOnClick(function(a) { Entry.playground.setFontAlign(Entry.TEXT_ALIGN_RIGHT); }); e.appendChild(c); @@ -14019,9 +12997,9 @@ Entry.Playground.prototype.generateTextView = function(a) { d = Entry.createElement("a"); c.appendChild(d); d.bindOnClick(function() { - var b = !Entry.playground.object.entity.getUnderLine() || !1; - k.src = Entry.mediaFilePath + "text_button_underline_" + b + ".png"; - Entry.playground.object.entity.setUnderLine(b); + var a = !Entry.playground.object.entity.getUnderLine() || !1; + k.src = Entry.mediaFilePath + "text_button_underline_" + a + ".png"; + Entry.playground.object.entity.setUnderLine(a); }); var k = Entry.createElement("img", "entryPlaygroundText_underlineImage"); d.appendChild(k); @@ -14041,9 +13019,9 @@ Entry.Playground.prototype.generateTextView = function(a) { d = Entry.createElement("a"); c.appendChild(d); d.bindOnClick(function() { - var b = !Entry.playground.object.entity.getStrike() || !1; - Entry.playground.object.entity.setStrike(b); - n.src = Entry.mediaFilePath + "text_button_strike_" + b + ".png"; + var a = !Entry.playground.object.entity.getStrike() || !1; + Entry.playground.object.entity.setStrike(a); + n.src = Entry.mediaFilePath + "text_button_strike_" + a + ".png"; }); var n = Entry.createElement("img", "entryPlaygroundText_strikeImage"); d.appendChild(n); @@ -14080,8 +13058,8 @@ Entry.Playground.prototype.generateTextView = function(a) { b.appendChild(d); a = Entry.getColourCodes(); for (e = 0;e < a.length;e++) { - c = Entry.createElement("div"), c.addClass("modal_colour"), c.setAttribute("colour", a[e]), c.style.backgroundColor = a[e], 0 === e && c.addClass("modalColourTrans"), c.bindOnClick(function(b) { - Entry.playground.setTextColour(b.target.getAttribute("colour")); + c = Entry.createElement("div"), c.addClass("modal_colour"), c.setAttribute("colour", a[e]), c.style.backgroundColor = a[e], 0 === e && c.addClass("modalColourTrans"), c.bindOnClick(function(a) { + Entry.playground.setTextColour(a.target.getAttribute("colour")); }), d.appendChild(c); } d.style.display = "none"; @@ -14090,8 +13068,8 @@ Entry.Playground.prototype.generateTextView = function(a) { this.backgroundsWrapper = d; b.appendChild(d); for (e = 0;e < a.length;e++) { - c = Entry.createElement("div"), c.addClass("modal_colour"), c.setAttribute("colour", a[e]), c.style.backgroundColor = a[e], 0 === e && c.addClass("modalColourTrans"), c.bindOnClick(function(b) { - Entry.playground.setBackgroundColour(b.target.getAttribute("colour")); + c = Entry.createElement("div"), c.addClass("modal_colour"), c.setAttribute("colour", a[e]), c.style.backgroundColor = a[e], 0 === e && c.addClass("modalColourTrans"), c.bindOnClick(function(a) { + Entry.playground.setBackgroundColour(a.target.getAttribute("colour")); }), d.appendChild(c); } d.style.display = "none"; @@ -14138,24 +13116,24 @@ Entry.Playground.prototype.generateTextView = function(a) { e.innerHTML = "\uae00\uc790 \ud06c\uae30"; a.appendChild(e); var u = !1, t = 0; - r.onmousedown = function(b) { + r.onmousedown = function(a) { u = !0; t = $(m).offset().left; }; - r.addEventListener("touchstart", function(b) { + r.addEventListener("touchstart", function(a) { u = !0; t = $(m).offset().left; }); - document.addEventListener("mousemove", function(b) { - u && (b = b.pageX - t, b = Math.max(b, 5), b = Math.min(b, 88), r.style.left = b + "px", b /= .88, q.style.width = b + "%", Entry.playground.object.entity.setFontSize(b)); + document.addEventListener("mousemove", function(a) { + u && (a = a.pageX - t, a = Math.max(a, 5), a = Math.min(a, 88), r.style.left = a + "px", a /= .88, q.style.width = a + "%", Entry.playground.object.entity.setFontSize(a)); }); - document.addEventListener("touchmove", function(b) { - u && (b = b.touches[0].pageX - t, b = Math.max(b, 5), b = Math.min(b, 88), r.style.left = b + "px", b /= .88, q.style.width = b + "%", Entry.playground.object.entity.setFontSize(b)); + document.addEventListener("touchmove", function(a) { + u && (a = a.touches[0].pageX - t, a = Math.max(a, 5), a = Math.min(a, 88), r.style.left = a + "px", a /= .88, q.style.width = a + "%", Entry.playground.object.entity.setFontSize(a)); }); - document.addEventListener("mouseup", function(b) { + document.addEventListener("mouseup", function(a) { u = !1; }); - document.addEventListener("touchend", function(b) { + document.addEventListener("touchend", function(a) { u = !1; }); a = Entry.createElement("div"); @@ -14206,7 +13184,7 @@ Entry.Playground.prototype.generateSoundView = function(a) { if ("workspace" == Entry.type) { var b = Entry.createElement("div", "entryAddSound"); b.addClass("entryPlaygroundAddSound"); - b.bindOnClick(function(b) { + b.bindOnClick(function(a) { Entry.dispatchEvent("openSoundManager"); }); var c = Entry.createElement("div", "entryAddSoundInner"); @@ -14216,24 +13194,24 @@ Entry.Playground.prototype.generateSoundView = function(a) { a.appendChild(b); b = Entry.createElement("ul", "entrySoundList"); b.addClass("entryPlaygroundSoundList"); - $ && $(b).sortable({start:function(b, a) { - a.item.data("start_pos", a.item.index()); - }, stop:function(b, a) { - b = a.item.data("start_pos"); - a = a.item.index(); - Entry.playground.moveSound(b, a); + $ && $(b).sortable({start:function(a, b) { + b.item.data("start_pos", b.item.index()); + }, stop:function(a, b) { + a = b.item.data("start_pos"); + b = b.item.index(); + Entry.playground.moveSound(a, b); }, axis:"y"}); a.appendChild(b); this.soundListView_ = b; } else { - "phone" == Entry.type && (b = Entry.createElement("div", "entryAddSound"), b.addClass("entryPlaygroundAddSoundPhone"), b.bindOnClick(function(b) { + "phone" == Entry.type && (b = Entry.createElement("div", "entryAddSound"), b.addClass("entryPlaygroundAddSoundPhone"), b.bindOnClick(function(a) { Entry.dispatchEvent("openSoundManager"); - }), c = Entry.createElement("div", "entryAddSoundInner"), c.addClass("entryPlaygroundAddSoundInnerPhone"), c.innerHTML = Lang.Workspace.sound_add, b.appendChild(c), a.appendChild(b), b = Entry.createElement("ul", "entrySoundList"), b.addClass("entryPlaygroundSoundListPhone"), $ && $(b).sortable({start:function(b, a) { - a.item.data("start_pos", a.item.index()); - }, stop:function(b, a) { - b = a.item.data("start_pos"); - a = a.item.index(); - Entry.playground.moveSound(b, a); + }), c = Entry.createElement("div", "entryAddSoundInner"), c.addClass("entryPlaygroundAddSoundInnerPhone"), c.innerHTML = Lang.Workspace.sound_add, b.appendChild(c), a.appendChild(b), b = Entry.createElement("ul", "entrySoundList"), b.addClass("entryPlaygroundSoundListPhone"), $ && $(b).sortable({start:function(a, b) { + b.item.data("start_pos", b.item.index()); + }, stop:function(a, b) { + a = b.item.data("start_pos"); + b = b.item.index(); + Entry.playground.moveSound(a, b); }, axis:"y"}), a.appendChild(b), this.soundListView_ = b); } }; @@ -14469,15 +13447,15 @@ Entry.Playground.prototype.showTab = function(a) { this.tabViewElements[a] && (this.tabViewElements[a].addClass("showTab"), this.tabViewElements[a].removeClass("hideTab")); }; Entry.Playground.prototype.initializeResizeHandle = function(a) { - $(a).bind("mousedown touchstart", function(b) { + $(a).bind("mousedown touchstart", function(a) { Entry.playground.resizing = !0; - Entry.documentMousemove && (Entry.playground.resizeEvent = Entry.documentMousemove.attach(this, function(b) { - Entry.playground.resizing && Entry.resizeElement({menuWidth:b.clientX - Entry.interfaceState.canvasWidth}); + Entry.documentMousemove && (Entry.playground.resizeEvent = Entry.documentMousemove.attach(this, function(a) { + Entry.playground.resizing && Entry.resizeElement({menuWidth:a.clientX - Entry.interfaceState.canvasWidth}); })); }); - $(document).bind("mouseup touchend", function(b) { - if (b = Entry.playground.resizeEvent) { - Entry.playground.resizing = !1, Entry.documentMousemove.detach(b), delete Entry.playground.resizeEvent; + $(document).bind("mouseup touchend", function(a) { + if (a = Entry.playground.resizeEvent) { + Entry.playground.resizing = !1, Entry.documentMousemove.detach(a), delete Entry.playground.resizeEvent; } }); }; @@ -14527,7 +13505,7 @@ Entry.Playground.prototype.generatePictureElement = function(a) { a.view = c; c.addClass("entryPlaygroundPictureElement"); c.picture = a; - c.bindOnClick(function(b) { + c.bindOnClick(function(a) { Entry.playground.selectPicture(this.picture); }); Entry.Utils.disableContextmenu(a.view); @@ -14561,8 +13539,8 @@ Entry.Playground.prototype.generatePictureElement = function(a) { f.picture = a; f.value = a.name; Entry.attachEventListener(f, "blur", b); - f.onkeypress = function(b) { - 13 == b.keyCode && this.blur(); + f.onkeypress = function(a) { + 13 == a.keyCode && this.blur(); }; c.appendChild(f); d = Entry.createElement("div", "s_" + a.id); @@ -14595,12 +13573,12 @@ Entry.Playground.prototype.generateSoundElement = function(a) { d.addClass("entryPlaygroundSoundPlay"); var e = !1, f; d.addEventListener("click", function() { - e ? (e = !1, d.removeClass("entryPlaygroundSoundStop"), d.addClass("entryPlaygroundSoundPlay"), f.stop()) : (e = !0, d.removeClass("entryPlaygroundSoundPlay"), d.addClass("entryPlaygroundSoundStop"), f = createjs.Sound.play(a.id), f.addEventListener("complete", function(b) { + e ? (e = !1, d.removeClass("entryPlaygroundSoundStop"), d.addClass("entryPlaygroundSoundPlay"), f.stop()) : (e = !0, d.removeClass("entryPlaygroundSoundPlay"), d.addClass("entryPlaygroundSoundStop"), f = createjs.Sound.play(a.id), f.addEventListener("complete", function(a) { d.removeClass("entryPlaygroundSoundStop"); d.addClass("entryPlaygroundSoundPlay"); e = !1; - }), f.addEventListener("loop", function(b) { - }), f.addEventListener("failed", function(b) { + }), f.addEventListener("loop", function(a) { + }), f.addEventListener("failed", function(a) { })); }); b.appendChild(d); @@ -14613,8 +13591,8 @@ Entry.Playground.prototype.generateSoundElement = function(a) { if ("" === this.value) { alert("\uc774\ub984\uc744 \uc785\ub825\ud558\uc5ec \uc8fc\uc138\uc694."), this.focus(); } else { - for (var b = 0, a = 0;a < h.length;a++) { - if (h[a].value == g.value && (b += 1, 1 < b)) { + for (var a = 0, b = 0;b < h.length;b++) { + if (h[b].value == g.value && (a += 1, 1 < a)) { alert("\uc774\ub984\uc774 \uc911\ubcf5 \ub418\uc5c8\uc2b5\ub2c8\ub2e4."); this.focus(); return; @@ -14624,8 +13602,8 @@ Entry.Playground.prototype.generateSoundElement = function(a) { Entry.playground.reloadPlayground(); } }; - g.onkeypress = function(b) { - 13 == b.keyCode && this.blur(); + g.onkeypress = function(a) { + 13 == a.keyCode && this.blur(); }; b.appendChild(g); c = Entry.createElement("div"); @@ -14738,8 +13716,8 @@ Entry.popupHelper = function(a) { this.body_.bindOnClick(function(a) { if (!(d.nowContent && -1 < b.indexOf(d.nowContent.prop("type")))) { var f = $(a.target); - c.forEach(function(b) { - f.hasClass(b) && this.popup.hide(); + c.forEach(function(a) { + f.hasClass(a) && this.popup.hide(); }.bind(this)); a.target == this && this.popup.hide(); } @@ -14747,8 +13725,8 @@ Entry.popupHelper = function(a) { this.body_.bind("touchstart", function(a) { if (!(d.nowContent && -1 < b.indexOf(d.nowContent.prop("type")))) { var f = $(a.target); - c.forEach(function(b) { - f.hasClass(b) && this.popup.hide(); + c.forEach(function(a) { + f.hasClass(a) && this.popup.hide(); }.bind(this)); a.target == this && this.popup.hide(); } @@ -14851,21 +13829,21 @@ Entry.Scene.prototype.generateView = function(a, b) { var c = this; this.view_ = a; this.view_.addClass("entryScene"); - b && "workspace" != b || (this.view_.addClass("entrySceneWorkspace"), $(this.view_).on("mousedown", function(b) { - var a = $(this).offset(), f = $(window), g = b.pageX - a.left + f.scrollLeft(); - b = b.pageY - a.top + f.scrollTop(); - b = 40 - b; - a = -40 / 55; + b && "workspace" != b || (this.view_.addClass("entrySceneWorkspace"), $(this.view_).on("mousedown", function(a) { + var b = $(this).offset(), f = $(window), g = a.pageX - b.left + f.scrollLeft(); + a = a.pageY - b.top + f.scrollTop(); + a = 40 - a; + b = -40 / 55; f = $(c.selectedScene.view).find(".entrySceneRemoveButtonCoverWorkspace").offset().left; - !(g < f || g > f + 55) && b > 40 + a * (g - f) && (g = c.getNextScene()) && (g = $(g.view), $(document).trigger("mouseup"), g.trigger("mousedown")); - }), a = Entry.createElement("ul"), a.addClass("entrySceneListWorkspace"), Entry.sceneEditable && $ && $(a).sortable({start:function(b, a) { - a.item.data("start_pos", a.item.index()); - $(a.item[0]).clone(!0); - }, stop:function(b, a) { - b = a.item.data("start_pos"); - a = a.item.index(); - Entry.scene.moveScene(b, a); - }, axis:"x", tolerance:"pointer"}), this.view_.appendChild(a), this.listView_ = a, Entry.sceneEditable && (a = Entry.createElement("span"), a.addClass("entrySceneElementWorkspace"), a.addClass("entrySceneAddButtonWorkspace"), a.bindOnClick(function(b) { + !(g < f || g > f + 55) && a > 40 + b * (g - f) && (g = c.getNextScene()) && (g = $(g.view), $(document).trigger("mouseup"), g.trigger("mousedown")); + }), a = Entry.createElement("ul"), a.addClass("entrySceneListWorkspace"), Entry.sceneEditable && $ && $(a).sortable({start:function(a, b) { + b.item.data("start_pos", b.item.index()); + $(b.item[0]).clone(!0); + }, stop:function(a, b) { + a = b.item.data("start_pos"); + b = b.item.index(); + Entry.scene.moveScene(a, b); + }, axis:"x", tolerance:"pointer"}), this.view_.appendChild(a), this.listView_ = a, Entry.sceneEditable && (a = Entry.createElement("span"), a.addClass("entrySceneElementWorkspace"), a.addClass("entrySceneAddButtonWorkspace"), a.bindOnClick(function(a) { Entry.engine.isState("run") || Entry.scene.addScene(); }), this.view_.appendChild(a), this.addButton_ = a)); }; @@ -14898,7 +13876,6 @@ Entry.Scene.prototype.generateElement = function(a) { a.name = this.value; f.style.width = Entry.computeInputWidth(a.name); }; -<<<<<<< HEAD f.appendChild(d); e = Entry.createElement("span"); e.addClass("entrySceneRemoveButtonCoverWorkspace"); @@ -14907,8 +13884,8 @@ Entry.Scene.prototype.generateElement = function(a) { var g = Entry.createElement("button"); g.addClass("entrySceneRemoveButtonWorkspace"); g.scene = a; - g.bindOnClick(function(b) { - b.stopPropagation(); + g.bindOnClick(function(a) { + a.stopPropagation(); Entry.engine.isState("run") || confirm(Lang.Workspace.will_you_delete_scene) && Entry.scene.removeScene(this.scene); }); e.appendChild(g); @@ -14919,135 +13896,6 @@ Entry.Scene.prototype.generateElement = function(a) { Entry.scene.cloneScene(a); }}]; Entry.ContextMenu.show(b, "workspace-contextmenu"); -======= - a.initValueInput = d; - c.appendChild(d); - c = Entry.createElement("div"); - c.addClass("entryVariableSettingSplitterWorkspace"); - a.appendChild(c); - c = Entry.createElement("div"); - c.addClass("entryVariableSettingSlideWrapperWorkspace"); - a.appendChild(c); - d = Entry.createElement("span"); - d.innerHTML = Lang.Workspace.slide; - c.appendChild(d); - d = Entry.createElement("span"); - d.addClass("entryVariableSettingCheckWorkspace"); - a.slideCheck = d; - c.appendChild(d); - c.bindOnClick(function(a) { - var c; - a = b.selectedVariable; - var d = b.variables_, f = a.getType(); - "variable" == f ? (c = a.toJSON(), c.variableType = "slide", c = new Entry.Variable(c), d.splice(d.indexOf(a), 0, c), 0 > c.getValue() && c.setValue(0), 100 < c.getValue() && c.setValue(100), e.removeAttribute("disabled"), g.removeAttribute("disabled")) : "slide" == f && (c = a.toJSON(), c.variableType = "variable", c = new Entry.Variable(c), d.splice(d.indexOf(a), 0, c), e.setAttribute("disabled", "disabled"), g.setAttribute("disabled", "disabled")); - b.createVariableView(c); - b.removeVariable(a); - b.updateSelectedVariable(c); - c.generateView(); - }); - c = Entry.createElement("div"); - a.minMaxWrapper = c; - c.addClass("entryVariableSettingMinMaxWrapperWorkspace"); - a.appendChild(c); - d = Entry.createElement("span"); - d.innerHTML = Lang.Workspace.min_value; - c.appendChild(d); - var e = Entry.createElement("input"); - e.addClass("entryVariableSettingMinValueInputWorkspace"); - d = b.selectedVariable; - e.value = d && "slide" == d.type ? d.minValue_ : 0; - e.onkeypress = function(a) { - 13 === a.keyCode && this.blur(); - }; - e.onblur = function(a) { - isNaN(this.value) || (a = b.selectedVariable, a.setMinValue(this.value), b.updateVariableSettingView(a)); - }; - a.minValueInput = e; - c.appendChild(e); - var f = Entry.createElement("span"); - f.addClass("entryVariableSettingMaxValueSpanWorkspace"); - f.innerHTML = Lang.Workspace.max_value; - c.appendChild(f); - var g = Entry.createElement("input"); - g.addClass("entryVariableSettingMaxValueInputWorkspace"); - g.value = d && "slide" == d.type ? d.maxValue_ : 100; - g.onkeypress = function(a) { - 13 === a.keyCode && this.blur(); - }; - g.onblur = function(a) { - isNaN(this.value) || (a = b.selectedVariable, a.setMaxValue(this.value), b.updateVariableSettingView(a)); - }; - a.maxValueInput = g; - c.appendChild(g); -}; -Entry.VariableContainer.prototype.updateVariableSettingView = function(b) { - var a = this.variableSettingView, c = a.visibleCheck, d = a.initValueInput, e = a.slideCheck, f = a.minValueInput, g = a.maxValueInput, h = a.minMaxWrapper; - c.removeClass("entryVariableSettingChecked"); - b.isVisible() && c.addClass("entryVariableSettingChecked"); - e.removeClass("entryVariableSettingChecked"); - "slide" == b.getType() ? (e.addClass("entryVariableSettingChecked"), f.removeAttribute("disabled"), g.removeAttribute("disabled"), f.value = b.getMinValue(), g.value = b.getMaxValue(), h.removeClass("entryVariableMinMaxDisabledWorkspace")) : (h.addClass("entryVariableMinMaxDisabledWorkspace"), f.setAttribute("disabled", "disabled"), g.setAttribute("disabled", "disabled")); - d.value = b.getValue(); - b.listElement.appendChild(a); - a.removeClass("entryRemove"); -}; -Entry.VariableContainer.prototype.generateListSettingView = function() { - var b = this, a = Entry.createElement("div"); - a.bindOnClick(function(a) { - a.stopPropagation(); - }); - this.listSettingView = a; - a.addClass("entryListSettingWorkspace"); - this.listView_.appendChild(a); - a.addClass("entryRemove"); - var c = Entry.createElement("div"); - c.addClass("entryListSettingVisibleWrapperWorkspace"); - c.bindOnClick(function(a) { - a = b.selectedList; - var c = b.listSettingView.visibleCheck; - a.setVisible(!a.isVisible()); - a.isVisible() ? c.addClass("entryListSettingCheckedWorkspace") : c.removeClass("entryListSettingCheckedWorkspace"); - }); - a.appendChild(c); - var d = Entry.createElement("span"); - d.innerHTML = Lang.Workspace.show_list_workspace; - c.appendChild(d); - d = Entry.createElement("span"); - d.addClass("entryListSettingCheckWorkspace"); - a.visibleCheck = d; - c.appendChild(d); - d = Entry.createElement("div"); - d.addClass("entryListSettingLengthWrapperWorkspace"); - c = Entry.createElement("span"); - c.addClass("entryListSettingLengthSpanWorkspace"); - c.innerHTML = Lang.Workspace.number_of_list; - d.appendChild(c); - a.appendChild(d); - c = Entry.createElement("div"); - c.addClass("entryListSettingLengthControllerWorkspace"); - d.appendChild(c); - d = Entry.createElement("span"); - d.addClass("entryListSettingMinusWorkspace"); - d.bindOnClick(function(a) { - b.selectedList.array_.pop(); - b.updateListSettingView(b.selectedList); - }); - c.appendChild(d); - d = Entry.createElement("input"); - d.addClass("entryListSettingLengthInputWorkspace"); - d.onblur = function() { - b.setListLength(this.value); - }; - d.onkeypress = function(a) { - 13 == a.keyCode && this.blur(); - }; - a.lengthInput = d; - c.appendChild(d); - d = Entry.createElement("span"); - d.addClass("entryListSettingPlusWorkspace"); - d.bindOnClick(function(a) { - b.selectedList.array_.push({data:0}); - b.updateListSettingView(b.selectedList); ->>>>>>> entrylabs/master }); return a.view = c; }; @@ -15308,59 +14156,59 @@ Entry.Stage.prototype.initStage = function(a) { this.initHandle(); this.mouseCoordinate = {x:0, y:0}; if (Entry.isPhone()) { - a.ontouchstart = function(b) { - Entry.dispatchEvent("canvasClick", b); + a.ontouchstart = function(a) { + Entry.dispatchEvent("canvasClick", a); Entry.stage.isClick = !0; - }, a.ontouchend = function(b) { + }, a.ontouchend = function(a) { Entry.stage.isClick = !1; - Entry.dispatchEvent("canvasClickCanceled", b); + Entry.dispatchEvent("canvasClickCanceled", a); }; } else { - var b = function(b) { - Entry.dispatchEvent("canvasClick", b); + var b = function(a) { + Entry.dispatchEvent("canvasClick", a); Entry.stage.isClick = !0; }; a.onmousedown = b; a.ontouchstart = b; - b = function(b) { + b = function(a) { Entry.stage.isClick = !1; - Entry.dispatchEvent("canvasClickCanceled", b); + Entry.dispatchEvent("canvasClickCanceled", a); }; a.onmouseup = b; a.ontouchend = b; - $(document).click(function(b) { - Entry.stage.focused = "entryCanvas" === b.target.id ? !0 : !1; + $(document).click(function(a) { + Entry.stage.focused = "entryCanvas" === a.target.id ? !0 : !1; }); } - Entry.addEventListener("canvasClick", function(b) { + Entry.addEventListener("canvasClick", function(a) { Entry.stage.isObjectClick = !1; }); Entry.windowResized.attach(this, function() { Entry.stage.updateBoundRect(); }); - b = function(b) { - b.preventDefault(); - var a = Entry.stage.getBoundRect(), e; - -1 < Entry.getBrowserType().indexOf("IE") ? (e = 480 * ((b.pageX - a.left - document.documentElement.scrollLeft) / a.width - .5), b = -270 * ((b.pageY - a.top - document.documentElement.scrollTop) / a.height - .5)) : b.changedTouches ? (e = 480 * ((b.changedTouches[0].pageX - a.left - document.body.scrollLeft) / a.width - .5), b = -270 * ((b.changedTouches[0].pageY - a.top - document.body.scrollTop) / a.height - .5)) : (e = 480 * ((b.pageX - a.left - document.body.scrollLeft) / a.width - .5), - b = -270 * ((b.pageY - a.top - document.body.scrollTop) / a.height - .5)); - Entry.stage.mouseCoordinate = {x:e.toFixed(1), y:b.toFixed(1)}; + b = function(a) { + a.preventDefault(); + var b = Entry.stage.getBoundRect(), e; + -1 < Entry.getBrowserType().indexOf("IE") ? (e = 480 * ((a.pageX - b.left - document.documentElement.scrollLeft) / b.width - .5), a = -270 * ((a.pageY - b.top - document.documentElement.scrollTop) / b.height - .5)) : a.changedTouches ? (e = 480 * ((a.changedTouches[0].pageX - b.left - document.body.scrollLeft) / b.width - .5), a = -270 * ((a.changedTouches[0].pageY - b.top - document.body.scrollTop) / b.height - .5)) : (e = 480 * ((a.pageX - b.left - document.body.scrollLeft) / b.width - .5), + a = -270 * ((a.pageY - b.top - document.body.scrollTop) / b.height - .5)); + Entry.stage.mouseCoordinate = {x:e.toFixed(1), y:a.toFixed(1)}; Entry.dispatchEvent("stageMouseMove"); }; a.onmousemove = b; a.ontouchmove = b; - a.onmouseout = function(b) { + a.onmouseout = function(a) { Entry.dispatchEvent("stageMouseOut"); }; - Entry.addEventListener("updateObject", function(b) { + Entry.addEventListener("updateObject", function(a) { Entry.engine.isState("stop") && Entry.stage.updateObject(); }); - Entry.addEventListener("canvasInputComplete", function(b) { + Entry.addEventListener("canvasInputComplete", function(a) { try { - var a = Entry.stage.inputField.value(); + var b = Entry.stage.inputField.value(); Entry.stage.hideInputField(); - if (a) { + if (b) { var e = Entry.container; - e.setInputValue(a); + e.setInputValue(b); e.inputValue.complete = !0; } } catch (f) { @@ -15583,7 +14431,7 @@ Entry.Stage.prototype.showInputField = function(a) { c.cursor = "pointer"; c.image = b; a.addChild(c); - a.on("mousedown", function(b) { + a.on("mousedown", function(a) { Entry.dispatchEvent("canvasInputComplete"); }); this.inputSubmitButton || (this.inputField.value(""), this.canvas.addChild(a), this.inputSubmitButton = a); @@ -15678,14 +14526,14 @@ Entry.StampEntity = function(a, b) { this.height = b.getHeight(); "sprite" == this.type && (this.object = b.object.clone(!0), this.object.filters = null, b.effect && (this.effect = Entry.cloneSimpleObject(b.effect), this.applyFilter())); this.object.entity = this; - b.dialog && (a = b.dialog, new Entry.Dialog(this, a.message_, a.mode_, !0), this.dialog.object = b.dialog.object.clone(!0), Entry.stage.loadDialog(this.dialog)); -}; -var EntityPrototype = Entry.EntityObject.prototype; -Entry.StampEntity.prototype.applyFilter = EntityPrototype.applyFilter; -Entry.StampEntity.prototype.removeClone = EntityPrototype.removeClone; -Entry.StampEntity.prototype.getWidth = EntityPrototype.getWidth; -Entry.StampEntity.prototype.getHeight = EntityPrototype.getHeight; -Entry.StampEntity.prototype.getInitialEffectValue = EntityPrototype.getInitialEffectValue; +}; +(function(a, b) { + a.applyFilter = b.applyFilter; + a.removeClone = b.removeClone; + a.getWidth = b.getWidth; + a.getHeight = b.getHeight; + a.getInitialEffectValue = b.getInitialEffectValue; +})(Entry.StampEntity.prototype, Entry.EntityObject.prototype); Entry.Toast = function() { this.toasts_ = []; var a = document.getElementById("entryToastContainer"); @@ -15713,8 +14561,8 @@ Entry.Toast.prototype.warning = function(a, b, c) { this.body_.appendChild(d); c || window.setTimeout(function() { d.style.opacity = 1; - var b = setInterval(function() { - .05 > d.style.opacity && (clearInterval(b), d.style.display = "none", Entry.removeElement(d)); + var a = setInterval(function() { + .05 > d.style.opacity && (clearInterval(a), d.style.display = "none", Entry.removeElement(d)); d.style.opacity *= .9; }, 20); }, 1E3); @@ -15738,8 +14586,8 @@ Entry.Toast.prototype.success = function(a, b, c) { this.body_.appendChild(d); c || window.setTimeout(function() { d.style.opacity = 1; - var b = setInterval(function() { - .05 > d.style.opacity && (clearInterval(b), d.style.display = "none", Entry.removeElement(d)); + var a = setInterval(function() { + .05 > d.style.opacity && (clearInterval(a), d.style.display = "none", Entry.removeElement(d)); d.style.opacity *= .9; }, 20); }, 1E3); @@ -15763,8 +14611,8 @@ Entry.Toast.prototype.alert = function(a, b, c) { this.body_.appendChild(d); c || window.setTimeout(function() { d.style.opacity = 1; - var b = setInterval(function() { - .05 > d.style.opacity && (clearInterval(b), d.style.display = "none", Entry.toast.body_.removeChild(d)); + var a = setInterval(function() { + .05 > d.style.opacity && (clearInterval(a), d.style.display = "none", Entry.toast.body_.removeChild(d)); d.style.opacity *= .9; }, 20); }, 5E3); @@ -15804,44 +14652,51 @@ Entry.ContextMenu = {}; a.visible = !1; a.createDom = function() { this.dom = Entry.Dom("ul", {id:"entry-contextmenu", parent:$("body")}); - this.dom.bind("mousedown touchstart", function(b) { - b.stopPropagation(); + this.dom.bind("mousedown touchstart", function(a) { + a.stopPropagation(); }); Entry.Utils.disableContextmenu(this.dom); Entry.documentMousedown.attach(this, function() { this.hide(); }); }; - a.show = function(b, a, d) { + a.show = function(a, c, d) { this.dom || this.createDom(); - if (0 !== b.length) { + if (0 !== a.length) { var e = this; - void 0 !== a && (this._className = a, this.dom.addClass(a)); - a = this.dom; - a.empty(); - for (var f = 0, g = b.length;f < g;f++) { - var h = b[f], k = h.text, l = !1 !== h.enable, n = Entry.Dom("li", {class:l ? "menuAble" : "menuDisable", parent:a}), n = Entry.Dom("span", {parent:n}); - n.text(k); - l && h.callback && function(b, a) { - b.mousedown(function(b) { - b.preventDefault(); - e.hide(); - a(b); - }); - }(n, h.callback); + void 0 !== c && (this._className = c, this.dom.addClass(c)); + var f = this.dom; + f.empty(); + for (var g = 0, h = a.length;g < h;g++) { + var k = a[g], l = k.text, n = !1 !== k.enable, m = Entry.Dom("li", {parent:f}); + if (k.divider) { + c = "divider"; + } else { + c = n ? "menuAble" : "menuDisable"; + var q = Entry.Dom("span", {parent:m}); + q.text(l); + n && k.callback && function(a, b) { + a.mousedown(function(a) { + a.preventDefault(); + e.hide(); + b(a); + }); + }(q, k.callback); + } + m.addClass(c); } - a.removeClass("entryRemove"); + f.removeClass("entryRemove"); this.visible = !0; this.position(d || Entry.mouseCoordinate); } }; - a.position = function(b) { - var a = this.dom; - a.css({left:0, top:0}); - var d = a.width(), e = a.height(), f = $(window), g = f.width(), f = f.height(); - b.x + d > g && (b.x -= d + 3); - b.y + e > f && (b.y -= e); - a.css({left:b.x, top:b.y}); + a.position = function(a) { + var c = this.dom; + c.css({left:0, top:0}); + var d = c.width(), e = c.height(), f = $(window), g = f.width(), f = f.height(); + a.x + d > g && (a.x -= d + 3); + a.y + e > f && (a.y -= e); + c.css({left:a.x, top:a.y}); }; a.hide = function() { this.visible = !1; @@ -15873,17 +14728,17 @@ Entry.Variable = function(a) { this._valueWidth = this._nameWidth = null; var b = Entry.parseNumber(a.value); this.value_ = "number" == typeof b ? b : a.value ? a.value : 0; - "slide" == this.type ? (this.minValue_ = Number(a.minValue ? a.minValue : 0), this.maxValue_ = Number(a.maxValue ? a.maxValue : 100)) : "list" == this.type && (this.array_ = a.array ? a.array : []); + "slide" == this.type ? (this.setMinValue(a.minValue), this.setMaxValue(a.maxValue)) : "list" == this.type && (this.array_ = a.array ? a.array : []); a.isClone || (this.visible_ = a.visible || "boolean" == typeof a.visible ? a.visible : !0, this.x_ = a.x ? a.x : null, this.y_ = a.y ? a.y : null, "list" == this.type && (this.width_ = a.width ? a.width : 100, this.height_ = a.height ? a.height : 120, this.scrollPosition = 0), this.BORDER = 6, this.FONT = "10pt NanumGothic"); }; Entry.Variable.prototype.generateView = function(a) { var b = this.type; if ("variable" == b || "timer" == b || "answer" == b) { this.view_ = new createjs.Container, this.rect_ = new createjs.Shape, this.view_.addChild(this.rect_), this.view_.variable = this, this.wrapper_ = new createjs.Shape, this.view_.addChild(this.wrapper_), this.textView_ = new createjs.Text("asdf", this.FONT, "#000000"), this.textView_.textBaseline = "alphabetic", this.textView_.x = 4, this.textView_.y = 1, this.view_.addChild(this.textView_), this.valueView_ = new createjs.Text("asdf", "10pt NanumGothic", "#ffffff"), this.valueView_.textBaseline = - "alphabetic", b = Entry.variableContainer.variables_.length, this.getX() && this.getY() ? (this.setX(this.getX()), this.setY(this.getY())) : (this.setX(-230 + 80 * Math.floor(b / 11)), this.setY(24 * a + 20 - 135 - 264 * Math.floor(b / 11))), this.view_.visible = this.visible_, this.view_.addChild(this.valueView_), this.view_.on("mousedown", function(b) { - "workspace" == Entry.type && (this.offset = {x:this.x - (.75 * b.stageX - 240), y:this.y - (.75 * b.stageY - 135)}, this.cursor = "move"); - }), this.view_.on("pressmove", function(b) { - "workspace" == Entry.type && (this.variable.setX(.75 * b.stageX - 240 + this.offset.x), this.variable.setY(.75 * b.stageY - 135 + this.offset.y), this.variable.updateView()); + "alphabetic", b = Entry.variableContainer.variables_.length, this.getX() && this.getY() ? (this.setX(this.getX()), this.setY(this.getY())) : (this.setX(-230 + 80 * Math.floor(b / 11)), this.setY(24 * a + 20 - 135 - 264 * Math.floor(b / 11))), this.view_.visible = this.visible_, this.view_.addChild(this.valueView_), this.view_.on("mousedown", function(a) { + "workspace" == Entry.type && (this.offset = {x:this.x - (.75 * a.stageX - 240), y:this.y - (.75 * a.stageY - 135)}, this.cursor = "move"); + }), this.view_.on("pressmove", function(a) { + "workspace" == Entry.type && (this.variable.setX(.75 * a.stageX - 240 + this.offset.x), this.variable.setY(.75 * a.stageY - 135 + this.offset.y), this.variable.updateView()); }); } else { if ("slide" == b) { @@ -15901,11 +14756,11 @@ Entry.Variable.prototype.generateView = function(a) { this.view_.addChild(this.textView_); this.valueView_ = new createjs.Text("value", "10pt NanumGothic", "#ffffff"); this.valueView_.textBaseline = "alphabetic"; - this.view_.on("mousedown", function(b) { - "workspace" == Entry.type && (this.offset = {x:this.x - (.75 * b.stageX - 240), y:this.y - (.75 * b.stageY - 135)}); + this.view_.on("mousedown", function(a) { + "workspace" == Entry.type && (this.offset = {x:this.x - (.75 * a.stageX - 240), y:this.y - (.75 * a.stageY - 135)}); }); - this.view_.on("pressmove", function(b) { - "workspace" != Entry.type || c.isAdjusting || (this.variable.setX(.75 * b.stageX - 240 + this.offset.x), this.variable.setY(.75 * b.stageY - 135 + this.offset.y), this.variable.updateView()); + this.view_.on("pressmove", function(a) { + "workspace" != Entry.type || c.isAdjusting || (this.variable.setX(.75 * a.stageX - 240 + this.offset.x), this.variable.setY(.75 * a.stageY - 135 + this.offset.y), this.variable.updateView()); }); this.view_.visible = this.visible_; this.view_.addChild(this.valueView_); @@ -15919,17 +14774,17 @@ Entry.Variable.prototype.generateView = function(a) { this.valueSetter_ = new createjs.Shape; this.valueSetter_.graphics.beginFill("#1bafea").s("#A0A1A1").ss(1).dc(b, 10.5, 3); this.valueSetter_.cursor = "pointer"; - this.valueSetter_.on("mousedown", function(b) { - Entry.engine.isState("run") && (c.isAdjusting = !0, this.offsetX = -(this.x - .75 * b.stageX + 240)); + this.valueSetter_.on("mousedown", function(a) { + Entry.engine.isState("run") && (c.isAdjusting = !0, this.offsetX = -(this.x - .75 * a.stageX + 240)); }); - this.valueSetter_.on("pressmove", function(b) { + this.valueSetter_.on("pressmove", function(a) { if (Entry.engine.isState("run")) { - var a = this.offsetX; - this.offsetX = -(this.x - .75 * b.stageX + 240); - a !== this.offsetX && (b = c.getX(), c.setSlideCommandX(b + 10 > this.offsetX ? 0 : b + c.maxWidth + 10 > this.offsetX ? this.offsetX - b : c.maxWidth + 10)); + var b = this.offsetX; + this.offsetX = -(this.x - .75 * a.stageX + 240); + b !== this.offsetX && (a = c.getX(), c.setSlideCommandX(a + 10 > this.offsetX ? 0 : a + c.maxWidth + 10 > this.offsetX ? this.offsetX - a : c.maxWidth + 10)); } }); - this.valueSetter_.on("pressup", function(b) { + this.valueSetter_.on("pressup", function(a) { c.isAdjusting = !1; }); this.view_.addChild(this.valueSetter_); @@ -15937,36 +14792,36 @@ Entry.Variable.prototype.generateView = function(a) { this.getX() && this.getY() ? (this.setX(this.getX()), this.setY(this.getY())) : (this.setX(-230 + 80 * Math.floor(b / 11)), this.setY(24 * a + 20 - 135 - 264 * Math.floor(b / 11))); } else { this.view_ = new createjs.Container, this.rect_ = new createjs.Shape, this.view_.addChild(this.rect_), this.view_.variable = this, this.titleView_ = new createjs.Text("asdf", this.FONT, "#000"), this.titleView_.textBaseline = "alphabetic", this.titleView_.textAlign = "center", this.titleView_.width = this.width_ - 2 * this.BORDER, this.titleView_.y = this.BORDER + 10, this.titleView_.x = this.width_ / 2, this.view_.addChild(this.titleView_), this.resizeHandle_ = new createjs.Shape, this.resizeHandle_.graphics.f("#1bafea").ss(1, - 0, 0).s("#1bafea").lt(0, -9).lt(-9, 0).lt(0, 0), this.view_.addChild(this.resizeHandle_), this.resizeHandle_.list = this, this.resizeHandle_.on("mouseover", function(b) { + 0, 0).s("#1bafea").lt(0, -9).lt(-9, 0).lt(0, 0), this.view_.addChild(this.resizeHandle_), this.resizeHandle_.list = this, this.resizeHandle_.on("mouseover", function(a) { this.cursor = "nwse-resize"; - }), this.resizeHandle_.on("mousedown", function(b) { + }), this.resizeHandle_.on("mousedown", function(a) { this.list.isResizing = !0; - this.offset = {x:.75 * b.stageX - this.list.getWidth(), y:.75 * b.stageY - this.list.getHeight()}; + this.offset = {x:.75 * a.stageX - this.list.getWidth(), y:.75 * a.stageY - this.list.getHeight()}; this.parent.cursor = "nwse-resize"; - }), this.resizeHandle_.on("pressmove", function(b) { - this.list.setWidth(.75 * b.stageX - this.offset.x); - this.list.setHeight(.75 * b.stageY - this.offset.y); + }), this.resizeHandle_.on("pressmove", function(a) { + this.list.setWidth(.75 * a.stageX - this.offset.x); + this.list.setHeight(.75 * a.stageY - this.offset.y); this.list.updateView(); - }), this.view_.on("mouseover", function(b) { + }), this.view_.on("mouseover", function(a) { this.cursor = "move"; - }), this.view_.on("mousedown", function(b) { - "workspace" != Entry.type || this.variable.isResizing || (this.offset = {x:this.x - (.75 * b.stageX - 240), y:this.y - (.75 * b.stageY - 135)}, this.cursor = "move"); - }), this.view_.on("pressup", function(b) { + }), this.view_.on("mousedown", function(a) { + "workspace" != Entry.type || this.variable.isResizing || (this.offset = {x:this.x - (.75 * a.stageX - 240), y:this.y - (.75 * a.stageY - 135)}, this.cursor = "move"); + }), this.view_.on("pressup", function(a) { this.cursor = "initial"; this.variable.isResizing = !1; - }), this.view_.on("pressmove", function(b) { - "workspace" != Entry.type || this.variable.isResizing || (this.variable.setX(.75 * b.stageX - 240 + this.offset.x), this.variable.setY(.75 * b.stageY - 135 + this.offset.y), this.variable.updateView()); + }), this.view_.on("pressmove", function(a) { + "workspace" != Entry.type || this.variable.isResizing || (this.variable.setX(.75 * a.stageX - 240 + this.offset.x), this.variable.setY(.75 * a.stageY - 135 + this.offset.y), this.variable.updateView()); }), this.elementView = new createjs.Container, b = new createjs.Text("asdf", this.FONT, "#000"), b.textBaseline = "middle", b.y = 5, this.elementView.addChild(b), this.elementView.indexView = b, b = new createjs.Shape, this.elementView.addChild(b), this.elementView.valueWrapper = b, b = new createjs.Text("fdsa", this.FONT, "#eee"), b.x = 24, b.y = 6, b.textBaseline = "middle", this.elementView.addChild(b), this.elementView.valueView = b, this.elementView.x = this.BORDER, this.scrollButton_ = - new createjs.Shape, this.scrollButton_.graphics.f("#aaa").rr(0, 0, 7, 30, 3.5), this.view_.addChild(this.scrollButton_), this.scrollButton_.y = 23, this.scrollButton_.list = this, this.scrollButton_.on("mousedown", function(b) { + new createjs.Shape, this.scrollButton_.graphics.f("#aaa").rr(0, 0, 7, 30, 3.5), this.view_.addChild(this.scrollButton_), this.scrollButton_.y = 23, this.scrollButton_.list = this, this.scrollButton_.on("mousedown", function(a) { this.list.isResizing = !0; this.cursor = "pointer"; - this.offsetY = isNaN(this.offsetY) || 0 > this.offsetY ? b.rawY / 2 : this.offsetY; - }), this.scrollButton_.on("pressmove", function(b) { - void 0 === this.moveAmount ? (this.y = b.target.y, this.moveAmount = !0) : this.y = b.rawY / 2 - this.offsetY + this.list.height_ / 100 * 23; + this.offsetY = isNaN(this.offsetY) || 0 > this.offsetY ? a.rawY / 2 : this.offsetY; + }), this.scrollButton_.on("pressmove", function(a) { + void 0 === this.moveAmount ? (this.y = a.target.y, this.moveAmount = !0) : this.y = a.rawY / 2 - this.offsetY + this.list.height_ / 100 * 23; 23 > this.y && (this.y = 23); this.y > this.list.getHeight() - 40 && (this.y = this.list.getHeight() - 40); this.list.updateView(); - }), this.scrollButton_.on("pressup", function(b) { + }), this.scrollButton_.on("pressup", function(a) { this.moveAmount = void 0; }), this.getX() && this.getY() ? (this.setX(this.getX()), this.setY(this.getY())) : (b = Entry.variableContainer.lists_.length, this.setX(110 * -Math.floor(b / 6) + 120), this.setY(24 * a + 20 - 135 - 145 * Math.floor(b / 6))); } @@ -16169,7 +15024,7 @@ Entry.Variable.prototype.getMinValue = function() { return this.minValue_; }; Entry.Variable.prototype.setMinValue = function(a) { - this.minValue_ = a; + this.minValue_ = a = a || 0; this.value_ < a && (this.value_ = a); this.updateView(); this.isMinFloat = Entry.isFloat(this.minValue_); @@ -16178,7 +15033,7 @@ Entry.Variable.prototype.getMaxValue = function() { return this.maxValue_; }; Entry.Variable.prototype.setMaxValue = function(a) { - this.maxValue_ = a; + this.maxValue_ = a = a || 100; this.value_ > a && (this.value_ = a); this.updateView(); this.isMaxFloat = Entry.isFloat(this.maxValue_); @@ -16678,14 +15533,14 @@ Entry.VariableContainer.prototype.createVariableView = function(a) { h.addClass("entryVariableListElementNameWorkspace"); h.setAttribute("disabled", "disabled"); h.value = a.name_; - h.bindOnClick(function(b) { - b.stopPropagation(); + h.bindOnClick(function(a) { + a.stopPropagation(); }); h.onblur = function(c) { (c = this.value.trim()) && 0 !== c.length ? b.changeVariableName(a, this.value) : (Entry.toast.alert(Lang.Msgs.warn, Lang.Workspace.variable_can_not_space), this.value = a.getName()); }; - h.onkeydown = function(b) { - 13 == b.keyCode && this.blur(); + h.onkeydown = function(a) { + 13 == a.keyCode && this.blur(); }; c.nameField = h; d.appendChild(h); @@ -16731,8 +15586,8 @@ Entry.VariableContainer.prototype.createMessageView = function(a) { }); var e = Entry.createElement("button"); e.addClass("entryVariableListElementEditWorkspace"); - e.bindOnClick(function(b) { - b.stopPropagation(); + e.bindOnClick(function(a) { + a.stopPropagation(); g.removeAttribute("disabled"); g.focus(); f.removeClass("entryRemove"); @@ -16741,8 +15596,8 @@ Entry.VariableContainer.prototype.createMessageView = function(a) { var f = Entry.createElement("button"); f.addClass("entryVariableListElementEditWorkspace"); f.addClass("entryRemove"); - f.bindOnClick(function(b) { - b.stopPropagation(); + f.bindOnClick(function(a) { + a.stopPropagation(); g.blur(); e.removeClass("entryRemove"); this.addClass("entryRemove"); @@ -16750,14 +15605,14 @@ Entry.VariableContainer.prototype.createMessageView = function(a) { var g = Entry.createElement("input"); g.addClass("entryVariableListElementNameWorkspace"); g.value = a.name; - g.bindOnClick(function(b) { - b.stopPropagation(); + g.bindOnClick(function(a) { + a.stopPropagation(); }); g.onblur = function(c) { (c = this.value.trim()) && 0 !== c.length ? (b.changeMessageName(a, this.value), e.removeClass("entryRemove"), f.addClass("entryRemove"), g.setAttribute("disabled", "disabled")) : (Entry.toast.alert(Lang.Msgs.warn, Lang.Msgs.sign_can_not_space), this.value = a.name); }; - g.onkeydown = function(b) { - 13 == b.keyCode && this.blur(); + g.onkeydown = function(a) { + 13 == a.keyCode && this.blur(); }; c.nameField = g; c.appendChild(g); @@ -16832,14 +15687,14 @@ Entry.VariableContainer.prototype.createListView = function(a) { h.setAttribute("disabled", "disabled"); h.addClass("entryVariableListElementNameWorkspace"); h.value = a.name_; - h.bindOnClick(function(b) { - b.stopPropagation(); + h.bindOnClick(function(a) { + a.stopPropagation(); }); h.onblur = function(c) { (c = this.value.trim()) && 0 !== c.length ? b.changeListName(a, this.value) : (Entry.toast.alert(Lang.Msgs.warn, Lang.Msgs.list_can_not_space), this.value = a.getName()); }; - h.onkeydown = function(b) { - 13 == b.keyCode && this.blur(); + h.onkeydown = function(a) { + 13 == a.keyCode && this.blur(); }; c.nameField = h; d.appendChild(h); @@ -17106,8 +15961,8 @@ Entry.VariableContainer.prototype.addCloneLocalVariables = function(a) { this.mapVariable(function(a, c) { a.object_ && a.object_ == c.objectId && (a = a.toJSON(), a.originId = a.id, a.id = Entry.generateHash(), a.object = c.newObjectId, delete a.x, delete a.y, b.push(a), c.json.script = c.json.script.replace(new RegExp(a.originId, "g"), a.id)); }, a); - b.map(function(b) { - c.addVariable(b); + b.map(function(a) { + c.addVariable(a); }); }; Entry.VariableContainer.prototype.generateTimer = function(a) { @@ -17126,8 +15981,8 @@ Entry.VariableContainer.prototype.generateAnswer = function(a) { }; Entry.VariableContainer.prototype.generateVariableSettingView = function() { var a = this, b = Entry.createElement("div"); - b.bindOnClick(function(b) { - b.stopPropagation(); + b.bindOnClick(function(a) { + a.stopPropagation(); }); this.variableSettingView = b; b.addClass("entryVariableSettingWorkspace"); @@ -17201,6 +16056,9 @@ Entry.VariableContainer.prototype.generateVariableSettingView = function() { e.addClass("entryVariableSettingMinValueInputWorkspace"); d = a.selectedVariable; e.value = d && "slide" == d.type ? d.minValue_ : 0; + e.onkeypress = function(a) { + 13 === a.keyCode && this.blur(); + }; e.onblur = function(b) { isNaN(this.value) || (b = a.selectedVariable, b.setMinValue(this.value), a.updateVariableSettingView(b)); }; @@ -17213,6 +16071,9 @@ Entry.VariableContainer.prototype.generateVariableSettingView = function() { var g = Entry.createElement("input"); g.addClass("entryVariableSettingMaxValueInputWorkspace"); g.value = d && "slide" == d.type ? d.maxValue_ : 100; + g.onkeypress = function(a) { + 13 === a.keyCode && this.blur(); + }; g.onblur = function(b) { isNaN(this.value) || (b = a.selectedVariable, b.setMaxValue(this.value), a.updateVariableSettingView(b)); }; @@ -17231,8 +16092,8 @@ Entry.VariableContainer.prototype.updateVariableSettingView = function(a) { }; Entry.VariableContainer.prototype.generateListSettingView = function() { var a = this, b = Entry.createElement("div"); - b.bindOnClick(function(b) { - b.stopPropagation(); + b.bindOnClick(function(a) { + a.stopPropagation(); }); this.listSettingView = b; b.addClass("entryListSettingWorkspace"); @@ -17276,8 +16137,8 @@ Entry.VariableContainer.prototype.generateListSettingView = function() { d.onblur = function() { a.setListLength(this.value); }; - d.onkeypress = function(b) { - 13 == b.keyCode && this.blur(); + d.onkeypress = function(a) { + 13 == a.keyCode && this.blur(); }; b.lengthInput = d; c.appendChild(d); @@ -17323,8 +16184,8 @@ Entry.VariableContainer.prototype.updateListSettingView = function(a) { h[c].data = this.value; a.updateView(); }; - f.onkeypress = function(b) { - 13 == b.keyCode && this.blur(); + f.onkeypress = function(a) { + 13 == a.keyCode && this.blur(); }; f.addClass("entryListSettingEachInputWorkspace"); e.appendChild(f); @@ -17358,11 +16219,11 @@ Entry.VariableContainer.prototype.setListLength = function(a) { }; Entry.VariableContainer.prototype.updateViews = function() { var a = this.lists_; - this.variables_.map(function(b) { - b.updateView(); + this.variables_.map(function(a) { + a.updateView(); }); - a.map(function(b) { - b.updateView(); + a.map(function(a) { + a.updateView(); }); }; Entry.VariableContainer.prototype.updateSelectedVariable = function(a, b) { @@ -17373,21 +16234,21 @@ Entry.VariableContainer.prototype.removeLocalVariables = function(a) { this.mapVariable(function(a, c) { a.object_ && a.object_ == c && b.push(a); }, a); - b.map(function(b) { - c.removeVariable(b); + b.map(function(a) { + c.removeVariable(a); }); }; Entry.VariableContainer.prototype.updateCloudVariables = function() { var a = Entry.projectId; if (Entry.cloudSavable && a) { - var b = Entry.variableContainer, a = b.variables_.filter(function(b) { - return b.isCloud_; - }), a = a.map(function(b) { - return b.toJSON(); - }), b = b.lists_.filter(function(b) { - return b.isCloud_; - }), b = b.map(function(b) { - return b.toJSON(); + var b = Entry.variableContainer, a = b.variables_.filter(function(a) { + return a.isCloud_; + }), a = a.map(function(a) { + return a.toJSON(); + }), b = b.lists_.filter(function(a) { + return a.isCloud_; + }), b = b.map(function(a) { + return a.toJSON(); }); $.ajax({url:"/api/project/variable/" + Entry.projectId, type:"PUT", data:{variables:a, lists:b}}).done(function() { }); @@ -17956,93 +16817,93 @@ Entry.Thread = function(a, b, c) { this.load(a); }; (function(a) { - a.load = function(b, a) { - void 0 === b && (b = []); - if (!(b instanceof Array)) { + a.load = function(a, c) { + void 0 === a && (a = []); + if (!(a instanceof Array)) { return console.error("thread must be array"); } - for (var d = 0;d < b.length;d++) { - var e = b[d]; + for (var d = 0;d < a.length;d++) { + var e = a[d]; e instanceof Entry.Block || e.isDummy ? (e.setThread(this), this._data.push(e)) : this._data.push(new Entry.Block(e, this)); } - (b = this._code.view) && this.createView(b.board, a); + (a = this._code.view) && this.createView(a.board, c); }; - a.registerEvent = function(b, a) { - this._event = a; - this._code.registerEvent(b, a); + a.registerEvent = function(a, c) { + this._event = c; + this._code.registerEvent(a, c); }; - a.unregisterEvent = function(b, a) { - this._code.unregisterEvent(b, a); + a.unregisterEvent = function(a, c) { + this._code.unregisterEvent(a, c); }; - a.createView = function(b, a) { - this.view || (this.view = new Entry.ThreadView(this, b)); + a.createView = function(a, c) { + this.view || (this.view = new Entry.ThreadView(this, a)); this._data.map(function(d) { - d.createView(b, a); + d.createView(a, c); }); }; - a.separate = function(b, a) { - this._data.has(b.id) && (b = this._data.splice(this._data.indexOf(b), a), this._code.createThread(b), this.changeEvent.notify()); + a.separate = function(a, c) { + this._data.has(a.id) && (a = this._data.splice(this._data.indexOf(a), c), this._code.createThread(a), this.changeEvent.notify()); }; - a.cut = function(b) { - b = this._data.indexOf(b); - b = this._data.splice(b); + a.cut = function(a) { + a = this._data.indexOf(a); + a = this._data.splice(a); this.changeEvent.notify(); - return b; + return a; }; - a.insertByBlock = function(b, a) { - b = b ? this._data.indexOf(b) : -1; - for (var d = 0;d < a.length;d++) { - a[d].setThread(this); + a.insertByBlock = function(a, c) { + a = a ? this._data.indexOf(a) : -1; + for (var d = 0;d < c.length;d++) { + c[d].setThread(this); } - this._data.splice.apply(this._data, [b + 1, 0].concat(a)); + this._data.splice.apply(this._data, [a + 1, 0].concat(c)); this.changeEvent.notify(); }; - a.insertToTop = function(b) { - b.setThread(this); - this._data.unshift.apply(this._data, [b]); + a.insertToTop = function(a) { + a.setThread(this); + this._data.unshift.apply(this._data, [a]); this.changeEvent.notify(); }; - a.clone = function(b, a) { - b = b || this._code; - b = new Entry.Thread([], b); + a.clone = function(a, c) { + a = a || this._code; + a = new Entry.Thread([], a); for (var d = this._data, e = [], f = 0, g = d.length;f < g;f++) { - e.push(d[f].clone(b)); + e.push(d[f].clone(a)); } - b.load(e, a); - return b; + a.load(e, c); + return a; }; - a.toJSON = function(b, a) { + a.toJSON = function(a, c) { var d = []; - for (a = void 0 === a ? 0 : a;a < this._data.length;a++) { - this._data[a] instanceof Entry.Block && d.push(this._data[a].toJSON(b)); + for (c = void 0 === c ? 0 : c;c < this._data.length;c++) { + this._data[c] instanceof Entry.Block && d.push(this._data[c].toJSON(a)); } return d; }; - a.destroy = function(b) { + a.destroy = function(a) { this._code.destroyThread(this, !1); - this.view && this.view.destroy(b); - for (var a = this._data, d = a.length - 1;0 <= d;d--) { - a[d].destroy(b); + this.view && this.view.destroy(a); + for (var c = this._data, d = c.length - 1;0 <= d;d--) { + c[d].destroy(a); } }; - a.getBlock = function(b) { - return this._data[b]; + a.getBlock = function(a) { + return this._data[a]; }; a.getBlocks = function() { - return this._data.map(function(b) { - return b; + return this._data.map(function(a) { + return a; }); }; a.countBlock = function() { - for (var b = 0, a = 0;a < this._data.length;a++) { - var d = this._data[a]; - if (d.type && (b++, d = d.statements)) { + for (var a = 0, c = 0;c < this._data.length;c++) { + var d = this._data[c]; + if (d.type && (a++, d = d.statements)) { for (var e = 0;e < d.length;e++) { - b += d[e].countBlock(); + a += d[e].countBlock(); } } } - return b; + return a; }; a.handleChange = function() { 0 === this._data.length && this.destroy(); @@ -18050,25 +16911,25 @@ Entry.Thread = function(a, b, c) { a.getCode = function() { return this._code; }; - a.setCode = function(b) { - this._code = b; + a.setCode = function(a) { + this._code = a; }; - a.spliceBlock = function(b) { - var a = this._data; - a.remove(b); - 0 === a.length && this.view.getParent().constructor !== Entry.FieldStatement && this.destroy(); + a.spliceBlock = function(a) { + var c = this._data; + c.remove(a); + 0 === c.length && this.view.getParent().constructor !== Entry.FieldStatement && this.destroy(); this.changeEvent.notify(); }; a.getFirstBlock = function() { return this._data[0]; }; - a.getPrevBlock = function(b) { - b = this._data.indexOf(b); - return this._data.at(b - 1); + a.getPrevBlock = function(a) { + a = this._data.indexOf(a); + return this._data.at(a - 1); }; - a.getNextBlock = function(b) { - b = this._data.indexOf(b); - return this._data.at(b + 1); + a.getNextBlock = function(a) { + a = this._data.indexOf(a); + return this._data.at(a + 1); }; a.getLastBlock = function() { return this._data.at(this._data.length - 1); @@ -18076,20 +16937,20 @@ Entry.Thread = function(a, b, c) { a.getRootBlock = function() { return this._data.at(0); }; - a.hasBlockType = function(b) { - function a(d) { - if (b == d.type) { + a.hasBlockType = function(a) { + function c(d) { + if (a == d.type) { return !0; } for (var f = d.params, g = 0;g < f.length;g++) { var h = f[g]; - if (h && h.constructor == Entry.Block && a(h)) { + if (h && h.constructor == Entry.Block && c(h)) { return !0; } } if (d = d.statements) { for (f = 0;f < d.length;f++) { - if (d[f].hasBlockType(b)) { + if (d[f].hasBlockType(a)) { return !0; } } @@ -18097,31 +16958,31 @@ Entry.Thread = function(a, b, c) { return !1; } for (var d = 0;d < this._data.length;d++) { - if (a(this._data[d])) { + if (c(this._data[d])) { return !0; } } return !1; }; - a.getCount = function(b) { - var a = this._data.length; - b && (a -= this._data.indexOf(b)); - return a; + a.getCount = function(a) { + var c = this._data.length; + a && (c -= this._data.indexOf(a)); + return c; }; - a.indexOf = function(b) { - return this._data.indexOf(b); + a.indexOf = function(a) { + return this._data.indexOf(a); }; - a.pointer = function(b, a) { - a = this.indexOf(a); - b.unshift(a); - this.parent instanceof Entry.Block && b.unshift(this.parent.indexOfStatements(this)); - return this._code === this.parent ? (b.unshift(this._code.indexOf(this)), a = this._data[0], b.unshift(a.y), b.unshift(a.x), b) : this.parent.pointer(b); + a.pointer = function(a, c) { + c = this.indexOf(c); + a.unshift(c); + this.parent instanceof Entry.Block && a.unshift(this.parent.indexOfStatements(this)); + return this._code === this.parent ? (a.unshift(this._code.indexOf(this)), c = this._data[0], a.unshift(c.y), a.unshift(c.x), a) : this.parent.pointer(a); }; - a.getBlockList = function(b) { - for (var a = [], d = 0;d < this._data.length;d++) { - a = a.concat(this._data[d].getBlockList(b)); + a.getBlockList = function(a) { + for (var c = [], d = 0;d < this._data.length;d++) { + c = c.concat(this._data[d].getBlockList(a)); } - return a; + return c; }; a.stringify = function() { return JSON.stringify(this.toJSON()); @@ -18316,8 +17177,8 @@ Entry.Block = function(a, b) { this.load(a); a = this.getCode(); a.registerBlock(this); - (b = this.events.dataAdd) && a.object && b.forEach(function(b) { - Entry.Utils.isFunction(b) && b(c); + (b = this.events.dataAdd) && a.object && b.forEach(function(a) { + Entry.Utils.isFunction(a) && a(c); }); }; Entry.Block.MAGNET_RANGE = 10; @@ -18327,12 +17188,12 @@ Entry.Block.DELETABLE_FALSE = 2; Entry.Block.DELETABLE_FALSE_LIGHTEN = 3; (function(a) { a.schema = {id:null, x:0, y:0, type:null, params:[], statements:[], view:null, thread:null, movable:null, deletable:Entry.Block.DELETABLE_TRUE, readOnly:null, copyable:!0, events:{}}; - a.load = function(b) { - b.id || (b.id = Entry.Utils.generateId()); - this.set(b); + a.load = function(a) { + a.id || (a.id = Entry.Utils.generateId()); + this.set(a); this.loadSchema(); }; - a.changeSchema = function(b) { + a.changeSchema = function(a) { this.set({params:[]}); this.loadSchema(); }; @@ -18343,89 +17204,89 @@ Entry.Block.DELETABLE_FALSE_LIGHTEN = 3; a.loadSchema = function() { if (this._schema = Entry.block[this.type]) { !this._schemaChangeEvent && this._schema.changeEvent && (this._schemaChangeEvent = this._schema.changeEvent.attach(this, this.changeSchema)); - var b = this._schema.events; - if (b) { - for (var a in b) { - this.events[a] || (this.events[a] = []); - for (var d = b[a], e = 0;e < d.length;e++) { + var a = this._schema.events; + if (a) { + for (var c in a) { + this.events[c] || (this.events[c] = []); + for (var d = a[c], e = 0;e < d.length;e++) { var f = d[e]; - f && 0 > this.events[a].indexOf(f) && this.events[a].push(f); + f && 0 > this.events[c].indexOf(f) && this.events[c].push(f); } } } this._schema.event && this.thread.registerEvent(this, this._schema.event); - b = this.params; - a = this._schema.params; - for (e = 0;a && e < a.length;e++) { - d = void 0 === b[e] || null === b[e] ? a[e].value : b[e], f = b[e] || e < b.length, !d || "Output" !== a[e].type && "Block" !== a[e].type || (d = new Entry.Block(d, this.thread)), f ? b.splice(e, 1, d) : b.push(d); + a = this.params; + c = this._schema.params; + for (e = 0;c && e < c.length;e++) { + d = void 0 === a[e] || null === a[e] ? c[e].value : a[e], f = a[e] || e < a.length, !d || "Output" !== c[e].type && "Block" !== c[e].type || (d = new Entry.Block(d, this.thread)), f ? a.splice(e, 1, d) : a.push(d); } - if (b = this._schema.statements) { - for (e = 0;e < b.length;e++) { + if (a = this._schema.statements) { + for (e = 0;e < a.length;e++) { this.statements.splice(e, 1, new Entry.Thread(this.statements[e], this.getCode(), this)); } } } }; - a.changeType = function(b) { + a.changeType = function(a) { this._schemaChangeEvent && this._schemaChangeEvent.destroy(); - this.set({type:b}); + this.set({type:a}); this.loadSchema(); - this.view && this.view.changeType(b); + this.view && this.view.changeType(a); }; - a.setThread = function(b) { - this.set({thread:b}); + a.setThread = function(a) { + this.set({thread:a}); }; a.getThread = function() { return this.thread; }; - a.insertAfter = function(b) { - this.thread.insertByBlock(this, b); + a.insertAfter = function(a) { + this.thread.insertByBlock(this, a); }; a._updatePos = function() { this.view && this.set({x:this.view.x, y:this.view.y}); }; - a.moveTo = function(b, a) { - this.view && this.view._moveTo(b, a); + a.moveTo = function(a, c) { + this.view && this.view._moveTo(a, c); this._updatePos(); this.getCode().changeEvent.notify(); }; - a.createView = function(b, a) { - this.view || (this.set({view:new Entry.BlockView(this, b, a)}), this._updatePos()); + a.createView = function(a, c) { + this.view || (this.set({view:new Entry.BlockView(this, a, c)}), this._updatePos()); }; - a.clone = function(b) { - return new Entry.Block(this.toJSON(!0), b); + a.clone = function(a) { + return new Entry.Block(this.toJSON(!0), a); }; - a.toJSON = function(b) { - var a = this._toJSON(); - delete a.view; - delete a.thread; - delete a.events; - b && delete a.id; - a.params = a.params.map(function(a) { - a instanceof Entry.Block && (a = a.toJSON(b)); - return a; + a.toJSON = function(a) { + var c = this._toJSON(); + delete c.view; + delete c.thread; + delete c.events; + a && delete c.id; + c.params = c.params.map(function(c) { + c instanceof Entry.Block && (c = c.toJSON(a)); + return c; }); - a.statements = a.statements.map(function(a) { - return a.toJSON(b); + c.statements = c.statements.map(function(c) { + return c.toJSON(a); }); - a.x = this.x; - a.y = this.y; - a.movable = this.movable; - a.deletable = this.deletable; - a.readOnly = this.readOnly; - return a; + c.x = this.x; + c.y = this.y; + c.movable = this.movable; + c.deletable = this.deletable; + c.readOnly = this.readOnly; + return c; }; - a.destroy = function(b, a) { + a.destroy = function(a, c) { var d = this, e = this.params; if (e) { for (var f = 0;f < e.length;f++) { var g = e[f]; - g instanceof Entry.Block && (g.doNotSplice = !0, g.destroy(b)); + g instanceof Entry.Block && (g.doNotSplice = !0, g.destroy(a)); } } if (e = this.statements) { for (f = 0;f < e.length;f++) { - e[f].destroy(b); + e[f].destroy(a); } } g = this.getPrevBlock(); @@ -18433,53 +17294,22 @@ Entry.Block.DELETABLE_FALSE_LIGHTEN = 3; this.getCode().unregisterBlock(this); e = this.getThread(); this._schema.event && e.unregisterEvent(this, this._schema.event); - f && (a ? f.destroy(b, a) : g ? f.view.bindPrev(g) : (a = this.getThread().view.getParent(), a.constructor === Entry.FieldStatement ? (f.view.bindPrev(a), a.insertTopBlock(f)) : a.constructor === Entry.FieldStatement ? f.replace(a._valueBlock) : f.view._toGlobalCoordinate())); + f && (c ? f.destroy(a, c) : g ? f.view.bindPrev(g) : (c = this.getThread().view.getParent(), c.constructor === Entry.FieldStatement ? (f.view.bindPrev(c), c.insertTopBlock(f)) : c.constructor === Entry.FieldStatement ? f.replace(c._valueBlock) : f.view._toGlobalCoordinate())); !this.doNotSplice && e.spliceBlock ? e.spliceBlock(this) : delete this.doNotSplice; - this.view && this.view.destroy(b); + this.view && this.view.destroy(a); this._schemaChangeEvent && this._schemaChangeEvent.destroy(); - (b = this.events.dataDestroy) && this.getCode().object && b.forEach(function(b) { - Entry.Utils.isFunction(b) && b(d); + (a = this.events.dataDestroy) && this.getCode().object && a.forEach(function(a) { + Entry.Utils.isFunction(a) && a(d); }); }; a.getView = function() { return this.view; }; - a.setMovable = function(b) { - this.movable != b && this.set({movable:b}); + a.setMovable = function(a) { + this.movable != a && this.set({movable:a}); }; -<<<<<<< HEAD - a.setCopyable = function(b) { - this.copyable != b && this.set({copyable:b}); -======= -})(Entry.FieldDropdown.prototype); -Entry.FieldDropdownDynamic = function(b, a, c) { - this._block = a.block; - this._blockView = a; - this.box = new Entry.BoxModel; - this.svgGroup = null; - this._contents = b; - this._index = c; - this._arrowColor = b.arrowColor; - c = this._contents.menuName; - Entry.Utils.isFunction(c) ? this._menuGenerator = c : this._menuName = c; - this._CONTENT_HEIGHT = this.getContentHeight(b.dropdownHeight); - this._FONT_SIZE = this.getFontSize(b.fontSize); - this._ROUND = b.roundValue || 3; - this.renderStart(a); -}; -Entry.Utils.inherit(Entry.FieldDropdown, Entry.FieldDropdownDynamic); -(function(b) { - b.constructor = Entry.FieldDropDownDynamic; - b._updateValue = function() { - var a = this._block.getCode().object, b = []; - Entry.container && (b = this._menuName ? Entry.container.getDropdownList(this._menuName, a) : this._menuGenerator()); - this._contents.options = b; - a = this.getValue(); - if (this._blockView.isInBlockMenu || !a || "null" == a) { - a = 0 !== b.length ? b[0][1] : null; - } - this.setValue(a); ->>>>>>> entrylabs/master + a.setCopyable = function(a) { + this.copyable != a && this.set({copyable:a}); }; a.isMovable = function() { return this.movable; @@ -18487,8 +17317,8 @@ Entry.Utils.inherit(Entry.FieldDropdown, Entry.FieldDropdownDynamic); a.isCopyable = function() { return this.copyable; }; - a.setDeletable = function(b) { - this.deletable != b && this.set({deletable:b}); + a.setDeletable = function(a) { + this.deletable != a && this.set({deletable:a}); }; a.isDeletable = function() { return this.deletable === Entry.Block.DELETABLE_TRUE; @@ -18509,53 +17339,53 @@ Entry.Utils.inherit(Entry.FieldDropdown, Entry.FieldDropdownDynamic); a.doSeparate = function() { this.separate(); }; - a.doInsert = function(b) { - "basic" === this.getBlockType() ? this.insert(b) : this.replace(b); + a.doInsert = function(a) { + "basic" === this.getBlockType() ? this.insert(a) : this.replace(a); }; - a.doDestroy = function(b) { - this.destroy(b); + a.doDestroy = function(a) { + this.destroy(a); this.getCode().changeEvent.notify(); return this; }; - a.doDestroyBelow = function(b) { + a.doDestroyBelow = function(a) { console.log("destroyBelow", this.id, this.x, this.y); - this.destroy(b, !0); + this.destroy(a, !0); this.getCode().changeEvent.notify(); return this; }; a.copy = function() { - var b = this.getThread(), a = []; - if (b instanceof Entry.Thread) { - for (var d = b.getBlocks().indexOf(this), b = b.toJSON(!0, d), d = 0;d < b.length;d++) { - a.push(b[d]); + var a = this.getThread(), c = []; + if (a instanceof Entry.Thread) { + for (var d = a.getBlocks().indexOf(this), a = a.toJSON(!0, d), d = 0;d < a.length;d++) { + c.push(a[d]); } } else { - a.push(this.toJSON(!0)); + c.push(this.toJSON(!0)); } - b = this.view.getAbsoluteCoordinate(); - d = a[0]; - d.x = b.x + 15; - d.y = b.y + 15; + a = this.view.getAbsoluteCoordinate(); + d = c[0]; + d.x = a.x + 15; + d.y = a.y + 15; d.id = Entry.Utils.generateId(); - return a; + return c; }; a.copyToClipboard = function() { Entry.clipboard = this.copy(); }; - a.separate = function(b) { - this.thread.separate(this, b); + a.separate = function(a) { + this.thread.separate(this, a); this._updatePos(); this.getCode().changeEvent.notify(); }; - a.insert = function(b) { - var a = this.thread.cut(this); - b instanceof Entry.Thread ? b.insertByBlock(null, a) : b.insertAfter(a); + a.insert = function(a) { + var c = this.thread.cut(this); + a instanceof Entry.Thread ? a.insertByBlock(null, c) : a.insertAfter(c); this._updatePos(); this.getCode().changeEvent.notify(); }; - a.replace = function(b) { + a.replace = function(a) { this.thread.cut(this); - b.getThread().replace(this); + a.getThread().replace(this); this.getCode().changeEvent.notify(); }; a.getPrevBlock = function() { @@ -18568,60 +17398,60 @@ Entry.Utils.inherit(Entry.FieldDropdown, Entry.FieldDropdownDynamic); return this.thread.getLastBlock(); }; a.getOutputBlock = function() { - for (var b = this._schema.params, a = 0;b && a < b.length;a++) { - if ("Output" === b[a].type) { - return this.params[a]; + for (var a = this._schema.params, c = 0;a && c < a.length;c++) { + if ("Output" === a[c].type) { + return this.params[c]; } } return null; }; a.getTerminateOutputBlock = function() { - for (var b = this;;) { - var a = b.getOutputBlock(); - if (!a) { - return b; + for (var a = this;;) { + var c = a.getOutputBlock(); + if (!c) { + return a; } - b = a; + a = c; } }; a.getBlockType = function() { if (!this.view) { return null; } - var b = Entry.skeleton[this._schema.skeleton].magnets(this.view); - return b.next || b.previous ? "basic" : b.boolean || b.string ? "field" : b.output ? "output" : null; + var a = Entry.skeleton[this._schema.skeleton].magnets(this.view); + return a.next || a.previous ? "basic" : a.boolean || a.string ? "field" : a.output ? "output" : null; }; - a.indexOfStatements = function(b) { - return this.statements.indexOf(b); + a.indexOfStatements = function(a) { + return this.statements.indexOf(a); }; - a.pointer = function(b) { - b || (b = []); - return this.thread.pointer(b, this); + a.pointer = function(a) { + a || (a = []); + return this.thread.pointer(a, this); }; a.targetPointer = function() { - var b = this.thread.pointer([], this); - 4 === b.length && 0 === b[3] && b.pop(); - return b; + var a = this.thread.pointer([], this); + 4 === a.length && 0 === a[3] && a.pop(); + return a; }; - a.getBlockList = function(b) { - var a = []; + a.getBlockList = function(a) { + var c = []; if (!this._schema) { return []; } - if (b && this._schema.isPrimitive) { - return a; + if (a && this._schema.isPrimitive) { + return c; } - a.push(this); + c.push(this); for (var d = this.params, e = 0;e < d.length;e++) { var f = d[e]; - f && f.constructor == Entry.Block && (a = a.concat(f.getBlockList(b))); + f && f.constructor == Entry.Block && (c = c.concat(f.getBlockList(a))); } if (d = this.statements) { for (e = 0;e < d.length;e++) { - a = a.concat(d[e].getBlockList(b)); + c = c.concat(d[e].getBlockList(a)); } } - return a; + return c; }; a.stringify = function() { return JSON.stringify(this.toJSON()); @@ -18666,74 +17496,74 @@ Entry.BlockMenu = function(a, b, c, d) { }; (function(a) { a.schema = {code:null, dragBlock:null, closeBlock:null, selectedBlockView:null}; - a._generateView = function(b) { - var a = this.view, d = this; - b && (this._categoryCol = Entry.Dom("ul", {class:"entryCategoryListWorkspace", parent:a}), this._generateCategoryView(b)); - this.blockMenuContainer = Entry.Dom("div", {"class":"blockMenuContainer", parent:a}); + a._generateView = function(a) { + var c = this.view, d = this; + a && (this._categoryCol = Entry.Dom("ul", {class:"entryCategoryListWorkspace", parent:c}), this._generateCategoryView(a)); + this.blockMenuContainer = Entry.Dom("div", {"class":"blockMenuContainer", parent:c}); this.svgDom = Entry.Dom($(''), {parent:this.blockMenuContainer}); - this.svgDom.mouseenter(function(b) { + this.svgDom.mouseenter(function(a) { d._scroller && d._scroller.setOpacity(1); - b = d.workspace.selectedBlockView; - !Entry.playground || Entry.playground.resizing || b && b.dragMode === Entry.DRAG_MODE_DRAG || (Entry.playground.focusBlockMenu = !0, b = d.svgGroup.getBBox(), b = b.width + b.x + 64, b > Entry.interfaceState.menuWidth && (this.widthBackup = Entry.interfaceState.menuWidth - 64, $(this).stop().animate({width:b - 62}, 200))); + a = d.workspace.selectedBlockView; + !Entry.playground || Entry.playground.resizing || a && a.dragMode === Entry.DRAG_MODE_DRAG || (Entry.playground.focusBlockMenu = !0, a = d.svgGroup.getBBox(), a = a.width + a.x + 64, a > Entry.interfaceState.menuWidth && (this.widthBackup = Entry.interfaceState.menuWidth - 64, $(this).stop().animate({width:a - 62}, 200))); }); - this.svgDom.mouseleave(function(b) { - Entry.playground && !Entry.playground.resizing && (d._scroller && d._scroller.setOpacity(0), (b = this.widthBackup) && $(this).stop().animate({width:b}, 200), delete this.widthBackup, delete Entry.playground.focusBlockMenu); + this.svgDom.mouseleave(function(a) { + Entry.playground && !Entry.playground.resizing && (d._scroller && d._scroller.setOpacity(0), (a = this.widthBackup) && $(this).stop().animate({width:a}, 200), delete this.widthBackup, delete Entry.playground.focusBlockMenu); }); $(window).scroll(function() { d.updateOffset(); }); }; - a.changeCode = function(b) { - if (!(b instanceof Entry.Code)) { + a.changeCode = function(a) { + if (!(a instanceof Entry.Code)) { return console.error("You must inject code instance"); } this.codeListener && this.code.changeEvent.detach(this.codeListener); - var a = this; - this.set({code:b}); + var c = this; + this.set({code:a}); this.codeListener = this.code.changeEvent.attach(this, function() { - a.changeEvent.notify(); + c.changeEvent.notify(); }); - b.createView(this); + a.createView(this); this.align(); }; - a.bindCodeView = function(b) { + a.bindCodeView = function(a) { this.svgBlockGroup.remove(); this.svgThreadGroup.remove(); - this.svgBlockGroup = b.svgBlockGroup; - this.svgThreadGroup = b.svgThreadGroup; + this.svgBlockGroup = a.svgBlockGroup; + this.svgThreadGroup = a.svgThreadGroup; this.svgGroup.appendChild(this.svgThreadGroup); this.svgGroup.appendChild(this.svgBlockGroup); this._scroller && this.svgGroup.appendChild(this._scroller.svgGroup); }; - a.align = function(b) { - var a = this.code; - if (a) { + a.align = function(a) { + var c = this.code; + if (c) { this._clearSplitters(); - a.view && !b && a.view.reDraw(); - b = a.getThreads(); - for (var a = 10, d = "LEFT" == this._align ? 10 : this.svgDom.width() / 2, e, f = 0, g = b.length;f < g;f++) { - var h = b[f].getFirstBlock(), k = h.view, h = Entry.block[h.type]; - this.checkBanClass(h) ? k.set({display:!1}) : (k.set({display:!0}), h = h.class, e && e !== h && (this._createSplitter(a), a += 15), e = h, h = d - k.offsetX, "CENTER" == this._align && (h -= k.width / 2), a -= k.offsetY, k._moveTo(h, a, !1), a += k.height + 15); + c.view && !a && c.view.reDraw(); + a = c.getThreads(); + for (var c = 10, d = "LEFT" == this._align ? 10 : this.svgDom.width() / 2, e, f = 0, g = a.length;f < g;f++) { + var h = a[f].getFirstBlock(), k = h.view, h = Entry.block[h.type]; + this.checkBanClass(h) ? k.set({display:!1}) : (k.set({display:!0}), h = h.class, e && e !== h && (this._createSplitter(c), c += 15), e = h, h = d - k.offsetX, "CENTER" == this._align && (h -= k.width / 2), c -= k.offsetY, k._moveTo(h, c, !1), c += k.height + 15); } this.updateSplitters(); this.changeEvent.notify(); } }; - a.cloneToGlobal = function(b) { + a.cloneToGlobal = function(a) { if (!this._boardBlockView && null !== this.dragBlock) { - var a = this.workspace, d = a.getMode(), e = this.dragBlock, f = this._svgWidth, g = a.selectedBoard; + var c = this.workspace, d = c.getMode(), e = this.dragBlock, f = this._svgWidth, g = c.selectedBoard; if (!g || d != Entry.Workspace.MODE_BOARD && d != Entry.Workspace.MODE_OVERLAYBOARD) { - Entry.GlobalSvg.setView(e, a.getMode()) && Entry.GlobalSvg.addControl(b); + Entry.GlobalSvg.setView(e, c.getMode()) && Entry.GlobalSvg.addControl(a); } else { - if (g.code && (a = e.block, d = a.getThread(), a && d)) { - a = d.toJSON(!0); - this._boardBlockView = Entry.do("addThread", a).value.getFirstBlock().view; + if (g.code && (c = e.block, d = c.getThread(), c && d)) { + c = d.toJSON(!0); + this._boardBlockView = Entry.do("addThread", c).value.getFirstBlock().view; var g = this.offset().top - g.offset().top, h, k; - if (a = this.dragBlock.mouseDownCoordinate) { - h = b.pageX - a.x, k = b.pageY - a.y; + if (c = this.dragBlock.mouseDownCoordinate) { + h = a.pageX - c.x, k = a.pageY - c.y; } this._boardBlockView._moveTo(e.x - f + (h || 0), e.y + g + (k || 0), !1); - this._boardBlockView.onMouseDown.call(this._boardBlockView, b); + this._boardBlockView.onMouseDown.call(this._boardBlockView, a); this._boardBlockView.dragInstance.set({isNew:!0}); } } @@ -18741,23 +17571,23 @@ Entry.BlockMenu = function(a, b, c, d) { }; a.terminateDrag = function() { if (this._boardBlockView) { - var b = this._boardBlockView; - if (b) { + var a = this._boardBlockView; + if (a) { this.workspace.getBoard(); this._boardBlockView = null; - var a = Entry.GlobalSvg.left, d = Entry.GlobalSvg.width / 2, b = b.getBoard().offset().left; - return a < b - d; + var c = Entry.GlobalSvg.left, d = Entry.GlobalSvg.width / 2, a = a.getBoard().offset().left; + return c < a - d; } } }; - a.getCode = function(b) { + a.getCode = function(a) { return this._code; }; - a.setSelectedBlock = function(b) { - var a = this.selectedBlockView; - a && a.removeSelected(); - b instanceof Entry.BlockView ? b.addSelected() : b = null; - this.set({selectedBlockView:b}); + a.setSelectedBlock = function(a) { + var c = this.selectedBlockView; + c && c.removeSelected(); + a instanceof Entry.BlockView ? a.addSelected() : a = null; + this.set({selectedBlockView:a}); }; a.hide = function() { this.view.addClass("entryRemove"); @@ -18766,30 +17596,30 @@ Entry.BlockMenu = function(a, b, c, d) { this.view.removeClass("entryRemove"); }; a.renderText = function() { - for (var b = this.code.getThreads(), a = 0;a < b.length;a++) { - b[a].view.renderText(); + for (var a = this.code.getThreads(), c = 0;c < a.length;c++) { + a[c].view.renderText(); } }; a.renderBlock = function() { - for (var b = this.code.getThreads(), a = 0;a < b.length;a++) { - b[a].view.renderBlock(); + for (var a = this.code.getThreads(), c = 0;c < a.length;c++) { + a[c].view.renderBlock(); } }; - a._createSplitter = function(b) { - b = this.svgBlockGroup.elem("line", {x1:20, y1:b, x2:this._svgWidth - 20, y2:b, stroke:"#b5b5b5"}); - this._splitters.push(b); + a._createSplitter = function(a) { + a = this.svgBlockGroup.elem("line", {x1:20, y1:a, x2:this._svgWidth - 20, y2:a, stroke:"#b5b5b5"}); + this._splitters.push(a); }; - a.updateSplitters = function(b) { - b = void 0 === b ? 0 : b; - var a = this._svgWidth - 20, d; + a.updateSplitters = function(a) { + a = void 0 === a ? 0 : a; + var c = this._svgWidth - 20, d; this._splitters.forEach(function(e) { - d = parseFloat(e.getAttribute("y1")) + b; - e.attr({x2:a, y1:d, y2:d}); + d = parseFloat(e.getAttribute("y1")) + a; + e.attr({x2:c, y1:d, y2:d}); }); }; a._clearSplitters = function() { - for (var b = this._splitters, a = b.length - 1;0 <= a;a--) { - b[a].remove(), b.pop(); + for (var a = this._splitters, c = a.length - 1;0 <= c;c--) { + a[c].remove(), a.pop(); } }; a.setWidth = function() { @@ -21281,7 +20111,10 @@ Entry.Utils.inherit(Entry.FieldDropdown, Entry.FieldDropdownDynamic); var a = this._block.getCode().object, c = []; Entry.container && (c = this._menuName ? Entry.container.getDropdownList(this._menuName, a) : this._menuGenerator()); this._contents.options = c; - (a = this.getValue()) && "null" != a || (a = 0 !== c.length ? c[0][1] : null); + a = this.getValue(); + if (this._blockView.isInBlockMenu || !a || "null" == a) { + a = 0 !== c.length ? c[0][1] : null; + } this.setValue(a); }; a.renderOptions = function() { diff --git a/dist/entry.min.js b/dist/entry.min.js index 1bac68f54f..f8dfe83c44 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -299,13 +299,8 @@ Entry.block.function_general={skeleton:"basic",color:"#cc7337",template:"\ud568\ Entry.STATIC.BREAK}};Entry.Hamster={PORT_MAP:{leftWheel:0,rightWheel:0,buzzer:0,outputA:0,outputB:0,leftLed:0,rightLed:0,note:0,lineTracerMode:0,lineTracerModeId:0,lineTracerSpeed:5,ioModeA:0,ioModeB:0},setZero:function(){var a=Entry.Hamster.PORT_MAP,b=Entry.hw.sendQueue,c;for(c in a)b[c]=a[c];Entry.hw.update();a=Entry.Hamster;a.lineTracerModeId=0;a.lineTracerStateId=-1;a.tempo=60;a.removeAllTimeouts()},lineTracerModeId:0,lineTracerStateId:-1,tempo:60,timeouts:[],removeTimeout:function(a){clearTimeout(a);var b=this.timeouts; a=b.indexOf(a);0<=a&&b.splice(a,1)},removeAllTimeouts:function(){var a=this.timeouts,b;for(b in a)clearTimeout(a[b]);this.timeouts=[]},setLineTracerMode:function(a,b){this.lineTracerModeId=this.lineTracerModeId+1&255;a.lineTracerMode=b;a.lineTracerModeId=this.lineTracerModeId},name:"hamster",monitorTemplate:{imgPath:"hw/hamster.png",width:256,height:256,listPorts:{temperature:{name:Lang.Blocks.HAMSTER_sensor_temperature,type:"input",pos:{x:0,y:0}},accelerationX:{name:Lang.Blocks.HAMSTER_sensor_accelerationX, type:"input",pos:{x:0,y:0}},accelerationY:{name:Lang.Blocks.HAMSTER_sensor_accelerationY,type:"input",pos:{x:0,y:0}},accelerationZ:{name:Lang.Blocks.HAMSTER_sensor_accelerationZ,type:"input",pos:{x:0,y:0}},buzzer:{name:Lang.Hw.buzzer,type:"output",pos:{x:0,y:0}},note:{name:Lang.Hw.buzzer+"2",type:"output",pos:{x:0,y:0}},outputA:{name:Lang.Hw.output+"A",type:"output",pos:{x:0,y:0}},outputB:{name:Lang.Hw.output+"B",type:"output",pos:{x:0,y:0}}},ports:{leftProximity:{name:Lang.Blocks.HAMSTER_sensor_leftProximity, -<<<<<<< HEAD -type:"input",pos:{x:122,y:156}},rightProximity:{name:Lang.Blocks.HAMSTER_sensor_rightProximity,type:"input",pos:{x:10,y:108}},leftFloor:{name:Lang.Blocks.HAMSTER_sensor_leftFloor,type:"input",pos:{x:100,y:234}},rightFloor:{name:Lang.Blocks.HAMSTER_sensor_rightFloor,type:"input",pos:{x:13,y:180}},lightsensor:{name:Lang.Blocks.HAMSTER_sensor_light,type:"input",pos:{x:56,y:189}},leftWheel:{name:Lang.Hw.leftWheel,type:"output",pos:{x:209,y:115}},rightWheel:{name:Lang.Hw.rightWheel,type:"output",pos:{x:98, -y:30}},leftLed:{name:Lang.Hw.left+" "+Lang.Hw.led,type:"output",pos:{x:87,y:210}},rightLed:{name:Lang.Hw.right+" "+Lang.Hw.led,type:"output",pos:{x:24,y:168}}},mode:"both"}};Blockly.Blocks.hamster_hand_found={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_hand_found);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.hamster_hand_found=function(a,b){a=Entry.hw.portData;return 50>>>>>> entrylabs/master +leftLed:{name:Lang.Hw.left+" "+Lang.Hw.led,type:"output",pos:{x:87,y:210}},rightLed:{name:Lang.Hw.right+" "+Lang.Hw.led,type:"output",pos:{x:24,y:168}}},mode:"both"}};Blockly.Blocks.hamster_hand_found={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_hand_found);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.hamster_hand_found=function(a,b){a=Entry.hw.portData;return 50=a.length&&(l&&clearInterval(l),c==a.length))return b(),!0}var h=document.createElement("span");h.innerHTML="giItT1WQy@!-/#";h.style.position="absolute";h.style.left="-10000px";h.style.top="-10000px";h.style.fontSize="300px";h.style.fontFamily="sans-serif";h.style.fontVariant="normal";h.style.fontStyle="normal";h.style.fontWeight= "normal";h.style.letterSpacing="0";document.body.appendChild(h);var k=h.offsetWidth;h.style.fontFamily=d;var l;e()||(l=setInterval(e,50))})(a[d])};window.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(a){window.setTimeout(a,1E3/60)}}(); -Entry.isMobile=function(){if(Entry.device)return"tablet"===Entry.device;var a=window.platform;if(a&&a.type&&("tablet"===a.type||"mobile"===a.type))return Entry.device="tablet",!0;Entry.device="desktop";return!1};Entry.Utils.convertMouseEvent=function(a){return a.originalEvent&&a.originalEvent.touches?a.originalEvent.touches[0]:a};Entry.Model=function(a,b){var c=Entry.Model;c.generateSchema(a);c.generateSetter(a);c.generateObserve(a);(void 0===b||b)&&Object.seal(a);return a}; +Entry.isMobile=function(){if(Entry.device)return"tablet"===Entry.device;var a=window.platform;if(a&&a.type&&("tablet"===a.type||"mobile"===a.type))return Entry.device="tablet",!0;Entry.device="desktop";return!1};Entry.Utils.convertMouseEvent=function(a){return a.originalEvent&&a.originalEvent.touches?a.originalEvent.touches[0]:a};Entry.Utils.convertIntToHex=function(a){return a.toString(16).toUpperCase()};Entry.Model=function(a,b){var c=Entry.Model;c.generateSchema(a);c.generateSetter(a);c.generateObserve(a);(void 0===b||b)&&Object.seal(a);return a}; (function(a){a.generateSchema=function(b){var a=b.schema;if(void 0!==a){a=JSON.parse(JSON.stringify(a));b.data={};for(var d in a)(function(d){b.data[d]=a[d];Object.defineProperty(b,d,{get:function(){return b.data[d]}})})(d);b._toJSON=this._toJSON}};a.generateSetter=function(b){b.set=this.set};a.set=function(b,a){var d={},e;for(e in this.data)void 0!==b[e]&&(b[e]===this.data[e]?delete b[e]:(d[e]=this.data[e],this.data[e]=b[e]instanceof Array?b[e].concat():b[e]));a||this.notify(Object.keys(b),d)};a.generateObserve= function(b){b.observers=[];b.observe=this.observe;b.unobserve=this.unobserve;b.notify=this.notify};a.observe=function(b,a,d,e){d=new Entry.Observer(this.observers,b,a,d);if(!1!==e)b[a]([]);return d};a.unobserve=function(b){b.destroy()};a.notify=function(b,a){"string"===typeof b&&(b=[b]);var d=this;d.observers.map(function(e){var f=b;void 0!==e.attrs&&(f=Entry.Utils.intersectArray(e.attrs,b));if(f.length)e.object[e.funcName](f.map(function(b){return{name:b,object:d,oldValue:a[b]}}))})};a._toJSON=function(){var b= {},a;for(a in this.data)b[a]=this.data[a];return b}})(Entry.Model);Entry.Observer=function(a,b,c,d){this.parent=a;this.object=b;this.funcName=c;this.attrs=d;a.push(this)};(function(a){a.destroy=function(){var b=this.parent,a=b.indexOf(this);-1c;c++)(function(c){var d=Entry.createElement("td","progressCell"+c);d.bindOnClick(function(){Entry.engine.setSpeedMeter(b[c])});a.appendChild(d)})(c);this.view_.insertBefore(this.speedProgress_,this.maximizeButton);this.speedProgress_.appendChild(a);this.speedHandle_=Entry.createElement("div","entrySpeedHandleWorkspace");var d=(Entry.interfaceState.canvasWidth-84)/5;$(this.speedHandle_).bind("mousedown.speedPanel touchstart.speedPanel",function(b){function a(b){b.stopPropagation();b=Entry.Utils.convertMouseEvent(b); b=Math.floor((b.clientX-80)/(5*d)*5);0>b||4b||(b=Math.min(4,b),b=Math.max(0,b),this.speedPanelOn&&(this.speedHandle_.style.left=(Entry.interfaceState.canvasWidth-80)/10*(2*b+1)+80-9+"px"),Entry.FPS!=a&&(clearInterval(this.ticker),this.ticker=setInterval(this.update,Math.floor(1E3/a)),Entry.FPS=a))};Entry.Engine.prototype.start=function(a){createjs.Ticker.setFPS(Entry.FPS);this.ticker=setInterval(this.update,Math.floor(1E3/Entry.FPS))}; -Entry.Engine.prototype.stop=function(){clearInterval(this.ticker);this.ticker=null};Entry.Engine.prototype.update=function(){Entry.engine.isState("run")&&(Entry.engine.computeObjects(),Entry.engine.executeQueue(),Entry.hw.update())};Entry.Engine.prototype.computeObjects=function(){Entry.container.mapObjectOnScene(this.computeFunction)};Entry.Engine.prototype.computeFunction=function(a){a.script.tick()}; +Entry.Engine.prototype.stop=function(){clearInterval(this.ticker);this.ticker=null};Entry.Engine.prototype.update=function(){Entry.engine.isState("run")&&(Entry.engine.computeObjects(),Entry.hw.update())};Entry.Engine.prototype.computeObjects=function(){Entry.container.mapObjectOnScene(this.computeFunction)};Entry.Engine.prototype.computeFunction=function(a){a.script.tick()}; Entry.Engine.computeThread=function(a,b){Entry.engine.isContinue=!0;for(a=!1;b&&Entry.engine.isContinue&&!a;){Entry.engine.isContinue=!b.isRepeat;var c=b.run();a=c&&c===b;b=c}return b};Entry.Engine.prototype.isState=function(a){return-1b||0>d||b>e||d>e||a.splice.call(this,d,0,a.splice.call(this,b,1)[0])};b.sort=function(){};b.fromJSON=function(){};b.toJSON=function(){for(var a=[],b=0,e=this.length;b/,d;d=b instanceof HTMLElement?$(b):b instanceof jQuery?b:c.test(b)?$(b):$("<"+b+">");if(void 0===a)return d;a.id&&d.attr("id",a.id);a.class&&d.addClass(a.class);a.classes&&a.classes.map(function(a){d.addClass(a)});a.src&&d.attr("src",a.src);a.parent&&a.parent.append(d);d.bindOnClick=function(){var a,b,c=function(a){a.stopImmediatePropagation();a.handled||(a.handled=!0,b.call(this,a))};1b.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.requestUpdate=!0};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()||-1c;c++)(function(c){var d=Entry.createElement("td","progressCell"+c);d.bindOnClick(function(){Entry.engine.setSpeedMeter(a[c])});b.appendChild(d)})(c);this.view_.insertBefore(this.speedProgress_,this.maximizeButton);this.speedProgress_.appendChild(b);this.speedHandle_=Entry.createElement("div","entrySpeedHandleWorkspace");var d=(Entry.interfaceState.canvasWidth-84)/5;$(this.speedHandle_).bind("mousedown.speedPanel touchstart.speedPanel",function(a){function b(a){a.stopPropagation();a=Entry.Utils.convertMouseEvent(a); -a=Math.floor((a.clientX-80)/(5*d)*5);0>a||4a||(a=Math.min(4,a),a=Math.max(0,a),this.speedPanelOn&&(this.speedHandle_.style.left=(Entry.interfaceState.canvasWidth-80)/10*(2*a+1)+80-9+"px"),Entry.FPS!=b&&(clearInterval(this.ticker),this.ticker=setInterval(this.update,Math.floor(1E3/b)),Entry.FPS=b))};Entry.Engine.prototype.start=function(b){createjs.Ticker.setFPS(Entry.FPS);this.ticker=setInterval(this.update,Math.floor(1E3/Entry.FPS))}; -Entry.Engine.prototype.stop=function(){clearInterval(this.ticker);this.ticker=null};Entry.Engine.prototype.update=function(){Entry.engine.isState("run")&&(Entry.engine.computeObjects(),Entry.hw.update())};Entry.Engine.prototype.computeObjects=function(){Entry.container.mapObjectOnScene(this.computeFunction)};Entry.Engine.prototype.computeFunction=function(b){b.script.tick()}; -Entry.Engine.computeThread=function(b,a){Entry.engine.isContinue=!0;for(var c=!1;a&&Entry.engine.isContinue&&!c;){Entry.engine.isContinue=!a.isRepeat;var d=a.run(),c=d&&d===a;a=d}return a};Entry.Engine.prototype.isState=function(b){return-1>>>>>> entrylabs/master this.state="run","mobile"==Entry.type&&this.view_.addClass("entryEngineBlueWorkspace"),this.pauseButton.innerHTML=Lang.Workspace.pause,this.runButton.addClass("run"),this.runButton.addClass("entryRemove"),this.stopButton.removeClass("entryRemove"),this.pauseButton&&this.pauseButton.removeClass("entryRemove"),this.runButton2&&this.runButton2.addClass("entryRemove"),this.stopButton2&&this.stopButton2.removeClass("entryRemove"),this.isUpdating||(Entry.engine.update(),Entry.engine.isUpdating=!0),Entry.stage.selectObject(), Entry.dispatchEvent("run"))}; Entry.Engine.prototype.toggleStop=function(){Entry.addActivity("stop");var a=Entry.container,b=Entry.variableContainer;a.mapEntity(function(b){b.loadSnapshot();b.object.filters=[];b.resetFilter();b.dialog&&b.dialog.remove();b.brush&&b.removeBrush()});b.mapVariable(function(b){b.loadSnapshot()});b.mapList(function(b){b.loadSnapshot();b.updateView()});this.stopProjectTimer();a.clearRunningState();a.loadSequenceSnapshot();this.projectTimer.loadSnapshot();Entry.container.inputValue.loadSnapshot();Entry.scene.loadStartSceneSnapshot(); Entry.Func.clearThreads();createjs.Sound.setVolume(1);createjs.Sound.stop();this.view_.removeClass("entryEngineBlueWorkspace");this.runButton.removeClass("entryRemove");this.stopButton.addClass("entryRemove");this.pauseButton&&this.pauseButton.addClass("entryRemove");this.runButton2&&this.runButton2.removeClass("entryRemove");this.stopButton2&&this.stopButton2.addClass("entryRemove");this.state="stop";Entry.dispatchEvent("stop");Entry.stage.hideInputField()}; -<<<<<<< HEAD Entry.Engine.prototype.togglePause=function(){var a=Entry.engine.projectTimer;"pause"==this.state?(a.pausedTime+=(new Date).getTime()-a.pauseStart,a.isPaused?a.pauseStart=(new Date).getTime():delete a.pauseStart,this.state="run",this.pauseButton.innerHTML=Lang.Workspace.pause,this.runButton.addClass("entryRemove"),this.runButton2&&this.runButton2.addClass("entryRemove")):(this.state="pause",a.isPaused&&(a.pausedTime+=(new Date).getTime()-a.pauseStart),a.pauseStart=(new Date).getTime(),this.pauseButton.innerHTML= Lang.Workspace.restart,this.runButton.removeClass("entryRemove"),this.stopButton.removeClass("entryRemove"),this.runButton2&&this.runButton2.removeClass("entryRemove"))};Entry.Engine.prototype.fireEvent=function(a){"run"==this.state&&Entry.container.mapEntityIncludeCloneOnScene(this.raiseEvent,a)};Entry.Engine.prototype.raiseEvent=function(a,b){a.parent.script.raiseEvent(b,a)}; -Entry.Engine.prototype.fireEventOnEntity=function(a,b){"run"==this.state&&Entry.container.mapEntityIncludeCloneOnScene(this.raiseEventOnEntity,[b,a])};Entry.Engine.prototype.raiseEventOnEntity=function(a,b){a===b[0]&&a.parent.script.raiseEvent(b[1],a)};Entry.Engine.prototype.pushQueue=function(a,b){a===b[0]&&this.queue.push({eventName:b[1],entity:a})}; +Entry.Engine.prototype.fireEventOnEntity=function(a,b){"run"==this.state&&Entry.container.mapEntityIncludeCloneOnScene(this.raiseEventOnEntity,[b,a])};Entry.Engine.prototype.raiseEventOnEntity=function(a,b){a===b[0]&&a.parent.script.raiseEvent(b[1],a)}; Entry.Engine.prototype.captureKeyEvent=function(a){var b=a.keyCode,c=Entry.type;a.ctrlKey&&"workspace"==c?83==b?(a.preventDefault(),Entry.dispatchEvent("saveWorkspace")):82==b?(a.preventDefault(),Entry.engine.run()):90==b&&(a.preventDefault(),console.log("engine"),Entry.dispatchEvent(a.shiftKey?"redo":"undo")):Entry.engine.isState("run")&&Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent,["keyPress",b]);Entry.engine.isState("stop")&&"workspace"===c&&37<=b&&40>=b&&Entry.stage.moveSprite(a)}; Entry.Engine.prototype.raiseKeyEvent=function(a,b){return a.parent.script.raiseEvent(b[0],a,String(b[1]))};Entry.Engine.prototype.updateMouseView=function(){var a=Entry.stage.mouseCoordinate;this.mouseView.textContent="X : "+a.x+", Y : "+a.y;this.mouseView.removeClass("entryRemove")};Entry.Engine.prototype.hideMouseView=function(){this.mouseView.addClass("entryRemove")}; Entry.Engine.prototype.toggleFullscreen=function(){if(this.popup)this.popup.remove(),this.popup=null;else{this.popup=new Entry.Popup;if("workspace"!=Entry.type){var a=$(document);$(this.popup.body_).css("top",a.scrollTop());$("body").css("overflow","hidden");popup.window_.appendChild(Entry.stage.canvas.canvas);popup.window_.appendChild(Entry.engine.runButton[0])}popup.window_.appendChild(Entry.engine.view_)}Entry.windowResized.notify()}; Entry.Engine.prototype.exitFullScreen=function(){document.webkitIsFullScreen||document.mozIsFullScreen||document.isFullScreen||(Entry.engine.footerView_.removeClass("entryRemove"),Entry.engine.headerView_.removeClass("entryRemove"));Entry.windowResized.notify()};Entry.Engine.prototype.showProjectTimer=function(){Entry.engine.projectTimer&&this.projectTimer.setVisible(!0)}; Entry.Engine.prototype.hideProjectTimer=function(){var a=this.projectTimer;if(a&&a.isVisible()&&!this.isState("run")){for(var b=Entry.container.getAllObjects(),c=["get_project_timer_value","reset_project_timer","set_visible_project_timer","choose_project_timer_action"],d=0,e=b.length;d=a&&Entry.stage.moveSprite(b)}; -Entry.Engine.prototype.raiseKeyEvent=function(b,a){return b.parent.script.raiseEvent(a[0],b,String(a[1]))};Entry.Engine.prototype.updateMouseView=function(){var b=Entry.stage.mouseCoordinate;this.mouseView.textContent="X : "+b.x+", Y : "+b.y;this.mouseView.removeClass("entryRemove")};Entry.Engine.prototype.hideMouseView=function(){this.mouseView.addClass("entryRemove")}; -Entry.Engine.prototype.toggleFullscreen=function(){if(this.popup)this.popup.remove(),this.popup=null;else{this.popup=new Entry.Popup;if("workspace"!=Entry.type){var b=$(document);$(this.popup.body_).css("top",b.scrollTop());$("body").css("overflow","hidden");popup.window_.appendChild(Entry.stage.canvas.canvas);popup.window_.appendChild(Entry.engine.runButton[0])}popup.window_.appendChild(Entry.engine.view_)}Entry.windowResized.notify()}; -Entry.Engine.prototype.exitFullScreen=function(){document.webkitIsFullScreen||document.mozIsFullScreen||document.isFullScreen||(Entry.engine.footerView_.removeClass("entryRemove"),Entry.engine.headerView_.removeClass("entryRemove"));Entry.windowResized.notify()};Entry.Engine.prototype.showProjectTimer=function(){Entry.engine.projectTimer&&this.projectTimer.setVisible(!0)}; -Entry.Engine.prototype.hideProjectTimer=function(){var b=this.projectTimer;if(b&&b.isVisible()&&!this.isState("run")){for(var a=Entry.container.getAllObjects(),c=["get_project_timer_value","reset_project_timer","set_visible_project_timer","choose_project_timer_action"],d=0,e=a.length;d>>>>>> entrylabs/master Entry.EntityObject.prototype.initCommand=function(){Entry.engine.isState("stop")&&(this.isCommandValid=!1,Entry.stateManager&&Entry.stateManager.addCommand("edit entity",this,this.restoreEntity,this.toJSON()))};Entry.EntityObject.prototype.doCommand=function(){this.isCommandValid=!0};Entry.EntityObject.prototype.checkCommand=function(){Entry.engine.isState("stop")&&!this.isCommandValid&&Entry.dispatchEvent("cancelLastCommand")}; Entry.EntityObject.prototype.restoreEntity=function(a){var b=this.toJSON();this.syncModel_(a);Entry.dispatchEvent("updateObject");Entry.stateManager&&Entry.stateManager.addCommand("restore object",this,this.restoreEntity,b)};Entry.EntityObject.prototype.setX=function(a){"number"==typeof a&&(this.x=a,this.object.x=this.x,this.isClone||this.parent.updateCoordinateView(),this.updateDialog(),Entry.requestUpdate=!0)};Entry.EntityObject.prototype.getX=function(){return this.x}; Entry.EntityObject.prototype.setY=function(a){"number"==typeof a&&(this.y=a,this.object.y=-this.y,this.isClone||this.parent.updateCoordinateView(),this.updateDialog(),Entry.requestUpdate=!0)};Entry.EntityObject.prototype.getY=function(){return this.y};Entry.EntityObject.prototype.getDirection=function(){return this.direction}; @@ -965,7 +856,6 @@ Entry.EntityObject.prototype.setBGColour=function(a){a||(a="transparent");this.b Entry.EntityObject.prototype.setStrike=function(a){void 0===a&&(a=!1);this.strike=a;this.textObject.strike=a;Entry.requestUpdate=!0};Entry.EntityObject.prototype.getStrike=function(){return this.strike};Entry.EntityObject.prototype.getFont=function(){var a=[];this.fontBold&&a.push("bold");this.fontItalic&&a.push("italic");a.push(this.getFontSize()+"px");a.push(this.fontType);return a.join(" ")}; Entry.EntityObject.prototype.setFont=function(a){if("textBox"==this.parent.objectType&&this.font!==a){a||(a="20px Nanum Gothic");var b=a.split(" "),c;if(c=-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);a.alpha=b.alpha=f(b.alpha,0,1);a.filters=e}(a,b),b.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.requestUpdate=!0}; -======= -Entry.EntityObject.prototype.setFontType=function(b){"textBox"==this.parent.objectType&&(this.fontType=b?b:"Nanum Gothic",this.syncFont())};Entry.EntityObject.prototype.getFontSize=function(b){return this.fontSize};Entry.EntityObject.prototype.setFontSize=function(b){"textBox"==this.parent.objectType&&this.fontSize!=b&&(this.fontSize=b?b:20,this.syncFont(),this.alignTextBox())};Entry.EntityObject.prototype.setFontBold=function(b){this.fontBold=b;Entry.requestUpdate=!0}; -Entry.EntityObject.prototype.toggleFontBold=function(){this.fontBold=!this.fontBold;this.syncFont();return this.fontBold};Entry.EntityObject.prototype.setFontItalic=function(b){this.fontItalic=b;Entry.requestUpdate=!0};Entry.EntityObject.prototype.toggleFontItalic=function(){this.fontItalic=!this.fontItalic;this.syncFont();return this.fontItalic}; -Entry.EntityObject.prototype.setFontName=function(b){for(var a=this.font.split(" "),c=[],d=0,e=a.length;d=m?k=[1,0,0,0,0,0,n,l,0,0,0,-1*l,n,0,0,0,0,0,1,0,0,0,0,0,1]:.66>=m?k=[n,0,l,0,0,0,1,0,0,0,l,0,n,0,0,0,0,0,1,0,0,0,0,0,1]:.99>=m&&(k=[n,l,0,0,0,-1*l,n,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1]);k=(new createjs.ColorMatrix).concat(k);k=new createjs.ColorMatrixFilter(k);c.push(k);b.alpha=a.alpha=d(a.alpha,0,1);b.filters=c})(c,d),d.cache(0, +Entry.EntityObject.prototype.applyFilter=function(a){function b(b,a){for(var c in b)if(b[c]!==a[c])return!1;return!0}var c=this.effect,d=this.object;if(a||!b(c,this.getInitialEffectValue()))(function(b,a){var c=[],d=Entry.adjustValueWithMaxMin;b.brightness=b.brightness;var k=new createjs.ColorMatrix;k.adjustColor(d(b.brightness,-100,100),0,0,0);k=new createjs.ColorMatrixFilter(k);c.push(k);b.hue=b.hue.mod(360);k=new createjs.ColorMatrix;k.adjustColor(0,0,0,b.hue);k=new createjs.ColorMatrixFilter(k); +c.push(k);var k=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1],l=10.8*b.hsv*Math.PI/180,n=Math.cos(l),l=Math.sin(l),m=Math.abs(b.hsv/100);1=m?k=[1,0,0,0,0,0,n,l,0,0,0,-1*l,n,0,0,0,0,0,1,0,0,0,0,0,1]:.66>=m?k=[n,0,l,0,0,0,1,0,0,0,l,0,n,0,0,0,0,0,1,0,0,0,0,0,1]:.99>=m&&(k=[n,l,0,0,0,-1*l,n,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1]);k=(new createjs.ColorMatrix).concat(k);k=new createjs.ColorMatrixFilter(k);c.push(k);a.alpha=b.alpha=d(b.alpha,0,1);a.filters=c})(c,d),d.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.requestUpdate=!0}; ->>>>>>> entrylabs/master 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 a=this.parent.clonedEntities.indexOf(this);this.parent.clonedEntities.splice(a,1);Entry.Utils.isFunction(this.clearExecutor)&&this.clearExecutor()}};Entry.EntityObject.prototype.clearExecutor=function(){this.parent.script.clearExecutorsByEntity(this)}; Entry.EntityObject.prototype.toJSON=function(){var a={};a.x=Entry.cutDecimal(this.getX());a.y=Entry.cutDecimal(this.getY());a.regX=Entry.cutDecimal(this.getRegX());a.regY=Entry.cutDecimal(this.getRegY());a.scaleX=this.getScaleX();a.scaleY=this.getScaleY();a.rotation=Entry.cutDecimal(this.getRotation());a.direction=Entry.cutDecimal(this.getDirection());a.width=Entry.cutDecimal(this.getWidth());a.height=Entry.cutDecimal(this.getHeight());a.font=this.getFont();a.visible=this.getVisible();"textBox"== @@ -1038,16 +914,17 @@ b=this._portMap.w.concat();this._alignEW(b,this._template.width*this.scale/3-32, listVLine=wholeHeight=0;mode=this._hwModule.monitorTemplate;for(f=0;fa-(k.width+l.width/2.2)&&(e+=1,initX=g,f=0)};a._movePort=function(b,a,d,e){var f=a,g=b.box.x*this.scale,h=b.box.y*this.scale; -a>e?(f=a-b.width,a=a>g&&g>e?"M"+g+","+d+"L"+g+","+h:"M"+(a+e)/2+","+d+"l0,"+(h>d?28:-3)+"H"+g+"L"+g+","+h):a=ad?28:-3)+"H"+g+"L"+g+","+h;b.group.attr({transform:"translate("+f+","+d+")"});b.path.attr({d:a})}})(Entry.HWMonitor.prototype);Entry.HW=function(){this.connectTrial=0;this.isFirstConnect=!0;this.initSocket();this.connected=!1;this.portData={};this.sendQueue={};this.outputQueue={};this.settingQueue={};this.socketType=this.hwModule=this.selectedDevice=null;Entry.addEventListener("stop",this.setZero);this.hwInfo={11:Entry.Arduino,19:Entry.ArduinoExt,12:Entry.SensorBoard,13:Entry.CODEino,14:Entry.joystick,15:Entry.dplay,16:Entry.nemoino,17:Entry.Xbot,18:Entry.ardublock,110:Entry.Cobl,24:Entry.Hamster,25:Entry.Albert,31:Entry.Bitbrick, -42:Entry.Arduino,51:Entry.Neobot,71:Entry.Robotis_carCont,72:Entry.Robotis_openCM70,81:Entry.Arduino}};Entry.HW.TRIAL_LIMIT=1;p=Entry.HW.prototype; +a>e?(f=a-b.width,a=a>g&&g>e?"M"+g+","+d+"L"+g+","+h:"M"+(a+e)/2+","+d+"l0,"+(h>d?28:-3)+"H"+g+"L"+g+","+h):a=ad?28:-3)+"H"+g+"L"+g+","+h;b.group.attr({transform:"translate("+f+","+d+")"});b.path.attr({d:a})}})(Entry.HWMonitor.prototype);Entry.HW=function(){this.connectTrial=0;this.isFirstConnect=!0;this.initSocket();this.connected=!1;this.portData={};this.sendQueue={};this.outputQueue={};this.settingQueue={};this.socketType=this.hwModule=this.selectedDevice=null;Entry.addEventListener("stop",this.setZero);this.hwInfo={"1.1":Entry.Arduino,"1.9":Entry.ArduinoExt,"1.2":Entry.SensorBoard,"1.3":Entry.CODEino,"1.4":Entry.joystick,"1.5":Entry.dplay,"1.6":Entry.nemoino,"1.7":Entry.Xbot,"1.8":Entry.ardublock,"1.A":Entry.Cobl,"2.4":Entry.Hamster, +"2.5":Entry.Albert,"3.1":Entry.Bitbrick,"4.2":Entry.Arduino,"5.1":Entry.Neobot,"7.1":Entry.Robotis_carCont,"7.2":Entry.Robotis_openCM70,"8.1":Entry.Arduino}};Entry.HW.TRIAL_LIMIT=1;p=Entry.HW.prototype; p.initSocket=function(){try{if(this.connectTrial>=Entry.HW.TRIAL_LIMIT)this.isFirstConnect||Entry.toast.alert(Lang.Menus.connect_hw,Lang.Menus.connect_fail,!1),this.isFirstConnect=!1;else{var a=this,b,c;this.connected=!1;this.connectTrial++;if(-1"+Lang.Menus[b]+"",{classes:["propertyTabElement","propertyTab"+b],parent:this._tabView}),f=this;e.bind("click",function(){f.select(b)});this.modes[b]&&(this.modes[b].tabDom.remove(),this.modes[b].contentDom.remove(),"hw"==b&&($(this.modes).removeClass(".propertyTabhw"),$(".propertyTabhw").unbind("dblclick")));this.modes[b]={obj:a,tabDom:e,contentDom:d};"hw"==b&&$(".propertyTabhw").bind("dblclick",function(){Entry.dispatchEvent("hwModeChange")})}; a.resize=function(b){this._view.css({width:b+"px",top:9*b/16+123-22+"px"});430<=b?this._view.removeClass("collapsed"):this._view.addClass("collapsed");Entry.dispatchEvent("windowResized");b=this.selected;"hw"==b?this.modes.hw.obj.listPorts?this.modes[b].obj.resizeList():this.modes[b].obj.resize():this.modes[b].obj.resize()};a.select=function(b){for(var a in this.modes){var d=this.modes[a];d.tabDom.removeClass("selected");d.contentDom.addClass("entryRemove");d.obj.visible=!1}a=this.modes[b];a.tabDom.addClass("selected"); @@ -1073,10 +950,9 @@ Entry.StateManager.prototype.undo=function(){if(this.canUndo()&&!this.isRestorin Entry.StateManager.prototype.redo=function(){if(this.canRedo()&&!this.isRestoring()){this.addActivity("redo");var a=this.redoStack_.pop();a.func.apply(a.caller,a.params);this.updateView();Entry.creationChangedEvent&&Entry.creationChangedEvent.notify()}};Entry.StateManager.prototype.updateView=function(){this.undoButton&&this.redoButton&&(this.canUndo()?this.undoButton.addClass("active"):this.undoButton.removeClass("active"),this.canRedo()?this.redoButton.addClass("active"):this.redoButton.removeClass("active"))}; Entry.StateManager.prototype.startRestore=function(){this.isRestore=!0};Entry.StateManager.prototype.endRestore=function(){this.isRestore=!1};Entry.StateManager.prototype.isRestoring=function(){return this.isRestore};Entry.StateManager.prototype.startIgnore=function(){this.isIgnore=!0};Entry.StateManager.prototype.endIgnore=function(){this.isIgnore=!1};Entry.StateManager.prototype.isIgnoring=function(){return this.isIgnore}; Entry.StateManager.prototype.canUndo=function(){return 0Entry.maxCloneLimit||(a=new Entry.EntityObject(this),b?(a.injectModel(b.picture?b.picture:null,b.toJSON()),a.snapshot_=b.snapshot_,b.effect&&(a.effect=Entry.cloneSimpleObject(b.effect),a.applyFilter()),b.brush&&Entry.setCloneBrush(a,b.brush)):(a.injectModel(this.entity.picture?this.entity.picture:null,this.entity.toJSON(a)),a.snapshot_=this.entity.snapshot_,this.entity.effect&&(a.effect=Entry.cloneSimpleObject(this.entity.effect), -a.applyFilter()),this.entity.brush&&Entry.setCloneBrush(a,this.entity.brush)),Entry.engine.pushQueue(a,[a,"when_clone_start"]),a.isClone=!0,a.isStarted=!0,this.addCloneVariables(this,a,b?b.variables:null,b?b.lists:null),this.clonedEntities.push(a),Entry.stage.loadEntity(a))}; +a.applyFilter()),this.entity.brush&&Entry.setCloneBrush(a,this.entity.brush)),Entry.engine.raiseEventOnEntity(a,[a,"when_clone_start"]),a.isClone=!0,a.isStarted=!0,this.addCloneVariables(this,a,b?b.variables:null,b?b.lists:null),this.clonedEntities.push(a),Entry.stage.loadEntity(a))}; Entry.EntryObject.prototype.initializeSplitter=function(a){a.onmousedown=function(b){Entry.container.disableSort();Entry.container.splitterEnable=!0};document.addEventListener("mousemove",function(b){Entry.container.splitterEnable&&Entry.resizeElement({canvasWidth:b.x||b.clientX})});document.addEventListener("mouseup",function(b){Entry.container.splitterEnable=!1;Entry.container.enableSort()})};Entry.EntryObject.prototype.isSelected=function(){return this.isSelected_}; Entry.EntryObject.prototype.toJSON=function(){var a={};a.id=this.id;a.name=this.name;"textBox"==this.objectType&&(a.text=this.text);a.script=this.getScriptText();"sprite"==this.objectType&&(a.selectedPictureId=this.selectedPicture.id);a.objectType=this.objectType;a.rotateMethod=this.getRotateMethod();a.scene=this.scene.id;a.sprite={pictures:Entry.getPicturesJSON(this.pictures),sounds:Entry.getSoundsJSON(this.sounds)};a.lock=this.lock;a.entity=this.entity.toJSON();return a}; Entry.EntryObject.prototype.destroy=function(){Entry.stage.unloadEntity(this.entity);this.view_&&Entry.removeElement(this.view_)};Entry.EntryObject.prototype.getSound=function(a){a=a.trim();for(var b=this.sounds,c=b.length,d=0;d=a&&0this.pictures.length)return!1;b=this.getPicture(b);var a=this.pictures.indexOf(b);Entry.stateManager&&Entry.stateManager.addCommand("remove sprite",this,this.addPicture,b,a);this.pictures.splice(a,1);b===this.selectedPicture&&Entry.playground.selectPicture(this.pictures[0]);Entry.playground.injectPicture(this);Entry.playground.reloadPlayground();return new Entry.State(this,this.addPicture,b,a)}; -Entry.EntryObject.prototype.getPicture=function(b){if(!b)return this.selectedPicture;b=b.trim();for(var a=this.pictures,c=a.length,d=0;d=b&&0Entry.maxCloneLimit||(b=new Entry.EntityObject(this),a?(b.injectModel(a.picture?a.picture:null,a.toJSON()),b.snapshot_=a.snapshot_,a.effect&&(b.effect=Entry.cloneSimpleObject(a.effect),b.applyFilter()),a.brush&&Entry.setCloneBrush(b,a.brush)):(b.injectModel(this.entity.picture?this.entity.picture:null,this.entity.toJSON(b)),b.snapshot_=this.entity.snapshot_,this.entity.effect&&(b.effect=Entry.cloneSimpleObject(this.entity.effect), -b.applyFilter()),this.entity.brush&&Entry.setCloneBrush(b,this.entity.brush)),Entry.engine.raiseEventOnEntity(b,[b,"when_clone_start"]),b.isClone=!0,b.isStarted=!0,this.addCloneVariables(this,b,a?a.variables:null,a?a.lists:null),this.clonedEntities.push(b),Entry.stage.loadEntity(b))}; -Entry.EntryObject.prototype.initializeSplitter=function(b){b.onmousedown=function(a){Entry.container.disableSort();Entry.container.splitterEnable=!0};document.addEventListener("mousemove",function(a){Entry.container.splitterEnable&&Entry.resizeElement({canvasWidth:a.x||a.clientX})});document.addEventListener("mouseup",function(a){Entry.container.splitterEnable=!1;Entry.container.enableSort()})};Entry.EntryObject.prototype.isSelected=function(){return this.isSelected_}; -Entry.EntryObject.prototype.toJSON=function(){var b={};b.id=this.id;b.name=this.name;"textBox"==this.objectType&&(b.text=this.text);b.script=this.getScriptText();"sprite"==this.objectType&&(b.selectedPictureId=this.selectedPicture.id);b.objectType=this.objectType;b.rotateMethod=this.getRotateMethod();b.scene=this.scene.id;b.sprite={pictures:Entry.getPicturesJSON(this.pictures),sounds:Entry.getSoundsJSON(this.sounds)};b.lock=this.lock;b.entity=this.entity.toJSON();return b}; -Entry.EntryObject.prototype.destroy=function(){Entry.stage.unloadEntity(this.entity);this.view_&&Entry.removeElement(this.view_)};Entry.EntryObject.prototype.getSound=function(b){b=b.trim();for(var a=this.sounds,c=a.length,d=0;d=b&&0>>>>>> entrylabs/master this.selectArea.x2,this.selectArea.y2,4);this.stage.update()};Entry.Painter.prototype.updateHandle_=function(){this.stage.getChildIndex(-1=b-e/100*b&&f<=b+e/100*b&&g>=c-e/100*c&&g<=c+e/100*c&&a>=d-e/100*d&&a<=d+e/100*d};Entry.Painter.prototype.matchColorOnly=function(a,b,c,d){return b===this.colorLayerData.data[a]&&c===this.colorLayerData.data[a+1]&&d===this.colorLayerData.data[a+2]?!0:!1}; Entry.Painter.prototype.matchColor=function(a,b,c,d,e){return b===this.colorLayerData.data[a]&&c===this.colorLayerData.data[a+1]&&d===this.colorLayerData.data[a+2]&&e===this.colorLayerData.data[a+3]?!0:!1};Entry.Painter.prototype.colorPixel=function(a,b,c,d,e){e||(e=255);this.stroke.transparent&&(e=d=c=b=0);this.colorLayerData.data[a]=b;this.colorLayerData.data[a+1]=c;this.colorLayerData.data[a+2]=d;this.colorLayerData.data[a+3]=e}; @@ -1261,17 +1048,10 @@ Entry.Painter.prototype.initCommand=function(){var a=!1;this.handle.visible&&(a= !0);(a||b)&&this.stage.update()};Entry.Painter.prototype.doCommand=function(){this.isCommandValid=!0};Entry.Painter.prototype.checkCommand=function(){this.isCommandValid||Entry.dispatchEvent("cancelLastCommand")}; Entry.Painter.prototype.restorePainter=function(a){this.clearHandle();var b=this.ctx.getImageData(0,0,this.canvas.width,this.canvas.height);this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);this.ctx.putImageData(a,0,0);a=new Image;a.src=this.canvas.toDataURL();var c=this;a.onload=function(b){b=new createjs.Bitmap(b.target);c.objectContainer.removeAllChildren();c.objectContainer.addChild(b)};Entry.stateManager&&Entry.stateManager.addCommand("restore sprite",this,this.restorePainter,b)}; Entry.Painter.prototype.platten=function(){this.colorLayerData=this.ctx.getImageData(0,0,this.canvas.width,this.canvas.height);this.reloadContext()}; -<<<<<<< HEAD Entry.Painter.prototype.fill=function(){if(!this.stroke.locked){this.stroke.locked=!0;this.initCommand();this.doCommand();this.clearHandle();var a=this.canvas.width,b=this.canvas.height;this.colorLayerData=this.ctx.getImageData(0,0,a,b);var c=new createjs.Point(this.stage.mouseX,this.stage.mouseY);c.x=Math.round(c.x);c.y=Math.round(c.y);for(var d=4*(c.y*a+c.x),e=this.colorLayerData.data[d],f=this.colorLayerData.data[d+1],g=this.colorLayerData.data[d+2],h=this.colorLayerData.data[d+3],k,l,c=[[c.x, c.y]],n=Entry.hex2rgb(this.stroke.lineColor);c.length;){for(var d=c.pop(),m=d[0],q=d[1],d=4*(q*a+m);0<=q&&this.matchColor(d,e,f,g,h);)--q,d-=4*a;d+=4*a;q+=1;for(l=k=!1;q>1,this.oldPt.y+this.stage.mouseY>>1);this.brush.graphics.setStrokeStyle(this.stroke.thickness,"round").beginStroke(this.stroke.lineColor).moveTo(a.x,a.y).curveTo(this.oldPt.x,this.oldPt.y,this.oldMidPt.x,this.oldMidPt.y);this.oldPt.x=this.stage.mouseX;this.oldPt.y=this.stage.mouseY;this.oldMidPt.x=a.x;this.oldMidPt.y=a.y;this.file.modified=!0;this.stage.update()}; -======= -Entry.Painter.prototype.fill=function(){if(!this.stroke.locked){this.stroke.locked=!0;this.initCommand();this.doCommand();this.clearHandle();var b=this.canvas.width,a=this.canvas.height;this.colorLayerData=this.ctx.getImageData(0,0,b,a);var c=new createjs.Point(this.stage.mouseX,this.stage.mouseY);c.x=Math.round(c.x);c.y=Math.round(c.y);for(var d=4*(c.y*b+c.x),e=this.colorLayerData.data[d],f=this.colorLayerData.data[d+1],g=this.colorLayerData.data[d+2],h=this.colorLayerData.data[d+3],k,l,c=[[c.x, -c.y]],n=Entry.hex2rgb(this.stroke.lineColor);c.length;){for(var d=c.pop(),m=d[0],q=d[1],d=4*(q*b+m);0<=q&&this.matchColor(d,e,f,g,h);)--q,d-=4*b;d+=4*b;q+=1;for(l=k=!1;q>1,this.oldPt.y+this.stage.mouseY>>1);this.brush.graphics.setStrokeStyle(this.stroke.thickness,"round").beginStroke(this.stroke.lineColor).moveTo(b.x,b.y).curveTo(this.oldPt.x,this.oldPt.y,this.oldMidPt.x,this.oldMidPt.y);this.oldPt.x=this.stage.mouseX;this.oldPt.y=this.stage.mouseY;this.oldMidPt.x=b.x;this.oldMidPt.y=b.y;this.file.modified=!0;this.stage.update()}; ->>>>>>> entrylabs/master Entry.Painter.prototype.move_line=function(){this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").moveTo(this.oldPt.x,this.oldPt.y).lineTo(this.stage.mouseX,this.stage.mouseY);this.file.modified=!0;this.stage.update()}; Entry.Painter.prototype.move_rect=function(){var a=this.stage.mouseX-this.oldPt.x,b=this.stage.mouseY-this.oldPt.y;event.shiftKey&&(b=a);this.stroke.fill?0===this.stroke.thickness?this.brush.graphics.clear().setStrokeStyle(this.stroke.thickness,"round").beginFill(this.stroke.fillColor).drawRect(this.oldPt.x,this.oldPt.y,a,b):this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").beginFill(this.stroke.fillColor).drawRect(this.oldPt.x,this.oldPt.y, a,b):0===this.stroke.thickness?this.brush.graphics.clear().setStrokeStyle(this.stroke.thickness,"round").drawRect(this.oldPt.x,this.oldPt.y,a,b):this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").drawRect(this.oldPt.x,this.oldPt.y,a,b);this.file.modified=!0;this.stage.update()}; @@ -1322,7 +1102,6 @@ this.attrResizeArea=Entry.createElement("fieldset","painterAttrResize");this.att e.addClass("entryPlaygroundPainterAttrResizeXTop");e.innerHTML="X";c.appendChild(e);this.objectWidthInput=Entry.createElement("input","entryPainterAttrWidth");this.objectWidthInput.onblur=function(){if(isNaN(this.value))return alert("\uc22b\uc790\ub9cc \uc785\ub825 \uac00\ub2a5\ud569\ub2c8\ub2e4."),!1;b.handle.width=this.value;b.updateImageHandle()};this.objectWidthInput.addClass("entryPlaygroundPainterNumberInput");c.appendChild(this.objectWidthInput);c=Entry.createElement("div");c.addClass("entryPlaygroundPainterSizeText"); c.innerHTML="x";d.appendChild(c);c=Entry.createElement("div");c.addClass("entryPlaygroundAttrReiszeY");d.appendChild(c);d=Entry.createElement("div");d.addClass("entryPlaygroundPainterAttrResizeYTop");d.innerHTML="Y";c.appendChild(d);this.objectHeightInput=Entry.createElement("input","entryPainterAttrHeight");this.objectHeightInput.onblur=function(){if(isNaN(this.value))return alert("\uc22b\uc790\ub9cc \uc785\ub825 \uac00\ub2a5\ud569\ub2c8\ub2e4."),!1;b.handle.height=this.value;b.updateImageHandle()}; this.objectHeightInput.addClass("entryPlaygroundPainterNumberInput");c.appendChild(this.objectHeightInput);this.attrRotateArea=Entry.createElement("div","painterAttrRotateArea");this.attrRotateArea.addClass("painterAttrRotateArea");g.appendChild(this.attrRotateArea);d=Entry.createElement("div");d.addClass("painterAttrRotateName");d.innerHTML=Lang.Workspace.picture_rotation;this.attrRotateArea.appendChild(d);d=Entry.createElement("fieldset","entryPainterAttrRotate");d.addClass("entryPlaygroundPainterAttrRotate"); -<<<<<<< HEAD this.attrRotateArea.appendChild(d);c=Entry.createElement("div");c.addClass("painterAttrRotateTop");c.innerHTML="\u03bf";d.appendChild(c);this.objectRotateInput=Entry.createElement("input","entryPainterAttrDegree");this.objectRotateInput.onblur=function(){if(isNaN(this.value))return alert("\uc22b\uc790\ub9cc \uc785\ub825 \uac00\ub2a5\ud569\ub2c8\ub2e4."),!1;360<=this.value?this.value%=360:0>this.value&&(this.value=360+this.value%360);b.handle.rotation=this.value;b.updateImageHandle()};this.objectRotateInput.addClass("entryPlaygroundPainterNumberInput"); this.objectRotateInput.defaultValue="0";d.appendChild(this.objectRotateInput);this.attrColorArea=Entry.createElement("fieldset","entryPainterAttrColor");this.attrColorArea.addClass("entryPlaygroundPainterAttrColor");g.appendChild(this.attrColorArea);var n=Entry.createElement("div");n.addClass("entryPlaygroundPainterAttrColorContainer");this.attrColorArea.appendChild(n);this.attrCircleArea=Entry.createElement("div");this.attrCircleArea.addClass("painterAttrCircleArea");g.appendChild(this.attrCircleArea); d=Entry.createElement("div","entryPainterAttrCircle");d.addClass("painterAttrCircle");this.attrCircleArea.appendChild(d);this.attrCircleArea.painterAttrCircle=d;d=Entry.createElement("input","entryPainterAttrCircleInput");d.value="#000000";d.addClass("painterAttrCircleInput");this.attrCircleArea.appendChild(d);this.attrColorSpoid=Entry.createElement("div");this.attrColorSpoid.bindOnClick(function(){b.selectToolbox("spoid")});this.attrColorSpoid.addClass("painterAttrColorSpoid");g.appendChild(this.attrColorSpoid); @@ -1331,16 +1110,6 @@ a,b.stroke.lineColor=a));document.getElementById("entryPainterAttrCircle").style var m=Entry.createElement("fieldset","entryPainterAttrThick");m.addClass("entryPlaygroundPainterAttrThick");this.attrThickArea.appendChild(m);d=Entry.createElement("div");d.addClass("paintAttrThickTop");m.appendChild(d);e=Entry.createElement("select","entryPainterAttrThick");e.addClass("entryPlaygroundPainterAttrThickInput");e.size="1";e.onchange=function(a){b.stroke.thickness=a.target.value};for(d=1;10>=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,e.appendChild(c);m.appendChild(e); d=Entry.createElement("div","entryPainterShapeLineColor");d.addClass("painterAttrShapeLineColor");c=Entry.createElement("div","entryPainterShapeInnerBackground");c.addClass("painterAttrShapeInnerBackground");d.appendChild(c);m.appendChild(d);this.attrThickArea.painterAttrShapeLineColor=d;m.bindOnClick(function(){q.style.zIndex="1";this.style.zIndex="10";r=!1});this.attrBackgroundArea=Entry.createElement("div","painterAttrBackgroundArea");this.attrBackgroundArea.addClass("entryPlaygroundPainterBackgroundArea"); g.appendChild(this.attrBackgroundArea);d=Entry.createElement("fieldset","entryPainterAttrbackground");d.addClass("entryPlaygroundPainterAttrBackground");this.attrBackgroundArea.appendChild(d);c=Entry.createElement("div");c.addClass("paintAttrBackgroundTop");d.appendChild(c);var q=Entry.createElement("div","entryPainterShapeBackgroundColor");q.addClass("painterAttrShapeBackgroundColor");this.attrBackgroundArea.painterAttrShapeBackgroundColor=q;c.appendChild(q);var r=!1;q.bindOnClick(function(b){m.style.zIndex= -======= -this.attrRotateArea.appendChild(d);c=Entry.createElement("div");c.addClass("painterAttrRotateTop");c.innerHTML="\u03bf";d.appendChild(c);this.objectRotateInput=Entry.createElement("input","entryPainterAttrDegree");this.objectRotateInput.onblur=function(){if(isNaN(this.value))return alert("\uc22b\uc790\ub9cc \uc785\ub825 \uac00\ub2a5\ud569\ub2c8\ub2e4."),!1;360<=this.value?this.value%=360:0>this.value&&(this.value=360+this.value%360);a.handle.rotation=this.value;a.updateImageHandle()};this.objectRotateInput.addClass("entryPlaygroundPainterNumberInput"); -this.objectRotateInput.defaultValue="0";d.appendChild(this.objectRotateInput);this.attrColorArea=Entry.createElement("fieldset","entryPainterAttrColor");this.attrColorArea.addClass("entryPlaygroundPainterAttrColor");g.appendChild(this.attrColorArea);var n=Entry.createElement("div");n.addClass("entryPlaygroundPainterAttrColorContainer");this.attrColorArea.appendChild(n);this.attrCircleArea=Entry.createElement("div");this.attrCircleArea.addClass("painterAttrCircleArea");g.appendChild(this.attrCircleArea); -d=Entry.createElement("div","entryPainterAttrCircle");d.addClass("painterAttrCircle");this.attrCircleArea.appendChild(d);this.attrCircleArea.painterAttrCircle=d;d=Entry.createElement("input","entryPainterAttrCircleInput");d.value="#000000";d.addClass("painterAttrCircleInput");this.attrCircleArea.appendChild(d);this.attrColorSpoid=Entry.createElement("div");this.attrColorSpoid.bindOnClick(function(){a.selectToolbox("spoid")});this.attrColorSpoid.addClass("painterAttrColorSpoid");g.appendChild(this.attrColorSpoid); -Entry.getColourCodes().forEach(function(b){var c=Entry.createElement("div");c.addClass("entryPlaygroundPainterAttrColorElement");"transparent"===b?c.style.backgroundImage="url("+(Entry.mediaFilePath+"/transparent.png")+")":c.style.backgroundColor=b;c.bindOnClick(function(c){"transparent"===b?(a.stroke.transparent=!0,a.stroke.lineColor="#ffffff"):(a.stroke.transparent=!1,r&&(document.getElementById("entryPainterShapeBackgroundColor").style.backgroundColor=b,a.stroke.fillColor=b),r||(document.getElementById("entryPainterShapeLineColor").style.backgroundColor= -b,a.stroke.lineColor=b));document.getElementById("entryPainterAttrCircle").style.backgroundColor=a.stroke.lineColor;document.getElementById("entryPainterAttrCircleInput").value=b});n.appendChild(c)});this.attrThickArea=Entry.createElement("div","painterAttrThickArea");this.attrThickArea.addClass("entryPlaygroundentryPlaygroundPainterAttrThickArea");g.appendChild(this.attrThickArea);d=Entry.createElement("legend");d.addClass("painterAttrThickName");d.innerHTML=Lang.Workspace.thickness;this.attrThickArea.appendChild(d); -var m=Entry.createElement("fieldset","entryPainterAttrThick");m.addClass("entryPlaygroundPainterAttrThick");this.attrThickArea.appendChild(m);d=Entry.createElement("div");d.addClass("paintAttrThickTop");m.appendChild(d);e=Entry.createElement("select","entryPainterAttrThick");e.addClass("entryPlaygroundPainterAttrThickInput");e.size="1";e.onchange=function(b){a.stroke.thickness=b.target.value};for(d=1;10>=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,e.appendChild(c);m.appendChild(e); -d=Entry.createElement("div","entryPainterShapeLineColor");d.addClass("painterAttrShapeLineColor");c=Entry.createElement("div","entryPainterShapeInnerBackground");c.addClass("painterAttrShapeInnerBackground");d.appendChild(c);m.appendChild(d);this.attrThickArea.painterAttrShapeLineColor=d;m.bindOnClick(function(){q.style.zIndex="1";this.style.zIndex="10";r=!1});this.attrBackgroundArea=Entry.createElement("div","painterAttrBackgroundArea");this.attrBackgroundArea.addClass("entryPlaygroundPainterBackgroundArea"); -g.appendChild(this.attrBackgroundArea);d=Entry.createElement("fieldset","entryPainterAttrbackground");d.addClass("entryPlaygroundPainterAttrBackground");this.attrBackgroundArea.appendChild(d);c=Entry.createElement("div");c.addClass("paintAttrBackgroundTop");d.appendChild(c);var q=Entry.createElement("div","entryPainterShapeBackgroundColor");q.addClass("painterAttrShapeBackgroundColor");this.attrBackgroundArea.painterAttrShapeBackgroundColor=q;c.appendChild(q);var r=!1;q.bindOnClick(function(a){m.style.zIndex= ->>>>>>> entrylabs/master "1";this.style.zIndex="10";r=!0});this.attrFontArea=Entry.createElement("div","painterAttrFont");this.attrFontArea.addClass("entryPlaygroundPainterAttrFont");g.appendChild(this.attrFontArea);e=Entry.createElement("div");e.addClass("entryPlaygroundPainterAttrTop");this.attrFontArea.appendChild(e);d=Entry.createElement("div");d.addClass("entryPlaygroundPaintAttrTop_");e.appendChild(d);d=Entry.createElement("legend");d.addClass("panterAttrFontTitle");d.innerHTML=Lang.Workspace.textStyle;k=Entry.createElement("select", "entryPainterAttrFontName");k.addClass("entryPlaygroundPainterAttrFontName");k.size="1";k.onchange=function(a){b.font.name=a.target.value};for(d=0;d=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,k.appendChild(c);e.appendChild(k);e=Entry.createElement("div");e.addClass("entryPlaygroundPainterAttrFontStyleArea");this.attrFontArea.appendChild(e);d=Entry.createElement("div");d.addClass("entryPlaygroundPainterAttrFontTop");e.appendChild(d);k=Entry.createElement("select","entryPainterAttrFontStyle"); @@ -1515,7 +1284,6 @@ d.view.addClass("minValue")}};Entry.Scene.prototype.getNextScene=function(){var p.init=function(a,b,c){Entry.assert("BLOCK"==a.tagName.toUpperCase(),a.tagName);this.type=a.getAttribute("type");this.id=Number(a.getAttribute("id"));a.getElementsByTagName("mutation").length&&a.getElementsByTagName("mutation")[0].hasAttribute("hashid")&&(this.hashId=a.childNodes[0].getAttribute("hashid"));"REPEAT"==this.type.substr(0,6).toUpperCase()&&(this.isRepeat=!0);b instanceof Entry.Script&&(this.previousScript=b,b.parentScript&&(this.parentScript=b.parentScript));c instanceof Entry.Script&& (this.parentScript=c);a=a.childNodes;for(b=0;bd.style.opacity&&(clearInterval(a),d.style.display="none",Entry.removeElement(d));d.style.opacity*=.9},20)},1E3)}; -Entry.Toast.prototype.success=function(b,a,c){var d=Entry.createElement("div","entryToast");d.addClass("entryToast");d.addClass("entryToastSuccess");d.bindOnClick(function(){Entry.toast.body_.removeChild(this)});var e=Entry.createElement("div","entryToast");e.addClass("entryToastTitle");e.innerHTML=b;d.appendChild(e);b=Entry.createElement("p","entryToast");b.addClass("entryToastMessage");b.innerHTML=a;d.appendChild(b);this.toasts_.push(d);this.body_.appendChild(d);c||window.setTimeout(function(){d.style.opacity= -1;var a=setInterval(function(){.05>d.style.opacity&&(clearInterval(a),d.style.display="none",Entry.removeElement(d));d.style.opacity*=.9},20)},1E3)}; -Entry.Toast.prototype.alert=function(b,a,c){var d=Entry.createElement("div","entryToast");d.addClass("entryToast");d.addClass("entryToastAlert");d.bindOnClick(function(){Entry.toast.body_.removeChild(this)});var e=Entry.createElement("div","entryToast");e.addClass("entryToastTitle");e.innerHTML=b;d.appendChild(e);b=Entry.createElement("p","entryToast");b.addClass("entryToastMessage");b.innerHTML=a;d.appendChild(b);this.toasts_.push(d);this.body_.appendChild(d);c||window.setTimeout(function(){d.style.opacity= -1;var a=setInterval(function(){.05>d.style.opacity&&(clearInterval(a),d.style.display="none",Entry.toast.body_.removeChild(d));d.style.opacity*=.9},20)},5E3)};Entry.TvCast=function(b){this.generateView(b)};p=Entry.TvCast.prototype;p.init=function(b){this.tvCastHash=b};p.generateView=function(b){var a=Entry.createElement("div");a.addClass("entryContainerMovieWorkspace");a.addClass("entryRemove");this.movieContainer=a;a=Entry.createElement("iframe");a.setAttribute("id","tvCastIframe");a.setAttribute("allowfullscreen","");a.setAttribute("frameborder",0);a.setAttribute("src",b);this.movieFrame=a;this.movieContainer.appendChild(this.movieFrame)};p.getView=function(){return this.movieContainer}; -p.resize=function(){document.getElementById("entryContainerWorkspaceId");var b=document.getElementById("tvCastIframe");w=this.movieContainer.offsetWidth;b.width=w+"px";b.height=9*w/16+"px"};Entry.BlockDriver=function(){}; -(function(b){b.convert=function(){var a=new Date,b;for(b in Entry.block)"function"===typeof Entry.block[b]&&this._convertBlock(b);console.log((new Date).getTime()-a.getTime())};b._convertBlock=function(a){function b(a){var d={type:a.getAttribute("type"),index:{}};a=$(a).children();if(!a)return d;for(var e=0;eg&&(a.x-=d+3);a.y+e>f&& -(a.y-=e);b.css({left:a.x,top:a.y})};b.hide=function(){this.visible=!1;this.dom.empty();this.dom.addClass("entryRemove");this._className&&(this.dom.removeClass(this._className),delete this._className)}})(Entry.ContextMenu);Entry.Loader={queueCount:0,totalCount:0};Entry.Loader.addQueue=function(b){this.queueCount||Entry.dispatchEvent("loadStart");this.queueCount++;this.totalCount++};Entry.Loader.removeQueue=function(b){this.queueCount--;this.queueCount||(Entry.dispatchEvent("loadComplete"),this.totalCount=0)};Entry.Loader.getLoadedPercent=function(){return 0===this.totalCount?1:this.queueCount/this.totalCount};Entry.STATIC={OBJECT:0,ENTITY:1,SPRITE:2,SOUND:3,VARIABLE:4,FUNCTION:5,SCENE:6,MESSAGE:7,BLOCK_MODEL:8,BLOCK_RENDER_MODEL:9,BOX_MODEL:10,THREAD_MODEL:11,DRAG_INSTANCE:12,BLOCK_STATIC:0,BLOCK_MOVE:1,BLOCK_FOLLOW:2,RETURN:0,CONTINUE:1,BREAK:2,PASS:3};Entry.Utils={};Entry.overridePrototype=function(){Number.prototype.mod=function(b){return(this%b+b)%b}};Entry.Utils.generateId=function(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).substr(-4)};Entry.Utils.intersectArray=function(b,a){for(var c=[],d=0;d=a.x&&e-c<=a.y&&e+b.height+c>=a.y}; -Entry.Utils.colorDarken=function(b,a){function c(a){2!=a.length&&(a="0"+a);return a}var d,e,f;7===b.length?(d=parseInt(b.substr(1,2),16),e=parseInt(b.substr(3,2),16),f=parseInt(b.substr(5,2),16)):(d=parseInt(b.substr(1,2),16),e=parseInt(b.substr(2,2),16),f=parseInt(b.substr(3,2),16));a=void 0===a?.7:a;d=c(Math.floor(d*a).toString(16));e=c(Math.floor(e*a).toString(16));f=c(Math.floor(f*a).toString(16));return"#"+d+e+f}; -Entry.Utils.colorLighten=function(b,a){a=0===a?0:a||20;var c=Entry.Utils.hexToHsl(b);c.l+=a/100;c.l=Math.min(1,Math.max(0,c.l));return Entry.Utils.hslToHex(c)};Entry.Utils.bound01=function(b,a){var c=b;"string"==typeof c&&-1!=c.indexOf(".")&&1===parseFloat(c)&&(b="100%");c="string"===typeof b&&-1!=b.indexOf("%");b=Math.min(a,Math.max(0,parseFloat(b)));c&&(b=parseInt(b*a,10)/100);return 1E-6>Math.abs(b-a)?1:b%a/parseFloat(a)}; -Entry.Utils.hexToHsl=function(b){var a,c;7===b.length?(a=parseInt(b.substr(1,2),16),c=parseInt(b.substr(3,2),16),b=parseInt(b.substr(5,2),16)):(a=parseInt(b.substr(1,2),16),c=parseInt(b.substr(2,2),16),b=parseInt(b.substr(3,2),16));a=Entry.Utils.bound01(a,255);c=Entry.Utils.bound01(c,255);b=Entry.Utils.bound01(b,255);var d=Math.max(a,c,b),e=Math.min(a,c,b),f,g=(d+e)/2;if(d==e)f=e=0;else{var h=d-e,e=.5c&&(c+=1);1c?b:c<2/3?a+(b-a)*(2/3-c)*6:a}function c(a){return 1==a.length?"0"+a:""+a}var d,e;e=Entry.Utils.bound01(b.h,360);d=Entry.Utils.bound01(b.s,1);b=Entry.Utils.bound01(b.l,1);if(0===d)d=b=e=b;else{var f=.5>b?b*(1+d):b+d-b*d,g=2*b-f;d=a(g,f,e+1/3);b=a(g,f,e);e=a(g,f,e-1/3)}b*=255;e*=255;return"#"+[c(Math.round(255*d).toString(16)),c(Math.round(b).toString(16)),c(Math.round(e).toString(16))].join("")}; -Entry.Utils.bindGlobalEvent=function(b){var a=$(document);void 0===b&&(b="resize mousedown mousemove keydown keyup dispose".split(" "));-1Entry.pressedKeys.indexOf(b)&&Entry.pressedKeys.push(b);Entry.keyPressed.notify(a)}));-1$1://$2").replace(/([xA1-xFEa-z0-9_-]+@[xA1-xFEa-z0-9-]+.[a-z0-9-]+)/gi,"$1"):""};Entry.generateHash=function(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).substr(-4)}; -Entry.addEventListener=function(b,a){this.events_||(this.events_={});this.events_[b]||(this.events_[b]=[]);a instanceof Function&&this.events_[b].push(a);return!0};Entry.dispatchEvent=function(b,a){this.events_||(this.events_={});if(this.events_[b])for(var c=0,d=this.events_[b].length;c=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;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.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", -{result:"matrixOut",in:"offOut",type:"matrix",values:"0.7 0 0 0 0 0 0.7 0 0 0 0 0 0.7 0 0 0 0 0 1 0"});d.elem("feBlend",{in:"SourceGraphic",in1:"offOut",mode:"normal"});c=c.elem("filter",{id:"entryBlockHighlightFilter_"+a});c.elem("feOffset",{result:"offOut",in:"SourceGraphic",dx:0,dy:0});c.elem("feColorMatrix",{result:"matrixOut",in:"offOut",type:"matrix",values:"1.3 0 0 0 0 0 1.3 0 0 0 0 0 1.3 0 0 0 0 0 1 0"})}; -Entry.Utils.addBlockPattern=function(b,a){for(var c=b.elem("pattern",{id:"blockHoverPattern_"+a,class:"blockHoverPattern",patternUnits:"userSpaceOnUse",patternTransform:"translate(12, 0)",x:0,y:0,width:125,height:33,style:"display: none"}),d=c.elem("g"),e=d.elem("rect",{x:0,y:0,width:125,height:33}),f=Entry.mediaFilePath+"block_pattern_(order).png",g=1;5>g;g++)d.elem("image",{class:"pattern"+g,href:f.replace("(order)",g),x:0,y:0,width:125,height:33});return{pattern:c,rect:e}}; -Entry.Utils.COLLISION={NONE:0,UP:1,RIGHT:2,LEFT:3,DOWN:4};Entry.Utils.createMouseEvent=function(b,a){var c=document.createEvent("MouseEvent");c.initMouseEvent(b,!0,!0,window,0,0,0,a.clientX,a.clientY,!1,!1,!1,!1,0,null);return c};Entry.Utils.xmlToJsonData=function(b){b=$.parseXML(b);var a=[];b=b.childNodes[0].childNodes;for(var c in b){var d=b[c];if(d.tagName){var e={category:d.getAttribute("id"),blocks:[]},d=d.childNodes;for(c in d){var f=d[c];f.tagName&&(f=f.getAttribute("type"))&&e.blocks.push(f)}a.push(e)}}return a}; -Entry.Utils.stopProjectWithToast=function(b,a,c){var d=b.block;a=a||"\ub7f0\ud0c0\uc784 \uc5d0\ub7ec \ubc1c\uc0dd";Entry.toast&&!c&&Entry.toast.alert(Lang.Msgs.warn,Lang.Workspace.check_runtime_error,!0);Entry.engine&&Entry.engine.toggleStop();"workspace"===Entry.type&&(b.block&&"funcBlock"in b.block?d=b.block.funcBlock:b.funcExecutor&&(d=b.funcExecutor.scope.block,b=b.type.replace("func_",""),Entry.Func.edit(Entry.variableContainer.functions_[b])),d&&(Entry.container.selectObject(d.getCode().object.id, -!0),d.view.getBoard().activateBlock(d)));throw Error(a);};Entry.Utils.AsyncError=function(b){this.name="AsyncError";this.message=b||"\ube44\ub3d9\uae30 \ud638\ucd9c \ub300\uae30"};Entry.Utils.AsyncError.prototype=Error();Entry.Utils.AsyncError.prototype.constructor=Entry.Utils.AsyncError;Entry.Utils.isChrome=function(){return/chrom(e|ium)/.test(navigator.userAgent.toLowerCase())}; -Entry.Utils.waitForWebfonts=function(b,a){for(var c=0,d=0,e=b.length;d=b.length&&(l&&clearInterval(l),c==b.length))return a(),!0}var h=document.createElement("span");h.innerHTML="giItT1WQy@!-/#";h.style.position="absolute";h.style.left="-10000px";h.style.top="-10000px";h.style.fontSize="300px";h.style.fontFamily="sans-serif";h.style.fontVariant="normal";h.style.fontStyle="normal";h.style.fontWeight= -"normal";h.style.letterSpacing="0";document.body.appendChild(h);var k=h.offsetWidth;h.style.fontFamily=d;var l;e()||(l=setInterval(e,50))})(b[d])};window.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(b){window.setTimeout(b,1E3/60)}}(); -Entry.isMobile=function(){if(Entry.device)return"tablet"===Entry.device;var b=window.platform;if(b&&b.type&&("tablet"===b.type||"mobile"===b.type))return Entry.device="tablet",!0;Entry.device="desktop";return!1};Entry.Utils.convertMouseEvent=function(b){return b.originalEvent&&b.originalEvent.touches?b.originalEvent.touches[0]:b};Entry.Utils.convertIntToHex=function(b){return b.toString(16).toUpperCase()};Entry.Model=function(b,a){var c=Entry.Model;c.generateSchema(b);c.generateSetter(b);c.generateObserve(b);(void 0===a||a)&&Object.seal(b);return b}; -(function(b){b.generateSchema=function(a){var b=a.schema;if(void 0!==b){b=JSON.parse(JSON.stringify(b));a.data={};for(var d in b)(function(d){a.data[d]=b[d];Object.defineProperty(a,d,{get:function(){return a.data[d]}})})(d);a._toJSON=this._toJSON}};b.generateSetter=function(a){a.set=this.set};b.set=function(a,b){var d={},e;for(e in this.data)void 0!==a[e]&&(a[e]===this.data[e]?delete a[e]:(d[e]=this.data[e],this.data[e]=a[e]instanceof Array?a[e].concat():a[e]));b||this.notify(Object.keys(a),d)};b.generateObserve= -function(a){a.observers=[];a.observe=this.observe;a.unobserve=this.unobserve;a.notify=this.notify};b.observe=function(a,b,d,e){d=new Entry.Observer(this.observers,a,b,d);if(!1!==e)a[b]([]);return d};b.unobserve=function(a){a.destroy()};b.notify=function(a,b){"string"===typeof a&&(a=[a]);var d=this;d.observers.map(function(e){var f=a;void 0!==e.attrs&&(f=Entry.Utils.intersectArray(e.attrs,a));if(f.length)e.object[e.funcName](f.map(function(a){return{name:a,object:d,oldValue:b[a]}}))})};b._toJSON=function(){var a= -{},b;for(b in this.data)a[b]=this.data[b];return a}})(Entry.Model);Entry.Func=function(b){this.id=b?b.id:Entry.generateHash();this.content=b?new Entry.Code(b.content):new Entry.Code([[{type:"function_create",copyable:!1,deletable:!1,x:40,y:40}]]);this.blockMenuBlock=this.block=null;this.hashMap={};this.paramMap={};var a=function(){};a.prototype=Entry.block.function_general;a=new a;a.changeEvent=new Entry.Event;a.template=Lang.template.function_general;Entry.block["func_"+this.id]=a;if(b){b=this.content._blockMap;for(var c in b)Entry.Func.registerParamBlock(b[c].type); -Entry.Func.generateWsBlock(this)}Entry.Func.registerFunction(this);Entry.Func.updateMenu()};Entry.Func.threads={};Entry.Func.registerFunction=function(b){if(Entry.playground){var a=Entry.playground.mainWorkspace;a&&(this._targetFuncBlock=a.getBlockMenu().getCategoryCodes("func").createThread([{type:"func_"+b.id}]),b.blockMenuBlock=this._targetFuncBlock)}}; -Entry.Func.executeFunction=function(b){var a=this.threads[b];if(a=Entry.Engine.computeThread(a.entity,a))return this.threads[b]=a,!0;delete this.threads[b];return!1};Entry.Func.clearThreads=function(){this.threads={}};Entry.Func.prototype.init=function(b){this.id=b.id;this.content=Blockly.Xml.textToDom(b.content);this.block=Blockly.Xml.textToDom(""+b.block+"").childNodes[0]};Entry.Func.prototype.destroy=function(){this.blockMenuBlock.destroy()}; -Entry.Func.edit=function(b){this.cancelEdit();this.targetFunc=b;this.initEditView(b.content);this.bindFuncChangeEvent();this.updateMenu()};Entry.Func.initEditView=function(b){this.menuCode||this.setupMenuCode();var a=Entry.playground.mainWorkspace;a.setMode(Entry.Workspace.MODE_OVERLAYBOARD);a.changeOverlayBoardCode(b);this._workspaceStateEvent=a.changeEvent.attach(this,this.endEdit)}; -Entry.Func.endEdit=function(b){this.unbindFuncChangeEvent();this._workspaceStateEvent.destroy();delete this._workspaceStateEvent;switch(b){case "save":this.save();case "cancelEdit":this.cancelEdit()}};Entry.Func.save=function(){this.targetFunc.generateBlock(!0);Entry.variableContainer.saveFunction(this.targetFunc)}; -Entry.Func.syncFuncName=function(b){var a=0,c=[],c=b.split(" "),d="";b=[];b=Blockly.mainWorkspace.getAllBlocks();for(var e=0;eBlockly.Block.dragMode_&&(b.updateMenu(),b.fieldText=a,b.workspaceLength=c)}}; -Entry.Func.setupMenuCode=function(){var b=Entry.playground.mainWorkspace;b&&(b=b.getBlockMenu().getCategoryCodes("func"),this._fieldLabel=b.createThread([{type:"function_field_label"}]).getFirstBlock(),this._fieldString=b.createThread([{type:"function_field_string",params:[{type:this.requestParamBlock("string")}]}]).getFirstBlock(),this._fieldBoolean=b.createThread([{type:"function_field_boolean",params:[{type:this.requestParamBlock("boolean")}]}]).getFirstBlock(),this.menuCode=b)}; -Entry.Func.refreshMenuCode=function(){if(Entry.playground.mainWorkspace){this.menuCode||this.setupMenuCode();var b=Entry.block[this._fieldString.params[0].type].changeEvent._listeners.length;2'));this._hwModule=b;var a=this;Entry.addEventListener("windowResized",function(){var b=a._hwModule.monitorTemplate.mode;"both"==b&&(a.resize(),a.resizeList());"list"==b?a.resizeList():a.resize()});Entry.addEventListener("hwModeChange",function(){a.changeMode()});this.changeOffset=0;this.scale=.5;this._listPortViews={}}; -(function(b){b.initView=function(){this.svgDom=Entry.Dom($(''))};b.generateView=function(){this.snap=Entry.SVG("hwMonitor");this._svgGroup=this.snap.elem("g");this._portMap={n:[],e:[],s:[],w:[]};var a=this._hwModule.monitorTemplate,b={href:Entry.mediaFilePath+a.imgPath,x:-a.width/2,y:-a.height/2,width:a.width,height:a.height};this._portViews={};this.hwView=this._svgGroup.elem("image");this.hwView= -this.hwView.attr(b);this._template=a;a=a.ports;this.pathGroup=null;this.pathGroup=this._svgGroup.elem("g");var b=[],d;for(d in a){var e=this.generatePortView(a[d],"_svgGroup");this._portViews[d]=e;b.push(e)}b.sort(function(a,b){return a.box.x-b.box.x});var f=this._portMap;b.map(function(a){(1>(Math.atan2(-a.box.y,a.box.x)/Math.PI+2)%2?f.n:f.s).push(a)});this.resize()};b.toggleMode=function(a){var b=this._hwModule.monitorTemplate;"list"==a?(b.TempPort=null,this._hwModule.monitorTemplate.ports&&(this._hwModule.monitorTemplate.TempPort= -this._hwModule.monitorTemplate.ports,this._hwModule.monitorTemplate.listPorts=this.addPortEle(this._hwModule.monitorTemplate.listPorts,this._hwModule.monitorTemplate.ports)),$(this._svglistGroup).remove(),this._svgGroup&&$(this._svgGroup).remove(),$(this._pathGroup).remove(),this._hwModule.monitorTemplate.mode="list",this.generateListView()):(this._hwModule.monitorTemplate.TempPort&&(this._hwModule.monitorTemplate.ports=this._hwModule.monitorTemplate.TempPort,this._hwModule.monitorTemplate.listPorts= -this.removePortEle(this._hwModule.monitorTemplate.listPorts,this._hwModule.monitorTemplate.ports)),$(this._svglistGroup).remove(),this._hwModule.monitorTemplate.mode="both",this.generateListView(),this.generateView())};b.setHwmonitor=function(a){this._hwmodule=a};b.changeMode=function(a){"both"==this._hwModule.monitorTemplate.mode?this.toggleMode("list"):"list"==this._hwModule.monitorTemplate.mode&&this.toggleMode("both")};b.addPortEle=function(a,b){if("object"!=typeof b)return a;for(var d in b)a[d]= -b[d];return a};b.removePortEle=function(a,b){if("object"!=typeof b)return a;for(var d in b)delete a[d];return a};b.generateListView=function(){this._portMapList={n:[]};this._svglistGroup=null;this.listsnap=Entry.SVG("hwMonitor");this._svglistGroup=this.listsnap.elem("g");var a=this._hwModule.monitorTemplate;this._template=a;a=a.listPorts;this.pathGroup=this._svglistGroup.elem("g");var b=[],d;for(d in a){var e=this.generatePortView(a[d],"_svglistGroup");this._listPortViews[d]=e;b.push(e)}var f=this._portMapList; -b.map(function(a){f.n.push(a)});this.resizeList()};b.generatePortView=function(a,b){var d=this[b].elem("g");d.addClass("hwComponent");var e=null,e=this.pathGroup.elem("path").attr({d:"m0,0",fill:"none",stroke:"input"===a.type?"#00979d":"#A751E3","stroke-width":3}),f=d.elem("rect").attr({x:0,y:0,width:150,height:22,rx:4,ry:4,fill:"#fff",stroke:"#a0a1a1"}),g=d.elem("text").attr({x:4,y:12,fill:"#000","class":"hwComponentName","alignment-baseline":"central"});g.textContent=a.name;g=g.getComputedTextLength(); -d.elem("rect").attr({x:g+8,y:2,width:30,height:18,rx:9,ry:9,fill:"input"===a.type?"#00979d":"#A751E3"});var h=d.elem("text").attr({x:g+13,y:12,fill:"#fff","class":"hwComponentValue","alignment-baseline":"central"});h.textContent=0;g+=40;f.attr({width:g});return{group:d,value:h,type:a.type,path:e,box:{x:a.pos.x-this._template.width/2,y:a.pos.y-this._template.height/2,width:g},width:g}};b.getView=function(){return this.svgDom};b.update=function(){var a=Entry.hw.portData,b=Entry.hw.sendQueue,d=this._hwModule.monitorTemplate.mode, -e=this._hwModule.monitorTemplate.keys||[],f=[];if("list"==d)f=this._listPortViews;else if("both"==d){if(f=this._listPortViews,this._portViews)for(var g in this._portViews)f[g]=this._portViews[g]}else f=this._portViews;if(b)for(g in b)0!=b[g]&&f[g]&&(f[g].type="output");for(var h in f)if(d=f[h],"input"==d.type){var k=a[h];0=this._template.height||0>=a.height||(this.scale=a.height/this._template.height* -this._template.height/1E3,this.align())};b.resizeList=function(){var a=this.svgDom.get(0).getBoundingClientRect();this._svglistGroup.attr({transform:"translate("+a.width/2+","+a.height/2+")"});this._rect=a;this.alignList()};b.align=function(){var a=[],a=this._portMap.s.concat();this._alignNS(a,this.scale/3*this._template.height+5,27);a=this._portMap.n.concat();this._alignNS(a,-this._template.height*this.scale/3-32,-27);a=this._portMap.e.concat();this._alignEW(a,-this._template.width*this.scale/3- -5,-27);a=this._portMap.w.concat();this._alignEW(a,this._template.width*this.scale/3-32,-27)};b.alignList=function(){for(var a={},a=this._hwModule.monitorTemplate.listPorts,b=a.length,d=0;dd-(l.width+n.width/2.2)&&(f+=1,initX=h,g=0)};b._movePort=function(a,b,d,e){var f=b,g=a.box.x*this.scale,h=a.box.y*this.scale; -b>e?(f=b-a.width,b=b>g&&g>e?"M"+g+","+d+"L"+g+","+h:"M"+(b+e)/2+","+d+"l0,"+(h>d?28:-3)+"H"+g+"L"+g+","+h):b=bd?28:-3)+"H"+g+"L"+g+","+h;a.group.attr({transform:"translate("+f+","+d+")"});a.path.attr({d:b})}})(Entry.HWMonitor.prototype);Entry.HW=function(){this.connectTrial=0;this.isFirstConnect=!0;this.initSocket();this.connected=!1;this.portData={};this.sendQueue={};this.outputQueue={};this.settingQueue={};this.socketType=this.hwModule=this.selectedDevice=null;Entry.addEventListener("stop",this.setZero);this.hwInfo={"1.1":Entry.Arduino,"1.9":Entry.ArduinoExt,"1.2":Entry.SensorBoard,"1.3":Entry.CODEino,"1.4":Entry.joystick,"1.5":Entry.dplay,"1.6":Entry.nemoino,"1.7":Entry.Xbot,"1.8":Entry.ardublock,"2.4":Entry.Hamster,"2.5":Entry.Albert, -"3.1":Entry.Bitbrick,"4.2":Entry.Arduino,"5.1":Entry.Neobot,"7.1":Entry.Robotis_carCont,"7.2":Entry.Robotis_openCM70,"8.1":Entry.Arduino}};Entry.HW.TRIAL_LIMIT=1;p=Entry.HW.prototype; -p.initSocket=function(){try{if(this.connectTrial>=Entry.HW.TRIAL_LIMIT)this.isFirstConnect||Entry.toast.alert(Lang.Menus.connect_hw,Lang.Menus.connect_fail,!1),this.isFirstConnect=!1;else{var b=this,a,c;this.connected=!1;this.connectTrial++;if(-1>>>>>> entrylabs/master Entry.Stage.prototype.initHandle=function(){this.handle=new EaselHandle(this.canvas);this.handle.setChangeListener(this,this.updateHandle);this.handle.setEditStartListener(this,this.startEdit);this.handle.setEditEndListener(this,this.endEdit)}; Entry.Stage.prototype.updateObject=function(){Entry.requestUpdate=!0;this.handle.setDraggable(!0);if(!this.editEntity){var a=this.selectedObject;if(a){"textBox"==a.objectType?this.handle.toggleCenter(!1):this.handle.toggleCenter(!0);"free"==a.getRotateMethod()?this.handle.toggleRotation(!0):this.handle.toggleRotation(!1);this.handle.toggleDirection(!0);a.getLock()?(this.handle.toggleRotation(!1),this.handle.toggleDirection(!1),this.handle.toggleResize(!1),this.handle.toggleCenter(!1),this.handle.setDraggable(!1)): this.handle.toggleResize(!0);this.handle.setVisible(!0);var b=a.entity;this.handle.setWidth(b.getScaleX()*b.getWidth());this.handle.setHeight(b.getScaleY()*b.getHeight());var c,d;if("textBox"==b.type)if(b.getLineBreak())c=b.regX*b.scaleX,d=-b.regY*b.scaleY;else{var e=b.getTextAlign();d=-b.regY*b.scaleY;switch(e){case Entry.TEXT_ALIGN_LEFT:c=-b.getWidth()/2*b.scaleX;break;case Entry.TEXT_ALIGN_CENTER:c=b.regX*b.scaleX;break;case Entry.TEXT_ALIGN_RIGHT:c=b.getWidth()/2*b.scaleX}}else c=(b.regX-b.width/ @@ -1671,14 +1310,13 @@ Entry.Stage.prototype.initWall=function(){var a=new createjs.Container,b=new Ima Entry.Stage.prototype.showInputField=function(a){a=1/1.5;this.inputField||(this.inputField=new CanvasInput({canvas:document.getElementById("entryCanvas"),fontSize:30*a,fontFamily:"NanumGothic",fontColor:"#212121",width:556*a,height:26*a,padding:8*a,borderWidth:1*a,borderColor:"#000",borderRadius:3*a,boxShadow:"none",innerShadow:"0px 0px 5px rgba(0, 0, 0, 0.5)",x:202*a,y:450*a,topPosition:!0,onsubmit:function(){Entry.dispatchEvent("canvasInputComplete")}}));a=new createjs.Container;var b=new Image; b.src=Entry.mediaFilePath+"confirm_button.png";var c=new createjs.Bitmap;c.scaleX=.23;c.scaleY=.23;c.x=160;c.y=89;c.cursor="pointer";c.image=b;a.addChild(c);a.on("mousedown",function(b){Entry.dispatchEvent("canvasInputComplete")});this.inputSubmitButton||(this.inputField.value(""),this.canvas.addChild(a),this.inputSubmitButton=a);this.inputField.show();Entry.requestUpdateTwice=!0}; Entry.Stage.prototype.hideInputField=function(){this.inputField&&this.inputField.value()&&this.inputField.value("");this.inputSubmitButton&&(this.canvas.removeChild(this.inputSubmitButton),this.inputSubmitButton=null);this.inputField&&this.inputField.hide();Entry.requestUpdate=!0}; -<<<<<<< HEAD Entry.Stage.prototype.initObjectContainers=function(){var a=Entry.scene.scenes_;if(a&&0!==a.length){for(var b=0;bd.style.opacity&&(clearInterval(b),d.style.display="none",Entry.removeElement(d));d.style.opacity*=.9},20)},1E3)}; Entry.Toast.prototype.success=function(a,b,c){var d=Entry.createElement("div","entryToast");d.addClass("entryToast");d.addClass("entryToastSuccess");d.bindOnClick(function(){Entry.toast.body_.removeChild(this)});var e=Entry.createElement("div","entryToast");e.addClass("entryToastTitle");e.innerHTML=a;d.appendChild(e);a=Entry.createElement("p","entryToast");a.addClass("entryToastMessage");a.innerHTML=b;d.appendChild(a);this.toasts_.push(d);this.body_.appendChild(d);c||window.setTimeout(function(){d.style.opacity= @@ -1686,10 +1324,10 @@ Entry.Toast.prototype.success=function(a,b,c){var d=Entry.createElement("div","e Entry.Toast.prototype.alert=function(a,b,c){var d=Entry.createElement("div","entryToast");d.addClass("entryToast");d.addClass("entryToastAlert");d.bindOnClick(function(){Entry.toast.body_.removeChild(this)});var e=Entry.createElement("div","entryToast");e.addClass("entryToastTitle");e.innerHTML=a;d.appendChild(e);a=Entry.createElement("p","entryToast");a.addClass("entryToastMessage");a.innerHTML=b;d.appendChild(a);this.toasts_.push(d);this.body_.appendChild(d);c||window.setTimeout(function(){d.style.opacity= 1;var b=setInterval(function(){.05>d.style.opacity&&(clearInterval(b),d.style.display="none",Entry.toast.body_.removeChild(d));d.style.opacity*=.9},20)},5E3)};Entry.TvCast=function(a){this.generateView(a)};p=Entry.TvCast.prototype;p.init=function(a){this.tvCastHash=a};p.generateView=function(a){var b=Entry.createElement("div");b.addClass("entryContainerMovieWorkspace");b.addClass("entryRemove");this.movieContainer=b;b=Entry.createElement("iframe");b.setAttribute("id","tvCastIframe");b.setAttribute("allowfullscreen","");b.setAttribute("frameborder",0);b.setAttribute("src",a);this.movieFrame=b;this.movieContainer.appendChild(this.movieFrame)};p.getView=function(){return this.movieContainer}; p.resize=function(){document.getElementById("entryContainerWorkspaceId");var a=document.getElementById("tvCastIframe");w=this.movieContainer.offsetWidth;a.width=w+"px";a.height=9*w/16+"px"};Entry.ContextMenu={}; -(function(a){a.visible=!1;a.createDom=function(){this.dom=Entry.Dom("ul",{id:"entry-contextmenu",parent:$("body")});this.dom.bind("mousedown touchstart",function(b){b.stopPropagation()});Entry.Utils.disableContextmenu(this.dom);Entry.documentMousedown.attach(this,function(){this.hide()})};a.show=function(b,a,d){this.dom||this.createDom();if(0!==b.length){var e=this;void 0!==a&&(this._className=a,this.dom.addClass(a));a=this.dom;a.empty();for(var f=0,g=b.length;fg&&(b.x-=d+3);b.y+e>f&&(b.y-=e);a.css({left:b.x,top:b.y})};a.hide=function(){this.visible= -!1;this.dom.empty();this.dom.addClass("entryRemove");this._className&&(this.dom.removeClass(this._className),delete this._className)}})(Entry.ContextMenu);Entry.Loader={queueCount:0,totalCount:0};Entry.Loader.addQueue=function(a){this.queueCount||Entry.dispatchEvent("loadStart");this.queueCount++;this.totalCount++};Entry.Loader.removeQueue=function(a){this.queueCount--;this.queueCount||(Entry.dispatchEvent("loadComplete"),this.totalCount=0)};Entry.Loader.getLoadedPercent=function(){return 0===this.totalCount?1:this.queueCount/this.totalCount};Entry.Variable=function(a){Entry.assert("string"==typeof a.name,"Variable name must be given");this.name_=a.name;this.id_=a.id?a.id:Entry.generateHash();this.type=a.variableType?a.variableType:"variable";this.object_=a.object||null;this.isCloud_=a.isCloud||!1;this._valueWidth=this._nameWidth=null;var b=Entry.parseNumber(a.value);this.value_="number"==typeof b?b:a.value?a.value:0;"slide"==this.type?(this.minValue_=Number(a.minValue?a.minValue:0),this.maxValue_=Number(a.maxValue?a.maxValue:100)):"list"== -this.type&&(this.array_=a.array?a.array:[]);a.isClone||(this.visible_=a.visible||"boolean"==typeof a.visible?a.visible:!0,this.x_=a.x?a.x:null,this.y_=a.y?a.y:null,"list"==this.type&&(this.width_=a.width?a.width:100,this.height_=a.height?a.height:120,this.scrollPosition=0),this.BORDER=6,this.FONT="10pt NanumGothic")}; +(function(a){a.visible=!1;a.createDom=function(){this.dom=Entry.Dom("ul",{id:"entry-contextmenu",parent:$("body")});this.dom.bind("mousedown touchstart",function(b){b.stopPropagation()});Entry.Utils.disableContextmenu(this.dom);Entry.documentMousedown.attach(this,function(){this.hide()})};a.show=function(b,a,d){this.dom||this.createDom();if(0!==b.length){var e=this;void 0!==a&&(this._className=a,this.dom.addClass(a));var f=this.dom;f.empty();for(var g=0,h=b.length;gg&&(b.x-=d+3);b.y+e>f&& +(b.y-=e);a.css({left:b.x,top:b.y})};a.hide=function(){this.visible=!1;this.dom.empty();this.dom.addClass("entryRemove");this._className&&(this.dom.removeClass(this._className),delete this._className)}})(Entry.ContextMenu);Entry.Loader={queueCount:0,totalCount:0};Entry.Loader.addQueue=function(a){this.queueCount||Entry.dispatchEvent("loadStart");this.queueCount++;this.totalCount++};Entry.Loader.removeQueue=function(a){this.queueCount--;this.queueCount||(Entry.dispatchEvent("loadComplete"),this.totalCount=0)};Entry.Loader.getLoadedPercent=function(){return 0===this.totalCount?1:this.queueCount/this.totalCount};Entry.Variable=function(a){Entry.assert("string"==typeof a.name,"Variable name must be given");this.name_=a.name;this.id_=a.id?a.id:Entry.generateHash();this.type=a.variableType?a.variableType:"variable";this.object_=a.object||null;this.isCloud_=a.isCloud||!1;this._valueWidth=this._nameWidth=null;var b=Entry.parseNumber(a.value);this.value_="number"==typeof b?b:a.value?a.value:0;"slide"==this.type?(this.setMinValue(a.minValue),this.setMaxValue(a.maxValue)):"list"==this.type&&(this.array_=a.array? +a.array:[]);a.isClone||(this.visible_=a.visible||"boolean"==typeof a.visible?a.visible:!0,this.x_=a.x?a.x:null,this.y_=a.y?a.y:null,"list"==this.type&&(this.width_=a.width?a.width:100,this.height_=a.height?a.height:120,this.scrollPosition=0),this.BORDER=6,this.FONT="10pt NanumGothic")}; Entry.Variable.prototype.generateView=function(a){var b=this.type;if("variable"==b||"timer"==b||"answer"==b)this.view_=new createjs.Container,this.rect_=new createjs.Shape,this.view_.addChild(this.rect_),this.view_.variable=this,this.wrapper_=new createjs.Shape,this.view_.addChild(this.wrapper_),this.textView_=new createjs.Text("asdf",this.FONT,"#000000"),this.textView_.textBaseline="alphabetic",this.textView_.x=4,this.textView_.y=1,this.view_.addChild(this.textView_),this.valueView_=new createjs.Text("asdf", "10pt NanumGothic","#ffffff"),this.valueView_.textBaseline="alphabetic",b=Entry.variableContainer.variables_.length,this.getX()&&this.getY()?(this.setX(this.getX()),this.setY(this.getY())):(this.setX(-230+80*Math.floor(b/11)),this.setY(24*a+20-135-264*Math.floor(b/11))),this.view_.visible=this.visible_,this.view_.addChild(this.valueView_),this.view_.on("mousedown",function(b){"workspace"==Entry.type&&(this.offset={x:this.x-(.75*b.stageX-240),y:this.y-(.75*b.stageY-135)},this.cursor="move")}),this.view_.on("pressmove", function(b){"workspace"==Entry.type&&(this.variable.setX(.75*b.stageX-240+this.offset.x),this.variable.setY(.75*b.stageY-135+this.offset.y),this.variable.updateView())});else if("slide"==b){var c=this;this.view_=new createjs.Container;this.rect_=new createjs.Shape;this.view_.addChild(this.rect_);this.view_.variable=this;this.wrapper_=new createjs.Shape;this.view_.addChild(this.wrapper_);this.textView_=new createjs.Text("name",this.FONT,"#000000");this.textView_.textBaseline="alphabetic";this.textView_.x= @@ -1722,7 +1360,7 @@ Entry.Variable.prototype.toJSON=function(){var a={};a.name=this.name_;a.id=this. Entry.Variable.prototype.clone=function(){var a=this.toJSON();a.isClone=!0;return a=new Entry.Variable(a)};Entry.Variable.prototype.getType=function(){return this.type};Entry.Variable.prototype.setType=function(a){this.type=a};Entry.Variable.prototype.getSlidePosition=function(a){var b=this.minValue_;return Math.abs(this.value_-b)/Math.abs(this.maxValue_-b)*a+10}; Entry.Variable.prototype.setSlideCommandX=function(a){var b=this.valueSetter_.graphics.command;a=Math.max("undefined"==typeof a?10:a,10);a=Math.min(this.maxWidth+10,a);b.x=a;this.updateSlideValueByView()}; Entry.Variable.prototype.updateSlideValueByView=function(){var a=Math.max(this.valueSetter_.graphics.command.x-10,0)/this.maxWidth;0>a&&(a=0);1c&&(a=this.maxValue_);this.isFloatPoint()||(a=Math.round(a));this.setValue(a)};Entry.Variable.prototype.getMinValue=function(){return this.minValue_}; -Entry.Variable.prototype.setMinValue=function(a){this.minValue_=a;this.value_a&&(this.value_=a);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.Variable.prototype.setMinValue=function(a){this.minValue_=a=a||0;this.value_a&&(this.value_=a);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(a){var b=this;this.view_=a;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(a){a=f.variableAddPanel; var c=a.view.name.value.trim();a.isOpen?c&&0!==c.length?b.addVariable():(a.view.addClass("entryRemove"),a.isOpen=!1):(a.view.removeClass("entryRemove"),a.view.name.focus(),a.isOpen=!0)});this.generateVariableAddView();this.generateListAddView();this.generateVariableSplitterView();this.generateVariableSettingView();this.generateListSettingView();c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.message_create; @@ -1808,8 +1446,8 @@ c.addClass("entryVariableSettingChecked"):c.removeClass("entryVariableSettingChe d=Entry.createElement("input");d.addClass("entryVariableSettingInitValueInputWorkspace");b.initValueInput=d;d.value=0;d.onkeyup=function(b){a.selectedVariable.setValue(this.value)};d.onblur=function(b){a.selectedVariable.setValue(this.value)};b.initValueInput=d;c.appendChild(d);c=Entry.createElement("div");c.addClass("entryVariableSettingSplitterWorkspace");b.appendChild(c);c=Entry.createElement("div");c.addClass("entryVariableSettingSlideWrapperWorkspace");b.appendChild(c);d=Entry.createElement("span"); d.innerHTML=Lang.Workspace.slide;c.appendChild(d);d=Entry.createElement("span");d.addClass("entryVariableSettingCheckWorkspace");b.slideCheck=d;c.appendChild(d);c.bindOnClick(function(b){var c;b=a.selectedVariable;var d=a.variables_,f=b.getType();"variable"==f?(c=b.toJSON(),c.variableType="slide",c=new Entry.Variable(c),d.splice(d.indexOf(b),0,c),0>c.getValue()&&c.setValue(0),100this.offsetX?0:a+c.maxWidth+10>this.offsetX?this.offsetX-a:c.maxWidth+10))}});this.valueSetter_.on("pressup",function(a){c.isAdjusting=!1});this.view_.addChild(this.valueSetter_); -a=Entry.variableContainer.variables_.length;this.getX()&&this.getY()?(this.setX(this.getX()),this.setY(this.getY())):(this.setX(-230+80*Math.floor(a/11)),this.setY(24*b+20-135-264*Math.floor(a/11)))}else this.view_=new createjs.Container,this.rect_=new createjs.Shape,this.view_.addChild(this.rect_),this.view_.variable=this,this.titleView_=new createjs.Text("asdf",this.FONT,"#000"),this.titleView_.textBaseline="alphabetic",this.titleView_.textAlign="center",this.titleView_.width=this.width_-2*this.BORDER, -this.titleView_.y=this.BORDER+10,this.titleView_.x=this.width_/2,this.view_.addChild(this.titleView_),this.resizeHandle_=new createjs.Shape,this.resizeHandle_.graphics.f("#1bafea").ss(1,0,0).s("#1bafea").lt(0,-9).lt(-9,0).lt(0,0),this.view_.addChild(this.resizeHandle_),this.resizeHandle_.list=this,this.resizeHandle_.on("mouseover",function(a){this.cursor="nwse-resize"}),this.resizeHandle_.on("mousedown",function(a){this.list.isResizing=!0;this.offset={x:.75*a.stageX-this.list.getWidth(),y:.75*a.stageY- -this.list.getHeight()};this.parent.cursor="nwse-resize"}),this.resizeHandle_.on("pressmove",function(a){this.list.setWidth(.75*a.stageX-this.offset.x);this.list.setHeight(.75*a.stageY-this.offset.y);this.list.updateView()}),this.view_.on("mouseover",function(a){this.cursor="move"}),this.view_.on("mousedown",function(a){"workspace"!=Entry.type||this.variable.isResizing||(this.offset={x:this.x-(.75*a.stageX-240),y:this.y-(.75*a.stageY-135)},this.cursor="move")}),this.view_.on("pressup",function(a){this.cursor= -"initial";this.variable.isResizing=!1}),this.view_.on("pressmove",function(a){"workspace"!=Entry.type||this.variable.isResizing||(this.variable.setX(.75*a.stageX-240+this.offset.x),this.variable.setY(.75*a.stageY-135+this.offset.y),this.variable.updateView())}),this.elementView=new createjs.Container,a=new createjs.Text("asdf",this.FONT,"#000"),a.textBaseline="middle",a.y=5,this.elementView.addChild(a),this.elementView.indexView=a,a=new createjs.Shape,this.elementView.addChild(a),this.elementView.valueWrapper= -a,a=new createjs.Text("fdsa",this.FONT,"#eee"),a.x=24,a.y=6,a.textBaseline="middle",this.elementView.addChild(a),this.elementView.valueView=a,this.elementView.x=this.BORDER,this.scrollButton_=new createjs.Shape,this.scrollButton_.graphics.f("#aaa").rr(0,0,7,30,3.5),this.view_.addChild(this.scrollButton_),this.scrollButton_.y=23,this.scrollButton_.list=this,this.scrollButton_.on("mousedown",function(a){this.list.isResizing=!0;this.cursor="pointer";this.offsetY=isNaN(this.offsetY)||0>this.offsetY?a.rawY/ -2:this.offsetY}),this.scrollButton_.on("pressmove",function(a){void 0===this.moveAmount?(this.y=a.target.y,this.moveAmount=!0):this.y=a.rawY/2-this.offsetY+this.list.height_/100*23;23>this.y&&(this.y=23);this.y>this.list.getHeight()-40&&(this.y=this.list.getHeight()-40);this.list.updateView()}),this.scrollButton_.on("pressup",function(a){this.moveAmount=void 0}),this.getX()&&this.getY()?(this.setX(this.getX()),this.setY(this.getY())):(a=Entry.variableContainer.lists_.length,this.setX(110*-Math.floor(a/ -6)+120),this.setY(24*b+20-135-145*Math.floor(a/6)));this.setVisible(this.isVisible());this.updateView();Entry.stage.loadVariable(this)}; -Entry.Variable.prototype.updateView=function(){if(this.view_){if(this.isVisible())if("variable"==this.type){this.view_.x=this.getX();this.view_.y=this.getY();if(this.object_){var b=Entry.container.getObject(this.object_);this.textView_.text=b?b.name+":"+this.getName():this.getName()}else this.textView_.text=this.getName();null===this._nameWidth&&(this._nameWidth=this.textView_.getMeasuredWidth());this.valueView_.x=this._nameWidth+14;this.valueView_.y=1;this.isNumber()?this.valueView_.text=this.getValue().toFixed(2).replace(".00", -""):this.valueView_.text=this.getValue();null===this._valueWidth&&(this._valueWidth=this.valueView_.getMeasuredWidth());this.rect_.graphics.clear().f("#ffffff").ss(1,2,0).s("#A0A1A1").rc(0,-14,this._nameWidth+this._valueWidth+26,20,4,4,4,4);this.wrapper_.graphics.clear().f("#1bafea").ss(1,2,0).s("#1bafea").rc(this._nameWidth+7,-11,this._valueWidth+15,14,7,7,7,7)}else if("slide"==this.type)this.view_.x=this.getX(),this.view_.y=this.getY(),this.object_?(b=Entry.container.getObject(this.object_),this.textView_.text= -b?b.name+":"+this.getName():this.getName()):this.textView_.text=this.getName(),null===this._nameWidth&&(this._nameWidth=this.textView_.getMeasuredWidth()),this.valueView_.x=this._nameWidth+14,this.valueView_.y=1,this.isNumber()?this.valueView_.text=this.getValue().toFixed(2).replace(".00",""):this.valueView_.text=this.getValue(),null===this._valueWidth&&(this._valueWidth=this.valueView_.getMeasuredWidth()),b=this._nameWidth+this._valueWidth+26,b=Math.max(b,90),this.rect_.graphics.clear().f("#ffffff").ss(1, -2,0).s("#A0A1A1").rc(0,-14,b,33,4,4,4,4),this.wrapper_.graphics.clear().f("#1bafea").ss(1,2,0).s("#1bafea").rc(this._nameWidth+7,-11,this._valueWidth+15,14,7,7,7,7),b=this._nameWidth+this._valueWidth+26,b=Math.max(b,90),this.maxWidth=b-20,this.slideBar_.graphics.clear().beginFill("#A0A1A1").s("#A0A1A1").ss(1).dr(10,10,this.maxWidth,1.5),b=this.getSlidePosition(this.maxWidth),this.valueSetter_.graphics.clear().beginFill("#1bafea").s("#A0A1A1").ss(1).dc(b,10.5,3);else if("list"==this.type){this.view_.x= -this.getX();this.view_.y=this.getY();this.resizeHandle_.x=this.width_-2;this.resizeHandle_.y=this.height_-2;var a=this.getName();this.object_&&(b=Entry.container.getObject(this.object_))&&(a=b.name+":"+a);a=7this.getHeight()-40&&(this.scrollButton_.y=this.getHeight()-40),this.elementView.valueWrapper.graphics.clear().f("#1bafea").rr(20,-2,this.getWidth()-20-10-2*this.BORDER,17,2),this.scrollButton_.visible=!0,this.scrollButton_.x=this.getWidth()-12,this.scrollPosition=Math.floor((this.scrollButton_.y-23)/(this.getHeight()-23-40)*(this.array_.length-b))):(this.elementView.valueWrapper.graphics.clear().f("#1bafea").rr(20,-2,this.getWidth()-20-2*this.BORDER, -17,2),this.scrollButton_.visible=!1,this.scrollPosition=0);for(a=this.scrollPosition;ac.length?c+"..":c;this.elementView.valueView.text=c;c=this.elementView.clone(!0);c.y=20*(a-this.scrollPosition)+23;this.view_.addChild(c)}}else"answer"==this.type?(this.view_.x=this.getX(),this.view_.y= -this.getY(),this.textView_.text=this.getName(),this.valueView_.y=1,this.isNumber()?parseInt(this.getValue(),10)==this.getValue()?this.valueView_.text=this.getValue():this.valueView_.text=this.getValue().toFixed(1).replace(".00",""):this.valueView_.text=this.getValue(),null===this._nameWidth&&(this._nameWidth=this.textView_.getMeasuredWidth()),null===this._valueWidth&&(this._valueWidth=this.valueView_.getMeasuredWidth()),this.valueView_.x=this._nameWidth+14,this.rect_.graphics.clear().f("#ffffff").ss(1, -2,0).s("#A0A1A1").rc(0,-14,this._nameWidth+this._valueWidth+26,20,4,4,4,4),this.wrapper_.graphics.clear().f("#E457DC").ss(1,2,0).s("#E457DC").rc(this._nameWidth+7,-11,this._valueWidth+15,14,7,7,7,7)):(this.view_.x=this.getX(),this.view_.y=this.getY(),this.textView_.text=this.getName(),null===this._nameWidth&&(this._nameWidth=this.textView_.getMeasuredWidth()),this.valueView_.x=this._nameWidth+14,this.valueView_.y=1,this.isNumber()?this.valueView_.text=this.getValue().toFixed(1).replace(".00",""): -this.valueView_.text=this.getValue(),null===this._valueWidth&&(this._valueWidth=this.valueView_.getMeasuredWidth()),this.rect_.graphics.clear().f("#ffffff").ss(1,2,0).s("#A0A1A1").rc(0,-14,this._nameWidth+this._valueWidth+26,20,4,4,4,4),this.wrapper_.graphics.clear().f("#ffbb14").ss(1,2,0).s("orange").rc(this._nameWidth+7,-11,this._valueWidth+15,14,7,7,7,7));Entry.requestUpdate=!0}};Entry.Variable.prototype.getName=function(){return this.name_}; -Entry.Variable.prototype.setName=function(b){Entry.assert("string"==typeof b,"Variable name must be string");this.name_=b;this._nameWidth=null;this.updateView();Entry.requestUpdateTwice=!0};Entry.Variable.prototype.getId=function(){return this.id_};Entry.Variable.prototype.getValue=function(){return this.isNumber()?Number(this.value_):this.value_};Entry.Variable.prototype.isNumber=function(){return isNaN(this.value_)?!1:!0}; -Entry.Variable.prototype.setValue=function(b){"slide"!=this.type?this.value_=b:(b=Number(b),this.value_=bthis.maxValue_?this.maxValue_:b);this.isCloud_&&Entry.variableContainer.updateCloudVariables();this._valueWidth=null;this.updateView();Entry.requestUpdateTwice=!0};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!==b&&(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.setMinValue=function(b){this.minValue_=b=b||0;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; -var c=b.view.name.value.trim();b.isOpen?c&&0!==c.length?a.addVariable():(b.view.addClass("entryRemove"),b.isOpen=!1):(b.view.removeClass("entryRemove"),b.view.name.focus(),b.isOpen=!0)});this.generateVariableAddView();this.generateListAddView();this.generateVariableSplitterView();this.generateVariableSettingView();this.generateListSettingView();c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.message_create; -this.messageAddButton_=c;c.bindOnClick(function(b){a.addMessage({name:Lang.Workspace.message+" "+(a.messages_.length+1)})});c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.list_create;this.listAddButton_=c;c.bindOnClick(function(b){b=f.listAddPanel;var c=b.view.name.value.trim();b.isOpen?c&&0!==c.length?a.addList():(b.view.addClass("entryRemove"),b.isOpen=!1):(b.view.removeClass("entryRemove"),b.view.name.focus(), -b.isOpen=!0)});c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.function_add;this.functionAddButton_=c;c.bindOnClick(function(b){b=a._getBlockMenu();Entry.playground.changeViewMode("code");"func"!=b.lastSelector&&b.selectMenu("func");a.createFunction()});return b}; -Entry.VariableContainer.prototype.createSelectButton=function(b,a){var c=this;void 0===a&&(a=!0);var d=Entry.createElement("td");d.addClass("entryVariableSelectButtonWorkspace",b);d.innerHTML=Lang.Workspace[b];a?d.bindOnClick(function(a){c.selectFilter(b);this.addClass("selected")}):d.addClass("disable");return d}; -Entry.VariableContainer.prototype.selectFilter=function(b){for(var a=this.view_.getElementsByTagName("td"),c=0;cb.x_&&a.xe?!0:!1}; -Entry.VariableContainer.prototype.getListById=function(b){var a=this.lists_,c=[];if(0this._maxNameLength&&(b=this._truncName(b,"variable"));b=this.checkAllVariableName(b,"variables_")?Entry.getOrderedName(b,this.variables_,"name_"):b;var c=a.info;b={name:b,isCloud:c.isCloud,object:c.object,variableType:"variable"};a.view.addClass("entryRemove");this.resetVariableAddPanel("variable")}b=new Entry.Variable(b);Entry.stateManager&& -Entry.stateManager.addCommand("add variable",this,this.removeVariable,b);b.generateView(this.variables_.length);this.createVariableView(b);this.variables_.unshift(b);Entry.playground.reloadPlayground();this.updateList();return new Entry.State(this,this.removeVariable,b)}; -Entry.VariableContainer.prototype.removeVariable=function(b){var a=this.variables_.indexOf(b),c=b.toJSON();this.selected==b&&this.select(null);b.remove();this.variables_.splice(a,1);Entry.stateManager&&Entry.stateManager.addCommand("remove variable",this,this.addVariable,c);Entry.playground.reloadPlayground();this.updateList();return new Entry.State(this,this.addVariable,c)}; -Entry.VariableContainer.prototype.changeVariableName=function(b,a){b.name_!=a&&(Entry.isExist(a,"name_",this.variables_)?(b.listElement.nameField.value=b.name_,Entry.toast.alert(Lang.Workspace.variable_rename_failed,Lang.Workspace.variable_dup)):10this._maxNameLength&&(b=this._truncName(b,"list"));b=this.checkAllVariableName(b,"lists_")?Entry.getOrderedName(b,this.lists_,"name_"):b;b={name:b,isCloud:c.isCloud,object:c.object,variableType:"list"};a.view.addClass("entryRemove");this.resetVariableAddPanel("list")}b=new Entry.Variable(b);Entry.stateManager&&Entry.stateManager.addCommand("add list", -this,this.removeList,b);b.generateView(this.lists_.length);this.createListView(b);this.lists_.unshift(b);Entry.playground.reloadPlayground();this.updateList();return new Entry.State(this,this.removelist,b)}; -Entry.VariableContainer.prototype.createListView=function(b){var a=this,c=Entry.createElement("li"),d=Entry.createElement("div");d.addClass("entryVariableListElementWrapperWorkspace");c.appendChild(d);c.addClass("entryVariableListElementWorkspace");b.object_?c.addClass("entryListLocalElementWorkspace"):b.isCloud_?c.addClass("entryListCloudElementWorkspace"):c.addClass("entryListGlobalElementWorkspace");c.bindOnClick(function(c){a.select(b)});var e=Entry.createElement("button");e.addClass("entryVariableListElementDeleteWorkspace"); -e.bindOnClick(function(c){c.stopPropagation();a.removeList(b);a.selectedList=null;a.listSettingView.addClass("entryRemove")});var f=Entry.createElement("button");f.addClass("entryVariableListElementEditWorkspace");f.bindOnClick(function(c){c.stopPropagation();h.removeAttribute("disabled");g.removeClass("entryRemove");this.addClass("entryRemove");a.updateSelectedVariable(b);h.focus()});c.editButton=f;var g=Entry.createElement("button");g.addClass("entryVariableListElementEditWorkspace");g.addClass("entryRemove"); -g.bindOnClick(function(c){c.stopPropagation();h.blur();h.setAttribute("disabled","disabled");f.removeClass("entryRemove");this.addClass("entryRemove");a.select(b);a.updateSelectedVariable(null,"list")});c.editSaveButton=g;var h=Entry.createElement("input");h.setAttribute("disabled","disabled");h.addClass("entryVariableListElementNameWorkspace");h.value=b.name_;h.bindOnClick(function(a){a.stopPropagation()});h.onblur=function(c){(c=this.value.trim())&&0!==c.length?a.changeListName(b,this.value):(Entry.toast.alert(Lang.Msgs.warn, -Lang.Msgs.list_can_not_space),this.value=b.getName())};h.onkeydown=function(a){13==a.keyCode&&this.blur()};c.nameField=h;d.appendChild(h);d.appendChild(f);d.appendChild(g);d.appendChild(e);b.listElement=c};Entry.VariableContainer.prototype.mapVariable=function(b,a){for(var c=this.variables_.length,d=0;dc.getValue()&&c.setValue(0),100b&&(a.length=b)}this.updateListSettingView()};Entry.VariableContainer.prototype.updateViews=function(){var b=this.lists_;this.variables_.map(function(a){a.updateView()});b.map(function(a){a.updateView()})}; -Entry.VariableContainer.prototype.updateSelectedVariable=function(b,a){b?"variable"==b.type?(this.selectedVariable=b,this.updateVariableSettingView(b)):"slide"==b.type?(this.selectedVariable=b,this.updateVariableSettingView(b)):"list"==b.type&&(this.selectedList=b,this.updateListSettingView(b)):(this.selectedVariable=null,"variable"==(a||"variable")?this.variableSettingView.addClass("entryRemove"):this.listSettingView.addClass("entryRemove"))}; -Entry.VariableContainer.prototype.removeLocalVariables=function(b){var a=[],c=this;this.mapVariable(function(b,c){b.object_&&b.object_==c&&a.push(b)},b);a.map(function(a){c.removeVariable(a)})}; -Entry.VariableContainer.prototype.updateCloudVariables=function(){var b=Entry.projectId;if(Entry.cloudSavable&&b){var a=Entry.variableContainer,b=a.variables_.filter(function(a){return a.isCloud_}),b=b.map(function(a){return a.toJSON()}),a=a.lists_.filter(function(a){return a.isCloud_}),a=a.map(function(a){return a.toJSON()});$.ajax({url:"/api/project/variable/"+Entry.projectId,type:"PUT",data:{variables:b,lists:a}}).done(function(){})}}; -Entry.VariableContainer.prototype.addRef=function(b,a){if(this.view_&&Entry.playground.mainWorkspace&&Entry.playground.mainWorkspace.getMode()===Entry.Workspace.MODE_BOARD){var c={object:a.getCode().object,block:a};a.funcBlock&&(c.funcBlock=a.funcBlock,delete a.funcBlock);this[b].push(c);if("_functionRefs"==b)for(var d=a.type.substr(5),e=Entry.variableContainer.functions_[d].content.getBlockList(),f=0;f>>>>>> entrylabs/master Entry.block.maze_step_for={skeleton:"basic_loop",mode:"maze",color:"#498DEB",template:"%1 \ubc88 \ubc18\ubcf5\ud558\uae30%2",syntax:["BasicIteration"],params:[{type:"Dropdown",key:"REPEAT",options:[[1,1],[2,2],[3,3],[4,4],[5,5],[6,6],[7,7],[8,8],[9,9],[10,10]],value:1},{type:"Image",img:"/img/assets/week/blocks/for.png",size:24}],statements:[{accept:"basic"}],func:function(){if(void 0===this.repeatCount)return this.repeatCount=this.block.params[0],Entry.STATIC.CONTINUE;if(0","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(a,b){a=b.getField("OPERATOR",b);var c=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return"EQUAL"==a?c==b:"BIGGER"==a?c>b:c",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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a>b}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a","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(a,b){a=b.getField("OPERATOR",b);var c=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return"EQUAL"==a?c==b:"BIGGER"==a?c>b:c",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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a>b}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return aa)throw Error("object is not available for current scene");switch(d){case "FRONT":c=0;break;case "FORWARD":c=Math.max(0,a-1);break;case "BACKWARD":c=Math.min(e,a+1);break;case "BACK":c=e}Entry.container.moveElementByBlock(a,c);return b.callReturn()}}, move_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:["10"]},null],type:"move_direction"},paramsKeyMap:{VALUE:0},"class":"walk",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.setX(a.getX()+c*Math.cos((a.getRotation()+a.getDirection()-90)/180*Math.PI));a.setY(a.getY()-c*Math.sin((a.getRotation()+a.getDirection()-90)/180*Math.PI)); a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}},move_x:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"move_x"},paramsKeyMap:{VALUE:0},"class":"move_relative",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.setX(a.getX()+c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY()); @@ -2691,596 +2156,6 @@ e.attr({transform:f});this.box.set({x:b,y:a})};a.getAbsolutePosFromBoard=functio b.x,y:a.y+b.y}};a.truncate=function(){var b=String(this.getValue()),a=this.TEXT_LIMIT_LENGTH,d=b.substring(0,a);b.length>a&&(d+="...");return d};a.appendSvgOptionGroup=function(){return this._block.view.getBoard().svgGroup.elem("g")};a.getValue=function(){return this._block.params[this._index]};a.setValue=function(b,a){this.value!=b&&(this.value=b,this._block.params[this._index]=b,a&&this._blockView.reDraw())};a._isEditable=function(){if(Entry.ContextMenu.visible||this._block.view.dragMode==Entry.DRAG_MODE_DRAG)return!1; var b=this._block.view,a=b.getBoard();if(!0===a.disableMouseEvent)return!1;var d=a.workspace.selectedBlockView;if(!d||a!=d.getBoard())return!1;a=b.getSvgRoot();return a==d.svgGroup||$(a).has($(b.svgGroup))};a._selectBlockView=function(){var b=this._block.view;b.getBoard().setSelectedBlock(b)};a._bindRenderOptions=function(){var b=this;$(this.svgGroup).bind("mouseup touchend",function(a){b._isEditable()&&(b.destroyOption(),b._startValue=b.getValue(),b.renderOptions())})};a.pointer=function(b){b=b|| [];b.unshift(this._index);b.unshift(Entry.PARAM);return this._block.pointer(b)};a.getFontSize=function(b){return b=b||this._blockView.getSkeleton().fontSize||12};a.getContentHeight=function(){return Entry.isMobile()?22:16}})(Entry.Field.prototype);Entry.FieldBlock=function(a,b,c,d,e){Entry.Model(this,!1);this._blockView=b;this._block=b.block;this._valueBlock=null;this.box=new Entry.BoxModel;this.changeEvent=new Entry.Event(this);this._index=c;this.contentIndex=e;this._content=a;this.acceptType=a.accept;this._restoreCurrent=a.restore;this.view=this;this.svgGroup=null;this._position=a.position;this.box.observe(b,"alignContent",["width","height"]);this.observe(this,"_updateBG",["magneting"],!1);this.renderStart(b.getBoard(),d)}; -======= -{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,"4",{type:"text",params:["0.5"]},null],type:"albert_play_note_for"},paramsKeyMap:{NOTE:0,OCTAVE:1,VALUE:2},"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=!1;c.note=0;return a.callReturn()}var d=a.getNumberField("NOTE",a),e=a.getNumberField("OCTAVE", -a),f=a.getNumberValue("VALUE",a),g=Entry.Albert.tempo,f=6E4*f/g;a.isStart=!0;a.timeFlag=1;c.buzzer=0;c.note=d+12*(e-1);if(100Entry.Albert.tempo&&(Entry.Albert.tempo=1);return a.callReturn()}}, -albert_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:"albert_set_tempo_to"},paramsKeyMap:{VALUE:0},"class":"albert_buzzer",isNotFor:["albert"],func:function(b,a){Entry.Albert.tempo=a.getNumberValue("VALUE");1>Entry.Albert.tempo&&(Entry.Albert.tempo=1);return a.callReturn()}},albert_move_forward:{color:"#00979D",skeleton:"basic", -statements:[],params:[{type:"Indicator",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 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;c.leftWheel=30;c.rightWheel=30;setTimeout(function(){a.timeFlag=0},1E3);return a}},albert_move_backward:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator", -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", -"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", -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])}}, -arduino_get_digital_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[{type:"arduino_get_port_number"}],type:"arduino_get_digital_value"},paramsKeyMap:{VALUE:0},"class":"arduino_value",isNotFor:["arduino"],func:function(b,a){var c=a.getNumberValue("VALUE",a);return Entry.hw.getDigitalPortValue(c)}},arduino_toggle_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"}, -{type:"Dropdown",options:[[Lang.Blocks.ARDUINO_on,"on"],[Lang.Blocks.ARDUINO_off,"off"]],value:"on",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"arduino_get_port_number"},null,null],type:"arduino_toggle_led"},paramsKeyMap:{VALUE:0,OPERATOR:1},"class":"arduino_set",isNotFor:["arduino"],func:function(b,a){var c=a.getNumberValue("VALUE"),d=a.getField("OPERATOR");Entry.hw.setDigitalPortValue(c,"on"==d?255: -0);return a.callReturn()}},arduino_toggle_pwm:{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:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"arduino_toggle_pwm"},paramsKeyMap:{PORT:0,VALUE:1},"class":"arduino_set",isNotFor:["arduino"],func:function(b,a){var c=a.getNumberValue("PORT"),d=a.getNumberValue("VALUE"), -d=Math.round(d),d=Math.max(d,0),d=Math.min(d,255);Entry.hw.setDigitalPortValue(c,d);return a.callReturn()}},arduino_convert_scale:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number",id:"bl5e"}]},{type:"number", -params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"arduino_convert_scale"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2,VALUE4:3,VALUE5:4},"class":"arduino",isNotFor:["arduino"],func:function(b,a){var c=a.getNumberValue("VALUE1",a),d=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a),f=a.getNumberValue("VALUE4",a),g=a.getNumberValue("VALUE5",a);if(d>e)var h=d,d=e,e=h;f>g&&(h=f,f=g,g=h);c-=d;c*=(g-f)/(e-d);c+=f;c=Math.min(g,c);c=Math.max(f, -c);return Math.round(c)}},arduino_ext_get_analog_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["A0","0"],["A1","1"],["A2","2"],["A3","3"],["A4","4"],["A5","5"]],value:"0",fontSize:11}],events:{},def:{params:[null],type:"arduino_ext_get_analog_value"},paramsKeyMap:{PORT:0},"class":"ArduinoExtGet",isNotFor:["ArduinoExt"],func:function(b,a){var c=a.getField("PORT",a),d=Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.ANALOG), -e=Entry.hw.portData.TIME||0;Entry.ArduinoExt.BlockState[this.type]||(Entry.ArduinoExt.BlockState[this.type]={isStart:!1,stamp:0});var f=Entry.ArduinoExt.BlockState[this.type],g=Entry.hw.portData.ANALOG;if(f.isStart){if(e&&e===f.stamp||64Entry.hw.getAnalogPortValue(0)?1:0}},CODEino_get_light_status:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CODEino_string_14,"BRIGHT"],[Lang.Blocks.CODEino_string_15, -"DARK"]],value:"BRIGHT",fontSize:11}],events:{},def:{params:[null],type:"CODEino_get_light_status"},paramsKeyMap:{STATUS:0},"class":"CODEino",isNotFor:["CODEino"],func:function(b,a){return"DARK"==a.getField("STATUS",a)?800Entry.hw.getAnalogPortValue(1)?1:0}},CODEino_is_button_pressed:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CODEino_string_3,"4"],[Lang.Blocks.CODEino_string_4, -"17"],[Lang.Blocks.CODEino_string_5,"18"],[Lang.Blocks.CODEino_string_6,"19"],[Lang.Blocks.CODEino_string_7,"20"]],value:"4",fontSize:11}],events:{},def:{params:[null],type:"CODEino_is_button_pressed"},paramsKeyMap:{PORT:0},"class":"CODEino",isNotFor:["CODEino"],func:function(b,a){var c=a.getNumberField("PORT",a);return 14d?1:0;if("RIGHT"==c||"FRONT"==c)return 30d?1:0}},CODEino_get_accelerometer_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["X","3"],["Y","4"],["Z","5"]],value:"3",fontSize:11}],events:{},def:{params:[null],type:"CODEino_get_accelerometer_value"}, -paramsKeyMap:{PORT:0},"class":"CODEino",isNotFor:["CODEino"],func:function(b,a){var c=265,d=402,e=-90,f=90,g=Entry.hw.getAnalogPortValue(a.getField("PORT",a));if(c>d)var h=c,c=d,d=h;e>f&&(h=e,e=f,f=h);g=(f-e)/(d-c)*(g-c);g+=e;g=Math.min(f,g);g=Math.max(e,g);return Math.round(g)}},nemoino_get_named_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"%1 \uc13c\uc11c\uac12",params:[{type:"Dropdown",options:[["\uc18c\ub9ac","0"],["\ube5b","1"],["\uc2ac\ub77c\uc774\ub354", -"2"],["\uc800\ud56d-A","3"],["\uc800\ud56d-B","4"],["\uc800\ud56d-C","5"],["\uc800\ud56d-D","6"]],value:"0",fontSize:11}],events:{},def:{params:[null],type:"nemoino_get_named_sensor_value"},paramsKeyMap:{PORT:0},"class":"nemoino",isNotFor:["nemoino"],func:function(b,a){return Entry.hw.getAnalogPortValue(a.getField("PORT",a))}},nemoino_get_sound_status:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],template:"\uc18c\ub9ac\uc13c\uc11c %1",params:[{type:"Dropdown",options:[["\uc18c\ub9ac\ud07c", -"GREAT"],["\uc18c\ub9ac\uc791\uc74c","SMALL"]],value:"GREAT",fontSize:11}],events:{},def:{params:[null],type:"nemoino_get_sound_status"},paramsKeyMap:{STATUS:0},"class":"nemoino",isNotFor:["nemoino"],func:function(b,a){return"GREAT"==a.getField("STATUS",a)?600Entry.hw.getAnalogPortValue(0)?1:0}},nemoino_is_button_pressed:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],template:"\ubcf4\ub4dc\uc758 %1",params:[{type:"Dropdown",options:[["\ubc84\ud2bc\ub204\ub984", -"4"],["A\uc5f0\uacb0\ub428","17"],["B\uc5f0\uacb0\ub428","18"],["C\uc5f0\uacb0\ub428","19"],["D\uc5f0\uacb0\ub428","20"]],value:"4",fontSize:11}],events:{},def:{params:[null],type:"nemoino_is_button_pressed"},paramsKeyMap:{PORT:0},"class":"nemoino",isNotFor:["nemoino"],func:function(b,a){var c=a.getNumberField("PORT",a);return 14d?1:0;if("RIGHT"==c||"FRONT"==c)return 30d?1:0}},nemoino_get_accelerometer_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"3\ucd95 \uac00\uc18d\ub3c4\uc13c\uc11c %1 \ucd95\uc758 \uc13c\uc11c\uac12", -params:[{type:"Dropdown",options:[["X","3"],["Y","4"],["Z","5"]],value:"3",fontSize:11}],events:{},def:{params:[null],type:"nemoino_get_accelerometer_value"},paramsKeyMap:{PORT:0},"class":"nemoino",isNotFor:["nemoino"],func:function(b,a){var c=265,d=402,e=-90,f=90,g=Entry.hw.getAnalogPortValue(a.getField("PORT",a));if(c>d)var h=c,c=d,d=h;e>f&&(h=e,e=f,f=h);g=(f-e)/(d-c)*(g-c);g+=e;g=Math.min(f,g);g=Math.max(e,g);return Math.round(g)}},bitbrick_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field", -statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW,menuName:Entry.Bitbrick.sensorList}],events:{},def:{params:[null],type:"bitbrick_sensor_value"},paramsKeyMap:{PORT:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=a.getStringField("PORT");return Entry.hw.portData[c].value}},bitbrick_is_touch_pressed:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"DropdownDynamic",value:null, -fontSize:11,menuName:Entry.Bitbrick.touchList}],events:{},def:{params:[null],type:"bitbrick_is_touch_pressed"},paramsKeyMap:{PORT:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){return 0===Entry.hw.portData[a.getStringField("PORT")].value}},bitbrick_turn_off_color_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"bitbrick_turn_off_color_led",id:"i3je"},"class":"condition",isNotFor:["bitbrick"], -func:function(b,a){Entry.hw.sendQueue.LEDR=0;Entry.hw.sendQueue.LEDG=0;Entry.hw.sendQueue.LEDB=0;return a.callReturn()}},bitbrick_turn_on_color_led_by_rgb:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["255"]},{type:"text",params:["255"]},{type:"text",params:["255"]},null],type:"bitbrick_turn_on_color_led_by_rgb"}, -paramsKeyMap:{rValue:0,gValue:1,bValue:2},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=a.getNumberValue("rValue"),d=a.getNumberValue("gValue"),e=a.getNumberValue("bValue"),f=Entry.adjustValueWithMaxMin,g=Entry.hw.sendQueue;g.LEDR=f(c,0,255);g.LEDG=f(d,0,255);g.LEDB=f(e,0,255);return a.callReturn()}},bitbrick_turn_on_color_led_by_picker:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Color"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{}, -def:{params:[null],type:"bitbrick_turn_on_color_led_by_picker"},paramsKeyMap:{VALUE:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=a.getStringField("VALUE");Entry.hw.sendQueue.LEDR=parseInt(c.substr(1,2),16);Entry.hw.sendQueue.LEDG=parseInt(c.substr(3,2),16);Entry.hw.sendQueue.LEDB=parseInt(c.substr(5,2),16);return a.callReturn()}},bitbrick_turn_on_color_led_by_value:{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:["0"]},null],type:"bitbrick_turn_on_color_led_by_value"},paramsKeyMap:{VALUE:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=a.getNumberValue("VALUE"),d,e,f,c=c%200;67>c?(d=200-3*c,e=3*c,f=0):134>c?(c-=67,d=0,e=200-3*c,f=3*c):201>c&&(c-=134,d=3*c,e=0,f=200-3*c);Entry.hw.sendQueue.LEDR=d;Entry.hw.sendQueue.LEDG=e;Entry.hw.sendQueue.LEDB=f;return a.callReturn()}},bitbrick_buzzer:{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:"bitbrick_buzzer"},paramsKeyMap:{VALUE:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){if(a.isStart)return Entry.hw.sendQueue.buzzer=0,delete a.isStart,a.callReturn();var c=a.getNumberValue("VALUE");Entry.hw.sendQueue.buzzer=c;a.isStart=!0;return a}},bitbrick_turn_off_all_motors:{color:"#00979D",skeleton:"basic",statements:[], -params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"bitbrick_turn_off_all_motors"},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=Entry.hw.sendQueue,d=Entry.Bitbrick;d.servoList().map(function(a){c[a[1]]=0});d.dcList().map(function(a){c[a[1]]=128});return a.callReturn()}},bitbrick_dc_speed:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.dcList},{type:"Block", -accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"text",params:["60"]},null],type:"bitbrick_dc_speed"},paramsKeyMap:{PORT:0,VALUE:1},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=a.getNumberValue("VALUE"),c=Math.min(c,Entry.Bitbrick.dcMaxValue),c=Math.max(c,Entry.Bitbrick.dcMinValue);Entry.hw.sendQueue[a.getStringField("PORT")]=c+128;return a.callReturn()}},bitbrick_dc_direction_speed:{color:"#00979D",skeleton:"basic", -statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.dcList},{type:"Dropdown",options:[[Lang.Blocks.BITBRICK_dc_direction_cw,"CW"],[Lang.Blocks.BITBRICK_dc_direction_ccw,"CCW"]],value:"CW",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,{type:"text",params:["100"]},null],type:"bitbrick_dc_direction_speed"},paramsKeyMap:{PORT:0,DIRECTION:1,VALUE:2},"class":"condition",isNotFor:["bitbrick"], -func:function(b,a){var c="CW"===a.getStringField("DIRECTION"),d=a.getNumberValue("VALUE"),d=Math.min(d,Entry.Bitbrick.dcMaxValue),d=Math.max(d,0);Entry.hw.sendQueue[a.getStringField("PORT")]=c?d+128:128-d;return a.callReturn()}},bitbrick_servomotor_angle:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.servoList},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null, -{type:"text",params:["100"]},null],type:"bitbrick_servomotor_angle"},paramsKeyMap:{PORT:0,VALUE:1},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=Entry.Bitbrick.servoMaxValue-(a.getNumberValue("VALUE")+1),c=Math.min(c,Entry.Bitbrick.servoMaxValue),c=Math.max(c,Entry.Bitbrick.servoMinValue);Entry.hw.sendQueue[a.getStringField("PORT")]=c;return a.callReturn()}},bitbrick_convert_scale:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"DropdownDynamic", -value:null,fontSize:11,menuName:Entry.Bitbrick.sensorList},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"}],events:{},def:{params:[null,{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["-100"]},{type:"number",params:["100"]}],type:"bitbrick_convert_scale"},paramsKeyMap:{PORT:0,VALUE2:1,VALUE3:2,VALUE4:3,VALUE5:4},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=a.getNumberField("PORT"), -d=Entry.hw.portData[c].value,c=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a),f=a.getNumberValue("VALUE4",a),g=a.getNumberValue("VALUE5",a);if(f>g)var h=f,f=g,g=h;d-=c;d*=(g-f)/(e-c);d+=f;d=Math.min(g,d);d=Math.max(f,d);return Math.round(d)}},start_drawing:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"start_drawing"},"class":"brush_control",isNotFor:["textBox"],func:function(b,a){b.brush? -b.brush.stop=!1:Entry.setBasicBrush(b);Entry.stage.sortZorder();b.brush.moveTo(b.getX(),-1*b.getY());return a.callReturn()}},stop_drawing:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"stop_drawing"},"class":"brush_control",isNotFor:["textBox"],func:function(b,a){b.brush&&b.shape&&(b.brush.stop=!0);return a.callReturn()}},set_color:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Color"}, -{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"set_color"},paramsKeyMap:{VALUE:0},"class":"brush_color",isNotFor:["textBox"],func:function(b,a){var c=a.getField("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(c=Entry.hex2rgb(c),b.brush.rgb=c,b.brush.endStroke(),b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}},set_random_color:{color:"#FF9E20", -skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"set_random_color"},"class":"brush_color",isNotFor:["textBox"],func:function(b,a){b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);if(b.brush){var c=Entry.generateRgb();b.brush.rgb=c;b.brush.endStroke();b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")");b.brush.moveTo(b.getX(),-1*b.getY())}return a.callReturn()}},change_thickness:{color:"#FF9E20", -skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["1"]},null],type:"change_thickness"},paramsKeyMap:{VALUE:0},"class":"brush_thickness",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.thickness+=c,1>b.brush.thickness&&(b.brush.thickness=1),b.brush.setStrokeStyle(b.brush.thickness),b.brush.moveTo(b.getX(), --1*b.getY()));return a.callReturn()}},set_thickness:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["1"]},null],type:"set_thickness"},paramsKeyMap:{VALUE:0},"class":"brush_thickness",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.thickness=c,b.brush.setStrokeStyle(b.brush.thickness), -b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}},change_opacity:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_opacity"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);c=Entry.adjustValueWithMaxMin(b.brush.opacity+ -c,0,100);b.brush&&(b.brush.opacity=c,b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}},set_opacity:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["50"]},null],type:"set_opacity"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"], -func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}},brush_erase_all:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"brush_erase_all"}, -"class":"brush_clear",isNotFor:["textBox"],func:function(b,a){var c=b.brush;if(c){var d=c._stroke.style,e=c._strokeStyle.width;c.clear().setStrokeStyle(e).beginStroke(d);c.moveTo(b.getX(),-1*b.getY())}c=b.parent.getStampEntities();c.map(function(a){a.removeClone()});c=null;return a.callReturn()}},brush_stamp:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"brush_stamp"},"class":"stamp",isNotFor:["textBox"], -func:function(b,a){b.parent.addStampEntity(b);return a.callReturn()}},change_brush_transparency:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_brush_transparency"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop= -!0);c=Entry.adjustValueWithMaxMin(b.brush.opacity-c,0,100);b.brush&&(b.brush.opacity=c,b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}},set_brush_tranparency:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["50"]},null],type:"set_brush_tranparency"}, -paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+(1-b.brush.opacity/100)+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}},number:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"TextInput", -value:10}],events:{},def:{params:[]},paramsKeyMap:{NUM:0},func:function(b,a){return a.getField("NUM",a)},isPrimitive:!0},angle:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Angle"}],events:{},def:{params:[null],type:"angle"},paramsKeyMap:{ANGLE:0},func:function(b,a){return a.getNumberField("ANGLE")}},get_x_coordinate:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_x_coordinate,color:"#3D3D3D"}],events:{},def:{params:[null], -type:"get_x_coordinate"},"class":"calc",isNotFor:[],func:function(b,a){return b.getX()}},get_y_coordinate:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_y_coordinate,color:"#3D3D3D"}],events:{},def:{params:[null],type:"get_y_coordinate"},"class":"calc",isNotFor:[],func:function(b,a){return b.getY()}},get_angle:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_angle,color:"#3D3D3D"}], -events:{},def:{params:[null]},func:function(b,a){return parseFloat(b.getRotation().toFixed(1))}},get_rotation_direction:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CALC_rotation_value,"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,"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 e}},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,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_rand_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"number",params:["0"]},null,{type:"number",params:["10"]},null],type:"calc_rand"},paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3},"class":"calc",isNotFor:[],func:function(b, -a){var c=a.getStringValue("LEFTHAND",a),d=a.getStringValue("RIGHTHAND",a),e=Math.min(c,d),f=Math.max(c,d),c=Entry.isFloat(c);return Entry.isFloat(d)||c?(Math.random()*(f-e)+e).toFixed(2):Math.floor(Math.random()*(f-e+1)+e)}},get_date:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_date_1,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_get_date_year,"YEAR"],[Lang.Blocks.CALC_get_date_month,"MONTH"],[Lang.Blocks.CALC_get_date_day, -"DAY"],[Lang.Blocks.CALC_get_date_hour,"HOUR"],[Lang.Blocks.CALC_get_date_minute,"MINUTE"],[Lang.Blocks.CALC_get_date_second,"SECOND"]],value:"YEAR",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_get_date_2,color:"#3D3D3D"}],events:{},def:{params:[null,"YEAR",null],type:"get_date"},paramsKeyMap:{VALUE:1},"class":"calc_date",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d=new Date;return"YEAR"==c?d.getFullYear():"MONTH"==c?d.getMonth()+1:"DAY"== -c?d.getDate():"HOUR"==c?d.getHours():"MINUTE"==c?d.getMinutes():d.getSeconds()}},get_sound_duration:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_sound_duration_1,color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"sounds",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_get_sound_duration_2,color:"#3D3D3D"}],events:{},def:{params:[null,null,null],type:"get_sound_duration"},paramsKeyMap:{VALUE:1}, -"class":"calc_duration",isNotFor:[],func:function(b,a){for(var c=a.getField("VALUE",a),d=b.parent.sounds,e=0;ed||d>c.length-1)throw Error();return c[d]}},length_of_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_length_of_string_1, -color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_length_of_string_2,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.entry]},null],type:"length_of_string"},paramsKeyMap:{STRING:1},"class":"calc_string",isNotFor:[],func:function(b,a){return a.getStringValue("STRING",a).length}},substring:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_substring_1,color:"#3D3D3D"},{type:"Block",accept:"string"}, -{type:"Text",text:Lang.Blocks.CALC_substring_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_substring_3,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_substring_4,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"number",params:["2"]},null,{type:"number",params:["5"]},null],type:"substring"},paramsKeyMap:{STRING:1,START:3,END:5},"class":"calc_string",isNotFor:[],func:function(b, -a){var c=a.getStringValue("STRING",a),d=a.getNumberValue("START",a)-1,e=a.getNumberValue("END",a)-1,f=c.length-1;if(0>d||0>e||d>f||e>f)throw Error();return c.substring(Math.min(d,e),Math.max(d,e)+1)}},replace_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_replace_string_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_3, -color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_4,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"text",params:[Lang.Blocks.hello]},null,{type:"text",params:[Lang.Blocks.nice]},null],type:"replace_string"},paramsKeyMap:{STRING:1,OLD_WORD:3,NEW_WORD:5},"class":"calc_string",isNotFor:[],func:function(b,a){return a.getStringValue("STRING",a).replace(new RegExp(a.getStringValue("OLD_WORD",a),"gm"), -a.getStringValue("NEW_WORD",a))}},change_string_case:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_change_string_case_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_change_string_case_2,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_change_string_case_sub_1,"toUpperCase"],[Lang.Blocks.CALC_change_string_case_sub_2,"toLowerCase"]],value:"toUpperCase",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}, -{type:"Text",text:Lang.Blocks.CALC_change_string_case_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:["Hello Entry!"]},null,null,null],type:"change_string_case"},paramsKeyMap:{STRING:1,CASE:3},"class":"calc_string",isNotFor:[],func:function(b,a){return a.getStringValue("STRING",a)[a.getField("CASE",a)]()}},index_of_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_index_of_string_1,color:"#3D3D3D"},{type:"Block",accept:"string"}, -{type:"Text",text:Lang.Blocks.CALC_index_of_string_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_index_of_string_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"text",params:[Lang.Blocks.entry]},null],type:"index_of_string"},paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3},"class":"calc_string",isNotFor:[],func:function(b,a){var c=a.getStringValue("LEFTHAND",a),d=a.getStringValue("RIGHTHAND",a),c=c.indexOf(d);return-1< -c?c+1:0}},combine_something:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_combine_something_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.VARIABLE_combine_something_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.VARIABLE_combine_something_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.block_hi]},null,{type:"text",params:[Lang.Blocks.entry]}, -null],type:"combine_something"},paramsKeyMap:{VALUE1:1,VALUE2:3},"class":"calc_string",isNotFor:[],func:function(b,a){var c=a.getStringValue("VALUE1",a),d=a.getStringValue("VALUE2",a);return c+d}},get_sound_volume:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_sound_volume,color:"#3D3D3D"},{type:"Text",text:"",color:"#3D3D3D"}],events:{},def:{params:[null,null],type:"get_sound_volume"},"class":"calc",isNotFor:[""],func:function(b,a){return 100* -createjs.Sound.getVolume()}},quotient_and_mod:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_quotient_and_mod_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_quotient_and_mod_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_quotient_and_mod_3,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_quotient_and_mod_sub_1,"QUOTIENT"],[Lang.Blocks.CALC_quotient_and_mod_sub_2, -"MOD"]],value:"QUOTIENT",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}],events:{},def:{params:[null,{type:"text",params:["10"]},null,{type:"text",params:["10"]},null,null],type:"quotient_and_mod"},paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3,OPERATOR:5},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);if(isNaN(c)||isNaN(d))throw Error();return"QUOTIENT"==a.getField("OPERATOR",a)?Math.floor(c/d):c%d}},choose_project_timer_action:{color:"#FFD974", -skeleton:"basic",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_choose_project_timer_action_1,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_choose_project_timer_action_sub_1,"START"],[Lang.Blocks.CALC_choose_project_timer_action_sub_2,"STOP"],[Lang.Blocks.CALC_choose_project_timer_action_sub_3,"RESET"]],value:"START",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_choose_project_timer_action_2,color:"#3D3D3D"},{type:"Indicator",img:"block_icon/calc_01.png", -size:12}],events:{viewAdd:[function(){Entry.engine&&Entry.engine.showProjectTimer()}],dataDestroy:[function(b){Entry.engine&&Entry.engine.hideProjectTimer(b)}]},def:{params:[null,"START",null,null],type:"choose_project_timer_action"},paramsKeyMap:{ACTION:1},"class":"calc_timer",isNotFor:[],func:function(b,a){var c=a.getField("ACTION"),d=Entry.engine,e=d.projectTimer;"START"==c?e.isInit?e.isInit&&e.isPaused&&(e.pauseStart&&(e.pausedTime+=(new Date).getTime()-e.pauseStart),delete e.pauseStart,e.isPaused= -!1):d.startProjectTimer():"STOP"==c?e.isInit&&!e.isPaused&&(e.isPaused=!0,e.pauseStart=(new Date).getTime()):"RESET"==c&&e.isInit&&(e.setValue(0),e.start=(new Date).getTime(),e.pausedTime=0,delete e.pauseStart);return a.callReturn()}},wait_second:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},null],type:"wait_second"},paramsKeyMap:{SECOND:0},"class":"delay", -isNotFor:[],func:function(b,a){if(a.isStart){if(1==a.timeFlag)return a;delete a.timeFlag;delete a.isStart;Entry.engine.isContinue=!1;return a.callReturn()}a.isStart=!0;a.timeFlag=1;var c=a.getNumberValue("SECOND",a);setTimeout(function(){a.timeFlag=0},60/(Entry.FPS||60)*c*1E3);return a}},repeat_basic:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"number", -params:["10"]},null],type:"repeat_basic"},paramsKeyMap:{VALUE:0},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(b,a){var c;if(!a.isLooped){a.isLooped=!0;c=a.getNumberValue("VALUE",a);if(0>c)throw Error(Lang.Blocks.FLOW_repeat_basic_errorMsg);a.iterCount=Math.floor(c)}if(0==a.iterCount||0>a.iterCount)return delete a.isLooped,delete a.iterCount,a.callReturn();a.iterCount--;return a.getStatement("DO",a)}},repeat_inf:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}], -params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null],type:"repeat_inf"},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(b,a){a.isLooped=!0;return a.getStatement("DO")}},stop_repeat:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null],type:"stop_repeat"},"class":"repeat",isNotFor:[],func:function(b,a){return this.executor.breakLoop()}},wait_until_true:{color:"#498deb", -skeleton:"basic",statements:[],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"},null],type:"wait_until_true"},paramsKeyMap:{BOOL:0},"class":"wait",isNotFor:[],func:function(b,a){return a.getBooleanValue("BOOL",a)?a.callReturn():a}},_if:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"}, -null],type:"_if"},paramsKeyMap:{BOOL:0},statementsKeyMap:{STACK:0},"class":"condition",isNotFor:[],func:function(b,a){return a.isCondition?(delete a.isCondition,a.callReturn()):a.getBooleanValue("BOOL",a)?(a.isCondition=!0,a.getStatement("STACK",a)):a.callReturn()}},if_else:{color:"#498deb",skeleton:"basic_double_loop",statements:[{accept:"basic"},{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12},{type:"LineBreak"}],events:{},def:{params:[{type:"True"}, -null],type:"if_else"},paramsKeyMap:{BOOL:0},statementsKeyMap:{STACK_IF:0,STACK_ELSE:1},"class":"condition",isNotFor:[],func:function(b,a){if(a.isCondition)return delete a.isCondition,a.callReturn();var c=a.getBooleanValue("BOOL",a);a.isCondition=!0;return c?a.getStatement("STACK_IF",a):a.getStatement("STACK_ELSE",a)}},create_clone:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"clone",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator", -img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null,null],type:"create_clone"},paramsKeyMap:{VALUE:0},"class":"clone",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d=a.callReturn();"self"==c?b.parent.addCloneEntity(b.parent,b,null):Entry.container.getObject(c).addCloneEntity(b.parent,null,null);return d}},delete_clone:{color:"#498deb",skeleton:"basic_without_next",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null], -type:"delete_clone"},"class":"clone",isNotFor:[],func:function(b,a){if(!b.isClone)return a.callReturn();b.removeClone();return this.die()}},when_clone_start:{color:"#498deb",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_clone.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"when_clone_start"},"class":"clone",isNotFor:[],func:function(b,a){return a.callReturn()},event:"when_clone_start"},stop_run:{color:"#498deb",skeleton:"basic",statements:[], -params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null]},func:function(b,a){return Entry.engine.toggleStop()}},repeat_while_true:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Dropdown",options:[[Lang.Blocks.FLOW_repeat_while_true_until,"until"],[Lang.Blocks.FLOW_repeat_while_true_while,"while"]],value:"until",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator",img:"block_icon/flow_03.png", -size:12}],events:{},def:{params:[{type:"True"},null,null],type:"repeat_while_true"},paramsKeyMap:{BOOL:0,OPTION:1},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(b,a){var c=a.getBooleanValue("BOOL",a);"until"==a.getField("OPTION",a)&&(c=!c);return(a.isLooped=c)?a.getStatement("DO",a):a.callReturn()}},stop_object:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.FLOW_stop_object_all,"all"],[Lang.Blocks.FLOW_stop_object_this_object,"thisOnly"], -[Lang.Blocks.FLOW_stop_object_this_thread,"thisThread"],[Lang.Blocks.FLOW_stop_object_other_thread,"otherThread"]],value:"all",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null,null],type:"stop_object"},paramsKeyMap:{TARGET:0},"class":"terminate",isNotFor:[],func:function(b,a){var c=a.getField("TARGET",a),d=Entry.container;switch(c){case "all":return d.clearRunningState(),this.die();case "thisOnly":return b.parent.script.clearExecutorsByEntity(b), -this.die();case "thisObject":return b.parent.script.clearExecutors(),this.die();case "thisThread":return this.die();case "otherThread":for(var c=this.executor,d=b.parent.script,e=d.executors,f=0;fa.count?(50>d.leftFloor&&50>d.rightFloor?a.count++:a.count=0,d=d.leftFloor-d.rightFloor,c.leftWheel=45+.25*d,c.rightWheel=45-.25*d):(a.count=0,a.boardState=2);break;case 2:d=d.leftFloor-d.rightFloor;c.leftWheel=45+.25*d;c.rightWheel= -45-.25*d;a.boardState=3;var e=setTimeout(function(){a.boardState=4;Entry.Hamster.removeTimeout(e)},250);Entry.Hamster.timeouts.push(e);break;case 3:d=d.leftFloor-d.rightFloor;c.leftWheel=45+.25*d;c.rightWheel=45-.25*d;break;case 4:c.leftWheel=0,c.rightWheel=0,a.boardState=0,a.isMoving=!1}return a}delete a.isStart;delete a.isMoving;delete a.count;delete a.boardState;Entry.engine.isContinue=!1;c.leftWheel=0;c.rightWheel=0;return a.callReturn()}a.isStart=!0;a.isMoving=!0;a.count=0;a.boardState=1;c.leftWheel= -45;c.rightWheel=45;Entry.Hamster.setLineTracerMode(c,0);return a}},hamster_turn_once:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null],type:"hamster_turn_once"},paramsKeyMap:{DIRECTION:0},"class":"hamster_board",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=Entry.hw.portData; -if(a.isStart){if(a.isMoving){if(a.isLeft)switch(a.boardState){case 1:2>a.count?50d.leftFloor&&(a.boardState=3);break;case 3:2>a.count?20>d.leftFloor&&a.count++:(a.count=0,a.boardState=4);break;case 4:50a.count?50d.rightFloor&&(a.boardState=3);break;case 3:2>a.count?20>d.rightFloor&&a.count++:(a.count=0,a.boardState=4);break;case 4:50Entry.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":return f(d,e.up,.2,!0)||f(d,e.down,.2,!0)||f(d,e.left,.2,!0)||f(d,e.right, -.2,!0);case "wall_up":return f(d,e.up,.2,!0);case "wall_down":return f(d,e.down,.2,!0);case "wall_right":return f(d,e.right,.2,!0);case "wall_left":return f(d,e.left,.2,!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< -g;e++){var h=c[e];if(!h.isStamp&&h.getVisible()&&Entry.checkCollisionRect(d,h.object.getTransformedBounds()))return!0}}else{if(c.getVisible()&&f(d,c.object,.2,!0))return!0;c=c.parent.clonedEntities;e=0;for(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",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(!0);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(!0);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(-1f)throw Error("object is not available for current scene");switch(d){case "FRONT":c=0;break;case "FORWARD":c=Math.max(0,f-1);break;case "BACKWARD":c=Math.min(e,f+1);break;case "BACK":c=e}Entry.container.moveElementByBlock(f,c);return a.callReturn()}},move_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:["10"]},null],type:"move_direction"},paramsKeyMap:{VALUE:0},"class":"walk",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(b.getX()+c*Math.cos((b.getRotation()+b.getDirection()-90)/180*Math.PI));b.setY(b.getY()-c*Math.sin((b.getRotation()+b.getDirection()-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},move_x:{color:"#A751E3",skeleton:"basic", -statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"move_x"},paramsKeyMap:{VALUE:0},"class":"move_relative",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(b.getX()+c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},move_y:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator", -img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"move_y"},paramsKeyMap:{VALUE:0},"class":"move_relative",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setY(b.getY()+c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},locate_xy_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator", -img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"locate_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_absolute",isNotFor:[],func:function(b,a){function c(){var c=a.x-b.getX(),d=a.y-b.getY(),c=c/a.frameCount,d=d/a.frameCount;b.setX(b.getX()+c);b.setY(b.getY()+d);a.frameCount--;b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY())}if(!a.isStart){var d;d=a.getNumberValue("VALUE1", -a);a.isStart=!0;a.frameCount=Math.max(Math.floor(d*Entry.FPS),1);a.x=a.getNumberValue("VALUE2",a);a.y=a.getNumberValue("VALUE3",a);1==a.frameCount&&c()}if(0!=a.frameCount)return c(),a;delete a.isStart;delete a.frameCount;return a.callReturn()}},rotate_by_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"rotate_by_angle"},paramsKeyMap:{VALUE:0}, -"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(b.getRotation()+c);return a.callReturn()}},rotate_by_angle_dropdown:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["45","45"],["90","90"],["135","135"],["180","180"]],value:"45",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:["45",null],type:"rotate_by_angle_dropdown"},paramsKeyMap:{VALUE:0},"class":"ebs",isNotFor:[],func:function(b, -a){var c=a.getField("VALUE",a);b.setRotation(b.getRotation()+Number(c));return a.callReturn()}},see_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"see_angle"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}},see_direction:{color:"#A751E3", -skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"sprites",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{VALUE:0},func:function(b,a){var c=a.getField("VALUE",a),d=Entry.container.getEntity(c),c=d.getX()-b.getX(),d=d.getY()-b.getY();0<=c?b.setRotation(Math.atan(d/c)/Math.PI*180+90):b.setRotation(Math.atan(d/c)/Math.PI*180+270);return a.callReturn()}},locate_xy:{color:"#A751E3",skeleton:"basic", -statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["0"]},{type:"number",params:["0"]},null],type:"locate_xy"},paramsKeyMap:{VALUE1:0,VALUE2:1},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE1",a),d=a.getNumberValue("VALUE2",a);b.setX(c);b.setY(d);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}}, -locate_x:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_x"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},locate_y:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block", -accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_y"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setY(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},locate:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING}, -{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"locate"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d;"mouse"==c?(c=Entry.stage.mouseCoordinate.x,d=Entry.stage.mouseCoordinate.y):(d=Entry.container.getEntity(c),c=d.getX(),d=d.getY());b.setX(Number(c));b.setY(Number(d));b.brush&&!b.brush.stop&&b.brush.lineTo(c,-1*d);return a.callReturn()}},move_xy_time:{color:"#A751E3",skeleton:"basic", -statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"move_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_relative",isNotFor:[],func:function(b,a){function c(){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())}if(!a.isStart){var d;d=a.getNumberValue("VALUE1",a);var e=a.getNumberValue("VALUE2",a),f=a.getNumberValue("VALUE3",a);a.isStart=!0;a.frameCount=Math.max(Math.floor(d*Entry.FPS),1);a.dX=e/a.frameCount;a.dY=f/a.frameCount;1==a.frameCount&&c()}if(0!=a.frameCount)return c(),a;delete a.isStart;delete a.frameCount;return a.callReturn()}},rotate_by_angle_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Angle"},{type:"Indicator", -img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},null,null],type:"rotate_by_angle_time"},paramsKeyMap:{VALUE:1},"class":"rotate",isNotFor:[],func:function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE",a);var d=a.getNumberField("VALUE",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dAngle=d/a.frameCount}if(0!=a.frameCount)return b.setRotation(b.getRotation()+a.dAngle),a.frameCount--,a;delete a.isStart;delete a.frameCount;return a.callReturn()}}, -bounce_wall:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null],type:"bounce_wall"},"class":"walk",isNotFor:[],func:function(b,a){var c=b.parent.getRotateMethod(),d="free"==c?(b.getRotation()+b.getDirection()).mod(360):b.getDirection(),e=Entry.Utils.COLLISION.NONE;if(90>d&&0<=d||360>d&&270<=d){var e=b.collision==Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,b.object,0,!1);!f&&e&& -(b.collision=Entry.Utils.COLLISION.NONE);f&&e&&(f=!1);f?("free"==c?b.setRotation(-b.getRotation()-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&&e&&(f=!1),f&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN))}else 270> -d&&90<=d&&(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&&e&&(f=!1),f?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN):(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)));360>d&&180<=d?(e=b.collision==Entry.Utils.COLLISION.LEFT,d=ndgmr.checkPixelCollision(Entry.stage.wall.left,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.LEFT):(e=b.collision==Entry.Utils.COLLISION.RIGHT, -d=ndgmr.checkPixelCollision(Entry.stage.wall.right,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.RIGHT))):180>d&&0<=d&&(e=b.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?b.setRotation(-b.getRotation()- -2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.RIGHT):(e=b.collision==Entry.Utils.COLLISION.LEFT,d=ndgmr.checkPixelCollision(Entry.stage.wall.left,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.LEFT)));return a.callReturn()}},flip_arrow_horizontal:{color:"#A751E3",skeleton:"basic",statements:[], -params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null]},func:function(b,a){b.setDirection(b.getDirection()+180);return a.callReturn()}},flip_arrow_vertical:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null]},func:function(b,a){b.setDirection(b.getDirection()+180);return a.callReturn()}},see_angle_object:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic", -value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"see_angle_object"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d=b.getX(),e=b.getY();if(b.parent.id==c)return a.callReturn();"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",size:12}],events:{},def:{params:[{type:"angle"},null],type:"rotate_absolute"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute", -isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c);return a.callReturn()}},rotate_relative:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"rotate_relative"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c+b.getRotation());return a.callReturn()}},direction_absolute:{color:"#A751E3", -skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"direction_absolute"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}},direction_relative:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png", -size:12}],events:{},def:{params:[{type:"angle"},null],type:"direction_relative"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c+b.getDirection());return a.callReturn()}},move_to_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},{type:"number",params:["10"]}, -null],type:"move_to_angle"},paramsKeyMap:{ANGLE:0,VALUE:1},"class":"move_rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a),d=a.getNumberValue("ANGLE",a);b.setX(b.getX()+c*Math.cos((d-90)/180*Math.PI));b.setY(b.getY()-c*Math.sin((d-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},rotate_by_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator", -img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"angle"},null],type:"rotate_by_time"},paramsKeyMap:{VALUE:0,ANGLE:1},"class":"rotate",isNotFor:[],func:function(b,a){function c(){b.setRotation(b.getRotation()+a.dAngle);a.frameCount--}if(!a.isStart){var d;d=a.getNumberValue("VALUE",a);var e=a.getNumberValue("ANGLE",a);a.isStart=!0;a.frameCount=Math.max(Math.floor(d*Entry.FPS),1);a.dAngle=e/a.frameCount;1==a.frameCount&&c()}if(0!=a.frameCount)return c(), -a;delete a.isStart;delete a.frameCount;return a.callReturn()}},direction_relative_duration:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"text",params:["2"]},{type:"angle"},null],type:"direction_relative_duration"},paramsKeyMap:{DURATION:0,AMOUNT:1},"class":"rotate",isNotFor:[],func:function(b,a){function c(){b.setDirection(b.getDirection()+ -a.dDirection);a.frameCount--}if(!a.isStart){var d;d=a.getNumberValue("DURATION",a);var e=a.getNumberValue("AMOUNT",a);a.isStart=!0;a.frameCount=Math.max(Math.floor(d*Entry.FPS),1);a.dDirection=e/a.frameCount;1==a.frameCount&&c()}if(0!=a.frameCount)return c(),a;delete a.isStart;delete a.frameCount;delete a.dDirection;return a.callReturn()}},neobot_sensor_value:{color:"#00979D",skeleton:"basic_string_field",fontColor:"#fff",statements:[],template:"%1 \uac12",params:[{type:"Dropdown",options:[["1\ubc88 \ud3ec\ud2b8", -"IN1"],["2\ubc88 \ud3ec\ud2b8","IN2"],["3\ubc88 \ud3ec\ud2b8","IN3"],["\ub9ac\ubaa8\ucee8","IR"],["\ubc30\ud130\ub9ac","BAT"]],value:"IN1",fontSize:11}],events:{},def:{params:[null],type:"neobot_sensor_value"},paramsKeyMap:{PORT:0},"class":"neobot_value",isNotFor:["neobot"],func:function(b,a){var c=a.getStringField("PORT");return Entry.hw.portData[c]}},neobot_sensor_convert_scale:{color:"#00979D",skeleton:"basic_string_field",fontColor:"#fff",statements:[],template:"%1 \uac12\uc758 \ubc94\uc704\ub97c %2 ~ %3 \uc5d0\uc11c %4 ~ %5 (\uc73c)\ub85c \ubcc0\ud658", -params:[{type:"Dropdown",options:[["1\ubc88 \ud3ec\ud2b8","IN1"],["2\ubc88 \ud3ec\ud2b8","IN2"],["3\ubc88 \ud3ec\ud2b8","IN3"],["\ub9ac\ubaa8\ucee8","IR"],["\ubc30\ud130\ub9ac","BAT"]],value:"IN1",fontSize:11},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"}],events:{},def:{params:[null,{type:"number",params:["0"]},{type:"number",params:["255"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"neobot_sensor_convert_scale"}, -paramsKeyMap:{PORT:0,OMIN:1,OMAX:2,MIN:3,MAX:4},"class":"neobot_value",isNotFor:["neobot"],func:function(b,a){var c=a.getStringField("PORT"),c=Entry.hw.portData[c],d=a.getNumberValue("OMIN",a),e=a.getNumberValue("OMAX",a),f=a.getNumberValue("MIN",a),g=a.getNumberValue("MAX",a);if(d>e)var h=d,d=e,e=h;f>g&&(h=f,f=g,g=h);c=(g-f)/(e-d)*(c-d);c+=f;c=Math.min(g,c);c=Math.max(f,c);return Math.round(c)}},neobot_left_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc67c\ucabd \ubaa8\ud130\ub97c %1 %2 \uc758 \uc18d\ub3c4\ub85c \ud68c\uc804 %3", -params:[{type:"Dropdown",options:[["\uc55e\uc73c\ub85c","16"],["\ub4a4\ub85c","32"]],value:"16",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{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"],["14","14"],["15","15"]],value:"0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,"15", -null],type:"neobot_left_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){var c=a.getNumberField("SPEED"),d=a.getNumberField("DIRECTION");Entry.hw.sendQueue.DCL=c+d;return a.callReturn()}},neobot_stop_left_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc67c\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_left_motor"}, -"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){Entry.hw.sendQueue.DCL=0;return a.callReturn()}},neobot_right_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubaa8\ud130\ub97c %1 %2 \uc758 \uc18d\ub3c4\ub85c \ud68c\uc804 %3",params:[{type:"Dropdown",options:[["\uc55e\uc73c\ub85c","16"],["\ub4a4\ub85c","32"]],value:"16",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{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"],["14","14"],["15","15"]],value:"0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,"15",null],type:"neobot_right_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){var c=a.getNumberField("SPEED"),d=a.getNumberField("DIRECTION");Entry.hw.sendQueue.DCR=c+d;return a.callReturn()}}, -neobot_stop_right_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_right_motor"},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){Entry.hw.sendQueue.DCR=0;return a.callReturn()}},neobot_all_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc591\ucabd \ubaa8\ud130\ub97c %1 %2\uc758 \uc18d\ub3c4\ub85c %3\ucd08 \ub3d9\uc548 \ud68c\uc804 %4", -params:[{type:"Dropdown",options:[["\uc55e\uc73c\ub85c","1"],["\ub4a4\ub85c","2"],["\uc81c\uc790\ub9ac\uc5d0\uc11c \uc67c\ucabd \ub3cc\uae30","3"],["\uc81c\uc790\ub9ac\uc5d0\uc11c \uc624\ub978\ucabd \ub3cc\uae30","4"],["\uc67c\ucabd\uc73c\ub85c \ub3cc\uae30","5"],["\uc624\ub978\ucabd\uc73c\ub85c \ub3cc\uae30","6"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{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"],["14","14"],["15","15"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:["1","15",{type:"number",params:["0"]}],type:"neobot_all_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1,DURATION:2},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){if(a.isStart){if(1==a.timeFlag)return a;delete a.timeFlag;delete a.isStart;Entry.hw.sendQueue.DCL= -0;Entry.hw.sendQueue.DCR=0;Entry.engine.isContinue=!1;return a.callReturn()}var c=a.getNumberField("SPEED"),d=a.getNumberField("DIRECTION"),e=a.getNumberValue("DURATION");0>e&&(e=0);switch(d){case 1:Entry.hw.sendQueue.DCL=16+c;Entry.hw.sendQueue.DCR=16+c;break;case 2:Entry.hw.sendQueue.DCL=32+c;Entry.hw.sendQueue.DCR=32+c;break;case 3:Entry.hw.sendQueue.DCL=32+c;Entry.hw.sendQueue.DCR=16+c;break;case 4:Entry.hw.sendQueue.DCL=16+c;Entry.hw.sendQueue.DCR=32+c;break;case 5:Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR= -16+c;break;case 6:Entry.hw.sendQueue.DCL=16+c,Entry.hw.sendQueue.DCR=0}if(0===e)return a.callReturn();a.isStart=!0;a.timeFlag=1;setTimeout(function(){a.timeFlag=0},1E3*e);return a}},neobot_stop_all_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc591\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_all_motor"},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){Entry.hw.sendQueue.DCL= -0;Entry.hw.sendQueue.DCR=0;return a.callReturn()}},neobot_set_servo:{color:"#00979D",skeleton:"basic",statements:[],template:"%1 \ud3ec\ud2b8\uc758 \uc11c\ubcf4\ubaa8\ud130\ub97c %2 \ub3c4 \uc774\ub3d9 %3",params:[{type:"Dropdown",options:[["OUT1","1"],["OUT2","2"],["OUT3","3"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"neobot_set_servo"},paramsKeyMap:{PORT:0, -DEGREE:1},"class":"neobot_output",isNotFor:["neobot"],func:function(b,a){var c=a.getNumberField("PORT"),d=a.getNumberValue("DEGREE");0>d?d=0:180d?d=0:255c.count)throw c.count++, -new Entry.Utils.AsyncError;c.isStart=!1;d=Entry.hw.portData[c.data_default_address];c.data_default_address=void 0;return d}},robotis_openCM70_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.robotis_cm_sound_detected,"CM_SOUND_DETECTED"],[Lang.Blocks.robotis_cm_sound_detecting,"CM_SOUND_DETECTING"],[Lang.Blocks.robotis_cm_user_button,"CM_USER_BUTTON"]],value:"CM_SOUND_DETECTED",fontSize:11}],events:{},def:{params:[null], -type:"robotis_openCM70_sensor_value"},paramsKeyMap:{SENSOR:0},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(b,a){var c=a.executor.scope;if(!c.isStart){c.isStart=!0;c.count=0;var d=Entry.Robotis_openCM70.INSTRUCTION.READ,e=0,f=0,g=0,h=0,k=a.getStringField("SENSOR");"CM_SOUND_DETECTED"==k?(g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1]): -"CM_SOUND_DETECTING"==k?(g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1]):"CM_USER_BUTTON"==k&&(g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1]); -g+=0*h;Entry.Robotis_carCont.setRobotisData([[d,e,f,0,h]]);Entry.Robotis_carCont.update();c.data_default_address=g;throw new Entry.Utils.AsyncError;}if(2>c.count)throw c.count++,new Entry.Utils.AsyncError;c.isStart=!1;d=Entry.hw.portData[c.data_default_address];c.data_default_address=void 0;return d}},robotis_openCM70_aux_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["3","PORT_3"],["4","PORT_4"],["5","PORT_5"],["6","PORT_6"]], -value:"PORT_3",fontSize:11},{type:"Dropdown",options:[[Lang.Blocks.robotis_aux_servo_position,"AUX_SERVO_POSITION"],[Lang.Blocks.robotis_aux_ir,"AUX_IR"],[Lang.Blocks.robotis_aux_touch,"AUX_TOUCH"],[Lang.Blocks.robotis_aux_brightness,"AUX_BRIGHTNESS"],[Lang.Blocks.robotis_aux_hydro_themo_humidity,"AUX_HYDRO_THEMO_HUMIDITY"],[Lang.Blocks.robotis_aux_hydro_themo_temper,"AUX_HYDRO_THEMO_TEMPER"],[Lang.Blocks.robotis_aux_temperature,"AUX_TEMPERATURE"],[Lang.Blocks.robotis_aux_ultrasonic,"AUX_ULTRASONIC"], -[Lang.Blocks.robotis_aux_magnetic,"AUX_MAGNETIC"],[Lang.Blocks.robotis_aux_motion_detection,"AUX_MOTION_DETECTION"],[Lang.Blocks.robotis_aux_color,"AUX_COLOR"],[Lang.Blocks.robotis_aux_custom,"AUX_CUSTOM"]],value:"AUX_SERVO_POSITION",fontSize:11}],events:{},def:{params:[null,null],type:"robotis_openCM70_aux_sensor_value"},paramsKeyMap:{PORT:0,SENSOR:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(b,a){var c=a.executor.scope;if(!c.isStart){c.isStart=!0;c.count=0;var d= -Entry.Robotis_openCM70.INSTRUCTION.READ,e=0,f=0,g=0,h=0,k=a.getStringField("PORT"),l=a.getStringField("SENSOR"),n=0;"PORT_3"==k?n=2:"PORT_4"==k?n=3:"PORT_5"==k?n=4:"PORT_6"==k&&(n=5);"AUX_SERVO_POSITION"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1]):"AUX_IR"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0], -h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1]):"AUX_TOUCH"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1]):"AUX_TEMPERATURE"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1], -e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1]):"AUX_BRIGHTNESS"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1]):"AUX_HYDRO_THEMO_HUMIDITY"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1], -e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1]):"AUX_HYDRO_THEMO_TEMPER"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1]):"AUX_ULTRASONIC"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0], -h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1]):"AUX_MAGNETIC"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1]):"AUX_MOTION_DETECTION"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0], -h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1]):"AUX_COLOR"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1]):"AUX_CUSTOM"==l&&(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1], -e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1]);g+=n*h;0!=n&&(f=6*h);Entry.Robotis_carCont.setRobotisData([[d,e,f,0,h]]);Entry.Robotis_carCont.update();c.data_default_address=g;console.log(g);throw new Entry.Utils.AsyncError;}if(2>c.count)throw c.count++,new Entry.Utils.AsyncError;c.isStart=!1;d=Entry.hw.portData[c.data_default_address];c.data_default_address=void 0;return d}},robotis_openCM70_cm_buzzer_index:{color:"#00979D",skeleton:"basic", -statements:[],params:[{type:"Dropdown",options:[[Lang.General.note_a+"(0)","0"],[Lang.General.note_a+"#(1)","1"],[Lang.General.note_b+"(2)","2"],[Lang.General.note_c+"(3)","3"],[Lang.General.note_c+"#(4)","4"],[Lang.General.note_d+"(5)","5"],[Lang.General.note_d+"#(6)","6"],[Lang.General.note_e+"(7)","7"],[Lang.General.note_f+"(8)","8"],[Lang.General.note_f+"#(9)","9"],[Lang.General.note_g+"(10)","10"],[Lang.General.note_g+"#(11)","11"],[Lang.General.note_a+"(12)","12"],[Lang.General.note_a+"#(13)", -"13"],[Lang.General.note_b+"(14)","14"],[Lang.General.note_c+"(15)","15"],[Lang.General.note_c+"#(16)","16"],[Lang.General.note_d+"(17)","17"],[Lang.General.note_d+"#(18)","18"],[Lang.General.note_e+"(19)","19"],[Lang.General.note_f+"(20)","20"],[Lang.General.note_f+"#(21)","21"],[Lang.General.note_g+"(22)","22"],[Lang.General.note_g+"#(23)","23"],[Lang.General.note_a+"(24)","24"],[Lang.General.note_a+"#(25)","25"],[Lang.General.note_b+"(26)","26"],[Lang.General.note_c+"(27)","27"],[Lang.General.note_c+ -"#(28)","28"],[Lang.General.note_d+"(29)","29"],[Lang.General.note_d+"#(30)","30"],[Lang.General.note_e+"(31)","31"],[Lang.General.note_f+"(32)","32"],[Lang.General.note_f+"#(33)","33"],[Lang.General.note_g+"(34)","34"],[Lang.General.note_g+"#(35)","35"],[Lang.General.note_a+"(36)","36"],[Lang.General.note_a+"#(37)","37"],[Lang.General.note_b+"(38)","38"],[Lang.General.note_c+"(39)","39"],[Lang.General.note_c+"#(40)","40"],[Lang.General.note_d+"(41)","41"],[Lang.General.note_d+"#(42)","42"],[Lang.General.note_e+ -"(43)","43"],[Lang.General.note_f+"(44)","44"],[Lang.General.note_f+"#(45)","45"],[Lang.General.note_g+"(46)","46"],[Lang.General.note_g+"#(47)","47"],[Lang.General.note_a+"(48)","48"],[Lang.General.note_a+"#(49)","49"],[Lang.General.note_b+"(50)","50"],[Lang.General.note_c+"(51)","51"]],value:"0",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["1"]},null],type:"robotis_openCM70_cm_buzzer_index"}, -paramsKeyMap:{CM_BUZZER_INDEX:0,CM_BUZZER_TIME:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(b,a){var c=a.getField("CM_BUZZER_INDEX",a),d=a.getNumberValue("CM_BUZZER_TIME",a),e=Entry.Robotis_openCM70.INSTRUCTION.WRITE,f=0,g=0,h=0,k=0,l=0,f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[1],h=parseInt(10*d);50d&&(d=0);return Entry.Robotis_carCont.postCallReturn(a,[[e,f+(c-1)*g,g,d]],Entry.Robotis_openCM70.delay)}},robotis_openCM70_aux_led_module:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.robotis_common_port_3,"3"],[Lang.Blocks.robotis_common_port_4,"4"],[Lang.Blocks.robotis_common_port_5,"5"],[Lang.Blocks.robotis_common_port_6,"6"]],value:"3",fontSize:11},{type:"Dropdown",options:[[Lang.Blocks.robotis_cm_led_both+Lang.Blocks.robotis_common_off, -"0"],[Lang.Blocks.robotis_cm_led_right+Lang.Blocks.robotis_common_on,"1"],[Lang.Blocks.robotis_cm_led_left+Lang.Blocks.robotis_common_on,"2"],[Lang.Blocks.robotis_cm_led_both+Lang.Blocks.robotis_common_on,"3"]],value:"0",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"robotis_openCM70_aux_led_module"},paramsKeyMap:{PORT:0,LED_MODULE:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(b,a){var c=a.getField("PORT", -a),d=a.getField("LED_MODULE",a),e=Entry.Robotis_openCM70.INSTRUCTION.WRITE,f=0,g=0,f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[1];return Entry.Robotis_carCont.postCallReturn(a,[[e,f+(c-1)*g,g,d]],Entry.Robotis_openCM70.delay)}},robotis_openCM70_aux_custom:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.robotis_common_port_3,"3"],[Lang.Blocks.robotis_common_port_4,"4"],[Lang.Blocks.robotis_common_port_5, -"5"],[Lang.Blocks.robotis_common_port_6,"6"]],value:"3",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["0"]},null],type:"robotis_openCM70_aux_custom"},paramsKeyMap:{PORT:0,VALUE:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(b,a){var c=a.getField("PORT",a),d=a.getNumberValue("VALUE"),e=Entry.Robotis_openCM70.INSTRUCTION.WRITE,f=0,g=0,f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0], -g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1];return Entry.Robotis_carCont.postCallReturn(a,[[e,f+(c-1)*g,g,d]],Entry.Robotis_openCM70.delay)}},robotis_openCM70_cm_custom:{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:"number",params:["0"]},{type:"number",params:["0"]},null],type:"robotis_openCM70_cm_custom"},paramsKeyMap:{ADDRESS:0, -VALUE:1},"class":"robotis_openCM70_custom",isNotFor:["robotis_openCM70"],func:function(b,a){var c=Entry.Robotis_openCM70.INSTRUCTION.WRITE,d=0,e=0,d=a.getNumberValue("ADDRESS"),e=a.getNumberValue("VALUE");return Entry.Robotis_carCont.postCallReturn(a,[[c,d,65535c&&(c=0);createjs.Sound.setVolume(c);return a.callReturn()}},sound_volume_set:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"sound_volume_set"},paramsKeyMap:{VALUE:0},"class":"sound_volume",isNotFor:[],func:function(b,a){var c= -a.getNumberValue("VALUE",a)/100;1c&&(c=0);createjs.Sound.setVolume(c);return a.callReturn()}},sound_silent_all:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[null],type:"sound_silent_all"},"class":"sound_stop",isNotFor:[],func:function(b,a){createjs.Sound.stop();return a.callReturn()}},get_sounds:{color:"#A4D01D",skeleton:"basic_string_field",statements:[],params:[{type:"DropdownDynamic",value:null, -menuName:"sounds",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_SOUNDS}],events:{},def:{params:[null],type:"get_sounds"},paramsKeyMap:{VALUE:0},func:function(b,a){return a.getStringField("VALUE")}},sound_something_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},null],type:"sound_something_with_block"},paramsKeyMap:{VALUE:0},"class":"sound_play",isNotFor:[], -func:function(b,a){var c=a.getStringValue("VALUE",a);(c=b.parent.getSound(c))&&createjs.Sound.play(c.id);return a.callReturn()}},sound_something_second_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds",id:"95dw"},{type:"number",params:["1"]},null],type:"sound_something_second_with_block"},paramsKeyMap:{VALUE:0,SECOND:1}, -"class":"sound_play",isNotFor:[],func:function(b,a){var c=a.getStringValue("VALUE",a),d=a.getNumberValue("SECOND",a);(c=b.parent.getSound(c))&&createjs.Sound.play(c.id,{startTime:0,duration:1E3*d});return a.callReturn()}},sound_something_wait_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},null],type:"sound_something_wait_with_block"},paramsKeyMap:{VALUE:0}, -"class":"sound_wait",isNotFor:[],func:function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.playState;delete a.isPlay;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(c=b.parent.getSound(c))createjs.Sound.play(c.id),setTimeout(function(){a.playState=0},1E3*c.duration);return a}},sound_something_second_wait_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png", -size:12}],events:{},def:{params:[{type:"get_sounds"},{type:"number",params:["1"]},null],type:"sound_something_second_wait_with_block"},paramsKeyMap:{VALUE:0,SECOND:1},"class":"sound_wait",isNotFor:[],func:function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.isPlay;delete a.playState;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(c=b.parent.getSound(c)){var d=createjs.Sound.play(c.id),c=a.getNumberValue("SECOND",a);setTimeout(function(){d.stop();a.playState= -0},1E3*c);d.addEventListener("complete",function(a){})}return a}},sound_from_to:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},{type:"text",params:["1"]},{type:"text",params:["10"]},null],type:"sound_from_to"},paramsKeyMap:{VALUE:0,START:1,END:2},"class":"sound_play",isNotFor:[],func:function(b,a){var c= -a.getStringValue("VALUE",a);if(c=b.parent.getSound(c)){var d=1E3*a.getNumberValue("START",a),e=1E3*a.getNumberValue("END",a);createjs.Sound.play(c.id,{startTime:Math.min(d,e),duration:Math.max(d,e)-Math.min(d,e)})}return a.callReturn()}},sound_from_to_and_wait:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"}, -{type:"text",params:["1"]},{type:"text",params:["10"]},null],type:"sound_from_to_and_wait"},paramsKeyMap:{VALUE:0,START:1,END:2},"class":"sound_wait",isNotFor:[],func:function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.isPlay;delete a.playState;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(c=b.parent.getSound(c)){var d=1E3*a.getNumberValue("START",a),e=1E3*a.getNumberValue("END",a),f=Math.min(d,e),d=Math.max(d,e)-f;createjs.Sound.play(c.id,{startTime:f, -duration:d});setTimeout(function(){a.playState=0},d)}return a}},when_run_button_click:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_play.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"when_run_button_click"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"start"},press_some_key:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_keyboard.png", -size:17,position:{x:0,y:-2}},{type:"Dropdown",options:[["q","81"],["w","87"],["e","69"],["r","82"],["a","65"],["s","83"],["d","68"],["\uc704\ucabd \ud654\uc0b4\ud45c","38"],["\uc544\ub798\ucabd \ud654\uc0b4\ud45c","40"],["\uc67c\ucabd \ud654\uc0b4\ud45c","37"],["\uc624\ub978\ucabd \ud654\uc0b4\ud45c","39"],["\uc5d4\ud130","13"],["\uc2a4\ud398\uc774\uc2a4","32"]],value:"81",fontSize:11},{type:"Indicator",img:"block_icon/start_03.png",size:12}],events:{},def:{params:[null,null,null]},paramsKeyMap:{VALUE:1}, -func:function(b,a){return a.callReturn()}},when_some_key_pressed:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_keyboard.png",size:17,position:{x:0,y:-2}},{type:"Keyboard",value:"81"}],events:{},def:{params:[null,"81"],type:"when_some_key_pressed"},paramsKeyMap:{VALUE:1},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"keyPress"},mouse_clicked:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator", -img:"block_icon/start_icon_mouse.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"mouse_clicked"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"mouse_clicked"},mouse_click_cancled:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_mouse.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"mouse_click_cancled"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()}, -event:"mouse_click_cancled"},when_object_click:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_mouse.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"when_object_click"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"when_object_click"},when_object_click_canceled:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_mouse.png",size:17,position:{x:0, -y:-2}}],events:{},def:{params:[null],type:"when_object_click_canceled"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"when_object_click_canceled"},when_some_key_click:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_keyboard.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null]},func:function(b,a){return a.callReturn()},event:"keyPress"},when_message_cast:{color:"#3BBD70",skeleton:"basic_event",statements:[], -params:[{type:"Indicator",img:"block_icon/start_icon_signal.png",size:17,position:{x:0,y:-2}},{type:"DropdownDynamic",value:null,menuName:"messages",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_START}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs",b)}],viewDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}]},def:{params:[null,null],type:"when_message_cast"},paramsKeyMap:{VALUE:1},"class":"message",isNotFor:["message"],func:function(b, -a){return a.callReturn()},event:"when_message_cast"},message_cast:{color:"#3BBD70",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"messages",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_START},{type:"Indicator",img:"block_icon/start_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs",b)}],viewDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}]},def:{params:[null,null],type:"message_cast"}, -paramsKeyMap:{VALUE:0},"class":"message",isNotFor:["message"],func:function(b,a){var c=a.getField("VALUE",a),d=Entry.isExist(c,"id",Entry.variableContainer.messages_);if("null"==c||!d)throw Error("value can not be null or undefined");Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent,["when_message_cast",c]);return a.callReturn()}},message_cast_wait:{color:"#3BBD70",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"messages",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_START}, -{type:"Indicator",img:"block_icon/start_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}]},def:{params:[null,null],type:"message_cast_wait"},paramsKeyMap:{VALUE:0},"class":"message",isNotFor:["message"],func:function(b,a){if(a.runningScript){for(var c=a.runningScript,d=c.length,e=0;ec.array_.length)throw Error("can not remove value from array"); -c.array_.splice(d-1,1);c.updateView();return a.callReturn()}},insert_value_to_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer; -a&&a.removeRef("_variableRefs",b)}]},def:{params:[{type:"text",params:["10"]},null,{type:"text",params:["1"]},null],type:"insert_value_to_list"},paramsKeyMap:{DATA:0,LIST:1,INDEX:2},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a),d=a.getValue("DATA",a),e=a.getValue("INDEX",a),c=Entry.variableContainer.getList(c,b);if(!c.array_||isNaN(e)||0==e||e>c.array_.length+1)throw Error("can not insert value to array");c.array_.splice(e-1,0,{data:d});c.updateView(); -return a.callReturn()}},change_value_list_index:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs", -b)}]},def:{params:[null,{type:"text",params:["1"]},{type:"text",params:["10"]},null],type:"change_value_list_index"},paramsKeyMap:{LIST:0,INDEX:1,DATA:2},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a),d=a.getValue("DATA",a),e=a.getValue("INDEX",a),c=Entry.variableContainer.getList(c,b);if(!c.array_||isNaN(e)||e>c.array_.length)throw Error("can not insert value to array");c.array_[e-1].data=d;c.updateView();return a.callReturn()}},value_of_index_from_list:{color:"#E457DC", -skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_value_of_index_from_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Text",text:Lang.Blocks.VARIABLE_value_of_index_from_list_2,color:"white"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.VARIABLE_value_of_index_from_list_3,color:"white"}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs", -b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null,null,{type:"number",params:["1"]}],type:"value_of_index_from_list"},paramsKeyMap:{LIST:1,INDEX:3},"class":"list_element",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a),d=a.getValue("INDEX",a),c=Entry.variableContainer.getList(c,b),d=Entry.getListRealIndex(d,c);if(!c.array_||isNaN(d)||d>c.array_.length)throw Error("can not insert value to array");return c.array_[d- -1].data}},length_of_list:{color:"#E457DC",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_length_of_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Text",text:Lang.Blocks.VARIABLE_length_of_list_2,color:"white"}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs", -b)}]},def:{params:[null,null,null],type:"length_of_list"},paramsKeyMap:{LIST:1},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a);return Entry.variableContainer.getList(c,b).array_.length}},show_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a= -Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null],type:"show_list"},paramsKeyMap:{LIST:0},"class":"list_visibility",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a);Entry.variableContainer.getList(c).setVisible(!0);return a.callReturn()}},hide_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists", -fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null],type:"hide_list"},paramsKeyMap:{LIST:0},"class":"list_visibility",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a);Entry.variableContainer.getList(c).setVisible(!1); -return a.callReturn()}},options_for_list:{color:"#E457DC",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["\uccab\ubc88\uc9f8","FIRST"],["\ub9c8\uc9c0\ub9c9","LAST"],["\ubb34\uc791\uc704","RANDOM"]],value:"FIRST",fontSize:11}],events:{},def:{params:[null]},paramsKeyMap:{OPERATOR:0},func:function(b,a){return a.getField("OPERATOR",a)}},set_visible_answer:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CALC_timer_visible_show, -"SHOW"],[Lang.Blocks.CALC_timer_visible_hide,"HIDE"]],value:"SHOW",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{viewAdd:[function(b){Entry.container&&Entry.container.showProjectAnswer()}],viewDestroy:[function(b){Entry.container&&Entry.container.hideProjectAnswer(b)}]},def:{params:["HIDE",null],type:"set_visible_answer"},paramsKeyMap:{BOOL:0},"class":"ask",isNotFor:[],func:function(b,a){"HIDE"==a.getField("BOOL",a)?Entry.container.inputValue.setVisible(!1): -Entry.container.inputValue.setVisible(!0);return a.callReturn()}},is_included_in_list:{color:"#E457DC",skeleton:"basic_boolean_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_is_included_in_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Text",text:Lang.Blocks.VARIABLE_is_included_in_list_2,color:"white"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.VARIABLE_is_included_in_list_3, -color:"white"}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null,null,{type:"text",params:["10"]},null],type:"is_included_in_list"},paramsKeyMap:{LIST:1,DATA:3},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a),d=a.getStringValue("DATA",a),c=Entry.variableContainer.getList(c,b);if(!c)return!1;for(var c= -c.array_,e=0,f=c.length;ek&&(k=Math.round(k-155),g=-k,h=0,Entry.dplay.vel_value=g);if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11, -0),a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(c,g),Entry.hw.setDigitalPortValue(d,h),Entry.hw.setDigitalPortValue(e,g),Entry.hw.setDigitalPortValue(f,h),delete a.isStart,delete a.timeFlag,Entry.engine.isContinue=!1,a.callReturn()}else{a.isStart=!0;a.timeFlag=1;var l=setTimeout(function(){a.timeFlag=2;Entry.dplay.removeTimeout(l)},50);Entry.dplay.timeouts.push(l);return a}}},dplay_buzzer:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\ub514\uc9c0\ud138 10\ubc88 \ubd80\uc800\ub97c %1 %2 %3 \ubc15\uc790\ub85c \uc5f0\uc8fc\ud558\uae30", -params:[{type:"Dropdown",options:[["\ub3c4","1"],["\ub3c4#","2"],["\ub808","3"],["\ubbf8b","4"],["\ubbf8","5"],["\ud30c","6"],["\ud30c#","7"],["\uc194","8"],["\uc194#","9"],["\ub77c","10"],["\uc2dcb","11"],["\uc2dc","12"],["\ubb34\uc74c","100"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png", -size:12}],events:{},def:{params:["1","1",{type:"text",params:["0.5"]},null],type:"dplay_buzzer"},paramsKeyMap:{NOTE:0,OCTAVE:1,VALUE:2},"class":"dplay_set",isNotFor:["dplay"],func:function(b,a){if(a.isStart){if(1==a.timeFlag)return a;Entry.hw.setDigitalPortValue(10,100);delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;return a.callReturn()}var c=a.getNumberField("NOTE",a),d=a.getNumberField("OCTAVE",a),e=a.getNumberValue("VALUE"),d=c+12*(d-1),e=6E4*e/60;a.isStart=!0;a.timeFlag=1;100== -c?Entry.hw.setDigitalPortValue(10,100):Entry.hw.setDigitalPortValue(10,d);if(100q?(n=Math.round(q-155),g=-n,h=0,Entry.dplay.Left_value=g):0==q&&(h=g=0,Entry.dplay.Left_value=0));"2"==m&&(e=6,f=11,0q?(n=Math.round(q-155),k=-n,l=0,Entry.dplay.Right_value= -k):0==q&&(l=k=0,Entry.dplay.Right_value=k));"3"==m&&(c=3,d=5,e=6,f=11,0q?(n=Math.round(q-155),g=-n,h=0,k=-n,l=0,Entry.dplay.Left_value=g,Entry.dplay.Right_value=k):0==q&&(l=k=h=g=0,Entry.dplay.Left_value=0,Entry.dplay.Right_value=0));if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0), -a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(c,g),Entry.hw.setDigitalPortValue(d,h),Entry.hw.setDigitalPortValue(e,l),Entry.hw.setDigitalPortValue(f,k),delete a.isStart,delete a.timeFlag,Entry.engine.isContinue=!1,a.callReturn()}else{a.isStart=!0;a.timeFlag=1;var r=setTimeout(function(){a.timeFlag=2;Entry.dplay.removeTimeout(r)},50);Entry.dplay.timeouts.push(r);return a}}},dplay_robot_speed_set:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubc14\ud034 %1 \uc67c\ucabd \ubc14\ud034 %2(\uc73c)\ub85c \uc815\ud558\uae30 %3", -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:["100"]},{type:"text",params:["100"]},null],type:"dplay_robot_speed_set"},paramsKeyMap:{R_VALUE:0,L_VALUE:1},"class":"dplay_robot",isNotFor:["dplay"],func:function(b,a){var c=0,d=0,e=0,f=0,g=0,g=0,g=a.getNumberValue("L_VALUE",a),g=Math.max(g,-100),g=Math.min(g,100);0 -g?(g=Math.round(g-155),c=-g,d=0,Entry.dplay.Left_value=c):0==g&&(d=c=0,Entry.dplay.Left_value=0);g=a.getNumberValue("R_VALUE",a);g=Math.max(g,-100);g=Math.min(g,100);0g?(g=Math.round(g-155),e=-g,f=0,Entry.dplay.Right_value=e):0==g&&(f=e=0,Entry.dplay.Right_value=0);if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0), -a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(3,c),Entry.hw.setDigitalPortValue(5,d),Entry.hw.setDigitalPortValue(6,f),Entry.hw.setDigitalPortValue(11,e),delete a.isStart,delete a.timeFlag,Entry.engine.isContinue=!1,a.callReturn()}else{a.isStart=!0;a.timeFlag=1;var h=setTimeout(function(){a.timeFlag=2;Entry.dplay.removeTimeout(h)},50);Entry.dplay.timeouts.push(h);return a}}},dplay_robot_stop:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\ub85c\ubd07\uc744 \uc815\uc9c0\ud558\uae30 %1", -params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"dplay_robot_stop"},paramsKeyMap:{},"class":"dplay_robot",isNotFor:["dplay"],func:function(b,a){Entry.hw.setDigitalPortValue(3,0);Entry.hw.setDigitalPortValue(5,0);Entry.hw.setDigitalPortValue(11,0);Entry.hw.setDigitalPortValue(6,0);return a.callReturn()}},nemoino_get_number_sensor_value:{parent:"arduino_get_number_sensor_value",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_sensor_number"}], -type:"nemoino_get_number_sensor_value"},"class":"arduino_value"},nemoino_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_port_number"}],type:"nemoino_get_digital_value"},"class":"arduino_value"},nemoino_toggle_led:{parent:"arduino_toggle_led",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"nemoino_toggle_led"},"class":"arduino_set"},nemoino_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_pwm_port_number"}, -{type:"arduino_text",params:["255"]},null],type:"nemoino_toggle_pwm"},"class":"arduino_set"},nemoino_convert_scale:{parent:"arduino_convert_scale",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number"}]},{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"nemoino_convert_scale"},"class":"arduino"},sensorBoard_get_number_sensor_value:{parent:"arduino_get_number_sensor_value", -isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_sensor_number"}],type:"sensorBoard_get_number_sensor_value"},"class":"arduino_value"},sensorBoard_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_port_number"}],type:"sensorBoard_get_digital_value"},"class":"arduino_value"},sensorBoard_toggle_led:{parent:"arduino_toggle_led",isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"sensorBoard_toggle_led"}, -"class":"arduino_set"},sensorBoard_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"sensorBoard_toggle_pwm"},"class":"arduino_set"},sensorBoard_convert_scale:{parent:"arduino_convert_scale",isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number",id:"bl5e"}]},{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number", -params:["0"]},{type:"number",params:["100"]}],type:"sensorBoard_convert_scale"},"class":"arduino"},CODEino_get_number_sensor_value:{parent:"arduino_get_number_sensor_value",isNotFor:["CODEino"],def:{params:[{type:"arduino_get_sensor_number"}],type:"CODEino_get_number_sensor_value"},"class":"arduino_value"},CODEino_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["CODEino"],def:{params:[{type:"arduino_get_port_number"}],type:"CODEino_get_digital_value"},"class":"arduino_value"},CODEino_toggle_led:{parent:"arduino_toggle_led", -isNotFor:["CODEino"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"CODEino_toggle_led"},"class":"arduino_set"},CODEino_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["CODEino"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"CODEino_toggle_pwm"},"class":"arduino_set"},CODEino_convert_scale:{parent:"arduino_convert_scale",isNotFor:["CODEino"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number"}]}, -{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"CODEino_convert_scale"},"class":"arduino"},ardublock_get_number_sensor_value:{parent:"arduino_get_number_sensor_value",isNotFor:["ardublock"],def:{params:[{type:"arduino_get_sensor_number"}],type:"ardublock_get_number_sensor_value"},"class":"arduino_value"},ardublock_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["ardublock"],def:{params:[{type:"arduino_get_port_number"}], -type:"ardublock_get_digital_value"},"class":"arduino_value"},ardublock_toggle_led:{parent:"arduino_toggle_led",isNotFor:["ardublock"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"ardublock_toggle_led"},"class":"arduino_set"},ardublock_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["ardublock"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"ardublock_toggle_pwm"},"class":"arduino_set"},ardublock_convert_scale:{parent:"arduino_convert_scale", -isNotFor:["ardublock"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number"}]},{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"ardublock_convert_scale"},"class":"arduino"},joystick_get_number_sensor_value:{parent:"arduino_get_number_sensor_value",isNotFor:["joystick"],def:{params:[{type:"arduino_get_sensor_number"}],type:"joystick_get_number_sensor_value"},"class":"arduino_value"}, -joystick_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["joystick"],def:{params:[{type:"arduino_get_port_number"}],type:"joystick_get_digital_value"},"class":"arduino_value"},joystick_toggle_led:{parent:"arduino_toggle_led",isNotFor:["joystick"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"joystick_toggle_led"},"class":"arduino_set"},joystick_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["joystick"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text", -params:["255"]},null],type:"joystick_toggle_pwm"},"class":"arduino_set"},joystick_convert_scale:{parent:"arduino_convert_scale",isNotFor:["joystick"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number"}]},{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"joystick_convert_scale"},"class":"arduino"},ebs_if:{parent:"_if",def:{type:"_if",params:[{type:"reach_something",params:[null, -"wall"]}]}},ebs_if2:{parent:"_if",def:{type:"_if",params:[{type:"reach_something",params:[null,"cwz5"]}]}}};(function(){for(var b in Entry.block){var a=Entry.block[b];if(a.parent){var c=function(){};c.prototype=Entry.block[a.parent];var c=new c,d;for(d in a)c[d]=a[d];Entry.block[b]=c}}})();"object"==typeof exports&&(exports.block=Entry.block);Entry.BlockMenu=function(b,a,c,d){Entry.Model(this,!1);this._align=a||"CENTER";this._scroll=void 0!==d?d:!1;this._bannedClass=[];this._categories=[];this.suffix="blockMenu";b="string"===typeof b?$("#"+b):$(b);if("DIV"!==b.prop("tagName"))return console.error("Dom is not div element");this.view=b;this.visible=!0;this._svgId="blockMenu"+(new Date).getTime();this._clearCategory();this._categoryData=c;this._generateView(c);this._splitters=[];this.setWidth();this.svg=Entry.SVG(this._svgId);Entry.Utils.addFilters(this.svg, -this.suffix);a=Entry.Utils.addBlockPattern(this.svg,this.suffix);this.patternRect=a.rect;this.pattern=a.pattern;this.svgGroup=this.svg.elem("g");this.svgThreadGroup=this.svgGroup.elem("g");this.svgThreadGroup.board=this;this.svgBlockGroup=this.svgGroup.elem("g");this.svgBlockGroup.board=this;this.changeEvent=new Entry.Event(this);c&&this._generateCategoryCodes(c);this.observe(this,"_handleDragBlock",["dragBlock"]);this._scroll&&(this._scroller=new Entry.BlockMenuScroller(this),this._addControl(b)); -Entry.documentMousedown&&Entry.documentMousedown.attach(this,this.setSelectedBlock);this._categoryCodes&&Entry.keyPressed&&Entry.keyPressed.attach(this,this._captureKeyEvent);Entry.windowResized&&(b=_.debounce(this.updateOffset,200),Entry.windowResized.attach(this,b))}; -(function(b){b.schema={code:null,dragBlock:null,closeBlock:null,selectedBlockView:null};b._generateView=function(a){var b=this.view,d=this;a&&(this._categoryCol=Entry.Dom("ul",{class:"entryCategoryListWorkspace",parent:b}),this._generateCategoryView(a));this.blockMenuContainer=Entry.Dom("div",{"class":"blockMenuContainer",parent:b});this.svgDom=Entry.Dom($(''),{parent:this.blockMenuContainer});this.svgDom.mouseenter(function(a){d._scroller&& -d._scroller.setOpacity(1);a=d.workspace.selectedBlockView;!Entry.playground||Entry.playground.resizing||a&&a.dragMode===Entry.DRAG_MODE_DRAG||(Entry.playground.focusBlockMenu=!0,a=d.svgGroup.getBBox(),a=a.width+a.x+64,a>Entry.interfaceState.menuWidth&&(this.widthBackup=Entry.interfaceState.menuWidth-64,$(this).stop().animate({width:a-62},200)))});this.svgDom.mouseleave(function(a){Entry.playground&&!Entry.playground.resizing&&(d._scroller&&d._scroller.setOpacity(0),(a=this.widthBackup)&&$(this).stop().animate({width:a}, -200),delete this.widthBackup,delete Entry.playground.focusBlockMenu)});$(window).scroll(function(){d.updateOffset()})};b.changeCode=function(a){if(!(a instanceof Entry.Code))return console.error("You must inject code instance");this.codeListener&&this.code.changeEvent.detach(this.codeListener);var b=this;this.set({code:a});this.codeListener=this.code.changeEvent.attach(this,function(){b.changeEvent.notify()});a.createView(this);this.align()};b.bindCodeView=function(a){this.svgBlockGroup.remove(); -this.svgThreadGroup.remove();this.svgBlockGroup=a.svgBlockGroup;this.svgThreadGroup=a.svgThreadGroup;this.svgGroup.appendChild(this.svgThreadGroup);this.svgGroup.appendChild(this.svgBlockGroup);this._scroller&&this.svgGroup.appendChild(this._scroller.svgGroup)};b.align=function(a){var b=this.code;if(b){this._clearSplitters();b.view&&!a&&b.view.reDraw();a=b.getThreads();for(var b=10,d="LEFT"==this._align?10:this.svgDom.width()/2,e,f=0,g=a.length;fthis._bannedClass.indexOf(a)&&this._bannedClass.push(a);this.align(b)};b.unbanClass=function(a,b){var d=this._bannedClass.indexOf(a);-1b&&(a.preventDefault(),this.selectMenu(b-49))};b.setPatternRectFill= -function(a){this.patternRect.attr({fill:a});this.pattern.attr({style:""})};b.disablePattern=function(){this.pattern.attr({style:"display: none"})};b._clearCategory=function(){this._selectedCategoryView=null;this._categories=[];var a=this._categoryElems,b;for(b in a)a[b].remove();this._categoryElems={};a=this._categoryCodes;for(b in a){var d=a[b];d.constructor==Entry.Code&&d.clear()}this._categoryCodes=null};b.setCategoryData=function(a){this._clearCategory();this._categoryData=a;this._generateCategoryView(a); -this._generateCategoryCodes(a)};b._generateCategoryView=function(a){if(a)for(var b=0;b=b?this.setVisible(!1):this.setVisible(!0)};b._reset=function(){this.vY=0;this.vScrollbar.attr({y:this.vY});this.resizeScrollBar()};b.onMouseDown=function(a){function b(a){a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();a=a.originalEvent&&a.originalEvent.touches?a.originalEvent.touches[0]:a;var c=e.dragInstance; -e.scroll(a.pageY-c.offsetY);c.set({offsetY:a.pageY})}function d(a){$(document).unbind(".scroll");delete e.dragInstance}var e=this;a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();if(0===a.button||a.originalEvent&&a.originalEvent.touches){Entry.documentMousedown&&Entry.documentMousedown.notify(a);var f;f=a.originalEvent&&a.originalEvent.touches?a.originalEvent.touches[0]:a;var g=$(document);g.bind("mousemove.scroll",b);g.bind("mouseup.scroll",d);g.bind("touchmove.scroll", -b);g.bind("touchend.scroll",d);e.dragInstance=new Entry.DragInstance({startY:f.pageY,offsetY:f.pageY})}a.stopPropagation()};b._addControl=function(){$(this.vScrollbar).bind("mousedown touchstart",this.mouseHandler)}})(Entry.BlockMenuScroller.prototype);Entry.BlockView=function(b,a,c){Entry.Model(this,!1);this.block=b;this._lazyUpdatePos=_.debounce(b._updatePos.bind(b),200);this._board=a;this._observers=[];this.set(b);this.svgGroup=a.svgBlockGroup.elem("g");this._schema=Entry.block[b.type];this._schema.changeEvent&&(this._schemaChangeEvent=this._schema.changeEvent.attach(this,this._updateSchema));var d=this._skeleton=Entry.skeleton[this._schema.skeleton];this._contents=[];this._statements=[];this.magnet={};this._paramMap={};d.magnets&&d.magnets(this).next&& -(this.svgGroup.nextMagnet=this.block,this._nextGroup=this.svgGroup.elem("g"),this._observers.push(this.observe(this,"_updateMagnet",["contentHeight"])));this.isInBlockMenu=this.getBoard()instanceof Entry.BlockMenu;var e=this;this.mouseHandler=function(){var a=e.block.events;a&&a.mousedown&&a.mousedown.forEach(function(a){a(e)});e.onMouseDown.apply(e,arguments)};this._startRender(b,c);this._observers.push(this.block.observe(this,"_setMovable",["movable"]));this._observers.push(this.block.observe(this, -"_setReadOnly",["movable"]));this._observers.push(this.block.observe(this,"_setCopyable",["copyable"]));this._observers.push(this.block.observe(this,"_updateColor",["deletable"],!1));this._observers.push(this.observe(this,"_updateBG",["magneting"],!1));this._observers.push(this.observe(this,"_updateOpacity",["visible"],!1));this._observers.push(this.observe(this,"_updateDisplay",["display"],!1));this._observers.push(this.observe(this,"_updateShadow",["shadow"]));this._observers.push(this.observe(this, -"_updateMagnet",["offsetY"]));this._observers.push(a.code.observe(this,"_setBoard",["board"],!1));this.dragMode=Entry.DRAG_MODE_NONE;Entry.Utils.disableContextmenu(this.svgGroup.node);a=b.events.viewAdd;"workspace"==Entry.type&&a&&!this.isInBlockMenu&&a.forEach(function(a){Entry.Utils.isFunction(a)&&a(b)})};Entry.BlockView.PARAM_SPACE=5;Entry.BlockView.DRAG_RADIUS=5;Entry.BlockView.pngMap={}; -(function(b){b.schema={id:0,type:Entry.STATIC.BLOCK_RENDER_MODEL,x:0,y:0,offsetX:0,offsetY:0,width:0,height:0,contentWidth:0,contentHeight:0,magneting:!1,visible:!0,animating:!1,shadow:!0,display:!0};b._startRender=function(a,b){var d=this,e=this._skeleton;this.svgGroup.attr({class:"block"});var f=e.classes;f&&0!==f.length&&f.forEach(function(a){d.svgGroup.addClass(a)});f=e.path(this);this.pathGroup=this.svgGroup.elem("g");this._updateMagnet();this._path=this.pathGroup.elem("path");this.getBoard().patternRect&& -($(this._path).mouseenter(function(a){d._mouseEnable&&d._changeFill(!0)}),$(this._path).mouseleave(function(a){d._mouseEnable&&d._changeFill(!1)}));var g=this._schema.color;this.block.deletable===Entry.Block.DELETABLE_FALSE_LIGHTEN&&(g=Entry.Utils.colorLighten(g));this._fillColor=g;f={d:f,fill:g,class:"blockPath"};if(this.magnet.next||this._skeleton.nextShadow)g=this.getBoard().suffix,this.pathGroup.attr({filter:"url(#entryBlockShadowFilter_"+g+")"});else if(this.magnet.string||this.magnet.boolean)f.stroke= -e.outerLine;e.outerLine&&(f["stroke-width"]="0.6");this._path.attr(f);this._moveTo(this.x,this.y,!1);this._startContentRender(b);!0!==this._board.disableMouseEvent&&this._addControl();this.bindPrev()};b._startContentRender=function(a){a=void 0===a?Entry.Workspace.MODE_BOARD:a;this.contentSvgGroup&&this.contentSvgGroup.remove();var b=this._schema;b.statements&&b.statements.length&&this.statementSvgGroup&&this.statementSvgGroup.remove();this._contents=[];this.contentSvgGroup=this.svgGroup.elem("g"); -b.statements&&b.statements.length&&(this.statementSvgGroup=this.svgGroup.elem("g"));switch(a){case Entry.Workspace.MODE_BOARD:case Entry.Workspace.MODE_OVERLAYBOARD:for(var d=/(%\d)/mi,e=(b.template?b.template:Lang.template[this.block.type]).split(d),f=b.params,g=0;gEntry.BlockView.DRAG_RADIUS)e&&(clearTimeout(e),e=null),f.movable&&(f.isInBlockMenu?g.cloneToGlobal(a):(a=!1,f.dragMode!=Entry.DRAG_MODE_DRAG&&(f._toGlobalCoordinate(), -f.dragMode=Entry.DRAG_MODE_DRAG,f.block.getThread().changeEvent.notify(),Entry.GlobalSvg.setView(f,c),a=!0),this.animating&&this.set({animating:!1}),0===f.dragInstance.height&&f.dragInstance.set({height:-1+f.height}),c=f.dragInstance,f._moveBy(d.pageX-c.offsetX,d.pageY-c.offsetY,!1),c.set({offsetX:d.pageX,offsetY:d.pageY}),Entry.GlobalSvg.position(),f.originPos||(f.originPos={x:f.x,y:f.y}),a&&g.generateCodeMagnetMap(),f._updateCloseBlock()))}function d(a){e&&(clearTimeout(e),e=null);$(document).unbind(".block"); -f.terminateDrag(a);g&&g.set({dragBlock:null});f._changeFill(!1);Entry.GlobalSvg.remove();delete this.mouseDownCoordinate;delete f.dragInstance}a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();var e=null,f=this;this._changeFill(!1);var g=this.getBoard();Entry.documentMousedown&&Entry.documentMousedown.notify(a);if(!this.readOnly&&!g.viewOnly){g.setSelectedBlock(this);this.dominate();if(0===a.button||a.originalEvent&&a.originalEvent.touches){var h=a.type,k;k=a.originalEvent&& -a.originalEvent.touches?a.originalEvent.touches[0]:a;this.mouseDownCoordinate={x:k.pageX,y:k.pageY};var l=$(document);l.bind("mousemove.block touchmove.block",c);l.bind("mouseup.block touchend.block",d);this.dragInstance=new Entry.DragInstance({startX:k.pageX,startY:k.pageY,offsetX:k.pageX,offsetY:k.pageY,height:0,mode:!0});g.set({dragBlock:this});this.addDragging();this.dragMode=Entry.DRAG_MODE_MOUSEDOWN;"touchstart"===h&&(e=setTimeout(function(){e&&(e=null,d(),f._rightClick(a))},1E3))}else Entry.Utils.isRightButton(a)&& -this._rightClick(a);g.workspace.getMode()===Entry.Workspace.MODE_VIMBOARD&&a&&document.getElementsByClassName("CodeMirror")[0].dispatchEvent(Entry.Utils.createMouseEvent("dragStart",event))}};b.vimBoardEvent=function(a,b,d){a&&(a=Entry.Utils.createMouseEvent(b,a),d&&(a.block=d),document.getElementsByClassName("CodeMirror")[0].dispatchEvent(a))};b.terminateDrag=function(a){var b=this.getBoard(),d=this.dragMode,e=this.block,f=b.workspace.getMode();this.removeDragging();this.set({visible:!0});this.dragMode= -Entry.DRAG_MODE_NONE;if(f===Entry.Workspace.MODE_VIMBOARD)b instanceof Entry.BlockMenu?(b.terminateDrag(),this.vimBoardEvent(a,"dragEnd",e)):b.clear();else if(d===Entry.DRAG_MODE_DRAG){var f=this.dragInstance&&this.dragInstance.isNew,g=Entry.GlobalSvg;a=!1;var h=this.block.getPrevBlock(this.block);a=!1;switch(Entry.GlobalSvg.terminateDrag(this)){case g.DONE:g=b.magnetedBlockView;g instanceof Entry.BlockView&&(g=g.block);h&&!g?Entry.do("separateBlock",e):h||g||f?g?("next"===g.view.magneting?(h=e.getLastBlock(), -this.dragMode=d,b.separate(e),this.dragMode=Entry.DRAG_MODE_NONE,Entry.do("insertBlock",g,h).isPass(f),Entry.ConnectionRipple.setView(g.view).dispose()):(Entry.do("insertBlock",e,g).isPass(f),a=!0),createjs.Sound.play("entryMagneting")):Entry.do("moveBlock",e).isPass(f):e.getThread().view.isGlobal()?Entry.do("moveBlock",e):Entry.do("separateBlock",e);break;case g.RETURN:e=this.block;d=this.originPos;h?(this.set({animating:!1}),createjs.Sound.play("entryMagneting"),this.bindPrev(h),e.insert(h)):(f= -e.getThread().view.getParent(),f instanceof Entry.Board?this._moveTo(d.x,d.y,!1):(createjs.Sound.play("entryMagneting"),Entry.do("insertBlock",e,f)));break;case g.REMOVE:createjs.Sound.play("entryDelete"),f?this.block.destroy(!1,!0):this.block.doDestroyBelow(!1)}b.setMagnetedBlock(null);a&&Entry.ConnectionRipple.setView(e.view).dispose()}this.destroyShadow();delete this.originPos;this.dominate()};b._updateCloseBlock=function(){var a=this.getBoard(),b;if(this._skeleton.magnets){for(var d in this.magnet)if(b= -"next"===d?this.getBoard().getNearestMagnet(this.x,this.y+this.getBelowHeight(),d):this.getBoard().getNearestMagnet(this.x,this.y,d))return a.setMagnetedBlock(b.view,d);a.setMagnetedBlock(null)}};b.dominate=function(){this.block.getThread().view.dominate()};b.getSvgRoot=function(){for(var a=this.getBoard().svgBlockGroup,b=this.svgGroup;b.parentNode!==a;)b=b.parentNode;return b};b.getBoard=function(){return this._board};b._setBoard=function(){this._board=this._board.code.board};b.destroy=function(a){$(this.svgGroup).unbind(".blockViewMousedown"); -this._destroyObservers();var b=this.svgGroup;a?$(b).fadeOut(100,function(){b.remove()}):b.remove();this._contents.forEach(function(a){a.constructor!==Entry.Block&&a.destroy()});var d=this.block;a=d.events.viewDestroy;"workspace"==Entry.type&&a&&!this.isInBlockMenu&&a.forEach(function(a){Entry.Utils.isFunction(a)&&a(d)});this._schemaChangeEvent&&this._schemaChangeEvent.destroy()};b.getShadow=function(){this._shadow||(this._shadow=Entry.SVG.createElement(this.svgGroup.cloneNode(!0),{opacity:.5}),this.getBoard().svgGroup.appendChild(this._shadow)); -return this._shadow};b.destroyShadow=function(){this._shadow&&(this._shadow.remove(),delete this._shadow)};b._updateMagnet=function(){if(this._skeleton.magnets){var a=this._skeleton.magnets(this);a.next&&this._nextGroup.attr("transform","translate("+a.next.x+","+a.next.y+")");this.magnet=a;this.block.getThread().changeEvent.notify()}};b._updateBG=function(){if(this._board.dragBlock&&this._board.dragBlock.dragInstance){var a=this.svgGroup;if(this.magnet.next){if(a=this.magneting){var b=this._board.dragBlock.getShadow(), -d=this.getAbsoluteCoordinate(),e;if("previous"===a)e=this.magnet.next,e="translate("+(d.x+e.x)+","+(d.y+e.y)+")";else if("next"===a){e=this.magnet.previous;var f=this._board.dragBlock.getBelowHeight();e="translate("+(d.x+e.x)+","+(d.y+e.y-f)+")"}$(b).attr({transform:e,display:"block"});this._clonedShadow=b;this.background&&(this.background.remove(),this.nextBackground.remove(),delete this.background,delete this.nextBackground);"previous"===a&&(a=this._board.dragBlock.getBelowHeight()+this.offsetY, -this.originalHeight=this.offsetY,this.set({offsetY:a}))}else this._clonedShadow&&(this._clonedShadow.attr({display:"none"}),delete this._clonedShadow),a=this.originalHeight,void 0!==a&&(this.background&&(this.background.remove(),this.nextBackground.remove(),delete this.background,delete this.nextBackground),this.set({offsetY:a}),delete this.originalHeight);(a=this.block.thread.changeEvent)&&a.notify()}else this.magneting?(a.attr({filter:"url(#entryBlockHighlightFilter_"+this.getBoard().suffix+")"}), -a.addClass("outputHighlight")):(a.removeClass("outputHighlight"),a.removeAttr("filter"))}};b.addDragging=function(){this.svgGroup.addClass("dragging")};b.removeDragging=function(){this.svgGroup.removeClass("dragging")};b.addSelected=function(){this.svgGroup.addClass("selected")};b.removeSelected=function(){this.svgGroup.removeClass("selected")};b.getSkeleton=function(){return this._skeleton};b.getContentPos=function(){return this._skeleton.contentPos(this)};b.renderText=function(){this._startContentRender(Entry.Workspace.MODE_VIMBOARD)}; -b.renderBlock=function(){this._startContentRender(Entry.Workspace.MODE_BOARD)};b._updateOpacity=function(){this.svgGroup.attr({opacity:!1===this.visible?0:1});this.visible&&this._setPosition()};b._updateShadow=function(){this.shadow&&Entry.Utils.colorDarken(this._schema.color,.7)};b._setMovable=function(){this.movable=null!==this.block.isMovable()?this.block.isMovable():void 0!==this._skeleton.movable?this._skeleton.movable:!0};b._setReadOnly=function(){this.readOnly=null!==this.block.isReadOnly()? -this.block.isReadOnly():void 0!==this._skeleton.readOnly?this._skeleton.readOnly:!1};b._setCopyable=function(){this.copyable=null!==this.block.isCopyable()?this.block.isCopyable():void 0!==this._skeleton.copyable?this._skeleton.copyable:!0};b.bumpAway=function(a,b){var d=this;a=a||15;b?window.setTimeout(function(){d._moveBy(a,a,!1)},b):d._moveBy(a,a,!1)};b.bindPrev=function(a){if(a){if(this._toLocalCoordinate(a.view._nextGroup),(a=a.getNextBlock())&&a!==this.block){var b=this.block.getLastBlock(); -b.view.magnet.next?a.view._toLocalCoordinate(b.view._nextGroup):(a.view._toGlobalCoordinate(),a.separate(),a.view.bumpAway(null,100))}}else if(a=this.block.getPrevBlock())this._toLocalCoordinate(a.view._nextGroup),(a=this.block.getNextBlock())&&a.view&&a.view._toLocalCoordinate(this._nextGroup)};b.getAbsoluteCoordinate=function(a){a=void 0!==a?a:this.dragMode;if(a===Entry.DRAG_MODE_DRAG)return{x:this.x,y:this.y};a=this.block.getThread().view.requestAbsoluteCoordinate(this);a.x+=this.x;a.y+=this.y; -return a};b.getBelowHeight=function(){return this.block.getThread().view.requestPartHeight(this)};b._updateDisplay=function(){this.svgGroup.attr({display:!1===this.display?"none":"block"});this.display&&this._setPosition()};b._updateColor=function(){var a=this._schema.color;this.block.deletable===Entry.Block.DELETABLE_FALSE_LIGHTEN&&(a=Entry.Utils.colorLighten(a));this._fillColor=a;this._path.attr({fill:a});this._updateContents()};b._updateContents=function(){for(var a=0;a\s+/g, -">").replace(/\s+(svgGroup)(defs)',h=this.svgGroup.getBoundingClientRect(),k=a?this.svgGroup:this.svgGroup.cloneNode(!0), -l=this._skeleton.box(this),n=b?1:1.5,m=function(){var a=window.platform;return a&&"windows"===a.name.toLowerCase()&&"7"===a.version[0]?!0:!1}()?.9:.95;-1<=+-x/".split(""),v=0;ve||d.splice(e,1)}};b.raiseEvent=function(a,b,d){a=this._eventMap[a];var e=[];if(void 0!==a){for(var f=0;fe||d.splice(e,1)};b.doDestroyThread=function(a,b){var d=this._data,e=d.indexOf(a);0>e||d.splice(e,1)};b.getThreads=function(){return this._data.map(function(a){return a})};b.toJSON=function(){for(var a= -this.getThreads(),b=[],d=0,e=a.length;db&&(d+="...");return d};b.appendSvgOptionGroup=function(){return this._block.view.getBoard().svgGroup.elem("g")};b.getValue=function(){return this._block.params[this._index]};b.setValue=function(a,b){this.value!=a&&(this.value=a,this._block.params[this._index]=a,b&&this._blockView.reDraw())};b._isEditable=function(){if(Entry.ContextMenu.visible||this._block.view.dragMode==Entry.DRAG_MODE_DRAG)return!1; -var a=this._block.view,b=a.getBoard();if(!0===b.disableMouseEvent)return!1;var d=b.workspace.selectedBlockView;if(!d||b!=d.getBoard())return!1;b=a.getSvgRoot();return b==d.svgGroup||$(b).has($(a.svgGroup))};b._selectBlockView=function(){var a=this._block.view;a.getBoard().setSelectedBlock(a)};b._bindRenderOptions=function(){var a=this;$(this.svgGroup).bind("mouseup touchend",function(b){a._isEditable()&&(a.destroyOption(),a._startValue=a.getValue(),a.renderOptions())})};b.pointer=function(a){a=a|| -[];a.unshift(this._index);a.unshift(Entry.PARAM);return this._block.pointer(a)};b.getFontSize=function(a){return a=a||this._blockView.getSkeleton().fontSize||12};b.getContentHeight=function(){return Entry.isMobile()?22:16}})(Entry.Field.prototype);Entry.FieldAngle=function(b,a,c){this._block=a.block;this._blockView=a;this.box=new Entry.BoxModel;this.svgGroup=null;this.position=b.position;this._contents=b;this._index=c;b=this.getValue();this.setValue(this.modValue(void 0!==b?b:90));this._CONTENT_HEIGHT=this.getContentHeight();this.renderStart()};Entry.Utils.inherit(Entry.Field,Entry.FieldAngle); -(function(b){b.renderStart=function(){this.svgGroup&&$(this.svgGroup).remove();this.svgGroup=this._blockView.contentSvgGroup.elem("g",{class:"entry-input-field"});this.textElement=this.svgGroup.elem("text",{x:4,y:4,"font-size":"11px"});this.textElement.textContent=this.getText();var a=this.getTextWidth(),b=this._CONTENT_HEIGHT,d=this.position&&this.position.y?this.position.y:0;this._header=this.svgGroup.elem("rect",{x:0,y:d-b/2,rx:3,ry:3,width:a,height:b,rx:3,ry:3,fill:"#fff","fill-opacity":.4}); -this.svgGroup.appendChild(this.textElement);this._bindRenderOptions();this.box.set({x:0,y:0,width:a,height:b})};b.renderOptions=function(){var a=this;this._attachDisposeEvent(function(){a.applyValue();a.destroyOption()});this.optionGroup=Entry.Dom("input",{class:"entry-widget-input-field",parent:$("body")});this.optionGroup.val(this.value);this.optionGroup.on("mousedown touchstart",function(a){a.stopPropagation()});this.optionGroup.on("keyup",function(b){var c=b.keyCode||b.which;a.applyValue(b);-1< -[13,27].indexOf(c)&&a.destroyOption()});var b=this.getAbsolutePosFromDocument();b.y-=this.box.height/2;this.optionGroup.css({height:this._CONTENT_HEIGHT,left:b.x,top:b.y,width:a.box.width});this.svgOptionGroup=this.appendSvgOptionGroup();this.svgOptionGroup.elem("circle",{x:0,y:0,r:49,class:"entry-field-angle-circle"});$(this.svgOptionGroup).on("mousedown touchstart",function(b){b.stopPropagation();a._updateByCoord(b)});this._dividerGroup=this.svgOptionGroup.elem("g");for(b=0;360>b;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+")"});$(this.svgOptionGroup).bind("mousemove touchmove",this._updateByCoord.bind(this));$(this.svgOptionGroup).bind("mouseup touchend",this.destroyOption.bind(this));this.updateGraph();this.optionGroup.focus();this.optionGroup.select()}; -b._updateByCoord=function(a){a.originalEvent&&a.originalEvent.touches&&(a=a.originalEvent.touches[0]);a=[a.clientX,a.clientY];var b=this.getAbsolutePosFromDocument();this.optionGroup.val(this.modValue(function(a,b){var c=b[0]-a[0],g=b[1]-a[1]-49-1,h=Math.atan(-g/c),h=Entry.toDegrees(h),h=90-h;0>c?h+=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||(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)}; ->>>>>>> entrylabs/master Entry.Utils.inherit(Entry.Field,Entry.FieldBlock); (function(a){a.schema={magneting:!1};a.renderStart=function(b,a){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(b,a),d.getThread().view.setParent(this));this.updateValueBlock(d);this._blockView.getBoard().constructor!==Entry.Board&&this._valueBlock.view.removeControl()};a.align=function(b,a,d){var e=this.svgGroup;this._position&&(this._position.x&& (b=this._position.x),this._position.y&&(a=this._position.y));var f=this._valueBlock;f&&(a=-.5*f.view.height);f="translate("+b+","+a+")";void 0===d||d?e.animate({transform:f},300,mina.easeinout):e.attr({transform:f});this.box.set({x:b,y:a})};a.calcWH=function(){var b=this._valueBlock;b?(b=b.view,this.box.set({width:b.width,height:b.height})):this.box.set({width:15,height:20})};a.calcHeight=a.calcWH;a.destroy=function(){};a.inspectBlock=function(){var b=null;if(this._originBlock)b=this._originBlock.type, @@ -3354,7 +2229,6 @@ function(b){return b%360};a.destroyOption=function(){this.disposeEvent&&(Entry.d this.optionGroup=Entry.Dom("table",{class:"entry-widget-color-table",parent:$("body")});for(var d=0;d>>>>>> entrylabs/master this.nextBackground.remove(),delete this.background,delete this.nextBackground);a=this._board.dragBlock.getBelowHeight();this.statementSvgGroup.attr({transform:"translate(0,"+a+")"});this.set({height:this.height+a})}else this._clonedShadow&&(this._clonedShadow.attr({display:"none"}),delete this._clonedShadow),a=this.originalHeight,void 0!==a&&(this.background&&(this.background.remove(),this.nextBackground.remove(),delete this.background,delete this.nextBackground),delete this.originalHeight),this.statementSvgGroup.attr({transform:"translate(0,0)"}), this.calcHeight();(a=this.block.thread.changeEvent)&&a.notify()}};a.insertTopBlock=function(a){this._posObserver&&this._posObserver.destroy();var c=this.firstBlock;(this.firstBlock=a)&&a.doInsert(this._thread);return c};a.getNextBlock=function(){return this.firstBlock};a.checkTopBlock=function(){var a=this._thread.getFirstBlock();a&&this.firstBlock!==a?(this.firstBlock=a,a.view.bindPrev(this),a._updatePos()):a||(this.firstBlock=null)}})(Entry.FieldStatement.prototype);Entry.FieldText=function(a,b,c){this._block=b.block;this._blockView=b;this._index=c;this.box=new Entry.BoxModel;this._fontSize=a.fontSize||b.getSkeleton().fontSize||12;this._color=a.color||this._block.getSchema().fontColor||b.getSkeleton().color||"white";this._align=a.align||"left";this._text=this.getValue()||a.text;this.setValue(null);this.textElement=null;this.renderStart(b)};Entry.Utils.inherit(Entry.Field,Entry.FieldText); (function(a){a.renderStart=function(){this.svgGroup&&$(this.svgGroup).remove();this.svgGroup=this._blockView.contentSvgGroup.elem("g");this._text=this._text.replace(/(\r\n|\n|\r)/gm," ");this.textElement=this.svgGroup.elem("text").attr({style:"white-space: pre;","font-size":this._fontSize+"px","font-family":"nanumBarunRegular","class":"dragNone",fill:this._color});this.textElement.textContent=this._text;var a=0,c=this.textElement.getBoundingClientRect();"center"==this._align&&(a=-c.width/2);this.textElement.attr({x:a, @@ -3426,7 +2271,6 @@ a.setView=function(a,c){if(a!=this._view&&!a.block.isReadOnly()&&a.movable)retur h=e.visible?e.svgDom.width():0;return c.y>d.offset().top-20&&c.x>f+h?this.DONE:c.y>g&&c.x>f&&e.visible?a.block.isDeletable()?this.REMOVE:this.RETURN:this.RETURN};a.addControl=function(a){this.onMouseDown.apply(this,arguments)};a.onMouseDown=function(a){function c(a){var b=a.pageX;a=a.pageY;var c=e.left+(b-e._startX),d=e.top+(a-e._startY);e.svgDom.css({left:c,top:d});e._startX=b;e._startY=a;e.left=c;e.top=d}function d(a){$(document).unbind(".block")}this._startY=a.pageY;var e=this;a.stopPropagation(); a.preventDefault();var f=$(document);f.bind("mousemove.block",c);f.bind("mouseup.block",d);f.bind("touchmove.block",c);f.bind("touchend.block",d);this._startX=a.pageX;this._startY=a.pageY}})(Entry.GlobalSvg);Entry.Mutator=function(){};(function(a){a.mutate=function(a,c){a=Entry.block[a];void 0===a.changeEvent&&(a.changeEvent=new Entry.Event);a.template=c.template;a.params=c.params;a.changeEvent.notify(1)}})(Entry.Mutator);(function(a){})(Entry.Mutator.prototype);Entry.RenderView=function(a,b){this._align=b||"CENTER";a="string"===typeof a?$("#"+a):$(a);if("DIV"!==a.prop("tagName"))return console.error("Dom is not div element");this.view=a;this.viewOnly=!0;this.suffix="renderView";this.disableMouseEvent=this.visible=!0;this._svgId="renderView_"+(new Date).getTime();this._generateView();this.offset=this.svgDom.offset();this.setWidth();this.svg=Entry.SVG(this._svgId);Entry.Utils.addFilters(this.svg,this.suffix);this.svg&&(this.svgGroup=this.svg.elem("g"),this.svgThreadGroup= this.svgGroup.elem("g"),this.svgThreadGroup.board=this,this.svgBlockGroup=this.svgGroup.elem("g"),this.svgBlockGroup.board=this)}; -<<<<<<< HEAD (function(a){a.schema={code:null,dragBlock:null,closeBlock:null,selectedBlockView:null};a._generateView=function(){this.renderViewContainer=Entry.Dom("div",{"class":"renderViewContainer",parent:this.view});this.svgDom=Entry.Dom($(''),{parent:this.renderViewContainer})};a.changeCode=function(a){if(!(a instanceof Entry.Code))return console.error("You must inject code instance");this.code=a;this.svg|| (this.svg=Entry.SVG(this._svgId),this.svgGroup=this.svg.elem("g"),this.svgThreadGroup=this.svgGroup.elem("g"),this.svgThreadGroup.board=this,this.svgBlockGroup=this.svgGroup.elem("g"),this.svgBlockGroup.board=this);a.createView(this);this.align();this.resize()};a.align=function(){var a=this.code.getThreads();if(a&&0!==a.length){for(var c=0,d="LEFT"==this._align?20:this.svgDom.width()/2,e=0,f=a.length;e'),{parent:this.renderViewContainer})};b.changeCode=function(a){if(!(a instanceof Entry.Code))return console.error("You must inject code instance");this.code=a;this.svg|| -(this.svg=Entry.SVG(this._svgId),this.svgGroup=this.svg.elem("g"),this.svgThreadGroup=this.svgGroup.elem("g"),this.svgThreadGroup.board=this,this.svgBlockGroup=this.svgGroup.elem("g"),this.svgBlockGroup.board=this);a.createView(this);this.align();this.resize()};b.align=function(){var a=this.code.getThreads();if(a&&0!==a.length){for(var b=0,d="LEFT"==this._align?20:this.svgDom.width()/2,e=0,f=a.length;e'), -{parent:this.wrapper});this.visible=!0;var d=this;this.svg=Entry.SVG(this._svgId);$(window).scroll(function(){d.updateOffset()});this.svgGroup=this.svg.elem("g");this.svgThreadGroup=this.svgGroup.elem("g");this.svgThreadGroup.board=this;this.svgBlockGroup=this.svgGroup.elem("g");this.svgBlockGroup.board=this;a.isOverlay?(this.wrapper.addClass("entryOverlayBoard"),this.generateButtons(),this.suffix="overlayBoard"):this.suffix="board";Entry.Utils.addFilters(this.svg,this.suffix);a=Entry.Utils.addBlockPattern(this.svg, -this.suffix);this.patternRect=a.rect;this.pattern=a.pattern};b.changeCode=function(a){this.code&&this.codeListener&&this.code.changeEvent.detach(this.codeListener);this.set({code:a});var b=this;a&&(this.codeListener=this.code.changeEvent.attach(this,function(){b.changeEvent.notify()}),a.createView(this));this.scroller.resizeScrollBar()};b.bindCodeView=function(a){this.svgBlockGroup.remove();this.svgThreadGroup.remove();this.svgBlockGroup=a.svgBlockGroup;this.svgThreadGroup=a.svgThreadGroup;this.svgGroup.appendChild(this.svgThreadGroup); -this.svgGroup.appendChild(this.svgBlockGroup)};b.setMagnetedBlock=function(a,b){if(this.magnetedBlockView){if(this.magnetedBlockView===a)return;this.magnetedBlockView.set({magneting:!1})}this.set({magnetedBlockView:a});a&&(a.set({magneting:b}),a.dominate())};b.getCode=function(){return this.code};b.findById=function(a){return this.code.findById(a)};b._addControl=function(){var a=this.svgDom,b=this;a.mousedown(function(){b.onMouseDown.apply(b,arguments)});a.bind("touchstart",function(){b.onMouseDown.apply(b, -arguments)});a.on("wheel",function(){b.mouseWheel.apply(b,arguments)});var d=b.scroller;d&&(a.mouseenter(function(a){d.setOpacity(1)}),a.mouseleave(function(a){d.setOpacity(0)}))};b.onMouseDown=function(a){function b(a){a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();a=Entry.Utils.convertMouseEvent(a);var c=e.mouseDownCoordinate;Math.sqrt(Math.pow(a.pageX-c.x,2)+Math.pow(a.pageY-c.y,2))a&&(f=f+e+10,e=0,d=15);e=Math.max(e,k.width);l=d+15;h._moveTo(f,l,!1);d=d+k.height+15}}this.scroller.resizeScrollBar()};b.clear=function(){this.svgBlockGroup.remove();this.svgThreadGroup.remove()};b.updateOffset= -function(){this._offset=this.svg.getBoundingClientRect();var a=$(window),b=a.scrollTop(),a=a.scrollLeft(),d=this._offset;this.relativeOffset={top:d.top-b,left:d.left-a};this.btnWrapper&&this.btnWrapper.attr({transform:"translate("+(d.width/2-65)+","+(d.height-200)+")"})};b.generateButtons=function(){var a=this,b=this.svgGroup.elem("g");this.btnWrapper=b;var d=b.elem("text",{x:27,y:33,class:"entryFunctionButtonText"});d.textContent=Lang.Buttons.save;var e=b.elem("text",{x:102.5,y:33,class:"entryFunctionButtonText"}); -e.textContent=Lang.Buttons.cancel;var f=b.elem("circle",{cx:27.5,cy:27.5,r:27.5,class:"entryFunctionButton"}),b=b.elem("circle",{cx:102.5,cy:27.5,r:27.5,class:"entryFunctionButton"});$(f).bind("mousedown touchstart",function(){a.save()});$(d).bind("mousedown touchstart",function(){a.save()});$(b).bind("mousedown touchstart",function(){a.cancelEdit()});$(e).bind("mousedown touchstart",function(){a.cancelEdit()})};b.cancelEdit=function(){this.workspace.setMode(Entry.Workspace.MODE_BOARD,"cancelEdit")}; -b.save=function(){this.workspace.setMode(Entry.Workspace.MODE_BOARD,"save")};b.generateCodeMagnetMap=function(){var a=this.code;if(a&&this.dragBlock)for(var b in this.dragBlock.magnet){var d=this._getCodeBlocks(a,b);d.sort(function(a,b){return a.point-b.point});d.unshift({point:-Number.MAX_VALUE,blocks:[]});for(var e=1;eg.point&&(g.blocks.push(h),l++,g=d[l],g););delete f.startBlock}f.endPoint=Number.MAX_VALUE;d[e-1].endPoint= -f.point}this._magnetMap[b]=d}};b._getCodeBlocks=function(a,b){var d=a.getThreads(),e=[],f;switch(b){case "previous":f=this._getNextMagnets;break;case "next":f=this._getPreviousMagnets;break;case "string":f=this._getFieldMagnets;break;case "boolean":f=this._getFieldMagnets;break;case "param":f=this._getOutputMagnets;break;default:return[]}for(var g=0;gd.endPoint)f=h+1;else{e=d.blocks;for(f=0;fthis.events[b].indexOf(f)&&this.events[b].push(f)}}this._schema.event&&this.thread.registerEvent(this,this._schema.event);a=this.params;b=this._schema.params;for(e=0;b&&e=e&&g>=b)}};b.align=function(){var a=this.getPosition();this.svgGroup.attr({transform:"translate("+a.x+","+a.y+")"})};b.setPosition=function(){if(this.board){var a=this.board.svgDom;this._x=a.width()-110;this._y=a.height()-110;this.align()}};b.getPosition=function(){return{x:this._x,y:this._y}};b.tAnimation=function(a){if(a!==this.isOver){a=void 0===a?!0:a;var b,d=this.trashcanTop;b=a?{translateX:15,translateY:-25, -rotateZ:30}:{translateX:0,translateY:0,rotateZ:0};$(d).velocity(b,{duration:50});this.isOver=a}};b.setBoard=function(a){this._dragBlockObserver&&this._dragBlockObserver.destroy();this.board=a;this.svgGroup||this._generateView();var b=a.svg,d=b.firstChild;d?b.insertBefore(this.svgGroup,d):b.appendChild(this.svgGroup);this._dragBlockObserver=a.observe(this,"updateDragBlock",["dragBlock"]);this.svgGroup.attr({filter:"url(#entryTrashcanFilter_"+a.suffix+")"});this.setPosition()}})(Entry.FieldTrashcan.prototype);Entry.Vim=function(b){b="string"===typeof b?$("#"+b):$(b);if("DIV"!==b.prop("tagName"))return console.error("Dom is not div element");this.createDom(b);this._parser=new Entry.Parser("maze","js",this.codeMirror);this._blockParser=new Entry.Parser("maze","block");Entry.Model(this,!1);window.eventset=[]}; -(function(b){b.createDom=function(a){function b(a){var c=e.getCodeToText(a.block);e.codeMirror.display.dragFunctions.leave(a);var d=Entry.Utils.createMouseEvent("mousedown",a);e.codeMirror.display.scroller.dispatchEvent(d);var c=c.split("\n"),k=c.length-1,l=0;c.forEach(function(a,b){e.codeMirror.replaceSelection(a);l=e.doc.getCursor().line;e.codeMirror.indentLine(l);0!==b&&k===b||e.codeMirror.replaceSelection("\n")});a=Entry.Utils.createMouseEvent("mouseup",a);e.codeMirror.display.scroller.dispatchEvent(a)} -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}); -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, -workspace:this,isOverlay:!0});this.overlayBoard.changeCode(new Entry.Code([]));this.overlayBoard.workspace=this;this.overlayBoard.observe(this,"_setSelectedBlockView",["selectedBlockView"],!1)};b._keyboardControl=function(a){var b=a.keyCode||a.which,d=a.ctrlKey;if(!Entry.Utils.isInInput(a)){var e=this.selectedBlockView;e&&!e.isInBlockMenu&&e.block.isDeletable()&&(8==b||46==b?(Entry.do("destroyBlock",e.block),a.preventDefault()):d&&(67==b?e.block.copyToClipboard():88==b&&(a=e.block,a.copyToClipboard(), -a.destroy(!0,!0),e.getBoard().setSelectedBlock(null))));d&&86==b&&(b=this.selectedBoard)&&b instanceof Entry.Board&&Entry.clipboard&&Entry.do("addThread",Entry.clipboard).value.getFirstBlock().copyToClipboard()}};b._handleChangeBoard=function(){var a=this.selectedBoard;a&&a.constructor===Entry.Board&&this.trashcan.setBoard(a)}})(Entry.Workspace.prototype);Entry.Playground=function(){this.enableArduino=this.isTextBGMode_=!1;this.viewMode_="default";Entry.addEventListener("textEdited",this.injectText);Entry.addEventListener("hwChanged",this.updateHW)}; -Entry.Playground.prototype.generateView=function(b,a){this.view_=b;this.view_.addClass("entryPlayground");if(a&&"workspace"!=a)"phone"==a&&(this.view_.addClass("entryPlaygroundPhone"),c=Entry.createElement("div","entryCategoryTab"),c.addClass("entryPlaygroundTabPhone"),Entry.view_.insertBefore(c,this.view_),this.generateTabView(c),this.tabView_=c,c=Entry.createElement("div","entryCurtain"),c.addClass("entryPlaygroundCurtainPhone"),c.addClass("entryRemove"),c.innerHTML=Lang.Workspace.cannot_edit_click_to_stop, -c.bindOnClick(function(){Entry.engine.toggleStop()}),this.view_.appendChild(c),this.curtainView_=c,Entry.pictureEditable&&(c=Entry.createElement("div","entryPicture"),c.addClass("entryPlaygroundPicturePhone"),c.addClass("entryRemove"),this.view_.appendChild(c),this.generatePictureView(c),this.pictureView_=c),c=Entry.createElement("div","entryText"),c.addClass("entryRemove"),this.view_.appendChild(c),this.generateTextView(c),this.textView_=c,Entry.soundEditable&&(c=Entry.createElement("div","entrySound"), -c.addClass("entryPlaygroundSoundWorkspacePhone"),c.addClass("entryRemove"),this.view_.appendChild(c),this.generateSoundView(c),this.soundView_=c),c=Entry.createElement("div","entryDefault"),this.view_.appendChild(c),this.generateDefaultView(c),this.defaultView_=c,c=Entry.createElement("div","entryCode"),c.addClass("entryPlaygroundCodePhone"),this.view_.appendChild(c),this.generateCodeView(c),this.codeView_=this.codeView_=c,Entry.addEventListener("run",function(a){Entry.playground.curtainView_.removeClass("entryRemove")}), -Entry.addEventListener("stop",function(a){Entry.playground.curtainView_.addClass("entryRemove")}));else{this.view_.addClass("entryPlaygroundWorkspace");var c=Entry.createElement("div","entryCategoryTab");c.addClass("entryPlaygroundTabWorkspace");this.view_.appendChild(c);this.generateTabView(c);this.tabView_=c;c=Entry.createElement("div","entryCurtain");c.addClass("entryPlaygroundCurtainWorkspace");c.addClass("entryRemove");var d=Lang.Workspace.cannot_edit_click_to_stop.split(".");c.innerHTML=d[0]+ -".
"+d[1];c.addEventListener("click",function(){Entry.engine.toggleStop()});this.view_.appendChild(c);this.curtainView_=c;Entry.pictureEditable&&(c=Entry.createElement("div","entryPicture"),c.addClass("entryPlaygroundPictureWorkspace"),c.addClass("entryRemove"),this.view_.appendChild(c),this.generatePictureView(c),this.pictureView_=c);c=Entry.createElement("div","entryText");c.addClass("entryPlaygroundTextWorkspace");c.addClass("entryRemove");this.view_.appendChild(c);this.generateTextView(c); -this.textView_=c;Entry.soundEditable&&(c=Entry.createElement("div","entrySound"),c.addClass("entryPlaygroundSoundWorkspace"),c.addClass("entryRemove"),this.view_.appendChild(c),this.generateSoundView(c),this.soundView_=c);c=Entry.createElement("div","entryDefault");c.addClass("entryPlaygroundDefaultWorkspace");this.view_.appendChild(c);this.generateDefaultView(c);this.defaultView_=c;c=Entry.createElement("div","entryCode");c.addClass("entryPlaygroundCodeWorkspace");c.addClass("entryRemove");this.view_.appendChild(c); -this.generateCodeView(c);this.codeView_=c;d=Entry.createElement("div");d.addClass("entryPlaygroundResizeWorkspace","entryRemove");this.resizeHandle_=d;this.view_.appendChild(d);this.initializeResizeHandle(d);this.codeView_=c;Entry.addEventListener("run",function(a){Entry.playground.curtainView_.removeClass("entryRemove")});Entry.addEventListener("stop",function(a){Entry.playground.curtainView_.addClass("entryRemove")})}};Entry.Playground.prototype.generateDefaultView=function(b){return b}; -Entry.Playground.prototype.generateTabView=function(b){var a=this,c=Entry.createElement("ul");c.addClass("entryTabListWorkspace");this.tabList_=c;b.appendChild(c);this.tabViewElements={};b=Entry.createElement("li","entryCodeTab");b.innerHTML=Lang.Workspace.tab_code;b.addClass("entryTabListItemWorkspace");b.addClass("entryTabSelected");c.appendChild(b);b.bindOnClick(function(b){a.changeViewMode("code");a.blockMenu.reDraw()});this.tabViewElements.code=b;Entry.pictureEditable&&(b=Entry.createElement("li", -"entryPictureTab"),b.innerHTML=Lang.Workspace.tab_picture,b.addClass("entryTabListItemWorkspace"),c.appendChild(b),b.bindOnClick(function(a){Entry.playground.changeViewMode("picture")}),this.tabViewElements.picture=b,b=Entry.createElement("li","entryTextboxTab"),b.innerHTML=Lang.Workspace.tab_text,b.addClass("entryTabListItemWorkspace"),c.appendChild(b),b.bindOnClick(function(a){Entry.playground.changeViewMode("text")}),this.tabViewElements.text=b,b.addClass("entryRemove"));Entry.soundEditable&&(b= -Entry.createElement("li","entrySoundTab"),b.innerHTML=Lang.Workspace.tab_sound,b.addClass("entryTabListItemWorkspace"),c.appendChild(b),b.bindOnClick(function(a){Entry.playground.changeViewMode("sound")}),this.tabViewElements.sound=b);Entry.hasVariableManager&&(b=Entry.createElement("li","entryVariableTab"),b.innerHTML=Lang.Workspace.tab_attribute,b.addClass("entryTabListItemWorkspace"),b.addClass("entryVariableTabWorkspace"),c.appendChild(b),b.bindOnClick(function(a){Entry.playground.toggleOnVariableView(); -Entry.playground.changeViewMode("variable")}),this.tabViewElements.variable=b)}; -Entry.Playground.prototype.generateCodeView=function(b){var a=this.createVariableView();b.appendChild(a);this.variableView_=a;b=Entry.Dom(b);a=Entry.Dom("div",{parent:b,id:"entryWorkspaceBoard",class:"entryWorkspaceBoard"});b=Entry.Dom("div",{parent:b,id:"entryWorkspaceBlockMenu",class:"entryWorkspaceBlockMenu"});this.mainWorkspace=new Entry.Workspace({blockMenu:{dom:b,align:"LEFT",categoryData:EntryStatic.getAllBlocks(),scroll:!0},board:{dom:a}});this.blockMenu=this.mainWorkspace.blockMenu;this.board= -this.mainWorkspace.board;Entry.hw&&this.updateHW()}; -Entry.Playground.prototype.generatePictureView=function(b){if("workspace"==Entry.type){var a=Entry.createElement("div","entryAddPicture");a.addClass("entryPlaygroundAddPicture");a.bindOnClick(function(a){Entry.dispatchEvent("openPictureManager")});var c=Entry.createElement("div","entryAddPictureInner");c.addClass("entryPlaygroundAddPictureInner");c.innerHTML=Lang.Workspace.picture_add;a.appendChild(c);b.appendChild(a);a=Entry.createElement("ul","entryPictureList");a.addClass("entryPlaygroundPictureList"); -$&&$(a).sortable({start:function(a,b){b.item.data("start_pos",b.item.index())},stop:function(a,b){var c=b.item.data("start_pos"),g=b.item.index();Entry.playground.movePicture(c,g)},axis:"y"});b.appendChild(a);this.pictureListView_=a;a=Entry.createElement("div","entryPainter");a.addClass("entryPlaygroundPainter");b.appendChild(a);this.painter=new Entry.Painter;this.painter.initialize(a)}else"phone"==Entry.type&&(a=Entry.createElement("div","entryAddPicture"),a.addClass("entryPlaygroundAddPicturePhone"), -a.bindOnClick(function(a){Entry.dispatchEvent("openPictureManager")}),c=Entry.createElement("div","entryAddPictureInner"),c.addClass("entryPlaygroundAddPictureInnerPhone"),c.innerHTML=Lang.Workspace.picture_add,a.appendChild(c),b.appendChild(a),a=Entry.createElement("ul","entryPictureList"),a.addClass("entryPlaygroundPictureListPhone"),$&&$(a).sortable({start:function(a,b){b.item.data("start_pos",b.item.index())},stop:function(a,b){var c=b.item.data("start_pos"),g=b.item.index();Entry.playground.movePicture(c, -g)},axis:"y"}),b.appendChild(a),this.pictureListView_=a)}; -Entry.Playground.prototype.generateTextView=function(b){var a=Entry.createElement("div");b.appendChild(a);b=Entry.createElement("div");b.addClass("textProperties");a.appendChild(b);var c=Entry.createElement("div");c.addClass("entryTextFontSelect");b.appendChild(c);var d=Entry.createElement("select","entryPainterAttrFontName");d.addClass("entryPlaygroundPainterAttrFontName","entryTextFontSelecter");d.size="1";d.onchange=function(a){Entry.playground.object.entity.setFontType(a.target.value)};for(var e= -0;e p").html(Lang.Menus.linebreak_on_desc_1),$(".entryPlaygroundLinebreakDescription > ul > li").eq(0).html(Lang.Menus.linebreak_on_desc_2),$(".entryPlaygroundLinebreakDescription > ul > li").eq(1).html(Lang.Menus.linebreak_on_desc_3)); -Entry.playground.setFontAlign(Entry.playground.object.entity.getTextAlign());b=Entry.playground.object.entity.getFontSize();Entry.playground.fontSizeIndiciator.style.width=b+"%";Entry.playground.fontSizeKnob.style.left=.88*b+"px"}};Entry.Playground.prototype.injectSound=function(){var b=this.soundListView_;if(b){for(;b.hasChildNodes();)b.removeChild(b.lastChild);if(this.object)for(var a=this.object.sounds,c=0,d=a.length;c>>>>>> entrylabs/master diff --git a/src/hw.js b/src/hw.js index a7333e8fa7..4246a310f2 100644 --- a/src/hw.js +++ b/src/hw.js @@ -22,26 +22,6 @@ Entry.HW = function() { Entry.addEventListener('stop', this.setZero); this.hwInfo = { -<<<<<<< HEAD - '11': Entry.Arduino, - '19': Entry.ArduinoExt, - '12': Entry.SensorBoard, - '13': Entry.CODEino, - '14': Entry.joystick, - '15': Entry.dplay, - '16': Entry.nemoino, - '17': Entry.Xbot, - '18': Entry.ardublock, - '110': Entry.Cobl, - '24': Entry.Hamster, - '25': Entry.Albert, - '31': Entry.Bitbrick, - '42': Entry.Arduino, - '51': Entry.Neobot, - '71': Entry.Robotis_carCont, - '72': Entry.Robotis_openCM70, - '81': Entry.Arduino -======= '1.1': Entry.Arduino, '1.9': Entry.ArduinoExt, '1.2': Entry.SensorBoard, @@ -51,6 +31,7 @@ Entry.HW = function() { '1.6': Entry.nemoino, '1.7': Entry.Xbot, '1.8': Entry.ardublock, + '1.A': Entry.Cobl, '2.4': Entry.Hamster, '2.5': Entry.Albert, '3.1': Entry.Bitbrick, @@ -59,7 +40,6 @@ Entry.HW = function() { '7.1': Entry.Robotis_carCont, '7.2': Entry.Robotis_openCM70, '8.1': Entry.Arduino ->>>>>>> entrylabs/master }; }; @@ -306,4 +286,4 @@ p.banHW = function() { for (var i in hwOptions) Entry.playground.mainWorkspace.blockMenu.banClass(hwOptions[i].name, true); -}; +}; \ No newline at end of file From 2f3d8f86c7bb750f8a7ca3940a85374bd71c5151 Mon Sep 17 00:00:00 2001 From: chanlee Date: Tue, 16 Aug 2016 18:19:55 +0900 Subject: [PATCH 09/15] apply language --- extern/lang/code.js | 132 ++++++++++++++++++++++++++++++++--------- extern/lang/en.js | 126 +++++++++++++++++++++++++++++++-------- extern/lang/ko.js | 140 +++++++++++++++++++++++++++++++++----------- 3 files changed, 310 insertions(+), 88 deletions(-) diff --git a/extern/lang/code.js b/extern/lang/code.js index 24cdd21fd3..4c2b428238 100644 --- a/extern/lang/code.js +++ b/extern/lang/code.js @@ -418,21 +418,23 @@ Lang.Blocks = { "VARIABLE_value_of_index_from_list_2": ",", "VARIABLE_value_of_index_from_list_3": ")", "HAMSTER_hand_found": "Entry.Hamster.isHandFound()", - "HAMSTER_sensor_leftProximity": "Entry.Hamster.getLeftProximity()", - "HAMSTER_sensor_rightProximity": "Entry.Hamster.getRightProximity()", - "HAMSTER_sensor_leftFloor": "Entry.Hamster.getLeftFloor()", - "HAMSTER_sensor_rightFloor": "Entry.Hamster.getRightFloor()", - "HAMSTER_sensor_accelerationX": "Entry.Hamster.getAccelerationX()", - "HAMSTER_sensor_accelerationY": "Entry.Hamster.getAccelerationY()", - "HAMSTER_sensor_accelerationZ": "Entry.Hamster..getAccelerationZ()", + "HAMSTER_sensor_left_proximity": "Entry.Hamster.getLeftProximity()", + "HAMSTER_sensor_right_proximity": "Entry.Hamster.getRightProximity()", + "HAMSTER_sensor_left_floor": "Entry.Hamster.getLeftFloor()", + "HAMSTER_sensor_right_floor": "Entry.Hamster.getRightFloor()", + "HAMSTER_sensor_acceleration_x": "Entry.Hamster.getAccelerationX()", + "HAMSTER_sensor_acceleration_y": "Entry.Hamster.getAccelerationY()", + "HAMSTER_sensor_acceleration_z": "Entry.Hamster..getAccelerationZ()", "HAMSTER_sensor_light": "Entry.Hamster.getLight()", "HAMSTER_sensor_temperature": "Entry.Hamster.getTemperature()", - "HAMSTER_sensor_signalStrength": "Entry.Hamster.getSignalStrength()", - "HAMSTER_sensor_inputA": "Entry.Hamster.getInputA()", - "HAMSTER_sensor_inputB": "Entry.Hamster.getInputB()", + "HAMSTER_sensor_signal_strength": "Entry.Hamster.getSignalStrength()", + "HAMSTER_sensor_input_a": "Entry.Hamster.getInputA()", + "HAMSTER_sensor_input_b": "Entry.Hamster.getInputB()", "HAMSTER_move_forward_once": "Entry.Hamster.moveForwardOnceOnBoard()", "HAMSTER_turn_once_1": "Entry.Hamster.turnOnceOnBoard('", "HAMSTER_turn_once_2": "')", + "HAMSTER_turn_once_left": "left", + "HAMSTER_turn_right": "right", "HAMSTER_move_forward": "move forward", "HAMSTER_move_backward": "move backward", "HAMSTER_turn_around_1": "turn", @@ -453,15 +455,25 @@ Lang.Blocks = { "HAMSTER_change_wheel_by_1": "Entry.Hamster.changeWheelBy('", "HAMSTER_change_wheel_by_2": "',", "HAMSTER_change_wheel_by_3": ")", + "HAMSTER_left_wheel": "left", + "HAMSTER_right_wheel": "right", + "HAMSTER_both_wheels": "both", "HAMSTER_set_wheel_to_1": "Entry.Hamster.setWheelTo('", "HAMSTER_set_wheel_to_2": "',", "HAMSTER_set_wheel_to_3": ")", "HAMSTER_follow_line_using_1": "Entry.Hamster.followLineUsingFloorSensor('", "HAMSTER_follow_line_using_2": "','", "HAMSTER_follow_line_using_3": "')", + "HAMSTER_left_floor_sensor": "left", + "HAMSTER_right_floor_sensor": "right", + "HAMSTER_both_floor_sensors": "both", "HAMSTER_follow_line_until_1": "Entry.Hamster.followLineUntilIntersection('", "HAMSTER_follow_line_until_2": "','", "HAMSTER_follow_line_until_3": "')", + "HAMSTER_left_intersection": "left", + "HAMSTER_right_intersection": "right", + "HAMSTER_front_intersection": "front", + "HAMSTER_rear_intersection": "rear", "HAMSTER_set_following_speed_to_1": "Entry.Hamster.setFollowingSpeedTo(", "HAMSTER_set_following_speed_to_2": ")", "HAMSTER_front": "front", @@ -470,11 +482,15 @@ Lang.Blocks = { "HAMSTER_set_led_to_1": "Entry.Hamster.setLedTo('", "HAMSTER_set_led_to_2": "','", "HAMSTER_set_led_to_3": "')", + "HAMSTER_left_led": "left", + "HAMSTER_right_led": "right", + "HAMSTER_both_leds": "both", "HAMSTER_clear_led_1": "Entry.Hamster.clearLed('", "HAMSTER_clear_led_2": "')", "HAMSTER_color_cyan": "cyan", "HAMSTER_color_magenta": "magenta", "HAMSTER_color_black": "black", + "HAMSTER_color_white": "white", "HAMSTER_beep": "Entry.Hamster.beep()", "HAMSTER_change_buzzer_by_1": "change buzzer by", "HAMSTER_change_buzzer_by_2": "", @@ -509,15 +525,24 @@ Lang.Blocks = { "HAMSTER_pwm_output": "PwmOutput", "HAMSTER_digital_output": "DigitalOutput", "ALBERT_hand_found": "Entry.Albert.isHandFound()", - "ALBERT_sensor_leftProximity": "Entry.Albert.getLeftProximity()", - "ALBERT_sensor_rightProximity": "Entry.Albert.getRightProximity()", + "ALBERT_is_oid_1": "Entry.Albert.isOidValue('", + "ALBERT_is_oid_2": "',", + "ALBERT_is_oid_3": ")", + "ALBERT_front_oid": "front", + "ALBERT_back_oid": "back", + "ALBERT_sensor_left_proximity": "Entry.Albert.getLeftProximity()", + "ALBERT_sensor_right_proximity": "Entry.Albert.getRightProximity()", + "ALBERT_sensor_acceleration_x": "Entry.Albert.getAccelerationX()", + "ALBERT_sensor_acceleration_y": "Entry.Albert.getAccelerationY()", + "ALBERT_sensor_acceleration_z": "Entry.Albert.getAccelerationZ()", "ALBERT_sensor_light": "Entry.Albert.getLight()", + "ALBERT_sensor_temperature": "Entry.Albert.getTemperature()", "ALBERT_sensor_battery": "Entry.Albert.getBattery()", - "ALBERT_sensor_signalStrength": "Entry.Albert.getSignalStrength()", - "ALBERT_sensor_frontOid": "Entry.Albert.getFrontOid()", - "ALBERT_sensor_backOid": "Entry.Albert.getBackOid()", - "ALBERT_sensor_positionX": "Entry.Albert.getPositionX()", - "ALBERT_sensor_positionY": "Entry.Albert.getPositionY()", + "ALBERT_sensor_signal_strength": "Entry.Albert.getSignalStrength()", + "ALBERT_sensor_front_oid": "Entry.Albert.getFrontOid()", + "ALBERT_sensor_back_oid": "Entry.Albert.getBackOid()", + "ALBERT_sensor_position_x": "Entry.Albert.getPositionX()", + "ALBERT_sensor_position_y": "Entry.Albert.getPositionY()", "ALBERT_sensor_orientation": "Entry.Albert.getOrientation()", "ALBERT_move_forward": "Entry.Albert.moveForward()", "ALBERT_move_backward": "Entry.Albert.moveBackward()", @@ -530,9 +555,14 @@ Lang.Blocks = { "ALBERT_turn_for_secs_1": "Entry.Albert.turnForSecs('", "ALBERT_turn_for_secs_2": "',", "ALBERT_turn_for_secs_3": ")", + "ALBERT_turn_left": "left", + "ALBERT_turn_right": "right", "ALBERT_change_both_wheels_by_1": "Entry.Albert.changeWheelsBy(", "ALBERT_change_both_wheels_by_2": ",", "ALBERT_change_both_wheels_by_3": ")", + "ALBERT_left_wheel": "left", + "ALBERT_right_wheel": "right", + "ALBERT_both_wheels": "both", "ALBERT_set_both_wheels_to_1": "Entry.Albert.setWheelsTo(", "ALBERT_set_both_wheels_to_2": ",", "ALBERT_set_both_wheels_to_3": ")", @@ -543,12 +573,20 @@ Lang.Blocks = { "ALBERT_set_wheel_to_2": "',", "ALBERT_set_wheel_to_3": ")", "ALBERT_stop": "Entry.Albert.stop()", - "ALBERT_set_pad_size_to_1": "Entry.Albert.setPadSizeTo(", - "ALBERT_set_pad_size_to_2": ",", - "ALBERT_set_pad_size_to_3": ")", + "ALBERT_set_board_size_to_1": "Entry.Albert.setPadSizeTo(", + "ALBERT_set_board_size_to_2": ",", + "ALBERT_set_board_size_to_3": ")", + "ALBERT_move_to_x_y_1": "Entry.Albert.moveToOnBoard(", + "ALBERT_move_to_x_y_2": ",", + "ALBERT_move_to_x_y_3": ")", + "ALBERT_set_orientation_to_1": "Entry.Albert.setOrientationToOnBoard(", + "ALBERT_set_orientation_to_2": ")", "ALBERT_set_eye_to_1": "Entry.Albert.setEyeTo('", "ALBERT_set_eye_to_2": "','", "ALBERT_set_eye_to_3": "')", + "ALBERT_left_eye": "left", + "ALBERT_right_eye": "right", + "ALBERT_both_eyes": "both", "ALBERT_clear_eye_1": "Entry.Albert.clearEye('", "ALBERT_clear_eye_2": "')", "ALBERT_body_led_1": "", @@ -557,6 +595,13 @@ Lang.Blocks = { "ALBERT_front_led_2": "front led", "ALBERT_color_cyan": "cyan", "ALBERT_color_magenta": "magenta", + "ALBERT_color_white": "white", + "ALBERT_turn_body_led_1": "Entry.Albert.turnBodyLed('", + "ALBERT_turn_body_led_2": "')", + "ALBERT_turn_front_led_1": "Entry.Albert.turnFrontLed('", + "ALBERT_turn_front_led_2": "')'", + "ALBERT_turn_on": "on", + "ALBERT_turn_off": "off", "ALBERT_beep": "Entry.Albert.beep()", "ALBERT_change_buzzer_by_1": "Entry.Albert.changeBuzzerBy(", "ALBERT_change_buzzer_by_2": ")", @@ -840,6 +885,17 @@ Lang.Buttons = { }; Lang.ko = "한국어"; Lang.Menus = { + "select_share_settings": "공유 공간을 선택해주세요.", + "major_updates": "주요 업데이트 안내", + "check_new_update": "엔트리의 변화를 확인하세요.", + "major_updates_notification": "엔트리의 주요 변경사항을 공지를 통해 안내해 드리고 있습니다.", + "find_out_now": "지금 바로 확인하세요!", + "offline_hw_program": "오프라인 & 하드웨어 연결 프로그램", + "read_more": "자세히 보기", + "not_supported_function": "이 기기에서는 지원하지 않는 기능입니다.", + "offline_download_confirm": "엔트리 오프라인 버전은 PC에서만 이용가능합니다. 다운로드 하시겠습니까?", + "copy_text": "텍스트를 복사하세요.", + "select_openArea_space": "작품 공유 공간을 선택해 주세요", "mission_guide": "미션 해결하기 안내", "of": " 의", "no_results_found": "검색 결과가 없습니다.", @@ -907,18 +963,24 @@ Lang.Menus = { "edit_done": "수정 완료되었습니다.", "alert_group_out": "학급을 정말 나가시겠습니까?", "lesson_share_cancel": "강의 공유 취소", + "project_share_cancel": "작품 공유 취소", "lesson_share_cancel_alert": "이(가) 공유된 모든 공간에서 공유를 취소하고 <나만보기>로 변경하시겠습니까? ", "lesson_share_cancel_alert_en": "", "course_share_cancel": "강의 모음 공유 취소", - "select_lesson_share": "강의 공유 선택", - "select_lesson_share_policy_1": "강의를 공유할 공간과", + "select_lesson_share": "강의 공유 공간 선택", + "select_project_share": "작품 공유 선택", + "select_lesson_share_policy_1": "강의를 공유할", + "select_lesson_share_policyAdd": "공간을 선택해 주세요", + "select_lesson_share_project_1": "작품을 공유할 공간과", "select_lesson_share_policy_2": "저작권 정책을 확인해 주세요.", "select_lesson_share_area": "강의 공유 공간을 선택해 주세요", + "select_project_share_area": "작품 공유 공간을 선택해 주세요", "lesson_share_policy": "강의 공유에 따른 엔트리 저작권 정책 동의", + "project_share_policy": "작품 공유에 따른 엔트리 저작권 정책 동의", "alert_agree_share": "공개하려면 엔트리 저작물 정책에 동의하여야 합니다.", "alert_agree_all": "모든 항목에 동의해 주세요.", - "select_course_share": "강의 모음 공유 선택", - "select_course_share_policy_1": "강의 모음을 공유할 공간과", + "select_course_share": "강의 모음 공유 공간 선택", + "select_course_share_policy_1": "강의 모음을 공유할", "select_course_share_policy_2": "저작권 정책을 확인해 주세요.", "select_course_share_area": "강의 모음 공유 공간을 선택해 주세요", "course_share_policy": "강의 모음 공유에 따른 엔트리 저작권 정책 동의", @@ -1179,6 +1241,9 @@ Lang.Menus = { "no_studying_lecture_collect_1": "학습 중인 강의 모음이 없습니다.", "no_studying_lecture_collect_2": "'오픈 강의'에서 학습을 시작해보세요!", "my_lecture": "나의 강의", + "markedGroup": "학급 관심", + "markedGroup_lecture": "학급 관심 강의", + "markedGroup_curriculum": "학급 관심 강의모음", "marked_lecture": "관심 강의", "marked_lecture_collection": "나의 관심 강의 모음", "marked_marked_curriculum": "관심 강의 모음", @@ -1223,8 +1288,11 @@ Lang.Menus = { "entry_x_hardware": "엔트리 X 하드웨어 교육자료 모음", "e_sensor": "E 센서보드", "arduino": "아두이노", + "arduinoExt": "아두이노 Uno 확장모드", "orange_board": "오렌지보드", "joystick": "오렌지보드(조이스틱)", + "ardublock": "아두블럭", + "codingtoolbox": "코딩툴박스", "materials_etc_all": "기타 교육자료 모음", "materials_teaching": "교원 연수 자료", "materials_etc": "기타 참고 자료", @@ -2604,9 +2672,7 @@ Lang.Menus = { "group_add_course_3": "추가하고 싶은 강의 모음을 관심 강의 모음으로 등록해 주세요.", "group_add_course_4": "강의 모음 보기", "hw_main_title": "프로그램 다운로드", - "hw_desc_wrapper_1": "엔트리 하드웨어 연결 프로그램과 오프라인 버전이", - "hw_desc_wrapper_2": "서비스를 한층 더 강화해 업그레이드 되었습니다.", - "hw_desc_wrapper_3": "업데이트 된 프로그램을 설치해주세요!", + "hw_desc_wrapper": "엔트리 하드웨어 연결 프로그램과 오프라인 버전이 \n서비스를 한층 더 강화해 업그레이드 되었습니다.\n업데이트 된 프로그램을 설치해주세요!", "hw_downolad_link": "하드웨어 연결 \n프로그램 다운로드", "save_as_image_all": "모든 코드 이미지로 저장하기", "save_as_image": "이미지로 저장하기" @@ -2862,6 +2928,7 @@ Lang.Workspace = { "Scene_add_error": "장면은 최대 10개까지 추가 가능합니다.", "replica_of_object": "의 복제본", "will_you_delete_scene": "장면은 한번 삭제하면 취소가 불가능 합니다. \n정말 삭제 하시겠습니까?", + "will_you_delete_function": "함수는 한번 삭제하면 취소가 불가능 합니다. \n정말 삭제 하시겠습니까?", "duplicate_scene": "복제하기", "block_explain": "블록 설명 ", "block_intro": "블록을 클릭하면 블록에 대한 설명이 나타납니다.", @@ -2901,9 +2968,15 @@ Lang.Workspace = { }; Lang.code = "코드보기"; Lang.EntryStatic = { - "group": "학급 학습하기", + "groupProject": "학급 공유하기", + "privateProject": "나만보기", + "privateCurriculum": "나만보기", + "publicCurriculum": "강의 모음 공유하기", + "publicProject": "작품 공유하기", + "group": "학급 공유하기", + "groupCurriculum": "학급 공유하기", "private": "나만보기", - "public": "오픈 강의", + "public": "강의 공유하기", "lecture_is_open_true": "공개", "lecture_is_open_false": "비공개", "category_all": "모든 작품", @@ -2918,6 +2991,7 @@ Lang.EntryStatic = { "category_category_physical": "피지컬", "category_category_etc": "기타", "sort_created": "최신순", + "sort_updated": "최신순", "sort_visit": "조회순", "sort_likeCnt": "좋아요순", "sort_comment": "댓글순", diff --git a/extern/lang/en.js b/extern/lang/en.js index 7fdd8ae161..e9079b241d 100644 --- a/extern/lang/en.js +++ b/extern/lang/en.js @@ -418,21 +418,23 @@ Lang.Blocks = { "VARIABLE_value_of_index_from_list_2": "", "VARIABLE_value_of_index_from_list_3": "th element", "HAMSTER_hand_found": "hand found?", - "HAMSTER_sensor_leftProximity": "left proximity", - "HAMSTER_sensor_rightProximity": "right proximity", - "HAMSTER_sensor_leftFloor": "left floor", - "HAMSTER_sensor_rightFloor": "right floor", - "HAMSTER_sensor_accelerationX": "x acceleration", - "HAMSTER_sensor_accelerationY": "y acceleration", - "HAMSTER_sensor_accelerationZ": "z acceleration", + "HAMSTER_sensor_left_proximity": "left proximity", + "HAMSTER_sensor_right_proximity": "right proximity", + "HAMSTER_sensor_left_floor": "left floor", + "HAMSTER_sensor_right_floor": "right floor", + "HAMSTER_sensor_acceleration_x": "x acceleration", + "HAMSTER_sensor_acceleration_y": "y acceleration", + "HAMSTER_sensor_acceleration_z": "z acceleration", "HAMSTER_sensor_light": "light", "HAMSTER_sensor_temperature": "temperature", - "HAMSTER_sensor_signalStrength": "signal strength", - "HAMSTER_sensor_inputA": "input A", - "HAMSTER_sensor_inputB": "input B", + "HAMSTER_sensor_signal_strength": "signal strength", + "HAMSTER_sensor_input_a": "input A", + "HAMSTER_sensor_input_b": "input B", "HAMSTER_move_forward_once": "move forward once on board", "HAMSTER_turn_once_1": "turn", "HAMSTER_turn_once_2": "once on board", + "HAMSTER_turn_once_left": "left", + "HAMSTER_turn_right": "right", "HAMSTER_move_forward": "move forward", "HAMSTER_move_backward": "move backward", "HAMSTER_turn_around_1": "turn", @@ -453,15 +455,25 @@ Lang.Blocks = { "HAMSTER_change_wheel_by_1": "change", "HAMSTER_change_wheel_by_2": "wheel by", "HAMSTER_change_wheel_by_3": "", + "HAMSTER_left_wheel": "left wheel", + "HAMSTER_right_wheel": "right wheel", + "HAMSTER_both_wheels": "both wheels", "HAMSTER_set_wheel_to_1": "set", "HAMSTER_set_wheel_to_2": "wheel to", "HAMSTER_set_wheel_to_3": "", "HAMSTER_follow_line_using_1": "follow", "HAMSTER_follow_line_using_2": "line using", "HAMSTER_follow_line_using_3": "floor sensor", + "HAMSTER_left_floor_sensor": "left floor", + "HAMSTER_right_floor_sensor": "right floor", + "HAMSTER_both_floor_sensors": "both floors", "HAMSTER_follow_line_until_1": "follow", "HAMSTER_follow_line_until_2": "line until", "HAMSTER_follow_line_until_3": "intersection", + "HAMSTER_left_intersection": "left", + "HAMSTER_right_intersection": "right", + "HAMSTER_front_intersection": "front", + "HAMSTER_rear_intersection": "rear", "HAMSTER_set_following_speed_to_1": "set following speed to", "HAMSTER_set_following_speed_to_2": "", "HAMSTER_front": "front", @@ -470,11 +482,15 @@ Lang.Blocks = { "HAMSTER_set_led_to_1": "set", "HAMSTER_set_led_to_2": "led to", "HAMSTER_set_led_to_3": "", + "HAMSTER_left_led": "left led", + "HAMSTER_right_led": "right led", + "HAMSTER_both_leds": "both leds", "HAMSTER_clear_led_1": "clear", "HAMSTER_clear_led_2": "led", "HAMSTER_color_cyan": "cyan", "HAMSTER_color_magenta": "magenta", "HAMSTER_color_black": "black", + "HAMSTER_color_white": "white", "HAMSTER_beep": "beep", "HAMSTER_change_buzzer_by_1": "change buzzer by", "HAMSTER_change_buzzer_by_2": "", @@ -509,15 +525,24 @@ Lang.Blocks = { "HAMSTER_pwm_output": "pwm output", "HAMSTER_digital_output": "digital output", "ALBERT_hand_found": "hand found?", - "ALBERT_sensor_leftProximity": "left proximity", - "ALBERT_sensor_rightProximity": "right proximity", + "ALBERT_is_oid_1": "is", + "ALBERT_is_oid_2": "oid", + "ALBERT_is_oid_3": "?", + "ALBERT_front_oid": "front", + "ALBERT_back_oid": "back", + "ALBERT_sensor_left_proximity": "left proximity", + "ALBERT_sensor_right_proximity": "right proximity", + "ALBERT_sensor_acceleration_x": "x acceleration", + "ALBERT_sensor_acceleration_y": "y acceleration", + "ALBERT_sensor_acceleration_z": "z acceleration", "ALBERT_sensor_light": "light", + "ALBERT_sensor_temperature": "temperature", "ALBERT_sensor_battery": "battery", - "ALBERT_sensor_signalStrength": "signal strength", - "ALBERT_sensor_frontOid": "front oid", - "ALBERT_sensor_backOid": "back oid", - "ALBERT_sensor_positionX": "x position", - "ALBERT_sensor_positionY": "y position", + "ALBERT_sensor_signal_strength": "signal strength", + "ALBERT_sensor_front_oid": "front oid", + "ALBERT_sensor_back_oid": "back oid", + "ALBERT_sensor_position_x": "x position", + "ALBERT_sensor_position_y": "y position", "ALBERT_sensor_orientation": "orientation", "ALBERT_move_forward": "move forward", "ALBERT_move_backward": "move backward", @@ -530,9 +555,14 @@ Lang.Blocks = { "ALBERT_turn_for_secs_1": "turn", "ALBERT_turn_for_secs_2": "for", "ALBERT_turn_for_secs_3": "secs", + "ALBERT_turn_left": "left", + "ALBERT_turn_right": "right", "ALBERT_change_both_wheels_by_1": "change wheels by left:", "ALBERT_change_both_wheels_by_2": "right:", "ALBERT_change_both_wheels_by_3": "", + "ALBERT_left_wheel": "left wheel", + "ALBERT_right_wheel": "right wheel", + "ALBERT_both_wheels": "both wheels", "ALBERT_set_both_wheels_to_1": "set wheels to left:", "ALBERT_set_both_wheels_to_2": "right:", "ALBERT_set_both_wheels_to_3": "", @@ -543,12 +573,20 @@ Lang.Blocks = { "ALBERT_set_wheel_to_2": "wheel to", "ALBERT_set_wheel_to_3": "", "ALBERT_stop": "stop", - "ALBERT_set_pad_size_to_1": "set pad size to width:", - "ALBERT_set_pad_size_to_2": "height:", - "ALBERT_set_pad_size_to_3": "", + "ALBERT_set_board_size_to_1": "set pad size to width:", + "ALBERT_set_board_size_to_2": "height:", + "ALBERT_set_board_size_to_3": "", + "ALBERT_move_to_x_y_1": "move to x:", + "ALBERT_move_to_x_y_2": "y:", + "ALBERT_move_to_x_y_3": "on board", + "ALBERT_set_orientation_to_1": "set orientation to", + "ALBERT_set_orientation_to_2": "on board", "ALBERT_set_eye_to_1": "set", "ALBERT_set_eye_to_2": "eye to", "ALBERT_set_eye_to_3": "", + "ALBERT_left_eye": "left eye", + "ALBERT_right_eye": "right eye", + "ALBERT_both_eyes": "both eyes", "ALBERT_clear_eye_1": "clear", "ALBERT_clear_eye_2": "eye", "ALBERT_body_led_1": "", @@ -557,6 +595,13 @@ Lang.Blocks = { "ALBERT_front_led_2": "front led", "ALBERT_color_cyan": "cyan", "ALBERT_color_magenta": "magenta", + "ALBERT_color_white": "white", + "ALBERT_turn_body_led_1": "turn", + "ALBERT_turn_body_led_2": "body led", + "ALBERT_turn_front_led_1": "turn", + "ALBERT_turn_front_led_2": "front led", + "ALBERT_turn_on": "on", + "ALBERT_turn_off": "off", "ALBERT_beep": "beep", "ALBERT_change_buzzer_by_1": "change buzzer by", "ALBERT_change_buzzer_by_2": ")", @@ -840,6 +885,17 @@ Lang.Buttons = { }; Lang.ko = "한국어"; Lang.Menus = { + "select_share_settings": "Select share settings", + "major_updates": "Major updates", + "check_new_update": "Check out\nEntry's new updates", + "major_updates_notification": "Entry's major updates are announced by notification. ", + "find_out_now": "Find out now!", + "offline_hw_program": "Offline and Hardware Connection Program", + "read_more": "read more", + "not_supported_function": "This tablet does not support this feature.", + "offline_download_confirm": "Entry Offline Editor is available for Windows OS. Would you like to download?", + "copy_text": "Copy text.", + "select_openArea_space": "Select share settings", "mission_guide": "Mission guide", "of": " 's ", "no_results_found": "No results found", @@ -907,14 +963,20 @@ Lang.Menus = { "edit_done": "Edit complete", "alert_group_out": "Do you want to leave the class?", "lesson_share_cancel": "Cancel Sharing Lesson", + "project_share_cancel": "Cancel Sharing Project", "lesson_share_cancel_alert": "and change share settings to Private view?", "lesson_share_cancel_alert_en": "Do you want to stop sharing ", "course_share_cancel": "Cancel Sharing Courseware", "select_lesson_share": "Select lesson to share", + "select_project_share": "Select project to share", "select_lesson_share_policy_1": "Please check share settings", + "select_lesson_share_policyAdd": "Please check share settings", + "select_lesson_share_project_1": "Please check share settings", "select_lesson_share_policy_2": "and copyright policies", "select_lesson_share_area": "Select share settings", + "select_project_share_area": "Select share settings", "lesson_share_policy": "I agree to Entry's Copyright Policies.", + "project_share_policy": "I agree to Entry's Copyright Policies.", "alert_agree_share": "To share publicly, you must agree to Entry's copyright policies", "alert_agree_all": "Agree to all items", "select_course_share": "Select courseware to share", @@ -1179,6 +1241,9 @@ Lang.Menus = { "no_studying_lecture_collect_1": "There are no courseware to show.", "no_studying_lecture_collect_2": "Start learning from 'Open lessons' section!", "my_lecture": "My lessons", + "markedGroup": "Favorite group", + "markedGroup_lecture": "Favorite group lessons", + "markedGroup_curriculum": "Favorite group curriculum", "marked_lecture": "Favorite lessons", "marked_lecture_collection": "My courseware", "marked_marked_curriculum": "My courseware", @@ -1223,8 +1288,11 @@ Lang.Menus = { "entry_x_hardware": "Entry Hardware Educational Materials", "e_sensor": "E Sensorboard", "arduino": "Arduino", + "arduinoExt": "ArduinoExt Uno", "orange_board": "orangeBoard", "joystick": "orangeBoard(joystick)", + "ardublock": "ardublock", + "codingtoolbox": "codingtoolbox", "materials_etc_all": "Other Educational Materials", "materials_teaching": "For Teacher Education", "materials_etc": "Other Resources", @@ -2126,7 +2194,7 @@ Lang.Menus = { "offline_description_3": "Download and try it out!", "sw_week_2015": "2015 소프트웨어교육 체험 주간", "cparty_desc": "두근두근 소프트웨어와의 첫만남", - "entry_offline_download": "엔트리 오프라인 \n다운로드", + "entry_offline_download": "Download \nOffline Editor", "offline_desc_1": "Install and use Entry Offline Editor without internet connection.", "offline_desc_2": "Download and try it out!", "download": "download", @@ -2603,11 +2671,9 @@ Lang.Menus = { "group_add_course_2": "Favorite lessons you want to add as course assignment from", "group_add_course_3": "'Learn > Open Lessons > Courseware", "group_add_course_4": "Browse courseware", - "hw_main_title": "프로그램 다운로드", - "hw_desc_wrapper_1": "엔트리 하드웨어 연결 프로그램과 오프라인 버전이", - "hw_desc_wrapper_2": "서비스를 한층 더 강화해 업그레이드 되었습니다.", - "hw_desc_wrapper_3": "업데이트 된 프로그램을 설치해주세요!", - "hw_downolad_link": "하드웨어 연결 \n프로그램 다운로드", + "hw_main_title": "Download Program", + "hw_desc_wrapper": "Install the Upgraded \nEntry Hardware Connection Program\nand Offline Editor", + "hw_downolad_link": "Download Hardware Connection Program", "save_as_image_all": "Save code as image", "save_as_image": "Save as image" }; @@ -2862,6 +2928,7 @@ Lang.Workspace = { "Scene_add_error": "The scene is up to 10.", "replica_of_object": "'s replicas", "will_you_delete_scene": "Deleting scene can not be restored.\nAre you sure you want to delete scene?", + "will_you_delete_function": "Deleting function can not be restored.\nAre you sure you want to delete function?", "duplicate_scene": "duplicate", "block_explain": "Block description ", "block_intro": "Clicking on the block comes the description of the block . ", @@ -2901,7 +2968,13 @@ Lang.Workspace = { }; Lang.code = "view code"; Lang.EntryStatic = { + "groupProject": "open group", + "privateProject": "only owner", + "privateCurriculum": "only owner", + "publicCurriculum": "curriculum share", + "publicProject": "project share", "group": "open group", + "groupCurriculum": "open group", "private": "only owner", "public": "open lessons", "lecture_is_open_true": "open", @@ -2918,6 +2991,7 @@ Lang.EntryStatic = { "category_category_physical": "Physical", "category_category_etc": "etc", "sort_created": "By Latest", + "sort_updated": "By Latest", "sort_visit": "By Viewers", "sort_likeCnt": "By Likes", "sort_comment": "By Comments", diff --git a/extern/lang/ko.js b/extern/lang/ko.js index 19d3b13624..ef809c7e78 100644 --- a/extern/lang/ko.js +++ b/extern/lang/ko.js @@ -418,21 +418,23 @@ Lang.Blocks = { "VARIABLE_value_of_index_from_list_2": "의", "VARIABLE_value_of_index_from_list_3": "번째 항목", "HAMSTER_hand_found": "손 찾음?", - "HAMSTER_sensor_leftProximity": "왼쪽 근접 센서", - "HAMSTER_sensor_rightProximity": "오른쪽 근접 센서", - "HAMSTER_sensor_leftFloor": "왼쪽 바닥 센서", - "HAMSTER_sensor_rightFloor": "오른쪽 바닥 센서", - "HAMSTER_sensor_accelerationX": "x축 가속도", - "HAMSTER_sensor_accelerationY": "y축 가속도", - "HAMSTER_sensor_accelerationZ": "z축 가속도", + "HAMSTER_sensor_left_proximity": "왼쪽 근접 센서", + "HAMSTER_sensor_right_proximity": "오른쪽 근접 센서", + "HAMSTER_sensor_left_floor": "왼쪽 바닥 센서", + "HAMSTER_sensor_right_floor": "오른쪽 바닥 센서", + "HAMSTER_sensor_acceleration_x": "x축 가속도", + "HAMSTER_sensor_acceleration_y": "y축 가속도", + "HAMSTER_sensor_acceleration_z": "z축 가속도", "HAMSTER_sensor_light": "밝기", "HAMSTER_sensor_temperature": "온도", - "HAMSTER_sensor_signalStrength": "신호 세기", - "HAMSTER_sensor_inputA": "입력 A", - "HAMSTER_sensor_inputB": "입력 B", + "HAMSTER_sensor_signal_strength": "신호 세기", + "HAMSTER_sensor_input_a": "입력 A", + "HAMSTER_sensor_input_b": "입력 B", "HAMSTER_move_forward_once": "말판 앞으로 한 칸 이동하기", "HAMSTER_turn_once_1": "말판", "HAMSTER_turn_once_2": "으로 한 번 돌기", + "HAMSTER_turn_once_left": "왼쪽", + "HAMSTER_turn_right": "오른쪽", "HAMSTER_move_forward": "앞으로 이동하기", "HAMSTER_move_backward": "뒤로 이동하기", "HAMSTER_turn_around_1": "", @@ -453,15 +455,25 @@ Lang.Blocks = { "HAMSTER_change_wheel_by_1": "", "HAMSTER_change_wheel_by_2": "바퀴", "HAMSTER_change_wheel_by_3": "만큼 바꾸기", + "HAMSTER_left_wheel": "왼쪽", + "HAMSTER_right_wheel": "오른쪽", + "HAMSTER_both_wheels": "양쪽", "HAMSTER_set_wheel_to_1": "", "HAMSTER_set_wheel_to_2": "바퀴", "HAMSTER_set_wheel_to_3": "(으)로 정하기", "HAMSTER_follow_line_using_1": "", "HAMSTER_follow_line_using_2": "선을", "HAMSTER_follow_line_using_3": "바닥 센서로 따라가기", + "HAMSTER_left_floor_sensor": "왼쪽", + "HAMSTER_right_floor_sensor": "오른쪽", + "HAMSTER_both_floor_sensors": "양쪽", "HAMSTER_follow_line_until_1": "", "HAMSTER_follow_line_until_2": "선을 따라", "HAMSTER_follow_line_until_3": "교차로까지 이동하기", + "HAMSTER_left_intersection": "왼쪽", + "HAMSTER_right_intersection": "오른쪽", + "HAMSTER_front_intersection": "앞쪽", + "HAMSTER_rear_intersection": "뒤쪽", "HAMSTER_set_following_speed_to_1": "선 따라가기 속도를", "HAMSTER_set_following_speed_to_2": "(으)로 정하기", "HAMSTER_front": "앞쪽", @@ -470,11 +482,15 @@ Lang.Blocks = { "HAMSTER_set_led_to_1": "", "HAMSTER_set_led_to_2": "LED를", "HAMSTER_set_led_to_3": "으로 정하기", + "HAMSTER_left_led": "왼쪽", + "HAMSTER_right_led": "오른쪽", + "HAMSTER_both_leds": "양쪽", "HAMSTER_clear_led_1": "", "HAMSTER_clear_led_2": "LED 끄기", "HAMSTER_color_cyan": "하늘색", "HAMSTER_color_magenta": "보라색", "HAMSTER_color_black": "검은색", + "HAMSTER_color_white": "하얀색", "HAMSTER_beep": "삐 소리내기", "HAMSTER_change_buzzer_by_1": "버저 음을", "HAMSTER_change_buzzer_by_2": "만큼 바꾸기", @@ -489,8 +505,8 @@ Lang.Blocks = { "HAMSTER_rest_for_2": "박자 쉬기", "HAMSTER_change_tempo_by_1": "연주 속도를", "HAMSTER_change_tempo_by_2": "만큼 바꾸기", - "HAMSTER_set_tempo_to_1": "연주 속도를", - "HAMSTER_set_tempo_to_2": "BPM으로 정하기", + "HAMSTER_set_tempo_to_1": "연주 속도를 분당", + "HAMSTER_set_tempo_to_2": "박자로 정하기", "HAMSTER_set_port_to_1": "포트", "HAMSTER_set_port_to_2": "를", "HAMSTER_set_port_to_3": "으로 정하기", @@ -509,15 +525,24 @@ Lang.Blocks = { "HAMSTER_pwm_output": "PWM 출력", "HAMSTER_digital_output": "디지털 출력", "ALBERT_hand_found": "손 찾음?", - "ALBERT_sensor_leftProximity": "왼쪽 근접 센서", - "ALBERT_sensor_rightProximity": "오른쪽 근접 센서", + "ALBERT_is_oid_1": "", + "ALBERT_is_oid_2": "OID 값이", + "ALBERT_is_oid_3": "인가?", + "ALBERT_front_oid": "앞쪽", + "ALBERT_back_oid": "뒤쪽", + "ALBERT_sensor_left_proximity": "왼쪽 근접 센서", + "ALBERT_sensor_right_proximity": "오른쪽 근접 센서", + "ALBERT_sensor_acceleration_x": "x축 가속도", + "ALBERT_sensor_acceleration_y": "y축 가속도", + "ALBERT_sensor_acceleration_z": "z축 가속도", "ALBERT_sensor_light": "밝기", + "ALBERT_sensor_temperature": "온도", "ALBERT_sensor_battery": "배터리", - "ALBERT_sensor_signalStrength": "신호 세기", - "ALBERT_sensor_frontOid": "앞쪽 OID", - "ALBERT_sensor_backOid": "뒤쪽 OID", - "ALBERT_sensor_positionX": "x 위치", - "ALBERT_sensor_positionY": "y 위치", + "ALBERT_sensor_signal_strength": "신호 세기", + "ALBERT_sensor_front_oid": "앞쪽 OID", + "ALBERT_sensor_back_oid": "뒤쪽 OID", + "ALBERT_sensor_position_x": "x 위치", + "ALBERT_sensor_position_y": "y 위치", "ALBERT_sensor_orientation": "방향", "ALBERT_move_forward": "앞으로 이동하기", "ALBERT_move_backward": "뒤로 이동하기", @@ -530,9 +555,14 @@ Lang.Blocks = { "ALBERT_turn_for_secs_1": "", "ALBERT_turn_for_secs_2": "으로", "ALBERT_turn_for_secs_3": "초 돌기", + "ALBERT_turn_left": "왼쪽", + "ALBERT_turn_right": "오른쪽", "ALBERT_change_both_wheels_by_1": "왼쪽 바퀴", "ALBERT_change_both_wheels_by_2": "오른쪽 바퀴", "ALBERT_change_both_wheels_by_3": "만큼 바꾸기", + "ALBERT_left_wheel": "왼쪽", + "ALBERT_right_wheel": "오른쪽", + "ALBERT_both_wheels": "양쪽", "ALBERT_set_both_wheels_to_1": "왼쪽 바퀴", "ALBERT_set_both_wheels_to_2": "오른쪽 바퀴", "ALBERT_set_both_wheels_to_3": "(으)로 정하기", @@ -543,12 +573,20 @@ Lang.Blocks = { "ALBERT_set_wheel_to_2": "바퀴", "ALBERT_set_wheel_to_3": "(으)로 정하기", "ALBERT_stop": "정지하기", - "ALBERT_set_pad_size_to_1": "패드 크기를 폭", - "ALBERT_set_pad_size_to_2": "높이", - "ALBERT_set_pad_size_to_3": "(으)로 정하기", + "ALBERT_set_board_size_to_1": "말판 크기를 폭", + "ALBERT_set_board_size_to_2": "높이", + "ALBERT_set_board_size_to_3": "(으)로 정하기", + "ALBERT_move_to_x_y_1": "말판 x:", + "ALBERT_move_to_x_y_2": "y:", + "ALBERT_move_to_x_y_3": "위치로 이동하기", + "ALBERT_set_orientation_to_1": "말판", + "ALBERT_set_orientation_to_2": "방향으로 바라보기", "ALBERT_set_eye_to_1": "", "ALBERT_set_eye_to_2": "눈을", "ALBERT_set_eye_to_3": "으로 정하기", + "ALBERT_left_eye": "왼쪽", + "ALBERT_right_eye": "오른쪽", + "ALBERT_both_eyes": "양쪽", "ALBERT_clear_eye_1": "", "ALBERT_clear_eye_2": "눈 끄기", "ALBERT_body_led_1": "몸통 LED", @@ -557,6 +595,13 @@ Lang.Blocks = { "ALBERT_front_led_2": "", "ALBERT_color_cyan": "하늘색", "ALBERT_color_magenta": "보라색", + "ALBERT_color_white": "하얀색", + "ALBERT_turn_body_led_1": "몸통 LED", + "ALBERT_turn_body_led_2": "", + "ALBERT_turn_front_led_1": "앞쪽 LED", + "ALBERT_turn_front_led_2": "", + "ALBERT_turn_on": "켜기", + "ALBERT_turn_off": "끄기", "ALBERT_beep": "삐 소리내기", "ALBERT_change_buzzer_by_1": "버저 음을", "ALBERT_change_buzzer_by_2": "만큼 바꾸기", @@ -571,8 +616,8 @@ Lang.Blocks = { "ALBERT_rest_for_2": "박자 쉬기", "ALBERT_change_tempo_by_1": "연주 속도를", "ALBERT_change_tempo_by_2": "만큼 바꾸기", - "ALBERT_set_tempo_to_1": "연주 속도를", - "ALBERT_set_tempo_to_2": "BPM으로 정하기", + "ALBERT_set_tempo_to_1": "연주 속도를 분당", + "ALBERT_set_tempo_to_2": "박자로 정하기", "VARIABLE_variable": "변수", "wall": "벽", "robotis_common_case_01": "(을)를", @@ -840,6 +885,17 @@ Lang.Buttons = { }; Lang.ko = "한국어"; Lang.Menus = { + "select_share_settings": "공유 공간을 선택해주세요.", + "major_updates": "주요 업데이트 안내", + "check_new_update": "엔트리의 변화를 확인하세요.", + "major_updates_notification": "엔트리의 주요 변경사항을 공지를 통해 안내해 드리고 있습니다.", + "find_out_now": "지금 바로 확인하세요!", + "offline_hw_program": "오프라인 & 하드웨어 연결 프로그램", + "read_more": "자세히 보기", + "not_supported_function": "이 기기에서는 지원하지 않는 기능입니다.", + "offline_download_confirm": "엔트리 오프라인 버전은 PC에서만 이용가능합니다. 다운로드 하시겠습니까?", + "copy_text": "텍스트를 복사하세요.", + "select_openArea_space": "작품 공유 공간을 선택해 주세요", "mission_guide": "미션 해결하기 안내", "of": " 의", "no_results_found": "검색 결과가 없습니다.", @@ -907,18 +963,24 @@ Lang.Menus = { "edit_done": "수정 완료되었습니다.", "alert_group_out": "학급을 정말 나가시겠습니까?", "lesson_share_cancel": "강의 공유 취소", + "project_share_cancel": "작품 공유 취소", "lesson_share_cancel_alert": "이(가) 공유된 모든 공간에서 공유를 취소하고 <나만보기>로 변경하시겠습니까? ", "lesson_share_cancel_alert_en": "", "course_share_cancel": "강의 모음 공유 취소", - "select_lesson_share": "강의 공유 선택", - "select_lesson_share_policy_1": "강의를 공유할 공간과", + "select_lesson_share": "강의 공유 공간 선택", + "select_project_share": "작품 공유 선택", + "select_lesson_share_policy_1": "강의를 공유할", + "select_lesson_share_policyAdd": "공간을 선택해 주세요", + "select_lesson_share_project_1": "작품을 공유할 공간과", "select_lesson_share_policy_2": "저작권 정책을 확인해 주세요.", "select_lesson_share_area": "강의 공유 공간을 선택해 주세요", + "select_project_share_area": "작품 공유 공간을 선택해 주세요", "lesson_share_policy": "강의 공유에 따른 엔트리 저작권 정책 동의", + "project_share_policy": "작품 공유에 따른 엔트리 저작권 정책 동의", "alert_agree_share": "공개하려면 엔트리 저작물 정책에 동의하여야 합니다.", "alert_agree_all": "모든 항목에 동의해 주세요.", - "select_course_share": "강의 모음 공유 선택", - "select_course_share_policy_1": "강의 모음을 공유할 공간과", + "select_course_share": "강의 모음 공유 공간 선택", + "select_course_share_policy_1": "강의 모음을 공유할", "select_course_share_policy_2": "저작권 정책을 확인해 주세요.", "select_course_share_area": "강의 모음 공유 공간을 선택해 주세요", "course_share_policy": "강의 모음 공유에 따른 엔트리 저작권 정책 동의", @@ -1179,6 +1241,9 @@ Lang.Menus = { "no_studying_lecture_collect_1": "학습 중인 강의 모음이 없습니다.", "no_studying_lecture_collect_2": "'오픈 강의'에서 학습을 시작해보세요!", "my_lecture": "나의 강의", + "markedGroup": "학급 관심", + "markedGroup_lecture": "학급 관심 강의", + "markedGroup_curriculum": "학급 관심 강의모음", "marked_lecture": "관심 강의", "marked_lecture_collection": "나의 관심 강의 모음", "marked_marked_curriculum": "관심 강의 모음", @@ -1223,8 +1288,11 @@ Lang.Menus = { "entry_x_hardware": "엔트리 X 하드웨어 교육자료 모음", "e_sensor": "E 센서보드", "arduino": "아두이노", + "arduinoExt": "아두이노 Uno 확장모드", "orange_board": "오렌지보드", "joystick": "오렌지보드(조이스틱)", + "ardublock": "아두블럭", + "codingtoolbox": "코딩툴박스", "materials_etc_all": "기타 교육자료 모음", "materials_teaching": "교원 연수 자료", "materials_etc": "기타 참고 자료", @@ -2604,9 +2672,7 @@ Lang.Menus = { "group_add_course_3": "추가하고 싶은 강의 모음을 관심 강의 모음으로 등록해 주세요.", "group_add_course_4": "강의 모음 보기", "hw_main_title": "프로그램 다운로드", - "hw_desc_wrapper_1": "엔트리 하드웨어 연결 프로그램과 오프라인 버전이", - "hw_desc_wrapper_2": "서비스를 한층 더 강화해 업그레이드 되었습니다.", - "hw_desc_wrapper_3": "업데이트 된 프로그램을 설치해주세요!", + "hw_desc_wrapper": "엔트리 하드웨어 연결 프로그램과 오프라인 버전이 \n서비스를 한층 더 강화해 업그레이드 되었습니다.\n업데이트 된 프로그램을 설치해주세요!", "hw_downolad_link": "하드웨어 연결 \n프로그램 다운로드", "save_as_image_all": "모든 코드 이미지로 저장하기", "save_as_image": "이미지로 저장하기" @@ -2862,6 +2928,7 @@ Lang.Workspace = { "Scene_add_error": "장면은 최대 10개까지 추가 가능합니다.", "replica_of_object": "의 복제본", "will_you_delete_scene": "장면은 한번 삭제하면 취소가 불가능 합니다. \n정말 삭제 하시겠습니까?", + "will_you_delete_function": "함수는 한번 삭제하면 취소가 불가능 합니다. \n정말 삭제 하시겠습니까?", "duplicate_scene": "복제하기", "block_explain": "블록 설명 ", "block_intro": "블록을 클릭하면 블록에 대한 설명이 나타납니다.", @@ -2901,9 +2968,15 @@ Lang.Workspace = { }; Lang.code = "코드보기"; Lang.EntryStatic = { - "group": "학급 학습하기", + "groupProject": "학급 공유하기", + "privateProject": "나만보기", + "privateCurriculum": "나만보기", + "publicCurriculum": "강의 모음 공유하기", + "publicProject": "작품 공유하기", + "group": "학급 공유하기", + "groupCurriculum": "학급 공유하기", "private": "나만보기", - "public": "오픈 강의", + "public": "강의 공유하기", "lecture_is_open_true": "공개", "lecture_is_open_false": "비공개", "category_all": "모든 작품", @@ -2918,6 +2991,7 @@ Lang.EntryStatic = { "category_category_physical": "피지컬", "category_category_etc": "기타", "sort_created": "최신순", + "sort_updated": "최신순", "sort_visit": "조회순", "sort_likeCnt": "좋아요순", "sort_comment": "댓글순", From 30e2ef25794d7f20561966666c8227e3e19e5008 Mon Sep 17 00:00:00 2001 From: chanlee Date: Tue, 16 Aug 2016 19:00:12 +0900 Subject: [PATCH 10/15] add legacy blocks --- src/blocks/block_albert.js | 716 ++++++------ src/blocks/block_hamster.js | 2083 +++++++++++++++++------------------ 2 files changed, 1411 insertions(+), 1388 deletions(-) diff --git a/src/blocks/block_albert.js b/src/blocks/block_albert.js index 5f4dca0443..c26d856967 100644 --- a/src/blocks/block_albert.js +++ b/src/blocks/block_albert.js @@ -24,29 +24,6 @@ Entry.Albert = { albert.tempo = 60; albert.removeAllTimeouts(); }, - monitorTemplate: { - imgPath: "hw/albert.png", - width: 387, - height: 503, - listPorts: { - "oid":{name: "OID", type: "input", pos: {x: 0, y: 0}}, - "buzzer":{name: Lang.Hw.buzzer , type: "output", pos: {x: 0, y: 0}}, - "note":{name: Lang.Hw.note , type: "output", pos: {x: 0, y: 0}} - }, - ports: { - "leftProximity":{name: Lang.Blocks.ALBERT_sensor_leftProximity, type: "input", pos: {x : 178, y: 401}}, - "rightProximity":{name: Lang.Blocks.ALBERT_sensor_rightProximity, type: "input", pos: {x: 66, y: 359}}, - "battery":{name: Lang.Blocks.ALBERT_sensor_battery , type: "input", pos: {x : 88, y: 368}}, - "light":{name: Lang.Blocks.ALBERT_sensor_light, type: "input", pos: {x: 127, y: 391}}, - "leftWheel":{name: Lang.Hw.leftWheel , type: "output", pos: {x: 299, y: 406}}, - "rightWheel":{name: Lang.Hw.rightWheel , type: "output", pos: {x: 22, y: 325}}, - "leftEye":{name: Lang.Hw.leftEye , type: "output", pos: {x: 260, y:26}}, - "rightEye":{name: Lang.Hw.rightEye, type: "output", pos: {x: 164, y: 13}}, - "bodyLed":{name: Lang.Hw.body + " " + Lang.Hw.led, type: "output", pos: {x: 367, y: 308}}, - "frontLed":{name: Lang.Hw.front + " " + Lang.Hw.led, pos: {x: 117, y: 410}} - }, - mode : 'both' - }, tempo: 60, timeouts: [], removeTimeout: function(id) { @@ -64,6 +41,164 @@ Entry.Albert = { } this.timeouts = []; }, + controller: { + PI: 3.14159265, + PI2: 6.2831853, + prevDirection: 0, + prevDirectionFine: 0, + directionFineCount: 0, + positionCount: 0, + finalPositionCount: 0, + GAIN_ANGLE: 30, + GAIN_ANGLE_FINE: 30, + GAIN_POSITION_FINE: 30, + STRAIGHT_SPEED: 20, + MAX_BASE_SPEED: 20, + GAIN_BASE_SPEED: 1.0, + GAIN_POSITION: 35, + POSITION_TOLERANCE_FINE: 3, + POSITION_TOLERANCE_FINE_LARGE: 5, + POSITION_TOLERANCE_ROUGH: 5, + POSITION_TOLERANCE_ROUGH_LARGE: 10, + ORIENTATION_TOLERANCE_FINE: 0.08, + ORIENTATION_TOLERANCE_ROUGH: 0.09, + ORIENTATION_TOLERANCE_ROUGH_LARGE: 0.18, + MINIMUM_WHEEL_SPEED: 18, + MINIMUM_WHEEL_SPEED_FINE: 15, + clear: function() { + this.prevDirection = 0; + this.prevDirectionFine = 0; + this.directionFineCount = 0; + this.positionCount = 0; + this.finalPositionCount = 0; + }, + controlAngleFine: function(currentRadian, targetRadian) { + var sq = Entry.hw.sendQueue; + var diff = this.validateRadian(targetRadian - currentRadian); + var mag = Math.abs(diff); + if(mag < this.ORIENTATION_TOLERANCE_FINE) + return false; + + var direction = diff > 0 ? 1 : -1; + if(direction * this.prevDirectionFine < 0) { + if(++this.directionFineCount > 5) + return false; + } + this.prevDirectionFine = direction; + + var value = 0; + if(diff > 0) { + value = Math.log(1 + mag) * this.GAIN_ANGLE_FINE; + if(value < this.MINIMUM_WHEEL_SPEED) value = this.MINIMUM_WHEEL_SPEED; + } else { + value = -Math.log(1 + mag) * this.GAIN_ANGLE_FINE; + if(value > -this.MINIMUM_WHEEL_SPEED) value = -this.MINIMUM_WHEEL_SPEED; + } + value = parseInt(value); + sq.leftWheel = -value; + sq.rightWheel = value; + return true; + }, + controlAngle: function(currentRadian, targetRadian) { + var sq = Entry.hw.sendQueue; + var diff = this.validateRadian(targetRadian - currentRadian); + var mag = Math.abs(diff); + if(mag < this.ORIENTATION_TOLERANCE_ROUGH) + return false; + + var direction = diff > 0 ? 1 : -1; + if(mag < this.ORIENTATION_TOLERANCE_ROUGH_LARGE && direction * this.prevDirection < 0) + return false; + this.prevDirection = direction; + + var value = 0; + if(diff > 0) { + value = Math.log(1 + mag) * this.GAIN_ANGLE; + if(value < this.MINIMUM_WHEEL_SPEED) value = this.MINIMUM_WHEEL_SPEED; + } else { + value = -Math.log(1 + mag) * this.GAIN_ANGLE; + if(value > -this.MINIMUM_WHEEL_SPEED) value = -this.MINIMUM_WHEEL_SPEED; + } + value = parseInt(value); + sq.leftWheel = -value; + sq.rightWheel = value; + return true; + }, + controlPositionFine: function(currentX, currentY, currentRadian, targetX, targetY) { + var sq = Entry.hw.sendQueue; + var targetRadian = Math.atan2(targetY - currentY, targetX - currentX); + var diff = this.validateRadian(targetRadian - currentRadian); + var mag = Math.abs(diff); + var ex = targetX - currentX ; + var ey = targetY - currentY; + var dist = Math.sqrt(ex * ex + ey * ey); + if(dist < this.POSITION_TOLERANCE_FINE) + return false; + if(dist < this.POSITION_TOLERANCE_FINE_LARGE) { + if(++this.finalPositionCount > 5) { + this.finalPositionCount = 0; + return false; + } + } + var value = 0; + if(diff > 0) + value = Math.log(1 + mag) * this.GAIN_POSITION_FINE; + else + value = -Math.log(1 + mag) * this.GAIN_POSITION_FINE; + value = parseInt(value); + sq.leftWheel = this.MINIMUM_WHEEL_SPEED_FINE - value; + sq.rightWheel = this.MINIMUM_WHEEL_SPEED_FINE + value; + return true; + }, + controlPosition: function(currentX, currentY, currentRadian, targetX, targetY) { + var sq = Entry.hw.sendQueue; + var targetRadian = Math.atan2(targetY - currentY, targetX - currentX); + var diff = this.validateRadian(targetRadian - currentRadian); + var mag = Math.abs(diff); + var ex = targetX - currentX ; + var ey = targetY - currentY; + var dist = Math.sqrt(ex * ex + ey * ey); + if(dist < this.POSITION_TOLERANCE_ROUGH) + return false; + if(dist < this.POSITION_TOLERANCE_ROUGH_LARGE) { + if(++this.positionCount > 10) { + this.positionCount = 0; + return false; + } + } else { + this.positionCount = 0; + } + if(mag < 0.01) { + sq.leftWheel = this.STRAIGHT_SPEED; + sq.rightWheel = this.STRAIGHT_SPEED; + } else { + var base = (this.MINIMUM_WHEEL_SPEED + 0.5 / mag) * this.GAIN_BASE_SPEED; + if(base > this.MAX_BASE_SPEED) base = this.MAX_BASE_SPEED; + + var value = 0; + if(diff > 0) + value = Math.log(1 + mag) * this.GAIN_POSITION; + else + value = -Math.log(1 + mag) * this.GAIN_POSITION; + base = parseInt(base); + value = parseInt(value); + sq.leftWheel = base - value; + sq.rightWheel = base + value; + } + return true; + }, + validateRadian: function(radian) + { + if(radian > this.PI) + return radian - this.PI2; + else if(radian < -this.PI) + return radian + this.PI2; + return radian; + }, + toRadian: function(degree) { + return degree * 3.14159265 / 180.0; + } + }, name: 'albert' }; @@ -83,22 +218,56 @@ Entry.block.albert_hand_found = function (sprite, script) { return pd.leftProximity > 40 || pd.rightProximity > 40; }; +Blockly.Blocks.albert_is_oid_value = { + init: function() { + this.setColour("#00979D"); + this.appendDummyInput() + .appendField(Lang.Blocks.ALBERT_is_oid_1) + .appendField(new Blockly.FieldDropdown([ + [Lang.Blocks.ALBERT_front_oid,"FRONT"], + [Lang.Blocks.ALBERT_back_oid,"BACK"] + ]), "OID") + .appendField(Lang.Blocks.ALBERT_is_oid_2); + this.appendValueInput("VALUE") + .setCheck(["Number", "String"]); + this.appendDummyInput() + .appendField(Lang.Blocks.ALBERT_is_oid_3); + this.setOutput(true, 'Boolean'); + this.setInputsInline(true); + } +}; + +Entry.block.albert_is_oid_value = function (sprite, script) { + var pd = Entry.hw.portData; + var oid = script.getField("OID", script); + var value = script.getNumberValue("VALUE"); + if (oid == 'FRONT') { + return pd.frontOid == value; + } else { + return pd.backOid == value; + } +}; + Blockly.Blocks.albert_value = { init: function() { this.setColour("#00979D"); this.appendDummyInput() .appendField('') .appendField(new Blockly.FieldDropdown([ - [Lang.Blocks.ALBERT_sensor_leftProximity ,"leftProximity"], - [Lang.Blocks.ALBERT_sensor_rightProximity,"rightProximity"], + [Lang.Blocks.ALBERT_sensor_left_proximity ,"leftProximity"], + [Lang.Blocks.ALBERT_sensor_right_proximity,"rightProximity"], + [Lang.Blocks.ALBERT_sensor_acceleration_x, "accelerationX"], + [Lang.Blocks.ALBERT_sensor_acceleration_y, "accelerationY"], + [Lang.Blocks.ALBERT_sensor_acceleration_z, "accelerationZ"], + [Lang.Blocks.ALBERT_sensor_front_oid,"frontOid"], + [Lang.Blocks.ALBERT_sensor_back_oid,"backOid"], + [Lang.Blocks.ALBERT_sensor_position_x,"positionX"], + [Lang.Blocks.ALBERT_sensor_position_y,"positionY"], + [Lang.Blocks.ALBERT_sensor_orientation,"orientation"], [Lang.Blocks.ALBERT_sensor_light ,"light"], + [Lang.Blocks.ALBERT_sensor_temperature, "temperature"], [Lang.Blocks.ALBERT_sensor_battery ,"battery"], - [Lang.Blocks.ALBERT_sensor_signalStrength,"signalStrength"], - [Lang.Blocks.ALBERT_sensor_frontOid,"frontOid"], - [Lang.Blocks.ALBERT_sensor_backOid,"backOid"], - [Lang.Blocks.ALBERT_sensor_positionX,"positionX"], - [Lang.Blocks.ALBERT_sensor_positionY,"positionY"], - [Lang.Blocks.ALBERT_sensor_orientation,"orientation"] + [Lang.Blocks.ALBERT_sensor_signal_strength,"signalStrength"] ]), "DEVICE"); this.setInputsInline(true); this.setOutput(true, 'Number'); @@ -202,8 +371,8 @@ Blockly.Blocks.albert_turn_for_secs = { this.appendDummyInput() .appendField(Lang.Blocks.ALBERT_turn_for_secs_1) .appendField(new Blockly.FieldDropdown([ - [Lang.General.left,"LEFT"], - [Lang.General.right,"RIGHT"] + [Lang.Blocks.ALBERT_turn_left,"LEFT"], + [Lang.Blocks.ALBERT_turn_right,"RIGHT"] ]), "DIRECTION") .appendField(Lang.Blocks.ALBERT_turn_for_secs_2) this.appendValueInput("VALUE") @@ -311,9 +480,9 @@ Blockly.Blocks.albert_change_wheel_by = { this.appendDummyInput() .appendField(Lang.Blocks.ALBERT_change_wheel_by_1) .appendField(new Blockly.FieldDropdown([ - [Lang.General.left,"LEFT"], - [Lang.General.right,"RIGHT"], - [Lang.General.both,"BOTH"] + [Lang.Blocks.ALBERT_left_wheel,"LEFT"], + [Lang.Blocks.ALBERT_right_wheel,"RIGHT"], + [Lang.Blocks.ALBERT_both_wheels,"BOTH"] ]), "DIRECTION") .appendField(Lang.Blocks.ALBERT_change_wheel_by_2); this.appendValueInput("VALUE") @@ -348,9 +517,9 @@ Blockly.Blocks.albert_set_wheel_to = { this.appendDummyInput() .appendField(Lang.Blocks.ALBERT_set_wheel_to_1) .appendField(new Blockly.FieldDropdown([ - [Lang.General.left,"LEFT"], - [Lang.General.right,"RIGHT"], - [Lang.General.both,"BOTH"] + [Lang.Blocks.ALBERT_left_wheel,"LEFT"], + [Lang.Blocks.ALBERT_right_wheel,"RIGHT"], + [Lang.Blocks.ALBERT_both_wheels,"BOTH"] ]), "DIRECTION") .appendField(Lang.Blocks.ALBERT_set_wheel_to_2); this.appendValueInput("VALUE") @@ -402,15 +571,15 @@ Blockly.Blocks.albert_set_pad_size_to = { init: function() { this.setColour("#00979D"); this.appendDummyInput() - .appendField(Lang.Blocks.ALBERT_set_pad_size_to_1); + .appendField(Lang.Blocks.ALBERT_set_board_size_to_1); this.appendValueInput("WIDTH") .setCheck(["Number", "String"]); this.appendDummyInput() - .appendField(Lang.Blocks.ALBERT_set_pad_size_to_2); + .appendField(Lang.Blocks.ALBERT_set_board_size_to_2); this.appendValueInput("HEIGHT") .setCheck(["Number", "String"]); this.appendDummyInput() - .appendField(Lang.Blocks.ALBERT_set_pad_size_to_3) + .appendField(Lang.Blocks.ALBERT_set_board_size_to_3) .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); this.setInputsInline(true); this.setPreviousStatement(true); @@ -425,6 +594,163 @@ Entry.block.albert_set_pad_size_to = function (sprite, script) { return script.callReturn(); }; +Blockly.Blocks.albert_move_to_x_y_on_board = { + init: function() { + this.setColour("#00979D"); + this.appendDummyInput() + .appendField(Lang.Blocks.ALBERT_move_to_x_y_1); + this.appendValueInput("X") + .setCheck(["Number", "String"]); + this.appendDummyInput() + .appendField(Lang.Blocks.ALBERT_move_to_x_y_2); + this.appendValueInput("Y") + .setCheck(["Number", "String"]); + this.appendDummyInput() + .appendField(Lang.Blocks.ALBERT_move_to_x_y_3) + .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + } +}; + +Entry.block.albert_move_to_x_y_on_board = function (sprite, script) { + var sq = Entry.hw.sendQueue; + var pd = Entry.hw.portData; + var controller = Entry.Albert.controller; + if (!script.isStart) { + script.isStart = true; + script.isMoving = true; + script.initialized = false; + script.boardState = 1; + script.x = -1; + script.y = -1; + script.theta = -200; + script.targetX = script.getNumberValue('X'); + script.targetY = script.getNumberValue('Y'); + controller.clear(); + sq.leftWheel = 0; + sq.rightWheel = 0; + return script; + } else if (script.isMoving) { + if(pd.positionX >= 0) script.x = pd.positionX; + if(pd.positionY >= 0) script.y = pd.positionY; + script.theta = pd.orientation; + switch(script.boardState) { + case 1: { + if(script.initialized == false) { + if(script.x < 0 || script.y < 0) { + sq.leftWheel = 20; + sq.rightWheel = -20; + return script; + } + script.initialized = true; + } + var current = controller.toRadian(script.theta); + var dx = script.targetX - script.x; + var dy = script.targetY - script.y; + var target = Math.atan2(dy, dx); + if(controller.controlAngle(current, target) == false) + script.boardState = 2; + break; + } + case 2: { + if(controller.controlPosition(script.x, script.y, controller.toRadian(script.theta), script.targetX, script.targetY) == false) + script.boardState = 3; + break; + } + case 3: { + if(controller.controlPositionFine(script.x, script.y, controller.toRadian(script.theta), script.targetX, script.targetY) == false) { + sq.leftWheel = 0; + sq.rightWheel = 0; + script.isMoving = false; + } + break; + } + } + return script; + } else { + delete script.isStart; + delete script.isMoving; + delete script.initialized; + delete script.boardState; + delete script.x; + delete script.y; + delete script.theta; + delete script.targetX; + delete script.targetY; + Entry.engine.isContinue = false; + sq.leftWheel = 0; + sq.rightWheel = 0; + return script.callReturn(); + } +}; + +Blockly.Blocks.albert_set_orientation_on_board = { + init: function() { + this.setColour("#00979D"); + this.appendDummyInput() + .appendField(Lang.Blocks.ALBERT_set_orientation_to_1); + this.appendValueInput("ORIENTATION") + .setCheck(["Number", "String"]); + this.appendDummyInput() + .appendField(Lang.Blocks.ALBERT_set_orientation_to_2) + .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + } +}; + +Entry.block.albert_set_orientation_on_board = function (sprite, script) { + var sq = Entry.hw.sendQueue; + var pd = Entry.hw.portData; + var controller = Entry.Albert.controller; + if (!script.isStart) { + script.isStart = true; + script.isMoving = true; + script.boardState = 1; + script.theta = -200; + script.targetTheta = script.getNumberValue('ORIENTATION'); + controller.clear(); + sq.leftWheel = 0; + sq.rightWheel = 0; + return script; + } else if (script.isMoving) { + script.theta = pd.orientation; + switch(script.boardState) { + case 1: { + var current = controller.toRadian(script.theta); + var target = controller.toRadian(script.targetTheta); + if(controller.controlAngle(current, target) == false) + script.boardState = 2; + break; + } + case 2: { + var current = controller.toRadian(script.theta); + var target = controller.toRadian(script.targetTheta); + if(controller.controlAngleFine(current, target) == false) { + sq.leftWheel = 0; + sq.rightWheel = 0; + script.isMoving = false; + } + break; + } + } + return script; + } else { + delete script.isStart; + delete script.isMoving; + delete script.boardState; + delete script.theta; + delete script.targetTheta; + Entry.engine.isContinue = false; + sq.leftWheel = 0; + sq.rightWheel = 0; + return script.callReturn(); + } +}; + //led Blockly.Blocks.albert_set_eye_to = { init: function() { @@ -432,9 +758,9 @@ Blockly.Blocks.albert_set_eye_to = { 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"] + [Lang.Blocks.ALBERT_left_eye,"LEFT"], + [Lang.Blocks.ALBERT_right_eye,"RIGHT"], + [Lang.Blocks.ALBERT_both_eyes,"BOTH"] ]), "DIRECTION") .appendField(Lang.Blocks.ALBERT_set_eye_to_2) .appendField(new Blockly.FieldDropdown([ @@ -444,7 +770,7 @@ Blockly.Blocks.albert_set_eye_to = { [Lang.Blocks.ALBERT_color_cyan,"3"], [Lang.General.blue,"1"], [Lang.Blocks.ALBERT_color_magenta,"5"], - [Lang.General.white,"7"] + [Lang.Blocks.ALBERT_color_white,"7"] ]), "COLOR") .appendField(Lang.Blocks.ALBERT_set_eye_to_3) .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); @@ -475,9 +801,9 @@ Blockly.Blocks.albert_clear_eye = { 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"] + [Lang.Blocks.ALBERT_left_eye,"LEFT"], + [Lang.Blocks.ALBERT_right_eye,"RIGHT"], + [Lang.Blocks.ALBERT_both_eyes,"BOTH"] ]), "DIRECTION") .appendField(Lang.Blocks.ALBERT_clear_eye_2) .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); @@ -505,12 +831,12 @@ Blockly.Blocks.albert_body_led = { init: function() { this.setColour("#00979D"); this.appendDummyInput() - .appendField(Lang.Blocks.ALBERT_body_led_1) + .appendField(Lang.Blocks.ALBERT_turn_body_led_1) .appendField(new Blockly.FieldDropdown([ - [Lang.General.turn_on,"ON"], - [Lang.General.turn_off,"OFF"] + [Lang.Blocks.ALBERT_turn_on,"ON"], + [Lang.Blocks.ALBERT_turn_off,"OFF"] ]), "STATE") - .appendField(Lang.Blocks.ALBERT_body_led_2) + .appendField(Lang.Blocks.ALBERT_turn_body_led_2) .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); this.setInputsInline(true); this.setPreviousStatement(true); @@ -530,12 +856,12 @@ Blockly.Blocks.albert_front_led = { init: function() { this.setColour("#00979D"); this.appendDummyInput() - .appendField(Lang.Blocks.ALBERT_front_led_1) + .appendField(Lang.Blocks.ALBERT_turn_front_led_1) .appendField(new Blockly.FieldDropdown([ - [Lang.General.turn_on,"ON"], - [Lang.General.turn_off,"OFF"] + [Lang.Blocks.ALBERT_turn_on,"ON"], + [Lang.Blocks.ALBERT_turn_off,"OFF"] ]), "STATE") - .appendField(Lang.Blocks.ALBERT_front_led_2) + .appendField(Lang.Blocks.ALBERT_turn_front_led_2) .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); this.setInputsInline(true); this.setPreviousStatement(true); @@ -817,279 +1143,3 @@ Entry.block.albert_set_tempo_to = function (sprite, script) { if (Entry.Albert.tempo < 1) Entry.Albert.tempo = 1; return script.callReturn(); }; - - - -// previous block -Blockly.Blocks.albert_move_forward = { - init: function() { - this.setColour("#00979D"); - this.appendDummyInput() - .appendField(Lang.Blocks.HAMSTER_move_forward) - .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); - this.setInputsInline(true); - this.setPreviousStatement(true); - this.setNextStatement(true); - } -}; - -Entry.block.albert_move_forward = function (sprite, script) { - var sq = Entry.hw.sendQueue; - if (!script.isStart) { - script.isStart = true; - script.timeFlag = 1; - sq.leftWheel = 30; - sq.rightWheel = 30; - var timeValue = 1 * 1000; - setTimeout(function() { - script.timeFlag = 0; - }, timeValue); - return script; - } else if (script.timeFlag == 1) { - return script; - } else { - delete script.timeFlag; - delete script.isStart; - Entry.engine.isContinue = false; - sq.leftWheel = 0; - sq.rightWheel = 0; - return script.callReturn(); - } -}; - -Blockly.Blocks.albert_move_backward = { - init: function() { - this.setColour("#00979D"); - this.appendDummyInput() - .appendField(Lang.Blocks.HAMSTER_move_backward) - .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); - this.setInputsInline(true); - this.setPreviousStatement(true); - this.setNextStatement(true); - } -}; - -Entry.block.albert_move_backward = function (sprite, script) { - var sq = Entry.hw.sendQueue; - if (!script.isStart) { - script.isStart = true; - script.timeFlag = 1; - var timeValue = 1 * 1000; - setTimeout(function() { - script.timeFlag = 0; - }, timeValue); - return script; - } else if (script.timeFlag == 1) { - sq.leftWheel = -30; - sq.rightWheel = -30; - return script; - } else { - delete script.timeFlag; - delete script.isStart; - Entry.engine.isContinue = false; - sq.leftWheel = 0; - sq.rightWheel = 0; - return script.callReturn(); - } -}; - -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(true); - this.setPreviousStatement(true); - this.setNextStatement(true); - } -}; - -Entry.block.albert_turn_around = function (sprite, script) { - var sq = Entry.hw.sendQueue; - if (!script.isStart) { - var direction = script.getField("DIRECTION", script); - var isLeft = direction == 'LEFT'; - script.leftValue = isLeft ? -30 : 30; - script.rightValue = isLeft ? 30 : -30; - script.isStart = true; - script.timeFlag = 1; - var timeValue = 1 * 1000; - setTimeout(function() { - script.timeFlag = 0; - }, timeValue); - return script; - } else if (script.timeFlag == 1) { - sq.leftWheel = script.leftValue; - sq.rightWheel = script.rightValue; - return script; - } else { - delete script.timeFlag; - delete script.isStart; - delete script.leftValue; - delete script.rightValue; - Entry.engine.isContinue = false; - sq.leftWheel = 0; - sq.rightWheel = 0; - return script.callReturn(); - } -}; - -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(true); - this.setPreviousStatement(true); - this.setNextStatement(true); - } -}; - -Entry.block.albert_set_led_to = function (sprite, script) { - var sq = Entry.hw.sendQueue; - var direction = script.getField("DIRECTION", script); - var color = Number(script.getField("COLOR", script)); - if (direction == 'FRONT') { - sq.leftEye = color; - sq.rightEye = color; - } else if (direction == 'LEFT') - sq.leftEye = color; - else - sq.rightEye = color; - - return script.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(true); - this.setPreviousStatement(true); - this.setNextStatement(true); - } -}; - -Entry.block.albert_clear_led = function (sprite, script) { - var sq = Entry.hw.sendQueue; - var direction = script.getField("DIRECTION", script); - if (direction == 'FRONT') { - sq.leftEye = 0; - sq.rightEye = 0; - } else if (direction == 'LEFT') sq.leftEye = 0; - else sq.rightEye = 0; - - return script.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 + 'block_icon/hardware_03.png', '*')); - this.setInputsInline(true); - this.setPreviousStatement(true); - this.setNextStatement(true); - } -}; - -Entry.block.albert_change_wheels_by = function (sprite, script) { - var sq = Entry.hw.sendQueue; - var pd = Entry.hw.portData; - var direction = script.getField('DIRECTION'); - var value = script.getNumberValue('VALUE'); - - if (direction == 'LEFT') { - sq.leftWheel = sq.leftWheel != undefined ? - sq.leftWheel + value : pd.leftWheel + value; - } else if (direction == 'RIGHT') - sq.rightWheel = sq.rightWheel != undefined ? - sq.rightWheel + value : pd.rightWheel + value; - else { - sq.leftWheel = sq.leftWheel != undefined ? - sq.leftWheel + value : pd.leftWheel + value; - sq.rightWheel = sq.rightWheel != undefined ? - sq.rightWheel + value : pd.rightWheel + value; - } - - return script.callReturn(); -}; - -Blockly.Blocks.albert_set_wheels_to = { - init: function() { - this.setColour("#00979D"); - this.appendDummyInput() - .appendField(Lang.Blocks.HAMSTER_set_wheels_to_1) - .appendField(new Blockly.FieldDropdown([ - [Lang.General.left,"LEFT"], - [Lang.General.right,"RIGHT"], - [Lang.General.both,"FRONT"] - ]), "DIRECTION") - .appendField(Lang.Blocks.HAMSTER_set_wheels_to_2); - this.appendValueInput("VALUE") - .setCheck(["Number", "String"]); - this.appendDummyInput() - .appendField(Lang.Blocks.HAMSTER_set_wheels_to_3) - .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); - this.setInputsInline(true); - this.setPreviousStatement(true); - this.setNextStatement(true); - } -}; - -Entry.block.albert_set_wheels_to = function (sprite, script) { - var sq = Entry.hw.sendQueue; - var direction = script.getField('DIRECTION'); - var value = script.getNumberValue('VALUE'); - - if (direction == 'LEFT') sq.leftWheel = value; - else if (direction == 'RIGHT') sq.rightWheel = value; - else { - sq.leftWheel = value; - sq.rightWheel = value; - } - - return script.callReturn(); -}; diff --git a/src/blocks/block_hamster.js b/src/blocks/block_hamster.js index 9feb6ea93b..c34eb27290 100644 --- a/src/blocks/block_hamster.js +++ b/src/blocks/block_hamster.js @@ -1,1236 +1,1209 @@ "use strict"; Entry.Hamster = { - PORT_MAP: { - leftWheel: 0, - rightWheel: 0, - buzzer: 0, - outputA: 0, - outputB: 0, - leftLed: 0, - rightLed: 0, - note: 0, - lineTracerMode: 0, - lineTracerModeId: 0, - lineTracerSpeed: 5, - ioModeA: 0, - ioModeB: 0 - }, - setZero: function() { - var portMap = Entry.Hamster.PORT_MAP; - var sq = Entry.hw.sendQueue; - for (var port in portMap) { - sq[port] = portMap[port]; - } - Entry.hw.update(); - var hamster = Entry.Hamster; - hamster.lineTracerModeId = 0; - hamster.lineTracerStateId = -1; - hamster.tempo = 60; - hamster.removeAllTimeouts(); - }, - lineTracerModeId: 0, - lineTracerStateId: -1, - tempo: 60, - timeouts: [], - removeTimeout: function(id) { - clearTimeout(id); - var timeouts = this.timeouts; - var index = timeouts.indexOf(id); - if(index >= 0) { - timeouts.splice(index, 1); - } - }, - removeAllTimeouts: function() { - var timeouts = this.timeouts; - for(var i in timeouts) { - clearTimeout(timeouts[i]); - } - this.timeouts = []; - }, - setLineTracerMode: function(sq, mode) { - this.lineTracerModeId = (this.lineTracerModeId + 1) & 0xff; - sq.lineTracerMode = mode; - sq.lineTracerModeId = this.lineTracerModeId; - }, - name: 'hamster', - monitorTemplate: { - imgPath: "hw/hamster.png", - width: 256, - height: 256, - listPorts:{ - "temperature":{name: Lang.Blocks.HAMSTER_sensor_temperature, type: "input", pos: {x: 0, y: 0}}, - "accelerationX":{name: Lang.Blocks.HAMSTER_sensor_accelerationX, type: "input", pos: {x: 0, y: 0}}, - "accelerationY":{name: Lang.Blocks.HAMSTER_sensor_accelerationY, type: "input", pos: {x: 0, y: 0}}, - "accelerationZ":{name: Lang.Blocks.HAMSTER_sensor_accelerationZ, type: "input", pos: {x: 0, y: 0}}, - "buzzer":{name: Lang.Hw.buzzer , type: "output", pos: {x: 0, y: 0}}, - "note":{name: Lang.Hw.buzzer + "2", type: "output", pos: {x: 0, y: 0}}, - "outputA":{name: Lang.Hw.output + "A", type: "output", pos: {x: 0, y: 0}}, - "outputB":{name: Lang.Hw.output + "B", type: "output", pos: {x: 0, y: 0}} - }, - ports: { - "leftProximity":{name: Lang.Blocks.HAMSTER_sensor_leftProximity, type: "input", pos: {x: 122, y: 156}}, - "rightProximity":{name: Lang.Blocks.HAMSTER_sensor_rightProximity, type: "input", pos: {x : 10, y: 108}}, - "leftFloor":{name: Lang.Blocks.HAMSTER_sensor_leftFloor, type: "input", pos: {x: 100, y: 234}}, - "rightFloor":{name: Lang.Blocks.HAMSTER_sensor_rightFloor, type: "input", pos: {x: 13, y: 180}}, - "light":{name: Lang.Blocks.HAMSTER_sensor_light, type: "input", pos: {x: 56, y: 189}}, - "leftWheel":{name: Lang.Hw.leftWheel, type: "output", pos: {x: 209, y: 115}}, - "rightWheel":{name: Lang.Hw.rightWheel, type: "output", pos: {x: 98, y: 30}}, - "leftLed":{name: Lang.Hw.left + " " + Lang.Hw.led, type: "output", pos: {x: 87, y: 210}}, - "rightLed":{name: Lang.Hw.right + " " + Lang.Hw.led , type: "output", pos: {x: 24, y: 168}}, - }, - mode : 'both' - } + PORT_MAP: { + leftWheel: 0, + rightWheel: 0, + buzzer: 0, + outputA: 0, + outputB: 0, + leftLed: 0, + rightLed: 0, + note: 0, + lineTracerMode: 0, + lineTracerModeId: 0, + lineTracerSpeed: 5, + ioModeA: 0, + ioModeB: 0 + }, + setZero: function() { + var portMap = Entry.Hamster.PORT_MAP; + var sq = Entry.hw.sendQueue; + for (var port in portMap) { + sq[port] = portMap[port]; + } + Entry.hw.update(); + var hamster = Entry.Hamster; + hamster.lineTracerModeId = 0; + hamster.lineTracerStateId = -1; + hamster.tempo = 60; + hamster.removeAllTimeouts(); + }, + lineTracerModeId: 0, + lineTracerStateId: -1, + tempo: 60, + timeouts: [], + removeTimeout: function(id) { + clearTimeout(id); + var timeouts = this.timeouts; + var index = timeouts.indexOf(id); + if(index >= 0) { + timeouts.splice(index, 1); + } + }, + removeAllTimeouts: function() { + var timeouts = this.timeouts; + for(var i in timeouts) { + clearTimeout(timeouts[i]); + } + this.timeouts = []; + }, + setLineTracerMode: function(sq, mode) { + this.lineTracerModeId = (this.lineTracerModeId + 1) & 0xff; + sq.lineTracerMode = mode; + sq.lineTracerModeId = this.lineTracerModeId; + }, + name: 'hamster' }; //sensor Blockly.Blocks.hamster_hand_found = { - init: function() { - this.setColour("#00979D"); - this.appendDummyInput() - .appendField(Lang.Blocks.HAMSTER_hand_found); - this.setOutput(true, 'Boolean'); - this.setInputsInline(true); - } + init: function() { + this.setColour("#00979D"); + this.appendDummyInput() + .appendField(Lang.Blocks.HAMSTER_hand_found); + this.setOutput(true, 'Boolean'); + this.setInputsInline(true); + } }; Entry.block.hamster_hand_found = function (sprite, script) { - var pd = Entry.hw.portData; - return pd.leftProximity > 50 || pd.rightProximity > 50; + var pd = Entry.hw.portData; + return pd.leftProximity > 50 || pd.rightProximity > 50; }; Blockly.Blocks.hamster_value = { - init: function() { - this.setColour("#00979D"); - this.appendDummyInput() - .appendField('') - .appendField(new Blockly.FieldDropdown([ - [Lang.Blocks.HAMSTER_sensor_leftProximity, "leftProximity"], - [Lang.Blocks.HAMSTER_sensor_rightProximity, "rightProximity"], - [Lang.Blocks.HAMSTER_sensor_leftFloor, "leftFloor"], - [Lang.Blocks.HAMSTER_sensor_rightFloor, "rightFloor"], - [Lang.Blocks.HAMSTER_sensor_accelerationX, "accelerationX"], - [Lang.Blocks.HAMSTER_sensor_accelerationY, "accelerationY"], - [Lang.Blocks.HAMSTER_sensor_accelerationZ, "accelerationZ"], - [Lang.Blocks.HAMSTER_sensor_light, "light"], - [Lang.Blocks.HAMSTER_sensor_temperature, "temperature"], - [Lang.Blocks.HAMSTER_sensor_signalStrength, "signalStrength"], - [Lang.Blocks.HAMSTER_sensor_inputA, "inputA"], - [Lang.Blocks.HAMSTER_sensor_inputB, "inputB"] - ]), "DEVICE"); - this.setInputsInline(true); - this.setOutput(true, 'Number'); - } + init: function() { + this.setColour("#00979D"); + this.appendDummyInput() + .appendField('') + .appendField(new Blockly.FieldDropdown([ + [Lang.Blocks.HAMSTER_sensor_left_proximity, "leftProximity"], + [Lang.Blocks.HAMSTER_sensor_right_proximity, "rightProximity"], + [Lang.Blocks.HAMSTER_sensor_left_floor, "leftFloor"], + [Lang.Blocks.HAMSTER_sensor_right_floor, "rightFloor"], + [Lang.Blocks.HAMSTER_sensor_acceleration_x, "accelerationX"], + [Lang.Blocks.HAMSTER_sensor_acceleration_y, "accelerationY"], + [Lang.Blocks.HAMSTER_sensor_acceleration_z, "accelerationZ"], + [Lang.Blocks.HAMSTER_sensor_light, "light"], + [Lang.Blocks.HAMSTER_sensor_temperature, "temperature"], + [Lang.Blocks.HAMSTER_sensor_signal_strength, "signalStrength"], + [Lang.Blocks.HAMSTER_sensor_input_a, "inputA"], + [Lang.Blocks.HAMSTER_sensor_input_b, "inputB"] + ]), "DEVICE"); + this.setInputsInline(true); + this.setOutput(true, 'Number'); + } }; Entry.block.hamster_value = function (sprite, script) { - var pd = Entry.hw.portData; - var dev = script.getField('DEVICE'); - return pd[dev]; + var pd = Entry.hw.portData; + var dev = script.getField('DEVICE'); + return pd[dev]; }; //board Blockly.Blocks.hamster_move_forward_once = { - init: function() { - this.setColour("#00979D"); - this.appendDummyInput() - .appendField(Lang.Blocks.HAMSTER_move_forward_once) - .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); - this.setInputsInline(true); - this.setPreviousStatement(true); - this.setNextStatement(true); - } + init: function() { + this.setColour("#00979D"); + this.appendDummyInput() + .appendField(Lang.Blocks.HAMSTER_move_forward_once) + .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + } }; Entry.block.hamster_move_forward_once = function (sprite, script) { - var sq = Entry.hw.sendQueue; - var pd = Entry.hw.portData; - if (!script.isStart) { - script.isStart = true; - script.isMoving = true; - script.count = 0; - script.boardState = 1; - sq.leftWheel = 45; - sq.rightWheel = 45; - Entry.Hamster.setLineTracerMode(sq, 0); - return script; - } else if (script.isMoving) { - switch(script.boardState) { - case 1: { - if(script.count < 2) { - if(pd.leftFloor < 50 && pd.rightFloor < 50) - script.count ++; - else - script.count = 0; - var diff = pd.leftFloor - pd.rightFloor; - sq.leftWheel = 45 + diff * 0.25; - sq.rightWheel = 45 - diff * 0.25; - } else { - script.count = 0; - script.boardState = 2; - } - break; - } - case 2: { - var diff = pd.leftFloor - pd.rightFloor; - sq.leftWheel = 45 + diff * 0.25; - sq.rightWheel = 45 - diff * 0.25; - script.boardState = 3; - var timer = setTimeout(function() { - script.boardState = 4; - Entry.Hamster.removeTimeout(timer); - }, 250); - Entry.Hamster.timeouts.push(timer); - break; - } - case 3: { - var diff = pd.leftFloor - pd.rightFloor; - sq.leftWheel = 45 + diff * 0.25; - sq.rightWheel = 45 - diff * 0.25; - break; - } - case 4: { - sq.leftWheel = 0; - sq.rightWheel = 0; - script.boardState = 0; - script.isMoving = false; - break; - } - } - return script; - } else { - delete script.isStart; - delete script.isMoving; - delete script.count; - delete script.boardState; - Entry.engine.isContinue = false; - sq.leftWheel = 0; - sq.rightWheel = 0; - return script.callReturn(); - } + var sq = Entry.hw.sendQueue; + var pd = Entry.hw.portData; + if (!script.isStart) { + script.isStart = true; + script.isMoving = true; + script.count = 0; + script.boardState = 1; + sq.leftWheel = 45; + sq.rightWheel = 45; + Entry.Hamster.setLineTracerMode(sq, 0); + return script; + } else if (script.isMoving) { + switch(script.boardState) { + case 1: { + if(script.count < 2) { + if(pd.leftFloor < 50 && pd.rightFloor < 50) + script.count ++; + else + script.count = 0; + var diff = pd.leftFloor - pd.rightFloor; + sq.leftWheel = 45 + diff * 0.25; + sq.rightWheel = 45 - diff * 0.25; + } else { + script.count = 0; + script.boardState = 2; + } + break; + } + case 2: { + var diff = pd.leftFloor - pd.rightFloor; + sq.leftWheel = 45 + diff * 0.25; + sq.rightWheel = 45 - diff * 0.25; + script.boardState = 3; + var timer = setTimeout(function() { + script.boardState = 4; + Entry.Hamster.removeTimeout(timer); + }, 250); + Entry.Hamster.timeouts.push(timer); + break; + } + case 3: { + var diff = pd.leftFloor - pd.rightFloor; + sq.leftWheel = 45 + diff * 0.25; + sq.rightWheel = 45 - diff * 0.25; + break; + } + case 4: { + sq.leftWheel = 0; + sq.rightWheel = 0; + script.boardState = 0; + script.isMoving = false; + break; + } + } + return script; + } else { + delete script.isStart; + delete script.isMoving; + delete script.count; + delete script.boardState; + Entry.engine.isContinue = false; + sq.leftWheel = 0; + sq.rightWheel = 0; + return script.callReturn(); + } }; Blockly.Blocks.hamster_turn_once = { - init: function() { - this.setColour("#00979D"); - this.appendDummyInput() - .appendField(Lang.Blocks.HAMSTER_turn_once_1) - .appendField(new Blockly.FieldDropdown([ - [Lang.General.left,"LEFT"], - [Lang.General.right,"RIGHT"] - ]), "DIRECTION") - .appendField(Lang.Blocks.HAMSTER_turn_once_2) - .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); - this.setInputsInline(true); - this.setPreviousStatement(true); - this.setNextStatement(true); - } + init: function() { + this.setColour("#00979D"); + this.appendDummyInput() + .appendField(Lang.Blocks.HAMSTER_turn_once_1) + .appendField(new Blockly.FieldDropdown([ + [Lang.Blocks.HAMSTER_turn_once_left,"LEFT"], + [Lang.Blocks.HAMSTER_turn_once_right,"RIGHT"] + ]), "DIRECTION") + .appendField(Lang.Blocks.HAMSTER_turn_once_2) + .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + } }; Entry.block.hamster_turn_once = function (sprite, script) { - var sq = Entry.hw.sendQueue; - var pd = Entry.hw.portData; - if (!script.isStart) { - script.isStart = true; - script.isMoving = true; - script.count = 0; - script.boardState = 1; - var direction = script.getField("DIRECTION", script); - if (direction == 'LEFT') { - script.isLeft = true; - sq.leftWheel = -45; - sq.rightWheel = 45; - } else { - script.isLeft = false; - sq.leftWheel = 45; - sq.rightWheel = -45; - } - Entry.Hamster.setLineTracerMode(sq, 0); - return script; - } else if (script.isMoving) { - if(script.isLeft) { - switch(script.boardState) { - case 1: { - if(script.count < 2) { - if(pd.leftFloor > 50) - script.count ++; - } else { - script.count = 0; - script.boardState = 2; - } - break; - } - case 2: { - if(pd.leftFloor < 20) { - script.boardState = 3; - } - break; - } - case 3: { - if(script.count < 2) { - if(pd.leftFloor < 20) - script.count ++; - } else { - script.count = 0; - script.boardState = 4; - } - break; - } - case 4: { - if(pd.leftFloor > 50) { - script.boardState = 5; - } - break; - } - case 5: { - var diff = pd.leftFloor - pd.rightFloor; - if(diff > -15) { - sq.leftWheel = 0; - sq.rightWheel = 0; - script.boardState = 0; - script.isMoving = false; - } else { - sq.leftWheel = diff * 0.5; - sq.rightWheel = -diff * 0.5; - } - break; - } - } - } else { - switch(script.boardState) { - case 1: { - if(script.count < 2) { - if(pd.rightFloor > 50) - script.count ++; - } else { - script.count = 0; - script.boardState = 2; - } - break; - } - case 2: { - if(pd.rightFloor < 20) { - script.boardState = 3; - } - break; - } - case 3: { - if(script.count < 2) { - if(pd.rightFloor < 20) - script.count ++; - } else { - script.count = 0; - script.boardState = 4; - } - break; - } - case 4: { - if(pd.rightFloor > 50) { - script.boardState = 5; - } - break; - } - case 5: { - var diff = pd.rightFloor - pd.leftFloor; - if(diff > -15) { - sq.leftWheel = 0; - sq.rightWheel = 0; - script.boardState = 0; - script.isMoving = false; - } else { - sq.leftWheel = -diff * 0.5; - sq.rightWheel = diff * 0.5; - } - break; - } - } - } - return script; - } else { - delete script.isStart; - delete script.isMoving; - delete script.count; - delete script.boardState; - delete script.isLeft; - Entry.engine.isContinue = false; - sq.leftWheel = 0; - sq.rightWheel = 0; - return script.callReturn(); - } + var sq = Entry.hw.sendQueue; + var pd = Entry.hw.portData; + if (!script.isStart) { + script.isStart = true; + script.isMoving = true; + script.count = 0; + script.boardState = 1; + var direction = script.getField("DIRECTION", script); + if (direction == 'LEFT') { + script.isLeft = true; + sq.leftWheel = -45; + sq.rightWheel = 45; + } else { + script.isLeft = false; + sq.leftWheel = 45; + sq.rightWheel = -45; + } + Entry.Hamster.setLineTracerMode(sq, 0); + return script; + } else if (script.isMoving) { + if(script.isLeft) { + switch(script.boardState) { + case 1: { + if(script.count < 2) { + if(pd.leftFloor > 50) + script.count ++; + } else { + script.count = 0; + script.boardState = 2; + } + break; + } + case 2: { + if(pd.leftFloor < 20) { + script.boardState = 3; + } + break; + } + case 3: { + if(script.count < 2) { + if(pd.leftFloor < 20) + script.count ++; + } else { + script.count = 0; + script.boardState = 4; + } + break; + } + case 4: { + if(pd.leftFloor > 50) { + script.boardState = 5; + } + break; + } + case 5: { + var diff = pd.leftFloor - pd.rightFloor; + if(diff > -15) { + sq.leftWheel = 0; + sq.rightWheel = 0; + script.boardState = 0; + script.isMoving = false; + } else { + sq.leftWheel = diff * 0.5; + sq.rightWheel = -diff * 0.5; + } + break; + } + } + } else { + switch(script.boardState) { + case 1: { + if(script.count < 2) { + if(pd.rightFloor > 50) + script.count ++; + } else { + script.count = 0; + script.boardState = 2; + } + break; + } + case 2: { + if(pd.rightFloor < 20) { + script.boardState = 3; + } + break; + } + case 3: { + if(script.count < 2) { + if(pd.rightFloor < 20) + script.count ++; + } else { + script.count = 0; + script.boardState = 4; + } + break; + } + case 4: { + if(pd.rightFloor > 50) { + script.boardState = 5; + } + break; + } + case 5: { + var diff = pd.rightFloor - pd.leftFloor; + if(diff > -15) { + sq.leftWheel = 0; + sq.rightWheel = 0; + script.boardState = 0; + script.isMoving = false; + } else { + sq.leftWheel = -diff * 0.5; + sq.rightWheel = diff * 0.5; + } + break; + } + } + } + return script; + } else { + delete script.isStart; + delete script.isMoving; + delete script.count; + delete script.boardState; + delete script.isLeft; + Entry.engine.isContinue = false; + sq.leftWheel = 0; + sq.rightWheel = 0; + return script.callReturn(); + } }; //wheel Blockly.Blocks.hamster_move_forward_for_secs = { - init: function() { - this.setColour("#00979D"); - this.appendDummyInput() - .appendField(Lang.Blocks.HAMSTER_move_forward_for_secs_1); - this.appendValueInput("VALUE") - .setCheck(["Number", "String"]); - this.appendDummyInput() - .appendField(Lang.Blocks.HAMSTER_move_forward_for_secs_2) - .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); - this.setInputsInline(true); - this.setPreviousStatement(true); - this.setNextStatement(true); - } + init: function() { + this.setColour("#00979D"); + this.appendDummyInput() + .appendField(Lang.Blocks.HAMSTER_move_forward_for_secs_1); + this.appendValueInput("VALUE") + .setCheck(["Number", "String"]); + this.appendDummyInput() + .appendField(Lang.Blocks.HAMSTER_move_forward_for_secs_2) + .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + } }; Entry.block.hamster_move_forward_for_secs = function (sprite, script) { - var sq = Entry.hw.sendQueue; - if (!script.isStart) { - script.isStart = true; - script.timeFlag = 1; - sq.leftWheel = 30; - sq.rightWheel = 30; - Entry.Hamster.setLineTracerMode(sq, 0); - var timeValue = script.getNumberValue("VALUE") * 1000; - var timer = setTimeout(function() { - script.timeFlag = 0; - Entry.Hamster.removeTimeout(timer); - }, timeValue); - Entry.Hamster.timeouts.push(timer); - return script; - } else if (script.timeFlag == 1) { - return script; - } else { - delete script.isStart; - delete script.timeFlag; - Entry.engine.isContinue = false; - sq.leftWheel = 0; - sq.rightWheel = 0; - return script.callReturn(); - } + var sq = Entry.hw.sendQueue; + if (!script.isStart) { + script.isStart = true; + script.timeFlag = 1; + sq.leftWheel = 30; + sq.rightWheel = 30; + Entry.Hamster.setLineTracerMode(sq, 0); + var timeValue = script.getNumberValue("VALUE") * 1000; + var timer = setTimeout(function() { + script.timeFlag = 0; + Entry.Hamster.removeTimeout(timer); + }, timeValue); + Entry.Hamster.timeouts.push(timer); + return script; + } else if (script.timeFlag == 1) { + return script; + } else { + delete script.isStart; + delete script.timeFlag; + Entry.engine.isContinue = false; + sq.leftWheel = 0; + sq.rightWheel = 0; + return script.callReturn(); + } }; Blockly.Blocks.hamster_move_backward_for_secs = { - init: function() { - this.setColour("#00979D"); - this.appendDummyInput() - .appendField(Lang.Blocks.HAMSTER_move_backward_for_secs_1); - this.appendValueInput("VALUE") - .setCheck(["Number", "String"]); - this.appendDummyInput() - .appendField(Lang.Blocks.HAMSTER_move_backward_for_secs_2) - .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); - this.setInputsInline(true); - this.setPreviousStatement(true); - this.setNextStatement(true); - } + init: function() { + this.setColour("#00979D"); + this.appendDummyInput() + .appendField(Lang.Blocks.HAMSTER_move_backward_for_secs_1); + this.appendValueInput("VALUE") + .setCheck(["Number", "String"]); + this.appendDummyInput() + .appendField(Lang.Blocks.HAMSTER_move_backward_for_secs_2) + .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + } }; Entry.block.hamster_move_backward_for_secs = function (sprite, script) { - var sq = Entry.hw.sendQueue; - if (!script.isStart) { - script.isStart = true; - script.timeFlag = 1; - sq.leftWheel = -30; - sq.rightWheel = -30; - Entry.Hamster.setLineTracerMode(sq, 0); - var timeValue = script.getNumberValue("VALUE") * 1000; - var timer = setTimeout(function() { - script.timeFlag = 0; - Entry.Hamster.removeTimeout(timer); - }, timeValue); - Entry.Hamster.timeouts.push(timer); - return script; - } else if (script.timeFlag == 1) { - return script; - } else { - delete script.isStart; - delete script.timeFlag; - Entry.engine.isContinue = false; - sq.leftWheel = 0; - sq.rightWheel = 0; - return script.callReturn(); - } + var sq = Entry.hw.sendQueue; + if (!script.isStart) { + script.isStart = true; + script.timeFlag = 1; + sq.leftWheel = -30; + sq.rightWheel = -30; + Entry.Hamster.setLineTracerMode(sq, 0); + var timeValue = script.getNumberValue("VALUE") * 1000; + var timer = setTimeout(function() { + script.timeFlag = 0; + Entry.Hamster.removeTimeout(timer); + }, timeValue); + Entry.Hamster.timeouts.push(timer); + return script; + } else if (script.timeFlag == 1) { + return script; + } else { + delete script.isStart; + delete script.timeFlag; + Entry.engine.isContinue = false; + sq.leftWheel = 0; + sq.rightWheel = 0; + return script.callReturn(); + } }; Blockly.Blocks.hamster_turn_for_secs = { - init: function() { - this.setColour("#00979D"); - this.appendDummyInput() - .appendField(Lang.Blocks.HAMSTER_turn_for_secs_1) - .appendField(new Blockly.FieldDropdown([ - [Lang.General.left,"LEFT"], - [Lang.General.right,"RIGHT"] - ]), "DIRECTION") - .appendField(Lang.Blocks.HAMSTER_turn_for_secs_2) - this.appendValueInput("VALUE") - .setCheck(["Number", "String"]); - this.appendDummyInput() - .appendField(Lang.Blocks.HAMSTER_turn_for_secs_3) - .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); - this.setInputsInline(true); - this.setPreviousStatement(true); - this.setNextStatement(true); - } + init: function() { + this.setColour("#00979D"); + this.appendDummyInput() + .appendField(Lang.Blocks.HAMSTER_turn_for_secs_1) + .appendField(new Blockly.FieldDropdown([ + [Lang.Blocks.HAMSTER_turn_left,"LEFT"], + [Lang.Blocks.HAMSTER_turn_right,"RIGHT"] + ]), "DIRECTION") + .appendField(Lang.Blocks.HAMSTER_turn_for_secs_2) + this.appendValueInput("VALUE") + .setCheck(["Number", "String"]); + this.appendDummyInput() + .appendField(Lang.Blocks.HAMSTER_turn_for_secs_3) + .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + } }; Entry.block.hamster_turn_for_secs = function (sprite, script) { - var sq = Entry.hw.sendQueue; - if (!script.isStart) { - script.isStart = true; - script.timeFlag = 1; - var direction = script.getField("DIRECTION", script); - if (direction == 'LEFT') { - sq.leftWheel = -30; - sq.rightWheel = 30; - } else { - sq.leftWheel = 30; - sq.rightWheel = -30; - } - Entry.Hamster.setLineTracerMode(sq, 0); - var timeValue = script.getNumberValue("VALUE") * 1000; - var timer = setTimeout(function() { - script.timeFlag = 0; - Entry.Hamster.removeTimeout(timer); - }, timeValue); - Entry.Hamster.timeouts.push(timer); - return script; - } else if (script.timeFlag == 1) { - return script; - } else { - delete script.isStart; - delete script.timeFlag; - Entry.engine.isContinue = false; - sq.leftWheel = 0; - sq.rightWheel = 0; - return script.callReturn(); - } + var sq = Entry.hw.sendQueue; + if (!script.isStart) { + script.isStart = true; + script.timeFlag = 1; + var direction = script.getField("DIRECTION", script); + if (direction == 'LEFT') { + sq.leftWheel = -30; + sq.rightWheel = 30; + } else { + sq.leftWheel = 30; + sq.rightWheel = -30; + } + Entry.Hamster.setLineTracerMode(sq, 0); + var timeValue = script.getNumberValue("VALUE") * 1000; + var timer = setTimeout(function() { + script.timeFlag = 0; + Entry.Hamster.removeTimeout(timer); + }, timeValue); + Entry.Hamster.timeouts.push(timer); + return script; + } else if (script.timeFlag == 1) { + return script; + } else { + delete script.isStart; + delete script.timeFlag; + Entry.engine.isContinue = false; + sq.leftWheel = 0; + sq.rightWheel = 0; + return script.callReturn(); + } }; Blockly.Blocks.hamster_change_both_wheels_by = { - init: function() { - this.setColour("#00979D"); - this.appendDummyInput() - .appendField(Lang.Blocks.HAMSTER_change_both_wheels_by_1); - this.appendValueInput("LEFT") - .setCheck(["Number", "String"]); - this.appendDummyInput() - .appendField(Lang.Blocks.HAMSTER_change_both_wheels_by_2) - this.appendValueInput("RIGHT") - .setCheck(["Number", "String"]); - this.appendDummyInput() - .appendField(Lang.Blocks.HAMSTER_change_both_wheels_by_3) - .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); - this.setInputsInline(true); - this.setPreviousStatement(true); - this.setNextStatement(true); - } + init: function() { + this.setColour("#00979D"); + this.appendDummyInput() + .appendField(Lang.Blocks.HAMSTER_change_both_wheels_by_1); + this.appendValueInput("LEFT") + .setCheck(["Number", "String"]); + this.appendDummyInput() + .appendField(Lang.Blocks.HAMSTER_change_both_wheels_by_2) + this.appendValueInput("RIGHT") + .setCheck(["Number", "String"]); + this.appendDummyInput() + .appendField(Lang.Blocks.HAMSTER_change_both_wheels_by_3) + .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + } }; Entry.block.hamster_change_both_wheels_by = function (sprite, script) { - var sq = Entry.hw.sendQueue; - var left = script.getNumberValue('LEFT'); - var right = script.getNumberValue('RIGHT'); - sq.leftWheel = sq.leftWheel != undefined ? sq.leftWheel + left : left; - sq.rightWheel = sq.rightWheel != undefined ? sq.rightWheel + right : right; - Entry.Hamster.setLineTracerMode(sq, 0); - return script.callReturn(); + var sq = Entry.hw.sendQueue; + var left = script.getNumberValue('LEFT'); + var right = script.getNumberValue('RIGHT'); + sq.leftWheel = sq.leftWheel != undefined ? sq.leftWheel + left : left; + sq.rightWheel = sq.rightWheel != undefined ? sq.rightWheel + right : right; + Entry.Hamster.setLineTracerMode(sq, 0); + return script.callReturn(); }; Blockly.Blocks.hamster_set_both_wheels_to = { - init: function() { - this.setColour("#00979D"); - this.appendDummyInput() - .appendField(Lang.Blocks.HAMSTER_set_both_wheels_to_1); - this.appendValueInput("LEFT") - .setCheck(["Number", "String"]); - this.appendDummyInput() - .appendField(Lang.Blocks.HAMSTER_set_both_wheels_to_2); - this.appendValueInput("RIGHT") - .setCheck(["Number", "String"]); - this.appendDummyInput() - .appendField(Lang.Blocks.HAMSTER_set_both_wheels_to_3) - .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); - this.setInputsInline(true); - this.setPreviousStatement(true); - this.setNextStatement(true); - } + init: function() { + this.setColour("#00979D"); + this.appendDummyInput() + .appendField(Lang.Blocks.HAMSTER_set_both_wheels_to_1); + this.appendValueInput("LEFT") + .setCheck(["Number", "String"]); + this.appendDummyInput() + .appendField(Lang.Blocks.HAMSTER_set_both_wheels_to_2); + this.appendValueInput("RIGHT") + .setCheck(["Number", "String"]); + this.appendDummyInput() + .appendField(Lang.Blocks.HAMSTER_set_both_wheels_to_3) + .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + } }; Entry.block.hamster_set_both_wheels_to = function (sprite, script) { - var sq = Entry.hw.sendQueue; - sq.leftWheel = script.getNumberValue('LEFT'); - sq.rightWheel = script.getNumberValue('RIGHT'); - Entry.Hamster.setLineTracerMode(sq, 0); - return script.callReturn(); + var sq = Entry.hw.sendQueue; + sq.leftWheel = script.getNumberValue('LEFT'); + sq.rightWheel = script.getNumberValue('RIGHT'); + Entry.Hamster.setLineTracerMode(sq, 0); + return script.callReturn(); }; Blockly.Blocks.hamster_change_wheel_by = { - init: function() { - this.setColour("#00979D"); - this.appendDummyInput() - .appendField(Lang.Blocks.HAMSTER_change_wheel_by_1) - .appendField(new Blockly.FieldDropdown([ - [Lang.General.left,"LEFT"], - [Lang.General.right,"RIGHT"], - [Lang.General.both,"BOTH"] - ]), "DIRECTION") - .appendField(Lang.Blocks.HAMSTER_change_wheel_by_2); - this.appendValueInput("VALUE") - .setCheck(["Number", "String"]); - this.appendDummyInput() - .appendField(Lang.Blocks.HAMSTER_change_wheel_by_3) - .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); - this.setInputsInline(true); - this.setPreviousStatement(true); - this.setNextStatement(true); - } + init: function() { + this.setColour("#00979D"); + this.appendDummyInput() + .appendField(Lang.Blocks.HAMSTER_change_wheel_by_1) + .appendField(new Blockly.FieldDropdown([ + [Lang.Blocks.HAMSTER_left_wheel,"LEFT"], + [Lang.Blocks.HAMSTER_right_wheel,"RIGHT"], + [Lang.Blocks.HAMSTER_both_wheels,"BOTH"] + ]), "DIRECTION") + .appendField(Lang.Blocks.HAMSTER_change_wheel_by_2); + this.appendValueInput("VALUE") + .setCheck(["Number", "String"]); + this.appendDummyInput() + .appendField(Lang.Blocks.HAMSTER_change_wheel_by_3) + .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + } }; Entry.block.hamster_change_wheel_by = function (sprite, script) { - var sq = Entry.hw.sendQueue; - var direction = script.getField('DIRECTION'); - var value = script.getNumberValue('VALUE'); - if (direction == 'LEFT') { - sq.leftWheel = sq.leftWheel != undefined ? sq.leftWheel + value : value; - } else if (direction == 'RIGHT') { - sq.rightWheel = sq.rightWheel != undefined ? sq.rightWheel + value : value; - } else { - sq.leftWheel = sq.leftWheel != undefined ? sq.leftWheel + value : value; - sq.rightWheel = sq.rightWheel != undefined ? sq.rightWheel + value : value; - } - Entry.Hamster.setLineTracerMode(sq, 0); - return script.callReturn(); + var sq = Entry.hw.sendQueue; + var direction = script.getField('DIRECTION'); + var value = script.getNumberValue('VALUE'); + if (direction == 'LEFT') { + sq.leftWheel = sq.leftWheel != undefined ? sq.leftWheel + value : value; + } else if (direction == 'RIGHT') { + sq.rightWheel = sq.rightWheel != undefined ? sq.rightWheel + value : value; + } else { + sq.leftWheel = sq.leftWheel != undefined ? sq.leftWheel + value : value; + sq.rightWheel = sq.rightWheel != undefined ? sq.rightWheel + value : value; + } + Entry.Hamster.setLineTracerMode(sq, 0); + return script.callReturn(); }; Blockly.Blocks.hamster_set_wheel_to = { - init: function() { - this.setColour("#00979D"); - this.appendDummyInput() - .appendField(Lang.Blocks.HAMSTER_set_wheel_to_1) - .appendField(new Blockly.FieldDropdown([ - [Lang.General.left,"LEFT"], - [Lang.General.right,"RIGHT"], - [Lang.General.both,"BOTH"] - ]), "DIRECTION") - .appendField(Lang.Blocks.HAMSTER_set_wheel_to_2); - this.appendValueInput("VALUE") - .setCheck(["Number", "String"]); - this.appendDummyInput() - .appendField(Lang.Blocks.HAMSTER_set_wheel_to_3) - .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); - this.setInputsInline(true); - this.setPreviousStatement(true); - this.setNextStatement(true); - } + init: function() { + this.setColour("#00979D"); + this.appendDummyInput() + .appendField(Lang.Blocks.HAMSTER_set_wheel_to_1) + .appendField(new Blockly.FieldDropdown([ + [Lang.Blocks.HAMSTER_left_wheel,"LEFT"], + [Lang.Blocks.HAMSTER_right_wheel,"RIGHT"], + [Lang.Blocks.HAMSTER_both_wheels,"BOTH"] + ]), "DIRECTION") + .appendField(Lang.Blocks.HAMSTER_set_wheel_to_2); + this.appendValueInput("VALUE") + .setCheck(["Number", "String"]); + this.appendDummyInput() + .appendField(Lang.Blocks.HAMSTER_set_wheel_to_3) + .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + } }; Entry.block.hamster_set_wheel_to = function (sprite, script) { - var sq = Entry.hw.sendQueue; - var direction = script.getField('DIRECTION'); - var value = script.getNumberValue('VALUE'); - if (direction == 'LEFT') { - sq.leftWheel = value; - } else if (direction == 'RIGHT') { - sq.rightWheel = value; - } else { - sq.leftWheel = value; - sq.rightWheel = value; - } - Entry.Hamster.setLineTracerMode(sq, 0); - return script.callReturn(); + var sq = Entry.hw.sendQueue; + var direction = script.getField('DIRECTION'); + var value = script.getNumberValue('VALUE'); + if (direction == 'LEFT') { + sq.leftWheel = value; + } else if (direction == 'RIGHT') { + sq.rightWheel = value; + } else { + sq.leftWheel = value; + sq.rightWheel = value; + } + Entry.Hamster.setLineTracerMode(sq, 0); + return script.callReturn(); }; Blockly.Blocks.hamster_follow_line_using = { - init: function() { - this.setColour("#00979D"); - this.appendDummyInput() - .appendField(Lang.Blocks.HAMSTER_follow_line_using_1) - .appendField(new Blockly.FieldDropdown([ - [Lang.Blocks.HAMSTER_color_black,"BLACK"], - [Lang.General.white,"WHITE"] - ]), "COLOR") - .appendField(Lang.Blocks.HAMSTER_follow_line_using_2) - .appendField(new Blockly.FieldDropdown([ - [Lang.General.left,"LEFT"], - [Lang.General.right,"RIGHT"], - [Lang.General.both,"BOTH"] - ]), "DIRECTION") - .appendField(Lang.Blocks.HAMSTER_follow_line_using_3) - .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); - this.setInputsInline(true); - this.setPreviousStatement(true); - this.setNextStatement(true); - } + init: function() { + this.setColour("#00979D"); + this.appendDummyInput() + .appendField(Lang.Blocks.HAMSTER_follow_line_using_1) + .appendField(new Blockly.FieldDropdown([ + [Lang.Blocks.HAMSTER_color_black,"BLACK"], + [Lang.Blocks.HAMSTER_color_white,"WHITE"] + ]), "COLOR") + .appendField(Lang.Blocks.HAMSTER_follow_line_using_2) + .appendField(new Blockly.FieldDropdown([ + [Lang.Blocks.HAMSTER_left_floor_sensor,"LEFT"], + [Lang.Blocks.HAMSTER_right_floor_sensor,"RIGHT"], + [Lang.Blocks.HAMSTER_both_floor_sensors,"BOTH"] + ]), "DIRECTION") + .appendField(Lang.Blocks.HAMSTER_follow_line_using_3) + .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + } }; Entry.block.hamster_follow_line_using = function (sprite, script) { - var sq = Entry.hw.sendQueue; - var color = script.getField('COLOR'); - var direction = script.getField('DIRECTION'); + var sq = Entry.hw.sendQueue; + var color = script.getField('COLOR'); + var direction = script.getField('DIRECTION'); - var mode = 1; - if (direction == 'RIGHT') mode = 2; - else if (direction == 'BOTH') mode = 3; - if (color == 'WHITE') mode += 7; + var mode = 1; + if (direction == 'RIGHT') mode = 2; + else if (direction == 'BOTH') mode = 3; + if (color == 'WHITE') mode += 7; - sq.leftWheel = 0; - sq.rightWheel = 0; - Entry.Hamster.setLineTracerMode(sq, mode); - return script.callReturn(); + sq.leftWheel = 0; + sq.rightWheel = 0; + Entry.Hamster.setLineTracerMode(sq, mode); + return script.callReturn(); }; Blockly.Blocks.hamster_follow_line_until = { - init: function() { - this.setColour("#00979D"); - this.appendDummyInput() - .appendField(Lang.Blocks.HAMSTER_follow_line_until_1) - .appendField(new Blockly.FieldDropdown([ - [Lang.Blocks.HAMSTER_color_black,"BLACK"], - [Lang.General.white,"WHITE"] - ]), "COLOR") - .appendField(Lang.Blocks.HAMSTER_follow_line_until_2) - .appendField(new Blockly.FieldDropdown([ - [Lang.General.left,"LEFT"], - [Lang.General.right,"RIGHT"], - [Lang.Blocks.HAMSTER_front,"FRONT"], - [Lang.Blocks.HAMSTER_rear,"REAR"] - ]), "DIRECTION") - .appendField(Lang.Blocks.HAMSTER_follow_line_until_3) - .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); - this.setInputsInline(true); - this.setPreviousStatement(true); - this.setNextStatement(true); - } + init: function() { + this.setColour("#00979D"); + this.appendDummyInput() + .appendField(Lang.Blocks.HAMSTER_follow_line_until_1) + .appendField(new Blockly.FieldDropdown([ + [Lang.Blocks.HAMSTER_color_black,"BLACK"], + [Lang.Blocks.HAMSTER_color_white,"WHITE"] + ]), "COLOR") + .appendField(Lang.Blocks.HAMSTER_follow_line_until_2) + .appendField(new Blockly.FieldDropdown([ + [Lang.Blocks.HAMSTER_left_intersection,"LEFT"], + [Lang.Blocks.HAMSTER_right_intersection,"RIGHT"], + [Lang.Blocks.HAMSTER_front_intersection,"FRONT"], + [Lang.Blocks.HAMSTER_rear_intersection,"REAR"] + ]), "DIRECTION") + .appendField(Lang.Blocks.HAMSTER_follow_line_until_3) + .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + } }; Entry.block.hamster_follow_line_until = function (sprite, script) { - var sq = Entry.hw.sendQueue; - var pd = Entry.hw.portData; - var color = script.getField('COLOR'); - var direction = script.getField('DIRECTION'); + var sq = Entry.hw.sendQueue; + var pd = Entry.hw.portData; + var color = script.getField('COLOR'); + var direction = script.getField('DIRECTION'); - var mode = 4; - if (direction == 'RIGHT') mode = 5; - else if (direction == 'FRONT') mode = 6; - else if (direction == 'REAR') mode = 7; - if (color == 'WHITE') mode += 7; + var mode = 4; + if (direction == 'RIGHT') mode = 5; + else if (direction == 'FRONT') mode = 6; + else if (direction == 'REAR') mode = 7; + if (color == 'WHITE') mode += 7; - if (!script.isStart) { - script.isStart = true; - sq.leftWheel = 0; - sq.rightWheel = 0; - Entry.Hamster.setLineTracerMode(sq, mode); - return script; - } else { - var hamster = Entry.Hamster; - if (pd.lineTracerStateId != hamster.lineTracerStateId) { - hamster.lineTracerStateId = pd.lineTracerStateId; - if (pd.lineTracerState == 0x40) { - delete script.isStart; - Entry.engine.isContinue = false; - hamster.setLineTracerMode(sq, 0); - return script.callReturn(); - } - } - return script; - } + if (!script.isStart) { + script.isStart = true; + sq.leftWheel = 0; + sq.rightWheel = 0; + Entry.Hamster.setLineTracerMode(sq, mode); + return script; + } else { + var hamster = Entry.Hamster; + if (pd.lineTracerStateId != hamster.lineTracerStateId) { + hamster.lineTracerStateId = pd.lineTracerStateId; + if (pd.lineTracerState == 0x40) { + delete script.isStart; + Entry.engine.isContinue = false; + hamster.setLineTracerMode(sq, 0); + return script.callReturn(); + } + } + return script; + } }; 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(true); - this.setPreviousStatement(true); - this.setNextStatement(true); - } + 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(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + } }; Entry.block.hamster_set_following_speed_to = function (sprite, script) { - var sq = Entry.hw.sendQueue; - sq.lineTracerSpeed = Number(script.getField("SPEED", script)); - return script.callReturn(); + var sq = Entry.hw.sendQueue; + sq.lineTracerSpeed = Number(script.getField("SPEED", script)); + return script.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(true); - this.setPreviousStatement(true); - this.setNextStatement(true); - } + 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(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + } }; Entry.block.hamster_stop = function (sprite, script) { - var sq = Entry.hw.sendQueue; - sq.leftWheel = 0; - sq.rightWheel = 0; - Entry.Hamster.setLineTracerMode(sq, 0); - return script.callReturn(); + var sq = Entry.hw.sendQueue; + sq.leftWheel = 0; + sq.rightWheel = 0; + Entry.Hamster.setLineTracerMode(sq, 0); + return script.callReturn(); }; //led 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(true); - this.setPreviousStatement(true); - this.setNextStatement(true); - } + init: function() { + this.setColour("#00979D"); + this.appendDummyInput() + .appendField(Lang.Blocks.HAMSTER_set_led_to_1) + .appendField(new Blockly.FieldDropdown([ + [Lang.Blocks.HAMSTER_left_led,"LEFT"], + [Lang.Blocks.HAMSTER_right_led,"RIGHT"], + [Lang.Blocks.HAMSTER_both_leds,"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.Blocks.HAMSTER_color_white,"7"] + ]), "COLOR") + .appendField(Lang.Blocks.HAMSTER_set_led_to_3) + .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + } }; Entry.block.hamster_set_led_to = function (sprite, script) { - var sq = Entry.hw.sendQueue; - var direction = script.getField("DIRECTION", script); - var color = Number(script.getField("COLOR", script)); - if (direction == 'LEFT') { - sq.leftLed = color; - } else if (direction == 'RIGHT') { - sq.rightLed = color; - } else { - sq.leftLed = color; - sq.rightLed = color; - } - return script.callReturn(); + var sq = Entry.hw.sendQueue; + var direction = script.getField("DIRECTION", script); + var color = Number(script.getField("COLOR", script)); + if (direction == 'LEFT') { + sq.leftLed = color; + } else if (direction == 'RIGHT') { + sq.rightLed = color; + } else { + sq.leftLed = color; + sq.rightLed = color; + } + return script.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(true); - this.setPreviousStatement(true); - this.setNextStatement(true); - } + init: function() { + this.setColour("#00979D"); + this.appendDummyInput() + .appendField(Lang.Blocks.HAMSTER_clear_led_1) + .appendField(new Blockly.FieldDropdown([ + [Lang.Blocks.HAMSTER_left_led,"LEFT"], + [Lang.Blocks.HAMSTER_right_led,"RIGHT"], + [Lang.Blocks.HAMSTER_both_leds,"BOTH"] + ]), "DIRECTION") + .appendField(Lang.Blocks.HAMSTER_clear_led_2) + .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + } }; Entry.block.hamster_clear_led = function (sprite, script) { - var sq = Entry.hw.sendQueue; - var direction = script.getField("DIRECTION", script); - if (direction == 'LEFT') { - sq.leftLed = 0; - } else if (direction == 'RIGHT') { - sq.rightLed = 0; - } else { - sq.leftLed = 0; - sq.rightLed = 0; - } - return script.callReturn(); + var sq = Entry.hw.sendQueue; + var direction = script.getField("DIRECTION", script); + if (direction == 'LEFT') { + sq.leftLed = 0; + } else if (direction == 'RIGHT') { + sq.rightLed = 0; + } else { + sq.leftLed = 0; + sq.rightLed = 0; + } + return script.callReturn(); }; //buzzer 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(true); - this.setPreviousStatement(true); - this.setNextStatement(true); - } + 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(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + } }; Entry.block.hamster_beep = function (sprite, script) { - var sq = Entry.hw.sendQueue; - if (!script.isStart) { - script.isStart = true; - script.timeFlag = 1; - sq.buzzer = 440; - sq.note = 0; - var timeValue = 0.2 * 1000; - var timer = setTimeout(function() { - script.timeFlag = 0; - Entry.Hamster.removeTimeout(timer); - }, timeValue); - Entry.Hamster.timeouts.push(timer); - return script; - } else if (script.timeFlag == 1) { - return script; - } else { - delete script.isStart; - delete script.timeFlag; - Entry.engine.isContinue = false; - sq.buzzer = 0; - return script.callReturn(); - } + var sq = Entry.hw.sendQueue; + if (!script.isStart) { + script.isStart = true; + script.timeFlag = 1; + sq.buzzer = 440; + sq.note = 0; + var timeValue = 0.2 * 1000; + var timer = setTimeout(function() { + script.timeFlag = 0; + Entry.Hamster.removeTimeout(timer); + }, timeValue); + Entry.Hamster.timeouts.push(timer); + return script; + } else if (script.timeFlag == 1) { + return script; + } else { + delete script.isStart; + delete script.timeFlag; + Entry.engine.isContinue = false; + sq.buzzer = 0; + return script.callReturn(); + } }; Blockly.Blocks.hamster_change_buzzer_by = { - init: function() { - this.setColour("#00979D"); - this.appendDummyInput() - .appendField(Lang.Blocks.HAMSTER_change_buzzer_by_1); - this.appendValueInput("VALUE") - .setCheck(["Number", "String"]); - this.appendDummyInput() - .appendField(Lang.Blocks.HAMSTER_change_buzzer_by_2) - .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); - this.setInputsInline(true); - this.setPreviousStatement(true); - this.setNextStatement(true); - } + init: function() { + this.setColour("#00979D"); + this.appendDummyInput() + .appendField(Lang.Blocks.HAMSTER_change_buzzer_by_1); + this.appendValueInput("VALUE") + .setCheck(["Number", "String"]); + this.appendDummyInput() + .appendField(Lang.Blocks.HAMSTER_change_buzzer_by_2) + .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + } }; Entry.block.hamster_change_buzzer_by = function (sprite, script) { - var sq = Entry.hw.sendQueue; - var value = script.getNumberValue('VALUE'); - sq.buzzer = sq.buzzer != undefined ? sq.buzzer + value : value; - sq.note = 0; - return script.callReturn(); + var sq = Entry.hw.sendQueue; + var value = script.getNumberValue('VALUE'); + sq.buzzer = sq.buzzer != undefined ? sq.buzzer + value : value; + sq.note = 0; + return script.callReturn(); }; Blockly.Blocks.hamster_set_buzzer_to = { - init: function() { - this.setColour("#00979D"); - this.appendDummyInput() - .appendField(Lang.Blocks.HAMSTER_set_buzzer_to_1); - this.appendValueInput("VALUE") - .setCheck(["Number", "String"]); - this.appendDummyInput() - .appendField(Lang.Blocks.HAMSTER_set_buzzer_to_2) - .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); - this.setInputsInline(true); - this.setPreviousStatement(true); - this.setNextStatement(true); - } + init: function() { + this.setColour("#00979D"); + this.appendDummyInput() + .appendField(Lang.Blocks.HAMSTER_set_buzzer_to_1); + this.appendValueInput("VALUE") + .setCheck(["Number", "String"]); + this.appendDummyInput() + .appendField(Lang.Blocks.HAMSTER_set_buzzer_to_2) + .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + } }; Entry.block.hamster_set_buzzer_to = function (sprite, script) { - var sq = Entry.hw.sendQueue; - sq.buzzer = script.getNumberValue('VALUE'); - sq.note = 0; - return script.callReturn(); + var sq = Entry.hw.sendQueue; + sq.buzzer = script.getNumberValue('VALUE'); + sq.note = 0; + return script.callReturn(); }; Blockly.Blocks.hamster_clear_buzzer = { - init: function() { - this.setColour("#00979D"); - this.appendDummyInput() - .appendField(Lang.Blocks.HAMSTER_clear_buzzer) - .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); - this.setInputsInline(true); - this.setPreviousStatement(true); - this.setNextStatement(true); - } + init: function() { + this.setColour("#00979D"); + this.appendDummyInput() + .appendField(Lang.Blocks.HAMSTER_clear_buzzer) + .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + } }; Entry.block.hamster_clear_buzzer = function (sprite, script) { - var sq = Entry.hw.sendQueue; - sq.buzzer = 0; - sq.note = 0; - return script.callReturn(); + var sq = Entry.hw.sendQueue; + sq.buzzer = 0; + sq.note = 0; + return script.callReturn(); }; Blockly.Blocks.hamster_play_note_for = { - init: function() { - this.setColour("#00979D"); - this.appendDummyInput() - .appendField(Lang.Blocks.HAMSTER_play_note_for_1) - .appendField(new Blockly.FieldDropdown([ - [Lang.General.note_c + '',"4"], - [Lang.General.note_c + '#',"5"], - [Lang.General.note_d + '',"6"], - [Lang.General.note_e + 'b',"7"], - [Lang.General.note_e + '',"8"], - [Lang.General.note_f + '',"9"], - [Lang.General.note_f + '#',"10"], - [Lang.General.note_g + '',"11"], - [Lang.General.note_g + '#',"12"], - [Lang.General.note_a + '',"13"], - [Lang.General.note_b + 'b',"14"], - [Lang.General.note_b + '',"15"] - ]), "NOTE") - .appendField(Lang.Blocks.HAMSTER_play_note_for_2) - .appendField(new Blockly.FieldDropdown([ - ['1',"1"], - ['2',"2"], - ['3',"3"], - ['4',"4"], - ['5',"5"], - ['6',"6"], - ['7',"7"] - ]), "OCTAVE") - .appendField(Lang.Blocks.HAMSTER_play_note_for_3) - this.appendValueInput("VALUE") - .setCheck(["Number", "String"]); - this.appendDummyInput() - .appendField(Lang.Blocks.HAMSTER_play_note_for_4) - .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); - this.setInputsInline(true); - this.setPreviousStatement(true); - this.setNextStatement(true); - } + init: function() { + this.setColour("#00979D"); + this.appendDummyInput() + .appendField(Lang.Blocks.HAMSTER_play_note_for_1) + .appendField(new Blockly.FieldDropdown([ + [Lang.General.note_c + '',"4"], + [Lang.General.note_c + '#',"5"], + [Lang.General.note_d + '',"6"], + [Lang.General.note_e + 'b',"7"], + [Lang.General.note_e + '',"8"], + [Lang.General.note_f + '',"9"], + [Lang.General.note_f + '#',"10"], + [Lang.General.note_g + '',"11"], + [Lang.General.note_g + '#',"12"], + [Lang.General.note_a + '',"13"], + [Lang.General.note_b + 'b',"14"], + [Lang.General.note_b + '',"15"] + ]), "NOTE") + .appendField(Lang.Blocks.HAMSTER_play_note_for_2) + .appendField(new Blockly.FieldDropdown([ + ['1',"1"], + ['2',"2"], + ['3',"3"], + ['4',"4"], + ['5',"5"], + ['6',"6"], + ['7',"7"] + ]), "OCTAVE") + .appendField(Lang.Blocks.HAMSTER_play_note_for_3) + this.appendValueInput("VALUE") + .setCheck(["Number", "String"]); + this.appendDummyInput() + .appendField(Lang.Blocks.HAMSTER_play_note_for_4) + .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + } }; Entry.block.hamster_play_note_for = function (sprite, script) { - var sq = Entry.hw.sendQueue; - if (!script.isStart) { - var note = script.getNumberField("NOTE", script); - var octave = script.getNumberField("OCTAVE", script); - var beat = script.getNumberValue("VALUE", script); - var tempo = Entry.Hamster.tempo; - note += (octave-1)*12; - var timeValue = beat*60*1000/tempo; - script.isStart = true; - script.timeFlag = 1; - sq.buzzer = 0; - sq.note = note; - if (timeValue > 100) { - var timer1 = setTimeout(function() { - sq.note = 0; - Entry.Hamster.removeTimeout(timer1); - }, timeValue-100); - Entry.Hamster.timeouts.push(timer1); - } - var timer2 = setTimeout(function() { - script.timeFlag = 0; - Entry.Hamster.removeTimeout(timer2); - }, timeValue); - Entry.Hamster.timeouts.push(timer2); - return script; - } else if (script.timeFlag == 1) { - return script; - } else { - delete script.isStart; - delete script.timeFlag; - Entry.engine.isContinue = false; - sq.note = 0; - return script.callReturn(); - } + var sq = Entry.hw.sendQueue; + if (!script.isStart) { + var note = script.getNumberField("NOTE", script); + var octave = script.getNumberField("OCTAVE", script); + var beat = script.getNumberValue("VALUE", script); + var tempo = Entry.Hamster.tempo; + note += (octave-1)*12; + var timeValue = beat*60*1000/tempo; + script.isStart = true; + script.timeFlag = 1; + sq.buzzer = 0; + sq.note = note; + if (timeValue > 100) { + var timer1 = setTimeout(function() { + sq.note = 0; + Entry.Hamster.removeTimeout(timer1); + }, timeValue-100); + Entry.Hamster.timeouts.push(timer1); + } + var timer2 = setTimeout(function() { + script.timeFlag = 0; + Entry.Hamster.removeTimeout(timer2); + }, timeValue); + Entry.Hamster.timeouts.push(timer2); + return script; + } else if (script.timeFlag == 1) { + return script; + } else { + delete script.isStart; + delete script.timeFlag; + Entry.engine.isContinue = false; + sq.note = 0; + return script.callReturn(); + } }; Blockly.Blocks.hamster_rest_for = { - init: function() { - this.setColour("#00979D"); - this.appendDummyInput() - .appendField(Lang.Blocks.HAMSTER_rest_for_1) - this.appendValueInput("VALUE") - .setCheck(["Number", "String"]); - this.appendDummyInput() - .appendField(Lang.Blocks.HAMSTER_rest_for_2) - .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); - this.setInputsInline(true); - this.setPreviousStatement(true); - this.setNextStatement(true); - } + init: function() { + this.setColour("#00979D"); + this.appendDummyInput() + .appendField(Lang.Blocks.HAMSTER_rest_for_1) + this.appendValueInput("VALUE") + .setCheck(["Number", "String"]); + this.appendDummyInput() + .appendField(Lang.Blocks.HAMSTER_rest_for_2) + .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + } }; Entry.block.hamster_rest_for = function (sprite, script) { - var sq = Entry.hw.sendQueue; - if (!script.isStart) { - script.isStart = true; - script.timeFlag = 1; - var timeValue = script.getNumberValue('VALUE'); - timeValue = timeValue*60*1000/Entry.Hamster.tempo; - sq.buzzer = 0; - sq.note = 0; - var timer = setTimeout(function() { - script.timeFlag = 0; - Entry.Hamster.removeTimeout(timer); - }, timeValue); - Entry.Hamster.timeouts.push(timer); - return script; - } else if (script.timeFlag == 1) { - return script; - } else { - delete script.isStart; - delete script.timeFlag; - Entry.engine.isContinue = false; - return script.callReturn(); - } + var sq = Entry.hw.sendQueue; + if (!script.isStart) { + script.isStart = true; + script.timeFlag = 1; + var timeValue = script.getNumberValue('VALUE'); + timeValue = timeValue*60*1000/Entry.Hamster.tempo; + sq.buzzer = 0; + sq.note = 0; + var timer = setTimeout(function() { + script.timeFlag = 0; + Entry.Hamster.removeTimeout(timer); + }, timeValue); + Entry.Hamster.timeouts.push(timer); + return script; + } else if (script.timeFlag == 1) { + return script; + } else { + delete script.isStart; + delete script.timeFlag; + Entry.engine.isContinue = false; + return script.callReturn(); + } }; Blockly.Blocks.hamster_change_tempo_by = { - init: function() { - this.setColour("#00979D"); - this.appendDummyInput() - .appendField(Lang.Blocks.HAMSTER_change_tempo_by_1); - this.appendValueInput("VALUE") - .setCheck(["Number", "String"]); - this.appendDummyInput() - .appendField(Lang.Blocks.HAMSTER_change_tempo_by_2) - .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); - this.setInputsInline(true); - this.setPreviousStatement(true); - this.setNextStatement(true); - } + init: function() { + this.setColour("#00979D"); + this.appendDummyInput() + .appendField(Lang.Blocks.HAMSTER_change_tempo_by_1); + this.appendValueInput("VALUE") + .setCheck(["Number", "String"]); + this.appendDummyInput() + .appendField(Lang.Blocks.HAMSTER_change_tempo_by_2) + .appendField(new Blockly.FieldIcon(Entry.mediaFilePath + 'block_icon/hardware_03.png', '*')); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + } }; Entry.block.hamster_change_tempo_by = function (sprite, script) { - Entry.Hamster.tempo += script.getNumberValue('VALUE'); - if (Entry.Hamster.tempo < 1) Entry.Hamster.tempo = 1; - return script.callReturn(); + Entry.Hamster.tempo += script.getNumberValue('VALUE'); + if (Entry.Hamster.tempo < 1) Entry.Hamster.tempo = 1; + return script.callReturn(); }; 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(true); - this.setPreviousStatement(true); - this.setNextStatement(true); - } + 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(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + } }; Entry.block.hamster_set_tempo_to = function (sprite, script) { - Entry.Hamster.tempo = script.getNumberValue('VALUE'); - if (Entry.Hamster.tempo < 1) Entry.Hamster.tempo = 1; - return script.callReturn(); + Entry.Hamster.tempo = script.getNumberValue('VALUE'); + if (Entry.Hamster.tempo < 1) Entry.Hamster.tempo = 1; + return script.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(true); - this.setPreviousStatement(true); - this.setNextStatement(true); - } + 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_a_b, "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(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + } }; Entry.block.hamster_set_port_to = function(sprite, script) { - var sq = Entry.hw.sendQueue; - var port = script.getField("PORT", script); - var mode = Number(script.getField("MODE", script)); - if (port == 'A') { - sq.ioModeA = mode; - } else if (port == 'B') { - sq.ioModeB = mode; - } else { - sq.ioModeA = mode; - sq.ioModeB = mode; - } - return script.callReturn(); + var sq = Entry.hw.sendQueue; + var port = script.getField("PORT", script); + var mode = Number(script.getField("MODE", script)); + if (port == 'A') { + sq.ioModeA = mode; + } else if (port == 'B') { + sq.ioModeB = mode; + } else { + sq.ioModeA = mode; + sq.ioModeB = mode; + } + return script.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); - } + 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_a_b, "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(sprite, script) { - var sq = Entry.hw.sendQueue; - var port = script.getField('PORT'); - var value = script.getNumberValue('VALUE'); - if (port == 'A') { - sq.outputA = sq.outputA != undefined ? sq.outputA + value : value; - } else if (port == 'B') { - sq.outputB = sq.outputB != undefined ? sq.outputB + value : value; - } else { - sq.outputA = sq.outputA != undefined ? sq.outputA + value : value; - sq.outputB = sq.outputB != undefined ? sq.outputB + value : value; - } - return script.callReturn(); + var sq = Entry.hw.sendQueue; + var port = script.getField('PORT'); + var value = script.getNumberValue('VALUE'); + if (port == 'A') { + sq.outputA = sq.outputA != undefined ? sq.outputA + value : value; + } else if (port == 'B') { + sq.outputB = sq.outputB != undefined ? sq.outputB + value : value; + } else { + sq.outputA = sq.outputA != undefined ? sq.outputA + value : value; + sq.outputB = sq.outputB != undefined ? sq.outputB + value : value; + } + return script.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); - } + 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_a_b, "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(sprite, script) { - var sq = Entry.hw.sendQueue; - var port = script.getField('PORT'); - var value = script.getNumberValue('VALUE'); - if (port == 'A') { - sq.outputA = value; - } else if (port == 'B') { - sq.outputB = value; - } else { - sq.outputA = value; - sq.outputB = value; - } - return script.callReturn(); + var sq = Entry.hw.sendQueue; + var port = script.getField('PORT'); + var value = script.getNumberValue('VALUE'); + if (port == 'A') { + sq.outputA = value; + } else if (port == 'B') { + sq.outputB = value; + } else { + sq.outputA = value; + sq.outputB = value; + } + return script.callReturn(); }; From 62124bc6c7b0229054b904c3601a301db539d2dd Mon Sep 17 00:00:00 2001 From: chanlee Date: Wed, 17 Aug 2016 10:28:12 +0900 Subject: [PATCH 11/15] add albert_is_oid_value block --- extern/util/static.js | 3 ++- src/workspace/block_entry.js | 48 ++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/extern/util/static.js b/extern/util/static.js index 09060d33ff..6bad2769ef 100644 --- a/extern/util/static.js +++ b/extern/util/static.js @@ -378,6 +378,7 @@ EntryStatic.getAllBlocks = function() { "hamster_change_output_by", "hamster_set_output_to", "albert_hand_found", + "albert_is_oid_value", "albert_value", "albert_move_forward_for_secs", "albert_move_backward_for_secs", @@ -2527,4 +2528,4 @@ if (typeof exports == "object") { exports.getAllBlocks = EntryStatic.getAllBlocks; exports.getCategoryByBlock = EntryStatic.getCategoryByBlock; exports.EntryStatic = EntryStatic; -} \ No newline at end of file +} diff --git a/src/workspace/block_entry.js b/src/workspace/block_entry.js index 8929bed904..a18bd63ad3 100644 --- a/src/workspace/block_entry.js +++ b/src/workspace/block_entry.js @@ -28,6 +28,54 @@ Entry.block = { return pd.leftProximity > 40 || pd.rightProximity > 40; } }, + "ablert_is_oid_value": { + "color": "#00979D", + "fontColor": "#fff", + "skeleton": "basic_boolean_field", + "statements": [], + "params": [ + { + "type": "Dropdown", + "options": [ + [Lang.Blocks.ALBERT_front_oid ,"FRONT"], + [Lang.Blocks.ALBERT_back_oid,"BACK"] + ], + "value": "FRONT", + "fontSize": 11 + }, + { + "type": "Block", + "accept": "string" + } + ], + "events": {}, + "def": { + "params": [ + null, + { + "type": "number", + "params": [ "0" ] + } + ], + "type": "albert_is_oid_value" + }, + "paramsKeyMap": { + "OID": 0, + "VALUE": 1 + }, + "class": "albert_sensor", + "isNotFor": [ "albert" ], + "func": function(sprite, script) { + var pd = Entry.hw.portData; + var oid = script.getField("OID", script); + var value = script.getNumberValue("VALUE"); + if (oid == 'FRONT') { + return pd.frontOid == value; + } else { + return pd.backOid == value; + } + } + }, "albert_value": { "color": "#00979D", "skeleton": "basic_string_field", From 207b6d880d6cf0d4e2446b6c0b61287e0ecf9fe5 Mon Sep 17 00:00:00 2001 From: chanlee Date: Wed, 17 Aug 2016 13:33:28 +0900 Subject: [PATCH 12/15] albert albert_move_to_x_y_on_board block added --- extern/lang/code.js | 1 + extern/lang/en.js | 1 + extern/lang/ko.js | 1 + extern/util/static.js | 1 + src/workspace/block_entry.js | 130 ++++++++++++++++++++++++++++++++--- 5 files changed, 125 insertions(+), 9 deletions(-) diff --git a/extern/lang/code.js b/extern/lang/code.js index 4c2b428238..d4b743577b 100644 --- a/extern/lang/code.js +++ b/extern/lang/code.js @@ -3423,6 +3423,7 @@ Lang.Hw = { }; Lang.template = { "albert_hand_found": "Entry.Albert.isHandFound()", + "albert_is_oid_value": "Entry.Albert.isOidValue( %1 ) %2", "albert_value": "%1", "albert_move_forward_for_secs": "Entry.Albert.moveForwardForSecs( %1 ) %2", "albert_move_backward_for_secs": "Entry.Albert.moveBackwardForSecs( %1 ) %2", diff --git a/extern/lang/en.js b/extern/lang/en.js index e9079b241d..22f6beda5d 100644 --- a/extern/lang/en.js +++ b/extern/lang/en.js @@ -3423,6 +3423,7 @@ Lang.Hw = { }; Lang.template = { "albert_hand_found": "hand found?", + "albert_is_oid_value": "Is %1 oid? %2", "albert_value": "%1", "albert_move_forward_for_secs": "move forward for %1 secs %2", "albert_move_backward_for_secs": "move backward for %1 secs %2", diff --git a/extern/lang/ko.js b/extern/lang/ko.js index ef809c7e78..a8320a6ffd 100644 --- a/extern/lang/ko.js +++ b/extern/lang/ko.js @@ -3423,6 +3423,7 @@ Lang.Hw = { }; Lang.template = { "albert_hand_found": "손 찾음?", + "albert_is_oid_value": "OID 값이 %1 인가? %2", "albert_value": "%1", "albert_move_forward_for_secs": "앞으로 %1 초 이동하기 %2", "albert_move_backward_for_secs": "뒤로 %1 초 이동하기 %2", diff --git a/extern/util/static.js b/extern/util/static.js index 6bad2769ef..046e6ab3d8 100644 --- a/extern/util/static.js +++ b/extern/util/static.js @@ -389,6 +389,7 @@ EntryStatic.getAllBlocks = function() { "albert_set_wheel_to", "albert_stop", "albert_set_pad_size_to", + "albert_move_to_x_y_on_board", "albert_set_eye_to", "albert_clear_eye", "albert_body_led", diff --git a/src/workspace/block_entry.js b/src/workspace/block_entry.js index a18bd63ad3..6bbed00c80 100644 --- a/src/workspace/block_entry.js +++ b/src/workspace/block_entry.js @@ -28,10 +28,10 @@ Entry.block = { return pd.leftProximity > 40 || pd.rightProximity > 40; } }, - "ablert_is_oid_value": { + "albert_is_oid_value": { "color": "#00979D", "fontColor": "#fff", - "skeleton": "basic_boolean_field", + "skeleton": "basic_string_field", "statements": [], "params": [ { @@ -84,15 +84,15 @@ Entry.block = { { "type": "Dropdown", "options": [ - [Lang.Blocks.ALBERT_sensor_leftProximity ,"leftProximity"], - [Lang.Blocks.ALBERT_sensor_rightProximity,"rightProximity"], + [Lang.Blocks.ALBERT_sensor_left_proximity ,"leftProximity"], + [Lang.Blocks.ALBERT_sensor_right_proximity,"rightProximity"], [Lang.Blocks.ALBERT_sensor_light,"light"], [Lang.Blocks.ALBERT_sensor_battery,"battery"], - [Lang.Blocks.ALBERT_sensor_signalStrength,"signalStrength"], - [Lang.Blocks.ALBERT_sensor_frontOid,"frontOid"], - [Lang.Blocks.ALBERT_sensor_backOid,"backOid"], - [Lang.Blocks.ALBERT_sensor_positionX,"positionX"], - [Lang.Blocks.ALBERT_sensor_positionY,"positionY"], + [Lang.Blocks.ALBERT_sensor_signal_strength,"signalStrength"], + [Lang.Blocks.ALBERT_sensor_front_oid,"frontOid"], + [Lang.Blocks.ALBERT_sensor_back_oid,"backOid"], + [Lang.Blocks.ALBERT_sensor_position_x,"positionX"], + [Lang.Blocks.ALBERT_sensor_position_y,"positionY"], [Lang.Blocks.ALBERT_sensor_orientation,"orientation"] ], "value": "leftProximity", @@ -598,6 +598,118 @@ Entry.block = { return script.callReturn(); } }, + "albert_move_to_x_y_on_board": { + "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": "number", + "params": [ "0" ] + }, + { + "type": "number", + "params": [ "0" ] + }, + null + ], + "type": "albert_move_to_x_y_on_board" + }, + "paramsKeyMap": { + "X": 0, + "Y": 1 + }, + "class": "albert_wheel", + "isNotFor": [ "albert" ], + "func": function (sprite, script) { + var sq = Entry.hw.sendQueue; + var pd = Entry.hw.portData; + var controller = Entry.Albert.controller; + if (!script.isStart) { + script.isStart = true; + script.isMoving = true; + script.initialized = false; + script.boardState = 1; + script.x = -1; + script.y = -1; + script.theta = -200; + script.targetX = script.getNumberValue('X'); + script.targetY = script.getNumberValue('Y'); + controller.clear(); + sq.leftWheel = 0; + sq.rightWheel = 0; + return script; + } else if (script.isMoving) { + if(pd.positionX >= 0) script.x = pd.positionX; + if(pd.positionY >= 0) script.y = pd.positionY; + script.theta = pd.orientation; + switch(script.boardState) { + case 1: { + if(script.initialized == false) { + if(script.x < 0 || script.y < 0) { + sq.leftWheel = 20; + sq.rightWheel = -20; + return script; + } + script.initialized = true; + } + var current = controller.toRadian(script.theta); + var dx = script.targetX - script.x; + var dy = script.targetY - script.y; + var target = Math.atan2(dy, dx); + if(controller.controlAngle(current, target) == false) + script.boardState = 2; + break; + } + case 2: { + if(controller.controlPosition(script.x, script.y, controller.toRadian(script.theta), script.targetX, script.targetY) == false) + script.boardState = 3; + break; + } + case 3: { + if(controller.controlPositionFine(script.x, script.y, controller.toRadian(script.theta), script.targetX, script.targetY) == false) { + sq.leftWheel = 0; + sq.rightWheel = 0; + script.isMoving = false; + } + break; + } + } + return script; + } else { + delete script.isStart; + delete script.isMoving; + delete script.initialized; + delete script.boardState; + delete script.x; + delete script.y; + delete script.theta; + delete script.targetX; + delete script.targetY; + Entry.engine.isContinue = false; + sq.leftWheel = 0; + sq.rightWheel = 0; + return script.callReturn(); + } + } + }, "albert_set_eye_to": { "color": "#00979D", "skeleton": "basic", From 07320a1c73f4b33b31fb6e58bfa4478cd9944625 Mon Sep 17 00:00:00 2001 From: chanlee Date: Wed, 17 Aug 2016 13:54:15 +0900 Subject: [PATCH 13/15] add albert block and fix hamster lang --- extern/util/static.js | 1 + src/workspace/block_entry.js | 100 +++++++++++++++++++++++++++++++---- 2 files changed, 91 insertions(+), 10 deletions(-) diff --git a/extern/util/static.js b/extern/util/static.js index 046e6ab3d8..2bb977893e 100644 --- a/extern/util/static.js +++ b/extern/util/static.js @@ -390,6 +390,7 @@ EntryStatic.getAllBlocks = function() { "albert_stop", "albert_set_pad_size_to", "albert_move_to_x_y_on_board", + "albert_set_orientation_on_board", "albert_set_eye_to", "albert_clear_eye", "albert_body_led", diff --git a/src/workspace/block_entry.js b/src/workspace/block_entry.js index 6bbed00c80..78072abde8 100644 --- a/src/workspace/block_entry.js +++ b/src/workspace/block_entry.js @@ -710,6 +710,86 @@ Entry.block = { } } }, + "albert_set_orientation_on_board": { + "color": "#00979D", + "skeleton": "basic", + "statements": [], + "params": [ + { + "type": "Block", + "accept": "string" + }, + { + "type": "Indicator", + "img": "block_icon/hardware_03.png", + "size": 12 + } + ], + "events": {}, + "def": { + "params": [ + { + "type": "number", + "params": [ "0" ] + }, + null + ], + "type": "albert_set_orientation_on_board" + }, + "paramsKeyMap": { + "ORIENTATION": 0 + }, + "class": "albert_wheel", + "isNotFor": [ "albert" ], + "func": function (sprite, script) { + var sq = Entry.hw.sendQueue; + var pd = Entry.hw.portData; + var controller = Entry.Albert.controller; + if (!script.isStart) { + script.isStart = true; + script.isMoving = true; + script.boardState = 1; + script.theta = -200; + script.targetTheta = script.getNumberValue('ORIENTATION'); + controller.clear(); + sq.leftWheel = 0; + sq.rightWheel = 0; + return script; + } else if (script.isMoving) { + script.theta = pd.orientation; + switch(script.boardState) { + case 1: { + var current = controller.toRadian(script.theta); + var target = controller.toRadian(script.targetTheta); + if(controller.controlAngle(current, target) == false) + script.boardState = 2; + break; + } + case 2: { + var current = controller.toRadian(script.theta); + var target = controller.toRadian(script.targetTheta); + if(controller.controlAngleFine(current, target) == false) { + sq.leftWheel = 0; + sq.rightWheel = 0; + script.isMoving = false; + } + break; + } + } + return script; + } else { + delete script.isStart; + delete script.isMoving; + delete script.boardState; + delete script.theta; + delete script.targetTheta; + Entry.engine.isContinue = false; + sq.leftWheel = 0; + sq.rightWheel = 0; + return script.callReturn(); + } + } + }, "albert_set_eye_to": { "color": "#00979D", "skeleton": "basic", @@ -6851,18 +6931,18 @@ Entry.block = { { "type": "Dropdown", "options": [ - [Lang.Blocks.HAMSTER_sensor_leftProximity, "leftProximity"], - [Lang.Blocks.HAMSTER_sensor_rightProximity, "rightProximity"], - [Lang.Blocks.HAMSTER_sensor_leftFloor, "leftFloor"], - [Lang.Blocks.HAMSTER_sensor_rightFloor, "rightFloor"], - [Lang.Blocks.HAMSTER_sensor_accelerationX, "accelerationX"], - [Lang.Blocks.HAMSTER_sensor_accelerationY, "accelerationY"], - [Lang.Blocks.HAMSTER_sensor_accelerationZ, "accelerationZ"], + [Lang.Blocks.HAMSTER_sensor_left_proximity, "leftProximity"], + [Lang.Blocks.HAMSTER_sensor_right_proximity, "rightProximity"], + [Lang.Blocks.HAMSTER_sensor_left_floor, "leftFloor"], + [Lang.Blocks.HAMSTER_sensor_right_floor, "rightFloor"], + [Lang.Blocks.HAMSTER_sensor_acceleration_x, "accelerationX"], + [Lang.Blocks.HAMSTER_sensor_acceleration_y, "accelerationY"], + [Lang.Blocks.HAMSTER_sensor_acceleration_z, "accelerationZ"], [Lang.Blocks.HAMSTER_sensor_light, "light"], [Lang.Blocks.HAMSTER_sensor_temperature, "temperature"], - [Lang.Blocks.HAMSTER_sensor_signalStrength, "signalStrength"], - [Lang.Blocks.HAMSTER_sensor_inputA, "inputA"], - [Lang.Blocks.HAMSTER_sensor_inputB, "inputB"] + [Lang.Blocks.HAMSTER_sensor_signal_strength, "signalStrength"], + [Lang.Blocks.HAMSTER_sensor_input_a, "inputA"], + [Lang.Blocks.HAMSTER_sensor_input_b, "inputB"] ], "value": "leftProximity", "fontSize": 11 From 8b702a5c9ba05e22015e82f4d9bb901723172b88 Mon Sep 17 00:00:00 2001 From: chanlee Date: Wed, 17 Aug 2016 15:41:30 +0900 Subject: [PATCH 14/15] change albert and hamster port monitoring --- dist/entry.js | 30113 +++++++++++++++++----------------- dist/entry.min.js | 3863 ++--- src/blocks/block_albert.js | 31 + src/blocks/block_hamster.js | 31 +- 4 files changed, 17140 insertions(+), 16898 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index 84187cf136..2a8349eca0 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -1,14 +1,14 @@ -var Entry = {block:{}, TEXT_ALIGN_CENTER:0, TEXT_ALIGN_LEFT:1, TEXT_ALIGN_RIGHT:2, TEXT_ALIGNS:["center", "left", "right"], clipboard:null, loadProject:function(b) { - b || (b = Entry.getStartProject(Entry.mediaFilePath)); +var Entry = {block:{}, TEXT_ALIGN_CENTER:0, TEXT_ALIGN_LEFT:1, TEXT_ALIGN_RIGHT:2, TEXT_ALIGNS:["center", "left", "right"], clipboard:null, loadProject:function(a) { + a || (a = Entry.getStartProject(Entry.mediaFilePath)); "workspace" == this.type && Entry.stateManager.startIgnore(); - Entry.projectId = b._id; - Entry.variableContainer.setVariables(b.variables); - Entry.variableContainer.setMessages(b.messages); - Entry.scene.addScenes(b.scenes); + Entry.projectId = a._id; + Entry.variableContainer.setVariables(a.variables); + Entry.variableContainer.setMessages(a.messages); + Entry.scene.addScenes(a.scenes); Entry.stage.initObjectContainers(); - Entry.variableContainer.setFunctions(b.functions); - Entry.container.setObjects(b.objects); - Entry.FPS = b.speed ? b.speed : 60; + Entry.variableContainer.setFunctions(a.functions); + Entry.container.setObjects(a.objects); + Entry.FPS = a.speed ? a.speed : 60; createjs.Ticker.setFPS(Entry.FPS); "workspace" == this.type && setTimeout(function() { Entry.stateManager.endIgnore(); @@ -16,35 +16,37 @@ var Entry = {block:{}, TEXT_ALIGN_CENTER:0, TEXT_ALIGN_LEFT:1, TEXT_ALIGN_RIGHT: Entry.engine.projectTimer || Entry.variableContainer.generateTimer(); 0 === Object.keys(Entry.container.inputValue).length && Entry.variableContainer.generateAnswer(); Entry.start(); - return b; -}, exportProject:function(b) { - b || (b = {}); + return a; +}, exportProject:function(a) { + a || (a = {}); Entry.engine.isState("stop") || Entry.engine.toggleStop(); Entry.Func && Entry.Func.workspace && Entry.Func.workspace.visible && Entry.Func.cancelEdit(); - b.objects = Entry.container.toJSON(); - b.scenes = Entry.scene.toJSON(); - b.variables = Entry.variableContainer.getVariableJSON(); - b.messages = Entry.variableContainer.getMessageJSON(); - b.functions = Entry.variableContainer.getFunctionJSON(); - b.scenes = Entry.scene.toJSON(); - b.speed = Entry.FPS; - return b; -}, setBlockByText:function(b, a) { - for (var c = [], d = jQuery.parseXML(a).getElementsByTagName("category"), e = 0;e < d.length;e++) { - for (var f = d[e], g = {category:f.getAttribute("id"), blocks:[]}, f = f.childNodes, h = 0;h < f.length;h++) { - var k = f[h]; - !k.tagName || "BLOCK" != k.tagName.toUpperCase() && "BTN" != k.tagName.toUpperCase() || g.blocks.push(k.getAttribute("type")); - } - c.push(g); - } - Entry.playground.setBlockMenu(c); -}, setBlock:function(b, a) { - Entry.playground.setMenuBlock(b, a); + a.objects = Entry.container.toJSON(); + a.scenes = Entry.scene.toJSON(); + a.variables = Entry.variableContainer.getVariableJSON(); + a.messages = Entry.variableContainer.getMessageJSON(); + a.functions = Entry.variableContainer.getFunctionJSON(); + a.scenes = Entry.scene.toJSON(); + a.speed = Entry.FPS; + return a; +}, setBlockByText:function(a, b) { + a = []; + b = jQuery.parseXML(b).getElementsByTagName("category"); + for (var c = 0;c < b.length;c++) { + for (var d = b[c], e = {category:d.getAttribute("id"), blocks:[]}, d = d.childNodes, f = 0;f < d.length;f++) { + var g = d[f]; + !g.tagName || "BLOCK" != g.tagName.toUpperCase() && "BTN" != g.tagName.toUpperCase() || e.blocks.push(g.getAttribute("type")); + } + a.push(e); + } + Entry.playground.setBlockMenu(a); +}, setBlock:function(a, b) { + Entry.playground.setMenuBlock(a, b); }, enableArduino:function() { -}, initSound:function(b) { - b.path = b.fileurl ? b.fileurl : Entry.defaultPath + "/uploads/" + b.filename.substring(0, 2) + "/" + b.filename.substring(2, 4) + "/" + b.filename + b.ext; - Entry.soundQueue.loadFile({id:b.id, src:b.path, type:createjs.LoadQueue.SOUND}); -}, beforeUnload:function(b) { +}, initSound:function(a) { + a.path = a.fileurl ? a.fileurl : Entry.defaultPath + "/uploads/" + a.filename.substring(0, 2) + "/" + a.filename.substring(2, 4) + "/" + a.filename + a.ext; + Entry.soundQueue.loadFile({id:a.id, src:a.path, type:createjs.LoadQueue.SOUND}); +}, beforeUnload:function(a) { Entry.hw.closeConnection(); Entry.variableContainer.updateCloudVariables(); if ("workspace" == Entry.type && (localStorage && Entry.interfaceState && localStorage.setItem("workspace-interface", JSON.stringify(Entry.interfaceState)), !Entry.stateManager.isSaved())) { @@ -53,110 +55,204 @@ var Entry = {block:{}, TEXT_ALIGN_CENTER:0, TEXT_ALIGN_LEFT:1, TEXT_ALIGN_RIGHT: }, loadInterfaceState:function() { if ("workspace" == Entry.type) { if (localStorage && localStorage.getItem("workspace-interface")) { - var b = localStorage.getItem("workspace-interface"); - this.resizeElement(JSON.parse(b)); + var a = localStorage.getItem("workspace-interface"); + this.resizeElement(JSON.parse(a)); } else { this.resizeElement({menuWidth:280, canvasWidth:480}); } } -}, resizeElement:function(b) { +}, resizeElement:function(a) { if ("workspace" == Entry.type) { - var a = this.interfaceState; - !b.canvasWidth && a.canvasWidth && (b.canvasWidth = a.canvasWidth); - !b.menuWidth && this.interfaceState.menuWidth && (b.menuWidth = a.menuWidth); + var b = this.interfaceState; + !a.canvasWidth && b.canvasWidth && (a.canvasWidth = b.canvasWidth); + !a.menuWidth && this.interfaceState.menuWidth && (a.menuWidth = b.menuWidth); Entry.engine.speedPanelOn && Entry.engine.toggleSpeedPanel(); - (a = b.canvasWidth) ? 325 > a ? a = 325 : 720 < a && (a = 720) : a = 400; - b.canvasWidth = a; - var c = 9 * a / 16; - Entry.engine.view_.style.width = a + "px"; + (b = a.canvasWidth) ? 325 > b ? b = 325 : 720 < b && (b = 720) : b = 400; + a.canvasWidth = b; + var c = 9 * b / 16; + Entry.engine.view_.style.width = b + "px"; Entry.engine.view_.style.height = c + "px"; Entry.engine.view_.style.top = "40px"; - Entry.stage.canvas.canvas.style.width = a + "px"; - 400 <= a ? Entry.engine.view_.removeClass("collapsed") : Entry.engine.view_.addClass("collapsed"); - Entry.playground.view_.style.left = a + .5 + "px"; - Entry.propertyPanel.resize(a); + Entry.stage.canvas.canvas.style.width = b + "px"; + 400 <= b ? Entry.engine.view_.removeClass("collapsed") : Entry.engine.view_.addClass("collapsed"); + Entry.playground.view_.style.left = b + .5 + "px"; + Entry.propertyPanel.resize(b); var d = Entry.engine.view_.getElementsByClassName("entryAddButtonWorkspace_w")[0]; - d && (Entry.objectAddable ? (d.style.top = c + 24 + "px", d.style.width = .7 * a + "px") : d.style.display = "none"); + d && (Entry.objectAddable ? (d.style.top = c + 24 + "px", d.style.width = .7 * b + "px") : d.style.display = "none"); if (d = Entry.engine.view_.getElementsByClassName("entryRunButtonWorkspace_w")[0]) { - Entry.objectAddable ? (d.style.top = c + 24 + "px", d.style.left = .7 * a + "px", d.style.width = .3 * a + "px") : (d.style.left = "2px", d.style.top = c + 24 + "px", d.style.width = a - 4 + "px"); + Entry.objectAddable ? (d.style.top = c + 24 + "px", d.style.left = .7 * b + "px", d.style.width = .3 * b + "px") : (d.style.left = "2px", d.style.top = c + 24 + "px", d.style.width = b - 4 + "px"); } if (d = Entry.engine.view_.getElementsByClassName("entryStopButtonWorkspace_w")[0]) { - Entry.objectAddable ? (d.style.top = c + 24 + "px", d.style.left = .7 * a + "px", d.style.width = .3 * a + "px") : (d.style.left = "2px", d.style.top = c + 24 + "px", d.style.width = a + "px"); + Entry.objectAddable ? (d.style.top = c + 24 + "px", d.style.left = .7 * b + "px", d.style.width = .3 * b + "px") : (d.style.left = "2px", d.style.top = c + 24 + "px", d.style.width = b + "px"); } - (a = b.menuWidth) ? 244 > a ? a = 244 : 400 < a && (a = 400) : a = 264; - b.menuWidth = a; - $(".blockMenuContainer").css({width:a - 64 + "px"}); - $(".blockMenuContainer>svg").css({width:a - 64 + "px"}); + (b = a.menuWidth) ? 244 > b ? b = 244 : 400 < b && (b = 400) : b = 264; + a.menuWidth = b; + $(".blockMenuContainer").css({width:b - 64 + "px"}); + $(".blockMenuContainer>svg").css({width:b - 64 + "px"}); Entry.playground.mainWorkspace.blockMenu.setWidth(); - $(".entryWorkspaceBoard").css({left:a + "px"}); - Entry.playground.resizeHandle_.style.left = a + "px"; - Entry.playground.variableViewWrapper_.style.width = a + "px"; - this.interfaceState = b; + $(".entryWorkspaceBoard").css({left:b + "px"}); + Entry.playground.resizeHandle_.style.left = b + "px"; + Entry.playground.variableViewWrapper_.style.width = b + "px"; + this.interfaceState = a; } Entry.windowResized.notify(); }, getUpTime:function() { return (new Date).getTime() - this.startTime; -}, addActivity:function(b) { - Entry.stateManager && Entry.stateManager.addActivity(b); +}, addActivity:function(a) { + Entry.stateManager && Entry.stateManager.addActivity(a); }, startActivityLogging:function() { Entry.reporter && Entry.reporter.start(Entry.projectId, window.user ? window.user._id : null, Entry.startTime); }, getActivityLog:function() { - var b = {}; - Entry.stateManager && (b.activityLog = Entry.stateManager.activityLog_); - return b; -}, DRAG_MODE_NONE:0, DRAG_MODE_MOUSEDOWN:1, DRAG_MODE_DRAG:2, cancelObjectEdit:function(b) { - var a = Entry.playground.object; - if (a) { - var c = b.target; - b = 0 !== $(a.view_).find(c).length; + var a = {}; + Entry.stateManager && (a.activityLog = Entry.stateManager.activityLog_); + return a; +}, DRAG_MODE_NONE:0, DRAG_MODE_MOUSEDOWN:1, DRAG_MODE_DRAG:2, cancelObjectEdit:function(a) { + var b = Entry.playground.object; + if (b) { + var c = a.target; + a = 0 !== $(b.view_).find(c).length; c = c.tagName.toUpperCase(); - !a.isEditing || "INPUT" === c && b || a.editObjectValues(!1); + !b.isEditing || "INPUT" === c && a || b.editObjectValues(!1); } }}; window.Entry = Entry; Entry.Albert = {PORT_MAP:{leftWheel:0, rightWheel:0, buzzer:0, leftEye:0, rightEye:0, note:0, bodyLed:0, frontLed:0, padWidth:0, padHeight:0}, setZero:function() { - var b = Entry.Albert.PORT_MAP, a = Entry.hw.sendQueue, c; - for (c in b) { - a[c] = b[c]; + var a = Entry.Albert.PORT_MAP, b = Entry.hw.sendQueue, c; + for (c in a) { + b[c] = a[c]; } Entry.hw.update(); - b = Entry.Albert; - b.tempo = 60; - b.removeAllTimeouts(); -}, monitorTemplate:{imgPath:"hw/albert.png", width:387, height:503, listPorts:{oid:{name:"OID", type:"input", pos:{x:0, y:0}}, buzzer:{name:Lang.Hw.buzzer, type:"output", pos:{x:0, y:0}}, note:{name:Lang.Hw.note, type:"output", pos:{x:0, y:0}}}, ports:{leftProximity:{name:Lang.Blocks.ALBERT_sensor_leftProximity, type:"input", pos:{x:178, y:401}}, rightProximity:{name:Lang.Blocks.ALBERT_sensor_rightProximity, type:"input", pos:{x:66, y:359}}, battery:{name:Lang.Blocks.ALBERT_sensor_battery, type:"input", -pos:{x:88, y:368}}, light:{name:Lang.Blocks.ALBERT_sensor_light, type:"input", pos:{x:127, y:391}}, leftWheel:{name:Lang.Hw.leftWheel, type:"output", pos:{x:299, y:406}}, rightWheel:{name:Lang.Hw.rightWheel, type:"output", pos:{x:22, y:325}}, leftEye:{name:Lang.Hw.leftEye, type:"output", pos:{x:260, y:26}}, rightEye:{name:Lang.Hw.rightEye, type:"output", pos:{x:164, y:13}}, bodyLed:{name:Lang.Hw.body + " " + Lang.Hw.led, type:"output", pos:{x:367, y:308}}, frontLed:{name:Lang.Hw.front + " " + Lang.Hw.led, -pos:{x:117, y:410}}}, mode:"both"}, tempo:60, timeouts:[], removeTimeout:function(b) { - clearTimeout(b); - var a = this.timeouts; - b = a.indexOf(b); - 0 <= b && a.splice(b, 1); + a = Entry.Albert; + a.tempo = 60; + a.removeAllTimeouts(); +}, monitorTemplate:{imgPath:"hw/albert.png", width:387, height:503, listPorts:{temperature:{name:Lang.Blocks.ALBERT_sensor_temperature, type:"input", pos:{x:0, y:0}}, accelerationX:{name:Lang.Blocks.ALBERT_sensor_acceleration_x, type:"input", pos:{x:0, y:0}}, accelerationY:{name:Lang.Blocks.ALBERT_sensor_acceleration_y, type:"input", pos:{x:0, y:0}}, accelerationZ:{name:Lang.Blocks.ALBERT_sensor_acceleration_z, type:"input", pos:{x:0, y:0}}, frontOid:{name:Lang.Blocks.ALBERT_sensor_front_oid, type:"input", +pos:{x:0, y:0}}, backOid:{name:Lang.Blocks.ALBERT_sensor_back_oid, type:"input", pos:{x:0, y:0}}, positionX:{name:Lang.Blocks.ALBERT_sensor_position_x, type:"input", pos:{x:0, y:0}}, positionY:{name:Lang.Blocks.ALBERT_sensor_position_y, type:"input", pos:{x:0, y:0}}, orientation:{name:Lang.Blocks.ALBERT_sensor_orientation, type:"input", pos:{x:0, y:0}}, buzzer:{name:Lang.Hw.buzzer, type:"output", pos:{x:0, y:0}}, note:{name:Lang.Hw.note, type:"output", pos:{x:0, y:0}}}, ports:{leftProximity:{name:Lang.Blocks.ALBERT_sensor_leftProximity, +type:"input", pos:{x:178, y:401}}, rightProximity:{name:Lang.Blocks.ALBERT_sensor_rightProximity, type:"input", pos:{x:66, y:359}}, battery:{name:Lang.Blocks.ALBERT_sensor_battery, type:"input", pos:{x:88, y:368}}, light:{name:Lang.Blocks.ALBERT_sensor_light, type:"input", pos:{x:127, y:391}}, leftWheel:{name:Lang.Hw.leftWheel, type:"output", pos:{x:299, y:406}}, rightWheel:{name:Lang.Hw.rightWheel, type:"output", pos:{x:22, y:325}}, leftEye:{name:Lang.Hw.leftEye, type:"output", pos:{x:260, y:26}}, +rightEye:{name:Lang.Hw.rightEye, type:"output", pos:{x:164, y:13}}, bodyLed:{name:Lang.Hw.body + " " + Lang.Hw.led_en, type:"output", pos:{x:367, y:308}}, frontLed:{name:Lang.Hw.front + " " + Lang.Hw.led_en, pos:{x:117, y:410}}}, mode:"both"}, tempo:60, timeouts:[], removeTimeout:function(a) { + clearTimeout(a); + var b = this.timeouts; + a = b.indexOf(a); + 0 <= a && b.splice(a, 1); }, removeAllTimeouts:function() { - var b = this.timeouts, a; - for (a in b) { - clearTimeout(b[a]); + var a = this.timeouts, b; + for (b in a) { + clearTimeout(a[b]); } this.timeouts = []; -}, name:"albert"}; +}, controller:{PI:3.14159265, PI2:6.2831853, prevDirection:0, prevDirectionFine:0, directionFineCount:0, positionCount:0, finalPositionCount:0, GAIN_ANGLE:30, GAIN_ANGLE_FINE:30, GAIN_POSITION_FINE:30, STRAIGHT_SPEED:20, MAX_BASE_SPEED:20, GAIN_BASE_SPEED:1, GAIN_POSITION:35, POSITION_TOLERANCE_FINE:3, POSITION_TOLERANCE_FINE_LARGE:5, POSITION_TOLERANCE_ROUGH:5, POSITION_TOLERANCE_ROUGH_LARGE:10, ORIENTATION_TOLERANCE_FINE:.08, ORIENTATION_TOLERANCE_ROUGH:.09, ORIENTATION_TOLERANCE_ROUGH_LARGE:.18, +MINIMUM_WHEEL_SPEED:18, MINIMUM_WHEEL_SPEED_FINE:15, clear:function() { + this.finalPositionCount = this.positionCount = this.directionFineCount = this.prevDirectionFine = this.prevDirection = 0; +}, controlAngleFine:function(a, b) { + var c = Entry.hw.sendQueue; + a = this.validateRadian(b - a); + b = Math.abs(a); + if (b < this.ORIENTATION_TOLERANCE_FINE) { + return !1; + } + var d = 0 < a ? 1 : -1; + if (0 > d * this.prevDirectionFine && 5 < ++this.directionFineCount) { + return !1; + } + this.prevDirectionFine = d; + 0 < a ? (a = Math.log(1 + b) * this.GAIN_ANGLE_FINE, a < this.MINIMUM_WHEEL_SPEED && (a = this.MINIMUM_WHEEL_SPEED)) : (a = -Math.log(1 + b) * this.GAIN_ANGLE_FINE, a > -this.MINIMUM_WHEEL_SPEED && (a = -this.MINIMUM_WHEEL_SPEED)); + a = parseInt(a); + c.leftWheel = -a; + c.rightWheel = a; + return !0; +}, controlAngle:function(a, b) { + var c = Entry.hw.sendQueue; + a = this.validateRadian(b - a); + b = Math.abs(a); + if (b < this.ORIENTATION_TOLERANCE_ROUGH) { + return !1; + } + var d = 0 < a ? 1 : -1; + if (b < this.ORIENTATION_TOLERANCE_ROUGH_LARGE && 0 > d * this.prevDirection) { + return !1; + } + this.prevDirection = d; + 0 < a ? (a = Math.log(1 + b) * this.GAIN_ANGLE, a < this.MINIMUM_WHEEL_SPEED && (a = this.MINIMUM_WHEEL_SPEED)) : (a = -Math.log(1 + b) * this.GAIN_ANGLE, a > -this.MINIMUM_WHEEL_SPEED && (a = -this.MINIMUM_WHEEL_SPEED)); + a = parseInt(a); + c.leftWheel = -a; + c.rightWheel = a; + return !0; +}, controlPositionFine:function(a, b, c, d, e) { + var f = Entry.hw.sendQueue; + c = this.validateRadian(Math.atan2(e - b, d - a) - c); + var g = Math.abs(c); + a = d - a; + b = e - b; + b = Math.sqrt(a * a + b * b); + if (b < this.POSITION_TOLERANCE_FINE) { + return !1; + } + if (b < this.POSITION_TOLERANCE_FINE_LARGE && 5 < ++this.finalPositionCount) { + return this.finalPositionCount = 0, !1; + } + c = 0 < c ? Math.log(1 + g) * this.GAIN_POSITION_FINE : -Math.log(1 + g) * this.GAIN_POSITION_FINE; + c = parseInt(c); + f.leftWheel = this.MINIMUM_WHEEL_SPEED_FINE - c; + f.rightWheel = this.MINIMUM_WHEEL_SPEED_FINE + c; + return !0; +}, controlPosition:function(a, b, c, d, e) { + var f = Entry.hw.sendQueue; + c = this.validateRadian(Math.atan2(e - b, d - a) - c); + var g = Math.abs(c); + a = d - a; + b = e - b; + b = Math.sqrt(a * a + b * b); + if (b < this.POSITION_TOLERANCE_ROUGH) { + return !1; + } + if (b < this.POSITION_TOLERANCE_ROUGH_LARGE) { + if (10 < ++this.positionCount) { + return this.positionCount = 0, !1; + } + } else { + this.positionCount = 0; + } + .01 > g ? (f.leftWheel = this.STRAIGHT_SPEED, f.rightWheel = this.STRAIGHT_SPEED) : (b = (this.MINIMUM_WHEEL_SPEED + .5 / g) * this.GAIN_BASE_SPEED, b > this.MAX_BASE_SPEED && (b = this.MAX_BASE_SPEED), c = 0 < c ? Math.log(1 + g) * this.GAIN_POSITION : -Math.log(1 + g) * this.GAIN_POSITION, b = parseInt(b), c = parseInt(c), f.leftWheel = b - c, f.rightWheel = b + c); + return !0; +}, validateRadian:function(a) { + return a > this.PI ? a - this.PI2 : a < -this.PI ? a + this.PI2 : a; +}, toRadian:function(a) { + return 3.14159265 * a / 180; +}}, name:"albert"}; Blockly.Blocks.albert_hand_found = {init:function() { this.setColour("#00979D"); this.appendDummyInput().appendField(Lang.Blocks.ALBERT_hand_found); this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.albert_hand_found = function(b, a) { - var c = Entry.hw.portData; - return 40 < c.leftProximity || 40 < c.rightProximity; +Entry.block.albert_hand_found = function(a, b) { + a = Entry.hw.portData; + return 40 < a.leftProximity || 40 < a.rightProximity; +}; +Blockly.Blocks.albert_is_oid_value = {init:function() { + this.setColour("#00979D"); + this.appendDummyInput().appendField(Lang.Blocks.ALBERT_is_oid_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.ALBERT_front_oid, "FRONT"], [Lang.Blocks.ALBERT_back_oid, "BACK"]]), "OID").appendField(Lang.Blocks.ALBERT_is_oid_2); + this.appendValueInput("VALUE").setCheck(["Number", "String"]); + this.appendDummyInput().appendField(Lang.Blocks.ALBERT_is_oid_3); + this.setOutput(!0, "Boolean"); + this.setInputsInline(!0); +}}; +Entry.block.albert_is_oid_value = function(a, b) { + a = Entry.hw.portData; + var c = b.getField("OID", b); + b = b.getNumberValue("VALUE"); + return "FRONT" == c ? a.frontOid == b : a.backOid == b; }; Blockly.Blocks.albert_value = {init:function() { this.setColour("#00979D"); - this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([[Lang.Blocks.ALBERT_sensor_leftProximity, "leftProximity"], [Lang.Blocks.ALBERT_sensor_rightProximity, "rightProximity"], [Lang.Blocks.ALBERT_sensor_light, "light"], [Lang.Blocks.ALBERT_sensor_battery, "battery"], [Lang.Blocks.ALBERT_sensor_signalStrength, "signalStrength"], [Lang.Blocks.ALBERT_sensor_frontOid, "frontOid"], [Lang.Blocks.ALBERT_sensor_backOid, "backOid"], [Lang.Blocks.ALBERT_sensor_positionX, "positionX"], - [Lang.Blocks.ALBERT_sensor_positionY, "positionY"], [Lang.Blocks.ALBERT_sensor_orientation, "orientation"]]), "DEVICE"); + this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([[Lang.Blocks.ALBERT_sensor_left_proximity, "leftProximity"], [Lang.Blocks.ALBERT_sensor_right_proximity, "rightProximity"], [Lang.Blocks.ALBERT_sensor_acceleration_x, "accelerationX"], [Lang.Blocks.ALBERT_sensor_acceleration_y, "accelerationY"], [Lang.Blocks.ALBERT_sensor_acceleration_z, "accelerationZ"], [Lang.Blocks.ALBERT_sensor_front_oid, "frontOid"], [Lang.Blocks.ALBERT_sensor_back_oid, "backOid"], [Lang.Blocks.ALBERT_sensor_position_x, + "positionX"], [Lang.Blocks.ALBERT_sensor_position_y, "positionY"], [Lang.Blocks.ALBERT_sensor_orientation, "orientation"], [Lang.Blocks.ALBERT_sensor_light, "light"], [Lang.Blocks.ALBERT_sensor_temperature, "temperature"], [Lang.Blocks.ALBERT_sensor_battery, "battery"], [Lang.Blocks.ALBERT_sensor_signal_strength, "signalStrength"]]), "DEVICE"); this.setInputsInline(!0); this.setOutput(!0, "Number"); }}; -Entry.block.albert_value = function(b, a) { - var c = Entry.hw.portData, d = a.getField("DEVICE"); - return c[d]; +Entry.block.albert_value = function(a, b) { + a = Entry.hw.portData; + b = b.getField("DEVICE"); + return a[b]; }; Blockly.Blocks.albert_move_forward_for_secs = {init:function() { this.setColour("#00979D"); @@ -167,29 +263,30 @@ Blockly.Blocks.albert_move_forward_for_secs = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_move_forward_for_secs = function(b, a) { - var c = Entry.hw.sendQueue; - if (a.isStart) { - if (1 == a.timeFlag) { - return a; +Entry.block.albert_move_forward_for_secs = function(a, b) { + a = Entry.hw.sendQueue; + if (b.isStart) { + if (1 == b.timeFlag) { + return b; } - delete a.isStart; - delete a.timeFlag; + delete b.isStart; + delete b.timeFlag; Entry.engine.isContinue = !1; - c.leftWheel = 0; - c.rightWheel = 0; - return a.callReturn(); + a.leftWheel = 0; + a.rightWheel = 0; + return b.callReturn(); } - a.isStart = !0; - a.timeFlag = 1; - c.leftWheel = 30; - c.rightWheel = 30; - var c = 1E3 * a.getNumberValue("VALUE"), d = setTimeout(function() { - a.timeFlag = 0; - Entry.Albert.removeTimeout(d); - }, c); - Entry.Albert.timeouts.push(d); - return a; + b.isStart = !0; + b.timeFlag = 1; + a.leftWheel = 30; + a.rightWheel = 30; + a = 1E3 * b.getNumberValue("VALUE"); + var c = setTimeout(function() { + b.timeFlag = 0; + Entry.Albert.removeTimeout(c); + }, a); + Entry.Albert.timeouts.push(c); + return b; }; Blockly.Blocks.albert_move_backward_for_secs = {init:function() { this.setColour("#00979D"); @@ -200,61 +297,63 @@ Blockly.Blocks.albert_move_backward_for_secs = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_move_backward_for_secs = function(b, a) { - var c = Entry.hw.sendQueue; - if (a.isStart) { - if (1 == a.timeFlag) { - return a; +Entry.block.albert_move_backward_for_secs = function(a, b) { + a = Entry.hw.sendQueue; + if (b.isStart) { + if (1 == b.timeFlag) { + return b; } - delete a.isStart; - delete a.timeFlag; + delete b.isStart; + delete b.timeFlag; Entry.engine.isContinue = !1; - c.leftWheel = 0; - c.rightWheel = 0; - return a.callReturn(); + a.leftWheel = 0; + a.rightWheel = 0; + return b.callReturn(); } - a.isStart = !0; - a.timeFlag = 1; - c.leftWheel = -30; - c.rightWheel = -30; - var c = 1E3 * a.getNumberValue("VALUE"), d = setTimeout(function() { - a.timeFlag = 0; - Entry.Albert.removeTimeout(d); - }, c); - Entry.Albert.timeouts.push(d); - return a; + b.isStart = !0; + b.timeFlag = 1; + a.leftWheel = -30; + a.rightWheel = -30; + a = 1E3 * b.getNumberValue("VALUE"); + var c = setTimeout(function() { + b.timeFlag = 0; + Entry.Albert.removeTimeout(c); + }, a); + Entry.Albert.timeouts.push(c); + return b; }; Blockly.Blocks.albert_turn_for_secs = {init:function() { this.setColour("#00979D"); - this.appendDummyInput().appendField(Lang.Blocks.ALBERT_turn_for_secs_1).appendField(new Blockly.FieldDropdown([[Lang.General.left, "LEFT"], [Lang.General.right, "RIGHT"]]), "DIRECTION").appendField(Lang.Blocks.ALBERT_turn_for_secs_2); + this.appendDummyInput().appendField(Lang.Blocks.ALBERT_turn_for_secs_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.ALBERT_turn_left, "LEFT"], [Lang.Blocks.ALBERT_turn_right, "RIGHT"]]), "DIRECTION").appendField(Lang.Blocks.ALBERT_turn_for_secs_2); this.appendValueInput("VALUE").setCheck(["Number", "String"]); this.appendDummyInput().appendField(Lang.Blocks.ALBERT_turn_for_secs_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath + "block_icon/hardware_03.png", "*")); this.setInputsInline(!0); this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_turn_for_secs = function(b, a) { - var c = Entry.hw.sendQueue; - if (a.isStart) { - if (1 == a.timeFlag) { - return a; +Entry.block.albert_turn_for_secs = function(a, b) { + a = Entry.hw.sendQueue; + if (b.isStart) { + if (1 == b.timeFlag) { + return b; } - delete a.isStart; - delete a.timeFlag; + delete b.isStart; + delete b.timeFlag; Entry.engine.isContinue = !1; - c.leftWheel = 0; - c.rightWheel = 0; - return a.callReturn(); + a.leftWheel = 0; + a.rightWheel = 0; + return b.callReturn(); } - a.isStart = !0; - a.timeFlag = 1; - "LEFT" == a.getField("DIRECTION", a) ? (c.leftWheel = -30, c.rightWheel = 30) : (c.leftWheel = 30, c.rightWheel = -30); - var c = 1E3 * a.getNumberValue("VALUE"), d = setTimeout(function() { - a.timeFlag = 0; - Entry.Albert.removeTimeout(d); - }, c); - Entry.Albert.timeouts.push(d); - return a; + b.isStart = !0; + b.timeFlag = 1; + "LEFT" == b.getField("DIRECTION", b) ? (a.leftWheel = -30, a.rightWheel = 30) : (a.leftWheel = 30, a.rightWheel = -30); + a = 1E3 * b.getNumberValue("VALUE"); + var c = setTimeout(function() { + b.timeFlag = 0; + Entry.Albert.removeTimeout(c); + }, a); + Entry.Albert.timeouts.push(c); + return b; }; Blockly.Blocks.albert_change_both_wheels_by = {init:function() { this.setColour("#00979D"); @@ -267,11 +366,12 @@ Blockly.Blocks.albert_change_both_wheels_by = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_change_both_wheels_by = function(b, a) { - var c = Entry.hw.sendQueue, d = a.getNumberValue("LEFT"), e = a.getNumberValue("RIGHT"); - c.leftWheel = void 0 != c.leftWheel ? c.leftWheel + d : d; - c.rightWheel = void 0 != c.rightWheel ? c.rightWheel + e : e; - return a.callReturn(); +Entry.block.albert_change_both_wheels_by = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getNumberValue("LEFT"), d = b.getNumberValue("RIGHT"); + a.leftWheel = void 0 != a.leftWheel ? a.leftWheel + c : c; + a.rightWheel = void 0 != a.rightWheel ? a.rightWheel + d : d; + return b.callReturn(); }; Blockly.Blocks.albert_set_both_wheels_to = {init:function() { this.setColour("#00979D"); @@ -284,39 +384,41 @@ Blockly.Blocks.albert_set_both_wheels_to = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_set_both_wheels_to = function(b, a) { - var c = Entry.hw.sendQueue; - c.leftWheel = a.getNumberValue("LEFT"); - c.rightWheel = a.getNumberValue("RIGHT"); - return a.callReturn(); +Entry.block.albert_set_both_wheels_to = function(a, b) { + a = Entry.hw.sendQueue; + a.leftWheel = b.getNumberValue("LEFT"); + a.rightWheel = b.getNumberValue("RIGHT"); + return b.callReturn(); }; Blockly.Blocks.albert_change_wheel_by = {init:function() { this.setColour("#00979D"); - this.appendDummyInput().appendField(Lang.Blocks.ALBERT_change_wheel_by_1).appendField(new Blockly.FieldDropdown([[Lang.General.left, "LEFT"], [Lang.General.right, "RIGHT"], [Lang.General.both, "BOTH"]]), "DIRECTION").appendField(Lang.Blocks.ALBERT_change_wheel_by_2); + this.appendDummyInput().appendField(Lang.Blocks.ALBERT_change_wheel_by_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.ALBERT_left_wheel, "LEFT"], [Lang.Blocks.ALBERT_right_wheel, "RIGHT"], [Lang.Blocks.ALBERT_both_wheels, "BOTH"]]), "DIRECTION").appendField(Lang.Blocks.ALBERT_change_wheel_by_2); this.appendValueInput("VALUE").setCheck(["Number", "String"]); this.appendDummyInput().appendField(Lang.Blocks.ALBERT_change_wheel_by_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath + "block_icon/hardware_03.png", "*")); this.setInputsInline(!0); this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_change_wheel_by = function(b, a) { - var c = Entry.hw.sendQueue, d = a.getField("DIRECTION"), e = a.getNumberValue("VALUE"); - "LEFT" == d ? c.leftWheel = void 0 != c.leftWheel ? c.leftWheel + e : e : ("RIGHT" != d && (c.leftWheel = void 0 != c.leftWheel ? c.leftWheel + e : e), c.rightWheel = void 0 != c.rightWheel ? c.rightWheel + e : e); - return a.callReturn(); +Entry.block.albert_change_wheel_by = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getField("DIRECTION"), d = b.getNumberValue("VALUE"); + "LEFT" == c ? a.leftWheel = void 0 != a.leftWheel ? a.leftWheel + d : d : ("RIGHT" != c && (a.leftWheel = void 0 != a.leftWheel ? a.leftWheel + d : d), a.rightWheel = void 0 != a.rightWheel ? a.rightWheel + d : d); + return b.callReturn(); }; Blockly.Blocks.albert_set_wheel_to = {init:function() { this.setColour("#00979D"); - this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_wheel_to_1).appendField(new Blockly.FieldDropdown([[Lang.General.left, "LEFT"], [Lang.General.right, "RIGHT"], [Lang.General.both, "BOTH"]]), "DIRECTION").appendField(Lang.Blocks.ALBERT_set_wheel_to_2); + this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_wheel_to_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.ALBERT_left_wheel, "LEFT"], [Lang.Blocks.ALBERT_right_wheel, "RIGHT"], [Lang.Blocks.ALBERT_both_wheels, "BOTH"]]), "DIRECTION").appendField(Lang.Blocks.ALBERT_set_wheel_to_2); this.appendValueInput("VALUE").setCheck(["Number", "String"]); this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_wheel_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_wheel_to = 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(); +Entry.block.albert_set_wheel_to = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getField("DIRECTION"), d = b.getNumberValue("VALUE"); + "LEFT" == c ? a.leftWheel = d : ("RIGHT" != c && (a.leftWheel = d), a.rightWheel = d); + return b.callReturn(); }; Blockly.Blocks.albert_stop = {init:function() { this.setColour("#00979D"); @@ -325,77 +427,192 @@ Blockly.Blocks.albert_stop = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_stop = function(b, a) { - var c = Entry.hw.sendQueue; - c.leftWheel = 0; - c.rightWheel = 0; - return a.callReturn(); +Entry.block.albert_stop = function(a, b) { + a = Entry.hw.sendQueue; + a.leftWheel = 0; + a.rightWheel = 0; + return b.callReturn(); }; Blockly.Blocks.albert_set_pad_size_to = {init:function() { this.setColour("#00979D"); - this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_pad_size_to_1); + this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_board_size_to_1); this.appendValueInput("WIDTH").setCheck(["Number", "String"]); - this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_pad_size_to_2); + this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_board_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.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_board_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(); +Entry.block.albert_set_pad_size_to = function(a, b) { + a = Entry.hw.sendQueue; + a.padWidth = b.getNumberValue("WIDTH"); + a.padHeight = b.getNumberValue("HEIGHT"); + return b.callReturn(); +}; +Blockly.Blocks.albert_move_to_x_y_on_board = {init:function() { + this.setColour("#00979D"); + this.appendDummyInput().appendField(Lang.Blocks.ALBERT_move_to_x_y_1); + this.appendValueInput("X").setCheck(["Number", "String"]); + this.appendDummyInput().appendField(Lang.Blocks.ALBERT_move_to_x_y_2); + this.appendValueInput("Y").setCheck(["Number", "String"]); + this.appendDummyInput().appendField(Lang.Blocks.ALBERT_move_to_x_y_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath + "block_icon/hardware_03.png", "*")); + this.setInputsInline(!0); + this.setPreviousStatement(!0); + this.setNextStatement(!0); +}}; +Entry.block.albert_move_to_x_y_on_board = function(a, b) { + var c = Entry.hw.sendQueue, d = Entry.hw.portData; + a = Entry.Albert.controller; + if (b.isStart) { + if (b.isMoving) { + 0 <= d.positionX && (b.x = d.positionX); + 0 <= d.positionY && (b.y = d.positionY); + b.theta = d.orientation; + switch(b.boardState) { + case 1: + if (0 == b.initialized) { + if (0 > b.x || 0 > b.y) { + c.leftWheel = 20; + c.rightWheel = -20; + break; + } + b.initialized = !0; + } + c = a.toRadian(b.theta); + 0 == a.controlAngle(c, Math.atan2(b.targetY - b.y, b.targetX - b.x)) && (b.boardState = 2); + break; + case 2: + 0 == a.controlPosition(b.x, b.y, a.toRadian(b.theta), b.targetX, b.targetY) && (b.boardState = 3); + break; + case 3: + 0 == a.controlPositionFine(b.x, b.y, a.toRadian(b.theta), b.targetX, b.targetY) && (c.leftWheel = 0, c.rightWheel = 0, b.isMoving = !1); + } + return b; + } + delete b.isStart; + delete b.isMoving; + delete b.initialized; + delete b.boardState; + delete b.x; + delete b.y; + delete b.theta; + delete b.targetX; + delete b.targetY; + Entry.engine.isContinue = !1; + c.leftWheel = 0; + c.rightWheel = 0; + return b.callReturn(); + } + b.isStart = !0; + b.isMoving = !0; + b.initialized = !1; + b.boardState = 1; + b.x = -1; + b.y = -1; + b.theta = -200; + b.targetX = b.getNumberValue("X"); + b.targetY = b.getNumberValue("Y"); + a.clear(); + c.leftWheel = 0; + c.rightWheel = 0; + return b; +}; +Blockly.Blocks.albert_set_orientation_on_board = {init:function() { + this.setColour("#00979D"); + this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_orientation_to_1); + this.appendValueInput("ORIENTATION").setCheck(["Number", "String"]); + this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_orientation_to_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath + "block_icon/hardware_03.png", "*")); + this.setInputsInline(!0); + this.setPreviousStatement(!0); + this.setNextStatement(!0); +}}; +Entry.block.albert_set_orientation_on_board = function(a, b) { + a = Entry.hw.sendQueue; + var c = Entry.hw.portData, d = Entry.Albert.controller; + if (b.isStart) { + if (b.isMoving) { + b.theta = c.orientation; + switch(b.boardState) { + case 1: + var c = d.toRadian(b.theta), e = d.toRadian(b.targetTheta); + 0 == d.controlAngle(c, e) && (b.boardState = 2); + break; + case 2: + c = d.toRadian(b.theta), e = d.toRadian(b.targetTheta), 0 == d.controlAngleFine(c, e) && (a.leftWheel = 0, a.rightWheel = 0, b.isMoving = !1); + } + return b; + } + delete b.isStart; + delete b.isMoving; + delete b.boardState; + delete b.theta; + delete b.targetTheta; + Entry.engine.isContinue = !1; + a.leftWheel = 0; + a.rightWheel = 0; + return b.callReturn(); + } + b.isStart = !0; + b.isMoving = !0; + b.boardState = 1; + b.theta = -200; + b.targetTheta = b.getNumberValue("ORIENTATION"); + d.clear(); + a.leftWheel = 0; + a.rightWheel = 0; + return b; }; 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.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_eye_to_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.ALBERT_left_eye, "LEFT"], [Lang.Blocks.ALBERT_right_eye, "RIGHT"], [Lang.Blocks.ALBERT_both_eyes, "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.Blocks.ALBERT_color_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(); +Entry.block.albert_set_eye_to = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getField("DIRECTION", b), d = Number(b.getField("COLOR", b)); + "LEFT" == c ? a.leftEye = d : ("RIGHT" != c && (a.leftEye = d), a.rightEye = d); + return b.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.appendDummyInput().appendField(Lang.Blocks.ALBERT_clear_eye_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.ALBERT_left_eye, "LEFT"], [Lang.Blocks.ALBERT_right_eye, "RIGHT"], [Lang.Blocks.ALBERT_both_eyes, "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(); +Entry.block.albert_clear_eye = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getField("DIRECTION", b); + "LEFT" == c ? a.leftEye = 0 : ("RIGHT" != c && (a.leftEye = 0), a.rightEye = 0); + return b.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.appendDummyInput().appendField(Lang.Blocks.ALBERT_turn_body_led_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.ALBERT_turn_on, "ON"], [Lang.Blocks.ALBERT_turn_off, "OFF"]]), "STATE").appendField(Lang.Blocks.ALBERT_turn_body_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_body_led = function(b, a) { - var c = Entry.hw.sendQueue; - "ON" == a.getField("STATE", a) ? c.bodyLed = 1 : c.bodyLed = 0; - return a.callReturn(); +Entry.block.albert_body_led = function(a, b) { + a = Entry.hw.sendQueue; + "ON" == b.getField("STATE", b) ? a.bodyLed = 1 : a.bodyLed = 0; + return b.callReturn(); }; Blockly.Blocks.albert_front_led = {init:function() { this.setColour("#00979D"); - this.appendDummyInput().appendField(Lang.Blocks.ALBERT_front_led_1).appendField(new Blockly.FieldDropdown([[Lang.General.turn_on, "ON"], [Lang.General.turn_off, "OFF"]]), "STATE").appendField(Lang.Blocks.ALBERT_front_led_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath + "block_icon/hardware_03.png", "*")); + this.appendDummyInput().appendField(Lang.Blocks.ALBERT_turn_front_led_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.ALBERT_turn_on, "ON"], [Lang.Blocks.ALBERT_turn_off, "OFF"]]), "STATE").appendField(Lang.Blocks.ALBERT_turn_front_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_front_led = function(b, a) { - var c = Entry.hw.sendQueue; - "ON" == a.getField("STATE", a) ? c.frontLed = 1 : c.frontLed = 0; - return a.callReturn(); +Entry.block.albert_front_led = function(a, b) { + a = Entry.hw.sendQueue; + "ON" == b.getField("STATE", b) ? a.frontLed = 1 : a.frontLed = 0; + return b.callReturn(); }; Blockly.Blocks.albert_beep = {init:function() { this.setColour("#00979D"); @@ -404,28 +621,28 @@ Blockly.Blocks.albert_beep = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_beep = function(b, a) { - var c = Entry.hw.sendQueue; - if (a.isStart) { - if (1 == a.timeFlag) { - return a; +Entry.block.albert_beep = function(a, b) { + a = Entry.hw.sendQueue; + if (b.isStart) { + if (1 == b.timeFlag) { + return b; } - delete a.isStart; - delete a.timeFlag; + delete b.isStart; + delete b.timeFlag; Entry.engine.isContinue = !1; - c.buzzer = 0; - return a.callReturn(); + a.buzzer = 0; + return b.callReturn(); } - a.isStart = !0; - a.timeFlag = 1; - c.buzzer = 440; - c.note = 0; - var d = setTimeout(function() { - a.timeFlag = 0; - Entry.Albert.removeTimeout(d); + b.isStart = !0; + b.timeFlag = 1; + a.buzzer = 440; + a.note = 0; + var c = setTimeout(function() { + b.timeFlag = 0; + Entry.Albert.removeTimeout(c); }, 200); - Entry.Albert.timeouts.push(d); - return a; + Entry.Albert.timeouts.push(c); + return b; }; Blockly.Blocks.albert_change_buzzer_by = {init:function() { this.setColour("#00979D"); @@ -436,11 +653,12 @@ Blockly.Blocks.albert_change_buzzer_by = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_change_buzzer_by = 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(); +Entry.block.albert_change_buzzer_by = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getNumberValue("VALUE"); + a.buzzer = void 0 != a.buzzer ? a.buzzer + c : c; + a.note = 0; + return b.callReturn(); }; Blockly.Blocks.albert_set_buzzer_to = {init:function() { this.setColour("#00979D"); @@ -451,11 +669,11 @@ Blockly.Blocks.albert_set_buzzer_to = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_set_buzzer_to = function(b, a) { - var c = Entry.hw.sendQueue; - c.buzzer = a.getNumberValue("VALUE"); - c.note = 0; - return a.callReturn(); +Entry.block.albert_set_buzzer_to = function(a, b) { + a = Entry.hw.sendQueue; + a.buzzer = b.getNumberValue("VALUE"); + a.note = 0; + return b.callReturn(); }; Blockly.Blocks.albert_clear_buzzer = {init:function() { this.setColour("#00979D"); @@ -464,11 +682,11 @@ Blockly.Blocks.albert_clear_buzzer = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_clear_buzzer = function(b, a) { - var c = Entry.hw.sendQueue; - c.buzzer = 0; - c.note = 0; - return a.callReturn(); +Entry.block.albert_clear_buzzer = function(a, b) { + a = Entry.hw.sendQueue; + a.buzzer = 0; + a.note = 0; + return b.callReturn(); }; Blockly.Blocks.albert_play_note_for = {init:function() { this.setColour("#00979D"); @@ -480,36 +698,37 @@ Blockly.Blocks.albert_play_note_for = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_play_note_for = function(b, a) { +Entry.block.albert_play_note_for = function(a, b) { var c = Entry.hw.sendQueue; - if (a.isStart) { - if (1 == a.timeFlag) { - return a; + if (b.isStart) { + if (1 == b.timeFlag) { + return b; } - delete a.isStart; - delete a.timeFlag; + delete b.isStart; + delete b.timeFlag; Entry.engine.isContinue = !1; c.note = 0; - return a.callReturn(); + return b.callReturn(); } - var d = a.getNumberField("NOTE", a), e = a.getNumberField("OCTAVE", a), f = a.getNumberValue("VALUE", a), g = Entry.Albert.tempo, f = 6E4 * f / g; - a.isStart = !0; - a.timeFlag = 1; + a = b.getNumberField("NOTE", b); + var d = b.getNumberField("OCTAVE", b), e = 6E4 * b.getNumberValue("VALUE", b) / Entry.Albert.tempo; + b.isStart = !0; + b.timeFlag = 1; c.buzzer = 0; - c.note = d + 12 * (e - 1); - if (100 < f) { - var h = setTimeout(function() { + c.note = a + 12 * (d - 1); + if (100 < e) { + var f = setTimeout(function() { c.note = 0; - Entry.Albert.removeTimeout(h); - }, f - 100); - Entry.Albert.timeouts.push(h); + Entry.Albert.removeTimeout(f); + }, e - 100); + Entry.Albert.timeouts.push(f); } - var k = setTimeout(function() { - a.timeFlag = 0; - Entry.Albert.removeTimeout(k); - }, f); - Entry.Albert.timeouts.push(k); - return a; + var g = setTimeout(function() { + b.timeFlag = 0; + Entry.Albert.removeTimeout(g); + }, e); + Entry.Albert.timeouts.push(g); + return b; }; Blockly.Blocks.albert_rest_for = {init:function() { this.setColour("#00979D"); @@ -520,28 +739,28 @@ Blockly.Blocks.albert_rest_for = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_rest_for = function(b, a) { - var c = Entry.hw.sendQueue; - if (a.isStart) { - if (1 == a.timeFlag) { - return a; +Entry.block.albert_rest_for = function(a, b) { + a = Entry.hw.sendQueue; + if (b.isStart) { + if (1 == b.timeFlag) { + return b; } - delete a.isStart; - delete a.timeFlag; + delete b.isStart; + delete b.timeFlag; Entry.engine.isContinue = !1; - return a.callReturn(); + return b.callReturn(); } - a.isStart = !0; - a.timeFlag = 1; - var d = a.getNumberValue("VALUE"), d = 6E4 * d / Entry.Albert.tempo; - c.buzzer = 0; - c.note = 0; - var e = setTimeout(function() { - a.timeFlag = 0; - Entry.Albert.removeTimeout(e); - }, d); - Entry.Albert.timeouts.push(e); - return a; + b.isStart = !0; + b.timeFlag = 1; + var c = b.getNumberValue("VALUE"), c = 6E4 * c / Entry.Albert.tempo; + a.buzzer = 0; + a.note = 0; + var d = setTimeout(function() { + b.timeFlag = 0; + Entry.Albert.removeTimeout(d); + }, c); + Entry.Albert.timeouts.push(d); + return b; }; Blockly.Blocks.albert_change_tempo_by = {init:function() { this.setColour("#00979D"); @@ -552,10 +771,10 @@ Blockly.Blocks.albert_change_tempo_by = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_change_tempo_by = function(b, a) { - Entry.Albert.tempo += a.getNumberValue("VALUE"); +Entry.block.albert_change_tempo_by = function(a, b) { + Entry.Albert.tempo += b.getNumberValue("VALUE"); 1 > Entry.Albert.tempo && (Entry.Albert.tempo = 1); - return a.callReturn(); + return b.callReturn(); }; Blockly.Blocks.albert_set_tempo_to = {init:function() { this.setColour("#00979D"); @@ -566,156 +785,15 @@ Blockly.Blocks.albert_set_tempo_to = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.albert_set_tempo_to = function(b, a) { - Entry.Albert.tempo = a.getNumberValue("VALUE"); +Entry.block.albert_set_tempo_to = function(a, b) { + Entry.Albert.tempo = b.getNumberValue("VALUE"); 1 > Entry.Albert.tempo && (Entry.Albert.tempo = 1); - return a.callReturn(); -}; -Blockly.Blocks.albert_move_forward = {init:function() { - this.setColour("#00979D"); - this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_move_forward).appendField(new Blockly.FieldIcon(Entry.mediaFilePath + "block_icon/hardware_03.png", "*")); - this.setInputsInline(!0); - this.setPreviousStatement(!0); - this.setNextStatement(!0); -}}; -Entry.block.albert_move_forward = function(b, a) { - var c = Entry.hw.sendQueue; - if (a.isStart) { - if (1 == a.timeFlag) { - return 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; - c.leftWheel = 30; - c.rightWheel = 30; - setTimeout(function() { - a.timeFlag = 0; - }, 1E3); - return a; -}; -Blockly.Blocks.albert_move_backward = {init:function() { - this.setColour("#00979D"); - this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_move_backward).appendField(new Blockly.FieldIcon(Entry.mediaFilePath + "block_icon/hardware_03.png", "*")); - this.setInputsInline(!0); - this.setPreviousStatement(!0); - this.setNextStatement(!0); -}}; -Entry.block.albert_move_backward = 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; -}; -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(); -}; -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 + "block_icon/hardware_03.png", "*")); - this.setInputsInline(!0); - this.setPreviousStatement(!0); - this.setNextStatement(!0); -}}; -Entry.block.albert_change_wheels_by = 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(); -}; -Blockly.Blocks.albert_set_wheels_to = {init:function() { - this.setColour("#00979D"); - this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_wheels_to_1).appendField(new Blockly.FieldDropdown([[Lang.General.left, "LEFT"], [Lang.General.right, "RIGHT"], [Lang.General.both, "FRONT"]]), "DIRECTION").appendField(Lang.Blocks.HAMSTER_set_wheels_to_2); - this.appendValueInput("VALUE").setCheck(["Number", "String"]); - this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_wheels_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_wheels_to = 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(); + return b.callReturn(); }; Entry.Arduino = {name:"arduino", setZero:function() { Entry.hw.sendQueue.readablePorts = []; - for (var b = 0;20 > b;b++) { - Entry.hw.sendQueue[b] = 0, Entry.hw.sendQueue.readablePorts.push(b); + for (var a = 0;20 > a;a++) { + Entry.hw.sendQueue[a] = 0, Entry.hw.sendQueue.readablePorts.push(a); } Entry.hw.update(); }, monitorTemplate:{imgPath:"hw/arduino.png", width:605, height:434, listPorts:{2:{name:Lang.Hw.port_en + " 2 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, 3:{name:Lang.Hw.port_en + " 3 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, 4:{name:Lang.Hw.port_en + " 4 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, 5:{name:Lang.Hw.port_en + " 5 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, 6:{name:Lang.Hw.port_en + " 6 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, 7:{name:Lang.Hw.port_en + @@ -723,16 +801,16 @@ Entry.Arduino = {name:"arduino", setZero:function() { Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, a0:{name:Lang.Hw.port_en + " A0 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, a1:{name:Lang.Hw.port_en + " A1 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, a2:{name:Lang.Hw.port_en + " A2 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, a3:{name:Lang.Hw.port_en + " A3 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, a4:{name:Lang.Hw.port_en + " A4 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, a5:{name:Lang.Hw.port_en + " A5 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}}, mode:"both"}}; Entry.ArduinoExt = {name:"ArduinoExt", getSensorKey:function() { - return "xxxxxxxx".replace(/[xy]/g, function(b) { - var a = 16 * Math.random() | 0; - return ("x" == b ? a : a & 0 | 0).toString(16); + return "xxxxxxxx".replace(/[xy]/g, function(a) { + var b = 16 * Math.random() | 0; + return ("x" == a ? b : b & 0 | 0).toString(16); }).toUpperCase(); -}, getSensorTime:function(b) { - return (new Date).getTime() + b; +}, getSensorTime:function(a) { + return (new Date).getTime() + a; }, setZero:function() { - Entry.hw.sendQueue.SET ? Object.keys(Entry.hw.sendQueue.SET).forEach(function(b) { - Entry.hw.sendQueue.SET[b].data = 0; - Entry.hw.sendQueue.TIME = Entry.ArduinoExt.getSensorTime(Entry.hw.sendQueue.SET[b].type); + Entry.hw.sendQueue.SET ? Object.keys(Entry.hw.sendQueue.SET).forEach(function(a) { + Entry.hw.sendQueue.SET[a].data = 0; + Entry.hw.sendQueue.TIME = Entry.ArduinoExt.getSensorTime(Entry.hw.sendQueue.SET[a].type); Entry.hw.sendQueue.KEY = Entry.ArduinoExt.getSensorKey(); }) : Entry.hw.sendQueue = {SET:{0:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}, 1:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}, 2:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}, 3:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}, 4:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}, 5:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}, 6:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}, 7:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}, 8:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}, 9:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}, 10:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}, 11:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}, 12:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}, 13:{type:Entry.ArduinoExt.sensorTypes.DIGITAL, data:0}}, TIME:Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.DIGITAL), KEY:Entry.ArduinoExt.getSensorKey()}; @@ -741,15 +819,15 @@ Entry.ArduinoExt = {name:"ArduinoExt", getSensorKey:function() { 1661, 3322, 6645], 10:[55, 110, 220, 440, 880, 1760, 3520, 7040], 11:[58, 117, 233, 466, 932, 1865, 3729, 7459], 12:[62, 123, 247, 494, 988, 1976, 3951, 7902]}, BlockState:{}}; Entry.SensorBoard = {name:"sensorBoard", setZero:Entry.Arduino.setZero}; Entry.ardublock = {name:"ardublock", setZero:Entry.Arduino.setZero}; -Entry.dplay = {name:"dplay", vel_value:255, Left_value:255, Right_value:255, setZero:Entry.Arduino.setZero, timeouts:[], removeTimeout:function(b) { - clearTimeout(b); - var a = this.timeouts; - b = a.indexOf(b); - 0 <= b && a.splice(b, 1); +Entry.dplay = {name:"dplay", vel_value:255, Left_value:255, Right_value:255, setZero:Entry.Arduino.setZero, timeouts:[], removeTimeout:function(a) { + clearTimeout(a); + var b = this.timeouts; + a = b.indexOf(a); + 0 <= a && b.splice(a, 1); }, removeAllTimeouts:function() { - var b = this.timeouts, a; - for (a in b) { - clearTimeout(b[a]); + var a = this.timeouts, b; + for (b in a) { + clearTimeout(a[b]); } this.timeouts = []; }}; @@ -762,8 +840,8 @@ Blockly.Blocks.arduino_text = {init:function() { this.setOutput(!0, "String"); this.setInputsInline(!0); }}; -Entry.block.arduino_text = function(b, a) { - return a.getStringField("NAME"); +Entry.block.arduino_text = function(a, b) { + return b.getStringField("NAME"); }; Blockly.Blocks.arduino_send = {init:function() { this.setColour("#00979D"); @@ -774,12 +852,13 @@ Blockly.Blocks.arduino_send = {init:function() { 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(); +Entry.block.arduino_send = function(a, b) { + a = b.getValue("VALUE", b); + var c = new XMLHttpRequest; + c.open("POST", "http://localhost:23518/arduino/", !1); + c.send(String(a)); + Entry.assert(200 == c.status, "arduino is not connected"); + return b.callReturn(); }; Blockly.Blocks.arduino_get_string = {init:function() { this.setColour("#00979D"); @@ -789,12 +868,13 @@ Blockly.Blocks.arduino_get_string = {init:function() { 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(a, b) { + a = b.getValue("VALUE", b); + b = new XMLHttpRequest; + b.open("POST", "http://localhost:23518/arduino/", !1); + b.send(String(a)); + Entry.assert(200 == b.status, "arduino is not connected"); + return Number(b.responseText); }; Blockly.Blocks.arduino_get_number = {init:function() { this.setColour("#00979D"); @@ -804,12 +884,13 @@ Blockly.Blocks.arduino_get_number = {init:function() { 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; +Entry.block.arduino_get_string = function(a, b) { + a = b.getValue("VALUE", b); + b = new XMLHttpRequest; + b.open("POST", "http://localhost:23518/arduino/", !1); + b.send(String(a)); + Entry.assert(200 == b.status, "arduino is not connected"); + return b.responseText; }; Blockly.Blocks.arduino_get_sensor_number = {init:function() { this.setColour("#00979D"); @@ -818,8 +899,8 @@ Blockly.Blocks.arduino_get_sensor_number = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.arduino_get_sensor_number = function(b, a) { - return a.getStringField("PORT"); +Entry.block.arduino_get_sensor_number = function(a, b) { + return b.getStringField("PORT"); }; Blockly.Blocks.arduino_get_port_number = {init:function() { this.setColour("#00979D"); @@ -828,8 +909,8 @@ Blockly.Blocks.arduino_get_port_number = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.arduino_get_port_number = function(b, a) { - return a.getStringField("PORT"); +Entry.block.arduino_get_port_number = function(a, b) { + return b.getStringField("PORT"); }; Blockly.Blocks.arduino_get_pwm_port_number = {init:function() { this.setColour("#00979D"); @@ -838,8 +919,8 @@ Blockly.Blocks.arduino_get_pwm_port_number = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.arduino_get_pwm_port_number = function(b, a) { - return a.getStringField("PORT"); +Entry.block.arduino_get_pwm_port_number = function(a, b) { + return b.getStringField("PORT"); }; Blockly.Blocks.arduino_get_number_sensor_value = {init:function() { this.setColour("#00979D"); @@ -849,9 +930,9 @@ Blockly.Blocks.arduino_get_number_sensor_value = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Number"); }}; -Entry.block.arduino_get_number_sensor_value = function(b, a) { - var c = a.getValue("VALUE", a); - return Entry.hw.getAnalogPortValue(c[1]); +Entry.block.arduino_get_number_sensor_value = function(a, b) { + a = b.getValue("VALUE", b); + return Entry.hw.getAnalogPortValue(a[1]); }; Blockly.Blocks.arduino_get_digital_value = {init:function() { this.setColour("#00979D"); @@ -861,9 +942,9 @@ Blockly.Blocks.arduino_get_digital_value = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Boolean"); }}; -Entry.block.arduino_get_digital_value = function(b, a) { - var c = a.getNumberValue("VALUE", a); - return Entry.hw.getDigitalPortValue(c); +Entry.block.arduino_get_digital_value = function(a, b) { + a = b.getNumberValue("VALUE", b); + return Entry.hw.getDigitalPortValue(a); }; Blockly.Blocks.arduino_toggle_led = {init:function() { this.setColour("#00979D"); @@ -875,10 +956,11 @@ Blockly.Blocks.arduino_toggle_led = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.arduino_toggle_led = function(b, a) { - var c = a.getNumberValue("VALUE"), d = "on" == a.getField("OPERATOR") ? 255 : 0; - Entry.hw.setDigitalPortValue(c, d); - return a.callReturn(); +Entry.block.arduino_toggle_led = function(a, b) { + a = b.getNumberValue("VALUE"); + var c = b.getField("OPERATOR"); + Entry.hw.setDigitalPortValue(a, "on" == c ? 255 : 0); + return b.callReturn(); }; Blockly.Blocks.arduino_toggle_pwm = {init:function() { this.setColour("#00979D"); @@ -892,10 +974,11 @@ Blockly.Blocks.arduino_toggle_pwm = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.arduino_toggle_pwm = function(b, a) { - var c = a.getNumberValue("PORT"), d = a.getNumberValue("VALUE"), d = Math.round(d), d = Math.max(d, 0), d = Math.min(d, 255); - Entry.hw.setDigitalPortValue(c, d); - return a.callReturn(); +Entry.block.arduino_toggle_pwm = function(a, b) { + a = b.getNumberValue("PORT"); + var c = b.getNumberValue("VALUE"), c = Math.round(c), c = Math.max(c, 0), c = Math.min(c, 255); + Entry.hw.setDigitalPortValue(a, c); + return b.callReturn(); }; Blockly.Blocks.arduino_convert_scale = {init:function() { this.setColour("#00979D"); @@ -914,17 +997,18 @@ Blockly.Blocks.arduino_convert_scale = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.arduino_convert_scale = function(b, a) { - var c = a.getNumberValue("VALUE1", a), d = a.getNumberValue("VALUE2", a), e = a.getNumberValue("VALUE3", a), f = a.getNumberValue("VALUE4", a), g = a.getNumberValue("VALUE5", a); +Entry.block.arduino_convert_scale = function(a, b) { + var c = b.getNumberValue("VALUE1", b), d = b.getNumberValue("VALUE2", b), e = b.getNumberValue("VALUE3", b); + a = b.getNumberValue("VALUE4", b); + b = b.getNumberValue("VALUE5", b); if (d > e) { - var h = d, d = e, e = h - } - f > g && (h = f, f = g, g = h); - c -= d; - c *= (g - f) / (e - d); - c += f; - c = Math.min(g, c); - c = Math.max(f, c); + var f = d, d = e, e = f + } + a > b && (f = a, a = b, b = f); + c = (b - a) / (e - d) * (c - d); + c += a; + c = Math.min(b, c); + c = Math.max(a, c); return Math.round(c); }; Blockly.Blocks.sensorBoard_get_named_sensor_value = {init:function() { @@ -933,8 +1017,8 @@ Blockly.Blocks.sensorBoard_get_named_sensor_value = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.sensorBoard_get_named_sensor_value = function(b, a) { - return Entry.hw.getAnalogPortValue(a.getField("PORT", a)); +Entry.block.sensorBoard_get_named_sensor_value = function(a, b) { + return Entry.hw.getAnalogPortValue(b.getField("PORT", b)); }; Blockly.Blocks.sensorBoard_is_button_pressed = {init:function() { this.setColour("#00979D"); @@ -943,8 +1027,8 @@ Blockly.Blocks.sensorBoard_is_button_pressed = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Boolean"); }}; -Entry.block.sensorBoard_is_button_pressed = function(b, a) { - return Entry.hw.getDigitalPortValue(a.getNumberField("PORT", a)); +Entry.block.sensorBoard_is_button_pressed = function(a, b) { + return Entry.hw.getDigitalPortValue(b.getNumberField("PORT", b)); }; Blockly.Blocks.sensorBoard_led = {init:function() { this.setColour("#00979D"); @@ -953,9 +1037,9 @@ Blockly.Blocks.sensorBoard_led = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.sensorBoard_led = function(b, a) { - Entry.hw.setDigitalPortValue(a.getField("PORT"), a.getNumberField("OPERATOR")); - return a.callReturn(); +Entry.block.sensorBoard_led = function(a, b) { + Entry.hw.setDigitalPortValue(b.getField("PORT"), b.getNumberField("OPERATOR")); + return b.callReturn(); }; Entry.block.arduino_download_connector = {skeleton:"basic_button", color:"#eee", template:"%1", params:[{type:"Text", text:"\uc5f0\uacb0 \ud504\ub85c\uadf8\ub7a8 \ub2e4\uc6b4\ub85c\ub4dc", color:"#333", align:"center"}], func:function() { }, events:{mousedown:[function() { @@ -980,8 +1064,8 @@ Blockly.Blocks.CODEino_get_sensor_number = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.CODEino_get_sensor_number = function(b, a) { - return a.getStringField("PORT"); +Entry.block.CODEino_get_sensor_number = function(a, b) { + return b.getStringField("PORT"); }; Blockly.Blocks.CODEino_get_named_sensor_value = {init:function() { this.setColour("#00979D"); @@ -989,8 +1073,8 @@ Blockly.Blocks.CODEino_get_named_sensor_value = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.CODEino_get_named_sensor_value = function(b, a) { - return Entry.hw.getAnalogPortValue(a.getField("PORT", a)); +Entry.block.CODEino_get_named_sensor_value = function(a, b) { + return Entry.hw.getAnalogPortValue(b.getField("PORT", b)); }; Blockly.Blocks.CODEino_get_sound_status = {init:function() { this.setColour("#00979D"); @@ -998,8 +1082,8 @@ Blockly.Blocks.CODEino_get_sound_status = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Boolean"); }}; -Entry.block.CODEino_get_sound_status = function(b, a) { - return "GREAT" == a.getField("STATUS", a) ? 600 < Entry.hw.getAnalogPortValue(0) ? 1 : 0 : 600 > Entry.hw.getAnalogPortValue(0) ? 1 : 0; +Entry.block.CODEino_get_sound_status = function(a, b) { + return "GREAT" == b.getField("STATUS", b) ? 600 < Entry.hw.getAnalogPortValue(0) ? 1 : 0 : 600 > Entry.hw.getAnalogPortValue(0) ? 1 : 0; }; Blockly.Blocks.CODEino_get_light_status = {init:function() { this.setColour("#00979D"); @@ -1007,8 +1091,8 @@ Blockly.Blocks.CODEino_get_light_status = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Boolean"); }}; -Entry.block.CODEino_get_light_status = function(b, a) { - return "DARK" == a.getField("STATUS", a) ? 800 < Entry.hw.getAnalogPortValue(1) ? 1 : 0 : 800 > Entry.hw.getAnalogPortValue(1) ? 1 : 0; +Entry.block.CODEino_get_light_status = function(a, b) { + return "DARK" == b.getField("STATUS", b) ? 800 < Entry.hw.getAnalogPortValue(1) ? 1 : 0 : 800 > Entry.hw.getAnalogPortValue(1) ? 1 : 0; }; Blockly.Blocks.CODEino_is_button_pressed = {init:function() { this.setColour("#00979D"); @@ -1016,9 +1100,9 @@ Blockly.Blocks.CODEino_is_button_pressed = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Boolean"); }}; -Entry.block.CODEino_is_button_pressed = function(b, a) { - var c = a.getNumberField("PORT", a); - return 14 < c ? !Entry.hw.getAnalogPortValue(c - 14) : !Entry.hw.getDigitalPortValue(c); +Entry.block.CODEino_is_button_pressed = function(a, b) { + a = b.getNumberField("PORT", b); + return 14 < a ? !Entry.hw.getAnalogPortValue(a - 14) : !Entry.hw.getDigitalPortValue(a); }; Blockly.Blocks.CODEino_get_accelerometer_direction = {init:function() { this.setColour("#00979D"); @@ -1027,23 +1111,22 @@ Blockly.Blocks.CODEino_get_accelerometer_direction = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Boolean"); }}; -Entry.block.CODEino_get_accelerometer_direction = function(b, a) { - var c = a.getField("DIRECTION", a), d = 0; - "LEFT" == c || "RIGHT" == c ? d = 3 : "FRONT" == c || "REAR" == c ? d = 4 : "REVERSE" == c && (d = 5); - d = Entry.hw.getAnalogPortValue(d); - d = 180 / 137 * (d - 265); - d += -90; - d = Math.min(90, d); - d = Math.max(-90, d); - d = Math.round(d); - if ("LEFT" == c || "REAR" == c) { - return -30 > d ? 1 : 0; +Entry.block.CODEino_get_accelerometer_direction = function(a, b) { + a = b.getField("DIRECTION", b); + b = 0; + "LEFT" == a || "RIGHT" == a ? b = 3 : "FRONT" == a || "REAR" == a ? b = 4 : "REVERSE" == a && (b = 5); + b = Entry.hw.getAnalogPortValue(b) - 265; + b = Math.min(90, 180 / 137 * b + -90); + b = Math.max(-90, b); + b = Math.round(b); + if ("LEFT" == a || "REAR" == a) { + return -30 > b ? 1 : 0; } - if ("RIGHT" == c || "FRONT" == c) { - return 30 < d ? 1 : 0; + if ("RIGHT" == a || "FRONT" == a) { + return 30 < b ? 1 : 0; } - if ("REVERSE" == c) { - return -50 > d ? 1 : 0; + if ("REVERSE" == a) { + return -50 > b ? 1 : 0; } }; Blockly.Blocks.CODEino_get_accelerometer_value = {init:function() { @@ -1052,17 +1135,19 @@ Blockly.Blocks.CODEino_get_accelerometer_value = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.CODEino_get_accelerometer_value = function(b, a) { - var c = 265, d = 402, e = -90, f = 90, g = Entry.hw.getAnalogPortValue(a.getField("PORT", a)); - if (c > d) { - var h = c, c = d, d = h +Entry.block.CODEino_get_accelerometer_value = function(a, b) { + var c = Entry.hw.getAnalogPortValue(b.getField("PORT", b)), d = 265, e = 402; + a = -90; + b = 90; + if (d > e) { + var f = d, d = e, e = f } - e > f && (h = e, e = f, f = h); - g = (f - e) / (d - c) * (g - c); - g += e; - g = Math.min(f, g); - g = Math.max(e, g); - return Math.round(g); + a > b && (f = a, a = b, b = f); + c = (b - a) / (e - d) * (c - d); + c += a; + c = Math.min(b, c); + c = Math.max(a, c); + return Math.round(c); }; Blockly.Blocks.dplay_select_led = {init:function() { this.setColour("#00979D"); @@ -1074,12 +1159,13 @@ Blockly.Blocks.dplay_select_led = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.dplay_select_led = function(b, a) { - var c = a.getField("PORT"), d = 7; - "7" == c ? d = 7 : "8" == c ? d = 8 : "9" == c ? d = 9 : "10" == c && (d = 10); - c = "on" == a.getField("OPERATOR") ? 255 : 0; - Entry.hw.setDigitalPortValue(d, c); - return a.callReturn(); +Entry.block.dplay_select_led = function(a, b) { + var c = b.getField("PORT"); + a = 7; + "7" == c ? a = 7 : "8" == c ? a = 8 : "9" == c ? a = 9 : "10" == c && (a = 10); + c = b.getField("OPERATOR"); + Entry.hw.setDigitalPortValue(a, "on" == c ? 255 : 0); + return b.callReturn(); }; Blockly.Blocks.dplay_get_switch_status = {init:function() { this.setColour("#00979D"); @@ -1089,10 +1175,11 @@ Blockly.Blocks.dplay_get_switch_status = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Boolean"); }}; -Entry.block.dplay_get_switch_status = function(b, a) { - var c = a.getField("PORT"), d = 2; - "2" == c ? d = 2 : "4" == c && (d = 4); - return "OFF" == a.getField("STATUS") ? 1 == Entry.hw.getDigitalPortValue(d) ? 1 : 0 : 0 == Entry.hw.getDigitalPortValue(d) ? 1 : 0; +Entry.block.dplay_get_switch_status = function(a, b) { + a = b.getField("PORT"); + var c = 2; + "2" == a ? c = 2 : "4" == a && (c = 4); + return "OFF" == b.getField("STATUS") ? 1 == Entry.hw.getDigitalPortValue(c) ? 1 : 0 : 0 == Entry.hw.getDigitalPortValue(c) ? 1 : 0; }; Blockly.Blocks.dplay_get_light_status = {init:function() { this.setColour("#00979D"); @@ -1100,8 +1187,8 @@ Blockly.Blocks.dplay_get_light_status = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Boolean"); }}; -Entry.block.dplay_get_light_status = function(b, a) { - return "DARK" == a.getField("STATUS", a) ? 800 < Entry.hw.getAnalogPortValue(1) ? 1 : 0 : 800 > Entry.hw.getAnalogPortValue(1) ? 1 : 0; +Entry.block.dplay_get_light_status = function(a, b) { + return "DARK" == b.getField("STATUS", b) ? 800 < Entry.hw.getAnalogPortValue(1) ? 1 : 0 : 800 > Entry.hw.getAnalogPortValue(1) ? 1 : 0; }; Blockly.Blocks.dplay_get_value = {init:function() { this.setColour("#00979D"); @@ -1113,9 +1200,9 @@ Blockly.Blocks.dplay_get_value = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Number"); }}; -Entry.block.dplay_get_value = function(b, a) { - var c = a.getValue("VALUE", a); - return Entry.hw.getAnalogPortValue(c[1]); +Entry.block.dplay_get_value = function(a, b) { + a = b.getValue("VALUE", b); + return Entry.hw.getAnalogPortValue(a[1]); }; Blockly.Blocks.dplay_get_tilt = {init:function() { this.setColour("#00979D"); @@ -1123,8 +1210,8 @@ Blockly.Blocks.dplay_get_tilt = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Boolean"); }}; -Entry.block.dplay_get_tilt = function(b, a) { - return "LIGHT" == a.getField("STATUS", a) ? 1 == Entry.hw.getDigitalPortValue(12) ? 1 : 0 : 0 == Entry.hw.getDigitalPortValue(12) ? 1 : 0; +Entry.block.dplay_get_tilt = function(a, b) { + return "LIGHT" == b.getField("STATUS", b) ? 1 == Entry.hw.getDigitalPortValue(12) ? 1 : 0 : 0 == Entry.hw.getDigitalPortValue(12) ? 1 : 0; }; Blockly.Blocks.dplay_DCmotor = {init:function() { this.setColour("#00979D"); @@ -1135,14 +1222,15 @@ Blockly.Blocks.dplay_DCmotor = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.dplay_DCmotor = function(b, a) { - var c = a.getField("PORT"), d = 0; - "3" == c ? d = 5 : "6" == c && (d = 11); - var e = a.getField("OPERATOR"), f = 0, g = 0; - "FRONT" == e ? (f = 255, g = 0) : "REAR" == e ? (f = 0, g = 255) : "OFF" == e && (g = f = 0); +Entry.block.dplay_DCmotor = function(a, b) { + a = b.getField("PORT"); + var c = 0; + "3" == a ? c = 5 : "6" == a && (c = 11); + var d = b.getField("OPERATOR"), e = 0, f = 0; + "FRONT" == d ? (e = 255, f = 0) : "REAR" == d ? (e = 0, f = 255) : "OFF" == d && (f = e = 0); + Entry.hw.setDigitalPortValue(a, e); Entry.hw.setDigitalPortValue(c, f); - Entry.hw.setDigitalPortValue(d, g); - return a.callReturn(); + return b.callReturn(); }; Blockly.Blocks.dplay_buzzer = {init:function() { this.setColour("#00979D"); @@ -1156,15 +1244,16 @@ Blockly.Blocks.dplay_buzzer = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.dplay_buzzer = function(b, a) { - var c = a.getField("PORT"), d = 2; - "1" == c ? d = 2 : "2" == c ? d = 4 : "3" == c && (d = 7); - c = a.getNumberValue("VALUE"); +Entry.block.dplay_buzzer = function(a, b) { + var c = b.getField("PORT"); + a = 2; + "1" == c ? a = 2 : "2" == c ? a = 4 : "3" == c && (a = 7); + c = b.getNumberValue("VALUE"); c = Math.round(c); c = Math.max(c, 0); c = Math.min(c, 100); - Entry.hw.setDigitalPortValue(d, c); - return a.callReturn(); + Entry.hw.setDigitalPortValue(a, c); + return b.callReturn(); }; Blockly.Blocks.dplay_servo = {init:function() { this.setColour("#00979D"); @@ -1176,39 +1265,42 @@ Blockly.Blocks.dplay_servo = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.dplay_servo = function(b, a) { - var c = a.getNumberValue("VALUE"), c = Math.round(c), c = Math.max(c, 0), c = Math.min(c, 180); - Entry.hw.setDigitalPortValue(9, c); - return a.callReturn(); +Entry.block.dplay_servo = function(a, b) { + a = b.getNumberValue("VALUE"); + a = Math.round(a); + a = Math.max(a, 0); + a = Math.min(a, 180); + Entry.hw.setDigitalPortValue(9, a); + return b.callReturn(); }; Entry.Bitbrick = {SENSOR_MAP:{1:"light", 2:"IR", 3:"touch", 4:"potentiometer", 5:"MIC", 21:"UserSensor", 11:"UserInput", 20:"LED", 19:"SERVO", 18:"DC"}, PORT_MAP:{buzzer:2, 5:4, 6:6, 7:8, 8:10, LEDR:12, LEDG:14, LEDB:16}, sensorList:function() { - for (var b = [], a = Entry.hw.portData, c = 1;5 > c;c++) { - var d = a[c]; - d && (d.value || 0 === d.value) && b.push([c + " - " + Lang.Blocks["BITBRICK_" + d.type], c.toString()]); + for (var a = [], b = Entry.hw.portData, c = 1;5 > c;c++) { + var d = b[c]; + d && (d.value || 0 === d.value) && a.push([c + " - " + Lang.Blocks["BITBRICK_" + d.type], c.toString()]); } - return 0 == b.length ? [[Lang.Blocks.no_target, "null"]] : b; + return 0 == a.length ? [[Lang.Blocks.no_target, "null"]] : a; }, touchList:function() { - for (var b = [], a = Entry.hw.portData, c = 1;5 > c;c++) { - var d = a[c]; - d && "touch" === d.type && b.push([c.toString(), c.toString()]); + for (var a = [], b = Entry.hw.portData, c = 1;5 > c;c++) { + var d = b[c]; + d && "touch" === d.type && a.push([c.toString(), c.toString()]); } - return 0 == b.length ? [[Lang.Blocks.no_target, "null"]] : b; + return 0 == a.length ? [[Lang.Blocks.no_target, "null"]] : a; }, servoList:function() { - for (var b = [], a = Entry.hw.portData, c = 5;9 > c;c++) { - var d = a[c]; - d && "SERVO" === d.type && b.push(["ABCD"[c - 5], c.toString()]); + for (var a = [], b = Entry.hw.portData, c = 5;9 > c;c++) { + var d = b[c]; + d && "SERVO" === d.type && a.push(["ABCD"[c - 5], c.toString()]); } - return 0 == b.length ? [[Lang.Blocks.no_target, "null"]] : b; + return 0 == a.length ? [[Lang.Blocks.no_target, "null"]] : a; }, dcList:function() { - for (var b = [], a = Entry.hw.portData, c = 5;9 > c;c++) { - var d = a[c]; - d && "DC" === d.type && b.push(["ABCD"[c - 5], c.toString()]); + for (var a = [], b = Entry.hw.portData, c = 5;9 > c;c++) { + var d = b[c]; + d && "DC" === d.type && a.push(["ABCD"[c - 5], c.toString()]); } - return 0 == b.length ? [[Lang.Blocks.no_target, "null"]] : b; + return 0 == a.length ? [[Lang.Blocks.no_target, "null"]] : a; }, setZero:function() { - var b = Entry.hw.sendQueue, a; - for (a in Entry.Bitbrick.PORT_MAP) { - b[a] = 0; + var a = Entry.hw.sendQueue, b; + for (b in Entry.Bitbrick.PORT_MAP) { + a[b] = 0; } Entry.hw.update(); }, name:"bitbrick", servoMaxValue:181, servoMinValue:1, dcMaxValue:100, dcMinValue:-100, monitorTemplate:{keys:["value"], imgPath:"hw/bitbrick.png", width:400, height:400, listPorts:{1:{name:Lang.Hw.port_en + " 1 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, 2:{name:Lang.Hw.port_en + " 2 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, 3:{name:Lang.Hw.port_en + " 3 " + Lang.Hw.port_ko, type:"input", pos:{x:0, y:0}}, 4:{name:Lang.Hw.port_en + " 4 " + Lang.Hw.port_ko, type:"input", pos:{x:0, @@ -1219,9 +1311,9 @@ Blockly.Blocks.bitbrick_sensor_value = {init:function() { this.setOutput(!0, "String"); this.setInputsInline(!0); }}; -Entry.block.bitbrick_sensor_value = function(b, a) { - var c = a.getStringField("PORT"); - return Entry.hw.portData[c].value; +Entry.block.bitbrick_sensor_value = function(a, b) { + a = b.getStringField("PORT"); + return Entry.hw.portData[a].value; }; Blockly.Blocks.bitbrick_is_touch_pressed = {init:function() { this.setColour("#00979D"); @@ -1229,8 +1321,8 @@ Blockly.Blocks.bitbrick_is_touch_pressed = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.bitbrick_is_touch_pressed = function(b, a) { - return 0 === Entry.hw.portData[a.getStringField("PORT")].value; +Entry.block.bitbrick_is_touch_pressed = function(a, b) { + return 0 === Entry.hw.portData[b.getStringField("PORT")].value; }; Blockly.Blocks.bitbrick_turn_off_color_led = {init:function() { this.setColour("#00979D"); @@ -1239,11 +1331,11 @@ Blockly.Blocks.bitbrick_turn_off_color_led = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.bitbrick_turn_off_color_led = function(b, a) { +Entry.block.bitbrick_turn_off_color_led = function(a, b) { Entry.hw.sendQueue.LEDR = 0; Entry.hw.sendQueue.LEDG = 0; Entry.hw.sendQueue.LEDB = 0; - return a.callReturn(); + return b.callReturn(); }; Blockly.Blocks.bitbrick_turn_on_color_led_by_rgb = {init:function() { this.setColour("#00979D"); @@ -1258,12 +1350,13 @@ Blockly.Blocks.bitbrick_turn_on_color_led_by_rgb = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.bitbrick_turn_on_color_led_by_rgb = function(b, a) { - var c = a.getNumberValue("rValue"), d = a.getNumberValue("gValue"), e = a.getNumberValue("bValue"), f = Entry.adjustValueWithMaxMin, g = Entry.hw.sendQueue; - g.LEDR = f(c, 0, 255); - g.LEDG = f(d, 0, 255); - g.LEDB = f(e, 0, 255); - return a.callReturn(); +Entry.block.bitbrick_turn_on_color_led_by_rgb = function(a, b) { + a = b.getNumberValue("rValue"); + var c = b.getNumberValue("gValue"), d = b.getNumberValue("bValue"), e = Entry.adjustValueWithMaxMin, f = Entry.hw.sendQueue; + f.LEDR = e(a, 0, 255); + f.LEDG = e(c, 0, 255); + f.LEDB = e(d, 0, 255); + return b.callReturn(); }; Blockly.Blocks.bitbrick_turn_on_color_led_by_picker = {init:function() { this.setColour("#00979D"); @@ -1272,12 +1365,12 @@ Blockly.Blocks.bitbrick_turn_on_color_led_by_picker = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.bitbrick_turn_on_color_led_by_picker = function(b, a) { - var c = a.getStringField("VALUE"); - Entry.hw.sendQueue.LEDR = parseInt(c.substr(1, 2), 16); - Entry.hw.sendQueue.LEDG = parseInt(c.substr(3, 2), 16); - Entry.hw.sendQueue.LEDB = parseInt(c.substr(5, 2), 16); - return a.callReturn(); +Entry.block.bitbrick_turn_on_color_led_by_picker = function(a, b) { + a = b.getStringField("VALUE"); + Entry.hw.sendQueue.LEDR = parseInt(a.substr(1, 2), 16); + Entry.hw.sendQueue.LEDG = parseInt(a.substr(3, 2), 16); + Entry.hw.sendQueue.LEDB = parseInt(a.substr(5, 2), 16); + return b.callReturn(); }; Blockly.Blocks.bitbrick_turn_on_color_led_by_value = {init:function() { this.setColour("#00979D"); @@ -1288,13 +1381,15 @@ Blockly.Blocks.bitbrick_turn_on_color_led_by_value = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.bitbrick_turn_on_color_led_by_value = function(b, a) { - var c = a.getNumberValue("VALUE"), d, e, f, c = c % 200; - 67 > c ? (d = 200 - 3 * c, e = 3 * c, f = 0) : 134 > c ? (c -= 67, d = 0, e = 200 - 3 * c, f = 3 * c) : 201 > c && (c -= 134, d = 3 * c, e = 0, f = 200 - 3 * c); - Entry.hw.sendQueue.LEDR = d; - Entry.hw.sendQueue.LEDG = e; - Entry.hw.sendQueue.LEDB = f; - return a.callReturn(); +Entry.block.bitbrick_turn_on_color_led_by_value = function(a, b) { + a = b.getNumberValue("VALUE"); + var c, d, e; + a %= 200; + 67 > a ? (c = 200 - 3 * a, d = 3 * a, e = 0) : 134 > a ? (a -= 67, c = 0, d = 200 - 3 * a, e = 3 * a) : 201 > a && (a -= 134, c = 3 * a, d = 0, e = 200 - 3 * a); + Entry.hw.sendQueue.LEDR = c; + Entry.hw.sendQueue.LEDG = d; + Entry.hw.sendQueue.LEDB = e; + return b.callReturn(); }; Blockly.Blocks.bitbrick_buzzer = {init:function() { this.setColour("#00979D"); @@ -1305,14 +1400,14 @@ Blockly.Blocks.bitbrick_buzzer = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.bitbrick_buzzer = function(b, a) { - if (a.isStart) { - return Entry.hw.sendQueue.buzzer = 0, delete a.isStart, a.callReturn(); +Entry.block.bitbrick_buzzer = function(a, b) { + if (b.isStart) { + return Entry.hw.sendQueue.buzzer = 0, delete b.isStart, b.callReturn(); } - var c = a.getNumberValue("VALUE"); - Entry.hw.sendQueue.buzzer = c; - a.isStart = !0; - return a; + a = b.getNumberValue("VALUE"); + Entry.hw.sendQueue.buzzer = a; + b.isStart = !0; + return b; }; Blockly.Blocks.bitbrick_turn_off_all_motors = {init:function() { this.setColour("#00979D"); @@ -1321,15 +1416,16 @@ Blockly.Blocks.bitbrick_turn_off_all_motors = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.bitbrick_turn_off_all_motors = function(b, a) { - var c = Entry.hw.sendQueue, d = Entry.Bitbrick; - d.servoList().map(function(a) { - c[a[1]] = 0; +Entry.block.bitbrick_turn_off_all_motors = function(a, b) { + var c = Entry.hw.sendQueue; + a = Entry.Bitbrick; + a.servoList().map(function(b) { + c[b[1]] = 0; }); - d.dcList().map(function(a) { - c[a[1]] = 128; + a.dcList().map(function(b) { + c[b[1]] = 128; }); - return a.callReturn(); + return b.callReturn(); }; Blockly.Blocks.bitbrick_dc_speed = {init:function() { this.setColour("#00979D"); @@ -1340,10 +1436,12 @@ Blockly.Blocks.bitbrick_dc_speed = {init:function() { this.setNextStatement(!0); this.setInputsInline(!0); }}; -Entry.block.bitbrick_dc_speed = function(b, a) { - var c = a.getNumberValue("VALUE"), c = Math.min(c, Entry.Bitbrick.dcMaxValue), c = Math.max(c, Entry.Bitbrick.dcMinValue); - Entry.hw.sendQueue[a.getStringField("PORT")] = c + 128; - return a.callReturn(); +Entry.block.bitbrick_dc_speed = function(a, b) { + a = b.getNumberValue("VALUE"); + a = Math.min(a, Entry.Bitbrick.dcMaxValue); + a = Math.max(a, Entry.Bitbrick.dcMinValue); + Entry.hw.sendQueue[b.getStringField("PORT")] = a + 128; + return b.callReturn(); }; Blockly.Blocks.bitbrick_dc_direction_speed = {init:function() { this.setColour("#00979D"); @@ -1354,10 +1452,11 @@ Blockly.Blocks.bitbrick_dc_direction_speed = {init:function() { this.setNextStatement(!0); this.setInputsInline(!0); }}; -Entry.block.bitbrick_dc_direction_speed = function(b, a) { - var c = "CW" === a.getStringField("DIRECTION"), d = a.getNumberValue("VALUE"), d = Math.min(d, Entry.Bitbrick.dcMaxValue), d = Math.max(d, 0); - Entry.hw.sendQueue[a.getStringField("PORT")] = c ? d + 128 : 128 - d; - return a.callReturn(); +Entry.block.bitbrick_dc_direction_speed = function(a, b) { + a = "CW" === b.getStringField("DIRECTION"); + var c = b.getNumberValue("VALUE"), c = Math.min(c, Entry.Bitbrick.dcMaxValue), c = Math.max(c, 0); + Entry.hw.sendQueue[b.getStringField("PORT")] = a ? c + 128 : 128 - c; + return b.callReturn(); }; Blockly.Blocks.bitbrick_servomotor_angle = {init:function() { this.setColour("#00979D"); @@ -1368,10 +1467,12 @@ Blockly.Blocks.bitbrick_servomotor_angle = {init:function() { this.setNextStatement(!0); this.setInputsInline(!0); }}; -Entry.block.bitbrick_servomotor_angle = function(b, a) { - var c = a.getNumberValue("VALUE") + 1, c = Math.min(c, Entry.Bitbrick.servoMaxValue), c = Math.max(c, Entry.Bitbrick.servoMinValue); - Entry.hw.sendQueue[a.getStringField("PORT")] = c; - return a.callReturn(); +Entry.block.bitbrick_servomotor_angle = function(a, b) { + a = b.getNumberValue("VALUE") + 1; + a = Math.min(a, Entry.Bitbrick.servoMaxValue); + a = Math.max(a, Entry.Bitbrick.servoMinValue); + Entry.hw.sendQueue[b.getStringField("PORT")] = a; + return b.callReturn(); }; Blockly.Blocks.bitbrick_convert_scale = {init:function() { this.setColour("#00979D"); @@ -1388,17 +1489,21 @@ Blockly.Blocks.bitbrick_convert_scale = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.bitbrick_convert_scale = function(b, a) { - var c = a.getNumberField("PORT"), d = Entry.hw.portData[c].value, c = a.getNumberValue("VALUE2", a), e = a.getNumberValue("VALUE3", a), f = a.getNumberValue("VALUE4", a), g = a.getNumberValue("VALUE5", a); - if (f > g) { - var h = f, f = g, g = h - } - d -= c; - d *= (g - f) / (e - c); - d += f; - d = Math.min(g, d); - d = Math.max(f, d); - return Math.round(d); +Entry.block.bitbrick_convert_scale = function(a, b) { + a = b.getNumberField("PORT"); + var c = Entry.hw.portData[a].value, d = b.getNumberValue("VALUE2", b), e = b.getNumberValue("VALUE3", b); + a = b.getNumberValue("VALUE4", b); + b = b.getNumberValue("VALUE5", b); + if (a > b) { + var f = a; + a = b; + b = f; + } + c = (b - a) / (e - d) * (c - d); + c += a; + c = Math.min(b, c); + c = Math.max(a, c); + return Math.round(c); }; var categoryColor = "#FF9E20"; Blockly.Blocks.start_drawing = {init:function() { @@ -1408,11 +1513,11 @@ Blockly.Blocks.start_drawing = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.start_drawing = function(b, a) { - b.brush ? b.brush.stop = !1 : Entry.setBasicBrush(b); +Entry.block.start_drawing = function(a, b) { + a.brush ? a.brush.stop = !1 : Entry.setBasicBrush(a); Entry.stage.sortZorder(); - b.brush.moveTo(b.getX(), -1 * b.getY()); - return a.callReturn(); + a.brush.moveTo(a.getX(), -1 * a.getY()); + return b.callReturn(); }; Blockly.Blocks.stop_drawing = {init:function() { this.setColour(categoryColor); @@ -1421,9 +1526,9 @@ Blockly.Blocks.stop_drawing = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.stop_drawing = function(b, a) { - b.brush && b.shape && (b.brush.stop = !0); - return a.callReturn(); +Entry.block.stop_drawing = function(a, b) { + a.brush && a.shape && (a.brush.stop = !0); + return b.callReturn(); }; Blockly.Blocks.set_color = {init:function() { this.setColour(categoryColor); @@ -1434,11 +1539,11 @@ Blockly.Blocks.set_color = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.set_color = function(b, a) { - var c = a.getField("VALUE", a); - b.brush || (Entry.setBasicBrush(b), b.brush.stop = !0); - b.brush && (c = Entry.hex2rgb(c), b.brush.rgb = c, b.brush.endStroke(), b.brush.beginStroke("rgba(" + c.r + "," + c.g + "," + c.b + "," + b.brush.opacity / 100 + ")"), b.brush.moveTo(b.getX(), -1 * b.getY())); - return a.callReturn(); +Entry.block.set_color = function(a, b) { + var c = b.getField("VALUE", b); + a.brush || (Entry.setBasicBrush(a), a.brush.stop = !0); + a.brush && (c = Entry.hex2rgb(c), a.brush.rgb = c, a.brush.endStroke(), a.brush.beginStroke("rgba(" + c.r + "," + c.g + "," + c.b + "," + a.brush.opacity / 100 + ")"), a.brush.moveTo(a.getX(), -1 * a.getY())); + return b.callReturn(); }; Blockly.Blocks.set_random_color = {init:function() { this.setColour(categoryColor); @@ -1447,16 +1552,16 @@ Blockly.Blocks.set_random_color = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.set_random_color = function(b, a) { - b.brush || (Entry.setBasicBrush(b), b.brush.stop = !0); - if (b.brush) { +Entry.block.set_random_color = function(a, b) { + a.brush || (Entry.setBasicBrush(a), a.brush.stop = !0); + if (a.brush) { var c = Entry.generateRgb(); - b.brush.rgb = c; - b.brush.endStroke(); - b.brush.beginStroke("rgba(" + c.r + "," + c.g + "," + c.b + "," + b.brush.opacity / 100 + ")"); - b.brush.moveTo(b.getX(), -1 * b.getY()); + a.brush.rgb = c; + a.brush.endStroke(); + a.brush.beginStroke("rgba(" + c.r + "," + c.g + "," + c.b + "," + a.brush.opacity / 100 + ")"); + a.brush.moveTo(a.getX(), -1 * a.getY()); } - return a.callReturn(); + return b.callReturn(); }; Blockly.Blocks.change_thickness = {init:function() { this.setColour(categoryColor); @@ -1467,11 +1572,11 @@ Blockly.Blocks.change_thickness = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.change_thickness = function(b, a) { - var c = a.getNumberValue("VALUE", a); - b.brush || (Entry.setBasicBrush(b), b.brush.stop = !0); - b.brush && (b.brush.thickness += c, 1 > b.brush.thickness && (b.brush.thickness = 1), b.brush.setStrokeStyle(b.brush.thickness), b.brush.moveTo(b.getX(), -1 * b.getY())); - return a.callReturn(); +Entry.block.change_thickness = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.brush || (Entry.setBasicBrush(a), a.brush.stop = !0); + a.brush && (a.brush.thickness += c, 1 > a.brush.thickness && (a.brush.thickness = 1), a.brush.setStrokeStyle(a.brush.thickness), a.brush.moveTo(a.getX(), -1 * a.getY())); + return b.callReturn(); }; Blockly.Blocks.set_thickness = {init:function() { this.setColour(categoryColor); @@ -1482,11 +1587,11 @@ Blockly.Blocks.set_thickness = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.set_thickness = function(b, a) { - var c = a.getNumberValue("VALUE", a); - b.brush || (Entry.setBasicBrush(b), b.brush.stop = !0); - b.brush && (b.brush.thickness = c, b.brush.setStrokeStyle(b.brush.thickness), b.brush.moveTo(b.getX(), -1 * b.getY())); - return a.callReturn(); +Entry.block.set_thickness = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.brush || (Entry.setBasicBrush(a), a.brush.stop = !0); + a.brush && (a.brush.thickness = c, a.brush.setStrokeStyle(a.brush.thickness), a.brush.moveTo(a.getX(), -1 * a.getY())); + return b.callReturn(); }; Blockly.Blocks.change_opacity = {init:function() { this.setColour(categoryColor); @@ -1497,12 +1602,12 @@ Blockly.Blocks.change_opacity = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.change_opacity = function(b, a) { - var c = a.getNumberValue("VALUE", a); - b.brush || (Entry.setBasicBrush(b), b.brush.stop = !0); - c = Entry.adjustValueWithMaxMin(b.brush.opacity + c, 0, 100); - b.brush && (b.brush.opacity = c, b.brush.endStroke(), c = b.brush.rgb, b.brush.beginStroke("rgba(" + c.r + "," + c.g + "," + c.b + "," + b.brush.opacity / 100 + ")"), b.brush.moveTo(b.getX(), -1 * b.getY())); - return a.callReturn(); +Entry.block.change_opacity = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.brush || (Entry.setBasicBrush(a), a.brush.stop = !0); + c = Entry.adjustValueWithMaxMin(a.brush.opacity + c, 0, 100); + a.brush && (a.brush.opacity = c, a.brush.endStroke(), c = a.brush.rgb, a.brush.beginStroke("rgba(" + c.r + "," + c.g + "," + c.b + "," + a.brush.opacity / 100 + ")"), a.brush.moveTo(a.getX(), -1 * a.getY())); + return b.callReturn(); }; Blockly.Blocks.set_opacity = {init:function() { this.setColour(categoryColor); @@ -1513,11 +1618,11 @@ Blockly.Blocks.set_opacity = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.set_opacity = function(b, a) { - var c = a.getNumberValue("VALUE", a); - b.brush || (Entry.setBasicBrush(b), b.brush.stop = !0); - b.brush && (b.brush.opacity = Entry.adjustValueWithMaxMin(c, 0, 100), b.brush.endStroke(), c = b.brush.rgb, b.brush.beginStroke("rgba(" + c.r + "," + c.g + "," + c.b + "," + b.brush.opacity / 100 + ")"), b.brush.moveTo(b.getX(), -1 * b.getY())); - return a.callReturn(); +Entry.block.set_opacity = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.brush || (Entry.setBasicBrush(a), a.brush.stop = !0); + a.brush && (a.brush.opacity = Entry.adjustValueWithMaxMin(c, 0, 100), a.brush.endStroke(), c = a.brush.rgb, a.brush.beginStroke("rgba(" + c.r + "," + c.g + "," + c.b + "," + a.brush.opacity / 100 + ")"), a.brush.moveTo(a.getX(), -1 * a.getY())); + return b.callReturn(); }; Blockly.Blocks.brush_erase_all = {init:function() { this.setColour(categoryColor); @@ -1526,19 +1631,19 @@ Blockly.Blocks.brush_erase_all = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.brush_erase_all = function(b, a) { - var c = b.brush; +Entry.block.brush_erase_all = function(a, b) { + var c = a.brush; if (c) { var d = c._stroke.style, e = c._strokeStyle.width; c.clear().setStrokeStyle(e).beginStroke(d); - c.moveTo(b.getX(), -1 * b.getY()); + c.moveTo(a.getX(), -1 * a.getY()); } - c = b.parent.getStampEntities(); - c.map(function(a) { - a.removeClone(); + a = a.parent.getStampEntities(); + a.map(function(b) { + b.removeClone(); }); - c = null; - return a.callReturn(); + a = null; + return b.callReturn(); }; Blockly.Blocks.brush_stamp = {init:function() { this.setColour(categoryColor); @@ -1547,9 +1652,9 @@ Blockly.Blocks.brush_stamp = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.brush_stamp = function(b, a) { - b.parent.addStampEntity(b); - return a.callReturn(); +Entry.block.brush_stamp = function(a, b) { + a.parent.addStampEntity(a); + return b.callReturn(); }; Blockly.Blocks.change_brush_transparency = {init:function() { this.setColour(categoryColor); @@ -1560,12 +1665,12 @@ Blockly.Blocks.change_brush_transparency = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.change_brush_transparency = function(b, a) { - var c = a.getNumberValue("VALUE", a); - b.brush || (Entry.setBasicBrush(b), b.brush.stop = !0); - c = Entry.adjustValueWithMaxMin(b.brush.opacity - c, 0, 100); - b.brush && (b.brush.opacity = c, b.brush.endStroke(), c = b.brush.rgb, b.brush.beginStroke("rgba(" + c.r + "," + c.g + "," + c.b + "," + b.brush.opacity / 100 + ")"), b.brush.moveTo(b.getX(), -1 * b.getY())); - return a.callReturn(); +Entry.block.change_brush_transparency = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.brush || (Entry.setBasicBrush(a), a.brush.stop = !0); + c = Entry.adjustValueWithMaxMin(a.brush.opacity - c, 0, 100); + a.brush && (a.brush.opacity = c, a.brush.endStroke(), c = a.brush.rgb, a.brush.beginStroke("rgba(" + c.r + "," + c.g + "," + c.b + "," + a.brush.opacity / 100 + ")"), a.brush.moveTo(a.getX(), -1 * a.getY())); + return b.callReturn(); }; Blockly.Blocks.set_brush_tranparency = {init:function() { this.setColour(categoryColor); @@ -1576,11 +1681,11 @@ Blockly.Blocks.set_brush_tranparency = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.set_brush_tranparency = function(b, a) { - var c = a.getNumberValue("VALUE", a); - b.brush || (Entry.setBasicBrush(b), b.brush.stop = !0); - b.brush && (b.brush.opacity = Entry.adjustValueWithMaxMin(c, 0, 100), b.brush.endStroke(), c = b.brush.rgb, b.brush.beginStroke("rgba(" + c.r + "," + c.g + "," + c.b + "," + (1 - b.brush.opacity / 100) + ")"), b.brush.moveTo(b.getX(), -1 * b.getY())); - return a.callReturn(); +Entry.block.set_brush_tranparency = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.brush || (Entry.setBasicBrush(a), a.brush.stop = !0); + a.brush && (a.brush.opacity = Entry.adjustValueWithMaxMin(c, 0, 100), a.brush.endStroke(), c = a.brush.rgb, a.brush.beginStroke("rgba(" + c.r + "," + c.g + "," + c.b + "," + (1 - a.brush.opacity / 100) + ")"), a.brush.moveTo(a.getX(), -1 * a.getY())); + return b.callReturn(); }; var calcArrowColor = "#e8b349", calcBlockColor = "#FFD974", calcFontColor = "#3D3D3D"; Blockly.Blocks.number = {init:function() { @@ -1589,8 +1694,8 @@ Blockly.Blocks.number = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.number = function(b, a) { - return a.getField("NUM", a); +Entry.block.number = function(a, b) { + return b.getField("NUM", b); }; Blockly.Blocks.angle = {init:function() { this.setColour(calcBlockColor); @@ -1598,8 +1703,8 @@ Blockly.Blocks.angle = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.angle = function(b, a) { - return a.getNumberField("ANGLE"); +Entry.block.angle = function(a, b) { + return b.getNumberField("ANGLE"); }; Blockly.Blocks.get_x_coordinate = {init:function() { this.setColour(calcBlockColor); @@ -1607,8 +1712,8 @@ Blockly.Blocks.get_x_coordinate = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.get_x_coordinate = function(b, a) { - return b.getX(); +Entry.block.get_x_coordinate = function(a, b) { + return a.getX(); }; Blockly.Blocks.get_y_coordinate = {init:function() { this.setColour(calcBlockColor); @@ -1616,8 +1721,8 @@ Blockly.Blocks.get_y_coordinate = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.get_y_coordinate = function(b, a) { - return b.getY(); +Entry.block.get_y_coordinate = function(a, b) { + return a.getY(); }; Blockly.Blocks.get_angle = {init:function() { this.setColour(calcBlockColor); @@ -1625,8 +1730,8 @@ Blockly.Blocks.get_angle = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.get_angle = function(b, a) { - return parseFloat(b.getRotation().toFixed(1)); +Entry.block.get_angle = function(a, b) { + return parseFloat(a.getRotation().toFixed(1)); }; Blockly.Blocks.get_rotation_direction = {init:function() { this.setColour(calcBlockColor); @@ -1635,8 +1740,8 @@ Blockly.Blocks.get_rotation_direction = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -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)); +Entry.block.get_rotation_direction = function(a, b) { + return "DIRECTION" == b.getField("OPERATOR", b).toUpperCase() ? parseFloat(a.getDirection().toFixed(1)) : parseFloat(a.getRotation().toFixed(1)); }; Blockly.Blocks.distance_something = {init:function() { this.setColour(calcBlockColor); @@ -1644,13 +1749,13 @@ Blockly.Blocks.distance_something = {init:function() { 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)); +Entry.block.distance_something = function(a, b) { + b = b.getField("VALUE", b); + if ("mouse" == b) { + return b = Entry.stage.mouseCoordinate, Math.sqrt(Math.pow(a.getX() - b.x, 2) + Math.pow(a.getY() - b.y, 2)); } - c = Entry.container.getEntity(c); - return Math.sqrt(Math.pow(b.getX() - c.getX(), 2) + Math.pow(b.getY() - c.getY(), 2)); + b = Entry.container.getEntity(b); + return Math.sqrt(Math.pow(a.getX() - b.getX(), 2) + Math.pow(a.getY() - b.getY(), 2)); }; Blockly.Blocks.coordinate_mouse = {init:function() { this.setColour(calcBlockColor); @@ -1658,8 +1763,8 @@ Blockly.Blocks.coordinate_mouse = {init:function() { 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); +Entry.block.coordinate_mouse = function(a, b) { + return "x" === b.getField("VALUE", b) ? Number(Entry.stage.mouseCoordinate.x) : Number(Entry.stage.mouseCoordinate.y); }; Blockly.Blocks.coordinate_object = {init:function() { this.setColour(calcBlockColor); @@ -1668,24 +1773,24 @@ Blockly.Blocks.coordinate_object = {init:function() { 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)) { +Entry.block.coordinate_object = function(a, b) { + var c = b.getField("VALUE", b); + a = "self" == c ? a : Entry.container.getEntity(c); + switch(b.getField("COORDINATE", b)) { case "x": - return c.getX(); + return a.getX(); case "y": - return c.getY(); + return a.getY(); case "rotation": - return c.getRotation(); + return a.getRotation(); case "direction": - return c.getDirection(); + return a.getDirection(); case "picture_index": - var d = c.parent, d = d.pictures; - return d.indexOf(c.picture) + 1; + return b = a.parent, b = b.pictures, b.indexOf(a.picture) + 1; case "size": - return Number(c.getSize().toFixed(1)); + return Number(a.getSize().toFixed(1)); case "picture_name": - return d = c.parent, d = d.pictures, d[d.indexOf(c.picture)].name; + return b = a.parent, b = b.pictures, b[b.indexOf(a.picture)].name; } }; Blockly.Blocks.calc_basic = {init:function() { @@ -1696,9 +1801,11 @@ Blockly.Blocks.calc_basic = {init:function() { 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; +Entry.block.calc_basic = function(a, b) { + a = b.getField("OPERATOR", b); + var c = b.getNumberValue("LEFTHAND", b); + b = b.getNumberValue("RIGHTHAND", b); + return "PLUS" == a ? c + b : "MINUS" == a ? c - b : "MULTI" == a ? c * b : c / b; }; Blockly.Blocks.calc_plus = {init:function() { this.setColour(calcBlockColor); @@ -1708,9 +1815,10 @@ Blockly.Blocks.calc_plus = {init:function() { 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; +Entry.block.calc_plus = function(a, b) { + a = b.getNumberValue("LEFTHAND", b); + b = b.getNumberValue("RIGHTHAND", b); + return a + b; }; Blockly.Blocks.calc_minus = {init:function() { this.setColour(calcBlockColor); @@ -1720,9 +1828,10 @@ Blockly.Blocks.calc_minus = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.calc_minus = function(b, a) { - var c = a.getNumberValue("LEFTHAND", a), d = a.getNumberValue("RIGHTHAND", a); - return c - d; +Entry.block.calc_minus = function(a, b) { + a = b.getNumberValue("LEFTHAND", b); + b = b.getNumberValue("RIGHTHAND", b); + return a - b; }; Blockly.Blocks.calc_times = {init:function() { this.setColour(calcBlockColor); @@ -1732,9 +1841,10 @@ Blockly.Blocks.calc_times = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.calc_times = function(b, a) { - var c = a.getNumberValue("LEFTHAND", a), d = a.getNumberValue("RIGHTHAND", a); - return c * d; +Entry.block.calc_times = function(a, b) { + a = b.getNumberValue("LEFTHAND", b); + b = b.getNumberValue("RIGHTHAND", b); + return a * b; }; Blockly.Blocks.calc_divide = {init:function() { this.setColour(calcBlockColor); @@ -1744,9 +1854,10 @@ Blockly.Blocks.calc_divide = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.calc_divide = function(b, a) { - var c = a.getNumberValue("LEFTHAND", a), d = a.getNumberValue("RIGHTHAND", a); - return c / d; +Entry.block.calc_divide = function(a, b) { + a = b.getNumberValue("LEFTHAND", b); + b = b.getNumberValue("RIGHTHAND", b); + return a / b; }; Blockly.Blocks.calc_mod = {init:function() { this.setColour(calcBlockColor); @@ -1758,9 +1869,10 @@ Blockly.Blocks.calc_mod = {init:function() { this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_mod_3, calcFontColor); this.setInputsInline(!0); }}; -Entry.block.calc_mod = function(b, a) { - var c = a.getNumberValue("LEFTHAND", a), d = a.getNumberValue("RIGHTHAND", a); - return c % d; +Entry.block.calc_mod = function(a, b) { + a = b.getNumberValue("LEFTHAND", b); + b = b.getNumberValue("RIGHTHAND", b); + return a % b; }; Blockly.Blocks.calc_share = {init:function() { this.setColour(calcBlockColor); @@ -1772,9 +1884,10 @@ Blockly.Blocks.calc_share = {init:function() { this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_share_3, calcFontColor); this.setInputsInline(!0); }}; -Entry.block.calc_share = function(b, a) { - var c = a.getNumberValue("LEFTHAND", a), d = a.getNumberValue("RIGHTHAND", a); - return Math.floor(c / d); +Entry.block.calc_share = function(a, b) { + a = b.getNumberValue("LEFTHAND", b); + b = b.getNumberValue("RIGHTHAND", b); + return Math.floor(a / b); }; Blockly.Blocks.calc_operation = {init:function() { this.setColour(calcBlockColor); @@ -1787,45 +1900,45 @@ Blockly.Blocks.calc_operation = {init:function() { this.appendDummyInput().appendField(" "); this.setInputsInline(!0); }}; -Entry.block.calc_operation = function(b, a) { - var c = a.getNumberValue("LEFTHAND", a), d = a.getField("VALUE", a); - if (-1 < ["asin_radian", "acos_radian"].indexOf(d) && (1 < c || -1 > c)) { +Entry.block.calc_operation = function(a, b) { + a = b.getNumberValue("LEFTHAND", b); + b = b.getField("VALUE", b); + if (-1 < ["asin_radian", "acos_radian"].indexOf(b) && (1 < a || -1 > a)) { 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) { + b.indexOf("_") && (b = b.split("_")[0]); + -1 < ["sin", "cos", "tan"].indexOf(b) && (a = Entry.toRadian(a)); + switch(b) { case "square": - e = c * c; + b = a * a; break; case "factorial": - e = Entry.factorial(c); + b = Entry.factorial(a); break; case "root": - e = Math.sqrt(c); + b = Math.sqrt(a); break; case "log": - e = Math.log(c) / Math.LN10; + b = Math.log(a) / Math.LN10; break; case "ln": - e = Math.log(c); + b = Math.log(a); break; case "asin": ; case "acos": ; case "atan": - e = Entry.toDegrees(Math[d](c)); + b = Entry.toDegrees(Math[b](a)); break; case "unnatural": - e = c - Math.floor(c); - 0 > c && (e = 1 - e); + b = a - Math.floor(a); + 0 > a && (b = 1 - b); break; default: - e = Math[d](c); + b = Math[b](a); } - return Math.round(1E3 * e) / 1E3; + return Math.round(1E3 * b) / 1E3; }; Blockly.Blocks.calc_rand = {init:function() { this.setColour(calcBlockColor); @@ -1837,9 +1950,12 @@ Blockly.Blocks.calc_rand = {init:function() { this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_rand_3, calcFontColor); this.setInputsInline(!0); }}; -Entry.block.calc_rand = function(b, a) { - var c = a.getStringValue("LEFTHAND", a), d = a.getStringValue("RIGHTHAND", a), e = Math.min(c, d), f = Math.max(c, d), c = Entry.isFloat(c); - return Entry.isFloat(d) || c ? (Math.random() * (f - e) + e).toFixed(2) : Math.floor(Math.random() * (f - e + 1) + e); +Entry.block.calc_rand = function(a, b) { + a = b.getStringValue("LEFTHAND", b); + b = b.getStringValue("RIGHTHAND", b); + var c = Math.min(a, b), d = Math.max(a, b); + a = Entry.isFloat(a); + return Entry.isFloat(b) || a ? (Math.random() * (d - c) + c).toFixed(2) : Math.floor(Math.random() * (d - c + 1) + c); }; Blockly.Blocks.get_date = {init:function() { this.setColour(calcBlockColor); @@ -1848,9 +1964,10 @@ Blockly.Blocks.get_date = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.get_date = function(b, a) { - var c = a.getField("VALUE", a), d = new Date; - return "YEAR" == c ? d.getFullYear() : "MONTH" == c ? d.getMonth() + 1 : "DAY" == c ? d.getDate() : "HOUR" == c ? d.getHours() : "MINUTE" == c ? d.getMinutes() : d.getSeconds(); +Entry.block.get_date = function(a, b) { + a = b.getField("VALUE", b); + b = new Date; + return "YEAR" == a ? b.getFullYear() : "MONTH" == a ? b.getMonth() + 1 : "DAY" == a ? b.getDate() : "HOUR" == a ? b.getHours() : "MINUTE" == a ? b.getMinutes() : b.getSeconds(); }; Blockly.Blocks.get_sound_duration = {init:function() { this.setColour(calcBlockColor); @@ -1860,10 +1977,12 @@ Blockly.Blocks.get_sound_duration = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.get_sound_duration = function(b, a) { - for (var c = a.getField("VALUE", a), d = b.parent.sounds, e = 0;e < d.length;e++) { - if (d[e].id == c) { - return d[e].duration; +Entry.block.get_sound_duration = function(a, b) { + b = b.getField("VALUE", b); + a = a.parent.sounds; + for (var c = 0;c < a.length;c++) { + if (a[c].id == b) { + return a[c].duration; } } }; @@ -1875,12 +1994,12 @@ Blockly.Blocks.reset_project_timer = {init:function() { this.setNextStatement(!0); }, whenAdd:function() { Entry.engine && Entry.engine.showProjectTimer(); -}, whenRemove:function(b) { - Entry.engine && Entry.engine.hideProjectTimer(b); +}, whenRemove:function(a) { + Entry.engine && Entry.engine.hideProjectTimer(a); }}; -Entry.block.reset_project_timer = function(b, a) { +Entry.block.reset_project_timer = function(a, b) { Entry.engine.updateProjectTimer(0); - return a.callReturn(); + return b.callReturn(); }; Blockly.Blocks.set_visible_project_timer = {init:function() { this.setColour(calcBlockColor); @@ -1892,13 +2011,14 @@ Blockly.Blocks.set_visible_project_timer = {init:function() { this.setNextStatement(!0); }, whenAdd:function() { Entry.engine && Entry.engine.showProjectTimer(); -}, whenRemove:function(b) { - Entry.engine && Entry.engine.hideProjectTimer(b); +}, whenRemove:function(a) { + Entry.engine && Entry.engine.hideProjectTimer(a); }}; -Entry.block.set_visible_project_timer = function(b, a) { - var c = a.getField("ACTION", a), d = Entry.engine.projectTimer; - "SHOW" == c ? d.setVisible(!0) : d.setVisible(!1); - return a.callReturn(); +Entry.block.set_visible_project_timer = function(a, b) { + a = b.getField("ACTION", b); + var c = Entry.engine.projectTimer; + "SHOW" == a ? c.setVisible(!0) : c.setVisible(!1); + return b.callReturn(); }; Blockly.Blocks.timer_variable = {init:function() { this.setColour(calcBlockColor); @@ -1906,7 +2026,7 @@ Blockly.Blocks.timer_variable = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.timer_variable = function(b, a) { +Entry.block.timer_variable = function(a, b) { return Entry.container.inputValue.getValue(); }; Blockly.Blocks.get_project_timer_value = {init:function() { @@ -1916,10 +2036,10 @@ Blockly.Blocks.get_project_timer_value = {init:function() { this.setInputsInline(!0); }, whenAdd:function() { Entry.engine && Entry.engine.showProjectTimer(); -}, whenRemove:function(b) { - Entry.engine && Entry.engine.hideProjectTimer(b); +}, whenRemove:function(a) { + Entry.engine && Entry.engine.hideProjectTimer(a); }}; -Entry.block.get_project_timer_value = function(b, a) { +Entry.block.get_project_timer_value = function(a, b) { return Entry.engine.projectTimer.getValue(); }; Blockly.Blocks.char_at = {init:function() { @@ -1932,12 +2052,13 @@ Blockly.Blocks.char_at = {init:function() { this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_char_at_3, calcFontColor); this.setInputsInline(!0); }}; -Entry.block.char_at = function(b, a) { - var c = a.getStringValue("LEFTHAND", a), d = a.getNumberValue("RIGHTHAND", a) - 1; - if (0 > d || d > c.length - 1) { +Entry.block.char_at = function(a, b) { + a = b.getStringValue("LEFTHAND", b); + b = b.getNumberValue("RIGHTHAND", b) - 1; + if (0 > b || b > a.length - 1) { throw Error(); } - return c[d]; + return a[b]; }; Blockly.Blocks.length_of_string = {init:function() { this.setColour(calcBlockColor); @@ -1947,8 +2068,8 @@ Blockly.Blocks.length_of_string = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.length_of_string = function(b, a) { - return a.getStringValue("STRING", a).length; +Entry.block.length_of_string = function(a, b) { + return b.getStringValue("STRING", b).length; }; Blockly.Blocks.substring = {init:function() { this.setColour(calcBlockColor); @@ -1962,12 +2083,15 @@ Blockly.Blocks.substring = {init:function() { this.setOutput(!0, "String"); this.setInputsInline(!0); }}; -Entry.block.substring = function(b, a) { - var c = a.getStringValue("STRING", a), d = a.getNumberValue("START", a) - 1, e = a.getNumberValue("END", a) - 1, f = c.length - 1; - if (0 > d || 0 > e || d > f || e > f) { +Entry.block.substring = function(a, b) { + a = b.getStringValue("STRING", b); + var c = b.getNumberValue("START", b) - 1; + b = b.getNumberValue("END", b) - 1; + var d = a.length - 1; + if (0 > c || 0 > b || c > d || b > d) { throw Error(); } - return c.substring(Math.min(d, e), Math.max(d, e) + 1); + return a.substring(Math.min(c, b), Math.max(c, b) + 1); }; Blockly.Blocks.replace_string = {init:function() { this.setColour(calcBlockColor); @@ -1981,8 +2105,8 @@ Blockly.Blocks.replace_string = {init:function() { this.setOutput(!0, "String"); this.setInputsInline(!0); }}; -Entry.block.replace_string = function(b, a) { - return a.getStringValue("STRING", a).replace(new RegExp(a.getStringValue("OLD_WORD", a), "gm"), a.getStringValue("NEW_WORD", a)); +Entry.block.replace_string = function(a, b) { + return b.getStringValue("STRING", b).replace(new RegExp(b.getStringValue("OLD_WORD", b), "gm"), b.getStringValue("NEW_WORD", b)); }; Blockly.Blocks.change_string_case = {init:function() { this.setColour(calcBlockColor); @@ -1994,8 +2118,8 @@ Blockly.Blocks.change_string_case = {init:function() { this.setOutput(!0, "String"); this.setInputsInline(!0); }}; -Entry.block.change_string_case = function(b, a) { - return a.getStringValue("STRING", a)[a.getField("CASE", a)](); +Entry.block.change_string_case = function(a, b) { + return b.getStringValue("STRING", b)[b.getField("CASE", b)](); }; Blockly.Blocks.index_of_string = {init:function() { this.setColour(calcBlockColor); @@ -2007,9 +2131,11 @@ Blockly.Blocks.index_of_string = {init:function() { this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_index_of_string_3, calcFontColor); this.setInputsInline(!0); }}; -Entry.block.index_of_string = function(b, a) { - var c = a.getStringValue("LEFTHAND", a), d = a.getStringValue("RIGHTHAND", a), c = c.indexOf(d); - return -1 < c ? c + 1 : 0; +Entry.block.index_of_string = function(a, b) { + a = b.getStringValue("LEFTHAND", b); + b = b.getStringValue("RIGHTHAND", b); + b = a.indexOf(b); + return -1 < b ? b + 1 : 0; }; Blockly.Blocks.combine_something = {init:function() { this.setColour(calcBlockColor); @@ -2021,9 +2147,10 @@ Blockly.Blocks.combine_something = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "String"); }}; -Entry.block.combine_something = function(b, a) { - var c = a.getStringValue("VALUE1", a), d = a.getStringValue("VALUE2", a); - return c + d; +Entry.block.combine_something = function(a, b) { + a = b.getStringValue("VALUE1", b); + b = b.getStringValue("VALUE2", b); + return a + b; }; Blockly.Blocks.get_sound_volume = {init:function() { this.setColour(calcBlockColor); @@ -2031,7 +2158,7 @@ Blockly.Blocks.get_sound_volume = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.get_sound_volume = function(b, a) { +Entry.block.get_sound_volume = function(a, b) { return 100 * createjs.Sound.getVolume(); }; Blockly.Blocks.quotient_and_mod = {init:function() { @@ -2043,12 +2170,13 @@ Blockly.Blocks.quotient_and_mod = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.quotient_and_mod = function(b, a) { - var c = a.getNumberValue("LEFTHAND", a), d = a.getNumberValue("RIGHTHAND", a); - if (isNaN(c) || isNaN(d)) { +Entry.block.quotient_and_mod = function(a, b) { + a = b.getNumberValue("LEFTHAND", b); + var c = b.getNumberValue("RIGHTHAND", b); + if (isNaN(a) || isNaN(c)) { throw Error(); } - return "QUOTIENT" == a.getField("OPERATOR", a) ? Math.floor(c / d) : c % d; + return "QUOTIENT" == b.getField("OPERATOR", b) ? Math.floor(a / c) : a % c; }; Blockly.Blocks.choose_project_timer_action = {init:function() { this.setColour(calcBlockColor); @@ -2059,13 +2187,14 @@ Blockly.Blocks.choose_project_timer_action = {init:function() { this.setNextStatement(!0); }, whenAdd:function() { Entry.engine && Entry.engine.showProjectTimer(); -}, whenRemove:function(b) { - Entry.engine && Entry.engine.hideProjectTimer(b); +}, whenRemove:function(a) { + Entry.engine && Entry.engine.hideProjectTimer(a); }}; -Entry.block.choose_project_timer_action = function(b, a) { - var c = a.getField("ACTION"), d = Entry.engine, e = d.projectTimer; - "START" == c ? e.isInit ? e.isInit && e.isPaused && (e.pauseStart && (e.pausedTime += (new Date).getTime() - e.pauseStart), delete e.pauseStart, e.isPaused = !1) : d.startProjectTimer() : "STOP" == c ? e.isInit && !e.isPaused && (e.isPaused = !0, e.pauseStart = (new Date).getTime()) : "RESET" == c && e.isInit && (e.setValue(0), e.start = (new Date).getTime(), e.pausedTime = 0, delete e.pauseStart); - return a.callReturn(); +Entry.block.choose_project_timer_action = function(a, b) { + a = b.getField("ACTION"); + var c = Entry.engine, d = c.projectTimer; + "START" == a ? d.isInit ? d.isInit && d.isPaused && (d.pauseStart && (d.pausedTime += (new Date).getTime() - d.pauseStart), delete d.pauseStart, d.isPaused = !1) : c.startProjectTimer() : "STOP" == a ? d.isInit && !d.isPaused && (d.isPaused = !0, d.pauseStart = (new Date).getTime()) : "RESET" == a && d.isInit && (d.setValue(0), d.start = (new Date).getTime(), d.pausedTime = 0, delete d.pauseStart); + return b.callReturn(); }; Blockly.Blocks.wait_second = {init:function() { this.setColour("#498deb"); @@ -2076,23 +2205,23 @@ Blockly.Blocks.wait_second = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.wait_second = function(b, a) { - if (a.isStart) { - if (1 == a.timeFlag) { - return a; +Entry.block.wait_second = function(a, b) { + if (b.isStart) { + if (1 == b.timeFlag) { + return b; } - delete a.timeFlag; - delete a.isStart; + delete b.timeFlag; + delete b.isStart; Entry.engine.isContinue = !1; - return a.callReturn(); + return b.callReturn(); } - a.isStart = !0; - a.timeFlag = 1; - var c = a.getNumberValue("SECOND", a), c = 60 / (Entry.FPS || 60) * c * 1E3; + b.isStart = !0; + b.timeFlag = 1; + a = b.getNumberValue("SECOND", b); setTimeout(function() { - a.timeFlag = 0; - }, c); - return a; + b.timeFlag = 0; + }, 60 / (Entry.FPS || 60) * a * 1E3); + return b; }; Blockly.Blocks.repeat_basic = {init:function() { this.setColour("#498deb"); @@ -2104,21 +2233,20 @@ Blockly.Blocks.repeat_basic = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.repeat_basic = function(b, a) { - var c; - if (!a.isLooped) { - a.isLooped = !0; - c = a.getNumberValue("VALUE", a); - if (0 > c) { +Entry.block.repeat_basic = function(a, b) { + if (!b.isLooped) { + b.isLooped = !0; + a = b.getNumberValue("VALUE", b); + if (0 > a) { throw Error(Lang.Blocks.FLOW_repeat_basic_errorMsg); } - a.iterCount = Math.floor(c); + b.iterCount = Math.floor(a); } - if (0 == a.iterCount || 0 > a.iterCount) { - return delete a.isLooped, delete a.iterCount, a.callReturn(); + if (0 == b.iterCount || 0 > b.iterCount) { + return delete b.isLooped, delete b.iterCount, b.callReturn(); } - a.iterCount--; - return a.getStatement("DO", a); + b.iterCount--; + return b.getStatement("DO", b); }; Blockly.Blocks.repeat_inf = {init:function() { this.setColour("#498deb"); @@ -2128,9 +2256,9 @@ Blockly.Blocks.repeat_inf = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.repeat_inf = function(b, a) { - a.isLooped = !0; - return a.getStatement("DO"); +Entry.block.repeat_inf = function(a, b) { + b.isLooped = !0; + return b.getStatement("DO"); }; Blockly.Blocks.stop_repeat = {init:function() { this.setColour("#498deb"); @@ -2139,7 +2267,7 @@ Blockly.Blocks.stop_repeat = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.stop_repeat = function(b, a) { +Entry.block.stop_repeat = function(a, b) { return this.executor.break(); }; Blockly.Blocks.wait_until_true = {init:function() { @@ -2151,8 +2279,8 @@ Blockly.Blocks.wait_until_true = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.wait_until_true = function(b, a) { - return a.getBooleanValue("BOOL", a) ? a.callReturn() : a; +Entry.block.wait_until_true = function(a, b) { + return b.getBooleanValue("BOOL", b) ? b.callReturn() : b; }; Blockly.Blocks._if = {init:function() { this.setColour("#498deb"); @@ -2164,8 +2292,8 @@ Blockly.Blocks._if = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block._if = function(b, a) { - return a.isLooped ? (delete a.isLooped, a.callReturn()) : a.getBooleanValue("BOOL", a) ? (a.isLooped = !0, a.getStatement("STACK", a)) : a.callReturn(); +Entry.block._if = function(a, b) { + return b.isLooped ? (delete b.isLooped, b.callReturn()) : b.getBooleanValue("BOOL", b) ? (b.isLooped = !0, b.getStatement("STACK", b)) : b.callReturn(); }; Blockly.Blocks.if_else = {init:function() { this.setColour("#498deb"); @@ -2179,13 +2307,13 @@ Blockly.Blocks.if_else = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.if_else = function(b, a) { - if (a.isLooped) { - return delete a.isLooped, a.callReturn(); +Entry.block.if_else = function(a, b) { + if (b.isLooped) { + return delete b.isLooped, b.callReturn(); } - var c = a.getBooleanValue("BOOL", a); - a.isLooped = !0; - return c ? a.getStatement("STACK_IF", a) : a.getStatement("STACK_ELSE", a); + a = b.getBooleanValue("BOOL", b); + b.isLooped = !0; + return a ? b.getStatement("STACK_IF", b) : b.getStatement("STACK_ELSE", b); }; Blockly.Blocks.create_clone = {init:function() { this.setColour("#498deb"); @@ -2196,10 +2324,11 @@ Blockly.Blocks.create_clone = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.create_clone = function(b, a) { - var c = a.getField("VALUE", a), d = a.callReturn(); - "self" == c ? b.parent.addCloneEntity(b.parent, b, null) : Entry.container.getObject(c).addCloneEntity(b.parent, null, null); - return d; +Entry.block.create_clone = function(a, b) { + var c = b.getField("VALUE", b); + b = b.callReturn(); + "self" == c ? a.parent.addCloneEntity(a.parent, a, null) : Entry.container.getObject(c).addCloneEntity(a.parent, null, null); + return b; }; Blockly.Blocks.delete_clone = {init:function() { this.setColour("#498deb"); @@ -2207,11 +2336,11 @@ Blockly.Blocks.delete_clone = {init:function() { this.setInputsInline(!0); this.setPreviousStatement(!0); }}; -Entry.block.delete_clone = function(b, a) { - if (!b.isClone) { - return a.callReturn(); +Entry.block.delete_clone = function(a, b) { + if (!a.isClone) { + return b.callReturn(); } - b.removeClone(); + a.removeClone(); }; Blockly.Blocks.when_clone_start = {init:function() { this.setColour("#498deb"); @@ -2219,8 +2348,8 @@ Blockly.Blocks.when_clone_start = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); }}; -Entry.block.when_clone_start = function(b, a) { - return a.callReturn(); +Entry.block.when_clone_start = function(a, b) { + return b.callReturn(); }; Blockly.Blocks.stop_run = {init:function() { this.setColour("#498deb"); @@ -2229,7 +2358,7 @@ Blockly.Blocks.stop_run = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.stop_run = function(b, a) { +Entry.block.stop_run = function(a, b) { return Entry.engine.toggleStop(); }; Blockly.Blocks.repeat_while_true = {init:function() { @@ -2241,10 +2370,10 @@ Blockly.Blocks.repeat_while_true = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.repeat_while_true = function(b, a) { - var c = a.getBooleanValue("BOOL", a); - "until" == a.getField("OPTION", a) && (c = !c); - return (a.isLooped = c) ? a.getStatement("DO", a) : a.callReturn(); +Entry.block.repeat_while_true = function(a, b) { + a = b.getBooleanValue("BOOL", b); + "until" == b.getField("OPTION", b) && (a = !a); + return (b.isLooped = a) ? b.getStatement("DO", b) : b.callReturn(); }; Blockly.Blocks.stop_object = {init:function() { this.setColour("#498deb"); @@ -2255,17 +2384,18 @@ Blockly.Blocks.stop_object = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.stop_object = function(b, a) { - var c = a.getField("TARGET", a), d = Entry.container; - switch(c) { +Entry.block.stop_object = function(a, b) { + b = b.getField("TARGET", b); + var c = Entry.container; + switch(b) { case "all": - return d.clearRunningState(), this.die(); + return c.clearRunningState(), this.die(); case "thisOnly": - return b.parent.script.clearExecutorsByEntity(b), this.die(); + return a.parent.script.clearExecutorsByEntity(a), this.die(); case "thisThread": return this.die(); case "otherThread": - b.parent.script.clearExecutors(), b.parent.script.addExecutor(this.executor); + a.parent.script.clearExecutors(), a.parent.script.addExecutor(this.executor); } }; Blockly.Blocks.restart_project = {init:function() { @@ -2274,7 +2404,7 @@ Blockly.Blocks.restart_project = {init:function() { this.setInputsInline(!0); this.setPreviousStatement(!0); }}; -Entry.block.restart_project = function(b, a) { +Entry.block.restart_project = function(a, b) { Entry.engine.toggleStop(); Entry.engine.toggleRun(); }; @@ -2285,13 +2415,13 @@ Blockly.Blocks.remove_all_clones = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.remove_all_clones = function(b, a) { - var c = b.parent.getClonedEntities(); - c.map(function(a) { - a.removeClone(); +Entry.block.remove_all_clones = function(a, b) { + a = a.parent.getClonedEntities(); + a.map(function(b) { + b.removeClone(); }); - c = null; - return a.callReturn(); + a = null; + return b.callReturn(); }; Entry.block.functionAddButton = {skeleton:"basic_button", color:"#eee", isNotFor:["functionInit"], template:"%1", params:[{type:"Text", text:"\ud568\uc218 \ucd94\uac00", color:"#333", align:"center"}], events:{mousedown:[function() { Entry.variableContainer.createFunction(); @@ -2325,18 +2455,18 @@ Blockly.Blocks.function_param_string = {init:function() { this.setColour("#FFD974"); this.setOutput(!0, ["String", "Number"]); this.setInputsInline(!0); -}, domToMutation:function(b) { - b.getElementsByTagName("field"); - this.hashId = b.getAttribute("hashid"); - (b = Entry.Func.targetFunc.stringHash[this.hashId]) || (b = ""); - this.appendDummyInput().appendField(new Blockly.FieldTextInput(Lang.Blocks.FUNCTION_character_variable + b), ""); +}, domToMutation:function(a) { + a.getElementsByTagName("field"); + this.hashId = a.getAttribute("hashid"); + (a = Entry.Func.targetFunc.stringHash[this.hashId]) || (a = ""); + this.appendDummyInput().appendField(new Blockly.FieldTextInput(Lang.Blocks.FUNCTION_character_variable + a), ""); }, mutationToDom:function() { - var b = document.createElement("mutation"); - b.setAttribute("hashid", this.hashId); - return b; + var a = document.createElement("mutation"); + a.setAttribute("hashid", this.hashId); + return a; }}; -Entry.block.function_param_string = function(b, a, c) { - return a.register[a.hashId].run(); +Entry.block.function_param_string = function(a, b, c) { + return b.register[b.hashId].run(); }; Entry.block.function_param_string = {skeleton:"basic_string_field", color:"#ffd974", template:"\ubb38\uc790/\uc22b\uc790\uac12", func:function() { return this.executor.register.params[this.executor.register.paramMap[this.block.type]]; @@ -2346,18 +2476,18 @@ Blockly.Blocks.function_param_boolean = {init:function() { this.setColour("#AEB8FF"); this.setOutput(!0, "Boolean"); this.setInputsInline(!0); -}, domToMutation:function(b) { - b.getElementsByTagName("field"); - this.hashId = b.getAttribute("hashid"); - (b = Entry.Func.targetFunc.booleanHash[this.hashId]) || (b = ""); - this.appendDummyInput().appendField(new Blockly.FieldTextInput(Lang.Blocks.FUNCTION_logical_variable + b), ""); +}, domToMutation:function(a) { + a.getElementsByTagName("field"); + this.hashId = a.getAttribute("hashid"); + (a = Entry.Func.targetFunc.booleanHash[this.hashId]) || (a = ""); + this.appendDummyInput().appendField(new Blockly.FieldTextInput(Lang.Blocks.FUNCTION_logical_variable + a), ""); }, mutationToDom:function() { - var b = document.createElement("mutation"); - b.setAttribute("hashid", this.hashId); - return b; + var a = document.createElement("mutation"); + a.setAttribute("hashid", this.hashId); + return a; }}; -Entry.block.function_param_boolean = function(b, a, c) { - return a.register[a.hashId].run(); +Entry.block.function_param_boolean = function(a, b, c) { + return b.register[b.hashId].run(); }; Entry.block.function_param_boolean = {skeleton:"basic_boolean_field", color:"#aeb8ff", template:"\ud310\ub2e8\uac12", func:function() { return this.executor.register.params[this.executor.register.paramMap[this.block.type]]; @@ -2370,8 +2500,8 @@ Blockly.Blocks.function_create = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); }}; -Entry.block.function_create = function(b, a) { - return a.callReturn(); +Entry.block.function_create = function(a, b) { + return b.callReturn(); }; Entry.block.function_create = {skeleton:"basic", color:"#cc7337", event:"funcDef", template:"\ud568\uc218 \uc815\uc758\ud558\uae30 %1 %2", params:[{type:"Block", accept:"paramMagnet", value:{type:"function_field_label"}}, {type:"Indicator", img:"/lib/entryjs/images/block_icon/function_03.png", size:12}], func:function() { }}; @@ -2380,12 +2510,12 @@ Blockly.Blocks.function_general = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); this.setPreviousStatement(!0); -}, domToMutation:function(b) { - var a = b.getElementsByTagName("field"); +}, domToMutation:function(a) { + var b = a.getElementsByTagName("field"); this.appendDummyInput().appendField(""); - a.length || this.appendDummyInput().appendField(Lang.Blocks.FUNCTION_function); - for (var c = 0;c < a.length;c++) { - var d = a[c], e = d.getAttribute("hashid"); + b.length || this.appendDummyInput().appendField(Lang.Blocks.FUNCTION_function); + for (var c = 0;c < b.length;c++) { + var d = b[c], e = d.getAttribute("hashid"); switch(d.getAttribute("type").toLowerCase()) { case "label": this.appendDummyInput().appendField(d.getAttribute("content")); @@ -2397,11 +2527,11 @@ Blockly.Blocks.function_general = {init:function() { this.appendValueInput(e).setCheck(["Boolean"]); } } - this.hashId = b.getAttribute("hashid"); + this.hashId = a.getAttribute("hashid"); this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath + "block_icon/function_03.png", "*")); }, mutationToDom:function() { - for (var b = document.createElement("mutation"), a = 1;a < this.inputList.length;a++) { - var c = this.inputList[a]; + for (var a = document.createElement("mutation"), b = 1;b < this.inputList.length;b++) { + var c = this.inputList[b]; if (c.fieldRow[0] && c.fieldRow[0] instanceof Blockly.FieldLabel) { var c = c.fieldRow[0], d = document.createElement("field"); d.setAttribute("type", "label"); @@ -2409,34 +2539,34 @@ Blockly.Blocks.function_general = {init:function() { } else { c.connection && "String" == c.connection.check_[0] ? (d = document.createElement("field"), d.setAttribute("type", "string"), d.setAttribute("hashid", c.name)) : c.connection && "Boolean" == c.connection.check_[0] && (d = document.createElement("field"), d.setAttribute("type", "boolean"), d.setAttribute("hashid", c.name)); } - b.appendChild(d); + a.appendChild(d); } - b.setAttribute("hashid", this.hashId); - return b; + a.setAttribute("hashid", this.hashId); + return a; }}; -Entry.block.function_general = function(b, a) { - if (!a.thread) { - var c = Entry.variableContainer.getFunction(a.hashId); - a.thread = new Entry.Script(b); - a.thread.register = a.values; +Entry.block.function_general = function(a, b) { + if (!b.thread) { + var c = Entry.variableContainer.getFunction(b.hashId); + b.thread = new Entry.Script(a); + b.thread.register = b.values; for (var d = 0;d < c.content.childNodes.length;d++) { - "function_create" == c.content.childNodes[d].getAttribute("type") && a.thread.init(c.content.childNodes[d]); + "function_create" == c.content.childNodes[d].getAttribute("type") && b.thread.init(c.content.childNodes[d]); } } - if (c = Entry.Engine.computeThread(b, a.thread)) { - return a.thread = c, a; + if (a = Entry.Engine.computeThread(a, b.thread)) { + return b.thread = a, b; } - delete a.thread; - return a.callReturn(); + delete b.thread; + return b.callReturn(); }; -Entry.block.function_general = {skeleton:"basic", color:"#cc7337", template:"\ud568\uc218", params:[], func:function(b) { +Entry.block.function_general = {skeleton:"basic", color:"#cc7337", template:"\ud568\uc218", params:[], func:function(a) { if (!this.initiated) { this.initiated = !0; - var a = Entry.variableContainer.getFunction(this.block.type.substr(5, 9)); - this.funcCode = a.content; - this.funcExecutor = this.funcCode.raiseEvent("funcDef", b)[0]; + var b = Entry.variableContainer.getFunction(this.block.type.substr(5, 9)); + this.funcCode = b.content; + this.funcExecutor = this.funcCode.raiseEvent("funcDef", a)[0]; this.funcExecutor.register.params = this.getParams(); - this.funcExecutor.register.paramMap = a.paramMap; + this.funcExecutor.register.paramMap = b.paramMap; } this.funcExecutor.execute(); if (!this.funcExecutor.isEnd()) { @@ -2444,54 +2574,56 @@ Entry.block.function_general = {skeleton:"basic", color:"#cc7337", template:"\ud } }}; Entry.Hamster = {PORT_MAP:{leftWheel:0, rightWheel:0, buzzer:0, outputA:0, outputB:0, leftLed:0, rightLed:0, note:0, lineTracerMode:0, lineTracerModeId:0, lineTracerSpeed:5, ioModeA:0, ioModeB:0}, setZero:function() { - var b = Entry.Hamster.PORT_MAP, a = Entry.hw.sendQueue, c; - for (c in b) { - a[c] = b[c]; + var a = Entry.Hamster.PORT_MAP, b = Entry.hw.sendQueue, c; + for (c in a) { + b[c] = a[c]; } Entry.hw.update(); - b = Entry.Hamster; - b.lineTracerModeId = 0; - b.lineTracerStateId = -1; - b.tempo = 60; - b.removeAllTimeouts(); -}, lineTracerModeId:0, lineTracerStateId:-1, tempo:60, timeouts:[], removeTimeout:function(b) { - clearTimeout(b); - var a = this.timeouts; - b = a.indexOf(b); - 0 <= b && a.splice(b, 1); + a = Entry.Hamster; + a.lineTracerModeId = 0; + a.lineTracerStateId = -1; + a.tempo = 60; + a.removeAllTimeouts(); +}, lineTracerModeId:0, lineTracerStateId:-1, tempo:60, timeouts:[], removeTimeout:function(a) { + clearTimeout(a); + var b = this.timeouts; + a = b.indexOf(a); + 0 <= a && b.splice(a, 1); }, removeAllTimeouts:function() { - var b = this.timeouts, a; - for (a in b) { - clearTimeout(b[a]); + var a = this.timeouts, b; + for (b in a) { + clearTimeout(a[b]); } this.timeouts = []; -}, setLineTracerMode:function(b, a) { +}, setLineTracerMode:function(a, b) { this.lineTracerModeId = this.lineTracerModeId + 1 & 255; - b.lineTracerMode = a; - b.lineTracerModeId = this.lineTracerModeId; -}, name:"hamster", monitorTemplate:{imgPath:"hw/hamster.png", width:256, height:256, listPorts:{temperature:{name:Lang.Blocks.HAMSTER_sensor_temperature, type:"input", pos:{x:0, y:0}}, accelerationX:{name:Lang.Blocks.HAMSTER_sensor_accelerationX, type:"input", pos:{x:0, y:0}}, accelerationY:{name:Lang.Blocks.HAMSTER_sensor_accelerationY, type:"input", pos:{x:0, y:0}}, accelerationZ:{name:Lang.Blocks.HAMSTER_sensor_accelerationZ, type:"input", pos:{x:0, y:0}}, buzzer:{name:Lang.Hw.buzzer, type:"output", -pos:{x:0, y:0}}, note:{name:Lang.Hw.buzzer + "2", type:"output", pos:{x:0, y:0}}, outputA:{name:Lang.Hw.output + "A", type:"output", pos:{x:0, y:0}}, outputB:{name:Lang.Hw.output + "B", type:"output", pos:{x:0, y:0}}}, ports:{leftProximity:{name:Lang.Blocks.HAMSTER_sensor_leftProximity, type:"input", pos:{x:122, y:156}}, rightProximity:{name:Lang.Blocks.HAMSTER_sensor_rightProximity, type:"input", pos:{x:10, y:108}}, leftFloor:{name:Lang.Blocks.HAMSTER_sensor_leftFloor, type:"input", pos:{x:100, -y:234}}, rightFloor:{name:Lang.Blocks.HAMSTER_sensor_rightFloor, type:"input", pos:{x:13, y:180}}, light:{name:Lang.Blocks.HAMSTER_sensor_light, type:"input", pos:{x:56, y:189}}, leftWheel:{name:Lang.Hw.leftWheel, type:"output", pos:{x:209, y:115}}, rightWheel:{name:Lang.Hw.rightWheel, type:"output", pos:{x:98, y:30}}, leftLed:{name:Lang.Hw.left + " " + Lang.Hw.led, type:"output", pos:{x:87, y:210}}, rightLed:{name:Lang.Hw.right + " " + Lang.Hw.led, type:"output", pos:{x:24, y:168}}}, mode:"both"}}; + a.lineTracerMode = b; + a.lineTracerModeId = this.lineTracerModeId; +}, name:"hamster", monitorTemplate:{imgPath:"hw/hamster.png", width:256, height:256, listPorts:{temperature:{name:Lang.Blocks.HAMSTER_sensor_temperature, type:"input", pos:{x:0, y:0}}, inputA:{name:Lang.Blocks.HAMSTER_sensor_input_a, type:"input", pos:{x:0, y:0}}, inputB:{name:Lang.Blocks.HAMSTER_sensor_input_b, type:"input", pos:{x:0, y:0}}, accelerationX:{name:Lang.Blocks.HAMSTER_sensor_acceleration_x, type:"input", pos:{x:0, y:0}}, accelerationY:{name:Lang.Blocks.HAMSTER_sensor_acceleration_y, +type:"input", pos:{x:0, y:0}}, accelerationZ:{name:Lang.Blocks.HAMSTER_sensor_acceleration_z, type:"input", pos:{x:0, y:0}}, buzzer:{name:Lang.Hw.buzzer, type:"output", pos:{x:0, y:0}}, note:{name:Lang.Hw.note, type:"output", pos:{x:0, y:0}}, outputA:{name:Lang.Hw.output + "A", type:"output", pos:{x:0, y:0}}, outputB:{name:Lang.Hw.output + "B", type:"output", pos:{x:0, y:0}}}, ports:{leftProximity:{name:Lang.Blocks.HAMSTER_sensor_left_proximity, type:"input", pos:{x:122, y:156}}, rightProximity:{name:Lang.Blocks.HAMSTER_sensor_right_proximity, +type:"input", pos:{x:10, y:108}}, leftFloor:{name:Lang.Blocks.HAMSTER_sensor_left_floor, type:"input", pos:{x:100, y:234}}, rightFloor:{name:Lang.Blocks.HAMSTER_sensor_right_floor, type:"input", pos:{x:13, y:180}}, light:{name:Lang.Blocks.HAMSTER_sensor_light, type:"input", pos:{x:56, y:189}}, leftWheel:{name:Lang.Hw.leftWheel, type:"output", pos:{x:209, y:115}}, rightWheel:{name:Lang.Hw.rightWheel, type:"output", pos:{x:98, y:30}}, leftLed:{name:Lang.Hw.left + " " + Lang.Hw.led_en, type:"output", +pos:{x:87, y:210}}, rightLed:{name:Lang.Hw.right + " " + Lang.Hw.led_en, type:"output", pos:{x:24, y:168}}}, mode:"both"}}; Blockly.Blocks.hamster_hand_found = {init:function() { this.setColour("#00979D"); this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_hand_found); this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.hamster_hand_found = function(b, a) { - var c = Entry.hw.portData; - return 50 < c.leftProximity || 50 < c.rightProximity; +Entry.block.hamster_hand_found = function(a, b) { + a = Entry.hw.portData; + return 50 < a.leftProximity || 50 < a.rightProximity; }; Blockly.Blocks.hamster_value = {init:function() { this.setColour("#00979D"); - this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_sensor_leftProximity, "leftProximity"], [Lang.Blocks.HAMSTER_sensor_rightProximity, "rightProximity"], [Lang.Blocks.HAMSTER_sensor_leftFloor, "leftFloor"], [Lang.Blocks.HAMSTER_sensor_rightFloor, "rightFloor"], [Lang.Blocks.HAMSTER_sensor_accelerationX, "accelerationX"], [Lang.Blocks.HAMSTER_sensor_accelerationY, "accelerationY"], [Lang.Blocks.HAMSTER_sensor_accelerationZ, "accelerationZ"], [Lang.Blocks.HAMSTER_sensor_light, - "light"], [Lang.Blocks.HAMSTER_sensor_temperature, "temperature"], [Lang.Blocks.HAMSTER_sensor_signalStrength, "signalStrength"], [Lang.Blocks.HAMSTER_sensor_inputA, "inputA"], [Lang.Blocks.HAMSTER_sensor_inputB, "inputB"]]), "DEVICE"); + this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_sensor_left_proximity, "leftProximity"], [Lang.Blocks.HAMSTER_sensor_right_proximity, "rightProximity"], [Lang.Blocks.HAMSTER_sensor_left_floor, "leftFloor"], [Lang.Blocks.HAMSTER_sensor_right_floor, "rightFloor"], [Lang.Blocks.HAMSTER_sensor_acceleration_x, "accelerationX"], [Lang.Blocks.HAMSTER_sensor_acceleration_y, "accelerationY"], [Lang.Blocks.HAMSTER_sensor_acceleration_z, "accelerationZ"], + [Lang.Blocks.HAMSTER_sensor_light, "light"], [Lang.Blocks.HAMSTER_sensor_temperature, "temperature"], [Lang.Blocks.HAMSTER_sensor_signal_strength, "signalStrength"], [Lang.Blocks.HAMSTER_sensor_input_a, "inputA"], [Lang.Blocks.HAMSTER_sensor_input_b, "inputB"]]), "DEVICE"); this.setInputsInline(!0); this.setOutput(!0, "Number"); }}; -Entry.block.hamster_value = function(b, a) { - var c = Entry.hw.portData, d = a.getField("DEVICE"); - return c[d]; +Entry.block.hamster_value = function(a, b) { + a = Entry.hw.portData; + b = b.getField("DEVICE"); + return a[b]; }; Blockly.Blocks.hamster_move_forward_once = {init:function() { this.setColour("#00979D"); @@ -2500,118 +2632,120 @@ Blockly.Blocks.hamster_move_forward_once = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_move_forward_once = function(b, a) { - var c = Entry.hw.sendQueue, d = Entry.hw.portData; - if (a.isStart) { - if (a.isMoving) { - switch(a.boardState) { +Entry.block.hamster_move_forward_once = function(a, b) { + a = Entry.hw.sendQueue; + var c = Entry.hw.portData; + if (b.isStart) { + if (b.isMoving) { + switch(b.boardState) { case 1: - 2 > a.count ? (50 > d.leftFloor && 50 > d.rightFloor ? a.count++ : a.count = 0, d = d.leftFloor - d.rightFloor, c.leftWheel = 45 + .25 * d, c.rightWheel = 45 - .25 * d) : (a.count = 0, a.boardState = 2); + 2 > b.count ? (50 > c.leftFloor && 50 > c.rightFloor ? b.count++ : b.count = 0, c = c.leftFloor - c.rightFloor, a.leftWheel = 45 + .25 * c, a.rightWheel = 45 - .25 * c) : (b.count = 0, b.boardState = 2); break; case 2: - d = d.leftFloor - d.rightFloor; - c.leftWheel = 45 + .25 * d; - c.rightWheel = 45 - .25 * d; - a.boardState = 3; - var e = setTimeout(function() { - a.boardState = 4; - Entry.Hamster.removeTimeout(e); + c = c.leftFloor - c.rightFloor; + a.leftWheel = 45 + .25 * c; + a.rightWheel = 45 - .25 * c; + b.boardState = 3; + var d = setTimeout(function() { + b.boardState = 4; + Entry.Hamster.removeTimeout(d); }, 250); - Entry.Hamster.timeouts.push(e); + Entry.Hamster.timeouts.push(d); break; case 3: - d = d.leftFloor - d.rightFloor; - c.leftWheel = 45 + .25 * d; - c.rightWheel = 45 - .25 * d; + c = c.leftFloor - c.rightFloor; + a.leftWheel = 45 + .25 * c; + a.rightWheel = 45 - .25 * c; break; case 4: - c.leftWheel = 0, c.rightWheel = 0, a.boardState = 0, a.isMoving = !1; + a.leftWheel = 0, a.rightWheel = 0, b.boardState = 0, b.isMoving = !1; } - return a; + return b; } - delete a.isStart; - delete a.isMoving; - delete a.count; - delete a.boardState; + delete b.isStart; + delete b.isMoving; + delete b.count; + delete b.boardState; Entry.engine.isContinue = !1; - c.leftWheel = 0; - c.rightWheel = 0; - return a.callReturn(); + a.leftWheel = 0; + a.rightWheel = 0; + return b.callReturn(); } - a.isStart = !0; - a.isMoving = !0; - a.count = 0; - a.boardState = 1; - c.leftWheel = 45; - c.rightWheel = 45; - Entry.Hamster.setLineTracerMode(c, 0); - return a; + b.isStart = !0; + b.isMoving = !0; + b.count = 0; + b.boardState = 1; + a.leftWheel = 45; + a.rightWheel = 45; + Entry.Hamster.setLineTracerMode(a, 0); + return b; }; Blockly.Blocks.hamster_turn_once = {init:function() { this.setColour("#00979D"); - this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_turn_once_1).appendField(new Blockly.FieldDropdown([[Lang.General.left, "LEFT"], [Lang.General.right, "RIGHT"]]), "DIRECTION").appendField(Lang.Blocks.HAMSTER_turn_once_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath + "block_icon/hardware_03.png", "*")); + this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_turn_once_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_turn_once_left, "LEFT"], [Lang.Blocks.HAMSTER_turn_once_right, "RIGHT"]]), "DIRECTION").appendField(Lang.Blocks.HAMSTER_turn_once_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath + "block_icon/hardware_03.png", "*")); this.setInputsInline(!0); this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_turn_once = function(b, a) { - var c = Entry.hw.sendQueue, d = Entry.hw.portData; - if (a.isStart) { - if (a.isMoving) { - if (a.isLeft) { - switch(a.boardState) { +Entry.block.hamster_turn_once = function(a, b) { + a = Entry.hw.sendQueue; + var c = Entry.hw.portData; + if (b.isStart) { + if (b.isMoving) { + if (b.isLeft) { + switch(b.boardState) { case 1: - 2 > a.count ? 50 < d.leftFloor && a.count++ : (a.count = 0, a.boardState = 2); + 2 > b.count ? 50 < c.leftFloor && b.count++ : (b.count = 0, b.boardState = 2); break; case 2: - 20 > d.leftFloor && (a.boardState = 3); + 20 > c.leftFloor && (b.boardState = 3); break; case 3: - 2 > a.count ? 20 > d.leftFloor && a.count++ : (a.count = 0, a.boardState = 4); + 2 > b.count ? 20 > c.leftFloor && b.count++ : (b.count = 0, b.boardState = 4); break; case 4: - 50 < d.leftFloor && (a.boardState = 5); + 50 < c.leftFloor && (b.boardState = 5); break; case 5: - d = d.leftFloor - d.rightFloor, -15 < d ? (c.leftWheel = 0, c.rightWheel = 0, a.boardState = 0, a.isMoving = !1) : (c.leftWheel = .5 * d, c.rightWheel = .5 * -d); + c = c.leftFloor - c.rightFloor, -15 < c ? (a.leftWheel = 0, a.rightWheel = 0, b.boardState = 0, b.isMoving = !1) : (a.leftWheel = .5 * c, a.rightWheel = .5 * -c); } } else { - switch(a.boardState) { + switch(b.boardState) { case 1: - 2 > a.count ? 50 < d.rightFloor && a.count++ : (a.count = 0, a.boardState = 2); + 2 > b.count ? 50 < c.rightFloor && b.count++ : (b.count = 0, b.boardState = 2); break; case 2: - 20 > d.rightFloor && (a.boardState = 3); + 20 > c.rightFloor && (b.boardState = 3); break; case 3: - 2 > a.count ? 20 > d.rightFloor && a.count++ : (a.count = 0, a.boardState = 4); + 2 > b.count ? 20 > c.rightFloor && b.count++ : (b.count = 0, b.boardState = 4); break; case 4: - 50 < d.rightFloor && (a.boardState = 5); + 50 < c.rightFloor && (b.boardState = 5); break; case 5: - d = d.rightFloor - d.leftFloor, -15 < d ? (c.leftWheel = 0, c.rightWheel = 0, a.boardState = 0, a.isMoving = !1) : (c.leftWheel = .5 * -d, c.rightWheel = .5 * d); + c = c.rightFloor - c.leftFloor, -15 < c ? (a.leftWheel = 0, a.rightWheel = 0, b.boardState = 0, b.isMoving = !1) : (a.leftWheel = .5 * -c, a.rightWheel = .5 * c); } } - return a; + return b; } - delete a.isStart; - delete a.isMoving; - delete a.count; - delete a.boardState; - delete a.isLeft; + delete b.isStart; + delete b.isMoving; + delete b.count; + delete b.boardState; + delete b.isLeft; Entry.engine.isContinue = !1; - c.leftWheel = 0; - c.rightWheel = 0; - return a.callReturn(); + a.leftWheel = 0; + a.rightWheel = 0; + return b.callReturn(); } - a.isStart = !0; - a.isMoving = !0; - a.count = 0; - a.boardState = 1; - "LEFT" == a.getField("DIRECTION", a) ? (a.isLeft = !0, c.leftWheel = -45, c.rightWheel = 45) : (a.isLeft = !1, c.leftWheel = 45, c.rightWheel = -45); - Entry.Hamster.setLineTracerMode(c, 0); - return a; + b.isStart = !0; + b.isMoving = !0; + b.count = 0; + b.boardState = 1; + "LEFT" == b.getField("DIRECTION", b) ? (b.isLeft = !0, a.leftWheel = -45, a.rightWheel = 45) : (b.isLeft = !1, a.leftWheel = 45, a.rightWheel = -45); + Entry.Hamster.setLineTracerMode(a, 0); + return b; }; Blockly.Blocks.hamster_move_forward_for_secs = {init:function() { this.setColour("#00979D"); @@ -2622,30 +2756,31 @@ Blockly.Blocks.hamster_move_forward_for_secs = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_move_forward_for_secs = function(b, a) { - var c = Entry.hw.sendQueue; - if (a.isStart) { - if (1 == a.timeFlag) { - return a; +Entry.block.hamster_move_forward_for_secs = function(a, b) { + a = Entry.hw.sendQueue; + if (b.isStart) { + if (1 == b.timeFlag) { + return b; } - delete a.isStart; - delete a.timeFlag; + delete b.isStart; + delete b.timeFlag; Entry.engine.isContinue = !1; - c.leftWheel = 0; - c.rightWheel = 0; - return a.callReturn(); + a.leftWheel = 0; + a.rightWheel = 0; + return b.callReturn(); } - a.isStart = !0; - a.timeFlag = 1; - c.leftWheel = 30; - c.rightWheel = 30; - Entry.Hamster.setLineTracerMode(c, 0); - var c = 1E3 * a.getNumberValue("VALUE"), d = setTimeout(function() { - a.timeFlag = 0; - Entry.Hamster.removeTimeout(d); - }, c); - Entry.Hamster.timeouts.push(d); - return a; + b.isStart = !0; + b.timeFlag = 1; + a.leftWheel = 30; + a.rightWheel = 30; + Entry.Hamster.setLineTracerMode(a, 0); + a = 1E3 * b.getNumberValue("VALUE"); + var c = setTimeout(function() { + b.timeFlag = 0; + Entry.Hamster.removeTimeout(c); + }, a); + Entry.Hamster.timeouts.push(c); + return b; }; Blockly.Blocks.hamster_move_backward_for_secs = {init:function() { this.setColour("#00979D"); @@ -2656,63 +2791,65 @@ Blockly.Blocks.hamster_move_backward_for_secs = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_move_backward_for_secs = function(b, a) { - var c = Entry.hw.sendQueue; - if (a.isStart) { - if (1 == a.timeFlag) { - return a; +Entry.block.hamster_move_backward_for_secs = function(a, b) { + a = Entry.hw.sendQueue; + if (b.isStart) { + if (1 == b.timeFlag) { + return b; } - delete a.isStart; - delete a.timeFlag; + delete b.isStart; + delete b.timeFlag; Entry.engine.isContinue = !1; - c.leftWheel = 0; - c.rightWheel = 0; - return a.callReturn(); + a.leftWheel = 0; + a.rightWheel = 0; + return b.callReturn(); } - a.isStart = !0; - a.timeFlag = 1; - c.leftWheel = -30; - c.rightWheel = -30; - Entry.Hamster.setLineTracerMode(c, 0); - var c = 1E3 * a.getNumberValue("VALUE"), d = setTimeout(function() { - a.timeFlag = 0; - Entry.Hamster.removeTimeout(d); - }, c); - Entry.Hamster.timeouts.push(d); - return a; + b.isStart = !0; + b.timeFlag = 1; + a.leftWheel = -30; + a.rightWheel = -30; + Entry.Hamster.setLineTracerMode(a, 0); + a = 1E3 * b.getNumberValue("VALUE"); + var c = setTimeout(function() { + b.timeFlag = 0; + Entry.Hamster.removeTimeout(c); + }, a); + Entry.Hamster.timeouts.push(c); + return b; }; Blockly.Blocks.hamster_turn_for_secs = {init:function() { this.setColour("#00979D"); - this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_turn_for_secs_1).appendField(new Blockly.FieldDropdown([[Lang.General.left, "LEFT"], [Lang.General.right, "RIGHT"]]), "DIRECTION").appendField(Lang.Blocks.HAMSTER_turn_for_secs_2); + this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_turn_for_secs_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_turn_left, "LEFT"], [Lang.Blocks.HAMSTER_turn_right, "RIGHT"]]), "DIRECTION").appendField(Lang.Blocks.HAMSTER_turn_for_secs_2); this.appendValueInput("VALUE").setCheck(["Number", "String"]); this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_turn_for_secs_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath + "block_icon/hardware_03.png", "*")); this.setInputsInline(!0); this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_turn_for_secs = function(b, a) { - var c = Entry.hw.sendQueue; - if (a.isStart) { - if (1 == a.timeFlag) { - return a; +Entry.block.hamster_turn_for_secs = function(a, b) { + a = Entry.hw.sendQueue; + if (b.isStart) { + if (1 == b.timeFlag) { + return b; } - delete a.isStart; - delete a.timeFlag; + delete b.isStart; + delete b.timeFlag; Entry.engine.isContinue = !1; - c.leftWheel = 0; - c.rightWheel = 0; - return a.callReturn(); + a.leftWheel = 0; + a.rightWheel = 0; + return b.callReturn(); } - a.isStart = !0; - a.timeFlag = 1; - "LEFT" == a.getField("DIRECTION", a) ? (c.leftWheel = -30, c.rightWheel = 30) : (c.leftWheel = 30, c.rightWheel = -30); - Entry.Hamster.setLineTracerMode(c, 0); - var c = 1E3 * a.getNumberValue("VALUE"), d = setTimeout(function() { - a.timeFlag = 0; - Entry.Hamster.removeTimeout(d); - }, c); - Entry.Hamster.timeouts.push(d); - return a; + b.isStart = !0; + b.timeFlag = 1; + "LEFT" == b.getField("DIRECTION", b) ? (a.leftWheel = -30, a.rightWheel = 30) : (a.leftWheel = 30, a.rightWheel = -30); + Entry.Hamster.setLineTracerMode(a, 0); + a = 1E3 * b.getNumberValue("VALUE"); + var c = setTimeout(function() { + b.timeFlag = 0; + Entry.Hamster.removeTimeout(c); + }, a); + Entry.Hamster.timeouts.push(c); + return b; }; Blockly.Blocks.hamster_change_both_wheels_by = {init:function() { this.setColour("#00979D"); @@ -2725,12 +2862,13 @@ Blockly.Blocks.hamster_change_both_wheels_by = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_change_both_wheels_by = function(b, a) { - var c = Entry.hw.sendQueue, d = a.getNumberValue("LEFT"), e = a.getNumberValue("RIGHT"); - c.leftWheel = void 0 != c.leftWheel ? c.leftWheel + d : d; - c.rightWheel = void 0 != c.rightWheel ? c.rightWheel + e : e; - Entry.Hamster.setLineTracerMode(c, 0); - return a.callReturn(); +Entry.block.hamster_change_both_wheels_by = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getNumberValue("LEFT"), d = b.getNumberValue("RIGHT"); + a.leftWheel = void 0 != a.leftWheel ? a.leftWheel + c : c; + a.rightWheel = void 0 != a.rightWheel ? a.rightWheel + d : d; + Entry.Hamster.setLineTracerMode(a, 0); + return b.callReturn(); }; Blockly.Blocks.hamster_set_both_wheels_to = {init:function() { this.setColour("#00979D"); @@ -2743,80 +2881,84 @@ Blockly.Blocks.hamster_set_both_wheels_to = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_set_both_wheels_to = function(b, a) { - var c = Entry.hw.sendQueue; - c.leftWheel = a.getNumberValue("LEFT"); - c.rightWheel = a.getNumberValue("RIGHT"); - Entry.Hamster.setLineTracerMode(c, 0); - return a.callReturn(); +Entry.block.hamster_set_both_wheels_to = function(a, b) { + a = Entry.hw.sendQueue; + a.leftWheel = b.getNumberValue("LEFT"); + a.rightWheel = b.getNumberValue("RIGHT"); + Entry.Hamster.setLineTracerMode(a, 0); + return b.callReturn(); }; Blockly.Blocks.hamster_change_wheel_by = {init:function() { this.setColour("#00979D"); - this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_change_wheel_by_1).appendField(new Blockly.FieldDropdown([[Lang.General.left, "LEFT"], [Lang.General.right, "RIGHT"], [Lang.General.both, "BOTH"]]), "DIRECTION").appendField(Lang.Blocks.HAMSTER_change_wheel_by_2); + this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_change_wheel_by_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_left_wheel, "LEFT"], [Lang.Blocks.HAMSTER_right_wheel, "RIGHT"], [Lang.Blocks.HAMSTER_both_wheels, "BOTH"]]), "DIRECTION").appendField(Lang.Blocks.HAMSTER_change_wheel_by_2); this.appendValueInput("VALUE").setCheck(["Number", "String"]); this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_change_wheel_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_wheel_by = function(b, a) { - var c = Entry.hw.sendQueue, d = a.getField("DIRECTION"), e = a.getNumberValue("VALUE"); - "LEFT" == d ? c.leftWheel = void 0 != c.leftWheel ? c.leftWheel + e : e : ("RIGHT" != d && (c.leftWheel = void 0 != c.leftWheel ? c.leftWheel + e : e), c.rightWheel = void 0 != c.rightWheel ? c.rightWheel + e : e); - Entry.Hamster.setLineTracerMode(c, 0); - return a.callReturn(); +Entry.block.hamster_change_wheel_by = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getField("DIRECTION"), d = b.getNumberValue("VALUE"); + "LEFT" == c ? a.leftWheel = void 0 != a.leftWheel ? a.leftWheel + d : d : ("RIGHT" != c && (a.leftWheel = void 0 != a.leftWheel ? a.leftWheel + d : d), a.rightWheel = void 0 != a.rightWheel ? a.rightWheel + d : d); + Entry.Hamster.setLineTracerMode(a, 0); + return b.callReturn(); }; Blockly.Blocks.hamster_set_wheel_to = {init:function() { this.setColour("#00979D"); - this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_wheel_to_1).appendField(new Blockly.FieldDropdown([[Lang.General.left, "LEFT"], [Lang.General.right, "RIGHT"], [Lang.General.both, "BOTH"]]), "DIRECTION").appendField(Lang.Blocks.HAMSTER_set_wheel_to_2); + this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_wheel_to_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_left_wheel, "LEFT"], [Lang.Blocks.HAMSTER_right_wheel, "RIGHT"], [Lang.Blocks.HAMSTER_both_wheels, "BOTH"]]), "DIRECTION").appendField(Lang.Blocks.HAMSTER_set_wheel_to_2); this.appendValueInput("VALUE").setCheck(["Number", "String"]); this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_wheel_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_wheel_to = 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); - Entry.Hamster.setLineTracerMode(c, 0); - return a.callReturn(); +Entry.block.hamster_set_wheel_to = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getField("DIRECTION"), d = b.getNumberValue("VALUE"); + "LEFT" == c ? a.leftWheel = d : ("RIGHT" != c && (a.leftWheel = d), a.rightWheel = d); + Entry.Hamster.setLineTracerMode(a, 0); + return b.callReturn(); }; Blockly.Blocks.hamster_follow_line_using = {init:function() { this.setColour("#00979D"); - this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_follow_line_using_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_color_black, "BLACK"], [Lang.General.white, "WHITE"]]), "COLOR").appendField(Lang.Blocks.HAMSTER_follow_line_using_2).appendField(new Blockly.FieldDropdown([[Lang.General.left, "LEFT"], [Lang.General.right, "RIGHT"], [Lang.General.both, "BOTH"]]), "DIRECTION").appendField(Lang.Blocks.HAMSTER_follow_line_using_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath + + this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_follow_line_using_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_color_black, "BLACK"], [Lang.Blocks.HAMSTER_color_white, "WHITE"]]), "COLOR").appendField(Lang.Blocks.HAMSTER_follow_line_using_2).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_left_floor_sensor, "LEFT"], [Lang.Blocks.HAMSTER_right_floor_sensor, "RIGHT"], [Lang.Blocks.HAMSTER_both_floor_sensors, "BOTH"]]), "DIRECTION").appendField(Lang.Blocks.HAMSTER_follow_line_using_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath + "block_icon/hardware_03.png", "*")); this.setInputsInline(!0); this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_follow_line_using = 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(); +Entry.block.hamster_follow_line_using = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getField("COLOR"), d = b.getField("DIRECTION"), e = 1; + "RIGHT" == d ? e = 2 : "BOTH" == d && (e = 3); + "WHITE" == c && (e += 7); + a.leftWheel = 0; + a.rightWheel = 0; + Entry.Hamster.setLineTracerMode(a, e); + return b.callReturn(); }; Blockly.Blocks.hamster_follow_line_until = {init:function() { this.setColour("#00979D"); - this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_follow_line_until_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_color_black, "BLACK"], [Lang.General.white, "WHITE"]]), "COLOR").appendField(Lang.Blocks.HAMSTER_follow_line_until_2).appendField(new Blockly.FieldDropdown([[Lang.General.left, "LEFT"], [Lang.General.right, "RIGHT"], [Lang.Blocks.HAMSTER_front, "FRONT"], [Lang.Blocks.HAMSTER_rear, "REAR"]]), "DIRECTION").appendField(Lang.Blocks.HAMSTER_follow_line_until_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath + - "block_icon/hardware_03.png", "*")); + this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_follow_line_until_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_color_black, "BLACK"], [Lang.Blocks.HAMSTER_color_white, "WHITE"]]), "COLOR").appendField(Lang.Blocks.HAMSTER_follow_line_until_2).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_left_intersection, "LEFT"], [Lang.Blocks.HAMSTER_right_intersection, "RIGHT"], [Lang.Blocks.HAMSTER_front_intersection, "FRONT"], [Lang.Blocks.HAMSTER_rear_intersection, "REAR"]]), + "DIRECTION").appendField(Lang.Blocks.HAMSTER_follow_line_until_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath + "block_icon/hardware_03.png", "*")); this.setInputsInline(!0); this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -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(); +Entry.block.hamster_follow_line_until = function(a, b) { + a = Entry.hw.sendQueue; + var c = Entry.hw.portData, d = b.getField("COLOR"), e = b.getField("DIRECTION"), f = 4; + "RIGHT" == e ? f = 5 : "FRONT" == e ? f = 6 : "REAR" == e && (f = 7); + "WHITE" == d && (f += 7); + if (b.isStart) { + if (d = Entry.Hamster, c.lineTracerStateId != d.lineTracerStateId && (d.lineTracerStateId = c.lineTracerStateId, 64 == c.lineTracerState)) { + return delete b.isStart, Entry.engine.isContinue = !1, d.setLineTracerMode(a, 0), b.callReturn(); } } else { - a.isStart = !0, c.leftWheel = 0, c.rightWheel = 0, Entry.Hamster.setLineTracerMode(c, g); + b.isStart = !0, a.leftWheel = 0, a.rightWheel = 0, Entry.Hamster.setLineTracerMode(a, f); } - return a; + return b; }; Blockly.Blocks.hamster_set_following_speed_to = {init:function() { this.setColour("#00979D"); @@ -2825,9 +2967,9 @@ Blockly.Blocks.hamster_set_following_speed_to = {init:function() { 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(); +Entry.block.hamster_set_following_speed_to = function(a, b) { + Entry.hw.sendQueue.lineTracerSpeed = Number(b.getField("SPEED", b)); + return b.callReturn(); }; Blockly.Blocks.hamster_stop = {init:function() { this.setColour("#00979D"); @@ -2836,37 +2978,39 @@ Blockly.Blocks.hamster_stop = {init:function() { 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(); +Entry.block.hamster_stop = function(a, b) { + a = Entry.hw.sendQueue; + a.leftWheel = 0; + a.rightWheel = 0; + Entry.Hamster.setLineTracerMode(a, 0); + return b.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.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_led_to_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_left_led, "LEFT"], [Lang.Blocks.HAMSTER_right_led, "RIGHT"], [Lang.Blocks.HAMSTER_both_leds, "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.Blocks.HAMSTER_color_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(); +Entry.block.hamster_set_led_to = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getField("DIRECTION", b), d = Number(b.getField("COLOR", b)); + "LEFT" == c ? a.leftLed = d : ("RIGHT" != c && (a.leftLed = d), a.rightLed = d); + return b.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.appendDummyInput().appendField(Lang.Blocks.HAMSTER_clear_led_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_left_led, "LEFT"], [Lang.Blocks.HAMSTER_right_led, "RIGHT"], [Lang.Blocks.HAMSTER_both_leds, "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(); +Entry.block.hamster_clear_led = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getField("DIRECTION", b); + "LEFT" == c ? a.leftLed = 0 : ("RIGHT" != c && (a.leftLed = 0), a.rightLed = 0); + return b.callReturn(); }; Blockly.Blocks.hamster_beep = {init:function() { this.setColour("#00979D"); @@ -2875,28 +3019,28 @@ Blockly.Blocks.hamster_beep = {init:function() { 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; +Entry.block.hamster_beep = function(a, b) { + a = Entry.hw.sendQueue; + if (b.isStart) { + if (1 == b.timeFlag) { + return b; } - delete a.isStart; - delete a.timeFlag; + delete b.isStart; + delete b.timeFlag; Entry.engine.isContinue = !1; - c.buzzer = 0; - return a.callReturn(); + a.buzzer = 0; + return b.callReturn(); } - a.isStart = !0; - a.timeFlag = 1; - c.buzzer = 440; - c.note = 0; - var d = setTimeout(function() { - a.timeFlag = 0; - Entry.Hamster.removeTimeout(d); + b.isStart = !0; + b.timeFlag = 1; + a.buzzer = 440; + a.note = 0; + var c = setTimeout(function() { + b.timeFlag = 0; + Entry.Hamster.removeTimeout(c); }, 200); - Entry.Hamster.timeouts.push(d); - return a; + Entry.Hamster.timeouts.push(c); + return b; }; Blockly.Blocks.hamster_change_buzzer_by = {init:function() { this.setColour("#00979D"); @@ -2907,11 +3051,12 @@ Blockly.Blocks.hamster_change_buzzer_by = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_change_buzzer_by = 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(); +Entry.block.hamster_change_buzzer_by = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getNumberValue("VALUE"); + a.buzzer = void 0 != a.buzzer ? a.buzzer + c : c; + a.note = 0; + return b.callReturn(); }; Blockly.Blocks.hamster_set_buzzer_to = {init:function() { this.setColour("#00979D"); @@ -2922,11 +3067,11 @@ Blockly.Blocks.hamster_set_buzzer_to = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_set_buzzer_to = function(b, a) { - var c = Entry.hw.sendQueue; - c.buzzer = a.getNumberValue("VALUE"); - c.note = 0; - return a.callReturn(); +Entry.block.hamster_set_buzzer_to = function(a, b) { + a = Entry.hw.sendQueue; + a.buzzer = b.getNumberValue("VALUE"); + a.note = 0; + return b.callReturn(); }; Blockly.Blocks.hamster_clear_buzzer = {init:function() { this.setColour("#00979D"); @@ -2935,11 +3080,11 @@ Blockly.Blocks.hamster_clear_buzzer = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_clear_buzzer = function(b, a) { - var c = Entry.hw.sendQueue; - c.buzzer = 0; - c.note = 0; - return a.callReturn(); +Entry.block.hamster_clear_buzzer = function(a, b) { + a = Entry.hw.sendQueue; + a.buzzer = 0; + a.note = 0; + return b.callReturn(); }; Blockly.Blocks.hamster_play_note_for = {init:function() { this.setColour("#00979D"); @@ -2951,36 +3096,37 @@ Blockly.Blocks.hamster_play_note_for = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_play_note_for = function(b, a) { +Entry.block.hamster_play_note_for = function(a, b) { var c = Entry.hw.sendQueue; - if (a.isStart) { - if (1 == a.timeFlag) { - return a; + if (b.isStart) { + if (1 == b.timeFlag) { + return b; } - delete a.isStart; - delete a.timeFlag; + delete b.isStart; + delete b.timeFlag; Entry.engine.isContinue = !1; c.note = 0; - return a.callReturn(); + return b.callReturn(); } - var d = a.getNumberField("NOTE", a), e = a.getNumberField("OCTAVE", a), f = a.getNumberValue("VALUE", a), g = Entry.Hamster.tempo, f = 6E4 * f / g; - a.isStart = !0; - a.timeFlag = 1; + a = b.getNumberField("NOTE", b); + var d = b.getNumberField("OCTAVE", b), e = 6E4 * b.getNumberValue("VALUE", b) / Entry.Hamster.tempo; + b.isStart = !0; + b.timeFlag = 1; c.buzzer = 0; - c.note = d + 12 * (e - 1); - if (100 < f) { - var h = setTimeout(function() { + c.note = a + 12 * (d - 1); + if (100 < e) { + var f = setTimeout(function() { c.note = 0; - Entry.Hamster.removeTimeout(h); - }, f - 100); - Entry.Hamster.timeouts.push(h); + Entry.Hamster.removeTimeout(f); + }, e - 100); + Entry.Hamster.timeouts.push(f); } - var k = setTimeout(function() { - a.timeFlag = 0; - Entry.Hamster.removeTimeout(k); - }, f); - Entry.Hamster.timeouts.push(k); - return a; + var g = setTimeout(function() { + b.timeFlag = 0; + Entry.Hamster.removeTimeout(g); + }, e); + Entry.Hamster.timeouts.push(g); + return b; }; Blockly.Blocks.hamster_rest_for = {init:function() { this.setColour("#00979D"); @@ -2991,28 +3137,28 @@ Blockly.Blocks.hamster_rest_for = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_rest_for = function(b, a) { - var c = Entry.hw.sendQueue; - if (a.isStart) { - if (1 == a.timeFlag) { - return a; +Entry.block.hamster_rest_for = function(a, b) { + a = Entry.hw.sendQueue; + if (b.isStart) { + if (1 == b.timeFlag) { + return b; } - delete a.isStart; - delete a.timeFlag; + delete b.isStart; + delete b.timeFlag; Entry.engine.isContinue = !1; - return a.callReturn(); + return b.callReturn(); } - a.isStart = !0; - a.timeFlag = 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; + b.isStart = !0; + b.timeFlag = 1; + var c = b.getNumberValue("VALUE"), c = 6E4 * c / Entry.Hamster.tempo; + a.buzzer = 0; + a.note = 0; + var d = setTimeout(function() { + b.timeFlag = 0; + Entry.Hamster.removeTimeout(d); + }, c); + Entry.Hamster.timeouts.push(d); + return b; }; Blockly.Blocks.hamster_change_tempo_by = {init:function() { this.setColour("#00979D"); @@ -3023,10 +3169,10 @@ Blockly.Blocks.hamster_change_tempo_by = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_change_tempo_by = function(b, a) { - Entry.Hamster.tempo += a.getNumberValue("VALUE"); +Entry.block.hamster_change_tempo_by = function(a, b) { + Entry.Hamster.tempo += b.getNumberValue("VALUE"); 1 > Entry.Hamster.tempo && (Entry.Hamster.tempo = 1); - return a.callReturn(); + return b.callReturn(); }; Blockly.Blocks.hamster_set_tempo_to = {init:function() { this.setColour("#00979D"); @@ -3037,51 +3183,54 @@ Blockly.Blocks.hamster_set_tempo_to = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hamster_set_tempo_to = function(b, a) { - Entry.Hamster.tempo = a.getNumberValue("VALUE"); +Entry.block.hamster_set_tempo_to = function(a, b) { + Entry.Hamster.tempo = b.getNumberValue("VALUE"); 1 > Entry.Hamster.tempo && (Entry.Hamster.tempo = 1); - return a.callReturn(); + return b.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, + 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_a_b, "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(); +Entry.block.hamster_set_port_to = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getField("PORT", b), d = Number(b.getField("MODE", b)); + "A" == c ? a.ioModeA = d : ("B" != c && (a.ioModeA = d), a.ioModeB = d); + return b.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.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_a_b, "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(); +Entry.block.hamster_change_output_by = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getField("PORT"), d = b.getNumberValue("VALUE"); + "A" == c ? a.outputA = void 0 != a.outputA ? a.outputA + d : d : ("B" != c && (a.outputA = void 0 != a.outputA ? a.outputA + d : d), a.outputB = void 0 != a.outputB ? a.outputB + d : d); + return b.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.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_a_b, "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(); +Entry.block.hamster_set_output_to = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getField("PORT"), d = b.getNumberValue("VALUE"); + "A" == c ? a.outputA = d : ("B" != c && (a.outputA = d), a.outputB = d); + return b.callReturn(); }; Blockly.Blocks.is_clicked = {init:function() { this.setColour("#AEB8FF"); @@ -3089,7 +3238,7 @@ Blockly.Blocks.is_clicked = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.is_clicked = function(b, a) { +Entry.block.is_clicked = function(a, b) { return Entry.stage.isClick; }; Blockly.Blocks.is_press_some_key = {init:function() { @@ -3099,9 +3248,9 @@ Blockly.Blocks.is_press_some_key = {init:function() { 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); +Entry.block.is_press_some_key = function(a, b) { + a = Number(b.getField("VALUE", b)); + return 0 <= Entry.pressedKeys.indexOf(a); }; Blockly.Blocks.reach_something = {init:function() { this.setColour("#AEB8FF"); @@ -3111,64 +3260,68 @@ Blockly.Blocks.reach_something = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.reach_something = function(b, a) { - if (!b.getVisible()) { +Entry.block.reach_something = function(a, b) { + if (!a.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) { + var c = b.getField("VALUE", b); + b = a.object; + var d = /wall/.test(c), e = ndgmr.checkPixelCollision; + if (d) { + switch(a = 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)) { + if (e(b, a.up, .2, !0) || e(b, a.down, .2, !0) || e(b, a.left, .2, !0) || e(b, a.right, .2, !0)) { return !0; } break; case "wall_up": - if (f(d, e.up, .2, !0)) { + if (e(b, a.up, .2, !0)) { return !0; } break; case "wall_down": - if (f(d, e.down, .2, !0)) { + if (e(b, a.down, .2, !0)) { return !0; } break; case "wall_right": - if (f(d, e.right, .2, !0)) { + if (e(b, a.right, .2, !0)) { return !0; } break; case "wall_left": - if (f(d, e.left, .2, !0)) { + if (e(b, a.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); + return e = Entry.stage.canvas, e = b.globalToLocal(e.mouseX, e.mouseY), b.hitTest(e.x, e.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)) { + if ("textBox" == c.type || "textBox" == a.type) { + e = c.object.getTransformedBounds(); + b = b.getTransformedBounds(); + if (Entry.checkCollisionRect(b, e)) { return !0; } - for (var c = c.parent.clonedEntities, e = 0, g = c.length;e < g;e++) { - var h = c[e]; - if (!h.isStamp && h.getVisible() && Entry.checkCollisionRect(d, h.object.getTransformedBounds())) { + a = c.parent.clonedEntities; + c = 0; + for (d = a.length;c < d;c++) { + var f = a[c]; + if (!f.isStamp && f.getVisible() && Entry.checkCollisionRect(b, f.object.getTransformedBounds())) { return !0; } } } else { - if (c.getVisible() && f(d, c.object, .2, !0)) { + if (c.getVisible() && e(b, c.object, .2, !0)) { return !0; } - c = c.parent.clonedEntities; - e = 0; - for (g = c.length;e < g;e++) { - if (h = c[e], !h.isStamp && h.getVisible() && f(d, h.object, .2, !0)) { + a = c.parent.clonedEntities; + c = 0; + for (d = a.length;c < d;c++) { + if (f = a[c], !f.isStamp && f.getVisible() && e(b, f.object, .2, !0)) { return !0; } } @@ -3184,9 +3337,11 @@ Blockly.Blocks.boolean_comparison = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.boolean_comparison = 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 < e; +Entry.block.boolean_comparison = function(a, b) { + a = b.getField("OPERATOR", b); + var c = b.getNumberValue("LEFTHAND", b); + b = b.getNumberValue("RIGHTHAND", b); + return "EQUAL" == a ? c == b : "BIGGER" == a ? c > b : c < b; }; Blockly.Blocks.boolean_equal = {init:function() { this.setColour("#AEB8FF"); @@ -3196,9 +3351,10 @@ Blockly.Blocks.boolean_equal = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.boolean_equal = function(b, a) { - var c = a.getStringValue("LEFTHAND", a), d = a.getStringValue("RIGHTHAND", a); - return c == d; +Entry.block.boolean_equal = function(a, b) { + a = b.getStringValue("LEFTHAND", b); + b = b.getStringValue("RIGHTHAND", b); + return a == b; }; Blockly.Blocks.boolean_bigger = {init:function() { this.setColour("#AEB8FF"); @@ -3208,9 +3364,10 @@ Blockly.Blocks.boolean_bigger = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.boolean_bigger = function(b, a) { - var c = a.getNumberValue("LEFTHAND", a), d = a.getNumberValue("RIGHTHAND", a); - return c > d; +Entry.block.boolean_bigger = function(a, b) { + a = b.getNumberValue("LEFTHAND", b); + b = b.getNumberValue("RIGHTHAND", b); + return a > b; }; Blockly.Blocks.boolean_smaller = {init:function() { this.setColour("#AEB8FF"); @@ -3220,9 +3377,10 @@ Blockly.Blocks.boolean_smaller = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.boolean_smaller = function(b, a) { - var c = a.getNumberValue("LEFTHAND", a), d = a.getNumberValue("RIGHTHAND", a); - return c < d; +Entry.block.boolean_smaller = function(a, b) { + a = b.getNumberValue("LEFTHAND", b); + b = b.getNumberValue("RIGHTHAND", b); + return a < b; }; Blockly.Blocks.boolean_and_or = {init:function() { this.setColour("#AEB8FF"); @@ -3232,9 +3390,11 @@ Blockly.Blocks.boolean_and_or = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.boolean_and_or = function(b, a) { - var c = a.getField("OPERATOR", a), d = a.getBooleanValue("LEFTHAND", a), e = a.getBooleanValue("RIGHTHAND", a); - return "AND" == c ? d && e : d || e; +Entry.block.boolean_and_or = function(a, b) { + a = b.getField("OPERATOR", b); + var c = b.getBooleanValue("LEFTHAND", b); + b = b.getBooleanValue("RIGHTHAND", b); + return "AND" == a ? c && b : c || b; }; Blockly.Blocks.boolean_and = {init:function() { this.setColour("#AEB8FF"); @@ -3244,9 +3404,10 @@ Blockly.Blocks.boolean_and = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.boolean_and = function(b, a) { - var c = a.getBooleanValue("LEFTHAND", a), d = a.getBooleanValue("RIGHTHAND", a); - return c && d; +Entry.block.boolean_and = function(a, b) { + a = b.getBooleanValue("LEFTHAND", b); + b = b.getBooleanValue("RIGHTHAND", b); + return a && b; }; Blockly.Blocks.boolean_or = {init:function() { this.setColour("#AEB8FF"); @@ -3256,9 +3417,10 @@ Blockly.Blocks.boolean_or = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.boolean_or = function(b, a) { - var c = a.getBooleanValue("LEFTHAND", a), d = a.getBooleanValue("RIGHTHAND", a); - return c || d; +Entry.block.boolean_or = function(a, b) { + a = b.getBooleanValue("LEFTHAND", b); + b = b.getBooleanValue("RIGHTHAND", b); + return a || b; }; Blockly.Blocks.boolean_not = {init:function() { this.setColour("#AEB8FF"); @@ -3269,8 +3431,8 @@ Blockly.Blocks.boolean_not = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.boolean_not = function(b, a) { - return !a.getBooleanValue("VALUE"); +Entry.block.boolean_not = function(a, b) { + return !b.getBooleanValue("VALUE"); }; Blockly.Blocks.true_or_false = {init:function() { this.setColour("#AEB8FF"); @@ -3279,8 +3441,8 @@ Blockly.Blocks.true_or_false = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.true_or_false = function(b, a) { - return "true" == a.children[0].textContent; +Entry.block.true_or_false = function(a, b) { + return "true" == b.children[0].textContent; }; Blockly.Blocks.True = {init:function() { this.setColour("#AEB8FF"); @@ -3288,7 +3450,7 @@ Blockly.Blocks.True = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.True = function(b, a) { +Entry.block.True = function(a, b) { return !0; }; Blockly.Blocks.False = {init:function() { @@ -3297,7 +3459,7 @@ Blockly.Blocks.False = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.False = function(b, a) { +Entry.block.False = function(a, b) { return !1; }; Blockly.Blocks.boolean_basic_operator = {init:function() { @@ -3308,19 +3470,21 @@ Blockly.Blocks.boolean_basic_operator = {init:function() { 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) { +Entry.block.boolean_basic_operator = function(a, b) { + a = b.getField("OPERATOR", b); + var c = b.getStringValue("LEFTHAND", b); + b = b.getStringValue("RIGHTHAND", b); + switch(a) { case "EQUAL": - return d == e; + return c == b; case "GREATER": - return Number(d) > Number(e); + return Number(c) > Number(b); case "LESS": - return Number(d) < Number(e); + return Number(c) < Number(b); case "GREATER_OR_EQUAL": - return Number(d) >= Number(e); + return Number(c) >= Number(b); case "LESS_OR_EQUAL": - return Number(d) <= Number(e); + return Number(c) <= Number(b); } }; Blockly.Blocks.show = {init:function() { @@ -3330,9 +3494,9 @@ Blockly.Blocks.show = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.show = function(b, a) { - b.setVisible(!0); - return a.callReturn(); +Entry.block.show = function(a, b) { + a.setVisible(!0); + return b.callReturn(); }; Blockly.Blocks.hide = {init:function() { this.setColour("#EC4466"); @@ -3341,9 +3505,9 @@ Blockly.Blocks.hide = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hide = function(b, a) { - b.setVisible(!1); - return a.callReturn(); +Entry.block.hide = function(a, b) { + a.setVisible(!1); + return b.callReturn(); }; Blockly.Blocks.dialog_time = {init:function() { this.setColour("#EC4466"); @@ -3358,20 +3522,20 @@ Blockly.Blocks.dialog_time = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.dialog_time = 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; +Entry.block.dialog_time = function(a, b) { + if (!b.isStart) { + var c = b.getNumberValue("SECOND", b), d = b.getStringValue("VALUE", b), e = b.getField("OPTION", b); + b.isStart = !0; + b.timeFlag = 1; d || "number" == typeof d || (d = " "); d = Entry.convertToRoundedDecimals(d, 3); - new Entry.Dialog(b, d, e); - b.syncDialogVisible(b.getVisible()); + new Entry.Dialog(a, d, e); + a.syncDialogVisible(a.getVisible()); setTimeout(function() { - a.timeFlag = 0; + b.timeFlag = 0; }, 1E3 * c); } - return 0 == a.timeFlag ? (delete a.timeFlag, delete a.isStart, b.dialog && b.dialog.remove(), a.callReturn()) : a; + return 0 == b.timeFlag ? (delete b.timeFlag, delete b.isStart, a.dialog && a.dialog.remove(), b.callReturn()) : b; }; Blockly.Blocks.dialog = {init:function() { this.setColour("#EC4466"); @@ -3384,13 +3548,13 @@ Blockly.Blocks.dialog = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.dialog = function(b, a) { - var c = a.getStringValue("VALUE", a); +Entry.block.dialog = function(a, b) { + var c = b.getStringValue("VALUE", b); 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(); + var d = b.getField("OPTION", b), c = Entry.convertToRoundedDecimals(c, 3); + new Entry.Dialog(a, c, d); + a.syncDialogVisible(a.getVisible()); + return b.callReturn(); }; Blockly.Blocks.remove_dialog = {init:function() { this.setColour("#EC4466"); @@ -3399,9 +3563,9 @@ Blockly.Blocks.remove_dialog = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.remove_dialog = function(b, a) { - b.dialog && b.dialog.remove(); - return a.callReturn(); +Entry.block.remove_dialog = function(a, b) { + a.dialog && a.dialog.remove(); + return b.callReturn(); }; Blockly.Blocks.change_to_nth_shape = {init:function() { this.setColour("#EC4466"); @@ -3412,10 +3576,10 @@ Blockly.Blocks.change_to_nth_shape = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.change_to_nth_shape = function(b, a) { - var c = a.getField("VALUE", a), c = b.parent.getPicture(c); - b.setImage(c); - return a.callReturn(); +Entry.block.change_to_nth_shape = function(a, b) { + var c = b.getField("VALUE", b), c = a.parent.getPicture(c); + a.setImage(c); + return b.callReturn(); }; Blockly.Blocks.change_to_next_shape = {init:function() { this.setColour("#EC4466"); @@ -3424,11 +3588,11 @@ Blockly.Blocks.change_to_next_shape = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.change_to_next_shape = function(b, a) { +Entry.block.change_to_next_shape = function(a, b) { var c; - c = a.fields && "prev" === a.getStringField("DRIECTION") ? b.parent.getPrevPicture(b.picture.id) : b.parent.getNextPicture(b.picture.id); - b.setImage(c); - return a.callReturn(); + c = b.fields && "prev" === b.getStringField("DRIECTION") ? a.parent.getPrevPicture(a.picture.id) : a.parent.getNextPicture(a.picture.id); + a.setImage(c); + return b.callReturn(); }; Blockly.Blocks.set_effect_volume = {init:function() { this.setColour("#EC4466"); @@ -3441,11 +3605,11 @@ Blockly.Blocks.set_effect_volume = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.set_effect_volume = 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(); +Entry.block.set_effect_volume = function(a, b) { + var c = b.getField("EFFECT", b), d = b.getNumberValue("VALUE", b); + "color" == c ? a.effect.hue = d + a.effect.hue : "lens" != c && "swriling" != c && "pixel" != c && "mosaic" != c && ("brightness" == c ? a.effect.brightness = d + a.effect.brightness : "blur" != c && "opacity" == c && (a.effect.alpha += d / 100)); + a.applyFilter(); + return b.callReturn(); }; Blockly.Blocks.set_effect = {init:function() { this.setColour("#EC4466"); @@ -3458,11 +3622,11 @@ Blockly.Blocks.set_effect = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.set_effect = 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(); +Entry.block.set_effect = function(a, b) { + var c = b.getField("EFFECT", b), d = b.getNumberValue("VALUE", b); + "color" == c ? a.effect.hue = d : "lens" != c && "swriling" != c && "pixel" != c && "mosaic" != c && ("brightness" == c ? a.effect.brightness = d : "blur" != c && "opacity" == c && (a.effect.alpha = d / 100)); + a.applyFilter(); + return b.callReturn(); }; Blockly.Blocks.erase_all_effects = {init:function() { this.setColour("#EC4466"); @@ -3471,9 +3635,9 @@ Blockly.Blocks.erase_all_effects = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.erase_all_effects = function(b, a) { - b.resetFilter(); - return a.callReturn(); +Entry.block.erase_all_effects = function(a, b) { + a.resetFilter(); + return b.callReturn(); }; Blockly.Blocks.change_scale_percent = {init:function() { this.setColour("#EC4466"); @@ -3484,11 +3648,11 @@ Blockly.Blocks.change_scale_percent = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.change_scale_percent = function(b, a) { - var c = (a.getNumberValue("VALUE", a) + 100) / 100; - b.setScaleX(b.getScaleX() * c); - b.setScaleY(b.getScaleY() * c); - return a.callReturn(); +Entry.block.change_scale_percent = function(a, b) { + var c = (b.getNumberValue("VALUE", b) + 100) / 100; + a.setScaleX(a.getScaleX() * c); + a.setScaleY(a.getScaleY() * c); + return b.callReturn(); }; Blockly.Blocks.set_scale_percent = {init:function() { this.setColour("#EC4466"); @@ -3499,11 +3663,11 @@ Blockly.Blocks.set_scale_percent = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.set_scale_percent = 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(); +Entry.block.set_scale_percent = function(a, b) { + var c = b.getNumberValue("VALUE", b) / 100, d = a.snapshot_; + a.setScaleX(c * d.scaleX); + a.setScaleY(c * d.scaleY); + return b.callReturn(); }; Blockly.Blocks.change_scale_size = {init:function() { this.setColour("#EC4466"); @@ -3514,10 +3678,10 @@ Blockly.Blocks.change_scale_size = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.change_scale_size = function(b, a) { - var c = a.getNumberValue("VALUE", a); - b.setSize(b.getSize() + c); - return a.callReturn(); +Entry.block.change_scale_size = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.setSize(a.getSize() + c); + return b.callReturn(); }; Blockly.Blocks.set_scale_size = {init:function() { this.setColour("#EC4466"); @@ -3528,10 +3692,10 @@ Blockly.Blocks.set_scale_size = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.set_scale_size = function(b, a) { - var c = a.getNumberValue("VALUE", a); - b.setSize(c); - return a.callReturn(); +Entry.block.set_scale_size = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.setSize(c); + return b.callReturn(); }; Blockly.Blocks.flip_y = {init:function() { this.setColour("#EC4466"); @@ -3540,9 +3704,9 @@ Blockly.Blocks.flip_y = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.flip_y = function(b, a) { - b.setScaleX(-1 * b.getScaleX()); - return a.callReturn(); +Entry.block.flip_y = function(a, b) { + a.setScaleX(-1 * a.getScaleX()); + return b.callReturn(); }; Blockly.Blocks.flip_x = {init:function() { this.setColour("#EC4466"); @@ -3551,9 +3715,9 @@ Blockly.Blocks.flip_x = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.flip_x = function(b, a) { - b.setScaleY(-1 * b.getScaleY()); - return a.callReturn(); +Entry.block.flip_x = function(a, b) { + a.setScaleY(-1 * a.getScaleY()); + return b.callReturn(); }; Blockly.Blocks.set_object_order = {init:function() { this.setColour("#EC4466"); @@ -3564,10 +3728,11 @@ Blockly.Blocks.set_object_order = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.set_object_order = function(b, a) { - var c = a.getField("VALUE", a), d = Entry.container.getCurrentObjects().indexOf(b.parent); - if (-1 < d) { - return Entry.container.moveElementByBlock(d, c), a.callReturn(); +Entry.block.set_object_order = function(a, b) { + var c = b.getField("VALUE", b); + a = Entry.container.getCurrentObjects().indexOf(a.parent); + if (-1 < a) { + return Entry.container.moveElementByBlock(a, c), b.callReturn(); } throw Error("object is not available"); }; @@ -3579,8 +3744,8 @@ Blockly.Blocks.get_pictures = {init:function() { this.setOutput(!0, "String"); this.setInputsInline(!0); }}; -Entry.block.get_pictures = function(b, a) { - return a.getStringField("VALUE"); +Entry.block.get_pictures = function(a, b) { + return b.getStringField("VALUE"); }; Blockly.Blocks.change_to_some_shape = {init:function() { this.setColour("#EC4466"); @@ -3591,12 +3756,12 @@ Blockly.Blocks.change_to_some_shape = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.change_to_some_shape = function(b, a) { - var c = a.getStringValue("VALUE"); +Entry.block.change_to_some_shape = function(a, b) { + var c = b.getStringValue("VALUE"); Entry.parseNumber(c); - c = b.parent.getPicture(c); - b.setImage(c); - return a.callReturn(); + c = a.parent.getPicture(c); + a.setImage(c); + return b.callReturn(); }; Blockly.Blocks.add_effect_amount = {init:function() { this.setColour("#EC4466"); @@ -3609,11 +3774,11 @@ Blockly.Blocks.add_effect_amount = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.add_effect_amount = function(b, a) { - var c = a.getField("EFFECT", a), d = a.getNumberValue("VALUE", a); - "color" == c ? b.effect.hsv = d + b.effect.hsv : "brightness" == c ? b.effect.brightness = d + b.effect.brightness : "transparency" == c && (b.effect.alpha -= d / 100); - b.applyFilter(); - return a.callReturn(); +Entry.block.add_effect_amount = function(a, b) { + var c = b.getField("EFFECT", b), d = b.getNumberValue("VALUE", b); + "color" == c ? a.effect.hsv = d + a.effect.hsv : "brightness" == c ? a.effect.brightness = d + a.effect.brightness : "transparency" == c && (a.effect.alpha -= d / 100); + a.applyFilter(); + return b.callReturn(); }; Blockly.Blocks.change_effect_amount = {init:function() { this.setColour("#EC4466"); @@ -3626,11 +3791,11 @@ Blockly.Blocks.change_effect_amount = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.change_effect_amount = function(b, a) { - var c = a.getField("EFFECT", a), d = a.getNumberValue("VALUE", a); - "color" == c ? b.effect.hsv = d : "brightness" == c ? b.effect.brightness = d : "transparency" == c && (b.effect.alpha = 1 - d / 100); - b.applyFilter(); - return a.callReturn(); +Entry.block.change_effect_amount = function(a, b) { + var c = b.getField("EFFECT", b), d = b.getNumberValue("VALUE", b); + "color" == c ? a.effect.hsv = d : "brightness" == c ? a.effect.brightness = d : "transparency" == c && (a.effect.alpha = 1 - d / 100); + a.applyFilter(); + return b.callReturn(); }; Blockly.Blocks.set_effect_amount = {init:function() { this.setColour("#EC4466"); @@ -3643,11 +3808,11 @@ Blockly.Blocks.set_effect_amount = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.set_effect_amount = function(b, a) { - var c = a.getField("EFFECT", a), d = a.getNumberValue("VALUE", a); - "color" == c ? b.effect.hue = d + b.effect.hue : "brightness" == c ? b.effect.brightness = d + b.effect.brightness : "transparency" == c && (b.effect.alpha -= d / 100); - b.applyFilter(); - return a.callReturn(); +Entry.block.set_effect_amount = function(a, b) { + var c = b.getField("EFFECT", b), d = b.getNumberValue("VALUE", b); + "color" == c ? a.effect.hue = d + a.effect.hue : "brightness" == c ? a.effect.brightness = d + a.effect.brightness : "transparency" == c && (a.effect.alpha -= d / 100); + a.applyFilter(); + return b.callReturn(); }; Blockly.Blocks.set_entity_effect = {init:function() { this.setColour("#EC4466"); @@ -3660,11 +3825,11 @@ Blockly.Blocks.set_entity_effect = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.set_entity_effect = function(b, a) { - var c = a.getField("EFFECT", a), d = a.getNumberValue("VALUE", a); - "color" == c ? b.effect.hue = d : "brightness" == c ? b.effect.brightness = d : "transparency" == c && (b.effect.alpha = 1 - d / 100); - b.applyFilter(); - return a.callReturn(); +Entry.block.set_entity_effect = function(a, b) { + var c = b.getField("EFFECT", b), d = b.getNumberValue("VALUE", b); + "color" == c ? a.effect.hue = d : "brightness" == c ? a.effect.brightness = d : "transparency" == c && (a.effect.alpha = 1 - d / 100); + a.applyFilter(); + return b.callReturn(); }; Blockly.Blocks.change_object_index = {init:function() { this.setColour("#EC4466"); @@ -3674,9 +3839,11 @@ Blockly.Blocks.change_object_index = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.change_object_index = function(b, a) { - var c, d = a.getField("LOCATION", a), e = Entry.container.getCurrentObjects(), f = e.indexOf(b.parent), e = e.length - 1; - if (0 > f) { +Entry.block.change_object_index = function(a, b) { + var c, d = b.getField("LOCATION", b), e = Entry.container.getCurrentObjects(); + a = e.indexOf(a.parent); + e = e.length - 1; + if (0 > a) { throw Error("object is not available for current scene"); } switch(d) { @@ -3684,16 +3851,16 @@ Entry.block.change_object_index = function(b, a) { c = 0; break; case "FORWARD": - c = Math.max(0, f - 1); + c = Math.max(0, a - 1); break; case "BACKWARD": - c = Math.min(e, f + 1); + c = Math.min(e, a + 1); break; case "BACK": c = e; } - Entry.container.moveElementByBlock(f, c); - return a.callReturn(); + Entry.container.moveElementByBlock(a, c); + return b.callReturn(); }; Blockly.Blocks.move_direction = {init:function() { this.setColour("#A751E3"); @@ -3704,12 +3871,12 @@ Blockly.Blocks.move_direction = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.move_direction = function(b, a) { - var c = a.getNumberValue("VALUE", a); - b.setX(b.getX() + c * Math.cos((b.getRotation() + b.getDirection() - 90) / 180 * Math.PI)); - b.setY(b.getY() - c * Math.sin((b.getRotation() + b.getDirection() - 90) / 180 * Math.PI)); - b.brush && !b.brush.stop && b.brush.lineTo(b.getX(), -1 * b.getY()); - return a.callReturn(); +Entry.block.move_direction = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.setX(a.getX() + c * Math.cos((a.getRotation() + a.getDirection() - 90) / 180 * Math.PI)); + a.setY(a.getY() - c * Math.sin((a.getRotation() + a.getDirection() - 90) / 180 * Math.PI)); + a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()); + return b.callReturn(); }; Blockly.Blocks.move_x = {init:function() { this.setColour("#A751E3"); @@ -3720,11 +3887,11 @@ Blockly.Blocks.move_x = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.move_x = function(b, a) { - var c = a.getNumberValue("VALUE", a); - b.setX(b.getX() + c); - b.brush && !b.brush.stop && b.brush.lineTo(b.getX(), -1 * b.getY()); - return a.callReturn(); +Entry.block.move_x = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.setX(a.getX() + c); + a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()); + return b.callReturn(); }; Blockly.Blocks.move_y = {init:function() { this.setColour("#A751E3"); @@ -3735,11 +3902,11 @@ Blockly.Blocks.move_y = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.move_y = function(b, a) { - var c = a.getNumberValue("VALUE", a); - b.setY(b.getY() + c); - b.brush && !b.brush.stop && b.brush.lineTo(b.getX(), -1 * b.getY()); - return a.callReturn(); +Entry.block.move_y = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.setY(a.getY() + c); + a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()); + return b.callReturn(); }; Blockly.Blocks.locate_xy_time = {init:function() { this.setColour("#A751E3"); @@ -3754,29 +3921,29 @@ Blockly.Blocks.locate_xy_time = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.locate_xy_time = function(b, a) { - if (!a.isStart) { +Entry.block.locate_xy_time = function(a, b) { + if (!b.isStart) { var c; - c = a.getNumberValue("VALUE1", a); - a.isStart = !0; - a.frameCount = Math.floor(c * Entry.FPS); - a.x = a.getNumberValue("VALUE2", a); - a.y = a.getNumberValue("VALUE3", a); - } - if (0 != a.frameCount) { - c = a.x - b.getX(); - var d = a.y - b.getY(); - c /= a.frameCount; - d /= a.frameCount; - b.setX(b.getX() + c); - b.setY(b.getY() + d); - a.frameCount--; - b.brush && !b.brush.stop && b.brush.lineTo(b.getX(), -1 * b.getY()); - return a; + c = b.getNumberValue("VALUE1", b); + b.isStart = !0; + b.frameCount = Math.floor(c * Entry.FPS); + b.x = b.getNumberValue("VALUE2", b); + b.y = b.getNumberValue("VALUE3", b); + } + if (0 != b.frameCount) { + c = b.x - a.getX(); + var d = b.y - a.getY(); + c /= b.frameCount; + d /= b.frameCount; + a.setX(a.getX() + c); + a.setY(a.getY() + d); + b.frameCount--; + a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()); + return b; } - delete a.isStart; - delete a.frameCount; - return a.callReturn(); + delete b.isStart; + delete b.frameCount; + return b.callReturn(); }; Blockly.Blocks.rotate_by_angle = {init:function() { this.setColour("#A751E3"); @@ -3787,10 +3954,10 @@ Blockly.Blocks.rotate_by_angle = {init:function() { 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(); +Entry.block.rotate_by_angle = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.setRotation(a.getRotation() + c); + return b.callReturn(); }; Blockly.Blocks.rotate_by_angle_dropdown = {init:function() { this.setColour("#A751E3"); @@ -3800,10 +3967,10 @@ Blockly.Blocks.rotate_by_angle_dropdown = {init:function() { 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(a, b) { + var c = b.getField("VALUE", b); + a.setRotation(a.getRotation() + Number(c)); + return b.callReturn(); }; Blockly.Blocks.see_angle = {init:function() { this.setColour("#A751E3"); @@ -3814,10 +3981,10 @@ Blockly.Blocks.see_angle = {init:function() { 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(); +Entry.block.see_angle = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.setDirection(c); + return b.callReturn(); }; Blockly.Blocks.see_direction = {init:function() { this.setColour("#A751E3"); @@ -3828,10 +3995,10 @@ Blockly.Blocks.see_direction = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.see_direction = function(b, a) { - var c = a.getField("VALUE", a), d = Entry.container.getEntity(c), c = d.getX() - b.getX(), d = d.getY() - b.getY(); - 0 <= c ? b.setRotation(Math.atan(d / c) / Math.PI * 180 + 90) : b.setRotation(Math.atan(d / c) / Math.PI * 180 + 270); - return a.callReturn(); +Entry.block.see_direction = function(a, b) { + var c = b.getField("VALUE", b), d = Entry.container.getEntity(c), c = d.getX() - a.getX(), d = d.getY() - a.getY(); + 0 <= c ? a.setRotation(Math.atan(d / c) / Math.PI * 180 + 90) : a.setRotation(Math.atan(d / c) / Math.PI * 180 + 270); + return b.callReturn(); }; Blockly.Blocks.locate_xy = {init:function() { this.setColour("#A751E3"); @@ -3844,13 +4011,13 @@ Blockly.Blocks.locate_xy = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.locate_xy = function(b, a) { - var c = a.getNumberValue("VALUE1", a); - b.setX(c); - c = a.getNumberValue("VALUE2", a); - b.setY(c); - b.brush && !b.brush.stop && b.brush.lineTo(b.getX(), -1 * b.getY()); - return a.callReturn(); +Entry.block.locate_xy = function(a, b) { + var c = b.getNumberValue("VALUE1", b); + a.setX(c); + c = b.getNumberValue("VALUE2", b); + a.setY(c); + a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()); + return b.callReturn(); }; Blockly.Blocks.locate_x = {init:function() { this.setColour("#A751E3"); @@ -3861,11 +4028,11 @@ Blockly.Blocks.locate_x = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.locate_x = function(b, a) { - var c = a.getNumberValue("VALUE", a); - b.setX(c); - b.brush && !b.brush.stop && b.brush.lineTo(b.getX(), -1 * b.getY()); - return a.callReturn(); +Entry.block.locate_x = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.setX(c); + a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()); + return b.callReturn(); }; Blockly.Blocks.locate_y = {init:function() { this.setColour("#A751E3"); @@ -3876,11 +4043,11 @@ Blockly.Blocks.locate_y = {init:function() { 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(); +Entry.block.locate_y = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.setY(c); + a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()); + return b.callReturn(); }; Blockly.Blocks.locate = {init:function() { this.setColour("#A751E3"); @@ -3891,13 +4058,13 @@ Blockly.Blocks.locate = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.locate = function(b, a) { - var c = a.getField("VALUE", a), d; +Entry.block.locate = function(a, b) { + var c = b.getField("VALUE", b), 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(); + a.setX(Number(c)); + a.setY(Number(d)); + a.brush && !a.brush.stop && a.brush.lineTo(c, -1 * d); + return b.callReturn(); }; Blockly.Blocks.move_xy_time = {init:function() { this.setColour("#A751E3"); @@ -3912,22 +4079,22 @@ Blockly.Blocks.move_xy_time = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.move_xy_time = function(b, a) { - if (!a.isStart) { +Entry.block.move_xy_time = function(a, b) { + if (!b.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; + c = b.getNumberValue("VALUE1", b); + var d = b.getNumberValue("VALUE2", b), e = b.getNumberValue("VALUE3", b); + b.isStart = !0; + b.frameCount = Math.floor(c * Entry.FPS); + b.dX = d / b.frameCount; + b.dY = e / b.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; + if (0 != b.frameCount) { + return a.setX(a.getX() + b.dX), a.setY(a.getY() + b.dY), b.frameCount--, a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()), b; } - delete a.isStart; - delete a.frameCount; - return a.callReturn(); + delete b.isStart; + delete b.frameCount; + return b.callReturn(); }; Blockly.Blocks.locate_time = {init:function() { this.setColour("#A751E3"); @@ -3951,21 +4118,21 @@ Blockly.Blocks.rotate_by_angle_time = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.rotate_by_angle_time = function(b, a) { - if (!a.isStart) { +Entry.block.rotate_by_angle_time = function(a, b) { + if (!b.isStart) { var c; - c = a.getNumberValue("VALUE", a); - var d = a.getNumberField("VALUE", a); - a.isStart = !0; - a.frameCount = Math.floor(c * Entry.FPS); - a.dAngle = d / a.frameCount; + c = b.getNumberValue("VALUE", b); + var d = b.getNumberField("VALUE", b); + b.isStart = !0; + b.frameCount = Math.floor(c * Entry.FPS); + b.dAngle = d / b.frameCount; } - if (0 != a.frameCount) { - return b.setRotation(b.getRotation() + a.dAngle), a.frameCount--, a; + if (0 != b.frameCount) { + return a.setRotation(a.getRotation() + b.dAngle), b.frameCount--, b; } - delete a.isStart; - delete a.frameCount; - return a.callReturn(); + delete b.isStart; + delete b.frameCount; + return b.callReturn(); }; Blockly.Blocks.bounce_when = {init:function() { this.setColour("#A751E3"); @@ -3983,22 +4150,23 @@ Blockly.Blocks.bounce_wall = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.bounce_wall = function(b, a) { - var c = b.parent.getRotateMethod(), d = "free" == c ? (b.getRotation() + b.getDirection()).mod(360) : b.getDirection(), e = Entry.Utils.COLLISION.NONE; +Entry.block.bounce_wall = function(a, b) { + var c = a.parent.getRotateMethod(), d = "free" == c ? (a.getRotation() + a.getDirection()).mod(360) : a.getDirection(), e; if (90 > d && 0 <= d || 360 > d && 270 <= d) { - var e = b.collision == Entry.Utils.COLLISION.UP, f = ndgmr.checkPixelCollision(Entry.stage.wall.up, b.object, 0, !1); - !f && e && (b.collision = Entry.Utils.COLLISION.NONE); + e = a.collision == Entry.Utils.COLLISION.UP; + var f = ndgmr.checkPixelCollision(Entry.stage.wall.up, a.object, 0, !1); + !f && e && (a.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 && e && (f = !1), f && ("free" == c ? b.setRotation(-b.getRotation() - 2 * b.getDirection() + 180) : b.setDirection(-b.getDirection() + 180), b.collision = + f ? ("free" == c ? a.setRotation(-a.getRotation() - 2 * a.getDirection() + 180) : a.setDirection(-a.getDirection() + 180), a.collision = Entry.Utils.COLLISION.UP) : (e = a.collision == Entry.Utils.COLLISION.DOWN, f = ndgmr.checkPixelCollision(Entry.stage.wall.down, a.object, 0, !1), !f && e && (a.collision = Entry.Utils.COLLISION.NONE), f && e && (f = !1), f && ("free" == c ? a.setRotation(-a.getRotation() - 2 * a.getDirection() + 180) : a.setDirection(-a.getDirection() + 180), a.collision = Entry.Utils.COLLISION.DOWN)); } else { - 270 > d && 90 <= d && (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 && e && (f = !1), f ? ("free" == c ? b.setRotation(-b.getRotation() - 2 * b.getDirection() + 180) : b.setDirection(-b.getDirection() + 180), b.collision = Entry.Utils.COLLISION.DOWN) : (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))); + 270 > d && 90 <= d && (e = a.collision == Entry.Utils.COLLISION.DOWN, f = ndgmr.checkPixelCollision(Entry.stage.wall.down, a.object, 0, !1), !f && e && (a.collision = Entry.Utils.COLLISION.NONE), f && e && (f = !1), f ? ("free" == c ? a.setRotation(-a.getRotation() - 2 * a.getDirection() + 180) : a.setDirection(-a.getDirection() + 180), a.collision = Entry.Utils.COLLISION.DOWN) : (e = a.collision == Entry.Utils.COLLISION.UP, f = ndgmr.checkPixelCollision(Entry.stage.wall.up, a.object, 0, !1), + !f && e && (a.collision = Entry.Utils.COLLISION.NONE), f && e && (f = !1), f && ("free" == c ? a.setRotation(-a.getRotation() - 2 * a.getDirection() + 180) : a.setDirection(-a.getDirection() + 180), a.collision = Entry.Utils.COLLISION.UP))); } - 360 > d && 180 <= d ? (e = b.collision == Entry.Utils.COLLISION.LEFT, d = ndgmr.checkPixelCollision(Entry.stage.wall.left, b.object, 0, !1), !d && e && (b.collision = Entry.Utils.COLLISION.NONE), d && e && (d = !1), d ? ("free" == c ? b.setRotation(-b.getRotation() - 2 * b.getDirection()) : b.setDirection(-b.getDirection() + 360), b.collision = Entry.Utils.COLLISION.LEFT) : (e = b.collision == Entry.Utils.COLLISION.RIGHT, d = ndgmr.checkPixelCollision(Entry.stage.wall.right, b.object, 0, !1), !d && - e && (b.collision = Entry.Utils.COLLISION.NONE), d && e && (d = !1), d && ("free" == c ? b.setRotation(-b.getRotation() - 2 * b.getDirection()) : b.setDirection(-b.getDirection() + 360), b.collision = Entry.Utils.COLLISION.RIGHT))) : 180 > d && 0 <= d && (e = b.collision == Entry.Utils.COLLISION.RIGHT, d = ndgmr.checkPixelCollision(Entry.stage.wall.right, b.object, 0, !1), !d && e && (b.collision = Entry.Utils.COLLISION.NONE), d && e && (d = !1), d ? ("free" == c ? b.setRotation(-b.getRotation() - - 2 * b.getDirection()) : b.setDirection(-b.getDirection() + 360), b.collision = Entry.Utils.COLLISION.RIGHT) : (e = b.collision == Entry.Utils.COLLISION.LEFT, d = ndgmr.checkPixelCollision(Entry.stage.wall.left, b.object, 0, !1), !d && e && (b.collision = Entry.Utils.COLLISION.NONE), d && e && (d = !1), d && ("free" == c ? b.setRotation(-b.getRotation() - 2 * b.getDirection()) : b.setDirection(-b.getDirection() + 360), b.collision = Entry.Utils.COLLISION.LEFT))); - return a.callReturn(); + 360 > d && 180 <= d ? (e = a.collision == Entry.Utils.COLLISION.LEFT, d = ndgmr.checkPixelCollision(Entry.stage.wall.left, a.object, 0, !1), !d && e && (a.collision = Entry.Utils.COLLISION.NONE), d && e && (d = !1), d ? ("free" == c ? a.setRotation(-a.getRotation() - 2 * a.getDirection()) : a.setDirection(-a.getDirection() + 360), a.collision = Entry.Utils.COLLISION.LEFT) : (e = a.collision == Entry.Utils.COLLISION.RIGHT, d = ndgmr.checkPixelCollision(Entry.stage.wall.right, a.object, 0, !1), !d && + e && (a.collision = Entry.Utils.COLLISION.NONE), d && e && (d = !1), d && ("free" == c ? a.setRotation(-a.getRotation() - 2 * a.getDirection()) : a.setDirection(-a.getDirection() + 360), a.collision = Entry.Utils.COLLISION.RIGHT))) : 180 > d && 0 <= d && (e = a.collision == Entry.Utils.COLLISION.RIGHT, d = ndgmr.checkPixelCollision(Entry.stage.wall.right, a.object, 0, !1), !d && e && (a.collision = Entry.Utils.COLLISION.NONE), d && e && (d = !1), d ? ("free" == c ? a.setRotation(-a.getRotation() - + 2 * a.getDirection()) : a.setDirection(-a.getDirection() + 360), a.collision = Entry.Utils.COLLISION.RIGHT) : (e = a.collision == Entry.Utils.COLLISION.LEFT, d = ndgmr.checkPixelCollision(Entry.stage.wall.left, a.object, 0, !1), !d && e && (a.collision = Entry.Utils.COLLISION.NONE), d && e && (d = !1), d && ("free" == c ? a.setRotation(-a.getRotation() - 2 * a.getDirection()) : a.setDirection(-a.getDirection() + 360), a.collision = Entry.Utils.COLLISION.LEFT))); + return b.callReturn(); }; Blockly.Blocks.flip_arrow_horizontal = {init:function() { this.setColour("#A751E3"); @@ -4007,9 +4175,9 @@ Blockly.Blocks.flip_arrow_horizontal = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.flip_arrow_horizontal = function(b, a) { - b.setDirection(b.getDirection() + 180); - return a.callReturn(); +Entry.block.flip_arrow_horizontal = function(a, b) { + a.setDirection(a.getDirection() + 180); + return b.callReturn(); }; Blockly.Blocks.flip_arrow_vertical = {init:function() { this.setColour("#A751E3"); @@ -4018,9 +4186,9 @@ Blockly.Blocks.flip_arrow_vertical = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.flip_arrow_vertical = function(b, a) { - b.setDirection(b.getDirection() + 180); - return a.callReturn(); +Entry.block.flip_arrow_vertical = function(a, b) { + a.setDirection(a.getDirection() + 180); + return b.callReturn(); }; Blockly.Blocks.see_angle_object = {init:function() { this.setColour("#A751E3"); @@ -4031,16 +4199,16 @@ Blockly.Blocks.see_angle_object = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.see_angle_object = function(b, a) { - var c = a.getField("VALUE", a), d = b.getX(), e = b.getY(); - if (b.parent.id == c) { - return a.callReturn(); +Entry.block.see_angle_object = function(a, b) { + var c = b.getField("VALUE", b), d = a.getX(), e = a.getY(); + if (a.parent.id == c) { + return b.callReturn(); } "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(); + e = 0 === d && 0 === e ? a.getDirection() + a.getRotation() : 0 <= d ? -Math.atan(e / d) / Math.PI * 180 + 90 : -Math.atan(e / d) / Math.PI * 180 + 270; + d = a.getDirection() + a.getRotation(); + a.setRotation(a.getRotation() + e - d); + return b.callReturn(); }; Blockly.Blocks.see_angle_direction = {init:function() { this.setColour("#A751E3"); @@ -4051,10 +4219,10 @@ Blockly.Blocks.see_angle_direction = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.see_angle_direction = function(b, a) { - var c = a.getNumberValue("VALUE", a), d = b.getDirection() + b.getRotation(); - b.setRotation(b.getRotation() + c - d); - return a.callReturn(); +Entry.block.see_angle_direction = function(a, b) { + var c = b.getNumberValue("VALUE", b), d = a.getDirection() + a.getRotation(); + a.setRotation(a.getRotation() + c - d); + return b.callReturn(); }; Blockly.Blocks.rotate_direction = {init:function() { this.setColour("#A751E3"); @@ -4065,10 +4233,10 @@ Blockly.Blocks.rotate_direction = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.rotate_direction = function(b, a) { - var c = a.getNumberValue("VALUE", a); - b.setDirection(c + b.getDirection()); - return a.callReturn(); +Entry.block.rotate_direction = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.setDirection(c + a.getDirection()); + return b.callReturn(); }; Blockly.Blocks.locate_object_time = {init:function() { this.setColour("#A751E3"); @@ -4081,25 +4249,25 @@ Blockly.Blocks.locate_object_time = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.locate_object_time = function(b, a) { - if (!a.isStart) { +Entry.block.locate_object_time = function(a, b) { + if (!b.isStart) { var c, d, e; - d = a.getField("TARGET", a); - c = a.getNumberValue("VALUE", a); + d = b.getField("TARGET", b); + c = b.getNumberValue("VALUE", b); 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; + "mouse" == d ? (d = e.x - a.getX(), e = e.y - a.getY()) : (e = Entry.container.getEntity(d), d = e.getX() - a.getX(), e = e.getY() - a.getY()), b.isStart = !0, b.frameCount = c, b.dX = d / b.frameCount, b.dY = e / b.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 = Number(e.x), e = Number(e.y)) : (e = Entry.container.getEntity(d), d = e.getX(), e = e.getY()), a.setX(d), a.setY(e), a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()), b.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; + if (0 != b.frameCount) { + return a.setX(a.getX() + b.dX), a.setY(a.getY() + b.dY), b.frameCount--, a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()), b; } - delete a.isStart; - delete a.frameCount; - return a.callReturn(); + delete b.isStart; + delete b.frameCount; + return b.callReturn(); }; Blockly.Blocks.rotate_absolute = {init:function() { this.setColour("#A751E3"); @@ -4110,10 +4278,10 @@ Blockly.Blocks.rotate_absolute = {init:function() { 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(); +Entry.block.rotate_absolute = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.setRotation(c); + return b.callReturn(); }; Blockly.Blocks.rotate_relative = {init:function() { this.setColour("#A751E3"); @@ -4124,10 +4292,10 @@ Blockly.Blocks.rotate_relative = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.rotate_relative = function(b, a) { - var c = a.getNumberValue("VALUE", a); - b.setRotation(c + b.getRotation()); - return a.callReturn(); +Entry.block.rotate_relative = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.setRotation(c + a.getRotation()); + return b.callReturn(); }; Blockly.Blocks.direction_absolute = {init:function() { this.setColour("#A751E3"); @@ -4138,10 +4306,10 @@ Blockly.Blocks.direction_absolute = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.direction_absolute = function(b, a) { - var c = a.getNumberValue("VALUE", a); - b.setDirection(c); - return a.callReturn(); +Entry.block.direction_absolute = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.setDirection(c); + return b.callReturn(); }; Blockly.Blocks.direction_relative = {init:function() { this.setColour("#A751E3"); @@ -4152,10 +4320,10 @@ Blockly.Blocks.direction_relative = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.direction_relative = function(b, a) { - var c = a.getNumberValue("VALUE", a); - b.setDirection(c + b.getDirection()); - return a.callReturn(); +Entry.block.direction_relative = function(a, b) { + var c = b.getNumberValue("VALUE", b); + a.setDirection(c + a.getDirection()); + return b.callReturn(); }; Blockly.Blocks.move_to_angle = {init:function() { this.setColour("#A751E3"); @@ -4168,12 +4336,12 @@ Blockly.Blocks.move_to_angle = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.move_to_angle = function(b, a) { - var c = a.getNumberValue("VALUE", a), d = a.getNumberValue("ANGLE", a); - b.setX(b.getX() + c * Math.cos((d - 90) / 180 * Math.PI)); - b.setY(b.getY() - c * Math.sin((d - 90) / 180 * Math.PI)); - b.brush && !b.brush.stop && b.brush.lineTo(b.getX(), -1 * b.getY()); - return a.callReturn(); +Entry.block.move_to_angle = function(a, b) { + var c = b.getNumberValue("VALUE", b), d = b.getNumberValue("ANGLE", b); + a.setX(a.getX() + c * Math.cos((d - 90) / 180 * Math.PI)); + a.setY(a.getY() - c * Math.sin((d - 90) / 180 * Math.PI)); + a.brush && !a.brush.stop && a.brush.lineTo(a.getX(), -1 * a.getY()); + return b.callReturn(); }; Blockly.Blocks.rotate_by_time = {init:function() { this.setColour("#A751E3"); @@ -4187,21 +4355,21 @@ Blockly.Blocks.rotate_by_time = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.rotate_by_time = function(b, a) { - if (!a.isStart) { +Entry.block.rotate_by_time = function(a, b) { + if (!b.isStart) { var c; - c = a.getNumberValue("VALUE", a); - var d = a.getNumberValue("ANGLE", a); - a.isStart = !0; - a.frameCount = Math.floor(c * Entry.FPS); - a.dAngle = d / a.frameCount; + c = b.getNumberValue("VALUE", b); + var d = b.getNumberValue("ANGLE", b); + b.isStart = !0; + b.frameCount = Math.floor(c * Entry.FPS); + b.dAngle = d / b.frameCount; } - if (0 != a.frameCount) { - return b.setRotation(b.getRotation() + a.dAngle), a.frameCount--, a; + if (0 != b.frameCount) { + return a.setRotation(a.getRotation() + b.dAngle), b.frameCount--, b; } - delete a.isStart; - delete a.frameCount; - return a.callReturn(); + delete b.isStart; + delete b.frameCount; + return b.callReturn(); }; Blockly.Blocks.direction_relative_duration = {init:function() { this.setColour("#A751E3"); @@ -4214,26 +4382,26 @@ Blockly.Blocks.direction_relative_duration = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.direction_relative_duration = function(b, a) { - if (!a.isStart) { +Entry.block.direction_relative_duration = function(a, b) { + if (!b.isStart) { var c; - c = a.getNumberValue("DURATION", a); - var d = a.getNumberValue("AMOUNT", a); - a.isStart = !0; - a.frameCount = Math.floor(c * Entry.FPS); - a.dDirection = d / a.frameCount; + c = b.getNumberValue("DURATION", b); + var d = b.getNumberValue("AMOUNT", b); + b.isStart = !0; + b.frameCount = Math.floor(c * Entry.FPS); + b.dDirection = d / b.frameCount; } - if (0 != a.frameCount) { - return b.setDirection(b.getDirection() + a.dDirection), a.frameCount--, a; + if (0 != b.frameCount) { + return a.setDirection(a.getDirection() + b.dDirection), b.frameCount--, b; } - delete a.isStart; - delete a.frameCount; - delete a.dDirection; - return a.callReturn(); + delete b.isStart; + delete b.frameCount; + delete b.dDirection; + return b.callReturn(); }; Entry.Neobot = {name:"neobot", LOCAL_MAP:["IN1", "IN2", "IN3", "IR", "BAT"], REMOTE_MAP:"OUT1 OUT2 OUT3 DCR DCL SND FND OPT".split(" "), setZero:function() { - for (var b in Entry.Neobot.REMOTE_MAP) { - Entry.hw.sendQueue[Entry.Neobot.REMOTE_MAP[b]] = 0; + for (var a in Entry.Neobot.REMOTE_MAP) { + Entry.hw.sendQueue[Entry.Neobot.REMOTE_MAP[a]] = 0; } Entry.hw.update(); }, name:"neobot", monitorTemplate:{imgPath:"hw/neobot.png", width:700, height:700, listPorts:{IR:{name:"\ub9ac\ubaa8\ucee8", type:"input", pos:{x:0, y:0}}, BAT:{name:"\ubca0\ud130\ub9ac", type:"input", pos:{x:0, y:0}}, SND:{name:Lang.Hw.buzzer, type:"output", pos:{x:0, y:0}}, FND:{name:"FND", type:"output", pos:{x:0, y:0}}}, ports:{IN1:{name:"IN1", type:"input", pos:{x:270, y:200}}, IN2:{name:"IN2", type:"input", pos:{x:325, y:200}}, IN3:{name:"IN3", type:"input", pos:{x:325, y:500}}, DCL:{name:"L-Motor", @@ -4244,9 +4412,9 @@ Blockly.Blocks.neobot_sensor_value = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.neobot_sensor_value = function(b, a) { - var c = a.getStringField("PORT"); - return Entry.hw.portData[c]; +Entry.block.neobot_sensor_value = function(a, b) { + a = b.getStringField("PORT"); + return Entry.hw.portData[a]; }; Blockly.Blocks.neobot_left_motor = {init:function() { this.setColour("#00979D"); @@ -4256,10 +4424,11 @@ Blockly.Blocks.neobot_left_motor = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.neobot_left_motor = function(b, a) { - var c = a.getNumberField("SPEED"), d = a.getNumberField("DIRECTION"); - Entry.hw.sendQueue.DCL = c + d; - return a.callReturn(); +Entry.block.neobot_left_motor = function(a, b) { + a = b.getNumberField("SPEED"); + var c = b.getNumberField("DIRECTION"); + Entry.hw.sendQueue.DCL = a + c; + return b.callReturn(); }; Blockly.Blocks.neobot_stop_left_motor = {init:function() { this.setColour("#00979D"); @@ -4268,9 +4437,9 @@ Blockly.Blocks.neobot_stop_left_motor = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.neobot_stop_left_motor = function(b, a) { +Entry.block.neobot_stop_left_motor = function(a, b) { Entry.hw.sendQueue.DCL = 0; - return a.callReturn(); + return b.callReturn(); }; Blockly.Blocks.neobot_right_motor = {init:function() { this.setColour("#00979D"); @@ -4280,10 +4449,11 @@ Blockly.Blocks.neobot_right_motor = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.neobot_right_motor = function(b, a) { - var c = a.getNumberField("SPEED"), d = a.getNumberField("DIRECTION"); - Entry.hw.sendQueue.DCR = c + d; - return a.callReturn(); +Entry.block.neobot_right_motor = function(a, b) { + a = b.getNumberField("SPEED"); + var c = b.getNumberField("DIRECTION"); + Entry.hw.sendQueue.DCR = a + c; + return b.callReturn(); }; Blockly.Blocks.neobot_stop_right_motor = {init:function() { this.setColour("#00979D"); @@ -4292,9 +4462,9 @@ Blockly.Blocks.neobot_stop_right_motor = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.neobot_stop_right_motor = function(b, a) { +Entry.block.neobot_stop_right_motor = function(a, b) { Entry.hw.sendQueue.DCR = 0; - return a.callReturn(); + return b.callReturn(); }; Blockly.Blocks.neobot_all_motor = {init:function() { this.setColour("#00979D"); @@ -4305,34 +4475,34 @@ Blockly.Blocks.neobot_all_motor = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.neobot_all_motor = function(b, a) { - a.getNumberField("TYPE"); - var c = a.getNumberField("SPEED"); - switch(a.getNumberField("DIRECTION")) { +Entry.block.neobot_all_motor = function(a, b) { + b.getNumberField("TYPE"); + a = b.getNumberField("SPEED"); + switch(b.getNumberField("DIRECTION")) { case 1: - Entry.hw.sendQueue.DCL = 16 + c; - Entry.hw.sendQueue.DCR = 16 + c; + Entry.hw.sendQueue.DCL = 16 + a; + Entry.hw.sendQueue.DCR = 16 + a; break; case 2: - Entry.hw.sendQueue.DCL = 32 + c; - Entry.hw.sendQueue.DCR = 32 + c; + Entry.hw.sendQueue.DCL = 32 + a; + Entry.hw.sendQueue.DCR = 32 + a; break; case 3: - Entry.hw.sendQueue.DCL = 32 + c; - Entry.hw.sendQueue.DCR = 16 + c; + Entry.hw.sendQueue.DCL = 32 + a; + Entry.hw.sendQueue.DCR = 16 + a; break; case 4: - Entry.hw.sendQueue.DCL = 16 + c; - Entry.hw.sendQueue.DCR = 32 + c; + Entry.hw.sendQueue.DCL = 16 + a; + Entry.hw.sendQueue.DCR = 32 + a; break; case 5: Entry.hw.sendQueue.DCL = 0; - Entry.hw.sendQueue.DCR = 16 + c; + Entry.hw.sendQueue.DCR = 16 + a; break; case 6: - Entry.hw.sendQueue.DCL = 16 + c, Entry.hw.sendQueue.DCR = 0; + Entry.hw.sendQueue.DCL = 16 + a, Entry.hw.sendQueue.DCR = 0; } - return a.callReturn(); + return b.callReturn(); }; Blockly.Blocks.neobot_set_servo = {init:function() { this.setColour("#00979D"); @@ -4342,12 +4512,13 @@ Blockly.Blocks.neobot_set_servo = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.neobot_set_servo = function(b, a) { - var c = a.getNumberField("PORT"), d = a.getNumberField("DEGREE"); - Entry.hw.sendQueue["OUT" + c] = d; - 3 === c && (c = 4); - Entry.hw.sendQueue.OPT |= c; - return a.callReturn(); +Entry.block.neobot_set_servo = function(a, b) { + a = b.getNumberField("PORT"); + var c = b.getNumberField("DEGREE"); + Entry.hw.sendQueue["OUT" + a] = c; + 3 === a && (a = 4); + Entry.hw.sendQueue.OPT |= a; + return b.callReturn(); }; Blockly.Blocks.neobot_set_output = {init:function() { this.setColour("#00979D"); @@ -4358,13 +4529,14 @@ Blockly.Blocks.neobot_set_output = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.neobot_set_output = function(b, a) { - var c = a.getStringField("PORT", a), d = a.getNumberValue("VALUE", a), e = c; - 0 > d ? d = 0 : 255 < d && (d = 255); - 3 === e && (e = 4); - Entry.hw.sendQueue["OUT" + c] = d; - Entry.hw.sendQueue.OPT &= ~e; - return a.callReturn(); +Entry.block.neobot_set_output = function(a, b) { + a = b.getStringField("PORT", b); + var c = b.getNumberValue("VALUE", b), d = a; + 0 > c ? c = 0 : 255 < c && (c = 255); + 3 === d && (d = 4); + Entry.hw.sendQueue["OUT" + a] = c; + Entry.hw.sendQueue.OPT &= ~d; + return b.callReturn(); }; Blockly.Blocks.neobot_set_fnd = {init:function() { this.setColour("#00979D"); @@ -4375,11 +4547,11 @@ Blockly.Blocks.neobot_set_fnd = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.neobot_set_fnd = function(b, a) { - var c = a.getNumberValue("VALUE", a); - 255 < c ? c = 255 : 0 > c && (c = 0); - Entry.hw.sendQueue.FND = c; - return a.callReturn(); +Entry.block.neobot_set_fnd = function(a, b) { + a = b.getNumberValue("VALUE", b); + 255 < a ? a = 255 : 0 > a && (a = 0); + Entry.hw.sendQueue.FND = a; + return b.callReturn(); }; Blockly.Blocks.neobot_play_note_for = {init:function() { this.setColour("#00979D"); @@ -4390,27 +4562,27 @@ Blockly.Blocks.neobot_play_note_for = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.neobot_play_note_for = function(b, a) { - var c = Entry.hw.sendQueue; - if (a.isStart) { - if (1 == a.timeFlag) { - return a; +Entry.block.neobot_play_note_for = function(a, b) { + a = Entry.hw.sendQueue; + if (b.isStart) { + if (1 == b.timeFlag) { + return b; } - delete a.timeFlag; - delete a.isStart; + delete b.timeFlag; + delete b.isStart; Entry.hw.sendQueue.SND = 0; Entry.engine.isContinue = !1; - return a.callReturn(); + return b.callReturn(); } - var d = a.getNumberField("NOTE", a), e = a.getNumberField("OCTAVE", a), f = a.getNumberField("DURATION", a), d = d + 12 * e; - a.isStart = !0; - a.timeFlag = 1; - 65 < d && (d = 65); - c.SND = d; + var c = b.getNumberField("NOTE", b), d = b.getNumberField("OCTAVE", b), e = b.getNumberField("DURATION", b), c = c + 12 * d; + b.isStart = !0; + b.timeFlag = 1; + 65 < c && (c = 65); + a.SND = c; setTimeout(function() { - a.timeFlag = 0; - }, 1 / f * 2E3); - return a; + b.timeFlag = 0; + }, 1 / e * 2E3); + return b; }; Entry.Robotis_carCont = {INSTRUCTION:{NONE:0, WRITE:3, READ:2}, CONTROL_TABLE:{CM_LED:[67, 1], CM_SPRING_RIGHT:[69, 1, 69, 2], CM_SPRING_LEFT:[70, 1, 69, 2], CM_SWITCH:[71, 1], CM_SOUND_DETECTED:[86, 1], CM_SOUND_DETECTING:[87, 1], CM_IR_LEFT:[91, 2, 91, 4], CM_IR_RIGHT:[93, 2, 91, 4], CM_CALIBRATION_LEFT:[95, 2], CM_CALIBRATION_RIGHT:[97, 2], AUX_MOTOR_SPEED_LEFT:[152, 2], AUX_MOTOR_SPEED_RIGHT:[154, 2]}, setZero:function() { this.setRobotisData([[Entry.Robotis_carCont.INSTRUCTION.WRITE, 152, 2, 0], [Entry.Robotis_carCont.INSTRUCTION.WRITE, 154, 2, 0]]); @@ -4419,47 +4591,47 @@ Entry.Robotis_carCont = {INSTRUCTION:{NONE:0, WRITE:3, READ:2}, CONTROL_TABLE:{C this.setRobotisData(null); Entry.hw.sendQueue.setZero = null; this.update(); -}, name:"robotis_carCont", delay:40, postCallReturn:function(b, a, c) { +}, name:"robotis_carCont", delay:40, postCallReturn:function(a, b, c) { if (0 >= c) { - return this.setRobotisData(a), this.update(), b.callReturn(); + return this.setRobotisData(b), this.update(), a.callReturn(); } - if (b.isStart) { - if (1 == b.timeFlag) { - return this.setRobotisData(null), b; + if (a.isStart) { + if (1 == a.timeFlag) { + return this.setRobotisData(null), a; } - delete b.timeFlag; - delete b.isStart; + delete a.timeFlag; + delete a.isStart; Entry.engine.isContinue = !1; this.update(); - return b.callReturn(); + return a.callReturn(); } - b.isStart = !0; - b.timeFlag = 1; - this.setRobotisData(a); + a.isStart = !0; + a.timeFlag = 1; + this.setRobotisData(b); setTimeout(function() { - b.timeFlag = 0; + a.timeFlag = 0; }, c); - return b; -}, wait:function(b, a) { - Entry.hw.socket.send(JSON.stringify(b)); - for (var c = (new Date).getTime(), d = c;d < c + a;) { - d = (new Date).getTime(); + return a; +}, wait:function(a, b) { + Entry.hw.socket.send(JSON.stringify(a)); + for (var c = a = (new Date).getTime();c < a + b;) { + c = (new Date).getTime(); } }, update:function() { Entry.hw.update(); - var b = Entry.hw.sendQueue.ROBOTIS_DATA; - b && b.forEach(function(a) { - a.send = !0; + var a = Entry.hw.sendQueue.ROBOTIS_DATA; + a && a.forEach(function(b) { + b.send = !0; }); this.setRobotisData(null); }, filterSendData:function() { - var b = Entry.hw.sendQueue.ROBOTIS_DATA; - return b ? b.filter(function(a) { - return !0 !== a.send; + var a = Entry.hw.sendQueue.ROBOTIS_DATA; + return a ? a.filter(function(b) { + return !0 !== b.send; }) : null; -}, setRobotisData:function(b) { - var a = this.filterSendData(); - Entry.hw.sendQueue.ROBOTIS_DATA = null == b ? a : a ? a.concat(b) : b; +}, setRobotisData:function(a) { + var b = this.filterSendData(); + Entry.hw.sendQueue.ROBOTIS_DATA = null == a ? b : b ? b.concat(a) : a; }}; Entry.Robotis_openCM70 = {INSTRUCTION:{NONE:0, WRITE:3, READ:2}, CONTROL_TABLE:{CM_LED_R:[79, 1], CM_LED_G:[80, 1], CM_LED_B:[81, 1], CM_BUZZER_INDEX:[84, 1], CM_BUZZER_TIME:[85, 1], CM_SOUND_DETECTED:[86, 1], CM_SOUND_DETECTING:[87, 1], CM_USER_BUTTON:[26, 1], CM_MOTION:[66, 1], AUX_SERVO_POSITION:[152, 2], AUX_IR:[168, 2], AUX_TOUCH:[202, 1], AUX_TEMPERATURE:[234, 1], AUX_ULTRASONIC:[242, 1], AUX_MAGNETIC:[250, 1], AUX_MOTION_DETECTION:[258, 1], AUX_COLOR:[266, 1], AUX_CUSTOM:[216, 2], AUX_BRIGHTNESS:[288, 2], AUX_HYDRO_THEMO_HUMIDITY:[274, 1], AUX_HYDRO_THEMO_TEMPER:[282, 1], AUX_SERVO_MODE:[126, 1], AUX_SERVO_SPEED:[136, 2], AUX_MOTOR_SPEED:[136, 2], AUX_LED_MODULE:[210, 1]}, setZero:function() { @@ -4482,13 +4654,14 @@ Blockly.Blocks.robotis_openCM70_cm_custom_value = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.robotis_openCM70_cm_custom_value = function(b, a) { - var c = Entry.Robotis_openCM70.INSTRUCTION.READ, d = 0, e = 0, f = 0, d = a.getStringField("SIZE"); - "BYTE" == d ? e = 1 : "WORD" == d ? e = 2 : "DWORD" == d && (e = 4); - f = d = a.getNumberValue("VALUE"); - Entry.Robotis_carCont.setRobotisData([[c, d, e, 0, e]]); +Entry.block.robotis_openCM70_cm_custom_value = function(a, b) { + a = Entry.Robotis_openCM70.INSTRUCTION.READ; + var c = 0, d = b.getStringField("SIZE"); + "BYTE" == d ? c = 1 : "WORD" == d ? c = 2 : "DWORD" == d && (c = 4); + b = b.getNumberValue("VALUE"); + Entry.Robotis_carCont.setRobotisData([[a, b, c, 0, c]]); Entry.Robotis_carCont.update(); - return Entry.hw.portData[f]; + return Entry.hw.portData[b]; }; Blockly.Blocks.robotis_openCM70_sensor_value = {init:function() { this.setColour("#00979D"); @@ -4498,20 +4671,22 @@ Blockly.Blocks.robotis_openCM70_sensor_value = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }, sensorList:function() { - var b = []; - b.push([Lang.Blocks.robotis_cm_sound_detected, "CM_SOUND_DETECTED"]); - b.push([Lang.Blocks.robotis_cm_sound_detecting, "CM_SOUND_DETECTING"]); - b.push([Lang.Blocks.robotis_cm_user_button, "CM_USER_BUTTON"]); - return b; + var a = []; + a.push([Lang.Blocks.robotis_cm_sound_detected, "CM_SOUND_DETECTED"]); + a.push([Lang.Blocks.robotis_cm_sound_detecting, "CM_SOUND_DETECTING"]); + a.push([Lang.Blocks.robotis_cm_user_button, "CM_USER_BUTTON"]); + return a; }}; -Entry.block.robotis_openCM70_sensor_value = function(b, a) { - var c = Entry.Robotis_openCM70.INSTRUCTION.READ, d = 0, e = 0, f = 0, g = 0, h = a.getStringField("SENSOR"); - "CM_SOUND_DETECTED" == h ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1], d = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1]) : "CM_SOUND_DETECTING" == h ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1], d = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0], - e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1]) : "CM_USER_BUTTON" == h && (f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1], d = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1]); - f += 0 * g; - Entry.Robotis_carCont.setRobotisData([[c, d, e, 0, g]]); +Entry.block.robotis_openCM70_sensor_value = function(a, b) { + a = Entry.Robotis_openCM70.INSTRUCTION.READ; + var c = 0, d = 0, e = 0, f = 0; + b = b.getStringField("SENSOR"); + "CM_SOUND_DETECTED" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1]) : "CM_SOUND_DETECTING" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0], + d = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1]) : "CM_USER_BUTTON" == b && (e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1]); + e += 0 * f; + Entry.Robotis_carCont.setRobotisData([[a, c, d, 0, f]]); Entry.Robotis_carCont.update(); - return Entry.hw.portData[f]; + return Entry.hw.portData[e]; }; Blockly.Blocks.robotis_openCM70_aux_sensor_value = {init:function() { this.setColour("#00979D"); @@ -4523,43 +4698,46 @@ Blockly.Blocks.robotis_openCM70_aux_sensor_value = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }, portList:function() { - var b = []; - b.push([Lang.Blocks.robotis_common_port_3, "PORT_3"]); - b.push([Lang.Blocks.robotis_common_port_4, "PORT_4"]); - b.push([Lang.Blocks.robotis_common_port_5, "PORT_5"]); - b.push([Lang.Blocks.robotis_common_port_6, "PORT_6"]); - return b; + var a = []; + a.push([Lang.Blocks.robotis_common_port_3, "PORT_3"]); + a.push([Lang.Blocks.robotis_common_port_4, "PORT_4"]); + a.push([Lang.Blocks.robotis_common_port_5, "PORT_5"]); + a.push([Lang.Blocks.robotis_common_port_6, "PORT_6"]); + return a; }, sensorList:function() { - var b = []; - b.push([Lang.Blocks.robotis_aux_servo_position, "AUX_SERVO_POSITION"]); - b.push([Lang.Blocks.robotis_aux_ir, "AUX_IR"]); - b.push([Lang.Blocks.robotis_aux_touch, "AUX_TOUCH"]); - b.push([Lang.Blocks.robotis_aux_brightness, "AUX_BRIGHTNESS"]); - b.push([Lang.Blocks.robotis_aux_hydro_themo_humidity, "AUX_HYDRO_THEMO_HUMIDITY"]); - b.push([Lang.Blocks.robotis_aux_hydro_themo_temper, "AUX_HYDRO_THEMO_TEMPER"]); - b.push([Lang.Blocks.robotis_aux_temperature, "AUX_TEMPERATURE"]); - b.push([Lang.Blocks.robotis_aux_ultrasonic, "AUX_ULTRASONIC"]); - b.push([Lang.Blocks.robotis_aux_magnetic, "AUX_MAGNETIC"]); - b.push([Lang.Blocks.robotis_aux_motion_detection, "AUX_MOTION_DETECTION"]); - b.push([Lang.Blocks.robotis_aux_color, "AUX_COLOR"]); - b.push([Lang.Blocks.robotis_aux_custom, "AUX_CUSTOM"]); - return b; + var a = []; + a.push([Lang.Blocks.robotis_aux_servo_position, "AUX_SERVO_POSITION"]); + a.push([Lang.Blocks.robotis_aux_ir, "AUX_IR"]); + a.push([Lang.Blocks.robotis_aux_touch, "AUX_TOUCH"]); + a.push([Lang.Blocks.robotis_aux_brightness, "AUX_BRIGHTNESS"]); + a.push([Lang.Blocks.robotis_aux_hydro_themo_humidity, "AUX_HYDRO_THEMO_HUMIDITY"]); + a.push([Lang.Blocks.robotis_aux_hydro_themo_temper, "AUX_HYDRO_THEMO_TEMPER"]); + a.push([Lang.Blocks.robotis_aux_temperature, "AUX_TEMPERATURE"]); + a.push([Lang.Blocks.robotis_aux_ultrasonic, "AUX_ULTRASONIC"]); + a.push([Lang.Blocks.robotis_aux_magnetic, "AUX_MAGNETIC"]); + a.push([Lang.Blocks.robotis_aux_motion_detection, "AUX_MOTION_DETECTION"]); + a.push([Lang.Blocks.robotis_aux_color, "AUX_COLOR"]); + a.push([Lang.Blocks.robotis_aux_custom, "AUX_CUSTOM"]); + return a; }}; -Entry.block.robotis_openCM70_aux_sensor_value = function(b, a) { - var c = Entry.Robotis_openCM70.INSTRUCTION.READ, d = 0, e = 0, f = 0, g = 0, h = a.getStringField("PORT"), k = a.getStringField("SENSOR"), l = 0; - "PORT_3" == h ? l = 2 : "PORT_4" == h ? l = 3 : "PORT_5" == h ? l = 4 : "PORT_6" == h && (l = 5); - "AUX_SERVO_POSITION" == k ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1]) : "AUX_IR" == k ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1]) : - "AUX_TOUCH" == k ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1]) : "AUX_TEMPERATURE" == k ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1]) : - "AUX_BRIGHTNESS" == k ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1]) : "AUX_HYDRO_THEMO_HUMIDITY" == k ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0], - e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1]) : "AUX_HYDRO_THEMO_TEMPER" == k ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1]) : "AUX_ULTRASONIC" == k ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1], - d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1]) : "AUX_MAGNETIC" == k ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1]) : "AUX_MOTION_DETECTION" == k ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1], - d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1]) : "AUX_COLOR" == k ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1]) : "AUX_CUSTOM" == k && (f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1], - d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1]); - f += l * g; - 0 != l && (e = 6 * g); - Entry.Robotis_carCont.setRobotisData([[c, d, e, 0, g]]); +Entry.block.robotis_openCM70_aux_sensor_value = function(a, b) { + a = Entry.Robotis_openCM70.INSTRUCTION.READ; + var c = 0, d = 0, e = 0, f = 0, g = b.getStringField("PORT"); + b = b.getStringField("SENSOR"); + var h = 0; + "PORT_3" == g ? h = 2 : "PORT_4" == g ? h = 3 : "PORT_5" == g ? h = 4 : "PORT_6" == g && (h = 5); + "AUX_SERVO_POSITION" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1]) : "AUX_IR" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1]) : + "AUX_TOUCH" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1]) : "AUX_TEMPERATURE" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1]) : + "AUX_BRIGHTNESS" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1]) : "AUX_HYDRO_THEMO_HUMIDITY" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0], + d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1]) : "AUX_HYDRO_THEMO_TEMPER" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1]) : "AUX_ULTRASONIC" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1], + c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1]) : "AUX_MAGNETIC" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1]) : "AUX_MOTION_DETECTION" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1], + c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1]) : "AUX_COLOR" == b ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1], c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1]) : "AUX_CUSTOM" == b && (e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1], + c = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0], d = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1]); + e += h * f; + 0 != h && (d = 6 * f); + Entry.Robotis_carCont.setRobotisData([[a, c, d, 0, f]]); Entry.Robotis_carCont.update(); - return Entry.hw.portData[f]; + return Entry.hw.portData[e]; }; Blockly.Blocks.robotis_openCM70_cm_buzzer_index = {init:function() { this.setColour("#00979D"); @@ -4576,12 +4754,14 @@ Blockly.Blocks.robotis_openCM70_cm_buzzer_index = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_openCM70_cm_buzzer_index = function(b, a) { - var c = a.getField("CM_BUZZER_INDEX", a), d = a.getNumberValue("CM_BUZZER_TIME", a), e = Entry.Robotis_openCM70.INSTRUCTION.WRITE, f = 0, g = 0, h = 0, k = 0, l = 0, f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[1], h = parseInt(10 * d); - 50 < h && (h = 50); - k = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[0]; - l = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[1]; - return Entry.Robotis_carCont.postCallReturn(a, [[e, f, g, h], [e, k, l, c]], 1E3 * d); +Entry.block.robotis_openCM70_cm_buzzer_index = function(a, b) { + a = b.getField("CM_BUZZER_INDEX", b); + var c = b.getNumberValue("CM_BUZZER_TIME", b), d = Entry.Robotis_openCM70.INSTRUCTION.WRITE, e, f, g; + e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[0]; + f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[1]; + g = parseInt(10 * c); + 50 < g && (g = 50); + return Entry.Robotis_carCont.postCallReturn(b, [[d, e, f, g], [d, Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[0], Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[1], a]], 1E3 * c); }; Blockly.Blocks.robotis_openCM70_cm_buzzer_melody = {init:function() { this.setColour("#00979D"); @@ -4594,9 +4774,10 @@ Blockly.Blocks.robotis_openCM70_cm_buzzer_melody = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_openCM70_cm_buzzer_melody = function(b, a) { - var c = a.getField("CM_BUZZER_MELODY", a), d = Entry.Robotis_openCM70.INSTRUCTION.WRITE, e = 0, f = 0, g = 0, h = 0, e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[1], g = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[0], h = Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[1]; - return Entry.Robotis_carCont.postCallReturn(a, [[d, e, f, 255], [d, g, h, c]], 1E3); +Entry.block.robotis_openCM70_cm_buzzer_melody = function(a, b) { + a = b.getField("CM_BUZZER_MELODY", b); + var c = Entry.Robotis_openCM70.INSTRUCTION.WRITE; + return Entry.Robotis_carCont.postCallReturn(b, [[c, Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[0], Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[1], 255], [c, Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[0], Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_INDEX[1], a]], 1E3); }; Blockly.Blocks.robotis_openCM70_cm_sound_detected_clear = {init:function() { this.setColour("#00979D"); @@ -4605,9 +4786,8 @@ Blockly.Blocks.robotis_openCM70_cm_sound_detected_clear = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_openCM70_cm_sound_detected_clear = function(b, a) { - var c = Entry.Robotis_openCM70.INSTRUCTION.WRITE, d = 0, e = 0, d = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1]; - return Entry.Robotis_carCont.postCallReturn(a, [[c, d, e, 0]], Entry.Robotis_openCM70.delay); +Entry.block.robotis_openCM70_cm_sound_detected_clear = function(a, b) { + return Entry.Robotis_carCont.postCallReturn(b, [[Entry.Robotis_openCM70.INSTRUCTION.WRITE, Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0], Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1], 0]], Entry.Robotis_openCM70.delay); }; Blockly.Blocks.robotis_openCM70_cm_led = {init:function() { this.setColour("#00979D"); @@ -4617,10 +4797,11 @@ Blockly.Blocks.robotis_openCM70_cm_led = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_openCM70_cm_led = function(b, a) { - var c = a.getField("CM_LED", a), d = a.getField("VALUE", a), e = Entry.Robotis_openCM70.INSTRUCTION.WRITE, f = 0, g = 0; - "CM_LED_R" == c ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_R[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_R[1]) : "CM_LED_G" == c ? (f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_G[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_G[1]) : "CM_LED_B" == c && (f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_B[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_B[1]); - return Entry.Robotis_carCont.postCallReturn(a, [[e, f, g, d]], Entry.Robotis_openCM70.delay); +Entry.block.robotis_openCM70_cm_led = function(a, b) { + a = b.getField("CM_LED", b); + var c = b.getField("VALUE", b), d = Entry.Robotis_openCM70.INSTRUCTION.WRITE, e = 0, f = 0; + "CM_LED_R" == a ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_R[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_R[1]) : "CM_LED_G" == a ? (e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_G[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_G[1]) : "CM_LED_B" == a && (e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_B[0], f = Entry.Robotis_openCM70.CONTROL_TABLE.CM_LED_B[1]); + return Entry.Robotis_carCont.postCallReturn(b, [[d, e, f, c]], Entry.Robotis_openCM70.delay); }; Blockly.Blocks.robotis_openCM70_cm_motion = {init:function() { this.setColour("#00979D"); @@ -4632,9 +4813,13 @@ Blockly.Blocks.robotis_openCM70_cm_motion = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_openCM70_cm_motion = function(b, a) { - var c = Entry.Robotis_openCM70.INSTRUCTION.WRITE, d = 0, e = 0, f = 0, d = Entry.Robotis_openCM70.CONTROL_TABLE.CM_MOTION[0], e = Entry.Robotis_openCM70.CONTROL_TABLE.CM_MOTION[1], f = a.getNumberValue("VALUE", a); - return Entry.Robotis_carCont.postCallReturn(a, [[c, d, e, f]], Entry.Robotis_openCM70.delay); +Entry.block.robotis_openCM70_cm_motion = function(a, b) { + a = Entry.Robotis_openCM70.INSTRUCTION.WRITE; + var c, d, e; + c = Entry.Robotis_openCM70.CONTROL_TABLE.CM_MOTION[0]; + d = Entry.Robotis_openCM70.CONTROL_TABLE.CM_MOTION[1]; + e = b.getNumberValue("VALUE", b); + return Entry.Robotis_carCont.postCallReturn(b, [[a, c, d, e]], Entry.Robotis_openCM70.delay); }; Blockly.Blocks.robotis_openCM70_aux_motor_speed = {init:function() { this.setColour("#00979D"); @@ -4645,10 +4830,13 @@ Blockly.Blocks.robotis_openCM70_aux_motor_speed = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_openCM70_aux_motor_speed = function(b, a) { - var c = a.getField("PORT", a), d = a.getField("DIRECTION_ANGLE", a), e = a.getNumberValue("VALUE"), f = Entry.Robotis_openCM70.INSTRUCTION.WRITE, g = 0, h = 0, g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTOR_SPEED[0], h = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTOR_SPEED[1]; - "CW" == d ? (e += 1024, 2047 < e && (e = 2047)) : 1023 < e && (e = 1023); - return Entry.Robotis_carCont.postCallReturn(a, [[f, g + (c - 1) * h, h, e]], Entry.Robotis_openCM70.delay); +Entry.block.robotis_openCM70_aux_motor_speed = function(a, b) { + a = b.getField("PORT", b); + var c = b.getField("DIRECTION_ANGLE", b), d = b.getNumberValue("VALUE"), e = Entry.Robotis_openCM70.INSTRUCTION.WRITE, f, g; + f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTOR_SPEED[0]; + g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTOR_SPEED[1]; + "CW" == c ? (d += 1024, 2047 < d && (d = 2047)) : 1023 < d && (d = 1023); + return Entry.Robotis_carCont.postCallReturn(b, [[e, f + (a - 1) * g, g, d]], Entry.Robotis_openCM70.delay); }; Blockly.Blocks.robotis_openCM70_aux_servo_mode = {init:function() { this.setColour("#00979D"); @@ -4658,9 +4846,12 @@ Blockly.Blocks.robotis_openCM70_aux_servo_mode = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_openCM70_aux_servo_mode = function(b, a) { - var c = a.getField("PORT", a), d = a.getField("MODE", a), e = Entry.Robotis_openCM70.INSTRUCTION.WRITE, f = 0, g = 0, f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_MODE[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_MODE[1]; - return Entry.Robotis_carCont.postCallReturn(a, [[e, f + (c - 1) * g, g, d]], Entry.Robotis_openCM70.delay); +Entry.block.robotis_openCM70_aux_servo_mode = function(a, b) { + a = b.getField("PORT", b); + var c = b.getField("MODE", b), d = Entry.Robotis_openCM70.INSTRUCTION.WRITE, e, f; + e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_MODE[0]; + f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_MODE[1]; + return Entry.Robotis_carCont.postCallReturn(b, [[d, e + (a - 1) * f, f, c]], Entry.Robotis_openCM70.delay); }; Blockly.Blocks.robotis_openCM70_aux_servo_speed = {init:function() { this.setColour("#00979D"); @@ -4671,10 +4862,13 @@ Blockly.Blocks.robotis_openCM70_aux_servo_speed = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_openCM70_aux_servo_speed = function(b, a) { - var c = a.getField("PORT", a), d = a.getField("DIRECTION_ANGLE", a), e = a.getNumberValue("VALUE"), f = Entry.Robotis_openCM70.INSTRUCTION.WRITE, g = 0, h = 0, g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_SPEED[0], h = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_SPEED[1]; - "CW" == d ? (e += 1024, 2047 < e && (e = 2047)) : 1023 < e && (e = 1023); - return Entry.Robotis_carCont.postCallReturn(a, [[f, g + (c - 1) * h, h, e]], Entry.Robotis_openCM70.delay); +Entry.block.robotis_openCM70_aux_servo_speed = function(a, b) { + a = b.getField("PORT", b); + var c = b.getField("DIRECTION_ANGLE", b), d = b.getNumberValue("VALUE"), e = Entry.Robotis_openCM70.INSTRUCTION.WRITE, f, g; + f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_SPEED[0]; + g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_SPEED[1]; + "CW" == c ? (d += 1024, 2047 < d && (d = 2047)) : 1023 < d && (d = 1023); + return Entry.Robotis_carCont.postCallReturn(b, [[e, f + (a - 1) * g, g, d]], Entry.Robotis_openCM70.delay); }; Blockly.Blocks.robotis_openCM70_aux_servo_position = {init:function() { this.setColour("#00979D"); @@ -4685,10 +4879,13 @@ Blockly.Blocks.robotis_openCM70_aux_servo_position = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_openCM70_aux_servo_position = function(b, a) { - var c = a.getField("PORT", a), d = a.getNumberValue("VALUE"), e = Entry.Robotis_openCM70.INSTRUCTION.WRITE, f = 0, g = 0, f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1]; - 1023 < d ? d = 1023 : 0 > d && (d = 0); - return Entry.Robotis_carCont.postCallReturn(a, [[e, f + (c - 1) * g, g, d]], Entry.Robotis_openCM70.delay); +Entry.block.robotis_openCM70_aux_servo_position = function(a, b) { + a = b.getField("PORT", b); + var c = b.getNumberValue("VALUE"), d = Entry.Robotis_openCM70.INSTRUCTION.WRITE, e, f; + e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0]; + f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1]; + 1023 < c ? c = 1023 : 0 > c && (c = 0); + return Entry.Robotis_carCont.postCallReturn(b, [[d, e + (a - 1) * f, f, c]], Entry.Robotis_openCM70.delay); }; Blockly.Blocks.robotis_openCM70_aux_led_module = {init:function() { this.setColour("#00979D"); @@ -4699,9 +4896,12 @@ Blockly.Blocks.robotis_openCM70_aux_led_module = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_openCM70_aux_led_module = function(b, a) { - var c = a.getField("PORT", a), d = a.getField("LED_MODULE", a), e = Entry.Robotis_openCM70.INSTRUCTION.WRITE, f = 0, g = 0, f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[1]; - return Entry.Robotis_carCont.postCallReturn(a, [[e, f + (c - 1) * g, g, d]], Entry.Robotis_openCM70.delay); +Entry.block.robotis_openCM70_aux_led_module = function(a, b) { + a = b.getField("PORT", b); + var c = b.getField("LED_MODULE", b), d = Entry.Robotis_openCM70.INSTRUCTION.WRITE, e, f; + e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[0]; + f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[1]; + return Entry.Robotis_carCont.postCallReturn(b, [[d, e + (a - 1) * f, f, c]], Entry.Robotis_openCM70.delay); }; Blockly.Blocks.robotis_openCM70_aux_custom = {init:function() { this.setColour("#00979D"); @@ -4712,9 +4912,12 @@ Blockly.Blocks.robotis_openCM70_aux_custom = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_openCM70_aux_custom = function(b, a) { - var c = a.getField("PORT", a), d = a.getNumberValue("VALUE"), e = Entry.Robotis_openCM70.INSTRUCTION.WRITE, f = 0, g = 0, f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0], g = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1]; - return Entry.Robotis_carCont.postCallReturn(a, [[e, f + (c - 1) * g, g, d]], Entry.Robotis_openCM70.delay); +Entry.block.robotis_openCM70_aux_custom = function(a, b) { + a = b.getField("PORT", b); + var c = b.getNumberValue("VALUE"), d = Entry.Robotis_openCM70.INSTRUCTION.WRITE, e, f; + e = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0]; + f = Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1]; + return Entry.Robotis_carCont.postCallReturn(b, [[d, e + (a - 1) * f, f, c]], Entry.Robotis_openCM70.delay); }; Blockly.Blocks.robotis_openCM70_cm_custom = {init:function() { this.setColour("#00979D"); @@ -4729,9 +4932,12 @@ Blockly.Blocks.robotis_openCM70_cm_custom = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_openCM70_cm_custom = function(b, a) { - var c = Entry.Robotis_openCM70.INSTRUCTION.WRITE, d = 0, e = 0, d = a.getNumberValue("ADDRESS"), e = a.getNumberValue("VALUE"); - return Entry.Robotis_carCont.postCallReturn(a, [[c, d, 65535 < e ? 4 : 255 < e ? 2 : 1, e]], Entry.Robotis_openCM70.delay); +Entry.block.robotis_openCM70_cm_custom = function(a, b) { + a = Entry.Robotis_openCM70.INSTRUCTION.WRITE; + var c, d; + c = b.getNumberValue("ADDRESS"); + d = b.getNumberValue("VALUE"); + return Entry.Robotis_carCont.postCallReturn(b, [[a, c, 65535 < d ? 4 : 255 < d ? 2 : 1, d]], Entry.Robotis_openCM70.delay); }; Blockly.Blocks.robotis_carCont_sensor_value = {init:function() { this.setColour("#00979D"); @@ -4740,17 +4946,19 @@ Blockly.Blocks.robotis_carCont_sensor_value = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.robotis_carCont_sensor_value = function(b, a) { - var c = Entry.Robotis_carCont.INSTRUCTION.READ, d = 0, e = 0, f = 0, g = 0, h = a.getStringField("SENSOR"); - "CM_SPRING_LEFT" == h ? (f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[0], g = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[1], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[2], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[3]) : "CM_SPRING_RIGHT" == h ? (f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[0], g = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[1], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[2], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[3]) : - "CM_SWITCH" == h ? (f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[0], g = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[1], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[0], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[1]) : "CM_SOUND_DETECTED" == h ? (f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[0], g = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[1], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[0], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[1]) : - "CM_SOUND_DETECTING" == h ? (f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[0], g = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[1], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[0], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[1]) : "CM_IR_LEFT" == h ? (f = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[0], g = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[1], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[2], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[3]) : - "CM_IR_RIGHT" == h ? (f = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[0], g = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[1], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[2], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[3]) : "CM_CALIBRATION_LEFT" == h ? (f = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[0], g = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[1], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[0], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[1]) : - "CM_CALIBRATION_RIGHT" == h ? (f = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[0], g = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[1], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[0], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[1]) : "CM_BUTTON_STATUS" == h && (f = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[0], g = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[1], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[0], - e = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[1]); - Entry.Robotis_carCont.setRobotisData([[c, d, e, 0, g]]); +Entry.block.robotis_carCont_sensor_value = function(a, b) { + a = Entry.Robotis_carCont.INSTRUCTION.READ; + var c = 0, d = 0, e = 0, f = 0; + b = b.getStringField("SENSOR"); + "CM_SPRING_LEFT" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[2], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_LEFT[3]) : "CM_SPRING_RIGHT" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[2], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_SPRING_RIGHT[3]) : + "CM_SWITCH" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[0], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_SWITCH[1]) : "CM_SOUND_DETECTED" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[0], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[1]) : + "CM_SOUND_DETECTING" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[0], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTING[1]) : "CM_IR_LEFT" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[2], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_LEFT[3]) : + "CM_IR_RIGHT" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[2], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_IR_RIGHT[3]) : "CM_CALIBRATION_LEFT" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[0], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[1]) : + "CM_CALIBRATION_RIGHT" == b ? (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[0], d = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[1]) : "CM_BUTTON_STATUS" == b && (e = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[0], f = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[1], c = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[0], + d = Entry.Robotis_carCont.CONTROL_TABLE.CM_BUTTON_STATUS[1]); + Entry.Robotis_carCont.setRobotisData([[a, c, d, 0, f]]); Entry.Robotis_carCont.update(); - return Entry.hw.portData[f]; + return Entry.hw.portData[e]; }; Blockly.Blocks.robotis_carCont_cm_led = {init:function() { this.setColour("#00979D"); @@ -4759,11 +4967,14 @@ Blockly.Blocks.robotis_carCont_cm_led = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_carCont_cm_led = function(b, a) { - var c = a.getField("VALUE_LEFT", a), d = a.getField("VALUE_RIGHT", a), e = Entry.Robotis_carCont.INSTRUCTION.WRITE, f = 0, g = 0, h = 0, f = Entry.Robotis_carCont.CONTROL_TABLE.CM_LED[0], g = Entry.Robotis_carCont.CONTROL_TABLE.CM_LED[1]; - 1 == c && 1 == d ? h = 9 : 1 == c && 0 == d && (h = 8); - 0 == c && 1 == d && (h = 1); - return Entry.Robotis_carCont.postCallReturn(a, [[e, f, g, h]], Entry.Robotis_carCont.delay); +Entry.block.robotis_carCont_cm_led = function(a, b) { + a = b.getField("VALUE_LEFT", b); + var c = b.getField("VALUE_RIGHT", b), d = Entry.Robotis_carCont.INSTRUCTION.WRITE, e, f, g = 0; + e = Entry.Robotis_carCont.CONTROL_TABLE.CM_LED[0]; + f = Entry.Robotis_carCont.CONTROL_TABLE.CM_LED[1]; + 1 == a && 1 == c ? g = 9 : 1 == a && 0 == c && (g = 8); + 0 == a && 1 == c && (g = 1); + return Entry.Robotis_carCont.postCallReturn(b, [[d, e, f, g]], Entry.Robotis_carCont.delay); }; Blockly.Blocks.robotis_carCont_cm_sound_detected_clear = {init:function() { this.setColour("#00979D"); @@ -4772,9 +4983,8 @@ Blockly.Blocks.robotis_carCont_cm_sound_detected_clear = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_carCont_cm_sound_detected_clear = function(b, a) { - var c = Entry.Robotis_carCont.INSTRUCTION.WRITE, d = 0, e = 0, d = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[0], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[1]; - return Entry.Robotis_carCont.postCallReturn(a, [[c, d, e, 0]], Entry.Robotis_carCont.delay); +Entry.block.robotis_carCont_cm_sound_detected_clear = function(a, b) { + return Entry.Robotis_carCont.postCallReturn(b, [[Entry.Robotis_carCont.INSTRUCTION.WRITE, Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[0], Entry.Robotis_carCont.CONTROL_TABLE.CM_SOUND_DETECTED[1], 0]], Entry.Robotis_carCont.delay); }; Blockly.Blocks.robotis_carCont_aux_motor_speed = {init:function() { this.setColour("#00979D"); @@ -4785,11 +4995,13 @@ Blockly.Blocks.robotis_carCont_aux_motor_speed = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_carCont_aux_motor_speed = function(b, a) { - var c = a.getField("DIRECTION", a), d = a.getField("DIRECTION_ANGLE", a), e = a.getNumberValue("VALUE"), f = Entry.Robotis_carCont.INSTRUCTION.WRITE, g = 0, h = 0; - "LEFT" == c ? (g = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_LEFT[0], h = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_LEFT[1]) : (g = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_RIGHT[0], h = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_RIGHT[1]); - "CW" == d ? (e += 1024, 2047 < e && (e = 2047)) : 1023 < e && (e = 1023); - return Entry.Robotis_carCont.postCallReturn(a, [[f, g, h, e]], Entry.Robotis_carCont.delay); +Entry.block.robotis_carCont_aux_motor_speed = function(a, b) { + var c = b.getField("DIRECTION", b); + a = b.getField("DIRECTION_ANGLE", b); + var d = b.getNumberValue("VALUE"), e = Entry.Robotis_carCont.INSTRUCTION.WRITE, f; + "LEFT" == c ? (c = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_LEFT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_LEFT[1]) : (c = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_RIGHT[0], f = Entry.Robotis_carCont.CONTROL_TABLE.AUX_MOTOR_SPEED_RIGHT[1]); + "CW" == a ? (d += 1024, 2047 < d && (d = 2047)) : 1023 < d && (d = 1023); + return Entry.Robotis_carCont.postCallReturn(b, [[e, c, f, d]], Entry.Robotis_carCont.delay); }; Blockly.Blocks.robotis_carCont_cm_calibration = {init:function() { this.setColour("#00979D"); @@ -4800,10 +5012,12 @@ Blockly.Blocks.robotis_carCont_cm_calibration = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.robotis_carCont_cm_calibration = function(b, a) { - var c = a.getField("DIRECTION", a), d = a.getNumberValue("VALUE"), e = Entry.Robotis_carCont.INSTRUCTION.WRITE, f = 0, g = 0; - "LEFT" == c ? (f = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[0], g = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[1]) : (f = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[0], g = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[1]); - return Entry.Robotis_carCont.postCallReturn(a, [[e, f, g, d]], Entry.Robotis_carCont.delay); +Entry.block.robotis_carCont_cm_calibration = function(a, b) { + var c = b.getField("DIRECTION", b); + a = b.getNumberValue("VALUE"); + var d = Entry.Robotis_carCont.INSTRUCTION.WRITE, e; + "LEFT" == c ? (c = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[0], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_LEFT[1]) : (c = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[0], e = Entry.Robotis_carCont.CONTROL_TABLE.CM_CALIBRATION_RIGHT[1]); + return Entry.Robotis_carCont.postCallReturn(b, [[d, c, e, a]], Entry.Robotis_carCont.delay); }; Blockly.Blocks.when_scene_start = {init:function() { this.setColour("#3BBD70"); @@ -4811,8 +5025,8 @@ Blockly.Blocks.when_scene_start = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); }}; -Entry.block.when_scene_start = function(b, a) { - return a.callReturn(); +Entry.block.when_scene_start = function(a, b) { + return b.callReturn(); }; Blockly.Blocks.start_scene = {init:function() { this.setColour("#3BBD70"); @@ -4821,10 +5035,10 @@ Blockly.Blocks.start_scene = {init:function() { this.setInputsInline(!0); this.setPreviousStatement(!0); }}; -Entry.block.start_scene = function(b, a) { - var c = a.getField("VALUE", a); - if (c = Entry.scene.getSceneById(c)) { - Entry.scene.selectScene(c), Entry.engine.fireEvent("when_scene_start"); +Entry.block.start_scene = function(a, b) { + a = b.getField("VALUE", b); + if (a = Entry.scene.getSceneById(a)) { + Entry.scene.selectScene(a), Entry.engine.fireEvent("when_scene_start"); } return null; }; @@ -4835,9 +5049,11 @@ Blockly.Blocks.start_neighbor_scene = {init:function() { this.setInputsInline(!0); this.setPreviousStatement(!0); }}; -Entry.block.start_neighbor_scene = function(b, a) { - var c = Entry.scene.selectedScene, d = Entry.scene.getScenes(), c = d.indexOf(c); - "next" == a.getField("OPERATOR", a) ? c + 1 < d.length && (d = Entry.scene.getSceneById(d[c + 1].id)) && (Entry.scene.selectScene(d), Entry.engine.fireEvent("when_scene_start")) : 0 < c && (d = Entry.scene.getSceneById(d[c - 1].id)) && (Entry.scene.selectScene(d), Entry.engine.fireEvent("when_scene_start")); +Entry.block.start_neighbor_scene = function(a, b) { + var c = Entry.scene.selectedScene; + a = Entry.scene.getScenes(); + c = a.indexOf(c); + "next" == b.getField("OPERATOR", b) ? c + 1 < a.length && (b = Entry.scene.getSceneById(a[c + 1].id)) && (Entry.scene.selectScene(b), Entry.engine.fireEvent("when_scene_start")) : 0 < c && (b = Entry.scene.getSceneById(a[c - 1].id)) && (Entry.scene.selectScene(b), Entry.engine.fireEvent("when_scene_start")); return null; }; Blockly.Blocks.sound_something = {init:function() { @@ -4849,10 +5065,10 @@ Blockly.Blocks.sound_something = {init:function() { this.setNextStatement(!0); this.setPreviousStatement(!0); }}; -Entry.block.sound_something = function(b, a) { - var c = a.getField("VALUE", a); - Entry.isExist(c, "id", b.parent.sounds) && createjs.Sound.play(c); - return a.callReturn(); +Entry.block.sound_something = function(a, b) { + var c = b.getField("VALUE", b); + Entry.isExist(c, "id", a.parent.sounds) && createjs.Sound.play(c); + return b.callReturn(); }; Blockly.Blocks.sound_something_second = {init:function() { this.setColour("#A4D01D"); @@ -4865,15 +5081,15 @@ Blockly.Blocks.sound_something_second = {init:function() { this.setNextStatement(!0); this.setPreviousStatement(!0); }}; -Entry.block.sound_something_second = function(b, a) { - var c = a.getField("VALUE", a), d = a.getNumberValue("SECOND", a); - if (Entry.isExist(c, "id", b.parent.sounds)) { +Entry.block.sound_something_second = function(a, b) { + var c = b.getField("VALUE", b), d = b.getNumberValue("SECOND", b); + if (Entry.isExist(c, "id", a.parent.sounds)) { var e = createjs.Sound.play(c); setTimeout(function() { e.stop(); }, 1E3 * d); } - return a.callReturn(); + return b.callReturn(); }; Blockly.Blocks.sound_something_wait = {init:function() { this.setColour("#A4D01D"); @@ -4884,22 +5100,22 @@ Blockly.Blocks.sound_something_wait = {init:function() { this.setNextStatement(!0); this.setPreviousStatement(!0); }}; -Entry.block.sound_something_wait = function(b, a) { - if (a.isPlay) { - if (1 == a.playState) { - return a; +Entry.block.sound_something_wait = function(a, b) { + if (b.isPlay) { + if (1 == b.playState) { + return b; } - delete a.playState; - delete a.isPlay; - return a.callReturn(); + delete b.playState; + delete b.isPlay; + return b.callReturn(); } - a.isPlay = !0; - a.playState = 1; - var c = a.getField("VALUE", a), d = b.parent.getSound(c); - Entry.isExist(c, "id", b.parent.sounds) && (createjs.Sound.play(c), setTimeout(function() { - a.playState = 0; + b.isPlay = !0; + b.playState = 1; + var c = b.getField("VALUE", b), d = a.parent.getSound(c); + Entry.isExist(c, "id", a.parent.sounds) && (createjs.Sound.play(c), setTimeout(function() { + b.playState = 0; }, 1E3 * d.duration)); - return a; + return b; }; Blockly.Blocks.sound_something_second_wait = {init:function() { this.setColour("#A4D01D"); @@ -4912,28 +5128,29 @@ Blockly.Blocks.sound_something_second_wait = {init:function() { this.setNextStatement(!0); this.setPreviousStatement(!0); }}; -Entry.block.sound_something_second_wait = function(b, a) { - if (a.isPlay) { - if (1 == a.playState) { - return a; +Entry.block.sound_something_second_wait = function(a, b) { + if (b.isPlay) { + if (1 == b.playState) { + return b; } - delete a.isPlay; - delete a.playState; - return a.callReturn(); + delete b.isPlay; + delete b.playState; + return b.callReturn(); } - a.isPlay = !0; - a.playState = 1; - var c = a.getField("VALUE", a); - if (Entry.isExist(c, "id", b.parent.sounds)) { - var d = createjs.Sound.play(c), c = a.getNumberValue("SECOND", a); + b.isPlay = !0; + b.playState = 1; + var c = b.getField("VALUE", b); + if (Entry.isExist(c, "id", a.parent.sounds)) { + var d = createjs.Sound.play(c); + a = b.getNumberValue("SECOND", b); setTimeout(function() { d.stop(); - a.playState = 0; - }, 1E3 * c); - d.addEventListener("complete", function(a) { + b.playState = 0; + }, 1E3 * a); + d.addEventListener("complete", function(b) { }); } - return a; + return b; }; Blockly.Blocks.sound_volume_change = {init:function() { this.setColour("#A4D01D"); @@ -4944,12 +5161,13 @@ Blockly.Blocks.sound_volume_change = {init:function() { this.setNextStatement(!0); this.setPreviousStatement(!0); }}; -Entry.block.sound_volume_change = function(b, a) { - var c = a.getNumberValue("VALUE", a) / 100, c = c + createjs.Sound.getVolume(); - 1 < c && (c = 1); - 0 > c && (c = 0); - createjs.Sound.setVolume(c); - return a.callReturn(); +Entry.block.sound_volume_change = function(a, b) { + a = b.getNumberValue("VALUE", b) / 100; + a += createjs.Sound.getVolume(); + 1 < a && (a = 1); + 0 > a && (a = 0); + createjs.Sound.setVolume(a); + return b.callReturn(); }; Blockly.Blocks.sound_volume_set = {init:function() { this.setColour("#A4D01D"); @@ -4960,12 +5178,12 @@ Blockly.Blocks.sound_volume_set = {init:function() { this.setNextStatement(!0); this.setPreviousStatement(!0); }}; -Entry.block.sound_volume_set = function(b, a) { - var c = a.getNumberValue("VALUE", a) / 100; - 1 < c && (c = 1); - 0 > c && (c = 0); - createjs.Sound.setVolume(c); - return a.callReturn(); +Entry.block.sound_volume_set = function(a, b) { + a = b.getNumberValue("VALUE", b) / 100; + 1 < a && (a = 1); + 0 > a && (a = 0); + createjs.Sound.setVolume(a); + return b.callReturn(); }; Blockly.Blocks.sound_silent_all = {init:function() { this.setColour("#A4D01D"); @@ -4974,9 +5192,9 @@ Blockly.Blocks.sound_silent_all = {init:function() { this.setNextStatement(!0); this.setPreviousStatement(!0); }}; -Entry.block.sound_silent_all = function(b, a) { +Entry.block.sound_silent_all = function(a, b) { createjs.Sound.stop(); - return a.callReturn(); + return b.callReturn(); }; Blockly.Blocks.get_sounds = {init:function() { this.setColour("#A4D01D"); @@ -4986,8 +5204,8 @@ Blockly.Blocks.get_sounds = {init:function() { this.setOutput(!0, "String"); this.setInputsInline(!0); }}; -Entry.block.get_sounds = function(b, a) { - return a.getStringField("VALUE"); +Entry.block.get_sounds = function(a, b) { + return b.getStringField("VALUE"); }; Blockly.Blocks.sound_something_with_block = {init:function() { this.setColour("#A4D01D"); @@ -4998,10 +5216,10 @@ Blockly.Blocks.sound_something_with_block = {init:function() { this.setNextStatement(!0); this.setPreviousStatement(!0); }}; -Entry.block.sound_something_with_block = function(b, a) { - var c = a.getStringValue("VALUE", a); - (c = b.parent.getSound(c)) && createjs.Sound.play(c.id); - return a.callReturn(); +Entry.block.sound_something_with_block = function(a, b) { + var c = b.getStringValue("VALUE", b); + (a = a.parent.getSound(c)) && createjs.Sound.play(a.id); + return b.callReturn(); }; Blockly.Blocks.sound_something_second_with_block = {init:function() { this.setColour("#A4D01D"); @@ -5014,10 +5232,10 @@ Blockly.Blocks.sound_something_second_with_block = {init:function() { this.setNextStatement(!0); this.setPreviousStatement(!0); }}; -Entry.block.sound_something_second_with_block = function(b, a) { - var c = a.getStringValue("VALUE", a), d = a.getNumberValue("SECOND", a); - (c = b.parent.getSound(c)) && createjs.Sound.play(c.id, {startTime:0, duration:1E3 * d}); - return a.callReturn(); +Entry.block.sound_something_second_with_block = function(a, b) { + var c = b.getStringValue("VALUE", b), d = b.getNumberValue("SECOND", b); + (a = a.parent.getSound(c)) && createjs.Sound.play(a.id, {startTime:0, duration:1E3 * d}); + return b.callReturn(); }; Blockly.Blocks.sound_something_wait_with_block = {init:function() { this.setColour("#A4D01D"); @@ -5028,24 +5246,24 @@ Blockly.Blocks.sound_something_wait_with_block = {init:function() { this.setNextStatement(!0); this.setPreviousStatement(!0); }}; -Entry.block.sound_something_wait_with_block = function(b, a) { - if (a.isPlay) { - if (1 == a.playState) { - return a; +Entry.block.sound_something_wait_with_block = function(a, b) { + if (b.isPlay) { + if (1 == b.playState) { + return b; } - delete a.playState; - delete a.isPlay; - return a.callReturn(); + delete b.playState; + delete b.isPlay; + return b.callReturn(); } - a.isPlay = !0; - a.playState = 1; - var c = a.getStringValue("VALUE", a); - if (c = b.parent.getSound(c)) { - createjs.Sound.play(c.id), setTimeout(function() { - a.playState = 0; - }, 1E3 * c.duration); + b.isPlay = !0; + b.playState = 1; + var c = b.getStringValue("VALUE", b); + if (a = a.parent.getSound(c)) { + createjs.Sound.play(a.id), setTimeout(function() { + b.playState = 0; + }, 1E3 * a.duration); } - return a; + return b; }; Blockly.Blocks.sound_something_second_wait_with_block = {init:function() { this.setColour("#A4D01D"); @@ -5058,28 +5276,29 @@ Blockly.Blocks.sound_something_second_wait_with_block = {init:function() { this.setNextStatement(!0); this.setPreviousStatement(!0); }}; -Entry.block.sound_something_second_wait_with_block = function(b, a) { - if (a.isPlay) { - if (1 == a.playState) { - return a; +Entry.block.sound_something_second_wait_with_block = function(a, b) { + if (b.isPlay) { + if (1 == b.playState) { + return b; } - delete a.isPlay; - delete a.playState; - return a.callReturn(); + delete b.isPlay; + delete b.playState; + return b.callReturn(); } - a.isPlay = !0; - a.playState = 1; - var c = a.getStringValue("VALUE", a); - if (c = b.parent.getSound(c)) { - var d = createjs.Sound.play(c.id), c = a.getNumberValue("SECOND", a); + b.isPlay = !0; + b.playState = 1; + var c = b.getStringValue("VALUE", b); + if (a = a.parent.getSound(c)) { + var d = createjs.Sound.play(a.id); + a = b.getNumberValue("SECOND", b); setTimeout(function() { d.stop(); - a.playState = 0; - }, 1E3 * c); - d.addEventListener("complete", function(a) { + b.playState = 0; + }, 1E3 * a); + d.addEventListener("complete", function(b) { }); } - return a; + return b; }; Blockly.Blocks.sound_from_to = {init:function() { this.setColour("#A4D01D"); @@ -5094,13 +5313,13 @@ Blockly.Blocks.sound_from_to = {init:function() { this.setNextStatement(!0); this.setPreviousStatement(!0); }}; -Entry.block.sound_from_to = function(b, a) { - var c = a.getStringValue("VALUE", a); - if (c = b.parent.getSound(c)) { - var d = 1E3 * a.getNumberValue("START", a), e = 1E3 * a.getNumberValue("END", a); - createjs.Sound.play(c.id, {startTime:Math.min(d, e), duration:Math.max(d, e) - Math.min(d, e)}); +Entry.block.sound_from_to = function(a, b) { + var c = b.getStringValue("VALUE", b); + if (a = a.parent.getSound(c)) { + var c = 1E3 * b.getNumberValue("START", b), d = 1E3 * b.getNumberValue("END", b); + createjs.Sound.play(a.id, {startTime:Math.min(c, d), duration:Math.max(c, d) - Math.min(c, d)}); } - return a.callReturn(); + return b.callReturn(); }; Blockly.Blocks.sound_from_to_and_wait = {init:function() { this.setColour("#A4D01D"); @@ -5115,26 +5334,26 @@ Blockly.Blocks.sound_from_to_and_wait = {init:function() { this.setNextStatement(!0); this.setPreviousStatement(!0); }}; -Entry.block.sound_from_to_and_wait = function(b, a) { - if (a.isPlay) { - if (1 == a.playState) { - return a; +Entry.block.sound_from_to_and_wait = function(a, b) { + if (b.isPlay) { + if (1 == b.playState) { + return b; } - delete a.isPlay; - delete a.playState; - return a.callReturn(); + delete b.isPlay; + delete b.playState; + return b.callReturn(); } - a.isPlay = !0; - a.playState = 1; - var c = a.getStringValue("VALUE", a); - if (c = b.parent.getSound(c)) { - var d = 1E3 * a.getNumberValue("START", a), e = 1E3 * a.getNumberValue("END", a), f = Math.min(d, e), d = Math.max(d, e) - f; - createjs.Sound.play(c.id, {startTime:f, duration:d}); + b.isPlay = !0; + b.playState = 1; + var c = b.getStringValue("VALUE", b); + if (a = a.parent.getSound(c)) { + var d = 1E3 * b.getNumberValue("START", b), e = 1E3 * b.getNumberValue("END", b), c = Math.min(d, e), d = Math.max(d, e) - c; + createjs.Sound.play(a.id, {startTime:c, duration:d}); setTimeout(function() { - a.playState = 0; + b.playState = 0; }, d); } - return a; + return b; }; Blockly.Blocks.when_run_button_click = {init:function() { this.setColour("#3BBD70"); @@ -5142,8 +5361,8 @@ Blockly.Blocks.when_run_button_click = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); }}; -Entry.block.when_run_button_click = function(b, a) { - return a.callReturn(); +Entry.block.when_run_button_click = function(a, b) { + return b.callReturn(); }; Blockly.Blocks.press_some_key = {init:function() { this.setColour("#3BBD70"); @@ -5152,8 +5371,8 @@ Blockly.Blocks.press_some_key = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); }}; -Entry.block.press_some_key = function(b, a) { - return a.callReturn(); +Entry.block.press_some_key = function(a, b) { + return b.callReturn(); }; Blockly.Blocks.when_some_key_pressed = {init:function() { this.setColour("#3BBD70"); @@ -5161,8 +5380,8 @@ Blockly.Blocks.when_some_key_pressed = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); }}; -Entry.block.when_some_key_pressed = function(b, a) { - return a.callReturn(); +Entry.block.when_some_key_pressed = function(a, b) { + return b.callReturn(); }; Blockly.Blocks.mouse_clicked = {init:function() { this.setColour("#3BBD70"); @@ -5170,8 +5389,8 @@ Blockly.Blocks.mouse_clicked = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); }}; -Entry.block.mouse_clicked = function(b, a) { - return a.callReturn(); +Entry.block.mouse_clicked = function(a, b) { + return b.callReturn(); }; Blockly.Blocks.mouse_click_cancled = {init:function() { this.setColour("#3BBD70"); @@ -5179,8 +5398,8 @@ Blockly.Blocks.mouse_click_cancled = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); }}; -Entry.block.mouse_click_cancled = function(b, a) { - return a.callReturn(); +Entry.block.mouse_click_cancled = function(a, b) { + return b.callReturn(); }; Blockly.Blocks.when_object_click = {init:function() { this.setColour("#3BBD70"); @@ -5188,8 +5407,8 @@ Blockly.Blocks.when_object_click = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); }}; -Entry.block.when_object_click = function(b, a) { - return a.callReturn(); +Entry.block.when_object_click = function(a, b) { + return b.callReturn(); }; Blockly.Blocks.when_object_click_canceled = {init:function() { this.setColour("#3BBD70"); @@ -5197,8 +5416,8 @@ Blockly.Blocks.when_object_click_canceled = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); }}; -Entry.block.when_object_click_canceled = function(b, a) { - return a.callReturn(); +Entry.block.when_object_click_canceled = function(a, b) { + return b.callReturn(); }; Blockly.Blocks.when_some_key_click = {init:function() { this.setColour("#3BBD70"); @@ -5206,23 +5425,23 @@ Blockly.Blocks.when_some_key_click = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); }}; -Entry.block.when_some_key_click = function(b, a) { - return a.callReturn(); +Entry.block.when_some_key_click = function(a, b) { + return b.callReturn(); }; Blockly.Blocks.when_message_cast = {init:function() { this.setColour("#3BBD70"); this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath + "block_icon/start_icon_signal.png", "*", "start")).appendField(Lang.Blocks.START_when_message_cast_1).appendField(new Blockly.FieldDropdownDynamic("messages"), "VALUE").appendField(Lang.Blocks.START_when_message_cast_2); this.setInputsInline(!0); this.setNextStatement(!0); -}, whenAdd:function(b) { - var a = Entry.variableContainer; - a && a.addRef("_messageRefs", b); -}, whenRemove:function(b) { - var a = Entry.variableContainer; - a && a.removeRef("_messageRefs", b); +}, whenAdd:function(a) { + var b = Entry.variableContainer; + b && b.addRef("_messageRefs", a); +}, whenRemove:function(a) { + var b = Entry.variableContainer; + b && b.removeRef("_messageRefs", a); }}; -Entry.block.when_message_cast = function(b, a) { - return a.callReturn(); +Entry.block.when_message_cast = function(a, b) { + return b.callReturn(); }; Blockly.Blocks.message_cast = {init:function() { this.setColour("#3BBD70"); @@ -5231,20 +5450,21 @@ Blockly.Blocks.message_cast = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); this.setPreviousStatement(!0); -}, whenAdd:function(b) { - var a = Entry.variableContainer; - a && a.addRef("_messageRefs", b); -}, whenRemove:function(b) { - var a = Entry.variableContainer; - a && a.removeRef("_messageRefs", b); -}}; -Entry.block.message_cast = function(b, a) { - var c = a.getField("VALUE", a), d = Entry.isExist(c, "id", Entry.variableContainer.messages_); - if ("null" == c || !d) { +}, whenAdd:function(a) { + var b = Entry.variableContainer; + b && b.addRef("_messageRefs", a); +}, whenRemove:function(a) { + var b = Entry.variableContainer; + b && b.removeRef("_messageRefs", a); +}}; +Entry.block.message_cast = function(a, b) { + a = b.getField("VALUE", b); + var c = Entry.isExist(a, "id", Entry.variableContainer.messages_); + if ("null" == a || !c) { throw Error("value can not be null or undefined"); } - Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent, ["when_message_cast", c]); - return a.callReturn(); + Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent, ["when_message_cast", a]); + return b.callReturn(); }; Blockly.Blocks.message_cast_wait = {init:function() { this.setColour("#3BBD70"); @@ -5252,32 +5472,33 @@ Blockly.Blocks.message_cast_wait = {init:function() { this.setInputsInline(!0); this.setNextStatement(!0); this.setPreviousStatement(!0); -}, whenAdd:function(b) { - var a = Entry.variableContainer; - a && a.addRef("_messageRefs", b); -}, whenRemove:function(b) { - var a = Entry.variableContainer; - a && a.removeRef("_messageRefs", b); -}}; -Entry.block.message_cast_wait = function(b, a) { - if (a.runningScript) { - for (var c = a.runningScript, d = c.length, e = 0;e < d;e++) { - var f = c.shift(); - f && !f.isEnd() && c.push(f); - } - return c.length ? a : a.callReturn(); - } - c = a.getField("VALUE", a); - f = Entry.isExist(c, "id", Entry.variableContainer.messages_); - if ("null" == c || !f) { +}, whenAdd:function(a) { + var b = Entry.variableContainer; + b && b.addRef("_messageRefs", a); +}, whenRemove:function(a) { + var b = Entry.variableContainer; + b && b.removeRef("_messageRefs", a); +}}; +Entry.block.message_cast_wait = function(a, b) { + if (b.runningScript) { + a = b.runningScript; + for (var c = a.length, d = 0;d < c;d++) { + var e = a.shift(); + e && !e.isEnd() && a.push(e); + } + return a.length ? b : b.callReturn(); + } + a = b.getField("VALUE", b); + e = Entry.isExist(a, "id", Entry.variableContainer.messages_); + if ("null" == a || !e) { throw Error("value can not be null or undefined"); } - d = Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent, ["when_message_cast", c]); - for (c = [];d.length;) { - (f = d.shift()) && (c = c.concat(f)); + c = Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent, ["when_message_cast", a]); + for (a = [];c.length;) { + (e = c.shift()) && (a = a.concat(e)); } - a.runningScript = c; - return a; + b.runningScript = a; + return b; }; var colour = "#FFCA36"; Blockly.Blocks.text = {init:function() { @@ -5286,8 +5507,8 @@ Blockly.Blocks.text = {init:function() { this.setOutput(!0, "String"); this.setInputsInline(!0); }}; -Entry.block.text = function(b, a) { - return a.getField("NAME", a); +Entry.block.text = function(a, b) { + return b.getField("NAME", b); }; Blockly.Blocks.text_write = {init:function() { this.setColour(colour); @@ -5298,10 +5519,10 @@ Blockly.Blocks.text_write = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.text_write = function(b, a) { - var c = a.getStringValue("VALUE", a), c = Entry.convertToRoundedDecimals(c, 3); - b.setText(c); - return a.callReturn(); +Entry.block.text_write = function(a, b) { + var c = b.getStringValue("VALUE", b), c = Entry.convertToRoundedDecimals(c, 3); + a.setText(c); + return b.callReturn(); }; Blockly.Blocks.text_append = {init:function() { this.setColour(colour); @@ -5312,10 +5533,10 @@ Blockly.Blocks.text_append = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.text_append = function(b, a) { - var c = a.getStringValue("VALUE", a); - b.setText(Entry.convertToRoundedDecimals(b.getText(), 3) + Entry.convertToRoundedDecimals(c, 3)); - return a.callReturn(); +Entry.block.text_append = function(a, b) { + var c = b.getStringValue("VALUE", b); + a.setText(Entry.convertToRoundedDecimals(a.getText(), 3) + Entry.convertToRoundedDecimals(c, 3)); + return b.callReturn(); }; Blockly.Blocks.text_prepend = {init:function() { this.setColour(colour); @@ -5326,10 +5547,10 @@ Blockly.Blocks.text_prepend = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.text_prepend = function(b, a) { - var c = a.getStringValue("VALUE", a); - b.setText(Entry.convertToRoundedDecimals(c, 3) + Entry.convertToRoundedDecimals(b.getText(), 3)); - return a.callReturn(); +Entry.block.text_prepend = function(a, b) { + var c = b.getStringValue("VALUE", b); + a.setText(Entry.convertToRoundedDecimals(c, 3) + Entry.convertToRoundedDecimals(a.getText(), 3)); + return b.callReturn(); }; Blockly.Blocks.text_flush = {init:function() { this.setColour(colour); @@ -5338,9 +5559,9 @@ Blockly.Blocks.text_flush = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.text_flush = function(b, a) { - b.setText(""); - return a.callReturn(); +Entry.block.text_flush = function(a, b) { + a.setText(""); + return b.callReturn(); }; Entry.block.variableAddButton = {skeleton:"basic_button", color:"#eee", template:"%1", params:[{type:"Text", text:"\ubcc0\uc218 \ucd94\uac00", color:"#333", align:"center"}], func:function() { }, events:{mousedown:[function() { @@ -5360,22 +5581,22 @@ Blockly.Blocks.change_variable = {init:function() { this.setInputsInline(!0); this.setPreviousStatement(!0); this.setNextStatement(!0); -}, whenAdd:function(b) { - var a = Entry.variableContainer; - a && a.addRef("_variableRefs", b); -}, whenRemove:function(b) { - var a = Entry.variableContainer; - a && a.removeRef("_variableRefs", b); -}}; -Entry.block.change_variable = function(b, a) { - var c = a.getField("VARIABLE", a), d = a.getNumberValue("VALUE", a), e = 0, d = Entry.parseNumber(d); +}, whenAdd:function(a) { + var b = Entry.variableContainer; + b && b.addRef("_variableRefs", a); +}, whenRemove:function(a) { + var b = Entry.variableContainer; + b && b.removeRef("_variableRefs", a); +}}; +Entry.block.change_variable = function(a, b) { + var c = b.getField("VARIABLE", b), d = b.getNumberValue("VALUE", b), d = Entry.parseNumber(d); if (0 == d && "boolean" == typeof d) { throw Error("Type is not correct"); } - c = Entry.variableContainer.getVariable(c, b); - e = Entry.getMaxFloatPoint([d, c.getValue()]); - c.setValue((d + c.getValue()).toFixed(e)); - return a.callReturn(); + c = Entry.variableContainer.getVariable(c, a); + a = Entry.getMaxFloatPoint([d, c.getValue()]); + c.setValue((d + c.getValue()).toFixed(a)); + return b.callReturn(); }; Blockly.Blocks.set_variable = {init:function() { this.setColour("#E457DC"); @@ -5387,17 +5608,17 @@ Blockly.Blocks.set_variable = {init:function() { this.setInputsInline(!0); this.setPreviousStatement(!0); this.setNextStatement(!0); -}, whenAdd:function(b) { - var a = Entry.variableContainer; - a && a.addRef("_variableRefs", b); -}, whenRemove:function(b) { - var a = Entry.variableContainer; - a && a.removeRef("_variableRefs", b); -}}; -Entry.block.set_variable = function(b, a) { - var c = a.getField("VARIABLE", a), d = a.getValue("VALUE", a); - Entry.variableContainer.getVariable(c, b).setValue(d); - return a.callReturn(); +}, whenAdd:function(a) { + var b = Entry.variableContainer; + b && b.addRef("_variableRefs", a); +}, whenRemove:function(a) { + var b = Entry.variableContainer; + b && b.removeRef("_variableRefs", a); +}}; +Entry.block.set_variable = function(a, b) { + var c = b.getField("VARIABLE", b), d = b.getValue("VALUE", b); + Entry.variableContainer.getVariable(c, a).setValue(d); + return b.callReturn(); }; Blockly.Blocks.show_variable = {init:function() { this.setColour("#E457DC"); @@ -5406,18 +5627,19 @@ Blockly.Blocks.show_variable = {init:function() { this.setInputsInline(!0); this.setPreviousStatement(!0); this.setNextStatement(!0); -}, whenAdd:function(b) { - var a = Entry.variableContainer; - a && a.addRef("_variableRefs", b); -}, whenRemove:function(b) { - var a = Entry.variableContainer; - a && a.removeRef("_variableRefs", b); -}}; -Entry.block.show_variable = function(b, a) { - var c = a.getField("VARIABLE", a), c = Entry.variableContainer.getVariable(c, b); - c.setVisible(!0); - c.updateView(); - return a.callReturn(); +}, whenAdd:function(a) { + var b = Entry.variableContainer; + b && b.addRef("_variableRefs", a); +}, whenRemove:function(a) { + var b = Entry.variableContainer; + b && b.removeRef("_variableRefs", a); +}}; +Entry.block.show_variable = function(a, b) { + var c = b.getField("VARIABLE", b); + a = Entry.variableContainer.getVariable(c, a); + a.setVisible(!0); + a.updateView(); + return b.callReturn(); }; Blockly.Blocks.hide_variable = {init:function() { this.setColour("#E457DC"); @@ -5426,17 +5648,17 @@ Blockly.Blocks.hide_variable = {init:function() { this.setInputsInline(!0); this.setPreviousStatement(!0); this.setNextStatement(!0); -}, whenAdd:function(b) { - var a = Entry.variableContainer; - a && a.addRef("_variableRefs", b); -}, whenRemove:function(b) { - var a = Entry.variableContainer; - a && a.removeRef("_variableRefs", b); -}}; -Entry.block.hide_variable = function(b, a) { - var c = a.getField("VARIABLE", a); - Entry.variableContainer.getVariable(c, b).setVisible(!1); - return a.callReturn(); +}, whenAdd:function(a) { + var b = Entry.variableContainer; + b && b.addRef("_variableRefs", a); +}, whenRemove:function(a) { + var b = Entry.variableContainer; + b && b.removeRef("_variableRefs", a); +}}; +Entry.block.hide_variable = function(a, b) { + var c = b.getField("VARIABLE", b); + Entry.variableContainer.getVariable(c, a).setVisible(!1); + return b.callReturn(); }; Blockly.Blocks.get_y = {init:function() { this.setColour(230); @@ -5449,16 +5671,16 @@ Blockly.Blocks.get_variable = {init:function() { this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("variables"), "VARIABLE").appendField(Lang.Blocks.VARIABLE_get_variable_2); this.setOutput(!0, "Number"); this.setInputsInline(!0); -}, whenAdd:function(b) { - var a = Entry.variableContainer; - a && a.addRef("_variableRefs", b); -}, whenRemove:function(b) { - var a = Entry.variableContainer; - a && a.removeRef("_variableRefs", b); +}, whenAdd:function(a) { + var b = Entry.variableContainer; + b && b.addRef("_variableRefs", a); +}, whenRemove:function(a) { + var b = Entry.variableContainer; + b && b.removeRef("_variableRefs", a); }}; -Entry.block.get_variable = function(b, a) { - var c = a.getField("VARIABLE", a); - return Entry.variableContainer.getVariable(c, b).getValue(); +Entry.block.get_variable = function(a, b) { + b = b.getField("VARIABLE", b); + return Entry.variableContainer.getVariable(b, a).getValue(); }; Blockly.Blocks.ask_and_wait = {init:function() { this.setColour("#E457DC"); @@ -5470,30 +5692,30 @@ Blockly.Blocks.ask_and_wait = {init:function() { this.setNextStatement(!0); }, whenAdd:function() { Entry.container && Entry.container.showProjectAnswer(); -}, whenRemove:function(b) { - Entry.container && Entry.container.hideProjectAnswer(b); +}, whenRemove:function(a) { + Entry.container && Entry.container.hideProjectAnswer(a); }}; -Entry.block.ask_and_wait = function(b, a) { - var c = Entry.container.inputValue, d = Entry.stage.inputField, e = a.getValue("VALUE", a); +Entry.block.ask_and_wait = function(a, b) { + var c = Entry.container.inputValue, d = Entry.stage.inputField, e = b.getValue("VALUE", b); if (!e) { throw Error("message can not be empty"); } - if (c.sprite == b && d && !d._isHidden) { - return a; + if (c.sprite == a && d && !d._isHidden) { + return b; } - if (c.sprite != b && a.isInit) { - return b.dialog && b.dialog.remove(), delete a.isInit, a.callReturn(); + if (c.sprite != a && b.isInit) { + return a.dialog && a.dialog.remove(), delete b.isInit, b.callReturn(); } - if (c.complete && c.sprite == b && d._isHidden && a.isInit) { - return b.dialog && b.dialog.remove(), delete c.complete, delete a.isInit, a.callReturn(); + if (c.complete && c.sprite == a && d._isHidden && b.isInit) { + return a.dialog && a.dialog.remove(), delete c.complete, delete b.isInit, b.callReturn(); } e = Entry.convertToRoundedDecimals(e, 3); - new Entry.Dialog(b, e, "speak"); + new Entry.Dialog(a, e, "speak"); Entry.stage.showInputField(); - c.script = a; - c.sprite = b; - a.isInit = !0; - return a; + c.script = b; + c.sprite = a; + b.isInit = !0; + return b; }; Blockly.Blocks.get_canvas_input_value = {init:function() { this.setColour("#E457DC"); @@ -5503,10 +5725,10 @@ Blockly.Blocks.get_canvas_input_value = {init:function() { this.setInputsInline(!0); }, whenAdd:function() { Entry.container && Entry.container.showProjectAnswer(); -}, whenRemove:function(b) { - Entry.container && Entry.container.hideProjectAnswer(b); +}, whenRemove:function(a) { + Entry.container && Entry.container.hideProjectAnswer(a); }}; -Entry.block.get_canvas_input_value = function(b, a) { +Entry.block.get_canvas_input_value = function(a, b) { return Entry.container.getInputValue(); }; Blockly.Blocks.add_value_to_list = {init:function() { @@ -5519,19 +5741,20 @@ Blockly.Blocks.add_value_to_list = {init:function() { this.setInputsInline(!0); this.setPreviousStatement(!0); this.setNextStatement(!0); -}, whenAdd:function(b) { - var a = Entry.variableContainer; - a && a.addRef("_variableRefs", b); -}, whenRemove:function(b) { - var a = Entry.variableContainer; - a && a.removeRef("_variableRefs", b); -}}; -Entry.block.add_value_to_list = function(b, a) { - var c = a.getField("LIST", a), d = a.getValue("VALUE", a), c = Entry.variableContainer.getList(c, b); - c.array_ || (c.array_ = []); - c.array_.push({data:d}); - c.updateView(); - return a.callReturn(); +}, whenAdd:function(a) { + var b = Entry.variableContainer; + b && b.addRef("_variableRefs", a); +}, whenRemove:function(a) { + var b = Entry.variableContainer; + b && b.removeRef("_variableRefs", a); +}}; +Entry.block.add_value_to_list = function(a, b) { + var c = b.getField("LIST", b), d = b.getValue("VALUE", b); + a = Entry.variableContainer.getList(c, a); + a.array_ || (a.array_ = []); + a.array_.push({data:d}); + a.updateView(); + return b.callReturn(); }; Blockly.Blocks.remove_value_from_list = {init:function() { this.setColour("#E457DC"); @@ -5544,14 +5767,15 @@ Blockly.Blocks.remove_value_from_list = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.remove_value_from_list = function(b, a) { - var c = a.getField("LIST", a), d = a.getValue("VALUE", a), c = Entry.variableContainer.getList(c, b); - if (!c.array_ || isNaN(d) || d > c.array_.length) { +Entry.block.remove_value_from_list = function(a, b) { + var c = b.getField("LIST", b), d = b.getValue("VALUE", b); + a = Entry.variableContainer.getList(c, a); + if (!a.array_ || isNaN(d) || d > a.array_.length) { throw Error("can not remove value from array"); } - c.array_.splice(d - 1, 1); - c.updateView(); - return a.callReturn(); + a.array_.splice(d - 1, 1); + a.updateView(); + return b.callReturn(); }; Blockly.Blocks.insert_value_to_list = {init:function() { this.setColour("#E457DC"); @@ -5566,14 +5790,15 @@ Blockly.Blocks.insert_value_to_list = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.insert_value_to_list = function(b, a) { - var c = a.getField("LIST", a), d = a.getValue("DATA", a), e = a.getValue("INDEX", a), c = Entry.variableContainer.getList(c, b); - if (!c.array_ || isNaN(e) || 0 == e || e > c.array_.length + 1) { +Entry.block.insert_value_to_list = function(a, b) { + var c = b.getField("LIST", b), d = b.getValue("DATA", b), e = b.getValue("INDEX", b); + a = Entry.variableContainer.getList(c, a); + if (!a.array_ || isNaN(e) || 0 == e || e > a.array_.length + 1) { throw Error("can not insert value to array"); } - c.array_.splice(e - 1, 0, {data:d}); - c.updateView(); - return a.callReturn(); + a.array_.splice(e - 1, 0, {data:d}); + a.updateView(); + return b.callReturn(); }; Blockly.Blocks.change_value_list_index = {init:function() { this.setColour("#E457DC"); @@ -5588,14 +5813,15 @@ Blockly.Blocks.change_value_list_index = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.change_value_list_index = function(b, a) { - var c = a.getField("LIST", a), d = a.getValue("DATA", a), e = a.getValue("INDEX", a), c = Entry.variableContainer.getList(c, b); - if (!c.array_ || isNaN(e) || e > c.array_.length) { +Entry.block.change_value_list_index = function(a, b) { + var c = b.getField("LIST", b), d = b.getValue("DATA", b), e = b.getValue("INDEX", b); + a = Entry.variableContainer.getList(c, a); + if (!a.array_ || isNaN(e) || e > a.array_.length) { throw Error("can not insert value to array"); } - c.array_[e - 1].data = d; - c.updateView(); - return a.callReturn(); + a.array_[e - 1].data = d; + a.updateView(); + return b.callReturn(); }; Blockly.Blocks.value_of_index_from_list = {init:function() { this.setColour("#E457DC"); @@ -5607,12 +5833,15 @@ Blockly.Blocks.value_of_index_from_list = {init:function() { this.setOutput(!0, "String"); this.setInputsInline(!0); }}; -Entry.block.value_of_index_from_list = function(b, a) { - var c = a.getField("LIST", a), d = a.getValue("INDEX", a), c = Entry.variableContainer.getList(c, b), d = Entry.getListRealIndex(d, c); - if (!c.array_ || isNaN(d) || d > c.array_.length) { +Entry.block.value_of_index_from_list = function(a, b) { + var c = b.getField("LIST", b); + b = b.getValue("INDEX", b); + a = Entry.variableContainer.getList(c, a); + b = Entry.getListRealIndex(b, a); + if (!a.array_ || isNaN(b) || b > a.array_.length) { throw Error("can not insert value to array"); } - return c.array_[d - 1].data; + return a.array_[b - 1].data; }; Blockly.Blocks.length_of_list = {init:function() { this.setColour("#E457DC"); @@ -5622,9 +5851,9 @@ Blockly.Blocks.length_of_list = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.length_of_list = function(b, a) { - var c = a.getField("LIST", a); - return Entry.variableContainer.getList(c).array_.length; +Entry.block.length_of_list = function(a, b) { + a = b.getField("LIST", b); + return Entry.variableContainer.getList(a).array_.length; }; Blockly.Blocks.show_list = {init:function() { this.setColour("#E457DC"); @@ -5634,10 +5863,10 @@ Blockly.Blocks.show_list = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.show_list = function(b, a) { - var c = a.getField("LIST", a); - Entry.variableContainer.getList(c).setVisible(!0); - return a.callReturn(); +Entry.block.show_list = function(a, b) { + a = b.getField("LIST", b); + Entry.variableContainer.getList(a).setVisible(!0); + return b.callReturn(); }; Blockly.Blocks.hide_list = {init:function() { this.setColour("#E457DC"); @@ -5647,10 +5876,10 @@ Blockly.Blocks.hide_list = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.hide_list = function(b, a) { - var c = a.getField("LIST", a); - Entry.variableContainer.getList(c).setVisible(!1); - return a.callReturn(); +Entry.block.hide_list = function(a, b) { + a = b.getField("LIST", b); + Entry.variableContainer.getList(a).setVisible(!1); + return b.callReturn(); }; Blockly.Blocks.options_for_list = {init:function() { this.setColour("#E457DC"); @@ -5660,8 +5889,8 @@ Blockly.Blocks.options_for_list = {init:function() { this.setOutput(!0, "Number"); this.setInputsInline(!0); }}; -Entry.block.options_for_list = function(b, a) { - return a.getField("OPERATOR", a); +Entry.block.options_for_list = function(a, b) { + return b.getField("OPERATOR", b); }; Blockly.Blocks.set_visible_answer = {init:function() { this.setColour("#E457DC"); @@ -5673,12 +5902,12 @@ Blockly.Blocks.set_visible_answer = {init:function() { this.setNextStatement(!0); }, whenAdd:function() { Entry.container && Entry.container.showProjectAnswer(); -}, whenRemove:function(b) { - Entry.container && Entry.container.hideProjectAnswer(b); +}, whenRemove:function(a) { + Entry.container && Entry.container.hideProjectAnswer(a); }}; -Entry.block.set_visible_answer = function(b, a) { - "HIDE" == a.getField("BOOL", a) ? Entry.container.inputValue.setVisible(!1) : Entry.container.inputValue.setVisible(!0); - return a.callReturn(); +Entry.block.set_visible_answer = function(a, b) { + "HIDE" == b.getField("BOOL", b) ? Entry.container.inputValue.setVisible(!1) : Entry.container.inputValue.setVisible(!0); + return b.callReturn(); }; Blockly.Blocks.is_included_in_list = {init:function() { this.setColour("#E457DC"); @@ -5690,34 +5919,37 @@ Blockly.Blocks.is_included_in_list = {init:function() { this.setOutput(!0, "Boolean"); this.setInputsInline(!0); }}; -Entry.block.is_included_in_list = function(b, a) { - var c = a.getField("LIST", a), d = a.getStringValue("DATA", a), c = Entry.variableContainer.getList(c); - if (!c) { +Entry.block.is_included_in_list = function(a, b) { + a = b.getField("LIST", b); + b = b.getStringValue("DATA", b); + a = Entry.variableContainer.getList(a); + if (!a) { return !1; } - for (var c = c.array_, e = 0, f = c.length;e < f;e++) { - if (c[e].data.toString() == d.toString()) { + a = a.array_; + for (var c = 0, d = a.length;c < d;c++) { + if (a[c].data.toString() == b.toString()) { return !0; } } return !1; }; Entry.Xbot = {PORT_MAP:{rightWheel:0, leftWheel:0, head:90, armR:90, armL:90, analogD5:127, analogD6:127, D4:0, D7:0, D12:0, D13:0, ledR:0, ledG:0, ledB:0, lcdNum:0, lcdTxt:" ", note:262, duration:0}, setZero:function() { - var b = Entry.Xbot.PORT_MAP, a = Entry.hw.sendQueue, c; - for (c in b) { - a[c] = b[c]; + var a = Entry.Xbot.PORT_MAP, b = Entry.hw.sendQueue, c; + for (c in a) { + b[c] = a[c]; } Entry.hw.update(); Entry.Xbot.removeAllTimeouts(); -}, timeouts:[], removeTimeout:function(b) { - clearTimeout(b); - var a = this.timeouts; - b = a.indexOf(b); - 0 <= b && a.splice(b, 1); +}, timeouts:[], removeTimeout:function(a) { + clearTimeout(a); + var b = this.timeouts; + a = b.indexOf(a); + 0 <= a && b.splice(a, 1); }, removeAllTimeouts:function() { - var b = this.timeouts, a; - for (a in b) { - clearTimeout(b[a]); + var a = this.timeouts, b; + for (b in a) { + clearTimeout(a[b]); } this.timeouts = []; }, name:"xbot_epor_edge"}; @@ -5727,9 +5959,10 @@ Blockly.Blocks.xbot_digitalInput = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Boolean"); }}; -Entry.block.xbot_digitalInput = function(b, a) { - var c = Entry.hw.portData, d = a.getField("DEVICE"); - return c[d]; +Entry.block.xbot_digitalInput = function(a, b) { + a = Entry.hw.portData; + b = b.getField("DEVICE"); + return a[b]; }; Blockly.Blocks.xbot_analogValue = {init:function() { this.setColour("#00979D"); @@ -5737,9 +5970,10 @@ Blockly.Blocks.xbot_analogValue = {init:function() { this.setInputsInline(!0); this.setOutput(!0, "Number"); }}; -Entry.block.xbot_analogValue = function(b, a) { - var c = Entry.hw.portData, d = a.getField("DEVICE"); - return c[d]; +Entry.block.xbot_analogValue = function(a, b) { + a = Entry.hw.portData; + b = b.getField("DEVICE"); + return a[b]; }; Blockly.Blocks.xbot_digitalOutput = {init:function() { this.setColour("#00979D"); @@ -5749,13 +5983,14 @@ Blockly.Blocks.xbot_digitalOutput = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.xbot_digitalOutput = function(b, a) { - var c = Entry.hw.sendQueue, d = a.getStringField("DEVICE", a), e = a.getStringField("VALUE", a); - c.D13 = "D13" == d && "HIGH" == e ? 1 : 0; - c.D4 = "D4" == d && "HIGH" == e ? 1 : 0; - c.D7 = "D7" == d && "HIGH" == e ? 1 : 0; - c.D12 = "D12" == d && "HIGH" == e ? 1 : 0; - return a.callReturn(); +Entry.block.xbot_digitalOutput = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getStringField("DEVICE", b), d = b.getStringField("VALUE", b); + a.D13 = "D13" == c && "HIGH" == d ? 1 : 0; + a.D4 = "D4" == c && "HIGH" == d ? 1 : 0; + a.D7 = "D7" == c && "HIGH" == d ? 1 : 0; + a.D12 = "D12" == c && "HIGH" == d ? 1 : 0; + return b.callReturn(); }; Blockly.Blocks.xbot_analogOutput = {init:function() { this.setColour("#00979D"); @@ -5766,10 +6001,11 @@ Blockly.Blocks.xbot_analogOutput = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.xbot_analogOutput = function(b, a) { - var c = Entry.hw.sendQueue, d = a.getStringField("DEVICE", a), e = a.getNumberValue("VALUE", a); - "analogD5" == d ? c.analogD5 = e : "analogD6" == d && (c.analogD6 = e); - return a.callReturn(); +Entry.block.xbot_analogOutput = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getStringField("DEVICE", b), d = b.getNumberValue("VALUE", b); + "analogD5" == c ? a.analogD5 = d : "analogD6" == c && (a.analogD6 = d); + return b.callReturn(); }; Blockly.Blocks.xbot_servo = {init:function() { this.setColour("#00979D"); @@ -5780,10 +6016,11 @@ Blockly.Blocks.xbot_servo = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.xbot_servo = function(b, a) { - var c = Entry.hw.sendQueue, d = a.getStringField("DEVICE", a), e = a.getNumberValue("VALUE", a); - "head" == d ? c.head = e : "right" == d ? c.armR = e : "left" == d && (c.armL = e); - return a.callReturn(); +Entry.block.xbot_servo = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getStringField("DEVICE", b), d = b.getNumberValue("VALUE", b); + "head" == c ? a.head = d : "right" == c ? a.armR = d : "left" == c && (a.armL = d); + return b.callReturn(); }; Blockly.Blocks.xbot_oneWheel = {init:function() { this.setColour("#00979D"); @@ -5794,10 +6031,11 @@ Blockly.Blocks.xbot_oneWheel = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.xbot_oneWheel = function(b, a) { - var c = Entry.hw.sendQueue, d = a.getStringField("DEVICE", a), e = a.getNumberValue("VALUE", a); - "rightWheel" == d ? c.rightWheel = e : "leftWheel" == d ? c.leftWheel = e : c.rightWheel = c.leftWheel = e; - return a.callReturn(); +Entry.block.xbot_oneWheel = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getStringField("DEVICE", b), d = b.getNumberValue("VALUE", b); + "rightWheel" == c ? a.rightWheel = d : "leftWheel" == c ? a.leftWheel = d : a.rightWheel = a.leftWheel = d; + return b.callReturn(); }; Blockly.Blocks.xbot_twoWheel = {init:function() { this.setColour("#00979D"); @@ -5810,11 +6048,11 @@ Blockly.Blocks.xbot_twoWheel = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.xbot_twoWheel = function(b, a) { - var c = Entry.hw.sendQueue; - c.rightWheel = a.getNumberValue("rightWheel"); - c.leftWheel = a.getNumberValue("leftWheel"); - return a.callReturn(); +Entry.block.xbot_twoWheel = function(a, b) { + a = Entry.hw.sendQueue; + a.rightWheel = b.getNumberValue("rightWheel"); + a.leftWheel = b.getNumberValue("leftWheel"); + return b.callReturn(); }; Blockly.Blocks.xbot_rgb = {init:function() { this.setColour("#00979D"); @@ -5829,12 +6067,12 @@ Blockly.Blocks.xbot_rgb = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.xbot_rgb = function(b, a) { - var c = Entry.hw.sendQueue; - c.ledR = a.getNumberValue("ledR"); - c.ledG = a.getNumberValue("ledG"); - c.ledB = a.getNumberValue("ledB"); - return a.callReturn(); +Entry.block.xbot_rgb = function(a, b) { + a = Entry.hw.sendQueue; + a.ledR = b.getNumberValue("ledR"); + a.ledG = b.getNumberValue("ledG"); + a.ledB = b.getNumberValue("ledB"); + return b.callReturn(); }; Blockly.Blocks.xbot_rgb_picker = {init:function() { this.setColour("#00979D"); @@ -5843,12 +6081,13 @@ Blockly.Blocks.xbot_rgb_picker = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.xbot_rgb_picker = function(b, a) { - var c = a.getStringField("VALUE"), d = Entry.hw.sendQueue; - d.ledR = parseInt(.3 * parseInt(c.substr(1, 2), 16)); - d.ledG = parseInt(.3 * parseInt(c.substr(3, 2), 16)); - d.ledB = parseInt(.3 * parseInt(c.substr(5, 2), 16)); - return a.callReturn(); +Entry.block.xbot_rgb_picker = function(a, b) { + a = b.getStringField("VALUE"); + var c = Entry.hw.sendQueue; + c.ledR = parseInt(.3 * parseInt(a.substr(1, 2), 16)); + c.ledG = parseInt(.3 * parseInt(a.substr(3, 2), 16)); + c.ledB = parseInt(.3 * parseInt(a.substr(5, 2), 16)); + return b.callReturn(); }; Blockly.Blocks.xbot_buzzer = {init:function() { this.setColour("#00979D"); @@ -5859,12 +6098,13 @@ Blockly.Blocks.xbot_buzzer = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.xbot_buzzer = function(b, a) { - var c = Entry.hw.sendQueue, d = a.getStringField("NOTE", a), e = a.getStringField("OCTAVE", a), f = a.getNumberValue("VALUE", a), d = d + e; - c.note = "C2" == d ? 65 : "D2" == d ? 73 : "E2" == d ? 82 : "F2" == d ? 87 : "G2" == d ? 98 : "A2" == d ? 110 : "B2" == d ? 123 : "C3" == d ? 131 : "D3" == d ? 147 : "E3" == d ? 165 : "F3" == d ? 175 : "G3" == d ? 196 : "A3" == d ? 220 : "B3" == d ? 247 : "C4" == d ? 262 : "D4" == d ? 294 : "E4" == d ? 330 : "F4" == d ? 349 : "G4" == d ? 392 : "A4" == d ? 440 : "B4" == d ? 494 : "C5" == d ? 523 : "D5" == d ? 587 : "E5" == d ? 659 : "F5" == d ? 698 : "G5" == d ? 784 : "A5" == d ? 880 : "B5" == d ? - 988 : "C6" == d ? 1047 : "D6" == d ? 1175 : "E6" == d ? 1319 : "F6" == d ? 1397 : "G6" == d ? 1568 : "A6" == d ? 1760 : "B6" == d ? 1976 : "C7" == d ? 2093 : "D7" == d ? 2349 : "E7" == d ? 2637 : "F7" == d ? 2794 : "G7" == d ? 3136 : "A7" == d ? 3520 : "B7" == d ? 3951 : 262; - c.duration = 40 * f; - return a.callReturn(); +Entry.block.xbot_buzzer = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getStringField("NOTE", b), d = b.getStringField("OCTAVE", b), e = b.getNumberValue("VALUE", b), c = c + d; + a.note = "C2" == c ? 65 : "D2" == c ? 73 : "E2" == c ? 82 : "F2" == c ? 87 : "G2" == c ? 98 : "A2" == c ? 110 : "B2" == c ? 123 : "C3" == c ? 131 : "D3" == c ? 147 : "E3" == c ? 165 : "F3" == c ? 175 : "G3" == c ? 196 : "A3" == c ? 220 : "B3" == c ? 247 : "C4" == c ? 262 : "D4" == c ? 294 : "E4" == c ? 330 : "F4" == c ? 349 : "G4" == c ? 392 : "A4" == c ? 440 : "B4" == c ? 494 : "C5" == c ? 523 : "D5" == c ? 587 : "E5" == c ? 659 : "F5" == c ? 698 : "G5" == c ? 784 : "A5" == c ? 880 : "B5" == c ? + 988 : "C6" == c ? 1047 : "D6" == c ? 1175 : "E6" == c ? 1319 : "F6" == c ? 1397 : "G6" == c ? 1568 : "A6" == c ? 1760 : "B6" == c ? 1976 : "C7" == c ? 2093 : "D7" == c ? 2349 : "E7" == c ? 2637 : "F7" == c ? 2794 : "G7" == c ? 3136 : "A7" == c ? 3520 : "B7" == c ? 3951 : 262; + a.duration = 40 * e; + return b.callReturn(); }; Blockly.Blocks.xbot_lcd = {init:function() { this.setColour("#00979D"); @@ -5875,1092 +6115,1819 @@ Blockly.Blocks.xbot_lcd = {init:function() { this.setPreviousStatement(!0); this.setNextStatement(!0); }}; -Entry.block.xbot_lcd = function(b, a) { - var c = Entry.hw.sendQueue, d = a.getNumberField("LINE", a), e = a.getStringValue("VALUE", a); - 0 == d ? (c.lcdNum = 0, c.lcdTxt = e) : 1 == d && (c.lcdNum = 1, c.lcdTxt = e); - return a.callReturn(); +Entry.block.xbot_lcd = function(a, b) { + a = Entry.hw.sendQueue; + var c = b.getNumberField("LINE", b), d = b.getStringValue("VALUE", b); + 0 == c ? (a.lcdNum = 0, a.lcdTxt = d) : 1 == c && (a.lcdNum = 1, a.lcdTxt = d); + return b.callReturn(); }; -Entry.Collection = function(b) { +Entry.Collection = function(a) { this.length = 0; this._hashMap = {}; this._observers = []; - this.set(b); + this.set(a); }; -(function(b, a) { - b.set = function(b) { +(function(a, b) { + a.set = function(a) { for (;this.length;) { - a.pop.call(this); + b.pop.call(this); } var d = this._hashMap, e; for (e in d) { delete d[e]; } - if (void 0 !== b) { + if (void 0 !== a) { e = 0; - for (var f = b.length;e < f;e++) { - var g = b[e]; + for (var f = a.length;e < f;e++) { + var g = a[e]; d[g.id] = g; - a.push.call(this, g); + b.push.call(this, g); } } }; - b.push = function(b) { - this._hashMap[b.id] = b; - a.push.call(this, b); + a.push = function(a) { + this._hashMap[a.id] = a; + b.push.call(this, a); }; - b.unshift = function() { - for (var b = Array.prototype.slice.call(arguments, 0), d = this._hashMap, e = b.length - 1;0 <= e;e--) { - var f = b[e]; - a.unshift.call(this, f); + a.unshift = function() { + for (var a = Array.prototype.slice.call(arguments, 0), d = this._hashMap, e = a.length - 1;0 <= e;e--) { + var f = a[e]; + b.unshift.call(this, f); d[f.id] = f; } }; - b.insert = function(b, d) { - a.splice.call(this, d, 0, b); - this._hashMap[b.id] = b; + a.insert = function(a, d) { + b.splice.call(this, d, 0, a); + this._hashMap[a.id] = a; }; - b.has = function(a) { - return !!this._hashMap[a]; + a.has = function(b) { + return !!this._hashMap[b]; }; - b.get = function(a) { - return this._hashMap[a]; + a.get = function(b) { + return this._hashMap[b]; }; - b.at = function(a) { - return this[a]; + a.at = function(b) { + return this[b]; }; - b.getAll = function() { - for (var a = this.length, b = [], e = 0;e < a;e++) { - b.push(this[e]); + a.getAll = function() { + for (var b = this.length, a = [], e = 0;e < b;e++) { + a.push(this[e]); } - return b; + return a; }; - b.indexOf = function(b) { - return a.indexOf.call(this, b); + a.indexOf = function(a) { + return b.indexOf.call(this, a); }; - b.find = function(a) { - for (var b = [], e, f = 0, g = this.length;f < g;f++) { + a.find = function(b) { + for (var a = [], e, f = 0, g = this.length;f < g;f++) { e = !0; var h = this[f], k; - for (k in a) { - if (a[k] != h[k]) { + for (k in b) { + if (b[k] != h[k]) { e = !1; break; } } - e && b.push(h); + e && a.push(h); } - return b; + return a; }; - b.pop = function() { - var b = a.pop.call(this); - delete this._hashMap[b.id]; - return b; + a.pop = function() { + var a = b.pop.call(this); + delete this._hashMap[a.id]; + return a; }; - b.shift = function() { - var b = a.shift.call(this); - delete this._hashMap[b.id]; - return b; + a.shift = function() { + var a = b.shift.call(this); + delete this._hashMap[a.id]; + return a; }; - b.slice = function(b, d) { - var e = a.slice.call(this, b, d), f = this._hashMap, g; - for (g in e) { - delete f[e[g].id]; + a.slice = function(a, d) { + a = b.slice.call(this, a, d); + d = this._hashMap; + for (var e in a) { + delete d[a[e].id]; } - return e; + return a; }; - b.remove = function(a) { - var b = this.indexOf(a); - -1 < b && (delete this._hashMap[a.id], this.splice(b, 1)); + a.remove = function(b) { + var a = this.indexOf(b); + -1 < a && (delete this._hashMap[b.id], this.splice(a, 1)); }; - b.splice = function(b, d) { - var e = a.slice.call(arguments, 2), f = this._hashMap; - d = void 0 === d ? this.length - b : d; - for (var g = a.splice.call(this, b, d), h = 0, k = g.length;h < k;h++) { + a.splice = function(a, d) { + var e = b.slice.call(arguments, 2), f = this._hashMap; + d = void 0 === d ? this.length - a : d; + for (var g = b.splice.call(this, a, d), h = 0, k = g.length;h < k;h++) { delete f[g[h].id]; } h = 0; for (k = e.length;h < k;h++) { - f = e[h], a.splice.call(this, b++, 0, f), this._hashMap[f.id] = f; + f = e[h], b.splice.call(this, a++, 0, f), this._hashMap[f.id] = f; } return g; }; - b.clear = function() { + a.clear = function() { for (;this.length;) { - a.pop.call(this); + b.pop.call(this); } this._hashMap = {}; }; - b.map = function(a, b) { + a.map = function(b, a) { for (var e = [], f = 0, g = this.length;f < g;f++) { - e.push(a(this[f], b)); + e.push(b(this[f], a)); } return e; }; - b.moveFromTo = function(b, d) { + a.moveFromTo = function(a, d) { var e = this.length - 1; - 0 > b || 0 > d || b > e || d > e || a.splice.call(this, d, 0, a.splice.call(this, b, 1)[0]); + 0 > a || 0 > d || a > e || d > e || b.splice.call(this, d, 0, b.splice.call(this, a, 1)[0]); }; - b.sort = function() { + a.sort = function() { }; - b.fromJSON = function() { + a.fromJSON = function() { }; - b.toJSON = function() { - for (var a = [], b = 0, e = this.length;b < e;b++) { - a.push(this[b].toJSON()); + a.toJSON = function() { + for (var b = [], a = 0, e = this.length;a < e;a++) { + b.push(this[a].toJSON()); } - return a; + return b; }; - b.observe = function() { + a.observe = function() { }; - b.unobserve = function() { + a.unobserve = function() { }; - b.notify = function() { + a.notify = function() { }; - b.destroy = function() { + a.destroy = function() { }; })(Entry.Collection.prototype, Array.prototype); -Entry.Event = function(b) { - this._sender = b; +Entry.Event = function(a) { + this._sender = a; this._listeners = []; }; -(function(b) { - b.attach = function(a, b) { - var d = this, e = {obj:a, fn:b, destroy:function() { +(function(a) { + a.attach = function(b, a) { + var d = this; + b = {obj:b, fn:a, destroy:function() { d.detach(this); }}; - this._listeners.push(e); - return e; + this._listeners.push(b); + return b; }; - b.detach = function(a) { - var b = this._listeners; - a = b.indexOf(a); - if (-1 < a) { - return b.splice(a, 1); + a.detach = function(b) { + var a = this._listeners; + b = a.indexOf(b); + if (-1 < b) { + return a.splice(b, 1); } }; - b.clear = function() { - for (var a = this._listeners;a.length;) { - a.pop(); + a.clear = function() { + for (var b = this._listeners;b.length;) { + b.pop(); } }; - b.notify = function() { - var a = arguments; - this._listeners.slice().forEach(function(b) { - b.fn.apply(b.obj, a); + a.notify = function() { + var b = arguments; + this._listeners.slice().forEach(function(a) { + a.fn.apply(a.obj, b); }); }; })(Entry.Event.prototype); -Entry.Observer = function(b, a, c, d) { - this.parent = b; - this.object = a; - this.funcName = c; - this.attrs = d; - b.push(this); -}; -(function(b) { - b.destroy = function() { - var a = this.parent, b = a.indexOf(this); - -1 < b && a.splice(b, 1); - return this; +Entry.Utils = {}; +Entry.overridePrototype = function() { + Number.prototype.mod = function(a) { + return (this % a + a) % a; }; -})(Entry.Observer.prototype); -Entry.Command = {}; -(function(b) { - b["do"] = {type:EntryStatic.COMMAND_TYPES["do"], log:function(a) { - return [b["do"].type]; - }}; - b.undo = {type:EntryStatic.COMMAND_TYPES.undo, log:function(a) { - return [b.undo.type]; - }}; - b.redo = {type:EntryStatic.COMMAND_TYPES.redo, log:function(a) { - return [b.redo.type]; - }}; -})(Entry.Command); -Entry.Commander = function(b) { - if ("workspace" == b || "phone" == b) { - Entry.stateManager = new Entry.StateManager; - } - Entry.do = this.do.bind(this); - Entry.undo = this.undo.bind(this); - this.editor = {}; - this.reporters = []; - this._tempStorage = null; - Entry.Command.editor = this.editor; }; -(function(b) { - b.do = function(a) { - var b = this, d = Array.prototype.slice.call(arguments); - d.shift(); - var e = Entry.Command[a]; - Entry.stateManager && Entry.stateManager.addCommand.apply(Entry.stateManager, [a, this, this.do, e.undo].concat(e.state.apply(this, d))); - e = Entry.Command[a].do.apply(this, d); - setTimeout(function() { - b.report("do"); - b.report(a, d); - }, 0); - return {value:e, isPass:this.isPass.bind(this)}; - }; - b.undo = function() { - var a = Array.prototype.slice.call(arguments), b = a.shift(), d = Entry.Command[b]; - this.report("undo"); - Entry.stateManager && Entry.stateManager.addCommand.apply(Entry.stateManager, [b, this, this.do, d.undo].concat(d.state.apply(this, a))); - return {value:Entry.Command[b].do.apply(this, a), isPass:this.isPass.bind(this)}; - }; - b.redo = function() { - var a = Array.prototype.slice.call(arguments), b = a.shift(), d = Entry.Command[b]; - that.report("redo"); - Entry.stateManager && Entry.stateManager.addCommand.apply(Entry.stateManager, [b, this, this.undo, b].concat(d.state.apply(null, a))); - d.undo.apply(this, a); - }; - b.setCurrentEditor = function(a, b) { - this.editor[a] = b; - }; - b.isPass = function(a) { - a = void 0 === a ? !0 : a; - if (Entry.stateManager) { - var b = Entry.stateManager.getLastCommand(); - b && (b.isPass = a); - } - }; - b.addReporter = function(a) { - this.reporters.push(a); - }; - b.removeReporter = function(a) { - a = this.reporters.indexOf(a); - -1 < a && this.reporters.splice(a, 1); - }; - b.report = function(a, b) { - var d = this.reporters; - if (0 !== d.length) { - var e; - e = a && Entry.Command[a] && Entry.Command[a].log ? Entry.Command[a].log.apply(this, b) : b; - d.forEach(function(a) { - a.add(e); - }); +Entry.Utils.generateId = function() { + return ("0000" + (Math.random() * Math.pow(36, 4) << 0).toString(36)).substr(-4); +}; +Entry.Utils.intersectArray = function(a, b) { + for (var c = [], d = 0;d < a.length;d++) { + for (var e = 0;e < b.length;e++) { + if (a[d] == b[e]) { + c.push(a[d]); + break; + } } - }; -})(Entry.Commander.prototype); -(function(b) { - b.addThread = {type:EntryStatic.COMMAND_TYPES.addThread, do:function(a) { - return this.editor.board.code.createThread(a); - }, state:function(a) { - a.length && (a[0].id = Entry.Utils.generateId()); - return [a]; - }, log:function(a) { - a = this.editor.board.code.getThreads().pop(); - return [b.addThread.type, ["thread", a.stringify()], ["code", this.editor.board.code.stringify()]]; - }, undo:"destroyThread"}; - b.destroyThread = {type:EntryStatic.COMMAND_TYPES.destroyThread, do:function(a) { - this.editor.board.findById(a[0].id).destroy(!0, !0); - }, state:function(a) { - return [this.editor.board.findById(a[0].id).thread.toJSON()]; - }, log:function(a) { - a = a[0].id; - this.editor.board.findById(a); - return [b.destroyThread.type, ["blockId", a], ["code", this.editor.board.code.stringify()]]; - }, undo:"addThread"}; - b.destroyBlock = {type:EntryStatic.COMMAND_TYPES.destroyBlock, do:function(a) { - "string" === typeof a && (a = this.editor.board.findById(a)); - a.doDestroy(!0); - }, state:function(a) { - "string" === typeof a && (a = this.editor.board.findById(a)); - return [a.toJSON(), a.pointer()]; - }, log:function(a) { - "string" === typeof a && (a = this.editor.board.findById(a)); - return [b.destroyBlock.type, ["blockId", a.id], ["code", this.editor.board.code.stringify()]]; - }, undo:"recoverBlock"}; - b.recoverBlock = {type:EntryStatic.COMMAND_TYPES.recoverBlock, do:function(a, b) { - var d = this.editor.board.code.createThread([a]).getFirstBlock(); - "string" === typeof d && (d = this.editor.board.findById(d)); - this.editor.board.insert(d, b); - }, state:function(a) { - "string" !== typeof a && (a = a.id); - return [a]; - }, log:function(a, c) { - a = this.editor.board.findById(a.id); - return [b.recoverBlock.type, ["block", a.stringify()], ["pointer", c], ["code", this.editor.board.code.stringify()]]; - }, undo:"destroyBlock"}; - b.insertBlock = {type:EntryStatic.COMMAND_TYPES.insertBlock, do:function(a, b, d) { - "string" === typeof a && (a = this.editor.board.findById(a)); - this.editor.board.insert(a, b, d); - }, state:function(a, b) { - "string" === typeof a && (a = this.editor.board.findById(a)); - var d = [a.id], e = a.targetPointer(); - d.push(e); - "string" !== typeof a && "basic" === a.getBlockType() && d.push(a.thread.getCount(a)); - return d; - }, log:function(a, c, d) { - "string" === typeof a && (a = this.editor.board.findById(a)); - return [b.insertBlock.type, ["blockId", a.id], ["targetPointer", a.targetPointer()], ["count", d], ["code", this.editor.board.code.stringify()]]; - }, undo:"insertBlock"}; - b.separateBlock = {type:EntryStatic.COMMAND_TYPES.separateBlock, do:function(a) { - a.view && a.view._toGlobalCoordinate(Entry.DRAG_MODE_DRAG); - a.doSeparate(); - }, state:function(a) { - var b = [a.id], d = a.targetPointer(); - b.push(d); - "basic" === a.getBlockType() && b.push(a.thread.getCount(a)); - return b; - }, log:function(a) { - "string" === typeof a && (a = this.editor.board.findById(a)); - return [b.separateBlock.type, ["blockId", a.id], ["x", a.x], ["y", a.y], ["code", this.editor.board.code.stringify()]]; - }, undo:"insertBlock"}; - b.moveBlock = {type:EntryStatic.COMMAND_TYPES.moveBlock, do:function(a, b, d) { - void 0 !== b ? (a = this.editor.board.findById(a), a.moveTo(b, d)) : a._updatePos(); - }, state:function(a) { - "string" === typeof a && (a = this.editor.board.findById(a)); - return [a.id, a.x, a.y]; - }, log:function(a, c, d) { - return [b.moveBlock.type, ["blockId", a.id], ["x", a.x], ["y", a.y], ["code", this.editor.board.code.stringify()]]; - }, undo:"moveBlock"}; - b.cloneBlock = {type:EntryStatic.COMMAND_TYPES.cloneBlock, do:function(a) { - "string" === typeof a && (a = this.editor.board.findById(a)); - this.editor.board.code.createThread(a.copy()); - }, state:function(a) { - "string" !== typeof a && (a = a.id); - return [a]; - }, log:function(a) { - "string" === typeof a && (a = this.editor.board.findById(a)); - var c = this.editor.board.code.getThreads().pop(); - return [b.cloneBlock.type, ["blockId", a.id], ["thread", c.stringify()], ["code", this.editor.board.code.stringify()]]; - }, undo:"uncloneBlock"}; - b.uncloneBlock = {type:EntryStatic.COMMAND_TYPES.uncloneBlock, do:function(a) { - a = this.editor.board.code.getThreads().pop().getFirstBlock(); - this._tempStorage = a.id; - a.destroy(!0, !0); - }, state:function(a) { - return [a]; - }, log:function(a) { - a = this._tempStorage; - this._tempStorage = null; - return [b.uncloneBlock.type, ["blockId", a], ["code", this.editor.board.code.stringify()]]; - }, undo:"cloneBlock"}; - b.scrollBoard = {type:EntryStatic.COMMAND_TYPES.scrollBoard, do:function(a, b, d) { - d || this.editor.board.scroller._scroll(a, b); - delete this.editor.board.scroller._diffs; - }, state:function(a, b) { - return [-a, -b]; - }, log:function(a, c) { - return [b.scrollBoard.type, ["dx", a], ["dy", c]]; - }, undo:"scrollBoard"}; - b.setFieldValue = {type:EntryStatic.COMMAND_TYPES.setFieldValue, do:function(a, b, d, e, f) { - b.setValue(f, !0); - }, state:function(a, b, d, e, f) { - return [a, b, d, f, e]; - }, log:function(a, c, d, e, f) { - return [b.setFieldValue.type, ["pointer", d], ["newValue", f], ["code", this.editor.board.code.stringify()]]; - }, undo:"setFieldValue"}; -})(Entry.Command); -(function(b) { - b.selectObject = {type:EntryStatic.COMMAND_TYPES.selectObject, do:function(a) { - return Entry.container.selectObject(a); - }, state:function(a) { - if ((a = Entry.playground) && a.object) { - return [a.object.id]; - } - }, log:function(a) { - return [a]; - }, undo:"selectObject"}; -})(Entry.Command); -Entry.Container = function() { - this.objects_ = []; - this.cachedPicture = {}; - this.inputValue = {}; - this.currentObjects_ = this.copiedObject = null; + } + return c; }; -Entry.Container.prototype.generateView = function(b, a) { - var c = this; - this._view = b; - this._view.addClass("entryContainer"); - this._view.addClass("entryContainerWorkspace"); - this._view.setAttribute("id", "entryContainerWorkspaceId"); - var d = Entry.createElement("div"); - d.addClass("entryAddObjectWorkspace"); - d.innerHTML = Lang.Workspace.add_object; - d.bindOnClick(function(a) { - Entry.dispatchEvent("openSpriteManager"); - }); - var d = Entry.createElement("div"), e = "entryContainerListWorkspaceWrapper"; - Entry.isForLecture && (e += " lecture"); - d.addClass(e); - Entry.Utils.disableContextmenu(d); - $(d).bind("mousedown touchstart", function(a) { - function b(a) { - q && 5 < Math.sqrt(Math.pow(a.pageX - q.x, 2) + Math.pow(a.pageY - q.y, 2)) && e && (clearTimeout(e), e = null); +Entry.Utils.isPointInMatrix = function(a, b, c) { + c = void 0 === c ? 0 : c; + var d = a.offsetX ? a.x + a.offsetX : a.x, e = a.offsetY ? a.y + a.offsety : a.y; + return d - c <= b.x && d + a.width + c >= b.x && e - c <= b.y && e + a.height + c >= b.y; +}; +Entry.Utils.colorDarken = function(a, b) { + function c(b) { + 2 != b.length && (b = "0" + b); + return b; + } + var d, e; + 7 === a.length ? (d = parseInt(a.substr(1, 2), 16), e = parseInt(a.substr(3, 2), 16), a = parseInt(a.substr(5, 2), 16)) : (d = parseInt(a.substr(1, 2), 16), e = parseInt(a.substr(2, 2), 16), a = parseInt(a.substr(3, 2), 16)); + b = void 0 === b ? .7 : b; + d = c(Math.floor(d * b).toString(16)); + e = c(Math.floor(e * b).toString(16)); + a = c(Math.floor(a * b).toString(16)); + return "#" + d + e + a; +}; +Entry.Utils.colorLighten = function(a, b) { + b = 0 === b ? 0 : b || 20; + a = Entry.Utils.hexToHsl(a); + a.l += b / 100; + a.l = Math.min(1, Math.max(0, a.l)); + return Entry.Utils.hslToHex(a); +}; +Entry.Utils.bound01 = function(a, b) { + var c = a; + "string" == typeof c && -1 != c.indexOf(".") && 1 === parseFloat(c) && (a = "100%"); + c = "string" === typeof a && -1 != a.indexOf("%"); + a = Math.min(b, Math.max(0, parseFloat(a))); + c && (a = parseInt(a * b, 10) / 100); + return 1E-6 > Math.abs(a - b) ? 1 : a % b / parseFloat(b); +}; +Entry.Utils.hexToHsl = function(a) { + var b, c; + 7 === a.length ? (b = parseInt(a.substr(1, 2), 16), c = parseInt(a.substr(3, 2), 16), a = parseInt(a.substr(5, 2), 16)) : (b = parseInt(a.substr(1, 2), 16), c = parseInt(a.substr(2, 2), 16), a = parseInt(a.substr(3, 2), 16)); + b = Entry.Utils.bound01(b, 255); + c = Entry.Utils.bound01(c, 255); + a = Entry.Utils.bound01(a, 255); + var d = Math.max(b, c, a), e = Math.min(b, c, a), f, g = (d + e) / 2; + if (d == e) { + f = e = 0; + } else { + var h = d - e, e = .5 < g ? h / (2 - d - e) : h / (d + e); + switch(d) { + case b: + f = (c - a) / h + (c < a ? 6 : 0); + break; + case c: + f = (a - b) / h + 2; + break; + case a: + f = (b - c) / h + 4; } - function d(a) { - a.stopPropagation(); - l.unbind(".container"); - e && (clearTimeout(e), e = null); + f /= 6; + } + return {h:360 * f, s:e, l:g}; +}; +Entry.Utils.hslToHex = function(a) { + function b(b, a, c) { + 0 > c && (c += 1); + 1 < c && --c; + return c < 1 / 6 ? b + 6 * (a - b) * c : .5 > c ? a : c < 2 / 3 ? b + (a - b) * (2 / 3 - c) * 6 : b; + } + function c(b) { + return 1 == b.length ? "0" + b : "" + b; + } + var d, e; + e = Entry.Utils.bound01(a.h, 360); + d = Entry.Utils.bound01(a.s, 1); + a = Entry.Utils.bound01(a.l, 1); + if (0 === d) { + d = a = e = a; + } else { + var f = .5 > a ? a * (1 + d) : a + d - a * d, g = 2 * a - f; + d = b(g, f, e + 1 / 3); + a = b(g, f, e); + e = b(g, f, e - 1 / 3); + } + a *= 255; + e *= 255; + return "#" + [c(Math.round(255 * d).toString(16)), c(Math.round(a).toString(16)), c(Math.round(e).toString(16))].join(""); +}; +Entry.Utils.bindGlobalEvent = function(a) { + var b = $(document); + void 0 === a && (a = "resize mousedown mousemove keydown keyup dispose".split(" ")); + -1 < a.indexOf("resize") && (Entry.windowReszied && ($(window).off("resize"), Entry.windowReszied.clear()), Entry.windowResized = new Entry.Event(window), $(window).on("resize", function(b) { + Entry.windowResized.notify(b); + })); + -1 < a.indexOf("mousedown") && (Entry.documentMousedown && (b.off("mousedown"), Entry.documentMousedown.clear()), Entry.documentMousedown = new Entry.Event(window), b.on("mousedown", function(b) { + Entry.documentMousedown.notify(b); + })); + -1 < a.indexOf("mousemove") && (Entry.documentMousemove && (b.off("touchmove mousemove"), Entry.documentMousemove.clear()), Entry.mouseCoordinate = {}, Entry.documentMousemove = new Entry.Event(window), b.on("touchmove mousemove", function(b) { + b.originalEvent && b.originalEvent.touches && (b = b.originalEvent.touches[0]); + Entry.documentMousemove.notify(b); + Entry.mouseCoordinate.x = b.clientX; + Entry.mouseCoordinate.y = b.clientY; + })); + -1 < a.indexOf("keydown") && (Entry.keyPressed && (b.off("keydown"), Entry.keyPressed.clear()), Entry.pressedKeys = [], Entry.keyPressed = new Entry.Event(window), b.on("keydown", function(b) { + var a = b.keyCode; + 0 > Entry.pressedKeys.indexOf(a) && Entry.pressedKeys.push(a); + Entry.keyPressed.notify(b); + })); + -1 < a.indexOf("keyup") && (Entry.keyUpped && (b.off("keyup"), Entry.keyUpped.clear()), Entry.keyUpped = new Entry.Event(window), b.on("keyup", function(b) { + var a = Entry.pressedKeys.indexOf(b.keyCode); + -1 < a && Entry.pressedKeys.splice(a, 1); + Entry.keyUpped.notify(b); + })); + -1 < a.indexOf("dispose") && (Entry.disposeEvent && Entry.disposeEvent.clear(), Entry.disposeEvent = new Entry.Event(window), Entry.documentMousedown && Entry.documentMousedown.attach(this, function(b) { + Entry.disposeEvent.notify(b); + })); +}; +Entry.Utils.makeActivityReporter = function() { + Entry.activityReporter = new Entry.ActivityReporter; + Entry.commander && Entry.commander.addReporter(Entry.activityReporter); + return Entry.activityReporter; +}; +Entry.Utils.initEntryEvent_ = function() { + Entry.events_ || (Entry.events_ = []); +}; +Entry.sampleColours = []; +Entry.assert = function(a, b) { + if (!a) { + throw Error(b || "Assert failed"); + } +}; +Entry.parseTexttoXML = function(a) { + var b; + window.ActiveXObject ? (b = new ActiveXObject("Microsoft.XMLDOM"), b.async = "false", b.loadXML(a)) : b = (new DOMParser).parseFromString(a, "text/xml"); + return b; +}; +Entry.createElement = function(a, b) { + a = document.createElement(a); + b && (a.id = b); + a.hasClass = function(b) { + return this.className.match(new RegExp("(\\s|^)" + b + "(\\s|$)")); + }; + a.addClass = function(b) { + for (var a = 0;a < arguments.length;a++) { + b = arguments[a], this.hasClass(b) || (this.className += " " + b); } - var e = null, l = $(document), n = a.type, m = !1; - if (Entry.Utils.isRightButton(a)) { - c._rightClick(a), m = !0; - } else { - var q = {x:a.clientX, y:a.clientY}; - "touchstart" !== n || m || (a.stopPropagation(), a = Entry.Utils.convertMouseEvent(a), e = setTimeout(function() { - e && (e = null, c._rightClick(a)); - }, 1E3), l.bind("mousemove.container touchmove.container", b), l.bind("mouseup.container touchend.container", d)); + }; + a.removeClass = function(b) { + for (var a = 0;a < arguments.length;a++) { + b = arguments[a], this.hasClass(b) && (this.className = this.className.replace(new RegExp("(\\s|^)" + b + "(\\s|$)"), " ")); } - }); - this._view.appendChild(d); - e = Entry.createElement("ul"); - e.addClass("entryContainerListWorkspace"); - d.appendChild(e); - this.listView_ = e; - this.enableSort(); + }; + a.bindOnClick = function(b) { + $(this).on("click tab", function(a) { + a.stopImmediatePropagation(); + b.call(this, a); + }); + }; + return a; }; -Entry.Container.prototype.enableSort = function() { - $ && $(this.listView_).sortable({start:function(b, a) { - a.item.data("start_pos", a.item.index()); - }, stop:function(b, a) { - var c = a.item.data("start_pos"), d = a.item.index(); - Entry.container.moveElement(c, d); - }, axis:"y", cancel:"input.selectedEditingObject"}); +Entry.makeAutolink = function(a) { + return a ? a.replace(/(http|https|ftp|telnet|news|irc):\/\/([-/.a-zA-Z0-9_~#%$?&=:200-377()][^)\]}]+)/gi, "$1://$2").replace(/([xA1-xFEa-z0-9_-]+@[xA1-xFEa-z0-9-]+.[a-z0-9-]+)/gi, "$1") : ""; }; -Entry.Container.prototype.disableSort = function() { - $ && $(this.listView_).sortable("destroy"); +Entry.generateHash = function() { + return ("0000" + (Math.random() * Math.pow(36, 4) << 0).toString(36)).substr(-4); }; -Entry.Container.prototype.updateListView = function() { - if (this.listView_) { - for (var b = this.listView_;b.hasChildNodes();) { - b.removeChild(b.lastChild); - } - var a = this.getCurrentObjects(), c; - for (c in a) { - b.appendChild(a[c].view_); +Entry.addEventListener = function(a, b) { + this.events_ || (this.events_ = {}); + this.events_[a] || (this.events_[a] = []); + b instanceof Function && this.events_[a].push(b); + return !0; +}; +Entry.dispatchEvent = function(a, b) { + this.events_ || (this.events_ = {}); + if (this.events_[a]) { + for (var c = 0, d = this.events_[a].length;c < d;c++) { + this.events_[a][c].call(window, b); } - Entry.stage.sortZorder(); } }; -Entry.Container.prototype.setObjects = function(b) { - for (var a in b) { - var c = new Entry.EntryObject(b[a]); - this.objects_.push(c); - c.generateView(); - c.pictures.map(function(a) { - Entry.playground.generatePictureElement(a); - }); - c.sounds.map(function(a) { - Entry.playground.generateSoundElement(a); - }); +Entry.removeEventListener = function(a, b) { + if (this.events_[a]) { + for (var c = 0, d = this.events_[a].length;c < d;c++) { + if (this.events_[a][c] === b) { + this.events_[a].splice(c, 1); + break; + } + } } - this.updateObjectsOrder(); - this.updateListView(); - Entry.stage.sortZorder(); - Entry.variableContainer.updateViews(); - b = Entry.type; - ("workspace" == b || "phone" == b) && (b = this.getCurrentObjects()[0]) && this.selectObject(b.id); }; -Entry.Container.prototype.getPictureElement = function(b, a) { - var c = this.getObject(a).getPicture(b); - if (c) { - return c.view; +Entry.removeAllEventListener = function(a) { + this.events_ && this.events_[a] && delete this.events_[a]; +}; +Entry.addTwoNumber = function(a, b) { + if (isNaN(a) || isNaN(b)) { + return a + b; } - throw Error("No picture found"); + a += ""; + b += ""; + var c = a.indexOf("."), d = b.indexOf("."), e = 0, f = 0; + 0 < c && (e = a.length - c - 1); + 0 < d && (f = b.length - d - 1); + return 0 < e || 0 < f ? e >= f ? (parseFloat(a) + parseFloat(b)).toFixed(e) : (parseFloat(a) + parseFloat(b)).toFixed(f) : parseInt(a) + parseInt(b); }; -Entry.Container.prototype.setPicture = function(b) { - var a = this.getObject(b.objectId), c; - for (c in a.pictures) { - if (b.id === a.pictures[c].id) { - var d = {}; - d.dimension = b.dimension; - d.id = b.id; - d.filename = b.filename; - d.fileurl = b.fileurl; - d.name = b.name; - d.view = a.pictures[c].view; - a.pictures[c] = d; - return; +Entry.hex2rgb = function(a) { + return (a = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a)) ? {r:parseInt(a[1], 16), g:parseInt(a[2], 16), b:parseInt(a[3], 16)} : null; +}; +Entry.rgb2hex = function(a, b, c) { + return "#" + (16777216 + (a << 16) + (b << 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(a, b, c) { + return a > c ? c : a < b ? b : a; +}; +Entry.isExist = function(a, b, c) { + for (var d = 0;d < c.length;d++) { + if (c[d][b] == a) { + return c[d]; } } - throw Error("No picture found"); + return !1; }; -Entry.Container.prototype.selectPicture = function(b, a) { - var c = this.getObject(a), d = c.getPicture(b); - if (d) { - return c.selectedPicture = d, c.entity.setImage(d), c.updateThumbnailView(), c.id; +Entry.getColourCodes = function() { + return "transparent #660000 #663300 #996633 #003300 #003333 #003399 #000066 #330066 #660066 #FFFFFF #990000 #993300 #CC9900 #006600 #336666 #0033FF #000099 #660099 #990066 #000000 #CC0000 #CC3300 #FFCC00 #009900 #006666 #0066FF #0000CC #663399 #CC0099 #333333 #FF0000 #FF3300 #FFFF00 #00CC00 #009999 #0099FF #0000FF #9900CC #FF0099 #666666 #CC3333 #FF6600 #FFFF33 #00FF00 #00CCCC #00CCFF #3366FF #9933FF #FF00FF #999999 #FF6666 #FF6633 #FFFF66 #66FF66 #66CCCC #00FFFF #3399FF #9966FF #FF66FF #BBBBBB #FF9999 #FF9966 #FFFF99 #99FF99 #66FFCC #99FFFF #66CCff #9999FF #FF99FF #CCCCCC #FFCCCC #FFCC99 #FFFFCC #CCFFCC #99FFCC #CCFFFF #99CCFF #CCCCFF #FFCCFF".split(" "); +}; +Entry.removeElement = function(a) { + a && a.parentNode && a.parentNode.removeChild(a); +}; +Entry.getElementsByClassName = function(a) { + for (var b = [], c = document.getElementsByTagName("*"), d = 0;d < c.length;d++) { + -1 < (" " + c[d].className + " ").indexOf(" " + a + " ") && b.push(c[d]); } - throw Error("No picture found"); + return b; }; -Entry.Container.prototype.addObject = function(b, a) { - var c = new Entry.EntryObject(b); - c.name = Entry.getOrderedName(c.name, this.objects_); - Entry.stateManager && Entry.stateManager.addCommand("add object", this, this.removeObject, c); - c.scene || (c.scene = Entry.scene.selectedScene); - "number" == typeof a ? b.sprite.category && "background" == b.sprite.category.main ? (c.setLock(!0), this.objects_.push(c)) : this.objects_.splice(a, 0, c) : b.sprite.category && "background" == b.sprite.category.main ? this.objects_.push(c) : this.objects_.unshift(c); - c.generateView(); - c.pictures.map(function(a) { - Entry.playground.generatePictureElement(a); - }); - c.sounds.map(function(a) { - Entry.playground.generateSoundElement(a); - }); - this.setCurrentObjects(); - this.updateObjectsOrder(); - this.updateListView(); - this.selectObject(c.id); - Entry.variableContainer.updateViews(); - return new Entry.State(this, this.removeObject, c); +Entry.parseNumber = function(a) { + return "string" != typeof a || isNaN(Number(a)) ? "number" != typeof a || isNaN(Number(a)) ? !1 : a : Number(a); }; -Entry.Container.prototype.addCloneObject = function(b, a) { - var c = b.toJSON(), d = Entry.generateHash(); - Entry.variableContainer.addCloneLocalVariables({objectId:c.id, newObjectId:d, json:c}); - c.id = d; - c.scene = a || Entry.scene.selectedScene; - this.addObject(c); -}; -Entry.Container.prototype.removeObject = function(b) { - var a = this.objects_.indexOf(b), c = b.toJSON(); - Entry.stateManager && Entry.stateManager.addCommand("remove object", this, this.addObject, c, a); - c = new Entry.State(this.addObject, c, a); - b.destroy(); - this.objects_.splice(a, 1); - this.setCurrentObjects(); - Entry.stage.sortZorder(); - this.objects_.length && 0 !== a ? 0 < this.getCurrentObjects().length ? Entry.container.selectObject(this.getCurrentObjects()[0].id) : Entry.container.selectObject() : this.objects_.length && 0 === a ? Entry.container.selectObject(this.getCurrentObjects()[0].id) : (Entry.container.selectObject(), Entry.playground.flushPlayground()); - Entry.toast.success(Lang.Workspace.remove_object, b.name + " " + Lang.Workspace.remove_object_msg); - Entry.variableContainer.removeLocalVariables(b.id); - Entry.playground.reloadPlayground(); +Entry.countStringLength = function(a) { + var b, c = 0; + for (b = 0;b < a.length;b++) { + 255 < a.charCodeAt(b) ? c += 2 : c++; + } return c; }; -Entry.Container.prototype.selectObject = function(b, a) { - var c = this.getObject(b); - a && c && Entry.scene.selectScene(c.scene); - this.mapObjectOnScene(function(a) { - a.view_ && a.view_.removeClass("selectedObject"); - a.isSelected_ = !1; - }); - c && (c.view_ && c.view_.addClass("selectedObject"), c.isSelected_ = !0); - Entry.playground && Entry.playground.injectObject(c); - "minimize" != Entry.type && Entry.engine.isState("stop") && Entry.stage.selectObject(c); -}; -Entry.Container.prototype.getAllObjects = function() { - return this.objects_; +Entry.cutStringByLength = function(a, b) { + var c, d = 0; + for (c = 0;d < b && c < a.length;c++) { + 255 < a.charCodeAt(c) ? d += 2 : d++; + } + return a.substr(0, c); }; -Entry.Container.prototype.getObject = function(b) { - !b && Entry.playground && Entry.playground.object && (b = Entry.playground.object.id); - for (var a = this.objects_.length, c = 0;c < a;c++) { - var d = this.objects_[c]; - if (d.id == b) { - return d; +Entry.isChild = function(a, b) { + if (!b) { + for (;b.parentNode;) { + if ((b = b.parentNode) == a) { + return !0; + } } } + return !1; +}; +Entry.launchFullScreen = function(a) { + a.requestFullscreen ? a.requestFullscreen() : a.mozRequestFulScreen ? a.mozRequestFulScreen() : a.webkitRequestFullscreen ? a.webkitRequestFullscreen() : a.msRequestFullScreen && a.msRequestFullScreen(); +}; +Entry.exitFullScreen = function() { + document.exitFullScreen ? document.exitFullScreen() : document.mozCancelFullScreen ? document.mozCancelFullScreen() : document.webkitExitFullscreen && document.webkitExitFullscreen(); +}; +Entry.isPhone = function() { + return !1; +}; +Entry.getKeyCodeMap = function() { + return {65:"a", 66:"b", 67:"c", 68:"d", 69:"e", 70:"f", 71:"g", 72:"h", 73:"i", 74:"j", 75:"k", 76:"l", 77:"m", 78:"n", 79:"o", 80:"p", 81:"q", 82:"r", 83:"s", 84:"t", 85:"u", 86:"v", 87:"w", 88:"x", 89:"y", 90:"z", 32:Lang.Blocks.START_press_some_key_space, 37:Lang.Blocks.START_press_some_key_left, 38:Lang.Blocks.START_press_some_key_up, 39:Lang.Blocks.START_press_some_key_right, 40:Lang.Blocks.START_press_some_key_down, 48:"0", 49:"1", 50:"2", 51:"3", 52:"4", 53:"5", 54:"6", 55:"7", 56:"8", 57:"9", + 13:Lang.Blocks.START_press_some_key_enter}; +}; +Entry.checkCollisionRect = function(a, b) { + return !(a.y + a.height < b.y || a.y > b.y + b.height || a.x + a.width < b.x || a.x > b.x + b.width); +}; +Entry.bindAnimationCallback = function(a, b) { + a.addEventListener("webkitAnimationEnd", b, !1); + a.addEventListener("animationend", b, !1); + a.addEventListener("oanimationend", b, !1); +}; +Entry.cloneSimpleObject = function(a) { + var b = {}, c; + for (c in a) { + b[c] = a[c]; + } + return b; }; -Entry.Container.prototype.getEntity = function(b) { - if (b = this.getObject(b)) { - return b.entity; +Entry.nodeListToArray = function(a) { + for (var b = Array(a.length), c = -1, d = a.length;++c !== d;b[c] = a[c]) { } - Entry.toast.alert(Lang.Msgs.runtime_error, Lang.Workspace.object_not_found, !0); + return b; }; -Entry.Container.prototype.getVariable = function(b) { - for (var a = 0;a < this.variables_.length;a++) { - var c = this.variables_[a]; - if (c.getId() == b || c.getName() == b) { - return c; - } +Entry.computeInputWidth = function(a) { + var b = document.createElement("span"); + b.className = "tmp-element"; + b.innerHTML = a.replace(/&/g, "&").replace(//g, ">"); + document.body.appendChild(b); + a = b.offsetWidth; + document.body.removeChild(b); + return Number(a + 10) + "px"; +}; +Entry.isArrowOrBackspace = function(a) { + return -1 < [37, 38, 39, 40, 8].indexOf(a); +}; +Entry.hexStringToBin = function(a) { + for (var b = [], c = 0;c < a.length - 1;c += 2) { + b.push(parseInt(a.substr(c, 2), 16)); } + return String.fromCharCode.apply(String, b); }; -Entry.Container.prototype.moveElement = function(b, a, c) { - var d; - d = this.getCurrentObjects(); - b = this.getAllObjects().indexOf(d[b]); - a = this.getAllObjects().indexOf(d[a]); - !c && Entry.stateManager && Entry.stateManager.addCommand("reorder object", Entry.container, Entry.container.moveElement, a, b, !0); - this.objects_.splice(a, 0, this.objects_.splice(b, 1)[0]); - this.setCurrentObjects(); - Entry.container.updateListView(); - Entry.requestUpdate = !0; - return new Entry.State(Entry.container, Entry.container.moveElement, a, b, !0); +Entry.findObjsByKey = function(a, b, c) { + for (var d = [], e = 0;e < a.length;e++) { + a[e][b] == c && d.push(a[e]); + } + return d; }; -Entry.Container.prototype.moveElementByBlock = function(b, a) { - var c = this.getCurrentObjects().splice(b, 1)[0]; - this.getCurrentObjects().splice(a, 0, c); - Entry.stage.sortZorder(); - this.updateListView(); +Entry.factorials = []; +Entry.factorial = function(a) { + return 0 === a || 1 == a ? 1 : 0 < Entry.factorials[a] ? Entry.factorials[a] : Entry.factorials[a] = Entry.factorial(a - 1) * a; }; -Entry.Container.prototype.getDropdownList = function(b, a) { - var c = []; - switch(b) { - case "sprites": - for (var d = this.getCurrentObjects(), e = d.length, f = 0;f < e;f++) { - a = d[f], c.push([a.name, a.id]); - } - break; - case "spritesWithMouse": - d = this.getCurrentObjects(); - e = d.length; - for (f = 0;f < e;f++) { - a = d[f], c.push([a.name, a.id]); - } - c.push([Lang.Blocks.mouse_pointer, "mouse"]); - break; - case "spritesWithSelf": - d = this.getCurrentObjects(); - e = d.length; - for (f = 0;f < e;f++) { - a = d[f], c.push([a.name, a.id]); - } - c.push([Lang.Blocks.self, "self"]); - break; - case "collision": - c.push([Lang.Blocks.mouse_pointer, "mouse"]); - d = this.getCurrentObjects(); - e = d.length; - for (f = 0;f < e;f++) { - a = d[f], c.push([a.name, a.id]); - } - c.push([Lang.Blocks.wall, "wall"]); - c.push([Lang.Blocks.wall_up, "wall_up"]); - c.push([Lang.Blocks.wall_down, "wall_down"]); - c.push([Lang.Blocks.wall_right, "wall_right"]); - c.push([Lang.Blocks.wall_left, "wall_left"]); - break; - case "pictures": - a = Entry.playground.object || a; - if (!a) { +Entry.getListRealIndex = function(a, b) { + if (isNaN(a)) { + switch(a) { + case "FIRST": + a = 1; break; - } - d = a.pictures; - for (f = 0;f < d.length;f++) { - e = d[f], c.push([e.name, e.id]); - } - break; - case "messages": - d = Entry.variableContainer.messages_; - for (f = 0;f < d.length;f++) { - e = d[f], c.push([e.name, e.id]); - } - break; - case "variables": - d = Entry.variableContainer.variables_; - for (f = 0;f < d.length;f++) { - e = d[f], e.object_ && Entry.playground.object && e.object_ != Entry.playground.object.id || c.push([e.getName(), e.getId()]); - } - c && 0 !== c.length || c.push([Lang.Blocks.VARIABLE_variable, "null"]); - break; - case "lists": - a = Entry.playground.object || a; - d = Entry.variableContainer.lists_; - for (f = 0;f < d.length;f++) { - e = d[f], e.object_ && a && e.object_ != a.id || c.push([e.getName(), e.getId()]); - } - c && 0 !== c.length || c.push([Lang.Blocks.VARIABLE_list, "null"]); - break; - case "scenes": - d = Entry.scene.scenes_; - for (f = 0;f < d.length;f++) { - e = d[f], c.push([e.name, e.id]); - } - break; - case "sounds": - a = Entry.playground.object || a; - if (!a) { + case "LAST": + a = b.array_.length; break; - } - d = a.sounds; - for (f = 0;f < d.length;f++) { - e = d[f], c.push([e.name, e.id]); - } - break; - case "clone": - c.push([Lang.Blocks.oneself, "self"]); - e = this.objects_.length; - for (f = 0;f < e;f++) { - a = this.objects_[f], c.push([a.name, a.id]); - } - break; - case "objectSequence": - for (e = this.getCurrentObjects().length, f = 0;f < e;f++) { - c.push([(f + 1).toString(), f.toString()]); - } - ; - } - c.length || (c = [[Lang.Blocks.no_target, "null"]]); - return c; -}; -Entry.Container.prototype.clearRunningState = function() { - this.mapObject(function(b) { - b.clearExecutor(); - for (var a = b.clonedEntities.length;0 < a;a--) { - b.clonedEntities[a - 1].removeClone(); + case "RANDOM": + a = Math.floor(Math.random() * b.array_.length) + 1; } - b.clonedEntities = []; - }); -}; -Entry.Container.prototype.mapObject = function(b, a) { - for (var c = this.objects_.length, d = [], e = 0;e < c;e++) { - d.push(b(this.objects_[e], a)); } - return d; + return a; }; -Entry.Container.prototype.mapObjectOnScene = function(b, a) { - for (var c = this.getCurrentObjects(), d = c.length, e = [], f = 0;f < d;f++) { - e.push(b(c[f], a)); - } - return e; +Entry.toRadian = function(a) { + return a * Math.PI / 180; }; -Entry.Container.prototype.clearRunningStateOnScene = function() { - this.mapObjectOnScene(function(b) { - b.clearExecutor(); - for (var a = b.clonedEntities.length;0 < a;a--) { - b.clonedEntities[a - 1].removeClone(); - } - b.clonedEntities = []; - }); +Entry.toDegrees = function(a) { + return 180 * a / Math.PI; }; -Entry.Container.prototype.mapEntity = function(b, a) { - for (var c = this.objects_.length, d = [], e = 0;e < c;e++) { - d.push(b(this.objects_[e].entity, a)); +Entry.getPicturesJSON = function(a) { + for (var b = [], c = 0, d = a.length;c < d;c++) { + var e = a[c], f = {}; + f._id = e._id; + f.id = e.id; + f.dimension = e.dimension; + f.filename = e.filename; + f.fileurl = e.fileurl; + f.name = e.name; + f.scale = e.scale; + b.push(f); } - return d; + return b; }; -Entry.Container.prototype.mapEntityOnScene = function(b, a) { - for (var c = this.getCurrentObjects(), d = c.length, e = [], f = 0;f < d;f++) { - e.push(b(c[f].entity, a)); +Entry.getSoundsJSON = function(a) { + for (var b = [], c = 0, d = a.length;c < d;c++) { + var e = a[c], f = {}; + f._id = e._id; + f.duration = e.duration; + f.ext = e.ext; + f.id = e.id; + f.filename = e.filename; + f.fileurl = e.fileurl; + f.name = e.name; + b.push(f); } - return e; + return b; }; -Entry.Container.prototype.mapEntityIncludeClone = function(b, a) { - for (var c = this.objects_, d = c.length, e = [], f = 0;f < d;f++) { - var g = c[f], h = g.clonedEntities.length; - e.push(b(g.entity, a)); - for (var k = 0;k < h;k++) { - var l = g.clonedEntities[k]; - l && !l.isStamp && e.push(b(l, a)); - } - } - return e; +Entry.cutDecimal = function(a) { + return Math.round(100 * a) / 100; }; -Entry.Container.prototype.mapEntityIncludeCloneOnScene = function(b, a) { - for (var c = this.getCurrentObjects(), d = c.length, e = [], f = 0;f < d;f++) { - var g = c[f], h = g.clonedEntities.length; - e.push(b(g.entity, a)); - for (var k = 0;k < h;k++) { - var l = g.clonedEntities[k]; - l && !l.isStamp && e.push(b(l, a)); - } +Entry.getBrowserType = function() { + if (Entry.userAgent) { + return Entry.userAgent; } - return e; + var a = navigator.userAgent, b, c = a.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []; + if (/trident/i.test(c[1])) { + return b = /\brv[ :]+(\d+)/g.exec(a) || [], "IE " + (b[1] || ""); + } + if ("Chrome" === c[1] && (b = a.match(/\b(OPR|Edge)\/(\d+)/), null != b)) { + return b.slice(1).join(" ").replace("OPR", "Opera"); + } + c = c[2] ? [c[1], c[2]] : [navigator.appName, navigator.appVersion, "-?"]; + null != (b = a.match(/version\/(\d+)/i)) && c.splice(1, 1, b[1]); + a = c.join(" "); + return Entry.userAgent = a; +}; +Entry.setBasicBrush = function(a) { + var b = new createjs.Graphics; + b.thickness = 1; + b.rgb = Entry.hex2rgb("#ff0000"); + b.opacity = 100; + b.setStrokeStyle(1); + b.beginStroke("rgba(255,0,0,1)"); + var c = new createjs.Shape(b); + Entry.stage.selectedObjectContainer.addChild(c); + a.brush && (a.brush = null); + a.brush = b; + a.shape && (a.shape = null); + a.shape = c; }; -Entry.Container.prototype.getCachedPicture = function(b) { - Entry.assert("string" == typeof b, "pictureId must be string"); - return this.cachedPicture[b]; +Entry.setCloneBrush = function(a, b) { + var c = new createjs.Graphics; + c.thickness = b.thickness; + c.rgb = b.rgb; + c.opacity = b.opacity; + c.setStrokeStyle(c.thickness); + c.beginStroke("rgba(" + c.rgb.r + "," + c.rgb.g + "," + c.rgb.b + "," + c.opacity / 100 + ")"); + b = new createjs.Shape(c); + Entry.stage.selectedObjectContainer.addChild(b); + a.brush && (a.brush = null); + a.brush = c; + a.shape && (a.shape = null); + a.shape = b; }; -Entry.Container.prototype.cachePicture = function(b, a) { - this.cachedPicture[b] = a; +Entry.isFloat = function(a) { + return /\d+\.{1}\d+$/.test(a); }; -Entry.Container.prototype.toJSON = function() { - for (var b = [], a = this.objects_.length, c = 0;c < a;c++) { - b.push(this.objects_[c].toJSON()); +Entry.getStringIndex = function(a) { + if (!a) { + return ""; + } + for (var b = {string:a, index:1}, c = 0, d = [], e = a.length - 1;0 < e;--e) { + var f = a.charAt(e); + if (isNaN(f)) { + break; + } else { + d.unshift(f), c = e; + } } + 0 < c && (b.string = a.substring(0, c), b.index = parseInt(d.join("")) + 1); return b; }; -Entry.Container.prototype.takeSequenceSnapshot = function() { - for (var b = this.objects_.length, a = this.objects_, c = 0;c < b;c++) { - a[c].index = c; +Entry.getOrderedName = function(a, b, c) { + if (!a) { + return "untitled"; + } + if (!b || 0 === b.length) { + return a; + } + c || (c = "name"); + for (var d = 0, e = Entry.getStringIndex(a), f = 0, g = b.length;f < g;f++) { + var h = Entry.getStringIndex(b[f][c]); + e.string === h.string && h.index > d && (d = h.index); } + return 0 < d ? e.string + d : a; }; -Entry.Container.prototype.loadSequenceSnapshot = function() { - for (var b = this.objects_.length, a = Array(b), c = 0;c < b;c++) { - var d = this.objects_[c]; - a[d.index || c] = d; - delete d.index; +Entry.changeXmlHashId = function(a) { + if (/function_field/.test(a.getAttribute("type"))) { + for (var b = a.getElementsByTagName("mutation"), c = 0, d = b.length;c < d;c++) { + b[c].setAttribute("hashid", Entry.generateHash()); + } } - this.objects_ = a; - this.setCurrentObjects(); - Entry.stage.sortZorder(); - this.updateListView(); + return a; }; -Entry.Container.prototype.getInputValue = function() { - return this.inputValue.getValue(); +Entry.getMaxFloatPoint = function(a) { + for (var b = 0, c = 0, d = a.length;c < d;c++) { + var e = String(a[c]), f = e.indexOf("."); + -1 !== f && (e = e.length - (f + 1), e > b && (b = e)); + } + return Math.min(b, 20); }; -Entry.Container.prototype.setInputValue = function(b) { - b ? this.inputValue.setValue(b) : this.inputValue.setValue(0); +Entry.convertToRoundedDecimals = function(a, b) { + return isNaN(a) || !this.isFloat(a) ? a : Number(Math.round(a + "e" + b) + "e-" + b); }; -Entry.Container.prototype.resetSceneDuringRun = function() { - this.mapEntityOnScene(function(b) { - b.loadSnapshot(); - b.object.filters = []; - b.resetFilter(); - b.dialog && b.dialog.remove(); - b.shape && b.removeBrush(); - }); - this.clearRunningStateOnScene(); +Entry.attachEventListener = function(a, b, c) { + setTimeout(function() { + a.addEventListener(b, c); + }, 0); }; -Entry.Container.prototype.setCopiedObject = function(b) { - this.copiedObject = b; +Entry.deAttachEventListener = function(a, b, c) { + a.removeEventListener(b, c); }; -Entry.Container.prototype.updateObjectsOrder = function() { - for (var b = Entry.scene.getScenes(), a = [], c = 0;c < b.length;c++) { - for (var d = this.getSceneObjects(b[c]), e = 0;e < d.length;e++) { - a.push(d[e]); +Entry.isEmpty = function(a) { + if (!a) { + return !0; + } + for (var b in a) { + if (a.hasOwnProperty(b)) { + return !1; } } - this.objects_ = a; + return !0; }; -Entry.Container.prototype.getSceneObjects = function(b) { - b = b || Entry.scene.selectedScene; - for (var a = [], c = this.getAllObjects(), d = 0;d < c.length;d++) { - b.id == c[d].scene.id && a.push(c[d]); +Entry.Utils.disableContextmenu = function(a) { + if (a) { + $(a).on("contextmenu", function(b) { + b.stopPropagation(); + b.preventDefault(); + return !1; + }); } - return a; }; -Entry.Container.prototype.setCurrentObjects = function() { - this.currentObjects_ = this.getSceneObjects(); +Entry.Utils.isRightButton = function(a) { + return 2 == a.button || a.ctrlKey; }; -Entry.Container.prototype.getCurrentObjects = function() { - var b = this.currentObjects_; - b && 0 !== b.length || this.setCurrentObjects(); - return this.currentObjects_; +Entry.Utils.isTouchEvent = function(a) { + return "mousedown" !== a.type.toLowerCase(); }; -Entry.Container.prototype.getProjectWithJSON = function(b) { - b.objects = Entry.container.toJSON(); - b.variables = Entry.variableContainer.getVariableJSON(); - b.messages = Entry.variableContainer.getMessageJSON(); - b.scenes = Entry.scene.toJSON(); +Entry.Utils.inherit = function(a, b) { + function c() { + } + c.prototype = a.prototype; + b.prototype = new c; return b; }; -Entry.Container.prototype.blurAllInputs = function() { - this.getSceneObjects().map(function(b) { - b = b.view_.getElementsByTagName("input"); - for (var a = 0, c = b.length;a < c;a++) { - b[a].blur(); +Entry.bindAnimationCallbackOnce = function(a, b) { + a.one("webkitAnimationEnd animationendo animationend", b); +}; +Entry.Utils.isInInput = function(a) { + return "textarea" == a.target.type || "text" == a.target.type; +}; +Entry.Utils.isFunction = function(a) { + return "function" === typeof a; +}; +Entry.Utils.addFilters = function(a, b) { + a = a.elem("defs"); + var c = a.elem("filter", {id:"entryTrashcanFilter_" + b}); + c.elem("feGaussianBlur", {"in":"SourceAlpha", stdDeviation:2, result:"blur"}); + c.elem("feOffset", {"in":"blur", dx:1, dy:1, result:"offsetBlur"}); + c = c.elem("feMerge"); + c.elem("feMergeNode", {"in":"offsetBlur"}); + c.elem("feMergeNode", {"in":"SourceGraphic"}, c); + c = a.elem("filter", {id:"entryBlockShadowFilter_" + b, height:"200%"}); + c.elem("feOffset", {result:"offOut", in:"SourceGraphic", dx:0, dy:1}); + c.elem("feColorMatrix", {result:"matrixOut", in:"offOut", type:"matrix", values:"0.7 0 0 0 0 0 0.7 0 0 0 0 0 0.7 0 0 0 0 0 1 0"}); + c.elem("feBlend", {in:"SourceGraphic", in1:"offOut", mode:"normal"}); + b = a.elem("filter", {id:"entryBlockHighlightFilter_" + b}); + b.elem("feOffset", {result:"offOut", in:"SourceGraphic", dx:0, dy:0}); + b.elem("feColorMatrix", {result:"matrixOut", in:"offOut", type:"matrix", values:"1.3 0 0 0 0 0 1.3 0 0 0 0 0 1.3 0 0 0 0 0 1 0"}); +}; +Entry.Utils.addBlockPattern = function(a, b) { + a = a.elem("pattern", {id:"blockHoverPattern_" + b, class:"blockHoverPattern", patternUnits:"userSpaceOnUse", patternTransform:"translate(12, 0)", x:0, y:0, width:125, height:33, style:"display: none"}); + b = a.elem("g"); + for (var c = b.elem("rect", {x:0, y:0, width:125, height:33}), d = Entry.mediaFilePath + "block_pattern_(order).png", e = 1;5 > e;e++) { + b.elem("image", {class:"pattern" + e, href:d.replace("(order)", e), x:0, y:0, width:125, height:33}); + } + return {pattern:a, rect:c}; +}; +Entry.Utils.COLLISION = {NONE:0, UP:1, RIGHT:2, LEFT:3, DOWN:4}; +Entry.Utils.createMouseEvent = function(a, b) { + var c = document.createEvent("MouseEvent"); + c.initMouseEvent(a, !0, !0, window, 0, 0, 0, b.clientX, b.clientY, !1, !1, !1, !1, 0, null); + return c; +}; +Entry.Utils.xmlToJsonData = function(a) { + a = $.parseXML(a); + var b = []; + a = a.childNodes[0].childNodes; + for (var c in a) { + var d = a[c]; + if (d.tagName) { + var e = {category:d.getAttribute("id"), blocks:[]}, d = d.childNodes; + for (c in d) { + var f = d[c]; + f.tagName && (f = f.getAttribute("type")) && e.blocks.push(f); + } + b.push(e); } - }); + } + return b; }; -Entry.Container.prototype.showProjectAnswer = function() { - var b = this.inputValue; - b && b.setVisible(!0); +Entry.Utils.stopProjectWithToast = function(a, b, c) { + var d = a.block; + b = b || "\ub7f0\ud0c0\uc784 \uc5d0\ub7ec \ubc1c\uc0dd"; + Entry.toast && !c && Entry.toast.alert(Lang.Msgs.warn, Lang.Workspace.check_runtime_error, !0); + Entry.engine && Entry.engine.toggleStop(); + "workspace" === Entry.type && (a.block && "funcBlock" in a.block ? d = a.block.funcBlock : a.funcExecutor && (d = a.funcExecutor.scope.block, a = a.type.replace("func_", ""), Entry.Func.edit(Entry.variableContainer.functions_[a])), d && (Entry.container.selectObject(d.getCode().object.id, !0), d.view.getBoard().activateBlock(d))); + throw Error(b); }; -Entry.Container.prototype.hideProjectAnswer = function(b) { - if ((b = this.inputValue) && b.isVisible() && !Entry.engine.isState("run")) { - for (var a = Entry.container.getAllObjects(), c = ["ask_and_wait", "get_canvas_input_value", "set_visible_answer"], d = 0, e = a.length;d < e;d++) { - for (var f = a[d].script, g = 0;g < c.length;g++) { - if (f.hasBlockType(c[g])) { - return; +Entry.Utils.AsyncError = function(a) { + this.name = "AsyncError"; + this.message = a || "\ube44\ub3d9\uae30 \ud638\ucd9c \ub300\uae30"; +}; +Entry.Utils.AsyncError.prototype = Error(); +Entry.Utils.AsyncError.prototype.constructor = Entry.Utils.AsyncError; +Entry.Utils.isChrome = function() { + return /chrom(e|ium)/.test(navigator.userAgent.toLowerCase()); +}; +Entry.Utils.waitForWebfonts = function(a, b) { + for (var c = 0, d = 0, e = a.length;d < e;++d) { + (function(d) { + function e() { + h && h.offsetWidth != k && (++c, h.parentNode.removeChild(h), h = null); + if (c >= a.length && (l && clearInterval(l), c == a.length)) { + return b(), !0; } } - } - b.setVisible(!1); + var h = document.createElement("span"); + h.innerHTML = "giItT1WQy@!-/#"; + h.style.position = "absolute"; + h.style.left = "-10000px"; + h.style.top = "-10000px"; + h.style.fontSize = "300px"; + h.style.fontFamily = "sans-serif"; + h.style.fontVariant = "normal"; + h.style.fontStyle = "normal"; + h.style.fontWeight = "normal"; + h.style.letterSpacing = "0"; + document.body.appendChild(h); + var k = h.offsetWidth; + h.style.fontFamily = d; + var l; + e() || (l = setInterval(e, 50)); + })(a[d]); } }; -Entry.Container.prototype.getView = function() { - return this._view; +window.requestAnimFrame = function() { + return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(a) { + window.setTimeout(a, 1E3 / 60); + }; +}(); +Entry.isMobile = function() { + if (Entry.device) { + return "tablet" === Entry.device; + } + var a = window.platform; + if (a && a.type && ("tablet" === a.type || "mobile" === a.type)) { + return Entry.device = "tablet", !0; + } + Entry.device = "desktop"; + return !1; }; -Entry.Container.prototype.resize = function() { +Entry.Utils.convertMouseEvent = function(a) { + return a.originalEvent && a.originalEvent.touches ? a.originalEvent.touches[0] : a; }; -Entry.Container.prototype._rightClick = function(b) { - b.stopPropagation && b.stopPropagation(); - var a = [{text:Lang.Blocks.Paste_blocks, enable:!Entry.engine.isState("run") && !!Entry.container.copiedObject, callback:function() { - Entry.container.copiedObject ? Entry.container.addCloneObject(Entry.container.copiedObject) : Entry.toast.alert(Lang.Workspace.add_object_alert, Lang.Workspace.object_not_found_for_paste); - }}]; - Entry.ContextMenu.show(a, "workspace-contextmenu", {x:b.clientX, y:b.clientY}); +Entry.Utils.convertIntToHex = function(a) { + return a.toString(16).toUpperCase(); }; -Entry.Container.prototype.removeFuncBlocks = function(b) { - this.objects_.forEach(function(a) { - a.script.removeBlocksByType(b); - }); +Entry.Model = function(a, b) { + var c = Entry.Model; + c.generateSchema(a); + c.generateSetter(a); + c.generateObserve(a); + (void 0 === b || b) && Object.seal(a); + return a; }; -Entry.db = {data:{}, typeMap:{}}; -(function(b) { - b.add = function(a) { - this.data[a.id] = a; - var b = a.type; - void 0 === this.typeMap[b] && (this.typeMap[b] = {}); - this.typeMap[b][a.id] = a; +(function(a) { + a.generateSchema = function(b) { + var a = b.schema; + if (void 0 !== a) { + a = JSON.parse(JSON.stringify(a)); + b.data = {}; + for (var d in a) { + (function(d) { + b.data[d] = a[d]; + Object.defineProperty(b, d, {get:function() { + return b.data[d]; + }}); + })(d); + } + b._toJSON = this._toJSON; + } }; - b.has = function(a) { - return this.data.hasOwnProperty(a); + a.generateSetter = function(b) { + b.set = this.set; + }; + a.set = function(b, a) { + var d = {}, e; + for (e in this.data) { + void 0 !== b[e] && (b[e] === this.data[e] ? delete b[e] : (d[e] = this.data[e], this.data[e] = b[e] instanceof Array ? b[e].concat() : b[e])); + } + a || this.notify(Object.keys(b), d); }; - b.remove = function(a) { - this.has(a) && (delete this.typeMap[this.data[a].type][a], delete this.data[a]); + a.generateObserve = function(b) { + b.observers = []; + b.observe = this.observe; + b.unobserve = this.unobserve; + b.notify = this.notify; }; - b.get = function(a) { - return this.data[a]; + a.observe = function(b, a, d, e) { + d = new Entry.Observer(this.observers, b, a, d); + if (!1 !== e) { + b[a]([]); + } + return d; }; - b.find = function() { + a.unobserve = function(b) { + b.destroy(); }; - b.clear = function() { - this.data = {}; - this.typeMap = {}; + a.notify = function(b, a) { + "string" === typeof b && (b = [b]); + var d = this; + d.observers.map(function(e) { + var f = b; + void 0 !== e.attrs && (f = Entry.Utils.intersectArray(e.attrs, b)); + if (f.length) { + e.object[e.funcName](f.map(function(b) { + return {name:b, object:d, oldValue:a[b]}; + })); + } + }); }; -})(Entry.db); -Entry.Dom = function(b, a) { - var c = /<(\w+)>/, d; - d = b instanceof HTMLElement ? $(b) : b instanceof jQuery ? b : c.test(b) ? $(b) : $("<" + b + ">"); - if (void 0 === a) { - return d; - } - a.id && d.attr("id", a.id); - a.class && d.addClass(a.class); - a.classes && a.classes.map(function(a) { - d.addClass(a); - }); - a.src && d.attr("src", a.src); - a.parent && a.parent.append(d); - d.bindOnClick = function() { - var a, b, c = function(a) { - a.stopImmediatePropagation(); - a.handled || (a.handled = !0, b.call(this, a)); - }; - 1 < arguments.length ? (b = arguments[1] instanceof Function ? arguments[1] : function() { - }, a = "string" === typeof arguments[0] ? arguments[0] : "") : b = arguments[0] instanceof Function ? arguments[0] : function() { - }; - if (a) { - $(this).on("click tab", a, c); - } else { - $(this).on("click tab", c); + a._toJSON = function() { + var b = {}, a; + for (a in this.data) { + b[a] = this.data[a]; } + return b; }; - return d; -}; -Entry.SVG = function(b) { - b = document.getElementById(b); - return Entry.SVG.createElement(b); +})(Entry.Model); +Entry.Observer = function(a, b, c, d) { + this.parent = a; + this.object = b; + this.funcName = c; + this.attrs = d; + a.push(this); }; -Entry.SVG.NS = "http://www.w3.org/2000/svg"; -Entry.SVG.NS_XLINK = "http://www.w3.org/1999/xlink"; -Entry.SVG.createElement = function(b, a) { - var c; - c = "string" === typeof b ? document.createElementNS(Entry.SVG.NS, b) : b; - if (a) { - a.href && (c.setAttributeNS(Entry.SVG.NS_XLINK, "href", a.href), delete a.href); - for (var d in a) { - c.setAttribute(d, a[d]); +(function(a) { + a.destroy = function() { + var b = this.parent, a = b.indexOf(this); + -1 < a && b.splice(a, 1); + return this; + }; +})(Entry.Observer.prototype); +Entry.Command = {}; +(function(a) { + a["do"] = {type:EntryStatic.COMMAND_TYPES["do"], log:function(b) { + return [a["do"].type]; + }}; + a.undo = {type:EntryStatic.COMMAND_TYPES.undo, log:function(b) { + return [a.undo.type]; + }}; + a.redo = {type:EntryStatic.COMMAND_TYPES.redo, log:function(b) { + return [a.redo.type]; + }}; +})(Entry.Command); +Entry.Commander = function(a) { + if ("workspace" == a || "phone" == a) { + Entry.stateManager = new Entry.StateManager; + } + Entry.do = this.do.bind(this); + Entry.undo = this.undo.bind(this); + this.editor = {}; + this.reporters = []; + this._tempStorage = null; + Entry.Command.editor = this.editor; +}; +(function(a) { + a.do = function(b) { + var a = this, d = Array.prototype.slice.call(arguments); + d.shift(); + var e = Entry.Command[b]; + Entry.stateManager && Entry.stateManager.addCommand.apply(Entry.stateManager, [b, this, this.do, e.undo].concat(e.state.apply(this, d))); + e = Entry.Command[b].do.apply(this, d); + setTimeout(function() { + a.report("do"); + a.report(b, d); + }, 0); + return {value:e, isPass:this.isPass.bind(this)}; + }; + a.undo = function() { + var b = Array.prototype.slice.call(arguments), a = b.shift(), d = Entry.Command[a]; + this.report("undo"); + Entry.stateManager && Entry.stateManager.addCommand.apply(Entry.stateManager, [a, this, this.do, d.undo].concat(d.state.apply(this, b))); + return {value:Entry.Command[a].do.apply(this, b), isPass:this.isPass.bind(this)}; + }; + a.redo = function() { + var b = Array.prototype.slice.call(arguments), a = b.shift(), d = Entry.Command[a]; + that.report("redo"); + Entry.stateManager && Entry.stateManager.addCommand.apply(Entry.stateManager, [a, this, this.undo, a].concat(d.state.apply(null, b))); + d.undo.apply(this, b); + }; + a.setCurrentEditor = function(b, a) { + this.editor[b] = a; + }; + a.isPass = function(b) { + b = void 0 === b ? !0 : b; + if (Entry.stateManager) { + var a = Entry.stateManager.getLastCommand(); + a && (a.isPass = b); + } + }; + a.addReporter = function(b) { + this.reporters.push(b); + }; + a.removeReporter = function(b) { + b = this.reporters.indexOf(b); + -1 < b && this.reporters.splice(b, 1); + }; + a.report = function(b, a) { + var d = this.reporters; + if (0 !== d.length) { + var e; + e = b && Entry.Command[b] && Entry.Command[b].log ? Entry.Command[b].log.apply(this, a) : a; + d.forEach(function(b) { + b.add(e); + }); + } + }; +})(Entry.Commander.prototype); +(function(a) { + a.addThread = {type:EntryStatic.COMMAND_TYPES.addThread, do:function(b) { + return this.editor.board.code.createThread(b); + }, state:function(b) { + b.length && (b[0].id = Entry.Utils.generateId()); + return [b]; + }, log:function(b) { + b = this.editor.board.code.getThreads().pop(); + return [a.addThread.type, ["thread", b.stringify()], ["code", this.editor.board.code.stringify()]]; + }, undo:"destroyThread"}; + a.destroyThread = {type:EntryStatic.COMMAND_TYPES.destroyThread, do:function(b) { + this.editor.board.findById(b[0].id).destroy(!0, !0); + }, state:function(b) { + return [this.editor.board.findById(b[0].id).thread.toJSON()]; + }, log:function(b) { + b = b[0].id; + this.editor.board.findById(b); + return [a.destroyThread.type, ["blockId", b], ["code", this.editor.board.code.stringify()]]; + }, undo:"addThread"}; + a.destroyBlock = {type:EntryStatic.COMMAND_TYPES.destroyBlock, do:function(b) { + "string" === typeof b && (b = this.editor.board.findById(b)); + b.doDestroy(!0); + }, state:function(b) { + "string" === typeof b && (b = this.editor.board.findById(b)); + return [b.toJSON(), b.pointer()]; + }, log:function(b) { + "string" === typeof b && (b = this.editor.board.findById(b)); + return [a.destroyBlock.type, ["blockId", b.id], ["code", this.editor.board.code.stringify()]]; + }, undo:"recoverBlock"}; + a.recoverBlock = {type:EntryStatic.COMMAND_TYPES.recoverBlock, do:function(b, a) { + b = this.editor.board.code.createThread([b]).getFirstBlock(); + "string" === typeof b && (b = this.editor.board.findById(b)); + this.editor.board.insert(b, a); + }, state:function(b) { + "string" !== typeof b && (b = b.id); + return [b]; + }, log:function(b, c) { + b = this.editor.board.findById(b.id); + return [a.recoverBlock.type, ["block", b.stringify()], ["pointer", c], ["code", this.editor.board.code.stringify()]]; + }, undo:"destroyBlock"}; + a.insertBlock = {type:EntryStatic.COMMAND_TYPES.insertBlock, do:function(b, a, d) { + "string" === typeof b && (b = this.editor.board.findById(b)); + this.editor.board.insert(b, a, d); + }, state:function(b, a) { + "string" === typeof b && (b = this.editor.board.findById(b)); + a = [b.id]; + var d = b.targetPointer(); + a.push(d); + "string" !== typeof b && "basic" === b.getBlockType() && a.push(b.thread.getCount(b)); + return a; + }, log:function(b, c, d) { + "string" === typeof b && (b = this.editor.board.findById(b)); + return [a.insertBlock.type, ["blockId", b.id], ["targetPointer", b.targetPointer()], ["count", d], ["code", this.editor.board.code.stringify()]]; + }, undo:"insertBlock"}; + a.separateBlock = {type:EntryStatic.COMMAND_TYPES.separateBlock, do:function(b) { + b.view && b.view._toGlobalCoordinate(Entry.DRAG_MODE_DRAG); + b.doSeparate(); + }, state:function(b) { + var a = [b.id], d = b.targetPointer(); + a.push(d); + "basic" === b.getBlockType() && a.push(b.thread.getCount(b)); + return a; + }, log:function(b) { + "string" === typeof b && (b = this.editor.board.findById(b)); + return [a.separateBlock.type, ["blockId", b.id], ["x", b.x], ["y", b.y], ["code", this.editor.board.code.stringify()]]; + }, undo:"insertBlock"}; + a.moveBlock = {type:EntryStatic.COMMAND_TYPES.moveBlock, do:function(b, a, d) { + void 0 !== a ? (b = this.editor.board.findById(b), b.moveTo(a, d)) : b._updatePos(); + }, state:function(b) { + "string" === typeof b && (b = this.editor.board.findById(b)); + return [b.id, b.x, b.y]; + }, log:function(b, c, d) { + return [a.moveBlock.type, ["blockId", b.id], ["x", b.x], ["y", b.y], ["code", this.editor.board.code.stringify()]]; + }, undo:"moveBlock"}; + a.cloneBlock = {type:EntryStatic.COMMAND_TYPES.cloneBlock, do:function(b) { + "string" === typeof b && (b = this.editor.board.findById(b)); + this.editor.board.code.createThread(b.copy()); + }, state:function(b) { + "string" !== typeof b && (b = b.id); + return [b]; + }, log:function(b) { + "string" === typeof b && (b = this.editor.board.findById(b)); + var c = this.editor.board.code.getThreads().pop(); + return [a.cloneBlock.type, ["blockId", b.id], ["thread", c.stringify()], ["code", this.editor.board.code.stringify()]]; + }, undo:"uncloneBlock"}; + a.uncloneBlock = {type:EntryStatic.COMMAND_TYPES.uncloneBlock, do:function(b) { + b = this.editor.board.code.getThreads().pop().getFirstBlock(); + this._tempStorage = b.id; + b.destroy(!0, !0); + }, state:function(b) { + return [b]; + }, log:function(b) { + b = this._tempStorage; + this._tempStorage = null; + return [a.uncloneBlock.type, ["blockId", b], ["code", this.editor.board.code.stringify()]]; + }, undo:"cloneBlock"}; + a.scrollBoard = {type:EntryStatic.COMMAND_TYPES.scrollBoard, do:function(b, a, d) { + d || this.editor.board.scroller._scroll(b, a); + delete this.editor.board.scroller._diffs; + }, state:function(b, a) { + return [-b, -a]; + }, log:function(b, c) { + return [a.scrollBoard.type, ["dx", b], ["dy", c]]; + }, undo:"scrollBoard"}; + a.setFieldValue = {type:EntryStatic.COMMAND_TYPES.setFieldValue, do:function(b, a, d, e, f) { + a.setValue(f, !0); + }, state:function(b, a, d, e, f) { + return [b, a, d, f, e]; + }, log:function(b, c, d, e, f) { + return [a.setFieldValue.type, ["pointer", d], ["newValue", f], ["code", this.editor.board.code.stringify()]]; + }, undo:"setFieldValue"}; +})(Entry.Command); +(function(a) { + a.selectObject = {type:EntryStatic.COMMAND_TYPES.selectObject, do:function(b) { + return Entry.container.selectObject(b); + }, state:function(b) { + if ((b = Entry.playground) && b.object) { + return [b.object.id]; + } + }, log:function(b) { + return [b]; + }, undo:"selectObject"}; +})(Entry.Command); +Entry.Container = function() { + this.objects_ = []; + this.cachedPicture = {}; + this.inputValue = {}; + this.currentObjects_ = this.copiedObject = null; +}; +Entry.Container.prototype.generateView = function(a, b) { + var c = this; + this._view = a; + this._view.addClass("entryContainer"); + this._view.addClass("entryContainerWorkspace"); + this._view.setAttribute("id", "entryContainerWorkspaceId"); + a = Entry.createElement("div"); + a.addClass("entryAddObjectWorkspace"); + a.innerHTML = Lang.Workspace.add_object; + a.bindOnClick(function(b) { + Entry.dispatchEvent("openSpriteManager"); + }); + a = Entry.createElement("div"); + b = "entryContainerListWorkspaceWrapper"; + Entry.isForLecture && (b += " lecture"); + a.addClass(b); + Entry.Utils.disableContextmenu(a); + $(a).bind("mousedown touchstart", function(b) { + function a(b) { + n && 5 < Math.sqrt(Math.pow(b.pageX - n.x, 2) + Math.pow(b.pageY - n.y, 2)) && g && (clearTimeout(g), g = null); + } + function f(b) { + b.stopPropagation(); + h.unbind(".container"); + g && (clearTimeout(g), g = null); + } + var g = null, h = $(document), k = b.type, l = !1; + if (Entry.Utils.isRightButton(b)) { + c._rightClick(b), l = !0; + } else { + var n = {x:b.clientX, y:b.clientY}; + "touchstart" !== k || l || (b.stopPropagation(), b = Entry.Utils.convertMouseEvent(b), g = setTimeout(function() { + g && (g = null, c._rightClick(b)); + }, 1E3), h.bind("mousemove.container touchmove.container", a), h.bind("mouseup.container touchend.container", f)); + } + }); + this._view.appendChild(a); + b = Entry.createElement("ul"); + b.addClass("entryContainerListWorkspace"); + a.appendChild(b); + this.listView_ = b; + this.enableSort(); +}; +Entry.Container.prototype.enableSort = function() { + $ && $(this.listView_).sortable({start:function(a, b) { + b.item.data("start_pos", b.item.index()); + }, stop:function(a, b) { + a = b.item.data("start_pos"); + b = b.item.index(); + Entry.container.moveElement(a, b); + }, axis:"y", cancel:"input.selectedEditingObject"}); +}; +Entry.Container.prototype.disableSort = function() { + $ && $(this.listView_).sortable("destroy"); +}; +Entry.Container.prototype.updateListView = function() { + if (this.listView_) { + for (var a = this.listView_;a.hasChildNodes();) { + a.removeChild(a.lastChild); + } + var b = this.getCurrentObjects(), c; + for (c in b) { + a.appendChild(b[c].view_); } + Entry.stage.sortZorder(); } - this instanceof SVGElement && this.appendChild(c); - c.elem = Entry.SVG.createElement; - c.attr = Entry.SVG.attr; - c.addClass = Entry.SVG.addClass; - c.removeClass = Entry.SVG.removeClass; - c.hasClass = Entry.SVG.hasClass; - c.remove = Entry.SVG.remove; - c.removeAttr = Entry.SVG.removeAttr; - return c; }; -Entry.SVG.attr = function(b, a) { - if ("string" === typeof b) { - var c = {}; - c[b] = a; - b = c; +Entry.Container.prototype.setObjects = function(a) { + for (var b in a) { + var c = new Entry.EntryObject(a[b]); + this.objects_.push(c); + c.generateView(); + c.pictures.map(function(b) { + Entry.playground.generatePictureElement(b); + }); + c.sounds.map(function(b) { + Entry.playground.generateSoundElement(b); + }); } - 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]); - } + this.updateObjectsOrder(); + this.updateListView(); + Entry.stage.sortZorder(); + Entry.variableContainer.updateViews(); + a = Entry.type; + ("workspace" == a || "phone" == a) && (a = this.getCurrentObjects()[0]) && this.selectObject(a.id); +}; +Entry.Container.prototype.getPictureElement = function(a, b) { + if (a = this.getObject(b).getPicture(a)) { + return a.view; } - return this; + throw Error("No picture found"); }; -Entry.SVG.addClass = function(b) { - for (var a = this.getAttribute("class"), c = 0;c < arguments.length;c++) { - b = arguments[c], this.hasClass(b) || (a += " " + b); +Entry.Container.prototype.setPicture = function(a) { + var b = this.getObject(a.objectId), c; + for (c in b.pictures) { + if (a.id === b.pictures[c].id) { + var d = {}; + d.dimension = a.dimension; + d.id = a.id; + d.filename = a.filename; + d.fileurl = a.fileurl; + d.name = a.name; + d.view = b.pictures[c].view; + b.pictures[c] = d; + return; + } } - this.setAttribute("class", a); - return this; + throw Error("No picture found"); }; -Entry.SVG.removeClass = function(b) { - for (var a = this.getAttribute("class"), c = 0;c < arguments.length;c++) { - b = arguments[c], this.hasClass(b) && (a = a.replace(new RegExp("(\\s|^)" + b + "(\\s|$)"), " ")); +Entry.Container.prototype.selectPicture = function(a, b) { + b = this.getObject(b); + if (a = b.getPicture(a)) { + return b.selectedPicture = a, b.entity.setImage(a), b.updateThumbnailView(), b.id; } - this.setAttribute("class", a); - return this; + throw Error("No picture found"); }; -Entry.SVG.hasClass = function(b) { - var a = this.getAttribute("class"); - return a ? a.match(new RegExp("(\\s|^)" + b + "(\\s|$)")) : !1; +Entry.Container.prototype.addObject = function(a, b) { + var c = new Entry.EntryObject(a); + c.name = Entry.getOrderedName(c.name, this.objects_); + Entry.stateManager && Entry.stateManager.addCommand("add object", this, this.removeObject, c); + c.scene || (c.scene = Entry.scene.selectedScene); + "number" == typeof b ? a.sprite.category && "background" == a.sprite.category.main ? (c.setLock(!0), this.objects_.push(c)) : this.objects_.splice(b, 0, c) : a.sprite.category && "background" == a.sprite.category.main ? this.objects_.push(c) : this.objects_.unshift(c); + c.generateView(); + c.pictures.map(function(b) { + Entry.playground.generatePictureElement(b); + }); + c.sounds.map(function(b) { + Entry.playground.generateSoundElement(b); + }); + this.setCurrentObjects(); + this.updateObjectsOrder(); + this.updateListView(); + this.selectObject(c.id); + Entry.variableContainer.updateViews(); + return new Entry.State(this, this.removeObject, c); }; -Entry.SVG.remove = function() { - this.parentNode && this.parentNode.removeChild(this); +Entry.Container.prototype.addCloneObject = function(a, b) { + a = a.toJSON(); + var c = Entry.generateHash(); + Entry.variableContainer.addCloneLocalVariables({objectId:a.id, newObjectId:c, json:a}); + a.id = c; + a.scene = b || Entry.scene.selectedScene; + this.addObject(a); +}; +Entry.Container.prototype.removeObject = function(a) { + var b = this.objects_.indexOf(a), c = a.toJSON(); + Entry.stateManager && Entry.stateManager.addCommand("remove object", this, this.addObject, c, b); + c = new Entry.State(this.addObject, c, b); + a.destroy(); + this.objects_.splice(b, 1); + this.setCurrentObjects(); + Entry.stage.sortZorder(); + this.objects_.length && 0 !== b ? 0 < this.getCurrentObjects().length ? Entry.container.selectObject(this.getCurrentObjects()[0].id) : Entry.container.selectObject() : this.objects_.length && 0 === b ? Entry.container.selectObject(this.getCurrentObjects()[0].id) : (Entry.container.selectObject(), Entry.playground.flushPlayground()); + Entry.toast.success(Lang.Workspace.remove_object, a.name + " " + Lang.Workspace.remove_object_msg); + Entry.variableContainer.removeLocalVariables(a.id); + Entry.playground.reloadPlayground(); + return c; }; -Entry.SVG.removeAttr = function(b) { - this.removeAttribute(b); +Entry.Container.prototype.selectObject = function(a, b) { + a = this.getObject(a); + b && a && Entry.scene.selectScene(a.scene); + this.mapObjectOnScene(function(b) { + b.view_ && b.view_.removeClass("selectedObject"); + b.isSelected_ = !1; + }); + a && (a.view_ && a.view_.addClass("selectedObject"), a.isSelected_ = !0); + Entry.playground && Entry.playground.injectObject(a); + "minimize" != Entry.type && Entry.engine.isState("stop") && Entry.stage.selectObject(a); }; -Entry.Dialog = function(b, a, c, d) { - b.dialog && b.dialog.remove(); - b.dialog = this; - this.parent = b; - this.padding = 10; - this.border = 2; - "number" == typeof a && (a = String(a)); - this.message_ = a = a.match(/.{1,15}/g).join("\n"); - this.mode_ = c; - "speak" == c && this.generateSpeak(); - d || Entry.stage.loadDialog(this); +Entry.Container.prototype.getAllObjects = function() { + return this.objects_; }; -Entry.Dialog.prototype.generateSpeak = function() { - this.object = new createjs.Container; - var b = new createjs.Text; - b.font = "15px NanumGothic"; - b.textBaseline = "top"; - b.textAlign = "left"; - b.text = this.message_; - var a = b.getTransformedBounds(), c = a.height, a = 10 <= a.width ? a.width : 17, d = new createjs.Shape; - d.graphics.f("#f5f5f5").ss(2, "round").s("#6FC0DD").rr(-this.padding, -this.padding, a + 2 * this.padding, c + 2 * this.padding, this.padding); - this.object.addChild(d); - this.object.regX = a / 2; - this.object.regY = c / 2; - this.width = a; - this.height = c; - this.notch = this.createSpeakNotch("ne"); - this.update(); - this.object.addChild(this.notch); - this.object.addChild(b); - Entry.requestUpdate = !0; +Entry.Container.prototype.getObject = function(a) { + !a && Entry.playground && Entry.playground.object && (a = Entry.playground.object.id); + for (var b = this.objects_.length, c = 0;c < b;c++) { + var d = this.objects_[c]; + if (d.id == a) { + return d; + } + } }; -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.Container.prototype.getEntity = function(a) { + if (a = this.getObject(a)) { + return a.entity; + } + Entry.toast.alert(Lang.Msgs.runtime_error, Lang.Workspace.object_not_found, !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.Container.prototype.getVariable = function(a) { + for (var b = 0;b < this.variables_.length;b++) { + var c = this.variables_[b]; + if (c.getId() == a || c.getName() == a) { + return c; + } + } }; -Entry.Dialog.prototype.remove = function() { - Entry.stage.unloadDialog(this); - this.parent.dialog = null; +Entry.Container.prototype.moveElement = function(a, b, c) { + var d; + d = this.getCurrentObjects(); + a = this.getAllObjects().indexOf(d[a]); + b = this.getAllObjects().indexOf(d[b]); + !c && Entry.stateManager && Entry.stateManager.addCommand("reorder object", Entry.container, Entry.container.moveElement, b, a, !0); + this.objects_.splice(b, 0, this.objects_.splice(a, 1)[0]); + this.setCurrentObjects(); + Entry.container.updateListView(); Entry.requestUpdate = !0; + return new Entry.State(Entry.container, Entry.container.moveElement, b, a, !0); }; -Entry.DoneProject = function(b) { - this.generateView(b); -}; -var p = Entry.DoneProject.prototype; -p.init = function(b) { - this.projectId = b; +Entry.Container.prototype.moveElementByBlock = function(a, b) { + a = this.getCurrentObjects().splice(a, 1)[0]; + this.getCurrentObjects().splice(b, 0, a); + Entry.stage.sortZorder(); + this.updateListView(); }; -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"); +Entry.Container.prototype.getDropdownList = function(a, b) { + var c = []; + switch(a) { + case "sprites": + var d = this.getCurrentObjects(), e = d.length; + for (a = 0;a < e;a++) { + b = d[a], c.push([b.name, b.id]); + } + break; + case "spritesWithMouse": + d = this.getCurrentObjects(); + e = d.length; + for (a = 0;a < e;a++) { + b = d[a], c.push([b.name, b.id]); + } + c.push([Lang.Blocks.mouse_pointer, "mouse"]); + break; + case "spritesWithSelf": + d = this.getCurrentObjects(); + e = d.length; + for (a = 0;a < e;a++) { + b = d[a], c.push([b.name, b.id]); + } + c.push([Lang.Blocks.self, "self"]); + break; + case "collision": + c.push([Lang.Blocks.mouse_pointer, "mouse"]); + d = this.getCurrentObjects(); + e = d.length; + for (a = 0;a < e;a++) { + b = d[a], c.push([b.name, b.id]); + } + c.push([Lang.Blocks.wall, "wall"]); + c.push([Lang.Blocks.wall_up, "wall_up"]); + c.push([Lang.Blocks.wall_down, "wall_down"]); + c.push([Lang.Blocks.wall_right, "wall_right"]); + c.push([Lang.Blocks.wall_left, "wall_left"]); + break; + case "pictures": + b = Entry.playground.object || b; + if (!b) { + break; + } + b = b.pictures; + for (a = 0;a < b.length;a++) { + d = b[a], c.push([d.name, d.id]); + } + break; + case "messages": + b = Entry.variableContainer.messages_; + for (a = 0;a < b.length;a++) { + d = b[a], c.push([d.name, d.id]); + } + break; + case "variables": + b = Entry.variableContainer.variables_; + for (a = 0;a < b.length;a++) { + d = b[a], d.object_ && Entry.playground.object && d.object_ != Entry.playground.object.id || c.push([d.getName(), d.getId()]); + } + c && 0 !== c.length || c.push([Lang.Blocks.VARIABLE_variable, "null"]); + break; + case "lists": + b = Entry.playground.object || b; + d = Entry.variableContainer.lists_; + for (a = 0;a < d.length;a++) { + e = d[a], e.object_ && b && e.object_ != b.id || c.push([e.getName(), e.getId()]); + } + c && 0 !== c.length || c.push([Lang.Blocks.VARIABLE_list, "null"]); + break; + case "scenes": + b = Entry.scene.scenes_; + for (a = 0;a < b.length;a++) { + d = b[a], c.push([d.name, d.id]); + } + break; + case "sounds": + b = Entry.playground.object || b; + if (!b) { + break; + } + b = b.sounds; + for (a = 0;a < b.length;a++) { + d = b[a], c.push([d.name, d.id]); + } + break; + case "clone": + c.push([Lang.Blocks.oneself, "self"]); + e = this.objects_.length; + for (a = 0;a < e;a++) { + b = this.objects_[a], c.push([b.name, b.id]); + } + break; + case "objectSequence": + for (e = this.getCurrentObjects().length, a = 0;a < e;a++) { + c.push([(a + 1).toString(), a.toString()]); + } + ; + } + c.length || (c = [[Lang.Blocks.no_target, "null"]]); + return c; +}; +Entry.Container.prototype.clearRunningState = function() { + this.mapObject(function(a) { + a.clearExecutor(); + for (var b = a.clonedEntities.length;0 < b;b--) { + a.clonedEntities[b - 1].removeClone(); + } + a.clonedEntities = []; + }); +}; +Entry.Container.prototype.mapObject = function(a, b) { + for (var c = this.objects_.length, d = [], e = 0;e < c;e++) { + d.push(a(this.objects_[e], b)); + } + return d; +}; +Entry.Container.prototype.mapObjectOnScene = function(a, b) { + for (var c = this.getCurrentObjects(), d = c.length, e = [], f = 0;f < d;f++) { + e.push(a(c[f], b)); + } + return e; +}; +Entry.Container.prototype.clearRunningStateOnScene = function() { + this.mapObjectOnScene(function(a) { + a.clearExecutor(); + for (var b = a.clonedEntities.length;0 < b;b--) { + a.clonedEntities[b - 1].removeClone(); + } + a.clonedEntities = []; + }); +}; +Entry.Container.prototype.mapEntity = function(a, b) { + for (var c = this.objects_.length, d = [], e = 0;e < c;e++) { + d.push(a(this.objects_[e].entity, b)); + } + return d; +}; +Entry.Container.prototype.mapEntityOnScene = function(a, b) { + for (var c = this.getCurrentObjects(), d = c.length, e = [], f = 0;f < d;f++) { + e.push(a(c[f].entity, b)); + } + return e; +}; +Entry.Container.prototype.mapEntityIncludeClone = function(a, b) { + for (var c = this.objects_, d = c.length, e = [], f = 0;f < d;f++) { + var g = c[f], h = g.clonedEntities.length; + e.push(a(g.entity, b)); + for (var k = 0;k < h;k++) { + var l = g.clonedEntities[k]; + l && !l.isStamp && e.push(a(l, b)); + } + } + return e; +}; +Entry.Container.prototype.mapEntityIncludeCloneOnScene = function(a, b) { + for (var c = this.getCurrentObjects(), d = c.length, e = [], f = 0;f < d;f++) { + var g = c[f], h = g.clonedEntities.length; + e.push(a(g.entity, b)); + for (var k = 0;k < h;k++) { + var l = g.clonedEntities[k]; + l && !l.isStamp && e.push(a(l, b)); + } + } + return e; +}; +Entry.Container.prototype.getCachedPicture = function(a) { + Entry.assert("string" == typeof a, "pictureId must be string"); + return this.cachedPicture[a]; +}; +Entry.Container.prototype.cachePicture = function(a, b) { + this.cachedPicture[a] = b; +}; +Entry.Container.prototype.toJSON = function() { + for (var a = [], b = this.objects_.length, c = 0;c < b;c++) { + a.push(this.objects_[c].toJSON()); + } + return a; +}; +Entry.Container.prototype.takeSequenceSnapshot = function() { + for (var a = this.objects_.length, b = this.objects_, c = 0;c < a;c++) { + b[c].index = c; + } +}; +Entry.Container.prototype.loadSequenceSnapshot = function() { + for (var a = this.objects_.length, b = Array(a), c = 0;c < a;c++) { + var d = this.objects_[c]; + b[d.index || c] = d; + delete d.index; + } + this.objects_ = b; + this.setCurrentObjects(); + Entry.stage.sortZorder(); + this.updateListView(); +}; +Entry.Container.prototype.getInputValue = function() { + return this.inputValue.getValue(); +}; +Entry.Container.prototype.setInputValue = function(a) { + a ? this.inputValue.setValue(a) : this.inputValue.setValue(0); +}; +Entry.Container.prototype.resetSceneDuringRun = function() { + this.mapEntityOnScene(function(a) { + a.loadSnapshot(); + a.object.filters = []; + a.resetFilter(); + a.dialog && a.dialog.remove(); + a.shape && a.removeBrush(); + }); + this.clearRunningStateOnScene(); +}; +Entry.Container.prototype.setCopiedObject = function(a) { + this.copiedObject = a; +}; +Entry.Container.prototype.updateObjectsOrder = function() { + for (var a = Entry.scene.getScenes(), b = [], c = 0;c < a.length;c++) { + for (var d = this.getSceneObjects(a[c]), e = 0;e < d.length;e++) { + b.push(d[e]); + } + } + this.objects_ = b; +}; +Entry.Container.prototype.getSceneObjects = function(a) { + a = a || Entry.scene.selectedScene; + for (var b = [], c = this.getAllObjects(), d = 0;d < c.length;d++) { + a.id == c[d].scene.id && b.push(c[d]); + } + return b; +}; +Entry.Container.prototype.setCurrentObjects = function() { + this.currentObjects_ = this.getSceneObjects(); +}; +Entry.Container.prototype.getCurrentObjects = function() { + var a = this.currentObjects_; + a && 0 !== a.length || this.setCurrentObjects(); + return this.currentObjects_; +}; +Entry.Container.prototype.getProjectWithJSON = function(a) { + a.objects = Entry.container.toJSON(); + a.variables = Entry.variableContainer.getVariableJSON(); + a.messages = Entry.variableContainer.getMessageJSON(); + a.scenes = Entry.scene.toJSON(); + return a; +}; +Entry.Container.prototype.blurAllInputs = function() { + this.getSceneObjects().map(function(a) { + a = a.view_.getElementsByTagName("input"); + for (var b = 0, c = a.length;b < c;b++) { + a[b].blur(); + } + }); +}; +Entry.Container.prototype.showProjectAnswer = function() { + var a = this.inputValue; + a && a.setVisible(!0); +}; +Entry.Container.prototype.hideProjectAnswer = function(a) { + if ((a = this.inputValue) && a.isVisible() && !Entry.engine.isState("run")) { + for (var b = Entry.container.getAllObjects(), c = ["ask_and_wait", "get_canvas_input_value", "set_visible_answer"], d = 0, e = b.length;d < e;d++) { + for (var f = b[d].script, g = 0;g < c.length;g++) { + if (f.hasBlockType(c[g])) { + return; + } + } + } + a.setVisible(!1); + } +}; +Entry.Container.prototype.getView = function() { + return this._view; +}; +Entry.Container.prototype.resize = function() { +}; +Entry.Container.prototype._rightClick = function(a) { + a.stopPropagation && a.stopPropagation(); + var b = [{text:Lang.Blocks.Paste_blocks, enable:!Entry.engine.isState("run") && !!Entry.container.copiedObject, callback:function() { + Entry.container.copiedObject ? Entry.container.addCloneObject(Entry.container.copiedObject) : Entry.toast.alert(Lang.Workspace.add_object_alert, Lang.Workspace.object_not_found_for_paste); + }}]; + Entry.ContextMenu.show(b, "workspace-contextmenu", {x:a.clientX, y:a.clientY}); +}; +Entry.Container.prototype.removeFuncBlocks = function(a) { + this.objects_.forEach(function(b) { + b.script.removeBlocksByType(a); + }); +}; +Entry.db = {data:{}, typeMap:{}}; +(function(a) { + a.add = function(b) { + this.data[b.id] = b; + var a = b.type; + void 0 === this.typeMap[a] && (this.typeMap[a] = {}); + this.typeMap[a][b.id] = b; + }; + a.has = function(b) { + return this.data.hasOwnProperty(b); + }; + a.remove = function(b) { + this.has(b) && (delete this.typeMap[this.data[b].type][b], delete this.data[b]); + }; + a.get = function(b) { + return this.data[b]; + }; + a.find = function() { + }; + a.clear = function() { + this.data = {}; + this.typeMap = {}; + }; +})(Entry.db); +Entry.Dom = function(a, b) { + var c = /<(\w+)>/, d; + d = a instanceof HTMLElement ? $(a) : a instanceof jQuery ? a : c.test(a) ? $(a) : $("<" + a + ">"); + if (void 0 === b) { + return d; + } + b.id && d.attr("id", b.id); + b.class && d.addClass(b.class); + b.classes && b.classes.map(function(b) { + d.addClass(b); + }); + b.src && d.attr("src", b.src); + b.parent && b.parent.append(d); + d.bindOnClick = function() { + var b, a, c = function(b) { + b.stopImmediatePropagation(); + b.handled || (b.handled = !0, a.call(this, b)); + }; + 1 < arguments.length ? (a = arguments[1] instanceof Function ? arguments[1] : function() { + }, b = "string" === typeof arguments[0] ? arguments[0] : "") : a = arguments[0] instanceof Function ? arguments[0] : function() { + }; + if (b) { + $(this).on("click tab", b, c); + } else { + $(this).on("click tab", c); + } + }; + return d; +}; +Entry.SVG = function(a) { + a = document.getElementById(a); + return Entry.SVG.createElement(a); +}; +Entry.SVG.NS = "http://www.w3.org/2000/svg"; +Entry.SVG.NS_XLINK = "http://www.w3.org/1999/xlink"; +Entry.SVG.createElement = function(a, b) { + a = "string" === typeof a ? document.createElementNS(Entry.SVG.NS, a) : a; + if (b) { + b.href && (a.setAttributeNS(Entry.SVG.NS_XLINK, "href", b.href), delete b.href); + for (var c in b) { + a.setAttribute(c, b[c]); + } + } + this instanceof SVGElement && this.appendChild(a); + a.elem = Entry.SVG.createElement; + a.attr = Entry.SVG.attr; + a.addClass = Entry.SVG.addClass; + a.removeClass = Entry.SVG.removeClass; + a.hasClass = Entry.SVG.hasClass; + a.remove = Entry.SVG.remove; + a.removeAttr = Entry.SVG.removeAttr; + return a; +}; +Entry.SVG.attr = function(a, b) { + if ("string" === typeof a) { + var c = {}; + c[a] = b; + a = c; + } + if (a) { + a.href && (this.setAttributeNS(Entry.SVG.NS_XLINK, "href", a.href), delete a.href); + for (var d in a) { + this.setAttribute(d, a[d]); + } + } + return this; +}; +Entry.SVG.addClass = function(a) { + for (var b = this.getAttribute("class"), c = 0;c < arguments.length;c++) { + a = arguments[c], this.hasClass(a) || (b += " " + a); + } + this.setAttribute("class", b); + return this; +}; +Entry.SVG.removeClass = function(a) { + for (var b = this.getAttribute("class"), c = 0;c < arguments.length;c++) { + a = arguments[c], this.hasClass(a) && (b = b.replace(new RegExp("(\\s|^)" + a + "(\\s|$)"), " ")); + } + this.setAttribute("class", b); + return this; +}; +Entry.SVG.hasClass = function(a) { + var b = this.getAttribute("class"); + return b ? b.match(new RegExp("(\\s|^)" + a + "(\\s|$)")) : !1; +}; +Entry.SVG.remove = function() { + this.parentNode && this.parentNode.removeChild(this); +}; +Entry.SVG.removeAttr = function(a) { + this.removeAttribute(a); +}; +Entry.Dialog = function(a, b, c, d) { + a.dialog && a.dialog.remove(); + a.dialog = this; + this.parent = a; + this.padding = 10; + this.border = 2; + "number" == typeof b && (b = String(b)); + this.message_ = b = b.match(/.{1,15}/g).join("\n"); + this.mode_ = c; + "speak" == c && this.generateSpeak(); + d || Entry.stage.loadDialog(this); +}; +Entry.Dialog.prototype.generateSpeak = function() { + this.object = new createjs.Container; + var a = new createjs.Text; + a.font = "15px NanumGothic"; + a.textBaseline = "top"; + a.textAlign = "left"; + a.text = this.message_; + var b = a.getTransformedBounds(), c = b.height, b = 10 <= b.width ? b.width : 17, d = new createjs.Shape; + d.graphics.f("#f5f5f5").ss(2, "round").s("#6FC0DD").rr(-this.padding, -this.padding, b + 2 * this.padding, c + 2 * this.padding, this.padding); + this.object.addChild(d); + this.object.regX = b / 2; + this.object.regY = c / 2; + this.width = b; + this.height = c; + this.notch = this.createSpeakNotch("ne"); + this.update(); + this.object.addChild(this.notch); + this.object.addChild(a); + Entry.requestUpdate = !0; +}; +Entry.Dialog.prototype.update = function() { + var a = this.parent.object.getTransformedBounds(), b = ""; + -135 < a.y - this.height - 20 - this.border ? (this.object.y = a.y - this.height / 2 - 20 - this.padding, b += "n") : (this.object.y = a.y + a.height + this.height / 2 + 20 + this.padding, b += "s"); + 240 > a.x + a.width + this.width ? (this.object.x = a.x + a.width + this.width / 2, b += "e") : (this.object.x = a.x - this.width / 2, b += "w"); + this.notch.type != b && (this.object.removeChild(this.notch), this.notch = this.createSpeakNotch(b), this.object.addChild(this.notch)); + Entry.requestUpdate = !0; +}; +Entry.Dialog.prototype.createSpeakNotch = function(a) { + var b = new createjs.Shape; + b.type = a; + "ne" == a ? b.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" == a ? b.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" == a ? b.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" == a && b.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 b; +}; +Entry.Dialog.prototype.remove = function() { + Entry.stage.unloadDialog(this); + this.parent.dialog = null; + Entry.requestUpdate = !0; +}; +Entry.DoneProject = function(a) { + this.generateView(a); +}; +var p = Entry.DoneProject.prototype; +p.init = function(a) { + this.projectId = a; +}; +p.generateView = function(a) { + var b = Entry.createElement("div"); + b.addClass("entryContainerDoneWorkspace"); + this.doneContainer = b; + var c = Entry.createElement("iframe"); + c.setAttribute("id", "doneProjectframe"); + c.setAttribute("frameborder", 0); + c.setAttribute("src", "/api/iframe/project/" + a); + this.doneProjectFrame = c; + this.doneContainer.appendChild(c); + b.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"; + var a = document.getElementById("doneProjectframe"), b = this.doneContainer.offsetWidth; + a.width = b + "px"; + a.height = 9 * b / 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 < b.indexOf(d) && a.preventDefault(); + function a(b) { + var a = [37, 38, 39, 40, 32], d = b.keyCode || b.which, e = Entry.stage.inputField; + 32 == d && e && e.hasFocus() || -1 < a.indexOf(d) && b.preventDefault(); } this.state = "stop"; this.popup = null; @@ -6968,89 +7935,89 @@ Entry.Engine = function() { this.speeds = [1, 15, 30, 45, 60]; this._mouseMoved = !1; Entry.keyPressed && Entry.keyPressed.attach(this, this.captureKeyEvent); - Entry.addEventListener("canvasClick", function(a) { + Entry.addEventListener("canvasClick", function(b) { Entry.engine.fireEvent("mouse_clicked"); }); - Entry.addEventListener("canvasClickCanceled", function(a) { + Entry.addEventListener("canvasClickCanceled", function(b) { Entry.engine.fireEvent("mouse_click_cancled"); }); - Entry.addEventListener("entityClick", function(a) { - Entry.engine.fireEventOnEntity("when_object_click", a); + Entry.addEventListener("entityClick", function(b) { + Entry.engine.fireEventOnEntity("when_object_click", b); }); - Entry.addEventListener("entityClickCanceled", function(a) { - Entry.engine.fireEventOnEntity("when_object_click_canceled", a); + Entry.addEventListener("entityClickCanceled", function(b) { + Entry.engine.fireEventOnEntity("when_object_click_canceled", b); }); - "phone" != Entry.type && (Entry.addEventListener("stageMouseMove", function(a) { + "phone" != Entry.type && (Entry.addEventListener("stageMouseMove", function(b) { this._mouseMoved = !0; - }.bind(this)), Entry.addEventListener("stageMouseOut", function(a) { + }.bind(this)), Entry.addEventListener("stageMouseOut", function(b) { Entry.engine.hideMouseView(); })); Entry.addEventListener("run", function() { - $(window).bind("keydown", b); + $(window).bind("keydown", a); }); Entry.addEventListener("stop", function() { - $(window).unbind("keydown", b); + $(window).unbind("keydown", a); }); setInterval(function() { this._mouseMoved && (this.updateMouseView(), this._mouseMoved = !1); }.bind(this), 100); }; -Entry.Engine.prototype.generateView = function(b, a) { - if (a && "workspace" != a) { - "minimize" == a ? (this.view_ = b, this.view_.addClass("entryEngine"), this.view_.addClass("entryEngineMinimize"), this.maximizeButton = Entry.createElement("button"), this.maximizeButton.addClass("entryEngineButtonMinimize"), this.maximizeButton.addClass("entryMaximizeButtonMinimize"), this.view_.appendChild(this.maximizeButton), this.maximizeButton.bindOnClick(function(a) { +Entry.Engine.prototype.generateView = function(a, b) { + if (b && "workspace" != b) { + "minimize" == b ? (this.view_ = a, this.view_.addClass("entryEngine"), this.view_.addClass("entryEngineMinimize"), this.maximizeButton = Entry.createElement("button"), this.maximizeButton.addClass("entryEngineButtonMinimize"), this.maximizeButton.addClass("entryMaximizeButtonMinimize"), this.view_.appendChild(this.maximizeButton), this.maximizeButton.bindOnClick(function(b) { Entry.engine.toggleFullscreen(); - }), this.coordinateButton = Entry.createElement("button"), this.coordinateButton.addClass("entryEngineButtonMinimize"), this.coordinateButton.addClass("entryCoordinateButtonMinimize"), this.view_.appendChild(this.coordinateButton), this.coordinateButton.bindOnClick(function(a) { + }), this.coordinateButton = Entry.createElement("button"), this.coordinateButton.addClass("entryEngineButtonMinimize"), this.coordinateButton.addClass("entryCoordinateButtonMinimize"), this.view_.appendChild(this.coordinateButton), this.coordinateButton.bindOnClick(function(b) { this.hasClass("toggleOn") ? this.removeClass("toggleOn") : this.addClass("toggleOn"); Entry.stage.toggleCoordinator(); - }), this.stopButton = Entry.createElement("button"), this.stopButton.addClass("entryEngineButtonMinimize"), this.stopButton.addClass("entryStopButtonMinimize"), this.stopButton.addClass("entryRemove"), this.stopButton.innerHTML = Lang.Workspace.stop, this.view_.appendChild(this.stopButton), this.stopButton.bindOnClick(function(a) { + }), this.stopButton = Entry.createElement("button"), this.stopButton.addClass("entryEngineButtonMinimize"), this.stopButton.addClass("entryStopButtonMinimize"), this.stopButton.addClass("entryRemove"), this.stopButton.innerHTML = Lang.Workspace.stop, this.view_.appendChild(this.stopButton), this.stopButton.bindOnClick(function(b) { this.blur(); Entry.engine.toggleStop(); - }), this.pauseButton = Entry.createElement("button"), this.pauseButton.innerHTML = Lang.Workspace.pause, this.pauseButton.addClass("entryEngineButtonMinimize"), this.pauseButton.addClass("entryPauseButtonMinimize"), this.pauseButton.addClass("entryRemove"), this.view_.appendChild(this.pauseButton), this.pauseButton.bindOnClick(function(a) { + }), this.pauseButton = Entry.createElement("button"), this.pauseButton.innerHTML = Lang.Workspace.pause, this.pauseButton.addClass("entryEngineButtonMinimize"), this.pauseButton.addClass("entryPauseButtonMinimize"), this.pauseButton.addClass("entryRemove"), this.view_.appendChild(this.pauseButton), this.pauseButton.bindOnClick(function(b) { this.blur(); Entry.engine.togglePause(); }), this.mouseView = Entry.createElement("div"), this.mouseView.addClass("entryMouseViewMinimize"), this.mouseView.addClass("entryRemove"), this.view_.appendChild(this.mouseView), Entry.addEventListener("loadComplete", function() { this.runButton = Entry.Dom("div", {class:"entryRunButtonBigMinimize", parent:$("#entryCanvasWrapper")}); - this.runButton.bindOnClick(function(a) { + this.runButton.bindOnClick(function(b) { Entry.engine.toggleRun(); }); - }.bind(this))) : "phone" == a && (this.view_ = b, this.view_.addClass("entryEngine", "entryEnginePhone"), this.headerView_ = Entry.createElement("div", "entryEngineHeader"), this.headerView_.addClass("entryEngineHeaderPhone"), this.view_.appendChild(this.headerView_), this.maximizeButton = Entry.createElement("button"), this.maximizeButton.addClass("entryEngineButtonPhone", "entryMaximizeButtonPhone"), this.headerView_.appendChild(this.maximizeButton), this.maximizeButton.bindOnClick(function(a) { + }.bind(this))) : "phone" == b && (this.view_ = a, this.view_.addClass("entryEngine", "entryEnginePhone"), this.headerView_ = Entry.createElement("div", "entryEngineHeader"), this.headerView_.addClass("entryEngineHeaderPhone"), this.view_.appendChild(this.headerView_), this.maximizeButton = Entry.createElement("button"), this.maximizeButton.addClass("entryEngineButtonPhone", "entryMaximizeButtonPhone"), this.headerView_.appendChild(this.maximizeButton), this.maximizeButton.bindOnClick(function(b) { Entry.engine.footerView_.addClass("entryRemove"); Entry.engine.headerView_.addClass("entryRemove"); Entry.launchFullScreen(Entry.engine.view_); - }), document.addEventListener("fullscreenchange", function(a) { + }), document.addEventListener("fullscreenchange", function(b) { Entry.engine.exitFullScreen(); - }), document.addEventListener("webkitfullscreenchange", function(a) { + }), document.addEventListener("webkitfullscreenchange", function(b) { Entry.engine.exitFullScreen(); - }), document.addEventListener("mozfullscreenchange", function(a) { + }), document.addEventListener("mozfullscreenchange", function(b) { Entry.engine.exitFullScreen(); - }), this.footerView_ = Entry.createElement("div", "entryEngineFooter"), this.footerView_.addClass("entryEngineFooterPhone"), this.view_.appendChild(this.footerView_), this.runButton = Entry.createElement("button"), this.runButton.addClass("entryEngineButtonPhone", "entryRunButtonPhone"), Entry.objectAddable && this.runButton.addClass("small"), this.runButton.innerHTML = Lang.Workspace.run, this.footerView_.appendChild(this.runButton), this.runButton.bindOnClick(function(a) { + }), this.footerView_ = Entry.createElement("div", "entryEngineFooter"), this.footerView_.addClass("entryEngineFooterPhone"), this.view_.appendChild(this.footerView_), this.runButton = Entry.createElement("button"), this.runButton.addClass("entryEngineButtonPhone", "entryRunButtonPhone"), Entry.objectAddable && this.runButton.addClass("small"), this.runButton.innerHTML = Lang.Workspace.run, this.footerView_.appendChild(this.runButton), this.runButton.bindOnClick(function(b) { Entry.engine.toggleRun(); - }), this.stopButton = Entry.createElement("button"), this.stopButton.addClass("entryEngineButtonPhone", "entryStopButtonPhone", "entryRemove"), Entry.objectAddable && this.stopButton.addClass("small"), this.stopButton.innerHTML = Lang.Workspace.stop, this.footerView_.appendChild(this.stopButton), this.stopButton.bindOnClick(function(a) { + }), this.stopButton = Entry.createElement("button"), this.stopButton.addClass("entryEngineButtonPhone", "entryStopButtonPhone", "entryRemove"), Entry.objectAddable && this.stopButton.addClass("small"), this.stopButton.innerHTML = Lang.Workspace.stop, this.footerView_.appendChild(this.stopButton), this.stopButton.bindOnClick(function(b) { Entry.engine.toggleStop(); })); } else { - this.view_ = b; + this.view_ = a; this.view_.addClass("entryEngine_w"); this.view_.addClass("entryEngineWorkspace_w"); var c = Entry.createElement("button"); this.speedButton = c; this.speedButton.addClass("entrySpeedButtonWorkspace", "entryEngineTopWorkspace", "entryEngineButtonWorkspace_w"); this.view_.appendChild(this.speedButton); - this.speedButton.bindOnClick(function(a) { + this.speedButton.bindOnClick(function(b) { Entry.engine.toggleSpeedPanel(); c.blur(); }); this.maximizeButton = Entry.createElement("button"); this.maximizeButton.addClass("entryEngineButtonWorkspace_w", "entryEngineTopWorkspace", "entryMaximizeButtonWorkspace_w"); this.view_.appendChild(this.maximizeButton); - this.maximizeButton.bindOnClick(function(a) { + this.maximizeButton.bindOnClick(function(b) { Entry.engine.toggleFullscreen(); }); var d = Entry.createElement("button"); this.coordinateButton = d; this.coordinateButton.addClass("entryEngineButtonWorkspace_w", "entryEngineTopWorkspace", "entryCoordinateButtonWorkspace_w"); this.view_.appendChild(this.coordinateButton); - this.coordinateButton.bindOnClick(function(a) { + this.coordinateButton.bindOnClick(function(b) { this.hasClass("toggleOn") ? this.removeClass("toggleOn") : this.addClass("toggleOn"); d.blur(); Entry.stage.toggleCoordinator(); @@ -7059,7 +8026,7 @@ Entry.Engine.prototype.generateView = function(b, a) { this.addButton.addClass("entryEngineButtonWorkspace_w"); this.addButton.addClass("entryAddButtonWorkspace_w"); this.addButton.innerHTML = Lang.Workspace.add_object; - this.addButton.bindOnClick(function(a) { + this.addButton.bindOnClick(function(b) { Entry.dispatchEvent("openSpriteManager"); }); this.view_.appendChild(this.addButton); @@ -7068,14 +8035,14 @@ Entry.Engine.prototype.generateView = function(b, a) { this.runButton.addClass("entryRunButtonWorkspace_w"); this.runButton.innerHTML = Lang.Workspace.run; this.view_.appendChild(this.runButton); - this.runButton.bindOnClick(function(a) { + this.runButton.bindOnClick(function(b) { Entry.engine.toggleRun(); }); this.runButton2 = Entry.createElement("button"); this.runButton2.addClass("entryEngineButtonWorkspace_w"); this.runButton2.addClass("entryRunButtonWorkspace_w2"); this.view_.appendChild(this.runButton2); - this.runButton2.bindOnClick(function(a) { + this.runButton2.bindOnClick(function(b) { Entry.engine.toggleRun(); }); this.stopButton = Entry.createElement("button"); @@ -7084,7 +8051,7 @@ Entry.Engine.prototype.generateView = function(b, a) { this.stopButton.addClass("entryRemove"); this.stopButton.innerHTML = Lang.Workspace.stop; this.view_.appendChild(this.stopButton); - this.stopButton.bindOnClick(function(a) { + this.stopButton.bindOnClick(function(b) { Entry.engine.toggleStop(); }); this.stopButton2 = Entry.createElement("button"); @@ -7093,7 +8060,7 @@ Entry.Engine.prototype.generateView = function(b, a) { this.stopButton2.addClass("entryRemove"); this.stopButton2.innerHTML = Lang.Workspace.stop; this.view_.appendChild(this.stopButton2); - this.stopButton2.bindOnClick(function(a) { + this.stopButton2.bindOnClick(function(b) { Entry.engine.toggleStop(); }); this.pauseButton = Entry.createElement("button"); @@ -7101,7 +8068,7 @@ Entry.Engine.prototype.generateView = function(b, a) { this.pauseButton.addClass("entryPauseButtonWorkspace_w"); this.pauseButton.addClass("entryRemove"); this.view_.appendChild(this.pauseButton); - this.pauseButton.bindOnClick(function(a) { + this.pauseButton.bindOnClick(function(b) { Entry.engine.togglePause(); }); this.mouseView = Entry.createElement("div"); @@ -7112,7 +8079,7 @@ Entry.Engine.prototype.generateView = function(b, a) { }; Entry.Engine.prototype.toggleSpeedPanel = function() { if (this.speedPanelOn) { - this.speedPanelOn = !1, $(Entry.stage.canvas.canvas).animate({top:"24px"}), this.coordinateButton.removeClass("entryRemove"), this.maximizeButton.removeClass("entryRemove"), this.mouseView.removeClass("entryRemoveElement"), $(this.speedLabel_).remove(), delete this.speedLabel_, $(this.speedProgress_).fadeOut(null, function(a) { + this.speedPanelOn = !1, $(Entry.stage.canvas.canvas).animate({top:"24px"}), this.coordinateButton.removeClass("entryRemove"), this.maximizeButton.removeClass("entryRemove"), this.mouseView.removeClass("entryRemoveElement"), $(this.speedLabel_).remove(), delete this.speedLabel_, $(this.speedProgress_).fadeOut(null, function(b) { $(this).remove(); delete this.speedProgress_; }), $(this.speedHandle_).remove(), delete this.speedHandle_; @@ -7126,44 +8093,44 @@ Entry.Engine.prototype.toggleSpeedPanel = function() { this.speedLabel_.innerHTML = Lang.Workspace.speed; this.view_.insertBefore(this.speedLabel_, this.maximizeButton); this.speedProgress_ = Entry.createElement("table", "entrySpeedProgressWorkspace"); - for (var b = Entry.createElement("tr"), a = this.speeds, c = 0;5 > c;c++) { + for (var a = Entry.createElement("tr"), b = this.speeds, c = 0;5 > c;c++) { (function(c) { var d = Entry.createElement("td", "progressCell" + c); d.bindOnClick(function() { - Entry.engine.setSpeedMeter(a[c]); + Entry.engine.setSpeedMeter(b[c]); }); - b.appendChild(d); + a.appendChild(d); })(c); } this.view_.insertBefore(this.speedProgress_, this.maximizeButton); - this.speedProgress_.appendChild(b); + this.speedProgress_.appendChild(a); this.speedHandle_ = Entry.createElement("div", "entrySpeedHandleWorkspace"); var d = (Entry.interfaceState.canvasWidth - 84) / 5; - $(this.speedHandle_).bind("mousedown.speedPanel touchstart.speedPanel", function(a) { - function b(a) { - a.stopPropagation(); - a = Entry.Utils.convertMouseEvent(a); - a = Math.floor((a.clientX - 80) / (5 * d) * 5); - 0 > a || 4 < a || Entry.engine.setSpeedMeter(Entry.engine.speeds[a]); + $(this.speedHandle_).bind("mousedown.speedPanel touchstart.speedPanel", function(b) { + function a(b) { + b.stopPropagation(); + b = Entry.Utils.convertMouseEvent(b); + b = Math.floor((b.clientX - 80) / (5 * d) * 5); + 0 > b || 4 < b || Entry.engine.setSpeedMeter(Entry.engine.speeds[b]); } - function c(a) { + function c(b) { $(document).unbind(".speedPanel"); } - a.stopPropagation && a.stopPropagation(); - a.preventDefault && a.preventDefault(); - if (0 === a.button || a.originalEvent && a.originalEvent.touches) { - Entry.Utils.convertMouseEvent(a), a = $(document), a.bind("mousemove.speedPanel touchmove.speedPanel", b), a.bind("mouseup.speedPanel touchend.speedPanel", c); + b.stopPropagation && b.stopPropagation(); + b.preventDefault && b.preventDefault(); + if (0 === b.button || b.originalEvent && b.originalEvent.touches) { + Entry.Utils.convertMouseEvent(b), b = $(document), b.bind("mousemove.speedPanel touchmove.speedPanel", a), b.bind("mouseup.speedPanel touchend.speedPanel", c); } }); this.view_.insertBefore(this.speedHandle_, this.maximizeButton); this.setSpeedMeter(Entry.FPS); } }; -Entry.Engine.prototype.setSpeedMeter = function(b) { - var a = this.speeds.indexOf(b); - 0 > a || (a = Math.min(4, a), a = Math.max(0, a), this.speedPanelOn && (this.speedHandle_.style.left = (Entry.interfaceState.canvasWidth - 80) / 10 * (2 * a + 1) + 80 - 9 + "px"), Entry.FPS != b && (clearInterval(this.ticker), this.ticker = setInterval(this.update, Math.floor(1E3 / b)), Entry.FPS = b)); +Entry.Engine.prototype.setSpeedMeter = function(a) { + var b = this.speeds.indexOf(a); + 0 > b || (b = Math.min(4, b), b = Math.max(0, b), this.speedPanelOn && (this.speedHandle_.style.left = (Entry.interfaceState.canvasWidth - 80) / 10 * (2 * b + 1) + 80 - 9 + "px"), Entry.FPS != a && (clearInterval(this.ticker), this.ticker = setInterval(this.update, Math.floor(1E3 / a)), Entry.FPS = a)); }; -Entry.Engine.prototype.start = function(b) { +Entry.Engine.prototype.start = function(a) { createjs.Ticker.setFPS(Entry.FPS); this.ticker = setInterval(this.update, Math.floor(1E3 / Entry.FPS)); }; @@ -7177,54 +8144,55 @@ Entry.Engine.prototype.update = function() { Entry.Engine.prototype.computeObjects = function() { Entry.container.mapObjectOnScene(this.computeFunction); }; -Entry.Engine.prototype.computeFunction = function(b) { - b.script.tick(); +Entry.Engine.prototype.computeFunction = function(a) { + a.script.tick(); }; -Entry.Engine.computeThread = function(b, a) { +Entry.Engine.computeThread = function(a, b) { Entry.engine.isContinue = !0; - for (var c = !1;a && Entry.engine.isContinue && !c;) { - Entry.engine.isContinue = !a.isRepeat; - var d = a.run(), c = d && d === a; - a = d; + for (a = !1;b && Entry.engine.isContinue && !a;) { + Entry.engine.isContinue = !b.isRepeat; + var c = b.run(); + a = c && c === b; + b = c; } - return a; + return b; }; -Entry.Engine.prototype.isState = function(b) { - return -1 < this.state.indexOf(b); +Entry.Engine.prototype.isState = function(a) { + return -1 < this.state.indexOf(a); }; Entry.Engine.prototype.run = function() { this.isState("run") ? this.toggleStop() : (this.isState("stop") || this.isState("pause")) && this.toggleRun(); }; Entry.Engine.prototype.toggleRun = function() { - "pause" === this.state ? this.togglePause() : (Entry.addActivity("run"), "stop" == this.state && (Entry.container.mapEntity(function(b) { - b.takeSnapshot(); - }), Entry.variableContainer.mapVariable(function(b) { - b.takeSnapshot(); - }), Entry.variableContainer.mapList(function(b) { - b.takeSnapshot(); + "pause" === this.state ? this.togglePause() : (Entry.addActivity("run"), "stop" == this.state && (Entry.container.mapEntity(function(a) { + a.takeSnapshot(); + }), Entry.variableContainer.mapVariable(function(a) { + a.takeSnapshot(); + }), Entry.variableContainer.mapList(function(a) { + a.takeSnapshot(); }), this.projectTimer.takeSnapshot(), Entry.container.inputValue.takeSnapshot(), Entry.container.takeSequenceSnapshot(), Entry.scene.takeStartSceneSnapshot(), this.state = "run", this.fireEvent("start")), this.state = "run", "mobile" == Entry.type && this.view_.addClass("entryEngineBlueWorkspace"), this.pauseButton.innerHTML = Lang.Workspace.pause, this.runButton.addClass("run"), this.runButton.addClass("entryRemove"), this.stopButton.removeClass("entryRemove"), this.pauseButton && this.pauseButton.removeClass("entryRemove"), this.runButton2 && this.runButton2.addClass("entryRemove"), this.stopButton2 && this.stopButton2.removeClass("entryRemove"), this.isUpdating || (Entry.engine.update(), Entry.engine.isUpdating = !0), Entry.stage.selectObject(), Entry.dispatchEvent("run")); }; Entry.Engine.prototype.toggleStop = function() { Entry.addActivity("stop"); - var b = Entry.container, a = Entry.variableContainer; - b.mapEntity(function(a) { - a.loadSnapshot(); - a.object.filters = []; - a.resetFilter(); - a.dialog && a.dialog.remove(); - a.brush && a.removeBrush(); + var a = Entry.container, b = Entry.variableContainer; + a.mapEntity(function(b) { + b.loadSnapshot(); + b.object.filters = []; + b.resetFilter(); + b.dialog && b.dialog.remove(); + b.brush && b.removeBrush(); }); - a.mapVariable(function(a) { - a.loadSnapshot(); + b.mapVariable(function(b) { + b.loadSnapshot(); }); - a.mapList(function(a) { - a.loadSnapshot(); - a.updateView(); + b.mapList(function(b) { + b.loadSnapshot(); + b.updateView(); }); this.stopProjectTimer(); - b.clearRunningState(); - b.loadSequenceSnapshot(); + a.clearRunningState(); + a.loadSequenceSnapshot(); this.projectTimer.loadSnapshot(); Entry.container.inputValue.loadSnapshot(); Entry.scene.loadStartSceneSnapshot(); @@ -7242,33 +8210,33 @@ Entry.Engine.prototype.toggleStop = function() { Entry.stage.hideInputField(); }; Entry.Engine.prototype.togglePause = function() { - var b = Entry.engine.projectTimer; - "pause" == this.state ? (b.pausedTime += (new Date).getTime() - b.pauseStart, b.isPaused ? b.pauseStart = (new Date).getTime() : delete b.pauseStart, this.state = "run", this.pauseButton.innerHTML = Lang.Workspace.pause, this.runButton.addClass("entryRemove"), this.runButton2 && this.runButton2.addClass("entryRemove")) : (this.state = "pause", b.isPaused && (b.pausedTime += (new Date).getTime() - b.pauseStart), b.pauseStart = (new Date).getTime(), this.pauseButton.innerHTML = Lang.Workspace.restart, + var a = Entry.engine.projectTimer; + "pause" == this.state ? (a.pausedTime += (new Date).getTime() - a.pauseStart, a.isPaused ? a.pauseStart = (new Date).getTime() : delete a.pauseStart, this.state = "run", this.pauseButton.innerHTML = Lang.Workspace.pause, this.runButton.addClass("entryRemove"), this.runButton2 && this.runButton2.addClass("entryRemove")) : (this.state = "pause", a.isPaused && (a.pausedTime += (new Date).getTime() - a.pauseStart), a.pauseStart = (new Date).getTime(), this.pauseButton.innerHTML = Lang.Workspace.restart, this.runButton.removeClass("entryRemove"), this.stopButton.removeClass("entryRemove"), this.runButton2 && this.runButton2.removeClass("entryRemove")); }; -Entry.Engine.prototype.fireEvent = function(b) { - "run" == this.state && Entry.container.mapEntityIncludeCloneOnScene(this.raiseEvent, b); +Entry.Engine.prototype.fireEvent = function(a) { + "run" == this.state && Entry.container.mapEntityIncludeCloneOnScene(this.raiseEvent, a); }; -Entry.Engine.prototype.raiseEvent = function(b, a) { - b.parent.script.raiseEvent(a, b); +Entry.Engine.prototype.raiseEvent = function(a, b) { + a.parent.script.raiseEvent(b, a); }; -Entry.Engine.prototype.fireEventOnEntity = function(b, a) { - "run" == this.state && Entry.container.mapEntityIncludeCloneOnScene(this.raiseEventOnEntity, [a, b]); +Entry.Engine.prototype.fireEventOnEntity = function(a, b) { + "run" == this.state && Entry.container.mapEntityIncludeCloneOnScene(this.raiseEventOnEntity, [b, a]); }; -Entry.Engine.prototype.raiseEventOnEntity = function(b, a) { - b === a[0] && b.parent.script.raiseEvent(a[1], b); +Entry.Engine.prototype.raiseEventOnEntity = function(a, b) { + a === b[0] && a.parent.script.raiseEvent(b[1], a); }; -Entry.Engine.prototype.captureKeyEvent = function(b) { - var a = b.keyCode, c = Entry.type; - b.ctrlKey && "workspace" == c ? 83 == a ? (b.preventDefault(), Entry.dispatchEvent("saveWorkspace")) : 82 == a ? (b.preventDefault(), Entry.engine.run()) : 90 == a && (b.preventDefault(), console.log("engine"), Entry.dispatchEvent(b.shiftKey ? "redo" : "undo")) : Entry.engine.isState("run") && Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent, ["keyPress", a]); - Entry.engine.isState("stop") && "workspace" === c && 37 <= a && 40 >= a && Entry.stage.moveSprite(b); +Entry.Engine.prototype.captureKeyEvent = function(a) { + var b = a.keyCode, c = Entry.type; + a.ctrlKey && "workspace" == c ? 83 == b ? (a.preventDefault(), Entry.dispatchEvent("saveWorkspace")) : 82 == b ? (a.preventDefault(), Entry.engine.run()) : 90 == b && (a.preventDefault(), console.log("engine"), Entry.dispatchEvent(a.shiftKey ? "redo" : "undo")) : Entry.engine.isState("run") && Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent, ["keyPress", b]); + Entry.engine.isState("stop") && "workspace" === c && 37 <= b && 40 >= b && Entry.stage.moveSprite(a); }; -Entry.Engine.prototype.raiseKeyEvent = function(b, a) { - return b.parent.script.raiseEvent(a[0], b, String(a[1])); +Entry.Engine.prototype.raiseKeyEvent = function(a, b) { + return a.parent.script.raiseEvent(b[0], a, String(b[1])); }; Entry.Engine.prototype.updateMouseView = function() { - var b = Entry.stage.mouseCoordinate; - this.mouseView.textContent = "X : " + b.x + ", Y : " + b.y; + var a = Entry.stage.mouseCoordinate; + this.mouseView.textContent = "X : " + a.x + ", Y : " + a.y; this.mouseView.removeClass("entryRemove"); }; Entry.Engine.prototype.hideMouseView = function() { @@ -7280,8 +8248,8 @@ Entry.Engine.prototype.toggleFullscreen = function() { } else { this.popup = new Entry.Popup; if ("workspace" != Entry.type) { - var b = $(document); - $(this.popup.body_).css("top", b.scrollTop()); + var a = $(document); + $(this.popup.body_).css("top", a.scrollTop()); $("body").css("overflow", "hidden"); popup.window_.appendChild(Entry.stage.canvas.canvas); popup.window_.appendChild(Entry.engine.runButton[0]); @@ -7298,16 +8266,16 @@ Entry.Engine.prototype.showProjectTimer = function() { Entry.engine.projectTimer && this.projectTimer.setVisible(!0); }; Entry.Engine.prototype.hideProjectTimer = function() { - var b = this.projectTimer; - if (b && b.isVisible() && !this.isState("run")) { - for (var a = Entry.container.getAllObjects(), c = ["get_project_timer_value", "reset_project_timer", "set_visible_project_timer", "choose_project_timer_action"], d = 0, e = a.length;d < e;d++) { - for (var f = a[d].script, g = 0;g < c.length;g++) { + var a = this.projectTimer; + if (a && a.isVisible() && !this.isState("run")) { + for (var b = Entry.container.getAllObjects(), c = ["get_project_timer_value", "reset_project_timer", "set_visible_project_timer", "choose_project_timer_action"], d = 0, e = b.length;d < e;d++) { + for (var f = b[d].script, g = 0;g < c.length;g++) { if (f.hasBlockType(c[g])) { return; } } } - b.setVisible(!1); + a.setVisible(!1); } }; Entry.Engine.prototype.clearTimer = function() { @@ -7315,25 +8283,25 @@ Entry.Engine.prototype.clearTimer = function() { clearInterval(this.projectTimer.tick); }; Entry.Engine.prototype.startProjectTimer = function() { - var b = this.projectTimer; - b && (b.start = (new Date).getTime(), b.isInit = !0, b.pausedTime = 0, b.tick = setInterval(function(a) { + var a = this.projectTimer; + a && (a.start = (new Date).getTime(), a.isInit = !0, a.pausedTime = 0, a.tick = setInterval(function(b) { Entry.engine.updateProjectTimer(); }, 1E3 / 60)); }; Entry.Engine.prototype.stopProjectTimer = function() { - var b = this.projectTimer; - b && (this.updateProjectTimer(0), b.isPaused = !1, b.isInit = !1, b.pausedTime = 0, clearInterval(b.tick)); + var a = this.projectTimer; + a && (this.updateProjectTimer(0), a.isPaused = !1, a.isInit = !1, a.pausedTime = 0, clearInterval(a.tick)); }; -Entry.Engine.prototype.updateProjectTimer = function(b) { - var a = Entry.engine, c = a.projectTimer; +Entry.Engine.prototype.updateProjectTimer = function(a) { + var b = Entry.engine, c = b.projectTimer; if (c) { var d = (new Date).getTime(); - "undefined" == typeof b ? c.isPaused || a.isState("pause") || c.setValue((d - c.start - c.pausedTime) / 1E3) : (c.setValue(b), c.pausedTime = 0, c.start = d); + "undefined" == typeof a ? c.isPaused || b.isState("pause") || c.setValue((d - c.start - c.pausedTime) / 1E3) : (c.setValue(a), c.pausedTime = 0, c.start = d); } }; -Entry.EntityObject = function(b) { - this.parent = b; - this.type = b.objectType; +Entry.EntityObject = function(a) { + this.parent = a; + this.type = a.objectType; this.flip = !1; this.collision = Entry.Utils.COLLISION.NONE; this.id = Entry.generateHash(); @@ -7341,54 +8309,41 @@ Entry.EntityObject = function(b) { this.fontType = "Nanum Gothic", this.fontSize = 20, this.strike = this.underLine = this.fontItalic = this.fontBold = !1); this.object.entity = this; this.object.cursor = "pointer"; - this.object.on("mousedown", function(a) { - var b = this.entity.parent.id; + this.object.on("mousedown", function(b) { + var a = this.entity.parent.id; Entry.dispatchEvent("entityClick", this.entity); Entry.stage.isObjectClick = !0; - "minimize" != Entry.type && Entry.engine.isState("stop") && (this.offset = {x:-this.parent.x + this.entity.getX() - (.75 * a.stageX - 240), y:-this.parent.y - this.entity.getY() - (.75 * a.stageY - 135)}, this.cursor = "move", this.entity.initCommand(), Entry.container.selectObject(b)); + "minimize" != Entry.type && Entry.engine.isState("stop") && (this.offset = {x:-this.parent.x + this.entity.getX() - (.75 * b.stageX - 240), y:-this.parent.y - this.entity.getY() - (.75 * b.stageY - 135)}, this.cursor = "move", this.entity.initCommand(), Entry.container.selectObject(a)); }); - this.object.on("pressup", function(a) { + this.object.on("pressup", function(b) { Entry.dispatchEvent("entityClickCanceled", this.entity); this.cursor = "pointer"; this.entity.checkCommand(); }); - this.object.on("pressmove", function(a) { - "minimize" != Entry.type && Entry.engine.isState("stop") && !this.entity.parent.getLock() && (this.entity.doCommand(), this.entity.setX(.75 * a.stageX - 240 + this.offset.x), this.entity.setY(-(.75 * a.stageY - 135) - this.offset.y), Entry.stage.updateObject()); + this.object.on("pressmove", function(b) { + "minimize" != Entry.type && Entry.engine.isState("stop") && !this.entity.parent.getLock() && (this.entity.doCommand(), this.entity.setX(.75 * b.stageX - 240 + this.offset.x), this.entity.setY(-(.75 * b.stageY - 135) - this.offset.y), Entry.stage.updateObject()); }); }; -Entry.EntityObject.prototype.injectModel = function(b, a) { - if ("sprite" == this.type) { - this.setImage(b); - } else { - if ("textBox" == this.type) { - var c = this.parent; - a.text = a.text || c.text || c.name; - this.setFont(a.font); - this.setBGColour(a.bgColor); - this.setColour(a.colour); - this.setUnderLine(a.underLine); - this.setStrike(a.strike); - this.setText(a.text); - } - } - a && this.syncModel_(a); -}; -Entry.EntityObject.prototype.syncModel_ = function(b) { - this.setX(b.x); - this.setY(b.y); - this.setRegX(b.regX); - this.setRegY(b.regY); - this.setScaleX(b.scaleX); - this.setScaleY(b.scaleY); - this.setRotation(b.rotation); - this.setDirection(b.direction, !0); - this.setLineBreak(b.lineBreak); - this.setWidth(b.width); - this.setHeight(b.height); - this.setText(b.text); - this.setTextAlign(b.textAlign); - this.setFontSize(b.fontSize || this.getFontSize()); - this.setVisible(b.visible); +Entry.EntityObject.prototype.injectModel = function(a, b) { + "sprite" == this.type ? this.setImage(a) : "textBox" == this.type && (a = this.parent, b.text = b.text || a.text || a.name, this.setFont(b.font), this.setBGColour(b.bgColor), this.setColour(b.colour), this.setUnderLine(b.underLine), this.setStrike(b.strike), this.setText(b.text)); + b && this.syncModel_(b); +}; +Entry.EntityObject.prototype.syncModel_ = function(a) { + this.setX(a.x); + this.setY(a.y); + this.setRegX(a.regX); + this.setRegY(a.regY); + this.setScaleX(a.scaleX); + this.setScaleY(a.scaleY); + this.setRotation(a.rotation); + this.setDirection(a.direction, !0); + this.setLineBreak(a.lineBreak); + this.setWidth(a.width); + this.setHeight(a.height); + this.setText(a.text); + this.setTextAlign(a.textAlign); + this.setFontSize(a.fontSize || this.getFontSize()); + this.setVisible(a.visible); }; Entry.EntityObject.prototype.initCommand = function() { Entry.engine.isState("stop") && (this.isCommandValid = !1, Entry.stateManager && Entry.stateManager.addCommand("edit entity", this, this.restoreEntity, this.toJSON())); @@ -7399,20 +8354,20 @@ Entry.EntityObject.prototype.doCommand = function() { Entry.EntityObject.prototype.checkCommand = function() { Entry.engine.isState("stop") && !this.isCommandValid && Entry.dispatchEvent("cancelLastCommand"); }; -Entry.EntityObject.prototype.restoreEntity = function(b) { - var a = this.toJSON(); - this.syncModel_(b); +Entry.EntityObject.prototype.restoreEntity = function(a) { + var b = this.toJSON(); + this.syncModel_(a); Entry.dispatchEvent("updateObject"); - Entry.stateManager && Entry.stateManager.addCommand("restore object", this, this.restoreEntity, a); + Entry.stateManager && Entry.stateManager.addCommand("restore object", this, this.restoreEntity, b); }; -Entry.EntityObject.prototype.setX = function(b) { - "number" == typeof b && (this.x = b, this.object.x = this.x, this.isClone || this.parent.updateCoordinateView(), this.updateDialog(), Entry.requestUpdate = !0); +Entry.EntityObject.prototype.setX = function(a) { + "number" == typeof a && (this.x = a, this.object.x = this.x, this.isClone || this.parent.updateCoordinateView(), this.updateDialog(), Entry.requestUpdate = !0); }; Entry.EntityObject.prototype.getX = function() { return this.x; }; -Entry.EntityObject.prototype.setY = function(b) { - "number" == typeof b && (this.y = b, this.object.y = -this.y, this.isClone || this.parent.updateCoordinateView(), this.updateDialog(), Entry.requestUpdate = !0); +Entry.EntityObject.prototype.setY = function(a) { + "number" == typeof a && (this.y = a, this.object.y = -this.y, this.isClone || this.parent.updateCoordinateView(), this.updateDialog(), Entry.requestUpdate = !0); }; Entry.EntityObject.prototype.getY = function() { return this.y; @@ -7420,18 +8375,18 @@ Entry.EntityObject.prototype.getY = function() { Entry.EntityObject.prototype.getDirection = function() { return this.direction; }; -Entry.EntityObject.prototype.setDirection = function(b, a) { - b || (b = 0); - "vertical" != this.parent.getRotateMethod() || a || (0 <= this.direction && 180 > this.direction) == (0 <= b && 180 > b) || (this.setScaleX(-this.getScaleX()), Entry.stage.updateObject(), this.flip = !this.flip); - this.direction = b.mod(360); +Entry.EntityObject.prototype.setDirection = function(a, b) { + a || (a = 0); + "vertical" != this.parent.getRotateMethod() || b || (0 <= this.direction && 180 > this.direction) == (0 <= a && 180 > a) || (this.setScaleX(-this.getScaleX()), Entry.stage.updateObject(), this.flip = !this.flip); + this.direction = a.mod(360); this.object.direction = this.direction; this.isClone || this.parent.updateRotationView(); Entry.dispatchEvent("updateObject"); Entry.requestUpdate = !0; }; -Entry.EntityObject.prototype.setRotation = function(b) { - "free" != this.parent.getRotateMethod() && (b = 0); - this.rotation = b.mod(360); +Entry.EntityObject.prototype.setRotation = function(a) { + "free" != this.parent.getRotateMethod() && (a = 0); + this.rotation = a.mod(360); this.object.rotation = this.rotation; this.updateDialog(); this.isClone || this.parent.updateRotationView(); @@ -7441,26 +8396,26 @@ Entry.EntityObject.prototype.setRotation = function(b) { Entry.EntityObject.prototype.getRotation = function() { return this.rotation; }; -Entry.EntityObject.prototype.setRegX = function(b) { - "textBox" == this.type && (b = 0); - this.regX = b; +Entry.EntityObject.prototype.setRegX = function(a) { + "textBox" == this.type && (a = 0); + this.regX = a; this.object.regX = this.regX; Entry.requestUpdate = !0; }; Entry.EntityObject.prototype.getRegX = function() { return this.regX; }; -Entry.EntityObject.prototype.setRegY = function(b) { - "textBox" == this.type && (b = 0); - this.regY = b; +Entry.EntityObject.prototype.setRegY = function(a) { + "textBox" == this.type && (a = 0); + this.regY = a; this.object.regY = this.regY; Entry.requestUpdate = !0; }; Entry.EntityObject.prototype.getRegY = function() { return this.regY; }; -Entry.EntityObject.prototype.setScaleX = function(b) { - this.scaleX = b; +Entry.EntityObject.prototype.setScaleX = function(a) { + this.scaleX = a; this.object.scaleX = this.scaleX; this.parent.updateCoordinateView(); this.updateDialog(); @@ -7469,8 +8424,8 @@ Entry.EntityObject.prototype.setScaleX = function(b) { Entry.EntityObject.prototype.getScaleX = function() { return this.scaleX; }; -Entry.EntityObject.prototype.setScaleY = function(b) { - this.scaleY = b; +Entry.EntityObject.prototype.setScaleY = function(a) { + this.scaleY = a; this.object.scaleY = this.scaleY; this.parent.updateCoordinateView(); this.updateDialog(); @@ -7479,19 +8434,19 @@ Entry.EntityObject.prototype.setScaleY = function(b) { Entry.EntityObject.prototype.getScaleY = function() { return this.scaleY; }; -Entry.EntityObject.prototype.setSize = function(b) { - 1 > b && (b = 1); - b /= this.getSize(); - this.setScaleX(this.getScaleX() * b); - this.setScaleY(this.getScaleY() * b); +Entry.EntityObject.prototype.setSize = function(a) { + 1 > a && (a = 1); + a /= this.getSize(); + this.setScaleX(this.getScaleX() * a); + this.setScaleY(this.getScaleY() * a); this.isClone || this.parent.updateCoordinateView(); Entry.requestUpdate = !0; }; Entry.EntityObject.prototype.getSize = function() { return (this.getWidth() * Math.abs(this.getScaleX()) + this.getHeight() * Math.abs(this.getScaleY())) / 2; }; -Entry.EntityObject.prototype.setWidth = function(b) { - this.width = b; +Entry.EntityObject.prototype.setWidth = function(a) { + this.width = a; this.object.width = this.width; this.textObject && this.getLineBreak() && (this.textObject.lineWidth = this.width); this.updateDialog(); @@ -7501,8 +8456,8 @@ Entry.EntityObject.prototype.setWidth = function(b) { Entry.EntityObject.prototype.getWidth = function() { return this.width; }; -Entry.EntityObject.prototype.setHeight = function(b) { - this.height = b; +Entry.EntityObject.prototype.setHeight = function(a) { + this.height = a; this.textObject && (this.object.height = this.height, this.alignTextBox()); this.updateDialog(); this.updateBG(); @@ -7511,65 +8466,65 @@ Entry.EntityObject.prototype.setHeight = function(b) { Entry.EntityObject.prototype.getHeight = function() { return this.height; }; -Entry.EntityObject.prototype.setColour = function(b) { - b || (b = "#000000"); - this.colour = b; +Entry.EntityObject.prototype.setColour = function(a) { + a || (a = "#000000"); + this.colour = a; this.textObject && (this.textObject.color = this.colour); Entry.requestUpdate = !0; }; Entry.EntityObject.prototype.getColour = function() { return this.colour; }; -Entry.EntityObject.prototype.setBGColour = function(b) { - b || (b = "transparent"); - this.bgColor = b; +Entry.EntityObject.prototype.setBGColour = function(a) { + a || (a = "transparent"); + this.bgColor = a; this.updateBG(); Entry.requestUpdate = !0; }; Entry.EntityObject.prototype.getBGColour = function() { return this.bgColor; }; -Entry.EntityObject.prototype.setUnderLine = function(b) { - void 0 === b && (b = !1); - this.underLine = b; - this.textObject.underLine = b; +Entry.EntityObject.prototype.setUnderLine = function(a) { + void 0 === a && (a = !1); + this.underLine = a; + this.textObject.underLine = a; Entry.requestUpdate = !0; }; Entry.EntityObject.prototype.getUnderLine = function() { return this.underLine; }; -Entry.EntityObject.prototype.setStrike = function(b) { - void 0 === b && (b = !1); - this.strike = b; - this.textObject.strike = b; +Entry.EntityObject.prototype.setStrike = function(a) { + void 0 === a && (a = !1); + this.strike = a; + this.textObject.strike = a; Entry.requestUpdate = !0; }; Entry.EntityObject.prototype.getStrike = function() { return this.strike; }; Entry.EntityObject.prototype.getFont = function() { - var b = []; - this.fontBold && b.push("bold"); - this.fontItalic && b.push("italic"); - b.push(this.getFontSize() + "px"); - b.push(this.fontType); - return b.join(" "); -}; -Entry.EntityObject.prototype.setFont = function(b) { - if ("textBox" == this.parent.objectType && this.font !== b) { - b || (b = "20px Nanum Gothic"); - var a = b.split(" "), c = 0; - if (c = -1 < a.indexOf("bold")) { - a.splice(c - 1, 1), this.setFontBold(!0); - } - if (c = -1 < a.indexOf("italic")) { - a.splice(c - 1, 1), this.setFontItalic(!0); - } - c = parseInt(a.shift()); + var a = []; + this.fontBold && a.push("bold"); + this.fontItalic && a.push("italic"); + a.push(this.getFontSize() + "px"); + a.push(this.fontType); + return a.join(" "); +}; +Entry.EntityObject.prototype.setFont = function(a) { + if ("textBox" == this.parent.objectType && this.font !== a) { + a || (a = "20px Nanum Gothic"); + var b = a.split(" "), c; + if (c = -1 < b.indexOf("bold")) { + b.splice(c - 1, 1), this.setFontBold(!0); + } + if (c = -1 < b.indexOf("italic")) { + b.splice(c - 1, 1), this.setFontItalic(!0); + } + c = parseInt(b.shift()); this.setFontSize(c); - this.setFontType(a.join(" ")); + this.setFontType(b.join(" ")); this.font = this.getFont(); - this.textObject.font = b; + this.textObject.font = a; Entry.stage.update(); this.setWidth(this.textObject.getMeasuredWidth()); this.updateBG(); @@ -7596,17 +8551,17 @@ Entry.EntityObject.prototype.syncFont = function() { Entry.EntityObject.prototype.getFontType = function() { return this.fontType; }; -Entry.EntityObject.prototype.setFontType = function(b) { - "textBox" == this.parent.objectType && (this.fontType = b ? b : "Nanum Gothic", this.syncFont()); +Entry.EntityObject.prototype.setFontType = function(a) { + "textBox" == this.parent.objectType && (this.fontType = a ? a : "Nanum Gothic", this.syncFont()); }; -Entry.EntityObject.prototype.getFontSize = function(b) { +Entry.EntityObject.prototype.getFontSize = function(a) { return this.fontSize; }; -Entry.EntityObject.prototype.setFontSize = function(b) { - "textBox" == this.parent.objectType && this.fontSize != b && (this.fontSize = b ? b : 20, this.syncFont(), this.alignTextBox()); +Entry.EntityObject.prototype.setFontSize = function(a) { + "textBox" == this.parent.objectType && this.fontSize != a && (this.fontSize = a ? a : 20, this.syncFont(), this.alignTextBox()); }; -Entry.EntityObject.prototype.setFontBold = function(b) { - this.fontBold = b; +Entry.EntityObject.prototype.setFontBold = function(a) { + this.fontBold = a; Entry.requestUpdate = !0; }; Entry.EntityObject.prototype.toggleFontBold = function() { @@ -7614,8 +8569,8 @@ Entry.EntityObject.prototype.toggleFontBold = function() { this.syncFont(); return this.fontBold; }; -Entry.EntityObject.prototype.setFontItalic = function(b) { - this.fontItalic = b; +Entry.EntityObject.prototype.setFontItalic = function(a) { + this.fontItalic = a; Entry.requestUpdate = !0; }; Entry.EntityObject.prototype.toggleFontItalic = function() { @@ -7623,50 +8578,50 @@ Entry.EntityObject.prototype.toggleFontItalic = function() { this.syncFont(); return this.fontItalic; }; -Entry.EntityObject.prototype.setFontName = function(b) { - for (var a = this.font.split(" "), c = [], d = 0, e = a.length;d < e;d++) { - ("bold" === a[d] || "italic" === a[d] || -1 < a[d].indexOf("px")) && c.push(a[d]); +Entry.EntityObject.prototype.setFontName = function(a) { + for (var b = this.font.split(" "), c = [], d = 0, e = b.length;d < e;d++) { + ("bold" === b[d] || "italic" === b[d] || -1 < b[d].indexOf("px")) && c.push(b[d]); } - this.setFont(c.join(" ") + " " + b); + this.setFont(c.join(" ") + " " + a); }; Entry.EntityObject.prototype.getFontName = function() { if ("textBox" == this.type) { if (!this.font) { return ""; } - for (var b = this.font.split(" "), a = [], c = 0, d = b.length;c < d;c++) { - "bold" !== b[c] && "italic" !== b[c] && -1 === b[c].indexOf("px") && a.push(b[c]); + for (var a = this.font.split(" "), b = [], c = 0, d = a.length;c < d;c++) { + "bold" !== a[c] && "italic" !== a[c] && -1 === a[c].indexOf("px") && b.push(a[c]); } - return a.join(" ").trim(); + return b.join(" ").trim(); } }; -Entry.EntityObject.prototype.setText = function(b) { - "textBox" == this.parent.objectType && (void 0 === b && (b = ""), this.text = b, this.textObject.text = this.text, this.lineBreak || (this.setWidth(this.textObject.getMeasuredWidth()), this.parent.updateCoordinateView()), this.updateBG(), Entry.stage.updateObject()); +Entry.EntityObject.prototype.setText = function(a) { + "textBox" == this.parent.objectType && (void 0 === a && (a = ""), this.text = a, this.textObject.text = this.text, this.lineBreak || (this.setWidth(this.textObject.getMeasuredWidth()), this.parent.updateCoordinateView()), this.updateBG(), Entry.stage.updateObject()); }; Entry.EntityObject.prototype.getText = function() { return this.text; }; -Entry.EntityObject.prototype.setTextAlign = function(b) { - "textBox" == this.parent.objectType && (void 0 === b && (b = Entry.TEXT_ALIGN_CENTER), this.textAlign = b, this.textObject.textAlign = Entry.TEXT_ALIGNS[this.textAlign], this.alignTextBox(), this.updateBG(), Entry.stage.updateObject()); +Entry.EntityObject.prototype.setTextAlign = function(a) { + "textBox" == this.parent.objectType && (void 0 === a && (a = Entry.TEXT_ALIGN_CENTER), this.textAlign = a, this.textObject.textAlign = Entry.TEXT_ALIGNS[this.textAlign], this.alignTextBox(), this.updateBG(), Entry.stage.updateObject()); }; Entry.EntityObject.prototype.getTextAlign = function() { return this.textAlign; }; -Entry.EntityObject.prototype.setLineBreak = function(b) { +Entry.EntityObject.prototype.setLineBreak = function(a) { if ("textBox" == this.parent.objectType) { - void 0 === b && (b = !1); - var a = this.lineBreak; - this.lineBreak = b; - a && !this.lineBreak ? (this.textObject.lineWidth = null, this.setHeight(this.textObject.getMeasuredLineHeight()), this.setText(this.getText().replace(/\n/g, ""))) : !a && this.lineBreak && (this.setFontSize(this.getFontSize() * this.getScaleX()), this.setHeight(3 * this.textObject.getMeasuredLineHeight()), this.setWidth(this.getWidth() * this.getScaleX()), this.setScaleX(1), this.setScaleY(1), this.textObject.lineWidth = this.getWidth(), this.alignTextBox()); + void 0 === a && (a = !1); + var b = this.lineBreak; + this.lineBreak = a; + b && !this.lineBreak ? (this.textObject.lineWidth = null, this.setHeight(this.textObject.getMeasuredLineHeight()), this.setText(this.getText().replace(/\n/g, ""))) : !b && this.lineBreak && (this.setFontSize(this.getFontSize() * this.getScaleX()), this.setHeight(3 * this.textObject.getMeasuredLineHeight()), this.setWidth(this.getWidth() * this.getScaleX()), this.setScaleX(1), this.setScaleY(1), this.textObject.lineWidth = this.getWidth(), this.alignTextBox()); Entry.stage.updateObject(); } }; Entry.EntityObject.prototype.getLineBreak = function() { return this.lineBreak; }; -Entry.EntityObject.prototype.setVisible = function(b) { - void 0 === b && (b = !0); - this.visible = b; +Entry.EntityObject.prototype.setVisible = function(a) { + void 0 === a && (a = !0); + this.visible = a; this.object.visible = this.visible; this.dialog && this.syncDialogVisible(); Entry.requestUpdate = !0; @@ -7675,12 +8630,12 @@ Entry.EntityObject.prototype.setVisible = function(b) { Entry.EntityObject.prototype.getVisible = function() { return this.visible; }; -Entry.EntityObject.prototype.setImage = function(b) { - var a = this; - delete b._id; +Entry.EntityObject.prototype.setImage = function(a) { + var b = this; + delete a._id; Entry.assert("sprite" == this.type, "Set image is only for sprite object"); - b.id || (b.id = Entry.generateHash()); - this.picture = b; + a.id || (a.id = Entry.generateHash()); + this.picture = a; var c = this.picture.dimension, d = this.getRegX() - this.getWidth() / 2, e = this.getRegY() - this.getHeight() / 2; this.setWidth(c.width); this.setHeight(c.height); @@ -7689,47 +8644,47 @@ Entry.EntityObject.prototype.setImage = function(b) { this.setScaleY(this.scaleY); this.setRegX(this.width / 2 + d); this.setRegY(this.height / 2 + e); - var f = b.id + this.id, g = Entry.container.getCachedPicture(f); - g ? (Entry.image = g, this.object.image = g, this.object.cache(0, 0, this.getWidth(), this.getHeight())) : (g = new Image, b.fileurl ? g.src = b.fileurl : (b = b.filename, g.src = Entry.defaultPath + "/uploads/" + b.substring(0, 2) + "/" + b.substring(2, 4) + "/image/" + b + ".png"), this.object.image = g, this.object.cache(0, 0, this.getWidth(), this.getHeight()), g.onload = function(b) { + var f = a.id + this.id, g = Entry.container.getCachedPicture(f); + g ? (Entry.image = g, this.object.image = g, this.object.cache(0, 0, this.getWidth(), this.getHeight())) : (g = new Image, a.fileurl ? g.src = a.fileurl : (a = a.filename, g.src = Entry.defaultPath + "/uploads/" + a.substring(0, 2) + "/" + a.substring(2, 4) + "/image/" + a + ".png"), this.object.image = g, this.object.cache(0, 0, this.getWidth(), this.getHeight()), g.onload = function(a) { Entry.container.cachePicture(f, g); Entry.image = g; - a.object.image = g; - a.object.cache(0, 0, a.getWidth(), a.getHeight()); + b.object.image = g; + b.object.cache(0, 0, b.getWidth(), b.getHeight()); Entry.requestUpdate = !0; }); Entry.dispatchEvent("updateObject"); }; -Entry.EntityObject.prototype.applyFilter = function(b) { - function a(a, b) { - for (var c in a) { - if (a[c] !== b[c]) { +Entry.EntityObject.prototype.applyFilter = function(a) { + function b(b, a) { + for (var c in b) { + if (b[c] !== a[c]) { return !1; } } return !0; } var c = this.effect, d = this.object; - if (b || !a(c, this.getInitialEffectValue())) { - (function(a, b) { + if (a || !b(c, this.getInitialEffectValue())) { + (function(b, a) { var c = [], d = Entry.adjustValueWithMaxMin; - a.brightness = a.brightness; + b.brightness = b.brightness; var k = new createjs.ColorMatrix; - k.adjustColor(d(a.brightness, -100, 100), 0, 0, 0); + k.adjustColor(d(b.brightness, -100, 100), 0, 0, 0); k = new createjs.ColorMatrixFilter(k); c.push(k); - a.hue = a.hue.mod(360); + b.hue = b.hue.mod(360); k = new createjs.ColorMatrix; - k.adjustColor(0, 0, 0, a.hue); + k.adjustColor(0, 0, 0, b.hue); k = new createjs.ColorMatrixFilter(k); c.push(k); - var k = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1], l = 10.8 * a.hsv * Math.PI / 180, n = Math.cos(l), l = Math.sin(l), m = Math.abs(a.hsv / 100); + var k = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1], l = 10.8 * b.hsv * Math.PI / 180, n = Math.cos(l), l = Math.sin(l), m = Math.abs(b.hsv / 100); 1 < m && (m -= Math.floor(m)); 0 < m && .33 >= m ? k = [1, 0, 0, 0, 0, 0, n, l, 0, 0, 0, -1 * l, n, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1] : .66 >= m ? k = [n, 0, l, 0, 0, 0, 1, 0, 0, 0, l, 0, n, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1] : .99 >= m && (k = [n, l, 0, 0, 0, -1 * l, n, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1]); k = (new createjs.ColorMatrix).concat(k); k = new createjs.ColorMatrixFilter(k); c.push(k); - b.alpha = a.alpha = d(a.alpha, 0, 1); - b.filters = c; + a.alpha = b.alpha = d(b.alpha, 0, 1); + a.filters = c; })(c, d), d.cache(0, 0, this.getWidth(), this.getHeight()), Entry.requestUpdate = !0; } }; @@ -7754,8 +8709,8 @@ Entry.EntityObject.prototype.removeClone = function() { 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); + var a = this.parent.clonedEntities.indexOf(this); + this.parent.clonedEntities.splice(a, 1); Entry.Utils.isFunction(this.clearExecutor) && this.clearExecutor(); } }; @@ -7763,21 +8718,21 @@ 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; + var a = {}; + a.x = Entry.cutDecimal(this.getX()); + a.y = Entry.cutDecimal(this.getY()); + a.regX = Entry.cutDecimal(this.getRegX()); + a.regY = Entry.cutDecimal(this.getRegY()); + a.scaleX = this.getScaleX(); + a.scaleY = this.getScaleY(); + a.rotation = Entry.cutDecimal(this.getRotation()); + a.direction = Entry.cutDecimal(this.getDirection()); + a.width = Entry.cutDecimal(this.getWidth()); + a.height = Entry.cutDecimal(this.getHeight()); + a.font = this.getFont(); + a.visible = this.getVisible(); + "textBox" == this.parent.objectType && (a.colour = this.getColour(), a.text = this.getText(), a.textAlign = this.getTextAlign(), a.lineBreak = this.getLineBreak(), a.bgColor = this.getBGColour(), a.underLine = this.getUnderLine(), a.strike = this.getStrike(), a.fontSize = this.getFontSize()); + return a; }; Entry.EntityObject.prototype.setInitialEffectValue = function() { this.effect = this.getInitialEffectValue(); @@ -7793,1270 +8748,2122 @@ Entry.EntityObject.prototype.removeBrush = function() { Entry.EntityObject.prototype.updateBG = function() { if (this.bgObject) { this.bgObject.graphics.clear(); - var b = this.getWidth(), a = this.getHeight(); - this.bgObject.graphics.setStrokeStyle(1).beginStroke().beginFill(this.getBGColour()).drawRect(-b / 2, -a / 2, b, a); + var a = this.getWidth(), b = this.getHeight(); + this.bgObject.graphics.setStrokeStyle(1).beginStroke().beginFill(this.getBGColour()).drawRect(-a / 2, -b / 2, a, b); if (this.getLineBreak()) { this.bgObject.x = 0; } else { switch(this.getTextAlign()) { case Entry.TEXT_ALIGN_LEFT: - this.bgObject.x = b / 2; + this.bgObject.x = a / 2; break; case Entry.TEXT_ALIGN_CENTER: this.bgObject.x = 0; break; case Entry.TEXT_ALIGN_RIGHT: - this.bgObject.x = -b / 2; + this.bgObject.x = -a / 2; } } } }; Entry.EntityObject.prototype.alignTextBox = function() { if ("textBox" == this.type) { - var b = this.textObject; + var a = this.textObject; if (this.lineBreak) { - var a = b.getMeasuredLineHeight(); - b.y = a / 2 - this.getHeight() / 2; + var b = a.getMeasuredLineHeight(); + a.y = b / 2 - this.getHeight() / 2; switch(this.textAlign) { case Entry.TEXT_ALIGN_CENTER: - b.x = 0; + a.x = 0; break; case Entry.TEXT_ALIGN_LEFT: - b.x = -this.getWidth() / 2; + a.x = -this.getWidth() / 2; break; case Entry.TEXT_ALIGN_RIGHT: - b.x = this.getWidth() / 2; + a.x = this.getWidth() / 2; } - b.maxHeight = this.getHeight(); + a.maxHeight = this.getHeight(); } else { - b.x = 0, b.y = 0; + a.x = 0, a.y = 0; } } }; Entry.EntityObject.prototype.syncDialogVisible = function() { this.dialog && (this.dialog.object.visible = this.visible); }; -Entry.Helper = function() { - this.visible = !1; +Entry.Func = function(a) { + this.id = a ? a.id : Entry.generateHash(); + this.content = a ? new Entry.Code(a.content) : new Entry.Code([[{type:"function_create", copyable:!1, deletable:!1, x:40, y:40}]]); + this.blockMenuBlock = this.block = null; + this.hashMap = {}; + this.paramMap = {}; + var b = function() { + }; + b.prototype = Entry.block.function_general; + b = new b; + b.changeEvent = new Entry.Event; + b.template = Lang.template.function_general; + Entry.block["func_" + this.id] = b; + if (a) { + a = this.content._blockMap; + for (var c in a) { + Entry.Func.registerParamBlock(a[c].type); + } + Entry.Func.generateWsBlock(this); + } + Entry.Func.registerFunction(this); + Entry.Func.updateMenu(); }; -p = Entry.Helper.prototype; -p.generateView = function(b, a) { - if (!this.parentView_) { - this.parentView_ = b; - this.blockHelpData = EntryStatic.blockInfo; - var c = Entry.createElement("div", "entryBlockHelperWorkspace"); - this.view = c; - Entry.isForLecture && c.addClass("lecture"); - this.parentView_.appendChild(c); - var d = Entry.createElement("div", "entryBlockHelperContentWorkspace"); - d.addClass("entryBlockHelperIntro"); - Entry.isForLecture && d.addClass("lecture"); - c.appendChild(d); - this.blockHelperContent_ = d; - this.blockHelperView_ = c; - c = Entry.createElement("div", "entryBlockHelperBlockWorkspace"); - this.blockHelperContent_.appendChild(c); - d = Entry.createElement("div", "entryBlockHelperDescriptionWorkspace"); - this.blockHelperContent_.appendChild(d); - d.innerHTML = Lang.Helper.Block_click_msg; - this.blockHelperDescription_ = d; - this._renderView = new Entry.RenderView($(c), "LEFT"); - this.code = new Entry.Code([]); - this._renderView.changeCode(this.code); - this.first = !0; - } -}; -p.bindWorkspace = function(b) { - b && (this._blockViewObserver && this._blockViewObserver.destroy(), this.workspace = b, this._blockViewObserver = b.observe(this, "_updateSelectedBlock", ["selectedBlockView"])); -}; -p._updateSelectedBlock = function() { - var b = this.workspace.selectedBlockView; - if (b && this.visible && b != this._blockView) { - var a = b.block.type; - this._blockView = b; - this.renderBlock(a); +Entry.Func.threads = {}; +Entry.Func.registerFunction = function(a) { + if (Entry.playground) { + var b = Entry.playground.mainWorkspace; + b && (this._targetFuncBlock = b.getBlockMenu().getCategoryCodes("func").createThread([{type:"func_" + a.id}]), a.blockMenuBlock = this._targetFuncBlock); } }; -p.renderBlock = function(b) { - var a = Lang.Helper[b]; - if (b && this.visible && a && !Entry.block[b].isPrimitive) { - this.first && (this.blockHelperContent_.removeClass("entryBlockHelperIntro"), this.first = !1); - this.code.clear(); - var c = Entry.block[b].def, c = c || {type:b}; - this.code.createThread([c]); - this.code.board.align(); - this.code.board.resize(); - var c = this.code.getThreads()[0].getFirstBlock().view, d = c.svgGroup.getBBox(); - b = d.width; - d = d.height; - c = c.getSkeleton().box(c).offsetX; - isNaN(c) && (c = 0); - this.blockHelperDescription_.innerHTML = a; - this._renderView.align(); - $(this.blockHelperDescription_).css({top:d + 30}); - this._renderView.svgDom.css({"margin-left":-(b / 2) - 20 - c}); +Entry.Func.executeFunction = function(a) { + var b = this.threads[a]; + if (b = Entry.Engine.computeThread(b.entity, b)) { + return this.threads[a] = b, !0; } + delete this.threads[a]; + return !1; }; -p.getView = function() { - return this.view; +Entry.Func.clearThreads = function() { + this.threads = {}; }; -p.resize = function() { +Entry.Func.prototype.init = function(a) { + this.id = a.id; + this.content = Blockly.Xml.textToDom(a.content); + this.block = Blockly.Xml.textToDom("" + a.block + "").childNodes[0]; }; -Entry.Activity = function(b, a) { - this.name = b; - this.timestamp = new Date; - var c = []; - if (void 0 !== a) { - for (var d = 0, e = a.length;d < e;d++) { - var f = a[d]; - c.push({key:f[0], value:f[1]}); - } +Entry.Func.prototype.destroy = function() { + this.blockMenuBlock.destroy(); +}; +Entry.Func.edit = function(a) { + this.cancelEdit(); + this.targetFunc = a; + this.initEditView(a.content); + this.bindFuncChangeEvent(); + this.updateMenu(); +}; +Entry.Func.initEditView = function(a) { + this.menuCode || this.setupMenuCode(); + var b = Entry.playground.mainWorkspace; + b.setMode(Entry.Workspace.MODE_OVERLAYBOARD); + b.changeOverlayBoardCode(a); + this._workspaceStateEvent = b.changeEvent.attach(this, this.endEdit); +}; +Entry.Func.endEdit = function(a) { + this.unbindFuncChangeEvent(); + this._workspaceStateEvent.destroy(); + delete this._workspaceStateEvent; + switch(a) { + case "save": + this.save(); + case "cancelEdit": + this.cancelEdit(); } - this.data = c; }; -Entry.ActivityReporter = function() { - this._activities = []; +Entry.Func.save = function() { + this.targetFunc.generateBlock(!0); + Entry.variableContainer.saveFunction(this.targetFunc); }; -(function(b) { - b.add = function(a) { - if (a && 0 !== a.length) { - if (!(a instanceof Entry.Activity)) { - var b = a.shift(); - a = new Entry.Activity(b, a); +Entry.Func.syncFuncName = function(a) { + var b = 0; + a = a.split(" "); + var c = "", d; + d = Blockly.mainWorkspace.getAllBlocks(); + for (var e = 0;e < d.length;e++) { + var f = d[e]; + if ("function_general" === f.type) { + for (var f = f.inputList, g = 0;g < f.length;g++) { + var h = f[g]; + 0 < h.fieldRow.length && h.fieldRow[0] instanceof Blockly.FieldLabel && void 0 != h.fieldRow[0].text_ && (c += h.fieldRow[0].text_, c += " "); + } + c = c.trim(); + if (c === this.srcFName && this.srcFName.split(" ").length == a.length) { + for (c = 0;c < f.length;c++) { + if (h = f[c], 0 < h.fieldRow.length && h.fieldRow[0] instanceof Blockly.FieldLabel && void 0 != h.fieldRow[0].text_) { + if (void 0 === a[b]) { + f.splice(c, 1); + break; + } else { + h.fieldRow[0].text_ = a[b]; + } + b++; + } + } } - this._activities.push(a); + c = ""; + b = 0; } - }; - b.clear = function() { - this._activities = []; - }; - b.get = function() { - return this._activities; - }; - b.report = function() { - }; -})(Entry.ActivityReporter.prototype); -Entry.State = function(b, a, c, d) { - this.caller = a; - this.func = c; - 3 < arguments.length && (this.params = Array.prototype.slice.call(arguments).slice(3)); - this.message = b; - this.time = Entry.getUpTime(); - this.isPass = Entry.Command[b] ? Entry.Command[b].isPass : !1; + } + b = Blockly.Xml.workspaceToDom(Blockly.mainWorkspace); + Blockly.mainWorkspace.clear(); + Blockly.Xml.domToWorkspace(Blockly.mainWorkspace, b); }; -Entry.State.prototype.generateMessage = function() { +Entry.Func.cancelEdit = function() { + this.targetFunc && (Entry.Func.isEdit = !1, this.targetFunc.block || (this._targetFuncBlock.destroy(), delete Entry.variableContainer.functions_[this.targetFunc.id], delete Entry.variableContainer.selected), delete this.targetFunc, this.updateMenu(), Entry.variableContainer.updateList(), Entry.playground.mainWorkspace.setMode(Entry.Workspace.MODE_BOARD)); }; -Entry.StateManager = function() { - this.undoStack_ = []; - this.redoStack_ = []; - this.isIgnore = this.isRestore = !1; - Entry.addEventListener("cancelLastCommand", function(b) { - Entry.stateManager.cancelLastCommand(); - }); - Entry.addEventListener("run", function(b) { - Entry.stateManager.updateView(); - }); - Entry.addEventListener("stop", function(b) { - Entry.stateManager.updateView(); - }); - Entry.addEventListener("saveWorkspace", function(b) { - Entry.stateManager.addStamp(); - }); - Entry.addEventListener("undo", function(b) { - Entry.stateManager.undo(); - }); - Entry.addEventListener("redo", function(b) { - Entry.stateManager.redo(); - }); +Entry.Func.getMenuXml = function() { + var a = []; + this.targetFunc || (a = a.concat(this.createBtn)); + if (this.targetFunc) { + var b = this.FIELD_BLOCK, b = b.replace("#1", Entry.generateHash()), b = b.replace("#2", Entry.generateHash()), b = Blockly.Xml.textToDom(b).childNodes, a = a.concat(Entry.nodeListToArray(b)) + } + for (var c in Entry.variableContainer.functions_) { + b = Entry.variableContainer.functions_[c], b === this.targetFunc ? (b = Entry.Func.generateBlock(this.targetFunc, Blockly.Xml.workspaceToDom(Entry.Func.workspace), b.id).block, a.push(b)) : a.push(b.block); + } + return a; +}; +Entry.Func.syncFunc = function() { + var a = Entry.Func; + if (a.targetFunc) { + var b = a.workspace.topBlocks_[0].toString(), c = a.workspace.topBlocks_.length; + (a.fieldText != b || a.workspaceLength != c) && 1 > Blockly.Block.dragMode_ && (a.updateMenu(), a.fieldText = b, a.workspaceLength = c); + } }; -Entry.StateManager.prototype.generateView = function(b, a) { +Entry.Func.setupMenuCode = function() { + var a = Entry.playground.mainWorkspace; + a && (a = a.getBlockMenu().getCategoryCodes("func"), this._fieldLabel = a.createThread([{type:"function_field_label"}]).getFirstBlock(), this._fieldString = a.createThread([{type:"function_field_string", params:[{type:this.requestParamBlock("string")}]}]).getFirstBlock(), this._fieldBoolean = a.createThread([{type:"function_field_boolean", params:[{type:this.requestParamBlock("boolean")}]}]).getFirstBlock(), this.menuCode = a); }; -Entry.StateManager.prototype.addCommand = function(b, a, c, d) { - if (!this.isIgnoring()) { - if (this.isRestoring()) { - var e = new Entry.State, f = Array.prototype.slice.call(arguments); - Entry.State.prototype.constructor.apply(e, f); - this.redoStack_.push(e); - Entry.reporter && Entry.reporter.report(e); - } else { - e = new Entry.State, f = Array.prototype.slice.call(arguments), Entry.State.prototype.constructor.apply(e, f), this.undoStack_.push(e), Entry.reporter && Entry.reporter.report(e), this.updateView(); - } - Entry.creationChangedEvent && Entry.creationChangedEvent.notify(); +Entry.Func.refreshMenuCode = function() { + if (Entry.playground.mainWorkspace) { + this.menuCode || this.setupMenuCode(); + var a = Entry.block[this._fieldString.params[0].type].changeEvent._listeners.length; + 2 < a && this._fieldString.params[0].changeType(this.requestParamBlock("string")); + a = Entry.block[this._fieldBoolean.params[0].type].changeEvent._listeners.length; + 2 < a && this._fieldBoolean.params[0].changeType(this.requestParamBlock("boolean")); } }; -Entry.StateManager.prototype.cancelLastCommand = function() { - this.canUndo() && (this.undoStack_.pop(), this.updateView(), Entry.creationChangedEvent && Entry.creationChangedEvent.notify()); +Entry.Func.requestParamBlock = function(a) { + var b = Entry.generateHash(), c; + switch(a) { + case "string": + c = Entry.block.function_param_string; + break; + case "boolean": + c = Entry.block.function_param_boolean; + break; + default: + return null; + } + b = a + "Param_" + b; + a = Entry.Func.createParamBlock(b, c, a); + Entry.block[b] = a; + return b; }; -Entry.StateManager.prototype.getLastCommand = function() { - return this.undoStack_[this.undoStack_.length - 1]; +Entry.Func.registerParamBlock = function(a) { + -1 < a.indexOf("stringParam") ? Entry.Func.createParamBlock(a, Entry.block.function_param_string, a) : -1 < a.indexOf("booleanParam") && Entry.Func.createParamBlock(a, Entry.block.function_param_boolean, a); }; -Entry.StateManager.prototype.undo = function() { - if (this.canUndo() && !this.isRestoring()) { - this.addActivity("undo"); - for (this.startRestore();this.undoStack_.length;) { - var b = this.undoStack_.pop(); - b.func.apply(b.caller, b.params); - if (!0 !== b.isPass) { - break; - } - } - this.updateView(); - this.endRestore(); - Entry.creationChangedEvent && Entry.creationChangedEvent.notify(); +Entry.Func.createParamBlock = function(a, b, c) { + var d = function() { + }; + c = "string" === c ? "function_param_string" : "function_param_boolean"; + d.prototype = b; + d = new d; + d.changeEvent = new Entry.Event; + d.template = Lang.template[c]; + return Entry.block[a] = d; +}; +Entry.Func.updateMenu = function() { + if (Entry.playground && Entry.playground.mainWorkspace) { + var a = Entry.playground.mainWorkspace.getBlockMenu(); + this.targetFunc ? (this.menuCode || this.setupMenuCode(), a.banClass("functionInit"), a.unbanClass("functionEdit")) : (a.unbanClass("functionInit"), a.banClass("functionEdit")); + a.reDraw(); } }; -Entry.StateManager.prototype.redo = function() { - if (this.canRedo() && !this.isRestoring()) { - this.addActivity("redo"); - var b = this.redoStack_.pop(); - b.func.apply(b.caller, b.params); - this.updateView(); - Entry.creationChangedEvent && Entry.creationChangedEvent.notify(); +Entry.Func.prototype.edit = function() { + Entry.Func.isEdit || (Entry.Func.isEdit = !0, Entry.Func.svg ? this.parentView.appendChild(this.svg) : Entry.Func.initEditView()); +}; +Entry.Func.generateBlock = function(a) { + a = Entry.block["func_" + a.id]; + var b = {template:a.template, params:a.params}, c = /(%\d)/mi, d = a.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 = a.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:b, description:e}; }; -Entry.StateManager.prototype.updateView = function() { - this.undoButton && this.redoButton && (this.canUndo() ? this.undoButton.addClass("active") : this.undoButton.removeClass("active"), this.canRedo() ? this.redoButton.addClass("active") : this.redoButton.removeClass("active")); +Entry.Func.prototype.generateBlock = function(a) { + a = Entry.Func.generateBlock(this); + this.block = a.block; + this.description = a.description; }; -Entry.StateManager.prototype.startRestore = function() { - this.isRestore = !0; +Entry.Func.generateWsBlock = function(a) { + this.unbindFuncChangeEvent(); + a = a ? a : this.targetFunc; + for (var b = a.content.getEventMap("funcDef")[0].params[0], c = 0, d = 0, e = [], f = "", g = a.hashMap, h = a.paramMap;b;) { + var k = b.params[0]; + switch(b.type) { + case "function_field_label": + f = f + " " + k; + break; + case "function_field_boolean": + Entry.Mutator.mutate(k.type, {template:Lang.Blocks.FUNCTION_logical_variable + " " + (c ? c : "")}); + g[k.type] = !1; + h[k.type] = c + d; + c++; + e.push({type:"Block", accept:"boolean"}); + f += " %" + (c + d); + break; + case "function_field_string": + Entry.Mutator.mutate(k.type, {template:Lang.Blocks.FUNCTION_character_variable + " " + (d ? d : "")}), g[k.type] = !1, h[k.type] = c + d, d++, f += " %" + (c + d), e.push({type:"Block", accept:"string"}); + } + b = b.getOutputBlock(); + } + c++; + f += " %" + (c + d); + e.push({type:"Indicator", img:"block_icon/function_03.png", size:12}); + Entry.Mutator.mutate("func_" + a.id, {params:e, template:f}); + for (var l in g) { + g[l] ? (b = -1 < l.indexOf("string") ? Lang.Blocks.FUNCTION_character_variable : Lang.Blocks.FUNCTION_logical_variable, Entry.Mutator.mutate(l, {template:b})) : g[l] = !0; + } + this.bindFuncChangeEvent(a); }; -Entry.StateManager.prototype.endRestore = function() { - this.isRestore = !1; +Entry.Func.bindFuncChangeEvent = function(a) { + a = a ? a : this.targetFunc; + !this._funcChangeEvent && a.content.getEventMap("funcDef")[0].view && (this._funcChangeEvent = a.content.getEventMap("funcDef")[0].view._contents[1].changeEvent.attach(this, this.generateWsBlock)); }; -Entry.StateManager.prototype.isRestoring = function() { - return this.isRestore; +Entry.Func.unbindFuncChangeEvent = function() { + this._funcChangeEvent && this._funcChangeEvent.destroy(); + delete this._funcChangeEvent; }; -Entry.StateManager.prototype.startIgnore = function() { - this.isIgnore = !0; +Entry.Helper = function() { + this.visible = !1; }; -Entry.StateManager.prototype.endIgnore = function() { - this.isIgnore = !1; +p = Entry.Helper.prototype; +p.generateView = function(a, b) { + this.parentView_ || (this.parentView_ = a, this.blockHelpData = EntryStatic.blockInfo, this.view = a = Entry.createElement("div", "entryBlockHelperWorkspace"), Entry.isForLecture && a.addClass("lecture"), this.parentView_.appendChild(a), b = Entry.createElement("div", "entryBlockHelperContentWorkspace"), b.addClass("entryBlockHelperIntro"), Entry.isForLecture && b.addClass("lecture"), a.appendChild(b), this.blockHelperContent_ = b, this.blockHelperView_ = a, a = Entry.createElement("div", "entryBlockHelperBlockWorkspace"), + this.blockHelperContent_.appendChild(a), b = Entry.createElement("div", "entryBlockHelperDescriptionWorkspace"), this.blockHelperContent_.appendChild(b), b.innerHTML = Lang.Helper.Block_click_msg, this.blockHelperDescription_ = b, this._renderView = new Entry.RenderView($(a), "LEFT"), this.code = new Entry.Code([]), this._renderView.changeCode(this.code), this.first = !0); }; -Entry.StateManager.prototype.isIgnoring = function() { - return this.isIgnore; +p.bindWorkspace = function(a) { + a && (this._blockViewObserver && this._blockViewObserver.destroy(), this.workspace = a, this._blockViewObserver = a.observe(this, "_updateSelectedBlock", ["selectedBlockView"])); }; -Entry.StateManager.prototype.canUndo = function() { - return 0 < this.undoStack_.length && Entry.engine.isState("stop"); +p._updateSelectedBlock = function() { + var a = this.workspace.selectedBlockView; + if (a && this.visible && a != this._blockView) { + var b = a.block.type; + this._blockView = a; + this.renderBlock(b); + } }; -Entry.StateManager.prototype.canRedo = function() { - return 0 < this.redoStack_.length && Entry.engine.isState("stop"); +p.renderBlock = function(a) { + var b = Lang.Helper[a]; + if (a && this.visible && b && !Entry.block[a].isPrimitive) { + this.first && (this.blockHelperContent_.removeClass("entryBlockHelperIntro"), this.first = !1); + this.code.clear(); + var c = Entry.block[a].def, c = c || {type:a}; + this.code.createThread([c]); + this.code.board.align(); + this.code.board.resize(); + var c = this.code.getThreads()[0].getFirstBlock().view, d = c.svgGroup.getBBox(); + a = d.width; + d = d.height; + c = c.getSkeleton().box(c).offsetX; + isNaN(c) && (c = 0); + this.blockHelperDescription_.innerHTML = b; + this._renderView.align(); + $(this.blockHelperDescription_).css({top:d + 30}); + this._renderView.svgDom.css({"margin-left":-(a / 2) - 20 - c}); + } }; -Entry.StateManager.prototype.addStamp = function() { - this.stamp = Entry.generateHash(); - this.undoStack_.length && (this.undoStack_[this.undoStack_.length - 1].stamp = this.stamp); +p.getView = function() { + return this.view; }; -Entry.StateManager.prototype.isSaved = function() { - return 0 === this.undoStack_.length || this.undoStack_[this.undoStack_.length - 1].stamp == this.stamp && "string" == typeof this.stamp; +p.resize = function() { }; -Entry.StateManager.prototype.addActivity = function(b) { - Entry.reporter && Entry.reporter.report(new Entry.State(b)); +Entry.HWMontior = {}; +Entry.HWMonitor = function(a) { + this.svgDom = Entry.Dom($('')); + this._hwModule = a; + var b = this; + Entry.addEventListener("windowResized", function() { + var a = b._hwModule.monitorTemplate.mode; + "both" == a && (b.resize(), b.resizeList()); + "list" == a ? b.resizeList() : b.resize(); + }); + Entry.addEventListener("hwModeChange", function() { + b.changeMode(); + }); + this.changeOffset = 0; + this.scale = .5; + this._listPortViews = {}; }; -Entry.EntryObject = function(b) { - var a = this; - if (b) { - this.id = b.id; - this.name = b.name || b.sprite.name; - this.text = b.text || this.name; - this.objectType = b.objectType; - this.objectType || (this.objectType = "sprite"); - this.script = new Entry.Code(b.script ? b.script : [], this); - this.pictures = b.sprite.pictures; - this.sounds = []; - this.sounds = b.sprite.sounds; - for (var c = 0;c < this.sounds.length;c++) { - this.sounds[c].id || (this.sounds[c].id = Entry.generateHash()), Entry.initSound(this.sounds[c]); +(function(a) { + a.initView = function() { + this.svgDom = Entry.Dom($('')); + }; + a.generateView = function() { + this.snap = Entry.SVG("hwMonitor"); + this._svgGroup = this.snap.elem("g"); + this._portMap = {n:[], e:[], s:[], w:[]}; + var b = this._hwModule.monitorTemplate, a = {href:Entry.mediaFilePath + b.imgPath, x:-b.width / 2, y:-b.height / 2, width:b.width, height:b.height}; + this._portViews = {}; + this.hwView = this._svgGroup.elem("image"); + this.hwView = this.hwView.attr(a); + this._template = b; + b = b.ports; + this.pathGroup = null; + this.pathGroup = this._svgGroup.elem("g"); + var a = [], d; + for (d in b) { + var e = this.generatePortView(b[d], "_svgGroup"); + this._portViews[d] = e; + a.push(e); } - this.lock = b.lock ? b.lock : !1; - this.isEditing = !1; - "sprite" == this.objectType && (this.selectedPicture = b.selectedPictureId ? this.getPicture(b.selectedPictureId) : this.pictures[0]); - this.scene = Entry.scene.getSceneById(b.scene) || Entry.scene.selectedScene; - this.setRotateMethod(b.rotateMethod); - this.entity = new Entry.EntityObject(this); - this.entity.injectModel(this.selectedPicture ? this.selectedPicture : null, b.entity ? b.entity : this.initEntity(b)); - this.clonedEntities = []; - Entry.stage.loadObject(this); - for (c in this.pictures) { - (function(b) { - b.objectId = this.id; - b.id || (b.id = Entry.generateHash()); - var c = new Image; - if (b.fileurl) { - c.src = b.fileurl; - } else { - if (b.fileurl) { - c.src = b.fileurl; - } else { - var f = b.filename; - c.src = Entry.defaultPath + "/uploads/" + f.substring(0, 2) + "/" + f.substring(2, 4) + "/image/" + f + ".png"; + a.sort(function(b, a) { + return b.box.x - a.box.x; + }); + var f = this._portMap; + a.map(function(b) { + (1 > (Math.atan2(-b.box.y, b.box.x) / Math.PI + 2) % 2 ? f.n : f.s).push(b); + }); + this.resize(); + }; + a.toggleMode = function(b) { + var a = this._hwModule.monitorTemplate; + "list" == b ? (a.TempPort = null, this._hwModule.monitorTemplate.ports && (this._hwModule.monitorTemplate.TempPort = this._hwModule.monitorTemplate.ports, this._hwModule.monitorTemplate.listPorts = this.addPortEle(this._hwModule.monitorTemplate.listPorts, this._hwModule.monitorTemplate.ports)), $(this._svglistGroup).remove(), this._svgGroup && $(this._svgGroup).remove(), $(this._pathGroup).remove(), this._hwModule.monitorTemplate.mode = "list", this.generateListView()) : (this._hwModule.monitorTemplate.TempPort && + (this._hwModule.monitorTemplate.ports = this._hwModule.monitorTemplate.TempPort, this._hwModule.monitorTemplate.listPorts = this.removePortEle(this._hwModule.monitorTemplate.listPorts, this._hwModule.monitorTemplate.ports)), $(this._svglistGroup).remove(), this._hwModule.monitorTemplate.mode = "both", this.generateListView(), this.generateView()); + }; + a.setHwmonitor = function(b) { + this._hwmodule = b; + }; + a.changeMode = function(b) { + "both" == this._hwModule.monitorTemplate.mode ? this.toggleMode("list") : "list" == this._hwModule.monitorTemplate.mode && this.toggleMode("both"); + }; + a.addPortEle = function(b, a) { + if ("object" != typeof a) { + return b; + } + for (var d in a) { + b[d] = a[d]; + } + return b; + }; + a.removePortEle = function(b, a) { + if ("object" != typeof a) { + return b; + } + for (var d in a) { + delete b[d]; + } + return b; + }; + a.generateListView = function() { + this._portMapList = {n:[]}; + this._svglistGroup = null; + this.listsnap = Entry.SVG("hwMonitor"); + this._svglistGroup = this.listsnap.elem("g"); + var b = this._hwModule.monitorTemplate; + this._template = b; + b = b.listPorts; + this.pathGroup = this._svglistGroup.elem("g"); + var a = [], d; + for (d in b) { + var e = this.generatePortView(b[d], "_svglistGroup"); + this._listPortViews[d] = e; + a.push(e); + } + var f = this._portMapList; + a.map(function(b) { + f.n.push(b); + }); + this.resizeList(); + }; + a.generatePortView = function(b, a) { + a = this[a].elem("g"); + a.addClass("hwComponent"); + var d; + d = this.pathGroup.elem("path").attr({d:"m0,0", fill:"none", stroke:"input" === b.type ? "#00979d" : "#A751E3", "stroke-width":3}); + var e = a.elem("rect").attr({x:0, y:0, width:150, height:22, rx:4, ry:4, fill:"#fff", stroke:"#a0a1a1"}), f = a.elem("text").attr({x:4, y:12, fill:"#000", "class":"hwComponentName", "alignment-baseline":"central"}); + f.textContent = b.name; + f = f.getComputedTextLength(); + a.elem("rect").attr({x:f + 8, y:2, width:30, height:18, rx:9, ry:9, fill:"input" === b.type ? "#00979d" : "#A751E3"}); + var g = a.elem("text").attr({x:f + 13, y:12, fill:"#fff", "class":"hwComponentValue", "alignment-baseline":"central"}); + g.textContent = 0; + f += 40; + e.attr({width:f}); + return {group:a, value:g, type:b.type, path:d, box:{x:b.pos.x - this._template.width / 2, y:b.pos.y - this._template.height / 2, width:f}, width:f}; + }; + a.getView = function() { + return this.svgDom; + }; + a.update = function() { + var b = Entry.hw.portData, a = Entry.hw.sendQueue, d = this._hwModule.monitorTemplate.mode, e = this._hwModule.monitorTemplate.keys || [], f = []; + if ("list" == d) { + f = this._listPortViews; + } else { + if ("both" == d) { + if (f = this._listPortViews, this._portViews) { + for (var g in this._portViews) { + f[g] = this._portViews[g]; } } - Entry.Loader.addQueue(); - c.onload = function(c) { - Entry.container.cachePicture(b.id + a.entity.id, this); - Entry.requestUpdate = !0; - Entry.Loader.removeQueue(); - }; - c.onerror = function(a) { - Entry.Loader.removeQueue(); - }; - })(this.pictures[c]); + } else { + f = this._portViews; + } } - } -}; -Entry.EntryObject.prototype.generateView = function() { - if ("workspace" == Entry.type) { - var b = Entry.createElement("li", this.id); - b.addClass("entryContainerListElementWorkspace"); - b.object = this; - Entry.Utils.disableContextmenu(b); - var a = this; - longPressTimer = null; - $(b).bind("mousedown touchstart", function(b) { - function c(a) { - a.stopPropagation(); - h && 5 < Math.sqrt(Math.pow(a.pageX - h.x, 2) + Math.pow(a.pageY - h.y, 2)) && longPressTimer && (clearTimeout(longPressTimer), longPressTimer = null); + if (a) { + for (g in a) { + 0 != a[g] && f[g] && (f[g].type = "output"); } - function d(a) { - a.stopPropagation(); - e.unbind(".object"); - longPressTimer && (clearTimeout(longPressTimer), longPressTimer = null); + } + for (var h in f) { + if (d = f[h], "input" == d.type) { + var k = b[h]; + 0 < e.length && $.each(e, function(b, a) { + if ($.isPlainObject(k)) { + k = k[a] || 0; + } else { + return !1; + } + }); + d.value.textContent = k ? k : 0; + d.group.getElementsByTagName("rect")[1].attr({fill:"#00979D"}); + } else { + k = a[h], 0 < e.length && $.each(e, function(b, a) { + if ($.isPlainObject(k)) { + k = k[a] || 0; + } else { + return !1; + } + }), d.value.textContent = k ? k : 0, d.group.getElementsByTagName("rect")[1].attr({fill:"#A751E3"}); } - Entry.container.getObject(this.id) && Entry.container.selectObject(this.id); - var e = $(document), f = b.type, g = !1; - if (Entry.Utils.isRightButton(b)) { - b.stopPropagation(), Entry.documentMousedown.notify(b), g = !0, a._rightClick(b); + } + }; + a.resize = function() { + this.hwView && this.hwView.attr({transform:"scale(" + this.scale + ")"}); + if (this.svgDom) { + var b = this.svgDom.get(0).getBoundingClientRect() + } + this._svgGroup.attr({transform:"translate(" + b.width / 2 + "," + b.height / 1.8 + ")"}); + this._rect = b; + 0 >= this._template.height || 0 >= b.height || (this.scale = b.height / this._template.height * this._template.height / 1E3, this.align()); + }; + a.resizeList = function() { + var b = this.svgDom.get(0).getBoundingClientRect(); + this._svglistGroup.attr({transform:"translate(" + b.width / 2 + "," + b.height / 2 + ")"}); + this._rect = b; + this.alignList(); + }; + a.align = function() { + var b; + b = this._portMap.s.concat(); + this._alignNS(b, this.scale / 3 * this._template.height + 5, 27); + b = this._portMap.n.concat(); + this._alignNS(b, -this._template.height * this.scale / 3 - 32, -27); + b = this._portMap.e.concat(); + this._alignEW(b, -this._template.width * this.scale / 3 - 5, -27); + b = this._portMap.w.concat(); + this._alignEW(b, this._template.width * this.scale / 3 - 32, -27); + }; + a.alignList = function() { + var b; + b = this._hwModule.monitorTemplate.listPorts; + for (var a = b.length, d = 0;d < b.length;d++) { + b[d].group.attr({transform:"translate(" + this._template.width * (d / a - .5) + "," + (-this._template.width / 2 - 30) + ")"}); + } + b = this._portMapList.n.concat(); + this._alignNSList(b, -this._template.width * this.scale / 2 - 32, -27); + }; + a._alignEW = function(b, a, d) { + var e = b.length, f = this._rect.height - 50; + tP = -f / 2; + bP = f / 2; + height = this._rect.height; + listVLine = wholeHeight = 0; + mode = this._hwModule.monitorTemplate; + for (f = 0;f < e;f++) { + wholeHeight += b[f].height + 5; + } + wholeHeight < bP - tP && (bP = wholeHeight / 2 + 3, tP = -wholeHeight / 2 - 3); + for (;1 < e;) { + var g = b.shift(), f = b.pop(), h = tP, k = bP, l = d; + wholeWidth <= bP - tP ? (tP += g.width + 5, bP -= f.width + 5, l = 0) : 0 === b.length ? (tP = (tP + bP) / 2 - 3, bP = tP + 6) : (tP = Math.max(tP, -width / 2 + g.width) + 15, bP = Math.min(bP, width / 2 - f.width) - 15); + wholeWidth -= g.width + f.width + 10; + a += l; + } + b.length && b[0].group.attr({transform:"translate(" + a + ",60)"}); + g && rPort && (this._movePort(g, a, tP, h), this._movePort(rPort, a, bP, k)); + }; + a._alignNS = function(b, a, d) { + for (var e = -this._rect.width / 2, f = this._rect.width / 2, g = this._rect.width, h = 0, k = 0;k < b.length;k++) { + h += b[k].width + 5; + } + h < f - e && (f = h / 2 + 3, e = -h / 2 - 3); + for (;1 < b.length;) { + var k = b.shift(), l = b.pop(), n = e, m = f, q = d; + h <= f - e ? (e += k.width + 5, f -= l.width + 5, q = 0) : 0 === b.length ? (e = (e + f) / 2 - 3, f = e + 6) : (e = Math.max(e, -g / 2 + k.width) + 15, f = Math.min(f, g / 2 - l.width) - 15); + this._movePort(k, e, a, n); + this._movePort(l, f, a, m); + h -= k.width + l.width + 10; + a += q; + } + b.length && this._movePort(b[0], (f + e - b[0].width) / 2, a, 100); + }; + a._alignNSList = function(b, a) { + a = this._rect.width; + initX = -this._rect.width / 2 + 10; + initY = -this._rect.height / 2 + 10; + for (var d = listLine = wholeWidth = 0;d < b.length;d++) { + wholeWidth += b[d].width; + } + for (var e = 0, f = 0, g = initX, h, k, l = 0, d = 0;d < b.length;d++) { + k = b[d], d != b.length - 1 && (l = b[d + 1]), f += k.width, lP = initX, h = initY + 30 * e, k.group.attr({transform:"translate(" + lP + "," + h + ")"}), initX += k.width + 10, f > a - (k.width + l.width / 2.2) && (e += 1, initX = g, f = 0); + } + }; + a._movePort = function(b, a, d, e) { + var f = a, g = b.box.x * this.scale, h = b.box.y * this.scale; + a > e ? (f = a - b.width, a = a > g && g > e ? "M" + g + "," + d + "L" + g + "," + h : "M" + (a + e) / 2 + "," + d + "l0," + (h > d ? 28 : -3) + "H" + g + "L" + g + "," + h) : a = a < g && g < e ? "m" + g + "," + d + "L" + g + "," + h : "m" + (e + a) / 2 + "," + d + "l0," + (h > d ? 28 : -3) + "H" + g + "L" + g + "," + h; + b.group.attr({transform:"translate(" + f + "," + d + ")"}); + b.path.attr({d:a}); + }; +})(Entry.HWMonitor.prototype); +Entry.HW = function() { + this.connectTrial = 0; + this.isFirstConnect = !0; + this.initSocket(); + this.connected = !1; + this.portData = {}; + this.sendQueue = {}; + this.outputQueue = {}; + this.settingQueue = {}; + this.socketType = this.hwModule = this.selectedDevice = null; + Entry.addEventListener("stop", this.setZero); + this.hwInfo = {"1.1":Entry.Arduino, "1.9":Entry.ArduinoExt, "1.2":Entry.SensorBoard, "1.3":Entry.CODEino, "1.4":Entry.joystick, "1.5":Entry.dplay, "1.6":Entry.nemoino, "1.7":Entry.Xbot, "1.8":Entry.ardublock, "2.4":Entry.Hamster, "2.5":Entry.Albert, "3.1":Entry.Bitbrick, "4.2":Entry.Arduino, "5.1":Entry.Neobot, "7.1":Entry.Robotis_carCont, "7.2":Entry.Robotis_openCM70, "8.1":Entry.Arduino}; +}; +Entry.HW.TRIAL_LIMIT = 1; +p = Entry.HW.prototype; +p.initSocket = function() { + try { + if (this.connectTrial >= Entry.HW.TRIAL_LIMIT) { + this.isFirstConnect || Entry.toast.alert(Lang.Menus.connect_hw, Lang.Menus.connect_fail, !1), this.isFirstConnect = !1; + } else { + var a = this, b, c; + this.connected = !1; + this.connectTrial++; + if (-1 < location.protocol.indexOf("https")) { + c = new WebSocket("wss://hardware.play-entry.org:23518"); } else { - var h = {x:b.clientX, y:b.clientY}; - "touchstart" !== f || g || (b.stopPropagation(), Entry.documentMousedown.notify(b), longPressTimer = setTimeout(function() { - longPressTimer && (longPressTimer = null, a._rightClick(b)); - }, 1E3), e.bind("mousemove.object touchmove.object", c), e.bind("mouseup.object touchend.object", d)); + try { + b = new WebSocket("ws://127.0.0.1:23518"), b.binaryType = "arraybuffer", b.onopen = function() { + a.socketType = "WebSocket"; + a.initHardware(b); + }.bind(this), b.onmessage = function(b) { + b = JSON.parse(b.data); + a.checkDevice(b); + a.updatePortData(b); + }.bind(this), b.onclose = function() { + "WebSocket" === a.socketType && (this.socket = null, a.initSocket()); + }; + } catch (d) { + } + try { + c = new WebSocket("wss://hardware.play-entry.org:23518"); + } catch (d) { + } + } + c.binaryType = "arraybuffer"; + c.onopen = function() { + a.socketType = "WebSocketSecurity"; + a.initHardware(c); + }; + c.onmessage = function(b) { + b = JSON.parse(b.data); + a.checkDevice(b); + a.updatePortData(b); + }; + c.onclose = function() { + "WebSocketSecurity" === a.socketType && (this.socket = null, a.initSocket()); + }; + Entry.dispatchEvent("hwChanged"); + } + } catch (d) { + } +}; +p.retryConnect = function() { + this.connectTrial = 0; + this.initSocket(); +}; +p.initHardware = function(a) { + this.socket = a; + this.connectTrial = 0; + this.connected = !0; + Entry.dispatchEvent("hwChanged"); + Entry.playground && Entry.playground.object && Entry.playground.setMenu(Entry.playground.object.objectType); +}; +p.setDigitalPortValue = function(a, b) { + this.sendQueue[a] = b; + this.removePortReadable(a); +}; +p.getAnalogPortValue = function(a) { + return this.connected ? this.portData["a" + a] : 0; +}; +p.getDigitalPortValue = function(a) { + if (!this.connected) { + return 0; + } + this.setPortReadable(a); + return void 0 !== this.portData[a] ? this.portData[a] : 0; +}; +p.setPortReadable = function(a) { + this.sendQueue.readablePorts || (this.sendQueue.readablePorts = []); + var b = !1, c; + for (c in this.sendQueue.readablePorts) { + if (this.sendQueue.readablePorts[c] == a) { + b = !0; + break; + } + } + b || this.sendQueue.readablePorts.push(a); +}; +p.removePortReadable = function(a) { + if (this.sendQueue.readablePorts || Array.isArray(this.sendQueue.readablePorts)) { + var b, c; + for (c in this.sendQueue.readablePorts) { + if (this.sendQueue.readablePorts[c] == a) { + b = Number(c); + break; } + } + this.sendQueue.readablePorts = void 0 != b ? this.sendQueue.readablePorts.slice(0, b).concat(this.sendQueue.readablePorts.slice(b + 1, this.sendQueue.readablePorts.length)) : []; + } +}; +p.update = function() { + this.socket && 1 == this.socket.readyState && this.socket.send(JSON.stringify(this.sendQueue)); +}; +p.updatePortData = function(a) { + this.portData = a; + this.hwMonitor && "hw" == Entry.propertyPanel.selected && 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.8_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(a) { + void 0 !== a.company && (a = [Entry.Utils.convertIntToHex(a.company), ".", Entry.Utils.convertIntToHex(a.model)].join(""), a != this.selectedDevice && (this.selectedDevice = a, this.hwModule = this.hwInfo[a], 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), a = this.hwModule.monitorTemplate, "both" == a.mode ? (a.mode = "list", this.hwMonitor.generateListView(), a.mode = "general", this.hwMonitor.generateView(), a.mode = "both") : "list" == a.mode ? this.hwMonitor.generateListView() : this.hwMonitor.generateView()))); +}; +p.banHW = function() { + var a = this.hwInfo, b; + for (b in a) { + Entry.playground.mainWorkspace.blockMenu.banClass(a[b].name, !0); + } +}; +Entry.PropertyPanel = function() { + this.modes = {}; + this.selected = null; +}; +(function(a) { + a.generateView = function(b, a) { + this._view = Entry.Dom("div", {class:"propertyPanel", parent:$(b)}); + this._tabView = Entry.Dom("div", {class:"propertyTab", parent:this._view}); + this._contentView = Entry.Dom("div", {class:"propertyContent", parent:this._view}); + this._cover = Entry.Dom("div", {classes:["propertyPanelCover", "entryRemove"], parent:this._view}); + b = Entry.Dom("div", {class:"entryObjectSelectedImgWorkspace", parent:this._view}); + this.initializeSplitter(b); + }; + a.addMode = function(b, a) { + var d = a.getView(), d = Entry.Dom(d, {parent:this._contentView}), e = Entry.Dom("
" + Lang.Menus[b] + "
", {classes:["propertyTabElement", "propertyTab" + b], parent:this._tabView}), f = this; + e.bind("click", function() { + f.select(b); }); - this.view_ = b; - var c = this, b = Entry.createElement("ul"); - b.addClass("objectInfoView"); - Entry.objectEditable || b.addClass("entryHide"); - var d = Entry.createElement("li"); - d.addClass("objectInfo_visible"); - this.entity.getVisible() || d.addClass("objectInfo_unvisible"); - d.bindOnClick(function(a) { - Entry.engine.isState("run") || (a = c.entity, a.setVisible(!a.getVisible()) ? this.removeClass("objectInfo_unvisible") : this.addClass("objectInfo_unvisible")); + this.modes[b] && (this.modes[b].tabDom.remove(), this.modes[b].contentDom.remove(), "hw" == b && ($(this.modes).removeClass(".propertyTabhw"), $(".propertyTabhw").unbind("dblclick"))); + this.modes[b] = {obj:a, tabDom:e, contentDom:d}; + "hw" == b && $(".propertyTabhw").bind("dblclick", function() { + Entry.dispatchEvent("hwModeChange"); }); - var e = Entry.createElement("li"); - e.addClass("objectInfo_unlock"); - this.getLock() && e.addClass("objectInfo_lock"); - e.bindOnClick(function(a) { - Entry.engine.isState("run") || (a = c, a.setLock(!a.getLock()) ? this.addClass("objectInfo_lock") : this.removeClass("objectInfo_lock"), a.updateInputViews(a.getLock())); + }; + a.resize = function(b) { + this._view.css({width:b + "px", top:9 * b / 16 + 123 - 22 + "px"}); + 430 <= b ? this._view.removeClass("collapsed") : this._view.addClass("collapsed"); + Entry.dispatchEvent("windowResized"); + b = this.selected; + "hw" == b ? this.modes.hw.obj.listPorts ? this.modes[b].obj.resizeList() : this.modes[b].obj.resize() : this.modes[b].obj.resize(); + }; + a.select = function(b) { + for (var a in this.modes) { + var d = this.modes[a]; + d.tabDom.removeClass("selected"); + d.contentDom.addClass("entryRemove"); + d.obj.visible = !1; + } + a = this.modes[b]; + a.tabDom.addClass("selected"); + a.contentDom.removeClass("entryRemove"); + a.obj.resize && a.obj.resize(); + a.obj.visible = !0; + this.selected = b; + }; + a.initializeSplitter = function(b) { + var a = this; + b.bind("mousedown touchstart", function(b) { + a._cover.removeClass("entryRemove"); + Entry.container.disableSort(); + Entry.container.splitterEnable = !0; + Entry.documentMousemove && (Entry.container.resizeEvent = Entry.documentMousemove.attach(this, function(b) { + Entry.container.splitterEnable && Entry.resizeElement({canvasWidth:b.clientX || b.x}); + })); }); - b.appendChild(d); - b.appendChild(e); - this.view_.appendChild(b); - b = Entry.createElement("div"); - b.addClass("entryObjectThumbnailWorkspace"); - this.view_.appendChild(b); - this.thumbnailView_ = b; - b = Entry.createElement("div"); - b.addClass("entryObjectWrapperWorkspace"); - this.view_.appendChild(b); - d = Entry.createElement("input"); - d.bindOnClick(function(a) { - a.preventDefault(); - Entry.container.selectObject(c.id); - this.readOnly || (this.focus(), this.select()); + $(document).bind("mouseup touchend", function(b) { + if (b = Entry.container.resizeEvent) { + Entry.container.splitterEnable = !1, Entry.documentMousemove.detach(b), a._cover.addClass("entryRemove"), delete Entry.container.resizeEvent; + } + Entry.container.enableSort(); }); - d.addClass("entryObjectNameWorkspace"); - b.appendChild(d); - this.nameView_ = d; - this.nameView_.entryObject = this; - d.setAttribute("readonly", !0); - var f = this; - this.nameView_.onblur = function(a) { - this.entryObject.name = this.value; - Entry.playground.reloadPlayground(); - }; - this.nameView_.onkeypress = function(a) { - 13 == a.keyCode && f.editObjectValues(!1); - }; - this.nameView_.value = this.name; - d = Entry.createElement("div"); - d.addClass("entryObjectEditWorkspace"); - d.object = this; - this.editView_ = d; - this.view_.appendChild(d); - $(d).mousedown(function(b) { - var c = a.isEditing; - b.stopPropagation(); - Entry.documentMousedown.notify(b); - Entry.engine.isState("run") || !1 !== c || (a.editObjectValues(!c), Entry.playground.object !== a && Entry.container.selectObject(a.id), a.nameView_.select()); - }); - d.blur = function(b) { - a.editObjectComplete(); - }; - 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"); - e.innerHTML = Lang.Workspace.rotation + " : "; - var m = Entry.createElement("input"); - m.addClass("entryObjectRotateInputWorkspace"); - m.setAttribute("readonly", !0); - m.bindOnClick(function(a) { - a.stopPropagation(); - this.select(); - }); - this.rotateSpan_ = e; - this.rotateInput_ = m; - h = Entry.createElement("span"); - h.addClass("entryObjectDirectionSpanWorkspace"); - h.innerHTML = Lang.Workspace.direction + " : "; - var q = Entry.createElement("input"); - q.addClass("entryObjectDirectionInputWorkspace"); - q.setAttribute("readonly", !0); - q.bindOnClick(function(a) { - a.stopPropagation(); - this.select(); - }); - this.directionInput_ = q; - d.appendChild(e); - d.appendChild(m); - d.appendChild(h); - d.appendChild(q); - d.rotateInput_ = m; - d.directionInput_ = q; - c = this; - m.onkeypress = function(a) { - 13 == a.keyCode && c.editObjectValues(!1); - }; - m.onblur = function(a) { - a = m.value; - -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))); - isNaN(a) || c.entity.setRotation(Number(a)); - c.updateRotationView(); - Entry.stage.updateObject(); - }; - q.onkeypress = function(a) { - 13 == a.keyCode && c.editObjectValues(!1); - }; - q.onblur = function(a) { - a = q.value; - -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))); - isNaN(a) || c.entity.setDirection(Number(a)); - c.updateRotationView(); - Entry.stage.updateObject(); - }; - d = Entry.createElement("div"); - d.addClass("rotationMethodWrapper"); - b.appendChild(d); - this.rotationMethodWrapper_ = d; - b = Entry.createElement("span"); - b.addClass("entryObjectRotateMethodLabelWorkspace"); - d.appendChild(b); - b.innerHTML = Lang.Workspace.rotate_method + " : "; - b = Entry.createElement("div"); - b.addClass("entryObjectRotateModeWorkspace"); - b.addClass("entryObjectRotateModeAWorkspace"); - b.object = this; - this.rotateModeAView_ = b; - d.appendChild(b); - b.bindOnClick(function(a) { - Entry.engine.isState("run") || this.object.getLock() || (this.object.initRotateValue("free"), this.object.setRotateMethod("free")); - }); - b = Entry.createElement("div"); - b.addClass("entryObjectRotateModeWorkspace"); - b.addClass("entryObjectRotateModeBWorkspace"); - b.object = this; - this.rotateModeBView_ = b; - d.appendChild(b); - b.bindOnClick(function(a) { - Entry.engine.isState("run") || this.object.getLock() || (this.object.initRotateValue("vertical"), this.object.setRotateMethod("vertical")); - }); - b = Entry.createElement("div"); - b.addClass("entryObjectRotateModeWorkspace"); - b.addClass("entryObjectRotateModeCWorkspace"); - b.object = this; - this.rotateModeCView_ = b; - d.appendChild(b); - b.bindOnClick(function(a) { - Entry.engine.isState("run") || this.object.getLock() || (this.object.initRotateValue("none"), this.object.setRotateMethod("none")); - }); - this.updateThumbnailView(); - this.updateCoordinateView(); - this.updateRotateMethodView(); - this.updateInputViews(); - this.updateCoordinateView(!0); - this.updateRotationView(!0); - return this.view_; - } - if ("phone" == Entry.type) { - return b = Entry.createElement("li", this.id), b.addClass("entryContainerListElementWorkspace"), b.object = this, b.bindOnClick(function(a) { - Entry.container.getObject(this.id) && Entry.container.selectObject(this.id); - }), $ && (a = this, context.attach("#" + this.id, [{text:Lang.Workspace.context_rename, href:"/", action:function(a) { - a.preventDefault(); - }}, {text:Lang.Workspace.context_duplicate, href:"/", action:function(b) { - b.preventDefault(); - Entry.container.addCloneObject(a); - }}, {text:Lang.Workspace.context_remove, href:"/", action:function(b) { - b.preventDefault(); - Entry.container.removeObject(a); - }}])), this.view_ = b, b = Entry.createElement("ul"), b.addClass("objectInfoView"), d = Entry.createElement("li"), d.addClass("objectInfo_visible"), e = Entry.createElement("li"), e.addClass("objectInfo_lock"), b.appendChild(d), b.appendChild(e), this.view_.appendChild(b), b = Entry.createElement("div"), b.addClass("entryObjectThumbnailWorkspace"), this.view_.appendChild(b), this.thumbnailView_ = b, b = Entry.createElement("div"), b.addClass("entryObjectWrapperWorkspace"), this.view_.appendChild(b), - d = Entry.createElement("input"), d.addClass("entryObjectNameWorkspace"), b.appendChild(d), this.nameView_ = d, this.nameView_.entryObject = this, this.nameView_.onblur = function() { - this.entryObject.name = this.value; - Entry.playground.reloadPlayground(); - }, this.nameView_.onkeypress = function(a) { - 13 == a.keyCode && c.editObjectValues(!1); - }, this.nameView_.value = this.name, Entry.objectEditable && Entry.objectDeletable && (d = Entry.createElement("div"), d.addClass("entryObjectDeletePhone"), d.object = this, this.deleteView_ = d, this.view_.appendChild(d), d.bindOnClick(function(a) { - Entry.engine.isState("run") || Entry.container.removeObject(this.object); - })), d = Entry.createElement("button"), d.addClass("entryObjectEditPhone"), d.object = this, d.bindOnClick(function(a) { - if (a = Entry.container.getObject(this.id)) { - Entry.container.selectObject(a.id), Entry.playground.injectObject(a); - } - }), this.view_.appendChild(d), d = Entry.createElement("div"), d.addClass("entryObjectInformationWorkspace"), d.object = this, this.isInformationToggle = !1, b.appendChild(d), this.informationView_ = d, d = Entry.createElement("div"), d.addClass("entryObjectRotateLabelWrapperWorkspace"), this.view_.appendChild(d), this.rotateLabelWrapperView_ = d, e = Entry.createElement("span"), e.addClass("entryObjectRotateSpanWorkspace"), e.innerHTML = Lang.Workspace.rotation + " : ", m = Entry.createElement("input"), - m.addClass("entryObjectRotateInputWorkspace"), this.rotateSpan_ = e, this.rotateInput_ = m, h = Entry.createElement("span"), h.addClass("entryObjectDirectionSpanWorkspace"), h.innerHTML = Lang.Workspace.direction + " : ", q = Entry.createElement("input"), q.addClass("entryObjectDirectionInputWorkspace"), this.directionInput_ = q, d.appendChild(e), d.appendChild(m), d.appendChild(h), d.appendChild(q), d.rotateInput_ = m, d.directionInput_ = q, c = this, m.onkeypress = function(a) { - 13 == a.keyCode && (a = m.value, -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))), isNaN(a) || c.entity.setRotation(Number(a)), c.updateRotationView(), m.blur()); - }, m.onblur = function(a) { - c.entity.setRotation(c.entity.getRotation()); - Entry.stage.updateObject(); - }, q.onkeypress = function(a) { - 13 == a.keyCode && (a = q.value, -1 != a.indexOf("\u02da") && (a = a.substring(0, a.indexOf("\u02da"))), isNaN(a) || c.entity.setDirection(Number(a)), c.updateRotationView(), q.blur()); - }, q.onblur = function(a) { - c.entity.setDirection(c.entity.getDirection()); - Entry.stage.updateObject(); - }, b = Entry.createElement("div"), b.addClass("entryObjectRotationWrapperWorkspace"), b.object = this, this.view_.appendChild(b), d = Entry.createElement("span"), d.addClass("entryObjectCoordinateWorkspace"), b.appendChild(d), e = Entry.createElement("span"), e.addClass("entryObjectCoordinateSpanWorkspace"), e.innerHTML = "X:", g = Entry.createElement("input"), g.addClass("entryObjectCoordinateInputWorkspace"), h = Entry.createElement("span"), h.addClass("entryObjectCoordinateSpanWorkspace"), - h.innerHTML = "Y:", k = Entry.createElement("input"), k.addClass("entryObjectCoordinateInputWorkspace entryObjectCoordinateInputWorkspace_right"), l = Entry.createElement("span"), l.addClass("entryObjectCoordinateSpanWorkspace"), l.innerHTML = Lang.Workspace.Size, n = Entry.createElement("input"), n.addClass("entryObjectCoordinateInputWorkspace", "entryObjectCoordinateInputWorkspace_size"), d.appendChild(e), d.appendChild(g), d.appendChild(h), d.appendChild(k), d.appendChild(l), d.appendChild(n), - d.xInput_ = g, d.yInput_ = k, d.sizeInput_ = n, this.coordinateView_ = d, c = this, g.onkeypress = function(a) { - 13 == a.keyCode && (isNaN(g.value) || c.entity.setX(Number(g.value)), c.updateCoordinateView(), c.blur()); - }, g.onblur = function(a) { - c.entity.setX(c.entity.getX()); - Entry.stage.updateObject(); - }, k.onkeypress = function(a) { - 13 == a.keyCode && (isNaN(k.value) || c.entity.setY(Number(k.value)), c.updateCoordinateView(), c.blur()); - }, k.onblur = function(a) { - c.entity.setY(c.entity.getY()); - Entry.stage.updateObject(); - }, d = Entry.createElement("div"), d.addClass("rotationMethodWrapper"), b.appendChild(d), this.rotationMethodWrapper_ = d, b = Entry.createElement("span"), b.addClass("entryObjectRotateMethodLabelWorkspace"), d.appendChild(b), b.innerHTML = Lang.Workspace.rotate_method + " : ", b = Entry.createElement("div"), b.addClass("entryObjectRotateModeWorkspace"), b.addClass("entryObjectRotateModeAWorkspace"), b.object = this, this.rotateModeAView_ = b, d.appendChild(b), b.bindOnClick(function(a) { - Entry.engine.isState("run") || this.object.setRotateMethod("free"); - }), b = Entry.createElement("div"), b.addClass("entryObjectRotateModeWorkspace"), b.addClass("entryObjectRotateModeBWorkspace"), b.object = this, this.rotateModeBView_ = b, d.appendChild(b), b.bindOnClick(function(a) { - Entry.engine.isState("run") || this.object.setRotateMethod("vertical"); - }), b = Entry.createElement("div"), b.addClass("entryObjectRotateModeWorkspace"), b.addClass("entryObjectRotateModeCWorkspace"), b.object = this, this.rotateModeCView_ = b, d.appendChild(b), b.bindOnClick(function(a) { - Entry.engine.isState("run") || this.object.setRotateMethod("none"); - }), this.updateThumbnailView(), this.updateCoordinateView(), this.updateRotateMethodView(), this.updateInputViews(), this.view_; - } -}; -Entry.EntryObject.prototype.setName = function(b) { - Entry.assert("string" == typeof b, "object name must be string"); - this.name = b; - this.nameView_.value = b; -}; -Entry.EntryObject.prototype.setText = function(b) { - Entry.assert("string" == typeof b, "object text must be string"); - this.text = b; -}; -Entry.EntryObject.prototype.setScript = function(b) { - this.script = b; -}; -Entry.EntryObject.prototype.getScriptText = function() { - return JSON.stringify(this.script.toJSON()); + }; +})(Entry.PropertyPanel.prototype); +Entry.init = function(a, b) { + Entry.assert("object" === typeof b, "Init option is not object"); + this.events_ = {}; + this.interfaceState = {menuWidth:264}; + Entry.Utils.bindGlobalEvent("resize mousedown mousemove keydown keyup dispose".split(" ")); + this.options = b; + this.parseOptions(b); + this.mediaFilePath = (b.libDir ? b.libDir : "/lib") + "/entryjs/images/"; + this.defaultPath = b.defaultDir || ""; + this.blockInjectPath = b.blockInjectDir || ""; + "workspace" == this.type && this.isPhone() && (this.type = "phone"); + this.initialize_(); + this.view_ = a; + "tablet" === this.device ? this.view_.setAttribute("class", "entry tablet") : this.view_.setAttribute("class", "entry"); + Entry.initFonts(b.fonts); + this.createDom(a, this.type); + this.loadInterfaceState(); + this.overridePrototype(); + this.maxCloneLimit = 302; + this.cloudSavable = !0; + this.startTime = (new Date).getTime(); + document.onkeydown = function(b) { + Entry.dispatchEvent("keyPressed", b); + }; + document.onkeyup = function(b) { + Entry.dispatchEvent("keyUpped", b); + }; + window.onresize = function(b) { + Entry.dispatchEvent("windowResized", b); + }; + window.onbeforeunload = this.beforeUnload; + Entry.addEventListener("saveWorkspace", function(b) { + Entry.addActivity("save"); + }); + "IE" != Entry.getBrowserType().substr(0, 2) || window.flashaudio ? createjs.Sound.registerPlugins([createjs.WebAudioPlugin]) : (createjs.FlashAudioPlugin.swfPath = this.mediaFilePath + "media/", createjs.Sound.registerPlugins([createjs.FlashAudioPlugin]), window.flashaudio = !0); + Entry.soundQueue = new createjs.LoadQueue; + Entry.soundQueue.installPlugin(createjs.Sound); + Entry.loadAudio_([Entry.mediaFilePath + "sounds/click.mp3", Entry.mediaFilePath + "sounds/click.wav", Entry.mediaFilePath + "sounds/click.ogg"], "entryMagneting"); + Entry.loadAudio_([Entry.mediaFilePath + "sounds/delete.mp3", Entry.mediaFilePath + "sounds/delete.ogg", Entry.mediaFilePath + "sounds/delete.wav"], "entryDelete"); + createjs.Sound.stop(); }; -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"; - } +Entry.loadAudio_ = function(a, b) { + if (window.Audio && a.length) { + for (;0 < a.length;) { + a = a[0]; + a.match(/\/([^.]+)./); + Entry.soundQueue.loadFile({id:b, src:a, type:createjs.LoadQueue.SOUND}); + break; } } - return a; }; -Entry.EntryObject.prototype.updateThumbnailView = function() { - if ("sprite" == this.objectType) { - if (this.entity.picture.fileurl) { - this.thumbnailView_.style.backgroundImage = 'url("' + this.entity.picture.fileurl + '")'; - } else { - var b = this.entity.picture.filename; - this.thumbnailView_.style.backgroundImage = 'url("' + Entry.defaultPath + "/uploads/" + b.substring(0, 2) + "/" + b.substring(2, 4) + "/thumb/" + b + '.png")'; - } +Entry.initialize_ = function() { + this.stage = new Entry.Stage; + Entry.engine && Entry.engine.clearTimer(); + this.engine = new Entry.Engine; + this.propertyPanel = new Entry.PropertyPanel; + this.container = new Entry.Container; + this.helper = new Entry.Helper; + this.youtube = new Entry.Youtube; + this.variableContainer = new Entry.VariableContainer; + this.commander = new Entry.Commander(this.type); + this.scene = new Entry.Scene; + this.playground = new Entry.Playground; + this.toast = new Entry.Toast; + this.hw && this.hw.closeConnection(); + this.hw = new Entry.HW; + if (Entry.enableActivityLogging) { + this.reporter = new Entry.Reporter(!1); } else { - "textBox" == this.objectType && (this.thumbnailView_.style.backgroundImage = "url(" + (Entry.mediaFilePath + "/text_icon.png") + ")"); + if ("workspace" == this.type || "phone" == this.type) { + this.reporter = new Entry.Reporter(!0); + } } }; -Entry.EntryObject.prototype.updateCoordinateView = function(b) { - if ((this.isSelected() || b) && this.coordinateView_ && this.coordinateView_.xInput_ && this.coordinateView_.yInput_) { - b = this.coordinateView_.xInput_.value; - var a = this.coordinateView_.yInput_.value, c = this.coordinateView_.sizeInput_.value, d = this.entity.getX().toFixed(1), e = this.entity.getY().toFixed(1), f = this.entity.getSize().toFixed(1); - b != d && (this.coordinateView_.xInput_.value = d); - a != e && (this.coordinateView_.yInput_.value = e); - c != f && (this.coordinateView_.sizeInput_.value = f); +Entry.createDom = function(a, b) { + if (b && "workspace" != b) { + "minimize" == b ? (c = Entry.createElement("canvas"), c.className = "entryCanvasWorkspace", c.id = "entryCanvas", c.width = 640, c.height = 360, d = Entry.createElement("div", "entryCanvasWrapper"), d.appendChild(c), a.appendChild(d), this.canvas_ = c, this.stage.initStage(this.canvas_), d = Entry.createElement("div"), a.appendChild(d), this.engineView = d, this.engine.generateView(this.engineView, b)) : "phone" == b && (this.stateManagerView = c = Entry.createElement("div"), this.stateManager.generateView(this.stateManagerView, + b), d = Entry.createElement("div"), a.appendChild(d), this.engineView = d, this.engine.generateView(this.engineView, b), c = Entry.createElement("canvas"), c.addClass("entryCanvasPhone"), c.id = "entryCanvas", c.width = 640, c.height = 360, d.insertBefore(c, this.engine.footerView_), this.canvas_ = c, this.stage.initStage(this.canvas_), c = Entry.createElement("div"), a.appendChild(c), this.containerView = c, this.container.generateView(this.containerView, b), c = Entry.createElement("div"), + a.appendChild(c), this.playgroundView = c, this.playground.generateView(this.playgroundView, b)); + } else { + Entry.documentMousedown.attach(this, this.cancelObjectEdit); + var c = Entry.createElement("div"); + a.appendChild(c); + this.sceneView = c; + this.scene.generateView(this.sceneView, b); + c = Entry.createElement("div"); + this.sceneView.appendChild(c); + this.stateManagerView = c; + this.stateManager.generateView(this.stateManagerView, b); + var d = Entry.createElement("div"); + a.appendChild(d); + this.engineView = d; + this.engine.generateView(this.engineView, b); + c = Entry.createElement("canvas"); + c.addClass("entryCanvasWorkspace"); + c.id = "entryCanvas"; + c.width = 640; + c.height = 360; + d.insertBefore(c, this.engine.addButton); + c.addEventListener("mousewheel", function(b) { + var a = Entry.variableContainer.getListById(Entry.stage.mouseCoordinate); + b = 0 < b.wheelDelta ? !0 : !1; + for (var c = 0;c < a.length;c++) { + var d = a[c]; + d.scrollButton_.y = b ? 46 <= d.scrollButton_.y ? d.scrollButton_.y - 23 : 23 : d.scrollButton_.y + 23; + d.updateView(); + } + }); + this.canvas_ = c; + this.stage.initStage(this.canvas_); + c = Entry.createElement("div"); + this.propertyPanel.generateView(a, b); + this.containerView = c; + this.container.generateView(this.containerView, b); + this.propertyPanel.addMode("object", this.container); + this.helper.generateView(this.containerView, b); + this.propertyPanel.addMode("helper", this.helper); + c = Entry.createElement("div"); + a.appendChild(c); + this.playgroundView = c; + this.playground.generateView(this.playgroundView, b); + this.propertyPanel.select("object"); + this.helper.bindWorkspace(this.playground.mainWorkspace); } }; -Entry.EntryObject.prototype.updateRotationView = function(b) { - if (this.isSelected() && this.view_ || b) { - b = "", "free" == this.getRotateMethod() ? (this.rotateSpan_.removeClass("entryRemove"), this.rotateInput_.removeClass("entryRemove"), b += this.entity.getRotation().toFixed(1), this.rotateInput_.value = b + "\u02da") : (this.rotateSpan_.addClass("entryRemove"), this.rotateInput_.addClass("entryRemove")), b = "" + this.entity.getDirection().toFixed(1), b += "\u02da", this.directionInput_.value = b; - } -}; -Entry.EntryObject.prototype.select = function(b) { - console.log(this); +Entry.start = function(a) { + this.FPS || (this.FPS = 60); + Entry.assert("number" == typeof this.FPS, "FPS must be number"); + Entry.engine.start(this.FPS); }; -Entry.EntryObject.prototype.addPicture = function(b, a) { - Entry.stateManager && Entry.stateManager.addCommand("add sprite", this, this.removePicture, b.id); - b.objectId = this.id; - a || 0 === a ? (this.pictures.splice(a, 0, b), Entry.playground.injectPicture(this)) : this.pictures.push(b); - return new Entry.State(this, this.removePicture, b.id); +Entry.parseOptions = function(a) { + this.type = a.type; + a.device && (this.device = a.device); + this.projectSaveable = a.projectsaveable; + void 0 === this.projectSaveable && (this.projectSaveable = !0); + this.objectAddable = a.objectaddable; + void 0 === this.objectAddable && (this.objectAddable = !0); + this.objectEditable = a.objectEditable; + void 0 === this.objectEditable && (this.objectEditable = !0); + this.objectEditable || (this.objectAddable = !1); + this.objectDeletable = a.objectdeletable; + void 0 === this.objectDeletable && (this.objectDeletable = !0); + this.soundEditable = a.soundeditable; + void 0 === this.soundEditable && (this.soundEditable = !0); + this.pictureEditable = a.pictureeditable; + void 0 === this.pictureEditable && (this.pictureEditable = !0); + this.sceneEditable = a.sceneEditable; + void 0 === this.sceneEditable && (this.sceneEditable = !0); + this.functionEnable = a.functionEnable; + void 0 === this.functionEnable && (this.functionEnable = !0); + this.messageEnable = a.messageEnable; + void 0 === this.messageEnable && (this.messageEnable = !0); + this.variableEnable = a.variableEnable; + void 0 === this.variableEnable && (this.variableEnable = !0); + this.listEnable = a.listEnable; + void 0 === this.listEnable && (this.listEnable = !0); + this.hasVariableManager = a.hasvariablemanager; + this.variableEnable || this.messageEnable || this.listEnable || this.functionEnable ? void 0 === this.hasVariableManager && (this.hasVariableManager = !0) : this.hasVariableManager = !1; + this.isForLecture = a.isForLecture; }; -Entry.EntryObject.prototype.removePicture = function(b) { - if (2 > this.pictures.length) { - return !1; - } - b = this.getPicture(b); - var a = this.pictures.indexOf(b); - Entry.stateManager && Entry.stateManager.addCommand("remove sprite", this, this.addPicture, b, a); - this.pictures.splice(a, 1); - b === this.selectedPicture && Entry.playground.selectPicture(this.pictures[0]); - Entry.playground.injectPicture(this); - Entry.playground.reloadPlayground(); - return new Entry.State(this, this.addPicture, b, a); +Entry.initFonts = function(a) { + this.fonts = a; + a || (this.fonts = []); }; -Entry.EntryObject.prototype.getPicture = function(b) { - if (!b) { - return this.selectedPicture; - } - b = b.trim(); - for (var a = this.pictures, c = a.length, d = 0;d < c;d++) { - if (a[d].id == b) { - return a[d]; +Entry.Activity = function(a, b) { + this.name = a; + this.timestamp = new Date; + a = []; + if (void 0 !== b) { + for (var c = 0, d = b.length;c < d;c++) { + var e = b[c]; + a.push({key:e[0], value:e[1]}); } } - for (d = 0;d < c;d++) { - if (a[d].name == b) { - return a[d]; + this.data = a; +}; +Entry.ActivityReporter = function() { + this._activities = []; +}; +(function(a) { + a.add = function(b) { + if (b && 0 !== b.length) { + if (!(b instanceof Entry.Activity)) { + var a = b.shift(); + b = new Entry.Activity(a, b); + } + this._activities.push(b); } - } - b = Entry.parseNumber(b); - if ((!1 !== b || "boolean" != typeof b) && c >= b && 0 < b) { - return a[b - 1]; - } - throw Error("No picture found"); + }; + a.clear = function() { + this._activities = []; + }; + a.get = function() { + return this._activities; + }; + a.report = function() { + }; +})(Entry.ActivityReporter.prototype); +Entry.State = function(a, b, c, d) { + this.caller = b; + this.func = c; + 3 < arguments.length && (this.params = Array.prototype.slice.call(arguments).slice(3)); + this.message = a; + this.time = Entry.getUpTime(); + this.isPass = Entry.Command[a] ? Entry.Command[a].isPass : !1; }; -Entry.EntryObject.prototype.setPicture = function(b) { - for (var a in this.pictures) { - if (b.id === this.pictures[a].id) { - this.pictures[a] = b; - return; +Entry.State.prototype.generateMessage = function() { +}; +Entry.StateManager = function() { + this.undoStack_ = []; + this.redoStack_ = []; + this.isIgnore = this.isRestore = !1; + Entry.addEventListener("cancelLastCommand", function(a) { + Entry.stateManager.cancelLastCommand(); + }); + Entry.addEventListener("run", function(a) { + Entry.stateManager.updateView(); + }); + Entry.addEventListener("stop", function(a) { + Entry.stateManager.updateView(); + }); + Entry.addEventListener("saveWorkspace", function(a) { + Entry.stateManager.addStamp(); + }); + Entry.addEventListener("undo", function(a) { + Entry.stateManager.undo(); + }); + Entry.addEventListener("redo", function(a) { + Entry.stateManager.redo(); + }); +}; +Entry.StateManager.prototype.generateView = function(a, b) { +}; +Entry.StateManager.prototype.addCommand = function(a, b, c, d) { + if (!this.isIgnoring()) { + if (this.isRestoring()) { + var e = new Entry.State, f = Array.prototype.slice.call(arguments); + Entry.State.prototype.constructor.apply(e, f); + this.redoStack_.push(e); + Entry.reporter && Entry.reporter.report(e); + } else { + e = new Entry.State, f = Array.prototype.slice.call(arguments), Entry.State.prototype.constructor.apply(e, f), this.undoStack_.push(e), Entry.reporter && Entry.reporter.report(e), this.updateView(); } + Entry.creationChangedEvent && Entry.creationChangedEvent.notify(); } - throw Error("No picture found"); }; -Entry.EntryObject.prototype.getPrevPicture = function(b) { - for (var a = this.pictures, c = a.length, d = 0;d < c;d++) { - if (a[d].id == b) { - return a[0 == d ? c - 1 : d - 1]; +Entry.StateManager.prototype.cancelLastCommand = function() { + this.canUndo() && (this.undoStack_.pop(), this.updateView(), Entry.creationChangedEvent && Entry.creationChangedEvent.notify()); +}; +Entry.StateManager.prototype.getLastCommand = function() { + return this.undoStack_[this.undoStack_.length - 1]; +}; +Entry.StateManager.prototype.undo = function() { + if (this.canUndo() && !this.isRestoring()) { + this.addActivity("undo"); + for (this.startRestore();this.undoStack_.length;) { + var a = this.undoStack_.pop(); + a.func.apply(a.caller, a.params); + if (!0 !== a.isPass) { + break; + } } + this.updateView(); + this.endRestore(); + Entry.creationChangedEvent && Entry.creationChangedEvent.notify(); } }; -Entry.EntryObject.prototype.getNextPicture = function(b) { - for (var a = this.pictures, c = a.length, d = 0;d < c;d++) { - if (a[d].id == b) { - return a[d == c - 1 ? 0 : d + 1]; - } +Entry.StateManager.prototype.redo = function() { + if (this.canRedo() && !this.isRestoring()) { + this.addActivity("redo"); + var a = this.redoStack_.pop(); + a.func.apply(a.caller, a.params); + this.updateView(); + Entry.creationChangedEvent && Entry.creationChangedEvent.notify(); } }; -Entry.EntryObject.prototype.selectPicture = function(b) { - var a = this.getPicture(b); - if (a) { - this.selectedPicture = a, this.entity.setImage(a), this.updateThumbnailView(); - } else { - throw Error("No picture with pictureId : " + b); - } -}; -Entry.EntryObject.prototype.addSound = function(b, a) { - b.id || (b.id = Entry.generateHash()); - Entry.stateManager && Entry.stateManager.addCommand("add sound", this, this.removeSound, b.id); - Entry.initSound(b, a); - a || 0 === a ? (this.sounds.splice(a, 0, b), Entry.playground.injectSound(this)) : this.sounds.push(b); - return new Entry.State(this, this.removeSound, b.id); -}; -Entry.EntryObject.prototype.removeSound = function(b) { - var a; - a = this.getSound(b); - b = this.sounds.indexOf(a); - Entry.stateManager && Entry.stateManager.addCommand("remove sound", this, this.addSound, a, b); - this.sounds.splice(b, 1); - Entry.playground.reloadPlayground(); - Entry.playground.injectSound(this); - return new Entry.State(this, this.addSound, a, b); +Entry.StateManager.prototype.updateView = function() { + this.undoButton && this.redoButton && (this.canUndo() ? this.undoButton.addClass("active") : this.undoButton.removeClass("active"), this.canRedo() ? this.redoButton.addClass("active") : this.redoButton.removeClass("active")); }; -Entry.EntryObject.prototype.getRotateMethod = function() { - this.rotateMethod || (this.rotateMethod = "free"); - return this.rotateMethod; +Entry.StateManager.prototype.startRestore = function() { + this.isRestore = !0; }; -Entry.EntryObject.prototype.setRotateMethod = function(b) { - b || (b = "free"); - this.rotateMethod = b; - this.updateRotateMethodView(); - Entry.stage.selectedObject && Entry.stage.selectedObject.entity && (Entry.stage.updateObject(), Entry.stage.updateHandle()); +Entry.StateManager.prototype.endRestore = function() { + this.isRestore = !1; }; -Entry.EntryObject.prototype.initRotateValue = function(b) { - this.rotateMethod != b && (b = this.entity, b.rotation = 0, b.direction = 90, b.flip = !1); +Entry.StateManager.prototype.isRestoring = function() { + return this.isRestore; }; -Entry.EntryObject.prototype.updateRotateMethodView = function() { - var b = this.rotateMethod; - this.rotateModeAView_ && (this.rotateModeAView_.removeClass("selected"), this.rotateModeBView_.removeClass("selected"), this.rotateModeCView_.removeClass("selected"), "free" == b ? this.rotateModeAView_.addClass("selected") : "vertical" == b ? this.rotateModeBView_.addClass("selected") : this.rotateModeCView_.addClass("selected"), this.updateRotationView()); +Entry.StateManager.prototype.startIgnore = function() { + this.isIgnore = !0; }; -Entry.EntryObject.prototype.toggleInformation = function(b) { - this.setRotateMethod(this.getRotateMethod()); - void 0 === b && (b = this.isInformationToggle = !this.isInformationToggle); - b ? this.view_.addClass("informationToggle") : this.view_.removeClass("informationToggle"); +Entry.StateManager.prototype.endIgnore = function() { + this.isIgnore = !1; }; -Entry.EntryObject.prototype.addCloneEntity = function(b, a, c) { - this.clonedEntities.length > Entry.maxCloneLimit || (b = new Entry.EntityObject(this), a ? (b.injectModel(a.picture ? a.picture : null, a.toJSON()), b.snapshot_ = a.snapshot_, a.effect && (b.effect = Entry.cloneSimpleObject(a.effect), b.applyFilter()), a.brush && Entry.setCloneBrush(b, a.brush)) : (b.injectModel(this.entity.picture ? this.entity.picture : null, this.entity.toJSON(b)), b.snapshot_ = this.entity.snapshot_, this.entity.effect && (b.effect = Entry.cloneSimpleObject(this.entity.effect), - b.applyFilter()), this.entity.brush && Entry.setCloneBrush(b, this.entity.brush)), Entry.engine.raiseEventOnEntity(b, [b, "when_clone_start"]), b.isClone = !0, b.isStarted = !0, this.addCloneVariables(this, b, a ? a.variables : null, a ? a.lists : null), this.clonedEntities.push(b), Entry.stage.loadEntity(b)); +Entry.StateManager.prototype.isIgnoring = function() { + return this.isIgnore; }; -Entry.EntryObject.prototype.initializeSplitter = function(b) { - b.onmousedown = function(a) { - Entry.container.disableSort(); - Entry.container.splitterEnable = !0; - }; - document.addEventListener("mousemove", function(a) { - Entry.container.splitterEnable && Entry.resizeElement({canvasWidth:a.x || a.clientX}); - }); - document.addEventListener("mouseup", function(a) { - Entry.container.splitterEnable = !1; - Entry.container.enableSort(); - }); +Entry.StateManager.prototype.canUndo = function() { + return 0 < this.undoStack_.length && Entry.engine.isState("stop"); }; -Entry.EntryObject.prototype.isSelected = function() { - return this.isSelected_; +Entry.StateManager.prototype.canRedo = function() { + return 0 < this.redoStack_.length && Entry.engine.isState("stop"); }; -Entry.EntryObject.prototype.toJSON = function() { - var b = {}; - b.id = this.id; - b.name = this.name; - "textBox" == this.objectType && (b.text = this.text); - b.script = this.getScriptText(); - "sprite" == this.objectType && (b.selectedPictureId = this.selectedPicture.id); - b.objectType = this.objectType; - b.rotateMethod = this.getRotateMethod(); - b.scene = this.scene.id; - b.sprite = {pictures:Entry.getPicturesJSON(this.pictures), sounds:Entry.getSoundsJSON(this.sounds)}; - b.lock = this.lock; - b.entity = this.entity.toJSON(); - return b; +Entry.StateManager.prototype.addStamp = function() { + this.stamp = Entry.generateHash(); + this.undoStack_.length && (this.undoStack_[this.undoStack_.length - 1].stamp = this.stamp); }; -Entry.EntryObject.prototype.destroy = function() { - Entry.stage.unloadEntity(this.entity); - this.view_ && Entry.removeElement(this.view_); +Entry.StateManager.prototype.isSaved = function() { + return 0 === this.undoStack_.length || this.undoStack_[this.undoStack_.length - 1].stamp == this.stamp && "string" == typeof this.stamp; }; -Entry.EntryObject.prototype.getSound = function(b) { - b = b.trim(); - for (var a = this.sounds, c = a.length, d = 0;d < c;d++) { - if (a[d].id == b) { - return a[d]; - } - } - for (d = 0;d < c;d++) { - if (a[d].name == b) { - return a[d]; - } - } - b = Entry.parseNumber(b); - if ((!1 !== b || "boolean" != typeof b) && c >= b && 0 < b) { - return a[b - 1]; - } - throw Error("No Sound"); +Entry.StateManager.prototype.addActivity = function(a) { + Entry.reporter && Entry.reporter.report(new Entry.State(a)); }; -Entry.EntryObject.prototype.addCloneVariables = function(b, a, c, d) { - a.variables = []; - a.lists = []; - c || (c = Entry.findObjsByKey(Entry.variableContainer.variables_, "object_", b.id)); - d || (d = Entry.findObjsByKey(Entry.variableContainer.lists_, "object_", b.id)); - for (b = 0;b < c.length;b++) { - a.variables.push(c[b].clone()); - } - for (b = 0;b < d.length;b++) { - a.lists.push(d[b].clone()); - } +Entry.STATIC = {OBJECT:0, ENTITY:1, SPRITE:2, SOUND:3, VARIABLE:4, FUNCTION:5, SCENE:6, MESSAGE:7, BLOCK_MODEL:8, BLOCK_RENDER_MODEL:9, BOX_MODEL:10, THREAD_MODEL:11, DRAG_INSTANCE:12, BLOCK_STATIC:0, BLOCK_MOVE:1, BLOCK_FOLLOW:2, RETURN:0, CONTINUE:1, BREAK:2, PASS:3}; +Entry.BlockModel = function() { + Entry.Model(this); }; -Entry.EntryObject.prototype.getLock = function() { - return this.lock; +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.EntryObject.prototype.setLock = function(b) { - this.lock = b; - Entry.stage.updateObject(); - return b; +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.EntryObject.prototype.updateInputViews = function(b) { - b = b || this.getLock(); - var a = [this.nameView_, this.coordinateView_.xInput_, this.coordinateView_.yInput_, this.rotateInput_, this.directionInput_, this.coordinateView_.sizeInput_]; - if (b && 1 != a[0].getAttribute("readonly")) { - for (b = 0;b < a.length;b++) { - a[b].removeClass("selectedEditingObject"), a[b].setAttribute("readonly", !1), this.isEditing = !1; - } - } +Entry.BoxModel.prototype.schema = {id:0, type:Entry.STATIC.BOX_MODEL, x:0, y:0, width:0, height:0}; +Entry.DragInstance = function(a) { + Entry.Model(this); + this.set(a); }; -Entry.EntryObject.prototype.editObjectValues = function(b) { - var a; - a = this.getLock() ? [this.nameView_] : [this.coordinateView_.xInput_, this.coordinateView_.yInput_, this.rotateInput_, this.directionInput_, this.coordinateView_.sizeInput_]; - if (b) { - var c = this.nameView_; - $(a).removeClass("selectedNotEditingObject"); - $(c).removeClass("selectedNotEditingObject"); - window.setTimeout(function() { - $(c).removeAttr("readonly"); - c.addClass("selectedEditingObject"); - }); - for (b = 0;b < a.length;b++) { - $(a[b]).removeAttr("readonly"), a[b].addClass("selectedEditingObject"); - } - this.isEditing = !0; - } else { - for (b = 0;b < a.length;b++) { - a[b].blur(!0); +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.EntryObject = function(a) { + var b = this; + if (a) { + this.id = a.id; + this.name = a.name || a.sprite.name; + this.text = a.text || this.name; + this.objectType = a.objectType; + this.objectType || (this.objectType = "sprite"); + this.script = new Entry.Code(a.script ? a.script : [], this); + this.pictures = a.sprite.pictures; + this.sounds = []; + this.sounds = a.sprite.sounds; + for (var c = 0;c < this.sounds.length;c++) { + this.sounds[c].id || (this.sounds[c].id = Entry.generateHash()), Entry.initSound(this.sounds[c]); } - this.nameView_.blur(!0); - this.blurAllInput(); + this.lock = a.lock ? a.lock : !1; this.isEditing = !1; + "sprite" == this.objectType && (this.selectedPicture = a.selectedPictureId ? this.getPicture(a.selectedPictureId) : this.pictures[0]); + this.scene = Entry.scene.getSceneById(a.scene) || Entry.scene.selectedScene; + this.setRotateMethod(a.rotateMethod); + this.entity = new Entry.EntityObject(this); + this.entity.injectModel(this.selectedPicture ? this.selectedPicture : null, a.entity ? a.entity : this.initEntity(a)); + this.clonedEntities = []; + Entry.stage.loadObject(this); + for (c in this.pictures) { + (function(a) { + a.objectId = this.id; + a.id || (a.id = Entry.generateHash()); + var c = new Image; + if (a.fileurl) { + c.src = a.fileurl; + } else { + if (a.fileurl) { + c.src = a.fileurl; + } else { + var f = a.filename; + c.src = Entry.defaultPath + "/uploads/" + f.substring(0, 2) + "/" + f.substring(2, 4) + "/image/" + f + ".png"; + } + } + Entry.Loader.addQueue(); + c.onload = function(c) { + Entry.container.cachePicture(a.id + b.entity.id, this); + Entry.requestUpdate = !0; + Entry.Loader.removeQueue(); + }; + c.onerror = function(b) { + Entry.Loader.removeQueue(); + }; + })(this.pictures[c]); + } } }; -Entry.EntryObject.prototype.blurAllInput = function() { - var b = document.getElementsByClassName("selectedEditingObject"); - $(b).removeClass("selectedEditingObject"); - for (var b = [this.nameView_, this.coordinateView_.xInput_, this.coordinateView_.yInput_, this.rotateInput_, this.directionInput_, this.coordinateView_.sizeInput_], a = 0;a < b.length;a++) { - b[a].addClass("selectedNotEditingObject"), b[a].setAttribute("readonly", !0); - } -}; -Entry.EntryObject.prototype.addStampEntity = function(b) { - b = new Entry.StampEntity(this, b); - Entry.stage.loadEntity(b); - this.clonedEntities.push(b); - Entry.stage.sortZorder(); -}; -Entry.EntryObject.prototype.getClonedEntities = function() { - var b = []; - this.clonedEntities.map(function(a) { - a.isStamp || b.push(a); - }); - return b; -}; -Entry.EntryObject.prototype.getStampEntities = function() { - var b = []; - this.clonedEntities.map(function(a) { - a.isStamp && b.push(a); - }); - return b; -}; -Entry.EntryObject.prototype.clearExecutor = function() { - this.script.clearExecutors(); -}; -Entry.EntryObject.prototype._rightClick = function(b) { - var a = this, c = [{text:Lang.Workspace.context_rename, callback:function(b) { - b.stopPropagation(); - a.setLock(!1); - a.editObjectValues(!0); - a.nameView_.select(); - }}, {text:Lang.Workspace.context_duplicate, enable:!Entry.engine.isState("run"), callback:function() { - Entry.container.addCloneObject(a); - }}, {text:Lang.Workspace.context_remove, callback:function() { - Entry.container.removeObject(a); - }}, {text:Lang.Workspace.copy_file, callback:function() { - Entry.container.setCopiedObject(a); - }}, {text:Lang.Blocks.Paste_blocks, enable:!Entry.engine.isState("run") && !!Entry.container.copiedObject, callback:function() { - Entry.container.copiedObject ? Entry.container.addCloneObject(Entry.container.copiedObject) : Entry.toast.alert(Lang.Workspace.add_object_alert, Lang.Workspace.object_not_found_for_paste); - }}]; - b = Entry.Utils.convertMouseEvent(b); - Entry.ContextMenu.show(c, "workspace-contextmenu", {x:b.clientX, y:b.clientY}); -}; -Entry.Painter = function() { - this.toolbox = {selected:"cursor"}; - this.stroke = {enabled:!1, fillColor:"#000000", lineColor:"#000000", thickness:1, fill:!0, transparent:!1, style:"line", locked:!1}; - this.file = {id:Entry.generateHash(), name:"\uc0c8\uadf8\ub9bc", modified:!1, mode:"new"}; - this.font = {name:"KoPub Batang", size:20, style:"normal"}; - this.selectArea = {}; - this.firstStatement = !1; -}; -Entry.Painter.prototype.initialize = function(b) { - this.generateView(b); - this.canvas = document.getElementById("entryPainterCanvas"); - this.canvas_ = document.getElementById("entryPainterCanvas_"); - this.stage = new createjs.Stage(this.canvas); - this.stage.autoClear = !0; - this.stage.enableDOMEvents(!0); - this.stage.enableMouseOver(10); - this.stage.mouseMoveOutside = !0; - createjs.Touch.enable(this.stage); - this.objectContainer = new createjs.Container; - this.objectContainer.name = "container"; - this.stage.addChild(this.objectContainer); - this.ctx = this.stage.canvas.getContext("2d"); - this.ctx.imageSmoothingEnabled = !1; - this.ctx.webkitImageSmoothingEnabled = !1; - this.ctx.mozImageSmoothingEnabled = !1; - this.ctx.msImageSmoothingEnabled = !1; - this.ctx.oImageSmoothingEnabled = !1; - this.ctx_ = this.canvas_.getContext("2d"); - this.initDashedLine(); - this.initPicture(); - this.initCoordinator(); - this.initHandle(); - this.initDraw(); - var a = this; - Entry.addEventListener("textUpdate", function() { - var b = a.inputField.value(); - "" === b ? (a.inputField.hide(), delete a.inputField) : (a.inputField.hide(), a.drawText(b), a.selectToolbox("cursor")); - }); - this.selectToolbox("cursor"); +Entry.EntryObject.prototype.generateView = function() { + if ("workspace" == Entry.type) { + var a = Entry.createElement("li", this.id); + a.addClass("entryContainerListElementWorkspace"); + a.object = this; + Entry.Utils.disableContextmenu(a); + var b = this; + longPressTimer = null; + $(a).bind("mousedown touchstart", function(a) { + function c(b) { + b.stopPropagation(); + h && 5 < Math.sqrt(Math.pow(b.pageX - h.x, 2) + Math.pow(b.pageY - h.y, 2)) && longPressTimer && (clearTimeout(longPressTimer), longPressTimer = null); + } + function d(b) { + b.stopPropagation(); + e.unbind(".object"); + longPressTimer && (clearTimeout(longPressTimer), longPressTimer = null); + } + Entry.container.getObject(this.id) && Entry.container.selectObject(this.id); + var e = $(document), f = a.type, g = !1; + if (Entry.Utils.isRightButton(a)) { + a.stopPropagation(), Entry.documentMousedown.notify(a), g = !0, b._rightClick(a); + } else { + var h = {x:a.clientX, y:a.clientY}; + "touchstart" !== f || g || (a.stopPropagation(), Entry.documentMousedown.notify(a), longPressTimer = setTimeout(function() { + longPressTimer && (longPressTimer = null, b._rightClick(a)); + }, 1E3), e.bind("mousemove.object touchmove.object", c), e.bind("mouseup.object touchend.object", d)); + } + }); + this.view_ = a; + var c = this, a = Entry.createElement("ul"); + a.addClass("objectInfoView"); + Entry.objectEditable || a.addClass("entryHide"); + var d = Entry.createElement("li"); + d.addClass("objectInfo_visible"); + this.entity.getVisible() || d.addClass("objectInfo_unvisible"); + d.bindOnClick(function(b) { + Entry.engine.isState("run") || (b = c.entity, b.setVisible(!b.getVisible()) ? this.removeClass("objectInfo_unvisible") : this.addClass("objectInfo_unvisible")); + }); + var e = Entry.createElement("li"); + e.addClass("objectInfo_unlock"); + this.getLock() && e.addClass("objectInfo_lock"); + e.bindOnClick(function(b) { + Entry.engine.isState("run") || (b = c, b.setLock(!b.getLock()) ? this.addClass("objectInfo_lock") : this.removeClass("objectInfo_lock"), b.updateInputViews(b.getLock())); + }); + a.appendChild(d); + a.appendChild(e); + this.view_.appendChild(a); + a = Entry.createElement("div"); + a.addClass("entryObjectThumbnailWorkspace"); + this.view_.appendChild(a); + this.thumbnailView_ = a; + a = Entry.createElement("div"); + a.addClass("entryObjectWrapperWorkspace"); + this.view_.appendChild(a); + d = Entry.createElement("input"); + d.bindOnClick(function(b) { + b.preventDefault(); + Entry.container.selectObject(c.id); + this.readOnly || (this.focus(), this.select()); + }); + d.addClass("entryObjectNameWorkspace"); + a.appendChild(d); + this.nameView_ = d; + this.nameView_.entryObject = this; + d.setAttribute("readonly", !0); + var f = this; + this.nameView_.onblur = function(b) { + this.entryObject.name = this.value; + Entry.playground.reloadPlayground(); + }; + this.nameView_.onkeypress = function(b) { + 13 == b.keyCode && f.editObjectValues(!1); + }; + this.nameView_.value = this.name; + d = Entry.createElement("div"); + d.addClass("entryObjectEditWorkspace"); + d.object = this; + this.editView_ = d; + this.view_.appendChild(d); + $(d).mousedown(function(a) { + var c = b.isEditing; + a.stopPropagation(); + Entry.documentMousedown.notify(a); + Entry.engine.isState("run") || !1 !== c || (b.editObjectValues(!c), Entry.playground.object !== b && Entry.container.selectObject(b.id), b.nameView_.select()); + }); + d.blur = function(a) { + b.editObjectComplete(); + }; + Entry.objectEditable && Entry.objectDeletable && (d = Entry.createElement("div"), d.addClass("entryObjectDeleteWorkspace"), d.object = this, this.deleteView_ = d, this.view_.appendChild(d), d.bindOnClick(function(b) { + Entry.engine.isState("run") || Entry.container.removeObject(this.object); + })); + d = Entry.createElement("div"); + d.addClass("entryObjectInformationWorkspace"); + d.object = this; + this.isInformationToggle = !1; + a.appendChild(d); + this.informationView_ = d; + a = Entry.createElement("div"); + a.addClass("entryObjectRotationWrapperWorkspace"); + a.object = this; + this.view_.appendChild(a); + d = Entry.createElement("span"); + d.addClass("entryObjectCoordinateWorkspace"); + a.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(b) { + b.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(b) { + b.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(b) { + b.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(b) { + 13 == b.keyCode && c.editObjectValues(!1); + }; + g.onblur = function(b) { + isNaN(g.value) || c.entity.setX(Number(g.value)); + c.updateCoordinateView(); + Entry.stage.updateObject(); + }; + k.onkeypress = function(b) { + 13 == b.keyCode && c.editObjectValues(!1); + }; + k.onblur = function(b) { + isNaN(k.value) || c.entity.setY(Number(k.value)); + c.updateCoordinateView(); + Entry.stage.updateObject(); + }; + n.onkeypress = function(b) { + 13 == b.keyCode && c.editObjectValues(!1); + }; + n.onblur = function(b) { + isNaN(n.value) || c.entity.setSize(Number(n.value)); + c.updateCoordinateView(); + Entry.stage.updateObject(); + }; + d = Entry.createElement("div"); + d.addClass("entryObjectRotateLabelWrapperWorkspace"); + this.view_.appendChild(d); + this.rotateLabelWrapperView_ = d; + e = Entry.createElement("span"); + e.addClass("entryObjectRotateSpanWorkspace"); + e.innerHTML = Lang.Workspace.rotation + " : "; + var m = Entry.createElement("input"); + m.addClass("entryObjectRotateInputWorkspace"); + m.setAttribute("readonly", !0); + m.bindOnClick(function(b) { + b.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(b) { + b.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(b) { + 13 == b.keyCode && c.editObjectValues(!1); + }; + m.onblur = function(b) { + b = m.value; + -1 != b.indexOf("\u02da") && (b = b.substring(0, b.indexOf("\u02da"))); + isNaN(b) || c.entity.setRotation(Number(b)); + c.updateRotationView(); + Entry.stage.updateObject(); + }; + q.onkeypress = function(b) { + 13 == b.keyCode && c.editObjectValues(!1); + }; + q.onblur = function(b) { + b = q.value; + -1 != b.indexOf("\u02da") && (b = b.substring(0, b.indexOf("\u02da"))); + isNaN(b) || c.entity.setDirection(Number(b)); + c.updateRotationView(); + Entry.stage.updateObject(); + }; + d = Entry.createElement("div"); + d.addClass("rotationMethodWrapper"); + a.appendChild(d); + this.rotationMethodWrapper_ = d; + a = Entry.createElement("span"); + a.addClass("entryObjectRotateMethodLabelWorkspace"); + d.appendChild(a); + a.innerHTML = Lang.Workspace.rotate_method + " : "; + a = Entry.createElement("div"); + a.addClass("entryObjectRotateModeWorkspace"); + a.addClass("entryObjectRotateModeAWorkspace"); + a.object = this; + this.rotateModeAView_ = a; + d.appendChild(a); + a.bindOnClick(function(b) { + Entry.engine.isState("run") || this.object.getLock() || (this.object.initRotateValue("free"), this.object.setRotateMethod("free")); + }); + a = Entry.createElement("div"); + a.addClass("entryObjectRotateModeWorkspace"); + a.addClass("entryObjectRotateModeBWorkspace"); + a.object = this; + this.rotateModeBView_ = a; + d.appendChild(a); + a.bindOnClick(function(b) { + Entry.engine.isState("run") || this.object.getLock() || (this.object.initRotateValue("vertical"), this.object.setRotateMethod("vertical")); + }); + a = Entry.createElement("div"); + a.addClass("entryObjectRotateModeWorkspace"); + a.addClass("entryObjectRotateModeCWorkspace"); + a.object = this; + this.rotateModeCView_ = a; + d.appendChild(a); + a.bindOnClick(function(b) { + 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 a = Entry.createElement("li", this.id), a.addClass("entryContainerListElementWorkspace"), a.object = this, a.bindOnClick(function(b) { + Entry.container.getObject(this.id) && Entry.container.selectObject(this.id); + }), $ && (b = this, context.attach("#" + this.id, [{text:Lang.Workspace.context_rename, href:"/", action:function(b) { + b.preventDefault(); + }}, {text:Lang.Workspace.context_duplicate, href:"/", action:function(a) { + a.preventDefault(); + Entry.container.addCloneObject(b); + }}, {text:Lang.Workspace.context_remove, href:"/", action:function(a) { + a.preventDefault(); + Entry.container.removeObject(b); + }}])), this.view_ = a, a = Entry.createElement("ul"), a.addClass("objectInfoView"), d = Entry.createElement("li"), d.addClass("objectInfo_visible"), e = Entry.createElement("li"), e.addClass("objectInfo_lock"), a.appendChild(d), a.appendChild(e), this.view_.appendChild(a), a = Entry.createElement("div"), a.addClass("entryObjectThumbnailWorkspace"), this.view_.appendChild(a), this.thumbnailView_ = a, a = Entry.createElement("div"), a.addClass("entryObjectWrapperWorkspace"), this.view_.appendChild(a), + d = Entry.createElement("input"), d.addClass("entryObjectNameWorkspace"), a.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(b) { + 13 == b.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(b) { + Entry.engine.isState("run") || Entry.container.removeObject(this.object); + })), d = Entry.createElement("button"), d.addClass("entryObjectEditPhone"), d.object = this, d.bindOnClick(function(b) { + if (b = Entry.container.getObject(this.id)) { + Entry.container.selectObject(b.id), Entry.playground.injectObject(b); + } + }), this.view_.appendChild(d), d = Entry.createElement("div"), d.addClass("entryObjectInformationWorkspace"), d.object = this, this.isInformationToggle = !1, a.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(b) { + 13 == b.keyCode && (b = m.value, -1 != b.indexOf("\u02da") && (b = b.substring(0, b.indexOf("\u02da"))), isNaN(b) || c.entity.setRotation(Number(b)), c.updateRotationView(), m.blur()); + }, m.onblur = function(b) { + c.entity.setRotation(c.entity.getRotation()); + Entry.stage.updateObject(); + }, q.onkeypress = function(b) { + 13 == b.keyCode && (b = q.value, -1 != b.indexOf("\u02da") && (b = b.substring(0, b.indexOf("\u02da"))), isNaN(b) || c.entity.setDirection(Number(b)), c.updateRotationView(), q.blur()); + }, q.onblur = function(b) { + c.entity.setDirection(c.entity.getDirection()); + Entry.stage.updateObject(); + }, a = Entry.createElement("div"), a.addClass("entryObjectRotationWrapperWorkspace"), a.object = this, this.view_.appendChild(a), d = Entry.createElement("span"), d.addClass("entryObjectCoordinateWorkspace"), a.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(b) { + 13 == b.keyCode && (isNaN(g.value) || c.entity.setX(Number(g.value)), c.updateCoordinateView(), c.blur()); + }, g.onblur = function(b) { + c.entity.setX(c.entity.getX()); + Entry.stage.updateObject(); + }, k.onkeypress = function(b) { + 13 == b.keyCode && (isNaN(k.value) || c.entity.setY(Number(k.value)), c.updateCoordinateView(), c.blur()); + }, k.onblur = function(b) { + c.entity.setY(c.entity.getY()); + Entry.stage.updateObject(); + }, d = Entry.createElement("div"), d.addClass("rotationMethodWrapper"), a.appendChild(d), this.rotationMethodWrapper_ = d, a = Entry.createElement("span"), a.addClass("entryObjectRotateMethodLabelWorkspace"), d.appendChild(a), a.innerHTML = Lang.Workspace.rotate_method + " : ", a = Entry.createElement("div"), a.addClass("entryObjectRotateModeWorkspace"), a.addClass("entryObjectRotateModeAWorkspace"), a.object = this, this.rotateModeAView_ = a, d.appendChild(a), a.bindOnClick(function(b) { + Entry.engine.isState("run") || this.object.setRotateMethod("free"); + }), a = Entry.createElement("div"), a.addClass("entryObjectRotateModeWorkspace"), a.addClass("entryObjectRotateModeBWorkspace"), a.object = this, this.rotateModeBView_ = a, d.appendChild(a), a.bindOnClick(function(b) { + Entry.engine.isState("run") || this.object.setRotateMethod("vertical"); + }), a = Entry.createElement("div"), a.addClass("entryObjectRotateModeWorkspace"), a.addClass("entryObjectRotateModeCWorkspace"), a.object = this, this.rotateModeCView_ = a, d.appendChild(a), a.bindOnClick(function(b) { + Entry.engine.isState("run") || this.object.setRotateMethod("none"); + }), this.updateThumbnailView(), this.updateCoordinateView(), this.updateRotateMethodView(), this.updateInputViews(), this.view_; + } }; -Entry.Painter.prototype.initHandle = function() { - this._handle = new createjs.Container; - this._handle.rect = new createjs.Shape; - this._handle.addChild(this._handle.rect); - var b = new createjs.Container; - b.name = "move"; - b.width = 90; - b.height = 90; - b.x = 90; - b.y = 90; - b.rect = new createjs.Shape; - var a = this; - b.rect.on("mousedown", function(c) { - "cursor" === a.toolbox.selected && (a.initCommand(), this.offset = {x:this.parent.x - this.x - c.stageX, y:this.parent.y - this.y - c.stageY}, this.parent.handleMode = "move", b.isSelectCenter = !1); - }); - b.rect.on("pressmove", function(c) { - "cursor" !== a.toolbox.selected || b.isSelectCenter || (a.doCommand(), this.parent.x = c.stageX + this.offset.x, this.parent.y = c.stageY + this.offset.y, a.updateImageHandle()); - }); - b.on("mouseup", function(b) { - a.checkCommand(); - }); - b.rect.cursor = "move"; - b.addChild(b.rect); - b.notch = new createjs.Shape; - b.addChild(b.notch); - b.NEHandle = this.generateCornerHandle(); - b.addChild(b.NEHandle); - b.NWHandle = this.generateCornerHandle(); - b.addChild(b.NWHandle); - b.SWHandle = this.generateCornerHandle(); - b.addChild(b.SWHandle); - b.SEHandle = this.generateCornerHandle(); - b.addChild(b.SEHandle); - b.EHandle = this.generateXHandle(); - b.addChild(b.EHandle); - b.WHandle = this.generateXHandle(); - b.addChild(b.WHandle); - b.NHandle = this.generateYHandle(); - b.addChild(b.NHandle); - b.SHandle = this.generateYHandle(); - b.addChild(b.SHandle); - b.RHandle = new createjs.Shape; - b.RHandle.graphics.ss(2, 2, 0).beginFill("#888").s("#c1c7cd").f("#c1c7cd").dr(-2, -2, 8, 8); - b.RHandle.on("mousedown", function(b) { - a.initCommand(); - }); - b.RHandle.on("pressmove", function(b) { - a.doCommand(); - var d = b.stageX - this.parent.x; - b = b.stageY - this.parent.y; - this.parent.rotation = 0 <= d ? Math.atan(b / d) / Math.PI * 180 + 90 : Math.atan(b / d) / Math.PI * 180 + 270; - a.updateImageHandle(); - }); - b.RHandle.cursor = "crosshair"; - b.addChild(b.RHandle); - b.on("mouseup", function(b) { - a.checkCommand(); - }); - b.visible = !1; - this.handle = b; - this.stage.addChild(b); - this.updateImageHandleCursor(); +Entry.EntryObject.prototype.setName = function(a) { + Entry.assert("string" == typeof a, "object name must be string"); + this.name = a; + this.nameView_.value = a; }; -Entry.Painter.prototype.generateCornerHandle = function() { - var b = this, a = new createjs.Shape; - a.graphics.beginFill("#c1c7cd").ss(2, 2, 0).s("#c1c7cd").dr(-4, -4, 8, 8); - a.on("mousedown", function(a) { - b.initCommand(); - this.offset = {x:a.stageX - this.parent.x + this.parent.regX, y:a.stageY - this.parent.y + this.parent.regY}; - }); - a.on("pressmove", function(a) { - b.doCommand(); - var d = Math.sqrt(Math.abs((a.stageX - this.parent.x + this.parent.regX) / this.offset.x * (a.stageY - this.parent.y + this.parent.regY) / this.offset.y)); - 10 < this.parent.width * d && 10 < this.parent.height * d && (this.parent.width *= d, this.parent.height *= d, this.offset = {x:a.stageX - this.parent.x + this.parent.regX, y:a.stageY - this.parent.y + this.parent.regY}); - b.updateImageHandle(); - }); - a.on("mouseup", function(a) { - b.checkCommand(); - }); - return a; +Entry.EntryObject.prototype.setText = function(a) { + Entry.assert("string" == typeof a, "object text must be string"); + this.text = a; }; -Entry.Painter.prototype.generateXHandle = function() { - var b = this, a = new createjs.Shape; - a.graphics.beginFill("#c1c7cd").ss(2, 2, 0).s("#c1c7cd").dr(-4, -4, 8, 8); - a.on("mousedown", function(a) { - b.initCommand(); - this.offset = {x:a.stageX - this.parent.x + this.parent.regX}; - }); - a.on("pressmove", function(a) { - b.doCommand(); - var d = Math.abs((a.stageX - this.parent.x + this.parent.regX) / this.offset.x); - 10 < this.parent.width * d && (this.parent.width *= d, this.offset = {x:a.stageX - this.parent.x + this.parent.regX}); - b.updateImageHandle(); - }); - a.on("mouseup", function(a) { - b.checkCommand(); - }); - return a; +Entry.EntryObject.prototype.setScript = function(a) { + this.script = a; }; -Entry.Painter.prototype.generateYHandle = function() { - var b = this, a = new createjs.Shape; - a.graphics.beginFill("#c1c7cd").ss(2, 2, 0).s("#c1c7cd").dr(-4, -4, 8, 8); - a.on("mousedown", function(a) { - b.initCommand(); - this.offset = {y:a.stageY - this.parent.y + this.parent.regY}; - }); - a.on("pressmove", function(a) { - b.doCommand(); - var d = Math.abs((a.stageY - this.parent.y + this.parent.regY) / this.offset.y); - 10 < this.parent.height * d && (this.parent.height *= d, this.offset = {y:a.stageY - this.parent.y + this.parent.regY}); - b.updateImageHandle(); - }); - a.on("mouseup", function(a) { - b.checkCommand(); +Entry.EntryObject.prototype.getScriptText = function() { + return JSON.stringify(this.script.toJSON()); +}; +Entry.EntryObject.prototype.initEntity = function(a) { + var b = {}; + b.x = b.y = 0; + b.rotation = 0; + b.direction = 90; + if ("sprite" == this.objectType) { + var c = a.sprite.pictures[0].dimension; + b.regX = c.width / 2; + b.regY = c.height / 2; + b.scaleX = b.scaleY = "background" == a.sprite.category.main ? Math.max(270 / c.height, 480 / c.width) : "new" == a.sprite.category.main ? 1 : 200 / (c.width + c.height); + b.width = c.width; + b.height = c.height; + } else { + if ("textBox" == this.objectType) { + if (b.regX = 25, b.regY = 12, b.scaleX = b.scaleY = 1.5, b.width = 50, b.height = 24, b.text = a.text, a.options) { + if (a = a.options, c = "", a.bold && (c += "bold "), a.italic && (c += "italic "), b.underline = a.underline, b.strike = a.strike, b.font = c + "20px " + a.font.family, b.colour = a.colour, b.bgColor = a.background, b.lineBreak = a.lineBreak) { + b.width = 256, b.height = .5625 * b.width, b.regX = b.width / 2, b.regY = b.height / 2; + } + } else { + b.underline = !1, b.strike = !1, b.font = "20px Nanum Gothic", b.colour = "#000000", b.bgColor = "#ffffff"; + } + } + } + return b; +}; +Entry.EntryObject.prototype.updateThumbnailView = function() { + if ("sprite" == this.objectType) { + if (this.entity.picture.fileurl) { + this.thumbnailView_.style.backgroundImage = 'url("' + this.entity.picture.fileurl + '")'; + } else { + var a = this.entity.picture.filename; + this.thumbnailView_.style.backgroundImage = 'url("' + Entry.defaultPath + "/uploads/" + a.substring(0, 2) + "/" + a.substring(2, 4) + "/thumb/" + a + '.png")'; + } + } else { + "textBox" == this.objectType && (this.thumbnailView_.style.backgroundImage = "url(" + (Entry.mediaFilePath + "/text_icon.png") + ")"); + } +}; +Entry.EntryObject.prototype.updateCoordinateView = function(a) { + if ((this.isSelected() || a) && this.coordinateView_ && this.coordinateView_.xInput_ && this.coordinateView_.yInput_) { + a = this.coordinateView_.xInput_.value; + var b = this.coordinateView_.yInput_.value, c = this.coordinateView_.sizeInput_.value, d = this.entity.getX().toFixed(1), e = this.entity.getY().toFixed(1), f = this.entity.getSize().toFixed(1); + a != d && (this.coordinateView_.xInput_.value = d); + b != e && (this.coordinateView_.yInput_.value = e); + c != f && (this.coordinateView_.sizeInput_.value = f); + } +}; +Entry.EntryObject.prototype.updateRotationView = function(a) { + if (this.isSelected() && this.view_ || a) { + a = "", "free" == this.getRotateMethod() ? (this.rotateSpan_.removeClass("entryRemove"), this.rotateInput_.removeClass("entryRemove"), a += this.entity.getRotation().toFixed(1), this.rotateInput_.value = a + "\u02da") : (this.rotateSpan_.addClass("entryRemove"), this.rotateInput_.addClass("entryRemove")), a = "" + this.entity.getDirection().toFixed(1), this.directionInput_.value = a + "\u02da"; + } +}; +Entry.EntryObject.prototype.select = function(a) { + console.log(this); +}; +Entry.EntryObject.prototype.addPicture = function(a, b) { + Entry.stateManager && Entry.stateManager.addCommand("add sprite", this, this.removePicture, a.id); + a.objectId = this.id; + b || 0 === b ? (this.pictures.splice(b, 0, a), Entry.playground.injectPicture(this)) : this.pictures.push(a); + return new Entry.State(this, this.removePicture, a.id); +}; +Entry.EntryObject.prototype.removePicture = function(a) { + if (2 > this.pictures.length) { + return !1; + } + a = this.getPicture(a); + var b = this.pictures.indexOf(a); + Entry.stateManager && Entry.stateManager.addCommand("remove sprite", this, this.addPicture, a, b); + this.pictures.splice(b, 1); + a === this.selectedPicture && Entry.playground.selectPicture(this.pictures[0]); + Entry.playground.injectPicture(this); + Entry.playground.reloadPlayground(); + return new Entry.State(this, this.addPicture, a, b); +}; +Entry.EntryObject.prototype.getPicture = function(a) { + if (!a) { + return this.selectedPicture; + } + a = a.trim(); + for (var b = this.pictures, c = b.length, d = 0;d < c;d++) { + if (b[d].id == a) { + return b[d]; + } + } + for (d = 0;d < c;d++) { + if (b[d].name == a) { + return b[d]; + } + } + a = Entry.parseNumber(a); + if ((!1 !== a || "boolean" != typeof a) && c >= a && 0 < a) { + return b[a - 1]; + } + throw Error("No picture found"); +}; +Entry.EntryObject.prototype.setPicture = function(a) { + for (var b in this.pictures) { + if (a.id === this.pictures[b].id) { + this.pictures[b] = a; + return; + } + } + throw Error("No picture found"); +}; +Entry.EntryObject.prototype.getPrevPicture = function(a) { + for (var b = this.pictures, c = b.length, d = 0;d < c;d++) { + if (b[d].id == a) { + return b[0 == d ? c - 1 : d - 1]; + } + } +}; +Entry.EntryObject.prototype.getNextPicture = function(a) { + for (var b = this.pictures, c = b.length, d = 0;d < c;d++) { + if (b[d].id == a) { + return b[d == c - 1 ? 0 : d + 1]; + } + } +}; +Entry.EntryObject.prototype.selectPicture = function(a) { + var b = this.getPicture(a); + if (b) { + this.selectedPicture = b, this.entity.setImage(b), this.updateThumbnailView(); + } else { + throw Error("No picture with pictureId : " + a); + } +}; +Entry.EntryObject.prototype.addSound = function(a, b) { + a.id || (a.id = Entry.generateHash()); + Entry.stateManager && Entry.stateManager.addCommand("add sound", this, this.removeSound, a.id); + Entry.initSound(a, b); + b || 0 === b ? (this.sounds.splice(b, 0, a), Entry.playground.injectSound(this)) : this.sounds.push(a); + return new Entry.State(this, this.removeSound, a.id); +}; +Entry.EntryObject.prototype.removeSound = function(a) { + var b; + b = this.getSound(a); + a = this.sounds.indexOf(b); + Entry.stateManager && Entry.stateManager.addCommand("remove sound", this, this.addSound, b, a); + this.sounds.splice(a, 1); + Entry.playground.reloadPlayground(); + Entry.playground.injectSound(this); + return new Entry.State(this, this.addSound, b, a); +}; +Entry.EntryObject.prototype.getRotateMethod = function() { + this.rotateMethod || (this.rotateMethod = "free"); + return this.rotateMethod; +}; +Entry.EntryObject.prototype.setRotateMethod = function(a) { + a || (a = "free"); + this.rotateMethod = a; + this.updateRotateMethodView(); + Entry.stage.selectedObject && Entry.stage.selectedObject.entity && (Entry.stage.updateObject(), Entry.stage.updateHandle()); +}; +Entry.EntryObject.prototype.initRotateValue = function(a) { + this.rotateMethod != a && (a = this.entity, a.rotation = 0, a.direction = 90, a.flip = !1); +}; +Entry.EntryObject.prototype.updateRotateMethodView = function() { + var a = this.rotateMethod; + this.rotateModeAView_ && (this.rotateModeAView_.removeClass("selected"), this.rotateModeBView_.removeClass("selected"), this.rotateModeCView_.removeClass("selected"), "free" == a ? this.rotateModeAView_.addClass("selected") : "vertical" == a ? this.rotateModeBView_.addClass("selected") : this.rotateModeCView_.addClass("selected"), this.updateRotationView()); +}; +Entry.EntryObject.prototype.toggleInformation = function(a) { + this.setRotateMethod(this.getRotateMethod()); + void 0 === a && (a = this.isInformationToggle = !this.isInformationToggle); + a ? this.view_.addClass("informationToggle") : this.view_.removeClass("informationToggle"); +}; +Entry.EntryObject.prototype.addCloneEntity = function(a, b, c) { + this.clonedEntities.length > Entry.maxCloneLimit || (a = new Entry.EntityObject(this), b ? (a.injectModel(b.picture ? b.picture : null, b.toJSON()), a.snapshot_ = b.snapshot_, b.effect && (a.effect = Entry.cloneSimpleObject(b.effect), a.applyFilter()), b.brush && Entry.setCloneBrush(a, b.brush)) : (a.injectModel(this.entity.picture ? this.entity.picture : null, this.entity.toJSON(a)), a.snapshot_ = this.entity.snapshot_, this.entity.effect && (a.effect = Entry.cloneSimpleObject(this.entity.effect), + a.applyFilter()), this.entity.brush && Entry.setCloneBrush(a, this.entity.brush)), Entry.engine.raiseEventOnEntity(a, [a, "when_clone_start"]), a.isClone = !0, a.isStarted = !0, this.addCloneVariables(this, a, b ? b.variables : null, b ? b.lists : null), this.clonedEntities.push(a), Entry.stage.loadEntity(a)); +}; +Entry.EntryObject.prototype.initializeSplitter = function(a) { + a.onmousedown = function(b) { + Entry.container.disableSort(); + Entry.container.splitterEnable = !0; + }; + document.addEventListener("mousemove", function(b) { + Entry.container.splitterEnable && Entry.resizeElement({canvasWidth:b.x || b.clientX}); + }); + document.addEventListener("mouseup", function(b) { + Entry.container.splitterEnable = !1; + Entry.container.enableSort(); + }); +}; +Entry.EntryObject.prototype.isSelected = function() { + return this.isSelected_; +}; +Entry.EntryObject.prototype.toJSON = function() { + var a = {}; + a.id = this.id; + a.name = this.name; + "textBox" == this.objectType && (a.text = this.text); + a.script = this.getScriptText(); + "sprite" == this.objectType && (a.selectedPictureId = this.selectedPicture.id); + a.objectType = this.objectType; + a.rotateMethod = this.getRotateMethod(); + a.scene = this.scene.id; + a.sprite = {pictures:Entry.getPicturesJSON(this.pictures), sounds:Entry.getSoundsJSON(this.sounds)}; + a.lock = this.lock; + a.entity = this.entity.toJSON(); + return a; +}; +Entry.EntryObject.prototype.destroy = function() { + Entry.stage.unloadEntity(this.entity); + this.view_ && Entry.removeElement(this.view_); +}; +Entry.EntryObject.prototype.getSound = function(a) { + a = a.trim(); + for (var b = this.sounds, c = b.length, d = 0;d < c;d++) { + if (b[d].id == a) { + return b[d]; + } + } + for (d = 0;d < c;d++) { + if (b[d].name == a) { + return b[d]; + } + } + a = Entry.parseNumber(a); + if ((!1 !== a || "boolean" != typeof a) && c >= a && 0 < a) { + return b[a - 1]; + } + throw Error("No Sound"); +}; +Entry.EntryObject.prototype.addCloneVariables = function(a, b, c, d) { + b.variables = []; + b.lists = []; + c || (c = Entry.findObjsByKey(Entry.variableContainer.variables_, "object_", a.id)); + d || (d = Entry.findObjsByKey(Entry.variableContainer.lists_, "object_", a.id)); + for (a = 0;a < c.length;a++) { + b.variables.push(c[a].clone()); + } + for (a = 0;a < d.length;a++) { + b.lists.push(d[a].clone()); + } +}; +Entry.EntryObject.prototype.getLock = function() { + return this.lock; +}; +Entry.EntryObject.prototype.setLock = function(a) { + this.lock = a; + Entry.stage.updateObject(); + return a; +}; +Entry.EntryObject.prototype.updateInputViews = function(a) { + a = a || this.getLock(); + var b = [this.nameView_, this.coordinateView_.xInput_, this.coordinateView_.yInput_, this.rotateInput_, this.directionInput_, this.coordinateView_.sizeInput_]; + if (a && 1 != b[0].getAttribute("readonly")) { + for (a = 0;a < b.length;a++) { + b[a].removeClass("selectedEditingObject"), b[a].setAttribute("readonly", !1), this.isEditing = !1; + } + } +}; +Entry.EntryObject.prototype.editObjectValues = function(a) { + var b; + b = this.getLock() ? [this.nameView_] : [this.coordinateView_.xInput_, this.coordinateView_.yInput_, this.rotateInput_, this.directionInput_, this.coordinateView_.sizeInput_]; + if (a) { + var c = this.nameView_; + $(b).removeClass("selectedNotEditingObject"); + $(c).removeClass("selectedNotEditingObject"); + window.setTimeout(function() { + $(c).removeAttr("readonly"); + c.addClass("selectedEditingObject"); + }); + for (a = 0;a < b.length;a++) { + $(b[a]).removeAttr("readonly"), b[a].addClass("selectedEditingObject"); + } + this.isEditing = !0; + } else { + for (a = 0;a < b.length;a++) { + b[a].blur(!0); + } + this.nameView_.blur(!0); + this.blurAllInput(); + this.isEditing = !1; + } +}; +Entry.EntryObject.prototype.blurAllInput = function() { + var a = document.getElementsByClassName("selectedEditingObject"); + $(a).removeClass("selectedEditingObject"); + for (var a = [this.nameView_, this.coordinateView_.xInput_, this.coordinateView_.yInput_, this.rotateInput_, this.directionInput_, this.coordinateView_.sizeInput_], b = 0;b < a.length;b++) { + a[b].addClass("selectedNotEditingObject"), a[b].setAttribute("readonly", !0); + } +}; +Entry.EntryObject.prototype.addStampEntity = function(a) { + a = new Entry.StampEntity(this, a); + Entry.stage.loadEntity(a); + this.clonedEntities.push(a); + Entry.stage.sortZorder(); +}; +Entry.EntryObject.prototype.getClonedEntities = function() { + var a = []; + this.clonedEntities.map(function(b) { + b.isStamp || a.push(b); + }); + return a; +}; +Entry.EntryObject.prototype.getStampEntities = function() { + var a = []; + this.clonedEntities.map(function(b) { + b.isStamp && a.push(b); }); return a; }; +Entry.EntryObject.prototype.clearExecutor = function() { + this.script.clearExecutors(); +}; +Entry.EntryObject.prototype._rightClick = function(a) { + var b = this, c = [{text:Lang.Workspace.context_rename, callback:function(a) { + a.stopPropagation(); + b.setLock(!1); + b.editObjectValues(!0); + b.nameView_.select(); + }}, {text:Lang.Workspace.context_duplicate, enable:!Entry.engine.isState("run"), callback:function() { + Entry.container.addCloneObject(b); + }}, {text:Lang.Workspace.context_remove, callback:function() { + Entry.container.removeObject(b); + }}, {text:Lang.Workspace.copy_file, callback:function() { + Entry.container.setCopiedObject(b); + }}, {text:Lang.Blocks.Paste_blocks, enable:!Entry.engine.isState("run") && !!Entry.container.copiedObject, callback:function() { + Entry.container.copiedObject ? Entry.container.addCloneObject(Entry.container.copiedObject) : Entry.toast.alert(Lang.Workspace.add_object_alert, Lang.Workspace.object_not_found_for_paste); + }}]; + a = Entry.Utils.convertMouseEvent(a); + Entry.ContextMenu.show(c, "workspace-contextmenu", {x:a.clientX, y:a.clientY}); +}; +Entry.Painter = function() { + this.toolbox = {selected:"cursor"}; + this.stroke = {enabled:!1, fillColor:"#000000", lineColor:"#000000", thickness:1, fill:!0, transparent:!1, style:"line", locked:!1}; + this.file = {id:Entry.generateHash(), name:"\uc0c8\uadf8\ub9bc", modified:!1, mode:"new"}; + this.font = {name:"KoPub Batang", size:20, style:"normal"}; + this.selectArea = {}; + this.firstStatement = !1; +}; +Entry.Painter.prototype.initialize = function(a) { + this.generateView(a); + this.canvas = document.getElementById("entryPainterCanvas"); + this.canvas_ = document.getElementById("entryPainterCanvas_"); + this.stage = new createjs.Stage(this.canvas); + this.stage.autoClear = !0; + this.stage.enableDOMEvents(!0); + this.stage.enableMouseOver(10); + this.stage.mouseMoveOutside = !0; + createjs.Touch.enable(this.stage); + this.objectContainer = new createjs.Container; + this.objectContainer.name = "container"; + this.stage.addChild(this.objectContainer); + this.ctx = this.stage.canvas.getContext("2d"); + this.ctx.imageSmoothingEnabled = !1; + this.ctx.webkitImageSmoothingEnabled = !1; + this.ctx.mozImageSmoothingEnabled = !1; + this.ctx.msImageSmoothingEnabled = !1; + this.ctx.oImageSmoothingEnabled = !1; + this.ctx_ = this.canvas_.getContext("2d"); + this.initDashedLine(); + this.initPicture(); + this.initCoordinator(); + this.initHandle(); + this.initDraw(); + var b = this; + Entry.addEventListener("textUpdate", function() { + var a = b.inputField.value(); + "" === a ? (b.inputField.hide(), delete b.inputField) : (b.inputField.hide(), b.drawText(a), b.selectToolbox("cursor")); + }); + this.selectToolbox("cursor"); +}; +Entry.Painter.prototype.initHandle = function() { + this._handle = new createjs.Container; + this._handle.rect = new createjs.Shape; + this._handle.addChild(this._handle.rect); + var a = new createjs.Container; + a.name = "move"; + a.width = 90; + a.height = 90; + a.x = 90; + a.y = 90; + a.rect = new createjs.Shape; + var b = this; + a.rect.on("mousedown", function(c) { + "cursor" === b.toolbox.selected && (b.initCommand(), this.offset = {x:this.parent.x - this.x - c.stageX, y:this.parent.y - this.y - c.stageY}, this.parent.handleMode = "move", a.isSelectCenter = !1); + }); + a.rect.on("pressmove", function(c) { + "cursor" !== b.toolbox.selected || a.isSelectCenter || (b.doCommand(), this.parent.x = c.stageX + this.offset.x, this.parent.y = c.stageY + this.offset.y, b.updateImageHandle()); + }); + a.on("mouseup", function(a) { + b.checkCommand(); + }); + a.rect.cursor = "move"; + a.addChild(a.rect); + a.notch = new createjs.Shape; + a.addChild(a.notch); + a.NEHandle = this.generateCornerHandle(); + a.addChild(a.NEHandle); + a.NWHandle = this.generateCornerHandle(); + a.addChild(a.NWHandle); + a.SWHandle = this.generateCornerHandle(); + a.addChild(a.SWHandle); + a.SEHandle = this.generateCornerHandle(); + a.addChild(a.SEHandle); + a.EHandle = this.generateXHandle(); + a.addChild(a.EHandle); + a.WHandle = this.generateXHandle(); + a.addChild(a.WHandle); + a.NHandle = this.generateYHandle(); + a.addChild(a.NHandle); + a.SHandle = this.generateYHandle(); + a.addChild(a.SHandle); + a.RHandle = new createjs.Shape; + a.RHandle.graphics.ss(2, 2, 0).beginFill("#888").s("#c1c7cd").f("#c1c7cd").dr(-2, -2, 8, 8); + a.RHandle.on("mousedown", function(a) { + b.initCommand(); + }); + a.RHandle.on("pressmove", function(a) { + b.doCommand(); + var d = a.stageX - this.parent.x; + a = a.stageY - this.parent.y; + this.parent.rotation = 0 <= d ? Math.atan(a / d) / Math.PI * 180 + 90 : Math.atan(a / d) / Math.PI * 180 + 270; + b.updateImageHandle(); + }); + a.RHandle.cursor = "crosshair"; + a.addChild(a.RHandle); + a.on("mouseup", function(a) { + b.checkCommand(); + }); + a.visible = !1; + this.handle = a; + this.stage.addChild(a); + this.updateImageHandleCursor(); +}; +Entry.Painter.prototype.generateCornerHandle = function() { + var a = this, b = new createjs.Shape; + b.graphics.beginFill("#c1c7cd").ss(2, 2, 0).s("#c1c7cd").dr(-4, -4, 8, 8); + b.on("mousedown", function(b) { + a.initCommand(); + this.offset = {x:b.stageX - this.parent.x + this.parent.regX, y:b.stageY - this.parent.y + this.parent.regY}; + }); + b.on("pressmove", function(b) { + a.doCommand(); + var d = Math.sqrt(Math.abs((b.stageX - this.parent.x + this.parent.regX) / this.offset.x * (b.stageY - this.parent.y + this.parent.regY) / this.offset.y)); + 10 < this.parent.width * d && 10 < this.parent.height * d && (this.parent.width *= d, this.parent.height *= d, this.offset = {x:b.stageX - this.parent.x + this.parent.regX, y:b.stageY - this.parent.y + this.parent.regY}); + a.updateImageHandle(); + }); + b.on("mouseup", function(b) { + a.checkCommand(); + }); + return b; +}; +Entry.Painter.prototype.generateXHandle = function() { + var a = this, b = new createjs.Shape; + b.graphics.beginFill("#c1c7cd").ss(2, 2, 0).s("#c1c7cd").dr(-4, -4, 8, 8); + b.on("mousedown", function(b) { + a.initCommand(); + this.offset = {x:b.stageX - this.parent.x + this.parent.regX}; + }); + b.on("pressmove", function(b) { + a.doCommand(); + var d = Math.abs((b.stageX - this.parent.x + this.parent.regX) / this.offset.x); + 10 < this.parent.width * d && (this.parent.width *= d, this.offset = {x:b.stageX - this.parent.x + this.parent.regX}); + a.updateImageHandle(); + }); + b.on("mouseup", function(b) { + a.checkCommand(); + }); + return b; +}; +Entry.Painter.prototype.generateYHandle = function() { + var a = this, b = new createjs.Shape; + b.graphics.beginFill("#c1c7cd").ss(2, 2, 0).s("#c1c7cd").dr(-4, -4, 8, 8); + b.on("mousedown", function(b) { + a.initCommand(); + this.offset = {y:b.stageY - this.parent.y + this.parent.regY}; + }); + b.on("pressmove", function(b) { + a.doCommand(); + var d = Math.abs((b.stageY - this.parent.y + this.parent.regY) / this.offset.y); + 10 < this.parent.height * d && (this.parent.height *= d, this.offset = {y:b.stageY - this.parent.y + this.parent.regY}); + a.updateImageHandle(); + }); + b.on("mouseup", function(b) { + a.checkCommand(); + }); + return b; +}; Entry.Painter.prototype.updateImageHandle = function() { if (this.handle.visible) { - var b = this.handle, a = b.direction, c = b.width, d = b.height, e = b.regX, f = b.regY; - b.rect.graphics.clear().f("rgba(0,0,1,0.01)").ss(2, 2, 0).s("#c1c7cd").lt(-c / 2, -d / 2).lt(0, -d / 2).lt(0, -d / 2).lt(+c / 2, -d / 2).lt(+c / 2, +d / 2).lt(-c / 2, +d / 2).cp(); - b.notch.graphics.clear().f("rgba(0,0,1,0.01)").ss(2, 2, 0).s("#c1c7cd").lt(0, -d / 2).lt(0, -d / 2 - 20).cp(); - b.NEHandle.x = +b.width / 2; - b.NEHandle.y = -b.height / 2; - b.NWHandle.x = -b.width / 2; - b.NWHandle.y = -b.height / 2; - b.SWHandle.x = -b.width / 2; - b.SWHandle.y = +b.height / 2; - b.SEHandle.x = +b.width / 2; - b.SEHandle.y = +b.height / 2; - b.EHandle.x = +b.width / 2; - b.EHandle.y = 0; - b.WHandle.x = -b.width / 2; - b.WHandle.y = 0; - b.NHandle.x = 0; - b.NHandle.y = -b.height / 2; - b.SHandle.x = 0; - b.SHandle.y = +b.height / 2; - b.RHandle.x = -2; - b.RHandle.y = -b.height / 2 - 20 - 2; - this.handle.visible && (c = this.selectedObject, this.selectedObject.text ? (c.width = this.selectedObject.width, c.height = this.selectedObject.height) : (c.width = c.image.width, c.height = c.image.height), c.scaleX = b.width / c.width, c.scaleY = b.height / c.height, c.x = b.x, c.y = b.y, c.regX = c.width / 2 + e / c.scaleX, c.regY = c.height / 2 + f / c.scaleY, c.rotation = b.rotation, c.direction = a, this.selectArea.x1 = b.x - b.width / 2, this.selectArea.y1 = b.y - b.height / 2, this.selectArea.x2 = - b.width, this.selectArea.y2 = b.height, this.objectWidthInput.value = Math.abs(c.width * c.scaleX).toFixed(0), this.objectHeightInput.value = Math.abs(c.height * c.scaleY).toFixed(0), this.objectRotateInput.value = (1 * c.rotation).toFixed(0)); + var a = this.handle, b = a.direction, c = a.width, d = a.height, e = a.regX, f = a.regY; + a.rect.graphics.clear().f("rgba(0,0,1,0.01)").ss(2, 2, 0).s("#c1c7cd").lt(-c / 2, -d / 2).lt(0, -d / 2).lt(0, -d / 2).lt(+c / 2, -d / 2).lt(+c / 2, +d / 2).lt(-c / 2, +d / 2).cp(); + a.notch.graphics.clear().f("rgba(0,0,1,0.01)").ss(2, 2, 0).s("#c1c7cd").lt(0, -d / 2).lt(0, -d / 2 - 20).cp(); + a.NEHandle.x = +a.width / 2; + a.NEHandle.y = -a.height / 2; + a.NWHandle.x = -a.width / 2; + a.NWHandle.y = -a.height / 2; + a.SWHandle.x = -a.width / 2; + a.SWHandle.y = +a.height / 2; + a.SEHandle.x = +a.width / 2; + a.SEHandle.y = +a.height / 2; + a.EHandle.x = +a.width / 2; + a.EHandle.y = 0; + a.WHandle.x = -a.width / 2; + a.WHandle.y = 0; + a.NHandle.x = 0; + a.NHandle.y = -a.height / 2; + a.SHandle.x = 0; + a.SHandle.y = +a.height / 2; + a.RHandle.x = -2; + a.RHandle.y = -a.height / 2 - 20 - 2; + this.handle.visible && (c = this.selectedObject, this.selectedObject.text ? (c.width = this.selectedObject.width, c.height = this.selectedObject.height) : (c.width = c.image.width, c.height = c.image.height), c.scaleX = a.width / c.width, c.scaleY = a.height / c.height, c.x = a.x, c.y = a.y, c.regX = c.width / 2 + e / c.scaleX, c.regY = c.height / 2 + f / c.scaleY, c.rotation = a.rotation, c.direction = b, this.selectArea.x1 = a.x - a.width / 2, this.selectArea.y1 = a.y - a.height / 2, this.selectArea.x2 = + a.width, this.selectArea.y2 = a.height, this.objectWidthInput.value = Math.abs(c.width * c.scaleX).toFixed(0), this.objectHeightInput.value = Math.abs(c.height * c.scaleY).toFixed(0), this.objectRotateInput.value = (1 * c.rotation).toFixed(0)); this.updateImageHandleCursor(); this.stage.update(); } }; Entry.Painter.prototype.updateImageHandleCursor = function() { - var b = this.handle; - b.rect.cursor = "move"; - b.RHandle.cursor = "crosshair"; - for (var a = ["nwse-resize", "ns-resize", "nesw-resize", "ew-resize"], c = Math.floor((b.rotation + 22.5) % 180 / 45), d = 0;d < c;d++) { - a.push(a.shift()); - } - b.NHandle.cursor = a[1]; - b.NEHandle.cursor = a[2]; - b.EHandle.cursor = a[3]; - b.SEHandle.cursor = a[0]; - b.SHandle.cursor = a[1]; - b.SWHandle.cursor = a[2]; - b.WHandle.cursor = a[3]; - b.NWHandle.cursor = a[0]; -}; -Entry.Painter.prototype.clearCanvas = function(b) { + var a = this.handle; + a.rect.cursor = "move"; + a.RHandle.cursor = "crosshair"; + for (var b = ["nwse-resize", "ns-resize", "nesw-resize", "ew-resize"], c = Math.floor((a.rotation + 22.5) % 180 / 45), d = 0;d < c;d++) { + b.push(b.shift()); + } + a.NHandle.cursor = b[1]; + a.NEHandle.cursor = b[2]; + a.EHandle.cursor = b[3]; + a.SEHandle.cursor = b[0]; + a.SHandle.cursor = b[1]; + a.SWHandle.cursor = b[2]; + a.WHandle.cursor = b[3]; + a.NWHandle.cursor = b[0]; +}; +Entry.Painter.prototype.clearCanvas = function(a) { this.clearHandle(); - b || this.initCommand(); + a || this.initCommand(); this.objectContainer.removeAllChildren(); this.stage.update(); this.colorLayerData = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height); - b = 0; - for (var a = this.colorLayerData.data.length;b < a;b++) { - this.colorLayerData.data[b] = 255, this.colorLayerData.data[b + 1] = 255, this.colorLayerData.data[b + 2] = 255, this.colorLayerData.data[b + 3] = 255; + a = 0; + for (var b = this.colorLayerData.data.length;a < b;a++) { + this.colorLayerData.data[a] = 255, this.colorLayerData.data[a + 1] = 255, this.colorLayerData.data[a + 2] = 255, this.colorLayerData.data[a + 3] = 255; } this.reloadContext(); }; Entry.Painter.prototype.newPicture = function() { - var b = {dimension:{height:1, width:1}, fileurl:Entry.mediaFilePath + "_1x1.png", name:Lang.Workspace.new_picture}; - b.id = Entry.generateHash(); - Entry.playground.addPicture(b, !0); + var a = {dimension:{height:1, width:1}, fileurl:Entry.mediaFilePath + "_1x1.png", name:Lang.Workspace.new_picture}; + a.id = Entry.generateHash(); + Entry.playground.addPicture(a, !0); }; Entry.Painter.prototype.initPicture = function() { - var b = this; - Entry.addEventListener("pictureSelected", function(a) { - b.selectToolbox("cursor"); - if (b.file.id !== a.id) { - b.file.modified && confirm("\uc218\uc815\ub41c \ub0b4\uc6a9\uc744 \uc800\uc7a5\ud558\uc2dc\uaca0\uc2b5\ub2c8\uae4c?") && (b.file_ = JSON.parse(JSON.stringify(b.file)), b.file_save(!0)); - b.file.modified = !1; - b.clearCanvas(!0); + var a = this; + Entry.addEventListener("pictureSelected", function(b) { + a.selectToolbox("cursor"); + if (a.file.id !== b.id) { + a.file.modified && confirm("\uc218\uc815\ub41c \ub0b4\uc6a9\uc744 \uc800\uc7a5\ud558\uc2dc\uaca0\uc2b5\ub2c8\uae4c?") && (a.file_ = JSON.parse(JSON.stringify(a.file)), a.file_save(!0)); + a.file.modified = !1; + a.clearCanvas(!0); var c = new Image; - c.id = a.id ? a.id : Entry.generateHash(); - b.file.id = c.id; - b.file.name = a.name; - b.file.mode = "edit"; - c.src = a.fileurl ? a.fileurl : Entry.defaultPath + "/uploads/" + a.filename.substring(0, 2) + "/" + a.filename.substring(2, 4) + "/image/" + a.filename + ".png"; - c.onload = function(a) { - b.addImage(a.target); + c.id = b.id ? b.id : Entry.generateHash(); + a.file.id = c.id; + a.file.name = b.name; + a.file.mode = "edit"; + c.src = b.fileurl ? b.fileurl : Entry.defaultPath + "/uploads/" + b.filename.substring(0, 2) + "/" + b.filename.substring(2, 4) + "/image/" + b.filename + ".png"; + c.onload = function(b) { + a.addImage(b.target); }; } }); - Entry.addEventListener("pictureImport", function(a) { - b.addPicture(a); + Entry.addEventListener("pictureImport", function(b) { + a.addPicture(b); }); - Entry.addEventListener("pictureNameChanged", function(a) { - b.file.name = a.name; + Entry.addEventListener("pictureNameChanged", function(b) { + a.file.name = b.name; }); - Entry.addEventListener("pictureClear", function(a) { - b.file.modified = !1; - b.file.id = ""; - b.file.name = ""; - b.clearCanvas(); + Entry.addEventListener("pictureClear", function(b) { + a.file.modified = !1; + a.file.id = ""; + a.file.name = ""; + a.clearCanvas(); }); }; Entry.Painter.prototype.initDraw = function() { - var b = this; - this.stage.on("stagemousedown", function(a) { - b.stagemousedown(a); + var a = this; + this.stage.on("stagemousedown", function(b) { + a.stagemousedown(b); }); - this.stage.on("stagemouseup", function(a) { - b.stagemouseup(a); + this.stage.on("stagemouseup", function(b) { + a.stagemouseup(b); }); - this.stage.on("stagemousemove", function(a) { - b.stagemousemove(a); + this.stage.on("stagemousemove", function(b) { + a.stagemousemove(b); }); }; -Entry.Painter.prototype.selectObject = function(b, a) { - this.selectedObject = b; - this.handle.visible = b.visible; - a ? (this.handle.width = this.copy.width, this.handle.height = this.copy.height, this.handle.x = this.selectArea.x1 + this.copy.width / 2, this.handle.y = this.selectArea.y1 + this.copy.height / 2) : (this.handle.width = b.scaleX * b.image.width, this.handle.height = b.scaleY * b.image.height, this.handle.x = b.x, this.handle.y = b.y, this.handle.regX = +(b.regX - b.image.width / 2) * b.scaleX, this.handle.regY = +(b.regY - b.image.height / 2) * b.scaleY); - this.handle.rotation = b.rotation; +Entry.Painter.prototype.selectObject = function(a, b) { + this.selectedObject = a; + this.handle.visible = a.visible; + b ? (this.handle.width = this.copy.width, this.handle.height = this.copy.height, this.handle.x = this.selectArea.x1 + this.copy.width / 2, this.handle.y = this.selectArea.y1 + this.copy.height / 2) : (this.handle.width = a.scaleX * a.image.width, this.handle.height = a.scaleY * a.image.height, this.handle.x = a.x, this.handle.y = a.y, this.handle.regX = +(a.regX - a.image.width / 2) * a.scaleX, this.handle.regY = +(a.regY - a.image.height / 2) * a.scaleY); + this.handle.rotation = a.rotation; this.handle.direction = 0; this.updateImageHandle(); }; -Entry.Painter.prototype.selectTextObject = function(b) { - this.selectedObject = b; - var a = b.getTransformedBounds(); - this.handle.visible = b.visible; - b.width || (this.selectedObject.width = a.width); - b.height || (this.selectedObject.height = a.height); - this.handle.width = b.scaleX * this.selectedObject.width; - this.handle.height = b.scaleY * this.selectedObject.height; - this.handle.x = b.x; - this.handle.y = b.y; - b.regX || (b.regX = b.width / 2); - b.regY || (b.regY = b.height / 2); - this.handle.regX = (b.regX - this.selectedObject.width / 2) * b.scaleX; - this.handle.regY = (b.regY - this.selectedObject.height / 2) * b.scaleY; - this.handle.rotation = b.rotation; +Entry.Painter.prototype.selectTextObject = function(a) { + this.selectedObject = a; + var b = a.getTransformedBounds(); + this.handle.visible = a.visible; + a.width || (this.selectedObject.width = b.width); + a.height || (this.selectedObject.height = b.height); + this.handle.width = a.scaleX * this.selectedObject.width; + this.handle.height = a.scaleY * this.selectedObject.height; + this.handle.x = a.x; + this.handle.y = a.y; + a.regX || (a.regX = a.width / 2); + a.regY || (a.regY = a.height / 2); + this.handle.regX = (a.regX - this.selectedObject.width / 2) * a.scaleX; + this.handle.regY = (a.regY - this.selectedObject.height / 2) * a.scaleY; + this.handle.rotation = a.rotation; this.handle.direction = 0; this.updateImageHandle(); }; Entry.Painter.prototype.updateHandle = function() { -1 < this.stage.getChildIndex(this._handle) && this.stage.removeChild(this._handle); -1 === this.stage.getChildIndex(this.handle) && this.stage.addChild(this.handle); - var b = new createjs.Shape; - b.graphics.clear().beginFill("#000").rect(this.selectArea.x1, this.selectArea.y1, this.selectArea.x2, this.selectArea.y2); - this.handle.rect.hitArea = b; + var a = new createjs.Shape; + a.graphics.clear().beginFill("#000").rect(this.selectArea.x1, this.selectArea.y1, this.selectArea.x2, this.selectArea.y2); + this.handle.rect.hitArea = a; this.handle.rect.graphics.clear().setStrokeStyle(1, "round").beginStroke("#000000").drawDashedRect(this.selectArea.x1, this.selectArea.y1, this.selectArea.x2, this.selectArea.y2, 4); this.stage.update(); }; @@ -9065,56 +10872,56 @@ Entry.Painter.prototype.updateHandle_ = function() { this._handle.rect.graphics.clear().setStrokeStyle(1, "round").beginStroke("#cccccc").drawDashedRect(this.selectArea.x1, this.selectArea.y1, this.selectArea.x2, this.selectArea.y2, 2); this.stage.update(); }; -Entry.Painter.prototype.matchTolerance = function(b, a, c, d, e) { - var f = this.colorLayerData.data[b], g = this.colorLayerData.data[b + 1]; - b = this.colorLayerData.data[b + 2]; - return f >= a - e / 100 * a && f <= a + e / 100 * a && g >= c - e / 100 * c && g <= c + e / 100 * c && b >= d - e / 100 * d && b <= d + e / 100 * d; +Entry.Painter.prototype.matchTolerance = function(a, b, c, d, e) { + var f = this.colorLayerData.data[a], g = this.colorLayerData.data[a + 1]; + a = this.colorLayerData.data[a + 2]; + return f >= b - e / 100 * b && f <= b + e / 100 * b && g >= c - e / 100 * c && g <= c + e / 100 * c && a >= d - e / 100 * d && a <= d + e / 100 * d; }; -Entry.Painter.prototype.matchColorOnly = function(b, a, c, d) { - return a === this.colorLayerData.data[b] && c === this.colorLayerData.data[b + 1] && d === this.colorLayerData.data[b + 2] ? !0 : !1; +Entry.Painter.prototype.matchColorOnly = function(a, b, c, d) { + return b === this.colorLayerData.data[a] && c === this.colorLayerData.data[a + 1] && d === this.colorLayerData.data[a + 2] ? !0 : !1; }; -Entry.Painter.prototype.matchColor = function(b, a, c, d, e) { - return a === this.colorLayerData.data[b] && c === this.colorLayerData.data[b + 1] && d === this.colorLayerData.data[b + 2] && e === this.colorLayerData.data[b + 3] ? !0 : !1; +Entry.Painter.prototype.matchColor = function(a, b, c, d, e) { + return b === this.colorLayerData.data[a] && c === this.colorLayerData.data[a + 1] && d === this.colorLayerData.data[a + 2] && e === this.colorLayerData.data[a + 3] ? !0 : !1; }; -Entry.Painter.prototype.colorPixel = function(b, a, c, d, e) { +Entry.Painter.prototype.colorPixel = function(a, b, c, d, e) { e || (e = 255); - this.stroke.transparent && (e = d = c = a = 0); - this.colorLayerData.data[b] = a; - this.colorLayerData.data[b + 1] = c; - this.colorLayerData.data[b + 2] = d; - this.colorLayerData.data[b + 3] = e; -}; -Entry.Painter.prototype.pickStrokeColor = function(b) { - b = 4 * (Math.round(b.stageY) * this.canvas.width + Math.round(b.stageX)); - this.stroke.lineColor = Entry.rgb2hex(this.colorLayerData.data[b], this.colorLayerData.data[b + 1], this.colorLayerData.data[b + 2]); + this.stroke.transparent && (e = d = c = b = 0); + this.colorLayerData.data[a] = b; + this.colorLayerData.data[a + 1] = c; + this.colorLayerData.data[a + 2] = d; + this.colorLayerData.data[a + 3] = e; +}; +Entry.Painter.prototype.pickStrokeColor = function(a) { + a = 4 * (Math.round(a.stageY) * this.canvas.width + Math.round(a.stageX)); + this.stroke.lineColor = Entry.rgb2hex(this.colorLayerData.data[a], this.colorLayerData.data[a + 1], this.colorLayerData.data[a + 2]); document.getElementById("entryPainterAttrCircle").style.backgroundColor = this.stroke.lineColor; document.getElementById("entryPainterAttrCircleInput").value = this.stroke.lineColor; }; -Entry.Painter.prototype.drawText = function(b) { - var a = document.getElementById("entryPainterAttrFontStyle").value, c = document.getElementById("entryPainterAttrFontName").value, d = document.getElementById("entryPainterAttrFontSize").value; - b = new createjs.Text(b, a + " " + d + 'px "' + c + '"', this.stroke.lineColor); - b.textBaseline = "top"; - b.x = this.oldPt.x; - b.y = this.oldPt.y; - this.objectContainer.addChild(b); - this.selectTextObject(b); +Entry.Painter.prototype.drawText = function(a) { + var b = document.getElementById("entryPainterAttrFontStyle").value, c = document.getElementById("entryPainterAttrFontName").value, d = document.getElementById("entryPainterAttrFontSize").value; + a = new createjs.Text(a, b + " " + d + 'px "' + c + '"', this.stroke.lineColor); + a.textBaseline = "top"; + a.x = this.oldPt.x; + a.y = this.oldPt.y; + this.objectContainer.addChild(a); + this.selectTextObject(a); this.file.modified = !0; }; -Entry.Painter.prototype.addImage = function(b) { - var a = new createjs.Bitmap(b); - this.objectContainer.addChild(a); - a.x = this.stage.canvas.width / 2; - a.y = this.stage.canvas.height / 2; - a.regX = a.image.width / 2 | 0; - a.regY = a.image.height / 2 | 0; - if (540 < a.image.height) { - var c = 540 / a.image.height; - a.scaleX = c; - a.scaleY = c; - } - a.name = b.id; - a.id = b.id; - this.selectObject(a); +Entry.Painter.prototype.addImage = function(a) { + var b = new createjs.Bitmap(a); + this.objectContainer.addChild(b); + b.x = this.stage.canvas.width / 2; + b.y = this.stage.canvas.height / 2; + b.regX = b.image.width / 2 | 0; + b.regY = b.image.height / 2 | 0; + if (540 < b.image.height) { + var c = 540 / b.image.height; + b.scaleX = c; + b.scaleY = c; + } + b.name = a.id; + b.id = a.id; + this.selectObject(b); this.stage.update(); }; Entry.Painter.prototype.createBrush = function() { @@ -9135,18 +10942,18 @@ Entry.Painter.prototype.clearHandle = function() { this.stage.update(); }; Entry.Painter.prototype.initCommand = function() { - var b = !1; - this.handle.visible && (b = !0, this.handle.visible = !1); var a = !1; - this.coordinator.visible && (a = !0, this.coordinator.visible = !1); - (b || a) && this.stage.update(); + this.handle.visible && (a = !0, this.handle.visible = !1); + var b = !1; + this.coordinator.visible && (b = !0, this.coordinator.visible = !1); + (a || b) && this.stage.update(); this.isCommandValid = !1; this.colorLayerModel = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height); Entry.stateManager && this.firstStatement && Entry.stateManager.addCommand("edit sprite", this, this.restorePainter, this.colorLayerModel); this.firstStatement = !0; - b && (this.handle.visible = !0); - a && (this.coordinator.visible = !0); - (b || a) && this.stage.update(); + a && (this.handle.visible = !0); + b && (this.coordinator.visible = !0); + (a || b) && this.stage.update(); }; Entry.Painter.prototype.doCommand = function() { this.isCommandValid = !0; @@ -9154,20 +10961,20 @@ Entry.Painter.prototype.doCommand = function() { Entry.Painter.prototype.checkCommand = function() { this.isCommandValid || Entry.dispatchEvent("cancelLastCommand"); }; -Entry.Painter.prototype.restorePainter = function(b) { +Entry.Painter.prototype.restorePainter = function(a) { this.clearHandle(); - var a = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height); + var b = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height); this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height); - this.ctx.putImageData(b, 0, 0); - b = new Image; - b.src = this.canvas.toDataURL(); + this.ctx.putImageData(a, 0, 0); + a = new Image; + a.src = this.canvas.toDataURL(); var c = this; - b.onload = function(a) { - a = new createjs.Bitmap(a.target); + a.onload = function(b) { + b = new createjs.Bitmap(b.target); c.objectContainer.removeAllChildren(); - c.objectContainer.addChild(a); + c.objectContainer.addChild(b); }; - Entry.stateManager && Entry.stateManager.addCommand("restore sprite", this, this.restorePainter, a); + Entry.stateManager && Entry.stateManager.addCommand("restore sprite", this, this.restorePainter, b); }; Entry.Painter.prototype.platten = function() { this.colorLayerData = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height); @@ -9179,19 +10986,19 @@ Entry.Painter.prototype.fill = function() { this.initCommand(); this.doCommand(); this.clearHandle(); - var b = this.canvas.width, a = this.canvas.height; - this.colorLayerData = this.ctx.getImageData(0, 0, b, a); + var a = this.canvas.width, b = this.canvas.height; + this.colorLayerData = this.ctx.getImageData(0, 0, a, b); var c = new createjs.Point(this.stage.mouseX, this.stage.mouseY); c.x = Math.round(c.x); c.y = Math.round(c.y); - for (var d = 4 * (c.y * b + c.x), e = this.colorLayerData.data[d], f = this.colorLayerData.data[d + 1], g = this.colorLayerData.data[d + 2], h = this.colorLayerData.data[d + 3], k, l, c = [[c.x, c.y]], n = Entry.hex2rgb(this.stroke.lineColor);c.length;) { - for (var d = c.pop(), m = d[0], q = d[1], d = 4 * (q * b + m);0 <= q && this.matchColor(d, e, f, g, h);) { - --q, d -= 4 * b; + for (var d = 4 * (c.y * a + c.x), e = this.colorLayerData.data[d], f = this.colorLayerData.data[d + 1], g = this.colorLayerData.data[d + 2], h = this.colorLayerData.data[d + 3], k, l, c = [[c.x, c.y]], n = Entry.hex2rgb(this.stroke.lineColor);c.length;) { + for (var d = c.pop(), m = d[0], q = d[1], d = 4 * (q * a + m);0 <= q && this.matchColor(d, e, f, g, h);) { + --q, d -= 4 * a; } - d += 4 * b; + d += 4 * a; q += 1; - for (l = k = !1;q < a - 1 && this.matchColor(d, e, f, g, h);) { - q += 1, this.colorPixel(d, n.r, n.g, n.b), 0 < m && (this.matchColor(d - 4, e, f, g, h) ? k || (c.push([m - 1, q]), k = !0) : k && (k = !1)), m < b - 1 && (this.matchColor(d + 4, e, f, g, h) ? l || (c.push([m + 1, q]), l = !0) : l && (l = !1)), d += 4 * b; + for (l = k = !1;q < b - 1 && this.matchColor(d, e, f, g, h);) { + q += 1, this.colorPixel(d, n.r, n.g, n.b), 0 < m && (this.matchColor(d - 4, e, f, g, h) ? k || (c.push([m - 1, q]), k = !0) : k && (k = !1)), m < a - 1 && (this.matchColor(d + 4, e, f, g, h) ? l || (c.push([m + 1, q]), l = !0) : l && (l = !1)), d += 4 * a; } if (1080 < c.length) { break; @@ -9205,23 +11012,23 @@ Entry.Painter.prototype.reloadContext = function() { delete this.selectedObject; this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height); this.ctx.putImageData(this.colorLayerData, 0, 0); - var b = new Image; - b.src = this.canvas.toDataURL(); - var a = this; - b.onload = function(b) { - b = new createjs.Bitmap(b.target); - a.objectContainer.removeAllChildren(); - a.objectContainer.addChild(b); - a.stroke.locked = !1; + var a = new Image; + a.src = this.canvas.toDataURL(); + var b = this; + a.onload = function(a) { + a = new createjs.Bitmap(a.target); + b.objectContainer.removeAllChildren(); + b.objectContainer.addChild(a); + b.stroke.locked = !1; }; }; Entry.Painter.prototype.move_pen = function() { - var b = new createjs.Point(this.oldPt.x + this.stage.mouseX >> 1, this.oldPt.y + this.stage.mouseY >> 1); - this.brush.graphics.setStrokeStyle(this.stroke.thickness, "round").beginStroke(this.stroke.lineColor).moveTo(b.x, b.y).curveTo(this.oldPt.x, this.oldPt.y, this.oldMidPt.x, this.oldMidPt.y); + var a = new createjs.Point(this.oldPt.x + this.stage.mouseX >> 1, this.oldPt.y + this.stage.mouseY >> 1); + this.brush.graphics.setStrokeStyle(this.stroke.thickness, "round").beginStroke(this.stroke.lineColor).moveTo(a.x, a.y).curveTo(this.oldPt.x, this.oldPt.y, this.oldMidPt.x, this.oldMidPt.y); this.oldPt.x = this.stage.mouseX; this.oldPt.y = this.stage.mouseY; - this.oldMidPt.x = b.x; - this.oldMidPt.y = b.y; + this.oldMidPt.x = a.x; + this.oldMidPt.y = a.y; this.file.modified = !0; this.stage.update(); }; @@ -9231,18 +11038,18 @@ Entry.Painter.prototype.move_line = function() { this.stage.update(); }; Entry.Painter.prototype.move_rect = function() { - var b = this.stage.mouseX - this.oldPt.x, a = this.stage.mouseY - this.oldPt.y; - event.shiftKey && (a = b); - this.stroke.fill ? 0 === this.stroke.thickness ? this.brush.graphics.clear().setStrokeStyle(this.stroke.thickness, "round").beginFill(this.stroke.fillColor).drawRect(this.oldPt.x, this.oldPt.y, b, a) : this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness, "round").beginFill(this.stroke.fillColor).drawRect(this.oldPt.x, this.oldPt.y, b, a) : 0 === this.stroke.thickness ? this.brush.graphics.clear().setStrokeStyle(this.stroke.thickness, "round").drawRect(this.oldPt.x, - this.oldPt.y, b, a) : this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness, "round").drawRect(this.oldPt.x, this.oldPt.y, b, a); + var a = this.stage.mouseX - this.oldPt.x, b = this.stage.mouseY - this.oldPt.y; + event.shiftKey && (b = a); + this.stroke.fill ? 0 === this.stroke.thickness ? this.brush.graphics.clear().setStrokeStyle(this.stroke.thickness, "round").beginFill(this.stroke.fillColor).drawRect(this.oldPt.x, this.oldPt.y, a, b) : this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness, "round").beginFill(this.stroke.fillColor).drawRect(this.oldPt.x, this.oldPt.y, a, b) : 0 === this.stroke.thickness ? this.brush.graphics.clear().setStrokeStyle(this.stroke.thickness, "round").drawRect(this.oldPt.x, + this.oldPt.y, a, b) : this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness, "round").drawRect(this.oldPt.x, this.oldPt.y, a, b); this.file.modified = !0; this.stage.update(); }; Entry.Painter.prototype.move_circle = function() { - var b = this.stage.mouseX - this.oldPt.x, a = this.stage.mouseY - this.oldPt.y; - event.shiftKey && (a = b); - this.stroke.fill ? 0 === this.stroke.thickness ? this.brush.graphics.clear().beginStroke(this.stroke.fillColor).setStrokeStyle(this.stroke.thickness, "round").beginFill(this.stroke.fillColor).drawEllipse(this.oldPt.x, this.oldPt.y, b, a) : this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness, "round").beginFill(this.stroke.fillColor).drawEllipse(this.oldPt.x, this.oldPt.y, b, a) : this.stroke.fill || (0 === this.stroke.thickness ? this.brush.graphics.clear().drawEllipse(this.oldPt.x, - this.oldPt.y, b, a) : this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness, "round").drawEllipse(this.oldPt.x, this.oldPt.y, b, a)); + var a = this.stage.mouseX - this.oldPt.x, b = this.stage.mouseY - this.oldPt.y; + event.shiftKey && (b = a); + this.stroke.fill ? 0 === this.stroke.thickness ? this.brush.graphics.clear().beginStroke(this.stroke.fillColor).setStrokeStyle(this.stroke.thickness, "round").beginFill(this.stroke.fillColor).drawEllipse(this.oldPt.x, this.oldPt.y, a, b) : this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness, "round").beginFill(this.stroke.fillColor).drawEllipse(this.oldPt.x, this.oldPt.y, a, b) : this.stroke.fill || (0 === this.stroke.thickness ? this.brush.graphics.clear().drawEllipse(this.oldPt.x, + this.oldPt.y, a, b) : this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness, "round").drawEllipse(this.oldPt.x, this.oldPt.y, a, b)); this.file.modified = !0; this.stage.update(); }; @@ -9255,18 +11062,18 @@ Entry.Painter.prototype.edit_cut = function() { 0), this.ctx.clearRect(this.selectArea.x1, this.selectArea.y1, this.selectArea.x2, this.selectArea.y2), this.colorLayerData = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height), this.reloadContext(), this.file.modified = !0) : alert("\uc790\ub97c \uc601\uc5ed\uc744 \uc120\ud0dd\ud558\uc138\uc694."); }; Entry.Painter.prototype.edit_paste = function() { - var b = new Image; - b.src = this.canvas_.toDataURL(); - var a = this; - b.onload = function(b) { - b = new createjs.Bitmap(b.target); - b.x = a.canvas.width / 2; - b.y = a.canvas.height / 2; - b.regX = a.copy.width / 2 | 0; - b.regY = a.copy.height / 2 | 0; - b.id = Entry.generateHash(); - a.objectContainer.addChild(b); - a.selectObject(b, !0); + var a = new Image; + a.src = this.canvas_.toDataURL(); + var b = this; + a.onload = function(a) { + a = new createjs.Bitmap(a.target); + a.x = b.canvas.width / 2; + a.y = b.canvas.height / 2; + a.regX = b.copy.width / 2 | 0; + a.regY = b.copy.height / 2 | 0; + a.id = Entry.generateHash(); + b.objectContainer.addChild(a); + b.selectObject(a, !0); }; this.file.modified = !0; }; @@ -9285,35 +11092,35 @@ Entry.Painter.prototype.edit_select = function() { this.colorLayerData = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height); this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height); this.ctx.putImageData(this.colorLayerData, 0, 0); - var b = new Image; - b.src = this.canvas.toDataURL(); - var a = this; - b.onload = function(b) { - b = new createjs.Bitmap(b.target); - a.objectContainer.removeAllChildren(); - a.objectContainer.addChild(b); - b = new Image; - b.src = a.canvas_.toDataURL(); - b.onload = function(b) { - b = new createjs.Bitmap(b.target); - b.x = a.selectArea.x1 + a.copy.width / 2; - b.y = a.selectArea.y1 + a.copy.height / 2; - b.regX = a.copy.width / 2 | 0; - b.regY = a.copy.height / 2 | 0; - b.id = Entry.generateHash(); - b.name = b.id; - a.objectContainer.addChild(b); - a.selectObject(b, !0); + var a = new Image; + a.src = this.canvas.toDataURL(); + var b = this; + a.onload = function(a) { + a = new createjs.Bitmap(a.target); + b.objectContainer.removeAllChildren(); + b.objectContainer.addChild(a); + a = new Image; + a.src = b.canvas_.toDataURL(); + a.onload = function(a) { + a = new createjs.Bitmap(a.target); + a.x = b.selectArea.x1 + b.copy.width / 2; + a.y = b.selectArea.y1 + b.copy.height / 2; + a.regX = b.copy.width / 2 | 0; + a.regY = b.copy.height / 2 | 0; + a.id = Entry.generateHash(); + a.name = a.id; + b.objectContainer.addChild(a); + b.selectObject(a, !0); }; }; }; -Entry.Painter.prototype.move_erase = function(b) { - b = new createjs.Point(this.oldPt.x + this.stage.mouseX >> 1, this.oldPt.y + this.stage.mouseY >> 1); - this.eraser.graphics.setStrokeStyle(this.stroke.thickness, "round").beginStroke("#ffffff").moveTo(b.x, b.y).curveTo(this.oldPt.x, this.oldPt.y, this.oldMidPt.x, this.oldMidPt.y); +Entry.Painter.prototype.move_erase = function(a) { + a = new createjs.Point(this.oldPt.x + this.stage.mouseX >> 1, this.oldPt.y + this.stage.mouseY >> 1); + this.eraser.graphics.setStrokeStyle(this.stroke.thickness, "round").beginStroke("#ffffff").moveTo(a.x, a.y).curveTo(this.oldPt.x, this.oldPt.y, this.oldMidPt.x, this.oldMidPt.y); this.oldPt.x = this.stage.mouseX; this.oldPt.y = this.stage.mouseY; - this.oldMidPt.x = b.x; - this.oldMidPt.y = b.y; + this.oldMidPt.x = a.x; + this.oldMidPt.y = a.y; this.file.modified = !0; this.stage.update(); }; @@ -9322,111 +11129,110 @@ Entry.Painter.prototype.settingShapeBlur = function() { this.objectHeightInput.blur(); this.objectRotateInput.blur(); }; -Entry.Painter.prototype.stagemousedown = function(b) { - "picture" == Entry.playground.getViewMode() && (this.settingShapeBlur(), this.oldPt = new createjs.Point(b.stageX, b.stageY), this.oldMidPt = this.oldPt.clone(), "select" === this.toolbox.selected ? this.stage.addChild(this._handle) : "spoid" === this.toolbox.selected ? this.pickStrokeColor(b) : "text" === this.toolbox.selected ? (this.showInputField(b), this.stage.update()) : "erase" === this.toolbox.selected ? (this.createEraser(), this.stroke.enabled = !0) : "fill" === this.toolbox.selected ? +Entry.Painter.prototype.stagemousedown = function(a) { + "picture" == Entry.playground.getViewMode() && (this.settingShapeBlur(), this.oldPt = new createjs.Point(a.stageX, a.stageY), this.oldMidPt = this.oldPt.clone(), "select" === this.toolbox.selected ? this.stage.addChild(this._handle) : "spoid" === this.toolbox.selected ? this.pickStrokeColor(a) : "text" === this.toolbox.selected ? (this.showInputField(a), this.stage.update()) : "erase" === this.toolbox.selected ? (this.createEraser(), this.stroke.enabled = !0) : "fill" === this.toolbox.selected ? this.fill() : "cursor" !== this.toolbox.selected && (this.createBrush(), this.stroke.enabled = !0)); }; -Entry.Painter.prototype.stagemousemove = function(b) { - "picture" == Entry.playground.getViewMode() && ("select" === this.toolbox.selected && -1 < this.stage.getChildIndex(this._handle) ? (this.selectArea.x1 = this.oldPt.x, this.selectArea.y1 = this.oldPt.y, this.selectArea.x2 = b.stageX - this.oldPt.x, this.selectArea.y2 = b.stageY - this.oldPt.y, this.updateHandle_()) : this.stroke.enabled && (this.doCommand(), "pen" === this.toolbox.selected ? this.move_pen(b) : "line" === this.toolbox.selected ? this.move_line(b) : "rect" === this.toolbox.selected ? - this.move_rect(b) : "circle" === this.toolbox.selected ? this.move_circle(b) : "erase" === this.toolbox.selected && this.move_erase(b)), this.painterTopStageXY.innerHTML = "x:" + b.stageX.toFixed(1) + ", y:" + b.stageY.toFixed(1)); +Entry.Painter.prototype.stagemousemove = function(a) { + "picture" == Entry.playground.getViewMode() && ("select" === this.toolbox.selected && -1 < this.stage.getChildIndex(this._handle) ? (this.selectArea.x1 = this.oldPt.x, this.selectArea.y1 = this.oldPt.y, this.selectArea.x2 = a.stageX - this.oldPt.x, this.selectArea.y2 = a.stageY - this.oldPt.y, this.updateHandle_()) : this.stroke.enabled && (this.doCommand(), "pen" === this.toolbox.selected ? this.move_pen(a) : "line" === this.toolbox.selected ? this.move_line(a) : "rect" === this.toolbox.selected ? + this.move_rect(a) : "circle" === this.toolbox.selected ? this.move_circle(a) : "erase" === this.toolbox.selected && this.move_erase(a)), this.painterTopStageXY.innerHTML = "x:" + a.stageX.toFixed(1) + ", y:" + a.stageY.toFixed(1)); }; -Entry.Painter.prototype.stagemouseup = function(b) { - "picture" == Entry.playground.getViewMode() && ("select" === this.toolbox.selected ? (this.selectArea.x1 = this.oldPt.x, this.selectArea.y1 = this.oldPt.y, this.selectArea.x2 = b.stageX - this.oldPt.x, this.selectArea.y2 = b.stageY - this.oldPt.y, this.stage.removeChild(this._handle), this.stage.update(), 0 < this.selectArea.x2 && 0 < this.selectArea.y2 && this.edit_select(), this.selectToolbox("cursor")) : "cursor" !== this.toolbox.selected && this.stroke.enabled && (-1 < this.objectContainer.getChildIndex(this.eraser) && +Entry.Painter.prototype.stagemouseup = function(a) { + "picture" == Entry.playground.getViewMode() && ("select" === this.toolbox.selected ? (this.selectArea.x1 = this.oldPt.x, this.selectArea.y1 = this.oldPt.y, this.selectArea.x2 = a.stageX - this.oldPt.x, this.selectArea.y2 = a.stageY - this.oldPt.y, this.stage.removeChild(this._handle), this.stage.update(), 0 < this.selectArea.x2 && 0 < this.selectArea.y2 && this.edit_select(), this.selectToolbox("cursor")) : "cursor" !== this.toolbox.selected && this.stroke.enabled && (-1 < this.objectContainer.getChildIndex(this.eraser) && this.eraser.graphics.endStroke(), -1 < this.objectContainer.getChildIndex(this.brush) && this.brush.graphics.endStroke(), this.clearHandle(), this.platten(), this.stroke.enabled = !1, this.checkCommand())); }; -Entry.Painter.prototype.file_save = function(b) { +Entry.Painter.prototype.file_save = function(a) { this.clearHandle(); this.transparent(); this.trim(); - var a = this.canvas_.toDataURL(); - Entry.dispatchEvent("saveCanvasImage", {file:b ? this.file_ : this.file, image:a}); + var b = this.canvas_.toDataURL(); + Entry.dispatchEvent("saveCanvasImage", {file:a ? this.file_ : this.file, image:b}); this.file.modified = !1; }; Entry.Painter.prototype.transparent = function() { - var b = this.canvas.width, a = this.canvas.height; - this.colorLayerData = this.ctx.getImageData(0, 0, b, a); - var c = b * (a - 1) * 4, d = 4 * (b - 1), e = 4 * (b * a - 1); - this.matchColorOnly(0, 255, 255, 255) ? this.fillTransparent(1, 1) : this.matchColorOnly(c, 255, 255, 255) ? this.fillTransparent(1, a) : this.matchColorOnly(d, 255, 255, 255) ? this.fillTransparent(b, 1) : this.matchColorOnly(e, 255, 255, 255) && this.fillTransparent(b, a); -}; -Entry.Painter.prototype.fillTransparent = function(b, a) { - this.stage.mouseX = b; - this.stage.mouseY = a; + var a = this.canvas.width, b = this.canvas.height; + this.colorLayerData = this.ctx.getImageData(0, 0, a, b); + var c = a * (b - 1) * 4, d = 4 * (a - 1), e = 4 * (a * b - 1); + this.matchColorOnly(0, 255, 255, 255) ? this.fillTransparent(1, 1) : this.matchColorOnly(c, 255, 255, 255) ? this.fillTransparent(1, b) : this.matchColorOnly(d, 255, 255, 255) ? this.fillTransparent(a, 1) : this.matchColorOnly(e, 255, 255, 255) && this.fillTransparent(a, b); +}; +Entry.Painter.prototype.fillTransparent = function(a, b) { + this.stage.mouseX = a; + this.stage.mouseY = b; this.stroke.transparent = !0; this.fill(); }; Entry.Painter.prototype.trim = function() { - var b = this.canvas.width, a = this.ctx.getImageData(0, 0, b, this.canvas.height), c = a.data.length, d, e = null, f = null, g = null, h = null, k; + var a = this.canvas.width, b = this.ctx.getImageData(0, 0, a, this.canvas.height), c = b.data.length, d, e = null, f = null, g = null, h = null, k; for (d = 0;d < c;d += 4) { - 0 !== a.data[d + 3] && (g = d / 4 % b, k = ~~(d / 4 / b), null === e && (e = k), null === f ? f = g : g < f && (f = g), null === h ? h = k : h < k && (h = k)); + 0 !== b.data[d + 3] && (g = d / 4 % a, k = ~~(d / 4 / a), null === e && (e = k), null === f ? f = g : g < f && (f = g), null === h ? h = k : h < k && (h = k)); } - b = h - e; - a = g - f; - c = null; - 0 === b || 0 === a ? (c = this.ctx.getImageData(0, 0, 1, 1), c.data[0] = 255, c.data[1] = 255, c.data[2] = 255, c.data[3] = 255, this.canvas_.width = 1, this.canvas_.height = 1) : (c = this.ctx.getImageData(f, e, a, b), this.canvas_.width = a, this.canvas_.height = b); - this.ctx_.putImageData(c, 0, 0); + a = h - e; + b = g - f; + 0 === a || 0 === b ? (e = this.ctx.getImageData(0, 0, 1, 1), e.data[0] = 255, e.data[1] = 255, e.data[2] = 255, e.data[3] = 255, this.canvas_.width = 1, this.canvas_.height = 1) : (e = this.ctx.getImageData(f, e, b, a), this.canvas_.width = b, this.canvas_.height = a); + this.ctx_.putImageData(e, 0, 0); }; -Entry.Painter.prototype.showInputField = function(b) { - this.inputField ? (Entry.dispatchEvent("textUpdate"), delete this.inputField) : (this.initCommand(), this.doCommand(), this.inputField = new CanvasInput({canvas:document.getElementById("entryPainterCanvas"), fontSize:20, fontFamily:this.font.name, fontColor:"#000", width:650, padding:8, borderWidth:1, borderColor:"#000", borderRadius:3, boxShadow:"1px 1px 0px #fff", innerShadow:"0px 0px 5px rgba(0, 0, 0, 0.5)", x:b.stageX, y:b.stageY, onsubmit:function() { +Entry.Painter.prototype.showInputField = function(a) { + this.inputField ? (Entry.dispatchEvent("textUpdate"), delete this.inputField) : (this.initCommand(), this.doCommand(), this.inputField = new CanvasInput({canvas:document.getElementById("entryPainterCanvas"), fontSize:20, fontFamily:this.font.name, fontColor:"#000", width:650, padding:8, borderWidth:1, borderColor:"#000", borderRadius:3, boxShadow:"1px 1px 0px #fff", innerShadow:"0px 0px 5px rgba(0, 0, 0, 0.5)", x:a.stageX, y:a.stageY, onsubmit:function() { Entry.dispatchEvent("textUpdate"); }}), this.inputField.show()); }; -Entry.Painter.prototype.addPicture = function(b) { +Entry.Painter.prototype.addPicture = function(a) { this.initCommand(); - var a = new Image; - a.id = Entry.generateHash(); - a.src = b.fileurl ? b.fileurl : Entry.defaultPath + "/uploads/" + b.filename.substring(0, 2) + "/" + b.filename.substring(2, 4) + "/image/" + b.filename + ".png"; + var b = new Image; + b.id = Entry.generateHash(); + b.src = a.fileurl ? a.fileurl : Entry.defaultPath + "/uploads/" + a.filename.substring(0, 2) + "/" + a.filename.substring(2, 4) + "/image/" + a.filename + ".png"; var c = this; - a.onload = function(a) { - c.addImage(a.target); + b.onload = function(b) { + c.addImage(b.target); c.selectToolbox("cursor"); }; }; Entry.Painter.prototype.initCoordinator = function() { - var b = new createjs.Container, a = new createjs.Bitmap(Entry.mediaFilePath + "/workspace_coordinate.png"); - b.addChild(a); - this.stage.addChild(b); - b.visible = !1; - this.coordinator = b; + var a = new createjs.Container, b = new createjs.Bitmap(Entry.mediaFilePath + "/workspace_coordinate.png"); + a.addChild(b); + this.stage.addChild(a); + a.visible = !1; + this.coordinator = a; }; Entry.Painter.prototype.toggleCoordinator = function() { this.coordinator.visible = !this.coordinator.visible; this.stage.update(); }; Entry.Painter.prototype.initDashedLine = function() { - createjs.Graphics.prototype.dashedLineTo = function(b, a, c, d, e) { - this.moveTo(b, a); - var f = c - b, g = d - a; + createjs.Graphics.prototype.dashedLineTo = function(a, b, c, d, e) { + this.moveTo(a, b); + var f = c - a, g = d - b; e = Math.floor(Math.sqrt(f * f + g * g) / e); for (var f = f / e, g = g / e, h = 0;h++ < e;) { - b += f, a += g, this[0 === h % 2 ? "moveTo" : "lineTo"](b, a); + a += f, b += g, this[0 === h % 2 ? "moveTo" : "lineTo"](a, b); } this[0 === h % 2 ? "moveTo" : "lineTo"](c, d); return this; }; - createjs.Graphics.prototype.drawDashedRect = function(b, a, c, d, e) { - this.moveTo(b, a); - c = b + c; - d = a + d; - this.dashedLineTo(b, a, c, a, e); - this.dashedLineTo(c, a, c, d, e); - this.dashedLineTo(c, d, b, d, e); - this.dashedLineTo(b, d, b, a, e); + createjs.Graphics.prototype.drawDashedRect = function(a, b, c, d, e) { + this.moveTo(a, b); + c = a + c; + d = b + d; + this.dashedLineTo(a, b, c, b, e); + this.dashedLineTo(c, b, c, d, e); + this.dashedLineTo(c, d, a, d, e); + this.dashedLineTo(a, d, a, b, e); return this; }; - createjs.Graphics.prototype.drawResizableDashedRect = function(b, a, c, d, e, f) { - this.moveTo(b, a); - c = b + c; - d = a + d; - this.dashedLineTo(b + f, a, c - f, a, e); - this.dashedLineTo(c, a + f, c, d - f, e); - this.dashedLineTo(c - f, d, b + f, d, e); - this.dashedLineTo(b, d - f, b, a + f, e); + createjs.Graphics.prototype.drawResizableDashedRect = function(a, b, c, d, e, f) { + this.moveTo(a, b); + c = a + c; + d = b + d; + this.dashedLineTo(a + f, b, c - f, b, e); + this.dashedLineTo(c, b + f, c, d - f, e); + this.dashedLineTo(c - f, d, a + f, d, e); + this.dashedLineTo(a, d - f, a, b + f, e); return this; }; }; -Entry.Painter.prototype.generateView = function(b) { - var a = this; - this.view_ = b; +Entry.Painter.prototype.generateView = function(a) { + var b = this; + this.view_ = a; if (!Entry.type || "workspace" == Entry.type) { this.view_.addClass("entryPainterWorkspace"); var c = Entry.createElement("div", "entryPainterTop"); @@ -9460,26 +11266,26 @@ Entry.Painter.prototype.generateView = function(b) { e = Entry.createElement("div", "entryPictureFlipX"); e.title = "\uc88c\uc6b0\ub4a4\uc9d1\uae30"; e.bindOnClick(function() { - a.selectedObject && (a.selectedObject.scaleX *= -1, a.selectedObject.text ? a.selectTextObject(a.selectedObject) : a.selectObject(a.selectedObject), a.updateImageHandle(), a.stage.update()); + b.selectedObject && (b.selectedObject.scaleX *= -1, b.selectedObject.text ? b.selectTextObject(b.selectedObject) : b.selectObject(b.selectedObject), b.updateImageHandle(), b.stage.update()); }); e.addClass("entryPlaygroundPainterFlipX"); this.flipObject.appendChild(e); e = Entry.createElement("div", "entryPictureFlipY"); e.title = "\uc0c1\ud558\ub4a4\uc9d1\uae30"; e.bindOnClick(function() { - a.selectedObject && (a.selectedObject.scaleY *= -1, a.selectedObject.text ? a.selectTextObject(a.selectedObject) : a.selectObject(a.selectedObject), a.updateImageHandle(), a.stage.update()); + b.selectedObject && (b.selectedObject.scaleY *= -1, b.selectedObject.text ? b.selectTextObject(b.selectedObject) : b.selectObject(b.selectedObject), b.updateImageHandle(), b.stage.update()); }); e.addClass("entryPlaygroundPainterFlipY"); this.flipObject.appendChild(e); - Entry.addEventListener("windowResized", function(a) { + Entry.addEventListener("windowResized", function(b) { var c = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; - a = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; - var d = parseInt(document.getElementById("entryCanvas").style.width), c = c - (d + 240), d = a - 349; - b.style.width = c + "px"; + b = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; + var d = parseInt(document.getElementById("entryCanvas").style.width), c = c - (d + 240), d = b - 349; + a.style.width = c + "px"; f.style.width = c - 54 + "px"; f.style.height = d + "px"; g.style.top = d + 30 + "px"; - g.style.height = a - d + "px"; + g.style.height = b - d + "px"; }); var h = Entry.createElement("nav", "entryPainterTopMenu"); h.addClass("entryPlaygroundPainterTopMenu"); @@ -9490,7 +11296,7 @@ Entry.Painter.prototype.generateView = function(b) { h.appendChild(k); h = Entry.createElement("a", "entryPainterTopMenuFileNew"); h.bindOnClick(function() { - a.newPicture(); + b.newPicture(); }); h.addClass("entryPlaygroundPainterTopMenuFileNew"); h.innerHTML = Lang.Workspace.new_picture; @@ -9505,7 +11311,7 @@ Entry.Painter.prototype.generateView = function(b) { k.appendChild(h); var l = Entry.createElement("a", "entryPainterTopMenuFileSave"); l.bindOnClick(function() { - a.file_save(!1); + b.file_save(!1); }); l.addClass("entryPainterTopMenuFileSave"); l.innerHTML = Lang.Workspace.painter_file_save; @@ -9514,8 +11320,8 @@ Entry.Painter.prototype.generateView = function(b) { k.appendChild(h); k = Entry.createElement("a", "entryPainterTopMenuFileSaveAs"); k.bindOnClick(function() { - a.file.mode = "new"; - a.file_save(!1); + b.file.mode = "new"; + b.file_save(!1); }); k.addClass("entryPlaygroundPainterTopMenuFileSaveAs"); k.innerHTML = Lang.Workspace.painter_file_saveas; @@ -9539,7 +11345,7 @@ Entry.Painter.prototype.generateView = function(b) { e.appendChild(k); h = Entry.createElement("a", "entryPainterTopMenuEditCopy"); h.bindOnClick(function() { - a.edit_copy(); + b.edit_copy(); }); h.addClass("entryPlaygroundPainterTopMenuEditCopy"); h.innerHTML = Lang.Workspace.copy_file; @@ -9548,7 +11354,7 @@ Entry.Painter.prototype.generateView = function(b) { e.appendChild(k); h = Entry.createElement("a", "entryPainterTopMenuEditCut"); h.bindOnClick(function() { - a.edit_cut(); + b.edit_cut(); }); h.addClass("entryPlaygroundPainterTopMenuEditCut"); h.innerHTML = Lang.Workspace.cut_picture; @@ -9557,7 +11363,7 @@ Entry.Painter.prototype.generateView = function(b) { e.appendChild(k); h = Entry.createElement("a", "entryPainterTopMenuEditPaste"); h.bindOnClick(function() { - a.edit_paste(); + b.edit_paste(); }); h.addClass("entryPlaygroundPainterTopMenuEditPaste"); h.innerHTML = Lang.Workspace.paste_picture; @@ -9568,7 +11374,7 @@ Entry.Painter.prototype.generateView = function(b) { e.addClass("entryPlaygroundPainterTopMenuEditEraseAll"); e.innerHTML = Lang.Workspace.remove_all; e.bindOnClick(function() { - a.clearCanvas(); + b.clearCanvas(); }); k.appendChild(e); this.painterTopStageXY = e = Entry.createElement("div", "entryPainterTopStageXY"); @@ -9593,69 +11399,69 @@ Entry.Painter.prototype.generateView = function(b) { this.toolboxCursor = Entry.createElement("li", "entryPainterToolboxCursor"); this.toolboxCursor.title = "\uc774\ub3d9"; this.toolboxCursor.bindOnClick(function() { - a.selectToolbox("cursor"); + b.selectToolbox("cursor"); }); this.toolboxCursor.addClass("entryPlaygroundPainterToolboxCursor"); c.appendChild(this.toolboxCursor); this.toolboxSelect = Entry.createElement("li", "entryPainterToolboxSelect"); this.toolboxSelect.title = "\uc790\ub974\uae30"; this.toolboxSelect.bindOnClick(function() { - a.selectToolbox("select"); + b.selectToolbox("select"); }); this.toolboxSelect.addClass("entryPlaygroundPainterToolboxSelect"); c.appendChild(this.toolboxSelect); this.toolboxPen = Entry.createElement("li", "entryPainterToolboxPen"); this.toolboxPen.title = "\ud39c"; this.toolboxPen.bindOnClick(function() { - a.selectToolbox("pen"); + b.selectToolbox("pen"); }); this.toolboxPen.addClass("entryPlaygroundPainterToolboxPen"); c.appendChild(this.toolboxPen); this.toolboxLine = Entry.createElement("li", "entryPainterToolboxLine"); this.toolboxLine.title = "\uc9c1\uc120"; this.toolboxLine.bindOnClick(function() { - a.selectToolbox("line"); + b.selectToolbox("line"); }); this.toolboxLine.addClass("entryPlaygroundPainterToolboxLine"); c.appendChild(this.toolboxLine); this.toolboxRect = Entry.createElement("li", "entryPainterToolboxRect"); this.toolboxRect.title = "\uc0ac\uac01\ud615"; this.toolboxRect.bindOnClick(function() { - a.selectToolbox("rect"); + b.selectToolbox("rect"); }); this.toolboxRect.addClass("entryPlaygroundPainterToolboxRect"); c.appendChild(this.toolboxRect); this.toolboxCircle = Entry.createElement("li", "entryPainterToolboxCircle"); this.toolboxCircle.title = "\uc6d0"; this.toolboxCircle.bindOnClick(function() { - a.selectToolbox("circle"); + b.selectToolbox("circle"); }); this.toolboxCircle.addClass("entryPlaygroundPainterToolboxCircle"); c.appendChild(this.toolboxCircle); this.toolboxText = Entry.createElement("li", "entryPainterToolboxText"); this.toolboxText.title = "\uae00\uc0c1\uc790"; this.toolboxText.bindOnClick(function() { - a.selectToolbox("text"); + b.selectToolbox("text"); }); this.toolboxText.addClass("entryPlaygroundPainterToolboxText"); c.appendChild(this.toolboxText); this.toolboxFill = Entry.createElement("li", "entryPainterToolboxFill"); this.toolboxFill.bindOnClick(function() { - a.selectToolbox("fill"); + b.selectToolbox("fill"); }); this.toolboxFill.addClass("entryPlaygroundPainterToolboxFill"); c.appendChild(this.toolboxFill); this.toolboxErase = Entry.createElement("li", "entryPainterToolboxErase"); this.toolboxErase.title = "\uc9c0\uc6b0\uae30"; this.toolboxErase.bindOnClick(function() { - a.selectToolbox("erase"); + b.selectToolbox("erase"); }); this.toolboxErase.addClass("entryPlaygroundPainterToolboxErase"); c.appendChild(this.toolboxErase); d = Entry.createElement("li", "entryPainterToolboxCoordinate"); d.title = "\uc88c\ud45c"; d.bindOnClick(function() { - a.toggleCoordinator(); + b.toggleCoordinator(); }); d.addClass("entryPlaygroundPainterToolboxCoordinate"); c.appendChild(d); @@ -9680,8 +11486,8 @@ Entry.Painter.prototype.generateView = function(b) { if (isNaN(this.value)) { return alert("\uc22b\uc790\ub9cc \uc785\ub825 \uac00\ub2a5\ud569\ub2c8\ub2e4."), !1; } - a.handle.width = this.value; - a.updateImageHandle(); + b.handle.width = this.value; + b.updateImageHandle(); }; this.objectWidthInput.addClass("entryPlaygroundPainterNumberInput"); c.appendChild(this.objectWidthInput); @@ -9701,8 +11507,8 @@ Entry.Painter.prototype.generateView = function(b) { if (isNaN(this.value)) { return alert("\uc22b\uc790\ub9cc \uc785\ub825 \uac00\ub2a5\ud569\ub2c8\ub2e4."), !1; } - a.handle.height = this.value; - a.updateImageHandle(); + b.handle.height = this.value; + b.updateImageHandle(); }; this.objectHeightInput.addClass("entryPlaygroundPainterNumberInput"); c.appendChild(this.objectHeightInput); @@ -9726,8 +11532,8 @@ Entry.Painter.prototype.generateView = function(b) { return alert("\uc22b\uc790\ub9cc \uc785\ub825 \uac00\ub2a5\ud569\ub2c8\ub2e4."), !1; } 360 <= this.value ? this.value %= 360 : 0 > this.value && (this.value = 360 + this.value % 360); - a.handle.rotation = this.value; - a.updateImageHandle(); + b.handle.rotation = this.value; + b.updateImageHandle(); }; this.objectRotateInput.addClass("entryPlaygroundPainterNumberInput"); this.objectRotateInput.defaultValue = "0"; @@ -9745,10950 +11551,9315 @@ Entry.Painter.prototype.generateView = function(b) { d.addClass("painterAttrCircle"); this.attrCircleArea.appendChild(d); this.attrCircleArea.painterAttrCircle = d; - d = Entry.createElement("input", "entryPainterAttrCircleInput"); - d.value = "#000000"; - d.addClass("painterAttrCircleInput"); - this.attrCircleArea.appendChild(d); - this.attrColorSpoid = Entry.createElement("div"); - this.attrColorSpoid.bindOnClick(function() { - a.selectToolbox("spoid"); - }); - this.attrColorSpoid.addClass("painterAttrColorSpoid"); - g.appendChild(this.attrColorSpoid); - Entry.getColourCodes().forEach(function(b) { - var c = Entry.createElement("div"); - c.addClass("entryPlaygroundPainterAttrColorElement"); - "transparent" === b ? c.style.backgroundImage = "url(" + (Entry.mediaFilePath + "/transparent.png") + ")" : c.style.backgroundColor = b; - c.bindOnClick(function(c) { - "transparent" === b ? (a.stroke.transparent = !0, a.stroke.lineColor = "#ffffff") : (a.stroke.transparent = !1, r && (document.getElementById("entryPainterShapeBackgroundColor").style.backgroundColor = b, a.stroke.fillColor = b), r || (document.getElementById("entryPainterShapeLineColor").style.backgroundColor = b, a.stroke.lineColor = b)); - document.getElementById("entryPainterAttrCircle").style.backgroundColor = a.stroke.lineColor; - document.getElementById("entryPainterAttrCircleInput").value = b; - }); - n.appendChild(c); - }); - this.attrThickArea = Entry.createElement("div", "painterAttrThickArea"); - this.attrThickArea.addClass("entryPlaygroundentryPlaygroundPainterAttrThickArea"); - g.appendChild(this.attrThickArea); - d = Entry.createElement("legend"); - d.addClass("painterAttrThickName"); - d.innerHTML = Lang.Workspace.thickness; - this.attrThickArea.appendChild(d); - var m = Entry.createElement("fieldset", "entryPainterAttrThick"); - m.addClass("entryPlaygroundPainterAttrThick"); - this.attrThickArea.appendChild(m); - d = Entry.createElement("div"); - d.addClass("paintAttrThickTop"); - m.appendChild(d); - e = Entry.createElement("select", "entryPainterAttrThick"); - e.addClass("entryPlaygroundPainterAttrThickInput"); - e.size = "1"; - e.onchange = function(b) { - a.stroke.thickness = b.target.value; - }; - for (d = 1;10 >= d;d++) { - c = Entry.createElement("option"), c.value = d, c.innerHTML = d, e.appendChild(c); - } - m.appendChild(e); - d = Entry.createElement("div", "entryPainterShapeLineColor"); - d.addClass("painterAttrShapeLineColor"); - c = Entry.createElement("div", "entryPainterShapeInnerBackground"); - c.addClass("painterAttrShapeInnerBackground"); - d.appendChild(c); - m.appendChild(d); - this.attrThickArea.painterAttrShapeLineColor = d; - m.bindOnClick(function() { - q.style.zIndex = "1"; - this.style.zIndex = "10"; - r = !1; - }); - this.attrBackgroundArea = Entry.createElement("div", "painterAttrBackgroundArea"); - this.attrBackgroundArea.addClass("entryPlaygroundPainterBackgroundArea"); - g.appendChild(this.attrBackgroundArea); - d = Entry.createElement("fieldset", "entryPainterAttrbackground"); - d.addClass("entryPlaygroundPainterAttrBackground"); - this.attrBackgroundArea.appendChild(d); - c = Entry.createElement("div"); - c.addClass("paintAttrBackgroundTop"); - d.appendChild(c); - var q = Entry.createElement("div", "entryPainterShapeBackgroundColor"); - q.addClass("painterAttrShapeBackgroundColor"); - this.attrBackgroundArea.painterAttrShapeBackgroundColor = q; - c.appendChild(q); - var r = !1; - q.bindOnClick(function(a) { - m.style.zIndex = "1"; - this.style.zIndex = "10"; - r = !0; - }); - this.attrFontArea = Entry.createElement("div", "painterAttrFont"); - this.attrFontArea.addClass("entryPlaygroundPainterAttrFont"); - g.appendChild(this.attrFontArea); - e = Entry.createElement("div"); - e.addClass("entryPlaygroundPainterAttrTop"); - this.attrFontArea.appendChild(e); - d = Entry.createElement("div"); - d.addClass("entryPlaygroundPaintAttrTop_"); - e.appendChild(d); - d = Entry.createElement("legend"); - d.addClass("panterAttrFontTitle"); - d.innerHTML = Lang.Workspace.textStyle; - k = Entry.createElement("select", "entryPainterAttrFontName"); - k.addClass("entryPlaygroundPainterAttrFontName"); - k.size = "1"; - k.onchange = function(b) { - a.font.name = b.target.value; - }; - for (d = 0;d < Entry.fonts.length;d++) { - h = Entry.fonts[d], c = Entry.createElement("option"), c.value = h.family, c.innerHTML = h.name, k.appendChild(c); - } - e.appendChild(k); - e = Entry.createElement("div"); - e.addClass("painterAttrFontSizeArea"); - this.attrFontArea.appendChild(e); - d = Entry.createElement("div"); - d.addClass("painterAttrFontSizeTop"); - e.appendChild(d); - k = Entry.createElement("select", "entryPainterAttrFontSize"); - k.addClass("entryPlaygroundPainterAttrFontSize"); - k.size = "1"; - k.onchange = function(b) { - a.font.size = b.target.value; - }; - for (d = 20;72 >= d;d++) { - c = Entry.createElement("option"), c.value = d, c.innerHTML = d, k.appendChild(c); - } - e.appendChild(k); - e = Entry.createElement("div"); - e.addClass("entryPlaygroundPainterAttrFontStyleArea"); - this.attrFontArea.appendChild(e); - d = Entry.createElement("div"); - d.addClass("entryPlaygroundPainterAttrFontTop"); - e.appendChild(d); - k = Entry.createElement("select", "entryPainterAttrFontStyle"); - k.addClass("entryPlaygroundPainterAttrFontStyle"); - k.size = "1"; - k.onchange = function(b) { - a.font.style = b.target.value; - }; - h = [{label:"\ubcf4\ud1b5", value:"normal"}, {label:"\uad75\uac8c", value:"bold"}, {label:"\uae30\uc6b8\uc784", value:"italic"}]; - for (d = 0;d < h.length;d++) { - l = h[d], c = Entry.createElement("option"), c.value = l.value, c.innerHTML = l.label, k.appendChild(c); - } - e.appendChild(k); - this.attrLineArea = Entry.createElement("div", "painterAttrLineStyle"); - this.attrLineArea.addClass("entryPlaygroundPainterAttrLineStyle"); - g.appendChild(this.attrLineArea); - var t = Entry.createElement("div"); - t.addClass("entryPlaygroundPainterAttrLineStyleLine"); - this.attrLineArea.appendChild(t); - var u = Entry.createElement("div"); - u.addClass("entryPlaygroundPaitnerAttrLineArea"); - this.attrLineArea.appendChild(u); - d = Entry.createElement("div"); - d.addClass("entryPlaygroundPainterAttrLineStyleLine1"); - u.appendChild(d); - d.value = "line"; - var v = Entry.createElement("div"); - v.addClass("painterAttrLineStyleBackgroundLine"); - t.bindOnClick(function(a) { - u.removeClass("entryRemove"); - }); - u.blur = function(a) { - this.addClass("entryRemove"); - }; - u.onmouseleave = function(a) { - this.addClass("entryRemove"); - }; - d.bindOnClick(function(a) { - this.attrLineArea.removeClass(t); - this.attrLineArea.appendChild(v); - this.attrLineArea.onchange(a); - u.blur(); - }); - v.bindOnClick(function(a) { - u.removeClass("entryRemove"); - }); - this.attrLineArea.onchange = function(b) { - a.stroke.style = b.target.value; - }; - u.blur(); - } -}; -Entry.Painter.prototype.restoreHandle = function() { - this.selectedObject && !1 === this.handle.visible && (this.handle.visible = !0, this.stage.update()); -}; -Entry.Painter.prototype.initDisplay = function() { - this.stroke.enabled = !1; - this.toolboxCursor.addClass("entryPlaygroundPainterToolboxCursor"); - this.toolboxCursor.removeClass("entryToolboxCursorClicked"); - this.toolboxSelect.addClass("entryPlaygroundPainterToolboxSelect"); - this.toolboxSelect.removeClass("entryToolboxSelectClicked"); - this.toolboxPen.addClass("entryPlaygroundPainterToolboxPen"); - this.toolboxPen.removeClass("entryToolboxPenClicked"); - this.toolboxLine.addClass("entryPlaygroundPainterToolboxLine"); - this.toolboxLine.removeClass("entryToolboxLineClicked"); - this.toolboxRect.addClass("entryPlaygroundPainterToolboxRect"); - this.toolboxRect.removeClass("entryToolboxRectClicked"); - this.toolboxCircle.addClass("entryPlaygroundPainterToolboxCircle"); - this.toolboxCircle.removeClass("entryToolBoxCircleClicked"); - this.toolboxText.addClass("entryPlaygroundPainterToolboxText"); - this.toolboxText.removeClass("entryToolBoxTextClicked"); - this.toolboxFill.addClass("entryPlaygroundPainterToolboxFill"); - this.toolboxFill.removeClass("entryToolBoxFillClicked"); - this.toolboxErase.addClass("entryPlaygroundPainterToolboxErase"); - this.toolboxErase.removeClass("entryToolBoxEraseClicked"); - this.attrColorSpoid.addClass("painterAttrColorSpoid"); - this.attrColorSpoid.removeClass("painterAttrColorSpoidClicked"); - this.attrResizeArea.addClass("entryRemove"); - this.attrRotateArea.addClass("entryRemove"); - this.attrThickArea.addClass("entryRemove"); - this.attrFontArea.addClass("entryRemove"); - this.attrLineArea.addClass("entryRemove"); - this.attrColorArea.addClass("entryRemove"); - this.attrCircleArea.addClass("entryRemove"); - this.attrColorSpoid.addClass("entryRemove"); - this.attrFontArea.addClass("entryRemove"); - this.attrBackgroundArea.addClass("entryRemove"); - this.flipObject.addClass("entryRemove"); - this.attrThickArea.painterAttrShapeLineColor.addClass("entryRemove"); - this.attrBackgroundArea.painterAttrShapeBackgroundColor.addClass("entryRemove"); - this.attrCircleArea.painterAttrCircle.addClass("entryRemove"); - this.inputField && !this.inputField._isHidden && (this.inputField.hide(), this.stage.update()); -}; -Entry.Painter.prototype.selectToolbox = function(b) { - this.toolbox.selected = b; - "erase" != b && $(".entryPlaygroundPainterContainer").removeClass("dd"); - this.initDisplay(); - "cursor" !== b && this.clearHandle(); - "text" !== b && this.inputField && delete this.inputField; - switch(b) { - case "cursor": - this.restoreHandle(); - this.toolboxCursor.addClass("entryToolboxCursorClicked"); - this.attrResizeArea.removeClass("entryRemove"); - this.attrRotateArea.removeClass("entryRemove"); - this.flipObject.removeClass("entryRemove"); - break; - case "select": - this.toolboxSelect.addClass("entryToolboxSelectClicked"); - break; - case "pen": - this.toolboxPen.addClass("entryToolboxPenClicked"); - this.attrThickArea.removeClass("entryRemove"); - this.attrColorArea.removeClass("entryRemove"); - this.attrCircleArea.removeClass("entryRemove"); - this.attrColorSpoid.removeClass("entryRemove"); - this.attrThickArea.painterAttrShapeLineColor.removeClass("entryRemove"); - break; - case "line": - this.toolboxLine.addClass("entryToolboxLineClicked"); - this.attrThickArea.removeClass("entryRemove"); - this.attrColorArea.removeClass("entryRemove"); - this.attrCircleArea.removeClass("entryRemove"); - this.attrColorSpoid.removeClass("entryRemove"); - this.attrThickArea.painterAttrShapeLineColor.removeClass("entryRemove"); - break; - case "rect": - this.toolboxRect.addClass("entryToolboxRectClicked"); - this.attrThickArea.removeClass("entryRemove"); - this.attrColorArea.removeClass("entryRemove"); - this.attrCircleArea.removeClass("entryRemove"); - this.attrColorSpoid.removeClass("entryRemove"); - this.attrBackgroundArea.removeClass("entryRemove"); - this.attrThickArea.painterAttrShapeLineColor.removeClass("entryRemove"); - this.attrBackgroundArea.painterAttrShapeBackgroundColor.removeClass("entryRemove"); - break; - case "circle": - this.toolboxCircle.addClass("entryToolBoxCircleClicked"); - this.attrThickArea.removeClass("entryRemove"); - this.attrColorArea.removeClass("entryRemove"); - this.attrCircleArea.removeClass("entryRemove"); - this.attrColorSpoid.removeClass("entryRemove"); - this.attrThickArea.painterAttrShapeLineColor.removeClass("entryRemove"); - this.attrBackgroundArea.removeClass("entryRemove"); - this.attrBackgroundArea.painterAttrShapeBackgroundColor.removeClass("entryRemove"); - break; - case "text": - this.toolboxText.addClass("entryToolBoxTextClicked"); - this.attrFontArea.removeClass("entryRemove"); - this.attrColorArea.removeClass("entryRemove"); - this.attrCircleArea.removeClass("entryRemove"); - this.attrColorSpoid.removeClass("entryRemove"); - this.attrCircleArea.painterAttrCircle.removeClass("entryRemove"); - break; - case "fill": - this.toolboxFill.addClass("entryToolBoxFillClicked"); - this.attrColorArea.removeClass("entryRemove"); - this.attrCircleArea.removeClass("entryRemove"); - this.attrColorSpoid.removeClass("entryRemove"); - this.attrCircleArea.painterAttrCircle.removeClass("entryRemove"); - break; - case "erase": - $(".entryPlaygroundPainterContainer").addClass("dd"); - this.toolboxErase.addClass("entryToolBoxEraseClicked"); - this.attrThickArea.removeClass("entryRemove"); - break; - case "spoid": - this.attrColorArea.removeClass("entryRemove"); - this.attrCircleArea.removeClass("entryRemove"); - this.attrColorSpoid.removeClass("entryRemove"); - this.attrColorSpoid.removeClass("painterAttrColorSpoid"); - this.attrColorSpoid.addClass("painterAttrColorSpoidClicked"); - break; - case "coordinate": - this.toggleCoordinator(); - } -}; -Entry.BlockParser = function(b) { - this.syntax = b; - this._iterVariableCount = 0; - this._iterVariableChunk = ["i", "j", "k"]; -}; -(function(b) { - b.Code = function(a) { - if (a instanceof Entry.Thread) { - return this.Thread(a); - } - if (a instanceof Entry.Block) { - return this.Block(a); - } - var b = ""; - a = a.getThreads(); - for (var d = 0;d < a.length;d++) { - b += this.Thread(a[d]); - } - return b; - }; - b.Thread = function(a) { - if (a instanceof Entry.Block) { - return this.Block(a); - } - var b = ""; - a = a.getBlocks(); - for (var d = 0;d < a.length;d++) { - b += this.Block(a[d]); - } - return b; - }; - b.Block = function(a) { - var b = a._schema.syntax; - return b ? this[b[0]](a) : ""; - }; - b.Program = function(a) { - return ""; - }; - b.Scope = function(a) { - a = a._schema.syntax.concat(); - return a.splice(1, a.length - 1).join(".") + "();\n"; - }; - b.BasicFunction = function(a) { - a = this.Thread(a.statements[0]); - return "function promise() {\n" + this.indent(a) + "}\n"; - }; - b.BasicIteration = function(a) { - var b = a.params[0], d = this.publishIterateVariable(); - a = this.Thread(a.statements[0]); - this.unpublishIterateVariable(); - return "for (var " + d + " = 0; " + d + " < " + b + "; " + d + "++){\n" + this.indent(a) + "}\n"; - }; - b.BasicIf = function(a) { - var b = this.Thread(a.statements[0]); - return "if (" + a._schema.syntax.concat()[1] + ") {\n" + this.indent(b) + "}\n"; - }; - b.BasicWhile = function(a) { - var b = this.Thread(a.statements[0]); - return "while (" + a._schema.syntax.concat()[1] + ") {\n" + this.indent(b) + "}\n"; - }; - b.indent = function(a) { - var b = " "; - a = a.split("\n"); - a.pop(); - return b += a.join("\n ") + "\n"; - }; - b.publishIterateVariable = function() { - var a = "", b = this._iterVariableCount; - do { - a = this._iterVariableChunk[b % 3] + a, b = parseInt(b / 3) - 1, 0 === b && (a = this._iterVariableChunk[0] + a); - } while (0 < b); - this._iterVariableCount++; - return a; - }; - b.unpublishIterateVariable = function() { - this._iterVariableCount && this._iterVariableCount--; - }; -})(Entry.BlockParser.prototype); -Entry.JSParser = function(b) { - this.syntax = b; - this.scopeChain = []; - this.scope = null; -}; -(function(b) { - b.Program = function(a) { - var b = [], d = []; - d.push({type:this.syntax.Program}); - var e = this.initScope(a), d = d.concat(this.BlockStatement(a)); - this.unloadScope(); - b.push(d); - return b = b.concat(e); - }; - b.Identifier = function(a, b) { - return b ? b[a.name] : this.scope[a.name]; - }; - b.ExpressionStatement = function(a) { - a = a.expression; - return this[a.type](a); - }; - b.ForStatement = function(a) { - var b = a.init, d = a.test, e = a.update, f = a.body; - if (this.syntax.ForStatement) { - throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - } - var f = this[f.type](f), b = b.declarations[0].init.value, g = d.operator, d = d.right.value, h = 0; - "++" != e.operator && (e = b, b = d, d = e); - switch(g) { - case "<": - h = d - b; - break; - case "<=": - h = d + 1 - b; - break; - case ">": - h = b - d; - break; - case ">=": - h = b + 1 - d; - } - return this.BasicIteration(a, h, f); - }; - b.BlockStatement = function(a) { - var b = []; - a = a.body; - for (var d = 0;d < a.length;d++) { - var e = a[d], f = this[e.type](e); - if (f) { - if (void 0 === f.type) { - throw {message:"\ud574\ub2f9\ud558\ub294 \ube14\ub85d\uc774 \uc5c6\uc2b5\ub2c8\ub2e4.", node:e}; - } - f && b.push(f); - } - } - return b; - }; - b.EmptyStatement = function(a) { - throw {message:"empty\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.DebuggerStatement = function(a) { - throw {message:"debugger\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.WithStatement = function(a) { - throw {message:"with\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.ReturnStaement = function(a) { - throw {message:"return\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.LabeledStatement = function(a) { - throw {message:"label\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.BreakStatement = function(a) { - throw {message:"break\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.ContinueStatement = function(a) { - throw {message:"continue\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.IfStatement = function(a) { - if (this.syntax.IfStatement) { - throw {message:"if\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - } - return this.BasicIf(a); - }; - b.SwitchStatement = function(a) { - throw {message:"switch\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.SwitchCase = function(a) { - throw {message:"switch ~ case\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.ThrowStatement = function(a) { - throw {message:"throw\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.TryStatement = function(a) { - throw {message:"try\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.CatchClause = function(a) { - throw {message:"catch\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.WhileStatement = function(a) { - var b = a.body, d = this.syntax.WhileStatement, b = this[b.type](b); - if (d) { - throw {message:"while\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - } - return this.BasicWhile(a, b); - }; - b.DoWhileStatement = function(a) { - throw {message:"do ~ while\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.ForInStatement = function(a) { - throw {message:"for ~ in\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.FunctionDeclaration = function(a) { - if (this.syntax.FunctionDeclaration) { - throw {message:"function\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - } - return null; - }; - b.VariableDeclaration = function(a) { - throw {message:"var\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.ThisExpression = function(a) { - return this.scope.this; - }; - b.ArrayExpression = function(a) { - throw {message:"array\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.ObjectExpression = function(a) { - throw {message:"object\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.Property = function(a) { - throw {message:"init, get, set\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.FunctionExpression = function(a) { - throw {message:"function\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.UnaryExpression = function(a) { - throw {message:a.operator + "\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub839\uc5b4 \uc785\ub2c8\ub2e4.", node:a}; - }; - b.UnaryOperator = function() { - return "- + ! ~ typeof void delete".split(" "); - }; - b.updateOperator = function() { - return ["++", "--"]; - }; - b.BinaryOperator = function() { - return "== != === !== < <= > >= << >> >>> + - * / % , ^ & in instanceof".split(" "); - }; - b.AssignmentExpression = function(a) { - throw {message:a.operator + "\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub839\uc5b4 \uc785\ub2c8\ub2e4.", node:a}; - }; - b.AssignmentOperator = function() { - return "= += -= *= /= %= <<= >>= >>>= ,= ^= &=".split(" "); - }; - b.LogicalExpression = function(a) { - throw {message:a.operator + "\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub839\uc5b4 \uc785\ub2c8\ub2e4.", node:a}; - }; - b.LogicalOperator = function() { - return ["||", "&&"]; - }; - b.MemberExpression = function(a) { - var b = a.object, d = a.property; - console.log(b.type); - b = this[b.type](b); - console.log(b); - d = this[d.type](d, b); - if (Object(b) !== b || Object.getPrototypeOf(b) !== Object.prototype) { - throw {message:b + "\uc740(\ub294) \uc798\ubabb\ub41c \uba64\ubc84 \ubcc0\uc218\uc785\ub2c8\ub2e4.", node:a}; - } - b = d; - if (!b) { - throw {message:d + "\uc774(\uac00) \uc874\uc7ac\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.", node:a}; - } - return b; - }; - b.ConditionalExpression = function(a) { - throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.UpdateExpression = function(a) { - throw {message:a.operator + "\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub801\uc5b4 \uc785\ub2c8\ub2e4.", node:a}; - }; - b.CallExpression = function(a) { - a = a.callee; - return {type:this[a.type](a)}; - }; - b.NewExpression = function(a) { - throw {message:"new\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - }; - b.SequenceExpression = function(a) { - throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", 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 < a.length;d++) { - var e = a[d]; - "FunctionDeclaration" === e.type && (this.scope[e.id.name] = this.scope.promise, this.syntax.BasicFunction && (e = e.body, b.push([{type:this.syntax.BasicFunction, statements:[this[e.type](e)]}]))); - } - return b; - }; - b.BasicFunction = function(a, b) { - return null; - }; - b.BasicIteration = function(a, b, d) { - var e = this.syntax.BasicIteration; - if (!e) { - throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a}; - } - return {params:[b], type:e, statements:[d]}; - }; - b.BasicWhile = function(a, b) { - var d = a.test.raw; - if (this.syntax.BasicWhile[d]) { - return {type:this.syntax.BasicWhile[d], statements:[b]}; - } - throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a.test}; - }; - b.BasicIf = function(a) { - var b = a.consequent, b = this[b.type](b); - try { - var d = "", e = "===" === a.test.operator ? "==" : a.test.operator; - if ("Identifier" === a.test.left.type && "Literal" === a.test.right.type) { - d = a.test.left.name + " " + e + " " + a.test.right.raw; - } else { - if ("Literal" === a.test.left.type && "Identifier" === a.test.right.type) { - d = a.test.right.name + " " + e + " " + a.test.left.raw; - } else { - throw Error(); - } - } - if (this.syntax.BasicIf[d]) { - return Array.isArray(b) || "object" !== typeof b || (b = [b]), {type:this.syntax.BasicIf[d], statements:[b]}; - } - throw Error(); - } catch (f) { - throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:a.test}; - } - }; -})(Entry.JSParser.prototype); -Entry.Parser = function(b, a, c) { - this._mode = b; - this.syntax = {}; - 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)); - this.mappingSyntax(b); - switch(this._lang) { - case "js": - this._parser = new Entry.JSParser(this.syntax); - a = this.syntax; - var d = {}, e; - for (e in a.Scope) { - d[e + "();\n"] = a.Scope[e]; - } - "BasicIf" in a && (d.front = "BasicIf"); - CodeMirror.commands.javascriptComplete = function(a) { - CodeMirror.showHint(a, null, {globalScope:d}); - }; - c.on("keyup", function(a, b) { - !a.state.completionActive && 65 <= b.keyCode && 95 >= 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 < b.indexOf("function") ? b + a : a + b; - return d + "\n"; - }) : ""; - } - return b; - }; - b.getLineNumber = function(a, b) { - var d = this.codeMirror.getValue(), e = {from:{}, to:{}}, f = d.substring(0, a).split(/\n/gi); - e.from.line = f.length - 1; - e.from.ch = f[f.length - 1].length; - d = d.substring(0, b).split(/\n/gi); - e.to.line = d.length - 1; - e.to.ch = d[d.length - 1].length; - return e; - }; - b.mappingSyntax = function(a) { - for (var b = Object.keys(Entry.block), d = 0;d < b.length;d++) { - var e = b[d], f = Entry.block[e]; - if (f.mode === a && -1 < this.availableCode.indexOf(e) && (f = f.syntax)) { - for (var g = this.syntax, h = 0;h < f.length;h++) { - var k = f[h]; - if (h === f.length - 2 && "function" === typeof f[h + 1]) { - g[k] = f[h + 1]; - break; - } - g[k] || (g[k] = {}); - h === f.length - 1 ? g[k] = e : g = g[k]; - } - } - } - }; - b.setAvailableCode = function(a, b) { - var d = []; - a.forEach(function(a, b) { - a.forEach(function(a, b) { - d.push(a.type); - }); - }); - b instanceof Entry.Code ? b.getBlockList().forEach(function(a) { - a.type !== NtryData.START && -1 === d.indexOf(a.type) && d.push(a.type); - }) : b.forEach(function(a, b) { - a.forEach(function(a, b) { - a.type !== NtryData.START && -1 === d.indexOf(a.type) && d.push(a.type); - }); - }); - this.availableCode = this.availableCode.concat(d); - }; -})(Entry.Parser.prototype); -Entry.Pdf = function(b) { - this.generateView(b); -}; -p = Entry.Pdf.prototype; -p.generateView = function(b) { - var a = Entry.createElement("div", "entryPdfWorkspace"); - a.addClass("entryRemove"); - this._view = a; - var c = "/pdfjs/web/viewer.html"; - b && "" != b && (c += "?file=" + b); - pdfViewIframe = Entry.createElement("iframe", "entryPdfIframeWorkspace"); - pdfViewIframe.setAttribute("id", "pdfViewIframe"); - pdfViewIframe.setAttribute("frameborder", 0); - pdfViewIframe.setAttribute("src", c); - a.appendChild(pdfViewIframe); -}; -p.getView = function() { - return this._view; -}; -p.resize = function() { - var b = document.getElementById("entryContainerWorkspaceId"), a = document.getElementById("pdfViewIframe"); - w = b.offsetWidth; - a.width = w + "px"; - a.height = 9 * w / 16 + "px"; -}; -Entry.Popup = function() { - Entry.assert(!window.popup, "Popup exist"); - this.body_ = Entry.createElement("div"); - this.body_.addClass("entryPopup"); - this.body_.bindOnClick(function(b) { - b.target == this && this.popup.remove(); - }); - this.body_.popup = this; - document.body.appendChild(this.body_); - this.window_ = Entry.createElement("div"); - this.window_.addClass("entryPopupWindow"); - "tablet" === Entry.device && this.window_.addClass("tablet"); - this.window_.bindOnClick(function() { - }); - Entry.addEventListener("windowResized", this.resize); - window.popup = this; - this.resize(); - this.body_.appendChild(this.window_); -}; -Entry.Popup.prototype.remove = function() { - for (;this.window_.hasChildNodes();) { - "workspace" == Entry.type ? Entry.view_.insertBefore(this.window_.firstChild, Entry.container.view_) : Entry.view_.insertBefore(this.window_.lastChild, Entry.view_.firstChild); - } - $("body").css("overflow", "auto"); - Entry.removeElement(this.body_); - window.popup = null; - Entry.removeEventListener("windowResized", this.resize); - Entry.engine.popup = null; -}; -Entry.Popup.prototype.resize = function(b) { - b = window.popup.window_; - var a = .9 * window.innerWidth, c = .9 * window.innerHeight - 35; - 9 * a <= 16 * c ? c = a / 16 * 9 : a = 16 * c / 9; - b.style.width = String(a) + "px"; - b.style.height = String(c + 35) + "px"; -}; -Entry.popupHelper = function(b) { - this.popupList = {}; - this.nowContent; - b && (window.popupHelper = null); - Entry.assert(!window.popupHelper, "Popup exist"); - var a = ["confirm", "spinner"], c = ["entryPopupHelperTopSpan", "entryPopupHelperBottomSpan", "entryPopupHelperLeftSpan", "entryPopupHelperRightSpan"]; - this.body_ = Entry.Dom("div", {classes:["entryPopup", "hiddenPopup", "popupHelper"]}); - var d = this; - this.body_.bindOnClick(function(b) { - if (!(d.nowContent && -1 < a.indexOf(d.nowContent.prop("type")))) { - var f = $(b.target); - c.forEach(function(a) { - f.hasClass(a) && this.popup.hide(); - }.bind(this)); - b.target == this && this.popup.hide(); - } - }); - this.body_.bind("touchstart", function(b) { - if (!(d.nowContent && -1 < a.indexOf(d.nowContent.prop("type")))) { - var f = $(b.target); - c.forEach(function(a) { - f.hasClass(a) && this.popup.hide(); - }.bind(this)); - b.target == this && this.popup.hide(); - } - }); - window.popupHelper = this; - this.body_.prop("popup", this); - Entry.Dom("div", {class:"entryPopupHelperTopSpan", parent:this.body_}); - b = Entry.Dom("div", {class:"entryPopupHelperMiddleSpan", parent:this.body_}); - Entry.Dom("div", {class:"entryPopupHelperBottomSpan", parent:this.body_}); - Entry.Dom("div", {class:"entryPopupHelperLeftSpan", parent:b}); - this.window_ = Entry.Dom("div", {class:"entryPopupHelperWindow", parent:b}); - Entry.Dom("div", {class:"entryPopupHelperRightSpan", parent:b}); - $("body").append(this.body_); -}; -Entry.popupHelper.prototype.clearPopup = function() { - for (var b = this.popupWrapper_.children.length - 1;2 < b;b--) { - this.popupWrapper_.removeChild(this.popupWrapper_.children[b]); - } -}; -Entry.popupHelper.prototype.addPopup = function(b, a) { - var c = Entry.Dom("div"), d = Entry.Dom("div", {class:"entryPopupHelperCloseButton"}); - d.bindOnClick(function() { - a.closeEvent ? a.closeEvent(this) : this.hide(); - }.bind(this)); - var e = this; - d.bind("touchstart", function() { - a.closeEvent ? a.closeEvent(e) : e.hide(); - }); - var f = Entry.Dom("div", {class:"entryPopupHelperWrapper"}); - f.append(d); - a.title && (d = Entry.Dom("div", {class:"entryPopupHelperTitle"}), f.append(d), d.text(a.title)); - c.addClass(b); - c.append(f); - c.popupWrapper_ = f; - c.prop("type", a.type); - "function" === typeof a.setPopupLayout && a.setPopupLayout(c); - this.popupList[b] = c; -}; -Entry.popupHelper.prototype.hasPopup = function(b) { - return !!this.popupList[b]; -}; -Entry.popupHelper.prototype.setPopup = function(b) { -}; -Entry.popupHelper.prototype.remove = function(b) { - 0 < this.window_.children().length && this.window_.children().remove(); - this.window_.remove(); - delete this.popupList[b]; - this.nowContent = void 0; - this.body_.addClass("hiddenPopup"); -}; -Entry.popupHelper.prototype.resize = function(b) { -}; -Entry.popupHelper.prototype.show = function(b) { - 0 < this.window_.children().length && this.window_.children().detach(); - this.window_.append(this.popupList[b]); - this.nowContent = this.popupList[b]; - this.body_.removeClass("hiddenPopup"); -}; -Entry.popupHelper.prototype.hide = function() { - this.nowContent = void 0; - this.body_.addClass("hiddenPopup"); -}; -Entry.getStartProject = function(b) { - return {category:"\uae30\ud0c0", scenes:[{name:"\uc7a5\uba74 1", id:"7dwq"}], variables:[{name:"\ucd08\uc2dc\uacc4", id:"brih", visible:!1, value:"0", variableType:"timer", x:150, y:-70, array:[], object:null, isCloud:!1}, {name:"\ub300\ub2f5", id:"1vu8", visible:!1, value:"0", variableType:"answer", x:150, y:-100, array:[], object:null, isCloud:!1}], objects:[{id:"7y0y", name:"\uc5d4\ud2b8\ub9ac\ubd07", script:[[{type:"when_run_button_click", x:40, y:50}, {type:"repeat_basic", statements:[[{type:"move_direction"}]]}]], - selectedPictureId:"vx80", objectType:"sprite", rotateMethod:"free", scene:"7dwq", sprite:{sounds:[{duration:1.3, ext:".mp3", id:"8el5", fileurl:b + "media/bark.mp3", name:"\uac15\uc544\uc9c0 \uc9d6\ub294\uc18c\ub9ac"}], pictures:[{id:"vx80", fileurl:b + "media/entrybot1.png", name:Lang.Blocks.walking_entryBot + "1", scale:100, dimension:{width:284, height:350}}, {id:"4t48", fileurl:b + "media/entrybot2.png", name:Lang.Blocks.walking_entryBot + "2", scale:100, dimension:{width:284, height:350}}]}, - entity:{x:0, y:0, regX:142, regY:175, scaleX:.3154574132492113, scaleY:.3154574132492113, rotation:0, direction:90, width:284, height:350, visible:!0}, lock:!1, active:!0}], speed:60}; -}; -Entry.PropertyPanel = function() { - this.modes = {}; - this.selected = null; -}; -(function(b) { - b.generateView = function(a, b) { - this._view = Entry.Dom("div", {class:"propertyPanel", parent:$(a)}); - this._tabView = Entry.Dom("div", {class:"propertyTab", parent:this._view}); - this._contentView = Entry.Dom("div", {class:"propertyContent", parent:this._view}); - this._cover = Entry.Dom("div", {classes:["propertyPanelCover", "entryRemove"], parent:this._view}); - var d = Entry.Dom("div", {class:"entryObjectSelectedImgWorkspace", parent:this._view}); - this.initializeSplitter(d); - }; - b.addMode = function(a, b) { - var d = b.getView(), d = Entry.Dom(d, {parent:this._contentView}), e = Entry.Dom("
" + Lang.Menus[a] + "
", {classes:["propertyTabElement", "propertyTab" + a], parent:this._tabView}), f = this; - e.bind("click", function() { - f.select(a); - }); - this.modes[a] && (this.modes[a].tabDom.remove(), this.modes[a].contentDom.remove(), "hw" == a && ($(this.modes).removeClass(".propertyTabhw"), $(".propertyTabhw").unbind("dblclick"))); - this.modes[a] = {obj:b, tabDom:e, contentDom:d}; - "hw" == a && $(".propertyTabhw").bind("dblclick", function() { - Entry.dispatchEvent("hwModeChange"); - }); - }; - b.resize = function(a) { - this._view.css({width:a + "px", top:9 * a / 16 + 123 - 22 + "px"}); - 430 <= a ? this._view.removeClass("collapsed") : this._view.addClass("collapsed"); - Entry.dispatchEvent("windowResized"); - a = this.selected; - "hw" == a ? this.modes.hw.obj.listPorts ? this.modes[a].obj.resizeList() : this.modes[a].obj.resize() : this.modes[a].obj.resize(); - }; - b.select = function(a) { - for (var b in this.modes) { - var d = this.modes[b]; - d.tabDom.removeClass("selected"); - d.contentDom.addClass("entryRemove"); - d.obj.visible = !1; - } - b = this.modes[a]; - b.tabDom.addClass("selected"); - b.contentDom.removeClass("entryRemove"); - b.obj.resize && b.obj.resize(); - b.obj.visible = !0; - this.selected = a; - }; - b.initializeSplitter = function(a) { - var b = this; - a.bind("mousedown touchstart", function(a) { - b._cover.removeClass("entryRemove"); - Entry.container.disableSort(); - Entry.container.splitterEnable = !0; - Entry.documentMousemove && (Entry.container.resizeEvent = Entry.documentMousemove.attach(this, function(a) { - Entry.container.splitterEnable && Entry.resizeElement({canvasWidth:a.clientX || a.x}); - })); - }); - $(document).bind("mouseup touchend", function(a) { - if (a = Entry.container.resizeEvent) { - Entry.container.splitterEnable = !1, Entry.documentMousemove.detach(a), b._cover.addClass("entryRemove"), delete Entry.container.resizeEvent; - } - Entry.container.enableSort(); - }); - }; -})(Entry.PropertyPanel.prototype); -Entry.init = function(b, a) { - Entry.assert("object" === typeof a, "Init option is not object"); - this.events_ = {}; - this.interfaceState = {menuWidth:264}; - Entry.Utils.bindGlobalEvent("resize mousedown mousemove keydown keyup dispose".split(" ")); - this.options = a; - this.parseOptions(a); - this.mediaFilePath = (a.libDir ? a.libDir : "/lib") + "/entryjs/images/"; - this.defaultPath = a.defaultDir || ""; - this.blockInjectPath = a.blockInjectDir || ""; - "workspace" == this.type && this.isPhone() && (this.type = "phone"); - this.initialize_(); - this.view_ = b; - "tablet" === this.device ? this.view_.setAttribute("class", "entry tablet") : this.view_.setAttribute("class", "entry"); - Entry.initFonts(a.fonts); - this.createDom(b, this.type); - this.loadInterfaceState(); - this.overridePrototype(); - this.maxCloneLimit = 302; - this.cloudSavable = !0; - this.startTime = (new Date).getTime(); - document.onkeydown = function(a) { - Entry.dispatchEvent("keyPressed", a); - }; - document.onkeyup = function(a) { - Entry.dispatchEvent("keyUpped", a); - }; - window.onresize = function(a) { - Entry.dispatchEvent("windowResized", a); - }; - window.onbeforeunload = this.beforeUnload; - Entry.addEventListener("saveWorkspace", function(a) { - Entry.addActivity("save"); - }); - "IE" != Entry.getBrowserType().substr(0, 2) || window.flashaudio ? createjs.Sound.registerPlugins([createjs.WebAudioPlugin]) : (createjs.FlashAudioPlugin.swfPath = this.mediaFilePath + "media/", createjs.Sound.registerPlugins([createjs.FlashAudioPlugin]), window.flashaudio = !0); - Entry.soundQueue = new createjs.LoadQueue; - Entry.soundQueue.installPlugin(createjs.Sound); - Entry.loadAudio_([Entry.mediaFilePath + "sounds/click.mp3", Entry.mediaFilePath + "sounds/click.wav", Entry.mediaFilePath + "sounds/click.ogg"], "entryMagneting"); - Entry.loadAudio_([Entry.mediaFilePath + "sounds/delete.mp3", Entry.mediaFilePath + "sounds/delete.ogg", Entry.mediaFilePath + "sounds/delete.wav"], "entryDelete"); - createjs.Sound.stop(); -}; -Entry.loadAudio_ = function(b, a) { - if (window.Audio && b.length) { - for (;0 < b.length;) { - var c = b[0]; - c.match(/\/([^.]+)./); - Entry.soundQueue.loadFile({id:a, src:c, type:createjs.LoadQueue.SOUND}); - break; - } - } -}; -Entry.initialize_ = function() { - this.stage = new Entry.Stage; - Entry.engine && Entry.engine.clearTimer(); - this.engine = new Entry.Engine; - this.propertyPanel = new Entry.PropertyPanel; - this.container = new Entry.Container; - this.helper = new Entry.Helper; - this.youtube = new Entry.Youtube; - this.variableContainer = new Entry.VariableContainer; - this.commander = new Entry.Commander(this.type); - this.scene = new Entry.Scene; - this.playground = new Entry.Playground; - this.toast = new Entry.Toast; - this.hw && this.hw.closeConnection(); - this.hw = new Entry.HW; - if (Entry.enableActivityLogging) { - this.reporter = new Entry.Reporter(!1); - } else { - if ("workspace" == this.type || "phone" == this.type) { - this.reporter = new Entry.Reporter(!0); - } - } -}; -Entry.createDom = function(b, a) { - if (a && "workspace" != a) { - "minimize" == a ? (c = Entry.createElement("canvas"), c.className = "entryCanvasWorkspace", c.id = "entryCanvas", c.width = 640, c.height = 360, d = Entry.createElement("div", "entryCanvasWrapper"), d.appendChild(c), b.appendChild(d), this.canvas_ = c, this.stage.initStage(this.canvas_), d = Entry.createElement("div"), b.appendChild(d), this.engineView = d, this.engine.generateView(this.engineView, a)) : "phone" == a && (this.stateManagerView = c = Entry.createElement("div"), this.stateManager.generateView(this.stateManagerView, - a), d = Entry.createElement("div"), b.appendChild(d), this.engineView = d, this.engine.generateView(this.engineView, a), c = Entry.createElement("canvas"), c.addClass("entryCanvasPhone"), c.id = "entryCanvas", c.width = 640, c.height = 360, d.insertBefore(c, this.engine.footerView_), this.canvas_ = c, this.stage.initStage(this.canvas_), c = Entry.createElement("div"), b.appendChild(c), this.containerView = c, this.container.generateView(this.containerView, a), c = Entry.createElement("div"), - b.appendChild(c), this.playgroundView = c, this.playground.generateView(this.playgroundView, a)); - } else { - Entry.documentMousedown.attach(this, this.cancelObjectEdit); - var c = Entry.createElement("div"); - b.appendChild(c); - this.sceneView = c; - this.scene.generateView(this.sceneView, a); - c = Entry.createElement("div"); - this.sceneView.appendChild(c); - this.stateManagerView = c; - this.stateManager.generateView(this.stateManagerView, a); - var d = Entry.createElement("div"); - b.appendChild(d); - this.engineView = d; - this.engine.generateView(this.engineView, a); - c = Entry.createElement("canvas"); - c.addClass("entryCanvasWorkspace"); - c.id = "entryCanvas"; - c.width = 640; - c.height = 360; - d.insertBefore(c, this.engine.addButton); - c.addEventListener("mousewheel", function(a) { - var b = Entry.variableContainer.getListById(Entry.stage.mouseCoordinate); - a = 0 < a.wheelDelta ? !0 : !1; - for (var c = 0;c < b.length;c++) { - var d = b[c]; - d.scrollButton_.y = a ? 46 <= d.scrollButton_.y ? d.scrollButton_.y - 23 : 23 : d.scrollButton_.y + 23; - d.updateView(); - } - }); - this.canvas_ = c; - this.stage.initStage(this.canvas_); - c = Entry.createElement("div"); - this.propertyPanel.generateView(b, a); - this.containerView = c; - this.container.generateView(this.containerView, a); - this.propertyPanel.addMode("object", this.container); - this.helper.generateView(this.containerView, a); - this.propertyPanel.addMode("helper", this.helper); - c = Entry.createElement("div"); - b.appendChild(c); - this.playgroundView = c; - this.playground.generateView(this.playgroundView, a); - this.propertyPanel.select("object"); - this.helper.bindWorkspace(this.playground.mainWorkspace); - } -}; -Entry.start = function(b) { - this.FPS || (this.FPS = 60); - Entry.assert("number" == typeof this.FPS, "FPS must be number"); - Entry.engine.start(this.FPS); -}; -Entry.parseOptions = function(b) { - this.type = b.type; - b.device && (this.device = b.device); - this.projectSaveable = b.projectsaveable; - void 0 === this.projectSaveable && (this.projectSaveable = !0); - this.objectAddable = b.objectaddable; - void 0 === this.objectAddable && (this.objectAddable = !0); - this.objectEditable = b.objectEditable; - void 0 === this.objectEditable && (this.objectEditable = !0); - this.objectEditable || (this.objectAddable = !1); - this.objectDeletable = b.objectdeletable; - void 0 === this.objectDeletable && (this.objectDeletable = !0); - this.soundEditable = b.soundeditable; - void 0 === this.soundEditable && (this.soundEditable = !0); - this.pictureEditable = b.pictureeditable; - void 0 === this.pictureEditable && (this.pictureEditable = !0); - this.sceneEditable = b.sceneEditable; - void 0 === this.sceneEditable && (this.sceneEditable = !0); - this.functionEnable = b.functionEnable; - void 0 === this.functionEnable && (this.functionEnable = !0); - this.messageEnable = b.messageEnable; - void 0 === this.messageEnable && (this.messageEnable = !0); - this.variableEnable = b.variableEnable; - void 0 === this.variableEnable && (this.variableEnable = !0); - this.listEnable = b.listEnable; - void 0 === this.listEnable && (this.listEnable = !0); - this.hasVariableManager = b.hasvariablemanager; - this.variableEnable || this.messageEnable || this.listEnable || this.functionEnable ? void 0 === this.hasVariableManager && (this.hasVariableManager = !0) : this.hasVariableManager = !1; - this.isForLecture = b.isForLecture; -}; -Entry.initFonts = function(b) { - this.fonts = b; - b || (this.fonts = []); -}; -Entry.Reporter = function(b) { - this.projectId = this.userId = null; - this.isRealTime = b; - this.activities = []; -}; -Entry.Reporter.prototype.start = function(b, a, c) { - this.isRealTime && (-1 < window.location.href.indexOf("localhost") ? this.io = io("localhost:7000") : this.io = io("play04.play-entry.com:7000"), this.io.emit("activity", {message:"start", userId:a, projectId:b, time:c})); - this.userId = a; - this.projectId = b; -}; -Entry.Reporter.prototype.report = function(b) { - if (!this.isRealTime || this.io) { - var a = [], c; - for (c in b.params) { - var d = b.params[c]; - "object" !== typeof d ? a.push(d) : d.id && a.push(d.id); - } - b = {message:b.message, userId:this.userId, projectId:this.projectId, time:b.time, params:a}; - this.isRealTime ? this.io.emit("activity", b) : this.activities.push(b); - } -}; -Entry.Scene = function() { - var b = this; - this.scenes_ = []; - this.selectedScene = null; - this.maxCount = 20; - $(window).on("resize", function(a) { - b.resize(); - }); -}; -Entry.Scene.viewBasicWidth = 70; -Entry.Scene.prototype.generateView = function(b, a) { - var c = this; - this.view_ = b; - this.view_.addClass("entryScene"); - if (!a || "workspace" == a) { - this.view_.addClass("entrySceneWorkspace"); - $(this.view_).on("mousedown", function(a) { - var b = $(this).offset(), d = $(window), h = a.pageX - b.left + d.scrollLeft(); - a = a.pageY - b.top + d.scrollTop(); - a = 40 - a; - b = -40 / 55; - d = $(c.selectedScene.view).find(".entrySceneRemoveButtonCoverWorkspace").offset().left; - !(h < d || h > d + 55) && a > 40 + b * (h - d) && (h = c.getNextScene()) && (h = $(h.view), $(document).trigger("mouseup"), h.trigger("mousedown")); - }); - var d = Entry.createElement("ul"); - d.addClass("entrySceneListWorkspace"); - Entry.sceneEditable && $ && $(d).sortable({start:function(a, b) { - b.item.data("start_pos", b.item.index()); - $(b.item[0]).clone(!0); - }, stop:function(a, b) { - var c = b.item.data("start_pos"), d = b.item.index(); - Entry.scene.moveScene(c, d); - }, axis:"x", tolerance:"pointer"}); - this.view_.appendChild(d); - this.listView_ = d; - Entry.sceneEditable && (d = Entry.createElement("span"), d.addClass("entrySceneElementWorkspace"), d.addClass("entrySceneAddButtonWorkspace"), d.bindOnClick(function(a) { - Entry.engine.isState("run") || Entry.scene.addScene(); - }), this.view_.appendChild(d), this.addButton_ = d); - } -}; -Entry.Scene.prototype.generateElement = function(b) { - var a = this, c = Entry.createElement("li", b.id); - c.addClass("entrySceneElementWorkspace"); - c.addClass("entrySceneButtonWorkspace"); - c.addClass("minValue"); - $(c).on("mousedown", function(a) { - Entry.engine.isState("run") ? a.preventDefault() : Entry.scene.selectScene(b); - }); - var d = Entry.createElement("input"); - d.addClass("entrySceneFieldWorkspace"); - d.value = b.name; - Entry.sceneEditable || (d.disabled = "disabled"); - var e = Entry.createElement("span"); - e.addClass("entrySceneLeftWorkspace"); - c.appendChild(e); - var f = Entry.createElement("span"); - f.addClass("entrySceneInputCover"); - f.style.width = Entry.computeInputWidth(b.name); - c.appendChild(f); - b.inputWrapper = f; - d.onkeyup = function(c) { - c = c.keyCode; - Entry.isArrowOrBackspace(c) || (b.name = this.value, f.style.width = Entry.computeInputWidth(b.name), a.resize(), 13 == c && this.blur(), 10 < this.value.length && (this.value = this.value.substring(0, 10), this.blur())); - }; - d.onblur = function(a) { - d.value = this.value; - b.name = this.value; - f.style.width = Entry.computeInputWidth(b.name); - }; - f.appendChild(d); - e = Entry.createElement("span"); - e.addClass("entrySceneRemoveButtonCoverWorkspace"); - c.appendChild(e); - if (Entry.sceneEditable) { - var g = Entry.createElement("button"); - g.addClass("entrySceneRemoveButtonWorkspace"); - g.scene = b; - g.bindOnClick(function(a) { - a.stopPropagation(); - Entry.engine.isState("run") || confirm(Lang.Workspace.will_you_delete_scene) && Entry.scene.removeScene(this.scene); - }); - e.appendChild(g); - } - Entry.Utils.disableContextmenu(c); - $(c).on("contextmenu", function() { - var a = [{text:Lang.Workspace.duplicate_scene, enable:Entry.engine.isState("stop"), callback:function() { - Entry.scene.cloneScene(b); - }}]; - Entry.ContextMenu.show(a, "workspace-contextmenu"); - }); - return b.view = c; -}; -Entry.Scene.prototype.updateView = function() { - if (!Entry.type || "workspace" == Entry.type) { - for (var b = this.listView_, a = $(b).children().length;a < this.getScenes().length;a++) { - b.appendChild(this.getScenes()[a].view); - } - this.addButton_ && (this.getScenes().length < this.maxCount ? this.addButton_.removeClass("entryRemove") : this.addButton_.addClass("entryRemove")); - } - this.resize(); -}; -Entry.Scene.prototype.addScenes = function(b) { - if ((this.scenes_ = b) && 0 !== b.length) { - for (var a = 0, c = b.length;a < c;a++) { - this.generateElement(b[a]); - } - } else { - this.scenes_ = [], this.scenes_.push(this.createScene()); - } - this.selectScene(this.getScenes()[0]); - this.updateView(); -}; -Entry.Scene.prototype.addScene = function(b, a) { - void 0 === b && (b = this.createScene()); - b.view || this.generateElement(b); - a || "number" == typeof a ? this.getScenes().splice(a, 0, b) : this.getScenes().push(b); - Entry.stage.objectContainers.push(Entry.stage.createObjectContainer(b)); - Entry.playground.flushPlayground(); - this.selectScene(b); - this.updateView(); - return b; -}; -Entry.Scene.prototype.removeScene = function(b) { - if (1 >= this.getScenes().length) { - Entry.toast.alert(Lang.Msgs.runtime_error, Lang.Workspace.Scene_delete_error, !1); - } else { - var a = this.getScenes().indexOf(this.getSceneById(b.id)); - this.getScenes().splice(a, 1); - for (var a = Entry.container.getSceneObjects(b), c = 0;c < a.length;c++) { - Entry.container.removeObject(a[c]); - } - Entry.stage.removeObjectContainer(b); - $(b.view).remove(); - this.selectScene(); - } -}; -Entry.Scene.prototype.selectScene = function(b) { - b = b || this.getScenes()[0]; - if (!this.selectedScene || this.selectedScene.id != b.id) { - Entry.engine.isState("run") && Entry.container.resetSceneDuringRun(); - var a = this.selectedScene; - a && (a = a.view, a.removeClass("selectedScene"), a = $(a), a.find("input").blur()); - this.selectedScene = b; - b.view.addClass("selectedScene"); - Entry.container.setCurrentObjects(); - Entry.stage.objectContainers && 0 !== Entry.stage.objectContainers.length && Entry.stage.selectObjectContainer(b); - (b = Entry.container.getCurrentObjects()[0]) && "minimize" != Entry.type ? (Entry.container.selectObject(b.id), Entry.playground.refreshPlayground()) : (Entry.stage.selectObject(null), Entry.playground.flushPlayground(), Entry.variableContainer.updateList()); - Entry.container.listView_ || Entry.stage.sortZorder(); - Entry.container.updateListView(); - this.updateView(); - Entry.requestUpdate = !0; - } -}; -Entry.Scene.prototype.toJSON = function() { - for (var b = [], a = this.getScenes().length, c = 0;c < a;c++) { - var d = this.getScenes()[c], e = d.view, f = d.inputWrapper; - delete d.view; - delete d.inputWrapper; - b.push(JSON.parse(JSON.stringify(d))); - d.view = e; - d.inputWrapper = f; - } - return b; -}; -Entry.Scene.prototype.moveScene = function(b, a) { - this.getScenes().splice(a, 0, this.getScenes().splice(b, 1)[0]); - Entry.container.updateObjectsOrder(); - Entry.stage.sortZorder(); - $(".entrySceneElementWorkspace").removeAttr("style"); -}; -Entry.Scene.prototype.getSceneById = function(b) { - for (var a = this.getScenes(), c = 0;c < a.length;c++) { - if (a[c].id == b) { - return a[c]; - } - } - return !1; -}; -Entry.Scene.prototype.getScenes = function() { - return this.scenes_; -}; -Entry.Scene.prototype.takeStartSceneSnapshot = function() { - this.sceneBeforeRun = this.selectedScene; -}; -Entry.Scene.prototype.loadStartSceneSnapshot = function() { - this.selectScene(this.sceneBeforeRun); - this.sceneBeforeRun = null; -}; -Entry.Scene.prototype.createScene = function() { - var b = {name:Lang.Blocks.SCENE + " " + (this.getScenes().length + 1), id:Entry.generateHash()}; - this.generateElement(b); - return b; -}; -Entry.Scene.prototype.cloneScene = function(b) { - if (this.scenes_.length >= 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 < b.length;a++) { - if (c = b[a], "NEXT" == c.tagName.toUpperCase()) { - this.nextScript = new Entry.Script(this.entity), this.register && (this.nextScript.register = this.register), this.nextScript.init(b[a].childNodes[0], this); - } else { - if ("VALUE" == c.tagName.toUpperCase()) { - this.values || (this.values = {}); - var d = new Entry.Script(this.entity); - this.register && (d.register = this.register); - d.init(c.childNodes[0]); - this.values[c.getAttribute("name")] = d; - } else { - "FIELD" == c.tagName.toUpperCase() ? (this.fields || (this.fields = {}), this.fields[c.getAttribute("name")] = c.textContent) : "STATEMENT" == c.tagName.toUpperCase() && (this.statements || (this.statements = {}), d = new Entry.Script(this.entity), this.register && (d.register = this.register), d.init(c.childNodes[0], null, this), d.key = c.getAttribute("name"), this.statements[c.getAttribute("name")] = d); - } - } - } -}; -p.clone = function(b, a) { - var c = new Entry.Script(b); - c.id = this.id; - c.type = this.type; - c.isRepeat = this.isRepeat; - if (this.parentScript && !this.previousScript && 2 != a) { - c.parentScript = this.parentScript.clone(b); - for (var d = c.parentScript.statements[this.key] = c;d.nextScript;) { - d = d.nextScript, d.parentScript = c.parentScript; - } - } - this.nextScript && 1 != a && (c.nextScript = this.nextScript.clone(b, 0), c.nextScript.previousScript = this); - this.previousScript && 0 !== a && (c.previousScript = this.previousScript.clone(b, 1), c.previousScript.previousScript = this); - if (this.fields) { - c.fields = {}; - for (var e in this.fields) { - c.fields[e] = this.fields[e]; - } - } - if (this.values) { - for (e in c.values = {}, this.values) { - c.values[e] = this.values[e].clone(b); - } - } - if (this.statements) { - for (e in c.statements = {}, this.statements) { - for (c.statements[e] = this.statements[e].clone(b, 2), d = c.statements[e], d.parentScript = c;d.nextScript;) { - d = d.nextScript, d.parentScript = c; - } - } - } - return c; -}; -p.getStatement = function(b) { - return this.statements[b]; -}; -p.compute = function() { -}; -p.getValue = function(b) { - return this.values[b].run(); -}; -p.getNumberValue = function(b) { - return Number(this.values[b].run()); -}; -p.getStringValue = function(b) { - return String(this.values[b].run()); -}; -p.getBooleanValue = function(b) { - return this.values[b].run() ? !0 : !1; -}; -p.getField = function(b) { - return this.fields[b]; -}; -p.getStringField = function(b) { - return String(this.fields[b]); -}; -p.getNumberField = function(b) { - return Number(this.fields[b]); -}; -p.callReturn = function() { - return this.nextScript ? this.nextScript : this.parentScript ? this.parentScript : null; -}; -p.run = function() { - return Entry.block[this.type](this.entity, this); -}; -Entry.StampEntity = function(b, a) { - this.parent = b; - this.type = b.objectType; - this.isStamp = this.isClone = !0; - this.width = a.getWidth(); - this.height = a.getHeight(); - "sprite" == this.type && (this.object = a.object.clone(!0), this.object.filters = null, a.effect && (this.effect = Entry.cloneSimpleObject(a.effect), this.applyFilter())); - this.object.entity = this; -}; -(function(b, a) { - b.applyFilter = a.applyFilter; - b.removeClone = a.removeClone; - b.getWidth = a.getWidth; - b.getHeight = a.getHeight; - b.getInitialEffectValue = a.getInitialEffectValue; -})(Entry.StampEntity.prototype, Entry.EntityObject.prototype); -Entry.Toast = function() { - this.toasts_ = []; - var b = document.getElementById("entryToastContainer"); - b && document.body.removeChild(b); - this.body_ = Entry.createElement("div", "entryToastContainer"); - this.body_.addClass("entryToastContainer"); - document.body.appendChild(this.body_); -}; -Entry.Toast.prototype.warning = function(b, a, c) { - var d = Entry.createElement("div", "entryToast"); - d.addClass("entryToast"); - d.addClass("entryToastWarning"); - d.bindOnClick(function() { - Entry.toast.body_.removeChild(this); - }); - var e = Entry.createElement("div", "entryToast"); - e.addClass("entryToastTitle"); - e.innerHTML = b; - d.appendChild(e); - b = Entry.createElement("p", "entryToast"); - b.addClass("entryToastMessage"); - b.innerHTML = a; - d.appendChild(b); - this.toasts_.push(d); - this.body_.appendChild(d); - c || window.setTimeout(function() { - d.style.opacity = 1; - var a = setInterval(function() { - .05 > d.style.opacity && (clearInterval(a), d.style.display = "none", Entry.removeElement(d)); - d.style.opacity *= .9; - }, 20); - }, 1E3); -}; -Entry.Toast.prototype.success = function(b, a, c) { - var d = Entry.createElement("div", "entryToast"); - d.addClass("entryToast"); - d.addClass("entryToastSuccess"); - d.bindOnClick(function() { - Entry.toast.body_.removeChild(this); - }); - var e = Entry.createElement("div", "entryToast"); - e.addClass("entryToastTitle"); - e.innerHTML = b; - d.appendChild(e); - b = Entry.createElement("p", "entryToast"); - b.addClass("entryToastMessage"); - b.innerHTML = a; - d.appendChild(b); - this.toasts_.push(d); - this.body_.appendChild(d); - c || window.setTimeout(function() { - d.style.opacity = 1; - var a = setInterval(function() { - .05 > d.style.opacity && (clearInterval(a), d.style.display = "none", Entry.removeElement(d)); - d.style.opacity *= .9; - }, 20); - }, 1E3); -}; -Entry.Toast.prototype.alert = function(b, a, c) { - var d = Entry.createElement("div", "entryToast"); - d.addClass("entryToast"); - d.addClass("entryToastAlert"); - d.bindOnClick(function() { - Entry.toast.body_.removeChild(this); - }); - var e = Entry.createElement("div", "entryToast"); - e.addClass("entryToastTitle"); - e.innerHTML = b; - d.appendChild(e); - b = Entry.createElement("p", "entryToast"); - b.addClass("entryToastMessage"); - b.innerHTML = a; - d.appendChild(b); - this.toasts_.push(d); - this.body_.appendChild(d); - c || window.setTimeout(function() { - d.style.opacity = 1; - var a = setInterval(function() { - .05 > d.style.opacity && (clearInterval(a), d.style.display = "none", Entry.toast.body_.removeChild(d)); - d.style.opacity *= .9; - }, 20); - }, 5E3); -}; -Entry.TvCast = function(b) { - this.generateView(b); -}; -p = Entry.TvCast.prototype; -p.init = function(b) { - this.tvCastHash = b; -}; -p.generateView = function(b) { - var a = Entry.createElement("div"); - a.addClass("entryContainerMovieWorkspace"); - a.addClass("entryRemove"); - this.movieContainer = a; - a = Entry.createElement("iframe"); - a.setAttribute("id", "tvCastIframe"); - a.setAttribute("allowfullscreen", ""); - a.setAttribute("frameborder", 0); - a.setAttribute("src", b); - this.movieFrame = a; - this.movieContainer.appendChild(this.movieFrame); -}; -p.getView = function() { - return this.movieContainer; -}; -p.resize = function() { - document.getElementById("entryContainerWorkspaceId"); - var b = document.getElementById("tvCastIframe"); - w = this.movieContainer.offsetWidth; - b.width = w + "px"; - b.height = 9 * w / 16 + "px"; -}; -Entry.BlockDriver = function() { -}; -(function(b) { - b.convert = function() { - var a = new Date, b; - for (b in Entry.block) { - "function" === typeof Entry.block[b] && this._convertBlock(b); - } - console.log((new Date).getTime() - a.getTime()); - }; - b._convertBlock = function(a) { - function b(a) { - var d = {type:a.getAttribute("type"), index:{}}; - a = $(a).children(); - if (!a) { - return d; - } - for (var e = 0;e < a.length;e++) { - var f = a[e], g = f.tagName, h = $(f).children()[0], t = f.getAttribute("name"); - "value" === g ? "block" == h.nodeName && (d.params || (d.params = []), d.params.push(b(h)), d.index[t] = d.params.length - 1) : "field" === g && (d.params || (d.params = []), d.params.push(f.textContent), d.index[t] = d.params.length - 1); - } - return d; - } - var d = Blockly.Blocks[a], e = EntryStatic.blockInfo[a], f, g; - if (e && (f = e.class, g = e.isNotFor, e = e.xml)) { - var e = $.parseXML(e), h = b(e.childNodes[0]) - } - d = (new Entry.BlockMockup(d, h, a)).toJSON(); - d.class = f; - d.isNotFor = g; - _.isEmpty(d.paramsKeyMap) && delete d.paramsKeyMap; - _.isEmpty(d.statementsKeyMap) && delete d.statementsKeyMap; - d.func = Entry.block[a]; - -1 < "NUMBER TRUE FALSE TEXT FUNCTION_PARAM_BOOLEAN FUNCTION_PARAM_STRING TRUE_UN".split(" ").indexOf(a.toUpperCase()) && (d.isPrimitive = !0); - Entry.block[a] = d; - }; -})(Entry.BlockDriver.prototype); -Entry.BlockMockup = function(b, a, c) { - this.templates = []; - this.params = []; - this.statements = []; - this.color = ""; - this.output = this.isNext = this.isPrev = !1; - this.fieldCount = 0; - this.events = {}; - this.def = a || {}; - this.paramsKeyMap = {}; - this.statementsKeyMap = {}; - this.definition = {params:[], type:this.def.type}; - this.simulate(b); - this.def = this.definition; -}; -(function(b) { - b.simulate = function(a) { - a.sensorList && (this.sensorList = a.sensorList); - a.portList && (this.portList = a.portList); - a.init.call(this); - a.whenAdd && (this.events.blockViewAdd || (this.events.blockViewAdd = []), this.events.blockViewAdd.push(a.whenAdd)); - a.whenRemove && (this.events.blockViewDestroy || (this.events.blockViewDestroy = []), this.events.blockViewDestroy.push(a.whenRemove)); - }; - b.toJSON = function() { - function a(b) { - if (b && (b = b.params)) { - for (var c = 0;c < b.length;c++) { - var d = b[c]; - d && (delete d.index, a(d)); - } - } - } - var b = ""; - this.output ? b = "Boolean" === this.output ? "basic_boolean_field" : "basic_string_field" : !this.isPrev && this.isNext ? b = "basic_event" : 1 == this.statements.length ? b = "basic_loop" : 2 == this.statements.length ? b = "basic_double_loop" : this.isPrev && this.isNext ? b = "basic" : this.isPrev && !this.isNext && (b = "basic_without_next"); - a(this.def); - var d = /dummy_/mi, e; - for (e in this.paramsKeyMap) { - d.test(e) && delete this.paramsKeyMap[e]; - } - for (e in this.statementsKeyMap) { - d.test(e) && delete this.statementsKeyMap[e]; - } - return {color:this.color, skeleton:b, statements:this.statements, template:this.templates.filter(function(a) { - return "string" === typeof a; - }).join(" "), params:this.params, events:this.events, def:this.def, paramsKeyMap:this.paramsKeyMap, statementsKeyMap:this.statementsKeyMap}; - }; - b.appendDummyInput = function() { - return this; - }; - b.appendValueInput = function(a) { - this.def && this.def.index && (void 0 !== this.def.index[a] ? this.definition.params.push(this.def.params[this.def.index[a]]) : this.definition.params.push(null)); - this.params.push({type:"Block", accept:"string"}); - this._addToParamsKeyMap(a); - this.templates.push(this.getFieldCount()); - return this; - }; - b.appendStatementInput = function(a) { - this._addToStatementsKeyMap(a); - this.statements.push({accept:"basic"}); - }; - b.setCheck = function(a) { - var b = this.params; - "Boolean" === a && (b[b.length - 1].accept = "boolean"); - }; - b.appendField = function(a, b) { - if (!a) { - return this; - } - "string" === typeof a && 0 < a.length ? b ? (a = {type:"Text", text:a, color:b}, this.params.push(a), this._addToParamsKeyMap(), this.templates.push(this.getFieldCount()), this.def && this.def.index && void 0 !== this.def.index[b] ? this.definition.params.push(this.def.params[this.def.index[b]]) : this.definition.params.push(void 0)) : this.templates.push(a) : a.constructor == Blockly.FieldIcon ? ("start" === a.type ? this.params.push({type:"Indicator", img:a.src_, size:17, position:{x:0, y:-2}}) : - this.params.push({type:"Indicator", img:a.src_, size:12}), this._addToParamsKeyMap(), this.templates.push(this.getFieldCount()), this.definition && this.definition.params.push(null)) : a.constructor == Blockly.FieldDropdown ? (this.params.push({type:"Dropdown", options:a.menuGenerator_, value:a.menuGenerator_[0][1], fontSize:11}), this._addToParamsKeyMap(b), this.templates.push(this.getFieldCount()), this.def && this.def.index && void 0 !== this.def.index[b] ? this.definition.params.push(this.def.params[this.def.index[b]]) : - this.definition.params.push(void 0)) : a.constructor == Blockly.FieldDropdownDynamic ? (this.params.push({type:"DropdownDynamic", value:null, menuName:a.menuName_, fontSize:11}), this.templates.push(this.getFieldCount()), this.def && this.def.index && void 0 !== this.def.index[b] ? this.definition.params.push(this.def.params[this.def.index[b]]) : this.definition.params.push(void 0), this._addToParamsKeyMap(b)) : a.constructor == Blockly.FieldTextInput ? (this.params.push({type:"TextInput", value:10}), - this.templates.push(this.getFieldCount()), this._addToParamsKeyMap(b)) : a.constructor == Blockly.FieldAngle ? (this.params.push({type:"Angle"}), this.templates.push(this.getFieldCount()), this.def && this.def.index && void 0 !== this.def.index[b] ? this.definition.params.push(this.def.params[this.def.index[b]]) : this.definition.params.push(null), this._addToParamsKeyMap(b)) : a.constructor == Blockly.FieldKeydownInput ? (this.params.push({type:"Keyboard", value:81}), this.templates.push(this.getFieldCount()), - void 0 !== this.def.index[b] ? this.definition.params.push(this.def.params[this.def.index[b]]) : this.definition.params.push(void 0), this._addToParamsKeyMap(b)) : a.constructor == Blockly.FieldColour ? (this.params.push({type:"Color"}), this.templates.push(this.getFieldCount()), this._addToParamsKeyMap(b)) : console.log("else", a); - return this; - }; - b.setColour = function(a) { - this.color = a; - }; - b.setInputsInline = function() { - }; - b.setOutput = function(a, b) { - a && (this.output = b); - }; - b.setPreviousStatement = function(a) { - this.isPrev = a; - }; - b.setNextStatement = function(a) { - this.isNext = a; - }; - b.setEditable = function(a) { - }; - b.getFieldCount = function() { - this.fieldCount++; - return "%" + this.fieldCount; - }; - b._addToParamsKeyMap = function(a) { - a = a ? a : "dummy_" + Entry.Utils.generateId(); - var b = this.paramsKeyMap; - b[a] = Object.keys(b).length; - }; - b._addToStatementsKeyMap = function(a) { - a = a ? a : "dummy_" + Entry.Utils.generateId(); - var b = this.statementsKeyMap; - b[a] = Object.keys(b).length; - }; -})(Entry.BlockMockup.prototype); -Entry.ContextMenu = {}; -(function(b) { - b.visible = !1; - b.createDom = function() { - this.dom = Entry.Dom("ul", {id:"entry-contextmenu", parent:$("body")}); - this.dom.bind("mousedown touchstart", function(a) { - a.stopPropagation(); - }); - Entry.Utils.disableContextmenu(this.dom); - Entry.documentMousedown.attach(this, function() { - this.hide(); - }); - }; - b.show = function(a, b, d) { - this.dom || this.createDom(); - if (0 !== a.length) { - var e = this; - void 0 !== b && (this._className = b, this.dom.addClass(b)); - var f = this.dom; - f.empty(); - for (var g = 0, h = a.length;g < h;g++) { - var k = a[g], l = k.text, n = !1 !== k.enable, m = Entry.Dom("li", {parent:f}); - if (k.divider) { - b = "divider"; - } else { - b = n ? "menuAble" : "menuDisable"; - var q = Entry.Dom("span", {parent:m}); - q.text(l); - n && k.callback && function(a, b) { - a.mousedown(function(a) { - a.preventDefault(); - e.hide(); - b(a); - }); - }(q, k.callback); - } - m.addClass(b); - } - f.removeClass("entryRemove"); - this.visible = !0; - this.position(d || Entry.mouseCoordinate); - } - }; - b.position = function(a) { - var b = this.dom; - b.css({left:0, top:0}); - var d = b.width(), e = b.height(), f = $(window), g = f.width(), f = f.height(); - a.x + d > g && (a.x -= d + 3); - a.y + e > f && (a.y -= e); - b.css({left:a.x, top:a.y}); - }; - b.hide = function() { - this.visible = !1; - this.dom.empty(); - this.dom.addClass("entryRemove"); - this._className && (this.dom.removeClass(this._className), delete this._className); - }; -})(Entry.ContextMenu); -Entry.Loader = {queueCount:0, totalCount:0}; -Entry.Loader.addQueue = function(b) { - this.queueCount || Entry.dispatchEvent("loadStart"); - this.queueCount++; - this.totalCount++; -}; -Entry.Loader.removeQueue = function(b) { - this.queueCount--; - this.queueCount || (Entry.dispatchEvent("loadComplete"), this.totalCount = 0); -}; -Entry.Loader.getLoadedPercent = function() { - return 0 === this.totalCount ? 1 : this.queueCount / this.totalCount; -}; -Entry.STATIC = {OBJECT:0, ENTITY:1, SPRITE:2, SOUND:3, VARIABLE:4, FUNCTION:5, SCENE:6, MESSAGE:7, BLOCK_MODEL:8, BLOCK_RENDER_MODEL:9, BOX_MODEL:10, THREAD_MODEL:11, DRAG_INSTANCE:12, BLOCK_STATIC:0, BLOCK_MOVE:1, BLOCK_FOLLOW:2, RETURN:0, CONTINUE:1, BREAK:2, PASS:3}; -Entry.Utils = {}; -Entry.overridePrototype = function() { - Number.prototype.mod = function(b) { - return (this % b + b) % b; - }; -}; -Entry.Utils.generateId = function() { - return ("0000" + (Math.random() * Math.pow(36, 4) << 0).toString(36)).substr(-4); -}; -Entry.Utils.intersectArray = function(b, a) { - for (var c = [], d = 0;d < b.length;d++) { - for (var e = 0;e < a.length;e++) { - if (b[d] == a[e]) { - c.push(b[d]); - break; - } - } - } - return c; -}; -Entry.Utils.isPointInMatrix = function(b, a, c) { - c = void 0 === c ? 0 : c; - var d = b.offsetX ? b.x + b.offsetX : b.x, e = b.offsetY ? b.y + b.offsety : b.y; - return d - c <= a.x && d + b.width + c >= a.x && e - c <= a.y && e + b.height + c >= a.y; -}; -Entry.Utils.colorDarken = function(b, a) { - function c(a) { - 2 != a.length && (a = "0" + a); - return a; - } - var d, e, f; - 7 === b.length ? (d = parseInt(b.substr(1, 2), 16), e = parseInt(b.substr(3, 2), 16), f = parseInt(b.substr(5, 2), 16)) : (d = parseInt(b.substr(1, 2), 16), e = parseInt(b.substr(2, 2), 16), f = parseInt(b.substr(3, 2), 16)); - a = void 0 === a ? .7 : a; - d = c(Math.floor(d * a).toString(16)); - e = c(Math.floor(e * a).toString(16)); - f = c(Math.floor(f * a).toString(16)); - return "#" + d + e + f; -}; -Entry.Utils.colorLighten = function(b, a) { - a = 0 === a ? 0 : a || 20; - var c = Entry.Utils.hexToHsl(b); - c.l += a / 100; - c.l = Math.min(1, Math.max(0, c.l)); - return Entry.Utils.hslToHex(c); -}; -Entry.Utils.bound01 = function(b, a) { - var c = b; - "string" == typeof c && -1 != c.indexOf(".") && 1 === parseFloat(c) && (b = "100%"); - c = "string" === typeof b && -1 != b.indexOf("%"); - b = Math.min(a, Math.max(0, parseFloat(b))); - c && (b = parseInt(b * a, 10) / 100); - return 1E-6 > Math.abs(b - a) ? 1 : b % a / parseFloat(a); -}; -Entry.Utils.hexToHsl = function(b) { - var a, c; - 7 === b.length ? (a = parseInt(b.substr(1, 2), 16), c = parseInt(b.substr(3, 2), 16), b = parseInt(b.substr(5, 2), 16)) : (a = parseInt(b.substr(1, 2), 16), c = parseInt(b.substr(2, 2), 16), b = parseInt(b.substr(3, 2), 16)); - a = Entry.Utils.bound01(a, 255); - c = Entry.Utils.bound01(c, 255); - b = Entry.Utils.bound01(b, 255); - var d = Math.max(a, c, b), e = Math.min(a, c, b), f, g = (d + e) / 2; - if (d == e) { - f = e = 0; - } else { - var h = d - e, e = .5 < g ? h / (2 - d - e) : h / (d + e); - switch(d) { - case a: - f = (c - b) / h + (c < b ? 6 : 0); - break; - case c: - f = (b - a) / h + 2; - break; - case b: - f = (a - c) / h + 4; - } - f /= 6; - } - return {h:360 * f, s:e, l:g}; -}; -Entry.Utils.hslToHex = function(b) { - function a(a, b, c) { - 0 > c && (c += 1); - 1 < c && --c; - return c < 1 / 6 ? a + 6 * (b - a) * c : .5 > c ? b : c < 2 / 3 ? a + (b - a) * (2 / 3 - c) * 6 : a; - } - function c(a) { - return 1 == a.length ? "0" + a : "" + a; - } - var d, e; - e = Entry.Utils.bound01(b.h, 360); - d = Entry.Utils.bound01(b.s, 1); - b = Entry.Utils.bound01(b.l, 1); - if (0 === d) { - d = b = e = b; - } else { - var f = .5 > b ? b * (1 + d) : b + d - b * d, g = 2 * b - f; - d = a(g, f, e + 1 / 3); - b = a(g, f, e); - e = a(g, f, e - 1 / 3); - } - b *= 255; - e *= 255; - return "#" + [c(Math.round(255 * d).toString(16)), c(Math.round(b).toString(16)), c(Math.round(e).toString(16))].join(""); -}; -Entry.Utils.bindGlobalEvent = function(b) { - var a = $(document); - void 0 === b && (b = "resize mousedown mousemove keydown keyup dispose".split(" ")); - -1 < b.indexOf("resize") && (Entry.windowReszied && ($(window).off("resize"), Entry.windowReszied.clear()), Entry.windowResized = new Entry.Event(window), $(window).on("resize", function(a) { - Entry.windowResized.notify(a); - })); - -1 < b.indexOf("mousedown") && (Entry.documentMousedown && (a.off("mousedown"), Entry.documentMousedown.clear()), Entry.documentMousedown = new Entry.Event(window), a.on("mousedown", function(a) { - Entry.documentMousedown.notify(a); - })); - -1 < b.indexOf("mousemove") && (Entry.documentMousemove && (a.off("touchmove mousemove"), Entry.documentMousemove.clear()), Entry.mouseCoordinate = {}, Entry.documentMousemove = new Entry.Event(window), a.on("touchmove mousemove", function(a) { - a.originalEvent && a.originalEvent.touches && (a = a.originalEvent.touches[0]); - Entry.documentMousemove.notify(a); - Entry.mouseCoordinate.x = a.clientX; - Entry.mouseCoordinate.y = a.clientY; - })); - -1 < b.indexOf("keydown") && (Entry.keyPressed && (a.off("keydown"), Entry.keyPressed.clear()), Entry.pressedKeys = [], Entry.keyPressed = new Entry.Event(window), a.on("keydown", function(a) { - var b = a.keyCode; - 0 > Entry.pressedKeys.indexOf(b) && Entry.pressedKeys.push(b); - Entry.keyPressed.notify(a); - })); - -1 < b.indexOf("keyup") && (Entry.keyUpped && (a.off("keyup"), Entry.keyUpped.clear()), Entry.keyUpped = new Entry.Event(window), a.on("keyup", function(a) { - var b = Entry.pressedKeys.indexOf(a.keyCode); - -1 < b && Entry.pressedKeys.splice(b, 1); - Entry.keyUpped.notify(a); - })); - -1 < b.indexOf("dispose") && (Entry.disposeEvent && Entry.disposeEvent.clear(), Entry.disposeEvent = new Entry.Event(window), Entry.documentMousedown && Entry.documentMousedown.attach(this, function(a) { - Entry.disposeEvent.notify(a); - })); -}; -Entry.Utils.makeActivityReporter = function() { - Entry.activityReporter = new Entry.ActivityReporter; - Entry.commander && Entry.commander.addReporter(Entry.activityReporter); - return Entry.activityReporter; -}; -Entry.Utils.initEntryEvent_ = function() { - Entry.events_ || (Entry.events_ = []); -}; -Entry.sampleColours = []; -Entry.assert = function(b, a) { - if (!b) { - throw Error(a || "Assert failed"); - } -}; -Entry.parseTexttoXML = function(b) { - var a; - window.ActiveXObject ? (a = new ActiveXObject("Microsoft.XMLDOM"), a.async = "false", a.loadXML(b)) : a = (new DOMParser).parseFromString(b, "text/xml"); - return a; -}; -Entry.createElement = function(b, a) { - var c = document.createElement(b); - a && (c.id = a); - c.hasClass = function(a) { - return this.className.match(new RegExp("(\\s|^)" + a + "(\\s|$)")); - }; - c.addClass = function(a) { - for (var b = 0;b < arguments.length;b++) { - a = arguments[b], this.hasClass(a) || (this.className += " " + a); - } - }; - c.removeClass = function(a) { - for (var b = 0;b < arguments.length;b++) { - a = arguments[b], this.hasClass(a) && (this.className = this.className.replace(new RegExp("(\\s|^)" + a + "(\\s|$)"), " ")); - } - }; - c.bindOnClick = function(a) { - $(this).on("click tab", function(b) { - b.stopImmediatePropagation(); - a.call(this, b); - }); - }; - return c; -}; -Entry.makeAutolink = function(b) { - return b ? b.replace(/(http|https|ftp|telnet|news|irc):\/\/([-/.a-zA-Z0-9_~#%$?&=:200-377()][^)\]}]+)/gi, "$1://$2").replace(/([xA1-xFEa-z0-9_-]+@[xA1-xFEa-z0-9-]+.[a-z0-9-]+)/gi, "$1") : ""; -}; -Entry.generateHash = function() { - return ("0000" + (Math.random() * Math.pow(36, 4) << 0).toString(36)).substr(-4); -}; -Entry.addEventListener = function(b, a) { - this.events_ || (this.events_ = {}); - this.events_[b] || (this.events_[b] = []); - a instanceof Function && this.events_[b].push(a); - return !0; -}; -Entry.dispatchEvent = function(b, a) { - this.events_ || (this.events_ = {}); - if (this.events_[b]) { - for (var c = 0, d = this.events_[b].length;c < d;c++) { - this.events_[b][c].call(window, a); - } - } -}; -Entry.removeEventListener = function(b, a) { - if (this.events_[b]) { - for (var c = 0, d = this.events_[b].length;c < d;c++) { - if (this.events_[b][c] === a) { - this.events_[b].splice(c, 1); - break; - } - } - } -}; -Entry.removeAllEventListener = function(b) { - this.events_ && this.events_[b] && delete this.events_[b]; -}; -Entry.addTwoNumber = function(b, a) { - if (isNaN(b) || isNaN(a)) { - return b + a; - } - b += ""; - a += ""; - var c = b.indexOf("."), d = a.indexOf("."), e = 0, f = 0; - 0 < c && (e = b.length - c - 1); - 0 < d && (f = a.length - d - 1); - return 0 < e || 0 < f ? e >= 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 : b < a ? a : b; -}; -Entry.isExist = function(b, a, c) { - for (var d = 0;d < c.length;d++) { - if (c[d][a] == b) { - return c[d]; - } - } - return !1; -}; -Entry.getColourCodes = function() { - return "transparent #660000 #663300 #996633 #003300 #003333 #003399 #000066 #330066 #660066 #FFFFFF #990000 #993300 #CC9900 #006600 #336666 #0033FF #000099 #660099 #990066 #000000 #CC0000 #CC3300 #FFCC00 #009900 #006666 #0066FF #0000CC #663399 #CC0099 #333333 #FF0000 #FF3300 #FFFF00 #00CC00 #009999 #0099FF #0000FF #9900CC #FF0099 #666666 #CC3333 #FF6600 #FFFF33 #00FF00 #00CCCC #00CCFF #3366FF #9933FF #FF00FF #999999 #FF6666 #FF6633 #FFFF66 #66FF66 #66CCCC #00FFFF #3399FF #9966FF #FF66FF #BBBBBB #FF9999 #FF9966 #FFFF99 #99FF99 #66FFCC #99FFFF #66CCff #9999FF #FF99FF #CCCCCC #FFCCCC #FFCC99 #FFFFCC #CCFFCC #99FFCC #CCFFFF #99CCFF #CCCCFF #FFCCFF".split(" "); -}; -Entry.removeElement = function(b) { - b && b.parentNode && b.parentNode.removeChild(b); -}; -Entry.getElementsByClassName = function(b) { - for (var a = [], c = document.getElementsByTagName("*"), d = 0;d < c.length;d++) { - -1 < (" " + c[d].className + " ").indexOf(" " + b + " ") && a.push(c[d]); - } - return a; -}; -Entry.parseNumber = function(b) { - return "string" != typeof b || isNaN(Number(b)) ? "number" != typeof b || isNaN(Number(b)) ? !1 : b : Number(b); -}; -Entry.countStringLength = function(b) { - var a, c = 0; - for (a = 0;a < b.length;a++) { - 255 < b.charCodeAt(a) ? c += 2 : c++; - } - return c; -}; -Entry.cutStringByLength = function(b, a) { - var c, d = 0; - for (c = 0;d < a && c < b.length;c++) { - 255 < b.charCodeAt(c) ? d += 2 : d++; - } - return b.substr(0, c); -}; -Entry.isChild = function(b, a) { - if (!a) { - for (;a.parentNode;) { - if ((a = a.parentNode) == b) { - return !0; - } - } - } - return !1; -}; -Entry.launchFullScreen = function(b) { - b.requestFullscreen ? b.requestFullscreen() : b.mozRequestFulScreen ? b.mozRequestFulScreen() : b.webkitRequestFullscreen ? b.webkitRequestFullscreen() : b.msRequestFullScreen && b.msRequestFullScreen(); -}; -Entry.exitFullScreen = function() { - document.exitFullScreen ? document.exitFullScreen() : document.mozCancelFullScreen ? document.mozCancelFullScreen() : document.webkitExitFullscreen && document.webkitExitFullscreen(); -}; -Entry.isPhone = function() { - return !1; -}; -Entry.getKeyCodeMap = function() { - return {65:"a", 66:"b", 67:"c", 68:"d", 69:"e", 70:"f", 71:"g", 72:"h", 73:"i", 74:"j", 75:"k", 76:"l", 77:"m", 78:"n", 79:"o", 80:"p", 81:"q", 82:"r", 83:"s", 84:"t", 85:"u", 86:"v", 87:"w", 88:"x", 89:"y", 90:"z", 32:Lang.Blocks.START_press_some_key_space, 37:Lang.Blocks.START_press_some_key_left, 38:Lang.Blocks.START_press_some_key_up, 39:Lang.Blocks.START_press_some_key_right, 40:Lang.Blocks.START_press_some_key_down, 48:"0", 49:"1", 50:"2", 51:"3", 52:"4", 53:"5", 54:"6", 55:"7", 56:"8", 57:"9", - 13:Lang.Blocks.START_press_some_key_enter}; -}; -Entry.checkCollisionRect = function(b, a) { - return !(b.y + b.height < a.y || b.y > a.y + a.height || b.x + b.width < a.x || b.x > a.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 < b.length - 1;c += 2) { - a.push(parseInt(b.substr(c, 2), 16)); - } - return String.fromCharCode.apply(String, a); -}; -Entry.findObjsByKey = function(b, a, c) { - for (var d = [], e = 0;e < b.length;e++) { - b[e][a] == c && d.push(b[e]); - } - return d; -}; -Entry.factorials = []; -Entry.factorial = function(b) { - return 0 === b || 1 == b ? 1 : 0 < Entry.factorials[b] ? Entry.factorials[b] : Entry.factorials[b] = Entry.factorial(b - 1) * b; -}; -Entry.getListRealIndex = function(b, a) { - if (isNaN(b)) { - switch(b) { - case "FIRST": - b = 1; - break; - case "LAST": - b = a.array_.length; - break; - case "RANDOM": - b = Math.floor(Math.random() * a.array_.length) + 1; - } - } - return b; -}; -Entry.toRadian = function(b) { - return b * Math.PI / 180; -}; -Entry.toDegrees = function(b) { - return 180 * b / Math.PI; -}; -Entry.getPicturesJSON = function(b) { - for (var a = [], c = 0, d = b.length;c < d;c++) { - var e = b[c], f = {}; - f._id = e._id; - f.id = e.id; - f.dimension = e.dimension; - f.filename = e.filename; - f.fileurl = e.fileurl; - f.name = e.name; - f.scale = e.scale; - a.push(f); - } - return a; -}; -Entry.getSoundsJSON = function(b) { - for (var a = [], c = 0, d = b.length;c < d;c++) { - var e = b[c], f = {}; - f._id = e._id; - f.duration = e.duration; - f.ext = e.ext; - f.id = e.id; - f.filename = e.filename; - f.fileurl = e.fileurl; - f.name = e.name; - a.push(f); - } - return a; -}; -Entry.cutDecimal = function(b) { - return Math.round(100 * b) / 100; -}; -Entry.getBrowserType = function() { - if (Entry.userAgent) { - return Entry.userAgent; - } - var b = navigator.userAgent, a, c = b.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []; - if (/trident/i.test(c[1])) { - return a = /\brv[ :]+(\d+)/g.exec(b) || [], "IE " + (a[1] || ""); - } - if ("Chrome" === c[1] && (a = b.match(/\b(OPR|Edge)\/(\d+)/), null != a)) { - return a.slice(1).join(" ").replace("OPR", "Opera"); - } - c = c[2] ? [c[1], c[2]] : [navigator.appName, navigator.appVersion, "-?"]; - null != (a = b.match(/version\/(\d+)/i)) && c.splice(1, 1, a[1]); - b = c.join(" "); - return Entry.userAgent = b; -}; -Entry.setBasicBrush = function(b) { - var a = new createjs.Graphics; - a.thickness = 1; - a.rgb = Entry.hex2rgb("#ff0000"); - a.opacity = 100; - a.setStrokeStyle(1); - a.beginStroke("rgba(255,0,0,1)"); - var c = new createjs.Shape(a); - Entry.stage.selectedObjectContainer.addChild(c); - b.brush && (b.brush = null); - b.brush = a; - b.shape && (b.shape = null); - b.shape = c; -}; -Entry.setCloneBrush = function(b, a) { - var c = new createjs.Graphics; - c.thickness = a.thickness; - c.rgb = a.rgb; - c.opacity = a.opacity; - c.setStrokeStyle(c.thickness); - c.beginStroke("rgba(" + c.rgb.r + "," + c.rgb.g + "," + c.rgb.b + "," + c.opacity / 100 + ")"); - var d = new createjs.Shape(c); - Entry.stage.selectedObjectContainer.addChild(d); - b.brush && (b.brush = null); - b.brush = c; - b.shape && (b.shape = null); - b.shape = d; -}; -Entry.isFloat = function(b) { - return /\d+\.{1}\d+$/.test(b); -}; -Entry.getStringIndex = function(b) { - if (!b) { - return ""; - } - for (var a = {string:b, index:1}, c = 0, d = [], e = b.length - 1;0 < e;--e) { - var f = b.charAt(e); - if (isNaN(f)) { - break; - } else { - d.unshift(f), c = e; - } - } - 0 < c && (a.string = b.substring(0, c), a.index = parseInt(d.join("")) + 1); - return a; -}; -Entry.getOrderedName = function(b, a, c) { - if (!b) { - return "untitled"; - } - if (!a || 0 === a.length) { - return b; - } - c || (c = "name"); - for (var d = 0, e = Entry.getStringIndex(b), f = 0, g = a.length;f < g;f++) { - var h = Entry.getStringIndex(a[f][c]); - e.string === h.string && h.index > d && (d = h.index); - } - return 0 < d ? e.string + d : b; -}; -Entry.changeXmlHashId = function(b) { - if (/function_field/.test(b.getAttribute("type"))) { - for (var a = b.getElementsByTagName("mutation"), c = 0, d = a.length;c < d;c++) { - a[c].setAttribute("hashid", Entry.generateHash()); - } - } - return b; -}; -Entry.getMaxFloatPoint = function(b) { - for (var a = 0, c = 0, d = b.length;c < d;c++) { - var e = String(b[c]), f = e.indexOf("."); - -1 !== f && (e = e.length - (f + 1), e > a && (a = e)); - } - return Math.min(a, 20); -}; -Entry.convertToRoundedDecimals = function(b, a) { - return isNaN(b) || !this.isFloat(b) ? b : Number(Math.round(b + "e" + a) + "e-" + a); -}; -Entry.attachEventListener = function(b, a, c) { - setTimeout(function() { - b.addEventListener(a, c); - }, 0); -}; -Entry.deAttachEventListener = function(b, a, c) { - b.removeEventListener(a, c); -}; -Entry.isEmpty = function(b) { - if (!b) { - return !0; - } - for (var a in b) { - if (b.hasOwnProperty(a)) { - return !1; - } - } - return !0; -}; -Entry.Utils.disableContextmenu = function(b) { - if (b) { - $(b).on("contextmenu", function(a) { - a.stopPropagation(); - a.preventDefault(); - return !1; - }); - } -}; -Entry.Utils.isRightButton = function(b) { - return 2 == b.button || b.ctrlKey; -}; -Entry.Utils.isTouchEvent = function(b) { - return "mousedown" !== b.type.toLowerCase(); -}; -Entry.Utils.inherit = function(b, a) { - function c() { - } - c.prototype = b.prototype; - a.prototype = new c; - return a; -}; -Entry.bindAnimationCallbackOnce = function(b, a) { - b.one("webkitAnimationEnd animationendo animationend", a); -}; -Entry.Utils.isInInput = function(b) { - return "textarea" == b.target.type || "text" == b.target.type; -}; -Entry.Utils.isFunction = function(b) { - return "function" === typeof b; -}; -Entry.Utils.addFilters = function(b, a) { - var c = b.elem("defs"), d = c.elem("filter", {id:"entryTrashcanFilter_" + a}); - d.elem("feGaussianBlur", {"in":"SourceAlpha", stdDeviation:2, result:"blur"}); - d.elem("feOffset", {"in":"blur", dx:1, dy:1, result:"offsetBlur"}); - d = d.elem("feMerge"); - d.elem("feMergeNode", {"in":"offsetBlur"}); - d.elem("feMergeNode", {"in":"SourceGraphic"}, d); - d = c.elem("filter", {id:"entryBlockShadowFilter_" + a, height:"200%"}); - d.elem("feOffset", {result:"offOut", in:"SourceGraphic", dx:0, dy:1}); - d.elem("feColorMatrix", {result:"matrixOut", in:"offOut", type:"matrix", values:"0.7 0 0 0 0 0 0.7 0 0 0 0 0 0.7 0 0 0 0 0 1 0"}); - d.elem("feBlend", {in:"SourceGraphic", in1:"offOut", mode:"normal"}); - c = c.elem("filter", {id:"entryBlockHighlightFilter_" + a}); - c.elem("feOffset", {result:"offOut", in:"SourceGraphic", dx:0, dy:0}); - c.elem("feColorMatrix", {result:"matrixOut", in:"offOut", type:"matrix", values:"1.3 0 0 0 0 0 1.3 0 0 0 0 0 1.3 0 0 0 0 0 1 0"}); -}; -Entry.Utils.addBlockPattern = function(b, a) { - for (var c = b.elem("pattern", {id:"blockHoverPattern_" + a, class:"blockHoverPattern", patternUnits:"userSpaceOnUse", patternTransform:"translate(12, 0)", x:0, y:0, width:125, height:33, style:"display: none"}), d = c.elem("g"), e = d.elem("rect", {x:0, y:0, width:125, height:33}), f = Entry.mediaFilePath + "block_pattern_(order).png", g = 1;5 > g;g++) { - d.elem("image", {class:"pattern" + g, href:f.replace("(order)", g), x:0, y:0, width:125, height:33}); - } - return {pattern:c, rect:e}; -}; -Entry.Utils.COLLISION = {NONE:0, UP:1, RIGHT:2, LEFT:3, DOWN:4}; -Entry.Utils.createMouseEvent = function(b, a) { - var c = document.createEvent("MouseEvent"); - c.initMouseEvent(b, !0, !0, window, 0, 0, 0, a.clientX, a.clientY, !1, !1, !1, !1, 0, null); - return c; -}; -Entry.Utils.xmlToJsonData = function(b) { - b = $.parseXML(b); - var a = []; - b = b.childNodes[0].childNodes; - for (var c in b) { - var d = b[c]; - if (d.tagName) { - var e = {category:d.getAttribute("id"), blocks:[]}, d = d.childNodes; - for (c in d) { - var f = d[c]; - f.tagName && (f = f.getAttribute("type")) && e.blocks.push(f); - } - a.push(e); - } - } - return a; -}; -Entry.Utils.stopProjectWithToast = function(b, a, c) { - var d = b.block; - a = a || "\ub7f0\ud0c0\uc784 \uc5d0\ub7ec \ubc1c\uc0dd"; - Entry.toast && !c && Entry.toast.alert(Lang.Msgs.warn, Lang.Workspace.check_runtime_error, !0); - Entry.engine && Entry.engine.toggleStop(); - "workspace" === Entry.type && (b.block && "funcBlock" in b.block ? d = b.block.funcBlock : b.funcExecutor && (d = b.funcExecutor.scope.block, b = b.type.replace("func_", ""), Entry.Func.edit(Entry.variableContainer.functions_[b])), d && (Entry.container.selectObject(d.getCode().object.id, !0), d.view.getBoard().activateBlock(d))); - throw Error(a); -}; -Entry.Utils.AsyncError = function(b) { - this.name = "AsyncError"; - this.message = b || "\ube44\ub3d9\uae30 \ud638\ucd9c \ub300\uae30"; -}; -Entry.Utils.AsyncError.prototype = Error(); -Entry.Utils.AsyncError.prototype.constructor = Entry.Utils.AsyncError; -Entry.Utils.isChrome = function() { - return /chrom(e|ium)/.test(navigator.userAgent.toLowerCase()); -}; -Entry.Utils.waitForWebfonts = function(b, a) { - for (var c = 0, d = 0, e = b.length;d < e;++d) { - (function(d) { - function e() { - h && h.offsetWidth != k && (++c, h.parentNode.removeChild(h), h = null); - if (c >= b.length && (l && clearInterval(l), c == b.length)) { - return a(), !0; - } - } - var h = document.createElement("span"); - h.innerHTML = "giItT1WQy@!-/#"; - h.style.position = "absolute"; - h.style.left = "-10000px"; - h.style.top = "-10000px"; - h.style.fontSize = "300px"; - h.style.fontFamily = "sans-serif"; - h.style.fontVariant = "normal"; - h.style.fontStyle = "normal"; - h.style.fontWeight = "normal"; - h.style.letterSpacing = "0"; - document.body.appendChild(h); - var k = h.offsetWidth; - h.style.fontFamily = d; - var l; - e() || (l = setInterval(e, 50)); - })(b[d]); - } -}; -window.requestAnimFrame = function() { - return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(b) { - window.setTimeout(b, 1E3 / 60); - }; -}(); -Entry.isMobile = function() { - if (Entry.device) { - return "tablet" === Entry.device; - } - var b = window.platform; - if (b && b.type && ("tablet" === b.type || "mobile" === b.type)) { - return Entry.device = "tablet", !0; - } - Entry.device = "desktop"; - return !1; -}; -Entry.Utils.convertMouseEvent = function(b) { - return b.originalEvent && b.originalEvent.touches ? b.originalEvent.touches[0] : b; -}; -Entry.Utils.convertIntToHex = function(b) { - return b.toString(16).toUpperCase(); -}; -Entry.Model = function(b, a) { - var c = Entry.Model; - c.generateSchema(b); - c.generateSetter(b); - c.generateObserve(b); - (void 0 === a || a) && Object.seal(b); - return b; -}; -(function(b) { - b.generateSchema = function(a) { - var b = a.schema; - if (void 0 !== b) { - b = JSON.parse(JSON.stringify(b)); - a.data = {}; - for (var d in b) { - (function(d) { - a.data[d] = b[d]; - Object.defineProperty(a, d, {get:function() { - return a.data[d]; - }}); - })(d); - } - a._toJSON = this._toJSON; - } - }; - b.generateSetter = function(a) { - a.set = this.set; - }; - b.set = function(a, b) { - var d = {}, e; - for (e in this.data) { - void 0 !== a[e] && (a[e] === this.data[e] ? delete a[e] : (d[e] = this.data[e], this.data[e] = a[e] instanceof Array ? a[e].concat() : a[e])); - } - b || this.notify(Object.keys(a), d); - }; - b.generateObserve = function(a) { - a.observers = []; - a.observe = this.observe; - a.unobserve = this.unobserve; - a.notify = this.notify; - }; - b.observe = function(a, b, d, e) { - d = new Entry.Observer(this.observers, a, b, d); - if (!1 !== e) { - a[b]([]); - } - return d; - }; - b.unobserve = function(a) { - a.destroy(); - }; - b.notify = function(a, b) { - "string" === typeof a && (a = [a]); - var d = this; - d.observers.map(function(e) { - var f = a; - void 0 !== e.attrs && (f = Entry.Utils.intersectArray(e.attrs, a)); - if (f.length) { - e.object[e.funcName](f.map(function(a) { - return {name:a, object:d, oldValue:b[a]}; - })); - } - }); - }; - b._toJSON = function() { - var a = {}, b; - for (b in this.data) { - a[b] = this.data[b]; - } - return a; - }; -})(Entry.Model); -Entry.Func = function(b) { - this.id = b ? b.id : Entry.generateHash(); - this.content = b ? new Entry.Code(b.content) : new Entry.Code([[{type:"function_create", copyable:!1, deletable:!1, x:40, y:40}]]); - this.blockMenuBlock = this.block = null; - this.hashMap = {}; - this.paramMap = {}; - var a = function() { - }; - a.prototype = Entry.block.function_general; - a = new a; - a.changeEvent = new Entry.Event; - a.template = Lang.template.function_general; - Entry.block["func_" + this.id] = a; - if (b) { - b = this.content._blockMap; - for (var c in b) { - Entry.Func.registerParamBlock(b[c].type); - } - Entry.Func.generateWsBlock(this); - } - Entry.Func.registerFunction(this); - Entry.Func.updateMenu(); -}; -Entry.Func.threads = {}; -Entry.Func.registerFunction = function(b) { - if (Entry.playground) { - var a = Entry.playground.mainWorkspace; - a && (this._targetFuncBlock = a.getBlockMenu().getCategoryCodes("func").createThread([{type:"func_" + b.id}]), b.blockMenuBlock = this._targetFuncBlock); - } -}; -Entry.Func.executeFunction = function(b) { - var a = this.threads[b]; - if (a = Entry.Engine.computeThread(a.entity, a)) { - return this.threads[b] = a, !0; - } - delete this.threads[b]; - return !1; -}; -Entry.Func.clearThreads = function() { - this.threads = {}; -}; -Entry.Func.prototype.init = function(b) { - this.id = b.id; - this.content = Blockly.Xml.textToDom(b.content); - this.block = Blockly.Xml.textToDom("" + b.block + "").childNodes[0]; -}; -Entry.Func.prototype.destroy = function() { - this.blockMenuBlock.destroy(); -}; -Entry.Func.edit = function(b) { - this.cancelEdit(); - this.targetFunc = b; - this.initEditView(b.content); - this.bindFuncChangeEvent(); - this.updateMenu(); -}; -Entry.Func.initEditView = function(b) { - this.menuCode || this.setupMenuCode(); - var a = Entry.playground.mainWorkspace; - a.setMode(Entry.Workspace.MODE_OVERLAYBOARD); - a.changeOverlayBoardCode(b); - this._workspaceStateEvent = a.changeEvent.attach(this, this.endEdit); -}; -Entry.Func.endEdit = function(b) { - this.unbindFuncChangeEvent(); - this._workspaceStateEvent.destroy(); - delete this._workspaceStateEvent; - switch(b) { - case "save": - this.save(); - case "cancelEdit": - this.cancelEdit(); - } -}; -Entry.Func.save = function() { - this.targetFunc.generateBlock(!0); - Entry.variableContainer.saveFunction(this.targetFunc); -}; -Entry.Func.syncFuncName = function(b) { - var a = 0, c = [], c = b.split(" "), d = ""; - b = []; - b = Blockly.mainWorkspace.getAllBlocks(); - for (var e = 0;e < b.length;e++) { - var f = b[e]; - if ("function_general" === f.type) { - for (var g = [], g = f.inputList, h = 0;h < g.length;h++) { - f = g[h], 0 < f.fieldRow.length && f.fieldRow[0] instanceof Blockly.FieldLabel && void 0 != f.fieldRow[0].text_ && (d += f.fieldRow[0].text_, d += " "); - } - d = d.trim(); - if (d === this.srcFName && this.srcFName.split(" ").length == c.length) { - for (d = 0;d < g.length;d++) { - if (f = g[d], 0 < f.fieldRow.length && f.fieldRow[0] instanceof Blockly.FieldLabel && void 0 != f.fieldRow[0].text_) { - if (void 0 === c[a]) { - g.splice(d, 1); - break; - } else { - f.fieldRow[0].text_ = c[a]; - } - a++; - } - } - } - d = ""; - a = 0; - } - } - a = Blockly.Xml.workspaceToDom(Blockly.mainWorkspace); - Blockly.mainWorkspace.clear(); - Blockly.Xml.domToWorkspace(Blockly.mainWorkspace, a); -}; -Entry.Func.cancelEdit = function() { - this.targetFunc && (Entry.Func.isEdit = !1, this.targetFunc.block || (this._targetFuncBlock.destroy(), delete Entry.variableContainer.functions_[this.targetFunc.id], delete Entry.variableContainer.selected), delete this.targetFunc, this.updateMenu(), Entry.variableContainer.updateList(), Entry.playground.mainWorkspace.setMode(Entry.Workspace.MODE_BOARD)); -}; -Entry.Func.getMenuXml = function() { - var b = []; - this.targetFunc || (b = b.concat(this.createBtn)); - if (this.targetFunc) { - var a = this.FIELD_BLOCK, a = a.replace("#1", Entry.generateHash()), a = a.replace("#2", Entry.generateHash()), a = Blockly.Xml.textToDom(a).childNodes, b = b.concat(Entry.nodeListToArray(a)) - } - for (var c in Entry.variableContainer.functions_) { - a = Entry.variableContainer.functions_[c], a === this.targetFunc ? (a = Entry.Func.generateBlock(this.targetFunc, Blockly.Xml.workspaceToDom(Entry.Func.workspace), a.id).block, b.push(a)) : b.push(a.block); - } - return b; -}; -Entry.Func.syncFunc = function() { - var b = Entry.Func; - if (b.targetFunc) { - var a = b.workspace.topBlocks_[0].toString(), c = b.workspace.topBlocks_.length; - (b.fieldText != a || b.workspaceLength != c) && 1 > Blockly.Block.dragMode_ && (b.updateMenu(), b.fieldText = a, b.workspaceLength = c); - } -}; -Entry.Func.setupMenuCode = function() { - var b = Entry.playground.mainWorkspace; - b && (b = b.getBlockMenu().getCategoryCodes("func"), this._fieldLabel = b.createThread([{type:"function_field_label"}]).getFirstBlock(), this._fieldString = b.createThread([{type:"function_field_string", params:[{type:this.requestParamBlock("string")}]}]).getFirstBlock(), this._fieldBoolean = b.createThread([{type:"function_field_boolean", params:[{type:this.requestParamBlock("boolean")}]}]).getFirstBlock(), this.menuCode = b); -}; -Entry.Func.refreshMenuCode = function() { - if (Entry.playground.mainWorkspace) { - this.menuCode || this.setupMenuCode(); - var b = Entry.block[this._fieldString.params[0].type].changeEvent._listeners.length; - 2 < b && this._fieldString.params[0].changeType(this.requestParamBlock("string")); - b = Entry.block[this._fieldBoolean.params[0].type].changeEvent._listeners.length; - 2 < b && this._fieldBoolean.params[0].changeType(this.requestParamBlock("boolean")); - } -}; -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 < b.indexOf("stringParam") ? Entry.Func.createParamBlock(b, Entry.block.function_param_string, b) : -1 < b.indexOf("booleanParam") && Entry.Func.createParamBlock(b, Entry.block.function_param_boolean, b); -}; -Entry.Func.createParamBlock = function(b, a, c) { - var d = function() { - }; - c = "string" === c ? "function_param_string" : "function_param_boolean"; - d.prototype = a; - d = new d; - d.changeEvent = new Entry.Event; - d.template = Lang.template[c]; - return Entry.block[b] = d; -}; -Entry.Func.updateMenu = function() { - if (Entry.playground && Entry.playground.mainWorkspace) { - var b = Entry.playground.mainWorkspace.getBlockMenu(); - this.targetFunc ? (this.menuCode || this.setupMenuCode(), b.banClass("functionInit"), b.unbanClass("functionEdit")) : (b.unbanClass("functionInit"), b.banClass("functionEdit")); - b.reDraw(); - } -}; -Entry.Func.prototype.edit = function() { - Entry.Func.isEdit || (Entry.Func.isEdit = !0, Entry.Func.svg ? this.parentView.appendChild(this.svg) : Entry.Func.initEditView()); -}; -Entry.Func.generateBlock = function(b) { - b = Entry.block["func_" + b.id]; - 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; - } - return {block:a, description:e}; -}; -Entry.Func.prototype.generateBlock = function(b) { - b = Entry.Func.generateBlock(this); - this.block = b.block; - this.description = b.description; -}; -Entry.Func.generateWsBlock = function(b) { - this.unbindFuncChangeEvent(); - b = b ? b : this.targetFunc; - for (var a = b.content.getEventMap("funcDef")[0].params[0], c = 0, d = 0, e = [], f = "", g = b.hashMap, h = b.paramMap;a;) { - var k = a.params[0]; - switch(a.type) { - case "function_field_label": - f = f + " " + k; - break; - case "function_field_boolean": - Entry.Mutator.mutate(k.type, {template:Lang.Blocks.FUNCTION_logical_variable + " " + (c ? c : "")}); - g[k.type] = !1; - h[k.type] = c + d; - c++; - e.push({type:"Block", accept:"boolean"}); - f += " %" + (c + d); - break; - case "function_field_string": - Entry.Mutator.mutate(k.type, {template:Lang.Blocks.FUNCTION_character_variable + " " + (d ? d : "")}), g[k.type] = !1, h[k.type] = c + d, d++, f += " %" + (c + d), e.push({type:"Block", accept:"string"}); - } - a = a.getOutputBlock(); - } - c++; - f += " %" + (c + d); - e.push({type:"Indicator", img:"block_icon/function_03.png", size:12}); - Entry.Mutator.mutate("func_" + b.id, {params:e, template:f}); - for (var l in g) { - g[l] ? (a = -1 < l.indexOf("string") ? Lang.Blocks.FUNCTION_character_variable : Lang.Blocks.FUNCTION_logical_variable, Entry.Mutator.mutate(l, {template:a})) : g[l] = !0; - } - this.bindFuncChangeEvent(b); -}; -Entry.Func.bindFuncChangeEvent = function(b) { - b = b ? b : this.targetFunc; - !this._funcChangeEvent && b.content.getEventMap("funcDef")[0].view && (this._funcChangeEvent = b.content.getEventMap("funcDef")[0].view._contents[1].changeEvent.attach(this, this.generateWsBlock)); -}; -Entry.Func.unbindFuncChangeEvent = function() { - this._funcChangeEvent && this._funcChangeEvent.destroy(); - delete this._funcChangeEvent; -}; -Entry.HWMontior = {}; -Entry.HWMonitor = function(b) { - this.svgDom = Entry.Dom($('')); - this._hwModule = b; - var a = this; - Entry.addEventListener("windowResized", function() { - var b = a._hwModule.monitorTemplate.mode; - "both" == b && (a.resize(), a.resizeList()); - "list" == b ? a.resizeList() : a.resize(); - }); - Entry.addEventListener("hwModeChange", function() { - a.changeMode(); - }); - this.changeOffset = 0; - this.scale = .5; - this._listPortViews = {}; -}; -(function(b) { - b.initView = function() { - this.svgDom = Entry.Dom($('')); - }; - b.generateView = function() { - this.snap = Entry.SVG("hwMonitor"); - this._svgGroup = this.snap.elem("g"); - this._portMap = {n:[], e:[], s:[], w:[]}; - var a = this._hwModule.monitorTemplate, b = {href:Entry.mediaFilePath + a.imgPath, x:-a.width / 2, y:-a.height / 2, width:a.width, height:a.height}; - this._portViews = {}; - this.hwView = this._svgGroup.elem("image"); - this.hwView = this.hwView.attr(b); - this._template = a; - a = a.ports; - this.pathGroup = null; - this.pathGroup = this._svgGroup.elem("g"); - var b = [], d; - for (d in a) { - var e = this.generatePortView(a[d], "_svgGroup"); - this._portViews[d] = e; - b.push(e); - } - b.sort(function(a, b) { - return a.box.x - b.box.x; - }); - var f = this._portMap; - b.map(function(a) { - (1 > (Math.atan2(-a.box.y, a.box.x) / Math.PI + 2) % 2 ? f.n : f.s).push(a); - }); - this.resize(); - }; - b.toggleMode = function(a) { - var b = this._hwModule.monitorTemplate; - "list" == a ? (b.TempPort = null, this._hwModule.monitorTemplate.ports && (this._hwModule.monitorTemplate.TempPort = this._hwModule.monitorTemplate.ports, this._hwModule.monitorTemplate.listPorts = this.addPortEle(this._hwModule.monitorTemplate.listPorts, this._hwModule.monitorTemplate.ports)), $(this._svglistGroup).remove(), this._svgGroup && $(this._svgGroup).remove(), $(this._pathGroup).remove(), this._hwModule.monitorTemplate.mode = "list", this.generateListView()) : (this._hwModule.monitorTemplate.TempPort && - (this._hwModule.monitorTemplate.ports = this._hwModule.monitorTemplate.TempPort, this._hwModule.monitorTemplate.listPorts = this.removePortEle(this._hwModule.monitorTemplate.listPorts, this._hwModule.monitorTemplate.ports)), $(this._svglistGroup).remove(), this._hwModule.monitorTemplate.mode = "both", this.generateListView(), this.generateView()); - }; - b.setHwmonitor = function(a) { - this._hwmodule = a; - }; - b.changeMode = function(a) { - "both" == this._hwModule.monitorTemplate.mode ? this.toggleMode("list") : "list" == this._hwModule.monitorTemplate.mode && this.toggleMode("both"); - }; - b.addPortEle = function(a, b) { - if ("object" != typeof b) { - return a; - } - for (var d in b) { - a[d] = b[d]; - } - return a; - }; - b.removePortEle = function(a, b) { - if ("object" != typeof b) { - return a; - } - for (var d in b) { - delete a[d]; - } - return a; - }; - b.generateListView = function() { - this._portMapList = {n:[]}; - this._svglistGroup = null; - this.listsnap = Entry.SVG("hwMonitor"); - this._svglistGroup = this.listsnap.elem("g"); - var a = this._hwModule.monitorTemplate; - this._template = a; - a = a.listPorts; - this.pathGroup = this._svglistGroup.elem("g"); - var b = [], d; - for (d in a) { - var e = this.generatePortView(a[d], "_svglistGroup"); - this._listPortViews[d] = e; - b.push(e); - } - var f = this._portMapList; - b.map(function(a) { - f.n.push(a); - }); - this.resizeList(); - }; - b.generatePortView = function(a, b) { - var d = this[b].elem("g"); - d.addClass("hwComponent"); - var e = null, e = this.pathGroup.elem("path").attr({d:"m0,0", fill:"none", stroke:"input" === a.type ? "#00979d" : "#A751E3", "stroke-width":3}), f = d.elem("rect").attr({x:0, y:0, width:150, height:22, rx:4, ry:4, fill:"#fff", stroke:"#a0a1a1"}), g = d.elem("text").attr({x:4, y:12, fill:"#000", "class":"hwComponentName", "alignment-baseline":"central"}); - g.textContent = a.name; - g = g.getComputedTextLength(); - d.elem("rect").attr({x:g + 8, y:2, width:30, height:18, rx:9, ry:9, fill:"input" === a.type ? "#00979d" : "#A751E3"}); - var h = d.elem("text").attr({x:g + 13, y:12, fill:"#fff", "class":"hwComponentValue", "alignment-baseline":"central"}); - h.textContent = 0; - g += 40; - f.attr({width:g}); - return {group:d, value:h, type:a.type, path:e, box:{x:a.pos.x - this._template.width / 2, y:a.pos.y - this._template.height / 2, width:g}, width:g}; - }; - b.getView = function() { - return this.svgDom; - }; - b.update = function() { - var a = Entry.hw.portData, b = Entry.hw.sendQueue, d = this._hwModule.monitorTemplate.mode, e = this._hwModule.monitorTemplate.keys || [], f = []; - if ("list" == d) { - f = this._listPortViews; - } else { - if ("both" == d) { - if (f = this._listPortViews, this._portViews) { - for (var g in this._portViews) { - f[g] = this._portViews[g]; - } - } - } else { - f = this._portViews; - } - } - if (b) { - for (g in b) { - 0 != b[g] && f[g] && (f[g].type = "output"); - } - } - for (var h in f) { - if (d = f[h], "input" == d.type) { - var k = a[h]; - 0 < e.length && $.each(e, function(a, b) { - if ($.isPlainObject(k)) { - k = k[b] || 0; - } else { - return !1; - } - }); - d.value.textContent = k ? k : 0; - d.group.getElementsByTagName("rect")[1].attr({fill:"#00979D"}); - } else { - k = b[h], 0 < e.length && $.each(e, function(a, b) { - if ($.isPlainObject(k)) { - k = k[b] || 0; - } else { - return !1; - } - }), d.value.textContent = k ? k : 0, d.group.getElementsByTagName("rect")[1].attr({fill:"#A751E3"}); - } - } - }; - b.resize = function() { - this.hwView && this.hwView.attr({transform:"scale(" + this.scale + ")"}); - if (this.svgDom) { - var a = this.svgDom.get(0).getBoundingClientRect() - } - this._svgGroup.attr({transform:"translate(" + a.width / 2 + "," + a.height / 1.8 + ")"}); - this._rect = a; - 0 >= this._template.height || 0 >= a.height || (this.scale = a.height / this._template.height * this._template.height / 1E3, this.align()); - }; - b.resizeList = function() { - var a = this.svgDom.get(0).getBoundingClientRect(); - this._svglistGroup.attr({transform:"translate(" + a.width / 2 + "," + a.height / 2 + ")"}); - this._rect = a; - this.alignList(); - }; - b.align = function() { - var a = [], a = this._portMap.s.concat(); - this._alignNS(a, this.scale / 3 * this._template.height + 5, 27); - a = this._portMap.n.concat(); - this._alignNS(a, -this._template.height * this.scale / 3 - 32, -27); - a = this._portMap.e.concat(); - this._alignEW(a, -this._template.width * this.scale / 3 - 5, -27); - a = this._portMap.w.concat(); - this._alignEW(a, this._template.width * this.scale / 3 - 32, -27); - }; - b.alignList = function() { - for (var a = {}, a = this._hwModule.monitorTemplate.listPorts, b = a.length, d = 0;d < a.length;d++) { - a[d].group.attr({transform:"translate(" + this._template.width * (d / b - .5) + "," + (-this._template.width / 2 - 30) + ")"}); - } - a = this._portMapList.n.concat(); - this._alignNSList(a, -this._template.width * this.scale / 2 - 32, -27); - }; - b._alignEW = function(a, b, d) { - var e = a.length, f = this._rect.height - 50; - tP = -f / 2; - bP = f / 2; - height = this._rect.height; - listVLine = wholeHeight = 0; - mode = this._hwModule.monitorTemplate; - for (f = 0;f < e;f++) { - wholeHeight += a[f].height + 5; - } - wholeHeight < bP - tP && (bP = wholeHeight / 2 + 3, tP = -wholeHeight / 2 - 3); - for (;1 < e;) { - var g = a.shift(), f = a.pop(), h = tP, k = bP, l = d; - wholeWidth <= bP - tP ? (tP += g.width + 5, bP -= f.width + 5, l = 0) : 0 === a.length ? (tP = (tP + bP) / 2 - 3, bP = tP + 6) : (tP = Math.max(tP, -width / 2 + g.width) + 15, bP = Math.min(bP, width / 2 - f.width) - 15); - wholeWidth -= g.width + f.width + 10; - b += l; - } - a.length && a[0].group.attr({transform:"translate(" + b + ",60)"}); - g && rPort && (this._movePort(g, b, tP, h), this._movePort(rPort, b, bP, k)); - }; - b._alignNS = function(a, b, d) { - for (var e = -this._rect.width / 2, f = this._rect.width / 2, g = this._rect.width, h = 0, k = 0;k < a.length;k++) { - h += a[k].width + 5; - } - h < f - e && (f = h / 2 + 3, e = -h / 2 - 3); - for (;1 < a.length;) { - var k = a.shift(), l = a.pop(), n = e, m = f, q = d; - h <= f - e ? (e += k.width + 5, f -= l.width + 5, q = 0) : 0 === a.length ? (e = (e + f) / 2 - 3, f = e + 6) : (e = Math.max(e, -g / 2 + k.width) + 15, f = Math.min(f, g / 2 - l.width) - 15); - this._movePort(k, e, b, n); - this._movePort(l, f, b, m); - h -= k.width + l.width + 10; - b += q; - } - a.length && this._movePort(a[0], (f + e - a[0].width) / 2, b, 100); - }; - b._alignNSList = function(a, b) { - var d = this._rect.width; - initX = -this._rect.width / 2 + 10; - initY = -this._rect.height / 2 + 10; - for (var e = listLine = wholeWidth = 0;e < a.length;e++) { - wholeWidth += a[e].width; - } - for (var f = 0, g = 0, h = initX, k = 0, l = 0, n = 0, e = 0;e < a.length;e++) { - l = a[e], e != a.length - 1 && (n = a[e + 1]), g += l.width, lP = initX, k = initY + 30 * f, l.group.attr({transform:"translate(" + lP + "," + k + ")"}), initX += l.width + 10, g > d - (l.width + n.width / 2.2) && (f += 1, initX = h, g = 0); - } - }; - b._movePort = function(a, b, d, e) { - var f = b, g = a.box.x * this.scale, h = a.box.y * this.scale; - b > e ? (f = b - a.width, b = b > g && g > e ? "M" + g + "," + d + "L" + g + "," + h : "M" + (b + e) / 2 + "," + d + "l0," + (h > d ? 28 : -3) + "H" + g + "L" + g + "," + h) : b = b < g && g < e ? "m" + g + "," + d + "L" + g + "," + h : "m" + (e + b) / 2 + "," + d + "l0," + (h > d ? 28 : -3) + "H" + g + "L" + g + "," + h; - a.group.attr({transform:"translate(" + f + "," + d + ")"}); - a.path.attr({d:b}); - }; -})(Entry.HWMonitor.prototype); -Entry.HW = function() { - this.connectTrial = 0; - this.isFirstConnect = !0; - this.initSocket(); - this.connected = !1; - this.portData = {}; - this.sendQueue = {}; - this.outputQueue = {}; - this.settingQueue = {}; - this.socketType = this.hwModule = this.selectedDevice = null; - Entry.addEventListener("stop", this.setZero); - this.hwInfo = {"1.1":Entry.Arduino, "1.9":Entry.ArduinoExt, "1.2":Entry.SensorBoard, "1.3":Entry.CODEino, "1.4":Entry.joystick, "1.5":Entry.dplay, "1.6":Entry.nemoino, "1.7":Entry.Xbot, "1.8":Entry.ardublock, "2.4":Entry.Hamster, "2.5":Entry.Albert, "3.1":Entry.Bitbrick, "4.2":Entry.Arduino, "5.1":Entry.Neobot, "7.1":Entry.Robotis_carCont, "7.2":Entry.Robotis_openCM70, "8.1":Entry.Arduino}; -}; -Entry.HW.TRIAL_LIMIT = 1; -p = Entry.HW.prototype; -p.initSocket = function() { - try { - if (this.connectTrial >= Entry.HW.TRIAL_LIMIT) { - this.isFirstConnect || Entry.toast.alert(Lang.Menus.connect_hw, Lang.Menus.connect_fail, !1), this.isFirstConnect = !1; - } else { - var b = this, a, c; - this.connected = !1; - this.connectTrial++; - if (-1 < location.protocol.indexOf("https")) { - c = new WebSocket("wss://hardware.play-entry.org:23518"); - } else { - try { - a = new WebSocket("ws://127.0.0.1:23518"), a.binaryType = "arraybuffer", a.onopen = function() { - b.socketType = "WebSocket"; - b.initHardware(a); - }.bind(this), a.onmessage = function(a) { - a = 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.updatePortData = function(b) { - this.portData = b; - this.hwMonitor && "hw" == Entry.propertyPanel.selected && 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.8_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 = [Entry.Utils.convertIntToHex(b.company), ".", Entry.Utils.convertIntToHex(b.model)].join(""), 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; -}; -Entry.Stage.prototype.initStage = function(b) { - this.canvas = new createjs.Stage(b.id); - this.canvas.x = 320; - this.canvas.y = 180; - this.canvas.scaleX = this.canvas.scaleY = 2 / 1.5; - createjs.Touch.enable(this.canvas); - this.canvas.enableMouseOver(10); - this.canvas.mouseMoveOutside = !0; - this.canvas.addChild(this.background); - this.canvas.addChild(this.variableContainer); - this.canvas.addChild(this.dialogContainer); - this.inputField = null; - this.initCoordinator(); - this.initHandle(); - this.mouseCoordinate = {x:0, y:0}; - if (Entry.isPhone()) { - b.ontouchstart = function(a) { - Entry.dispatchEvent("canvasClick", a); - Entry.stage.isClick = !0; - }, b.ontouchend = function(a) { - Entry.stage.isClick = !1; - Entry.dispatchEvent("canvasClickCanceled", a); - }; - } else { - var a = function(a) { - Entry.dispatchEvent("canvasClick", a); - Entry.stage.isClick = !0; - }; - b.onmousedown = a; - b.ontouchstart = a; - a = function(a) { - Entry.stage.isClick = !1; - Entry.dispatchEvent("canvasClickCanceled", a); - }; - b.onmouseup = a; - b.ontouchend = a; - $(document).click(function(a) { - Entry.stage.focused = "entryCanvas" === a.target.id ? !0 : !1; - }); - } - Entry.addEventListener("canvasClick", function(a) { - Entry.stage.isObjectClick = !1; - }); - Entry.windowResized.attach(this, function() { - Entry.stage.updateBoundRect(); - }); - a = function(a) { - a.preventDefault(); - var b = Entry.stage.getBoundRect(), e; - -1 < Entry.getBrowserType().indexOf("IE") ? (e = 480 * ((a.pageX - b.left - document.documentElement.scrollLeft) / b.width - .5), a = -270 * ((a.pageY - b.top - document.documentElement.scrollTop) / b.height - .5)) : a.changedTouches ? (e = 480 * ((a.changedTouches[0].pageX - b.left - document.body.scrollLeft) / b.width - .5), a = -270 * ((a.changedTouches[0].pageY - b.top - document.body.scrollTop) / b.height - .5)) : (e = 480 * ((a.pageX - b.left - document.body.scrollLeft) / b.width - .5), - a = -270 * ((a.pageY - b.top - document.body.scrollTop) / b.height - .5)); - Entry.stage.mouseCoordinate = {x:e.toFixed(1), y:a.toFixed(1)}; - Entry.dispatchEvent("stageMouseMove"); - }; - b.onmousemove = a; - b.ontouchmove = a; - b.onmouseout = function(a) { - Entry.dispatchEvent("stageMouseOut"); - }; - Entry.addEventListener("updateObject", function(a) { - Entry.engine.isState("stop") && Entry.stage.updateObject(); - }); - Entry.addEventListener("canvasInputComplete", function(a) { - try { - var b = Entry.stage.inputField.value(); - Entry.stage.hideInputField(); - if (b) { - var e = Entry.container; - e.setInputValue(b); - e.inputValue.complete = !0; - } - } catch (f) { - } - }); - this.initWall(); - this.render(); -}; -Entry.Stage.prototype.render = function() { - Entry.stage.timer && clearTimeout(Entry.stage.timer); - var b = (new Date).getTime(); - Entry.stage.update(); - b = (new Date).getTime() - b; - Entry.stage.timer = setTimeout(Entry.stage.render, 16 - b % 16 + 16 * Math.floor(b / 16)); -}; -Entry.Stage.prototype.update = function() { - Entry.requestUpdate ? (Entry.engine.isState("stop") && this.objectUpdated ? (this.canvas.update(), this.objectUpdated = !1) : this.canvas.update(), this.inputField && !this.inputField._isHidden && this.inputField.render(), Entry.requestUpdateTwice ? Entry.requestUpdateTwice = !1 : Entry.requestUpdate = !1) : Entry.requestUpdate = !1; -}; -Entry.Stage.prototype.loadObject = function(b) { - var a = b.entity.object; - this.getObjectContainerByScene(b.scene).addChild(a); - this.canvas.update(); -}; -Entry.Stage.prototype.loadEntity = function(b) { - Entry.stage.getObjectContainerByScene(b.parent.scene).addChild(b.object); - this.sortZorder(); -}; -Entry.Stage.prototype.unloadEntity = function(b) { - Entry.stage.getObjectContainerByScene(b.parent.scene).removeChild(b.object); -}; -Entry.Stage.prototype.loadVariable = function(b) { - var a = b.view_; - this.variables[b.id] = a; - this.variableContainer.addChild(a); - Entry.requestUpdate = !0; -}; -Entry.Stage.prototype.removeVariable = function(b) { - this.variableContainer.removeChild(b.view_); - Entry.requestUpdate = !0; -}; -Entry.Stage.prototype.loadDialog = function(b) { - this.dialogContainer.addChild(b.object); -}; -Entry.Stage.prototype.unloadDialog = function(b) { - this.dialogContainer.removeChild(b.object); -}; -Entry.Stage.prototype.sortZorder = function() { - for (var b = Entry.container.getCurrentObjects(), a = this.selectedObjectContainer, c = 0, d = b.length - 1;0 <= d;d--) { - for (var e = b[d], f = e.entity, e = e.clonedEntities, g = 0, h = e.length;g < h;g++) { - e[g].shape && a.setChildIndex(e[g].shape, c++), a.setChildIndex(e[g].object, c++); - } - f.shape && a.setChildIndex(f.shape, c++); - a.setChildIndex(f.object, c++); - } -}; -Entry.Stage.prototype.initCoordinator = function() { - var b = new createjs.Container, a = new createjs.Bitmap(Entry.mediaFilePath + "workspace_coordinate.png"); - a.scaleX = .5; - a.scaleY = .5; - a.x = -240; - a.y = -135; - b.addChild(a); - this.canvas.addChild(b); - b.visible = !1; - this.coordinator = b; -}; -Entry.Stage.prototype.toggleCoordinator = function() { - this.coordinator.visible = !this.coordinator.visible; - Entry.requestUpdate = !0; -}; -Entry.Stage.prototype.selectObject = function(b) { - this.selectedObject = b ? b : null; - this.updateObject(); -}; -Entry.Stage.prototype.initHandle = function() { - this.handle = new EaselHandle(this.canvas); - this.handle.setChangeListener(this, this.updateHandle); - this.handle.setEditStartListener(this, this.startEdit); - this.handle.setEditEndListener(this, this.endEdit); -}; -Entry.Stage.prototype.updateObject = function() { - Entry.requestUpdate = !0; - this.handle.setDraggable(!0); - if (!this.editEntity) { - var b = this.selectedObject; - if (b) { - "textBox" == b.objectType ? this.handle.toggleCenter(!1) : this.handle.toggleCenter(!0); - "free" == b.getRotateMethod() ? this.handle.toggleRotation(!0) : this.handle.toggleRotation(!1); - this.handle.toggleDirection(!0); - b.getLock() ? (this.handle.toggleRotation(!1), this.handle.toggleDirection(!1), this.handle.toggleResize(!1), this.handle.toggleCenter(!1), this.handle.setDraggable(!1)) : this.handle.toggleResize(!0); - this.handle.setVisible(!0); - var a = b.entity; - this.handle.setWidth(a.getScaleX() * a.getWidth()); - this.handle.setHeight(a.getScaleY() * a.getHeight()); - var c, d; - if ("textBox" == a.type) { - if (a.getLineBreak()) { - c = a.regX * a.scaleX, d = -a.regY * a.scaleY; - } else { - var e = a.getTextAlign(); - d = -a.regY * a.scaleY; - switch(e) { - case Entry.TEXT_ALIGN_LEFT: - c = -a.getWidth() / 2 * a.scaleX; - break; - case Entry.TEXT_ALIGN_CENTER: - c = a.regX * a.scaleX; - break; - case Entry.TEXT_ALIGN_RIGHT: - c = a.getWidth() / 2 * a.scaleX; - } - } - } else { - c = (a.regX - a.width / 2) * a.scaleX, d = (a.height / 2 - a.regY) * a.scaleY; - } - e = a.getRotation() / 180 * Math.PI; - this.handle.setX(a.getX() - c * Math.cos(e) - d * Math.sin(e)); - this.handle.setY(-a.getY() - c * Math.sin(e) + d * Math.cos(e)); - this.handle.setRegX((a.regX - a.width / 2) * a.scaleX); - this.handle.setRegY((a.regY - a.height / 2) * a.scaleY); - this.handle.setRotation(a.getRotation()); - this.handle.setDirection(a.getDirection()); - this.objectUpdated = !0; - this.handle.setVisible(b.entity.getVisible()); - b.entity.getVisible() && this.handle.render(); - } else { - this.handle.setVisible(!1); - } - } -}; -Entry.Stage.prototype.updateHandle = function() { - this.editEntity = !0; - var b = this.handle, a = this.selectedObject.entity; - if (a.lineBreak) { - a.setHeight(b.height / a.getScaleY()), a.setWidth(b.width / a.getScaleX()); - } else { - if (0 !== a.width) { - var c = Math.abs(b.width / a.width); - a.flip && (c *= -1); - a.setScaleX(c); - } - 0 !== a.height && a.setScaleY(b.height / a.height); - } - c = b.rotation / 180 * Math.PI; - if ("textBox" == a.type) { - var d = b.regX / a.scaleX, d = b.regY / a.scaleY; - if (a.getLineBreak()) { - a.setX(b.x), a.setY(-b.y); - } else { - switch(a.getTextAlign()) { - case Entry.TEXT_ALIGN_LEFT: - a.setX(b.x - b.width / 2 * Math.cos(c)); - a.setY(-b.y + b.width / 2 * Math.sin(c)); - break; - case Entry.TEXT_ALIGN_CENTER: - a.setX(b.x); - a.setY(-b.y); - break; - case Entry.TEXT_ALIGN_RIGHT: - a.setX(b.x + b.width / 2 * Math.cos(c)), a.setY(-b.y - b.width / 2 * Math.sin(c)); - } - } - } else { - d = a.width / 2 + b.regX / a.scaleX, a.setX(b.x + b.regX * Math.cos(c) - b.regY * Math.sin(c)), a.setRegX(d), d = a.height / 2 + b.regY / a.scaleY, a.setY(-b.y - b.regX * Math.sin(c) - b.regY * Math.cos(c)), a.setRegY(d); - } - a.setDirection(b.direction); - a.setRotation(b.rotation); - this.selectedObject.entity.doCommand(); - this.editEntity = !1; -}; -Entry.Stage.prototype.startEdit = function() { - this.selectedObject.entity.initCommand(); -}; -Entry.Stage.prototype.endEdit = function() { - this.selectedObject.entity.checkCommand(); -}; -Entry.Stage.prototype.initWall = function() { - var b = new createjs.Container, a = new Image; - a.src = Entry.mediaFilePath + "media/bound.png"; - b.up = new createjs.Bitmap; - b.up.scaleX = 16; - b.up.y = -165; - b.up.x = -240; - b.up.image = a; - b.addChild(b.up); - b.down = new createjs.Bitmap; - b.down.scaleX = 16; - b.down.y = 135; - b.down.x = -240; - b.down.image = a; - b.addChild(b.down); - b.right = new createjs.Bitmap; - b.right.scaleY = 9; - b.right.y = -135; - b.right.x = 240; - b.right.image = a; - b.addChild(b.right); - b.left = new createjs.Bitmap; - b.left.scaleY = 9; - b.left.y = -135; - b.left.x = -270; - b.left.image = a; - b.addChild(b.left); - this.canvas.addChild(b); - this.wall = b; -}; -Entry.Stage.prototype.showInputField = function(b) { - b = 1 / 1.5; - this.inputField || (this.inputField = new CanvasInput({canvas:document.getElementById("entryCanvas"), fontSize:30 * b, fontFamily:"NanumGothic", fontColor:"#212121", width:556 * b, height:26 * b, padding:8 * b, borderWidth:1 * b, borderColor:"#000", borderRadius:3 * b, boxShadow:"none", innerShadow:"0px 0px 5px rgba(0, 0, 0, 0.5)", x:202 * b, y:450 * b, topPosition:!0, onsubmit:function() { - Entry.dispatchEvent("canvasInputComplete"); - }})); - b = new createjs.Container; - var a = new Image; - a.src = Entry.mediaFilePath + "confirm_button.png"; - var c = new createjs.Bitmap; - c.scaleX = .23; - c.scaleY = .23; - c.x = 160; - c.y = 89; - c.cursor = "pointer"; - c.image = a; - b.addChild(c); - b.on("mousedown", function(a) { - Entry.dispatchEvent("canvasInputComplete"); - }); - this.inputSubmitButton || (this.inputField.value(""), this.canvas.addChild(b), this.inputSubmitButton = b); - this.inputField.show(); - Entry.requestUpdateTwice = !0; -}; -Entry.Stage.prototype.hideInputField = function() { - this.inputField && this.inputField.value() && this.inputField.value(""); - this.inputSubmitButton && (this.canvas.removeChild(this.inputSubmitButton), this.inputSubmitButton = null); - this.inputField && this.inputField.hide(); - Entry.requestUpdate = !0; -}; -Entry.Stage.prototype.initObjectContainers = function() { - var b = Entry.scene.scenes_; - if (b && 0 !== b.length) { - for (var a = 0;a < b.length;a++) { - this.objectContainers[a] = this.createObjectContainer(b[a]); - } - this.selectedObjectContainer = this.objectContainers[0]; - } else { - b = this.createObjectContainer(Entry.scene.selectedScene), this.objectContainers.push(b), this.selectedObjectContainer = b; - } - this.canvas.addChild(this.selectedObjectContainer); - this.selectObjectContainer(Entry.scene.selectedScene); -}; -Entry.Stage.prototype.selectObjectContainer = function(b) { - if (this.canvas) { - for (var a = this.objectContainers, c = 0;c < a.length;c++) { - this.canvas.removeChild(a[c]); - } - this.selectedObjectContainer = this.getObjectContainerByScene(b); - this.canvas.addChildAt(this.selectedObjectContainer, 2); - } -}; -Entry.Stage.prototype.reAttachToCanvas = function() { - for (var b = [this.selectedObjectContainer, this.variableContainer, this.coordinator, this.handle, this.dialogContainer], a = 0;a < b.length;a++) { - this.canvas.removeChild(b[a]), this.canvas.addChild(b[a]); - } - console.log(this.canvas.getChildIndex(this.selectedObjectContainer)); -}; -Entry.Stage.prototype.createObjectContainer = function(b) { - var a = new createjs.Container; - a.scene = b; - return a; -}; -Entry.Stage.prototype.removeObjectContainer = function(b) { - var a = this.objectContainers; - b = this.getObjectContainerByScene(b); - this.canvas.removeChild(b); - a.splice(this.objectContainers.indexOf(b), 1); -}; -Entry.Stage.prototype.getObjectContainerByScene = function(b) { - for (var a = this.objectContainers, c = 0;c < a.length;c++) { - if (a[c].scene.id == b.id) { - return a[c]; - } - } -}; -Entry.Stage.prototype.moveSprite = function(b) { - if (this.selectedObject && Entry.stage.focused && !this.selectedObject.getLock()) { - var a = 5; - b.shiftKey && (a = 1); - var c = this.selectedObject.entity; - switch(b.keyCode) { - case 38: - c.setY(c.getY() + a); - break; - case 40: - c.setY(c.getY() - a); - break; - case 37: - c.setX(c.getX() - a); - break; - case 39: - c.setX(c.getX() + a); - } - this.updateObject(); - } -}; -Entry.Stage.prototype.getBoundRect = function(b) { - this._boundRect || this.updateBoundRect(); - return this._boundRect; -}; -Entry.Stage.prototype.updateBoundRect = function(b) { - this._boundRect = this.canvas.canvas.getBoundingClientRect(); -}; -Entry.Variable = function(b) { - Entry.assert("string" == typeof b.name, "Variable name must be given"); - this.name_ = b.name; - this.id_ = b.id ? b.id : Entry.generateHash(); - this.type = b.variableType ? b.variableType : "variable"; - this.object_ = b.object || null; - this.isCloud_ = b.isCloud || !1; - 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.setMinValue(b.minValue), this.setMaxValue(b.maxValue)) : "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) { - var a = this.type; - if ("variable" == a || "timer" == a || "answer" == a) { - this.view_ = new createjs.Container, this.rect_ = new createjs.Shape, this.view_.addChild(this.rect_), this.view_.variable = this, this.wrapper_ = new createjs.Shape, this.view_.addChild(this.wrapper_), this.textView_ = new createjs.Text("asdf", this.FONT, "#000000"), this.textView_.textBaseline = "alphabetic", this.textView_.x = 4, this.textView_.y = 1, this.view_.addChild(this.textView_), this.valueView_ = new createjs.Text("asdf", "10pt NanumGothic", "#ffffff"), this.valueView_.textBaseline = - "alphabetic", a = Entry.variableContainer.variables_.length, this.getX() && this.getY() ? (this.setX(this.getX()), this.setY(this.getY())) : (this.setX(-230 + 80 * Math.floor(a / 11)), this.setY(24 * b + 20 - 135 - 264 * Math.floor(a / 11))), this.view_.visible = this.visible_, this.view_.addChild(this.valueView_), this.view_.on("mousedown", function(a) { - "workspace" == Entry.type && (this.offset = {x:this.x - (.75 * a.stageX - 240), y:this.y - (.75 * a.stageY - 135)}, this.cursor = "move"); - }), this.view_.on("pressmove", function(a) { - "workspace" == Entry.type && (this.variable.setX(.75 * a.stageX - 240 + this.offset.x), this.variable.setY(.75 * a.stageY - 135 + this.offset.y), this.variable.updateView()); - }); - } else { - if ("slide" == a) { - var c = this; - this.view_ = new createjs.Container; - this.rect_ = new createjs.Shape; - this.view_.addChild(this.rect_); - this.view_.variable = this; - this.wrapper_ = new createjs.Shape; - this.view_.addChild(this.wrapper_); - this.textView_ = new createjs.Text("name", this.FONT, "#000000"); - this.textView_.textBaseline = "alphabetic"; - this.textView_.x = 4; - this.textView_.y = 1; - this.view_.addChild(this.textView_); - this.valueView_ = new createjs.Text("value", "10pt NanumGothic", "#ffffff"); - this.valueView_.textBaseline = "alphabetic"; - this.view_.on("mousedown", function(a) { - "workspace" == Entry.type && (this.offset = {x:this.x - (.75 * a.stageX - 240), y:this.y - (.75 * a.stageY - 135)}); - }); - this.view_.on("pressmove", function(a) { - "workspace" != Entry.type || c.isAdjusting || (this.variable.setX(.75 * a.stageX - 240 + this.offset.x), this.variable.setY(.75 * a.stageY - 135 + this.offset.y), this.variable.updateView()); - }); - this.view_.visible = this.visible_; - this.view_.addChild(this.valueView_); - a = this.textView_.getMeasuredWidth() + this.valueView_.getMeasuredWidth() + 26; - a = Math.max(a, 90); - this.maxWidth = a - 20; - this.slideBar_ = new createjs.Shape; - this.slideBar_.graphics.beginFill("#A0A1A1").s("#A0A1A1").ss(1).dr(10, 10, this.maxWidth, 1.5); - this.view_.addChild(this.slideBar_); - a = this.getSlidePosition(this.maxWidth); - this.valueSetter_ = new createjs.Shape; - this.valueSetter_.graphics.beginFill("#1bafea").s("#A0A1A1").ss(1).dc(a, 10.5, 3); - this.valueSetter_.cursor = "pointer"; - this.valueSetter_.on("mousedown", function(a) { - Entry.engine.isState("run") && (c.isAdjusting = !0, this.offsetX = -(this.x - .75 * a.stageX + 240)); - }); - this.valueSetter_.on("pressmove", function(a) { - if (Entry.engine.isState("run")) { - var b = this.offsetX; - this.offsetX = -(this.x - .75 * a.stageX + 240); - b !== this.offsetX && (a = c.getX(), c.setSlideCommandX(a + 10 > this.offsetX ? 0 : a + c.maxWidth + 10 > this.offsetX ? this.offsetX - a : c.maxWidth + 10)); - } - }); - this.valueSetter_.on("pressup", function(a) { - c.isAdjusting = !1; - }); - this.view_.addChild(this.valueSetter_); - a = Entry.variableContainer.variables_.length; - this.getX() && this.getY() ? (this.setX(this.getX()), this.setY(this.getY())) : (this.setX(-230 + 80 * Math.floor(a / 11)), this.setY(24 * b + 20 - 135 - 264 * Math.floor(a / 11))); - } else { - this.view_ = new createjs.Container, this.rect_ = new createjs.Shape, this.view_.addChild(this.rect_), this.view_.variable = this, this.titleView_ = new createjs.Text("asdf", this.FONT, "#000"), this.titleView_.textBaseline = "alphabetic", this.titleView_.textAlign = "center", this.titleView_.width = this.width_ - 2 * this.BORDER, this.titleView_.y = this.BORDER + 10, this.titleView_.x = this.width_ / 2, this.view_.addChild(this.titleView_), this.resizeHandle_ = new createjs.Shape, this.resizeHandle_.graphics.f("#1bafea").ss(1, - 0, 0).s("#1bafea").lt(0, -9).lt(-9, 0).lt(0, 0), this.view_.addChild(this.resizeHandle_), this.resizeHandle_.list = this, this.resizeHandle_.on("mouseover", function(a) { - this.cursor = "nwse-resize"; - }), this.resizeHandle_.on("mousedown", function(a) { - this.list.isResizing = !0; - this.offset = {x:.75 * a.stageX - this.list.getWidth(), y:.75 * a.stageY - this.list.getHeight()}; - this.parent.cursor = "nwse-resize"; - }), this.resizeHandle_.on("pressmove", function(a) { - this.list.setWidth(.75 * a.stageX - this.offset.x); - this.list.setHeight(.75 * a.stageY - this.offset.y); - this.list.updateView(); - }), this.view_.on("mouseover", function(a) { - this.cursor = "move"; - }), this.view_.on("mousedown", function(a) { - "workspace" != Entry.type || this.variable.isResizing || (this.offset = {x:this.x - (.75 * a.stageX - 240), y:this.y - (.75 * a.stageY - 135)}, this.cursor = "move"); - }), this.view_.on("pressup", function(a) { - this.cursor = "initial"; - this.variable.isResizing = !1; - }), this.view_.on("pressmove", function(a) { - "workspace" != Entry.type || this.variable.isResizing || (this.variable.setX(.75 * a.stageX - 240 + this.offset.x), this.variable.setY(.75 * a.stageY - 135 + this.offset.y), this.variable.updateView()); - }), this.elementView = new createjs.Container, a = new createjs.Text("asdf", this.FONT, "#000"), a.textBaseline = "middle", a.y = 5, this.elementView.addChild(a), this.elementView.indexView = a, a = new createjs.Shape, this.elementView.addChild(a), this.elementView.valueWrapper = a, a = new createjs.Text("fdsa", this.FONT, "#eee"), a.x = 24, a.y = 6, a.textBaseline = "middle", this.elementView.addChild(a), this.elementView.valueView = a, this.elementView.x = this.BORDER, this.scrollButton_ = - new createjs.Shape, this.scrollButton_.graphics.f("#aaa").rr(0, 0, 7, 30, 3.5), this.view_.addChild(this.scrollButton_), this.scrollButton_.y = 23, this.scrollButton_.list = this, this.scrollButton_.on("mousedown", function(a) { - this.list.isResizing = !0; - this.cursor = "pointer"; - this.offsetY = isNaN(this.offsetY) || 0 > this.offsetY ? a.rawY / 2 : this.offsetY; - }), this.scrollButton_.on("pressmove", function(a) { - void 0 === this.moveAmount ? (this.y = a.target.y, this.moveAmount = !0) : this.y = a.rawY / 2 - this.offsetY + this.list.height_ / 100 * 23; - 23 > this.y && (this.y = 23); - this.y > this.list.getHeight() - 40 && (this.y = this.list.getHeight() - 40); - this.list.updateView(); - }), this.scrollButton_.on("pressup", function(a) { - this.moveAmount = void 0; - }), this.getX() && this.getY() ? (this.setX(this.getX()), this.setY(this.getY())) : (a = Entry.variableContainer.lists_.length, this.setX(110 * -Math.floor(a / 6) + 120), this.setY(24 * b + 20 - 135 - 145 * Math.floor(a / 6))); - } - } - this.setVisible(this.isVisible()); - this.updateView(); - Entry.stage.loadVariable(this); -}; -Entry.Variable.prototype.updateView = function() { - if (this.view_) { - if (this.isVisible()) { - if ("variable" == this.type) { - this.view_.x = this.getX(); - this.view_.y = this.getY(); - if (this.object_) { - var b = Entry.container.getObject(this.object_); - this.textView_.text = b ? b.name + ":" + this.getName() : this.getName(); - } else { - this.textView_.text = this.getName(); - } - null === this._nameWidth && (this._nameWidth = this.textView_.getMeasuredWidth()); - this.valueView_.x = this._nameWidth + 14; - this.valueView_.y = 1; - this.isNumber() ? this.valueView_.text = this.getValue().toFixed(2).replace(".00", "") : this.valueView_.text = this.getValue(); - null === this._valueWidth && (this._valueWidth = this.valueView_.getMeasuredWidth()); - this.rect_.graphics.clear().f("#ffffff").ss(1, 2, 0).s("#A0A1A1").rc(0, -14, this._nameWidth + this._valueWidth + 26, 20, 4, 4, 4, 4); - this.wrapper_.graphics.clear().f("#1bafea").ss(1, 2, 0).s("#1bafea").rc(this._nameWidth + 7, -11, this._valueWidth + 15, 14, 7, 7, 7, 7); - } else { - if ("slide" == this.type) { - this.view_.x = this.getX(), this.view_.y = this.getY(), this.object_ ? (b = Entry.container.getObject(this.object_), this.textView_.text = b ? b.name + ":" + this.getName() : this.getName()) : this.textView_.text = this.getName(), null === this._nameWidth && (this._nameWidth = this.textView_.getMeasuredWidth()), this.valueView_.x = this._nameWidth + 14, this.valueView_.y = 1, this.isNumber() ? this.valueView_.text = this.getValue().toFixed(2).replace(".00", "") : this.valueView_.text = - this.getValue(), null === this._valueWidth && (this._valueWidth = this.valueView_.getMeasuredWidth()), b = this._nameWidth + this._valueWidth + 26, b = Math.max(b, 90), this.rect_.graphics.clear().f("#ffffff").ss(1, 2, 0).s("#A0A1A1").rc(0, -14, b, 33, 4, 4, 4, 4), this.wrapper_.graphics.clear().f("#1bafea").ss(1, 2, 0).s("#1bafea").rc(this._nameWidth + 7, -11, this._valueWidth + 15, 14, 7, 7, 7, 7), b = this._nameWidth + this._valueWidth + 26, b = Math.max(b, 90), this.maxWidth = b - 20, - this.slideBar_.graphics.clear().beginFill("#A0A1A1").s("#A0A1A1").ss(1).dr(10, 10, this.maxWidth, 1.5), b = this.getSlidePosition(this.maxWidth), this.valueSetter_.graphics.clear().beginFill("#1bafea").s("#A0A1A1").ss(1).dc(b, 10.5, 3); - } else { - if ("list" == this.type) { - this.view_.x = this.getX(); - this.view_.y = this.getY(); - this.resizeHandle_.x = this.width_ - 2; - this.resizeHandle_.y = this.height_ - 2; - var a = this.getName(); - this.object_ && (b = Entry.container.getObject(this.object_)) && (a = b.name + ":" + a); - a = 7 < a.length ? a.substr(0, 6) + ".." : a; - this.titleView_.text = a; - this.titleView_.x = this.width_ / 2; - for (this.rect_.graphics.clear().f("#ffffff").ss(1, 2, 0).s("#A0A1A1").rect(0, 0, this.width_, this.height_);this.view_.children[4];) { - this.view_.removeChild(this.view_.children[4]); - } - b = Math.floor((this.getHeight() - 20) / 20); - b < this.array_.length ? (this.scrollButton_.y > this.getHeight() - 40 && (this.scrollButton_.y = this.getHeight() - 40), this.elementView.valueWrapper.graphics.clear().f("#1bafea").rr(20, -2, this.getWidth() - 20 - 10 - 2 * this.BORDER, 17, 2), this.scrollButton_.visible = !0, this.scrollButton_.x = this.getWidth() - 12, this.scrollPosition = Math.floor((this.scrollButton_.y - 23) / (this.getHeight() - 23 - 40) * (this.array_.length - b))) : (this.elementView.valueWrapper.graphics.clear().f("#1bafea").rr(20, - -2, this.getWidth() - 20 - 2 * this.BORDER, 17, 2), this.scrollButton_.visible = !1, this.scrollPosition = 0); - for (a = this.scrollPosition;a < this.scrollPosition + b && a < this.array_.length;a++) { - this.elementView.indexView.text = a + 1; - var c = String(this.array_[a].data), d = Math.floor((this.getWidth() - 50) / 7), c = Entry.cutStringByLength(c, d), c = String(this.array_[a].data).length > c.length ? c + ".." : c; - this.elementView.valueView.text = c; - c = this.elementView.clone(!0); - c.y = 20 * (a - this.scrollPosition) + 23; - this.view_.addChild(c); - } - } else { - "answer" == this.type ? (this.view_.x = this.getX(), this.view_.y = this.getY(), this.textView_.text = this.getName(), this.valueView_.y = 1, this.isNumber() ? parseInt(this.getValue(), 10) == this.getValue() ? this.valueView_.text = this.getValue() : this.valueView_.text = this.getValue().toFixed(1).replace(".00", "") : this.valueView_.text = this.getValue(), null === this._nameWidth && (this._nameWidth = this.textView_.getMeasuredWidth()), null === this._valueWidth && (this._valueWidth = - this.valueView_.getMeasuredWidth()), this.valueView_.x = this._nameWidth + 14, this.rect_.graphics.clear().f("#ffffff").ss(1, 2, 0).s("#A0A1A1").rc(0, -14, this._nameWidth + this._valueWidth + 26, 20, 4, 4, 4, 4), this.wrapper_.graphics.clear().f("#E457DC").ss(1, 2, 0).s("#E457DC").rc(this._nameWidth + 7, -11, this._valueWidth + 15, 14, 7, 7, 7, 7)) : (this.view_.x = this.getX(), this.view_.y = this.getY(), this.textView_.text = this.getName(), null === this._nameWidth && (this._nameWidth = - this.textView_.getMeasuredWidth()), this.valueView_.x = this._nameWidth + 14, this.valueView_.y = 1, this.isNumber() ? this.valueView_.text = this.getValue().toFixed(1).replace(".00", "") : this.valueView_.text = this.getValue(), null === this._valueWidth && (this._valueWidth = this.valueView_.getMeasuredWidth()), this.rect_.graphics.clear().f("#ffffff").ss(1, 2, 0).s("#A0A1A1").rc(0, -14, this._nameWidth + this._valueWidth + 26, 20, 4, 4, 4, 4), this.wrapper_.graphics.clear().f("#ffbb14").ss(1, - 2, 0).s("orange").rc(this._nameWidth + 7, -11, this._valueWidth + 15, 14, 7, 7, 7, 7)); - } - } - } - } - Entry.requestUpdate = !0; - } -}; -Entry.Variable.prototype.getName = function() { - return this.name_; -}; -Entry.Variable.prototype.setName = function(b) { - Entry.assert("string" == typeof b, "Variable name must be string"); - this.name_ = b; - this._nameWidth = null; - this.updateView(); - Entry.requestUpdateTwice = !0; -}; -Entry.Variable.prototype.getId = function() { - return this.id_; -}; -Entry.Variable.prototype.getValue = function() { - return this.isNumber() ? Number(this.value_) : this.value_; -}; -Entry.Variable.prototype.isNumber = function() { - return isNaN(this.value_) ? !1 : !0; -}; -Entry.Variable.prototype.setValue = function(b) { - "slide" != this.type ? this.value_ = b : (b = Number(b), this.value_ = b < this.minValue_ ? this.minValue_ : b > this.maxValue_ ? this.maxValue_ : b); - this.isCloud_ && Entry.variableContainer.updateCloudVariables(); - this._valueWidth = null; - this.updateView(); - Entry.requestUpdateTwice = !0; -}; -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 !== b && (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); - 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); - b < a ? b = this.minValue_ : b > c && (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 = b || 0; - this.value_ < b && this.setValue(b); - this.updateView(); - this.isMinFloat = Entry.isFloat(this.minValue_); -}; -Entry.Variable.prototype.getMaxValue = function() { - return this.maxValue_; -}; -Entry.Variable.prototype.setMaxValue = function(b) { - this.maxValue_ = b = b || 100; - 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; - var c = b.view.name.value.trim(); - b.isOpen ? c && 0 !== c.length ? a.addVariable() : (b.view.addClass("entryRemove"), b.isOpen = !1) : (b.view.removeClass("entryRemove"), b.view.name.focus(), b.isOpen = !0); - }); - this.generateVariableAddView(); - this.generateListAddView(); - this.generateVariableSplitterView(); - this.generateVariableSettingView(); - this.generateListSettingView(); - c = Entry.createElement("li"); - c.addClass("entryVariableAddWorkspace"); - c.addClass("entryVariableListElementWorkspace"); - c.innerHTML = "+ " + Lang.Workspace.message_create; - this.messageAddButton_ = c; - c.bindOnClick(function(b) { - a.addMessage({name:Lang.Workspace.message + " " + (a.messages_.length + 1)}); - }); - c = Entry.createElement("li"); - c.addClass("entryVariableAddWorkspace"); - c.addClass("entryVariableListElementWorkspace"); - c.innerHTML = "+ " + Lang.Workspace.list_create; - this.listAddButton_ = c; - c.bindOnClick(function(b) { - b = f.listAddPanel; - var c = b.view.name.value.trim(); - b.isOpen ? c && 0 !== c.length ? a.addList() : (b.view.addClass("entryRemove"), b.isOpen = !1) : (b.view.removeClass("entryRemove"), b.view.name.focus(), b.isOpen = !0); - }); - c = Entry.createElement("li"); - c.addClass("entryVariableAddWorkspace"); - c.addClass("entryVariableListElementWorkspace"); - c.innerHTML = "+ " + Lang.Workspace.function_add; - this.functionAddButton_ = c; - c.bindOnClick(function(b) { - b = a._getBlockMenu(); - Entry.playground.changeViewMode("code"); - "func" != b.lastSelector && b.selectMenu("func"); - a.createFunction(); - }); - return b; -}; -Entry.VariableContainer.prototype.createSelectButton = function(b, a) { - var c = this; - void 0 === a && (a = !0); - var d = Entry.createElement("td"); - d.addClass("entryVariableSelectButtonWorkspace", b); - d.innerHTML = Lang.Workspace[b]; - a ? d.bindOnClick(function(a) { - c.selectFilter(b); - this.addClass("selected"); - }) : d.addClass("disable"); - return d; -}; -Entry.VariableContainer.prototype.selectFilter = function(b) { - for (var a = this.view_.getElementsByTagName("td"), c = 0;c < a.length;c++) { - a[c].removeClass("selected"), a[c].hasClass(b) && a[c].addClass("selected"); + d = Entry.createElement("input", "entryPainterAttrCircleInput"); + d.value = "#000000"; + d.addClass("painterAttrCircleInput"); + this.attrCircleArea.appendChild(d); + this.attrColorSpoid = Entry.createElement("div"); + this.attrColorSpoid.bindOnClick(function() { + b.selectToolbox("spoid"); + }); + this.attrColorSpoid.addClass("painterAttrColorSpoid"); + g.appendChild(this.attrColorSpoid); + Entry.getColourCodes().forEach(function(a) { + var c = Entry.createElement("div"); + c.addClass("entryPlaygroundPainterAttrColorElement"); + "transparent" === a ? c.style.backgroundImage = "url(" + (Entry.mediaFilePath + "/transparent.png") + ")" : c.style.backgroundColor = a; + c.bindOnClick(function(c) { + "transparent" === a ? (b.stroke.transparent = !0, b.stroke.lineColor = "#ffffff") : (b.stroke.transparent = !1, r && (document.getElementById("entryPainterShapeBackgroundColor").style.backgroundColor = a, b.stroke.fillColor = a), r || (document.getElementById("entryPainterShapeLineColor").style.backgroundColor = a, b.stroke.lineColor = a)); + document.getElementById("entryPainterAttrCircle").style.backgroundColor = b.stroke.lineColor; + document.getElementById("entryPainterAttrCircleInput").value = a; + }); + n.appendChild(c); + }); + this.attrThickArea = Entry.createElement("div", "painterAttrThickArea"); + this.attrThickArea.addClass("entryPlaygroundentryPlaygroundPainterAttrThickArea"); + g.appendChild(this.attrThickArea); + d = Entry.createElement("legend"); + d.addClass("painterAttrThickName"); + d.innerHTML = Lang.Workspace.thickness; + this.attrThickArea.appendChild(d); + var m = Entry.createElement("fieldset", "entryPainterAttrThick"); + m.addClass("entryPlaygroundPainterAttrThick"); + this.attrThickArea.appendChild(m); + d = Entry.createElement("div"); + d.addClass("paintAttrThickTop"); + m.appendChild(d); + e = Entry.createElement("select", "entryPainterAttrThick"); + e.addClass("entryPlaygroundPainterAttrThickInput"); + e.size = "1"; + e.onchange = function(a) { + b.stroke.thickness = a.target.value; + }; + for (d = 1;10 >= d;d++) { + c = Entry.createElement("option"), c.value = d, c.innerHTML = d, e.appendChild(c); + } + m.appendChild(e); + d = Entry.createElement("div", "entryPainterShapeLineColor"); + d.addClass("painterAttrShapeLineColor"); + c = Entry.createElement("div", "entryPainterShapeInnerBackground"); + c.addClass("painterAttrShapeInnerBackground"); + d.appendChild(c); + m.appendChild(d); + this.attrThickArea.painterAttrShapeLineColor = d; + m.bindOnClick(function() { + q.style.zIndex = "1"; + this.style.zIndex = "10"; + r = !1; + }); + this.attrBackgroundArea = Entry.createElement("div", "painterAttrBackgroundArea"); + this.attrBackgroundArea.addClass("entryPlaygroundPainterBackgroundArea"); + g.appendChild(this.attrBackgroundArea); + d = Entry.createElement("fieldset", "entryPainterAttrbackground"); + d.addClass("entryPlaygroundPainterAttrBackground"); + this.attrBackgroundArea.appendChild(d); + c = Entry.createElement("div"); + c.addClass("paintAttrBackgroundTop"); + d.appendChild(c); + var q = Entry.createElement("div", "entryPainterShapeBackgroundColor"); + q.addClass("painterAttrShapeBackgroundColor"); + this.attrBackgroundArea.painterAttrShapeBackgroundColor = q; + c.appendChild(q); + var r = !1; + q.bindOnClick(function(b) { + m.style.zIndex = "1"; + this.style.zIndex = "10"; + r = !0; + }); + this.attrFontArea = Entry.createElement("div", "painterAttrFont"); + this.attrFontArea.addClass("entryPlaygroundPainterAttrFont"); + g.appendChild(this.attrFontArea); + e = Entry.createElement("div"); + e.addClass("entryPlaygroundPainterAttrTop"); + this.attrFontArea.appendChild(e); + d = Entry.createElement("div"); + d.addClass("entryPlaygroundPaintAttrTop_"); + e.appendChild(d); + d = Entry.createElement("legend"); + d.addClass("panterAttrFontTitle"); + d.innerHTML = Lang.Workspace.textStyle; + k = Entry.createElement("select", "entryPainterAttrFontName"); + k.addClass("entryPlaygroundPainterAttrFontName"); + k.size = "1"; + k.onchange = function(a) { + b.font.name = a.target.value; + }; + for (d = 0;d < Entry.fonts.length;d++) { + h = Entry.fonts[d], c = Entry.createElement("option"), c.value = h.family, c.innerHTML = h.name, k.appendChild(c); + } + e.appendChild(k); + e = Entry.createElement("div"); + e.addClass("painterAttrFontSizeArea"); + this.attrFontArea.appendChild(e); + d = Entry.createElement("div"); + d.addClass("painterAttrFontSizeTop"); + e.appendChild(d); + k = Entry.createElement("select", "entryPainterAttrFontSize"); + k.addClass("entryPlaygroundPainterAttrFontSize"); + k.size = "1"; + k.onchange = function(a) { + b.font.size = a.target.value; + }; + for (d = 20;72 >= d;d++) { + c = Entry.createElement("option"), c.value = d, c.innerHTML = d, k.appendChild(c); + } + e.appendChild(k); + e = Entry.createElement("div"); + e.addClass("entryPlaygroundPainterAttrFontStyleArea"); + this.attrFontArea.appendChild(e); + d = Entry.createElement("div"); + d.addClass("entryPlaygroundPainterAttrFontTop"); + e.appendChild(d); + k = Entry.createElement("select", "entryPainterAttrFontStyle"); + k.addClass("entryPlaygroundPainterAttrFontStyle"); + k.size = "1"; + k.onchange = function(a) { + b.font.style = a.target.value; + }; + h = [{label:"\ubcf4\ud1b5", value:"normal"}, {label:"\uad75\uac8c", value:"bold"}, {label:"\uae30\uc6b8\uc784", value:"italic"}]; + for (d = 0;d < h.length;d++) { + l = h[d], c = Entry.createElement("option"), c.value = l.value, c.innerHTML = l.label, k.appendChild(c); + } + e.appendChild(k); + this.attrLineArea = Entry.createElement("div", "painterAttrLineStyle"); + this.attrLineArea.addClass("entryPlaygroundPainterAttrLineStyle"); + g.appendChild(this.attrLineArea); + var u = Entry.createElement("div"); + u.addClass("entryPlaygroundPainterAttrLineStyleLine"); + this.attrLineArea.appendChild(u); + var t = Entry.createElement("div"); + t.addClass("entryPlaygroundPaitnerAttrLineArea"); + this.attrLineArea.appendChild(t); + d = Entry.createElement("div"); + d.addClass("entryPlaygroundPainterAttrLineStyleLine1"); + t.appendChild(d); + d.value = "line"; + var v = Entry.createElement("div"); + v.addClass("painterAttrLineStyleBackgroundLine"); + u.bindOnClick(function(b) { + t.removeClass("entryRemove"); + }); + t.blur = function(b) { + this.addClass("entryRemove"); + }; + t.onmouseleave = function(b) { + this.addClass("entryRemove"); + }; + d.bindOnClick(function(b) { + this.attrLineArea.removeClass(u); + this.attrLineArea.appendChild(v); + this.attrLineArea.onchange(b); + t.blur(); + }); + v.bindOnClick(function(b) { + t.removeClass("entryRemove"); + }); + this.attrLineArea.onchange = function(a) { + b.stroke.style = a.target.value; + }; + t.blur(); } - this.viewMode_ = b; - this.select(); - this.updateList(); }; -Entry.VariableContainer.prototype.updateVariableAddView = function(b) { - b = "variable" == (b ? b : "variable") ? this.variableAddPanel : this.listAddPanel; - var a = b.info, c = b.view; - b.view.addClass("entryRemove"); - c.cloudCheck.removeClass("entryVariableAddChecked"); - c.localCheck.removeClass("entryVariableAddChecked"); - c.globalCheck.removeClass("entryVariableAddChecked"); - c.cloudWrapper.removeClass("entryVariableAddSpaceUnCheckedWorkspace"); - a.isCloud && c.cloudCheck.addClass("entryVariableAddChecked"); - b.isOpen && (c.removeClass("entryRemove"), c.name.focus()); - a.object ? (c.localCheck.addClass("entryVariableAddChecked"), c.cloudWrapper.addClass("entryVariableAddSpaceUnCheckedWorkspace")) : c.globalCheck.addClass("entryVariableAddChecked"); +Entry.Painter.prototype.restoreHandle = function() { + this.selectedObject && !1 === this.handle.visible && (this.handle.visible = !0, this.stage.update()); }; -Entry.VariableContainer.prototype.select = function(b) { - b = this.selected == b ? null : b; - this.selected && (this.selected.listElement.removeClass("selected"), this.selected.callerListElement && (this.listView_.removeChild(this.selected.callerListElement), delete this.selected.callerListElement), this.selected = null); - b && (b.listElement.addClass("selected"), this.selected = b, b instanceof Entry.Variable ? (this.renderVariableReference(b), b.object_ && Entry.container.selectObject(b.object_, !0)) : b instanceof Entry.Func ? this.renderFunctionReference(b) : this.renderMessageReference(b)); +Entry.Painter.prototype.initDisplay = function() { + this.stroke.enabled = !1; + this.toolboxCursor.addClass("entryPlaygroundPainterToolboxCursor"); + this.toolboxCursor.removeClass("entryToolboxCursorClicked"); + this.toolboxSelect.addClass("entryPlaygroundPainterToolboxSelect"); + this.toolboxSelect.removeClass("entryToolboxSelectClicked"); + this.toolboxPen.addClass("entryPlaygroundPainterToolboxPen"); + this.toolboxPen.removeClass("entryToolboxPenClicked"); + this.toolboxLine.addClass("entryPlaygroundPainterToolboxLine"); + this.toolboxLine.removeClass("entryToolboxLineClicked"); + this.toolboxRect.addClass("entryPlaygroundPainterToolboxRect"); + this.toolboxRect.removeClass("entryToolboxRectClicked"); + this.toolboxCircle.addClass("entryPlaygroundPainterToolboxCircle"); + this.toolboxCircle.removeClass("entryToolBoxCircleClicked"); + this.toolboxText.addClass("entryPlaygroundPainterToolboxText"); + this.toolboxText.removeClass("entryToolBoxTextClicked"); + this.toolboxFill.addClass("entryPlaygroundPainterToolboxFill"); + this.toolboxFill.removeClass("entryToolBoxFillClicked"); + this.toolboxErase.addClass("entryPlaygroundPainterToolboxErase"); + this.toolboxErase.removeClass("entryToolBoxEraseClicked"); + this.attrColorSpoid.addClass("painterAttrColorSpoid"); + this.attrColorSpoid.removeClass("painterAttrColorSpoidClicked"); + this.attrResizeArea.addClass("entryRemove"); + this.attrRotateArea.addClass("entryRemove"); + this.attrThickArea.addClass("entryRemove"); + this.attrFontArea.addClass("entryRemove"); + this.attrLineArea.addClass("entryRemove"); + this.attrColorArea.addClass("entryRemove"); + this.attrCircleArea.addClass("entryRemove"); + this.attrColorSpoid.addClass("entryRemove"); + this.attrFontArea.addClass("entryRemove"); + this.attrBackgroundArea.addClass("entryRemove"); + this.flipObject.addClass("entryRemove"); + this.attrThickArea.painterAttrShapeLineColor.addClass("entryRemove"); + this.attrBackgroundArea.painterAttrShapeBackgroundColor.addClass("entryRemove"); + this.attrCircleArea.painterAttrCircle.addClass("entryRemove"); + this.inputField && !this.inputField._isHidden && (this.inputField.hide(), this.stage.update()); }; -Entry.VariableContainer.prototype.renderMessageReference = function(b) { - for (var a = this, c = this._messageRefs, d = b.id, e = [], f = 0;f < c.length;f++) { - -1 < c[f].block.params.indexOf(d) && e.push(c[f]); - } - c = Entry.createElement("ul"); - c.addClass("entryVariableListCallerListWorkspace"); - for (f in e) { - var d = e[f], g = Entry.createElement("li"); - g.addClass("entryVariableListCallerWorkspace"); - g.appendChild(d.object.thumbnailView_.cloneNode()); - var h = Entry.createElement("div"); - h.addClass("entryVariableListCallerNameWorkspace"); - h.innerHTML = d.object.name + " : " + Lang.Blocks["START_" + d.block.type]; - g.appendChild(h); - g.caller = d; - g.message = b; - g.bindOnClick(function(b) { - Entry.playground.object != this.caller.object && (Entry.container.selectObject(), Entry.container.selectObject(this.caller.object.id, !0), a.select(null), a.select(this.message)); - Entry.playground.toggleOnVariableView(); - Entry.playground.changeViewMode("variable"); - }); - c.appendChild(g); +Entry.Painter.prototype.selectToolbox = function(a) { + this.toolbox.selected = a; + "erase" != a && $(".entryPlaygroundPainterContainer").removeClass("dd"); + this.initDisplay(); + "cursor" !== a && this.clearHandle(); + "text" !== a && this.inputField && delete this.inputField; + switch(a) { + case "cursor": + this.restoreHandle(); + this.toolboxCursor.addClass("entryToolboxCursorClicked"); + this.attrResizeArea.removeClass("entryRemove"); + this.attrRotateArea.removeClass("entryRemove"); + this.flipObject.removeClass("entryRemove"); + break; + case "select": + this.toolboxSelect.addClass("entryToolboxSelectClicked"); + break; + case "pen": + this.toolboxPen.addClass("entryToolboxPenClicked"); + this.attrThickArea.removeClass("entryRemove"); + this.attrColorArea.removeClass("entryRemove"); + this.attrCircleArea.removeClass("entryRemove"); + this.attrColorSpoid.removeClass("entryRemove"); + this.attrThickArea.painterAttrShapeLineColor.removeClass("entryRemove"); + break; + case "line": + this.toolboxLine.addClass("entryToolboxLineClicked"); + this.attrThickArea.removeClass("entryRemove"); + this.attrColorArea.removeClass("entryRemove"); + this.attrCircleArea.removeClass("entryRemove"); + this.attrColorSpoid.removeClass("entryRemove"); + this.attrThickArea.painterAttrShapeLineColor.removeClass("entryRemove"); + break; + case "rect": + this.toolboxRect.addClass("entryToolboxRectClicked"); + this.attrThickArea.removeClass("entryRemove"); + this.attrColorArea.removeClass("entryRemove"); + this.attrCircleArea.removeClass("entryRemove"); + this.attrColorSpoid.removeClass("entryRemove"); + this.attrBackgroundArea.removeClass("entryRemove"); + this.attrThickArea.painterAttrShapeLineColor.removeClass("entryRemove"); + this.attrBackgroundArea.painterAttrShapeBackgroundColor.removeClass("entryRemove"); + break; + case "circle": + this.toolboxCircle.addClass("entryToolBoxCircleClicked"); + this.attrThickArea.removeClass("entryRemove"); + this.attrColorArea.removeClass("entryRemove"); + this.attrCircleArea.removeClass("entryRemove"); + this.attrColorSpoid.removeClass("entryRemove"); + this.attrThickArea.painterAttrShapeLineColor.removeClass("entryRemove"); + this.attrBackgroundArea.removeClass("entryRemove"); + this.attrBackgroundArea.painterAttrShapeBackgroundColor.removeClass("entryRemove"); + break; + case "text": + this.toolboxText.addClass("entryToolBoxTextClicked"); + this.attrFontArea.removeClass("entryRemove"); + this.attrColorArea.removeClass("entryRemove"); + this.attrCircleArea.removeClass("entryRemove"); + this.attrColorSpoid.removeClass("entryRemove"); + this.attrCircleArea.painterAttrCircle.removeClass("entryRemove"); + break; + case "fill": + this.toolboxFill.addClass("entryToolBoxFillClicked"); + this.attrColorArea.removeClass("entryRemove"); + this.attrCircleArea.removeClass("entryRemove"); + this.attrColorSpoid.removeClass("entryRemove"); + this.attrCircleArea.painterAttrCircle.removeClass("entryRemove"); + break; + case "erase": + $(".entryPlaygroundPainterContainer").addClass("dd"); + this.toolboxErase.addClass("entryToolBoxEraseClicked"); + this.attrThickArea.removeClass("entryRemove"); + break; + case "spoid": + this.attrColorArea.removeClass("entryRemove"); + this.attrCircleArea.removeClass("entryRemove"); + this.attrColorSpoid.removeClass("entryRemove"); + this.attrColorSpoid.removeClass("painterAttrColorSpoid"); + this.attrColorSpoid.addClass("painterAttrColorSpoidClicked"); + break; + case "coordinate": + this.toggleCoordinator(); } - 0 === e.length && (g = Entry.createElement("li"), g.addClass("entryVariableListCallerWorkspace"), g.addClass("entryVariableListCallerNoneWorkspace"), g.innerHTML = Lang.Workspace.no_use, c.appendChild(g)); - b.callerListElement = c; - this.listView_.insertBefore(c, b.listElement); - this.listView_.insertBefore(b.listElement, c); }; -Entry.VariableContainer.prototype.renderVariableReference = function(b) { - for (var a = this, c = this._variableRefs, d = b.id_, e = [], f = 0;f < c.length;f++) { - -1 < c[f].block.params.indexOf(d) && e.push(c[f]); - } - c = Entry.createElement("ul"); - c.addClass("entryVariableListCallerListWorkspace"); - for (f in e) { - var d = e[f], g = Entry.createElement("li"); - g.addClass("entryVariableListCallerWorkspace"); - g.appendChild(d.object.thumbnailView_.cloneNode()); - var h = Entry.createElement("div"); - h.addClass("entryVariableListCallerNameWorkspace"); - h.innerHTML = d.object.name + " : " + Lang.Blocks["VARIABLE_" + d.block.type]; - g.appendChild(h); - g.caller = d; - g.variable = b; - g.bindOnClick(function(b) { - Entry.playground.object != this.caller.object && (Entry.container.selectObject(), Entry.container.selectObject(this.caller.object.id, !0), a.select(null)); - b = this.caller; - b = b.funcBlock || b.block; - b.view.getBoard().activateBlock(b); - Entry.playground.toggleOnVariableView(); - Entry.playground.changeViewMode("variable"); - }); - c.appendChild(g); - } - 0 === e.length && (g = Entry.createElement("li"), g.addClass("entryVariableListCallerWorkspace"), g.addClass("entryVariableListCallerNoneWorkspace"), g.innerHTML = Lang.Workspace.no_use, c.appendChild(g)); - b.callerListElement = c; - this.listView_.insertBefore(c, b.listElement); - this.listView_.insertBefore(b.listElement, c); +Entry.BlockParser = function(a) { + this.syntax = a; + this._iterVariableCount = 0; + this._iterVariableChunk = ["i", "j", "k"]; }; -Entry.VariableContainer.prototype.renderFunctionReference = function(b) { - for (var a = this, c = this._functionRefs, d = [], e = 0;e < c.length;e++) { - d.push(c[e]); - } - c = Entry.createElement("ul"); - c.addClass("entryVariableListCallerListWorkspace"); - for (e in d) { - var f = d[e], g = Entry.createElement("li"); - g.addClass("entryVariableListCallerWorkspace"); - g.appendChild(f.object.thumbnailView_.cloneNode()); - var h = Entry.createElement("div"); - h.addClass("entryVariableListCallerNameWorkspace"); - h.innerHTML = f.object.name; - g.appendChild(h); - g.caller = f; - g.bindOnClick(function(c) { - Entry.playground.object != this.caller.object && (Entry.container.selectObject(), Entry.container.selectObject(this.caller.object.id, !0), a.select(null), a.select(b)); - c = this.caller.block; - Entry.playground.toggleOnVariableView(); - c.view.getBoard().activateBlock(c); - Entry.playground.changeViewMode("variable"); - }); - c.appendChild(g); - } - 0 === d.length && (g = Entry.createElement("li"), g.addClass("entryVariableListCallerWorkspace"), g.addClass("entryVariableListCallerNoneWorkspace"), g.innerHTML = Lang.Workspace.no_use, c.appendChild(g)); - b.callerListElement = c; - this.listView_.insertBefore(c, b.listElement); - this.listView_.insertBefore(b.listElement, c); +(function(a) { + a.Code = function(b) { + if (b instanceof Entry.Thread) { + return this.Thread(b); + } + if (b instanceof Entry.Block) { + return this.Block(b); + } + var a = ""; + b = b.getThreads(); + for (var d = 0;d < b.length;d++) { + a += this.Thread(b[d]); + } + return a; + }; + a.Thread = function(b) { + if (b instanceof Entry.Block) { + return this.Block(b); + } + var a = ""; + b = b.getBlocks(); + for (var d = 0;d < b.length;d++) { + a += this.Block(b[d]); + } + return a; + }; + a.Block = function(b) { + var a = b._schema.syntax; + return a ? this[a[0]](b) : ""; + }; + a.Program = function(b) { + return ""; + }; + a.Scope = function(b) { + b = b._schema.syntax.concat(); + return b.splice(1, b.length - 1).join(".") + "();\n"; + }; + a.BasicFunction = function(b) { + b = this.Thread(b.statements[0]); + return "function promise() {\n" + this.indent(b) + "}\n"; + }; + a.BasicIteration = function(b) { + var a = b.params[0], d = this.publishIterateVariable(); + b = this.Thread(b.statements[0]); + this.unpublishIterateVariable(); + return "for (var " + d + " = 0; " + d + " < " + a + "; " + d + "++){\n" + this.indent(b) + "}\n"; + }; + a.BasicIf = function(b) { + var a = this.Thread(b.statements[0]); + return "if (" + b._schema.syntax.concat()[1] + ") {\n" + this.indent(a) + "}\n"; + }; + a.BasicWhile = function(b) { + var a = this.Thread(b.statements[0]); + return "while (" + b._schema.syntax.concat()[1] + ") {\n" + this.indent(a) + "}\n"; + }; + a.indent = function(b) { + var a = " "; + b = b.split("\n"); + b.pop(); + return a += b.join("\n ") + "\n"; + }; + a.publishIterateVariable = function() { + var b = "", a = this._iterVariableCount; + do { + b = this._iterVariableChunk[a % 3] + b, a = parseInt(a / 3) - 1, 0 === a && (b = this._iterVariableChunk[0] + b); + } while (0 < a); + this._iterVariableCount++; + return b; + }; + a.unpublishIterateVariable = function() { + this._iterVariableCount && this._iterVariableCount--; + }; +})(Entry.BlockParser.prototype); +Entry.JSParser = function(a) { + this.syntax = a; + this.scopeChain = []; + this.scope = null; }; -Entry.VariableContainer.prototype.updateList = function() { - if (this.listView_) { - this.variableSettingView.addClass("entryRemove"); - for (this.listSettingView.addClass("entryRemove");this.listView_.firstChild;) { - this.listView_.removeChild(this.listView_.firstChild); +(function(a) { + a.Program = function(b) { + var a = [], d = []; + d.push({type:this.syntax.Program}); + var e = this.initScope(b), d = d.concat(this.BlockStatement(b)); + this.unloadScope(); + a.push(d); + return a = a.concat(e); + }; + a.Identifier = function(b, a) { + return a ? a[b.name] : this.scope[b.name]; + }; + a.ExpressionStatement = function(b) { + b = b.expression; + return this[b.type](b); + }; + a.ForStatement = function(b) { + var a = b.init, d = b.test, e = b.update, f = b.body; + if (this.syntax.ForStatement) { + throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; } - var b = this.viewMode_, a = []; - if ("all" == b || "message" == b) { - "message" == b && this.listView_.appendChild(this.messageAddButton_); - for (var c in this.messages_) { - var d = this.messages_[c]; - a.push(d); - var e = d.listElement; - this.listView_.appendChild(e); - d.callerListElement && this.listView_.appendChild(d.callerListElement); - } + var f = this[f.type](f), a = a.declarations[0].init.value, g = d.operator, d = d.right.value, h = 0; + "++" != e.operator && (e = a, a = d, d = e); + switch(g) { + case "<": + h = d - a; + break; + case "<=": + h = d + 1 - a; + break; + case ">": + h = a - d; + break; + case ">=": + h = a + 1 - d; } - if ("all" == b || "variable" == b) { - if ("variable" == b) { - e = this.variableAddPanel.info; - e.object && !Entry.playground.object && (e.object = null); - this.listView_.appendChild(this.variableAddButton_); - this.listView_.appendChild(this.variableAddPanel.view); - this.variableSplitters.top.innerHTML = Lang.Workspace.Variable_used_at_all_objects; - this.listView_.appendChild(this.variableSplitters.top); - for (c in this.variables_) { - d = this.variables_[c], d.object_ || (a.push(d), e = d.listElement, this.listView_.appendChild(e), d.callerListElement && this.listView_.appendChild(d.callerListElement)); - } - this.variableSplitters.bottom.innerHTML = Lang.Workspace.Variable_used_at_special_object; - this.listView_.appendChild(this.variableSplitters.bottom); - for (c in this.variables_) { - d = this.variables_[c], d.object_ && (a.push(d), e = d.listElement, this.listView_.appendChild(e), d.callerListElement && this.listView_.appendChild(d.callerListElement)); - } - this.updateVariableAddView("variable"); - } else { - for (c in this.variables_) { - d = this.variables_[c], a.push(d), e = d.listElement, this.listView_.appendChild(e), d.callerListElement && this.listView_.appendChild(d.callerListElement); + return this.BasicIteration(b, h, f); + }; + a.BlockStatement = function(b) { + var a = []; + b = b.body; + for (var d = 0;d < b.length;d++) { + var e = b[d], f = this[e.type](e); + if (f) { + if (void 0 === f.type) { + throw {message:"\ud574\ub2f9\ud558\ub294 \ube14\ub85d\uc774 \uc5c6\uc2b5\ub2c8\ub2e4.", node:e}; } + f && a.push(f); } } - if ("all" == b || "list" == b) { - if ("list" == b) { - e = this.listAddPanel.info; - e.object && !Entry.playground.object && (e.object = null); - this.listView_.appendChild(this.listAddButton_); - this.listView_.appendChild(this.listAddPanel.view); - this.variableSplitters.top.innerHTML = Lang.Workspace.List_used_all_objects; - this.listView_.appendChild(this.variableSplitters.top); - this.updateVariableAddView("list"); - for (c in this.lists_) { - d = this.lists_[c], d.object_ || (a.push(d), e = d.listElement, this.listView_.appendChild(e), d.callerListElement && this.listView_.appendChild(d.callerListElement)); - } - this.variableSplitters.bottom.innerHTML = Lang.Workspace.list_used_specific_objects; - this.listView_.appendChild(this.variableSplitters.bottom); - for (c in this.lists_) { - d = this.lists_[c], d.object_ && (a.push(d), e = d.listElement, this.listView_.appendChild(e), d.callerListElement && this.listView_.appendChild(d.callerListElement)); - } - this.updateVariableAddView("variable"); - } else { - for (c in this.lists_) { - d = this.lists_[c], a.push(d), e = d.listElement, this.listView_.appendChild(e), d.callerListElement && this.listView_.appendChild(d.callerListElement); - } - } + return a; + }; + a.EmptyStatement = function(b) { + throw {message:"empty\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.DebuggerStatement = function(b) { + throw {message:"debugger\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.WithStatement = function(b) { + throw {message:"with\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.ReturnStaement = function(b) { + throw {message:"return\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.LabeledStatement = function(b) { + throw {message:"label\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.BreakStatement = function(b) { + throw {message:"break\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.ContinueStatement = function(b) { + throw {message:"continue\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.IfStatement = function(b) { + if (this.syntax.IfStatement) { + throw {message:"if\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; } - if ("all" == b || "func" == b) { - for (c in "func" == b && this.listView_.appendChild(this.functionAddButton_), this.functions_) { - b = this.functions_[c], a.push(b), e = b.listElement, this.listView_.appendChild(e), b.callerListElement && this.listView_.appendChild(b.callerListElement); - } + return this.BasicIf(b); + }; + a.SwitchStatement = function(b) { + throw {message:"switch\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.SwitchCase = function(b) { + throw {message:"switch ~ case\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.ThrowStatement = function(b) { + throw {message:"throw\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.TryStatement = function(b) { + throw {message:"try\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.CatchClause = function(b) { + throw {message:"catch\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.WhileStatement = function(b) { + var a = b.body, d = this.syntax.WhileStatement, a = this[a.type](a); + if (d) { + throw {message:"while\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; } - this.listView_.appendChild(this.variableSettingView); - this.listView_.appendChild(this.listSettingView); - } -}; -Entry.VariableContainer.prototype.setMessages = function(b) { - for (var a in b) { - var c = b[a]; - c.id || (c.id = Entry.generateHash()); - this.createMessageView(c); - this.messages_.push(c); - } - Entry.playground.reloadPlayground(); - this.updateList(); -}; -Entry.VariableContainer.prototype.setVariables = function(b) { - for (var a in b) { - var c = new Entry.Variable(b[a]), d = c.getType(); - "variable" == d || "slide" == d ? (c.generateView(this.variables_.length), this.createVariableView(c), this.variables_.push(c)) : "list" == d ? (c.generateView(this.lists_.length), this.createListView(c), this.lists_.push(c)) : "timer" == d ? this.generateTimer(c) : "answer" == d && this.generateAnswer(c); - } - Entry.isEmpty(Entry.engine.projectTimer) && Entry.variableContainer.generateTimer(); - Entry.isEmpty(Entry.container.inputValue) && Entry.variableContainer.generateAnswer(); - Entry.playground.reloadPlayground(); - this.updateList(); -}; -Entry.VariableContainer.prototype.setFunctions = function(b) { - for (var a in b) { - var c = new Entry.Func(b[a]); - c.generateBlock(); - this.createFunctionView(c); - this.functions_[c.id] = c; - } - this.updateList(); -}; -Entry.VariableContainer.prototype.getFunction = function(b) { - return this.functions_[b]; -}; -Entry.VariableContainer.prototype.getVariable = function(b, a) { - var c = Entry.findObjsByKey(this.variables_, "id_", b)[0]; - a && a.isClone && c.object_ && (c = Entry.findObjsByKey(a.variables, "id_", b)[0]); - return c; -}; -Entry.VariableContainer.prototype.getList = function(b, a) { - var c = Entry.findObjsByKey(this.lists_, "id_", b)[0]; - a && a.isClone && c.object_ && (c = Entry.findObjsByKey(a.lists, "id_", b)[0]); - return c; -}; -Entry.VariableContainer.prototype.createFunction = function() { - if (!Entry.Func.isEdit) { - var b = new Entry.Func; - Entry.Func.edit(b); - } -}; -Entry.VariableContainer.prototype.addFunction = function(b) { -}; -Entry.VariableContainer.prototype.removeFunction = function(b) { - var a = b.id; - b = this.functions_; - b[a].destroy(); - delete b[a]; - a = "func_" + a; - Entry.container.removeFuncBlocks(a); - for (var c in b) { - b[c].content.removeBlocksByType(a); - } - this.updateList(); -}; -Entry.VariableContainer.prototype.checkListPosition = function(b, a) { - var c = b.x_ + b.width_, d = -b.y_, e = -b.y_ + -b.height_; - return a.x > b.x_ && a.x < c && a.y < d && a.y > e ? !0 : !1; -}; -Entry.VariableContainer.prototype.getListById = function(b) { - var a = this.lists_, c = []; - if (0 < a.length) { - for (var d = 0;d < a.length;d++) { - this.checkListPosition(a[d], b) && c.push(a[d]); + return this.BasicWhile(b, a); + }; + a.DoWhileStatement = function(b) { + throw {message:"do ~ while\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.ForInStatement = function(b) { + throw {message:"for ~ in\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.FunctionDeclaration = function(b) { + if (this.syntax.FunctionDeclaration) { + throw {message:"function\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + } + return null; + }; + a.VariableDeclaration = function(b) { + throw {message:"var\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.ThisExpression = function(b) { + return this.scope.this; + }; + a.ArrayExpression = function(b) { + throw {message:"array\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.ObjectExpression = function(b) { + throw {message:"object\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.Property = function(b) { + throw {message:"init, get, set\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.FunctionExpression = function(b) { + throw {message:"function\uc740 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.UnaryExpression = function(b) { + throw {message:b.operator + "\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub839\uc5b4 \uc785\ub2c8\ub2e4.", node:b}; + }; + a.UnaryOperator = function() { + return "- + ! ~ typeof void delete".split(" "); + }; + a.updateOperator = function() { + return ["++", "--"]; + }; + a.BinaryOperator = function() { + return "== != === !== < <= > >= << >> >>> + - * / % , ^ & in instanceof".split(" "); + }; + a.AssignmentExpression = function(b) { + throw {message:b.operator + "\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub839\uc5b4 \uc785\ub2c8\ub2e4.", node:b}; + }; + a.AssignmentOperator = function() { + return "= += -= *= /= %= <<= >>= >>>= ,= ^= &=".split(" "); + }; + a.LogicalExpression = function(b) { + throw {message:b.operator + "\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub839\uc5b4 \uc785\ub2c8\ub2e4.", node:b}; + }; + a.LogicalOperator = function() { + return ["||", "&&"]; + }; + a.MemberExpression = function(b) { + var a = b.object, d = b.property; + console.log(a.type); + a = this[a.type](a); + console.log(a); + d = this[d.type](d, a); + if (Object(a) !== a || Object.getPrototypeOf(a) !== Object.prototype) { + throw {message:a + "\uc740(\ub294) \uc798\ubabb\ub41c \uba64\ubc84 \ubcc0\uc218\uc785\ub2c8\ub2e4.", node:b}; + } + a = d; + if (!a) { + throw {message:d + "\uc774(\uac00) \uc874\uc7ac\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.", node:b}; + } + return a; + }; + a.ConditionalExpression = function(b) { + throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.UpdateExpression = function(b) { + throw {message:b.operator + "\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub801\uc5b4 \uc785\ub2c8\ub2e4.", node:b}; + }; + a.CallExpression = function(b) { + b = b.callee; + return {type:this[b.type](b)}; + }; + a.NewExpression = function(b) { + throw {message:"new\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.SequenceExpression = function(b) { + throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + }; + a.initScope = function(b) { + if (null === this.scope) { + var a = function() { + }; + a.prototype = this.syntax.Scope; + } else { + a = function() { + }, a.prototype = this.scope; } - return c; - } - return !1; -}; -Entry.VariableContainer.prototype.editFunction = function(b, a) { -}; -Entry.VariableContainer.prototype.saveFunction = function(b) { - this.functions_[b.id] || (this.functions_[b.id] = b, this.createFunctionView(b)); - b.listElement.nameField.innerHTML = b.description; - this.updateList(); -}; -Entry.VariableContainer.prototype.createFunctionView = function(b) { - var a = this; - if (this.view_) { - var c = Entry.createElement("li"); - c.addClass("entryVariableListElementWorkspace"); - c.addClass("entryFunctionElementWorkspace"); - c.bindOnClick(function(c) { - c.stopPropagation(); - a.select(b); - }); - var d = Entry.createElement("button"); - d.addClass("entryVariableListElementDeleteWorkspace"); - d.bindOnClick(function(c) { - c.stopPropagation(); - confirm(Lang.Workspace.will_you_delete_function) && (a.removeFunction(b), a.selected = null); - }); - var e = Entry.createElement("button"); - e.addClass("entryVariableListElementEditWorkspace"); - var f = this._getBlockMenu(); - e.bindOnClick(function(a) { - a.stopPropagation(); - Entry.Func.edit(b); - Entry.playground && (Entry.playground.changeViewMode("code"), "func" != f.lastSelector && f.selectMenu("func")); - }); - var g = Entry.createElement("div"); - g.addClass("entryVariableFunctionElementNameWorkspace"); - g.innerHTML = b.description; - c.nameField = g; - c.appendChild(g); - c.appendChild(e); - c.appendChild(d); - b.listElement = c; - } -}; -Entry.VariableContainer.prototype.checkAllVariableName = function(b, a) { - a = this[a]; - for (var c = 0;c < a.length;c++) { - if (a[c].name_ == b) { - return !0; + this.scope = new a; + this.scopeChain.push(this.scope); + return this.scanDefinition(b); + }; + a.unloadScope = function() { + this.scopeChain.pop(); + this.scope = this.scopeChain.length ? this.scopeChain[this.scopeChain.length - 1] : null; + }; + a.scanDefinition = function(b) { + b = b.body; + for (var a = [], d = 0;d < b.length;d++) { + var e = b[d]; + "FunctionDeclaration" === e.type && (this.scope[e.id.name] = this.scope.promise, this.syntax.BasicFunction && (e = e.body, a.push([{type:this.syntax.BasicFunction, statements:[this[e.type](e)]}]))); } - } - return !1; -}; -Entry.VariableContainer.prototype.addVariable = function(b) { - if (!b) { - var a = this.variableAddPanel; - b = a.view.name.value.trim(); - b && 0 !== b.length || (b = Lang.Workspace.variable); - b.length > this._maxNameLength && (b = this._truncName(b, "variable")); - b = this.checkAllVariableName(b, "variables_") ? Entry.getOrderedName(b, this.variables_, "name_") : b; - var c = a.info; - b = {name:b, isCloud:c.isCloud, object:c.object, variableType:"variable"}; - a.view.addClass("entryRemove"); - this.resetVariableAddPanel("variable"); - } - b = new Entry.Variable(b); - Entry.stateManager && Entry.stateManager.addCommand("add variable", this, this.removeVariable, b); - b.generateView(this.variables_.length); - this.createVariableView(b); - this.variables_.unshift(b); - Entry.playground.reloadPlayground(); - this.updateList(); - return new Entry.State(this, this.removeVariable, b); -}; -Entry.VariableContainer.prototype.removeVariable = function(b) { - var a = this.variables_.indexOf(b), c = b.toJSON(); - this.selected == b && this.select(null); - b.remove(); - this.variables_.splice(a, 1); - Entry.stateManager && Entry.stateManager.addCommand("remove variable", this, this.addVariable, c); - Entry.playground.reloadPlayground(); - this.updateList(); - return new Entry.State(this, this.addVariable, c); -}; -Entry.VariableContainer.prototype.changeVariableName = function(b, a) { - b.name_ != a && (Entry.isExist(a, "name_", this.variables_) ? (b.listElement.nameField.value = b.name_, Entry.toast.alert(Lang.Workspace.variable_rename_failed, Lang.Workspace.variable_dup)) : 10 < a.length ? (b.listElement.nameField.value = b.name_, Entry.toast.alert(Lang.Workspace.variable_rename_failed, Lang.Workspace.variable_too_long)) : (b.setName(a), Entry.playground.reloadPlayground(), Entry.toast.success(Lang.Workspace.variable_rename, Lang.Workspace.variable_rename_ok))); -}; -Entry.VariableContainer.prototype.changeListName = function(b, a) { - b.name_ != a && (Entry.isExist(a, "name_", this.lists_) ? (b.listElement.nameField.value = b.name_, Entry.toast.alert(Lang.Workspace.list_rename_failed, Lang.Workspace.list_dup)) : 10 < a.length ? (b.listElement.nameField.value = b.name_, Entry.toast.alert(Lang.Workspace.list_rename_failed, Lang.Workspace.list_too_long)) : (b.name_ = a, b.updateView(), Entry.playground.reloadPlayground(), Entry.toast.success(Lang.Workspace.list_rename, Lang.Workspace.list_rename_ok))); -}; -Entry.VariableContainer.prototype.removeList = function(b) { - var a = this.lists_.indexOf(b), c = b.toJSON(); - Entry.stateManager && Entry.stateManager.addCommand("remove list", this, this.addList, c); - this.selected == b && this.select(null); - b.remove(); - this.lists_.splice(a, 1); - Entry.playground.reloadPlayground(); - this.updateList(); - return new Entry.State(this, this.addList, c); -}; -Entry.VariableContainer.prototype.createVariableView = function(b) { - var a = this, c = Entry.createElement("li"), d = Entry.createElement("div"); - d.addClass("entryVariableListElementWrapperWorkspace"); - c.appendChild(d); - c.addClass("entryVariableListElementWorkspace"); - b.object_ ? c.addClass("entryVariableLocalElementWorkspace") : b.isCloud_ ? c.addClass("entryVariableCloudElementWorkspace") : c.addClass("entryVariableGlobalElementWorkspace"); - c.bindOnClick(function(c) { - a.select(b); - }); - var e = Entry.createElement("button"); - e.addClass("entryVariableListElementDeleteWorkspace"); - e.bindOnClick(function(c) { - c.stopPropagation(); - a.removeVariable(b); - a.selectedVariable = null; - a.variableSettingView.addClass("entryRemove"); - }); - var f = Entry.createElement("button"); - f.addClass("entryVariableListElementEditWorkspace"); - f.bindOnClick(function(c) { - c.stopPropagation(); - h.removeAttribute("disabled"); - g.removeClass("entryRemove"); - this.addClass("entryRemove"); - a.updateSelectedVariable(b); - h.focus(); - }); - c.editButton = f; - var g = Entry.createElement("button"); - g.addClass("entryVariableListElementEditWorkspace"); - g.addClass("entryRemove"); - g.bindOnClick(function(b) { - b.stopPropagation(); - h.blur(); - h.setAttribute("disabled", "disabled"); - f.removeClass("entryRemove"); - this.addClass("entryRemove"); - a.updateSelectedVariable(null, "variable"); - }); - c.editSaveButton = g; - var h = Entry.createElement("input"); - h.addClass("entryVariableListElementNameWorkspace"); - h.setAttribute("disabled", "disabled"); - h.value = b.name_; - h.bindOnClick(function(a) { - a.stopPropagation(); - }); - h.onblur = function(c) { - (c = this.value.trim()) && 0 !== c.length ? a.changeVariableName(b, this.value) : (Entry.toast.alert(Lang.Msgs.warn, Lang.Workspace.variable_can_not_space), this.value = b.getName()); + return a; }; - h.onkeydown = function(a) { - 13 == a.keyCode && this.blur(); + a.BasicFunction = function(b, a) { + return null; }; - c.nameField = h; - d.appendChild(h); - d.appendChild(f); - d.appendChild(g); - d.appendChild(e); - b.listElement = c; -}; -Entry.VariableContainer.prototype.addMessage = function(b) { - b.id || (b.id = Entry.generateHash()); - Entry.stateManager && Entry.stateManager.addCommand("add message", this, this.removeMessage, b); - this.createMessageView(b); - this.messages_.unshift(b); - Entry.playground.reloadPlayground(); - this.updateList(); - b.listElement.nameField.focus(); - return new Entry.State(this, this.removeMessage, b); -}; -Entry.VariableContainer.prototype.removeMessage = function(b) { - this.selected == b && this.select(null); - Entry.stateManager && Entry.stateManager.addCommand("remove message", this, this.addMessage, b); - var a = this.messages_.indexOf(b); - this.messages_.splice(a, 1); - this.updateList(); - Entry.playground.reloadPlayground(); - return new Entry.State(this, this.addMessage, b); -}; -Entry.VariableContainer.prototype.changeMessageName = function(b, a) { - b.name != a && (Entry.isExist(a, "name", this.messages_) ? (b.listElement.nameField.value = b.name, Entry.toast.alert(Lang.Workspace.message_rename_failed, Lang.Workspace.message_dup)) : 10 < a.length ? (b.listElement.nameField.value = b.name, Entry.toast.alert(Lang.Workspace.message_rename_failed, Lang.Workspace.message_too_long)) : (b.name = a, Entry.playground.reloadPlayground(), Entry.toast.success(Lang.Workspace.message_rename, Lang.Workspace.message_rename_ok))); -}; -Entry.VariableContainer.prototype.createMessageView = function(b) { - var a = this, c = Entry.createElement("li"); - c.addClass("entryVariableListElementWorkspace"); - c.addClass("entryMessageElementWorkspace"); - c.bindOnClick(function(c) { - a.select(b); - }); - var d = Entry.createElement("button"); - d.addClass("entryVariableListElementDeleteWorkspace"); - d.bindOnClick(function(c) { - c.stopPropagation(); - a.removeMessage(b); - }); - var e = Entry.createElement("button"); - e.addClass("entryVariableListElementEditWorkspace"); - e.bindOnClick(function(a) { - a.stopPropagation(); - g.removeAttribute("disabled"); - g.focus(); - f.removeClass("entryRemove"); - this.addClass("entryRemove"); - }); - var f = Entry.createElement("button"); - f.addClass("entryVariableListElementEditWorkspace"); - f.addClass("entryRemove"); - f.bindOnClick(function(a) { - a.stopPropagation(); - g.blur(); - e.removeClass("entryRemove"); - this.addClass("entryRemove"); - }); - var g = Entry.createElement("input"); - g.addClass("entryVariableListElementNameWorkspace"); - g.value = b.name; - g.bindOnClick(function(a) { - a.stopPropagation(); - }); - g.onblur = function(c) { - (c = this.value.trim()) && 0 !== c.length ? (a.changeMessageName(b, this.value), e.removeClass("entryRemove"), f.addClass("entryRemove"), g.setAttribute("disabled", "disabled")) : (Entry.toast.alert(Lang.Msgs.warn, Lang.Msgs.sign_can_not_space), this.value = b.name); + a.BasicIteration = function(b, a, d) { + var e = this.syntax.BasicIteration; + if (!e) { + throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b}; + } + return {params:[a], type:e, statements:[d]}; }; - g.onkeydown = function(a) { - 13 == a.keyCode && this.blur(); + a.BasicWhile = function(b, a) { + var d = b.test.raw; + if (this.syntax.BasicWhile[d]) { + return {type:this.syntax.BasicWhile[d], statements:[a]}; + } + throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b.test}; }; - c.nameField = g; - c.appendChild(g); - c.appendChild(e); - c.appendChild(f); - c.appendChild(d); - b.listElement = c; -}; -Entry.VariableContainer.prototype.addList = function(b) { - if (!b) { - var a = this.listAddPanel; - b = a.view.name.value.trim(); - b && 0 !== b.length || (b = Lang.Workspace.list); - var c = a.info; - b.length > this._maxNameLength && (b = this._truncName(b, "list")); - b = this.checkAllVariableName(b, "lists_") ? Entry.getOrderedName(b, this.lists_, "name_") : b; - b = {name:b, isCloud:c.isCloud, object:c.object, variableType:"list"}; - a.view.addClass("entryRemove"); - this.resetVariableAddPanel("list"); + a.BasicIf = function(b) { + var a = b.consequent, a = this[a.type](a); + try { + var d = "", e = "===" === b.test.operator ? "==" : b.test.operator; + if ("Identifier" === b.test.left.type && "Literal" === b.test.right.type) { + d = b.test.left.name + " " + e + " " + b.test.right.raw; + } else { + if ("Literal" === b.test.left.type && "Identifier" === b.test.right.type) { + d = b.test.right.name + " " + e + " " + b.test.left.raw; + } else { + throw Error(); + } + } + if (this.syntax.BasicIf[d]) { + return Array.isArray(a) || "object" !== typeof a || (a = [a]), {type:this.syntax.BasicIf[d], statements:[a]}; + } + throw Error(); + } catch (f) { + throw {message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", node:b.test}; + } + }; +})(Entry.JSParser.prototype); +Entry.Parser = function(a, b, c) { + this._mode = a; + this.syntax = {}; + this.codeMirror = c; + this._lang = b || "js"; + this.availableCode = []; + "maze" === a && (this._stageId = Number(Ntry.configManager.getConfig("stageId")), "object" == typeof NtryData && this.setAvailableCode(NtryData.config[this._stageId].availableCode, NtryData.player[this._stageId].code)); + this.mappingSyntax(a); + switch(this._lang) { + case "js": + this._parser = new Entry.JSParser(this.syntax); + b = this.syntax; + var d = {}, e; + for (e in b.Scope) { + d[e + "();\n"] = b.Scope[e]; + } + "BasicIf" in b && (d.front = "BasicIf"); + CodeMirror.commands.javascriptComplete = function(b) { + CodeMirror.showHint(b, null, {globalScope:d}); + }; + c.on("keyup", function(b, a) { + !b.state.completionActive && 65 <= a.keyCode && 95 >= a.keyCode && CodeMirror.showHint(b, null, {completeSingle:!1, globalScope:d}); + }); + break; + case "block": + this._parser = new Entry.BlockParser(this.syntax); } - b = new Entry.Variable(b); - Entry.stateManager && Entry.stateManager.addCommand("add list", this, this.removeList, b); - b.generateView(this.lists_.length); - this.createListView(b); - this.lists_.unshift(b); - Entry.playground.reloadPlayground(); - this.updateList(); - return new Entry.State(this, this.removelist, b); }; -Entry.VariableContainer.prototype.createListView = function(b) { - var a = this, c = Entry.createElement("li"), d = Entry.createElement("div"); - d.addClass("entryVariableListElementWrapperWorkspace"); - c.appendChild(d); - c.addClass("entryVariableListElementWorkspace"); - b.object_ ? c.addClass("entryListLocalElementWorkspace") : b.isCloud_ ? c.addClass("entryListCloudElementWorkspace") : c.addClass("entryListGlobalElementWorkspace"); - c.bindOnClick(function(c) { - a.select(b); - }); - var e = Entry.createElement("button"); - e.addClass("entryVariableListElementDeleteWorkspace"); - e.bindOnClick(function(c) { - c.stopPropagation(); - a.removeList(b); - a.selectedList = null; - a.listSettingView.addClass("entryRemove"); - }); - var f = Entry.createElement("button"); - f.addClass("entryVariableListElementEditWorkspace"); - f.bindOnClick(function(c) { - c.stopPropagation(); - h.removeAttribute("disabled"); - g.removeClass("entryRemove"); - this.addClass("entryRemove"); - a.updateSelectedVariable(b); - h.focus(); - }); - c.editButton = f; - var g = Entry.createElement("button"); - g.addClass("entryVariableListElementEditWorkspace"); - g.addClass("entryRemove"); - g.bindOnClick(function(c) { - c.stopPropagation(); - h.blur(); - h.setAttribute("disabled", "disabled"); - f.removeClass("entryRemove"); - this.addClass("entryRemove"); - a.select(b); - a.updateSelectedVariable(null, "list"); - }); - c.editSaveButton = g; - var h = Entry.createElement("input"); - h.setAttribute("disabled", "disabled"); - h.addClass("entryVariableListElementNameWorkspace"); - h.value = b.name_; - h.bindOnClick(function(a) { - a.stopPropagation(); - }); - h.onblur = function(c) { - (c = this.value.trim()) && 0 !== c.length ? a.changeListName(b, this.value) : (Entry.toast.alert(Lang.Msgs.warn, Lang.Msgs.list_can_not_space), this.value = b.getName()); +(function(a) { + a.parse = function(b) { + var a = null; + switch(this._lang) { + case "js": + try { + var d = acorn.parse(b), a = this._parser.Program(d); + } catch (e) { + this.codeMirror && (e instanceof SyntaxError ? (b = {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.") : (b = this.getLineNumber(e.node.start, e.node.end), b.message = e.message, b.severity = "error", this.codeMirror.markText(b.from, b.to, {className:"CodeMirror-lint-mark-error", __annotation:b, clearOnEnter:!0})), Entry.toast.alert("Error", e.message)), a = []; + } + break; + case "block": + b = this._parser.Code(b).match(/(.*{.*[\S|\s]+?}|.+)/g), a = Array.isArray(b) ? b.reduce(function(b, a, c) { + 1 === c && (b += "\n"); + return (-1 < a.indexOf("function") ? a + b : b + a) + "\n"; + }) : ""; + } + return a; + }; + a.getLineNumber = function(b, a) { + var d = this.codeMirror.getValue(), e = {from:{}, to:{}}; + b = d.substring(0, b).split(/\n/gi); + e.from.line = b.length - 1; + e.from.ch = b[b.length - 1].length; + a = d.substring(0, a).split(/\n/gi); + e.to.line = a.length - 1; + e.to.ch = a[a.length - 1].length; + return e; }; - h.onkeydown = function(a) { - 13 == a.keyCode && this.blur(); + a.mappingSyntax = function(b) { + for (var a = Object.keys(Entry.block), d = 0;d < a.length;d++) { + var e = a[d], f = Entry.block[e]; + if (f.mode === b && -1 < this.availableCode.indexOf(e) && (f = f.syntax)) { + for (var g = this.syntax, h = 0;h < f.length;h++) { + var k = f[h]; + if (h === f.length - 2 && "function" === typeof f[h + 1]) { + g[k] = f[h + 1]; + break; + } + g[k] || (g[k] = {}); + h === f.length - 1 ? g[k] = e : g = g[k]; + } + } + } + }; + a.setAvailableCode = function(b, a) { + var d = []; + b.forEach(function(b, a) { + b.forEach(function(b, a) { + d.push(b.type); + }); + }); + a instanceof Entry.Code ? a.getBlockList().forEach(function(b) { + b.type !== NtryData.START && -1 === d.indexOf(b.type) && d.push(b.type); + }) : a.forEach(function(b, a) { + b.forEach(function(b, a) { + b.type !== NtryData.START && -1 === d.indexOf(b.type) && d.push(b.type); + }); + }); + this.availableCode = this.availableCode.concat(d); }; - c.nameField = h; - d.appendChild(h); - d.appendChild(f); - d.appendChild(g); - d.appendChild(e); - b.listElement = c; +})(Entry.Parser.prototype); +Entry.Pdf = function(a) { + this.generateView(a); }; -Entry.VariableContainer.prototype.mapVariable = function(b, a) { - for (var c = this.variables_.length, d = 0;d < c;d++) { - b(this.variables_[d], a); - } +p = Entry.Pdf.prototype; +p.generateView = function(a) { + var b = Entry.createElement("div", "entryPdfWorkspace"); + b.addClass("entryRemove"); + this._view = b; + var c = "/pdfjs/web/viewer.html"; + a && "" != a && (c += "?file=" + a); + pdfViewIframe = Entry.createElement("iframe", "entryPdfIframeWorkspace"); + pdfViewIframe.setAttribute("id", "pdfViewIframe"); + pdfViewIframe.setAttribute("frameborder", 0); + pdfViewIframe.setAttribute("src", c); + b.appendChild(pdfViewIframe); }; -Entry.VariableContainer.prototype.mapList = function(b, a) { - for (var c = this.lists_.length, d = 0;d < c;d++) { - b(this.lists_[d], a); - } +p.getView = function() { + return this._view; }; -Entry.VariableContainer.prototype.getVariableJSON = function() { - for (var b = [], a = 0;a < this.variables_.length;a++) { - b.push(this.variables_[a].toJSON()); - } - for (a = 0;a < this.lists_.length;a++) { - b.push(this.lists_[a].toJSON()); - } - Entry.engine.projectTimer && b.push(Entry.engine.projectTimer.toJSON()); - a = Entry.container.inputValue; - Entry.isEmpty(a) || b.push(a.toJSON()); - return b; +p.resize = function() { + var a = document.getElementById("entryContainerWorkspaceId"), b = document.getElementById("pdfViewIframe"); + w = a.offsetWidth; + b.width = w + "px"; + b.height = 9 * w / 16 + "px"; }; -Entry.VariableContainer.prototype.getMessageJSON = function() { - for (var b = [], a = 0;a < this.messages_.length;a++) { - b.push({id:this.messages_[a].id, name:this.messages_[a].name}); - } - return b; +Entry.FieldTrashcan = function(a) { + a && this.setBoard(a); + this.dragBlockObserver = this.dragBlock = null; + this.isOver = !1; + Entry.windowResized && Entry.windowResized.attach(this, this.setPosition); }; -Entry.VariableContainer.prototype.getFunctionJSON = function() { - var b = [], a; - for (a in this.functions_) { - var c = this.functions_[a], c = {id:c.id, content:JSON.stringify(c.content.toJSON())}; - b.push(c); +(function(a) { + a._generateView = function() { + this.svgGroup = this.board.svg.elem("g"); + this.renderStart(); + this._addControl(); + }; + a.renderStart = function() { + var b = Entry.mediaFilePath + "delete_"; + this.trashcanTop = this.svgGroup.elem("image", {href:b + "cover.png", width:60, height:20}); + this.svgGroup.elem("image", {href:b + "body.png", y:20, width:60, height:60}); + }; + a._addControl = function() { + $(this.svgGroup).bind("mousedown", function(b) { + Entry.Utils.isRightButton(b) && (b.stopPropagation(), $("#entryWorkspaceBoard").css("background", "white")); + }); + }; + a.updateDragBlock = function() { + var b = this.board.dragBlock, a = this.dragBlockObserver; + a && (a.destroy(), this.dragBlockObserver = null); + b ? this.dragBlockObserver = b.observe(this, "checkBlock", ["x", "y"]) : (this.isOver && this.dragBlock && !this.dragBlock.block.getPrevBlock() && (this.dragBlock.block.doDestroyBelow(!0), createjs.Sound.play("entryDelete")), this.tAnimation(!1)); + this.dragBlock = b; + }; + a.checkBlock = function() { + var b = this.dragBlock; + if (b && b.block.isDeletable()) { + var a = this.board.offset(), d = this.getPosition(), e = d.x + a.left, a = d.y + a.top, f, g; + if (b = b.dragInstance) { + f = b.offsetX, g = b.offsetY; + } + this.tAnimation(f >= e && g >= a); + } + }; + a.align = function() { + var b = this.getPosition(); + this.svgGroup.attr({transform:"translate(" + b.x + "," + b.y + ")"}); + }; + a.setPosition = function() { + if (this.board) { + var b = this.board.svgDom; + this._x = b.width() - 110; + this._y = b.height() - 110; + this.align(); + } + }; + a.getPosition = function() { + return {x:this._x, y:this._y}; + }; + a.tAnimation = function(b) { + if (b !== this.isOver) { + b = void 0 === b ? !0 : b; + var a, d = this.trashcanTop; + a = b ? {translateX:15, translateY:-25, rotateZ:30} : {translateX:0, translateY:0, rotateZ:0}; + $(d).velocity(a, {duration:50}); + this.isOver = b; + } + }; + a.setBoard = function(b) { + this._dragBlockObserver && this._dragBlockObserver.destroy(); + this.board = b; + this.svgGroup || this._generateView(); + var a = b.svg, d = a.firstChild; + d ? a.insertBefore(this.svgGroup, d) : a.appendChild(this.svgGroup); + this._dragBlockObserver = b.observe(this, "updateDragBlock", ["dragBlock"]); + this.svgGroup.attr({filter:"url(#entryTrashcanFilter_" + b.suffix + ")"}); + this.setPosition(); + }; +})(Entry.FieldTrashcan.prototype); +Entry.Workspace = function(a) { + Entry.Model(this, !1); + this.observe(this, "_handleChangeBoard", ["selectedBoard"], !1); + this.trashcan = new Entry.FieldTrashcan; + var b = a.blockMenu; + b && (this.blockMenu = new Entry.BlockMenu(b.dom, b.align, b.categoryData, b.scroll), this.blockMenu.workspace = this, this.blockMenu.observe(this, "_setSelectedBlockView", ["selectedBlockView"], !1)); + if (b = a.board) { + b.workspace = this, this.board = new Entry.Board(b), this.board.observe(this, "_setSelectedBlockView", ["selectedBlockView"], !1), this.set({selectedBoard:this.board}); } - return b; + if (b = a.vimBoard) { + this.vimBoard = new Entry.Vim(b.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.VariableContainer.prototype.resetVariableAddPanel = function(b) { - b = b || "variable"; - var a = "variable" == b ? this.variableAddPanel : this.listAddPanel, c = a.info; - c.isCloud = !1; - c.object = null; - a.view.name.value = ""; - a.isOpen = !1; - this.updateVariableAddView(b); +Entry.Workspace.MODE_BOARD = 0; +Entry.Workspace.MODE_VIMBOARD = 1; +Entry.Workspace.MODE_OVERLAYBOARD = 2; +(function(a) { + a.schema = {selectedBlockView:null, selectedBoard:null}; + a.getBoard = function() { + return this.board; + }; + a.getSelectedBoard = function() { + return this.selectedBoard; + }; + a.getBlockMenu = function() { + return this.blockMenu; + }; + a.getVimBoard = function() { + return this.vimBoard; + }; + a.getMode = function() { + return this.mode; + }; + a.setMode = function(b, a) { + b = Number(b); + var d = this.mode; + this.mode = b; + switch(b) { + 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(a); + }; + a.changeBoardCode = function(b) { + this.board.changeCode(b); + }; + a.changeOverlayBoardCode = function(b) { + this.overlayBoard && this.overlayBoard.changeCode(b); + }; + a.changeBlockMenuCode = function(b) { + this.blockMenu.changeCode(b); + }; + a.textToCode = function(b) { + if (b == Entry.Workspace.MODE_VIMBOARD) { + b = this.vimBoard.textToCode(); + var a = this.board, d = a.code; + d.load(b); + d.createView(a); + a.reDraw(); + this.board.alignThreads(); + } + }; + a.codeToText = function(b) { + return this.vimBoard.codeToText(b); + }; + a.getCodeToText = function(b) { + return this.vimBoard.getCodeToText(b); + }; + a._setSelectedBlockView = function() { + this.set({selectedBlockView:this.board.selectedBlockView || this.blockMenu.selectedBlockView || (this.overlayBoard ? this.overlayBoard.selectedBlockView : null)}); + }; + a.initOverlayBoard = function() { + this.overlayBoard = new Entry.Board({dom:this.board.view, workspace:this, isOverlay:!0}); + this.overlayBoard.changeCode(new Entry.Code([])); + this.overlayBoard.workspace = this; + this.overlayBoard.observe(this, "_setSelectedBlockView", ["selectedBlockView"], !1); + }; + a._keyboardControl = function(b) { + var a = b.keyCode || b.which, d = b.ctrlKey; + if (!Entry.Utils.isInInput(b)) { + var e = this.selectedBlockView; + e && !e.isInBlockMenu && e.block.isDeletable() && (8 == a || 46 == a ? (Entry.do("destroyBlock", e.block), b.preventDefault()) : d && (67 == a ? e.block.copyToClipboard() : 88 == a && (b = e.block, b.copyToClipboard(), b.destroy(!0, !0), e.getBoard().setSelectedBlock(null)))); + d && 86 == a && (a = this.selectedBoard) && a instanceof Entry.Board && Entry.clipboard && Entry.do("addThread", Entry.clipboard).value.getFirstBlock().copyToClipboard(); + } + }; + a._handleChangeBoard = function() { + var b = this.selectedBoard; + b && b.constructor === Entry.Board && this.trashcan.setBoard(b); + }; +})(Entry.Workspace.prototype); +Entry.BlockDriver = function() { }; -Entry.VariableContainer.prototype.generateVariableAddView = function() { - var b = this, a = Entry.createElement("li"); - this.variableAddPanel.view = a; - this.variableAddPanel.isOpen = !1; - a.addClass("entryVariableAddSpaceWorkspace"); - a.addClass("entryRemove"); - var c = Entry.createElement("div"); - c.addClass("entryVariableAddSpaceNameWrapperWorkspace"); - a.appendChild(c); - var d = Entry.createElement("input"); - d.addClass("entryVariableAddSpaceInputWorkspace"); - d.setAttribute("placeholder", Lang.Workspace.Variable_placeholder_name); - d.variableContainer = this; - d.onkeypress = function(a) { - 13 == a.keyCode && (Entry.variableContainer.addVariable(), b.updateSelectedVariable(b.variables_[0]), a = b.variables_[0].listElement, a.editButton.addClass("entryRemove"), a.editSaveButton.removeClass("entryRemove"), a.nameField.removeAttribute("disabled")); +(function(a) { + a.convert = function() { + var b = new Date, a; + for (a in Entry.block) { + "function" === typeof Entry.block[a] && this._convertBlock(a); + } + console.log((new Date).getTime() - b.getTime()); }; - this.variableAddPanel.view.name = d; - c.appendChild(d); - c = Entry.createElement("div"); - c.addClass("entryVariableAddSpaceGlobalWrapperWorkspace"); - c.bindOnClick(function(a) { - b.variableAddPanel.info.object = null; - b.updateVariableAddView("variable"); - }); - a.appendChild(c); - d = Entry.createElement("span"); - d.innerHTML = Lang.Workspace.Variable_use_all_objects; - c.appendChild(d); - d = Entry.createElement("span"); - d.addClass("entryVariableAddSpaceCheckWorkspace"); - this.variableAddPanel.view.globalCheck = d; - this.variableAddPanel.info.object || d.addClass("entryVariableAddChecked"); - c.appendChild(d); - c = Entry.createElement("div"); - c.addClass("entryVariableAddSpaceLocalWrapperWorkspace"); - c.bindOnClick(function(a) { - Entry.playground.object && (a = b.variableAddPanel.info, a.object = Entry.playground.object.id, a.isCloud = !1, b.updateVariableAddView("variable")); - }); - a.appendChild(c); - d = Entry.createElement("span"); - d.innerHTML = Lang.Workspace.Variable_use_this_object; - c.appendChild(d); - d = Entry.createElement("span"); - d.addClass("entryVariableAddSpaceCheckWorkspace"); - this.variableAddPanel.view.localCheck = d; - this.variableAddPanel.info.object && d.addClass("entryVariableAddChecked"); - c.appendChild(d); - c = Entry.createElement("div"); - a.cloudWrapper = c; - c.addClass("entryVariableAddSpaceCloudWrapperWorkspace"); - c.bindOnClick(function(a) { - a = b.variableAddPanel.info; - a.object || (a.isCloud = !a.isCloud, b.updateVariableAddView("variable")); - }); - a.appendChild(c); - d = Entry.createElement("span"); - d.addClass("entryVariableAddSpaceCloudSpanWorkspace"); - d.innerHTML = Lang.Workspace.Variable_create_cloud; - c.appendChild(d); - d = Entry.createElement("span"); - this.variableAddPanel.view.cloudCheck = d; - d.addClass("entryVariableAddSpaceCheckWorkspace"); - d.addClass("entryVariableAddSpaceCloudCheckWorkspace"); - this.variableAddPanel.info.isCloud && d.addClass("entryVariableAddChecked"); - c.appendChild(d); - c = Entry.createElement("div"); - c.addClass("entryVariableAddSpaceButtonWrapperWorkspace"); + a._convertBlock = function(b) { + function a(b) { + var d = {type:b.getAttribute("type"), index:{}}; + b = $(b).children(); + if (!b) { + return d; + } + for (var e = 0;e < b.length;e++) { + var f = b[e], g = f.tagName, h = $(f).children()[0], u = f.getAttribute("name"); + "value" === g ? "block" == h.nodeName && (d.params || (d.params = []), d.params.push(a(h)), d.index[u] = d.params.length - 1) : "field" === g && (d.params || (d.params = []), d.params.push(f.textContent), d.index[u] = d.params.length - 1); + } + return d; + } + var d = Blockly.Blocks[b], e = EntryStatic.blockInfo[b], f, g; + if (e && (f = e.class, g = e.isNotFor, e = e.xml)) { + var e = $.parseXML(e), h = a(e.childNodes[0]) + } + d = (new Entry.BlockMockup(d, h, b)).toJSON(); + d.class = f; + d.isNotFor = g; + _.isEmpty(d.paramsKeyMap) && delete d.paramsKeyMap; + _.isEmpty(d.statementsKeyMap) && delete d.statementsKeyMap; + d.func = Entry.block[b]; + -1 < "NUMBER TRUE FALSE TEXT FUNCTION_PARAM_BOOLEAN FUNCTION_PARAM_STRING TRUE_UN".split(" ").indexOf(b.toUpperCase()) && (d.isPrimitive = !0); + Entry.block[b] = d; + }; +})(Entry.BlockDriver.prototype); +Entry.BlockMockup = function(a, b, c) { + this.templates = []; + this.params = []; + this.statements = []; + this.color = ""; + this.output = this.isNext = this.isPrev = !1; + this.fieldCount = 0; + this.events = {}; + this.def = b || {}; + this.paramsKeyMap = {}; + this.statementsKeyMap = {}; + this.definition = {params:[], type:this.def.type}; + this.simulate(a); + this.def = this.definition; +}; +(function(a) { + a.simulate = function(b) { + b.sensorList && (this.sensorList = b.sensorList); + b.portList && (this.portList = b.portList); + b.init.call(this); + b.whenAdd && (this.events.blockViewAdd || (this.events.blockViewAdd = []), this.events.blockViewAdd.push(b.whenAdd)); + b.whenRemove && (this.events.blockViewDestroy || (this.events.blockViewDestroy = []), this.events.blockViewDestroy.push(b.whenRemove)); + }; + a.toJSON = function() { + function b(a) { + if (a && (a = a.params)) { + for (var c = 0;c < a.length;c++) { + var d = a[c]; + d && (delete d.index, b(d)); + } + } + } + var a = ""; + this.output ? a = "Boolean" === this.output ? "basic_boolean_field" : "basic_string_field" : !this.isPrev && this.isNext ? a = "basic_event" : 1 == this.statements.length ? a = "basic_loop" : 2 == this.statements.length ? a = "basic_double_loop" : this.isPrev && this.isNext ? a = "basic" : this.isPrev && !this.isNext && (a = "basic_without_next"); + b(this.def); + var d = /dummy_/mi, e; + for (e in this.paramsKeyMap) { + d.test(e) && delete this.paramsKeyMap[e]; + } + for (e in this.statementsKeyMap) { + d.test(e) && delete this.statementsKeyMap[e]; + } + return {color:this.color, skeleton:a, statements:this.statements, template:this.templates.filter(function(b) { + return "string" === typeof b; + }).join(" "), params:this.params, events:this.events, def:this.def, paramsKeyMap:this.paramsKeyMap, statementsKeyMap:this.statementsKeyMap}; + }; + a.appendDummyInput = function() { + return this; + }; + a.appendValueInput = function(b) { + this.def && this.def.index && (void 0 !== this.def.index[b] ? this.definition.params.push(this.def.params[this.def.index[b]]) : this.definition.params.push(null)); + this.params.push({type:"Block", accept:"string"}); + this._addToParamsKeyMap(b); + this.templates.push(this.getFieldCount()); + return this; + }; + a.appendStatementInput = function(b) { + this._addToStatementsKeyMap(b); + this.statements.push({accept:"basic"}); + }; + a.setCheck = function(b) { + var a = this.params; + "Boolean" === b && (a[a.length - 1].accept = "boolean"); + }; + a.appendField = function(b, a) { + if (!b) { + return this; + } + "string" === typeof b && 0 < b.length ? a ? (b = {type:"Text", text:b, color:a}, this.params.push(b), this._addToParamsKeyMap(), this.templates.push(this.getFieldCount()), this.def && this.def.index && void 0 !== this.def.index[a] ? this.definition.params.push(this.def.params[this.def.index[a]]) : this.definition.params.push(void 0)) : this.templates.push(b) : b.constructor == Blockly.FieldIcon ? ("start" === b.type ? this.params.push({type:"Indicator", img:b.src_, size:17, position:{x:0, y:-2}}) : + this.params.push({type:"Indicator", img:b.src_, size:12}), this._addToParamsKeyMap(), this.templates.push(this.getFieldCount()), this.definition && this.definition.params.push(null)) : b.constructor == Blockly.FieldDropdown ? (this.params.push({type:"Dropdown", options:b.menuGenerator_, value:b.menuGenerator_[0][1], fontSize:11}), this._addToParamsKeyMap(a), this.templates.push(this.getFieldCount()), this.def && this.def.index && void 0 !== this.def.index[a] ? this.definition.params.push(this.def.params[this.def.index[a]]) : + this.definition.params.push(void 0)) : b.constructor == Blockly.FieldDropdownDynamic ? (this.params.push({type:"DropdownDynamic", value:null, menuName:b.menuName_, fontSize:11}), this.templates.push(this.getFieldCount()), this.def && this.def.index && void 0 !== this.def.index[a] ? this.definition.params.push(this.def.params[this.def.index[a]]) : this.definition.params.push(void 0), this._addToParamsKeyMap(a)) : b.constructor == Blockly.FieldTextInput ? (this.params.push({type:"TextInput", value:10}), + this.templates.push(this.getFieldCount()), this._addToParamsKeyMap(a)) : b.constructor == Blockly.FieldAngle ? (this.params.push({type:"Angle"}), this.templates.push(this.getFieldCount()), this.def && this.def.index && void 0 !== this.def.index[a] ? this.definition.params.push(this.def.params[this.def.index[a]]) : this.definition.params.push(null), this._addToParamsKeyMap(a)) : b.constructor == Blockly.FieldKeydownInput ? (this.params.push({type:"Keyboard", value:81}), this.templates.push(this.getFieldCount()), + void 0 !== this.def.index[a] ? this.definition.params.push(this.def.params[this.def.index[a]]) : this.definition.params.push(void 0), this._addToParamsKeyMap(a)) : b.constructor == Blockly.FieldColour ? (this.params.push({type:"Color"}), this.templates.push(this.getFieldCount()), this._addToParamsKeyMap(a)) : console.log("else", b); + return this; + }; + a.setColour = function(b) { + this.color = b; + }; + a.setInputsInline = function() { + }; + a.setOutput = function(b, a) { + b && (this.output = a); + }; + a.setPreviousStatement = function(b) { + this.isPrev = b; + }; + a.setNextStatement = function(b) { + this.isNext = b; + }; + a.setEditable = function(b) { + }; + a.getFieldCount = function() { + this.fieldCount++; + return "%" + this.fieldCount; + }; + a._addToParamsKeyMap = function(b) { + b = b ? b : "dummy_" + Entry.Utils.generateId(); + var a = this.paramsKeyMap; + a[b] = Object.keys(a).length; + }; + a._addToStatementsKeyMap = function(b) { + b = b ? b : "dummy_" + Entry.Utils.generateId(); + var a = this.statementsKeyMap; + a[b] = Object.keys(a).length; + }; +})(Entry.BlockMockup.prototype); +Entry.Playground = function() { + this.enableArduino = this.isTextBGMode_ = !1; + this.viewMode_ = "default"; + Entry.addEventListener("textEdited", this.injectText); + Entry.addEventListener("hwChanged", this.updateHW); +}; +Entry.Playground.prototype.generateView = function(a, b) { + this.view_ = a; + this.view_.addClass("entryPlayground"); + b && "workspace" != b ? "phone" == b && (this.view_.addClass("entryPlaygroundPhone"), a = Entry.createElement("div", "entryCategoryTab"), a.addClass("entryPlaygroundTabPhone"), Entry.view_.insertBefore(a, this.view_), this.generateTabView(a), this.tabView_ = a, a = Entry.createElement("div", "entryCurtain"), a.addClass("entryPlaygroundCurtainPhone"), a.addClass("entryRemove"), a.innerHTML = Lang.Workspace.cannot_edit_click_to_stop, a.bindOnClick(function() { + Entry.engine.toggleStop(); + }), this.view_.appendChild(a), this.curtainView_ = a, Entry.pictureEditable && (a = Entry.createElement("div", "entryPicture"), a.addClass("entryPlaygroundPicturePhone"), a.addClass("entryRemove"), this.view_.appendChild(a), this.generatePictureView(a), this.pictureView_ = a), a = Entry.createElement("div", "entryText"), a.addClass("entryRemove"), this.view_.appendChild(a), this.generateTextView(a), this.textView_ = a, Entry.soundEditable && (a = Entry.createElement("div", "entrySound"), a.addClass("entryPlaygroundSoundWorkspacePhone"), + a.addClass("entryRemove"), this.view_.appendChild(a), this.generateSoundView(a), this.soundView_ = a), a = Entry.createElement("div", "entryDefault"), this.view_.appendChild(a), this.generateDefaultView(a), this.defaultView_ = a, a = Entry.createElement("div", "entryCode"), a.addClass("entryPlaygroundCodePhone"), this.view_.appendChild(a), this.generateCodeView(a), this.codeView_ = this.codeView_ = a, Entry.addEventListener("run", function(b) { + Entry.playground.curtainView_.removeClass("entryRemove"); + }), Entry.addEventListener("stop", function(b) { + Entry.playground.curtainView_.addClass("entryRemove"); + })) : (this.view_.addClass("entryPlaygroundWorkspace"), a = Entry.createElement("div", "entryCategoryTab"), a.addClass("entryPlaygroundTabWorkspace"), this.view_.appendChild(a), this.generateTabView(a), this.tabView_ = a, a = Entry.createElement("div", "entryCurtain"), a.addClass("entryPlaygroundCurtainWorkspace"), a.addClass("entryRemove"), b = Lang.Workspace.cannot_edit_click_to_stop.split("."), a.innerHTML = b[0] + ".
" + b[1], a.addEventListener("click", function() { + Entry.engine.toggleStop(); + }), this.view_.appendChild(a), this.curtainView_ = a, Entry.pictureEditable && (a = Entry.createElement("div", "entryPicture"), a.addClass("entryPlaygroundPictureWorkspace"), a.addClass("entryRemove"), this.view_.appendChild(a), this.generatePictureView(a), this.pictureView_ = a), a = Entry.createElement("div", "entryText"), a.addClass("entryPlaygroundTextWorkspace"), a.addClass("entryRemove"), this.view_.appendChild(a), this.generateTextView(a), this.textView_ = a, Entry.soundEditable && (a = + Entry.createElement("div", "entrySound"), a.addClass("entryPlaygroundSoundWorkspace"), a.addClass("entryRemove"), this.view_.appendChild(a), this.generateSoundView(a), this.soundView_ = a), a = Entry.createElement("div", "entryDefault"), a.addClass("entryPlaygroundDefaultWorkspace"), this.view_.appendChild(a), this.generateDefaultView(a), this.defaultView_ = a, a = Entry.createElement("div", "entryCode"), a.addClass("entryPlaygroundCodeWorkspace"), a.addClass("entryRemove"), this.view_.appendChild(a), + this.generateCodeView(a), this.codeView_ = a, b = Entry.createElement("div"), b.addClass("entryPlaygroundResizeWorkspace", "entryRemove"), this.resizeHandle_ = b, this.view_.appendChild(b), this.initializeResizeHandle(b), this.codeView_ = a, Entry.addEventListener("run", function(b) { + Entry.playground.curtainView_.removeClass("entryRemove"); + }), Entry.addEventListener("stop", function(b) { + Entry.playground.curtainView_.addClass("entryRemove"); + })); +}; +Entry.Playground.prototype.generateDefaultView = function(a) { + return a; +}; +Entry.Playground.prototype.generateTabView = function(a) { + var b = this, c = Entry.createElement("ul"); + c.addClass("entryTabListWorkspace"); + this.tabList_ = c; a.appendChild(c); - a = Entry.createElement("span"); - a.addClass("entryVariableAddSpaceCancelWorkspace"); - a.addClass("entryVariableAddSpaceButtonWorkspace"); - a.innerHTML = Lang.Buttons.cancel; - a.bindOnClick(function(a) { - b.variableAddPanel.view.addClass("entryRemove"); - b.resetVariableAddPanel("variable"); - }); + this.tabViewElements = {}; + a = Entry.createElement("li", "entryCodeTab"); + a.innerHTML = Lang.Workspace.tab_code; + a.addClass("entryTabListItemWorkspace"); + a.addClass("entryTabSelected"); c.appendChild(a); - a = Entry.createElement("span"); - a.addClass("entryVariableAddSpaceConfirmWorkspace"); - a.addClass("entryVariableAddSpaceButtonWorkspace"); - a.innerHTML = Lang.Buttons.save; - a.variableContainer = this; a.bindOnClick(function(a) { - Entry.variableContainer.addVariable(); - b.updateSelectedVariable(b.variables_[0]); - a = b.variables_[0].listElement; - a.editButton.addClass("entryRemove"); - a.editSaveButton.removeClass("entryRemove"); - a.nameField.removeAttribute("disabled"); + b.changeViewMode("code"); + b.blockMenu.reDraw(); }); - c.appendChild(a); + this.tabViewElements.code = a; + Entry.pictureEditable && (a = Entry.createElement("li", "entryPictureTab"), a.innerHTML = Lang.Workspace.tab_picture, a.addClass("entryTabListItemWorkspace"), c.appendChild(a), a.bindOnClick(function(b) { + Entry.playground.changeViewMode("picture"); + }), this.tabViewElements.picture = a, a = Entry.createElement("li", "entryTextboxTab"), a.innerHTML = Lang.Workspace.tab_text, a.addClass("entryTabListItemWorkspace"), c.appendChild(a), a.bindOnClick(function(b) { + Entry.playground.changeViewMode("text"); + }), this.tabViewElements.text = a, a.addClass("entryRemove")); + Entry.soundEditable && (a = Entry.createElement("li", "entrySoundTab"), a.innerHTML = Lang.Workspace.tab_sound, a.addClass("entryTabListItemWorkspace"), c.appendChild(a), a.bindOnClick(function(b) { + Entry.playground.changeViewMode("sound"); + }), this.tabViewElements.sound = a); + Entry.hasVariableManager && (a = Entry.createElement("li", "entryVariableTab"), a.innerHTML = Lang.Workspace.tab_attribute, a.addClass("entryTabListItemWorkspace"), a.addClass("entryVariableTabWorkspace"), c.appendChild(a), a.bindOnClick(function(b) { + Entry.playground.toggleOnVariableView(); + Entry.playground.changeViewMode("variable"); + }), this.tabViewElements.variable = a); }; -Entry.VariableContainer.prototype.generateListAddView = function() { - var b = this, a = Entry.createElement("li"); - this.listAddPanel.view = a; - this.listAddPanel.isOpen = !1; - a.addClass("entryVariableAddSpaceWorkspace"); - a.addClass("entryRemove"); +Entry.Playground.prototype.generateCodeView = function(a) { + var b = this.createVariableView(); + a.appendChild(b); + this.variableView_ = b; + a = Entry.Dom(a); + b = Entry.Dom("div", {parent:a, id:"entryWorkspaceBoard", class:"entryWorkspaceBoard"}); + a = Entry.Dom("div", {parent:a, id:"entryWorkspaceBlockMenu", class:"entryWorkspaceBlockMenu"}); + this.mainWorkspace = new Entry.Workspace({blockMenu:{dom:a, align:"LEFT", categoryData:EntryStatic.getAllBlocks(), scroll:!0}, board:{dom:b}}); + this.blockMenu = this.mainWorkspace.blockMenu; + this.board = this.mainWorkspace.board; + Entry.hw && this.updateHW(); +}; +Entry.Playground.prototype.generatePictureView = function(a) { + if ("workspace" == Entry.type) { + var b = Entry.createElement("div", "entryAddPicture"); + b.addClass("entryPlaygroundAddPicture"); + b.bindOnClick(function(b) { + Entry.dispatchEvent("openPictureManager"); + }); + var c = Entry.createElement("div", "entryAddPictureInner"); + c.addClass("entryPlaygroundAddPictureInner"); + c.innerHTML = Lang.Workspace.picture_add; + b.appendChild(c); + a.appendChild(b); + b = Entry.createElement("ul", "entryPictureList"); + b.addClass("entryPlaygroundPictureList"); + $ && $(b).sortable({start:function(b, a) { + a.item.data("start_pos", a.item.index()); + }, stop:function(b, a) { + b = a.item.data("start_pos"); + a = a.item.index(); + Entry.playground.movePicture(b, a); + }, axis:"y"}); + a.appendChild(b); + this.pictureListView_ = b; + b = Entry.createElement("div", "entryPainter"); + b.addClass("entryPlaygroundPainter"); + a.appendChild(b); + this.painter = new Entry.Painter; + this.painter.initialize(b); + } else { + "phone" == Entry.type && (b = Entry.createElement("div", "entryAddPicture"), b.addClass("entryPlaygroundAddPicturePhone"), b.bindOnClick(function(b) { + Entry.dispatchEvent("openPictureManager"); + }), c = Entry.createElement("div", "entryAddPictureInner"), c.addClass("entryPlaygroundAddPictureInnerPhone"), c.innerHTML = Lang.Workspace.picture_add, b.appendChild(c), a.appendChild(b), b = Entry.createElement("ul", "entryPictureList"), b.addClass("entryPlaygroundPictureListPhone"), $ && $(b).sortable({start:function(b, a) { + a.item.data("start_pos", a.item.index()); + }, stop:function(b, a) { + b = a.item.data("start_pos"); + a = a.item.index(); + Entry.playground.movePicture(b, a); + }, axis:"y"}), a.appendChild(b), this.pictureListView_ = b); + } +}; +Entry.Playground.prototype.generateTextView = function(a) { + var b = Entry.createElement("div"); + a.appendChild(b); + a = Entry.createElement("div"); + a.addClass("textProperties"); + b.appendChild(a); var c = Entry.createElement("div"); - c.addClass("entryVariableAddSpaceNameWrapperWorkspace"); - c.addClass("entryListAddSpaceNameWrapperWorkspace"); + c.addClass("entryTextFontSelect"); a.appendChild(c); - var d = Entry.createElement("input"); - d.addClass("entryVariableAddSpaceInputWorkspace"); - d.setAttribute("placeholder", Lang.Workspace.list_name); - this.listAddPanel.view.name = d; - d.variableContainer = this; - d.onkeypress = function(a) { - 13 == a.keyCode && (b.addList(), a = b.lists_[0], b.updateSelectedVariable(a), a = a.listElement, a.editButton.addClass("entryRemove"), a.editSaveButton.removeClass("entryRemove"), a.nameField.removeAttribute("disabled")); + var d = Entry.createElement("select", "entryPainterAttrFontName"); + d.addClass("entryPlaygroundPainterAttrFontName", "entryTextFontSelecter"); + d.size = "1"; + d.onchange = function(b) { + Entry.playground.object.entity.setFontType(b.target.value); }; + for (var e = 0;e < Entry.fonts.length;e++) { + var f = Entry.fonts[e], g = Entry.createElement("option"); + g.value = f.family; + g.innerHTML = f.name; + d.appendChild(g); + } + this.fontName_ = d; c.appendChild(d); - c = Entry.createElement("div"); - c.addClass("entryVariableAddSpaceGlobalWrapperWorkspace"); - c.bindOnClick(function(a) { - b.listAddPanel.info.object = null; - b.updateVariableAddView("list"); + e = Entry.createElement("ul"); + e.addClass("entryPlayground_text_buttons"); + a.appendChild(e); + c = Entry.createElement("li"); + c.addClass("entryPlaygroundTextAlignLeft"); + c.bindOnClick(function(b) { + Entry.playground.setFontAlign(Entry.TEXT_ALIGN_LEFT); }); - a.appendChild(c); - d = Entry.createElement("span"); - d.innerHTML = Lang.Workspace.use_all_objects; - c.appendChild(d); - d = Entry.createElement("span"); - d.addClass("entryVariableAddSpaceCheckWorkspace"); - this.listAddPanel.view.globalCheck = d; - this.listAddPanel.info.object || d.addClass("entryVariableAddChecked"); + e.appendChild(c); + this.alignLeftBtn = c; + c = Entry.createElement("li"); + c.addClass("entryPlaygroundTextAlignCenter"); + c.bindOnClick(function(b) { + Entry.playground.setFontAlign(Entry.TEXT_ALIGN_CENTER); + }); + e.appendChild(c); + this.alignCenterBtn = c; + c = Entry.createElement("li"); + c.addClass("entryPlaygroundTextAlignRight"); + c.bindOnClick(function(b) { + Entry.playground.setFontAlign(Entry.TEXT_ALIGN_RIGHT); + }); + e.appendChild(c); + this.alignRightBtn = c; + c = Entry.createElement("li"); + e.appendChild(c); + d = Entry.createElement("a"); c.appendChild(d); - c = Entry.createElement("div"); - c.addClass("entryVariableAddSpaceLocalWrapperWorkspace"); - c.bindOnClick(function(a) { - Entry.playground.object && (a = b.listAddPanel.info, a.object = Entry.playground.object.id, a.isCloud = !1, b.updateVariableAddView("list")); + d.bindOnClick(function() { + Entry.playground.object.entity.toggleFontBold() ? h.src = Entry.mediaFilePath + "text_button_bold_true.png" : h.src = Entry.mediaFilePath + "text_button_bold_false.png"; }); - a.appendChild(c); - d = Entry.createElement("span"); - d.innerHTML = Lang.Workspace.Variable_use_this_object; + var h = Entry.createElement("img", "entryPlaygroundText_boldImage"); + d.appendChild(h); + h.src = Entry.mediaFilePath + "text_button_bold_false.png"; + c = Entry.createElement("li"); + e.appendChild(c); + d = Entry.createElement("a"); c.appendChild(d); - d = Entry.createElement("span"); - d.addClass("entryVariableAddSpaceCheckWorkspace"); - this.listAddPanel.view.localCheck = d; - this.variableAddPanel.info.object && addVariableLocalCheck.addClass("entryVariableAddChecked"); + d.bindOnClick(function() { + var b = !Entry.playground.object.entity.getUnderLine() || !1; + k.src = Entry.mediaFilePath + "text_button_underline_" + b + ".png"; + Entry.playground.object.entity.setUnderLine(b); + }); + var k = Entry.createElement("img", "entryPlaygroundText_underlineImage"); + d.appendChild(k); + k.src = Entry.mediaFilePath + "text_button_underline_false.png"; + c = Entry.createElement("li"); + e.appendChild(c); + d = Entry.createElement("a"); c.appendChild(d); - c = Entry.createElement("div"); - a.cloudWrapper = c; - c.addClass("entryVariableAddSpaceCloudWrapperWorkspace"); - c.bindOnClick(function(a) { - a = b.listAddPanel.info; - a.object || (a.isCloud = !a.isCloud, b.updateVariableAddView("list")); + d.bindOnClick(function() { + Entry.playground.object.entity.toggleFontItalic() ? l.src = Entry.mediaFilePath + "text_button_italic_true.png" : l.src = Entry.mediaFilePath + "/text_button_italic_false.png"; }); - a.appendChild(c); - d = Entry.createElement("span"); - d.addClass("entryVariableAddSpaceCloudSpanWorkspace"); - d.innerHTML = Lang.Workspace.List_create_cloud; + var l = Entry.createElement("img", "entryPlaygroundText_italicImage"); + d.appendChild(l); + l.src = Entry.mediaFilePath + "text_button_italic_false.png"; + c = Entry.createElement("li"); + e.appendChild(c); + d = Entry.createElement("a"); c.appendChild(d); - d = Entry.createElement("span"); - this.listAddPanel.view.cloudCheck = d; - d.addClass("entryVariableAddSpaceCheckWorkspace"); - d.addClass("entryVariableAddSpaceCloudCheckWorkspace"); - this.listAddPanel.info.isCloud && d.addClass("entryVariableAddChecked"); + d.bindOnClick(function() { + var b = !Entry.playground.object.entity.getStrike() || !1; + Entry.playground.object.entity.setStrike(b); + n.src = Entry.mediaFilePath + "text_button_strike_" + b + ".png"; + }); + var n = Entry.createElement("img", "entryPlaygroundText_strikeImage"); + d.appendChild(n); + n.src = Entry.mediaFilePath + "text_button_strike_false.png"; + d = Entry.createElement("li"); + e.appendChild(d); + c = Entry.createElement("a"); + d.appendChild(c); + c.bindOnClick(function() { + Entry.playground.toggleColourChooser("foreground"); + }); + d = Entry.createElement("img"); c.appendChild(d); + d.src = Entry.mediaFilePath + "text_button_color_false.png"; + c = Entry.createElement("li"); + e.appendChild(c); + e = Entry.createElement("a"); + c.appendChild(e); + e.bindOnClick(function() { + Entry.playground.toggleColourChooser("background"); + }); + c = Entry.createElement("img"); + e.appendChild(c); + c.src = Entry.mediaFilePath + "text_button_background_false.png"; + e = Entry.createElement("div"); + e.addClass("entryPlayground_fgColorDiv"); c = Entry.createElement("div"); - c.addClass("entryVariableAddSpaceButtonWrapperWorkspace"); + c.addClass("entryPlayground_bgColorDiv"); + a.appendChild(e); a.appendChild(c); - a = Entry.createElement("span"); - a.addClass("entryVariableAddSpaceCancelWorkspace"); - a.addClass("entryVariableAddSpaceButtonWorkspace"); - a.innerHTML = Lang.Buttons.cancel; - a.bindOnClick(function(a) { - b.listAddPanel.view.addClass("entryRemove"); - b.resetVariableAddPanel("list"); + d = Entry.createElement("div"); + d.addClass("entryPlaygroundTextColoursWrapper"); + this.coloursWrapper = d; + b.appendChild(d); + a = Entry.getColourCodes(); + for (e = 0;e < a.length;e++) { + c = Entry.createElement("div"), c.addClass("modal_colour"), c.setAttribute("colour", a[e]), c.style.backgroundColor = a[e], 0 === e && c.addClass("modalColourTrans"), c.bindOnClick(function(b) { + Entry.playground.setTextColour(b.target.getAttribute("colour")); + }), d.appendChild(c); + } + d.style.display = "none"; + d = Entry.createElement("div"); + d.addClass("entryPlaygroundTextBackgroundsWrapper"); + this.backgroundsWrapper = d; + b.appendChild(d); + for (e = 0;e < a.length;e++) { + c = Entry.createElement("div"), c.addClass("modal_colour"), c.setAttribute("colour", a[e]), c.style.backgroundColor = a[e], 0 === e && c.addClass("modalColourTrans"), c.bindOnClick(function(b) { + Entry.playground.setBackgroundColour(b.target.getAttribute("colour")); + }), d.appendChild(c); + } + d.style.display = "none"; + a = Entry.createElement("input"); + a.addClass("entryPlayground_textBox"); + a.onkeyup = function() { + Entry.playground.object.setText(this.value); + Entry.playground.object.entity.setText(this.value); + }; + a.onblur = function() { + Entry.dispatchEvent("textEdited"); + }; + this.textEditInput = a; + b.appendChild(a); + a = Entry.createElement("textarea"); + a.addClass("entryPlayground_textArea"); + a.style.display = "none"; + a.onkeyup = function() { + Entry.playground.object.setText(this.value); + Entry.playground.object.entity.setText(this.value); + }; + a.onblur = function() { + Entry.dispatchEvent("textEdited"); + }; + this.textEditArea = a; + b.appendChild(a); + a = Entry.createElement("div"); + a.addClass("entryPlaygroundFontSizeWrapper"); + b.appendChild(a); + this.fontSizeWrapper = a; + var m = Entry.createElement("div"); + m.addClass("entryPlaygroundFontSizeSlider"); + a.appendChild(m); + var q = Entry.createElement("div"); + q.addClass("entryPlaygroundFontSizeIndicator"); + m.appendChild(q); + this.fontSizeIndiciator = q; + var r = Entry.createElement("div"); + r.addClass("entryPlaygroundFontSizeKnob"); + m.appendChild(r); + this.fontSizeKnob = r; + e = Entry.createElement("div"); + e.addClass("entryPlaygroundFontSizeLabel"); + e.innerHTML = "\uae00\uc790 \ud06c\uae30"; + a.appendChild(e); + var u = !1, t = 0; + r.onmousedown = function(b) { + u = !0; + t = $(m).offset().left; + }; + r.addEventListener("touchstart", function(b) { + u = !0; + t = $(m).offset().left; }); - c.appendChild(a); - a = Entry.createElement("span"); - a.addClass("entryVariableAddSpaceConfirmWorkspace"); - a.addClass("entryVariableAddSpaceButtonWorkspace"); - a.innerHTML = Lang.Buttons.save; - a.variableContainer = this; - a.bindOnClick(function(a) { - b.addList(); - a = b.lists_[0]; - b.updateSelectedVariable(a); - a = a.listElement; - a.editButton.addClass("entryRemove"); - a.editSaveButton.removeClass("entryRemove"); - a.nameField.removeAttribute("disabled"); + document.addEventListener("mousemove", function(b) { + u && (b = b.pageX - t, b = Math.max(b, 5), b = Math.min(b, 88), r.style.left = b + "px", b /= .88, q.style.width = b + "%", Entry.playground.object.entity.setFontSize(b)); }); - c.appendChild(a); + document.addEventListener("touchmove", function(b) { + u && (b = b.touches[0].pageX - t, b = Math.max(b, 5), b = Math.min(b, 88), r.style.left = b + "px", b /= .88, q.style.width = b + "%", Entry.playground.object.entity.setFontSize(b)); + }); + document.addEventListener("mouseup", function(b) { + u = !1; + }); + document.addEventListener("touchend", function(b) { + u = !1; + }); + a = Entry.createElement("div"); + a.addClass("entryPlaygroundLinebreakWrapper"); + b.appendChild(a); + b = Entry.createElement("hr"); + b.addClass("entryPlaygroundLinebreakHorizontal"); + a.appendChild(b); + b = Entry.createElement("div"); + b.addClass("entryPlaygroundLinebreakButtons"); + a.appendChild(b); + e = Entry.createElement("img"); + e.bindOnClick(function() { + Entry.playground.toggleLineBreak(!1); + v.innerHTML = Lang.Menus.linebreak_off_desc_1; + x.innerHTML = Lang.Menus.linebreak_off_desc_2; + y.innerHTML = Lang.Menus.linebreak_off_desc_3; + }); + e.src = Entry.mediaFilePath + "text-linebreak-off-true.png"; + b.appendChild(e); + this.linebreakOffImage = e; + e = Entry.createElement("img"); + e.bindOnClick(function() { + Entry.playground.toggleLineBreak(!0); + v.innerHTML = Lang.Menus.linebreak_on_desc_1; + x.innerHTML = Lang.Menus.linebreak_on_desc_2; + y.innerHTML = Lang.Menus.linebreak_on_desc_3; + }); + e.src = Entry.mediaFilePath + "text-linebreak-on-false.png"; + b.appendChild(e); + this.linebreakOnImage = e; + b = Entry.createElement("div"); + b.addClass("entryPlaygroundLinebreakDescription"); + a.appendChild(b); + var v = Entry.createElement("p"); + v.innerHTML = Lang.Menus.linebreak_off_desc_1; + b.appendChild(v); + a = Entry.createElement("ul"); + b.appendChild(a); + var x = Entry.createElement("li"); + x.innerHTML = Lang.Menus.linebreak_off_desc_2; + a.appendChild(x); + var y = Entry.createElement("li"); + y.innerHTML = Lang.Menus.linebreak_off_desc_3; + a.appendChild(y); }; -Entry.VariableContainer.prototype.generateVariableSplitterView = function() { - var b = Entry.createElement("li"); - b.addClass("entryVariableSplitterWorkspace"); - var a = Entry.createElement("li"); - a.addClass("entryVariableSplitterWorkspace"); - this.variableSplitters = {top:b, bottom:a}; +Entry.Playground.prototype.generateSoundView = function(a) { + if ("workspace" == Entry.type) { + var b = Entry.createElement("div", "entryAddSound"); + b.addClass("entryPlaygroundAddSound"); + b.bindOnClick(function(b) { + Entry.dispatchEvent("openSoundManager"); + }); + var c = Entry.createElement("div", "entryAddSoundInner"); + c.addClass("entryPlaygroundAddSoundInner"); + c.innerHTML = Lang.Workspace.sound_add; + b.appendChild(c); + a.appendChild(b); + b = Entry.createElement("ul", "entrySoundList"); + b.addClass("entryPlaygroundSoundList"); + $ && $(b).sortable({start:function(b, a) { + a.item.data("start_pos", a.item.index()); + }, stop:function(b, a) { + b = a.item.data("start_pos"); + a = a.item.index(); + Entry.playground.moveSound(b, a); + }, axis:"y"}); + a.appendChild(b); + this.soundListView_ = b; + } else { + "phone" == Entry.type && (b = Entry.createElement("div", "entryAddSound"), b.addClass("entryPlaygroundAddSoundPhone"), b.bindOnClick(function(b) { + Entry.dispatchEvent("openSoundManager"); + }), c = Entry.createElement("div", "entryAddSoundInner"), c.addClass("entryPlaygroundAddSoundInnerPhone"), c.innerHTML = Lang.Workspace.sound_add, b.appendChild(c), a.appendChild(b), b = Entry.createElement("ul", "entrySoundList"), b.addClass("entryPlaygroundSoundListPhone"), $ && $(b).sortable({start:function(b, a) { + a.item.data("start_pos", a.item.index()); + }, stop:function(b, a) { + b = a.item.data("start_pos"); + a = a.item.index(); + Entry.playground.moveSound(b, a); + }, axis:"y"}), a.appendChild(b), this.soundListView_ = b); + } }; -Entry.VariableContainer.prototype.openVariableAddPanel = function(b) { - b = b ? b : "variable"; - Entry.playground.toggleOnVariableView(); - Entry.playground.changeViewMode("variable"); - "variable" == b ? this.variableAddPanel.isOpen = !0 : this.listAddPanel.isOpen = !0; - this.selectFilter(b); - this.updateVariableAddView(b); +Entry.Playground.prototype.injectObject = function(a) { + if (!a) { + this.changeViewMode("code"), this.object = null; + } else { + if (a !== this.object) { + this.object && this.object.toggleInformation(!1); + this.object = a; + this.setMenu(a.objectType); + this.injectCode(); + "sprite" == a.objectType && Entry.pictureEditable ? (this.tabViewElements.text && this.tabViewElements.text.addClass("entryRemove"), this.tabViewElements.picture && this.tabViewElements.picture.removeClass("entryRemove")) : "textBox" == a.objectType && (this.tabViewElements.picture && this.tabViewElements.picture.addClass("entryRemove"), this.tabViewElements.text && this.tabViewElements.text.removeClass("entryRemove")); + var b = this.viewMode_; + "default" == b ? this.changeViewMode("code") : "picture" != b && "text" != b || "textBox" != a.objectType ? "text" != b && "picture" != b || "sprite" != a.objectType ? "sound" == b && this.changeViewMode("sound") : this.changeViewMode("picture") : this.changeViewMode("text"); + this.reloadPlayground(); + } + } }; -Entry.VariableContainer.prototype.getMenuXml = function(b) { - for (var a = [], c = 0 !== this.variables_.length, d = 0 !== this.lists_.length, e, f = 0, g;g = b[f];f++) { - var h = g.tagName; - h && "BLOCK" == h.toUpperCase() ? (e = g.getAttribute("bCategory"), !c && "variable" == e || !d && "list" == e || a.push(g)) : !h || "SPLITTER" != h.toUpperCase() && "BTN" != h.toUpperCase() || !c && "variable" == e || (d || "list" != e) && a.push(g); +Entry.Playground.prototype.injectCode = function() { + var a = this.mainWorkspace; + a.changeBoardCode(this.object.script); + a.getBoard().adjustThreadsPosition(); +}; +Entry.Playground.prototype.injectPicture = function() { + var a = this.pictureListView_; + if (a) { + for (;a.hasChildNodes();) { + a.removeChild(a.lastChild); + } + if (this.object) { + for (var b = this.object.pictures, c = 0, d = b.length;c < d;c++) { + var e = b[c].view; + e || console.log(e); + e.orderHolder.innerHTML = c + 1; + a.appendChild(e); + } + this.selectPicture(this.object.selectedPicture); + } else { + Entry.dispatchEvent("pictureClear"); + } } - return a; }; -Entry.VariableContainer.prototype.addCloneLocalVariables = function(b) { - var a = [], c = this; - this.mapVariable(function(b, c) { - if (b.object_ && b.object_ == c.objectId) { - var f = b.toJSON(); - f.originId = f.id; - f.id = Entry.generateHash(); - f.object = c.newObjectId; - delete f.x; - delete f.y; - a.push(f); - c.json.script = c.json.script.replace(new RegExp(f.originId, "g"), f.id); - } - }, b); - a.map(function(a) { - c.addVariable(a); - }); +Entry.Playground.prototype.addPicture = function(a, b) { + a = Entry.cloneSimpleObject(a); + delete a.id; + delete a.view; + a = JSON.parse(JSON.stringify(a)); + a.id = Entry.generateHash(); + a.name = Entry.getOrderedName(a.name, this.object.pictures); + this.generatePictureElement(a); + this.object.addPicture(a); + this.injectPicture(); + this.selectPicture(a); }; -Entry.VariableContainer.prototype.generateTimer = function(b) { - b || (b = {}, b.id = Entry.generateHash(), b.name = Lang.Workspace.Variable_Timer, b.value = 0, b.variableType = "timer", b.visible = !1, b.x = 150, b.y = -70, b = new Entry.Variable(b)); - b.generateView(); - b.tick = null; - Entry.engine.projectTimer = b; - Entry.addEventListener("stop", function() { - Entry.engine.stopProjectTimer(); - }); +Entry.Playground.prototype.setPicture = function(a) { + var b = Entry.container.getPictureElement(a.id, a.objectId), c = $(b); + if (b) { + a.view = b; + b.picture = a; + b = c.find("#t_" + a.id)[0]; + if (a.fileurl) { + b.style.backgroundImage = 'url("' + a.fileurl + '")'; + } else { + var d = a.filename; + b.style.backgroundImage = 'url("' + Entry.defaultPath + "/uploads/" + d.substring(0, 2) + "/" + d.substring(2, 4) + "/thumb/" + d + '.png")'; + } + c.find("#s_" + a.id)[0].innerHTML = a.dimension.width + " X " + a.dimension.height; + } + Entry.container.setPicture(a); }; -Entry.VariableContainer.prototype.generateAnswer = function(b) { - b || (b = new Entry.Variable({id:Entry.generateHash(), name:Lang.Blocks.VARIABLE_get_canvas_input_value, value:0, variableType:"answer", visible:!1, x:150, y:-100})); - b.generateView(); - Entry.container.inputValue = b; +Entry.Playground.prototype.clonePicture = function(a) { + a = Entry.playground.object.getPicture(a); + this.addPicture(a, !0); }; -Entry.VariableContainer.prototype.generateVariableSettingView = function() { - var b = this, a = Entry.createElement("div"); - a.bindOnClick(function(a) { - a.stopPropagation(); - }); - this.variableSettingView = a; - a.addClass("entryVariableSettingWorkspace"); - this.listView_.appendChild(a); - a.addClass("entryRemove"); - var c = Entry.createElement("div"); - c.addClass("entryVariableSettingVisibleWrapperWorkspace"); - c.bindOnClick(function(a) { - a = b.selectedVariable; - var c = b.variableSettingView.visibleCheck; - a.setVisible(!a.isVisible()); - a.isVisible() ? c.addClass("entryVariableSettingChecked") : c.removeClass("entryVariableSettingChecked"); - }); - a.appendChild(c); - var d = Entry.createElement("span"); - d.innerHTML = Lang.Workspace.show_variable; - c.appendChild(d); - d = Entry.createElement("span"); - d.addClass("entryVariableSettingCheckWorkspace"); - a.visibleCheck = d; - c.appendChild(d); - c = Entry.createElement("div"); - c.addClass("entryVariableSettingInitValueWrapperWorkspace"); - a.appendChild(c); - d = Entry.createElement("span"); - d.innerHTML = Lang.Workspace.default_value; - c.appendChild(d); - d = Entry.createElement("input"); - d.addClass("entryVariableSettingInitValueInputWorkspace"); - a.initValueInput = d; - d.value = 0; - d.onkeyup = function(a) { - b.selectedVariable.setValue(this.value); - }; - d.onblur = function(a) { - b.selectedVariable.setValue(this.value); - }; - a.initValueInput = d; - c.appendChild(d); - c = Entry.createElement("div"); - c.addClass("entryVariableSettingSplitterWorkspace"); - a.appendChild(c); - c = Entry.createElement("div"); - c.addClass("entryVariableSettingSlideWrapperWorkspace"); - a.appendChild(c); - d = Entry.createElement("span"); - d.innerHTML = Lang.Workspace.slide; - c.appendChild(d); - d = Entry.createElement("span"); - d.addClass("entryVariableSettingCheckWorkspace"); - a.slideCheck = d; - c.appendChild(d); - c.bindOnClick(function(a) { - var c; - a = b.selectedVariable; - var d = b.variables_, f = a.getType(); - "variable" == f ? (c = a.toJSON(), c.variableType = "slide", c = new Entry.Variable(c), d.splice(d.indexOf(a), 0, c), 0 > c.getValue() && c.setValue(0), 100 < c.getValue() && c.setValue(100), e.removeAttribute("disabled"), g.removeAttribute("disabled")) : "slide" == f && (c = a.toJSON(), c.variableType = "variable", c = new Entry.Variable(c), d.splice(d.indexOf(a), 0, c), e.setAttribute("disabled", "disabled"), g.setAttribute("disabled", "disabled")); - b.createVariableView(c); - b.removeVariable(a); - b.updateSelectedVariable(c); - c.generateView(); - }); - c = Entry.createElement("div"); - a.minMaxWrapper = c; - c.addClass("entryVariableSettingMinMaxWrapperWorkspace"); - a.appendChild(c); - d = Entry.createElement("span"); - d.innerHTML = Lang.Workspace.min_value; - c.appendChild(d); - var e = Entry.createElement("input"); - e.addClass("entryVariableSettingMinValueInputWorkspace"); - d = b.selectedVariable; - e.value = d && "slide" == d.type ? d.minValue_ : 0; - e.onkeypress = function(a) { - 13 === a.keyCode && this.blur(); - }; - e.onblur = function(a) { - isNaN(this.value) || (a = b.selectedVariable, a.setMinValue(this.value), b.updateVariableSettingView(a)); - }; - a.minValueInput = e; - c.appendChild(e); - var f = Entry.createElement("span"); - f.addClass("entryVariableSettingMaxValueSpanWorkspace"); - f.innerHTML = Lang.Workspace.max_value; - c.appendChild(f); - var g = Entry.createElement("input"); - g.addClass("entryVariableSettingMaxValueInputWorkspace"); - g.value = d && "slide" == d.type ? d.maxValue_ : 100; - g.onkeypress = function(a) { - 13 === a.keyCode && this.blur(); - }; - g.onblur = function(a) { - isNaN(this.value) || (a = b.selectedVariable, a.setMaxValue(this.value), b.updateVariableSettingView(a)); - }; - a.maxValueInput = g; - c.appendChild(g); +Entry.Playground.prototype.selectPicture = function(a) { + for (var b = this.object.pictures, c = 0, d = b.length;c < d;c++) { + var e = b[c]; + e.id === a.id ? e.view.addClass("entryPictureSelected") : e.view.removeClass("entryPictureSelected"); + } + var f; + a && a.id && (f = Entry.container.selectPicture(a.id, a.objectId)); + this.object.id === f && Entry.dispatchEvent("pictureSelected", a); }; -Entry.VariableContainer.prototype.updateVariableSettingView = function(b) { - var a = this.variableSettingView, c = a.visibleCheck, d = a.initValueInput, e = a.slideCheck, f = a.minValueInput, g = a.maxValueInput, h = a.minMaxWrapper; - c.removeClass("entryVariableSettingChecked"); - b.isVisible() && c.addClass("entryVariableSettingChecked"); - e.removeClass("entryVariableSettingChecked"); - "slide" == b.getType() ? (e.addClass("entryVariableSettingChecked"), f.removeAttribute("disabled"), g.removeAttribute("disabled"), f.value = b.getMinValue(), g.value = b.getMaxValue(), h.removeClass("entryVariableMinMaxDisabledWorkspace")) : (h.addClass("entryVariableMinMaxDisabledWorkspace"), f.setAttribute("disabled", "disabled"), g.setAttribute("disabled", "disabled")); - d.value = b.getValue(); - b.listElement.appendChild(a); - a.removeClass("entryRemove"); +Entry.Playground.prototype.movePicture = function(a, b) { + this.object.pictures.splice(b, 0, this.object.pictures.splice(a, 1)[0]); + this.injectPicture(); + Entry.stage.sortZorder(); }; -Entry.VariableContainer.prototype.generateListSettingView = function() { - var b = this, a = Entry.createElement("div"); - a.bindOnClick(function(a) { - a.stopPropagation(); - }); - this.listSettingView = a; - a.addClass("entryListSettingWorkspace"); - this.listView_.appendChild(a); - a.addClass("entryRemove"); - var c = Entry.createElement("div"); - c.addClass("entryListSettingVisibleWrapperWorkspace"); - c.bindOnClick(function(a) { - a = b.selectedList; - var c = b.listSettingView.visibleCheck; - a.setVisible(!a.isVisible()); - a.isVisible() ? c.addClass("entryListSettingCheckedWorkspace") : c.removeClass("entryListSettingCheckedWorkspace"); - }); - a.appendChild(c); - var d = Entry.createElement("span"); - d.innerHTML = Lang.Workspace.show_list_workspace; - c.appendChild(d); - d = Entry.createElement("span"); - d.addClass("entryListSettingCheckWorkspace"); - a.visibleCheck = d; - c.appendChild(d); - d = Entry.createElement("div"); - d.addClass("entryListSettingLengthWrapperWorkspace"); - c = Entry.createElement("span"); - c.addClass("entryListSettingLengthSpanWorkspace"); - c.innerHTML = Lang.Workspace.number_of_list; - d.appendChild(c); - a.appendChild(d); - c = Entry.createElement("div"); - c.addClass("entryListSettingLengthControllerWorkspace"); - d.appendChild(c); - d = Entry.createElement("span"); - d.addClass("entryListSettingMinusWorkspace"); - d.bindOnClick(function(a) { - b.selectedList.array_.pop(); - b.updateListSettingView(b.selectedList); - }); - c.appendChild(d); - d = Entry.createElement("input"); - d.addClass("entryListSettingLengthInputWorkspace"); - d.onblur = function() { - b.setListLength(this.value); - }; - d.onkeypress = function(a) { - 13 == a.keyCode && this.blur(); - }; - a.lengthInput = d; - c.appendChild(d); - 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.Playground.prototype.injectText = function() { + if (Entry.playground.object) { + Entry.playground.textEditInput.value = Entry.playground.object.entity.getText(); + Entry.playground.textEditArea.value = Entry.playground.object.entity.getText(); + Entry.playground.fontName_.value = Entry.playground.object.entity.getFontName(); + if (Entry.playground.object.entity.font) { + var a = -1 < Entry.playground.object.entity.font.indexOf("bold") || !1; + $("#entryPlaygroundText_boldImage").attr("src", Entry.mediaFilePath + "text_button_bold_" + a + ".png"); + a = -1 < Entry.playground.object.entity.font.indexOf("italic") || !1; + $("#entryPlaygroundText_italicImage").attr("src", Entry.mediaFilePath + "text_button_italic_" + a + ".png"); + } + a = Entry.playground.object.entity.getUnderLine() || !1; + $("#entryPlaygroundText_underlineImage").attr("src", Entry.mediaFilePath + "text_button_underline_" + a + ".png"); + a = Entry.playground.object.entity.getStrike() || !1; + $("#entryPlaygroundText_strikeImage").attr("src", Entry.mediaFilePath + "text_button_strike_" + a + ".png"); + $(".entryPlayground_fgColorDiv").css("backgroundColor", Entry.playground.object.entity.colour); + $(".entryPlayground_bgColorDiv").css("backgroundColor", Entry.playground.object.entity.bgColour); + Entry.playground.toggleLineBreak(Entry.playground.object.entity.getLineBreak()); + Entry.playground.object.entity.getLineBreak() && ($(".entryPlaygroundLinebreakDescription > p").html(Lang.Menus.linebreak_on_desc_1), $(".entryPlaygroundLinebreakDescription > ul > li").eq(0).html(Lang.Menus.linebreak_on_desc_2), $(".entryPlaygroundLinebreakDescription > ul > li").eq(1).html(Lang.Menus.linebreak_on_desc_3)); + Entry.playground.setFontAlign(Entry.playground.object.entity.getTextAlign()); + a = Entry.playground.object.entity.getFontSize(); + Entry.playground.fontSizeIndiciator.style.width = a + "%"; + Entry.playground.fontSizeKnob.style.left = .88 * a + "px"; + } }; -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); +Entry.Playground.prototype.injectSound = function() { + var a = this.soundListView_; + if (a) { + for (;a.hasChildNodes();) { + a.removeChild(a.lastChild); + } + if (this.object) { + for (var b = this.object.sounds, c = 0, d = b.length;c < d;c++) { + var e = b[c].view; + e.orderHolder.innerHTML = c + 1; + a.appendChild(e); + } + } } - var h = b.array_; - 0 === h.length ? g.addClass("entryRemove") : g.removeClass("entryRemove"); - for (e = 0;e < h.length;e++) { - (function(c) { - var e = Entry.createElement("div"); - e.addClass("entryListSettingValueWrapperWorkspace"); - var f = Entry.createElement("span"); - f.addClass("entryListSettingValueNumberSpanWorkspace"); - f.innerHTML = c + 1; - e.appendChild(f); - f = Entry.createElement("input"); - f.value = h[c].data; - f.onblur = function() { - h[c].data = this.value; - b.updateView(); - }; - f.onkeypress = function(a) { - 13 == a.keyCode && this.blur(); - }; - f.addClass("entryListSettingEachInputWorkspace"); - e.appendChild(f); - f = Entry.createElement("span"); - f.bindOnClick(function() { - h.splice(c, 1); - a.updateListSettingView(); - }); - f.addClass("entryListSettingValueRemoveWorkspace"); - e.appendChild(f); - d.appendChild(e); - })(e); +}; +Entry.Playground.prototype.moveSound = function(a, b) { + this.object.sounds.splice(b, 0, this.object.sounds.splice(a, 1)[0]); + this.updateListViewOrder("sound"); + Entry.stage.sortZorder(); +}; +Entry.Playground.prototype.addSound = function(a, b) { + a = Entry.cloneSimpleObject(a); + delete a.view; + delete a.id; + a = JSON.parse(JSON.stringify(a)); + a.id = Entry.generateHash(); + a.name = Entry.getOrderedName(a.name, this.object.sounds); + this.generateSoundElement(a); + this.object.addSound(a); + this.injectSound(); +}; +Entry.Playground.prototype.changeViewMode = function(a) { + for (var b in this.tabViewElements) { + this.tabViewElements[b].removeClass("entryTabSelected"); + } + "default" != a && this.tabViewElements[a].addClass("entryTabSelected"); + if ("variable" != a) { + var c = this.view_.children; + for (b = 0;b < c.length;b++) { + var d = c[b]; + -1 < d.id.toUpperCase().indexOf(a.toUpperCase()) ? d.removeClass("entryRemove") : d.addClass("entryRemove"); + } + if ("picture" == a && (!this.pictureView_.object || this.pictureView_.object != this.object)) { + this.pictureView_.object = this.object, this.injectPicture(); + } else { + if ("sound" == a && (!this.soundView_.object || this.soundView_.object != this.object)) { + this.soundView_.object = this.object, this.injectSound(); + } else { + if ("text" == a && "textBox" == this.object.objectType || this.textView_.object != this.object) { + this.textView_.object = this.object, this.injectText(); + } + } + } + "code" == a && this.resizeHandle_ && this.resizeHandle_.removeClass("entryRemove"); + Entry.engine.isState("run") && this.curtainView_.removeClass("entryRemove"); + this.viewMode_ = a; + this.toggleOffVariableView(); + } +}; +Entry.Playground.prototype.createVariableView = function() { + var a = Entry.createElement("div"); + Entry.type && "workspace" != Entry.type ? "phone" == Entry.type && a.addClass("entryVariablePanelPhone") : a.addClass("entryVariablePanelWorkspace"); + this.variableViewWrapper_ = a; + Entry.variableContainer.createDom(a); + return a; +}; +Entry.Playground.prototype.toggleOnVariableView = function() { + Entry.playground.changeViewMode("code"); + this.hideBlockMenu(); + Entry.variableContainer.updateList(); + this.variableView_.removeClass("entryRemove"); + this.resizeHandle_.removeClass("entryRemove"); +}; +Entry.Playground.prototype.toggleOffVariableView = function() { + this.showBlockMenu(); + this.variableView_.addClass("entryRemove"); +}; +Entry.Playground.prototype.editBlock = function() { + var a = Entry.playground; + Entry.stateManager && Entry.stateManager.addCommand("edit block", a, a.restoreBlock, a.object, a.object.getScriptText()); +}; +Entry.Playground.prototype.mouseupBlock = function() { + if (Entry.reporter) { + var a = Entry.playground, b = a.object; + Entry.reporter.report(new Entry.State("edit block mouseup", a, a.restoreBlock, b, b.getScriptText())); } - b.updateView(); - c.removeClass("entryRemove"); }; -Entry.VariableContainer.prototype.setListLength = function(b) { - b = Number(b); - var a = this.selectedList.array_; - if (!isNaN(b)) { - var c = a.length; - if (c < b) { - for (b -= c, c = 0;c < b;c++) { - a.push({data:0}); - } - } else { - c > b && (a.length = b); - } +Entry.Playground.prototype.restoreBlock = function(a, b) { + Entry.container.selectObject(a.id); + Entry.stateManager && Entry.stateManager.addCommand("restore block", this, this.restoreBlock, this.object, this.object.getScriptText()); + Blockly.Xml.textToDom(b); +}; +Entry.Playground.prototype.setMenu = function(a) { + if (this.currentObjectType != a) { + var b = this.blockMenu; + b.unbanClass(this.currentObjectType); + b.banClass(a); + b.setMenu(); + b.selectMenu(0, !0); + this.currentObjectType = a; } - this.updateListSettingView(); }; -Entry.VariableContainer.prototype.updateViews = function() { - var b = this.lists_; - this.variables_.map(function(a) { - a.updateView(); +Entry.Playground.prototype.hideTabs = function() { + var a = ["picture", "text", "sound", "variable"], b; + for (b in a) { + this.hideTab([a[b]]); + } +}; +Entry.Playground.prototype.hideTab = function(a) { + this.tabViewElements[a] && (this.tabViewElements[a].addClass("hideTab"), this.tabViewElements[a].removeClass("showTab")); +}; +Entry.Playground.prototype.showTabs = function() { + var a = ["picture", "text", "sound", "variable"], b; + for (b in a) { + this.showTab(a[b]); + } +}; +Entry.Playground.prototype.showTab = function(a) { + this.tabViewElements[a] && (this.tabViewElements[a].addClass("showTab"), this.tabViewElements[a].removeClass("hideTab")); +}; +Entry.Playground.prototype.initializeResizeHandle = function(a) { + $(a).bind("mousedown touchstart", function(b) { + Entry.playground.resizing = !0; + Entry.documentMousemove && (Entry.playground.resizeEvent = Entry.documentMousemove.attach(this, function(b) { + Entry.playground.resizing && Entry.resizeElement({menuWidth:b.clientX - Entry.interfaceState.canvasWidth}); + })); }); - b.map(function(a) { - a.updateView(); + $(document).bind("mouseup touchend", function(b) { + if (b = Entry.playground.resizeEvent) { + Entry.playground.resizing = !1, Entry.documentMousemove.detach(b), delete Entry.playground.resizeEvent; + } }); }; -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.Playground.prototype.reloadPlayground = function() { + var a = this.mainWorkspace; + a && (a.getBlockMenu().reDraw(), this.object && this.object.script.view.reDraw()); }; -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.Playground.prototype.flushPlayground = function() { + this.object = null; + if (Entry.playground && Entry.playground.view_) { + this.injectPicture(); + this.injectSound(); + var a = Entry.playground.mainWorkspace.getBoard(); + a.clear(); + a.changeCode(null); + } }; -Entry.VariableContainer.prototype.updateCloudVariables = function() { - var b = Entry.projectId; - if (Entry.cloudSavable && b) { - var a = Entry.variableContainer, b = a.variables_.filter(function(a) { - return a.isCloud_; - }), b = b.map(function(a) { - return a.toJSON(); - }), a = a.lists_.filter(function(a) { - return a.isCloud_; - }), a = a.map(function(a) { - return a.toJSON(); - }); - $.ajax({url:"/api/project/variable/" + Entry.projectId, type:"PUT", data:{variables:b, lists:a}}).done(function() { - }); +Entry.Playground.prototype.refreshPlayground = function() { + Entry.playground && Entry.playground.view_ && ("picture" === this.getViewMode() && this.injectPicture(), "sound" === this.getViewMode() && this.injectSound()); +}; +Entry.Playground.prototype.updateListViewOrder = function(a) { + a = "picture" == a ? this.pictureListView_.childNodes : this.soundListView_.childNodes; + for (var b = 0, c = a.length;b < c;b++) { + a[b].orderHolder.innerHTML = b + 1; } }; -Entry.VariableContainer.prototype.addRef = function(b, a) { - if (this.view_ && Entry.playground.mainWorkspace && Entry.playground.mainWorkspace.getMode() === Entry.Workspace.MODE_BOARD) { - var c = {object:a.getCode().object, block:a}; - a.funcBlock && (c.funcBlock = a.funcBlock, delete a.funcBlock); - this[b].push(c); - if ("_functionRefs" == b) { - for (var d = a.type.substr(5), e = Entry.variableContainer.functions_[d].content.getBlockList(), f = 0;f < e.length;f++) { - a = e[f]; - var g = a.events; - -1 < a.type.indexOf("func_") && a.type.substr(5) == d || (g && g.viewAdd && g.viewAdd.forEach(function(b) { - a.getCode().object = c.object; - b && (a.funcBlock = c.block, b(a)); - }), g && g.dataAdd && g.dataAdd.forEach(function(b) { - a.getCode().object = c.object; - b && (a.funcBlock = c.block, b(a)); - })); +Entry.Playground.prototype.generatePictureElement = function(a) { + function b() { + if ("" === this.value.trim()) { + Entry.deAttachEventListener(this, "blur", b), alert("\uc774\ub984\uc744 \uc785\ub825\ud558\uc5ec \uc8fc\uc138\uc694."), this.focus(), Entry.attachEventListener(this, "blur", b); + } else { + for (var a = $(".entryPlaygroundPictureName"), c = 0;c < a.length;c++) { + if (a.eq(c).val() == f.value && a[c] != this) { + Entry.deAttachEventListener(this, "blur", b); + alert("\uc774\ub984\uc774 \uc911\ubcf5 \ub418\uc5c8\uc2b5\ub2c8\ub2e4."); + this.focus(); + Entry.attachEventListener(this, "blur", b); + return; + } } + this.picture.name = this.value; + Entry.playground.reloadPlayground(); + Entry.dispatchEvent("pictureNameChanged", this.picture); } - return c; } + var c = Entry.createElement("li", a.id); + a.view = c; + c.addClass("entryPlaygroundPictureElement"); + c.picture = a; + c.bindOnClick(function(b) { + Entry.playground.selectPicture(this.picture); + }); + Entry.Utils.disableContextmenu(a.view); + $(a.view).on("contextmenu", function() { + Entry.ContextMenu.show([{text:Lang.Workspace.context_rename, callback:function() { + f.focus(); + }}, {text:Lang.Workspace.context_duplicate, callback:function() { + Entry.playground.clonePicture(a.id); + }}, {text:Lang.Workspace.context_remove, callback:function() { + Entry.playground.object.removePicture(a.id) ? (Entry.removeElement(c), Entry.toast.success(Lang.Workspace.shape_remove_ok, a.name + " " + Lang.Workspace.shape_remove_ok_msg)) : Entry.toast.alert(Lang.Workspace.shape_remove_fail, Lang.Workspace.shape_remove_fail_msg); + }}, {divider:!0}, {text:Lang.Workspace.context_download, callback:function() { + a.fileurl ? window.open(a.fileurl) : window.open("/api/sprite/download/image/" + encodeURIComponent(a.filename) + "/" + encodeURIComponent(a.name) + ".png"); + }}], "workspace-contextmenu"); + }); + var d = Entry.createElement("div"); + d.addClass("entryPlaygroundPictureOrder"); + c.orderHolder = d; + c.appendChild(d); + d = Entry.createElement("div", "t_" + a.id); + d.addClass("entryPlaygroundPictureThumbnail"); + if (a.fileurl) { + d.style.backgroundImage = 'url("' + a.fileurl + '")'; + } else { + var e = a.filename; + d.style.backgroundImage = 'url("' + Entry.defaultPath + "/uploads/" + e.substring(0, 2) + "/" + e.substring(2, 4) + "/thumb/" + e + '.png")'; + } + c.appendChild(d); + var f = Entry.createElement("input"); + f.addClass("entryPlaygroundPictureName"); + f.addClass("entryEllipsis"); + f.picture = a; + f.value = a.name; + Entry.attachEventListener(f, "blur", b); + f.onkeypress = function(b) { + 13 == b.keyCode && this.blur(); + }; + c.appendChild(f); + d = Entry.createElement("div", "s_" + a.id); + d.addClass("entryPlaygroundPictureSize"); + d.innerHTML = a.dimension.width + " X " + a.dimension.height; + c.appendChild(d); }; -Entry.VariableContainer.prototype.removeRef = function(b, a) { - if (Entry.playground.mainWorkspace && Entry.playground.mainWorkspace.getMode() === Entry.Workspace.MODE_BOARD) { - for (var c = this[b], d = 0;d < c.length;d++) { - if (c[d].block == a) { - c.splice(d, 1); - break; - } - } - if ("_functionRefs" == b && (c = a.type.substr(5), d = Entry.variableContainer.functions_[c])) { - for (var e = d.content.getBlockList(), d = 0;d < e.length;d++) { - a = e[d]; - var f = a.events; - -1 < a.type.indexOf("func_") && a.type.substr(5) == c || (f && f.viewDestroy && f.viewDestroy.forEach(function(b) { - b && b(a); - }), f && f.dataDestroy && f.dataDestroy.forEach(function(b) { - b && b(a); - })); +Entry.Playground.prototype.generateSoundElement = function(a) { + var b = Entry.createElement("sound", a.id); + a.view = b; + b.addClass("entryPlaygroundSoundElement"); + b.sound = a; + Entry.Utils.disableContextmenu(a.view); + $(a.view).on("contextmenu", function() { + Entry.ContextMenu.show([{text:Lang.Workspace.context_rename, callback:function() { + g.focus(); + }}, {text:Lang.Workspace.context_duplicate, callback:function() { + Entry.playground.addSound(a, !0); + }}, {text:Lang.Workspace.context_remove, callback:function() { + Entry.playground.object.removeSound(a.id) ? (Entry.removeElement(b), Entry.toast.success(Lang.Workspace.sound_remove_ok, a.name + " " + Lang.Workspace.sound_remove_ok_msg)) : Entry.toast.alert(Lang.Workspace.sound_remove_fail, ""); + Entry.removeElement(b); + }}], "workspace-contextmenu"); + }); + var c = Entry.createElement("div"); + c.addClass("entryPlaygroundSoundOrder"); + b.orderHolder = c; + b.appendChild(c); + var d = Entry.createElement("div"); + d.addClass("entryPlaygroundSoundThumbnail"); + d.addClass("entryPlaygroundSoundPlay"); + var e = !1, f; + d.addEventListener("click", function() { + e ? (e = !1, d.removeClass("entryPlaygroundSoundStop"), d.addClass("entryPlaygroundSoundPlay"), f.stop()) : (e = !0, d.removeClass("entryPlaygroundSoundPlay"), d.addClass("entryPlaygroundSoundStop"), f = createjs.Sound.play(a.id), f.addEventListener("complete", function(b) { + d.removeClass("entryPlaygroundSoundStop"); + d.addClass("entryPlaygroundSoundPlay"); + e = !1; + }), f.addEventListener("loop", function(b) { + }), f.addEventListener("failed", function(b) { + })); + }); + b.appendChild(d); + var g = Entry.createElement("input"); + g.addClass("entryPlaygroundSoundName"); + g.sound = a; + g.value = a.name; + var h = document.getElementsByClassName("entryPlaygroundSoundName"); + g.onblur = function() { + if ("" === this.value) { + alert("\uc774\ub984\uc744 \uc785\ub825\ud558\uc5ec \uc8fc\uc138\uc694."), this.focus(); + } else { + for (var b = 0, a = 0;a < h.length;a++) { + if (h[a].value == g.value && (b += 1, 1 < b)) { + alert("\uc774\ub984\uc774 \uc911\ubcf5 \ub418\uc5c8\uc2b5\ub2c8\ub2e4."); + this.focus(); + return; + } } + this.sound.name = this.value; + Entry.playground.reloadPlayground(); } - } + }; + g.onkeypress = function(b) { + 13 == b.keyCode && this.blur(); + }; + b.appendChild(g); + c = Entry.createElement("div"); + c.addClass("entryPlaygroundSoundLength"); + c.innerHTML = a.duration + " \ucd08"; + b.appendChild(c); }; -Entry.VariableContainer.prototype._getBlockMenu = function() { - return Entry.playground.mainWorkspace.getBlockMenu(); +Entry.Playground.prototype.toggleColourChooser = function(a) { + "foreground" === a ? "none" === this.coloursWrapper.style.display ? (this.coloursWrapper.style.display = "block", this.backgroundsWrapper.style.display = "none") : this.coloursWrapper.style.display = "none" : "background" === a && ("none" === this.backgroundsWrapper.style.display ? (this.backgroundsWrapper.style.display = "block", this.coloursWrapper.style.display = "none") : this.backgroundsWrapper.style.display = "none"); }; -Entry.VariableContainer.prototype._truncName = function(b, a) { - b = b.substring(0, this._maxNameLength); - Entry.toast.warning(Lang.Workspace[a + "_name_auto_edited_title"], Lang.Workspace[a + "_name_auto_edited_content"]); - return b; +Entry.Playground.prototype.setTextColour = function(a) { + Entry.playground.object.entity.setColour(a); + Entry.playground.toggleColourChooser("foreground"); + $(".entryPlayground_fgColorDiv").css("backgroundColor", a); }; -Entry.VariableContainer.prototype._maxNameLength = 10; -Entry.block.run = {skeleton:"basic", color:"#3BBD70", contents:["this is", "basic block"], func:function() { -}}; -Entry.block.mutant = {skeleton:"basic", event:"start", color:"#3BBD70", template:"test mutant block", params:[], func:function() { -}, changeEvent:new Entry.Event}; -Entry.block.jr_start = {skeleton:"pebble_event", event:"start", color:"#3BBD70", template:"%1", params:[{type:"Indicator", img:"/img/assets/ntry/bitmap/jr/block_play_image.png", highlightColor:"#3BBD70", position:{x:0, y:0}, size:22}], func:function() { - var b = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), a; - for (a in b) { - this._unit = b[a]; - } - Ntry.unitComp = Ntry.entityManager.getComponent(this._unit.id, Ntry.STATIC.UNIT); -}}; -Entry.block.jr_repeat = {skeleton:"pebble_loop", color:"#127CDB", template:"%1 \ubc18\ubcf5", params:[{type:"Text", text:Lang.Menus.repeat_0}, {type:"Dropdown", options:[[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]], value:3, fontSize:14, roundValue:3}, {type:"Text", text:Lang.Menus.repeat_1}], statements:[], func:function() { - if (void 0 === this.repeatCount) { - return this.repeatCount = this.block.params[0], Entry.STATIC.CONTINUE; - } - if (0 < this.repeatCount) { - this.repeatCount--; - var b = this.block.statements[0]; - if (0 !== b.getBlocks().length) { - return this.executor.stepInto(b), Entry.STATIC.CONTINUE; - } - } else { - delete this.repeatCount; - } -}}; -Entry.block.jr_item = {skeleton:"pebble_basic", color:"#F46C6C", template:"\uaf43 \ubaa8\uc73c\uae30 %1", params:[{type:"Indicator", img:"/img/assets/ntry/bitmap/jr/block_item_image.png", highlightColor:"#FFF", position:{x:83, y:0}, size:22}], func:function() { - if (this.isContinue) { - if (this.isAction) { - return Entry.STATIC.CONTINUE; - } - delete this.isAction; - delete this.isContinue; - } else { - this.isAction = this.isContinue = !0; - var b = this; - Ntry.dispatchEvent("unitAction", Ntry.STATIC.GET_ITEM, function() { - Ntry.dispatchEvent("getItem"); - b.isAction = !1; - }); - return Entry.STATIC.CONTINUE; - } -}}; -Entry.block.cparty_jr_item = {skeleton:"pebble_basic", color:"#8ABC1D", template:"%1 %2", params:[{type:"Text", text:Lang.Menus.pick_up_pencil}, {type:"Indicator", img:"/img/assets/ntry/bitmap/cpartyjr/pen.png", highlightColor:"#FFF", position:{x:83, y:0}, size:22}], func:function() { - if (this.isContinue) { - if (this.isAction) { - return Entry.STATIC.CONTINUE; - } - delete this.isAction; - delete this.isContinue; - } else { - this.isAction = this.isContinue = !0; - var b = this; - Ntry.dispatchEvent("unitAction", Ntry.STATIC.GET_ITEM, function() { - Ntry.dispatchEvent("getItem"); - b.isAction = !1; - }); - return Entry.STATIC.CONTINUE; - } -}}; -Entry.block.jr_north = {skeleton:"pebble_basic", color:"#A751E3", template:"%1 %2", params:[{type:"Text", text:Lang.Menus.go_up}, {type:"Indicator", img:"/img/assets/ntry/bitmap/jr/block_up_image.png", position:{x:83, y:0}, size:22}], func:function() { - if (this.isContinue) { - if (this.isAction) { - return Entry.STATIC.CONTINUE; - } - delete this.isAction; - delete this.isContinue; - } else { - this.isAction = this.isContinue = !0; - var b = Ntry.STATIC, a = this, c = function() { - window.setTimeout(function() { - Ntry.dispatchEvent("unitAction", Ntry.STATIC.WALK, function() { - a.isAction = !1; - }); - }, 3); - }, d; - switch(Ntry.unitComp.direction) { - case Ntry.STATIC.EAST: - d = b.TURN_LEFT; - break; - case Ntry.STATIC.SOUTH: - d = b.HALF_ROTATION; - break; - case Ntry.STATIC.WEST: - d = b.TURN_RIGHT; - break; - default: - c(); - } - d && Ntry.dispatchEvent("unitAction", d, c); - return Entry.STATIC.CONTINUE; - } -}}; -Entry.block.jr_east = {skeleton:"pebble_basic", color:"#A751E3", template:"%1 %2", params:[{type:"Text", text:Lang.Menus.go_right}, {type:"Indicator", img:"/img/assets/ntry/bitmap/jr/block_right_image.png", position:{x:83, y:0}, size:22}], func:function() { - var b = Ntry.STATIC; - if (this.isContinue) { - if (this.isAction) { - return Entry.STATIC.CONTINUE; - } - delete this.isAction; - delete this.isContinue; - } else { - this.isAction = this.isContinue = !0; - var a = this, c = function() { - window.setTimeout(function() { - Ntry.dispatchEvent("unitAction", b.WALK, function() { - a.isAction = !1; - }); - }, 3); - }, d; - switch(Ntry.unitComp.direction) { - case b.SOUTH: - d = b.TURN_LEFT; - break; - case b.WEST: - d = b.HALF_ROTATION; - break; - case b.NORTH: - d = b.TURN_RIGHT; - break; - default: - c(); - } - d && Ntry.dispatchEvent("unitAction", d, c); - return Entry.STATIC.CONTINUE; +Entry.Playground.prototype.setBackgroundColour = function(a) { + Entry.playground.object.entity.setBGColour(a); + Entry.playground.toggleColourChooser("background"); + $(".entryPlayground_bgColorDiv").css("backgroundColor", a); +}; +Entry.Playground.prototype.isTextBGMode = function() { + return this.isTextBGMode_; +}; +Entry.Playground.prototype.checkVariables = function() { + Entry.forEBS || (Entry.variableContainer.lists_.length ? this.blockMenu.unbanClass("listNotExist") : this.blockMenu.banClass("listNotExist"), Entry.variableContainer.variables_.length ? this.blockMenu.unbanClass("variableNotExist") : this.blockMenu.banClass("variableNotExist")); +}; +Entry.Playground.prototype.getViewMode = function() { + return this.viewMode_; +}; +Entry.Playground.prototype.updateHW = function() { + var a = Entry.playground.mainWorkspace.blockMenu; + if (a) { + var b = Entry.hw; + b && b.connected ? (a.unbanClass("arduinoConnected", !0), a.banClass("arduinoDisconnected", !0), b.banHW(), b.hwModule && a.unbanClass(b.hwModule.name)) : (a.banClass("arduinoConnected", !0), a.unbanClass("arduinoDisconnected", !0), Entry.hw.banHW()); + a.reDraw(); } -}}; -Entry.block.jr_south = {skeleton:"pebble_basic", color:"#A751E3", template:"%1 %2", params:[{type:"Text", text:Lang.Menus.go_down}, {type:"Indicator", img:"/img/assets/ntry/bitmap/jr/block_down_image.png", position:{x:83, y:0}, size:22}], func:function() { - if (this.isContinue) { - if (this.isAction) { - return Entry.STATIC.CONTINUE; - } - delete this.isAction; - delete this.isContinue; - } else { - this.isAction = this.isContinue = !0; - var b = Ntry.STATIC, a = this, c = function() { - window.setTimeout(function() { - Ntry.dispatchEvent("unitAction", Ntry.STATIC.WALK, function() { - a.isAction = !1; - }); - }, 3); - }, d; - switch(Ntry.unitComp.direction) { - case b.EAST: - d = b.TURN_RIGHT; - break; - case b.NORTH: - d = b.HALF_ROTATION; +}; +Entry.Playground.prototype.toggleLineBreak = function(a) { + this.object && "textBox" == this.object.objectType && (a ? (Entry.playground.object.entity.setLineBreak(!0), $(".entryPlayground_textArea").css("display", "block"), $(".entryPlayground_textBox").css("display", "none"), this.linebreakOffImage.src = Entry.mediaFilePath + "text-linebreak-off-false.png", this.linebreakOnImage.src = Entry.mediaFilePath + "text-linebreak-on-true.png", this.fontSizeWrapper.removeClass("entryHide")) : (Entry.playground.object.entity.setLineBreak(!1), $(".entryPlayground_textArea").css("display", + "none"), $(".entryPlayground_textBox").css("display", "block"), this.linebreakOffImage.src = Entry.mediaFilePath + "text-linebreak-off-true.png", this.linebreakOnImage.src = Entry.mediaFilePath + "text-linebreak-on-false.png", this.fontSizeWrapper.addClass("entryHide"))); +}; +Entry.Playground.prototype.setFontAlign = function(a) { + if ("textBox" == this.object.objectType) { + this.alignLeftBtn.removeClass("toggle"); + this.alignCenterBtn.removeClass("toggle"); + this.alignRightBtn.removeClass("toggle"); + switch(a) { + case Entry.TEXT_ALIGN_LEFT: + this.alignLeftBtn.addClass("toggle"); break; - case b.WEST: - d = b.TURN_LEFT; + case Entry.TEXT_ALIGN_CENTER: + this.alignCenterBtn.addClass("toggle"); break; - default: - c(); + case Entry.TEXT_ALIGN_RIGHT: + this.alignRightBtn.addClass("toggle"); } - d && Ntry.dispatchEvent("unitAction", d, c); - return Entry.STATIC.CONTINUE; + this.object.entity.setTextAlign(a); } -}}; -Entry.block.jr_west = {skeleton:"pebble_basic", color:"#A751E3", template:"%1 %2", params:[{type:"Text", text:Lang.Menus.go_left}, {type:"Indicator", img:"/img/assets/ntry/bitmap/jr/block_left_image.png", position:{x:83, y:0}, size:22}], func:function() { - if (this.isContinue) { - if (this.isAction) { - return Entry.STATIC.CONTINUE; +}; +Entry.Playground.prototype.hideBlockMenu = function() { + this.mainWorkspace.getBlockMenu().hide(); +}; +Entry.Playground.prototype.showBlockMenu = function() { + this.mainWorkspace.getBlockMenu().show(); +}; +Entry.Popup = function() { + Entry.assert(!window.popup, "Popup exist"); + this.body_ = Entry.createElement("div"); + this.body_.addClass("entryPopup"); + this.body_.bindOnClick(function(a) { + a.target == this && this.popup.remove(); + }); + this.body_.popup = this; + document.body.appendChild(this.body_); + this.window_ = Entry.createElement("div"); + this.window_.addClass("entryPopupWindow"); + "tablet" === Entry.device && this.window_.addClass("tablet"); + this.window_.bindOnClick(function() { + }); + Entry.addEventListener("windowResized", this.resize); + window.popup = this; + this.resize(); + this.body_.appendChild(this.window_); +}; +Entry.Popup.prototype.remove = function() { + for (;this.window_.hasChildNodes();) { + "workspace" == Entry.type ? Entry.view_.insertBefore(this.window_.firstChild, Entry.container.view_) : Entry.view_.insertBefore(this.window_.lastChild, Entry.view_.firstChild); + } + $("body").css("overflow", "auto"); + Entry.removeElement(this.body_); + window.popup = null; + Entry.removeEventListener("windowResized", this.resize); + Entry.engine.popup = null; +}; +Entry.Popup.prototype.resize = function(a) { + a = window.popup.window_; + var b = .9 * window.innerWidth, c = .9 * window.innerHeight - 35; + 9 * b <= 16 * c ? c = b / 16 * 9 + 35 : (b = 16 * c / 9, c += 35); + a.style.width = String(b) + "px"; + a.style.height = String(c) + "px"; +}; +Entry.popupHelper = function(a) { + this.popupList = {}; + this.nowContent; + a && (window.popupHelper = null); + Entry.assert(!window.popupHelper, "Popup exist"); + var b = ["confirm", "spinner"], c = ["entryPopupHelperTopSpan", "entryPopupHelperBottomSpan", "entryPopupHelperLeftSpan", "entryPopupHelperRightSpan"]; + this.body_ = Entry.Dom("div", {classes:["entryPopup", "hiddenPopup", "popupHelper"]}); + var d = this; + this.body_.bindOnClick(function(a) { + if (!(d.nowContent && -1 < b.indexOf(d.nowContent.prop("type")))) { + var f = $(a.target); + c.forEach(function(b) { + f.hasClass(b) && this.popup.hide(); + }.bind(this)); + a.target == this && this.popup.hide(); } - delete this.isAction; - delete this.isContinue; - } else { - this.isAction = this.isContinue = !0; - var b = Ntry.STATIC, a = this, c = function() { - window.setTimeout(function() { - Ntry.dispatchEvent("unitAction", b.WALK, function() { - a.isAction = !1; - }); - }, 3); - }, d; - switch(Ntry.unitComp.direction) { - case b.SOUTH: - d = b.TURN_RIGHT; - break; - case b.EAST: - d = b.HALF_ROTATION; - break; - case b.NORTH: - d = b.TURN_LEFT; - break; - default: - c(); + }); + this.body_.bind("touchstart", function(a) { + if (!(d.nowContent && -1 < b.indexOf(d.nowContent.prop("type")))) { + var f = $(a.target); + c.forEach(function(b) { + f.hasClass(b) && this.popup.hide(); + }.bind(this)); + a.target == this && this.popup.hide(); } - d && Ntry.dispatchEvent("unitAction", d, c); - return Entry.STATIC.CONTINUE; - } -}}; -Entry.block.jr_start_basic = {skeleton:"basic_event", event:"start", color:"#3BBD70", template:"%1 %2", params:[{type:"Indicator", boxMultiplier:2, img:"/img/assets/block_icon/start_icon_play.png", highlightColor:"#3BBD70", size:17, position:{x:0, y:-2}}, Lang.Menus.maze_when_run], func:function() { - var b = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), a; - for (a in b) { - this._unit = b[a]; + }); + window.popupHelper = this; + this.body_.prop("popup", this); + Entry.Dom("div", {class:"entryPopupHelperTopSpan", parent:this.body_}); + a = Entry.Dom("div", {class:"entryPopupHelperMiddleSpan", parent:this.body_}); + Entry.Dom("div", {class:"entryPopupHelperBottomSpan", parent:this.body_}); + Entry.Dom("div", {class:"entryPopupHelperLeftSpan", parent:a}); + this.window_ = Entry.Dom("div", {class:"entryPopupHelperWindow", parent:a}); + Entry.Dom("div", {class:"entryPopupHelperRightSpan", parent:a}); + $("body").append(this.body_); +}; +Entry.popupHelper.prototype.clearPopup = function() { + for (var a = this.popupWrapper_.children.length - 1;2 < a;a--) { + this.popupWrapper_.removeChild(this.popupWrapper_.children[a]); } - Ntry.unitComp = Ntry.entityManager.getComponent(this._unit.id, Ntry.STATIC.UNIT); -}}; -Entry.block.jr_go_straight = {skeleton:"basic", color:"#A751E3", template:"%1 %2", params:[Lang.Menus.go_forward, {type:"Image", img:"/img/assets/ntry/bitmap/jr/cparty_go_straight.png", size:24}], func:function() { - if (this.isContinue) { - if (this.isAction) { - return Entry.STATIC.CONTINUE; +}; +Entry.popupHelper.prototype.addPopup = function(a, b) { + var c = Entry.Dom("div"), d = Entry.Dom("div", {class:"entryPopupHelperCloseButton"}); + d.bindOnClick(function() { + b.closeEvent ? b.closeEvent(this) : this.hide(); + }.bind(this)); + var e = this; + d.bind("touchstart", function() { + b.closeEvent ? b.closeEvent(e) : e.hide(); + }); + var f = Entry.Dom("div", {class:"entryPopupHelperWrapper"}); + f.append(d); + b.title && (d = Entry.Dom("div", {class:"entryPopupHelperTitle"}), f.append(d), d.text(b.title)); + c.addClass(a); + c.append(f); + c.popupWrapper_ = f; + c.prop("type", b.type); + "function" === typeof b.setPopupLayout && b.setPopupLayout(c); + this.popupList[a] = c; +}; +Entry.popupHelper.prototype.hasPopup = function(a) { + return !!this.popupList[a]; +}; +Entry.popupHelper.prototype.setPopup = function(a) { +}; +Entry.popupHelper.prototype.remove = function(a) { + 0 < this.window_.children().length && this.window_.children().remove(); + this.window_.remove(); + delete this.popupList[a]; + this.nowContent = void 0; + this.body_.addClass("hiddenPopup"); +}; +Entry.popupHelper.prototype.resize = function(a) { +}; +Entry.popupHelper.prototype.show = function(a) { + 0 < this.window_.children().length && this.window_.children().detach(); + this.window_.append(this.popupList[a]); + this.nowContent = this.popupList[a]; + this.body_.removeClass("hiddenPopup"); +}; +Entry.popupHelper.prototype.hide = function() { + this.nowContent = void 0; + this.body_.addClass("hiddenPopup"); +}; +Entry.getStartProject = function(a) { + return {category:"\uae30\ud0c0", scenes:[{name:"\uc7a5\uba74 1", id:"7dwq"}], variables:[{name:"\ucd08\uc2dc\uacc4", id:"brih", visible:!1, value:"0", variableType:"timer", x:150, y:-70, array:[], object:null, isCloud:!1}, {name:"\ub300\ub2f5", id:"1vu8", visible:!1, value:"0", variableType:"answer", x:150, y:-100, array:[], object:null, isCloud:!1}], objects:[{id:"7y0y", name:"\uc5d4\ud2b8\ub9ac\ubd07", script:[[{type:"when_run_button_click", x:40, y:50}, {type:"repeat_basic", statements:[[{type:"move_direction"}]]}]], + selectedPictureId:"vx80", objectType:"sprite", rotateMethod:"free", scene:"7dwq", sprite:{sounds:[{duration:1.3, ext:".mp3", id:"8el5", fileurl:a + "media/bark.mp3", name:"\uac15\uc544\uc9c0 \uc9d6\ub294\uc18c\ub9ac"}], pictures:[{id:"vx80", fileurl:a + "media/entrybot1.png", name:Lang.Blocks.walking_entryBot + "1", scale:100, dimension:{width:284, height:350}}, {id:"4t48", fileurl:a + "media/entrybot2.png", name:Lang.Blocks.walking_entryBot + "2", scale:100, dimension:{width:284, height:350}}]}, + entity:{x:0, y:0, regX:142, regY:175, scaleX:.3154574132492113, scaleY:.3154574132492113, rotation:0, direction:90, width:284, height:350, visible:!0}, lock:!1, active:!0}], speed:60}; +}; +Entry.Reporter = function(a) { + this.projectId = this.userId = null; + this.isRealTime = a; + this.activities = []; +}; +Entry.Reporter.prototype.start = function(a, b, c) { + this.isRealTime && (-1 < window.location.href.indexOf("localhost") ? this.io = io("localhost:7000") : this.io = io("play04.play-entry.com:7000"), this.io.emit("activity", {message:"start", userId:b, projectId:a, time:c})); + this.userId = b; + this.projectId = a; +}; +Entry.Reporter.prototype.report = function(a) { + if (!this.isRealTime || this.io) { + var b = [], c; + for (c in a.params) { + var d = a.params[c]; + "object" !== typeof d ? b.push(d) : d.id && b.push(d.id); } - delete this.isAction; - delete this.isContinue; - } else { - this.isAction = this.isContinue = !0; - var b = this; - Ntry.dispatchEvent("unitAction", Ntry.STATIC.WALK, function() { - b.isAction = !1; + a = {message:a.message, userId:this.userId, projectId:this.projectId, time:a.time, params:b}; + this.isRealTime ? this.io.emit("activity", a) : this.activities.push(a); + } +}; +Entry.Scene = function() { + var a = this; + this.scenes_ = []; + this.selectedScene = null; + this.maxCount = 20; + $(window).on("resize", function(b) { + a.resize(); + }); +}; +Entry.Scene.viewBasicWidth = 70; +Entry.Scene.prototype.generateView = function(a, b) { + var c = this; + this.view_ = a; + this.view_.addClass("entryScene"); + b && "workspace" != b || (this.view_.addClass("entrySceneWorkspace"), $(this.view_).on("mousedown", function(b) { + var a = $(this).offset(), f = $(window), g = b.pageX - a.left + f.scrollLeft(); + b = b.pageY - a.top + f.scrollTop(); + b = 40 - b; + a = -40 / 55; + f = $(c.selectedScene.view).find(".entrySceneRemoveButtonCoverWorkspace").offset().left; + !(g < f || g > f + 55) && b > 40 + a * (g - f) && (g = c.getNextScene()) && (g = $(g.view), $(document).trigger("mouseup"), g.trigger("mousedown")); + }), a = Entry.createElement("ul"), a.addClass("entrySceneListWorkspace"), Entry.sceneEditable && $ && $(a).sortable({start:function(b, a) { + a.item.data("start_pos", a.item.index()); + $(a.item[0]).clone(!0); + }, stop:function(b, a) { + b = a.item.data("start_pos"); + a = a.item.index(); + Entry.scene.moveScene(b, a); + }, axis:"x", tolerance:"pointer"}), this.view_.appendChild(a), this.listView_ = a, Entry.sceneEditable && (a = Entry.createElement("span"), a.addClass("entrySceneElementWorkspace"), a.addClass("entrySceneAddButtonWorkspace"), a.bindOnClick(function(b) { + Entry.engine.isState("run") || Entry.scene.addScene(); + }), this.view_.appendChild(a), this.addButton_ = a)); +}; +Entry.Scene.prototype.generateElement = function(a) { + var b = this, c = Entry.createElement("li", a.id); + c.addClass("entrySceneElementWorkspace"); + c.addClass("entrySceneButtonWorkspace"); + c.addClass("minValue"); + $(c).on("mousedown", function(b) { + Entry.engine.isState("run") ? b.preventDefault() : Entry.scene.selectScene(a); + }); + var d = Entry.createElement("input"); + d.addClass("entrySceneFieldWorkspace"); + d.value = a.name; + Entry.sceneEditable || (d.disabled = "disabled"); + var e = Entry.createElement("span"); + e.addClass("entrySceneLeftWorkspace"); + c.appendChild(e); + var f = Entry.createElement("span"); + f.addClass("entrySceneInputCover"); + f.style.width = Entry.computeInputWidth(a.name); + c.appendChild(f); + a.inputWrapper = f; + d.onkeyup = function(c) { + c = c.keyCode; + Entry.isArrowOrBackspace(c) || (a.name = this.value, f.style.width = Entry.computeInputWidth(a.name), b.resize(), 13 == c && this.blur(), 10 < this.value.length && (this.value = this.value.substring(0, 10), this.blur())); + }; + d.onblur = function(b) { + d.value = this.value; + a.name = this.value; + f.style.width = Entry.computeInputWidth(a.name); + }; + f.appendChild(d); + e = Entry.createElement("span"); + e.addClass("entrySceneRemoveButtonCoverWorkspace"); + c.appendChild(e); + if (Entry.sceneEditable) { + var g = Entry.createElement("button"); + g.addClass("entrySceneRemoveButtonWorkspace"); + g.scene = a; + g.bindOnClick(function(b) { + b.stopPropagation(); + Entry.engine.isState("run") || confirm(Lang.Workspace.will_you_delete_scene) && Entry.scene.removeScene(this.scene); }); - return Entry.STATIC.CONTINUE; + e.appendChild(g); } -}}; -Entry.block.jr_turn_left = {skeleton:"basic", color:"#A751E3", template:"%1 %2", params:[Lang.Menus.jr_turn_left, {type:"Image", img:"/img/assets/ntry/bitmap/jr/cparty_rotate_l.png", size:24}], func:function() { - if (this.isContinue) { - if (this.isAction) { - return Entry.STATIC.CONTINUE; + Entry.Utils.disableContextmenu(c); + $(c).on("contextmenu", function() { + var b = [{text:Lang.Workspace.duplicate_scene, enable:Entry.engine.isState("stop"), callback:function() { + Entry.scene.cloneScene(a); + }}]; + Entry.ContextMenu.show(b, "workspace-contextmenu"); + }); + return a.view = c; +}; +Entry.Scene.prototype.updateView = function() { + if (!Entry.type || "workspace" == Entry.type) { + for (var a = this.listView_, b = $(a).children().length;b < this.getScenes().length;b++) { + a.appendChild(this.getScenes()[b].view); } - delete this.isAction; - delete this.isContinue; - } else { - this.isAction = this.isContinue = !0; - var b = this; - Ntry.dispatchEvent("unitAction", Ntry.STATIC.TURN_LEFT, function() { - b.isAction = !1; - }); - return Entry.STATIC.CONTINUE; + this.addButton_ && (this.getScenes().length < this.maxCount ? this.addButton_.removeClass("entryRemove") : this.addButton_.addClass("entryRemove")); } -}}; -Entry.block.jr_turn_right = {skeleton:"basic", color:"#A751E3", template:"%1 %2", params:[Lang.Menus.jr_turn_right, {type:"Image", img:"/img/assets/ntry/bitmap/jr/cparty_rotate_r.png", size:24}], func:function() { - if (this.isContinue) { - if (this.isAction) { - return Entry.STATIC.CONTINUE; + this.resize(); +}; +Entry.Scene.prototype.addScenes = function(a) { + if ((this.scenes_ = a) && 0 !== a.length) { + for (var b = 0, c = a.length;b < c;b++) { + this.generateElement(a[b]); } - delete this.isAction; - delete this.isContinue; } else { - this.isAction = this.isContinue = !0; - var b = this; - Ntry.dispatchEvent("unitAction", Ntry.STATIC.TURN_RIGHT, function() { - b.isAction = !1; - }); - return Entry.STATIC.CONTINUE; + this.scenes_ = [], this.scenes_.push(this.createScene()); } -}}; -Entry.block.jr_go_slow = {skeleton:"basic", color:"#f46c6c", template:"%1 %2", params:[Lang.Menus.go_slow, {type:"Image", img:"/img/assets/ntry/bitmap/jr/cparty_go_slow.png", size:24}], func:function() { - if (this.isContinue) { - if (this.isAction) { - return Entry.STATIC.CONTINUE; - } - delete this.isAction; - delete this.isContinue; + this.selectScene(this.getScenes()[0]); + this.updateView(); +}; +Entry.Scene.prototype.addScene = function(a, b) { + void 0 === a && (a = this.createScene()); + a.view || this.generateElement(a); + b || "number" == typeof b ? this.getScenes().splice(b, 0, a) : this.getScenes().push(a); + Entry.stage.objectContainers.push(Entry.stage.createObjectContainer(a)); + Entry.playground.flushPlayground(); + this.selectScene(a); + this.updateView(); + return a; +}; +Entry.Scene.prototype.removeScene = function(a) { + if (1 >= this.getScenes().length) { + Entry.toast.alert(Lang.Msgs.runtime_error, Lang.Workspace.Scene_delete_error, !1); } else { - this.isAction = this.isContinue = !0; - var b = this; - Ntry.dispatchEvent("unitAction", Ntry.STATIC.GO_SLOW, function() { - b.isAction = !1; - }); - return Entry.STATIC.CONTINUE; + var b = this.getScenes().indexOf(this.getSceneById(a.id)); + this.getScenes().splice(b, 1); + for (var b = Entry.container.getSceneObjects(a), c = 0;c < b.length;c++) { + Entry.container.removeObject(b[c]); + } + Entry.stage.removeObjectContainer(a); + $(a.view).remove(); + this.selectScene(); } -}}; -Entry.block.jr_repeat_until_dest = {skeleton:"basic_loop", color:"#498DEB", template:"%1 %2 %3 %4", syntax:["BasicWhile", "true"], params:[Lang.Menus.repeat_until_reach_2, {type:"Image", img:"/img/assets/ntry/bitmap/jr/jr_goal_image.png", size:18}, Lang.Menus.repeat_until_reach_1, {type:"Image", img:"/img/assets/week/blocks/for.png", size:24}], statements:[{accept:"basic"}], func:function() { - var b = this.block.statements[0]; - if (0 !== b.getBlocks().length) { - return this.executor.stepInto(b), Entry.STATIC.CONTINUE; +}; +Entry.Scene.prototype.selectScene = function(a) { + a = a || this.getScenes()[0]; + if (!this.selectedScene || this.selectedScene.id != a.id) { + Entry.engine.isState("run") && Entry.container.resetSceneDuringRun(); + var b = this.selectedScene; + b && (b = b.view, b.removeClass("selectedScene"), b = $(b), b.find("input").blur()); + this.selectedScene = a; + a.view.addClass("selectedScene"); + Entry.container.setCurrentObjects(); + Entry.stage.objectContainers && 0 !== Entry.stage.objectContainers.length && Entry.stage.selectObjectContainer(a); + (a = Entry.container.getCurrentObjects()[0]) && "minimize" != Entry.type ? (Entry.container.selectObject(a.id), Entry.playground.refreshPlayground()) : (Entry.stage.selectObject(null), Entry.playground.flushPlayground(), Entry.variableContainer.updateList()); + Entry.container.listView_ || Entry.stage.sortZorder(); + Entry.container.updateListView(); + this.updateView(); + Entry.requestUpdate = !0; + } +}; +Entry.Scene.prototype.toJSON = function() { + for (var a = [], b = this.getScenes().length, c = 0;c < b;c++) { + var d = this.getScenes()[c], e = d.view, f = d.inputWrapper; + delete d.view; + delete d.inputWrapper; + a.push(JSON.parse(JSON.stringify(d))); + d.view = e; + d.inputWrapper = f; } -}}; -Entry.block.jr_if_construction = {skeleton:"basic_loop", color:"#498DEB", template:"%1 %2 %3 %4", params:[Lang.Menus.jr_if_1, {type:"Image", img:"/img/assets/ntry/bitmap/jr/jr_construction_image.png", size:18}, Lang.Menus.jr_if_2, {type:"Image", img:"/img/assets/week/blocks/for.png", size:24}], statements:[{accept:"basic"}], func:function() { - if (!this.isContinue) { - var b = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), a, c; - for (c in b) { - a = b[c]; + return a; +}; +Entry.Scene.prototype.moveScene = function(a, b) { + this.getScenes().splice(b, 0, this.getScenes().splice(a, 1)[0]); + Entry.container.updateObjectsOrder(); + Entry.stage.sortZorder(); + $(".entrySceneElementWorkspace").removeAttr("style"); +}; +Entry.Scene.prototype.getSceneById = function(a) { + for (var b = this.getScenes(), c = 0;c < b.length;c++) { + if (b[c].id == a) { + return b[c]; } - b = Ntry.entityManager.getComponent(a.id, Ntry.STATIC.UNIT); - a = Ntry.entityManager.getComponent(a.id, Ntry.STATIC.GRID); - a = {x:a.x, y:a.y}; - Ntry.addVectorByDirection(a, b.direction, 1); - a = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:a.x, y:a.y}, {type:Ntry.STATIC.TILE, tileType:Ntry.STATIC.OBSTACLE_REPAIR}); - this.isContinue = !0; - b = this.block.statements[0]; - if (0 !== a.length && 0 !== b.getBlocks().length) { - return this.executor.stepInto(b), Entry.STATIC.CONTINUE; + } + return !1; +}; +Entry.Scene.prototype.getScenes = function() { + return this.scenes_; +}; +Entry.Scene.prototype.takeStartSceneSnapshot = function() { + this.sceneBeforeRun = this.selectedScene; +}; +Entry.Scene.prototype.loadStartSceneSnapshot = function() { + this.selectScene(this.sceneBeforeRun); + this.sceneBeforeRun = null; +}; +Entry.Scene.prototype.createScene = function() { + var a = {name:Lang.Blocks.SCENE + " " + (this.getScenes().length + 1), id:Entry.generateHash()}; + this.generateElement(a); + return a; +}; +Entry.Scene.prototype.cloneScene = function(a) { + if (this.scenes_.length >= this.maxCount) { + Entry.toast.alert(Lang.Msgs.runtime_error, Lang.Workspace.Scene_add_error, !1); + } else { + var b = {name:a.name + Lang.Workspace.replica_of_object, id:Entry.generateHash()}; + this.generateElement(b); + this.addScene(b); + a = Entry.container.getSceneObjects(a); + for (var c = a.length - 1;0 <= c;c--) { + Entry.container.addCloneObject(a[c], b.id); } } -}}; -Entry.block.jr_if_speed = {skeleton:"basic_loop", color:"#498DEB", template:Lang.Menus.jr_if_1 + " %1 " + Lang.Menus.jr_if_2 + " %2", params:[{type:"Image", img:"/img/assets/ntry/bitmap/jr/jr_speed_image.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/for.png", size:24}], statements:[{accept:"basic"}], func:function() { - if (!this.isContinue) { - var b = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), a, c; - for (c in b) { - a = b[c]; +}; +Entry.Scene.prototype.resize = function() { + var a = this.getScenes(), b = this.selectedScene, c = a[0]; + if (0 !== a.length && c) { + var d = $(c.view).offset().left, c = parseFloat($(b.view).css("margin-left")), e = $(this.view_).width() - d, f = 0, g; + for (g in a) { + var d = a[g], h = d.view; + h.addClass("minValue"); + $(d.inputWrapper).width(Entry.computeInputWidth(d.name)); + h = $(h); + f = f + h.width() + c; } - b = Ntry.entityManager.getComponent(a.id, Ntry.STATIC.UNIT); - a = Ntry.entityManager.getComponent(a.id, Ntry.STATIC.GRID); - a = {x:a.x, y:a.y}; - Ntry.addVectorByDirection(a, b.direction, 1); - a = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:a.x, y:a.y}, {type:Ntry.STATIC.TILE, tileType:Ntry.STATIC.OBSTACLE_SLOW}); - this.isContinue = !0; - b = this.block.statements[0]; - if (0 !== a.length && 0 !== b.getBlocks().length) { - return this.executor.stepInto(b), Entry.STATIC.CONTINUE; + if (f > e) { + for (g in e -= $(b.view).width(), c = e / (a.length - 1) - (Entry.Scene.viewBasicWidth + c), a) { + d = a[g], b.id != d.id ? (d.view.removeClass("minValue"), $(d.inputWrapper).width(c)) : d.view.addClass("minValue"); + } } } -}}; -Entry.block.maze_step_start = {skeleton:"basic_event", mode:"maze", event:"start", color:"#3BBD70", template:"%1 \uc2dc\uc791\ud558\uae30\ub97c \ud074\ub9ad\ud588\uc744 \ub54c", syntax:["Program"], params:[{type:"Indicator", boxMultiplier:2, img:"/img/assets/block_icon/start_icon_play.png", highlightColor:"#3BBD70", size:17, position:{x:0, y:-2}}], func:function() { - var b = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), a; - for (a in b) { - this._unit = b[a]; - } - Ntry.unitComp = Ntry.entityManager.getComponent(this._unit.id, Ntry.STATIC.UNIT); -}}; -Entry.block.maze_step_jump = {skeleton:"basic", mode:"maze", color:"#FF6E4B", template:"\ub6f0\uc5b4\ub118\uae30%1", params:[{type:"Image", img:"/img/assets/week/blocks/jump.png", size:24}], syntax:["Scope", "jump"], func:function() { - if (this.isContinue) { - if (this.isAction) { - return Entry.STATIC.CONTINUE; +}; +Entry.Scene.prototype.getNextScene = function() { + var a = this.getScenes(); + return a[a.indexOf(this.selectedScene) + 1]; +}; +Entry.Script = function(a) { + this.entity = a; +}; +p = Entry.Script.prototype; +p.init = function(a, b, c) { + Entry.assert("BLOCK" == a.tagName.toUpperCase(), a.tagName); + this.type = a.getAttribute("type"); + this.id = Number(a.getAttribute("id")); + a.getElementsByTagName("mutation").length && a.getElementsByTagName("mutation")[0].hasAttribute("hashid") && (this.hashId = a.childNodes[0].getAttribute("hashid")); + "REPEAT" == this.type.substr(0, 6).toUpperCase() && (this.isRepeat = !0); + b instanceof Entry.Script && (this.previousScript = b, b.parentScript && (this.parentScript = b.parentScript)); + c instanceof Entry.Script && (this.parentScript = c); + a = a.childNodes; + for (b = 0;b < a.length;b++) { + if (c = a[b], "NEXT" == c.tagName.toUpperCase()) { + this.nextScript = new Entry.Script(this.entity), this.register && (this.nextScript.register = this.register), this.nextScript.init(a[b].childNodes[0], this); + } else { + if ("VALUE" == c.tagName.toUpperCase()) { + this.values || (this.values = {}); + var d = new Entry.Script(this.entity); + this.register && (d.register = this.register); + d.init(c.childNodes[0]); + this.values[c.getAttribute("name")] = d; + } else { + "FIELD" == c.tagName.toUpperCase() ? (this.fields || (this.fields = {}), this.fields[c.getAttribute("name")] = c.textContent) : "STATEMENT" == c.tagName.toUpperCase() && (this.statements || (this.statements = {}), d = new Entry.Script(this.entity), this.register && (d.register = this.register), d.init(c.childNodes[0], null, this), d.key = c.getAttribute("name"), this.statements[c.getAttribute("name")] = d); + } } - delete this.isAction; - delete this.isContinue; - } else { - this.isAction = this.isContinue = !0; - var b = this; - Ntry.dispatchEvent("unitAction", Ntry.STATIC.JUMP, function() { - b.isAction = !1; - }); - return Entry.STATIC.CONTINUE; - } -}}; -Entry.block.maze_step_for = {skeleton:"basic_loop", mode:"maze", color:"#498DEB", template:"%1 \ubc88 \ubc18\ubcf5\ud558\uae30%2", syntax:["BasicIteration"], params:[{type:"Dropdown", key:"REPEAT", options:[[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]], value:1}, {type:"Image", img:"/img/assets/week/blocks/for.png", size:24}], statements:[{accept:"basic"}], func:function() { - if (void 0 === this.repeatCount) { - return this.repeatCount = this.block.params[0], Entry.STATIC.CONTINUE; } - if (0 < this.repeatCount) { - this.repeatCount--; - var b = this.block.statements[0]; - if (0 !== b.getBlocks().length) { - return this.executor.stepInto(b), Entry.STATIC.CONTINUE; +}; +p.clone = function(a, b) { + var c = new Entry.Script(a); + c.id = this.id; + c.type = this.type; + c.isRepeat = this.isRepeat; + if (this.parentScript && !this.previousScript && 2 != b) { + c.parentScript = this.parentScript.clone(a); + for (var d = c.parentScript.statements[this.key] = c;d.nextScript;) { + d = d.nextScript, d.parentScript = c.parentScript; } - } else { - delete this.repeatCount; - } -}}; -Entry.block.test = {skeleton:"basic_boolean_field", mode:"maze", color:"#127CDB", template:"%1 this is test block %2", params:[{type:"Angle", value:"90"}, {type:"Dropdown", options:[[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]], value:1}], func:function() { -}}; -Entry.block.maze_repeat_until_1 = {skeleton:"basic_loop", mode:"maze", color:"#498DEB", template:"%1 \ub9cc\ub0a0 \ub54c \uae4c\uc9c0 \ubc18\ubcf5%2", syntax:["BasicWhile", "true"], params:[{type:"Image", img:"/img/assets/ntry/block_inner/repeat_goal_1.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/for.png", size:24}], statements:[{accept:"basic"}], func:function() { - var b = this.block.statements[0]; - if (0 !== b.getBlocks().length) { - return this.executor.stepInto(b), Entry.STATIC.CONTINUE; - } -}}; -Entry.block.maze_repeat_until_2 = {skeleton:"basic_loop", mode:"maze", color:"#498DEB", template:"\ubaa8\ub4e0 %1 \ub9cc\ub0a0 \ub54c \uae4c\uc9c0 \ubc18\ubcf5%2", syntax:["BasicWhile", "true"], params:[{type:"Image", img:"/img/assets/ntry/block_inner/repeat_goal_1.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/for.png", size:24}], statements:[{accept:"basic"}], func:function() { - var b = this.block.statements[0]; - if (0 !== b.getBlocks().length) { - return this.executor.stepInto(b), Entry.STATIC.CONTINUE; } -}}; -Entry.block.maze_step_if_1 = {skeleton:"basic_loop", mode:"maze", color:"#498DEB", template:"\ub9cc\uc57d \uc55e\uc5d0 %1 \uc788\ub2e4\uba74%2", syntax:["BasicIf", 'front == "wall"'], params:[{type:"Image", img:"/img/assets/ntry/block_inner/if_target_1.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/if.png", size:24}], statements:[{accept:"basic"}], func:function() { - if (!this.isContinue) { - var b = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), a, c; - for (c in b) { - a = b[c]; - } - b = Ntry.entityManager.getComponent(a.id, Ntry.STATIC.UNIT); - a = Ntry.entityManager.getComponent(a.id, Ntry.STATIC.GRID); - a = {x:a.x, y:a.y}; - Ntry.addVectorByDirection(a, b.direction, 1); - c = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:a.x, y:a.y}); - b = this.block.statements[0]; - if (0 === c.length) { - return this.executor.stepInto(b), Entry.STATIC.CONTINUE; - } - a = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:a.x, y:a.y}, {type:Ntry.STATIC.TILE, tileType:Ntry.STATIC.WALL}); - this.isContinue = !0; - if (0 !== a.length && 0 !== b.getBlocks().length) { - return this.executor.stepInto(b), Entry.STATIC.CONTINUE; + this.nextScript && 1 != b && (c.nextScript = this.nextScript.clone(a, 0), c.nextScript.previousScript = this); + this.previousScript && 0 !== b && (c.previousScript = this.previousScript.clone(a, 1), c.previousScript.previousScript = this); + if (this.fields) { + c.fields = {}; + for (var e in this.fields) { + c.fields[e] = this.fields[e]; } } -}}; -Entry.block.maze_step_if_2 = {skeleton:"basic_loop", mode:"maze", color:"#498DEB", template:"\ub9cc\uc57d \uc55e\uc5d0 %1 \uc788\ub2e4\uba74%2", syntax:["BasicIf", 'front == "bee"'], params:[{type:"Image", img:"/img/assets/ntry/bitmap/maze2/obstacle_01.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/if.png", size:24}], statements:[{accept:"basic"}], func:function() { - if (!this.isContinue) { - var b = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), a, c; - for (c in b) { - a = b[c]; - } - b = Ntry.entityManager.getComponent(a.id, Ntry.STATIC.UNIT); - a = Ntry.entityManager.getComponent(a.id, Ntry.STATIC.GRID); - a = {x:a.x, y:a.y}; - Ntry.addVectorByDirection(a, b.direction, 1); - a = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:a.x, y:a.y}, {type:Ntry.STATIC.TILE, tileType:Ntry.STATIC.OBSTACLE_BEE}); - this.isContinue = !0; - b = this.block.statements[0]; - if (0 !== a.length && 0 !== b.getBlocks().length) { - return this.executor.stepInto(b), Entry.STATIC.CONTINUE; + if (this.values) { + for (e in c.values = {}, this.values) { + c.values[e] = this.values[e].clone(a); } } -}}; -Entry.block.maze_call_function = {skeleton:"basic", mode:"maze", color:"#B57242", template:"\uc57d\uc18d \ubd88\ub7ec\uc624\uae30%1", syntax:["Scope", "promise"], params:[{type:"Image", img:"/img/assets/week/blocks/function.png", size:24}], func:function() { - if (!this.funcExecutor) { - var b = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.CODE), a; - for (a in b) { - this.funcExecutor = new Entry.Executor(b[a].components[Ntry.STATIC.CODE].code.getEventMap("define")[0]); + if (this.statements) { + for (e in c.statements = {}, this.statements) { + for (c.statements[e] = this.statements[e].clone(a, 2), d = c.statements[e], d.parentScript = c;d.nextScript;) { + d = d.nextScript, d.parentScript = c; + } } } - this.funcExecutor.execute(); - if (null !== this.funcExecutor.scope.block) { - return Entry.STATIC.CONTINUE; - } -}}; -Entry.block.maze_define_function = {skeleton:"basic_define", mode:"maze", color:"#B57242", event:"define", template:"\uc57d\uc18d\ud558\uae30%1", syntax:["BasicFunction"], params:[{type:"Image", img:"/img/assets/week/blocks/function.png", size:24}], statements:[{accept:"basic"}], func:function(b) { - if (!this.executed && (b = this.block.statements[0], 0 !== b.getBlocks().length)) { - return this.executor.stepInto(b), this.executed = !0, Entry.STATIC.CONTINUE; + return c; +}; +p.getStatement = function(a) { + return this.statements[a]; +}; +p.compute = function() { +}; +p.getValue = function(a) { + return this.values[a].run(); +}; +p.getNumberValue = function(a) { + return Number(this.values[a].run()); +}; +p.getStringValue = function(a) { + return String(this.values[a].run()); +}; +p.getBooleanValue = function(a) { + return this.values[a].run() ? !0 : !1; +}; +p.getField = function(a) { + return this.fields[a]; +}; +p.getStringField = function(a) { + return String(this.fields[a]); +}; +p.getNumberField = function(a) { + return Number(this.fields[a]); +}; +p.callReturn = function() { + return this.nextScript ? this.nextScript : this.parentScript ? this.parentScript : null; +}; +p.run = function() { + return Entry.block[this.type](this.entity, this); +}; +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; +}; +Entry.Stage.prototype.initStage = function(a) { + this.canvas = new createjs.Stage(a.id); + this.canvas.x = 320; + this.canvas.y = 180; + this.canvas.scaleX = this.canvas.scaleY = 2 / 1.5; + createjs.Touch.enable(this.canvas); + this.canvas.enableMouseOver(10); + this.canvas.mouseMoveOutside = !0; + this.canvas.addChild(this.background); + this.canvas.addChild(this.variableContainer); + this.canvas.addChild(this.dialogContainer); + this.inputField = null; + this.initCoordinator(); + this.initHandle(); + this.mouseCoordinate = {x:0, y:0}; + if (Entry.isPhone()) { + a.ontouchstart = function(b) { + Entry.dispatchEvent("canvasClick", b); + Entry.stage.isClick = !0; + }, a.ontouchend = function(b) { + Entry.stage.isClick = !1; + Entry.dispatchEvent("canvasClickCanceled", b); + }; + } else { + var b = function(b) { + Entry.dispatchEvent("canvasClick", b); + Entry.stage.isClick = !0; + }; + a.onmousedown = b; + a.ontouchstart = b; + b = function(b) { + Entry.stage.isClick = !1; + Entry.dispatchEvent("canvasClickCanceled", b); + }; + a.onmouseup = b; + a.ontouchend = b; + $(document).click(function(b) { + Entry.stage.focused = "entryCanvas" === b.target.id ? !0 : !1; + }); } -}}; -Entry.block.maze_step_if_3 = {skeleton:"basic_loop", mode:"maze", color:"#498DEB", template:"\ub9cc\uc57d \uc55e\uc5d0 %1 \uc788\ub2e4\uba74%2", syntax:["BasicIf", 'front == "banana"'], params:[{type:"Image", img:"/img/assets/ntry/block_inner/if_target_3.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/if.png", size:24}], statements:[{accept:"basic"}], func:function() { - if (!this.isContinue) { - var b = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), a, c; - for (c in b) { - a = b[c]; + Entry.addEventListener("canvasClick", function(b) { + Entry.stage.isObjectClick = !1; + }); + Entry.windowResized.attach(this, function() { + Entry.stage.updateBoundRect(); + }); + b = function(b) { + b.preventDefault(); + var a = Entry.stage.getBoundRect(), e; + -1 < Entry.getBrowserType().indexOf("IE") ? (e = 480 * ((b.pageX - a.left - document.documentElement.scrollLeft) / a.width - .5), b = -270 * ((b.pageY - a.top - document.documentElement.scrollTop) / a.height - .5)) : b.changedTouches ? (e = 480 * ((b.changedTouches[0].pageX - a.left - document.body.scrollLeft) / a.width - .5), b = -270 * ((b.changedTouches[0].pageY - a.top - document.body.scrollTop) / a.height - .5)) : (e = 480 * ((b.pageX - a.left - document.body.scrollLeft) / a.width - .5), + b = -270 * ((b.pageY - a.top - document.body.scrollTop) / a.height - .5)); + Entry.stage.mouseCoordinate = {x:e.toFixed(1), y:b.toFixed(1)}; + Entry.dispatchEvent("stageMouseMove"); + }; + a.onmousemove = b; + a.ontouchmove = b; + a.onmouseout = function(b) { + Entry.dispatchEvent("stageMouseOut"); + }; + Entry.addEventListener("updateObject", function(b) { + Entry.engine.isState("stop") && Entry.stage.updateObject(); + }); + Entry.addEventListener("canvasInputComplete", function(b) { + try { + var a = Entry.stage.inputField.value(); + Entry.stage.hideInputField(); + if (a) { + var e = Entry.container; + e.setInputValue(a); + e.inputValue.complete = !0; + } + } catch (f) { } - b = Ntry.entityManager.getComponent(a.id, Ntry.STATIC.UNIT); - a = Ntry.entityManager.getComponent(a.id, Ntry.STATIC.GRID); - a = {x:a.x, y:a.y}; - Ntry.addVectorByDirection(a, b.direction, 1); - a = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:a.x, y:a.y}, {type:Ntry.STATIC.TILE, tileType:Ntry.STATIC.OBSTACLE_BANANA}); - this.isContinue = !0; - b = this.block.statements[0]; - if (0 !== a.length && 0 !== b.getBlocks().length) { - return this.executor.stepInto(b), Entry.STATIC.CONTINUE; + }); + this.initWall(); + this.render(); +}; +Entry.Stage.prototype.render = function() { + Entry.stage.timer && clearTimeout(Entry.stage.timer); + var a = (new Date).getTime(); + Entry.stage.update(); + a = (new Date).getTime() - a; + Entry.stage.timer = setTimeout(Entry.stage.render, 16 - a % 16 + 16 * Math.floor(a / 16)); +}; +Entry.Stage.prototype.update = function() { + Entry.requestUpdate ? (Entry.engine.isState("stop") && this.objectUpdated ? (this.canvas.update(), this.objectUpdated = !1) : this.canvas.update(), this.inputField && !this.inputField._isHidden && this.inputField.render(), Entry.requestUpdateTwice ? Entry.requestUpdateTwice = !1 : Entry.requestUpdate = !1) : Entry.requestUpdate = !1; +}; +Entry.Stage.prototype.loadObject = function(a) { + var b = a.entity.object; + this.getObjectContainerByScene(a.scene).addChild(b); + this.canvas.update(); +}; +Entry.Stage.prototype.loadEntity = function(a) { + Entry.stage.getObjectContainerByScene(a.parent.scene).addChild(a.object); + this.sortZorder(); +}; +Entry.Stage.prototype.unloadEntity = function(a) { + Entry.stage.getObjectContainerByScene(a.parent.scene).removeChild(a.object); +}; +Entry.Stage.prototype.loadVariable = function(a) { + var b = a.view_; + this.variables[a.id] = b; + this.variableContainer.addChild(b); + Entry.requestUpdate = !0; +}; +Entry.Stage.prototype.removeVariable = function(a) { + this.variableContainer.removeChild(a.view_); + Entry.requestUpdate = !0; +}; +Entry.Stage.prototype.loadDialog = function(a) { + this.dialogContainer.addChild(a.object); +}; +Entry.Stage.prototype.unloadDialog = function(a) { + this.dialogContainer.removeChild(a.object); +}; +Entry.Stage.prototype.sortZorder = function() { + for (var a = Entry.container.getCurrentObjects(), b = this.selectedObjectContainer, c = 0, d = a.length - 1;0 <= d;d--) { + for (var e = a[d], f = e.entity, e = e.clonedEntities, g = 0, h = e.length;g < h;g++) { + e[g].shape && b.setChildIndex(e[g].shape, c++), b.setChildIndex(e[g].object, c++); } + f.shape && b.setChildIndex(f.shape, c++); + b.setChildIndex(f.object, c++); } -}}; -Entry.block.maze_step_if_4 = {skeleton:"basic_loop", mode:"maze", color:"#498DEB", template:"\ub9cc\uc57d \uc55e\uc5d0 %1 \uc788\ub2e4\uba74%2", syntax:["BasicIf", 'front == "wall"'], params:[{type:"Image", img:"/img/assets/ntry/block_inner/if_target_2.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/if.png", size:24}], statements:[{accept:"basic"}], func:function() { - if (!this.isContinue) { - var b = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), a, c; - for (c in b) { - a = b[c]; - } - b = Ntry.entityManager.getComponent(a.id, Ntry.STATIC.UNIT); - a = Ntry.entityManager.getComponent(a.id, Ntry.STATIC.GRID); - a = {x:a.x, y:a.y}; - Ntry.addVectorByDirection(a, b.direction, 1); - a = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:a.x, y:a.y}, {type:Ntry.STATIC.TILE, tileType:Ntry.STATIC.WALL}); - this.isContinue = !0; - b = this.block.statements[0]; - if (0 !== a.length && 0 !== b.getBlocks().length) { - return this.executor.stepInto(b), Entry.STATIC.CONTINUE; +}; +Entry.Stage.prototype.initCoordinator = function() { + var a = new createjs.Container, b = new createjs.Bitmap(Entry.mediaFilePath + "workspace_coordinate.png"); + b.scaleX = .5; + b.scaleY = .5; + b.x = -240; + b.y = -135; + a.addChild(b); + this.canvas.addChild(a); + a.visible = !1; + this.coordinator = a; +}; +Entry.Stage.prototype.toggleCoordinator = function() { + this.coordinator.visible = !this.coordinator.visible; + Entry.requestUpdate = !0; +}; +Entry.Stage.prototype.selectObject = function(a) { + this.selectedObject = a ? a : null; + this.updateObject(); +}; +Entry.Stage.prototype.initHandle = function() { + this.handle = new EaselHandle(this.canvas); + this.handle.setChangeListener(this, this.updateHandle); + this.handle.setEditStartListener(this, this.startEdit); + this.handle.setEditEndListener(this, this.endEdit); +}; +Entry.Stage.prototype.updateObject = function() { + Entry.requestUpdate = !0; + this.handle.setDraggable(!0); + if (!this.editEntity) { + var a = this.selectedObject; + if (a) { + "textBox" == a.objectType ? this.handle.toggleCenter(!1) : this.handle.toggleCenter(!0); + "free" == a.getRotateMethod() ? this.handle.toggleRotation(!0) : this.handle.toggleRotation(!1); + this.handle.toggleDirection(!0); + a.getLock() ? (this.handle.toggleRotation(!1), this.handle.toggleDirection(!1), this.handle.toggleResize(!1), this.handle.toggleCenter(!1), this.handle.setDraggable(!1)) : this.handle.toggleResize(!0); + this.handle.setVisible(!0); + var b = a.entity; + this.handle.setWidth(b.getScaleX() * b.getWidth()); + this.handle.setHeight(b.getScaleY() * b.getHeight()); + var c, d; + if ("textBox" == b.type) { + if (b.getLineBreak()) { + c = b.regX * b.scaleX, d = -b.regY * b.scaleY; + } else { + var e = b.getTextAlign(); + d = -b.regY * b.scaleY; + switch(e) { + case Entry.TEXT_ALIGN_LEFT: + c = -b.getWidth() / 2 * b.scaleX; + break; + case Entry.TEXT_ALIGN_CENTER: + c = b.regX * b.scaleX; + break; + case Entry.TEXT_ALIGN_RIGHT: + c = b.getWidth() / 2 * b.scaleX; + } + } + } else { + c = (b.regX - b.width / 2) * b.scaleX, d = (b.height / 2 - b.regY) * b.scaleY; + } + e = b.getRotation() / 180 * Math.PI; + this.handle.setX(b.getX() - c * Math.cos(e) - d * Math.sin(e)); + this.handle.setY(-b.getY() - c * Math.sin(e) + d * Math.cos(e)); + this.handle.setRegX((b.regX - b.width / 2) * b.scaleX); + this.handle.setRegY((b.regY - b.height / 2) * b.scaleY); + this.handle.setRotation(b.getRotation()); + this.handle.setDirection(b.getDirection()); + this.objectUpdated = !0; + this.handle.setVisible(a.entity.getVisible()); + a.entity.getVisible() && this.handle.render(); + } else { + this.handle.setVisible(!1); } } -}}; -Entry.block.maze_step_move_step = {skeleton:"basic", mode:"maze", color:"#A751E3", template:"\uc55e\uc73c\ub85c \ud55c \uce78 \uc774\ub3d9%1", syntax:["Scope", "move"], params:[{type:"Image", img:"/img/assets/week/blocks/moveStep.png", size:24}], func:function() { - if (this.isContinue) { - if (this.isAction) { - return Entry.STATIC.CONTINUE; +}; +Entry.Stage.prototype.updateHandle = function() { + this.editEntity = !0; + var a = this.handle, b = this.selectedObject.entity; + if (b.lineBreak) { + b.setHeight(a.height / b.getScaleY()), b.setWidth(a.width / b.getScaleX()); + } else { + if (0 !== b.width) { + var c = Math.abs(a.width / b.width); + b.flip && (c *= -1); + b.setScaleX(c); + } + 0 !== b.height && b.setScaleY(a.height / b.height); + } + c = a.rotation / 180 * Math.PI; + if ("textBox" == b.type) { + var d; + if (b.getLineBreak()) { + b.setX(a.x), b.setY(-a.y); + } else { + switch(b.getTextAlign()) { + case Entry.TEXT_ALIGN_LEFT: + b.setX(a.x - a.width / 2 * Math.cos(c)); + b.setY(-a.y + a.width / 2 * Math.sin(c)); + break; + case Entry.TEXT_ALIGN_CENTER: + b.setX(a.x); + b.setY(-a.y); + break; + case Entry.TEXT_ALIGN_RIGHT: + b.setX(a.x + a.width / 2 * Math.cos(c)), b.setY(-a.y - a.width / 2 * Math.sin(c)); + } } - delete this.isAction; - delete this.isContinue; } else { - this.isAction = this.isContinue = !0; - var b = this; - Ntry.dispatchEvent("unitAction", Ntry.STATIC.WALK, function() { - b.isAction = !1; - }); - return Entry.STATIC.CONTINUE; + d = b.width / 2 + a.regX / b.scaleX, b.setX(a.x + a.regX * Math.cos(c) - a.regY * Math.sin(c)), b.setRegX(d), d = b.height / 2 + a.regY / b.scaleY, b.setY(-a.y - a.regX * Math.sin(c) - a.regY * Math.cos(c)), b.setRegY(d); } -}}; -Entry.block.maze_step_rotate_left = {skeleton:"basic", mode:"maze", color:"#A751E3", template:"\uc67c\ucabd\uc73c\ub85c \ud68c\uc804%1", syntax:["Scope", "left"], params:[{type:"Image", img:"/img/assets/week/blocks/turnL.png", size:24}], func:function() { - if (this.isContinue) { - if (this.isAction) { - return Entry.STATIC.CONTINUE; + b.setDirection(a.direction); + b.setRotation(a.rotation); + this.selectedObject.entity.doCommand(); + this.editEntity = !1; +}; +Entry.Stage.prototype.startEdit = function() { + this.selectedObject.entity.initCommand(); +}; +Entry.Stage.prototype.endEdit = function() { + this.selectedObject.entity.checkCommand(); +}; +Entry.Stage.prototype.initWall = function() { + var a = new createjs.Container, b = new Image; + b.src = Entry.mediaFilePath + "media/bound.png"; + a.up = new createjs.Bitmap; + a.up.scaleX = 16; + a.up.y = -165; + a.up.x = -240; + a.up.image = b; + a.addChild(a.up); + a.down = new createjs.Bitmap; + a.down.scaleX = 16; + a.down.y = 135; + a.down.x = -240; + a.down.image = b; + a.addChild(a.down); + a.right = new createjs.Bitmap; + a.right.scaleY = 9; + a.right.y = -135; + a.right.x = 240; + a.right.image = b; + a.addChild(a.right); + a.left = new createjs.Bitmap; + a.left.scaleY = 9; + a.left.y = -135; + a.left.x = -270; + a.left.image = b; + a.addChild(a.left); + this.canvas.addChild(a); + this.wall = a; +}; +Entry.Stage.prototype.showInputField = function(a) { + a = 1 / 1.5; + this.inputField || (this.inputField = new CanvasInput({canvas:document.getElementById("entryCanvas"), fontSize:30 * a, fontFamily:"NanumGothic", fontColor:"#212121", width:556 * a, height:26 * a, padding:8 * a, borderWidth:1 * a, borderColor:"#000", borderRadius:3 * a, boxShadow:"none", innerShadow:"0px 0px 5px rgba(0, 0, 0, 0.5)", x:202 * a, y:450 * a, topPosition:!0, onsubmit:function() { + Entry.dispatchEvent("canvasInputComplete"); + }})); + a = new createjs.Container; + var b = new Image; + b.src = Entry.mediaFilePath + "confirm_button.png"; + var c = new createjs.Bitmap; + c.scaleX = .23; + c.scaleY = .23; + c.x = 160; + c.y = 89; + c.cursor = "pointer"; + c.image = b; + a.addChild(c); + a.on("mousedown", function(b) { + Entry.dispatchEvent("canvasInputComplete"); + }); + this.inputSubmitButton || (this.inputField.value(""), this.canvas.addChild(a), this.inputSubmitButton = a); + this.inputField.show(); + Entry.requestUpdateTwice = !0; +}; +Entry.Stage.prototype.hideInputField = function() { + this.inputField && this.inputField.value() && this.inputField.value(""); + this.inputSubmitButton && (this.canvas.removeChild(this.inputSubmitButton), this.inputSubmitButton = null); + this.inputField && this.inputField.hide(); + Entry.requestUpdate = !0; +}; +Entry.Stage.prototype.initObjectContainers = function() { + var a = Entry.scene.scenes_; + if (a && 0 !== a.length) { + for (var b = 0;b < a.length;b++) { + this.objectContainers[b] = this.createObjectContainer(a[b]); } - delete this.isAction; - delete this.isContinue; + this.selectedObjectContainer = this.objectContainers[0]; } else { - this.isAction = this.isContinue = !0; - var b = this; - Ntry.dispatchEvent("unitAction", Ntry.STATIC.TURN_LEFT, function() { - b.isAction = !1; - }); - return Entry.STATIC.CONTINUE; + a = this.createObjectContainer(Entry.scene.selectedScene), this.objectContainers.push(a), this.selectedObjectContainer = a; } -}}; -Entry.block.maze_step_rotate_right = {skeleton:"basic", mode:"maze", color:"#A751E3", template:"\uc624\ub978\ucabd\uc73c\ub85c \ud68c\uc804%1", syntax:["Scope", "right"], params:[{type:"Image", img:"/img/assets/week/blocks/turnR.png", size:24}], func:function() { - if (this.isContinue) { - if (this.isAction) { - return Entry.STATIC.CONTINUE; + this.canvas.addChild(this.selectedObjectContainer); + this.selectObjectContainer(Entry.scene.selectedScene); +}; +Entry.Stage.prototype.selectObjectContainer = function(a) { + if (this.canvas) { + for (var b = this.objectContainers, c = 0;c < b.length;c++) { + this.canvas.removeChild(b[c]); } - delete this.isAction; - delete this.isContinue; - } else { - this.isAction = this.isContinue = !0; - var b = this; - Ntry.dispatchEvent("unitAction", Ntry.STATIC.TURN_RIGHT, function() { - b.isAction = !1; - }); - return Entry.STATIC.CONTINUE; + this.selectedObjectContainer = this.getObjectContainerByScene(a); + this.canvas.addChildAt(this.selectedObjectContainer, 2); } -}}; -Entry.block.test_wrapper = {skeleton:"basic", mode:"maze", color:"#3BBD70", template:"%1 this is test block %2", params:[{type:"Block", accept:"basic_boolean_field", value:[{type:"test", params:[30, 50]}]}, {type:"Dropdown", options:[[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]], value:1}], func:function() { -}}; -Entry.block.basic_button = {skeleton:"basic_button", color:"#eee", template:"%1", params:[{type:"Text", text:"basic button", color:"#333", align:"center"}], func:function() { -}}; -Entry.BlockMenu = function(b, a, c, d) { - Entry.Model(this, !1); - this._align = a || "CENTER"; - this._scroll = void 0 !== d ? d : !1; - this._bannedClass = []; - this._categories = []; - this.suffix = "blockMenu"; - b = "string" === typeof b ? $("#" + b) : $(b); - if ("DIV" !== b.prop("tagName")) { - return console.error("Dom is not div element"); +}; +Entry.Stage.prototype.reAttachToCanvas = function() { + for (var a = [this.selectedObjectContainer, this.variableContainer, this.coordinator, this.handle, this.dialogContainer], b = 0;b < a.length;b++) { + this.canvas.removeChild(a[b]), this.canvas.addChild(a[b]); } - this.view = b; - this.visible = !0; - this._svgId = "blockMenu" + (new Date).getTime(); - this._clearCategory(); - this._categoryData = c; - this._generateView(c); - this._splitters = []; - this.setWidth(); - this.svg = Entry.SVG(this._svgId); - Entry.Utils.addFilters(this.svg, this.suffix); - a = Entry.Utils.addBlockPattern(this.svg, this.suffix); - this.patternRect = a.rect; - this.pattern = a.pattern; - this.svgGroup = this.svg.elem("g"); - this.svgThreadGroup = this.svgGroup.elem("g"); - this.svgThreadGroup.board = this; - this.svgBlockGroup = this.svgGroup.elem("g"); - this.svgBlockGroup.board = this; - this.changeEvent = new Entry.Event(this); - c && this._generateCategoryCodes(c); - this.observe(this, "_handleDragBlock", ["dragBlock"]); - this._scroll && (this._scroller = new Entry.BlockMenuScroller(this), this._addControl(b)); - Entry.documentMousedown && Entry.documentMousedown.attach(this, this.setSelectedBlock); - this._categoryCodes && Entry.keyPressed && Entry.keyPressed.attach(this, this._captureKeyEvent); - Entry.windowResized && (b = _.debounce(this.updateOffset, 200), Entry.windowResized.attach(this, b)); -}; -(function(b) { - b.schema = {code:null, dragBlock:null, closeBlock:null, selectedBlockView:null}; - b._generateView = function(a) { - var b = this.view, d = this; - a && (this._categoryCol = Entry.Dom("ul", {class:"entryCategoryListWorkspace", parent:b}), this._generateCategoryView(a)); - this.blockMenuContainer = Entry.Dom("div", {"class":"blockMenuContainer", parent:b}); - this.svgDom = Entry.Dom($(''), {parent:this.blockMenuContainer}); - this.svgDom.mouseenter(function(a) { - d._scroller && d._scroller.setOpacity(1); - a = d.workspace.selectedBlockView; - !Entry.playground || Entry.playground.resizing || a && a.dragMode === Entry.DRAG_MODE_DRAG || (Entry.playground.focusBlockMenu = !0, a = d.svgGroup.getBBox(), a = a.width + a.x + 64, a > Entry.interfaceState.menuWidth && (this.widthBackup = Entry.interfaceState.menuWidth - 64, $(this).stop().animate({width:a - 62}, 200))); - }); - this.svgDom.mouseleave(function(a) { - Entry.playground && !Entry.playground.resizing && (d._scroller && d._scroller.setOpacity(0), (a = this.widthBackup) && $(this).stop().animate({width:a}, 200), delete this.widthBackup, delete Entry.playground.focusBlockMenu); - }); - $(window).scroll(function() { - d.updateOffset(); - }); - }; - b.changeCode = function(a) { - if (!(a instanceof Entry.Code)) { - return console.error("You must inject code instance"); + console.log(this.canvas.getChildIndex(this.selectedObjectContainer)); +}; +Entry.Stage.prototype.createObjectContainer = function(a) { + var b = new createjs.Container; + b.scene = a; + return b; +}; +Entry.Stage.prototype.removeObjectContainer = function(a) { + var b = this.objectContainers; + a = this.getObjectContainerByScene(a); + this.canvas.removeChild(a); + b.splice(this.objectContainers.indexOf(a), 1); +}; +Entry.Stage.prototype.getObjectContainerByScene = function(a) { + for (var b = this.objectContainers, c = 0;c < b.length;c++) { + if (b[c].scene.id == a.id) { + return b[c]; } - this.codeListener && this.code.changeEvent.detach(this.codeListener); - var b = this; - this.set({code:a}); - this.codeListener = this.code.changeEvent.attach(this, function() { - b.changeEvent.notify(); + } +}; +Entry.Stage.prototype.moveSprite = function(a) { + if (this.selectedObject && Entry.stage.focused && !this.selectedObject.getLock()) { + var b = 5; + a.shiftKey && (b = 1); + var c = this.selectedObject.entity; + switch(a.keyCode) { + case 38: + c.setY(c.getY() + b); + break; + case 40: + c.setY(c.getY() - b); + break; + case 37: + c.setX(c.getX() - b); + break; + case 39: + c.setX(c.getX() + b); + } + this.updateObject(); + } +}; +Entry.Stage.prototype.getBoundRect = function(a) { + this._boundRect || this.updateBoundRect(); + return this._boundRect; +}; +Entry.Stage.prototype.updateBoundRect = function(a) { + this._boundRect = this.canvas.canvas.getBoundingClientRect(); +}; +Entry.StampEntity = function(a, b) { + this.parent = a; + this.type = a.objectType; + this.isStamp = this.isClone = !0; + this.width = b.getWidth(); + this.height = b.getHeight(); + "sprite" == this.type && (this.object = b.object.clone(!0), this.object.filters = null, b.effect && (this.effect = Entry.cloneSimpleObject(b.effect), this.applyFilter())); + this.object.entity = this; +}; +(function(a, b) { + a.applyFilter = b.applyFilter; + a.removeClone = b.removeClone; + a.getWidth = b.getWidth; + a.getHeight = b.getHeight; + a.getInitialEffectValue = b.getInitialEffectValue; +})(Entry.StampEntity.prototype, Entry.EntityObject.prototype); +Entry.Toast = function() { + this.toasts_ = []; + var a = document.getElementById("entryToastContainer"); + a && document.body.removeChild(a); + this.body_ = Entry.createElement("div", "entryToastContainer"); + this.body_.addClass("entryToastContainer"); + document.body.appendChild(this.body_); +}; +Entry.Toast.prototype.warning = function(a, b, c) { + var d = Entry.createElement("div", "entryToast"); + d.addClass("entryToast"); + d.addClass("entryToastWarning"); + d.bindOnClick(function() { + Entry.toast.body_.removeChild(this); + }); + var e = Entry.createElement("div", "entryToast"); + e.addClass("entryToastTitle"); + e.innerHTML = a; + d.appendChild(e); + a = Entry.createElement("p", "entryToast"); + a.addClass("entryToastMessage"); + a.innerHTML = b; + d.appendChild(a); + this.toasts_.push(d); + this.body_.appendChild(d); + c || window.setTimeout(function() { + d.style.opacity = 1; + var b = setInterval(function() { + .05 > d.style.opacity && (clearInterval(b), d.style.display = "none", Entry.removeElement(d)); + d.style.opacity *= .9; + }, 20); + }, 1E3); +}; +Entry.Toast.prototype.success = function(a, b, c) { + var d = Entry.createElement("div", "entryToast"); + d.addClass("entryToast"); + d.addClass("entryToastSuccess"); + d.bindOnClick(function() { + Entry.toast.body_.removeChild(this); + }); + var e = Entry.createElement("div", "entryToast"); + e.addClass("entryToastTitle"); + e.innerHTML = a; + d.appendChild(e); + a = Entry.createElement("p", "entryToast"); + a.addClass("entryToastMessage"); + a.innerHTML = b; + d.appendChild(a); + this.toasts_.push(d); + this.body_.appendChild(d); + c || window.setTimeout(function() { + d.style.opacity = 1; + var b = setInterval(function() { + .05 > d.style.opacity && (clearInterval(b), d.style.display = "none", Entry.removeElement(d)); + d.style.opacity *= .9; + }, 20); + }, 1E3); +}; +Entry.Toast.prototype.alert = function(a, b, c) { + var d = Entry.createElement("div", "entryToast"); + d.addClass("entryToast"); + d.addClass("entryToastAlert"); + d.bindOnClick(function() { + Entry.toast.body_.removeChild(this); + }); + var e = Entry.createElement("div", "entryToast"); + e.addClass("entryToastTitle"); + e.innerHTML = a; + d.appendChild(e); + a = Entry.createElement("p", "entryToast"); + a.addClass("entryToastMessage"); + a.innerHTML = b; + d.appendChild(a); + this.toasts_.push(d); + this.body_.appendChild(d); + c || window.setTimeout(function() { + d.style.opacity = 1; + var b = setInterval(function() { + .05 > d.style.opacity && (clearInterval(b), d.style.display = "none", Entry.toast.body_.removeChild(d)); + d.style.opacity *= .9; + }, 20); + }, 5E3); +}; +Entry.TvCast = function(a) { + this.generateView(a); +}; +p = Entry.TvCast.prototype; +p.init = function(a) { + this.tvCastHash = a; +}; +p.generateView = function(a) { + var b = Entry.createElement("div"); + b.addClass("entryContainerMovieWorkspace"); + b.addClass("entryRemove"); + this.movieContainer = b; + b = Entry.createElement("iframe"); + b.setAttribute("id", "tvCastIframe"); + b.setAttribute("allowfullscreen", ""); + b.setAttribute("frameborder", 0); + b.setAttribute("src", a); + this.movieFrame = b; + this.movieContainer.appendChild(this.movieFrame); +}; +p.getView = function() { + return this.movieContainer; +}; +p.resize = function() { + document.getElementById("entryContainerWorkspaceId"); + var a = document.getElementById("tvCastIframe"); + w = this.movieContainer.offsetWidth; + a.width = w + "px"; + a.height = 9 * w / 16 + "px"; +}; +Entry.ContextMenu = {}; +(function(a) { + a.visible = !1; + a.createDom = function() { + this.dom = Entry.Dom("ul", {id:"entry-contextmenu", parent:$("body")}); + this.dom.bind("mousedown touchstart", function(b) { + b.stopPropagation(); + }); + Entry.Utils.disableContextmenu(this.dom); + Entry.documentMousedown.attach(this, function() { + this.hide(); }); - a.createView(this); - this.align(); - }; - b.bindCodeView = function(a) { - this.svgBlockGroup.remove(); - this.svgThreadGroup.remove(); - this.svgBlockGroup = a.svgBlockGroup; - this.svgThreadGroup = a.svgThreadGroup; - this.svgGroup.appendChild(this.svgThreadGroup); - this.svgGroup.appendChild(this.svgBlockGroup); - this._scroller && this.svgGroup.appendChild(this._scroller.svgGroup); - }; - b.align = function(a) { - var b = this.code; - if (b) { - this._clearSplitters(); - b.view && !a && b.view.reDraw(); - a = b.getThreads(); - for (var b = 10, d = "LEFT" == this._align ? 10 : this.svgDom.width() / 2, e, f = 0, g = a.length;f < g;f++) { - var h = a[f].getFirstBlock(), k = h.view, h = Entry.block[h.type]; - this.checkBanClass(h) ? k.set({display:!1}) : (k.set({display:!0}), h = h.class, e && e !== h && (this._createSplitter(b), b += 15), e = h, h = d - k.offsetX, "CENTER" == this._align && (h -= k.width / 2), b -= k.offsetY, k._moveTo(h, b, !1), b += k.height + 15); - } - this.updateSplitters(); - this.changeEvent.notify(); - } }; - b.cloneToGlobal = function(a) { - if (!this._boardBlockView && null !== this.dragBlock) { - var b = this.workspace, d = b.getMode(), e = this.dragBlock, f = this._svgWidth, g = b.selectedBoard; - if (!g || d != Entry.Workspace.MODE_BOARD && d != Entry.Workspace.MODE_OVERLAYBOARD) { - Entry.GlobalSvg.setView(e, b.getMode()) && Entry.GlobalSvg.addControl(a); - } else { - if (g.code && (b = e.block, d = b.getThread(), b && d)) { - b = d.toJSON(!0); - this._boardBlockView = Entry.do("addThread", b).value.getFirstBlock().view; - var g = this.offset().top - g.offset().top, h, k; - if (b = this.dragBlock.mouseDownCoordinate) { - h = a.pageX - b.x, k = a.pageY - b.y; - } - this._boardBlockView._moveTo(e.x - f + (h || 0), e.y + g + (k || 0), !1); - this._boardBlockView.onMouseDown.call(this._boardBlockView, a); - this._boardBlockView.dragInstance.set({isNew:!0}); + a.show = function(b, a, d) { + this.dom || this.createDom(); + if (0 !== b.length) { + var e = this; + void 0 !== a && (this._className = a, this.dom.addClass(a)); + var f = this.dom; + f.empty(); + for (var g = 0, h = b.length;g < h;g++) { + var k = b[g], l = k.text, n = !1 !== k.enable, m = Entry.Dom("li", {parent:f}); + if (k.divider) { + a = "divider"; + } else { + a = n ? "menuAble" : "menuDisable"; + var q = Entry.Dom("span", {parent:m}); + q.text(l); + n && k.callback && function(b, a) { + b.mousedown(function(b) { + b.preventDefault(); + e.hide(); + a(b); + }); + }(q, k.callback); } + m.addClass(a); } + f.removeClass("entryRemove"); + this.visible = !0; + this.position(d || Entry.mouseCoordinate); } }; - b.terminateDrag = function() { - if (this._boardBlockView) { - var a = 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 b < a - d; - } - } - }; - b.getCode = function(a) { - return this._code; - }; - b.setSelectedBlock = function(a) { - var b = this.selectedBlockView; - b && b.removeSelected(); - a instanceof Entry.BlockView ? a.addSelected() : a = null; - this.set({selectedBlockView:a}); - }; - b.hide = function() { - this.view.addClass("entryRemove"); - }; - b.show = function() { - this.view.removeClass("entryRemove"); - }; - b.renderText = function() { - for (var a = this.code.getThreads(), b = 0;b < a.length;b++) { - a[b].view.renderText(); - } - }; - b.renderBlock = function() { - for (var a = this.code.getThreads(), b = 0;b < a.length;b++) { - a[b].view.renderBlock(); - } + a.position = function(b) { + var a = this.dom; + a.css({left:0, top:0}); + var d = a.width(), e = a.height(), f = $(window), g = f.width(), f = f.height(); + b.x + d > g && (b.x -= d + 3); + b.y + e > f && (b.y -= e); + a.css({left:b.x, top:b.y}); }; - b._createSplitter = function(a) { - a = this.svgBlockGroup.elem("line", {x1:20, y1:a, x2:this._svgWidth - 20, y2:a, stroke:"#b5b5b5"}); - this._splitters.push(a); + a.hide = function() { + this.visible = !1; + this.dom.empty(); + this.dom.addClass("entryRemove"); + this._className && (this.dom.removeClass(this._className), delete this._className); }; - b.updateSplitters = function(a) { - a = void 0 === a ? 0 : a; - var b = this._svgWidth - 20, d; - this._splitters.forEach(function(e) { - d = parseFloat(e.getAttribute("y1")) + a; - e.attr({x2:b, y1:d, y2:d}); +})(Entry.ContextMenu); +Entry.Loader = {queueCount:0, totalCount:0}; +Entry.Loader.addQueue = function(a) { + this.queueCount || Entry.dispatchEvent("loadStart"); + this.queueCount++; + this.totalCount++; +}; +Entry.Loader.removeQueue = function(a) { + this.queueCount--; + this.queueCount || (Entry.dispatchEvent("loadComplete"), this.totalCount = 0); +}; +Entry.Loader.getLoadedPercent = function() { + return 0 === this.totalCount ? 1 : this.queueCount / this.totalCount; +}; +Entry.Variable = function(a) { + Entry.assert("string" == typeof a.name, "Variable name must be given"); + this.name_ = a.name; + this.id_ = a.id ? a.id : Entry.generateHash(); + this.type = a.variableType ? a.variableType : "variable"; + this.object_ = a.object || null; + this.isCloud_ = a.isCloud || !1; + this._valueWidth = this._nameWidth = null; + var b = Entry.parseNumber(a.value); + this.value_ = "number" == typeof b ? b : a.value ? a.value : 0; + "slide" == this.type ? (this.setMinValue(a.minValue), this.setMaxValue(a.maxValue)) : "list" == this.type && (this.array_ = a.array ? a.array : []); + a.isClone || (this.visible_ = a.visible || "boolean" == typeof a.visible ? a.visible : !0, this.x_ = a.x ? a.x : null, this.y_ = a.y ? a.y : null, "list" == this.type && (this.width_ = a.width ? a.width : 100, this.height_ = a.height ? a.height : 120, this.scrollPosition = 0), this.BORDER = 6, this.FONT = "10pt NanumGothic"); +}; +Entry.Variable.prototype.generateView = function(a) { + var b = this.type; + if ("variable" == b || "timer" == b || "answer" == b) { + this.view_ = new createjs.Container, this.rect_ = new createjs.Shape, this.view_.addChild(this.rect_), this.view_.variable = this, this.wrapper_ = new createjs.Shape, this.view_.addChild(this.wrapper_), this.textView_ = new createjs.Text("asdf", this.FONT, "#000000"), this.textView_.textBaseline = "alphabetic", this.textView_.x = 4, this.textView_.y = 1, this.view_.addChild(this.textView_), this.valueView_ = new createjs.Text("asdf", "10pt NanumGothic", "#ffffff"), this.valueView_.textBaseline = + "alphabetic", b = Entry.variableContainer.variables_.length, this.getX() && this.getY() ? (this.setX(this.getX()), this.setY(this.getY())) : (this.setX(-230 + 80 * Math.floor(b / 11)), this.setY(24 * a + 20 - 135 - 264 * Math.floor(b / 11))), this.view_.visible = this.visible_, this.view_.addChild(this.valueView_), this.view_.on("mousedown", function(b) { + "workspace" == Entry.type && (this.offset = {x:this.x - (.75 * b.stageX - 240), y:this.y - (.75 * b.stageY - 135)}, this.cursor = "move"); + }), this.view_.on("pressmove", function(b) { + "workspace" == Entry.type && (this.variable.setX(.75 * b.stageX - 240 + this.offset.x), this.variable.setY(.75 * b.stageY - 135 + this.offset.y), this.variable.updateView()); }); - }; - b._clearSplitters = function() { - for (var a = this._splitters, b = a.length - 1;0 <= b;b--) { - a[b].remove(), a.pop(); - } - }; - b.setWidth = function() { - this._svgWidth = this.blockMenuContainer.width(); - this.updateSplitters(); - }; - b.setMenu = function() { - var a = this._categoryCodes, b = this._categoryElems, d; - for (d in a) { - for (var e = a[d], e = e instanceof Entry.Code ? e.getThreads() : e, f = e.length, g = 0;g < e.length;g++) { - var h = e[g], h = h instanceof Entry.Thread ? h.getFirstBlock().type : h[0].type; - this.checkBanClass(Entry.block[h]) && f--; - } - 0 === f ? b[d].addClass("entryRemove") : b[d].removeClass("entryRemove"); - } - }; - b.getCategoryCodes = function(a) { - a = this._convertSelector(a); - var b = this._categoryCodes[a]; - b || (this._generateCategoryElement(a), b = []); - b instanceof Entry.Code || (b = this._categoryCodes[a] = new Entry.Code(b)); - return b; - }; - b._convertSelector = function(a) { - if (isNaN(a)) { - return a; - } - a = Number(a); - for (var b = this._categories, d = this._categoryElems, e = 0;e < b.length;e++) { - var f = b[e]; - if (!d[f].hasClass("entryRemove") && 0 === a--) { - return f; - } - } - }; - b.selectMenu = function(a, b) { - var d = this._convertSelector(a); - if (d) { - "variable" == d && Entry.playground.checkVariables(); - "arduino" == d && this._generateHwCode(); - var e = this._categoryElems[d], f = this._selectedCategoryView, g = !1, h = this.workspace.board, k = h.view; - f && f.removeClass("entrySelectedCategory"); - e != f || b ? f || (this.visible || (g = !0, k.addClass("foldOut"), Entry.playground.showTabs()), k.removeClass("folding"), this.visible = !0) : (k.addClass("folding"), this._selectedCategoryView = null, e.removeClass("entrySelectedCategory"), Entry.playground.hideTabs(), g = !0, this.visible = !1); - g && Entry.bindAnimationCallbackOnce(k, function() { - h.scroller.resizeScrollBar.call(h.scroller); - k.removeClass("foldOut"); - Entry.windowResized.notify(); + } else { + if ("slide" == b) { + var c = this; + this.view_ = new createjs.Container; + this.rect_ = new createjs.Shape; + this.view_.addChild(this.rect_); + this.view_.variable = this; + this.wrapper_ = new createjs.Shape; + this.view_.addChild(this.wrapper_); + this.textView_ = new createjs.Text("name", this.FONT, "#000000"); + this.textView_.textBaseline = "alphabetic"; + this.textView_.x = 4; + this.textView_.y = 1; + this.view_.addChild(this.textView_); + this.valueView_ = new createjs.Text("value", "10pt NanumGothic", "#ffffff"); + this.valueView_.textBaseline = "alphabetic"; + this.view_.on("mousedown", function(b) { + "workspace" == Entry.type && (this.offset = {x:this.x - (.75 * b.stageX - 240), y:this.y - (.75 * b.stageY - 135)}); }); - this.visible && (f = this._categoryCodes[d], this._selectedCategoryView = e, e.addClass("entrySelectedCategory"), f.constructor !== Entry.Code && (f = this._categoryCodes[d] = new Entry.Code(f)), this.changeCode(f)); - this.lastSelector = d; - } - }; - b._generateCategoryCodes = function(a) { - this._categoryCodes = {}; - for (var b = 0;b < a.length;b++) { - var d = a[b], e = []; - d.blocks.forEach(function(a) { - var b = Entry.block[a]; - if (b && b.def) { - if (b.defs) { - for (a = 0;a < b.defs.length;a++) { - e.push([b.defs[a]]); - } - } else { - e.push([b.def]); - } - } else { - e.push([{type:a}]); - } + this.view_.on("pressmove", function(b) { + "workspace" != Entry.type || c.isAdjusting || (this.variable.setX(.75 * b.stageX - 240 + this.offset.x), this.variable.setY(.75 * b.stageY - 135 + this.offset.y), this.variable.updateView()); }); - d = d.category; - this._categories.push(d); - this._categoryCodes[d] = e; - } - }; - b.banClass = function(a, b) { - 0 > this._bannedClass.indexOf(a) && this._bannedClass.push(a); - this.align(b); - }; - b.unbanClass = function(a, b) { - var d = this._bannedClass.indexOf(a); - -1 < d && this._bannedClass.splice(d, 1); - this.align(b); - }; - b.checkBanClass = function(a) { - if (a) { - a = a.isNotFor; - for (var b in this._bannedClass) { - if (a && -1 < a.indexOf(this._bannedClass[b])) { - return !0; + this.view_.visible = this.visible_; + this.view_.addChild(this.valueView_); + b = this.textView_.getMeasuredWidth() + this.valueView_.getMeasuredWidth() + 26; + b = Math.max(b, 90); + this.maxWidth = b - 20; + this.slideBar_ = new createjs.Shape; + this.slideBar_.graphics.beginFill("#A0A1A1").s("#A0A1A1").ss(1).dr(10, 10, this.maxWidth, 1.5); + this.view_.addChild(this.slideBar_); + b = this.getSlidePosition(this.maxWidth); + this.valueSetter_ = new createjs.Shape; + this.valueSetter_.graphics.beginFill("#1bafea").s("#A0A1A1").ss(1).dc(b, 10.5, 3); + this.valueSetter_.cursor = "pointer"; + this.valueSetter_.on("mousedown", function(b) { + Entry.engine.isState("run") && (c.isAdjusting = !0, this.offsetX = -(this.x - .75 * b.stageX + 240)); + }); + this.valueSetter_.on("pressmove", function(b) { + if (Entry.engine.isState("run")) { + var a = this.offsetX; + this.offsetX = -(this.x - .75 * b.stageX + 240); + a !== this.offsetX && (b = c.getX(), c.setSlideCommandX(b + 10 > this.offsetX ? 0 : b + c.maxWidth + 10 > this.offsetX ? this.offsetX - b : c.maxWidth + 10)); } - } - return !1; - } - }; - b._addControl = function(a) { - var b = this; - a.on("wheel", function() { - b._mouseWheel.apply(b, arguments); - }); - b._scroller && $(this.svg).bind("mousedown touchstart", function(a) { - b.onMouseDown.apply(b, arguments); - }); - }; - b.onMouseDown = function(a) { - function b(a) { - a.stopPropagation && a.stopPropagation(); - a.preventDefault && a.preventDefault(); - a = Entry.Utils.convertMouseEvent(a); - var c = e.dragInstance; - e._scroller.scroll(-a.pageY + c.offsetY); - c.set({offsetY:a.pageY}); - } - function d(a) { - $(document).unbind(".blockMenu"); - delete e.dragInstance; - } - a.stopPropagation && a.stopPropagation(); - a.preventDefault && a.preventDefault(); - var e = this; - if (0 === a.button || a.originalEvent && a.originalEvent.touches) { - a = Entry.Utils.convertMouseEvent(a); - Entry.documentMousedown && Entry.documentMousedown.notify(a); - var f = $(document); - f.bind("mousemove.blockMenu", b); - f.bind("mouseup.blockMenu", d); - f.bind("touchmove.blockMenu", b); - f.bind("touchend.blockMenu", d); - this.dragInstance = new Entry.DragInstance({startY:a.pageY, offsetY:a.pageY}); - } - }; - b._mouseWheel = function(a) { - a = a.originalEvent; - a.preventDefault(); - var b = Entry.disposeEvent; - b && b.notify(a); - this._scroller.scroll(-a.wheelDeltaY || a.deltaY / 3); - }; - b.dominate = function(a) { - this.svgBlockGroup.appendChild(a.view.svgGroup); - }; - b.reDraw = function() { - this.selectMenu(this.lastSelector, !0); - }; - b._handleDragBlock = function() { - this._boardBlockView = null; - this._scroller && this._scroller.setOpacity(0); - }; - b._captureKeyEvent = function(a) { - var b = a.keyCode, d = Entry.type; - a.ctrlKey && "workspace" == d && 48 < b && 58 > b && (a.preventDefault(), this.selectMenu(b - 49)); - }; - b.setPatternRectFill = function(a) { - this.patternRect.attr({fill:a}); - this.pattern.attr({style:""}); - }; - b.disablePattern = function() { - this.pattern.attr({style:"display: none"}); - }; - b._clearCategory = function() { - this._selectedCategoryView = null; - this._categories = []; - var a = this._categoryElems, b; - for (b in a) { - a[b].remove(); - } - this._categoryElems = {}; - a = this._categoryCodes; - for (b in a) { - var d = a[b]; - d.constructor == Entry.Code && d.clear(); - } - this._categoryCodes = null; - }; - b.setCategoryData = function(a) { - this._clearCategory(); - this._categoryData = a; - this._generateCategoryView(a); - this._generateCategoryCodes(a); - }; - b._generateCategoryView = function(a) { - if (a) { - for (var b = 0;b < a.length;b++) { - this._generateCategoryElement(a[b].category); - } - } - }; - b._generateCategoryElement = function(a) { - var b = this; - (function(a, e) { - a.text(Lang.Blocks[e.toUpperCase()]); - b._categoryElems[e] = a; - a.bindOnClick(function(a) { - b.selectMenu(e); }); - })(Entry.Dom("li", {id:"entryCategory" + a, class:"entryCategoryElementWorkspace", parent:this._categoryCol}), a); - }; - b.updateOffset = function() { - this._offset = this.svgDom.offset(); - }; - b.offset = function() { - (!this._offset || 0 === this._offset.top && 0 === this._offset.left) && this.updateOffset(); - return this._offset; - }; - b._generateHwCode = function() { - var a = this._categoryCodes.arduino; - a instanceof Entry.Code && a.clear(); - for (var b = this._categoryData, d, a = b.length - 1;0 <= a;a--) { - if ("arduino" === b[a].category) { - d = b[a].blocks; - break; - } + this.valueSetter_.on("pressup", function(b) { + c.isAdjusting = !1; + }); + this.view_.addChild(this.valueSetter_); + b = Entry.variableContainer.variables_.length; + this.getX() && this.getY() ? (this.setX(this.getX()), this.setY(this.getY())) : (this.setX(-230 + 80 * Math.floor(b / 11)), this.setY(24 * a + 20 - 135 - 264 * Math.floor(b / 11))); + } else { + this.view_ = new createjs.Container, this.rect_ = new createjs.Shape, this.view_.addChild(this.rect_), this.view_.variable = this, this.titleView_ = new createjs.Text("asdf", this.FONT, "#000"), this.titleView_.textBaseline = "alphabetic", this.titleView_.textAlign = "center", this.titleView_.width = this.width_ - 2 * this.BORDER, this.titleView_.y = this.BORDER + 10, this.titleView_.x = this.width_ / 2, this.view_.addChild(this.titleView_), this.resizeHandle_ = new createjs.Shape, this.resizeHandle_.graphics.f("#1bafea").ss(1, + 0, 0).s("#1bafea").lt(0, -9).lt(-9, 0).lt(0, 0), this.view_.addChild(this.resizeHandle_), this.resizeHandle_.list = this, this.resizeHandle_.on("mouseover", function(b) { + this.cursor = "nwse-resize"; + }), this.resizeHandle_.on("mousedown", function(b) { + this.list.isResizing = !0; + this.offset = {x:.75 * b.stageX - this.list.getWidth(), y:.75 * b.stageY - this.list.getHeight()}; + this.parent.cursor = "nwse-resize"; + }), this.resizeHandle_.on("pressmove", function(b) { + this.list.setWidth(.75 * b.stageX - this.offset.x); + this.list.setHeight(.75 * b.stageY - this.offset.y); + this.list.updateView(); + }), this.view_.on("mouseover", function(b) { + this.cursor = "move"; + }), this.view_.on("mousedown", function(b) { + "workspace" != Entry.type || this.variable.isResizing || (this.offset = {x:this.x - (.75 * b.stageX - 240), y:this.y - (.75 * b.stageY - 135)}, this.cursor = "move"); + }), this.view_.on("pressup", function(b) { + this.cursor = "initial"; + this.variable.isResizing = !1; + }), this.view_.on("pressmove", function(b) { + "workspace" != Entry.type || this.variable.isResizing || (this.variable.setX(.75 * b.stageX - 240 + this.offset.x), this.variable.setY(.75 * b.stageY - 135 + this.offset.y), this.variable.updateView()); + }), this.elementView = new createjs.Container, b = new createjs.Text("asdf", this.FONT, "#000"), b.textBaseline = "middle", b.y = 5, this.elementView.addChild(b), this.elementView.indexView = b, b = new createjs.Shape, this.elementView.addChild(b), this.elementView.valueWrapper = b, b = new createjs.Text("fdsa", this.FONT, "#eee"), b.x = 24, b.y = 6, b.textBaseline = "middle", this.elementView.addChild(b), this.elementView.valueView = b, this.elementView.x = this.BORDER, this.scrollButton_ = + new createjs.Shape, this.scrollButton_.graphics.f("#aaa").rr(0, 0, 7, 30, 3.5), this.view_.addChild(this.scrollButton_), this.scrollButton_.y = 23, this.scrollButton_.list = this, this.scrollButton_.on("mousedown", function(b) { + this.list.isResizing = !0; + this.cursor = "pointer"; + this.offsetY = isNaN(this.offsetY) || 0 > this.offsetY ? b.rawY / 2 : this.offsetY; + }), this.scrollButton_.on("pressmove", function(b) { + void 0 === this.moveAmount ? (this.y = b.target.y, this.moveAmount = !0) : this.y = b.rawY / 2 - this.offsetY + this.list.height_ / 100 * 23; + 23 > this.y && (this.y = 23); + this.y > this.list.getHeight() - 40 && (this.y = this.list.getHeight() - 40); + this.list.updateView(); + }), this.scrollButton_.on("pressup", function(b) { + this.moveAmount = void 0; + }), this.getX() && this.getY() ? (this.setX(this.getX()), this.setY(this.getY())) : (b = Entry.variableContainer.lists_.length, this.setX(110 * -Math.floor(b / 6) + 120), this.setY(24 * a + 20 - 135 - 145 * Math.floor(b / 6))); } - b = []; - for (a = 0;a < d.length;a++) { - var e = d[a], f = Entry.block[e]; - if (!this.checkBanClass(f)) { - if (f && f.def) { - if (f.defs) { - for (a = 0;a < f.defs.length;a++) { - b.push([f.defs[a]]); + } + this.setVisible(this.isVisible()); + this.updateView(); + Entry.stage.loadVariable(this); +}; +Entry.Variable.prototype.updateView = function() { + if (this.view_) { + if (this.isVisible()) { + if ("variable" == this.type) { + this.view_.x = this.getX(); + this.view_.y = this.getY(); + if (this.object_) { + var a = Entry.container.getObject(this.object_); + this.textView_.text = a ? a.name + ":" + this.getName() : this.getName(); + } else { + this.textView_.text = this.getName(); + } + null === this._nameWidth && (this._nameWidth = this.textView_.getMeasuredWidth()); + this.valueView_.x = this._nameWidth + 14; + this.valueView_.y = 1; + this.isNumber() ? this.valueView_.text = this.getValue().toFixed(2).replace(".00", "") : this.valueView_.text = this.getValue(); + null === this._valueWidth && (this._valueWidth = this.valueView_.getMeasuredWidth()); + this.rect_.graphics.clear().f("#ffffff").ss(1, 2, 0).s("#A0A1A1").rc(0, -14, this._nameWidth + this._valueWidth + 26, 20, 4, 4, 4, 4); + this.wrapper_.graphics.clear().f("#1bafea").ss(1, 2, 0).s("#1bafea").rc(this._nameWidth + 7, -11, this._valueWidth + 15, 14, 7, 7, 7, 7); + } else { + if ("slide" == this.type) { + this.view_.x = this.getX(), this.view_.y = this.getY(), this.object_ ? (a = Entry.container.getObject(this.object_), this.textView_.text = a ? a.name + ":" + this.getName() : this.getName()) : this.textView_.text = this.getName(), null === this._nameWidth && (this._nameWidth = this.textView_.getMeasuredWidth()), this.valueView_.x = this._nameWidth + 14, this.valueView_.y = 1, this.isNumber() ? this.valueView_.text = this.getValue().toFixed(2).replace(".00", "") : this.valueView_.text = + this.getValue(), null === this._valueWidth && (this._valueWidth = this.valueView_.getMeasuredWidth()), a = this._nameWidth + this._valueWidth + 26, a = Math.max(a, 90), this.rect_.graphics.clear().f("#ffffff").ss(1, 2, 0).s("#A0A1A1").rc(0, -14, a, 33, 4, 4, 4, 4), this.wrapper_.graphics.clear().f("#1bafea").ss(1, 2, 0).s("#1bafea").rc(this._nameWidth + 7, -11, this._valueWidth + 15, 14, 7, 7, 7, 7), a = this._nameWidth + this._valueWidth + 26, a = Math.max(a, 90), this.maxWidth = a - 20, + this.slideBar_.graphics.clear().beginFill("#A0A1A1").s("#A0A1A1").ss(1).dr(10, 10, this.maxWidth, 1.5), a = this.getSlidePosition(this.maxWidth), this.valueSetter_.graphics.clear().beginFill("#1bafea").s("#A0A1A1").ss(1).dc(a, 10.5, 3); + } else { + if ("list" == this.type) { + this.view_.x = this.getX(); + this.view_.y = this.getY(); + this.resizeHandle_.x = this.width_ - 2; + this.resizeHandle_.y = this.height_ - 2; + var b = this.getName(); + this.object_ && (a = Entry.container.getObject(this.object_)) && (b = a.name + ":" + b); + b = 7 < b.length ? b.substr(0, 6) + ".." : b; + this.titleView_.text = b; + this.titleView_.x = this.width_ / 2; + for (this.rect_.graphics.clear().f("#ffffff").ss(1, 2, 0).s("#A0A1A1").rect(0, 0, this.width_, this.height_);this.view_.children[4];) { + this.view_.removeChild(this.view_.children[4]); + } + a = Math.floor((this.getHeight() - 20) / 20); + a < this.array_.length ? (this.scrollButton_.y > this.getHeight() - 40 && (this.scrollButton_.y = this.getHeight() - 40), this.elementView.valueWrapper.graphics.clear().f("#1bafea").rr(20, -2, this.getWidth() - 20 - 10 - 2 * this.BORDER, 17, 2), this.scrollButton_.visible = !0, this.scrollButton_.x = this.getWidth() - 12, this.scrollPosition = Math.floor((this.scrollButton_.y - 23) / (this.getHeight() - 23 - 40) * (this.array_.length - a))) : (this.elementView.valueWrapper.graphics.clear().f("#1bafea").rr(20, + -2, this.getWidth() - 20 - 2 * this.BORDER, 17, 2), this.scrollButton_.visible = !1, this.scrollPosition = 0); + for (b = this.scrollPosition;b < this.scrollPosition + a && b < this.array_.length;b++) { + this.elementView.indexView.text = b + 1; + var c = String(this.array_[b].data), d = Math.floor((this.getWidth() - 50) / 7), c = Entry.cutStringByLength(c, d), c = String(this.array_[b].data).length > c.length ? c + ".." : c; + this.elementView.valueView.text = c; + c = this.elementView.clone(!0); + c.y = 20 * (b - this.scrollPosition) + 23; + this.view_.addChild(c); } } else { - b.push([f.def]); + "answer" == this.type ? (this.view_.x = this.getX(), this.view_.y = this.getY(), this.textView_.text = this.getName(), this.valueView_.y = 1, this.isNumber() ? parseInt(this.getValue(), 10) == this.getValue() ? this.valueView_.text = this.getValue() : this.valueView_.text = this.getValue().toFixed(1).replace(".00", "") : this.valueView_.text = this.getValue(), null === this._nameWidth && (this._nameWidth = this.textView_.getMeasuredWidth()), null === this._valueWidth && (this._valueWidth = + this.valueView_.getMeasuredWidth()), this.valueView_.x = this._nameWidth + 14, this.rect_.graphics.clear().f("#ffffff").ss(1, 2, 0).s("#A0A1A1").rc(0, -14, this._nameWidth + this._valueWidth + 26, 20, 4, 4, 4, 4), this.wrapper_.graphics.clear().f("#E457DC").ss(1, 2, 0).s("#E457DC").rc(this._nameWidth + 7, -11, this._valueWidth + 15, 14, 7, 7, 7, 7)) : (this.view_.x = this.getX(), this.view_.y = this.getY(), this.textView_.text = this.getName(), null === this._nameWidth && (this._nameWidth = + this.textView_.getMeasuredWidth()), this.valueView_.x = this._nameWidth + 14, this.valueView_.y = 1, this.isNumber() ? this.valueView_.text = this.getValue().toFixed(1).replace(".00", "") : this.valueView_.text = this.getValue(), null === this._valueWidth && (this._valueWidth = this.valueView_.getMeasuredWidth()), this.rect_.graphics.clear().f("#ffffff").ss(1, 2, 0).s("#A0A1A1").rc(0, -14, this._nameWidth + this._valueWidth + 26, 20, 4, 4, 4, 4), this.wrapper_.graphics.clear().f("#ffbb14").ss(1, + 2, 0).s("orange").rc(this._nameWidth + 7, -11, this._valueWidth + 15, 14, 7, 7, 7, 7)); } - } else { - b.push([{type:e}]); } } } - this._categoryCodes.arduino = b; - }; -})(Entry.BlockMenu.prototype); -Entry.BlockMenuScroller = function(b) { - var a = this; - this.board = b; - this.board.changeEvent.attach(this, this._reset); - this.svgGroup = null; - this.vRatio = this.vY = this.vWidth = this.hX = 0; - this._visible = !0; - this._opacity = -1; - this.mouseHandler = function() { - a.onMouseDown.apply(a, arguments); - }; - this.createScrollBar(); - this.setOpacity(0); - this._addControl(); - Entry.windowResized && Entry.windowResized.attach(this, this.resizeScrollBar); + Entry.requestUpdate = !0; + } }; -Entry.BlockMenuScroller.RADIUS = 7; -(function(b) { - b.createScrollBar = function() { - this.svgGroup = this.board.svgGroup.elem("g", {class:"boardScrollbar"}); - this.vScrollbar = this.svgGroup.elem("rect", {rx:4, ry:4}); - this.resizeScrollBar(); - }; - b.resizeScrollBar = function() { - this._updateRatio(); - if (this._visible && 0 !== this.vRatio) { - var a = this.board.blockMenuContainer; - this.vScrollbar.attr({width:9, height:a.height() / this.vRatio, x:a.width() - 9}); - } - }; - b.updateScrollBar = function(a) { - this.vY += a; - this.vScrollbar.attr({y:this.vY}); - }; - b.scroll = function(a) { - this.isVisible() && (a = this._adjustValue(a) - this.vY, 0 !== a && (this.board.code.moveBy(0, -a * this.vRatio), this.updateScrollBar(a))); - }; - b._adjustValue = function(a) { - var b = this.board.svgDom.height(), b = b - b / this.vRatio; - a = this.vY + a; - a = Math.max(0, a); - return a = Math.min(b, a); - }; - b.setVisible = function(a) { - a != this.isVisible() && (this._visible = a, this.svgGroup.attr({display:!0 === a ? "block" : "none"})); - }; - b.setOpacity = function(a) { - this._opacity != a && (this.vScrollbar.attr({opacity:a}), this._opacity = a); - }; - b.isVisible = function() { - return this._visible; - }; - b._updateRatio = function() { - var a = this.board, b = a.svgBlockGroup.getBoundingClientRect(), d = a.blockMenuContainer.height(), a = a.offset(); - this.vRatio = b = (b.height + (b.top - a.top) + 10) / d; - 1 >= b ? this.setVisible(!1) : this.setVisible(!0); - }; - b._reset = function() { - this.vY = 0; - this.vScrollbar.attr({y:this.vY}); - this.resizeScrollBar(); - }; - b.onMouseDown = function(a) { - function b(a) { - a.stopPropagation && a.stopPropagation(); - a.preventDefault && a.preventDefault(); - a = a.originalEvent && a.originalEvent.touches ? a.originalEvent.touches[0] : a; - var c = e.dragInstance; - e.scroll(a.pageY - c.offsetY); - c.set({offsetY:a.pageY}); - } - function d(a) { - $(document).unbind(".scroll"); - delete e.dragInstance; - } - var e = this; - a.stopPropagation && a.stopPropagation(); - a.preventDefault && a.preventDefault(); - if (0 === a.button || a.originalEvent && a.originalEvent.touches) { - Entry.documentMousedown && Entry.documentMousedown.notify(a); - var f; - f = a.originalEvent && a.originalEvent.touches ? a.originalEvent.touches[0] : a; - var g = $(document); - g.bind("mousemove.scroll", b); - g.bind("mouseup.scroll", d); - g.bind("touchmove.scroll", b); - g.bind("touchend.scroll", d); - e.dragInstance = new Entry.DragInstance({startY:f.pageY, offsetY:f.pageY}); - } - a.stopPropagation(); - }; - b._addControl = function() { - $(this.vScrollbar).bind("mousedown touchstart", this.mouseHandler); - }; -})(Entry.BlockMenuScroller.prototype); -Entry.BlockView = function(b, a, c) { - Entry.Model(this, !1); - this.block = b; - this._lazyUpdatePos = _.debounce(b._updatePos.bind(b), 200); - this._board = a; - this._observers = []; - this.set(b); - this.svgGroup = a.svgBlockGroup.elem("g"); - this._schema = Entry.block[b.type]; - this._schema.changeEvent && (this._schemaChangeEvent = this._schema.changeEvent.attach(this, this._updateSchema)); - var d = this._skeleton = Entry.skeleton[this._schema.skeleton]; - this._contents = []; - this._statements = []; - this.magnet = {}; - this._paramMap = {}; - d.magnets && d.magnets(this).next && (this.svgGroup.nextMagnet = this.block, this._nextGroup = this.svgGroup.elem("g"), this._observers.push(this.observe(this, "_updateMagnet", ["contentHeight"]))); - this.isInBlockMenu = this.getBoard() instanceof Entry.BlockMenu; - var e = this; - this.mouseHandler = function() { - var a = e.block.events; - a && a.mousedown && a.mousedown.forEach(function(a) { - a(e); - }); - e.onMouseDown.apply(e, arguments); - }; - this._startRender(b, c); - this._observers.push(this.block.observe(this, "_setMovable", ["movable"])); - this._observers.push(this.block.observe(this, "_setReadOnly", ["movable"])); - this._observers.push(this.block.observe(this, "_setCopyable", ["copyable"])); - this._observers.push(this.block.observe(this, "_updateColor", ["deletable"], !1)); - this._observers.push(this.observe(this, "_updateBG", ["magneting"], !1)); - this._observers.push(this.observe(this, "_updateOpacity", ["visible"], !1)); - this._observers.push(this.observe(this, "_updateDisplay", ["display"], !1)); - this._observers.push(this.observe(this, "_updateShadow", ["shadow"])); - this._observers.push(this.observe(this, "_updateMagnet", ["offsetY"])); - this._observers.push(a.code.observe(this, "_setBoard", ["board"], !1)); - this.dragMode = Entry.DRAG_MODE_NONE; - Entry.Utils.disableContextmenu(this.svgGroup.node); - a = b.events.viewAdd; - "workspace" == Entry.type && a && !this.isInBlockMenu && a.forEach(function(a) { - Entry.Utils.isFunction(a) && a(b); +Entry.Variable.prototype.getName = function() { + return this.name_; +}; +Entry.Variable.prototype.setName = function(a) { + Entry.assert("string" == typeof a, "Variable name must be string"); + this.name_ = a; + this._nameWidth = null; + this.updateView(); + Entry.requestUpdateTwice = !0; +}; +Entry.Variable.prototype.getId = function() { + return this.id_; +}; +Entry.Variable.prototype.getValue = function() { + return this.isNumber() ? Number(this.value_) : this.value_; +}; +Entry.Variable.prototype.isNumber = function() { + return isNaN(this.value_) ? !1 : !0; +}; +Entry.Variable.prototype.setValue = function(a) { + "slide" != this.type ? this.value_ = a : (a = Number(a), this.value_ = a < this.minValue_ ? this.minValue_ : a > this.maxValue_ ? this.maxValue_ : a); + this.isCloud_ && Entry.variableContainer.updateCloudVariables(); + this._valueWidth = null; + this.updateView(); + Entry.requestUpdateTwice = !0; +}; +Entry.Variable.prototype.isVisible = function() { + return this.visible_; +}; +Entry.Variable.prototype.setVisible = function(a) { + Entry.assert("boolean" == typeof a, "Variable visible state must be boolean"); + this.visible !== a && (this.visible_ = this.view_.visible = a, this.updateView()); +}; +Entry.Variable.prototype.setX = function(a) { + this.x_ = a; + this.updateView(); +}; +Entry.Variable.prototype.getX = function() { + return this.x_; +}; +Entry.Variable.prototype.setY = function(a) { + this.y_ = a; + this.updateView(); +}; +Entry.Variable.prototype.getY = function() { + return this.y_; +}; +Entry.Variable.prototype.setWidth = function(a) { + this.width_ = 100 > a ? 100 : a; + this.updateView(); +}; +Entry.Variable.prototype.getWidth = function() { + return this.width_; +}; +Entry.Variable.prototype.isInList = function(a, b) { + this.getX(); + this.getY(); +}; +Entry.Variable.prototype.setHeight = function(a) { + this.height_ = 100 > a ? 100 : a; + 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(a) { + this.setX(a.x); + this.setY(a.y); + this.id_ = a.id; + this.setVisible(a.visible); + this.setValue(a.value); + this.setName(a.name); + this.isCloud_ = a.isCloud; + "list" == this.type && (this.setWidth(a.width), this.setHeight(a.height), this.array_ = a.array); +}; +Entry.Variable.prototype.toJSON = function() { + var a = {}; + a.name = this.name_; + a.id = this.id_; + a.visible = this.visible_; + a.value = this.value_; + a.variableType = this.type; + "list" == this.type ? (a.width = this.getWidth(), a.height = this.getHeight(), a.array = JSON.parse(JSON.stringify(this.array_))) : "slide" == this.type && (a.minValue = this.minValue_, a.maxValue = this.maxValue_); + a.isCloud = this.isCloud_; + a.object = this.object_; + a.x = this.x_; + a.y = this.y_; + return a; +}; +Entry.Variable.prototype.remove = function() { + Entry.stage.removeVariable(this); +}; +Entry.Variable.prototype.clone = function() { + var a = this.toJSON(); + a.isClone = !0; + return a = new Entry.Variable(a); +}; +Entry.Variable.prototype.getType = function() { + return this.type; +}; +Entry.Variable.prototype.setType = function(a) { + this.type = a; +}; +Entry.Variable.prototype.getSlidePosition = function(a) { + var b = this.minValue_; + return Math.abs(this.value_ - b) / Math.abs(this.maxValue_ - b) * a + 10; +}; +Entry.Variable.prototype.setSlideCommandX = function(a) { + var b = this.valueSetter_.graphics.command; + a = Math.max("undefined" == typeof a ? 10 : a, 10); + a = Math.min(this.maxWidth + 10, a); + b.x = a; + this.updateSlideValueByView(); +}; +Entry.Variable.prototype.updateSlideValueByView = function() { + var a = Math.max(this.valueSetter_.graphics.command.x - 10, 0) / this.maxWidth; + 0 > a && (a = 0); + 1 < a && (a = 1); + var b = parseFloat(this.minValue_), c = parseFloat(this.maxValue_), a = (b + Number(Math.abs(c - b) * a)).toFixed(2), a = parseFloat(a); + a < b ? a = this.minValue_ : a > c && (a = this.maxValue_); + this.isFloatPoint() || (a = Math.round(a)); + this.setValue(a); +}; +Entry.Variable.prototype.getMinValue = function() { + return this.minValue_; +}; +Entry.Variable.prototype.setMinValue = function(a) { + this.minValue_ = a = a || 0; + this.value_ < a && this.setValue(a); + this.updateView(); + this.isMinFloat = Entry.isFloat(this.minValue_); +}; +Entry.Variable.prototype.getMaxValue = function() { + return this.maxValue_; +}; +Entry.Variable.prototype.setMaxValue = function(a) { + this.maxValue_ = a = a || 100; + this.value_ > a && (this.value_ = a); + 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(a) { + var b = this; + this.view_ = a; + 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(a) { + a = f.variableAddPanel; + var c = a.view.name.value.trim(); + a.isOpen ? c && 0 !== c.length ? b.addVariable() : (a.view.addClass("entryRemove"), a.isOpen = !1) : (a.view.removeClass("entryRemove"), a.view.name.focus(), a.isOpen = !0); + }); + this.generateVariableAddView(); + this.generateListAddView(); + this.generateVariableSplitterView(); + this.generateVariableSettingView(); + this.generateListSettingView(); + c = Entry.createElement("li"); + c.addClass("entryVariableAddWorkspace"); + c.addClass("entryVariableListElementWorkspace"); + c.innerHTML = "+ " + Lang.Workspace.message_create; + this.messageAddButton_ = c; + c.bindOnClick(function(a) { + b.addMessage({name:Lang.Workspace.message + " " + (b.messages_.length + 1)}); + }); + c = Entry.createElement("li"); + c.addClass("entryVariableAddWorkspace"); + c.addClass("entryVariableListElementWorkspace"); + c.innerHTML = "+ " + Lang.Workspace.list_create; + this.listAddButton_ = c; + c.bindOnClick(function(a) { + a = f.listAddPanel; + var c = a.view.name.value.trim(); + a.isOpen ? c && 0 !== c.length ? b.addList() : (a.view.addClass("entryRemove"), a.isOpen = !1) : (a.view.removeClass("entryRemove"), a.view.name.focus(), a.isOpen = !0); + }); + c = Entry.createElement("li"); + c.addClass("entryVariableAddWorkspace"); + c.addClass("entryVariableListElementWorkspace"); + c.innerHTML = "+ " + Lang.Workspace.function_add; + this.functionAddButton_ = c; + c.bindOnClick(function(a) { + a = b._getBlockMenu(); + Entry.playground.changeViewMode("code"); + "func" != a.lastSelector && a.selectMenu("func"); + b.createFunction(); }); + return a; }; -Entry.BlockView.PARAM_SPACE = 5; -Entry.BlockView.DRAG_RADIUS = 5; -Entry.BlockView.pngMap = {}; -(function(b) { - b.schema = {id:0, type:Entry.STATIC.BLOCK_RENDER_MODEL, x:0, y:0, offsetX:0, offsetY:0, width:0, height:0, contentWidth:0, contentHeight:0, magneting:!1, visible:!0, animating:!1, shadow:!0, display:!0}; - b._startRender = function(a, b) { - var d = this, e = this._skeleton; - this.svgGroup.attr({class:"block"}); - var f = e.classes; - f && 0 !== f.length && f.forEach(function(a) { - d.svgGroup.addClass(a); +Entry.VariableContainer.prototype.createSelectButton = function(a, b) { + var c = this; + void 0 === b && (b = !0); + var d = Entry.createElement("td"); + d.addClass("entryVariableSelectButtonWorkspace", a); + d.innerHTML = Lang.Workspace[a]; + b ? d.bindOnClick(function(b) { + c.selectFilter(a); + this.addClass("selected"); + }) : d.addClass("disable"); + return d; +}; +Entry.VariableContainer.prototype.selectFilter = function(a) { + for (var b = this.view_.getElementsByTagName("td"), c = 0;c < b.length;c++) { + b[c].removeClass("selected"), b[c].hasClass(a) && b[c].addClass("selected"); + } + this.viewMode_ = a; + this.select(); + this.updateList(); +}; +Entry.VariableContainer.prototype.updateVariableAddView = function(a) { + a = "variable" == (a ? a : "variable") ? this.variableAddPanel : this.listAddPanel; + var b = a.info, c = a.view; + a.view.addClass("entryRemove"); + c.cloudCheck.removeClass("entryVariableAddChecked"); + c.localCheck.removeClass("entryVariableAddChecked"); + c.globalCheck.removeClass("entryVariableAddChecked"); + c.cloudWrapper.removeClass("entryVariableAddSpaceUnCheckedWorkspace"); + b.isCloud && c.cloudCheck.addClass("entryVariableAddChecked"); + a.isOpen && (c.removeClass("entryRemove"), c.name.focus()); + b.object ? (c.localCheck.addClass("entryVariableAddChecked"), c.cloudWrapper.addClass("entryVariableAddSpaceUnCheckedWorkspace")) : c.globalCheck.addClass("entryVariableAddChecked"); +}; +Entry.VariableContainer.prototype.select = function(a) { + a = this.selected == a ? null : a; + this.selected && (this.selected.listElement.removeClass("selected"), this.selected.callerListElement && (this.listView_.removeChild(this.selected.callerListElement), delete this.selected.callerListElement), this.selected = null); + a && (a.listElement.addClass("selected"), this.selected = a, a instanceof Entry.Variable ? (this.renderVariableReference(a), a.object_ && Entry.container.selectObject(a.object_, !0)) : a instanceof Entry.Func ? this.renderFunctionReference(a) : this.renderMessageReference(a)); +}; +Entry.VariableContainer.prototype.renderMessageReference = function(a) { + for (var b = this, c = this._messageRefs, d = a.id, e = [], f = 0;f < c.length;f++) { + -1 < c[f].block.params.indexOf(d) && e.push(c[f]); + } + c = Entry.createElement("ul"); + c.addClass("entryVariableListCallerListWorkspace"); + for (f in e) { + var d = e[f], g = Entry.createElement("li"); + g.addClass("entryVariableListCallerWorkspace"); + g.appendChild(d.object.thumbnailView_.cloneNode()); + var h = Entry.createElement("div"); + h.addClass("entryVariableListCallerNameWorkspace"); + h.innerHTML = d.object.name + " : " + Lang.Blocks["START_" + d.block.type]; + g.appendChild(h); + g.caller = d; + g.message = a; + g.bindOnClick(function(a) { + Entry.playground.object != this.caller.object && (Entry.container.selectObject(), Entry.container.selectObject(this.caller.object.id, !0), b.select(null), b.select(this.message)); + Entry.playground.toggleOnVariableView(); + Entry.playground.changeViewMode("variable"); }); - f = e.path(this); - this.pathGroup = this.svgGroup.elem("g"); - this._updateMagnet(); - this._path = this.pathGroup.elem("path"); - this.getBoard().patternRect && ($(this._path).mouseenter(function(a) { - d._mouseEnable && d._changeFill(!0); - }), $(this._path).mouseleave(function(a) { - d._mouseEnable && d._changeFill(!1); - })); - var g = this._schema.color; - this.block.deletable === Entry.Block.DELETABLE_FALSE_LIGHTEN && (g = Entry.Utils.colorLighten(g)); - this._fillColor = g; - f = {d:f, fill:g, class:"blockPath"}; - if (this.magnet.next || this._skeleton.nextShadow) { - g = this.getBoard().suffix, this.pathGroup.attr({filter:"url(#entryBlockShadowFilter_" + g + ")"}); - } else { - if (this.magnet.string || this.magnet.boolean) { - f.stroke = e.outerLine; - } - } - e.outerLine && (f["stroke-width"] = "0.6"); - this._path.attr(f); - this._moveTo(this.x, this.y, !1); - this._startContentRender(b); - !0 !== this._board.disableMouseEvent && this._addControl(); - this.bindPrev(); - }; - b._startContentRender = function(a) { - a = void 0 === a ? Entry.Workspace.MODE_BOARD : a; - this.contentSvgGroup && this.contentSvgGroup.remove(); - var b = this._schema; - b.statements && b.statements.length && this.statementSvgGroup && this.statementSvgGroup.remove(); - this._contents = []; - this.contentSvgGroup = this.svgGroup.elem("g"); - b.statements && b.statements.length && (this.statementSvgGroup = this.svgGroup.elem("g")); - switch(a) { - case Entry.Workspace.MODE_BOARD: - ; - case Entry.Workspace.MODE_OVERLAYBOARD: - for (var d = /(%\d)/mi, e = (b.template ? b.template : Lang.template[this.block.type]).split(d), f = b.params, g = 0;g < e.length;g++) { - 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); - this._contents.push(h); - this._paramMap[k] = h; - } else { - this._contents.push(new Entry.FieldText({text:h}, this)); - } - } - } - if ((a = b.statements) && a.length) { - for (g = 0;g < a.length;g++) { - this._statements.push(new Entry.FieldStatement(a[g], this, g)); - } - } - break; - case Entry.Workspace.MODE_VIMBOARD: - g = this.getBoard().workspace.getCodeToText(this.block), this._contents.push(new Entry.FieldText({text:g, color:"white"}, this)); - } - this.alignContent(!1); - }; - b._updateSchema = function() { - this._startContentRender(); - }; - b.changeType = function(a) { - this._schemaChangeEvent && this._schemaChangeEvent.destroy(); - this._schema = Entry.block[a]; - this._schema.changeEvent && (this._schemaChangeEvent = this._schema.changeEvent.attach(this, this._updateSchema)); - this._updateSchema(); - }; - b.alignContent = function(a) { - !0 !== a && (a = !1); - for (var b = 0, d = 0, e = 0, f = 0, g = 0, h = 0, k = 0;k < this._contents.length;k++) { - var l = this._contents[k]; - l instanceof Entry.FieldLineBreak ? (this._alignStatement(a, f), l.align(f), f++, d = l.box.y, b = 8) : (l.align(b, d, a), k === this._contents.length - 1 || l instanceof Entry.FieldText && 0 == l._text.length || (b += Entry.BlockView.PARAM_SPACE)); - l = l.box; - 0 !== f ? h = Math.max(1E6 * Math.round(l.height), h) : e = Math.max(l.height, e); - b += l.width; - g = Math.max(g, b); - this.set({contentWidth:g, contentHeight:e}); - } - this.set({contentHeight:e + h}); - this._statements.length != f && this._alignStatement(a, f); - a = this.getContentPos(); - this.contentSvgGroup.attr("transform", "translate(" + a.x + "," + a.y + ")"); - this.contentPos = a; - this._render(); - this._updateMagnet(); - }; - b._alignStatement = function(a, b) { - var d = this._skeleton.statementPos ? this._skeleton.statementPos(this) : [], e = this._statements[b]; - e && (d = d[b]) && e.align(d.x, d.y, a); - }; - b._render = function() { - this._renderPath(); - this.set(this._skeleton.box(this)); - }; - b._renderPath = function() { - var a = this._skeleton.path(this); - this._path.attr({d:a}); - this.set({animating:!1}); - }; - b._setPosition = function(a) { - this.svgGroup.attr("transform", "translate(" + this.x + "," + this.y + ")"); - }; - b._toLocalCoordinate = function(a) { - this._moveTo(0, 0, !1); - a.appendChild(this.svgGroup); - }; - b._toGlobalCoordinate = function(a) { - a = this.getAbsoluteCoordinate(a); - this._moveTo(a.x, a.y, !1); - this.getBoard().svgBlockGroup.appendChild(this.svgGroup); - }; - b._moveTo = function(a, b, d) { - this.set({x:a, y:b}); - this._lazyUpdatePos(); - this.visible && this.display && this._setPosition(d); - }; - b._moveBy = function(a, b, d) { - return this._moveTo(this.x + a, this.y + b, d); - }; - b._addControl = function() { - var a = this; - this._mouseEnable = !0; - $(this.svgGroup).bind("mousedown.blockViewMousedown touchstart.blockViewMousedown", a.mouseHandler); - var b = a.block.events; - b && b.dblclick && $(this.svgGroup).dblclick(function() { - b.dblclick.forEach(function(b) { - b && b(a); - }); + c.appendChild(g); + } + 0 === e.length && (g = Entry.createElement("li"), g.addClass("entryVariableListCallerWorkspace"), g.addClass("entryVariableListCallerNoneWorkspace"), g.innerHTML = Lang.Workspace.no_use, c.appendChild(g)); + a.callerListElement = c; + this.listView_.insertBefore(c, a.listElement); + this.listView_.insertBefore(a.listElement, c); +}; +Entry.VariableContainer.prototype.renderVariableReference = function(a) { + for (var b = this, c = this._variableRefs, d = a.id_, e = [], f = 0;f < c.length;f++) { + -1 < c[f].block.params.indexOf(d) && e.push(c[f]); + } + c = Entry.createElement("ul"); + c.addClass("entryVariableListCallerListWorkspace"); + for (f in e) { + var d = e[f], g = Entry.createElement("li"); + g.addClass("entryVariableListCallerWorkspace"); + g.appendChild(d.object.thumbnailView_.cloneNode()); + var h = Entry.createElement("div"); + h.addClass("entryVariableListCallerNameWorkspace"); + h.innerHTML = d.object.name + " : " + Lang.Blocks["VARIABLE_" + d.block.type]; + g.appendChild(h); + g.caller = d; + g.variable = a; + g.bindOnClick(function(a) { + Entry.playground.object != this.caller.object && (Entry.container.selectObject(), Entry.container.selectObject(this.caller.object.id, !0), b.select(null)); + a = this.caller; + a = a.funcBlock || a.block; + a.view.getBoard().activateBlock(a); + Entry.playground.toggleOnVariableView(); + Entry.playground.changeViewMode("variable"); }); - }; - b.removeControl = function() { - this._mouseEnable = !1; - $(this.svgGroup).unbind(".blockViewMousedown"); - }; - b.onMouseDown = function(a) { - function c(a) { - a.stopPropagation(); - var c = g.workspace.getMode(), d; - c === Entry.Workspace.MODE_VIMBOARD && b.vimBoardEvent(a, "dragOver"); - d = a.originalEvent && a.originalEvent.touches ? a.originalEvent.touches[0] : a; - var h = f.mouseDownCoordinate, h = Math.sqrt(Math.pow(d.pageX - h.x, 2) + Math.pow(d.pageY - h.y, 2)); - if (f.dragMode == Entry.DRAG_MODE_DRAG || h > Entry.BlockView.DRAG_RADIUS) { - e && (clearTimeout(e), e = null), f.movable && (f.isInBlockMenu ? g.cloneToGlobal(a) : (a = !1, f.dragMode != Entry.DRAG_MODE_DRAG && (f._toGlobalCoordinate(), f.dragMode = Entry.DRAG_MODE_DRAG, f.block.getThread().changeEvent.notify(), Entry.GlobalSvg.setView(f, c), a = !0), this.animating && this.set({animating:!1}), 0 === f.dragInstance.height && f.dragInstance.set({height:-1 + f.height}), c = f.dragInstance, f._moveBy(d.pageX - c.offsetX, d.pageY - c.offsetY, !1), c.set({offsetX:d.pageX, - offsetY:d.pageY}), Entry.GlobalSvg.position(), f.originPos || (f.originPos = {x:f.x, y:f.y}), a && g.generateCodeMagnetMap(), f._updateCloseBlock())); - } + c.appendChild(g); + } + 0 === e.length && (g = Entry.createElement("li"), g.addClass("entryVariableListCallerWorkspace"), g.addClass("entryVariableListCallerNoneWorkspace"), g.innerHTML = Lang.Workspace.no_use, c.appendChild(g)); + a.callerListElement = c; + this.listView_.insertBefore(c, a.listElement); + this.listView_.insertBefore(a.listElement, c); +}; +Entry.VariableContainer.prototype.renderFunctionReference = function(a) { + for (var b = this, c = this._functionRefs, d = [], e = 0;e < c.length;e++) { + d.push(c[e]); + } + c = Entry.createElement("ul"); + c.addClass("entryVariableListCallerListWorkspace"); + for (e in d) { + var f = d[e], g = Entry.createElement("li"); + g.addClass("entryVariableListCallerWorkspace"); + g.appendChild(f.object.thumbnailView_.cloneNode()); + var h = Entry.createElement("div"); + h.addClass("entryVariableListCallerNameWorkspace"); + h.innerHTML = f.object.name; + g.appendChild(h); + g.caller = f; + g.bindOnClick(function(c) { + Entry.playground.object != this.caller.object && (Entry.container.selectObject(), Entry.container.selectObject(this.caller.object.id, !0), b.select(null), b.select(a)); + c = this.caller.block; + Entry.playground.toggleOnVariableView(); + c.view.getBoard().activateBlock(c); + Entry.playground.changeViewMode("variable"); + }); + c.appendChild(g); + } + 0 === d.length && (g = Entry.createElement("li"), g.addClass("entryVariableListCallerWorkspace"), g.addClass("entryVariableListCallerNoneWorkspace"), g.innerHTML = Lang.Workspace.no_use, c.appendChild(g)); + a.callerListElement = c; + this.listView_.insertBefore(c, a.listElement); + this.listView_.insertBefore(a.listElement, c); +}; +Entry.VariableContainer.prototype.updateList = function() { + if (this.listView_) { + this.variableSettingView.addClass("entryRemove"); + for (this.listSettingView.addClass("entryRemove");this.listView_.firstChild;) { + this.listView_.removeChild(this.listView_.firstChild); } - function d(a) { - e && (clearTimeout(e), e = null); - $(document).unbind(".block"); - f.terminateDrag(a); - g && g.set({dragBlock:null}); - f._changeFill(!1); - Entry.GlobalSvg.remove(); - delete this.mouseDownCoordinate; - delete f.dragInstance; + var a = this.viewMode_, b = []; + if ("all" == a || "message" == a) { + "message" == a && this.listView_.appendChild(this.messageAddButton_); + for (var c in this.messages_) { + var d = this.messages_[c]; + b.push(d); + var e = d.listElement; + this.listView_.appendChild(e); + d.callerListElement && this.listView_.appendChild(d.callerListElement); + } } - a.stopPropagation && a.stopPropagation(); - a.preventDefault && a.preventDefault(); - var e = null, f = this; - this._changeFill(!1); - var g = this.getBoard(); - Entry.documentMousedown && Entry.documentMousedown.notify(a); - if (!this.readOnly && !g.viewOnly) { - g.setSelectedBlock(this); - this.dominate(); - if (0 === a.button || a.originalEvent && a.originalEvent.touches) { - var h = a.type, k; - k = a.originalEvent && a.originalEvent.touches ? a.originalEvent.touches[0] : a; - this.mouseDownCoordinate = {x:k.pageX, y:k.pageY}; - var l = $(document); - l.bind("mousemove.block touchmove.block", c); - l.bind("mouseup.block touchend.block", d); - this.dragInstance = new Entry.DragInstance({startX:k.pageX, startY:k.pageY, offsetX:k.pageX, offsetY:k.pageY, height:0, mode:!0}); - g.set({dragBlock:this}); - this.addDragging(); - this.dragMode = Entry.DRAG_MODE_MOUSEDOWN; - "touchstart" === h && (e = setTimeout(function() { - e && (e = null, d(), f._rightClick(a)); - }, 1E3)); + if ("all" == a || "variable" == a) { + if ("variable" == a) { + e = this.variableAddPanel.info; + e.object && !Entry.playground.object && (e.object = null); + this.listView_.appendChild(this.variableAddButton_); + this.listView_.appendChild(this.variableAddPanel.view); + this.variableSplitters.top.innerHTML = Lang.Workspace.Variable_used_at_all_objects; + this.listView_.appendChild(this.variableSplitters.top); + for (c in this.variables_) { + d = this.variables_[c], d.object_ || (b.push(d), e = d.listElement, this.listView_.appendChild(e), d.callerListElement && this.listView_.appendChild(d.callerListElement)); + } + this.variableSplitters.bottom.innerHTML = Lang.Workspace.Variable_used_at_special_object; + this.listView_.appendChild(this.variableSplitters.bottom); + for (c in this.variables_) { + d = this.variables_[c], d.object_ && (b.push(d), e = d.listElement, this.listView_.appendChild(e), d.callerListElement && this.listView_.appendChild(d.callerListElement)); + } + this.updateVariableAddView("variable"); } else { - Entry.Utils.isRightButton(a) && this._rightClick(a); + for (c in this.variables_) { + d = this.variables_[c], b.push(d), e = d.listElement, this.listView_.appendChild(e), d.callerListElement && this.listView_.appendChild(d.callerListElement); + } } - g.workspace.getMode() === Entry.Workspace.MODE_VIMBOARD && a && document.getElementsByClassName("CodeMirror")[0].dispatchEvent(Entry.Utils.createMouseEvent("dragStart", event)); } - }; - b.vimBoardEvent = function(a, b, d) { - a && (a = Entry.Utils.createMouseEvent(b, a), d && (a.block = d), document.getElementsByClassName("CodeMirror")[0].dispatchEvent(a)); - }; - b.terminateDrag = function(a) { - var b = this.getBoard(), d = this.dragMode, e = this.block, f = b.workspace.getMode(); - this.removeDragging(); - this.set({visible:!0}); - this.dragMode = Entry.DRAG_MODE_NONE; - if (f === Entry.Workspace.MODE_VIMBOARD) { - b instanceof Entry.BlockMenu ? (b.terminateDrag(), this.vimBoardEvent(a, "dragEnd", e)) : b.clear(); - } else { - if (d === Entry.DRAG_MODE_DRAG) { - var f = this.dragInstance && this.dragInstance.isNew, g = Entry.GlobalSvg; - a = !1; - var h = this.block.getPrevBlock(this.block); - a = !1; - switch(Entry.GlobalSvg.terminateDrag(this)) { - case g.DONE: - g = b.magnetedBlockView; - g instanceof Entry.BlockView && (g = g.block); - h && !g ? Entry.do("separateBlock", e) : h || g || f ? g ? ("next" === g.view.magneting ? (h = e.getLastBlock(), this.dragMode = d, b.separate(e), this.dragMode = Entry.DRAG_MODE_NONE, Entry.do("insertBlock", g, h).isPass(f), Entry.ConnectionRipple.setView(g.view).dispose()) : (Entry.do("insertBlock", e, g).isPass(f), a = !0), createjs.Sound.play("entryMagneting")) : Entry.do("moveBlock", e).isPass(f) : e.getThread().view.isGlobal() ? Entry.do("moveBlock", e) : Entry.do("separateBlock", - e); - break; - case g.RETURN: - e = this.block; - d = this.originPos; - h ? (this.set({animating:!1}), createjs.Sound.play("entryMagneting"), this.bindPrev(h), e.insert(h)) : (f = e.getThread().view.getParent(), f instanceof Entry.Board ? this._moveTo(d.x, d.y, !1) : (createjs.Sound.play("entryMagneting"), Entry.do("insertBlock", e, f))); - break; - case g.REMOVE: - createjs.Sound.play("entryDelete"), f ? this.block.destroy(!1, !0) : this.block.doDestroyBelow(!1); + if ("all" == a || "list" == a) { + if ("list" == a) { + e = this.listAddPanel.info; + e.object && !Entry.playground.object && (e.object = null); + this.listView_.appendChild(this.listAddButton_); + this.listView_.appendChild(this.listAddPanel.view); + this.variableSplitters.top.innerHTML = Lang.Workspace.List_used_all_objects; + this.listView_.appendChild(this.variableSplitters.top); + this.updateVariableAddView("list"); + for (c in this.lists_) { + d = this.lists_[c], d.object_ || (b.push(d), e = d.listElement, this.listView_.appendChild(e), d.callerListElement && this.listView_.appendChild(d.callerListElement)); + } + this.variableSplitters.bottom.innerHTML = Lang.Workspace.list_used_specific_objects; + this.listView_.appendChild(this.variableSplitters.bottom); + for (c in this.lists_) { + d = this.lists_[c], d.object_ && (b.push(d), e = d.listElement, this.listView_.appendChild(e), d.callerListElement && this.listView_.appendChild(d.callerListElement)); + } + this.updateVariableAddView("variable"); + } else { + for (c in this.lists_) { + d = this.lists_[c], b.push(d), e = d.listElement, this.listView_.appendChild(e), d.callerListElement && this.listView_.appendChild(d.callerListElement); } - b.setMagnetedBlock(null); - a && Entry.ConnectionRipple.setView(e.view).dispose(); } } - this.destroyShadow(); - delete this.originPos; - this.dominate(); - }; - b._updateCloseBlock = function() { - var a = this.getBoard(), b; - if (this._skeleton.magnets) { - for (var d in this.magnet) { - if (b = "next" === d ? this.getBoard().getNearestMagnet(this.x, this.y + this.getBelowHeight(), d) : this.getBoard().getNearestMagnet(this.x, this.y, d)) { - return a.setMagnetedBlock(b.view, d); - } + if ("all" == a || "func" == a) { + for (c in "func" == a && this.listView_.appendChild(this.functionAddButton_), this.functions_) { + a = this.functions_[c], b.push(a), e = a.listElement, this.listView_.appendChild(e), a.callerListElement && this.listView_.appendChild(a.callerListElement); } - a.setMagnetedBlock(null); } - }; - b.dominate = function() { - this.block.getThread().view.dominate(); - }; - b.getSvgRoot = function() { - for (var a = this.getBoard().svgBlockGroup, b = this.svgGroup;b.parentNode !== a;) { - b = b.parentNode; + this.listView_.appendChild(this.variableSettingView); + this.listView_.appendChild(this.listSettingView); + } +}; +Entry.VariableContainer.prototype.setMessages = function(a) { + for (var b in a) { + var c = a[b]; + c.id || (c.id = Entry.generateHash()); + this.createMessageView(c); + this.messages_.push(c); + } + Entry.playground.reloadPlayground(); + this.updateList(); +}; +Entry.VariableContainer.prototype.setVariables = function(a) { + for (var b in a) { + var c = new Entry.Variable(a[b]), d = c.getType(); + "variable" == d || "slide" == d ? (c.generateView(this.variables_.length), this.createVariableView(c), this.variables_.push(c)) : "list" == d ? (c.generateView(this.lists_.length), this.createListView(c), this.lists_.push(c)) : "timer" == d ? this.generateTimer(c) : "answer" == d && this.generateAnswer(c); + } + Entry.isEmpty(Entry.engine.projectTimer) && Entry.variableContainer.generateTimer(); + Entry.isEmpty(Entry.container.inputValue) && Entry.variableContainer.generateAnswer(); + Entry.playground.reloadPlayground(); + this.updateList(); +}; +Entry.VariableContainer.prototype.setFunctions = function(a) { + for (var b in a) { + var c = new Entry.Func(a[b]); + c.generateBlock(); + this.createFunctionView(c); + this.functions_[c.id] = c; + } + this.updateList(); +}; +Entry.VariableContainer.prototype.getFunction = function(a) { + return this.functions_[a]; +}; +Entry.VariableContainer.prototype.getVariable = function(a, b) { + var c = Entry.findObjsByKey(this.variables_, "id_", a)[0]; + b && b.isClone && c.object_ && (c = Entry.findObjsByKey(b.variables, "id_", a)[0]); + return c; +}; +Entry.VariableContainer.prototype.getList = function(a, b) { + var c = Entry.findObjsByKey(this.lists_, "id_", a)[0]; + b && b.isClone && c.object_ && (c = Entry.findObjsByKey(b.lists, "id_", a)[0]); + return c; +}; +Entry.VariableContainer.prototype.createFunction = function() { + if (!Entry.Func.isEdit) { + var a = new Entry.Func; + Entry.Func.edit(a); + } +}; +Entry.VariableContainer.prototype.addFunction = function(a) { +}; +Entry.VariableContainer.prototype.removeFunction = function(a) { + var b = a.id; + a = this.functions_; + a[b].destroy(); + delete a[b]; + b = "func_" + b; + Entry.container.removeFuncBlocks(b); + for (var c in a) { + a[c].content.removeBlocksByType(b); + } + this.updateList(); +}; +Entry.VariableContainer.prototype.checkListPosition = function(a, b) { + var c = a.x_ + a.width_, d = -a.y_, e = -a.y_ + -a.height_; + return b.x > a.x_ && b.x < c && b.y < d && b.y > e ? !0 : !1; +}; +Entry.VariableContainer.prototype.getListById = function(a) { + var b = this.lists_, c = []; + if (0 < b.length) { + for (var d = 0;d < b.length;d++) { + this.checkListPosition(b[d], a) && c.push(b[d]); } - return b; - }; - b.getBoard = function() { - return this._board; - }; - b._setBoard = function() { - this._board = this._board.code.board; - }; - b.destroy = function(a) { - $(this.svgGroup).unbind(".blockViewMousedown"); - this._destroyObservers(); - var b = this.svgGroup; - a ? $(b).fadeOut(100, function() { - b.remove(); - }) : b.remove(); - this._contents.forEach(function(a) { - a.constructor !== Entry.Block && a.destroy(); + return c; + } + return !1; +}; +Entry.VariableContainer.prototype.editFunction = function(a, b) { +}; +Entry.VariableContainer.prototype.saveFunction = function(a) { + this.functions_[a.id] || (this.functions_[a.id] = a, this.createFunctionView(a)); + a.listElement.nameField.innerHTML = a.description; + this.updateList(); +}; +Entry.VariableContainer.prototype.createFunctionView = function(a) { + var b = this; + if (this.view_) { + var c = Entry.createElement("li"); + c.addClass("entryVariableListElementWorkspace"); + c.addClass("entryFunctionElementWorkspace"); + c.bindOnClick(function(c) { + c.stopPropagation(); + b.select(a); }); - var d = this.block; - a = d.events.viewDestroy; - "workspace" == Entry.type && a && !this.isInBlockMenu && a.forEach(function(a) { - Entry.Utils.isFunction(a) && a(d); + var d = Entry.createElement("button"); + d.addClass("entryVariableListElementDeleteWorkspace"); + d.bindOnClick(function(c) { + c.stopPropagation(); + confirm(Lang.Workspace.will_you_delete_function) && (b.removeFunction(a), b.selected = null); }); - this._schemaChangeEvent && this._schemaChangeEvent.destroy(); - }; - b.getShadow = function() { - this._shadow || (this._shadow = Entry.SVG.createElement(this.svgGroup.cloneNode(!0), {opacity:.5}), this.getBoard().svgGroup.appendChild(this._shadow)); - return this._shadow; - }; - b.destroyShadow = function() { - this._shadow && (this._shadow.remove(), delete this._shadow); - }; - b._updateMagnet = function() { - if (this._skeleton.magnets) { - var a = this._skeleton.magnets(this); - a.next && this._nextGroup.attr("transform", "translate(" + a.next.x + "," + a.next.y + ")"); - this.magnet = a; - this.block.getThread().changeEvent.notify(); + var e = Entry.createElement("button"); + e.addClass("entryVariableListElementEditWorkspace"); + var f = this._getBlockMenu(); + e.bindOnClick(function(b) { + b.stopPropagation(); + Entry.Func.edit(a); + Entry.playground && (Entry.playground.changeViewMode("code"), "func" != f.lastSelector && f.selectMenu("func")); + }); + var g = Entry.createElement("div"); + g.addClass("entryVariableFunctionElementNameWorkspace"); + g.innerHTML = a.description; + c.nameField = g; + c.appendChild(g); + c.appendChild(e); + c.appendChild(d); + a.listElement = c; + } +}; +Entry.VariableContainer.prototype.checkAllVariableName = function(a, b) { + b = this[b]; + for (var c = 0;c < b.length;c++) { + if (b[c].name_ == a) { + return !0; } + } + return !1; +}; +Entry.VariableContainer.prototype.addVariable = function(a) { + if (!a) { + var b = this.variableAddPanel; + a = b.view.name.value.trim(); + a && 0 !== a.length || (a = Lang.Workspace.variable); + a.length > this._maxNameLength && (a = this._truncName(a, "variable")); + a = this.checkAllVariableName(a, "variables_") ? Entry.getOrderedName(a, this.variables_, "name_") : a; + var c = b.info; + a = {name:a, isCloud:c.isCloud, object:c.object, variableType:"variable"}; + b.view.addClass("entryRemove"); + this.resetVariableAddPanel("variable"); + } + a = new Entry.Variable(a); + Entry.stateManager && Entry.stateManager.addCommand("add variable", this, this.removeVariable, a); + a.generateView(this.variables_.length); + this.createVariableView(a); + this.variables_.unshift(a); + Entry.playground.reloadPlayground(); + this.updateList(); + return new Entry.State(this, this.removeVariable, a); +}; +Entry.VariableContainer.prototype.removeVariable = function(a) { + var b = this.variables_.indexOf(a), c = a.toJSON(); + this.selected == a && this.select(null); + a.remove(); + this.variables_.splice(b, 1); + Entry.stateManager && Entry.stateManager.addCommand("remove variable", this, this.addVariable, c); + Entry.playground.reloadPlayground(); + this.updateList(); + return new Entry.State(this, this.addVariable, c); +}; +Entry.VariableContainer.prototype.changeVariableName = function(a, b) { + a.name_ != b && (Entry.isExist(b, "name_", this.variables_) ? (a.listElement.nameField.value = a.name_, Entry.toast.alert(Lang.Workspace.variable_rename_failed, Lang.Workspace.variable_dup)) : 10 < b.length ? (a.listElement.nameField.value = a.name_, Entry.toast.alert(Lang.Workspace.variable_rename_failed, Lang.Workspace.variable_too_long)) : (a.setName(b), Entry.playground.reloadPlayground(), Entry.toast.success(Lang.Workspace.variable_rename, Lang.Workspace.variable_rename_ok))); +}; +Entry.VariableContainer.prototype.changeListName = function(a, b) { + a.name_ != b && (Entry.isExist(b, "name_", this.lists_) ? (a.listElement.nameField.value = a.name_, Entry.toast.alert(Lang.Workspace.list_rename_failed, Lang.Workspace.list_dup)) : 10 < b.length ? (a.listElement.nameField.value = a.name_, Entry.toast.alert(Lang.Workspace.list_rename_failed, Lang.Workspace.list_too_long)) : (a.name_ = b, a.updateView(), Entry.playground.reloadPlayground(), Entry.toast.success(Lang.Workspace.list_rename, Lang.Workspace.list_rename_ok))); +}; +Entry.VariableContainer.prototype.removeList = function(a) { + var b = this.lists_.indexOf(a), c = a.toJSON(); + Entry.stateManager && Entry.stateManager.addCommand("remove list", this, this.addList, c); + this.selected == a && this.select(null); + a.remove(); + this.lists_.splice(b, 1); + Entry.playground.reloadPlayground(); + this.updateList(); + return new Entry.State(this, this.addList, c); +}; +Entry.VariableContainer.prototype.createVariableView = function(a) { + var b = this, c = Entry.createElement("li"), d = Entry.createElement("div"); + d.addClass("entryVariableListElementWrapperWorkspace"); + c.appendChild(d); + c.addClass("entryVariableListElementWorkspace"); + a.object_ ? c.addClass("entryVariableLocalElementWorkspace") : a.isCloud_ ? c.addClass("entryVariableCloudElementWorkspace") : c.addClass("entryVariableGlobalElementWorkspace"); + c.bindOnClick(function(c) { + b.select(a); + }); + var e = Entry.createElement("button"); + e.addClass("entryVariableListElementDeleteWorkspace"); + e.bindOnClick(function(c) { + c.stopPropagation(); + b.removeVariable(a); + b.selectedVariable = null; + b.variableSettingView.addClass("entryRemove"); + }); + var f = Entry.createElement("button"); + f.addClass("entryVariableListElementEditWorkspace"); + f.bindOnClick(function(c) { + c.stopPropagation(); + h.removeAttribute("disabled"); + g.removeClass("entryRemove"); + this.addClass("entryRemove"); + b.updateSelectedVariable(a); + h.focus(); + }); + c.editButton = f; + var g = Entry.createElement("button"); + g.addClass("entryVariableListElementEditWorkspace"); + g.addClass("entryRemove"); + g.bindOnClick(function(a) { + a.stopPropagation(); + h.blur(); + h.setAttribute("disabled", "disabled"); + f.removeClass("entryRemove"); + this.addClass("entryRemove"); + b.updateSelectedVariable(null, "variable"); + }); + c.editSaveButton = g; + var h = Entry.createElement("input"); + h.addClass("entryVariableListElementNameWorkspace"); + h.setAttribute("disabled", "disabled"); + h.value = a.name_; + h.bindOnClick(function(b) { + b.stopPropagation(); + }); + h.onblur = function(c) { + (c = this.value.trim()) && 0 !== c.length ? b.changeVariableName(a, this.value) : (Entry.toast.alert(Lang.Msgs.warn, Lang.Workspace.variable_can_not_space), this.value = a.getName()); }; - b._updateBG = function() { - if (this._board.dragBlock && this._board.dragBlock.dragInstance) { - var a = this.svgGroup; - if (this.magnet.next) { - if (a = this.magneting) { - var b = this._board.dragBlock.getShadow(), d = this.getAbsoluteCoordinate(), e; - if ("previous" === a) { - e = this.magnet.next, e = "translate(" + (d.x + e.x) + "," + (d.y + e.y) + ")"; - } else { - if ("next" === a) { - e = this.magnet.previous; - var f = this._board.dragBlock.getBelowHeight(); - e = "translate(" + (d.x + e.x) + "," + (d.y + e.y - f) + ")"; - } - } - $(b).attr({transform:e, display:"block"}); - this._clonedShadow = b; - this.background && (this.background.remove(), this.nextBackground.remove(), delete this.background, delete this.nextBackground); - "previous" === a && (a = this._board.dragBlock.getBelowHeight() + this.offsetY, this.originalHeight = this.offsetY, this.set({offsetY:a})); - } else { - this._clonedShadow && (this._clonedShadow.attr({display:"none"}), delete this._clonedShadow), a = this.originalHeight, void 0 !== a && (this.background && (this.background.remove(), this.nextBackground.remove(), delete this.background, delete this.nextBackground), this.set({offsetY:a}), delete this.originalHeight); - } - (a = this.block.thread.changeEvent) && a.notify(); - } else { - this.magneting ? (a.attr({filter:"url(#entryBlockHighlightFilter_" + this.getBoard().suffix + ")"}), a.addClass("outputHighlight")) : (a.removeClass("outputHighlight"), a.removeAttr("filter")); - } - } + h.onkeydown = function(b) { + 13 == b.keyCode && this.blur(); }; - b.addDragging = function() { - this.svgGroup.addClass("dragging"); + c.nameField = h; + d.appendChild(h); + d.appendChild(f); + d.appendChild(g); + d.appendChild(e); + a.listElement = c; +}; +Entry.VariableContainer.prototype.addMessage = function(a) { + a.id || (a.id = Entry.generateHash()); + Entry.stateManager && Entry.stateManager.addCommand("add message", this, this.removeMessage, a); + this.createMessageView(a); + this.messages_.unshift(a); + Entry.playground.reloadPlayground(); + this.updateList(); + a.listElement.nameField.focus(); + return new Entry.State(this, this.removeMessage, a); +}; +Entry.VariableContainer.prototype.removeMessage = function(a) { + this.selected == a && this.select(null); + Entry.stateManager && Entry.stateManager.addCommand("remove message", this, this.addMessage, a); + var b = this.messages_.indexOf(a); + this.messages_.splice(b, 1); + this.updateList(); + Entry.playground.reloadPlayground(); + return new Entry.State(this, this.addMessage, a); +}; +Entry.VariableContainer.prototype.changeMessageName = function(a, b) { + a.name != b && (Entry.isExist(b, "name", this.messages_) ? (a.listElement.nameField.value = a.name, Entry.toast.alert(Lang.Workspace.message_rename_failed, Lang.Workspace.message_dup)) : 10 < b.length ? (a.listElement.nameField.value = a.name, Entry.toast.alert(Lang.Workspace.message_rename_failed, Lang.Workspace.message_too_long)) : (a.name = b, Entry.playground.reloadPlayground(), Entry.toast.success(Lang.Workspace.message_rename, Lang.Workspace.message_rename_ok))); +}; +Entry.VariableContainer.prototype.createMessageView = function(a) { + var b = this, c = Entry.createElement("li"); + c.addClass("entryVariableListElementWorkspace"); + c.addClass("entryMessageElementWorkspace"); + c.bindOnClick(function(c) { + b.select(a); + }); + var d = Entry.createElement("button"); + d.addClass("entryVariableListElementDeleteWorkspace"); + d.bindOnClick(function(c) { + c.stopPropagation(); + b.removeMessage(a); + }); + var e = Entry.createElement("button"); + e.addClass("entryVariableListElementEditWorkspace"); + e.bindOnClick(function(b) { + b.stopPropagation(); + g.removeAttribute("disabled"); + g.focus(); + f.removeClass("entryRemove"); + this.addClass("entryRemove"); + }); + var f = Entry.createElement("button"); + f.addClass("entryVariableListElementEditWorkspace"); + f.addClass("entryRemove"); + f.bindOnClick(function(b) { + b.stopPropagation(); + g.blur(); + e.removeClass("entryRemove"); + this.addClass("entryRemove"); + }); + var g = Entry.createElement("input"); + g.addClass("entryVariableListElementNameWorkspace"); + g.value = a.name; + g.bindOnClick(function(b) { + b.stopPropagation(); + }); + g.onblur = function(c) { + (c = this.value.trim()) && 0 !== c.length ? (b.changeMessageName(a, this.value), e.removeClass("entryRemove"), f.addClass("entryRemove"), g.setAttribute("disabled", "disabled")) : (Entry.toast.alert(Lang.Msgs.warn, Lang.Msgs.sign_can_not_space), this.value = a.name); }; - b.removeDragging = function() { - this.svgGroup.removeClass("dragging"); + g.onkeydown = function(b) { + 13 == b.keyCode && this.blur(); }; - b.addSelected = function() { - this.svgGroup.addClass("selected"); + c.nameField = g; + c.appendChild(g); + c.appendChild(e); + c.appendChild(f); + c.appendChild(d); + a.listElement = c; +}; +Entry.VariableContainer.prototype.addList = function(a) { + if (!a) { + var b = this.listAddPanel; + a = b.view.name.value.trim(); + a && 0 !== a.length || (a = Lang.Workspace.list); + var c = b.info; + a.length > this._maxNameLength && (a = this._truncName(a, "list")); + a = this.checkAllVariableName(a, "lists_") ? Entry.getOrderedName(a, this.lists_, "name_") : a; + a = {name:a, isCloud:c.isCloud, object:c.object, variableType:"list"}; + b.view.addClass("entryRemove"); + this.resetVariableAddPanel("list"); + } + a = new Entry.Variable(a); + Entry.stateManager && Entry.stateManager.addCommand("add list", this, this.removeList, a); + a.generateView(this.lists_.length); + this.createListView(a); + this.lists_.unshift(a); + Entry.playground.reloadPlayground(); + this.updateList(); + return new Entry.State(this, this.removelist, a); +}; +Entry.VariableContainer.prototype.createListView = function(a) { + var b = this, c = Entry.createElement("li"), d = Entry.createElement("div"); + d.addClass("entryVariableListElementWrapperWorkspace"); + c.appendChild(d); + c.addClass("entryVariableListElementWorkspace"); + a.object_ ? c.addClass("entryListLocalElementWorkspace") : a.isCloud_ ? c.addClass("entryListCloudElementWorkspace") : c.addClass("entryListGlobalElementWorkspace"); + c.bindOnClick(function(c) { + b.select(a); + }); + var e = Entry.createElement("button"); + e.addClass("entryVariableListElementDeleteWorkspace"); + e.bindOnClick(function(c) { + c.stopPropagation(); + b.removeList(a); + b.selectedList = null; + b.listSettingView.addClass("entryRemove"); + }); + var f = Entry.createElement("button"); + f.addClass("entryVariableListElementEditWorkspace"); + f.bindOnClick(function(c) { + c.stopPropagation(); + h.removeAttribute("disabled"); + g.removeClass("entryRemove"); + this.addClass("entryRemove"); + b.updateSelectedVariable(a); + h.focus(); + }); + c.editButton = f; + var g = Entry.createElement("button"); + g.addClass("entryVariableListElementEditWorkspace"); + g.addClass("entryRemove"); + g.bindOnClick(function(c) { + c.stopPropagation(); + h.blur(); + h.setAttribute("disabled", "disabled"); + f.removeClass("entryRemove"); + this.addClass("entryRemove"); + b.select(a); + b.updateSelectedVariable(null, "list"); + }); + c.editSaveButton = g; + var h = Entry.createElement("input"); + h.setAttribute("disabled", "disabled"); + h.addClass("entryVariableListElementNameWorkspace"); + h.value = a.name_; + h.bindOnClick(function(b) { + b.stopPropagation(); + }); + h.onblur = function(c) { + (c = this.value.trim()) && 0 !== c.length ? b.changeListName(a, this.value) : (Entry.toast.alert(Lang.Msgs.warn, Lang.Msgs.list_can_not_space), this.value = a.getName()); }; - b.removeSelected = function() { - this.svgGroup.removeClass("selected"); + h.onkeydown = function(b) { + 13 == b.keyCode && this.blur(); }; - b.getSkeleton = function() { - return this._skeleton; + c.nameField = h; + d.appendChild(h); + d.appendChild(f); + d.appendChild(g); + d.appendChild(e); + a.listElement = c; +}; +Entry.VariableContainer.prototype.mapVariable = function(a, b) { + for (var c = this.variables_.length, d = 0;d < c;d++) { + a(this.variables_[d], b); + } +}; +Entry.VariableContainer.prototype.mapList = function(a, b) { + for (var c = this.lists_.length, d = 0;d < c;d++) { + a(this.lists_[d], b); + } +}; +Entry.VariableContainer.prototype.getVariableJSON = function() { + for (var a = [], b = 0;b < this.variables_.length;b++) { + a.push(this.variables_[b].toJSON()); + } + for (b = 0;b < this.lists_.length;b++) { + a.push(this.lists_[b].toJSON()); + } + Entry.engine.projectTimer && a.push(Entry.engine.projectTimer.toJSON()); + b = Entry.container.inputValue; + Entry.isEmpty(b) || a.push(b.toJSON()); + return a; +}; +Entry.VariableContainer.prototype.getMessageJSON = function() { + for (var a = [], b = 0;b < this.messages_.length;b++) { + a.push({id:this.messages_[b].id, name:this.messages_[b].name}); + } + return a; +}; +Entry.VariableContainer.prototype.getFunctionJSON = function() { + var a = [], b; + for (b in this.functions_) { + var c = this.functions_[b], c = {id:c.id, content:JSON.stringify(c.content.toJSON())}; + a.push(c); + } + return a; +}; +Entry.VariableContainer.prototype.resetVariableAddPanel = function(a) { + a = a || "variable"; + var b = "variable" == a ? this.variableAddPanel : this.listAddPanel, c = b.info; + c.isCloud = !1; + c.object = null; + b.view.name.value = ""; + b.isOpen = !1; + this.updateVariableAddView(a); +}; +Entry.VariableContainer.prototype.generateVariableAddView = function() { + var a = this, b = Entry.createElement("li"); + this.variableAddPanel.view = b; + this.variableAddPanel.isOpen = !1; + b.addClass("entryVariableAddSpaceWorkspace"); + b.addClass("entryRemove"); + var c = Entry.createElement("div"); + c.addClass("entryVariableAddSpaceNameWrapperWorkspace"); + b.appendChild(c); + var d = Entry.createElement("input"); + d.addClass("entryVariableAddSpaceInputWorkspace"); + d.setAttribute("placeholder", Lang.Workspace.Variable_placeholder_name); + d.variableContainer = this; + d.onkeypress = function(b) { + 13 == b.keyCode && (Entry.variableContainer.addVariable(), a.updateSelectedVariable(a.variables_[0]), b = a.variables_[0].listElement, b.editButton.addClass("entryRemove"), b.editSaveButton.removeClass("entryRemove"), b.nameField.removeAttribute("disabled")); }; - b.getContentPos = function() { - return this._skeleton.contentPos(this); + this.variableAddPanel.view.name = d; + c.appendChild(d); + c = Entry.createElement("div"); + c.addClass("entryVariableAddSpaceGlobalWrapperWorkspace"); + c.bindOnClick(function(b) { + a.variableAddPanel.info.object = null; + a.updateVariableAddView("variable"); + }); + b.appendChild(c); + d = Entry.createElement("span"); + d.innerHTML = Lang.Workspace.Variable_use_all_objects; + c.appendChild(d); + d = Entry.createElement("span"); + d.addClass("entryVariableAddSpaceCheckWorkspace"); + this.variableAddPanel.view.globalCheck = d; + this.variableAddPanel.info.object || d.addClass("entryVariableAddChecked"); + c.appendChild(d); + c = Entry.createElement("div"); + c.addClass("entryVariableAddSpaceLocalWrapperWorkspace"); + c.bindOnClick(function(b) { + Entry.playground.object && (b = a.variableAddPanel.info, b.object = Entry.playground.object.id, b.isCloud = !1, a.updateVariableAddView("variable")); + }); + b.appendChild(c); + d = Entry.createElement("span"); + d.innerHTML = Lang.Workspace.Variable_use_this_object; + c.appendChild(d); + d = Entry.createElement("span"); + d.addClass("entryVariableAddSpaceCheckWorkspace"); + this.variableAddPanel.view.localCheck = d; + this.variableAddPanel.info.object && d.addClass("entryVariableAddChecked"); + c.appendChild(d); + c = Entry.createElement("div"); + b.cloudWrapper = c; + c.addClass("entryVariableAddSpaceCloudWrapperWorkspace"); + c.bindOnClick(function(b) { + b = a.variableAddPanel.info; + b.object || (b.isCloud = !b.isCloud, a.updateVariableAddView("variable")); + }); + b.appendChild(c); + d = Entry.createElement("span"); + d.addClass("entryVariableAddSpaceCloudSpanWorkspace"); + d.innerHTML = Lang.Workspace.Variable_create_cloud; + c.appendChild(d); + d = Entry.createElement("span"); + this.variableAddPanel.view.cloudCheck = d; + d.addClass("entryVariableAddSpaceCheckWorkspace"); + d.addClass("entryVariableAddSpaceCloudCheckWorkspace"); + this.variableAddPanel.info.isCloud && d.addClass("entryVariableAddChecked"); + c.appendChild(d); + c = Entry.createElement("div"); + c.addClass("entryVariableAddSpaceButtonWrapperWorkspace"); + b.appendChild(c); + b = Entry.createElement("span"); + b.addClass("entryVariableAddSpaceCancelWorkspace"); + b.addClass("entryVariableAddSpaceButtonWorkspace"); + b.innerHTML = Lang.Buttons.cancel; + b.bindOnClick(function(b) { + a.variableAddPanel.view.addClass("entryRemove"); + a.resetVariableAddPanel("variable"); + }); + c.appendChild(b); + b = Entry.createElement("span"); + b.addClass("entryVariableAddSpaceConfirmWorkspace"); + b.addClass("entryVariableAddSpaceButtonWorkspace"); + b.innerHTML = Lang.Buttons.save; + b.variableContainer = this; + b.bindOnClick(function(b) { + Entry.variableContainer.addVariable(); + a.updateSelectedVariable(a.variables_[0]); + b = a.variables_[0].listElement; + b.editButton.addClass("entryRemove"); + b.editSaveButton.removeClass("entryRemove"); + b.nameField.removeAttribute("disabled"); + }); + c.appendChild(b); +}; +Entry.VariableContainer.prototype.generateListAddView = function() { + var a = this, b = Entry.createElement("li"); + this.listAddPanel.view = b; + this.listAddPanel.isOpen = !1; + b.addClass("entryVariableAddSpaceWorkspace"); + b.addClass("entryRemove"); + var c = Entry.createElement("div"); + c.addClass("entryVariableAddSpaceNameWrapperWorkspace"); + c.addClass("entryListAddSpaceNameWrapperWorkspace"); + b.appendChild(c); + var d = Entry.createElement("input"); + d.addClass("entryVariableAddSpaceInputWorkspace"); + d.setAttribute("placeholder", Lang.Workspace.list_name); + this.listAddPanel.view.name = d; + d.variableContainer = this; + d.onkeypress = function(b) { + 13 == b.keyCode && (a.addList(), b = a.lists_[0], a.updateSelectedVariable(b), b = b.listElement, b.editButton.addClass("entryRemove"), b.editSaveButton.removeClass("entryRemove"), b.nameField.removeAttribute("disabled")); }; - b.renderText = function() { - this._startContentRender(Entry.Workspace.MODE_VIMBOARD); + c.appendChild(d); + c = Entry.createElement("div"); + c.addClass("entryVariableAddSpaceGlobalWrapperWorkspace"); + c.bindOnClick(function(b) { + a.listAddPanel.info.object = null; + a.updateVariableAddView("list"); + }); + b.appendChild(c); + d = Entry.createElement("span"); + d.innerHTML = Lang.Workspace.use_all_objects; + c.appendChild(d); + d = Entry.createElement("span"); + d.addClass("entryVariableAddSpaceCheckWorkspace"); + this.listAddPanel.view.globalCheck = d; + this.listAddPanel.info.object || d.addClass("entryVariableAddChecked"); + c.appendChild(d); + c = Entry.createElement("div"); + c.addClass("entryVariableAddSpaceLocalWrapperWorkspace"); + c.bindOnClick(function(b) { + Entry.playground.object && (b = a.listAddPanel.info, b.object = Entry.playground.object.id, b.isCloud = !1, a.updateVariableAddView("list")); + }); + b.appendChild(c); + d = Entry.createElement("span"); + d.innerHTML = Lang.Workspace.Variable_use_this_object; + c.appendChild(d); + d = Entry.createElement("span"); + d.addClass("entryVariableAddSpaceCheckWorkspace"); + this.listAddPanel.view.localCheck = d; + this.variableAddPanel.info.object && addVariableLocalCheck.addClass("entryVariableAddChecked"); + c.appendChild(d); + c = Entry.createElement("div"); + b.cloudWrapper = c; + c.addClass("entryVariableAddSpaceCloudWrapperWorkspace"); + c.bindOnClick(function(b) { + b = a.listAddPanel.info; + b.object || (b.isCloud = !b.isCloud, a.updateVariableAddView("list")); + }); + b.appendChild(c); + d = Entry.createElement("span"); + d.addClass("entryVariableAddSpaceCloudSpanWorkspace"); + d.innerHTML = Lang.Workspace.List_create_cloud; + c.appendChild(d); + d = Entry.createElement("span"); + this.listAddPanel.view.cloudCheck = d; + d.addClass("entryVariableAddSpaceCheckWorkspace"); + d.addClass("entryVariableAddSpaceCloudCheckWorkspace"); + this.listAddPanel.info.isCloud && d.addClass("entryVariableAddChecked"); + c.appendChild(d); + c = Entry.createElement("div"); + c.addClass("entryVariableAddSpaceButtonWrapperWorkspace"); + b.appendChild(c); + b = Entry.createElement("span"); + b.addClass("entryVariableAddSpaceCancelWorkspace"); + b.addClass("entryVariableAddSpaceButtonWorkspace"); + b.innerHTML = Lang.Buttons.cancel; + b.bindOnClick(function(b) { + a.listAddPanel.view.addClass("entryRemove"); + a.resetVariableAddPanel("list"); + }); + c.appendChild(b); + b = Entry.createElement("span"); + b.addClass("entryVariableAddSpaceConfirmWorkspace"); + b.addClass("entryVariableAddSpaceButtonWorkspace"); + b.innerHTML = Lang.Buttons.save; + b.variableContainer = this; + b.bindOnClick(function(b) { + a.addList(); + b = a.lists_[0]; + a.updateSelectedVariable(b); + b = b.listElement; + b.editButton.addClass("entryRemove"); + b.editSaveButton.removeClass("entryRemove"); + b.nameField.removeAttribute("disabled"); + }); + c.appendChild(b); +}; +Entry.VariableContainer.prototype.generateVariableSplitterView = function() { + var a = Entry.createElement("li"); + a.addClass("entryVariableSplitterWorkspace"); + var b = Entry.createElement("li"); + b.addClass("entryVariableSplitterWorkspace"); + this.variableSplitters = {top:a, bottom:b}; +}; +Entry.VariableContainer.prototype.openVariableAddPanel = function(a) { + a = a ? a : "variable"; + Entry.playground.toggleOnVariableView(); + Entry.playground.changeViewMode("variable"); + "variable" == a ? this.variableAddPanel.isOpen = !0 : this.listAddPanel.isOpen = !0; + this.selectFilter(a); + this.updateVariableAddView(a); +}; +Entry.VariableContainer.prototype.getMenuXml = function(a) { + for (var b = [], c = 0 !== this.variables_.length, d = 0 !== this.lists_.length, e, f = 0, g;g = a[f];f++) { + var h = g.tagName; + h && "BLOCK" == h.toUpperCase() ? (e = g.getAttribute("bCategory"), !c && "variable" == e || !d && "list" == e || b.push(g)) : !h || "SPLITTER" != h.toUpperCase() && "BTN" != h.toUpperCase() || !c && "variable" == e || (d || "list" != e) && b.push(g); + } + return b; +}; +Entry.VariableContainer.prototype.addCloneLocalVariables = function(a) { + var b = [], c = this; + this.mapVariable(function(a, c) { + a.object_ && a.object_ == c.objectId && (a = a.toJSON(), a.originId = a.id, a.id = Entry.generateHash(), a.object = c.newObjectId, delete a.x, delete a.y, b.push(a), c.json.script = c.json.script.replace(new RegExp(a.originId, "g"), a.id)); + }, a); + b.map(function(b) { + c.addVariable(b); + }); +}; +Entry.VariableContainer.prototype.generateTimer = function(a) { + a || (a = {}, a.id = Entry.generateHash(), a.name = Lang.Workspace.Variable_Timer, a.value = 0, a.variableType = "timer", a.visible = !1, a.x = 150, a.y = -70, a = new Entry.Variable(a)); + a.generateView(); + a.tick = null; + Entry.engine.projectTimer = a; + Entry.addEventListener("stop", function() { + Entry.engine.stopProjectTimer(); + }); +}; +Entry.VariableContainer.prototype.generateAnswer = function(a) { + a || (a = new Entry.Variable({id:Entry.generateHash(), name:Lang.Blocks.VARIABLE_get_canvas_input_value, value:0, variableType:"answer", visible:!1, x:150, y:-100})); + a.generateView(); + Entry.container.inputValue = a; +}; +Entry.VariableContainer.prototype.generateVariableSettingView = function() { + var a = this, b = Entry.createElement("div"); + b.bindOnClick(function(b) { + b.stopPropagation(); + }); + this.variableSettingView = b; + b.addClass("entryVariableSettingWorkspace"); + this.listView_.appendChild(b); + b.addClass("entryRemove"); + var c = Entry.createElement("div"); + c.addClass("entryVariableSettingVisibleWrapperWorkspace"); + c.bindOnClick(function(b) { + b = a.selectedVariable; + var c = a.variableSettingView.visibleCheck; + b.setVisible(!b.isVisible()); + b.isVisible() ? c.addClass("entryVariableSettingChecked") : c.removeClass("entryVariableSettingChecked"); + }); + b.appendChild(c); + var d = Entry.createElement("span"); + d.innerHTML = Lang.Workspace.show_variable; + c.appendChild(d); + d = Entry.createElement("span"); + d.addClass("entryVariableSettingCheckWorkspace"); + b.visibleCheck = d; + c.appendChild(d); + c = Entry.createElement("div"); + c.addClass("entryVariableSettingInitValueWrapperWorkspace"); + b.appendChild(c); + d = Entry.createElement("span"); + d.innerHTML = Lang.Workspace.default_value; + c.appendChild(d); + d = Entry.createElement("input"); + d.addClass("entryVariableSettingInitValueInputWorkspace"); + b.initValueInput = d; + d.value = 0; + d.onkeyup = function(b) { + a.selectedVariable.setValue(this.value); }; - b.renderBlock = function() { - this._startContentRender(Entry.Workspace.MODE_BOARD); + d.onblur = function(b) { + a.selectedVariable.setValue(this.value); }; - b._updateOpacity = function() { - this.svgGroup.attr({opacity:!1 === this.visible ? 0 : 1}); - this.visible && this._setPosition(); + b.initValueInput = d; + c.appendChild(d); + c = Entry.createElement("div"); + c.addClass("entryVariableSettingSplitterWorkspace"); + b.appendChild(c); + c = Entry.createElement("div"); + c.addClass("entryVariableSettingSlideWrapperWorkspace"); + b.appendChild(c); + d = Entry.createElement("span"); + d.innerHTML = Lang.Workspace.slide; + c.appendChild(d); + d = Entry.createElement("span"); + d.addClass("entryVariableSettingCheckWorkspace"); + b.slideCheck = d; + c.appendChild(d); + c.bindOnClick(function(b) { + var c; + b = a.selectedVariable; + var d = a.variables_, f = b.getType(); + "variable" == f ? (c = b.toJSON(), c.variableType = "slide", c = new Entry.Variable(c), d.splice(d.indexOf(b), 0, c), 0 > c.getValue() && c.setValue(0), 100 < c.getValue() && c.setValue(100), e.removeAttribute("disabled"), g.removeAttribute("disabled")) : "slide" == f && (c = b.toJSON(), c.variableType = "variable", c = new Entry.Variable(c), d.splice(d.indexOf(b), 0, c), e.setAttribute("disabled", "disabled"), g.setAttribute("disabled", "disabled")); + a.createVariableView(c); + a.removeVariable(b); + a.updateSelectedVariable(c); + c.generateView(); + }); + c = Entry.createElement("div"); + b.minMaxWrapper = c; + c.addClass("entryVariableSettingMinMaxWrapperWorkspace"); + b.appendChild(c); + d = Entry.createElement("span"); + d.innerHTML = Lang.Workspace.min_value; + c.appendChild(d); + var e = Entry.createElement("input"); + e.addClass("entryVariableSettingMinValueInputWorkspace"); + d = a.selectedVariable; + e.value = d && "slide" == d.type ? d.minValue_ : 0; + e.onkeypress = function(b) { + 13 === b.keyCode && this.blur(); }; - b._updateShadow = function() { - this.shadow && Entry.Utils.colorDarken(this._schema.color, .7); + e.onblur = function(b) { + isNaN(this.value) || (b = a.selectedVariable, b.setMinValue(this.value), a.updateVariableSettingView(b)); }; - b._setMovable = function() { - this.movable = null !== this.block.isMovable() ? this.block.isMovable() : void 0 !== this._skeleton.movable ? this._skeleton.movable : !0; + b.minValueInput = e; + c.appendChild(e); + var f = Entry.createElement("span"); + f.addClass("entryVariableSettingMaxValueSpanWorkspace"); + f.innerHTML = Lang.Workspace.max_value; + c.appendChild(f); + var g = Entry.createElement("input"); + g.addClass("entryVariableSettingMaxValueInputWorkspace"); + g.value = d && "slide" == d.type ? d.maxValue_ : 100; + g.onkeypress = function(b) { + 13 === b.keyCode && this.blur(); }; - b._setReadOnly = function() { - this.readOnly = null !== this.block.isReadOnly() ? this.block.isReadOnly() : void 0 !== this._skeleton.readOnly ? this._skeleton.readOnly : !1; + g.onblur = function(b) { + isNaN(this.value) || (b = a.selectedVariable, b.setMaxValue(this.value), a.updateVariableSettingView(b)); }; - b._setCopyable = function() { - this.copyable = null !== this.block.isCopyable() ? this.block.isCopyable() : void 0 !== this._skeleton.copyable ? this._skeleton.copyable : !0; + b.maxValueInput = g; + c.appendChild(g); +}; +Entry.VariableContainer.prototype.updateVariableSettingView = function(a) { + var b = this.variableSettingView, c = b.visibleCheck, d = b.initValueInput, e = b.slideCheck, f = b.minValueInput, g = b.maxValueInput, h = b.minMaxWrapper; + c.removeClass("entryVariableSettingChecked"); + a.isVisible() && c.addClass("entryVariableSettingChecked"); + e.removeClass("entryVariableSettingChecked"); + "slide" == a.getType() ? (e.addClass("entryVariableSettingChecked"), f.removeAttribute("disabled"), g.removeAttribute("disabled"), f.value = a.getMinValue(), g.value = a.getMaxValue(), h.removeClass("entryVariableMinMaxDisabledWorkspace")) : (h.addClass("entryVariableMinMaxDisabledWorkspace"), f.setAttribute("disabled", "disabled"), g.setAttribute("disabled", "disabled")); + d.value = a.getValue(); + a.listElement.appendChild(b); + b.removeClass("entryRemove"); +}; +Entry.VariableContainer.prototype.generateListSettingView = function() { + var a = this, b = Entry.createElement("div"); + b.bindOnClick(function(b) { + b.stopPropagation(); + }); + this.listSettingView = b; + b.addClass("entryListSettingWorkspace"); + this.listView_.appendChild(b); + b.addClass("entryRemove"); + var c = Entry.createElement("div"); + c.addClass("entryListSettingVisibleWrapperWorkspace"); + c.bindOnClick(function(b) { + b = a.selectedList; + var c = a.listSettingView.visibleCheck; + b.setVisible(!b.isVisible()); + b.isVisible() ? c.addClass("entryListSettingCheckedWorkspace") : c.removeClass("entryListSettingCheckedWorkspace"); + }); + b.appendChild(c); + var d = Entry.createElement("span"); + d.innerHTML = Lang.Workspace.show_list_workspace; + c.appendChild(d); + d = Entry.createElement("span"); + d.addClass("entryListSettingCheckWorkspace"); + b.visibleCheck = d; + c.appendChild(d); + d = Entry.createElement("div"); + d.addClass("entryListSettingLengthWrapperWorkspace"); + c = Entry.createElement("span"); + c.addClass("entryListSettingLengthSpanWorkspace"); + c.innerHTML = Lang.Workspace.number_of_list; + d.appendChild(c); + b.appendChild(d); + c = Entry.createElement("div"); + c.addClass("entryListSettingLengthControllerWorkspace"); + d.appendChild(c); + d = Entry.createElement("span"); + d.addClass("entryListSettingMinusWorkspace"); + d.bindOnClick(function(b) { + a.selectedList.array_.pop(); + a.updateListSettingView(a.selectedList); + }); + c.appendChild(d); + d = Entry.createElement("input"); + d.addClass("entryListSettingLengthInputWorkspace"); + d.onblur = function() { + a.setListLength(this.value); }; - b.bumpAway = function(a, b) { - var d = this; - a = a || 15; - b ? window.setTimeout(function() { - d._moveBy(a, a, !1); - }, b) : d._moveBy(a, a, !1); + d.onkeypress = function(b) { + 13 == b.keyCode && this.blur(); }; - b.bindPrev = function(a) { - if (a) { - if (this._toLocalCoordinate(a.view._nextGroup), (a = a.getNextBlock()) && a !== this.block) { - var b = this.block.getLastBlock(); - b.view.magnet.next ? a.view._toLocalCoordinate(b.view._nextGroup) : (a.view._toGlobalCoordinate(), a.separate(), a.view.bumpAway(null, 100)); + b.lengthInput = d; + c.appendChild(d); + d = Entry.createElement("span"); + d.addClass("entryListSettingPlusWorkspace"); + d.bindOnClick(function(b) { + a.selectedList.array_.push({data:0}); + a.updateListSettingView(a.selectedList); + }); + c.appendChild(d); + c = Entry.createElement("div"); + b.seperator = c; + b.appendChild(c); + c.addClass("entryListSettingSeperatorWorkspace"); + c = Entry.createElement("div"); + c.addClass("entryListSettingListValuesWorkspace"); + b.listValues = c; + b.appendChild(c); +}; +Entry.VariableContainer.prototype.updateListSettingView = function(a) { + var b = this; + a = a || this.selectedList; + var c = this.listSettingView, d = c.listValues, e = c.visibleCheck, f = c.lengthInput, g = c.seperator; + e.removeClass("entryListSettingCheckedWorkspace"); + a.isVisible() && e.addClass("entryListSettingCheckedWorkspace"); + f.value = a.array_.length; + for (a.listElement.appendChild(c);d.firstChild;) { + d.removeChild(d.firstChild); + } + var h = a.array_; + 0 === h.length ? g.addClass("entryRemove") : g.removeClass("entryRemove"); + for (e = 0;e < h.length;e++) { + (function(c) { + var e = Entry.createElement("div"); + e.addClass("entryListSettingValueWrapperWorkspace"); + var f = Entry.createElement("span"); + f.addClass("entryListSettingValueNumberSpanWorkspace"); + f.innerHTML = c + 1; + e.appendChild(f); + f = Entry.createElement("input"); + f.value = h[c].data; + f.onblur = function() { + h[c].data = this.value; + a.updateView(); + }; + f.onkeypress = function(b) { + 13 == b.keyCode && this.blur(); + }; + f.addClass("entryListSettingEachInputWorkspace"); + e.appendChild(f); + f = Entry.createElement("span"); + f.bindOnClick(function() { + h.splice(c, 1); + b.updateListSettingView(); + }); + f.addClass("entryListSettingValueRemoveWorkspace"); + e.appendChild(f); + d.appendChild(e); + })(e); + } + a.updateView(); + c.removeClass("entryRemove"); +}; +Entry.VariableContainer.prototype.setListLength = function(a) { + a = Number(a); + var b = this.selectedList.array_; + if (!isNaN(a)) { + var c = b.length; + if (c < a) { + for (a -= c, c = 0;c < a;c++) { + b.push({data:0}); } } else { - if (a = this.block.getPrevBlock()) { - this._toLocalCoordinate(a.view._nextGroup), (a = this.block.getNextBlock()) && a.view && a.view._toLocalCoordinate(this._nextGroup); + c > a && (b.length = a); + } + } + this.updateListSettingView(); +}; +Entry.VariableContainer.prototype.updateViews = function() { + var a = this.lists_; + this.variables_.map(function(b) { + b.updateView(); + }); + a.map(function(b) { + b.updateView(); + }); +}; +Entry.VariableContainer.prototype.updateSelectedVariable = function(a, b) { + a ? "variable" == a.type ? (this.selectedVariable = a, this.updateVariableSettingView(a)) : "slide" == a.type ? (this.selectedVariable = a, this.updateVariableSettingView(a)) : "list" == a.type && (this.selectedList = a, this.updateListSettingView(a)) : (this.selectedVariable = null, "variable" == (b || "variable") ? this.variableSettingView.addClass("entryRemove") : this.listSettingView.addClass("entryRemove")); +}; +Entry.VariableContainer.prototype.removeLocalVariables = function(a) { + var b = [], c = this; + this.mapVariable(function(a, c) { + a.object_ && a.object_ == c && b.push(a); + }, a); + b.map(function(b) { + c.removeVariable(b); + }); +}; +Entry.VariableContainer.prototype.updateCloudVariables = function() { + var a = Entry.projectId; + if (Entry.cloudSavable && a) { + var b = Entry.variableContainer, a = b.variables_.filter(function(b) { + return b.isCloud_; + }), a = a.map(function(b) { + return b.toJSON(); + }), b = b.lists_.filter(function(b) { + return b.isCloud_; + }), b = b.map(function(b) { + return b.toJSON(); + }); + $.ajax({url:"/api/project/variable/" + Entry.projectId, type:"PUT", data:{variables:a, lists:b}}).done(function() { + }); + } +}; +Entry.VariableContainer.prototype.addRef = function(a, b) { + if (this.view_ && Entry.playground.mainWorkspace && Entry.playground.mainWorkspace.getMode() === Entry.Workspace.MODE_BOARD) { + var c = {object:b.getCode().object, block:b}; + b.funcBlock && (c.funcBlock = b.funcBlock, delete b.funcBlock); + this[a].push(c); + if ("_functionRefs" == a) { + a = b.type.substr(5); + for (var d = Entry.variableContainer.functions_[a].content.getBlockList(), e = 0;e < d.length;e++) { + b = d[e]; + var f = b.events; + -1 < b.type.indexOf("func_") && b.type.substr(5) == a || (f && f.viewAdd && f.viewAdd.forEach(function(a) { + b.getCode().object = c.object; + a && (b.funcBlock = c.block, a(b)); + }), f && f.dataAdd && f.dataAdd.forEach(function(a) { + b.getCode().object = c.object; + a && (b.funcBlock = c.block, a(b)); + })); } } - }; - b.getAbsoluteCoordinate = function(a) { - a = void 0 !== a ? a : this.dragMode; - if (a === Entry.DRAG_MODE_DRAG) { - return {x:this.x, y:this.y}; + return c; + } +}; +Entry.VariableContainer.prototype.removeRef = function(a, b) { + if (Entry.playground.mainWorkspace && Entry.playground.mainWorkspace.getMode() === Entry.Workspace.MODE_BOARD) { + for (var c = this[a], d = 0;d < c.length;d++) { + if (c[d].block == b) { + c.splice(d, 1); + break; + } + } + if ("_functionRefs" == a && (a = b.type.substr(5), d = Entry.variableContainer.functions_[a])) { + for (c = d.content.getBlockList(), d = 0;d < c.length;d++) { + b = c[d]; + var e = b.events; + -1 < b.type.indexOf("func_") && b.type.substr(5) == a || (e && e.viewDestroy && e.viewDestroy.forEach(function(a) { + a && a(b); + }), e && e.dataDestroy && e.dataDestroy.forEach(function(a) { + a && a(b); + })); + } + } + } +}; +Entry.VariableContainer.prototype._getBlockMenu = function() { + return Entry.playground.mainWorkspace.getBlockMenu(); +}; +Entry.VariableContainer.prototype._truncName = function(a, b) { + a = a.substring(0, this._maxNameLength); + Entry.toast.warning(Lang.Workspace[b + "_name_auto_edited_title"], Lang.Workspace[b + "_name_auto_edited_content"]); + return a; +}; +Entry.VariableContainer.prototype._maxNameLength = 10; +Entry.block.run = {skeleton:"basic", color:"#3BBD70", contents:["this is", "basic block"], func:function() { +}}; +Entry.block.mutant = {skeleton:"basic", event:"start", color:"#3BBD70", template:"test mutant block", params:[], func:function() { +}, changeEvent:new Entry.Event}; +Entry.block.jr_start = {skeleton:"pebble_event", event:"start", color:"#3BBD70", template:"%1", params:[{type:"Indicator", img:"/img/assets/ntry/bitmap/jr/block_play_image.png", highlightColor:"#3BBD70", position:{x:0, y:0}, size:22}], func:function() { + var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), b; + for (b in a) { + this._unit = a[b]; + } + Ntry.unitComp = Ntry.entityManager.getComponent(this._unit.id, Ntry.STATIC.UNIT); +}}; +Entry.block.jr_repeat = {skeleton:"pebble_loop", color:"#127CDB", template:"%1 \ubc18\ubcf5", params:[{type:"Text", text:Lang.Menus.repeat_0}, {type:"Dropdown", options:[[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]], value:3, fontSize:14, roundValue:3}, {type:"Text", text:Lang.Menus.repeat_1}], statements:[], func:function() { + if (void 0 === this.repeatCount) { + return this.repeatCount = this.block.params[0], Entry.STATIC.CONTINUE; + } + if (0 < this.repeatCount) { + this.repeatCount--; + var a = this.block.statements[0]; + if (0 !== a.getBlocks().length) { + return this.executor.stepInto(a), Entry.STATIC.CONTINUE; + } + } else { + delete this.repeatCount; + } +}}; +Entry.block.jr_item = {skeleton:"pebble_basic", color:"#F46C6C", template:"\uaf43 \ubaa8\uc73c\uae30 %1", params:[{type:"Indicator", img:"/img/assets/ntry/bitmap/jr/block_item_image.png", highlightColor:"#FFF", position:{x:83, y:0}, size:22}], func:function() { + if (this.isContinue) { + if (this.isAction) { + return Entry.STATIC.CONTINUE; + } + delete this.isAction; + delete this.isContinue; + } else { + this.isAction = this.isContinue = !0; + var a = this; + Ntry.dispatchEvent("unitAction", Ntry.STATIC.GET_ITEM, function() { + Ntry.dispatchEvent("getItem"); + a.isAction = !1; + }); + return Entry.STATIC.CONTINUE; + } +}}; +Entry.block.cparty_jr_item = {skeleton:"pebble_basic", color:"#8ABC1D", template:"%1 %2", params:[{type:"Text", text:Lang.Menus.pick_up_pencil}, {type:"Indicator", img:"/img/assets/ntry/bitmap/cpartyjr/pen.png", highlightColor:"#FFF", position:{x:83, y:0}, size:22}], func:function() { + if (this.isContinue) { + if (this.isAction) { + return Entry.STATIC.CONTINUE; + } + delete this.isAction; + delete this.isContinue; + } else { + this.isAction = this.isContinue = !0; + var a = this; + Ntry.dispatchEvent("unitAction", Ntry.STATIC.GET_ITEM, function() { + Ntry.dispatchEvent("getItem"); + a.isAction = !1; + }); + return Entry.STATIC.CONTINUE; + } +}}; +Entry.block.jr_north = {skeleton:"pebble_basic", color:"#A751E3", template:"%1 %2", params:[{type:"Text", text:Lang.Menus.go_up}, {type:"Indicator", img:"/img/assets/ntry/bitmap/jr/block_up_image.png", position:{x:83, y:0}, size:22}], func:function() { + if (this.isContinue) { + if (this.isAction) { + return Entry.STATIC.CONTINUE; } - a = this.block.getThread().view.requestAbsoluteCoordinate(this); - a.x += this.x; - a.y += this.y; - return a; - }; - b.getBelowHeight = function() { - return this.block.getThread().view.requestPartHeight(this); - }; - b._updateDisplay = function() { - this.svgGroup.attr({display:!1 === this.display ? "none" : "block"}); - this.display && this._setPosition(); - }; - b._updateColor = function() { - var a = this._schema.color; - this.block.deletable === Entry.Block.DELETABLE_FALSE_LIGHTEN && (a = Entry.Utils.colorLighten(a)); - this._fillColor = a; - this._path.attr({fill:a}); - this._updateContents(); - }; - b._updateContents = function() { - for (var a = 0;a < this._contents.length;a++) { - this._contents[a].renderStart(); + delete this.isAction; + delete this.isContinue; + } else { + this.isAction = this.isContinue = !0; + var a = Ntry.STATIC, b = this, c = function() { + window.setTimeout(function() { + Ntry.dispatchEvent("unitAction", Ntry.STATIC.WALK, function() { + b.isAction = !1; + }); + }, 3); + }, d; + switch(Ntry.unitComp.direction) { + case Ntry.STATIC.EAST: + d = a.TURN_LEFT; + break; + case Ntry.STATIC.SOUTH: + d = a.HALF_ROTATION; + break; + case Ntry.STATIC.WEST: + d = a.TURN_RIGHT; + break; + default: + c(); } - this.alignContent(!1); - }; - b._destroyObservers = function() { - for (var a = this._observers;a.length;) { - a.pop().destroy(); + d && Ntry.dispatchEvent("unitAction", d, c); + return Entry.STATIC.CONTINUE; + } +}}; +Entry.block.jr_east = {skeleton:"pebble_basic", color:"#A751E3", template:"%1 %2", params:[{type:"Text", text:Lang.Menus.go_right}, {type:"Indicator", img:"/img/assets/ntry/bitmap/jr/block_right_image.png", position:{x:83, y:0}, size:22}], func:function() { + var a = Ntry.STATIC; + if (this.isContinue) { + if (this.isAction) { + return Entry.STATIC.CONTINUE; } - }; - b._changeFill = function(a) { - var b = this.getBoard(); - if (b.patternRect && !b.dragBlock) { - var d = this._fillColor, e = this._path, b = this.getBoard(); - a ? (b.setPatternRectFill(d), d = "url(#blockHoverPattern_" + this.getBoard().suffix + ")") : b.disablePattern(); - e.attr({fill:d}); + delete this.isAction; + delete this.isContinue; + } else { + this.isAction = this.isContinue = !0; + var b = this, c = function() { + window.setTimeout(function() { + Ntry.dispatchEvent("unitAction", a.WALK, function() { + b.isAction = !1; + }); + }, 3); + }, d; + switch(Ntry.unitComp.direction) { + case a.SOUTH: + d = a.TURN_LEFT; + break; + case a.WEST: + d = a.HALF_ROTATION; + break; + case a.NORTH: + d = a.TURN_RIGHT; + break; + default: + c(); } - }; - b.addActivated = function() { - this.svgGroup.addClass("activated"); - }; - b.removeActivated = function() { - this.svgGroup.removeClass("activated"); - }; - b.reDraw = function() { - if (this.visible) { - var a = this.block; - requestAnimFrame(this._updateContents.bind(this)); - var b = a.params; - if (b) { - for (var d = 0;d < b.length;d++) { - var e = b[d]; - e instanceof Entry.Block && e.view.reDraw(); - } - } - if (a = a.statements) { - for (d = 0;d < a.length;d++) { - a[d].view.reDraw(); - } - } + d && Ntry.dispatchEvent("unitAction", d, c); + return Entry.STATIC.CONTINUE; + } +}}; +Entry.block.jr_south = {skeleton:"pebble_basic", color:"#A751E3", template:"%1 %2", params:[{type:"Text", text:Lang.Menus.go_down}, {type:"Indicator", img:"/img/assets/ntry/bitmap/jr/block_down_image.png", position:{x:83, y:0}, size:22}], func:function() { + if (this.isContinue) { + if (this.isAction) { + return Entry.STATIC.CONTINUE; } - }; - b.getParam = function(a) { - return this._paramMap[a]; - }; - b.getDataUrl = function(a, b) { - function d() { - g = g.replace("(svgGroup)", (new XMLSerializer).serializeToString(k)).replace("%W", h.width * n).replace("%H", h.height * n).replace("(defs)", (new XMLSerializer).serializeToString(q[0])).replace(/>\s+/g, ">").replace(/\s+ e || d.splice(e, 1); + delete this.isAction; + delete this.isContinue; + } else { + this.isAction = this.isContinue = !0; + var a = this; + Ntry.dispatchEvent("unitAction", Ntry.STATIC.GO_SLOW, function() { + a.isAction = !1; + }); + return Entry.STATIC.CONTINUE; + } +}}; +Entry.block.jr_repeat_until_dest = {skeleton:"basic_loop", color:"#498DEB", template:"%1 %2 %3 %4", syntax:["BasicWhile", "true"], params:[Lang.Menus.repeat_until_reach_2, {type:"Image", img:"/img/assets/ntry/bitmap/jr/jr_goal_image.png", size:18}, Lang.Menus.repeat_until_reach_1, {type:"Image", img:"/img/assets/week/blocks/for.png", size:24}], statements:[{accept:"basic"}], func:function() { + var a = this.block.statements[0]; + if (0 !== a.getBlocks().length) { + return this.executor.stepInto(a), Entry.STATIC.CONTINUE; + } +}}; +Entry.block.jr_if_construction = {skeleton:"basic_loop", color:"#498DEB", template:"%1 %2 %3 %4", params:[Lang.Menus.jr_if_1, {type:"Image", img:"/img/assets/ntry/bitmap/jr/jr_construction_image.png", size:18}, Lang.Menus.jr_if_2, {type:"Image", img:"/img/assets/week/blocks/for.png", size:24}], statements:[{accept:"basic"}], func:function() { + if (!this.isContinue) { + var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), b, c; + for (c in a) { + b = a[c]; } - }; - b.raiseEvent = function(a, b, d) { - a = this._eventMap[a]; - var e = []; - if (void 0 !== a) { - for (var f = 0;f < a.length;f++) { - var g = a[f]; - if (void 0 === d || -1 < g.params.indexOf(d)) { - g = new Entry.Executor(a[f], b), this.executors.push(g), e.push(g); - } - } - return e; + a = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.UNIT); + b = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.GRID); + b = {x:b.x, y:b.y}; + Ntry.addVectorByDirection(b, a.direction, 1); + b = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:b.x, y:b.y}, {type:Ntry.STATIC.TILE, tileType:Ntry.STATIC.OBSTACLE_REPAIR}); + this.isContinue = !0; + a = this.block.statements[0]; + if (0 !== b.length && 0 !== a.getBlocks().length) { + return this.executor.stepInto(a), Entry.STATIC.CONTINUE; } - }; - b.getEventMap = function(a) { - return this._eventMap[a]; - }; - b.map = function(a) { - this._data.map(a); - }; - b.tick = function() { - for (var a = this.executors, b = 0;b < a.length;b++) { - var d = a[b]; - d.isEnd() ? (a.splice(b--, 1), 0 === a.length && this.executeEndEvent.notify()) : d.execute(); + } +}}; +Entry.block.jr_if_speed = {skeleton:"basic_loop", color:"#498DEB", template:Lang.Menus.jr_if_1 + " %1 " + Lang.Menus.jr_if_2 + " %2", params:[{type:"Image", img:"/img/assets/ntry/bitmap/jr/jr_speed_image.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/for.png", size:24}], statements:[{accept:"basic"}], func:function() { + if (!this.isContinue) { + var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), b, c; + for (c in a) { + b = a[c]; } - }; - b.removeExecutor = function(a) { - a = this.executors.indexOf(a); - -1 < a && this.executors.splice(a, 1); - }; - b.clearExecutors = function() { - this.executors.forEach(function(a) { - a.end(); - }); - this.executors = []; - }; - b.clearExecutorsByEntity = function(a) { - for (var b = this.executors, d = 0;d < b.length;d++) { - var e = b[d]; - e.entity === a && e.end(); + a = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.UNIT); + b = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.GRID); + b = {x:b.x, y:b.y}; + Ntry.addVectorByDirection(b, a.direction, 1); + b = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:b.x, y:b.y}, {type:Ntry.STATIC.TILE, tileType:Ntry.STATIC.OBSTACLE_SLOW}); + this.isContinue = !0; + a = this.block.statements[0]; + if (0 !== b.length && 0 !== a.getBlocks().length) { + return this.executor.stepInto(a), Entry.STATIC.CONTINUE; } - }; - b.addExecutor = function(a) { - this.executors.push(a); - }; - b.createThread = function(a, b) { - if (!(a instanceof Array)) { - return console.error("blocks must be array"); + } +}}; +Entry.block.maze_step_start = {skeleton:"basic_event", mode:"maze", event:"start", color:"#3BBD70", template:"%1 \uc2dc\uc791\ud558\uae30\ub97c \ud074\ub9ad\ud588\uc744 \ub54c", syntax:["Program"], params:[{type:"Indicator", boxMultiplier:2, img:"/img/assets/block_icon/start_icon_play.png", highlightColor:"#3BBD70", size:17, position:{x:0, y:-2}}], func:function() { + var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), b; + for (b in a) { + this._unit = a[b]; + } + Ntry.unitComp = Ntry.entityManager.getComponent(this._unit.id, Ntry.STATIC.UNIT); +}}; +Entry.block.maze_step_jump = {skeleton:"basic", mode:"maze", color:"#FF6E4B", template:"\ub6f0\uc5b4\ub118\uae30%1", params:[{type:"Image", img:"/img/assets/week/blocks/jump.png", size:24}], syntax:["Scope", "jump"], func:function() { + if (this.isContinue) { + if (this.isAction) { + return Entry.STATIC.CONTINUE; } - var d = new Entry.Thread(a, this); - void 0 === b ? this._data.push(d) : this._data.insert(d, b); - return d; - }; - b.cloneThread = function(a, b) { - var d = a.clone(this, b); - this._data.push(d); - return d; - }; - b.destroyThread = function(a, b) { - var d = this._data, e = d.indexOf(a); - 0 > e || d.splice(e, 1); - }; - b.doDestroyThread = function(a, b) { - var d = this._data, e = d.indexOf(a); - 0 > e || d.splice(e, 1); - }; - b.getThreads = function() { - return this._data.map(function(a) { - return a; + delete this.isAction; + delete this.isContinue; + } else { + this.isAction = this.isContinue = !0; + var a = this; + Ntry.dispatchEvent("unitAction", Ntry.STATIC.JUMP, function() { + a.isAction = !1; }); - }; - b.toJSON = function() { - for (var a = this.getThreads(), b = [], d = 0, e = a.length;d < e;d++) { - b.push(a[d].toJSON()); - } - return b; - }; - b.countBlock = function() { - for (var a = this.getThreads(), b = 0, d = 0;d < a.length;d++) { - b += a[d].countBlock(); + return Entry.STATIC.CONTINUE; + } +}}; +Entry.block.maze_step_for = {skeleton:"basic_loop", mode:"maze", color:"#498DEB", template:"%1 \ubc88 \ubc18\ubcf5\ud558\uae30%2", syntax:["BasicIteration"], params:[{type:"Dropdown", key:"REPEAT", options:[[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]], value:1}, {type:"Image", img:"/img/assets/week/blocks/for.png", size:24}], statements:[{accept:"basic"}], func:function() { + if (void 0 === this.repeatCount) { + return this.repeatCount = this.block.params[0], Entry.STATIC.CONTINUE; + } + if (0 < this.repeatCount) { + this.repeatCount--; + var a = this.block.statements[0]; + if (0 !== a.getBlocks().length) { + return this.executor.stepInto(a), Entry.STATIC.CONTINUE; } - return b; - }; - b.moveBy = function(a, b) { - for (var d = this.getThreads(), e = 0, f = d.length;e < f;e++) { - var g = d[e].getFirstBlock(); - g && g.view._moveBy(a, b, !1); + } else { + delete this.repeatCount; + } +}}; +Entry.block.test = {skeleton:"basic_boolean_field", mode:"maze", color:"#127CDB", template:"%1 this is test block %2", params:[{type:"Angle", value:"90"}, {type:"Dropdown", options:[[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]], value:1}], func:function() { +}}; +Entry.block.maze_repeat_until_1 = {skeleton:"basic_loop", mode:"maze", color:"#498DEB", template:"%1 \ub9cc\ub0a0 \ub54c \uae4c\uc9c0 \ubc18\ubcf5%2", syntax:["BasicWhile", "true"], params:[{type:"Image", img:"/img/assets/ntry/block_inner/repeat_goal_1.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/for.png", size:24}], statements:[{accept:"basic"}], func:function() { + var a = this.block.statements[0]; + if (0 !== a.getBlocks().length) { + return this.executor.stepInto(a), Entry.STATIC.CONTINUE; + } +}}; +Entry.block.maze_repeat_until_2 = {skeleton:"basic_loop", mode:"maze", color:"#498DEB", template:"\ubaa8\ub4e0 %1 \ub9cc\ub0a0 \ub54c \uae4c\uc9c0 \ubc18\ubcf5%2", syntax:["BasicWhile", "true"], params:[{type:"Image", img:"/img/assets/ntry/block_inner/repeat_goal_1.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/for.png", size:24}], statements:[{accept:"basic"}], func:function() { + var a = this.block.statements[0]; + if (0 !== a.getBlocks().length) { + return this.executor.stepInto(a), Entry.STATIC.CONTINUE; + } +}}; +Entry.block.maze_step_if_1 = {skeleton:"basic_loop", mode:"maze", color:"#498DEB", template:"\ub9cc\uc57d \uc55e\uc5d0 %1 \uc788\ub2e4\uba74%2", syntax:["BasicIf", 'front == "wall"'], params:[{type:"Image", img:"/img/assets/ntry/block_inner/if_target_1.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/if.png", size:24}], statements:[{accept:"basic"}], func:function() { + if (!this.isContinue) { + var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), b, c; + for (c in a) { + b = a[c]; + } + a = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.UNIT); + b = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.GRID); + b = {x:b.x, y:b.y}; + Ntry.addVectorByDirection(b, a.direction, 1); + c = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:b.x, y:b.y}); + a = this.block.statements[0]; + if (0 === c.length) { + return this.executor.stepInto(a), Entry.STATIC.CONTINUE; } - d = this.board; - d instanceof Entry.BlockMenu && d.updateSplitters(b); - }; - b.stringify = function() { - return JSON.stringify(this.toJSON()); - }; - b.dominate = function(a) { - a.view.setZIndex(this._maxZIndex++); - }; - b.indexOf = function(a) { - return this._data.indexOf(a); - }; - b._handleChange = function() { - Entry.creationChangedEvent && Entry.creationChangedEvent.notify(); - }; - b.hasBlockType = function(a) { - for (var b = this.getThreads(), d = 0;d < b.length;d++) { - if (b[d].hasBlockType(a)) { - return !0; - } + b = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:b.x, y:b.y}, {type:Ntry.STATIC.TILE, tileType:Ntry.STATIC.WALL}); + this.isContinue = !0; + if (0 !== b.length && 0 !== a.getBlocks().length) { + return this.executor.stepInto(a), Entry.STATIC.CONTINUE; } - return !1; - }; - b.findById = function(a) { - return this._blockMap[a]; - }; - b.registerBlock = function(a) { - this._blockMap[a.id] = a; - }; - b.unregisterBlock = function(a) { - delete this._blockMap[a.id]; - }; - b.getByPointer = function(a) { - a = a.concat(); - a.shift(); - a.shift(); - for (var b = this._data[a.shift()].getBlock(a.shift());a.length;) { - b instanceof Entry.Block || (b = b.getValueBlock()); - var d = a.shift(), e = a.shift(); - -1 < d ? b = b.statements[d].getBlock(e) : -1 === d && (b = b.view.getParam(e)); + } +}}; +Entry.block.maze_step_if_2 = {skeleton:"basic_loop", mode:"maze", color:"#498DEB", template:"\ub9cc\uc57d \uc55e\uc5d0 %1 \uc788\ub2e4\uba74%2", syntax:["BasicIf", 'front == "bee"'], params:[{type:"Image", img:"/img/assets/ntry/bitmap/maze2/obstacle_01.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/if.png", size:24}], statements:[{accept:"basic"}], func:function() { + if (!this.isContinue) { + var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), b, c; + for (c in a) { + b = a[c]; } - return b; - }; - b.getTargetByPointer = function(a) { - a = a.concat(); - a.shift(); - a.shift(); - var b = this._data[a.shift()], d; - if (1 === a.length) { - d = b.getBlock(a.shift() - 1); - } else { - for (d = b.getBlock(a.shift());a.length;) { - d instanceof Entry.Block || (d = d.getValueBlock()); - var e = a.shift(), b = a.shift(); - -1 < e ? (d = d.statements[e], d = a.length ? d.getBlock(b) : 0 === b ? d.view.getParent() : d.getBlock(b - 1)) : -1 === e && (d = d.view.getParam(b)); - } + a = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.UNIT); + b = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.GRID); + b = {x:b.x, y:b.y}; + Ntry.addVectorByDirection(b, a.direction, 1); + b = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:b.x, y:b.y}, {type:Ntry.STATIC.TILE, tileType:Ntry.STATIC.OBSTACLE_BEE}); + this.isContinue = !0; + a = this.block.statements[0]; + if (0 !== b.length && 0 !== a.getBlocks().length) { + return this.executor.stepInto(a), Entry.STATIC.CONTINUE; } - return d; - }; - b.getBlockList = function(a, b) { - for (var d = this.getThreads(), e = [], f = 0;f < d.length;f++) { - e = e.concat(d[f].getBlockList(a, b)); + } +}}; +Entry.block.maze_call_function = {skeleton:"basic", mode:"maze", color:"#B57242", template:"\uc57d\uc18d \ubd88\ub7ec\uc624\uae30%1", syntax:["Scope", "promise"], params:[{type:"Image", img:"/img/assets/week/blocks/function.png", size:24}], func:function() { + if (!this.funcExecutor) { + var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.CODE), b; + for (b in a) { + this.funcExecutor = new Entry.Executor(a[b].components[Ntry.STATIC.CODE].code.getEventMap("define")[0]); } - return e; - }; - b.removeBlocksByType = function(a) { - this.getBlockList(!1, a).forEach(function(a) { - a.doDestroy(); - }); - }; -})(Entry.Code.prototype); -Entry.CodeView = function(b, a) { - Entry.Model(this, !1); - this.code = b; - this.set({board:a}); - this.svgThreadGroup = a.svgGroup.elem("g"); - this.svgThreadGroup.attr({class:"svgThreadGroup"}); - this.svgThreadGroup.board = a; - this.svgBlockGroup = a.svgGroup.elem("g"); - this.svgBlockGroup.attr({class:"svgBlockGroup"}); - this.svgBlockGroup.board = a; - a.bindCodeView(this); - this.code.map(function(b) { - b.createView(a); - }); - b.observe(this, "_setBoard", ["board"]); -}; -(function(b) { - b.schema = {board:null, scrollX:0, scrollY:0}; - b._setBoard = function() { - this.set({board:this.code.board}); - }; - b.reDraw = function() { - this.code.map(function(a) { - a.view.reDraw(); - }); - }; -})(Entry.CodeView.prototype); -Entry.ConnectionRipple = {}; -(function(b) { - b.createDom = function(a) { - this.svgDom || (this._ripple = a.getBoard().svgGroup.elem("circle", {cx:0, cy:0, r:0, stroke:"#888", "stroke-width":10})); - }; - b.setView = function(a) { - this._ripple || this.createDom(a); - var b = this._ripple, d = a.getBoard().svgGroup; - b.remove(); - a = a.getAbsoluteCoordinate(); - b.attr({cx:a.x, cy:a.y}); - d.appendChild(b); - b._startTime = new Date; - return this; - }; - b.dispose = function() { - var a = this, b = this._ripple, d = (new Date - b._startTime) / 150; - 1 < d ? b.remove() : (b.attr({r:25 * d, opacity:1 - d}), window.setTimeout(function() { - a.dispose(); - }, 10)); - }; -})(Entry.ConnectionRipple); -Entry.Executor = function(b, a) { - this.scope = new Entry.Scope(b, this); - this.entity = a; - this._callStack = []; - this.register = {}; -}; -(function(b) { - b.execute = function() { - if (!this.isEnd()) { - for (;;) { - var a = null; - try { - a = this.scope.block.getSchema().func.call(this.scope, this.entity, this.scope); - } catch (b) { - if ("AsyncError" === b.name) { - a = Entry.STATIC.BREAK; - } else { - var c = !1; - "\ub7f0\ud0c0\uc784 \uc5d0\ub7ec" != b.message && (c = !0); - Entry.Utils.stopProjectWithToast(this.scope, "\ub7f0\ud0c0\uc784 \uc5d0\ub7ec", c); - } - } - if (this.isEnd()) { - break; - } - if (void 0 === a || null === a || a === Entry.STATIC.PASS) { - if (this.scope = new Entry.Scope(this.scope.block.getNextBlock(), this), null === this.scope.block) { - if (this._callStack.length) { - if (a = this.scope, this.scope = this._callStack.pop(), this.scope.isLooped !== a.isLooped) { - break; - } - } else { - break; - } - } - } else { - if (a !== Entry.STATIC.CONTINUE && (a === Entry.STATIC.BREAK || this.scope === a)) { - break; - } - } - } + } + this.funcExecutor.execute(); + if (null !== this.funcExecutor.scope.block) { + return Entry.STATIC.CONTINUE; + } +}}; +Entry.block.maze_define_function = {skeleton:"basic_define", mode:"maze", color:"#B57242", event:"define", template:"\uc57d\uc18d\ud558\uae30%1", syntax:["BasicFunction"], params:[{type:"Image", img:"/img/assets/week/blocks/function.png", size:24}], statements:[{accept:"basic"}], func:function(a) { + if (!this.executed && (a = this.block.statements[0], 0 !== a.getBlocks().length)) { + return this.executor.stepInto(a), this.executed = !0, Entry.STATIC.CONTINUE; + } +}}; +Entry.block.maze_step_if_3 = {skeleton:"basic_loop", mode:"maze", color:"#498DEB", template:"\ub9cc\uc57d \uc55e\uc5d0 %1 \uc788\ub2e4\uba74%2", syntax:["BasicIf", 'front == "banana"'], params:[{type:"Image", img:"/img/assets/ntry/block_inner/if_target_3.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/if.png", size:24}], statements:[{accept:"basic"}], func:function() { + if (!this.isContinue) { + var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), b, c; + for (c in a) { + b = a[c]; } - }; - b.stepInto = function(a) { - a instanceof Entry.Thread || console.error("Must step in to thread"); - a = a.getFirstBlock(); - if (!a) { - return Entry.STATIC.BREAK; + a = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.UNIT); + b = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.GRID); + b = {x:b.x, y:b.y}; + Ntry.addVectorByDirection(b, a.direction, 1); + b = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:b.x, y:b.y}, {type:Ntry.STATIC.TILE, tileType:Ntry.STATIC.OBSTACLE_BANANA}); + this.isContinue = !0; + a = this.block.statements[0]; + if (0 !== b.length && 0 !== a.getBlocks().length) { + return this.executor.stepInto(a), Entry.STATIC.CONTINUE; } - this._callStack.push(this.scope); - this.scope = new Entry.Scope(a, this); + } +}}; +Entry.block.maze_step_if_4 = {skeleton:"basic_loop", mode:"maze", color:"#498DEB", template:"\ub9cc\uc57d \uc55e\uc5d0 %1 \uc788\ub2e4\uba74%2", syntax:["BasicIf", 'front == "wall"'], params:[{type:"Image", img:"/img/assets/ntry/block_inner/if_target_2.png", size:18}, {type:"Image", img:"/img/assets/week/blocks/if.png", size:24}], statements:[{accept:"basic"}], func:function() { + if (!this.isContinue) { + var a = Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT), b, c; + for (c in a) { + b = a[c]; + } + a = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.UNIT); + b = Ntry.entityManager.getComponent(b.id, Ntry.STATIC.GRID); + b = {x:b.x, y:b.y}; + Ntry.addVectorByDirection(b, a.direction, 1); + b = Ntry.entityManager.find({type:Ntry.STATIC.GRID, x:b.x, y:b.y}, {type:Ntry.STATIC.TILE, tileType:Ntry.STATIC.WALL}); + this.isContinue = !0; + a = this.block.statements[0]; + if (0 !== b.length && 0 !== a.getBlocks().length) { + return this.executor.stepInto(a), Entry.STATIC.CONTINUE; + } + } +}}; +Entry.block.maze_step_move_step = {skeleton:"basic", mode:"maze", color:"#A751E3", template:"\uc55e\uc73c\ub85c \ud55c \uce78 \uc774\ub3d9%1", syntax:["Scope", "move"], params:[{type:"Image", img:"/img/assets/week/blocks/moveStep.png", size:24}], func:function() { + if (this.isContinue) { + if (this.isAction) { + return Entry.STATIC.CONTINUE; + } + delete this.isAction; + delete this.isContinue; + } else { + this.isAction = this.isContinue = !0; + var a = this; + Ntry.dispatchEvent("unitAction", Ntry.STATIC.WALK, function() { + a.isAction = !1; + }); return Entry.STATIC.CONTINUE; - }; - b.break = function() { - this._callStack.length && (this.scope = this._callStack.pop()); - return Entry.STATIC.PASS; - }; - b.breakLoop = function() { - this._callStack.length && (this.scope = this._callStack.pop()); - for (;this._callStack.length && "repeat" !== Entry.block[this.scope.block.type].class;) { - this.scope = this._callStack.pop(); + } +}}; +Entry.block.maze_step_rotate_left = {skeleton:"basic", mode:"maze", color:"#A751E3", template:"\uc67c\ucabd\uc73c\ub85c \ud68c\uc804%1", syntax:["Scope", "left"], params:[{type:"Image", img:"/img/assets/week/blocks/turnL.png", size:24}], func:function() { + if (this.isContinue) { + if (this.isAction) { + return Entry.STATIC.CONTINUE; } - return Entry.STATIC.PASS; - }; - b.end = function() { - this.scope.block = null; - }; - b.isEnd = function() { - return null === this.scope.block; - }; -})(Entry.Executor.prototype); -Entry.Scope = function(b, a) { - this.type = (this.block = b) ? b.type : null; - this.executor = a; - this.entity = a.entity; -}; -(function(b) { - b.callReturn = function() { - }; - b.getParam = function(a) { - a = this.block.params[a]; - var b = new Entry.Scope(a, this.executor); - return Entry.block[a.type].func.call(b, this.entity, b); - }; - b.getParams = function() { + delete this.isAction; + delete this.isContinue; + } else { + this.isAction = this.isContinue = !0; var a = this; - return this.block.params.map(function(b) { - if (b instanceof Entry.Block) { - var d = new Entry.Scope(b, a.executor); - return Entry.block[b.type].func.call(d, a.entity, d); - } - return b; + Ntry.dispatchEvent("unitAction", Ntry.STATIC.TURN_LEFT, function() { + a.isAction = !1; }); - }; - b.getValue = function(a, b) { - var d = this.block.params[this._getParamIndex(a, b)], e = new Entry.Scope(d, this.executor); - return Entry.block[d.type].func.call(e, this.entity, e); - }; - b.getStringValue = function(a, b) { - return String(this.getValue(a, b)); - }; - b.getNumberValue = function(a, b) { - return Number(this.getValue(a)); - }; - b.getBooleanValue = function(a, b) { - return Number(this.getValue(a, b)) ? !0 : !1; - }; - b.getField = function(a, b) { - return this.block.params[this._getParamIndex(a)]; - }; - b.getStringField = function(a, b) { - return String(this.getField(a)); - }; - b.getNumberField = function(a) { - return Number(this.getField(a)); - }; - b.getStatement = function(a, b) { - return this.executor.stepInto(this.block.statements[this._getStatementIndex(a, b)]); - }; - b._getParamIndex = function(a) { - this._schema || (this._schema = Entry.block[this.type]); - return this._schema.paramsKeyMap[a]; - }; - b._getStatementIndex = function(a) { - this._schema || (this._schema = Entry.block[this.type]); - return this._schema.statementsKeyMap[a]; - }; - b.die = function() { - this.block = null; - return Entry.STATIC.BREAK; - }; -})(Entry.Scope.prototype); -Entry.Field = function() { + return Entry.STATIC.CONTINUE; + } +}}; +Entry.block.maze_step_rotate_right = {skeleton:"basic", mode:"maze", color:"#A751E3", template:"\uc624\ub978\ucabd\uc73c\ub85c \ud68c\uc804%1", syntax:["Scope", "right"], params:[{type:"Image", img:"/img/assets/week/blocks/turnR.png", size:24}], func:function() { + if (this.isContinue) { + if (this.isAction) { + return Entry.STATIC.CONTINUE; + } + delete this.isAction; + delete this.isContinue; + } else { + this.isAction = this.isContinue = !0; + var a = this; + Ntry.dispatchEvent("unitAction", Ntry.STATIC.TURN_RIGHT, function() { + a.isAction = !1; + }); + return Entry.STATIC.CONTINUE; + } +}}; +Entry.block.test_wrapper = {skeleton:"basic", mode:"maze", color:"#3BBD70", template:"%1 this is test block %2", params:[{type:"Block", accept:"basic_boolean_field", value:[{type:"test", params:[30, 50]}]}, {type:"Dropdown", options:[[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]], value:1}], func:function() { +}}; +Entry.block.basic_button = {skeleton:"basic_button", color:"#eee", template:"%1", params:[{type:"Text", text:"basic button", color:"#333", align:"center"}], func:function() { +}}; +Entry.Thread = function(a, b, c) { + this._data = new Entry.Collection; + this._code = b; + this.changeEvent = new Entry.Event(this); + this.changeEvent.attach(this, this.handleChange); + this._event = null; + this.parent = c ? c : b; + this.load(a); }; -(function(b) { - b.TEXT_LIMIT_LENGTH = 20; - b.destroy = function() { - $(this.svgGroup).unbind("mouseup touchend"); - this.destroyOption(); +(function(a) { + a.load = function(b, a) { + void 0 === b && (b = []); + if (!(b instanceof Array)) { + return console.error("thread must be array"); + } + for (var d = 0;d < b.length;d++) { + var e = b[d]; + e instanceof Entry.Block || e.isDummy ? (e.setThread(this), this._data.push(e)) : Entry.block[e.type] && this._data.push(new Entry.Block(e, this)); + } + (b = this._code.view) && this.createView(b.board, a); }; - b.command = function() { - this._startValue && (this._startValue === this.getValue() || this._blockView.isInBlockMenu || Entry.do("setFieldValue", this._block, this, this.pointer(), this._startValue, this.getValue())); - delete this._startValue; + a.registerEvent = function(b, a) { + this._event = a; + this._code.registerEvent(b, a); }; - b.destroyOption = function() { - this.documentDownEvent && (Entry.documentMousedown.detach(this.documentDownEvent), delete this.documentDownEvent); - this.disposeEvent && (Entry.disposeEvent.detach(this.disposeEvent), delete this.documentDownEvent); - this.optionGroup && (this.optionGroup.remove(), delete this.optionGroup); - this.command(); + a.unregisterEvent = function(b, a) { + this._code.unregisterEvent(b, a); }; - b._attachDisposeEvent = function(a) { - var b = this; - b.disposeEvent = Entry.disposeEvent.attach(b, a || function() { - b.destroyOption(); + a.createView = function(b, a) { + this.view || (this.view = new Entry.ThreadView(this, b)); + this._data.map(function(d) { + d.createView(b, a); }); }; - 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 = "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.getAbsolutePosFromBoard = function() { - var a = this._block.view, b = a.getContentPos(), a = a.getAbsoluteCoordinate(); - return {x:a.x + this.box.x + b.x, y:a.y + this.box.y + b.y}; - }; - b.getAbsolutePosFromDocument = function() { - var a = this._block.view, b = a.getContentPos(), d = a.getAbsoluteCoordinate(), a = a.getBoard().svgDom.offset(); - return {x:d.x + this.box.x + b.x + a.left, y:d.y + this.box.y + b.y + a.top}; + a.separate = function(b, a) { + this._data.has(b.id) && (b = this._data.splice(this._data.indexOf(b), a), this._code.createThread(b), this.changeEvent.notify()); }; - b.getRelativePos = function() { - var a = this._block.view.getContentPos(), b = this.box; - return {x:b.x + a.x, y:b.y + a.y}; - }; - b.truncate = function() { - var a = String(this.getValue()), b = this.TEXT_LIMIT_LENGTH, d = a.substring(0, b); - a.length > b && (d += "..."); - return d; - }; - b.appendSvgOptionGroup = function() { - return this._block.view.getBoard().svgGroup.elem("g"); + a.cut = function(b) { + b = this._data.indexOf(b); + b = this._data.splice(b); + this.changeEvent.notify(); + return b; }; - b.getValue = function() { - return this._block.params[this._index]; + a.insertByBlock = function(b, a) { + b = b ? this._data.indexOf(b) : -1; + for (var d = 0;d < a.length;d++) { + a[d].setThread(this); + } + this._data.splice.apply(this._data, [b + 1, 0].concat(a)); + this.changeEvent.notify(); }; - b.setValue = function(a, b) { - this.value != a && (this.value = a, this._block.params[this._index] = a, b && this._blockView.reDraw()); + a.insertToTop = function(b) { + b.setThread(this); + this._data.unshift.apply(this._data, [b]); + this.changeEvent.notify(); }; - b._isEditable = function() { - if (Entry.ContextMenu.visible || this._block.view.dragMode == Entry.DRAG_MODE_DRAG) { - return !1; + a.clone = function(b, a) { + b = b || this._code; + b = new Entry.Thread([], b); + for (var d = this._data, e = [], f = 0, g = d.length;f < g;f++) { + e.push(d[f].clone(b)); } - var a = this._block.view, b = a.getBoard(); - if (!0 === b.disableMouseEvent) { - return !1; + b.load(e, a); + return b; + }; + a.toJSON = function(b, a) { + var d = []; + for (a = void 0 === a ? 0 : a;a < this._data.length;a++) { + this._data[a] instanceof Entry.Block && d.push(this._data[a].toJSON(b)); } - var d = b.workspace.selectedBlockView; - if (!d || b != d.getBoard()) { - return !1; + return d; + }; + a.destroy = function(b) { + this._code.destroyThread(this, !1); + this.view && this.view.destroy(b); + for (var a = this._data, d = a.length - 1;0 <= d;d--) { + a[d].destroy(b); } - b = a.getSvgRoot(); - return b == d.svgGroup || $(b).has($(a.svgGroup)); }; - b._selectBlockView = function() { - var a = this._block.view; - a.getBoard().setSelectedBlock(a); + a.getBlock = function(b) { + return this._data[b]; }; - b._bindRenderOptions = function() { - var a = this; - $(this.svgGroup).bind("mouseup touchend", function(b) { - a._isEditable() && (a.destroyOption(), a._startValue = a.getValue(), a.renderOptions()); + a.getBlocks = function() { + return this._data.map(function(b) { + return b; }); }; - b.pointer = function(a) { - a = a || []; - a.unshift(this._index); - a.unshift(Entry.PARAM); - return this._block.pointer(a); - }; - b.getFontSize = function(a) { - return a = a || this._blockView.getSkeleton().fontSize || 12; - }; - b.getContentHeight = function() { - return Entry.isMobile() ? 22 : 16; - }; -})(Entry.Field.prototype); -Entry.FieldAngle = function(b, a, c) { - this._block = a.block; - this._blockView = a; - this.box = new Entry.BoxModel; - this.svgGroup = null; - this.position = b.position; - this._contents = b; - this._index = c; - b = this.getValue(); - this.setValue(this.modValue(void 0 !== b ? b : 90)); - this._CONTENT_HEIGHT = this.getContentHeight(); - this.renderStart(); -}; -Entry.Utils.inherit(Entry.Field, Entry.FieldAngle); -(function(b) { - b.renderStart = function() { - this.svgGroup && $(this.svgGroup).remove(); - this.svgGroup = this._blockView.contentSvgGroup.elem("g", {class:"entry-input-field"}); - this.textElement = this.svgGroup.elem("text", {x:4, y:4, "font-size":"11px"}); - this.textElement.textContent = this.getText(); - var a = this.getTextWidth(), b = this._CONTENT_HEIGHT, d = this.position && this.position.y ? this.position.y : 0; - this._header = this.svgGroup.elem("rect", {x:0, y:d - b / 2, rx:3, ry:3, width:a, height:b, rx:3, ry:3, fill:"#fff", "fill-opacity":.4}); - this.svgGroup.appendChild(this.textElement); - this._bindRenderOptions(); - this.box.set({x:0, y:0, width:a, height:b}); - }; - b.renderOptions = function() { - var a = this; - this._attachDisposeEvent(function() { - a.applyValue(); - a.destroyOption(); - }); - this.optionGroup = Entry.Dom("input", {class:"entry-widget-input-field", parent:$("body")}); - this.optionGroup.val(this.value); - this.optionGroup.on("mousedown touchstart", function(a) { - a.stopPropagation(); - }); - this.optionGroup.on("keyup", function(b) { - var c = b.keyCode || b.which; - a.applyValue(b); - -1 < [13, 27].indexOf(c) && a.destroyOption(); - }); - var b = this.getAbsolutePosFromDocument(); - b.y -= this.box.height / 2; - this.optionGroup.css({height:this._CONTENT_HEIGHT, left:b.x, top:b.y, width:a.box.width}); - this.svgOptionGroup = this.appendSvgOptionGroup(); - this.svgOptionGroup.elem("circle", {x:0, y:0, r:49, class:"entry-field-angle-circle"}); - $(this.svgOptionGroup).on("mousedown touchstart", function(b) { - b.stopPropagation(); - a._updateByCoord(b); - }); - this._dividerGroup = this.svgOptionGroup.elem("g"); - for (b = 0;360 > b;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"}); + a.countBlock = function() { + for (var b = 0, a = 0;a < this._data.length;a++) { + var d = this._data[a]; + if (d.type && (b++, d = d.statements)) { + for (var e = 0;e < d.length;e++) { + b += d[e].countBlock(); + } + } } - 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 + ")"}); - $(this.svgOptionGroup).bind("mousemove touchmove", this._updateByCoord.bind(this)); - $(this.svgOptionGroup).bind("mouseup touchend", this.destroyOption.bind(this)); - this.updateGraph(); - this.optionGroup.focus(); - this.optionGroup.select(); - }; - b._updateByCoord = function(a) { - a.originalEvent && a.originalEvent.touches && (a = a.originalEvent.touches[0]); - a = [a.clientX, a.clientY]; - var b = this.getAbsolutePosFromDocument(); - this.optionGroup.val(this.modValue(function(a, b) { - var c = b[0] - a[0], g = b[1] - a[1] - 49 - 1, h = Math.atan(-g / c), h = Entry.toDegrees(h), h = 90 - h; - 0 > c ? h += 180 : 0 < g && (h += 360); - return 15 * Math.round(h / 15); - }([b.x + this.box.width / 2, b.y + this.box.height / 2 + 1], a))); - this.applyValue(); - }; - b.updateGraph = function() { - this._fillPath && this._fillPath.remove(); - var a = Entry.toRadian(this.getValue()), b = 49 * Math.sin(a), d = -49 * Math.cos(a), a = a > Math.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 || (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; + return b; }; - b.getText = function() { - return this.getValue() + "\u00b0"; + a.handleChange = function() { + 0 === this._data.length && this.destroy(); }; - b.modValue = function(a) { - return a % 360; + a.getCode = function() { + return this._code; }; - 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(); + a.setCode = function(b) { + this._code = b; }; -})(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(); + a.spliceBlock = function(b) { + this._data.remove(b); + this.changeEvent.notify(); }; - 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}); + a.getFirstBlock = function() { + return this._data[0]; }; - 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}); + a.getPrevBlock = function(b) { + b = this._data.indexOf(b); + return this._data.at(b - 1); }; - b.calcHeight = b.calcWH; - b.destroy = function() { + a.getNextBlock = function(b) { + b = this._data.indexOf(b); + return this._data.at(b + 1); }; - b.inspectBlock = function() { - var a = null; - if (this._originBlock) { - a = this._originBlock.type, delete this._originBlock; - } else { - switch(this.acceptType) { - case "boolean": - a = "True"; - break; - case "string": - a = "text"; - break; - case "param": - a = "function_field_label"; + a.getLastBlock = function() { + return this._data.at(this._data.length - 1); + }; + a.getRootBlock = function() { + return this._data.at(0); + }; + a.hasBlockType = function(b) { + function a(d) { + if (b == d.type) { + return !0; + } + for (var f = d.params, g = 0;g < f.length;g++) { + var h = f[g]; + if (h && h.constructor == Entry.Block && a(h)) { + return !0; + } + } + if (d = d.statements) { + for (f = 0;f < d.length;f++) { + if (d[f].hasBlockType(b)) { + return !0; + } + } } + return !1; } - return this._createBlockByType(a); + for (var d = 0;d < this._data.length;d++) { + if (a(this._data[d])) { + return !0; + } + } + return !1; }; - b._setValueBlock = function(a) { - this._restoreCurrent && (this._originBlock = this._valueBlock); - a || (a = this.inspectBlock()); - this._valueBlock = a; - this.setValue(a); - a.setThread(this); - a.getThread().view.setParent(this); - return this._valueBlock; + a.getCount = function(b) { + var a = this._data.length; + b && (a -= this._data.indexOf(b)); + return a; }; - b.getValueBlock = function() { - return this._valueBlock; + a.indexOf = function(b) { + return this._data.indexOf(b); }; - b.updateValueBlock = function(a) { - a instanceof Entry.Block || (a = void 0); - this._destroyObservers(); - a = this._setValueBlock(a).view; - a.bindPrev(this); - this._blockView.alignContent(); - this._posObserver = a.observe(this, "updateValueBlock", ["x", "y"], !1); - this._sizeObserver = a.observe(this, "calcWH", ["width", "height"]); - a = this._blockView.getBoard(); - a.constructor === Entry.Board && a.generateCodeMagnetMap(); + a.pointer = function(b, a) { + a = this.indexOf(a); + b.unshift(a); + this.parent instanceof Entry.Block && b.unshift(this.parent.indexOfStatements(this)); + return this._code === this.parent ? (b.unshift(this._code.indexOf(this)), a = this._data[0], b.unshift(a.y), b.unshift(a.x), b) : this.parent.pointer(b); }; - b._destroyObservers = function() { - this._sizeObserver && this._sizeObserver.destroy(); - this._posObserver && this._posObserver.destroy(); + a.getBlockList = function(b, a) { + for (var d = [], e = 0;e < this._data.length;e++) { + d = d.concat(this._data[e].getBlockList(b, a)); + } + return d; }; - b.getPrevBlock = function(a) { - return this._valueBlock === a ? this : null; + a.stringify = function() { + return JSON.stringify(this.toJSON()); }; - b.getNextBlock = function() { - return null; +})(Entry.Thread.prototype); +Entry.skeleton = function() { +}; +Entry.skeleton.basic = {path:function(a) { + var b = a.contentWidth; + a = a.contentHeight; + a = Math.max(30, a + 2); + b = Math.max(0, b + 9 - a / 2); + return "m -8,0 l 8,8 8,-8 h %w a %h,%h 0 0,1 0,%wh h -%w l -8,8 -8,-8 v -%wh z".replace(/%wh/gi, a).replace(/%w/gi, b).replace(/%h/gi, a / 2); +}, box:function(a) { + return {offsetX:-8, offsetY:0, width:(a ? a.contentWidth : 150) + 30, height:Math.max(30, (a ? a.contentHeight : 28) + 2), marginBottom:0}; +}, magnets:function(a) { + return {previous:{x:0, y:0}, next:{x:0, y:(a ? Math.max(a.height, 30) : 30) + 1 + a.offsetY}}; +}, contentPos:function(a) { + return {x:14, y:Math.max(a.contentHeight, 28) / 2 + 1}; +}}; +Entry.skeleton.basic_create = {path:function(a) { + var b = a.contentWidth; + a = a.contentHeight; + a = Math.max(30, a + 2); + b = Math.max(0, b + 9 - a / 2); + return "m -8,0 l 16,0 h %w a %h,%h 0 0,1 0,%wh h -%w l -8,8 -8,-8 v -%wh z".replace(/%wh/gi, a).replace(/%w/gi, b).replace(/%h/gi, a / 2); +}, box:function(a) { + return {offsetX:-8, offsetY:0, width:(a ? a.contentWidth : 150) + 30, height:Math.max(30, (a ? a.contentHeight : 28) + 2), marginBottom:0}; +}, magnets:function(a) { + return {next:{x:0, y:(a ? Math.max(a.height, 30) : 30) + 1 + a.offsetY}}; +}, contentPos:function(a) { + return {x:14, y:Math.max(a.contentHeight, 28) / 2 + 1}; +}}; +Entry.skeleton.basic_event = {path:function(a) { + a = a.contentWidth; + a = Math.max(0, a); + return "m -8,0 m 0,-5 a 19.5,19.5 0, 0,1 16,0 c 10,5 15,5 20,5 h %w a 15,15 0 0,1 0,30 H 8 l -8,8 -8,-8 l 0,0.5 a 19.5,19.5 0, 0,1 0,-35 z".replace(/%w/gi, a - 30); +}, box:function(a) { + return {offsetX:-19, offsetY:-7, width:a.contentWidth + 30, height:30, marginBottom:0}; +}, magnets:function(a) { + return {next:{x:0, y:(a ? Math.max(a.height + a.offsetY + 7, 30) : 30) + 1}}; +}, contentPos:function(a) { + return {x:1, y:15}; +}}; +Entry.skeleton.basic_loop = {path:function(a) { + var b = a.contentWidth, c = a.contentHeight, c = Math.max(30, c + 2), b = Math.max(0, b + 9 - c / 2); + a = a._statements[0] ? a._statements[0].height : 20; + a = Math.max(a, 20); + return "m -8,0 l 8,8 8,-8 h %w a %h,%h 0 0,1 0,%wh H 24 l -8,8 -8,-8 h -0.4 v %sh h 0.4 l 8,8 8,-8 h %bw a 8,8 0 0,1 0,16 H 8 l -8,8 -8,-8 z".replace(/%wh/gi, c).replace(/%w/gi, b).replace(/%bw/gi, b - 8).replace(/%h/gi, c / 2).replace(/%sh/gi, a + 1); +}, magnets:function(a) { + var b = Math.max(a.contentHeight + 2, 30), c = a._statements[0] ? a._statements[0].height : 20, c = Math.max(c, 20); + return {previous:{x:0, y:0}, next:{x:0, y:c + b + 18 + a.offsetY}}; +}, box:function(a) { + var b = a.contentWidth, c = Math.max(a.contentHeight + 2, 30); + a = a._statements[0] ? a._statements[0].height : 20; + a = Math.max(a, 20); + return {offsetX:-8, offsetY:0, width:b + 30, height:c + a + 17, marginBottom:0}; +}, statementPos:function(a) { + return [{x:16, y:Math.max(30, a.contentHeight + 2) + 1}]; +}, contentPos:function(a) { + return {x:14, y:Math.max(a.contentHeight, 28) / 2 + 1}; +}}; +Entry.skeleton.basic_define = {path:function(a) { + var b = a.contentWidth, c = a.contentHeight, c = Math.max(30, c + 2), b = Math.max(0, b + 9 - c / 2); + a = a._statements[0] ? a._statements[0].height : 30; + a = Math.max(a, 20); + return "m -8,0 l 16,0 h %w a %h,%h 0 0,1 0,%wh H 24 l -8,8 -8,-8 h -0.4 v %sh h 0.4 l 8,8 8,-8 h %bw a 8,8 0 0,1 0,16 H -8 z".replace(/%wh/gi, c).replace(/%w/gi, b).replace(/%h/gi, c / 2).replace(/%bw/gi, b - 8).replace(/%sh/gi, a + 1); +}, magnets:function() { + return {}; +}, box:function(a) { + return {offsetX:0, offsetY:0, width:a.contentWidth, height:Math.max(a.contentHeight, 25) + 46, marginBottom:0}; +}, statementPos:function(a) { + return [{x:16, y:Math.max(30, a.contentHeight + 2)}]; +}, contentPos:function() { + return {x:14, y:15}; +}}; +Entry.skeleton.pebble_event = {path:function(a) { + return "m 0,0 a 25,25 0 0,1 9,48.3 a 9,9 0 0,1 -18,0 a 25,25 0 0,1 9,-48.3 z"; +}, box:function(a) { + return {offsetX:-25, offsetY:0, width:50, height:48.3, marginBottom:0}; +}, magnets:function(a) { + return {next:{x:0, y:(a ? Math.max(a.height, 49.3) : 49.3) + a.offsetY}}; +}, contentPos:function() { + return {x:0, y:25}; +}}; +Entry.skeleton.pebble_loop = {fontSize:16, dropdownHeight:23, path:function(a) { + a = Math.max(a._statements[0] ? a._statements[0].height : 50, 50); + return "M 0,9 a 9,9 0 0,0 9,-9 h %cw q 25,0 25,25 v %ch q 0,25 -25,25 h -%cw a 9,9 0 0,1 -18,0 h -%cw q -25,0 -25,-25 v -%ch q 0,-25 25,-25 h %cw a 9,9 0 0,0 9,9 M 0,49 a 9,9 0 0,1 -9,-9 h -28 a 25,25 0 0,0 -25,25 v %cih a 25,25 0 0,0 25,25 h 28 a 9,9 0 0,0 18,0 h 28 a 25,25 0 0,0 25,-25 v -%cih a 25,25 0 0,0 -25,-25 h -28 a 9,9 0 0,1 -9,9 z".replace(/%cw/gi, 41).replace(/%ch/gi, a + 4).replace(/%cih/gi, a - 50); +}, magnets:function(a) { + var b = Math.max(a.contentHeight + 2, 41), c = a._statements[0] ? a._statements[0].height : 20, c = Math.max(c, 51); + return {previous:{x:0, y:0}, next:{x:0, y:c + b + 13 + a.offsetY}}; +}, box:function(a) { + var b = a.contentWidth, c = Math.max(a.contentHeight + 2, 41); + a = a._statements[0] ? a._statements[0].height : 20; + a = Math.max(a, 51); + return {offsetX:-(b / 2 + 13), offsetY:0, width:b + 30, height:c + a + 13, marginBottom:0}; +}, statementPos:function(a) { + return [{x:0, y:Math.max(39, a.contentHeight + 2) + 1.5}]; +}, contentPos:function() { + return {x:-46, y:25}; +}}; +Entry.skeleton.pebble_basic = {fontSize:15, morph:["prev", "next"], path:function(a) { + return "m 0,9 a 9,9 0 0,0 9,-9 h 28 q 25,0 25,25q 0,25 -25,25h -28 a 9,9 0 0,1 -18,0 h -28 q -25,0 -25,-25q 0,-25 25,-25h 28 a 9,9 0 0,0 9,9 z"; +}, magnets:function(a) { + return {previous:{x:0, y:0}, next:{x:0, y:(a ? Math.max(a.height, 51) : 51) + a.offsetY}}; +}, box:function() { + return {offsetX:-62, offsetY:0, width:124, height:50, marginBottom:0}; +}, contentPos:function() { + return {x:-46, y:25}; +}}; +Entry.skeleton.basic_string_field = {path:function(a) { + var b = a.contentWidth; + a = a.contentHeight; + a = Math.max(18, a + 2); + b = Math.max(0, b - a + 12); + return "m %h,0 h %w a %h,%h 0 1,1 0,%wh H %h A %h,%h 0 1,1 %h,0 z".replace(/%wh/gi, a).replace(/%w/gi, b).replace(/%h/gi, a / 2); +}, color:"#000", outerLine:"#768dce", box:function(a) { + return {offsetX:0, offsetY:0, width:(a ? a.contentWidth : 5) + 12, height:Math.max((a ? a.contentHeight : 18) + 2, 18), marginBottom:0}; +}, magnets:function() { + return {string:{}}; +}, contentPos:function(a) { + return {x:6, y:Math.max(a.contentHeight, 16) / 2 + 1}; +}}; +Entry.skeleton.basic_boolean_field = {path:function(a) { + var b = a.contentWidth; + a = a.contentHeight; + a = Math.max(18, a + 2); + b = Math.max(0, b - a + 19); + return "m %h,0 h %w l %h,%h -%h,%h H %h l -%h,-%h %h,-%h z".replace(/%wh/gi, a).replace(/%w/gi, b).replace(/%h/gi, a / 2); +}, color:"#000", outerLine:"#768dce", box:function(a) { + return {offsetX:0, offsetY:0, width:(a ? a.contentWidth : 5) + 19, height:Math.max((a ? a.contentHeight : 18) + 2, 18), marginBottom:0}; +}, magnets:function() { + return {boolean:{}}; +}, contentPos:function(a) { + return {x:10, y:Math.max(a.contentHeight, 16) / 2 + 1}; +}}; +Entry.skeleton.basic_param = {path:function(a) { + var b = a.contentWidth; + (a = a._contents[a._contents.length - 1]) && (b -= a.box.width + Entry.BlockView.PARAM_SPACE - 2); + b = Math.max(0, b); + return "m 4,0 h 10 h %w l 2,2 0,3 3,0 1,1 0,12 -1,1 -3,0 0,3 -2,2h -%w h -10 l -2,-2 0,-3 3,0 1,-1 0,-12 -1,-1 -3,0 0,-3 2,-2".replace(/%w/gi, b); +}, outerLine:"#768dce", box:function(a) { + return {offsetX:0, offsetY:0, width:(a ? a.contentWidth : 5) + 11, height:24, marginBottom:0}; +}, magnets:function() { + return {param:{}}; +}, contentPos:function(a) { + return {x:11, y:12}; +}}; +Entry.skeleton.basic_button = {path:function() { + return "m -64,0 h 128 a 6,6 0, 0,1 6,6 v 18 a 6,6 0, 0,1 -6,6 h -128 a 6,6 0, 0,1 -6,-6 v -18 a 6,6 0, 0,1 6,-6 z"; +}, box:function() { + return {offsetX:-80, offsetY:0, width:140, height:30}; +}, contentPos:function() { + return {x:0, y:15}; +}, movable:!1, readOnly:!0, nextShadow:!0, classes:["basicButtonView"]}; +Entry.skeleton.basic_without_next = {box:Entry.skeleton.basic.box, contentPos:Entry.skeleton.basic.contentPos, path:function(a) { + var b = a.contentWidth; + a = a.contentHeight; + a = Math.max(30, a + 2); + b = Math.max(0, b + 9 - a / 2); + return "m -8,0 l 8,8 8,-8 h %w a %h,%h 0 0,1 0, %wh H -8 z".replace(/%wh/gi, a).replace(/%w/gi, b).replace(/%h/gi, a / 2); +}, magnets:function(a) { + return {previous:{x:0, y:0}}; +}}; +Entry.skeleton.basic_double_loop = {path:function(a) { + var b = a.contentWidth, c = a.contentHeight % 1E6, d = Math.floor(a.contentHeight / 1E6), c = Math.max(30, c + 2), d = Math.max(30, d + 2), b = Math.max(0, b + 5 - c / 2), e = a._statements; + a = e[0] ? e[0].height : 20; + e = e[1] ? e[1].height : 20; + a = Math.max(a, 20); + e = Math.max(e, 20); + return "m -8,0 l 8,8 8,-8 h %w a %h1,%h1 0 0,1 0,%wh1 H 24 l -8,8 -8,-8 h -0.4 v %sh1 h 0.4 l 8,8 8,-8 h %bw a %h2,%h2 0 0,1 0,%wh2 H 24 l -8,8 -8,-8 h -0.4 v %sh2 h 0.4 l 8,8 8,-8 h %bw a 8,8 0 0,1 0,16 H 8 l -8,8 -8,-8 z".replace(/%wh1/gi, c).replace(/%wh2/gi, d).replace(/%w/gi, b).replace(/%bw/gi, b - 8).replace(/%h1/gi, c / 2).replace(/%h2/gi, d / 2).replace(/%sh1/gi, a + 1).replace(/%sh2/gi, e + 1); +}, magnets:function(a) { + var b = Math.max(a.contentHeight % 1E6 + 2, 30), c = Math.max(Math.floor(a.contentHeight / 1E6) + 2, 30), d = a._statements[0] ? a._statements[0].height : 20, e = a._statements[1] ? a._statements[1].height : 20, d = Math.max(d, 20), e = Math.max(e, 20); + return {previous:{x:0, y:0}, next:{x:0, y:d + e + b + c + 19 + a.offsetY}}; +}, box:function(a) { + var b = a.contentWidth, c = Math.max(Math.floor(a.contentHeight / 1E6) + 2, 30), d = Math.max(a.contentHeight % 1E6 + 2, 30), e = a._statements[0] ? a._statements[0].height % 1E6 : 20; + a = a._statements[1] ? a._statements[1].height : 20; + e = Math.max(e, 20); + a = Math.max(a, 20); + return {offsetX:-8, offsetY:0, width:b + 30, height:c + d + e + a + 17, marginBottom:0}; +}, statementPos:function(a) { + var b = Math.max(30, a.contentHeight % 1E6 + 2) + 1; + return [{x:16, y:b}, {x:16, y:b + Math.max(a._statements[0] ? a._statements[0].height % 1E6 : 20, 20) + Math.max(Math.floor(a.contentHeight / 1E6) + 2, 30) + 1}]; +}, contentPos:function(a) { + return {x:14, y:Math.max(a.contentHeight % 1E6, 28) / 2 + 1}; +}}; +Entry.Block = function(a, b) { + var c = this; + Entry.Model(this, !1); + this._schema = null; + this.setThread(b); + this.load(a); + a = this.getCode(); + a.registerBlock(this); + (b = this.events.dataAdd) && a.object && b.forEach(function(b) { + Entry.Utils.isFunction(b) && b(c); + }); +}; +Entry.Block.MAGNET_RANGE = 10; +Entry.Block.MAGNET_OFFSET = .4; +Entry.Block.DELETABLE_TRUE = 1; +Entry.Block.DELETABLE_FALSE = 2; +Entry.Block.DELETABLE_FALSE_LIGHTEN = 3; +(function(a) { + a.schema = {id:null, x:0, y:0, type:null, params:[], statements:[], view:null, thread:null, movable:null, deletable:Entry.Block.DELETABLE_TRUE, readOnly:null, copyable:!0, events:{}}; + a.load = function(b) { + b.id || (b.id = Entry.Utils.generateId()); + this.set(b); + this.loadSchema(); }; - b.requestAbsoluteCoordinate = function(a) { - a = this._blockView; - var b = a.contentPos; - a = a.getAbsoluteCoordinate(); - a.x += this.box.x + b.x; - a.y += this.box.y + b.y; - return a; + a.changeSchema = function(b) { + this.set({params:[]}); + this.loadSchema(); }; - b.dominate = function() { - this._blockView.dominate(); + a.getSchema = function() { + this._schema || this.loadSchema(); + return this._schema; }; - b.isGlobal = function() { - return !1; + a.loadSchema = function() { + if (this._schema = Entry.block[this.type]) { + !this._schemaChangeEvent && this._schema.changeEvent && (this._schemaChangeEvent = this._schema.changeEvent.attach(this, this.changeSchema)); + var b = this._schema.events; + if (b) { + for (var a in b) { + this.events[a] || (this.events[a] = []); + for (var d = b[a], e = 0;e < d.length;e++) { + var f = d[e]; + f && 0 > this.events[a].indexOf(f) && this.events[a].push(f); + } + } + } + this._schema.event && this.thread.registerEvent(this, this._schema.event); + b = this.params; + a = this._schema.params; + for (e = 0;a && e < a.length;e++) { + d = void 0 === b[e] || null === b[e] ? a[e].value : b[e], f = b[e] || e < b.length, !d || "Output" !== a[e].type && "Block" !== a[e].type || (d = new Entry.Block(d, this.thread)), f ? b.splice(e, 1, d) : b.push(d); + } + if (b = this._schema.statements) { + for (e = 0;e < b.length;e++) { + this.statements.splice(e, 1, new Entry.Thread(this.statements[e], this.getCode(), this)); + } + } + } }; - b.separate = function(a) { - this.getCode().createThread([a]); - this.calcWH(); - this.changeEvent.notify(); + a.changeType = function(b) { + this._schemaChangeEvent && this._schemaChangeEvent.destroy(); + this.set({type:b}); + this.loadSchema(); + this.view && this.view.changeType(b); }; - b.getCode = function() { - return this._block.thread.getCode(); + a.setThread = function(b) { + this.set({thread:b}); }; - b.cut = function(a) { - return this._valueBlock === a ? [a] : null; + a.getThread = function() { + return this.thread; }; - b.replace = function(a) { - "string" === typeof a && (a = this._createBlockByType(a)); - var b = this._valueBlock; - Entry.block[b.type].isPrimitive ? (b.doNotSplice = !0, b.destroy()) : "param" === this.acceptType ? (this._destroyObservers(), b.view._toGlobalCoordinate(), a.getTerminateOutputBlock().view._contents[1].replace(b)) : (this._destroyObservers(), b.view._toGlobalCoordinate(), this.separate(b), b.view.bumpAway(30, 150)); - this.updateValueBlock(a); - a.view._toLocalCoordinate(this.svgGroup); - this.calcWH(); - this.changeEvent.notify(); + a.insertAfter = function(b) { + this.thread.insertByBlock(this, b); }; - b.setParent = function(a) { - this._parent = a; + a._updatePos = function() { + this.view && this.set({x:this.view.x, y:this.view.y}); }; - b.getParent = function() { - return this._parent; + a.moveTo = function(b, a) { + this.view && this.view._moveTo(b, a); + this._updatePos(); + this.getCode().changeEvent.notify(); }; - b._createBlockByType = function(a) { - this._block.getThread(); - var b = this._blockView.getBoard(); - a = new Entry.Block({type:a}, this); - var d = b.workspace, e; - d && (e = d.getMode()); - a.createView(b, e); + a.createView = function(b, a) { + this.view || (this.set({view:new Entry.BlockView(this, b, a)}), this._updatePos()); + }; + a.clone = function(b) { + return new Entry.Block(this.toJSON(!0), b); + }; + a.toJSON = function(b) { + var a = this._toJSON(); + delete a.view; + delete a.thread; + delete a.events; + b && delete a.id; + a.params = a.params.map(function(a) { + a instanceof Entry.Block && (a = a.toJSON(b)); + return a; + }); + a.statements = a.statements.map(function(a) { + return a.toJSON(b); + }); + a.x = this.x; + a.y = this.y; + a.movable = this.movable; + a.deletable = this.deletable; + a.readOnly = this.readOnly; return a; }; - b.spliceBlock = function() { - this.updateValueBlock(); + a.destroy = function(b, a) { + var d = this, e = this.params; + if (e) { + for (var f = 0;f < e.length;f++) { + var g = e[f]; + g instanceof Entry.Block && (g.doNotSplice = !0, g.destroy(b)); + } + } + if (e = this.statements) { + for (f = 0;f < e.length;f++) { + e[f].destroy(b); + } + } + g = this.getPrevBlock(); + f = this.getNextBlock(); + this.getCode().unregisterBlock(this); + e = this.getThread(); + this._schema.event && e.unregisterEvent(this, this._schema.event); + f && (a ? f.destroy(b, a) : g ? f.view && f.view.bindPrev(g) : (a = this.getThread().view.getParent(), a.constructor === Entry.FieldStatement ? (f.view && f.view.bindPrev(a), a.insertTopBlock(f)) : a.constructor === Entry.FieldStatement ? f.replace(a._valueBlock) : f.view._toGlobalCoordinate())); + !this.doNotSplice && e.spliceBlock ? e.spliceBlock(this) : delete this.doNotSplice; + this.view && this.view.destroy(b); + this._schemaChangeEvent && this._schemaChangeEvent.destroy(); + (b = this.events.dataDestroy) && this.getCode().object && b.forEach(function(b) { + Entry.Utils.isFunction(b) && b(d); + }); }; - b._updateBG = function() { - this.magneting ? this._bg = this.svgGroup.elem("path", {d:"m 8,12 l -4,0 -2,-2 0,-3 3,0 1,-1 0,-12 -1,-1 -3,0 0,-3 2,-2 l 4,0 z", fill:"#fff", stroke:"#fff", "fill-opacity":.7, transform:"translate(0,12)"}) : this._bg && (this._bg.remove(), delete this._bg); + a.getView = function() { + return this.view; }; - b.getThread = function() { - return this; + a.setMovable = function(b) { + this.movable != b && this.set({movable:b}); }; - b.pointer = function(a) { - a.unshift(this._index); - a.unshift(Entry.PARAM); - return this._block.pointer(a); + a.setCopyable = function(b) { + this.copyable != b && this.set({copyable:b}); }; -})(Entry.FieldBlock.prototype); -Entry.FieldColor = function(b, a, c) { - this._block = a.block; - this._blockView = a; - this.box = new Entry.BoxModel; - this.svgGroup = null; - this._contents = b; - this._index = c; - this._position = b.position; - this.key = b.key; - this.setValue(this.getValue() || "#FF0000"); - this._CONTENT_HEIGHT = this.getContentHeight(); - this._CONTENT_WIDTH = this.getContentWidth(); - this.renderStart(a); -}; -Entry.Utils.inherit(Entry.Field, Entry.FieldColor); -(function(b) { - b.renderStart = function() { - this.svgGroup && $(this.svgGroup).remove(); - this.svgGroup = this._blockView.contentSvgGroup.elem("g", {class:"entry-field-color"}); - var a = this._CONTENT_HEIGHT, b = this._CONTENT_WIDTH, d = this._position, e; - d ? (e = d.x || 0, d = d.y || 0) : (e = 0, d = -a / 2); - this._header = this.svgGroup.elem("rect", {x:e, y:d, width:b, height:a, fill:this.getValue()}); - this._bindRenderOptions(); - this.box.set({x:e, y:d, width:b, height:a}); + a.isMovable = function() { + return this.movable; }; - b.renderOptions = function() { - var a = this; - this._attachDisposeEvent(); - var b = Entry.FieldColor.getWidgetColorList(); - this.optionGroup = Entry.Dom("table", {class:"entry-widget-color-table", parent:$("body")}); - for (var d = 0;d < b.length;d++) { - for (var e = Entry.Dom("tr", {class:"entry-widget-color-row", parent:this.optionGroup}), f = 0;f < b[d].length;f++) { - var g = Entry.Dom("td", {class:"entry-widget-color-cell", parent:e}), h = b[d][f]; - g.css({"background-color":h}); - g.attr({"data-color-value":h}); - (function(b, c) { - b.mousedown(function(a) { - a.stopPropagation(); - }); - b.mouseup(function(b) { - a.applyValue(c); - a.destroyOption(); - a._selectBlockView(); - }); - })(g, h); - } - } - b = this.getAbsolutePosFromDocument(); - b.y += this.box.height / 2 + 1; - this.optionGroup.css({left:b.x, top:b.y}); + a.isCopyable = function() { + return this.copyable; }; - b.applyValue = function(a) { - this.value != a && (this.setValue(a), this._header.attr({fill:a})); + a.setDeletable = function(b) { + this.deletable != b && this.set({deletable:b}); }; - b.getContentWidth = function() { - return Entry.isMobile() ? 20 : 14.5; + a.isDeletable = function() { + return this.deletable === Entry.Block.DELETABLE_TRUE; }; -})(Entry.FieldColor.prototype); -Entry.FieldColor.getWidgetColorList = function() { - return ["#FFFFFF #CCCCCC #C0C0C0 #999999 #666666 #333333 #000000".split(" "), "#FFCCCC #FF6666 #FF0000 #CC0000 #990000 #660000 #330000".split(" "), "#FFCC99 #FF9966 #FF9900 #FF6600 #CC6600 #993300 #663300".split(" "), "#FFFF99 #FFFF66 #FFCC66 #FFCC33 #CC9933 #996633 #663333".split(" "), "#FFFFCC #FFFF33 #FFFF00 #FFCC00 #999900 #666600 #333300".split(" "), "#99FF99 #66FF99 #33FF33 #33CC00 #009900 #006600 #003300".split(" "), "#99FFFF #33FFFF #66CCCC #00CCCC #339999 #336666 #003333".split(" "), "#CCFFFF #66FFFF #33CCFF #3366FF #3333FF #000099 #000066".split(" "), - "#CCCCFF #9999FF #6666CC #6633FF #6609CC #333399 #330099".split(" "), "#FFCCFF #FF99FF #CC66CC #CC33CC #993399 #663366 #330033".split(" ")]; -}; -Entry.FieldDropdown = function(b, a, c) { - this._block = a.block; - this._blockView = a; - this.box = new Entry.BoxModel; - this.svgGroup = null; - this._contents = b; - this._noArrow = b.noArrow; - this._arrowColor = b.arrowColor; - this._index = c; - this.setValue(this.getValue()); - this._CONTENT_HEIGHT = this.getContentHeight(b.dropdownHeight); - this._FONT_SIZE = this.getFontSize(b.fontSize); - this._ROUND = b.roundValue || 3; - this.renderStart(); -}; -Entry.Utils.inherit(Entry.Field, Entry.FieldDropdown); -(function(b) { - b.renderStart = function() { - this.svgGroup && $(this.svgGroup).remove(); - this instanceof Entry.FieldDropdownDynamic && this._updateValue(); - var a = this._blockView, b = Entry.isMobile(), d = b ? 33 : 20, b = b ? 24 : 10; - this.svgGroup = a.contentSvgGroup.elem("g", {class:"entry-field-dropdown"}); - this.textElement = this.svgGroup.elem("text", {x:5}); - this.textElement.textContent = this.getTextByValue(this.getValue()); - a = this.textElement.getBBox(); - this.textElement.attr({style:"white-space: pre;", "font-size":+this._FONT_SIZE + "px", y:.23 * a.height}); - d = this.textElement.getComputedTextLength() + d; - this._noArrow && (d -= b); - b = this._CONTENT_HEIGHT; - this._header = this.svgGroup.elem("rect", {width:d, height:b, y:-b / 2, rx:this._ROUND, ry:this._ROUND, fill:"#fff", "fill-opacity":.4}); - this.svgGroup.appendChild(this.textElement); - this._noArrow || (a = this.getArrow(), this._arrow = this.svgGroup.elem("polygon", {points:a.points, fill:a.color, stroke:a.color, transform:"translate(" + (d - a.width - 5) + "," + -a.height / 2 + ")"})); - this._bindRenderOptions(); - this.box.set({x:0, y:0, width:d, height:b}); + a.isReadOnly = function() { + return this.readOnly; }; - b.resize = function() { - var a = Entry.isMobile(), b = a ? 33 : 20, a = a ? 24 : 10, b = this.textElement.getComputedTextLength() + b; - this._noArrow ? b -= a : (a = this.getArrow(), this._arrow.attr({transform:"translate(" + (b - a.width - 5) + "," + -a.height / 2 + ")"})); - this._header.attr({width:b}); - this.box.set({width:b}); - this._block.view.alignContent(); + a.getCode = function() { + return this.thread.getCode(); }; - b.renderOptions = function() { - var a = this; - this._attachDisposeEvent(); - this.optionGroup = Entry.Dom("ul", {class:"entry-widget-dropdown", parent:$("body")}); - this.optionGroup.bind("mousedown touchstart", function(a) { - a.stopPropagation(); - }); - for (var b = this._contents.options, b = this._contents.options, d = 0, e = b.length;d < e;d++) { - var f = b[d], g = f[0], f = f[1], h = Entry.Dom("li", {class:"rect", parent:this.optionGroup}), k = Entry.Dom("span", {class:"left", parent:h}); - Entry.Dom("span", {class:"right", parent:h}).text(g); - this.getValue() == f && k.text("\u2713"); - (function(b, c) { - b.bind("mousedown touchstart", function(a) { - a.stopPropagation(); - }); - b.bind("mouseup touchend", function(b) { - b.stopPropagation(); - a.applyValue(c); - a.destroyOption(); - a._selectBlockView(); - }); - })(h, f); - } - this._position(); + a.doAdd = function() { + this.getCode().changeEvent.notify(); }; - b._position = function() { - var a = this.getAbsolutePosFromDocument(); - a.y += this.box.height / 2; - var b = $(document).height(), d = this.optionGroup.height(), e = this.optionGroup.width() + 30; - if (b < a.y + d + 30) { - var b = this._blockView.getBoard().svgDom.height(), f = this.getAbsolutePosFromBoard(); - this._blockView.y < b / 2 ? (a.x += this.box.width / 2 - e / 2, b -= f.y + 30, this.optionGroup.height(b)) : (a.x += this.box.width + 1, b -= b - f.y, b - 30 < d && this.optionGroup.height(b - b % 30), a.y -= this.optionGroup.height()); - } else { - a.x += this.box.width / 2 - e / 2; - } - this.optionGroup.addClass("rendered"); - this.optionGroup.css({left:a.x, top:a.y, width:e}); - this.optionGroup.find(".right").width(e - 20); + a.doMove = function() { + this._updatePos(); + this.getCode().changeEvent.notify(); }; - b.applyValue = function(a) { - this.value != a && this.setValue(a); - this.textElement.textContent = this.getTextByValue(a); - this.resize(); + a.doSeparate = function() { + this.separate(); }; - b.getTextByValue = function(a) { - if (!a || "null" === a) { - return Lang.Blocks.no_target; - } - for (var b = this._contents.options, d = 0, e = b.length;d < e;d++) { - var f = b[d]; - if (f[1] == a) { - return f[0]; - } - } - return Lang.Blocks.no_target; + a.doInsert = function(b) { + "basic" === this.getBlockType() ? this.insert(b) : this.replace(b); }; - b.getContentHeight = function(a) { - return a = a || this._blockView.getSkeleton().dropdownHeight || (Entry.isMobile() ? 22 : 16); + a.doDestroy = function(b) { + this.destroy(b); + this.getCode().changeEvent.notify(); + return this; }; - b.getArrow = function() { - var a = Entry.isMobile(); - return {color:this._arrowColor || this._blockView._schema.color, points:a ? "0,0 19,0 9.5,13" : "0,0 6.4,0 3.2,4.2", height:a ? 13 : 4.2, width:a ? 19 : 6.4}; + a.doDestroyBelow = function(b) { + console.log("destroyBelow", this.id, this.x, this.y); + this.destroy(b, !0); + this.getCode().changeEvent.notify(); + return this; }; -})(Entry.FieldDropdown.prototype); -Entry.FieldDropdownDynamic = function(b, a, c) { - this._block = a.block; - this._blockView = a; - this.box = new Entry.BoxModel; - this.svgGroup = null; - this._contents = b; - this._index = c; - this._arrowColor = b.arrowColor; - c = this._contents.menuName; - Entry.Utils.isFunction(c) ? this._menuGenerator = c : this._menuName = c; - this._CONTENT_HEIGHT = this.getContentHeight(b.dropdownHeight); - this._FONT_SIZE = this.getFontSize(b.fontSize); - this._ROUND = b.roundValue || 3; - this.renderStart(a); -}; -Entry.Utils.inherit(Entry.FieldDropdown, Entry.FieldDropdownDynamic); -(function(b) { - b.constructor = Entry.FieldDropDownDynamic; - b._updateValue = function() { - var a = this._block.getCode().object, b = []; - Entry.container && (b = this._menuName ? Entry.container.getDropdownList(this._menuName, a) : this._menuGenerator()); - this._contents.options = b; - a = this.getValue(); - if (this._blockView.isInBlockMenu || !a || "null" == a) { - a = 0 !== b.length ? b[0][1] : null; + a.copy = function() { + var b = this.getThread(), a = []; + if (b instanceof Entry.Thread) { + for (var d = b.getBlocks().indexOf(this), b = b.toJSON(!0, d), d = 0;d < b.length;d++) { + a.push(b[d]); + } + } else { + a.push(this.toJSON(!0)); } - this.setValue(a); + b = this.view.getAbsoluteCoordinate(); + d = a[0]; + d.x = b.x + 15; + d.y = b.y + 15; + d.id = Entry.Utils.generateId(); + return a; }; - b.renderOptions = function() { - var a = this; - this._attachDisposeEvent(); - this.optionGroup = Entry.Dom("ul", {class:"entry-widget-dropdown", parent:$("body")}); - this.optionGroup.bind("mousedown touchstart", function(a) { - a.stopPropagation(); - }); - var b; - b = this._menuName ? Entry.container.getDropdownList(this._contents.menuName) : this._menuGenerator(); - this._contents.options = b; - for (var d = 0;d < b.length;d++) { - var e = b[d], f = e[0], e = e[1], g = Entry.Dom("li", {class:"rect", parent:this.optionGroup}), h = Entry.Dom("span", {class:"left", parent:g}); - Entry.Dom("span", {class:"right", parent:g}).text(f); - this.getValue() == e && h.text("\u2713"); - (function(b, c) { - b.mousedown(function(a) { - a.stopPropagation(); - }); - b.mouseup(function(b) { - b.stopPropagation(); - a.applyValue(c); - a.destroyOption(); - a._selectBlockView(); - }); - })(g, e); - } - this._position(); + a.copyToClipboard = function() { + Entry.clipboard = this.copy(); }; -})(Entry.FieldDropdownDynamic.prototype); -Entry.FieldImage = function(b, a, c) { - this._block = a.block; - this._blockView = a; - this._content = b; - this.box = new Entry.BoxModel; - this._size = b.size; - this._highlightColor = b.highlightColor ? b.highlightColor : "#F59900"; - this._position = b.position; - this._imgElement = this._path = this.svgGroup = null; - this._index = c; - this.setValue(null); - this.renderStart(); -}; -Entry.Utils.inherit(Entry.Field, Entry.FieldImage); -(function(b) { - b.renderStart = function() { - this.svgGroup && this.svgGroup.remove(); - this._imgUrl = this._block.deletable === Entry.Block.DELETABLE_FALSE_LIGHTEN ? this._content.img.replace(".png", "_un.png") : this._content.img; - this.svgGroup = this._blockView.contentSvgGroup.elem("g"); - this._imgElement = this.svgGroup.elem("image", {href:this._imgUrl, x:0, y:-.5 * this._size, width:this._size, height:this._size}); - this.box.set({x:this._size, y:0, width:this._size, height:this._size}); + a.separate = function(b) { + this.thread.separate(this, b); + this._updatePos(); + this.getCode().changeEvent.notify(); }; -})(Entry.FieldImage.prototype); -Entry.FieldIndicator = function(b, a, c) { - this._block = a.block; - this._blockView = a; - this.box = new Entry.BoxModel; - this._size = b.size; - this._imgUrl = this._block.deletable === Entry.Block.DELETABLE_FALSE_LIGHTEN ? b.img.replace(".png", "_un.png") : b.img; - this._boxMultiplier = b.boxMultiplier || 2; - this._highlightColor = b.highlightColor ? b.highlightColor : "#F59900"; - this._position = b.position; - this._index = c; - this._imgElement = this._path = this.svgGroup = null; - this.setValue(null); - this.renderStart(); -}; -Entry.Utils.inherit(Entry.Field, Entry.FieldIndicator); -(function(b) { - b.renderStart = function() { - this.svgGroup && this.svgGroup.remove(); - this.svgGroup = this._blockView.contentSvgGroup.elem("g"); - this._imgElement = this.svgGroup.elem("image", {href:Entry.mediaFilePath + this._imgUrl, x:this._position ? -1 * this._size : 0, y:-1 * this._size, width:2 * this._size, height:2 * this._size}); - var a = "m 0,-%s a %s,%s 0 1,1 -0.1,0 z".replace(/%s/gi, this._size); - this._path = this.svgGroup.elem("path", {d:a, stroke:"none", fill:"none"}); - this.box.set({width:this._size * this._boxMultiplier + (this._position ? -this._size : 0), height:this._size * this._boxMultiplier}); + a.insert = function(b) { + var a = this.thread.cut(this); + b instanceof Entry.Thread ? b.insertByBlock(null, a) : b.insertAfter(a); + this._updatePos(); + this.getCode().changeEvent.notify(); }; - b.enableHighlight = function() { - var a = this._path.getTotalLength(), b = this._path; - this._path.attr({stroke:this._highlightColor, strokeWidth:2, "stroke-linecap":"round", "stroke-dasharray":a + " " + a, "stroke-dashoffset":a}); - setInterval(function() { - b.attr({"stroke-dashoffset":a}).animate({"stroke-dashoffset":0}, 300); - }, 1400, mina.easeout); - setTimeout(function() { - setInterval(function() { - b.animate({"stroke-dashoffset":-a}, 300); - }, 1400, mina.easeout); - }, 500); + a.replace = function(b) { + this.thread.cut(this); + b.getThread().replace(this); + this.getCode().changeEvent.notify(); }; -})(Entry.FieldIndicator.prototype); -Entry.Keyboard = {}; -Entry.FieldKeyboard = function(b, a, c) { - this._block = a.block; - this._blockView = a; - this.box = new Entry.BoxModel; - this.svgGroup = null; - this.position = b.position; - this._contents = b; - this._index = c; - this.setValue(String(this.getValue())); - this._CONTENT_HEIGHT = this.getContentHeight(); - this._optionVisible = !1; - this.renderStart(a); -}; -Entry.Utils.inherit(Entry.Field, Entry.FieldKeyboard); -(function(b) { - b.renderStart = function() { - this.svgGroup && $(this.svgGroup).remove(); - this.svgGroup = this._blockView.contentSvgGroup.elem("g", {class:"entry-input-field"}); - this.textElement = this.svgGroup.elem("text").attr({x:5, y:4, "font-size":"11px"}); - this.textElement.textContent = Entry.getKeyCodeMap()[this.getValue()]; - var a = this.getTextWidth() + 1, b = this._CONTENT_HEIGHT, d = this.position && this.position.y ? this.position.y : 0; - this._header = this.svgGroup.elem("rect", {x:0, y:d - b / 2, width:a, height:b, rx:3, ry:3, fill:"#fff", "fill-opacity":.4}); - this.svgGroup.appendChild(this.textElement); - this._bindRenderOptions(); - this.box.set({x:0, y:0, width:a, height:b}); + a.getPrevBlock = function() { + return this.thread.getPrevBlock(this); }; - b.renderOptions = function() { - Entry.keyPressed && (this.keyPressed = Entry.keyPressed.attach(this, this._keyboardControl)); - this._optionVisible = !0; - this._attachDisposeEvent(); - var a = this.getAbsolutePosFromDocument(); - a.x -= this.box.width / 2; - a.y += this.box.height / 2 + 1; - this.optionGroup = Entry.Dom("img", {class:"entry-widget-keyboard-input", src:Entry.mediaFilePath + "/media/keyboard_workspace.png", parent:$("body")}); - this.optionGroup.css({left:a.x, top:a.y}); + a.getNextBlock = function() { + return this.thread.getNextBlock(this) || null; }; - b.destroyOption = function() { - this.disposeEvent && (Entry.disposeEvent.detach(this.disposeEvent), delete this.disposeEvent); - this.optionGroup && (this.optionGroup.remove(), delete this.optionGroup); - this._optionVisible = !1; - this.command(); - this.keyPressed && (Entry.keyPressed.detach(this.keyPressed), delete this.keyPressed); + a.getLastBlock = function() { + return this.thread.getLastBlock(); }; - b._keyboardControl = function(a) { - a.stopPropagation(); - if (this._optionVisible) { - a = a.keyCode; - var b = Entry.getKeyCodeMap()[a]; - void 0 !== b && this.applyValue(b, a); + a.getOutputBlock = function() { + for (var b = this._schema.params, a = 0;b && a < b.length;a++) { + if ("Output" === b[a].type) { + return this.params[a]; + } + } + return null; + }; + a.getTerminateOutputBlock = function() { + for (var b = this;;) { + var a = b.getOutputBlock(); + if (!a) { + return b; + } + b = a; } }; - b.applyValue = function(a, b) { - this.setValue(String(b)); - this.destroyOption(); - this.textElement.textContent = a; - this.resize(); + a.getBlockType = function() { + if (!this.view) { + return null; + } + var b = Entry.skeleton[this._schema.skeleton].magnets(this.view); + return b.next || b.previous ? "basic" : b.boolean || b.string ? "field" : b.output ? "output" : null; }; - b.resize = function() { - var a = this.getTextWidth() + 1; - this._header.attr({width:a}); - this.box.set({width:a}); - this._blockView.alignContent(); + a.indexOfStatements = function(b) { + return this.statements.indexOf(b); }; - b.getTextWidth = function() { - return this.textElement.getComputedTextLength() + 10; + a.pointer = function(b) { + b || (b = []); + return this.thread.pointer(b, this); }; - b.destroy = function() { - this.destroyOption(); - Entry.keyPressed && this.keyPressed && Entry.keyPressed.detach(this.keyPressed); + a.targetPointer = function() { + var b = this.thread.pointer([], this); + 4 === b.length && 0 === b[3] && b.pop(); + return b; }; -})(Entry.FieldKeyboard.prototype); -Entry.FieldLineBreak = function(b, a, c) { - this._block = a.block; - this._blockView = a; - this._index = c; - this.box = new Entry.BoxModel; - this.setValue(null); - this.renderStart(); -}; -Entry.Utils.inherit(Entry.Field, Entry.FieldLineBreak); -(function(b) { - b.renderStart = function() { + a.getBlockList = function(b, a) { + var d = []; + if (!this._schema) { + return []; + } + if (b && this._schema.isPrimitive) { + return d; + } + (a || this.type) === this.type && d.push(this); + for (var e = this.params, f = 0;f < e.length;f++) { + var g = e[f]; + g && g.constructor == Entry.Block && (d = d.concat(g.getBlockList(b, a))); + } + if (e = this.statements) { + for (f = 0;f < e.length;f++) { + d = d.concat(e[f].getBlockList(b, a)); + } + } + return d; }; - b.align = function(a) { - var b = this._blockView; - 0 !== b._statements.length && this.box.set({y:(b._statements[a].height || 20) + Math.max(b.contentHeight % 1E3, 30)}); + a.stringify = function() { + return JSON.stringify(this.toJSON()); }; -})(Entry.FieldLineBreak.prototype); -Entry.FieldOutput = function(b, a, c, d, e) { +})(Entry.Block.prototype); +Entry.BlockMenu = function(a, b, c, d) { Entry.Model(this, !1); - this._blockView = a; - this._block = a.block; - this._valueBlock = null; - this.box = new Entry.BoxModel; + this._align = b || "CENTER"; + this._scroll = void 0 !== d ? d : !1; + this._bannedClass = []; + this._categories = []; + this.suffix = "blockMenu"; + a = "string" === typeof a ? $("#" + a) : $(a); + if ("DIV" !== a.prop("tagName")) { + return console.error("Dom is not div element"); + } + this.view = a; + this.visible = !0; + this._svgId = "blockMenu" + (new Date).getTime(); + this._clearCategory(); + this._categoryData = c; + this._generateView(c); + this._splitters = []; + this.setWidth(); + this.svg = Entry.SVG(this._svgId); + Entry.Utils.addFilters(this.svg, this.suffix); + b = Entry.Utils.addBlockPattern(this.svg, this.suffix); + this.patternRect = b.rect; + this.pattern = b.pattern; + this.svgGroup = this.svg.elem("g"); + this.svgThreadGroup = this.svgGroup.elem("g"); + this.svgThreadGroup.board = this; + this.svgBlockGroup = this.svgGroup.elem("g"); + this.svgBlockGroup.board = this; this.changeEvent = new Entry.Event(this); - this._index = c; - this.contentIndex = e; - this._content = b; - this.acceptType = b.accept; - 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.FieldOutput); -(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)); - this._updateValueBlock(d); - this._blockView.getBoard().constructor == Entry.BlockMenu && this._valueBlock && this._valueBlock.view.removeControl(); + c && this._generateCategoryCodes(c); + this.observe(this, "_handleDragBlock", ["dragBlock"]); + this._scroll && (this._scroller = new Entry.BlockMenuScroller(this), this._addControl(a)); + Entry.documentMousedown && Entry.documentMousedown.attach(this, this.setSelectedBlock); + this._categoryCodes && Entry.keyPressed && Entry.keyPressed.attach(this, this._captureKeyEvent); + Entry.windowResized && (a = _.debounce(this.updateOffset, 200), Entry.windowResized.attach(this, a)); +}; +(function(a) { + a.schema = {code:null, dragBlock:null, closeBlock:null, selectedBlockView:null}; + a._generateView = function(b) { + var a = this.view, d = this; + b && (this._categoryCol = Entry.Dom("ul", {class:"entryCategoryListWorkspace", parent:a}), this._generateCategoryView(b)); + this.blockMenuContainer = Entry.Dom("div", {"class":"blockMenuContainer", parent:a}); + this.svgDom = Entry.Dom($(''), {parent:this.blockMenuContainer}); + this.svgDom.mouseenter(function(b) { + d._scroller && d._scroller.setOpacity(1); + b = d.workspace.selectedBlockView; + !Entry.playground || Entry.playground.resizing || b && b.dragMode === Entry.DRAG_MODE_DRAG || (Entry.playground.focusBlockMenu = !0, b = d.svgGroup.getBBox(), b = b.width + b.x + 64, b > Entry.interfaceState.menuWidth && (this.widthBackup = Entry.interfaceState.menuWidth - 64, $(this).stop().animate({width:b - 62}, 200))); + }); + this.svgDom.mouseleave(function(b) { + Entry.playground && !Entry.playground.resizing && (d._scroller && d._scroller.setOpacity(0), (b = this.widthBackup) && $(this).stop().animate({width:b}, 200), delete this.widthBackup, delete Entry.playground.focusBlockMenu); + }); + $(window).scroll(function() { + d.updateOffset(); + }); }; - 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}); + a.changeCode = function(b) { + if (!(b instanceof Entry.Code)) { + return console.error("You must inject code instance"); + } + this.codeListener && this.code.changeEvent.detach(this.codeListener); + var a = this; + this.set({code:b}); + this.codeListener = this.code.changeEvent.attach(this, function() { + a.changeEvent.notify(); + }); + b.createView(this); + this.align(); }; - b.calcWH = function() { - var a = this._valueBlock; - a ? (a = a.view, this.box.set({width:a.width, height:a.height})) : this.box.set({width:0, height:20}); + a.bindCodeView = function(b) { + this.svgBlockGroup.remove(); + this.svgThreadGroup.remove(); + this.svgBlockGroup = b.svgBlockGroup; + this.svgThreadGroup = b.svgThreadGroup; + this.svgGroup.appendChild(this.svgThreadGroup); + this.svgGroup.appendChild(this.svgBlockGroup); + this._scroller && this.svgGroup.appendChild(this._scroller.svgGroup); }; - b.calcHeight = b.calcWH; - b.destroy = function() { + a.align = function(b) { + var a = this.code; + if (a) { + this._clearSplitters(); + a.view && !b && a.view.reDraw(); + b = a.getThreads(); + for (var a = 10, d = "LEFT" == this._align ? 10 : this.svgDom.width() / 2, e, f = 0, g = b.length;f < g;f++) { + var h = b[f].getFirstBlock(), k = h.view, h = Entry.block[h.type]; + this.checkBanClass(h) ? k.set({display:!1}) : (k.set({display:!0}), h = h.class, e && e !== h && (this._createSplitter(a), a += 15), e = h, h = d - k.offsetX, "CENTER" == this._align && (h -= k.width / 2), a -= k.offsetY, k._moveTo(h, a, !1), a += k.height + 15); + } + this.updateSplitters(); + this.changeEvent.notify(); + } }; - b._inspectBlock = function() { + a.cloneToGlobal = function(b) { + if (!this._boardBlockView && null !== this.dragBlock) { + var a = this.workspace, d = a.getMode(), e = this.dragBlock, f = this._svgWidth, g = a.selectedBoard; + if (!g || d != Entry.Workspace.MODE_BOARD && d != Entry.Workspace.MODE_OVERLAYBOARD) { + Entry.GlobalSvg.setView(e, a.getMode()) && Entry.GlobalSvg.addControl(b); + } else { + if (g.code && (a = e.block, d = a.getThread(), a && d)) { + a = d.toJSON(!0); + this._boardBlockView = Entry.do("addThread", a).value.getFirstBlock().view; + var g = this.offset().top - g.offset().top, h, k; + if (a = this.dragBlock.mouseDownCoordinate) { + h = b.pageX - a.x, k = b.pageY - a.y; + } + this._boardBlockView._moveTo(e.x - f + (h || 0), e.y + g + (k || 0), !1); + this._boardBlockView.onMouseDown.call(this._boardBlockView, b); + this._boardBlockView.dragInstance.set({isNew:!0}); + } + } + } }; - b._setValueBlock = function(a) { - if (a != this._valueBlock || !this._valueBlock) { - return this._valueBlock = a, this.setValue(a), a && a.setThread(this), this._valueBlock; + a.terminateDrag = function() { + if (this._boardBlockView) { + var b = this._boardBlockView; + if (b) { + this.workspace.getBoard(); + this._boardBlockView = null; + var a = Entry.GlobalSvg.left, d = Entry.GlobalSvg.width / 2, b = b.getBoard().offset().left; + return a < b - d; + } } }; - b._updateValueBlock = function(a) { - a instanceof Entry.Block || (a = void 0); - this._sizeObserver && this._sizeObserver.destroy(); - this._posObserver && this._posObserver.destroy(); - (a = this._setValueBlock(a)) ? (a = a.view, a.bindPrev(), this._posObserver = a.observe(this, "_updateValueBlock", ["x", "y"], !1), this._sizeObserver = a.observe(this, "calcWH", ["width", "height"])) : this.calcWH(); - this._blockView.alignContent(); - a = this._blockView.getBoard(); - a.constructor === Entry.Board && a.generateCodeMagnetMap(); + a.getCode = function(b) { + return this._code; }; - b.getPrevBlock = function(a) { - return this._valueBlock === a ? this : null; + a.setSelectedBlock = function(b) { + var a = this.selectedBlockView; + a && a.removeSelected(); + b instanceof Entry.BlockView ? b.addSelected() : b = null; + this.set({selectedBlockView:b}); }; - b.getNextBlock = function() { - return null; + a.hide = function() { + this.view.addClass("entryRemove"); }; - b.requestAbsoluteCoordinate = function(a) { - a = this._blockView; - var b = a.contentPos; - a = a.getAbsoluteCoordinate(); - a.x += this.box.x + b.x; - a.y += this.box.y + b.y; - return a; + a.show = function() { + this.view.removeClass("entryRemove"); }; - b.dominate = function() { - this._blockView.dominate(); + a.renderText = function() { + for (var b = this.code.getThreads(), a = 0;a < b.length;a++) { + b[a].view.renderText(); + } }; - b.isGlobal = function() { - return !1; + a.renderBlock = function() { + for (var b = this.code.getThreads(), a = 0;a < b.length;a++) { + b[a].view.renderBlock(); + } }; - b.separate = function(a) { - this.getCode().createThread([a]); - this.changeEvent.notify(); + a._createSplitter = function(b) { + b = this.svgBlockGroup.elem("line", {x1:20, y1:b, x2:this._svgWidth - 20, y2:b, stroke:"#b5b5b5"}); + this._splitters.push(b); }; - b.getCode = function() { - return this._block.thread.getCode(); + a.updateSplitters = function(b) { + b = void 0 === b ? 0 : b; + var a = this._svgWidth - 20, d; + this._splitters.forEach(function(e) { + d = parseFloat(e.getAttribute("y1")) + b; + e.attr({x2:a, y1:d, y2:d}); + }); }; - b.cut = function(a) { - return this._valueBlock === a ? (delete this._valueBlock, [a]) : null; + a._clearSplitters = function() { + for (var b = this._splitters, a = b.length - 1;0 <= a;a--) { + b[a].remove(), b.pop(); + } }; - b._updateBG = function() { - this.magneting ? this._bg = this.svgGroup.elem("path", {d:"m -4,-12 h 3 l 2,2 0,3 3,0 1,1 0,12 -1,1 -3,0 0,3 -2,2 h -3 ", fill:"#fff", stroke:"#fff", "fill-opacity":.7, transform:"translate(0," + (this._valueBlock ? 12 : 0) + ")"}) : this._bg && (this._bg.remove(), delete this._bg); + a.setWidth = function() { + this._svgWidth = this.blockMenuContainer.width(); + this.updateSplitters(); }; - b.replace = function(a) { - var b = this._valueBlock; - b && (b.view._toGlobalCoordinate(), a.getTerminateOutputBlock().view._contents[1].replace(b)); - this._updateValueBlock(a); - a.view._toLocalCoordinate(this.svgGroup); - this.calcWH(); + a.setMenu = function() { + var b = this._categoryCodes, a = this._categoryElems, d; + for (d in b) { + for (var e = b[d], e = e instanceof Entry.Code ? e.getThreads() : e, f = e.length, g = 0;g < e.length;g++) { + var h = e[g], h = h instanceof Entry.Thread ? h.getFirstBlock().type : h[0].type; + this.checkBanClass(Entry.block[h]) && f--; + } + 0 === f ? a[d].addClass("entryRemove") : a[d].removeClass("entryRemove"); + } }; - b.setParent = function(a) { - this._parent = a; + a.getCategoryCodes = function(b) { + b = this._convertSelector(b); + var a = this._categoryCodes[b]; + a || (this._generateCategoryElement(b), a = []); + a instanceof Entry.Code || (a = this._categoryCodes[b] = new Entry.Code(a)); + return a; }; - b.getParent = function() { - return this._parent; + a._convertSelector = function(b) { + if (isNaN(b)) { + return b; + } + b = Number(b); + for (var a = this._categories, d = this._categoryElems, e = 0;e < a.length;e++) { + var f = a[e]; + if (!d[f].hasClass("entryRemove") && 0 === b--) { + return f; + } + } }; - b.getThread = function() { - return this; + a.selectMenu = function(b, a) { + if (b = this._convertSelector(b)) { + "variable" == b && Entry.playground.checkVariables(); + "arduino" == b && this._generateHwCode(); + var d = this._categoryElems[b], e = this._selectedCategoryView, f = !1, g = this.workspace.board, h = g.view; + e && e.removeClass("entrySelectedCategory"); + d != e || a ? e || (this.visible || (f = !0, h.addClass("foldOut"), Entry.playground.showTabs()), h.removeClass("folding"), this.visible = !0) : (h.addClass("folding"), this._selectedCategoryView = null, d.removeClass("entrySelectedCategory"), Entry.playground.hideTabs(), f = !0, this.visible = !1); + f && Entry.bindAnimationCallbackOnce(h, function() { + g.scroller.resizeScrollBar.call(g.scroller); + h.removeClass("foldOut"); + Entry.windowResized.notify(); + }); + this.visible && (a = this._categoryCodes[b], this._selectedCategoryView = d, d.addClass("entrySelectedCategory"), a.constructor !== Entry.Code && (a = this._categoryCodes[b] = new Entry.Code(a)), this.changeCode(a)); + this.lastSelector = b; + } }; - b.getValueBlock = function() { - return this._valueBlock; + a._generateCategoryCodes = function(b) { + this._categoryCodes = {}; + for (var a = 0;a < b.length;a++) { + var d = b[a], e = []; + d.blocks.forEach(function(b) { + var a = Entry.block[b]; + if (a && a.def) { + if (a.defs) { + for (b = 0;b < a.defs.length;b++) { + e.push([a.defs[b]]); + } + } else { + e.push([a.def]); + } + } else { + e.push([{type:b}]); + } + }); + d = d.category; + this._categories.push(d); + this._categoryCodes[d] = e; + } }; - b.pointer = function(a) { - a.unshift(this._index); - a.unshift(Entry.PARAM); - return this._block.pointer(a); + a.banClass = function(b, a) { + 0 > this._bannedClass.indexOf(b) && this._bannedClass.push(b); + this.align(a); }; -})(Entry.FieldOutput.prototype); -Entry.FieldStatement = function(b, a, c) { - Entry.Model(this, !1); - this._blockView = a; - this.block = a.block; - this.view = this; - this._index = c; - this.acceptType = b.accept; - this._thread = this.statementSvgGroup = this.svgGroup = null; - this._position = b.position; - this.observe(a, "alignContent", ["height"], !1); - this.observe(this, "_updateBG", ["magneting"], !1); - this.renderStart(a.getBoard()); -}; -(function(b) { - b.schema = {x:0, y:0, width:100, height:20, magneting:!1}; - b.magnet = {next:{x:0, y:0}}; - b.renderStart = function(a) { - this.svgGroup = this._blockView.statementSvgGroup.elem("g"); - this._nextGroup = this.statementSvgGroup = this.svgGroup.elem("g"); - this._initThread(a); - this._board = a; + a.unbanClass = function(b, a) { + b = this._bannedClass.indexOf(b); + -1 < b && this._bannedClass.splice(b, 1); + this.align(a); }; - b._initThread = function(a) { - var b = this.getValue(); - this._thread = b; - b.createView(a); - b.view.setParent(this); - if (a = b.getFirstBlock()) { - a.view._toLocalCoordinate(this.statementSvgGroup), this.firstBlock = a; + a.checkBanClass = function(b) { + if (b) { + b = b.isNotFor; + for (var a in this._bannedClass) { + if (b && -1 < b.indexOf(this._bannedClass[a])) { + return !0; + } + } + return !1; } - b.changeEvent.attach(this, this.calcHeight); - b.changeEvent.attach(this, this.checkTopBlock); - this.calcHeight(); }; - b.align = function(a, b, d) { - d = void 0 === d ? !0 : d; - var e = this.svgGroup; - this._position && (this._position.x && (a = this._position.x), this._position.y && (b = this._position.y)); - var f = "translate(" + a + "," + b + ")"; - this.set({x:a, y:b}); - d ? e.animate({transform:f}, 300, mina.easeinout) : e.attr({transform:f}); + a._addControl = function(b) { + var a = this; + b.on("wheel", function() { + a._mouseWheel.apply(a, arguments); + }); + a._scroller && $(this.svg).bind("mousedown touchstart", function(b) { + a.onMouseDown.apply(a, arguments); + }); }; - b.calcHeight = function() { - var a = this._thread.view.requestPartHeight(null); - this.set({height:a}); + a.onMouseDown = function(b) { + function a(b) { + b.stopPropagation && b.stopPropagation(); + b.preventDefault && b.preventDefault(); + b = Entry.Utils.convertMouseEvent(b); + var c = e.dragInstance; + e._scroller.scroll(-b.pageY + c.offsetY); + c.set({offsetY:b.pageY}); + } + function d(b) { + $(document).unbind(".blockMenu"); + delete e.dragInstance; + } + b.stopPropagation && b.stopPropagation(); + b.preventDefault && b.preventDefault(); + var e = this; + if (0 === b.button || b.originalEvent && b.originalEvent.touches) { + b = Entry.Utils.convertMouseEvent(b); + Entry.documentMousedown && Entry.documentMousedown.notify(b); + var f = $(document); + f.bind("mousemove.blockMenu", a); + f.bind("mouseup.blockMenu", d); + f.bind("touchmove.blockMenu", a); + f.bind("touchend.blockMenu", d); + this.dragInstance = new Entry.DragInstance({startY:b.pageY, offsetY:b.pageY}); + } }; - b.getValue = function() { - return this.block.statements[this._index]; + a._mouseWheel = function(b) { + b = b.originalEvent; + b.preventDefault(); + var a = Entry.disposeEvent; + a && a.notify(b); + this._scroller.scroll(-b.wheelDeltaY || b.deltaY / 3); }; - b.requestAbsoluteCoordinate = function() { - var a = this._blockView.getAbsoluteCoordinate(); - a.x += this.x; - a.y += this.y; - return a; + a.dominate = function(b) { + this.svgBlockGroup.appendChild(b.view.svgGroup); }; - b.dominate = function() { - this._blockView.dominate(); + a.reDraw = function() { + this.selectMenu(this.lastSelector, !0); }; - b.destroy = function() { + a._handleDragBlock = function() { + this._boardBlockView = null; + this._scroller && this._scroller.setOpacity(0); }; - b._updateBG = function() { - if (this._board.dragBlock && this._board.dragBlock.dragInstance) { - if (this.magneting) { - var a = this._board.dragBlock.getShadow(), b = this.requestAbsoluteCoordinate(), b = "translate(" + b.x + "," + b.y + ")"; - $(a).attr({transform:b, display:"block"}); - this._clonedShadow = a; - this.background && (this.background.remove(), this.nextBackground.remove(), delete this.background, delete this.nextBackground); - a = this._board.dragBlock.getBelowHeight(); - this.statementSvgGroup.attr({transform:"translate(0," + a + ")"}); - this.set({height:this.height + a}); - } else { - this._clonedShadow && (this._clonedShadow.attr({display:"none"}), delete this._clonedShadow), a = this.originalHeight, void 0 !== a && (this.background && (this.background.remove(), this.nextBackground.remove(), delete this.background, delete this.nextBackground), delete this.originalHeight), this.statementSvgGroup.attr({transform:"translate(0,0)"}), this.calcHeight(); - } - (a = this.block.thread.changeEvent) && a.notify(); - } + a._captureKeyEvent = function(b) { + var a = b.keyCode, d = Entry.type; + b.ctrlKey && "workspace" == d && 48 < a && 58 > a && (b.preventDefault(), this.selectMenu(a - 49)); }; - b.insertTopBlock = function(a) { - this._posObserver && this._posObserver.destroy(); - var b = this.firstBlock; - (this.firstBlock = a) && a.doInsert(this._thread); - return b; + a.setPatternRectFill = function(b) { + this.patternRect.attr({fill:b}); + this.pattern.attr({style:""}); }; - b.getNextBlock = function() { - return this.firstBlock; + a.disablePattern = function() { + this.pattern.attr({style:"display: none"}); }; - b.checkTopBlock = function() { - var a = this._thread.getFirstBlock(); - a && this.firstBlock !== a ? (this.firstBlock = a, a.view.bindPrev(this), a._updatePos()) : a || (this.firstBlock = null); + a._clearCategory = function() { + this._selectedCategoryView = null; + this._categories = []; + var b = this._categoryElems, a; + for (a in b) { + b[a].remove(); + } + this._categoryElems = {}; + b = this._categoryCodes; + for (a in b) { + var d = b[a]; + d.constructor == Entry.Code && d.clear(); + } + this._categoryCodes = null; }; -})(Entry.FieldStatement.prototype); -Entry.FieldText = function(b, a, c) { - this._block = a.block; - this._blockView = a; - this._index = c; - this.box = new Entry.BoxModel; - this._fontSize = b.fontSize || a.getSkeleton().fontSize || 12; - this._color = b.color || this._block.getSchema().fontColor || a.getSkeleton().color || "white"; - this._align = b.align || "left"; - this._text = this.getValue() || b.text; - this.setValue(null); - this.textElement = null; - this.renderStart(a); -}; -Entry.Utils.inherit(Entry.Field, Entry.FieldText); -(function(b) { - b.renderStart = function() { - this.svgGroup && $(this.svgGroup).remove(); - this.svgGroup = this._blockView.contentSvgGroup.elem("g"); - this._text = this._text.replace(/(\r\n|\n|\r)/gm, " "); - this.textElement = this.svgGroup.elem("text").attr({style:"white-space: pre;", "font-size":this._fontSize + "px", "font-family":"nanumBarunRegular", "class":"dragNone", fill:this._color}); - this.textElement.textContent = this._text; - var a = 0, b = this.textElement.getBoundingClientRect(); - "center" == this._align && (a = -b.width / 2); - this.textElement.attr({x:a, y:.25 * b.height}); - this.box.set({x:0, y:0, width:b.width, height:b.height}); + a.setCategoryData = function(b) { + this._clearCategory(); + this._categoryData = b; + this._generateCategoryView(b); + this._generateCategoryCodes(b); }; -})(Entry.FieldText.prototype); -Entry.FieldTextInput = function(b, a, c) { - this._blockView = a; - this._block = a.block; - this.box = new Entry.BoxModel; - this.svgGroup = null; - this.position = b.position; - this._contents = b; - this._index = c; - this.value = this.getValue() || ""; - this._CONTENT_HEIGHT = this.getContentHeight(); - this.renderStart(); -}; -Entry.Utils.inherit(Entry.Field, Entry.FieldTextInput); -(function(b) { - b.renderStart = function() { - this.svgGroup && $(this.svgGroup).remove(); - this.svgGroup = this._blockView.contentSvgGroup.elem("g"); - this.svgGroup.attr({class:"entry-input-field"}); - this.textElement = this.svgGroup.elem("text", {x:3, y:4, "font-size":"12px"}); - this.textElement.textContent = this.truncate(); - var a = this.getTextWidth(), b = this.position && this.position.y ? this.position.y : 0, d = this._CONTENT_HEIGHT; - this._header = this.svgGroup.elem("rect", {width:a, height:d, y:b - d / 2, rx:3, ry:3, fill:"transparent"}); - this.svgGroup.appendChild(this.textElement); - this._bindRenderOptions(); - this.box.set({x:0, y:0, width:a, height:d}); + a._generateCategoryView = function(b) { + if (b) { + for (var a = 0;a < b.length;a++) { + this._generateCategoryElement(b[a].category); + } + } }; - b.renderOptions = function() { + a._generateCategoryElement = function(b) { var a = this; - this._attachDisposeEvent(function() { - a.applyValue(); - a.destroyOption(); - }); - this.optionGroup = Entry.Dom("input", {class:"entry-widget-input-field", parent:$("body")}); - this.optionGroup.val(this.getValue()); - this.optionGroup.on("mousedown", function(a) { - a.stopPropagation(); - }); - this.optionGroup.on("keyup", function(b) { - var c = b.keyCode || b.which; - a.applyValue(b); - -1 < [13, 27].indexOf(c) && a.destroyOption(); - }); - var b = this.getAbsolutePosFromDocument(); - b.y -= this.box.height / 2; - this.optionGroup.css({height:this._CONTENT_HEIGHT, left:b.x, top:b.y, width:a.box.width}); - this.optionGroup.focus(); - b = this.optionGroup[0]; - b.setSelectionRange(0, b.value.length, "backward"); - }; - b.applyValue = function(a) { - a = this.optionGroup.val(); - this.setValue(a); - this.textElement.textContent = this.truncate(); - this.resize(); + (function(b, e) { + b.text(Lang.Blocks[e.toUpperCase()]); + a._categoryElems[e] = b; + b.bindOnClick(function(b) { + a.selectMenu(e); + }); + })(Entry.Dom("li", {id:"entryCategory" + b, class:"entryCategoryElementWorkspace", parent:this._categoryCol}), b); }; - b.resize = function() { - var a = this.getTextWidth(); - this._header.attr({width:a}); - this.optionGroup.css({width:a}); - this.box.set({width:a}); - this._blockView.alignContent(); + a.updateOffset = function() { + this._offset = this.svgDom.offset(); }; - b.getTextWidth = function() { - return this.textElement.getComputedTextLength() + 6 + 2; + a.offset = function() { + (!this._offset || 0 === this._offset.top && 0 === this._offset.left) && this.updateOffset(); + return this._offset; }; -})(Entry.FieldTextInput.prototype); -Entry.GlobalSvg = {}; -(function(b) { - b.DONE = 0; - b._inited = !1; - b.REMOVE = 1; - b.RETURN = 2; - b.createDom = function() { - if (!this.inited) { - $("#globalSvgSurface").remove(); - $("#globalSvg").remove(); - var a = $("body"); - this._container = Entry.Dom("div", {classes:["globalSvgSurface", "entryRemove"], id:"globalSvgSurface", parent:a}); - this.svgDom = Entry.Dom($(''), {parent:this._container}); - this.svg = Entry.SVG("globalSvg"); - this.top = this.left = 0; - this._inited = !0; + a._generateHwCode = function() { + var b = this._categoryCodes.arduino; + b instanceof Entry.Code && b.clear(); + for (var a = this._categoryData, d, b = a.length - 1;0 <= b;b--) { + if ("arduino" === a[b].category) { + d = a[b].blocks; + break; + } + } + a = []; + for (b = 0;b < d.length;b++) { + var e = d[b], f = Entry.block[e]; + if (!this.checkBanClass(f)) { + if (f && f.def) { + if (f.defs) { + for (b = 0;b < f.defs.length;b++) { + a.push([f.defs[b]]); + } + } else { + a.push([f.def]); + } + } else { + a.push([{type:e}]); + } + } } + this._categoryCodes.arduino = a; }; - b.setView = function(a, b) { - if (a != this._view && !a.block.isReadOnly() && a.movable) { - return this._view = a, this._mode = b, b !== Entry.Workspace.MODE_VIMBOARD && a.set({visible:!1}), this.draw(), this.show(), this.align(), this.position(), !0; +})(Entry.BlockMenu.prototype); +Entry.BlockMenuScroller = function(a) { + var b = this; + this.board = a; + this.board.changeEvent.attach(this, this._reset); + this.svgGroup = null; + this.vRatio = this.vY = this.vWidth = this.hX = 0; + this._visible = !0; + this._opacity = -1; + this.mouseHandler = function() { + b.onMouseDown.apply(b, arguments); + }; + this.createScrollBar(); + this.setOpacity(0); + this._addControl(); + Entry.windowResized && Entry.windowResized.attach(this, this.resizeScrollBar); +}; +Entry.BlockMenuScroller.RADIUS = 7; +(function(a) { + a.createScrollBar = function() { + this.svgGroup = this.board.svgGroup.elem("g", {class:"boardScrollbar"}); + this.vScrollbar = this.svgGroup.elem("rect", {rx:4, ry:4}); + this.resizeScrollBar(); + }; + a.resizeScrollBar = function() { + this._updateRatio(); + if (this._visible && 0 !== this.vRatio) { + var a = this.board.blockMenuContainer; + this.vScrollbar.attr({width:9, height:a.height() / this.vRatio, x:a.width() - 9}); } }; - b.draw = function() { - var a = this._view; - this._svg && this.remove(); - var b = this._mode == Entry.Workspace.MODE_VIMBOARD; - this.svgGroup = Entry.SVG.createElement(a.svgGroup.cloneNode(!0), {opacity:1}); - this.svg.appendChild(this.svgGroup); - b && (a = $(this.svgGroup), a.find("g").css({filter:"none"}), a.find("path").velocity({opacity:0}, {duration:500}), a.find("text").velocity({fill:"#000000"}, {duration:530})); + a.updateScrollBar = function(a) { + this.vY += a; + this.vScrollbar.attr({y:this.vY}); }; - b.remove = function() { - this.svgGroup && (this.svgGroup.remove(), delete this.svgGroup, delete this._view, delete this._offsetX, delete this._offsetY, delete this._startX, delete this._startY, this.hide()); + a.scroll = function(a) { + this.isVisible() && (a = this._adjustValue(a) - this.vY, 0 !== a && (this.board.code.moveBy(0, -a * this.vRatio), this.updateScrollBar(a))); }; - b.align = function() { - var a = this._view.getSkeleton().box(this._view).offsetX || 0, b = this._view.getSkeleton().box(this._view).offsetY || 0, a = -1 * a + 1, b = -1 * b + 1; - this._offsetX = a; - this._offsetY = b; - this.svgGroup.attr({transform:"translate(" + a + "," + b + ")"}); + a._adjustValue = function(a) { + var c = this.board.svgDom.height(), c = c - c / this.vRatio; + a = this.vY + a; + a = Math.max(0, a); + return a = Math.min(c, a); }; - b.show = function() { - this._container.removeClass("entryRemove"); + a.setVisible = function(a) { + a != this.isVisible() && (this._visible = a, this.svgGroup.attr({display:!0 === a ? "block" : "none"})); }; - b.hide = function() { - this._container.addClass("entryRemove"); + a.setOpacity = function(a) { + this._opacity != a && (this.vScrollbar.attr({opacity:a}), this._opacity = a); }; - b.position = function() { - var a = this._view; - if (a) { - var b = a.getAbsoluteCoordinate(), a = a.getBoard().offset(); - this.left = b.x + a.left - this._offsetX; - this.top = b.y + a.top - this._offsetY; - this.svgDom.css({transform:"translate3d(" + this.left + "px," + this.top + "px, 0px)"}); - } + a.isVisible = function() { + return this._visible; }; - b.terminateDrag = function(a) { - var b = Entry.mouseCoordinate, d = a.getBoard(), e = d.workspace.blockMenu, f = e.offset().left, g = e.offset().top, h = e.visible ? e.svgDom.width() : 0; - return b.y > d.offset().top - 20 && b.x > f + h ? this.DONE : b.y > g && b.x > f && e.visible ? a.block.isDeletable() ? this.REMOVE : this.RETURN : this.RETURN; + a._updateRatio = function() { + var a = this.board, c = a.svgBlockGroup.getBoundingClientRect(), d = a.blockMenuContainer.height(), a = a.offset(); + this.vRatio = c = (c.height + (c.top - a.top) + 10) / d; + 1 >= c ? this.setVisible(!1) : this.setVisible(!0); }; - b.addControl = function(a) { - this.onMouseDown.apply(this, arguments); + a._reset = function() { + this.vY = 0; + this.vScrollbar.attr({y:this.vY}); + this.resizeScrollBar(); }; - b.onMouseDown = function(a) { - function b(a) { - var c = a.pageX; - a = a.pageY; - var d = e.left + (c - e._startX), f = e.top + (a - e._startY); - e.svgDom.css({left:d, top:f}); - e._startX = c; - e._startY = a; - e.left = d; - e.top = f; + a.onMouseDown = function(a) { + function c(a) { + a.stopPropagation && a.stopPropagation(); + a.preventDefault && a.preventDefault(); + a = a.originalEvent && a.originalEvent.touches ? a.originalEvent.touches[0] : a; + var b = e.dragInstance; + e.scroll(a.pageY - b.offsetY); + b.set({offsetY:a.pageY}); } function d(a) { - $(document).unbind(".block"); + $(document).unbind(".scroll"); + delete e.dragInstance; } - this._startY = a.pageY; var e = this; + a.stopPropagation && a.stopPropagation(); + a.preventDefault && a.preventDefault(); + if (0 === a.button || a.originalEvent && a.originalEvent.touches) { + Entry.documentMousedown && Entry.documentMousedown.notify(a); + var f; + f = a.originalEvent && a.originalEvent.touches ? a.originalEvent.touches[0] : a; + var g = $(document); + g.bind("mousemove.scroll", c); + g.bind("mouseup.scroll", d); + g.bind("touchmove.scroll", c); + g.bind("touchend.scroll", d); + e.dragInstance = new Entry.DragInstance({startY:f.pageY, offsetY:f.pageY}); + } a.stopPropagation(); - a.preventDefault(); - var f = $(document); - f.bind("mousemove.block", b); - f.bind("mouseup.block", d); - f.bind("touchmove.block", b); - f.bind("touchend.block", d); - this._startX = a.pageX; - this._startY = a.pageY; - }; -})(Entry.GlobalSvg); -Entry.Mutator = function() { -}; -(function(b) { - b.mutate = function(a, b) { - var d = Entry.block[a]; - void 0 === d.changeEvent && (d.changeEvent = new Entry.Event); - d.template = b.template; - d.params = b.params; - d.changeEvent.notify(1); }; -})(Entry.Mutator); -(function(b) { -})(Entry.Mutator.prototype); -Entry.RenderView = function(b, a) { - this._align = a || "CENTER"; - b = "string" === typeof b ? $("#" + b) : $(b); - if ("DIV" !== b.prop("tagName")) { - return console.error("Dom is not div element"); - } - this.view = b; - this.viewOnly = !0; - this.suffix = "renderView"; - this.disableMouseEvent = this.visible = !0; - this._svgId = "renderView_" + (new Date).getTime(); - this._generateView(); - this.offset = this.svgDom.offset(); - this.setWidth(); - this.svg = Entry.SVG(this._svgId); - Entry.Utils.addFilters(this.svg, this.suffix); - this.svg && (this.svgGroup = this.svg.elem("g"), this.svgThreadGroup = this.svgGroup.elem("g"), this.svgThreadGroup.board = this, this.svgBlockGroup = this.svgGroup.elem("g"), this.svgBlockGroup.board = this); -}; -(function(b) { - b.schema = {code:null, dragBlock:null, closeBlock:null, selectedBlockView:null}; - b._generateView = function() { - this.renderViewContainer = Entry.Dom("div", {"class":"renderViewContainer", parent:this.view}); - this.svgDom = Entry.Dom($(''), {parent:this.renderViewContainer}); + a._addControl = function() { + $(this.vScrollbar).bind("mousedown touchstart", this.mouseHandler); }; - b.changeCode = function(a) { - if (!(a instanceof Entry.Code)) { - return console.error("You must inject code instance"); - } - this.code = a; - this.svg || (this.svg = Entry.SVG(this._svgId), this.svgGroup = this.svg.elem("g"), this.svgThreadGroup = this.svgGroup.elem("g"), this.svgThreadGroup.board = this, this.svgBlockGroup = this.svgGroup.elem("g"), this.svgBlockGroup.board = this); - a.createView(this); - this.align(); - this.resize(); +})(Entry.BlockMenuScroller.prototype); +Entry.BlockView = function(a, b, c) { + Entry.Model(this, !1); + this.block = a; + this._lazyUpdatePos = _.debounce(a._updatePos.bind(a), 200); + this._board = b; + this._observers = []; + this.set(a); + this.svgGroup = b.svgBlockGroup.elem("g"); + this._schema = Entry.block[a.type]; + this._schema.changeEvent && (this._schemaChangeEvent = this._schema.changeEvent.attach(this, this._updateSchema)); + var d = this._skeleton = Entry.skeleton[this._schema.skeleton]; + this._contents = []; + this._statements = []; + this.magnet = {}; + this._paramMap = {}; + d.magnets && d.magnets(this).next && (this.svgGroup.nextMagnet = this.block, this._nextGroup = this.svgGroup.elem("g"), this._observers.push(this.observe(this, "_updateMagnet", ["contentHeight"]))); + this.isInBlockMenu = this.getBoard() instanceof Entry.BlockMenu; + var e = this; + this.mouseHandler = function() { + var a = e.block.events; + a && a.mousedown && a.mousedown.forEach(function(a) { + a(e); + }); + e.onMouseDown.apply(e, arguments); }; - b.align = function() { - var a = this.code.getThreads(); - if (a && 0 !== a.length) { - for (var b = 0, d = "LEFT" == this._align ? 20 : this.svgDom.width() / 2, e = 0, f = a.length;e < f;e++) { - var g = a[e].getFirstBlock().view; - g._moveTo(d, b - g.offsetY, !1); - g = g.svgGroup.getBBox().height; - b += g + 15; + this._startRender(a, c); + this._observers.push(this.block.observe(this, "_setMovable", ["movable"])); + this._observers.push(this.block.observe(this, "_setReadOnly", ["movable"])); + this._observers.push(this.block.observe(this, "_setCopyable", ["copyable"])); + this._observers.push(this.block.observe(this, "_updateColor", ["deletable"], !1)); + this._observers.push(this.observe(this, "_updateBG", ["magneting"], !1)); + this._observers.push(this.observe(this, "_updateOpacity", ["visible"], !1)); + this._observers.push(this.observe(this, "_updateDisplay", ["display"], !1)); + this._observers.push(this.observe(this, "_updateShadow", ["shadow"])); + this._observers.push(this.observe(this, "_updateMagnet", ["offsetY"])); + this._observers.push(b.code.observe(this, "_setBoard", ["board"], !1)); + this.dragMode = Entry.DRAG_MODE_NONE; + Entry.Utils.disableContextmenu(this.svgGroup.node); + b = a.events.viewAdd; + "workspace" == Entry.type && b && !this.isInBlockMenu && b.forEach(function(b) { + Entry.Utils.isFunction(b) && b(a); + }); +}; +Entry.BlockView.PARAM_SPACE = 5; +Entry.BlockView.DRAG_RADIUS = 5; +Entry.BlockView.pngMap = {}; +(function(a) { + a.schema = {id:0, type:Entry.STATIC.BLOCK_RENDER_MODEL, x:0, y:0, offsetX:0, offsetY:0, width:0, height:0, contentWidth:0, contentHeight:0, magneting:!1, visible:!0, animating:!1, shadow:!0, display:!0}; + a._startRender = function(a, c) { + var d = this; + a = this._skeleton; + this.svgGroup.attr({class:"block"}); + var e = a.classes; + e && 0 !== e.length && e.forEach(function(a) { + d.svgGroup.addClass(a); + }); + e = a.path(this); + this.pathGroup = this.svgGroup.elem("g"); + this._updateMagnet(); + this._path = this.pathGroup.elem("path"); + this.getBoard().patternRect && ($(this._path).mouseenter(function(a) { + d._mouseEnable && d._changeFill(!0); + }), $(this._path).mouseleave(function(a) { + d._mouseEnable && d._changeFill(!1); + })); + var f = this._schema.color; + this.block.deletable === Entry.Block.DELETABLE_FALSE_LIGHTEN && (f = Entry.Utils.colorLighten(f)); + this._fillColor = f; + e = {d:e, fill:f, class:"blockPath"}; + if (this.magnet.next || this._skeleton.nextShadow) { + f = this.getBoard().suffix, this.pathGroup.attr({filter:"url(#entryBlockShadowFilter_" + f + ")"}); + } else { + if (this.magnet.string || this.magnet.boolean) { + e.stroke = a.outerLine; } - this._bBox = this.svgGroup.getBBox(); - this.height = this._bBox.height; } + a.outerLine && (e["stroke-width"] = "0.6"); + this._path.attr(e); + this._moveTo(this.x, this.y, !1); + this._startContentRender(c); + !0 !== this._board.disableMouseEvent && this._addControl(); + this.bindPrev(); }; - b.hide = function() { - this.view.addClass("entryRemove"); - }; - b.show = function() { - this.view.removeClass("entryRemove"); - }; - b.setWidth = function() { - this._svgWidth = this.svgDom.width(); - this.offset = this.svgDom.offset(); - }; - b.bindCodeView = function(a) { - this.svgBlockGroup.remove(); - this.svgThreadGroup.remove(); - this.svgBlockGroup = a.svgBlockGroup; - this.svgThreadGroup = a.svgThreadGroup; - this.svgGroup.appendChild(this.svgThreadGroup); - this.svgGroup.appendChild(this.svgBlockGroup); - }; - b.resize = function() { - this.svg && this._bBox && $(this.svg).css("height", this._bBox.height + 10); + a._startContentRender = function(a) { + a = void 0 === a ? Entry.Workspace.MODE_BOARD : a; + this.contentSvgGroup && this.contentSvgGroup.remove(); + var c = this._schema; + c.statements && c.statements.length && this.statementSvgGroup && this.statementSvgGroup.remove(); + this._contents = []; + this.contentSvgGroup = this.svgGroup.elem("g"); + c.statements && c.statements.length && (this.statementSvgGroup = this.svgGroup.elem("g")); + switch(a) { + case Entry.Workspace.MODE_BOARD: + ; + case Entry.Workspace.MODE_OVERLAYBOARD: + for (var d = /(%\d)/mi, e = (c.template ? c.template : Lang.template[this.block.type]).split(d), f = c.params, g = 0;g < e.length;g++) { + 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); + this._contents.push(h); + this._paramMap[k] = h; + } else { + this._contents.push(new Entry.FieldText({text:h}, this)); + } + } + } + if ((a = c.statements) && a.length) { + for (g = 0;g < a.length;g++) { + this._statements.push(new Entry.FieldStatement(a[g], this, g)); + } + } + break; + case Entry.Workspace.MODE_VIMBOARD: + g = this.getBoard().workspace.getCodeToText(this.block), this._contents.push(new Entry.FieldText({text:g, color:"white"}, this)); + } + this.alignContent(!1); }; -})(Entry.RenderView.prototype); -Entry.Scroller = function(b, a, c) { - this._horizontal = void 0 === a ? !0 : a; - this._vertical = void 0 === c ? !0 : c; - this.board = b; - this.svgGroup = null; - this.vRatio = this.vY = this.vWidth = this.hRatio = this.hX = this.hWidth = 0; - this._visible = !0; - this._opacity = -1; - this.createScrollBar(); - this.setOpacity(0); - this._bindEvent(); - this._scrollCommand = _.debounce(Entry.do, 200); -}; -Entry.Scroller.RADIUS = 7; -(function(b) { - b.createScrollBar = function() { - var a = Entry.Scroller.RADIUS, b = this; - this.svgGroup = this.board.svg.elem("g").attr({class:"boardScrollbar"}); - this._horizontal && (this.hScrollbar = this.svgGroup.elem("rect", {height:2 * a, rx:a, ry:a}), this.hScrollbar.mousedown = function(a) { - function e(a) { - a.stopPropagation(); - a.preventDefault(); - a.originalEvent.touches && (a = a.originalEvent.touches[0]); - var d = b.dragInstance; - b.scroll((a.pageX - d.offsetX) / b.hRatio, 0); - d.set({offsetX:a.pageX, offsetY:a.pageY}); - } - function f(a) { - $(document).unbind(".scroll"); - delete b.dragInstance; - } - if (0 === a.button || a instanceof Touch) { - Entry.documentMousedown && Entry.documentMousedown.notify(a); - var g = $(document); - g.bind("mousemove.scroll", e); - g.bind("mouseup.scroll", f); - g.bind("touchmove.scroll", e); - g.bind("touchend.scroll", f); - b.dragInstance = new Entry.DragInstance({startX:a.pageX, startY:a.pageY, offsetX:a.pageX, offsetY:a.pageY}); - } - a.stopPropagation(); - }); - this._vertical && (this.vScrollbar = this.svgGroup.elem("rect", {width:2 * a, rx:a, ry:a}), this.vScrollbar.mousedown = function(a) { - function e(a) { - a.stopPropagation(); - a.preventDefault(); - a.originalEvent.touches && (a = a.originalEvent.touches[0]); - var d = b.dragInstance; - b.scroll(0, (a.pageY - d.offsetY) / b.vRatio); - d.set({offsetX:a.pageX, offsetY:a.pageY}); - } - function f(a) { - $(document).unbind(".scroll"); - delete b.dragInstance; - } - if (0 === a.button || a instanceof Touch) { - Entry.documentMousedown && Entry.documentMousedown.notify(a); - var g = $(document); - g.bind("mousemove.scroll", e); - g.bind("mouseup.scroll", f); - g.bind("touchmove.scroll", e); - g.bind("touchend.scroll", f); - b.dragInstance = new Entry.DragInstance({startX:a.pageX, startY:a.pageY, offsetX:a.pageX, offsetY:a.pageY}); - } - a.stopPropagation(); - }); + a._updateSchema = function() { + this._startContentRender(); }; - b.updateScrollBar = function(a, b) { - this._horizontal && (this.hX += a * this.hRatio, this.hScrollbar.attr({x:this.hX})); - this._vertical && (this.vY += b * this.vRatio, this.vScrollbar.attr({y:this.vY})); + a.changeType = function(a) { + this._schemaChangeEvent && this._schemaChangeEvent.destroy(); + this._schema = Entry.block[a]; + this._schema.changeEvent && (this._schemaChangeEvent = this._schema.changeEvent.attach(this, this._updateSchema)); + this._updateSchema(); }; - b.scroll = function(a, b) { - if (this.board.code) { - var d = this.board.svgBlockGroup.getBoundingClientRect(), e = this.board.svgDom, f = d.left - this.board.offset().left, g = d.top - this.board.offset().top, h = d.height; - a = Math.max(-d.width + Entry.BOARD_PADDING - f, a); - b = Math.max(-h + Entry.BOARD_PADDING - g, b); - a = Math.min(e.width() - Entry.BOARD_PADDING - f, a); - b = Math.min(e.height() - Entry.BOARD_PADDING - g, b); - this._scroll(a, b); - this._diffs || (this._diffs = [0, 0]); - this._diffs[0] += a; - this._diffs[1] += b; - this._scrollCommand("scrollBoard", this._diffs[0], this._diffs[1], !0); + a.alignContent = function(a) { + !0 !== a && (a = !1); + for (var c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, k = 0;k < this._contents.length;k++) { + var l = this._contents[k]; + l instanceof Entry.FieldLineBreak ? (this._alignStatement(a, f), l.align(f), f++, d = l.box.y, c = 8) : (l.align(c, d, a), k === this._contents.length - 1 || l instanceof Entry.FieldText && 0 == l._text.length || (c += Entry.BlockView.PARAM_SPACE)); + l = l.box; + 0 !== f ? h = Math.max(1E6 * Math.round(l.height), h) : e = Math.max(l.height, e); + c += l.width; + g = Math.max(g, c); + this.set({contentWidth:g, contentHeight:e}); } + this.set({contentHeight:e + h}); + this._statements.length != f && this._alignStatement(a, f); + a = this.getContentPos(); + this.contentSvgGroup.attr("transform", "translate(" + a.x + "," + a.y + ")"); + this.contentPos = a; + this._render(); + this._updateMagnet(); }; - b._scroll = function(a, b) { - this.board.code.moveBy(a, b); - this.updateScrollBar(a, b); + a._alignStatement = function(a, c) { + var d = this._skeleton.statementPos ? this._skeleton.statementPos(this) : [], e = this._statements[c]; + e && (c = d[c]) && e.align(c.x, c.y, a); }; - b.setVisible = function(a) { - a != this.isVisible() && (this._visible = a, this.svgGroup.attr({display:!0 === a ? "block" : "none"})); + a._render = function() { + this._renderPath(); + this.set(this._skeleton.box(this)); }; - b.isVisible = function() { - return this._visible; + a._renderPath = function() { + var a = this._skeleton.path(this); + this._path.attr({d:a}); + this.set({animating:!1}); }; - b.setOpacity = function(a) { - this._opacity != a && (this.hScrollbar.attr({opacity:a}), this.vScrollbar.attr({opacity:a}), this._opacity = a); + a._setPosition = function(a) { + this.svgGroup.attr("transform", "translate(" + this.x + "," + this.y + ")"); }; - b.resizeScrollBar = function() { - if (this._visible) { - var a = this.board, b = a.svgBlockGroup.getBoundingClientRect(), d = a.svgDom, e = d.width(), d = d.height(), f = b.left - a.offset().left, a = b.top - a.offset().top, g = b.width, b = b.height; - if (this._horizontal) { - var h = -g + Entry.BOARD_PADDING, k = e - Entry.BOARD_PADDING, g = (e + 2 * Entry.Scroller.RADIUS) * g / (k - h + g); - isNaN(g) && (g = 0); - this.hX = (f - h) / (k - h) * (e - g - 2 * Entry.Scroller.RADIUS); - this.hScrollbar.attr({width:g, x:this.hX, y:d - 2 * Entry.Scroller.RADIUS}); - this.hRatio = (e - g - 2 * Entry.Scroller.RADIUS) / (k - h); + a._toLocalCoordinate = function(a) { + this._moveTo(0, 0, !1); + a.appendChild(this.svgGroup); + }; + a._toGlobalCoordinate = function(a) { + a = this.getAbsoluteCoordinate(a); + this._moveTo(a.x, a.y, !1); + this.getBoard().svgBlockGroup.appendChild(this.svgGroup); + }; + a._moveTo = function(a, c, d) { + this.set({x:a, y:c}); + this._lazyUpdatePos(); + this.visible && this.display && this._setPosition(d); + }; + a._moveBy = function(a, c, d) { + return this._moveTo(this.x + a, this.y + c, d); + }; + a._addControl = function() { + var a = this; + this._mouseEnable = !0; + $(this.svgGroup).bind("mousedown.blockViewMousedown touchstart.blockViewMousedown", a.mouseHandler); + var c = a.block.events; + c && c.dblclick && $(this.svgGroup).dblclick(function() { + c.dblclick.forEach(function(c) { + c && c(a); + }); + }); + }; + a.removeControl = function() { + this._mouseEnable = !1; + $(this.svgGroup).unbind(".blockViewMousedown"); + }; + a.onMouseDown = function(b) { + function c(b) { + b.stopPropagation(); + var c = g.workspace.getMode(), d; + c === Entry.Workspace.MODE_VIMBOARD && a.vimBoardEvent(b, "dragOver"); + d = b.originalEvent && b.originalEvent.touches ? b.originalEvent.touches[0] : b; + var h = f.mouseDownCoordinate, h = Math.sqrt(Math.pow(d.pageX - h.x, 2) + Math.pow(d.pageY - h.y, 2)); + if (f.dragMode == Entry.DRAG_MODE_DRAG || h > Entry.BlockView.DRAG_RADIUS) { + e && (clearTimeout(e), e = null), f.movable && (f.isInBlockMenu ? g.cloneToGlobal(b) : (b = !1, f.dragMode != Entry.DRAG_MODE_DRAG && (f._toGlobalCoordinate(), f.dragMode = Entry.DRAG_MODE_DRAG, f.block.getThread().changeEvent.notify(), Entry.GlobalSvg.setView(f, c), b = !0), this.animating && this.set({animating:!1}), 0 === f.dragInstance.height && f.dragInstance.set({height:-1 + f.height}), c = f.dragInstance, f._moveBy(d.pageX - c.offsetX, d.pageY - c.offsetY, !1), c.set({offsetX:d.pageX, + offsetY:d.pageY}), Entry.GlobalSvg.position(), f.originPos || (f.originPos = {x:f.x, y:f.y}), b && g.generateCodeMagnetMap(), f._updateCloseBlock())); + } + } + function d(a) { + e && (clearTimeout(e), e = null); + $(document).unbind(".block"); + f.terminateDrag(a); + g && g.set({dragBlock:null}); + f._changeFill(!1); + Entry.GlobalSvg.remove(); + delete this.mouseDownCoordinate; + delete f.dragInstance; + } + b.stopPropagation && b.stopPropagation(); + b.preventDefault && b.preventDefault(); + var e = null, f = this; + this._changeFill(!1); + var g = this.getBoard(); + Entry.documentMousedown && Entry.documentMousedown.notify(b); + if (!this.readOnly && !g.viewOnly) { + g.setSelectedBlock(this); + this.dominate(); + if (0 === b.button || b.originalEvent && b.originalEvent.touches) { + var h = b.type, k; + k = b.originalEvent && b.originalEvent.touches ? b.originalEvent.touches[0] : b; + this.mouseDownCoordinate = {x:k.pageX, y:k.pageY}; + var l = $(document); + l.bind("mousemove.block touchmove.block", c); + l.bind("mouseup.block touchend.block", d); + this.dragInstance = new Entry.DragInstance({startX:k.pageX, startY:k.pageY, offsetX:k.pageX, offsetY:k.pageY, height:0, mode:!0}); + g.set({dragBlock:this}); + this.addDragging(); + this.dragMode = Entry.DRAG_MODE_MOUSEDOWN; + "touchstart" === h && (e = setTimeout(function() { + e && (e = null, d(), f._rightClick(b)); + }, 1E3)); + } else { + Entry.Utils.isRightButton(b) && this._rightClick(b); } - this._vertical && (f = -b + Entry.BOARD_PADDING, g = d - Entry.BOARD_PADDING, b = (d + 2 * Entry.Scroller.RADIUS) * b / (g - f + b), this.vY = (a - f) / (g - f) * (d - b - 2 * Entry.Scroller.RADIUS), this.vScrollbar.attr({height:b, y:this.vY, x:e - 2 * Entry.Scroller.RADIUS}), this.vRatio = (d - b - 2 * Entry.Scroller.RADIUS) / (g - f)); + g.workspace.getMode() === Entry.Workspace.MODE_VIMBOARD && b && document.getElementsByClassName("CodeMirror")[0].dispatchEvent(Entry.Utils.createMouseEvent("dragStart", event)); } }; - b._bindEvent = function() { - var a = _.debounce(this.resizeScrollBar, 200); - this.board.changeEvent.attach(this, a); - Entry.windowResized && Entry.windowResized.attach(this, a); + a.vimBoardEvent = function(a, c, d) { + a && (a = Entry.Utils.createMouseEvent(c, a), d && (a.block = d), document.getElementsByClassName("CodeMirror")[0].dispatchEvent(a)); }; -})(Entry.Scroller.prototype); -Entry.Board = function(b) { - Entry.Model(this, !1); - this.changeEvent = new Entry.Event(this); - this.createView(b); - this.updateOffset(); - this.scroller = new Entry.Scroller(this, !0, !0); - this._magnetMap = {}; - Entry.ANIMATION_DURATION = 200; - Entry.BOARD_PADDING = 100; - this._initContextOptions(); - Entry.Utils.disableContextmenu(this.svgDom); - this._addControl(); - this._bindEvent(); -}; -Entry.Board.OPTION_PASTE = 0; -Entry.Board.OPTION_ALIGN = 1; -Entry.Board.OPTION_CLEAR = 2; -Entry.Board.OPTION_DOWNLOAD = 3; -Entry.Board.DRAG_RADIUS = 5; -(function(b) { - b.schema = {code:null, dragBlock:null, magnetedBlockView:null, selectedBlockView:null}; - b.createView = function(a) { - var b = a.dom, b = "string" === typeof b ? $("#" + b) : $(b); - if ("DIV" !== b.prop("tagName")) { - return console.error("Dom is not div element"); + a.terminateDrag = function(a) { + var c = this.getBoard(), d = this.dragMode, e = this.block, f = c.workspace.getMode(); + this.removeDragging(); + this.set({visible:!0}); + this.dragMode = Entry.DRAG_MODE_NONE; + if (f === Entry.Workspace.MODE_VIMBOARD) { + c instanceof Entry.BlockMenu ? (c.terminateDrag(), this.vimBoardEvent(a, "dragEnd", e)) : c.clear(); + } else { + if (d === Entry.DRAG_MODE_DRAG) { + var f = this.dragInstance && this.dragInstance.isNew, g = Entry.GlobalSvg, h = this.block.getPrevBlock(this.block); + a = !1; + switch(Entry.GlobalSvg.terminateDrag(this)) { + case g.DONE: + g = c.magnetedBlockView; + g instanceof Entry.BlockView && (g = g.block); + h && !g ? Entry.do("separateBlock", e) : h || g || f ? g ? ("next" === g.view.magneting ? (h = e.getLastBlock(), this.dragMode = d, c.separate(e), this.dragMode = Entry.DRAG_MODE_NONE, Entry.do("insertBlock", g, h).isPass(f), Entry.ConnectionRipple.setView(g.view).dispose()) : (Entry.do("insertBlock", e, g).isPass(f), a = !0), createjs.Sound.play("entryMagneting")) : Entry.do("moveBlock", e).isPass(f) : e.getThread().view.isGlobal() ? Entry.do("moveBlock", e) : Entry.do("separateBlock", + e); + break; + case g.RETURN: + e = this.block; + d = this.originPos; + h ? (this.set({animating:!1}), createjs.Sound.play("entryMagneting"), this.bindPrev(h), e.insert(h)) : (f = e.getThread().view.getParent(), f instanceof Entry.Board ? this._moveTo(d.x, d.y, !1) : (createjs.Sound.play("entryMagneting"), Entry.do("insertBlock", e, f))); + break; + case g.REMOVE: + createjs.Sound.play("entryDelete"), f ? this.block.destroy(!1, !0) : this.block.doDestroyBelow(!1); + } + c.setMagnetedBlock(null); + a && Entry.ConnectionRipple.setView(e.view).dispose(); + } } - this.view = b; - this._svgId = "play" + (new Date).getTime(); - this.workspace = a.workspace; - this._activatedBlockView = null; - this.wrapper = Entry.Dom("div", {parent:b, class:"entryBoardWrapper"}); - this.svgDom = Entry.Dom($(''), {parent:this.wrapper}); - this.visible = !0; - var d = this; - this.svg = Entry.SVG(this._svgId); - $(window).scroll(function() { - d.updateOffset(); - }); - this.svgGroup = this.svg.elem("g"); - this.svgThreadGroup = this.svgGroup.elem("g"); - this.svgThreadGroup.board = this; - this.svgBlockGroup = this.svgGroup.elem("g"); - this.svgBlockGroup.board = this; - a.isOverlay ? (this.wrapper.addClass("entryOverlayBoard"), this.generateButtons(), this.suffix = "overlayBoard") : this.suffix = "board"; - Entry.Utils.addFilters(this.svg, this.suffix); - a = Entry.Utils.addBlockPattern(this.svg, this.suffix); - this.patternRect = a.rect; - this.pattern = a.pattern; + this.destroyShadow(); + delete this.originPos; + this.dominate(); }; - b.changeCode = function(a) { - this.code && this.codeListener && this.code.changeEvent.detach(this.codeListener); - this.set({code:a}); - var b = this; - a && (this.codeListener = this.code.changeEvent.attach(this, function() { - b.changeEvent.notify(); - }), a.createView(this)); - this.scroller.resizeScrollBar(); + a._updateCloseBlock = function() { + var a = this.getBoard(), c; + if (this._skeleton.magnets) { + for (var d in this.magnet) { + if (c = "next" === d ? this.getBoard().getNearestMagnet(this.x, this.y + this.getBelowHeight(), d) : this.getBoard().getNearestMagnet(this.x, this.y, d)) { + return a.setMagnetedBlock(c.view, d); + } + } + a.setMagnetedBlock(null); + } }; - b.bindCodeView = function(a) { - this.svgBlockGroup.remove(); - this.svgThreadGroup.remove(); - this.svgBlockGroup = a.svgBlockGroup; - this.svgThreadGroup = a.svgThreadGroup; - this.svgGroup.appendChild(this.svgThreadGroup); - this.svgGroup.appendChild(this.svgBlockGroup); + a.dominate = function() { + this.block.getThread().view.dominate(); }; - b.setMagnetedBlock = function(a, b) { - if (this.magnetedBlockView) { - if (this.magnetedBlockView === a) { - return; - } - this.magnetedBlockView.set({magneting:!1}); + a.getSvgRoot = function() { + for (var a = this.getBoard().svgBlockGroup, c = this.svgGroup;c.parentNode !== a;) { + c = c.parentNode; } - this.set({magnetedBlockView:a}); - a && (a.set({magneting:b}), a.dominate()); + return c; }; - b.getCode = function() { - return this.code; + a.getBoard = function() { + return this._board; }; - b.findById = function(a) { - return this.code.findById(a); + a._setBoard = function() { + this._board = this._board.code.board; }; - b._addControl = function() { - var a = this.svgDom, b = this; - a.mousedown(function() { - b.onMouseDown.apply(b, arguments); - }); - a.bind("touchstart", function() { - b.onMouseDown.apply(b, arguments); + a.destroy = function(a) { + $(this.svgGroup).unbind(".blockViewMousedown"); + this._destroyObservers(); + var c = this.svgGroup; + a ? $(c).fadeOut(100, function() { + c.remove(); + }) : c.remove(); + this._contents.forEach(function(a) { + a.constructor !== Entry.Block && a.destroy(); }); - a.on("wheel", function() { - b.mouseWheel.apply(b, arguments); + var d = this.block; + a = d.events.viewDestroy; + "workspace" == Entry.type && a && !this.isInBlockMenu && a.forEach(function(a) { + Entry.Utils.isFunction(a) && a(d); }); - var d = b.scroller; - d && (a.mouseenter(function(a) { - d.setOpacity(1); - }), a.mouseleave(function(a) { - d.setOpacity(0); - })); + this._schemaChangeEvent && this._schemaChangeEvent.destroy(); }; - b.onMouseDown = function(a) { - function b(a) { - a.stopPropagation && a.stopPropagation(); - a.preventDefault && a.preventDefault(); - a = Entry.Utils.convertMouseEvent(a); - var c = e.mouseDownCoordinate; - Math.sqrt(Math.pow(a.pageX - c.x, 2) + Math.pow(a.pageY - c.y, 2)) < Entry.Board.DRAG_RADIUS || (f && (clearTimeout(f), f = null), c = e.dragInstance, e.scroller.scroll(a.pageX - c.offsetX, a.pageY - c.offsetY), c.set({offsetX:a.pageX, offsetY:a.pageY})); - } - function d(a) { - f && (clearTimeout(f), f = null); - $(document).unbind(".entryBoard"); - delete e.mouseDownCoordinate; - delete e.dragInstance; + a.getShadow = function() { + this._shadow || (this._shadow = Entry.SVG.createElement(this.svgGroup.cloneNode(!0), {opacity:.5}), this.getBoard().svgGroup.appendChild(this._shadow)); + return this._shadow; + }; + a.destroyShadow = function() { + this._shadow && (this._shadow.remove(), delete this._shadow); + }; + a._updateMagnet = function() { + if (this._skeleton.magnets) { + var a = this._skeleton.magnets(this); + a.next && this._nextGroup.attr("transform", "translate(" + a.next.x + "," + a.next.y + ")"); + this.magnet = a; + this.block.getThread().changeEvent.notify(); } - if (this.workspace.getMode() != Entry.Workspace.MODE_VIMBOARD) { - a.stopPropagation && a.stopPropagation(); - a.preventDefault && a.preventDefault(); - var e = this, f = null; - if (0 === a.button || a.originalEvent && a.originalEvent.touches) { - var g = a.type, h = Entry.Utils.convertMouseEvent(a); - Entry.documentMousedown && Entry.documentMousedown.notify(h); - var k = $(document); - this.mouseDownCoordinate = {x:h.pageX, y:h.pageY}; - k.bind("mousemove.entryBoard", b); - k.bind("mouseup.entryBoard", d); - k.bind("touchmove.entryBoard", b); - k.bind("touchend.entryBoard", d); - this.dragInstance = new Entry.DragInstance({startX:h.pageX, startY:h.pageY, offsetX:h.pageX, offsetY:h.pageY}); - "touchstart" === g && (f = setTimeout(function() { - f && (f = null, d(), e._rightClick(a)); - }, 1E3)); + }; + a._updateBG = function() { + if (this._board.dragBlock && this._board.dragBlock.dragInstance) { + var a = this.svgGroup; + if (this.magnet.next) { + if (a = this.magneting) { + var c = this._board.dragBlock.getShadow(), d = this.getAbsoluteCoordinate(), e; + if ("previous" === a) { + e = this.magnet.next, e = "translate(" + (d.x + e.x) + "," + (d.y + e.y) + ")"; + } else { + if ("next" === a) { + e = this.magnet.previous; + var f = this._board.dragBlock.getBelowHeight(); + e = "translate(" + (d.x + e.x) + "," + (d.y + e.y - f) + ")"; + } + } + $(c).attr({transform:e, display:"block"}); + this._clonedShadow = c; + this.background && (this.background.remove(), this.nextBackground.remove(), delete this.background, delete this.nextBackground); + "previous" === a && (a = this._board.dragBlock.getBelowHeight() + this.offsetY, this.originalHeight = this.offsetY, this.set({offsetY:a})); + } else { + this._clonedShadow && (this._clonedShadow.attr({display:"none"}), delete this._clonedShadow), a = this.originalHeight, void 0 !== a && (this.background && (this.background.remove(), this.nextBackground.remove(), delete this.background, delete this.nextBackground), this.set({offsetY:a}), delete this.originalHeight); + } + (a = this.block.thread.changeEvent) && a.notify(); } else { - Entry.Utils.isRightButton(a) && this._rightClick(a); + this.magneting ? (a.attr({filter:"url(#entryBlockHighlightFilter_" + this.getBoard().suffix + ")"}), a.addClass("outputHighlight")) : (a.removeClass("outputHighlight"), a.removeAttr("filter")); } } }; - b.mouseWheel = function(a) { - a = a.originalEvent; - a.preventDefault(); - var b = Entry.disposeEvent; - b && b.notify(a); - this.scroller.scroll(a.wheelDeltaX || -a.deltaX, a.wheelDeltaY || -a.deltaY); + a.addDragging = function() { + this.svgGroup.addClass("dragging"); }; - b.setSelectedBlock = function(a) { - var b = this.selectedBlockView; - b && b.removeSelected(); - a instanceof Entry.BlockView ? a.addSelected() : a = null; - this.set({selectedBlockView:a}); + a.removeDragging = function() { + this.svgGroup.removeClass("dragging"); }; - b._keyboardControl = function(a) { - var b = this.selectedBlockView; - b && 46 == a.keyCode && b.block && !Entry.Utils.isInInput(a) && (Entry.do("destroyBlock", b.block), this.set({selectedBlockView:null})); + a.addSelected = function() { + this.svgGroup.addClass("selected"); }; - b.hide = function() { - this.wrapper.addClass("entryRemove"); - this.visible = !1; + a.removeSelected = function() { + this.svgGroup.removeClass("selected"); }; - b.show = function() { - this.wrapper.removeClass("entryRemove"); - this.visible = !0; + a.getSkeleton = function() { + return this._skeleton; }; - b.alignThreads = function() { - for (var a = this.svgDom.height(), b = this.code.getThreads(), d = 15, e = 0, a = a - 30, f = 50, g = 0;g < b.length;g++) { - var h = b[g].getFirstBlock(); - if (h) { - var h = h.view, k = h.svgGroup.getBBox(), l = d + 15; - l > a && (f = f + e + 10, e = 0, d = 15); - e = Math.max(e, k.width); - l = d + 15; - h._moveTo(f, l, !1); - d = d + k.height + 15; - } - } - this.scroller.resizeScrollBar(); + a.getContentPos = function() { + return this._skeleton.contentPos(this); }; - b.clear = function() { - this.svgBlockGroup.remove(); - this.svgThreadGroup.remove(); + a.renderText = function() { + this._startContentRender(Entry.Workspace.MODE_VIMBOARD); }; - b.updateOffset = function() { - this._offset = this.svg.getBoundingClientRect(); - var a = $(window), b = a.scrollTop(), a = a.scrollLeft(), d = this._offset; - this.relativeOffset = {top:d.top - b, left:d.left - a}; - this.btnWrapper && this.btnWrapper.attr({transform:"translate(" + (d.width / 2 - 65) + "," + (d.height - 200) + ")"}); + a.renderBlock = function() { + this._startContentRender(Entry.Workspace.MODE_BOARD); }; - b.generateButtons = function() { - var a = this, b = this.svgGroup.elem("g"); - this.btnWrapper = b; - var d = b.elem("text", {x:27, y:33, class:"entryFunctionButtonText"}); - d.textContent = Lang.Buttons.save; - var e = b.elem("text", {x:102.5, y:33, class:"entryFunctionButtonText"}); - e.textContent = Lang.Buttons.cancel; - var f = b.elem("circle", {cx:27.5, cy:27.5, r:27.5, class:"entryFunctionButton"}), b = b.elem("circle", {cx:102.5, cy:27.5, r:27.5, class:"entryFunctionButton"}); - $(f).bind("mousedown touchstart", function() { - a.save(); - }); - $(d).bind("mousedown touchstart", function() { - a.save(); - }); - $(b).bind("mousedown touchstart", function() { - a.cancelEdit(); - }); - $(e).bind("mousedown touchstart", function() { - a.cancelEdit(); - }); + a._updateOpacity = function() { + this.svgGroup.attr({opacity:!1 === this.visible ? 0 : 1}); + this.visible && this._setPosition(); }; - b.cancelEdit = function() { - this.workspace.setMode(Entry.Workspace.MODE_BOARD, "cancelEdit"); + a._updateShadow = function() { + this.shadow && Entry.Utils.colorDarken(this._schema.color, .7); }; - b.save = function() { - this.workspace.setMode(Entry.Workspace.MODE_BOARD, "save"); + a._setMovable = function() { + this.movable = null !== this.block.isMovable() ? this.block.isMovable() : void 0 !== this._skeleton.movable ? this._skeleton.movable : !0; }; - b.generateCodeMagnetMap = function() { - var a = this.code; - if (a && this.dragBlock) { - for (var b in this.dragBlock.magnet) { - var d = this._getCodeBlocks(a, b); - d.sort(function(a, b) { - return a.point - b.point; - }); - d.unshift({point:-Number.MAX_VALUE, blocks:[]}); - for (var e = 1;e < d.length;e++) { - var f = d[e], g = f, h = f.startBlock; - if (h) { - for (var k = f.endPoint, l = e;k > g.point && (g.blocks.push(h), l++, g = d[l], g);) { - } - delete f.startBlock; - } - f.endPoint = Number.MAX_VALUE; - d[e - 1].endPoint = f.point; - } - this._magnetMap[b] = d; + a._setReadOnly = function() { + this.readOnly = null !== this.block.isReadOnly() ? this.block.isReadOnly() : void 0 !== this._skeleton.readOnly ? this._skeleton.readOnly : !1; + }; + a._setCopyable = function() { + this.copyable = null !== this.block.isCopyable() ? this.block.isCopyable() : void 0 !== this._skeleton.copyable ? this._skeleton.copyable : !0; + }; + a.bumpAway = function(a, c) { + var d = this; + a = a || 15; + c ? window.setTimeout(function() { + d._moveBy(a, a, !1); + }, c) : d._moveBy(a, a, !1); + }; + a.bindPrev = function(a) { + if (a) { + if (this._toLocalCoordinate(a.view._nextGroup), (a = a.getNextBlock()) && a !== this.block) { + var c = this.block.getLastBlock(); + c.view.magnet.next ? a.view._toLocalCoordinate(c.view._nextGroup) : (a.view._toGlobalCoordinate(), a.separate(), a.view.bumpAway(null, 100)); + } + } else { + if (a = this.block.getPrevBlock()) { + this._toLocalCoordinate(a.view._nextGroup), (a = this.block.getNextBlock()) && a.view && a.view._toLocalCoordinate(this._nextGroup); } } }; - b._getCodeBlocks = function(a, b) { - var d = a.getThreads(), e = [], f; - switch(b) { - case "previous": - f = this._getNextMagnets; - break; - case "next": - f = this._getPreviousMagnets; - break; - case "string": - f = this._getFieldMagnets; - break; - case "boolean": - f = this._getFieldMagnets; - break; - case "param": - f = this._getOutputMagnets; - break; - default: - return []; - } - for (var g = 0;g < d.length;g++) { - var h = d[g], e = e.concat(f.call(this, h, h.view.zIndex, null, b)) + a.getAbsoluteCoordinate = function(a) { + a = void 0 !== a ? a : this.dragMode; + if (a === Entry.DRAG_MODE_DRAG) { + return {x:this.x, y:this.y}; } - return e; + a = this.block.getThread().view.requestAbsoluteCoordinate(this); + a.x += this.x; + a.y += this.y; + return a; }; - b._getNextMagnets = function(a, b, d, e) { - var f = a.getBlocks(), g = [], h = []; - d || (d = {x:0, y:0}); - var k = d.x; - d = d.y; - for (var l = 0;l < f.length;l++) { - var n = f[l], m = n.view; - m.zIndex = b; - if (m.dragInstance) { - break; - } - d += m.y; - k += m.x; - a = d + 1; - m.magnet.next && (a += m.height, h.push({point:d, endPoint:a, startBlock:n, blocks:[]}), h.push({point:a, blocks:[]}), m.absX = k); - n.statements && (b += .01); - for (var q = 0;q < n.statements.length;q++) { - a = n.statements[q]; - var r = n.view._statements[q]; - r.zIndex = b; - r.absX = k + r.x; - h.push({point:r.y + d - 30, endPoint:r.y + d, startBlock:r, blocks:[]}); - h.push({point:r.y + d + r.height, blocks:[]}); - b += .01; - g = g.concat(this._getNextMagnets(a, b, {x:r.x + k, y:r.y + d}, e)); - } - m.magnet.next && (d += m.magnet.next.y, k += m.magnet.next.x); + a.getBelowHeight = function() { + return this.block.getThread().view.requestPartHeight(this); + }; + a._updateDisplay = function() { + this.svgGroup.attr({display:!1 === this.display ? "none" : "block"}); + this.display && this._setPosition(); + }; + a._updateColor = function() { + var a = this._schema.color; + this.block.deletable === Entry.Block.DELETABLE_FALSE_LIGHTEN && (a = Entry.Utils.colorLighten(a)); + this._fillColor = a; + this._path.attr({fill:a}); + this._updateContents(); + }; + a._updateContents = function() { + for (var a = 0;a < this._contents.length;a++) { + this._contents[a].renderStart(); } - return g.concat(h); + this.alignContent(!1); }; - b._getPreviousMagnets = function(a, b, d, e) { - var f = a.getBlocks(); - a = []; - d || (d = {x:0, y:0}); - e = d.x; - d = d.y; - var f = f[0], g = f.view; - g.zIndex = b; - if (g.dragInstance) { - return []; + a._destroyObservers = function() { + for (var a = this._observers;a.length;) { + a.pop().destroy(); } - d += g.y - 15; - e += g.x; - return g.magnet.previous ? (b = d + 1 + g.height, a.push({point:d, endPoint:b, startBlock:f, blocks:[]}), a.push({point:b, blocks:[]}), g.absX = e, a) : []; }; - b._getFieldMagnets = function(a, b, d, e) { - var f = a.getBlocks(), g = [], h = []; - d || (d = {x:0, y:0}); - var k = d.x; - d = d.y; - for (var l = 0;l < f.length;l++) { - var n = f[l], m = n.view; - if (m.dragInstance) { - break; - } - m.zIndex = b; - d += m.y; - k += m.x; - h = h.concat(this._getFieldBlockMetaData(m, k, d, b, e)); - n.statements && (b += .01); - for (var q = 0;q < n.statements.length;q++) { - a = n.statements[q]; - var r = n.view._statements[q], g = g.concat(this._getFieldMagnets(a, b, {x:r.x + k, y:r.y + d}, e)); - } - m.magnet.next && (d += m.magnet.next.y, k += m.magnet.next.x); + a._changeFill = function(a) { + var c = this.getBoard(); + if (c.patternRect && !c.dragBlock) { + var d = this._fillColor, e = this._path, c = this.getBoard(); + a ? (c.setPatternRectFill(d), d = "url(#blockHoverPattern_" + this.getBoard().suffix + ")") : c.disablePattern(); + e.attr({fill:d}); } - return g.concat(h); }; - b._getFieldBlockMetaData = function(a, b, d, e, f) { - var g = a._contents, h = []; - d += a.contentPos.y; - for (var k = 0;k < g.length;k++) { - var l = g[k]; - if (l instanceof Entry.FieldBlock) { - var n = l._valueBlock; - if (!n.view.dragInstance && (l.acceptType === f || "boolean" === l.acceptType)) { - var m = b + l.box.x, q = d + l.box.y + a.contentHeight % 1E3 * -.5, r = d + l.box.y + l.box.height; - l.acceptType === f && (h.push({point:q, endPoint:r, startBlock:n, blocks:[]}), h.push({point:r, blocks:[]})); - l = n.view; - l.absX = m; - l.zIndex = e; - h = h.concat(this._getFieldBlockMetaData(l, m + l.contentPos.x, q + l.contentPos.y, e + .01, f)); + a.addActivated = function() { + this.svgGroup.addClass("activated"); + }; + a.removeActivated = function() { + this.svgGroup.removeClass("activated"); + }; + a.reDraw = function() { + if (this.visible) { + var a = this.block; + requestAnimFrame(this._updateContents.bind(this)); + var c = a.params; + if (c) { + for (var d = 0;d < c.length;d++) { + var e = c[d]; + e instanceof Entry.Block && e.view.reDraw(); + } + } + if (a = a.statements) { + for (d = 0;d < a.length;d++) { + a[d].view.reDraw(); } } } - return h; }; - b._getOutputMagnets = function(a, b, d, e) { - var f = a.getBlocks(), g = [], h = []; - d || (d = {x:0, y:0}); - var k = d.x; - d = d.y; - for (var l = 0;l < f.length;l++) { - var n = f[l], m = n.view; - if (m.dragInstance) { - break; - } - m.zIndex = b; - d += m.y; - k += m.x; - h = h.concat(this._getOutputMetaData(m, k, d, b, e)); - n.statements && (b += .01); - for (var q = 0;q < n.statements.length;q++) { - a = n.statements[q]; - var r = n.view._statements[q], g = g.concat(this._getOutputMagnets(a, b, {x:r.x + k, y:r.y + d}, e)); + a.getParam = function(a) { + return this._paramMap[a]; + }; + a.getDataUrl = function(a, c) { + function d() { + g = g.replace("(svgGroup)", (new XMLSerializer).serializeToString(k)).replace("%W", h.width * l).replace("%H", h.height * l).replace("(defs)", (new XMLSerializer).serializeToString(m[0])).replace(/>\s+/g, ">").replace(/\s+ d.endPoint) { - f = h + 1; - } else { - e = d.blocks; - for (f = 0;f < e.length;f++) { - if (g = e[f].view, g.absX - b < a && a < g.absX + g.width && (g = d.blocks[f], !k || k.view.zIndex < g.view.zIndex)) { - k = d.blocks[f]; - } - } - return k; - } - } - } - return null; + a._rightClick = function(a) { + var c = Entry.disposeEvent; + c && c.notify(a); + var d = this, e = d.block; + if (!this.isInBlockMenu) { + var c = [], f = {text:Lang.Blocks.Duplication_option, enable:this.copyable, callback:function() { + Entry.do("cloneBlock", e); + }}, g = {text:Lang.Blocks.CONTEXT_COPY_option, enable:this.copyable, callback:function() { + d.block.copyToClipboard(); + }}, h = {text:Lang.Blocks.Delete_Blocks, enable:e.isDeletable(), callback:function() { + Entry.do("destroyBlock", d.block); + }}, k = {text:Lang.Menus.save_as_image, callback:function() { + d.downloadAsImage(); + }}; + c.push(f); + c.push(g); + c.push(h); + Entry.Utils.isChrome() && "workspace" == Entry.type && !Entry.isMobile() && c.push(k); + a.originalEvent && a.originalEvent.touches && (a = a.originalEvent.touches[0]); + Entry.ContextMenu.show(c, null, {x:a.clientX, y:a.clientY}); } }; - b.dominate = function(a) { - a && (a = a.getFirstBlock()) && (this.svgBlockGroup.appendChild(a.view.svgGroup), this.code.dominate(a.thread)); +})(Entry.BlockView.prototype); +Entry.Field = function() { +}; +(function(a) { + a.TEXT_LIMIT_LENGTH = 20; + a.destroy = function() { + $(this.svgGroup).unbind("mouseup touchend"); + this.destroyOption(); }; - b.setPatternRectFill = function(a) { - this.patternRect.attr({fill:a}); - this.pattern.attr({style:""}); + a.command = function() { + this._startValue && (this._startValue === this.getValue() || this._blockView.isInBlockMenu || Entry.do("setFieldValue", this._block, this, this.pointer(), this._startValue, this.getValue())); + delete this._startValue; }; - b.disablePattern = function() { - this.pattern.attr({style:"display: none"}); + a.destroyOption = function() { + this.documentDownEvent && (Entry.documentMousedown.detach(this.documentDownEvent), delete this.documentDownEvent); + this.disposeEvent && (Entry.disposeEvent.detach(this.disposeEvent), delete this.documentDownEvent); + this.optionGroup && (this.optionGroup.remove(), delete this.optionGroup); + this.command(); }; - b._removeActivated = function() { - this._activatedBlockView && (this._activatedBlockView.removeActivated(), this._activatedBlockView = null); + a._attachDisposeEvent = function(a) { + var c = this; + c.disposeEvent = Entry.disposeEvent.attach(c, a || function() { + c.destroyOption(); + }); }; - b.activateBlock = function(a) { - a = a.view; - var b = a.getAbsoluteCoordinate(), d = this.svgDom, e = b.x, b = b.y, e = d.width() / 2 - e, d = d.height() / 2 - b - 100; - this.scroller.scroll(e, d); - a.addActivated(); - this._activatedBlockView = a; + a.align = function(a, c, d) { + var e = this.svgGroup; + this._position && (this._position.x && (a = this._position.x), this._position.y && (c = this._position.y)); + var f = "translate(" + a + "," + c + ")"; + void 0 === d || d ? e.animate({transform:f}, 300, mina.easeinout) : e.attr({transform:f}); + this.box.set({x:a, y:c}); }; - b.reDraw = function() { - this.code.view.reDraw(); + a.getAbsolutePosFromBoard = function() { + var a = this._block.view, c = a.getContentPos(), a = a.getAbsoluteCoordinate(); + return {x:a.x + this.box.x + c.x, y:a.y + this.box.y + c.y}; }; - b.separate = function(a, b) { - "string" === typeof a && (a = this.findById(a)); - a.view && a.view._toGlobalCoordinate(); - var d = a.getPrevBlock(); - a.separate(b); - d && d.getNextBlock() && d.getNextBlock().view.bindPrev(); + a.getAbsolutePosFromDocument = function() { + var a = this._block.view, c = a.getContentPos(), d = a.getAbsoluteCoordinate(), a = a.getBoard().svgDom.offset(); + return {x:d.x + this.box.x + c.x + a.left, y:d.y + this.box.y + c.y + a.top}; }; - b.insert = function(a, b, d) { - "string" === typeof a && (a = this.findById(a)); - this.separate(a, d); - 3 === b.length ? a.moveTo(b[0], b[1]) : 4 === b.length && 0 === b[3] ? (b = this.code.getThreads()[b[2]], a.thread.cut(a), b.insertToTop(a), a.getNextBlock().view.bindPrev()) : (b = b instanceof Array ? this.code.getTargetByPointer(b) : b, b instanceof Entry.Block ? ("basic" === a.getBlockType() && a.view.bindPrev(b), a.doInsert(b)) : b instanceof Entry.FieldStatement ? (a.view.bindPrev(b), b.insertTopBlock(a)) : a.doInsert(b)); + a.getRelativePos = function() { + var a = this._block.view.getContentPos(), c = this.box; + return {x:c.x + a.x, y:c.y + a.y}; }; - b.adjustThreadsPosition = function() { - var a = this.code; - a && (a = a.getThreads()) && 0 !== a.length && (a = a.sort(function(a, b) { - return a.getFirstBlock().view.x - b.getFirstBlock().view.x; - }), a = a[0].getFirstBlock()) && (a = a.view, a = a.getAbsoluteCoordinate(), this.scroller.scroll(50 - a.x, 30 - a.y)); + a.truncate = function() { + var a = String(this.getValue()), c = this.TEXT_LIMIT_LENGTH, d = a.substring(0, c); + a.length > c && (d += "..."); + return d; }; - b._initContextOptions = function() { - var a = this; - this._contextOptions = [{activated:!0, option:{text:Lang.Blocks.Paste_blocks, enable:!!Entry.clipboard, callback:function() { - Entry.do("addThread", Entry.clipboard).value.getFirstBlock().copyToClipboard(); - }}}, {activated:!0, option:{text:Lang.Blocks.tidy_up_block, callback:function() { - a.alignThreads(); - }}}, {activated:!0, option:{text:Lang.Blocks.Clear_all_blocks, callback:function() { - a.code.clear(); - }}}, {activated:"workspace" === Entry.type && Entry.Utils.isChrome() && !Entry.isMobile(), option:{text:Lang.Menus.save_as_image_all, enable:!0, callback:function() { - a.code.getThreads().forEach(function(a) { - (a = a.getFirstBlock()) && a.view.downloadAsImage(); - }); - }}}]; + a.appendSvgOptionGroup = function() { + return this._block.view.getBoard().svgGroup.elem("g"); }; - b.activateContextOption = function(a) { - this._contextOptions[a].activated = !0; + a.getValue = function() { + return this._block.params[this._index]; }; - b.deActivateContextOption = function(a) { - this._contextOptions[a].activated = !1; + a.setValue = function(a, c) { + this.value != a && (this.value = a, this._block.params[this._index] = a, c && this._blockView.reDraw()); }; - b._bindEvent = function() { - Entry.documentMousedown && (Entry.documentMousedown.attach(this, this.setSelectedBlock), Entry.documentMousedown.attach(this, this._removeActivated)); - Entry.keyPressed && Entry.keyPressed.attach(this, this._keyboardControl); - if (Entry.windowResized) { - var a = _.debounce(this.updateOffset, 200); - Entry.windowResized.attach(this, a); + a._isEditable = function() { + if (Entry.ContextMenu.visible || this._block.view.dragMode == Entry.DRAG_MODE_DRAG) { + return !1; + } + var a = this._block.view, c = a.getBoard(); + if (!0 === c.disableMouseEvent) { + return !1; + } + var d = c.workspace.selectedBlockView; + if (!d || c != d.getBoard()) { + return !1; } + c = a.getSvgRoot(); + return c == d.svgGroup || $(c).has($(a.svgGroup)); }; - b.offset = function() { - (!this._offset || 0 === this._offset.top && 0 === this._offset.left) && this.updateOffset(); - return this._offset; + a._selectBlockView = function() { + var a = this._block.view; + a.getBoard().setSelectedBlock(a); }; - b._rightClick = function(a) { - var b = Entry.disposeEvent; - b && b.notify(a); - if (this.visible) { - var b = [], d = this._contextOptions; - d[Entry.Board.OPTION_PASTE].option.enable = !!Entry.clipboard; - d[Entry.Board.OPTION_DOWNLOAD].option.enable = 0 !== this.code.getThreads().length; - for (var e = 0;e < this._contextOptions.length;e++) { - d[e].activated && b.push(d[e].option); - } - a = Entry.Utils.convertMouseEvent(a); - Entry.ContextMenu.show(b, null, {x:a.clientX, y:a.clientY}); - } + a._bindRenderOptions = function() { + var a = this; + $(this.svgGroup).bind("mouseup touchend", function(c) { + a._isEditable() && (a.destroyOption(), a._startValue = a.getValue(), a.renderOptions()); + }); }; -})(Entry.Board.prototype); -Entry.skeleton = function() { -}; -Entry.skeleton.basic = {path:function(b) { - var a = b.contentWidth; - b = b.contentHeight; - b = Math.max(30, b + 2); - a = Math.max(0, a + 9 - b / 2); - return "m -8,0 l 8,8 8,-8 h %w a %h,%h 0 0,1 0,%wh h -%w l -8,8 -8,-8 v -%wh z".replace(/%wh/gi, b).replace(/%w/gi, a).replace(/%h/gi, b / 2); -}, box:function(b) { - return {offsetX:-8, offsetY:0, width:(b ? b.contentWidth : 150) + 30, height:Math.max(30, (b ? b.contentHeight : 28) + 2), marginBottom:0}; -}, magnets:function(b) { - return {previous:{x:0, y:0}, next:{x:0, y:(b ? Math.max(b.height, 30) : 30) + 1 + b.offsetY}}; -}, contentPos:function(b) { - return {x:14, y:Math.max(b.contentHeight, 28) / 2 + 1}; -}}; -Entry.skeleton.basic_create = {path:function(b) { - var a = b.contentWidth; - b = b.contentHeight; - b = Math.max(30, b + 2); - a = Math.max(0, a + 9 - b / 2); - return "m -8,0 l 16,0 h %w a %h,%h 0 0,1 0,%wh h -%w l -8,8 -8,-8 v -%wh z".replace(/%wh/gi, b).replace(/%w/gi, a).replace(/%h/gi, b / 2); -}, box:function(b) { - return {offsetX:-8, offsetY:0, width:(b ? b.contentWidth : 150) + 30, height:Math.max(30, (b ? b.contentHeight : 28) + 2), marginBottom:0}; -}, magnets:function(b) { - return {next:{x:0, y:(b ? Math.max(b.height, 30) : 30) + 1 + b.offsetY}}; -}, contentPos:function(b) { - return {x:14, y:Math.max(b.contentHeight, 28) / 2 + 1}; -}}; -Entry.skeleton.basic_event = {path:function(b) { - b = b.contentWidth; - b = Math.max(0, b); - return "m -8,0 m 0,-5 a 19.5,19.5 0, 0,1 16,0 c 10,5 15,5 20,5 h %w a 15,15 0 0,1 0,30 H 8 l -8,8 -8,-8 l 0,0.5 a 19.5,19.5 0, 0,1 0,-35 z".replace(/%w/gi, b - 30); -}, box:function(b) { - return {offsetX:-19, offsetY:-7, width:b.contentWidth + 30, height:30, marginBottom:0}; -}, magnets:function(b) { - return {next:{x:0, y:(b ? Math.max(b.height + b.offsetY + 7, 30) : 30) + 1}}; -}, contentPos:function(b) { - return {x:1, y:15}; -}}; -Entry.skeleton.basic_loop = {path:function(b) { - var a = b.contentWidth, c = b.contentHeight, c = Math.max(30, c + 2), a = Math.max(0, a + 9 - c / 2); - b = b._statements[0] ? b._statements[0].height : 20; - b = Math.max(b, 20); - return "m -8,0 l 8,8 8,-8 h %w a %h,%h 0 0,1 0,%wh H 24 l -8,8 -8,-8 h -0.4 v %sh h 0.4 l 8,8 8,-8 h %bw a 8,8 0 0,1 0,16 H 8 l -8,8 -8,-8 z".replace(/%wh/gi, c).replace(/%w/gi, a).replace(/%bw/gi, a - 8).replace(/%h/gi, c / 2).replace(/%sh/gi, b + 1); -}, magnets:function(b) { - var a = Math.max(b.contentHeight + 2, 30), c = b._statements[0] ? b._statements[0].height : 20, c = Math.max(c, 20); - return {previous:{x:0, y:0}, next:{x:0, y:c + a + 18 + b.offsetY}}; -}, box:function(b) { - var a = b.contentWidth, c = Math.max(b.contentHeight + 2, 30); - b = b._statements[0] ? b._statements[0].height : 20; - b = Math.max(b, 20); - return {offsetX:-8, offsetY:0, width:a + 30, height:c + b + 17, marginBottom:0}; -}, statementPos:function(b) { - return [{x:16, y:Math.max(30, b.contentHeight + 2) + 1}]; -}, contentPos:function(b) { - return {x:14, y:Math.max(b.contentHeight, 28) / 2 + 1}; -}}; -Entry.skeleton.basic_define = {path:function(b) { - var a = b.contentWidth, c = b.contentHeight, c = Math.max(30, c + 2), a = Math.max(0, a + 9 - c / 2); - b = b._statements[0] ? b._statements[0].height : 30; - b = Math.max(b, 20); - return "m -8,0 l 16,0 h %w a %h,%h 0 0,1 0,%wh H 24 l -8,8 -8,-8 h -0.4 v %sh h 0.4 l 8,8 8,-8 h %bw a 8,8 0 0,1 0,16 H -8 z".replace(/%wh/gi, c).replace(/%w/gi, a).replace(/%h/gi, c / 2).replace(/%bw/gi, a - 8).replace(/%sh/gi, b + 1); -}, magnets:function() { - return {}; -}, box:function(b) { - return {offsetX:0, offsetY:0, width:b.contentWidth, height:Math.max(b.contentHeight, 25) + 46, marginBottom:0}; -}, statementPos:function(b) { - return [{x:16, y:Math.max(30, b.contentHeight + 2)}]; -}, contentPos:function() { - return {x:14, y:15}; -}}; -Entry.skeleton.pebble_event = {path:function(b) { - return "m 0,0 a 25,25 0 0,1 9,48.3 a 9,9 0 0,1 -18,0 a 25,25 0 0,1 9,-48.3 z"; -}, box:function(b) { - return {offsetX:-25, offsetY:0, width:50, height:48.3, marginBottom:0}; -}, magnets:function(b) { - return {next:{x:0, y:(b ? Math.max(b.height, 49.3) : 49.3) + b.offsetY}}; -}, contentPos:function() { - return {x:0, y:25}; -}}; -Entry.skeleton.pebble_loop = {fontSize:16, dropdownHeight:23, path:function(b) { - b = Math.max(b._statements[0] ? b._statements[0].height : 50, 50); - return "M 0,9 a 9,9 0 0,0 9,-9 h %cw q 25,0 25,25 v %ch q 0,25 -25,25 h -%cw a 9,9 0 0,1 -18,0 h -%cw q -25,0 -25,-25 v -%ch q 0,-25 25,-25 h %cw a 9,9 0 0,0 9,9 M 0,49 a 9,9 0 0,1 -9,-9 h -28 a 25,25 0 0,0 -25,25 v %cih a 25,25 0 0,0 25,25 h 28 a 9,9 0 0,0 18,0 h 28 a 25,25 0 0,0 25,-25 v -%cih a 25,25 0 0,0 -25,-25 h -28 a 9,9 0 0,1 -9,9 z".replace(/%cw/gi, 41).replace(/%ch/gi, b + 4).replace(/%cih/gi, b - 50); -}, magnets:function(b) { - var a = Math.max(b.contentHeight + 2, 41), c = b._statements[0] ? b._statements[0].height : 20, c = Math.max(c, 51); - return {previous:{x:0, y:0}, next:{x:0, y:c + a + 13 + b.offsetY}}; -}, box:function(b) { - var a = b.contentWidth, c = Math.max(b.contentHeight + 2, 41); - b = b._statements[0] ? b._statements[0].height : 20; - b = Math.max(b, 51); - return {offsetX:-(a / 2 + 13), offsetY:0, width:a + 30, height:c + b + 13, marginBottom:0}; -}, statementPos:function(b) { - return [{x:0, y:Math.max(39, b.contentHeight + 2) + 1.5}]; -}, contentPos:function() { - return {x:-46, y:25}; -}}; -Entry.skeleton.pebble_basic = {fontSize:15, morph:["prev", "next"], path:function(b) { - return "m 0,9 a 9,9 0 0,0 9,-9 h 28 q 25,0 25,25q 0,25 -25,25h -28 a 9,9 0 0,1 -18,0 h -28 q -25,0 -25,-25q 0,-25 25,-25h 28 a 9,9 0 0,0 9,9 z"; -}, magnets:function(b) { - return {previous:{x:0, y:0}, next:{x:0, y:(b ? Math.max(b.height, 51) : 51) + b.offsetY}}; -}, box:function() { - return {offsetX:-62, offsetY:0, width:124, height:50, marginBottom:0}; -}, contentPos:function() { - return {x:-46, y:25}; -}}; -Entry.skeleton.basic_string_field = {path:function(b) { - var a = b.contentWidth; - b = b.contentHeight; - b = Math.max(18, b + 2); - a = Math.max(0, a - b + 12); - return "m %h,0 h %w a %h,%h 0 1,1 0,%wh H %h A %h,%h 0 1,1 %h,0 z".replace(/%wh/gi, b).replace(/%w/gi, a).replace(/%h/gi, b / 2); -}, color:"#000", outerLine:"#768dce", box:function(b) { - return {offsetX:0, offsetY:0, width:(b ? b.contentWidth : 5) + 12, height:Math.max((b ? b.contentHeight : 18) + 2, 18), marginBottom:0}; -}, magnets:function() { - return {string:{}}; -}, contentPos:function(b) { - return {x:6, y:Math.max(b.contentHeight, 16) / 2 + 1}; -}}; -Entry.skeleton.basic_boolean_field = {path:function(b) { - var a = b.contentWidth; - b = b.contentHeight; - b = Math.max(18, b + 2); - a = Math.max(0, a - b + 19); - return "m %h,0 h %w l %h,%h -%h,%h H %h l -%h,-%h %h,-%h z".replace(/%wh/gi, b).replace(/%w/gi, a).replace(/%h/gi, b / 2); -}, color:"#000", outerLine:"#768dce", box:function(b) { - return {offsetX:0, offsetY:0, width:(b ? b.contentWidth : 5) + 19, height:Math.max((b ? b.contentHeight : 18) + 2, 18), marginBottom:0}; -}, magnets:function() { - return {boolean:{}}; -}, contentPos:function(b) { - return {x:10, y:Math.max(b.contentHeight, 16) / 2 + 1}; -}}; -Entry.skeleton.basic_param = {path:function(b) { - var a = b.contentWidth; - (b = b._contents[b._contents.length - 1]) && (a -= b.box.width + Entry.BlockView.PARAM_SPACE - 2); - a = Math.max(0, a); - return "m 4,0 h 10 h %w l 2,2 0,3 3,0 1,1 0,12 -1,1 -3,0 0,3 -2,2h -%w h -10 l -2,-2 0,-3 3,0 1,-1 0,-12 -1,-1 -3,0 0,-3 2,-2".replace(/%w/gi, a); -}, outerLine:"#768dce", box:function(b) { - return {offsetX:0, offsetY:0, width:(b ? b.contentWidth : 5) + 11, height:24, marginBottom:0}; -}, magnets:function() { - return {param:{}}; -}, contentPos:function(b) { - return {x:11, y:12}; -}}; -Entry.skeleton.basic_button = {path:function() { - return "m -64,0 h 128 a 6,6 0, 0,1 6,6 v 18 a 6,6 0, 0,1 -6,6 h -128 a 6,6 0, 0,1 -6,-6 v -18 a 6,6 0, 0,1 6,-6 z"; -}, box:function() { - return {offsetX:-80, offsetY:0, width:140, height:30}; -}, contentPos:function() { - return {x:0, y:15}; -}, movable:!1, readOnly:!0, nextShadow:!0, classes:["basicButtonView"]}; -Entry.skeleton.basic_without_next = {box:Entry.skeleton.basic.box, contentPos:Entry.skeleton.basic.contentPos, path:function(b) { - var a = b.contentWidth; - b = b.contentHeight; - b = Math.max(30, b + 2); - a = Math.max(0, a + 9 - b / 2); - return "m -8,0 l 8,8 8,-8 h %w a %h,%h 0 0,1 0, %wh H -8 z".replace(/%wh/gi, b).replace(/%w/gi, a).replace(/%h/gi, b / 2); -}, magnets:function(b) { - return {previous:{x:0, y:0}}; -}}; -Entry.skeleton.basic_double_loop = {path:function(b) { - var a = b.contentWidth, c = b.contentHeight % 1E6, d = Math.floor(b.contentHeight / 1E6), c = Math.max(30, c + 2), d = Math.max(30, d + 2), a = Math.max(0, a + 5 - c / 2), e = b._statements; - b = e[0] ? e[0].height : 20; - e = e[1] ? e[1].height : 20; - b = Math.max(b, 20); - e = Math.max(e, 20); - return "m -8,0 l 8,8 8,-8 h %w a %h1,%h1 0 0,1 0,%wh1 H 24 l -8,8 -8,-8 h -0.4 v %sh1 h 0.4 l 8,8 8,-8 h %bw a %h2,%h2 0 0,1 0,%wh2 H 24 l -8,8 -8,-8 h -0.4 v %sh2 h 0.4 l 8,8 8,-8 h %bw a 8,8 0 0,1 0,16 H 8 l -8,8 -8,-8 z".replace(/%wh1/gi, c).replace(/%wh2/gi, d).replace(/%w/gi, a).replace(/%bw/gi, a - 8).replace(/%h1/gi, c / 2).replace(/%h2/gi, d / 2).replace(/%sh1/gi, b + 1).replace(/%sh2/gi, e + 1); -}, magnets:function(b) { - var a = Math.max(b.contentHeight % 1E6 + 2, 30), c = Math.max(Math.floor(b.contentHeight / 1E6) + 2, 30), d = b._statements[0] ? b._statements[0].height : 20, e = b._statements[1] ? b._statements[1].height : 20, d = Math.max(d, 20), e = Math.max(e, 20); - return {previous:{x:0, y:0}, next:{x:0, y:d + e + a + c + 19 + b.offsetY}}; -}, box:function(b) { - var a = b.contentWidth, c = Math.max(Math.floor(b.contentHeight / 1E6) + 2, 30), d = Math.max(b.contentHeight % 1E6 + 2, 30), e = b._statements[0] ? b._statements[0].height % 1E6 : 20; - b = b._statements[1] ? b._statements[1].height : 20; - e = Math.max(e, 20); - b = Math.max(b, 20); - return {offsetX:-8, offsetY:0, width:a + 30, height:c + d + e + b + 17, marginBottom:0}; -}, statementPos:function(b) { - var a = Math.max(30, b.contentHeight % 1E6 + 2) + 1; - return [{x:16, y:a}, {x:16, y:a + Math.max(b._statements[0] ? b._statements[0].height % 1E6 : 20, 20) + Math.max(Math.floor(b.contentHeight / 1E6) + 2, 30) + 1}]; -}, contentPos:function(b) { - return {x:14, y:Math.max(b.contentHeight % 1E6, 28) / 2 + 1}; -}}; -Entry.Thread = function(b, a, c) { - this._data = new Entry.Collection; - this._code = a; + a.pointer = function(a) { + a = a || []; + a.unshift(this._index); + a.unshift(Entry.PARAM); + return this._block.pointer(a); + }; + a.getFontSize = function(a) { + return a = a || this._blockView.getSkeleton().fontSize || 12; + }; + a.getContentHeight = function() { + return Entry.isMobile() ? 22 : 16; + }; +})(Entry.Field.prototype); +Entry.FieldBlock = function(a, b, c, d, e) { + Entry.Model(this, !1); + this._blockView = b; + this._block = b.block; + this._valueBlock = null; + this.box = new Entry.BoxModel; this.changeEvent = new Entry.Event(this); - this.changeEvent.attach(this, this.handleChange); - this._event = null; - this.parent = c ? c : a; - this.load(b); + this._index = c; + this.contentIndex = e; + this._content = a; + this.acceptType = a.accept; + this._restoreCurrent = a.restore; + this.view = this; + this.svgGroup = null; + this._position = a.position; + this.box.observe(b, "alignContent", ["width", "height"]); + this.observe(this, "_updateBG", ["magneting"], !1); + this.renderStart(b.getBoard(), d); }; -(function(b) { - b.load = function(a, b) { - void 0 === a && (a = []); - if (!(a instanceof Array)) { - return console.error("thread must be array"); - } - for (var d = 0;d < a.length;d++) { - var e = a[d]; - e instanceof Entry.Block || e.isDummy ? (e.setThread(this), this._data.push(e)) : Entry.block[e.type] && this._data.push(new Entry.Block(e, this)); +Entry.Utils.inherit(Entry.Field, Entry.FieldBlock); +(function(a) { + a.schema = {magneting:!1}; + a.renderStart = function(a, c) { + 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, c), d.getThread().view.setParent(this)); + this.updateValueBlock(d); + this._blockView.getBoard().constructor !== Entry.Board && this._valueBlock.view.removeControl(); + }; + a.align = function(a, c, d) { + var e = this.svgGroup; + this._position && (this._position.x && (a = this._position.x), this._position.y && (c = this._position.y)); + var f = this._valueBlock; + f && (c = -.5 * f.view.height); + f = "translate(" + a + "," + c + ")"; + void 0 === d || d ? e.animate({transform:f}, 300, mina.easeinout) : e.attr({transform:f}); + this.box.set({x:a, y:c}); + }; + a.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}); + }; + a.calcHeight = a.calcWH; + a.destroy = function() { + }; + a.inspectBlock = function() { + var a = null; + if (this._originBlock) { + a = this._originBlock.type, delete this._originBlock; + } else { + switch(this.acceptType) { + case "boolean": + a = "True"; + break; + case "string": + a = "text"; + break; + case "param": + a = "function_field_label"; + } } - (d = this._code.view) && this.createView(d.board, b); + return this._createBlockByType(a); + }; + a._setValueBlock = function(a) { + this._restoreCurrent && (this._originBlock = this._valueBlock); + a || (a = this.inspectBlock()); + this._valueBlock = a; + this.setValue(a); + a.setThread(this); + a.getThread().view.setParent(this); + return this._valueBlock; + }; + a.getValueBlock = function() { + return this._valueBlock; }; - b.registerEvent = function(a, b) { - this._event = b; - this._code.registerEvent(a, b); + a.updateValueBlock = function(a) { + a instanceof Entry.Block || (a = void 0); + this._destroyObservers(); + a = this._setValueBlock(a).view; + a.bindPrev(this); + this._blockView.alignContent(); + this._posObserver = a.observe(this, "updateValueBlock", ["x", "y"], !1); + this._sizeObserver = a.observe(this, "calcWH", ["width", "height"]); + a = this._blockView.getBoard(); + a.constructor === Entry.Board && a.generateCodeMagnetMap(); }; - b.unregisterEvent = function(a, b) { - this._code.unregisterEvent(a, b); + a._destroyObservers = function() { + this._sizeObserver && this._sizeObserver.destroy(); + this._posObserver && this._posObserver.destroy(); }; - b.createView = function(a, b) { - this.view || (this.view = new Entry.ThreadView(this, a)); - this._data.map(function(d) { - d.createView(a, b); - }); + a.getPrevBlock = function(a) { + return this._valueBlock === a ? this : null; }; - b.separate = function(a, b) { - if (this._data.has(a.id)) { - var d = this._data.splice(this._data.indexOf(a), b); - this._code.createThread(d); - this.changeEvent.notify(); - } + a.getNextBlock = function() { + return null; }; - b.cut = function(a) { - a = this._data.indexOf(a); - a = this._data.splice(a); - this.changeEvent.notify(); + a.requestAbsoluteCoordinate = function(a) { + a = this._blockView; + var c = a.contentPos; + a = a.getAbsoluteCoordinate(); + a.x += this.box.x + c.x; + a.y += this.box.y + c.y; return a; }; - b.insertByBlock = function(a, b) { - for (var d = a ? this._data.indexOf(a) : -1, e = 0;e < b.length;e++) { - b[e].setThread(this); - } - this._data.splice.apply(this._data, [d + 1, 0].concat(b)); - this.changeEvent.notify(); + a.dominate = function() { + this._blockView.dominate(); }; - b.insertToTop = function(a) { - a.setThread(this); - this._data.unshift.apply(this._data, [a]); + a.isGlobal = function() { + return !1; + }; + a.separate = function(a) { + this.getCode().createThread([a]); + this.calcWH(); this.changeEvent.notify(); }; - b.clone = function(a, b) { - a = a || this._code; - for (var d = new Entry.Thread([], a), e = this._data, f = [], g = 0, h = e.length;g < h;g++) { - f.push(e[g].clone(d)); - } - d.load(f, b); - return d; + a.getCode = function() { + return this._block.thread.getCode(); }; - b.toJSON = function(a, b) { - for (var d = [], e = void 0 === b ? 0 : b;e < this._data.length;e++) { - this._data[e] instanceof Entry.Block && d.push(this._data[e].toJSON(a)); - } - return d; + a.cut = function(a) { + return this._valueBlock === a ? [a] : null; }; - b.destroy = function(a) { - this._code.destroyThread(this, !1); - this.view && this.view.destroy(a); - for (var b = this._data, d = b.length - 1;0 <= d;d--) { - b[d].destroy(a); - } + a.replace = function(a) { + "string" === typeof a && (a = this._createBlockByType(a)); + var c = this._valueBlock; + Entry.block[c.type].isPrimitive ? (c.doNotSplice = !0, c.destroy()) : "param" === this.acceptType ? (this._destroyObservers(), c.view._toGlobalCoordinate(), a.getTerminateOutputBlock().view._contents[1].replace(c)) : (this._destroyObservers(), c.view._toGlobalCoordinate(), this.separate(c), c.view.bumpAway(30, 150)); + this.updateValueBlock(a); + a.view._toLocalCoordinate(this.svgGroup); + this.calcWH(); + this.changeEvent.notify(); }; - b.getBlock = function(a) { - return this._data[a]; + a.setParent = function(a) { + this._parent = a; }; - b.getBlocks = function() { - return this._data.map(function(a) { - return a; - }); + a.getParent = function() { + return this._parent; }; - b.countBlock = function() { - for (var a = 0, b = 0;b < this._data.length;b++) { - var d = this._data[b]; - if (d.type && (a++, d = d.statements)) { - for (var e = 0;e < d.length;e++) { - a += d[e].countBlock(); - } - } - } + a._createBlockByType = function(a) { + this._block.getThread(); + var c = this._blockView.getBoard(); + a = new Entry.Block({type:a}, this); + var d = c.workspace, e; + d && (e = d.getMode()); + a.createView(c, e); return a; }; - b.handleChange = function() { - 0 === this._data.length && this.destroy(); - }; - b.getCode = function() { - return this._code; - }; - b.setCode = function(a) { - this._code = a; - }; - b.spliceBlock = function(a) { - this._data.remove(a); - this.changeEvent.notify(); - }; - b.getFirstBlock = function() { - return this._data[0]; - }; - b.getPrevBlock = function(a) { - a = this._data.indexOf(a); - return this._data.at(a - 1); + a.spliceBlock = function() { + this.updateValueBlock(); }; - b.getNextBlock = function(a) { - a = this._data.indexOf(a); - return this._data.at(a + 1); + a._updateBG = function() { + this.magneting ? this._bg = this.svgGroup.elem("path", {d:"m 8,12 l -4,0 -2,-2 0,-3 3,0 1,-1 0,-12 -1,-1 -3,0 0,-3 2,-2 l 4,0 z", fill:"#fff", stroke:"#fff", "fill-opacity":.7, transform:"translate(0,12)"}) : this._bg && (this._bg.remove(), delete this._bg); }; - b.getLastBlock = function() { - return this._data.at(this._data.length - 1); + a.getThread = function() { + return this; }; - b.getRootBlock = function() { - return this._data.at(0); + a.pointer = function(a) { + a.unshift(this._index); + a.unshift(Entry.PARAM); + return this._block.pointer(a); }; - b.hasBlockType = function(a) { - function b(d) { - if (a == d.type) { - return !0; +})(Entry.FieldBlock.prototype); +Entry.Scroller = function(a, b, c) { + this._horizontal = void 0 === b ? !0 : b; + this._vertical = void 0 === c ? !0 : c; + this.board = a; + this.svgGroup = null; + this.vRatio = this.vY = this.vWidth = this.hRatio = this.hX = this.hWidth = 0; + this._visible = !0; + this._opacity = -1; + this.createScrollBar(); + this.setOpacity(0); + this._bindEvent(); + this._scrollCommand = _.debounce(Entry.do, 200); +}; +Entry.Scroller.RADIUS = 7; +(function(a) { + a.createScrollBar = function() { + var a = Entry.Scroller.RADIUS, c = this; + this.svgGroup = this.board.svg.elem("g").attr({class:"boardScrollbar"}); + this._horizontal && (this.hScrollbar = this.svgGroup.elem("rect", {height:2 * a, rx:a, ry:a}), this.hScrollbar.mousedown = function(a) { + function b(a) { + a.stopPropagation(); + a.preventDefault(); + a.originalEvent.touches && (a = a.originalEvent.touches[0]); + var d = c.dragInstance; + c.scroll((a.pageX - d.offsetX) / c.hRatio, 0); + d.set({offsetX:a.pageX, offsetY:a.pageY}); } - for (var f = d.params, g = 0;g < f.length;g++) { - var h = f[g]; - if (h && h.constructor == Entry.Block && b(h)) { - return !0; - } + function f(a) { + $(document).unbind(".scroll"); + delete c.dragInstance; } - if (d = d.statements) { - for (f = 0;f < d.length;f++) { - if (d[f].hasBlockType(a)) { - return !0; - } - } + if (0 === a.button || a instanceof Touch) { + Entry.documentMousedown && Entry.documentMousedown.notify(a); + var g = $(document); + g.bind("mousemove.scroll", b); + g.bind("mouseup.scroll", f); + g.bind("touchmove.scroll", b); + g.bind("touchend.scroll", f); + c.dragInstance = new Entry.DragInstance({startX:a.pageX, startY:a.pageY, offsetX:a.pageX, offsetY:a.pageY}); } - return !1; - } - for (var d = 0;d < this._data.length;d++) { - if (b(this._data[d])) { - return !0; + a.stopPropagation(); + }); + this._vertical && (this.vScrollbar = this.svgGroup.elem("rect", {width:2 * a, rx:a, ry:a}), this.vScrollbar.mousedown = function(a) { + function b(a) { + a.stopPropagation(); + a.preventDefault(); + a.originalEvent.touches && (a = a.originalEvent.touches[0]); + var d = c.dragInstance; + c.scroll(0, (a.pageY - d.offsetY) / c.vRatio); + d.set({offsetX:a.pageX, offsetY:a.pageY}); + } + function f(a) { + $(document).unbind(".scroll"); + delete c.dragInstance; + } + if (0 === a.button || a instanceof Touch) { + Entry.documentMousedown && Entry.documentMousedown.notify(a); + var g = $(document); + g.bind("mousemove.scroll", b); + g.bind("mouseup.scroll", f); + g.bind("touchmove.scroll", b); + g.bind("touchend.scroll", f); + c.dragInstance = new Entry.DragInstance({startX:a.pageX, startY:a.pageY, offsetX:a.pageX, offsetY:a.pageY}); } + a.stopPropagation(); + }); + }; + a.updateScrollBar = function(a, c) { + this._horizontal && (this.hX += a * this.hRatio, this.hScrollbar.attr({x:this.hX})); + this._vertical && (this.vY += c * this.vRatio, this.vScrollbar.attr({y:this.vY})); + }; + a.scroll = function(a, c) { + if (this.board.code) { + var d = this.board.svgBlockGroup.getBoundingClientRect(), e = this.board.svgDom, f = d.left - this.board.offset().left, g = d.top - this.board.offset().top, h = d.height; + a = Math.max(-d.width + Entry.BOARD_PADDING - f, a); + c = Math.max(-h + Entry.BOARD_PADDING - g, c); + a = Math.min(e.width() - Entry.BOARD_PADDING - f, a); + c = Math.min(e.height() - Entry.BOARD_PADDING - g, c); + this._scroll(a, c); + this._diffs || (this._diffs = [0, 0]); + this._diffs[0] += a; + this._diffs[1] += c; + this._scrollCommand("scrollBoard", this._diffs[0], this._diffs[1], !0); } - return !1; }; - b.getCount = function(a) { - var b = this._data.length; - a && (b -= this._data.indexOf(a)); - return b; + a._scroll = function(a, c) { + this.board.code.moveBy(a, c); + this.updateScrollBar(a, c); }; - b.indexOf = function(a) { - return this._data.indexOf(a); + a.setVisible = function(a) { + a != this.isVisible() && (this._visible = a, this.svgGroup.attr({display:!0 === a ? "block" : "none"})); + }; + a.isVisible = function() { + return this._visible; }; - b.pointer = function(a, b) { - var d = this.indexOf(b); - a.unshift(d); - this.parent instanceof Entry.Block && a.unshift(this.parent.indexOfStatements(this)); - return this._code === this.parent ? (a.unshift(this._code.indexOf(this)), d = this._data[0], a.unshift(d.y), a.unshift(d.x), a) : this.parent.pointer(a); + a.setOpacity = function(a) { + this._opacity != a && (this.hScrollbar.attr({opacity:a}), this.vScrollbar.attr({opacity:a}), this._opacity = a); }; - b.getBlockList = function(a, b) { - for (var d = [], e = 0;e < this._data.length;e++) { - d = d.concat(this._data[e].getBlockList(a, b)); + a.resizeScrollBar = function() { + if (this._visible) { + var a = this.board, c = a.svgBlockGroup.getBoundingClientRect(), d = a.svgDom, e = d.width(), d = d.height(), f = c.left - a.offset().left, a = c.top - a.offset().top, g = c.width, c = c.height; + if (this._horizontal) { + var h = -g + Entry.BOARD_PADDING, k = e - Entry.BOARD_PADDING, g = (e + 2 * Entry.Scroller.RADIUS) * g / (k - h + g); + isNaN(g) && (g = 0); + this.hX = (f - h) / (k - h) * (e - g - 2 * Entry.Scroller.RADIUS); + this.hScrollbar.attr({width:g, x:this.hX, y:d - 2 * Entry.Scroller.RADIUS}); + this.hRatio = (e - g - 2 * Entry.Scroller.RADIUS) / (k - h); + } + this._vertical && (f = -c + Entry.BOARD_PADDING, g = d - Entry.BOARD_PADDING, c = (d + 2 * Entry.Scroller.RADIUS) * c / (g - f + c), this.vY = (a - f) / (g - f) * (d - c - 2 * Entry.Scroller.RADIUS), this.vScrollbar.attr({height:c, y:this.vY, x:e - 2 * Entry.Scroller.RADIUS}), this.vRatio = (d - c - 2 * Entry.Scroller.RADIUS) / (g - f)); } - return d; }; - b.stringify = function() { - return JSON.stringify(this.toJSON()); + a._bindEvent = function() { + var a = _.debounce(this.resizeScrollBar, 200); + this.board.changeEvent.attach(this, a); + Entry.windowResized && Entry.windowResized.attach(this, a); }; -})(Entry.Thread.prototype); -Entry.Block = function(b, a) { - var c = this; +})(Entry.Scroller.prototype); +Entry.Board = function(a) { Entry.Model(this, !1); - this._schema = null; - this.setThread(a); - this.load(b); - var d = this.getCode(); - d.registerBlock(this); - var e = this.events.dataAdd; - e && d.object && e.forEach(function(a) { - Entry.Utils.isFunction(a) && a(c); - }); + this.changeEvent = new Entry.Event(this); + this.createView(a); + this.updateOffset(); + this.scroller = new Entry.Scroller(this, !0, !0); + this._magnetMap = {}; + Entry.ANIMATION_DURATION = 200; + Entry.BOARD_PADDING = 100; + this._initContextOptions(); + Entry.Utils.disableContextmenu(this.svgDom); + this._addControl(); + this._bindEvent(); }; -Entry.Block.MAGNET_RANGE = 10; -Entry.Block.MAGNET_OFFSET = .4; -Entry.Block.DELETABLE_TRUE = 1; -Entry.Block.DELETABLE_FALSE = 2; -Entry.Block.DELETABLE_FALSE_LIGHTEN = 3; -(function(b) { - b.schema = {id:null, x:0, y:0, type:null, params:[], statements:[], view:null, thread:null, movable:null, deletable:Entry.Block.DELETABLE_TRUE, readOnly:null, copyable:!0, events:{}}; - b.load = function(a) { - a.id || (a.id = Entry.Utils.generateId()); - this.set(a); - this.loadSchema(); +Entry.Board.OPTION_PASTE = 0; +Entry.Board.OPTION_ALIGN = 1; +Entry.Board.OPTION_CLEAR = 2; +Entry.Board.OPTION_DOWNLOAD = 3; +Entry.Board.DRAG_RADIUS = 5; +(function(a) { + a.schema = {code:null, dragBlock:null, magnetedBlockView:null, selectedBlockView:null}; + a.createView = function(a) { + var c = a.dom, c = "string" === typeof c ? $("#" + c) : $(c); + if ("DIV" !== c.prop("tagName")) { + return console.error("Dom is not div element"); + } + this.view = c; + this._svgId = "play" + (new Date).getTime(); + this.workspace = a.workspace; + this._activatedBlockView = null; + this.wrapper = Entry.Dom("div", {parent:c, class:"entryBoardWrapper"}); + this.svgDom = Entry.Dom($(''), {parent:this.wrapper}); + this.visible = !0; + var d = this; + this.svg = Entry.SVG(this._svgId); + $(window).scroll(function() { + d.updateOffset(); + }); + this.svgGroup = this.svg.elem("g"); + this.svgThreadGroup = this.svgGroup.elem("g"); + this.svgThreadGroup.board = this; + this.svgBlockGroup = this.svgGroup.elem("g"); + this.svgBlockGroup.board = this; + a.isOverlay ? (this.wrapper.addClass("entryOverlayBoard"), this.generateButtons(), this.suffix = "overlayBoard") : this.suffix = "board"; + Entry.Utils.addFilters(this.svg, this.suffix); + a = Entry.Utils.addBlockPattern(this.svg, this.suffix); + this.patternRect = a.rect; + this.pattern = a.pattern; }; - b.changeSchema = function(a) { - this.set({params:[]}); - this.loadSchema(); + a.changeCode = function(a) { + this.code && this.codeListener && this.code.changeEvent.detach(this.codeListener); + this.set({code:a}); + var c = this; + a && (this.codeListener = this.code.changeEvent.attach(this, function() { + c.changeEvent.notify(); + }), a.createView(this)); + this.scroller.resizeScrollBar(); }; - b.getSchema = function() { - this._schema || this.loadSchema(); - return this._schema; + a.bindCodeView = function(a) { + this.svgBlockGroup.remove(); + this.svgThreadGroup.remove(); + this.svgBlockGroup = a.svgBlockGroup; + this.svgThreadGroup = a.svgThreadGroup; + this.svgGroup.appendChild(this.svgThreadGroup); + this.svgGroup.appendChild(this.svgBlockGroup); }; - b.loadSchema = function() { - if (this._schema = Entry.block[this.type]) { - !this._schemaChangeEvent && this._schema.changeEvent && (this._schemaChangeEvent = this._schema.changeEvent.attach(this, this.changeSchema)); - var a = this._schema.events; - if (a) { - for (var b in a) { - this.events[b] || (this.events[b] = []); - for (var d = a[b], e = 0;e < d.length;e++) { - var f = d[e]; - f && 0 > this.events[b].indexOf(f) && this.events[b].push(f); - } - } - } - this._schema.event && this.thread.registerEvent(this, this._schema.event); - a = this.params; - b = this._schema.params; - for (e = 0;b && e < b.length;e++) { - d = void 0 === a[e] || null === a[e] ? b[e].value : a[e], f = a[e] || e < a.length, !d || "Output" !== b[e].type && "Block" !== b[e].type || (d = new Entry.Block(d, this.thread)), f ? a.splice(e, 1, d) : a.push(d); + a.setMagnetedBlock = function(a, c) { + if (this.magnetedBlockView) { + if (this.magnetedBlockView === a) { + return; } - if (a = this._schema.statements) { - for (e = 0;e < a.length;e++) { - this.statements.splice(e, 1, new Entry.Thread(this.statements[e], this.getCode(), this)); - } + this.magnetedBlockView.set({magneting:!1}); + } + this.set({magnetedBlockView:a}); + a && (a.set({magneting:c}), a.dominate()); + }; + a.getCode = function() { + return this.code; + }; + a.findById = function(a) { + return this.code.findById(a); + }; + a._addControl = function() { + var a = this.svgDom, c = this; + a.mousedown(function() { + c.onMouseDown.apply(c, arguments); + }); + a.bind("touchstart", function() { + c.onMouseDown.apply(c, arguments); + }); + a.on("wheel", function() { + c.mouseWheel.apply(c, arguments); + }); + var d = c.scroller; + d && (a.mouseenter(function(a) { + d.setOpacity(1); + }), a.mouseleave(function(a) { + d.setOpacity(0); + })); + }; + a.onMouseDown = function(a) { + function c(a) { + a.stopPropagation && a.stopPropagation(); + a.preventDefault && a.preventDefault(); + a = Entry.Utils.convertMouseEvent(a); + var b = e.mouseDownCoordinate; + Math.sqrt(Math.pow(a.pageX - b.x, 2) + Math.pow(a.pageY - b.y, 2)) < Entry.Board.DRAG_RADIUS || (f && (clearTimeout(f), f = null), b = e.dragInstance, e.scroller.scroll(a.pageX - b.offsetX, a.pageY - b.offsetY), b.set({offsetX:a.pageX, offsetY:a.pageY})); + } + function d(a) { + f && (clearTimeout(f), f = null); + $(document).unbind(".entryBoard"); + delete e.mouseDownCoordinate; + delete e.dragInstance; + } + if (this.workspace.getMode() != Entry.Workspace.MODE_VIMBOARD) { + a.stopPropagation && a.stopPropagation(); + a.preventDefault && a.preventDefault(); + var e = this, f = null; + if (0 === a.button || a.originalEvent && a.originalEvent.touches) { + var g = a.type, h = Entry.Utils.convertMouseEvent(a); + Entry.documentMousedown && Entry.documentMousedown.notify(h); + var k = $(document); + this.mouseDownCoordinate = {x:h.pageX, y:h.pageY}; + k.bind("mousemove.entryBoard", c); + k.bind("mouseup.entryBoard", d); + k.bind("touchmove.entryBoard", c); + k.bind("touchend.entryBoard", d); + this.dragInstance = new Entry.DragInstance({startX:h.pageX, startY:h.pageY, offsetX:h.pageX, offsetY:h.pageY}); + "touchstart" === g && (f = setTimeout(function() { + f && (f = null, d(), e._rightClick(a)); + }, 1E3)); + } else { + Entry.Utils.isRightButton(a) && this._rightClick(a); } } }; - b.changeType = function(a) { - this._schemaChangeEvent && this._schemaChangeEvent.destroy(); - this.set({type:a}); - this.loadSchema(); - this.view && this.view.changeType(a); + a.mouseWheel = function(a) { + a = a.originalEvent; + a.preventDefault(); + var c = Entry.disposeEvent; + c && c.notify(a); + this.scroller.scroll(a.wheelDeltaX || -a.deltaX, a.wheelDeltaY || -a.deltaY); }; - b.setThread = function(a) { - this.set({thread:a}); + a.setSelectedBlock = function(a) { + var c = this.selectedBlockView; + c && c.removeSelected(); + a instanceof Entry.BlockView ? a.addSelected() : a = null; + this.set({selectedBlockView:a}); }; - b.getThread = function() { - return this.thread; + a._keyboardControl = function(a) { + var c = this.selectedBlockView; + c && 46 == a.keyCode && c.block && !Entry.Utils.isInInput(a) && (Entry.do("destroyBlock", c.block), this.set({selectedBlockView:null})); }; - b.insertAfter = function(a) { - this.thread.insertByBlock(this, a); + a.hide = function() { + this.wrapper.addClass("entryRemove"); + this.visible = !1; }; - b._updatePos = function() { - this.view && this.set({x:this.view.x, y:this.view.y}); + a.show = function() { + this.wrapper.removeClass("entryRemove"); + this.visible = !0; }; - b.moveTo = function(a, b) { - this.view && this.view._moveTo(a, b); - this._updatePos(); - this.getCode().changeEvent.notify(); + a.alignThreads = function() { + for (var a = this.svgDom.height(), c = this.code.getThreads(), d = 15, e = 0, a = a - 30, f = 50, g = 0;g < c.length;g++) { + var h = c[g].getFirstBlock(); + if (h) { + var h = h.view, k = h.svgGroup.getBBox(), l = d + 15; + l > a && (f = f + e + 10, e = 0, d = 15); + e = Math.max(e, k.width); + l = d + 15; + h._moveTo(f, l, !1); + d = d + k.height + 15; + } + } + this.scroller.resizeScrollBar(); }; - b.createView = function(a, b) { - this.view || (this.set({view:new Entry.BlockView(this, a, b)}), this._updatePos()); + a.clear = function() { + this.svgBlockGroup.remove(); + this.svgThreadGroup.remove(); }; - b.clone = function(a) { - return new Entry.Block(this.toJSON(!0), a); + a.updateOffset = function() { + this._offset = this.svg.getBoundingClientRect(); + var a = $(window), c = a.scrollTop(), a = a.scrollLeft(), d = this._offset; + this.relativeOffset = {top:d.top - c, left:d.left - a}; + this.btnWrapper && this.btnWrapper.attr({transform:"translate(" + (d.width / 2 - 65) + "," + (d.height - 200) + ")"}); }; - b.toJSON = function(a) { - var b = this._toJSON(); - delete b.view; - delete b.thread; - delete b.events; - a && delete b.id; - b.params = b.params.map(function(b) { - b instanceof Entry.Block && (b = b.toJSON(a)); - return b; + a.generateButtons = function() { + var a = this, c = this.svgGroup.elem("g"); + this.btnWrapper = c; + var d = c.elem("text", {x:27, y:33, class:"entryFunctionButtonText"}); + d.textContent = Lang.Buttons.save; + var e = c.elem("text", {x:102.5, y:33, class:"entryFunctionButtonText"}); + e.textContent = Lang.Buttons.cancel; + var f = c.elem("circle", {cx:27.5, cy:27.5, r:27.5, class:"entryFunctionButton"}), c = c.elem("circle", {cx:102.5, cy:27.5, r:27.5, class:"entryFunctionButton"}); + $(f).bind("mousedown touchstart", function() { + a.save(); }); - b.statements = b.statements.map(function(b) { - return b.toJSON(a); + $(d).bind("mousedown touchstart", function() { + a.save(); }); - b.x = this.x; - b.y = this.y; - b.movable = this.movable; - b.deletable = this.deletable; - b.readOnly = this.readOnly; - return b; - }; - b.destroy = function(a, b) { - var d = this, e = this.params; - if (e) { - for (var f = 0;f < e.length;f++) { - var g = e[f]; - g instanceof Entry.Block && (g.doNotSplice = !0, g.destroy(a)); - } - } - if (e = this.statements) { - for (f = 0;f < e.length;f++) { - e[f].destroy(a); - } - } - g = this.getPrevBlock(); - f = this.getNextBlock(); - this.getCode().unregisterBlock(this); - e = this.getThread(); - this._schema.event && e.unregisterEvent(this, this._schema.event); - f && (b ? f.destroy(a, b) : g ? f.view && f.view.bindPrev(g) : (g = this.getThread().view.getParent(), g.constructor === Entry.FieldStatement ? (f.view && f.view.bindPrev(g), g.insertTopBlock(f)) : g.constructor === Entry.FieldStatement ? f.replace(g._valueBlock) : f.view._toGlobalCoordinate())); - !this.doNotSplice && e.spliceBlock ? e.spliceBlock(this) : delete this.doNotSplice; - this.view && this.view.destroy(a); - this._schemaChangeEvent && this._schemaChangeEvent.destroy(); - (f = this.events.dataDestroy) && this.getCode().object && f.forEach(function(a) { - Entry.Utils.isFunction(a) && a(d); + $(c).bind("mousedown touchstart", function() { + a.cancelEdit(); + }); + $(e).bind("mousedown touchstart", function() { + a.cancelEdit(); }); }; - b.getView = function() { - return this.view; + a.cancelEdit = function() { + this.workspace.setMode(Entry.Workspace.MODE_BOARD, "cancelEdit"); }; - b.setMovable = function(a) { - this.movable != a && this.set({movable:a}); + a.save = function() { + this.workspace.setMode(Entry.Workspace.MODE_BOARD, "save"); }; - b.setCopyable = function(a) { - this.copyable != a && this.set({copyable:a}); + a.generateCodeMagnetMap = function() { + var a = this.code; + if (a && this.dragBlock) { + for (var c in this.dragBlock.magnet) { + var d = this._getCodeBlocks(a, c); + d.sort(function(a, b) { + return a.point - b.point; + }); + d.unshift({point:-Number.MAX_VALUE, blocks:[]}); + for (var e = 1;e < d.length;e++) { + var f = d[e], g = f, h = f.startBlock; + if (h) { + for (var k = f.endPoint, l = e;k > g.point && (g.blocks.push(h), l++, g = d[l], g);) { + } + delete f.startBlock; + } + f.endPoint = Number.MAX_VALUE; + d[e - 1].endPoint = f.point; + } + this._magnetMap[c] = d; + } + } }; - b.isMovable = function() { - return this.movable; + a._getCodeBlocks = function(a, c) { + a = a.getThreads(); + var d = [], e; + switch(c) { + case "previous": + e = this._getNextMagnets; + break; + case "next": + e = this._getPreviousMagnets; + break; + case "string": + e = this._getFieldMagnets; + break; + case "boolean": + e = this._getFieldMagnets; + break; + case "param": + e = this._getOutputMagnets; + break; + default: + return []; + } + for (var f = 0;f < a.length;f++) { + var g = a[f], d = d.concat(e.call(this, g, g.view.zIndex, null, c)) + } + return d; }; - b.isCopyable = function() { - return this.copyable; + a._getNextMagnets = function(a, c, d, e) { + var f = a.getBlocks(), g = [], h = []; + d || (d = {x:0, y:0}); + var k = d.x; + d = d.y; + for (var l = 0;l < f.length;l++) { + var n = f[l], m = n.view; + m.zIndex = c; + if (m.dragInstance) { + break; + } + d += m.y; + k += m.x; + a = d + 1; + m.magnet.next && (a += m.height, h.push({point:d, endPoint:a, startBlock:n, blocks:[]}), h.push({point:a, blocks:[]}), m.absX = k); + n.statements && (c += .01); + for (var q = 0;q < n.statements.length;q++) { + a = n.statements[q]; + var r = n.view._statements[q]; + r.zIndex = c; + r.absX = k + r.x; + h.push({point:r.y + d - 30, endPoint:r.y + d, startBlock:r, blocks:[]}); + h.push({point:r.y + d + r.height, blocks:[]}); + c += .01; + g = g.concat(this._getNextMagnets(a, c, {x:r.x + k, y:r.y + d}, e)); + } + m.magnet.next && (d += m.magnet.next.y, k += m.magnet.next.x); + } + return g.concat(h); }; - b.setDeletable = function(a) { - this.deletable != a && this.set({deletable:a}); + a._getPreviousMagnets = function(a, c, d, e) { + var f = a.getBlocks(); + a = []; + d || (d = {x:0, y:0}); + e = d.x; + d = d.y; + var f = f[0], g = f.view; + g.zIndex = c; + if (g.dragInstance) { + return []; + } + d += g.y - 15; + e += g.x; + return g.magnet.previous ? (c = d + 1 + g.height, a.push({point:d, endPoint:c, startBlock:f, blocks:[]}), a.push({point:c, blocks:[]}), g.absX = e, a) : []; }; - b.isDeletable = function() { - return this.deletable === Entry.Block.DELETABLE_TRUE; + a._getFieldMagnets = function(a, c, d, e) { + var f = a.getBlocks(), g = [], h = []; + d || (d = {x:0, y:0}); + var k = d.x; + d = d.y; + for (var l = 0;l < f.length;l++) { + var n = f[l], m = n.view; + if (m.dragInstance) { + break; + } + m.zIndex = c; + d += m.y; + k += m.x; + h = h.concat(this._getFieldBlockMetaData(m, k, d, c, e)); + n.statements && (c += .01); + for (var q = 0;q < n.statements.length;q++) { + a = n.statements[q]; + var r = n.view._statements[q], g = g.concat(this._getFieldMagnets(a, c, {x:r.x + k, y:r.y + d}, e)); + } + m.magnet.next && (d += m.magnet.next.y, k += m.magnet.next.x); + } + return g.concat(h); }; - b.isReadOnly = function() { - return this.readOnly; + a._getFieldBlockMetaData = function(a, c, d, e, f) { + var g = a._contents, h = []; + d += a.contentPos.y; + for (var k = 0;k < g.length;k++) { + var l = g[k]; + if (l instanceof Entry.FieldBlock) { + var n = l._valueBlock; + if (!n.view.dragInstance && (l.acceptType === f || "boolean" === l.acceptType)) { + var m = c + l.box.x, q = d + l.box.y + a.contentHeight % 1E3 * -.5, r = d + l.box.y + l.box.height; + l.acceptType === f && (h.push({point:q, endPoint:r, startBlock:n, blocks:[]}), h.push({point:r, blocks:[]})); + l = n.view; + l.absX = m; + l.zIndex = e; + h = h.concat(this._getFieldBlockMetaData(l, m + l.contentPos.x, q + l.contentPos.y, e + .01, f)); + } + } + } + return h; }; - b.getCode = function() { - return this.thread.getCode(); + a._getOutputMagnets = function(a, c, d, e) { + var f = a.getBlocks(), g = [], h = []; + d || (d = {x:0, y:0}); + var k = d.x; + d = d.y; + for (var l = 0;l < f.length;l++) { + var n = f[l], m = n.view; + if (m.dragInstance) { + break; + } + m.zIndex = c; + d += m.y; + k += m.x; + h = h.concat(this._getOutputMetaData(m, k, d, c, e)); + n.statements && (c += .01); + for (var q = 0;q < n.statements.length;q++) { + a = n.statements[q]; + var r = n.view._statements[q], g = g.concat(this._getOutputMagnets(a, c, {x:r.x + k, y:r.y + d}, e)); + } + m.magnet.next && (d += m.magnet.next.y, k += m.magnet.next.x); + } + return g.concat(h); }; - b.doAdd = function() { - this.getCode().changeEvent.notify(); + a._getOutputMetaData = function(a, c, d, e, f) { + var g = a._contents, h = []; + c += a.contentPos.x; + d += a.contentPos.y; + for (a = 0;a < g.length;a++) { + var k = g[a], l = c + k.box.x, n = d - 24, m = d; + k instanceof Entry.FieldBlock ? (k.acceptType === f && (h.push({point:n, endPoint:m, startBlock:k, blocks:[]}), h.push({point:m, blocks:[]}), k.absX = l, k.zIndex = e, k.width = 20), (n = k._valueBlock) && (h = h.concat(this._getOutputMetaData(n.view, l, d + k.box.y, e + .01, f)))) : k instanceof Entry.FieldOutput && k.acceptType === f && (h.push({point:n, endPoint:m, startBlock:k, blocks:[]}), h.push({point:m, blocks:[]}), k.absX = l, k.zIndex = e, k.width = 20, (n = k._valueBlock) && (n.view.dragInstance || + (h = h.concat(this._getOutputMetaData(n.view, c + k.box.x, d + k.box.y, e + .01, f))))); + } + return h; }; - b.doMove = function() { - this._updatePos(); - this.getCode().changeEvent.notify(); + a.getNearestMagnet = function(a, c, d) { + var e = this._magnetMap[d]; + if (e && 0 !== e.length) { + var f = 0, g = e.length - 1, h, k = null, l = "previous" === d ? c - 15 : c; + for (c = -1 < ["previous", "next"].indexOf(d) ? 20 : 0;f <= g;) { + if (h = (f + g) / 2 | 0, d = e[h], l < d.point) { + g = h - 1; + } else { + if (l > d.endPoint) { + f = h + 1; + } else { + e = d.blocks; + for (f = 0;f < e.length;f++) { + if (g = e[f].view, g.absX - c < a && a < g.absX + g.width && (g = d.blocks[f], !k || k.view.zIndex < g.view.zIndex)) { + k = d.blocks[f]; + } + } + return k; + } + } + } + return null; + } }; - b.doSeparate = function() { - this.separate(); + a.dominate = function(a) { + a && (a = a.getFirstBlock()) && (this.svgBlockGroup.appendChild(a.view.svgGroup), this.code.dominate(a.thread)); }; - b.doInsert = function(a) { - "basic" === this.getBlockType() ? this.insert(a) : this.replace(a); + a.setPatternRectFill = function(a) { + this.patternRect.attr({fill:a}); + this.pattern.attr({style:""}); }; - b.doDestroy = function(a) { - this.destroy(a); - this.getCode().changeEvent.notify(); - return this; + a.disablePattern = function() { + this.pattern.attr({style:"display: none"}); }; - b.doDestroyBelow = function(a) { - console.log("destroyBelow", this.id, this.x, this.y); - this.destroy(a, !0); - this.getCode().changeEvent.notify(); - return this; + a._removeActivated = function() { + this._activatedBlockView && (this._activatedBlockView.removeActivated(), this._activatedBlockView = null); }; - b.copy = function() { - var a = this.getThread(), b = []; - if (a instanceof Entry.Thread) { - for (var d = a.getBlocks().indexOf(this), a = a.toJSON(!0, d), d = 0;d < a.length;d++) { - b.push(a[d]); - } - } else { - b.push(this.toJSON(!0)); - } - a = this.view.getAbsoluteCoordinate(); - d = b[0]; - d.x = a.x + 15; - d.y = a.y + 15; - d.id = Entry.Utils.generateId(); - return b; + a.activateBlock = function(a) { + a = a.view; + var c = a.getAbsoluteCoordinate(), d = this.svgDom, e = c.x, c = c.y, e = d.width() / 2 - e, d = d.height() / 2 - c - 100; + this.scroller.scroll(e, d); + a.addActivated(); + this._activatedBlockView = a; + }; + a.reDraw = function() { + this.code.view.reDraw(); }; - b.copyToClipboard = function() { - Entry.clipboard = this.copy(); + a.separate = function(a, c) { + "string" === typeof a && (a = this.findById(a)); + a.view && a.view._toGlobalCoordinate(); + var d = a.getPrevBlock(); + a.separate(c); + d && d.getNextBlock() && d.getNextBlock().view.bindPrev(); }; - b.separate = function(a) { - this.thread.separate(this, a); - this._updatePos(); - this.getCode().changeEvent.notify(); + a.insert = function(a, c, d) { + "string" === typeof a && (a = this.findById(a)); + this.separate(a, d); + 3 === c.length ? a.moveTo(c[0], c[1]) : 4 === c.length && 0 === c[3] ? (c = this.code.getThreads()[c[2]], a.thread.cut(a), c.insertToTop(a), a.getNextBlock().view.bindPrev()) : (c = c instanceof Array ? this.code.getTargetByPointer(c) : c, c instanceof Entry.Block ? ("basic" === a.getBlockType() && a.view.bindPrev(c), a.doInsert(c)) : c instanceof Entry.FieldStatement ? (a.view.bindPrev(c), c.insertTopBlock(a)) : a.doInsert(c)); }; - b.insert = function(a) { - var b = this.thread.cut(this); - a instanceof Entry.Thread ? a.insertByBlock(null, b) : a.insertAfter(b); - this._updatePos(); - this.getCode().changeEvent.notify(); + a.adjustThreadsPosition = function() { + var a = this.code; + a && (a = a.getThreads()) && 0 !== a.length && (a = a.sort(function(a, b) { + return a.getFirstBlock().view.x - b.getFirstBlock().view.x; + }), a = a[0].getFirstBlock()) && (a = a.view, a = a.getAbsoluteCoordinate(), this.scroller.scroll(50 - a.x, 30 - a.y)); }; - b.replace = function(a) { - this.thread.cut(this); - a.getThread().replace(this); - this.getCode().changeEvent.notify(); + a._initContextOptions = function() { + var a = this; + this._contextOptions = [{activated:!0, option:{text:Lang.Blocks.Paste_blocks, enable:!!Entry.clipboard, callback:function() { + Entry.do("addThread", Entry.clipboard).value.getFirstBlock().copyToClipboard(); + }}}, {activated:!0, option:{text:Lang.Blocks.tidy_up_block, callback:function() { + a.alignThreads(); + }}}, {activated:!0, option:{text:Lang.Blocks.Clear_all_blocks, callback:function() { + a.code.clear(); + }}}, {activated:"workspace" === Entry.type && Entry.Utils.isChrome() && !Entry.isMobile(), option:{text:Lang.Menus.save_as_image_all, enable:!0, callback:function() { + a.code.getThreads().forEach(function(a) { + (a = a.getFirstBlock()) && a.view.downloadAsImage(); + }); + }}}]; }; - b.getPrevBlock = function() { - return this.thread.getPrevBlock(this); + a.activateContextOption = function(a) { + this._contextOptions[a].activated = !0; }; - b.getNextBlock = function() { - return this.thread.getNextBlock(this) || null; + a.deActivateContextOption = function(a) { + this._contextOptions[a].activated = !1; }; - b.getLastBlock = function() { - return this.thread.getLastBlock(); + a._bindEvent = function() { + Entry.documentMousedown && (Entry.documentMousedown.attach(this, this.setSelectedBlock), Entry.documentMousedown.attach(this, this._removeActivated)); + Entry.keyPressed && Entry.keyPressed.attach(this, this._keyboardControl); + if (Entry.windowResized) { + var a = _.debounce(this.updateOffset, 200); + Entry.windowResized.attach(this, a); + } + }; + a.offset = function() { + (!this._offset || 0 === this._offset.top && 0 === this._offset.left) && this.updateOffset(); + return this._offset; }; - b.getOutputBlock = function() { - for (var a = this._schema.params, b = 0;a && b < a.length;b++) { - if ("Output" === a[b].type) { - return this.params[b]; + a._rightClick = function(a) { + var c = Entry.disposeEvent; + c && c.notify(a); + if (this.visible) { + var c = [], d = this._contextOptions; + d[Entry.Board.OPTION_PASTE].option.enable = !!Entry.clipboard; + d[Entry.Board.OPTION_DOWNLOAD].option.enable = 0 !== this.code.getThreads().length; + for (var e = 0;e < this._contextOptions.length;e++) { + d[e].activated && c.push(d[e].option); } + a = Entry.Utils.convertMouseEvent(a); + Entry.ContextMenu.show(c, null, {x:a.clientX, y:a.clientY}); } - return null; }; - b.getTerminateOutputBlock = function() { - for (var a = this;;) { - var b = a.getOutputBlock(); - if (!b) { - return a; - } - a = b; +})(Entry.Board.prototype); +Entry.Code = function(a, b) { + Entry.Model(this, !1); + b && (this.object = b); + this._data = new Entry.Collection; + this._eventMap = {}; + this._blockMap = {}; + this.executors = []; + this.executeEndEvent = new Entry.Event(this); + this.changeEvent = new Entry.Event(this); + this.changeEvent.attach(this, this._handleChange); + this._maxZIndex = 0; + this.load(a); +}; +Entry.STATEMENT = 0; +Entry.PARAM = -1; +(function(a) { + a.schema = {view:null, board:null}; + a.load = function(a) { + a instanceof Array || (a = JSON.parse(a)); + this.clear(); + for (var c = 0;c < a.length;c++) { + this._data.push(new Entry.Thread(a[c], this)); } + return this; }; - b.getBlockType = function() { - if (!this.view) { - return null; + a.clear = function() { + for (var a = this._data.length - 1;0 <= a;a--) { + this._data[a].destroy(!1); } - var a = Entry.skeleton[this._schema.skeleton].magnets(this.view); - return a.next || a.previous ? "basic" : a.boolean || a.string ? "field" : a.output ? "output" : null; + this.clearExecutors(); + this._eventMap = {}; }; - b.indexOfStatements = function(a) { - return this.statements.indexOf(a); + a.createView = function(a) { + null === this.view ? this.set({view:new Entry.CodeView(this, a), board:a}) : (this.set({board:a}), a.bindCodeView(this.view)); }; - b.pointer = function(a) { - a || (a = []); - return this.thread.pointer(a, this); + a.registerEvent = function(a, c) { + this._eventMap[c] || (this._eventMap[c] = []); + this._eventMap[c].push(a); }; - b.targetPointer = function() { - var a = this.thread.pointer([], this); - 4 === a.length && 0 === a[3] && a.pop(); - return a; + a.unregisterEvent = function(a, c) { + (c = this._eventMap[c]) && 0 !== c.length && (a = c.indexOf(a), 0 > a || c.splice(a, 1)); }; - b.getBlockList = function(a, b) { - var d = []; - if (!this._schema) { - return []; - } - if (a && this._schema.isPrimitive) { - return d; - } - (b || this.type) === this.type && d.push(this); - for (var e = this.params, f = 0;f < e.length;f++) { - var g = e[f]; - g && g.constructor == Entry.Block && (d = d.concat(g.getBlockList(a, b))); - } - if (e = this.statements) { - for (f = 0;f < e.length;f++) { - d = d.concat(e[f].getBlockList(a, b)); + a.raiseEvent = function(a, c, d) { + a = this._eventMap[a]; + var e = []; + if (void 0 !== a) { + for (var f = 0;f < a.length;f++) { + var g = a[f]; + if (void 0 === d || -1 < g.params.indexOf(d)) { + g = new Entry.Executor(a[f], c), this.executors.push(g), e.push(g); + } } + return e; } - return d; }; - b.stringify = function() { - return JSON.stringify(this.toJSON()); - }; -})(Entry.Block.prototype); -Entry.ThreadView = function(b, a) { - Entry.Model(this, !1); - this.thread = b; - this.svgGroup = a.svgThreadGroup.elem("g"); - this.parent = a; -}; -(function(b) { - b.schema = {height:0, zIndex:0}; - b.destroy = function() { - this.svgGroup.remove(); - }; - b.setParent = function(a) { - this.parent = a; + a.getEventMap = function(a) { + return this._eventMap[a]; }; - b.getParent = function() { - return this.parent; + a.map = function(a) { + this._data.map(a); }; - b.renderText = function() { - for (var a = this.thread.getBlocks(), b = 0;b < a.length;b++) { - a[b].view.renderText(); + a.tick = function() { + for (var a = this.executors, c = 0;c < a.length;c++) { + var d = a[c]; + d.isEnd() ? (a.splice(c--, 1), 0 === a.length && this.executeEndEvent.notify()) : d.execute(); } }; - b.renderBlock = function() { - for (var a = this.thread.getBlocks(), b = 0;b < a.length;b++) { - a[b].view.renderBlock(); - } + a.removeExecutor = function(a) { + a = this.executors.indexOf(a); + -1 < a && this.executors.splice(a, 1); }; - b.requestAbsoluteCoordinate = function(a) { - var b = this.thread.getBlocks(), d = b.shift(), e = {x:0, y:0}; - for (this.parent instanceof Entry.Board || this.parent instanceof Entry.BlockMenu || (e = this.parent.requestAbsoluteCoordinate());d && d.view !== a && d.view;) { - d = d.view, e.x += d.x + d.magnet.next.x, e.y += d.y + d.magnet.next.y, d = b.shift(); - } - return e; + a.clearExecutors = function() { + this.executors.forEach(function(a) { + a.end(); + }); + this.executors = []; }; - b.requestPartHeight = function(a, b) { - for (var d = this.thread.getBlocks(), e = d.pop(), f = a ? a.magnet.next ? a.magnet.next.y : a.height : 0;e && e.view !== a && e.view;) { - e = e.view, f = e.magnet.next ? f + e.magnet.next.y : f + e.height, e.dragMode === Entry.DRAG_MODE_DRAG && (f = 0), e = d.pop(); + a.clearExecutorsByEntity = function(a) { + for (var c = this.executors, d = 0;d < c.length;d++) { + var e = c[d]; + e.entity === a && e.end(); } - return f; - }; - b.dominate = function() { - this.parent.dominate(this.thread); }; - b.isGlobal = function() { - return this.parent instanceof Entry.Board; + a.addExecutor = function(a) { + this.executors.push(a); }; - b.reDraw = function() { - for (var a = this.thread._data, b = a.length - 1;0 <= b;b--) { - a[b].view.reDraw(); + a.createThread = function(a, c) { + if (!(a instanceof Array)) { + return console.error("blocks must be array"); } + a = new Entry.Thread(a, this); + void 0 === c ? this._data.push(a) : this._data.insert(a, c); + return a; }; - b.setZIndex = function(a) { - this.set({zIndex:a}); + a.cloneThread = function(a, c) { + a = a.clone(this, c); + this._data.push(a); + return a; }; -})(Entry.ThreadView.prototype); -Entry.FieldTrashcan = function(b) { - b && this.setBoard(b); - this.dragBlockObserver = this.dragBlock = null; - this.isOver = !1; - Entry.windowResized && Entry.windowResized.attach(this, this.setPosition); -}; -(function(b) { - b._generateView = function() { - this.svgGroup = this.board.svg.elem("g"); - this.renderStart(); - this._addControl(); + a.destroyThread = function(a, c) { + c = this._data; + a = c.indexOf(a); + 0 > a || c.splice(a, 1); }; - b.renderStart = function() { - var a = Entry.mediaFilePath + "delete_"; - this.trashcanTop = this.svgGroup.elem("image", {href:a + "cover.png", width:60, height:20}); - this.svgGroup.elem("image", {href:a + "body.png", y:20, width:60, height:60}); + a.doDestroyThread = function(a, c) { + c = this._data; + a = c.indexOf(a); + 0 > a || c.splice(a, 1); }; - b._addControl = function() { - $(this.svgGroup).bind("mousedown", function(a) { - Entry.Utils.isRightButton(a) && (a.stopPropagation(), $("#entryWorkspaceBoard").css("background", "white")); + a.getThreads = function() { + return this._data.map(function(a) { + return a; }); }; - b.updateDragBlock = function() { - var a = this.board.dragBlock, b = this.dragBlockObserver; - b && (b.destroy(), this.dragBlockObserver = null); - a ? this.dragBlockObserver = a.observe(this, "checkBlock", ["x", "y"]) : (this.isOver && this.dragBlock && !this.dragBlock.block.getPrevBlock() && (this.dragBlock.block.doDestroyBelow(!0), createjs.Sound.play("entryDelete")), this.tAnimation(!1)); - this.dragBlock = a; - }; - b.checkBlock = function() { - var a = this.dragBlock; - if (a && a.block.isDeletable()) { - var b = this.board.offset(), d = this.getPosition(), e = d.x + b.left, b = d.y + b.top, f, g; - if (a = a.dragInstance) { - f = a.offsetX, g = a.offsetY; - } - this.tAnimation(f >= e && g >= b); + a.toJSON = function() { + for (var a = this.getThreads(), c = [], d = 0, e = a.length;d < e;d++) { + c.push(a[d].toJSON()); } + return c; }; - b.align = function() { - var a = this.getPosition(); - this.svgGroup.attr({transform:"translate(" + a.x + "," + a.y + ")"}); - }; - b.setPosition = function() { - if (this.board) { - var a = this.board.svgDom; - this._x = a.width() - 110; - this._y = a.height() - 110; - this.align(); + a.countBlock = function() { + for (var a = this.getThreads(), c = 0, d = 0;d < a.length;d++) { + c += a[d].countBlock(); } + return c; }; - b.getPosition = function() { - return {x:this._x, y:this._y}; - }; - b.tAnimation = function(a) { - if (a !== this.isOver) { - a = void 0 === a ? !0 : a; - var b, d = this.trashcanTop; - b = a ? {translateX:15, translateY:-25, rotateZ:30} : {translateX:0, translateY:0, rotateZ:0}; - $(d).velocity(b, {duration:50}); - this.isOver = a; + a.moveBy = function(a, c) { + for (var d = this.getThreads(), e = 0, f = d.length;e < f;e++) { + var g = d[e].getFirstBlock(); + g && g.view._moveBy(a, c, !1); } + a = this.board; + a instanceof Entry.BlockMenu && a.updateSplitters(c); }; - b.setBoard = function(a) { - this._dragBlockObserver && this._dragBlockObserver.destroy(); - this.board = a; - this.svgGroup || this._generateView(); - var b = a.svg, d = b.firstChild; - d ? b.insertBefore(this.svgGroup, d) : b.appendChild(this.svgGroup); - this._dragBlockObserver = a.observe(this, "updateDragBlock", ["dragBlock"]); - this.svgGroup.attr({filter:"url(#entryTrashcanFilter_" + a.suffix + ")"}); - this.setPosition(); + a.stringify = function() { + return JSON.stringify(this.toJSON()); }; -})(Entry.FieldTrashcan.prototype); -Entry.Vim = function(b) { - b = "string" === typeof b ? $("#" + b) : $(b); - if ("DIV" !== b.prop("tagName")) { - return console.error("Dom is not div element"); - } - this.createDom(b); - this._parser = new Entry.Parser("maze", "js", this.codeMirror); - this._blockParser = new Entry.Parser("maze", "block"); - Entry.Model(this, !1); - window.eventset = []; -}; -(function(b) { - b.createDom = function(a) { - function b(a) { - var c = e.getCodeToText(a.block); - e.codeMirror.display.dragFunctions.leave(a); - var d = Entry.Utils.createMouseEvent("mousedown", a); - e.codeMirror.display.scroller.dispatchEvent(d); - var c = c.split("\n"), k = c.length - 1, l = 0; - c.forEach(function(a, b) { - e.codeMirror.replaceSelection(a); - l = e.doc.getCursor().line; - e.codeMirror.indentLine(l); - 0 !== b && k === b || e.codeMirror.replaceSelection("\n"); - }); - a = Entry.Utils.createMouseEvent("mouseup", a); - e.codeMirror.display.scroller.dispatchEvent(a); - } - 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); + a.dominate = function(a) { + a.view.setZIndex(this._maxZIndex++); }; - b.hide = function() { - this.view.addClass("entryRemove"); + a.indexOf = function(a) { + return this._data.indexOf(a); }; - b.show = function() { - this.view.removeClass("entryRemove"); + a._handleChange = function() { + Entry.creationChangedEvent && Entry.creationChangedEvent.notify(); }; - b.textToCode = function() { - var a = this.codeMirror.getValue(), a = this._parser.parse(a); - if (0 === a.length) { - throw "\ube14\ub85d \ud30c\uc2f1 \uc624\ub958"; + a.hasBlockType = function(a) { + for (var c = this.getThreads(), d = 0;d < c.length;d++) { + if (c[d].hasBlockType(a)) { + return !0; + } } - 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; + return !1; }; - b.getMode = function() { - return this.mode; + a.findById = function(a) { + return this._blockMap[a]; }; - 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}); - 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); + a.registerBlock = function(a) { + this._blockMap[a.id] = a; }; - b.changeBoardCode = function(a) { - this.board.changeCode(a); + a.unregisterBlock = function(a) { + delete this._blockMap[a.id]; }; - b.changeOverlayBoardCode = function(a) { - this.overlayBoard && this.overlayBoard.changeCode(a); + a.getByPointer = function(a) { + a = a.concat(); + a.shift(); + a.shift(); + for (var c = this._data[a.shift()].getBlock(a.shift());a.length;) { + c instanceof Entry.Block || (c = c.getValueBlock()); + var d = a.shift(), e = a.shift(); + -1 < d ? c = c.statements[d].getBlock(e) : -1 === d && (c = c.view.getParam(e)); + } + return c; }; - b.changeBlockMenuCode = function(a) { - this.blockMenu.changeCode(a); + a.getTargetByPointer = function(a) { + a = a.concat(); + a.shift(); + a.shift(); + var c = this._data[a.shift()], d; + if (1 === a.length) { + d = c.getBlock(a.shift() - 1); + } else { + for (d = c.getBlock(a.shift());a.length;) { + d instanceof Entry.Block || (d = d.getValueBlock()); + var e = a.shift(), c = a.shift(); + -1 < e ? (d = d.statements[e], d = a.length ? d.getBlock(c) : 0 === c ? d.view.getParent() : d.getBlock(c - 1)) : -1 === e && (d = d.view.getParam(c)); + } + } + return d; }; - 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(); + a.getBlockList = function(a, c) { + for (var d = this.getThreads(), e = [], f = 0;f < d.length;f++) { + e = e.concat(d[f].getBlockList(a, c)); } + return e; }; - b.codeToText = function(a) { - return this.vimBoard.codeToText(a); + a.removeBlocksByType = function(a) { + this.getBlockList(!1, a).forEach(function(a) { + a.doDestroy(); + }); }; - b.getCodeToText = function(a) { - return this.vimBoard.getCodeToText(a); +})(Entry.Code.prototype); +Entry.CodeView = function(a, b) { + Entry.Model(this, !1); + this.code = a; + this.set({board:b}); + this.svgThreadGroup = b.svgGroup.elem("g"); + this.svgThreadGroup.attr({class:"svgThreadGroup"}); + this.svgThreadGroup.board = b; + this.svgBlockGroup = b.svgGroup.elem("g"); + this.svgBlockGroup.attr({class:"svgBlockGroup"}); + this.svgBlockGroup.board = b; + b.bindCodeView(this); + this.code.map(function(a) { + a.createView(b); + }); + a.observe(this, "_setBoard", ["board"]); +}; +(function(a) { + a.schema = {board:null, scrollX:0, scrollY:0}; + a._setBoard = function() { + this.set({board:this.code.board}); }; - b._setSelectedBlockView = function() { - this.set({selectedBlockView:this.board.selectedBlockView || this.blockMenu.selectedBlockView || (this.overlayBoard ? this.overlayBoard.selectedBlockView : null)}); + a.reDraw = function() { + this.code.map(function(a) { + a.view.reDraw(); + }); }; - b.initOverlayBoard = function() { - this.overlayBoard = new Entry.Board({dom:this.board.view, workspace:this, isOverlay:!0}); - this.overlayBoard.changeCode(new Entry.Code([])); - this.overlayBoard.workspace = this; - this.overlayBoard.observe(this, "_setSelectedBlockView", ["selectedBlockView"], !1); +})(Entry.CodeView.prototype); +Entry.ConnectionRipple = {}; +(function(a) { + a.createDom = function(a) { + this.svgDom || (this._ripple = a.getBoard().svgGroup.elem("circle", {cx:0, cy:0, r:0, stroke:"#888", "stroke-width":10})); }; - b._keyboardControl = function(a) { - var b = a.keyCode || a.which, d = a.ctrlKey; - if (!Entry.Utils.isInInput(a)) { - var e = this.selectedBlockView; - e && !e.isInBlockMenu && e.block.isDeletable() && (8 == b || 46 == b ? (Entry.do("destroyBlock", e.block), a.preventDefault()) : d && (67 == b ? e.block.copyToClipboard() : 88 == b && (a = e.block, a.copyToClipboard(), a.destroy(!0, !0), e.getBoard().setSelectedBlock(null)))); - d && 86 == b && (b = this.selectedBoard) && b instanceof Entry.Board && Entry.clipboard && Entry.do("addThread", Entry.clipboard).value.getFirstBlock().copyToClipboard(); - } + a.setView = function(a) { + this._ripple || this.createDom(a); + var c = this._ripple, d = a.getBoard().svgGroup; + c.remove(); + a = a.getAbsoluteCoordinate(); + c.attr({cx:a.x, cy:a.y}); + d.appendChild(c); + c._startTime = new Date; + return this; }; - b._handleChangeBoard = function() { - var a = this.selectedBoard; - a && a.constructor === Entry.Board && this.trashcan.setBoard(a); + a.dispose = function() { + var a = this, c = this._ripple, d = (new Date - c._startTime) / 150; + 1 < d ? c.remove() : (c.attr({r:25 * d, opacity:1 - d}), window.setTimeout(function() { + a.dispose(); + }, 10)); }; -})(Entry.Workspace.prototype); -Entry.Playground = function() { - this.enableArduino = this.isTextBGMode_ = !1; - this.viewMode_ = "default"; - Entry.addEventListener("textEdited", this.injectText); - Entry.addEventListener("hwChanged", this.updateHW); -}; -Entry.Playground.prototype.generateView = function(b, a) { - this.view_ = b; - this.view_.addClass("entryPlayground"); - if (a && "workspace" != a) { - "phone" == a && (this.view_.addClass("entryPlaygroundPhone"), c = Entry.createElement("div", "entryCategoryTab"), c.addClass("entryPlaygroundTabPhone"), Entry.view_.insertBefore(c, this.view_), this.generateTabView(c), this.tabView_ = c, c = Entry.createElement("div", "entryCurtain"), c.addClass("entryPlaygroundCurtainPhone"), c.addClass("entryRemove"), c.innerHTML = Lang.Workspace.cannot_edit_click_to_stop, c.bindOnClick(function() { - Entry.engine.toggleStop(); - }), this.view_.appendChild(c), this.curtainView_ = c, Entry.pictureEditable && (c = Entry.createElement("div", "entryPicture"), c.addClass("entryPlaygroundPicturePhone"), c.addClass("entryRemove"), this.view_.appendChild(c), this.generatePictureView(c), this.pictureView_ = c), c = Entry.createElement("div", "entryText"), c.addClass("entryRemove"), this.view_.appendChild(c), this.generateTextView(c), this.textView_ = c, Entry.soundEditable && (c = Entry.createElement("div", "entrySound"), c.addClass("entryPlaygroundSoundWorkspacePhone"), - c.addClass("entryRemove"), this.view_.appendChild(c), this.generateSoundView(c), this.soundView_ = c), c = Entry.createElement("div", "entryDefault"), this.view_.appendChild(c), this.generateDefaultView(c), this.defaultView_ = c, c = Entry.createElement("div", "entryCode"), c.addClass("entryPlaygroundCodePhone"), this.view_.appendChild(c), this.generateCodeView(c), this.codeView_ = this.codeView_ = c, Entry.addEventListener("run", function(a) { - Entry.playground.curtainView_.removeClass("entryRemove"); - }), Entry.addEventListener("stop", function(a) { - Entry.playground.curtainView_.addClass("entryRemove"); - })); - } else { - this.view_.addClass("entryPlaygroundWorkspace"); - var c = Entry.createElement("div", "entryCategoryTab"); - c.addClass("entryPlaygroundTabWorkspace"); - this.view_.appendChild(c); - this.generateTabView(c); - this.tabView_ = c; - c = Entry.createElement("div", "entryCurtain"); - c.addClass("entryPlaygroundCurtainWorkspace"); - c.addClass("entryRemove"); - var d = Lang.Workspace.cannot_edit_click_to_stop.split("."); - c.innerHTML = d[0] + ".
" + d[1]; - c.addEventListener("click", function() { - Entry.engine.toggleStop(); - }); - this.view_.appendChild(c); - this.curtainView_ = c; - Entry.pictureEditable && (c = Entry.createElement("div", "entryPicture"), c.addClass("entryPlaygroundPictureWorkspace"), c.addClass("entryRemove"), this.view_.appendChild(c), this.generatePictureView(c), this.pictureView_ = c); - c = Entry.createElement("div", "entryText"); - c.addClass("entryPlaygroundTextWorkspace"); - c.addClass("entryRemove"); - this.view_.appendChild(c); - this.generateTextView(c); - this.textView_ = c; - Entry.soundEditable && (c = Entry.createElement("div", "entrySound"), c.addClass("entryPlaygroundSoundWorkspace"), c.addClass("entryRemove"), this.view_.appendChild(c), this.generateSoundView(c), this.soundView_ = c); - c = Entry.createElement("div", "entryDefault"); - c.addClass("entryPlaygroundDefaultWorkspace"); - this.view_.appendChild(c); - this.generateDefaultView(c); - this.defaultView_ = c; - c = Entry.createElement("div", "entryCode"); - c.addClass("entryPlaygroundCodeWorkspace"); - c.addClass("entryRemove"); - this.view_.appendChild(c); - this.generateCodeView(c); - this.codeView_ = c; - d = Entry.createElement("div"); - d.addClass("entryPlaygroundResizeWorkspace", "entryRemove"); - this.resizeHandle_ = d; - this.view_.appendChild(d); - this.initializeResizeHandle(d); - this.codeView_ = c; - Entry.addEventListener("run", function(a) { - Entry.playground.curtainView_.removeClass("entryRemove"); - }); - Entry.addEventListener("stop", function(a) { - Entry.playground.curtainView_.addClass("entryRemove"); - }); - } -}; -Entry.Playground.prototype.generateDefaultView = function(b) { - return b; -}; -Entry.Playground.prototype.generateTabView = function(b) { - var a = this, c = Entry.createElement("ul"); - c.addClass("entryTabListWorkspace"); - this.tabList_ = c; - b.appendChild(c); - this.tabViewElements = {}; - b = Entry.createElement("li", "entryCodeTab"); - b.innerHTML = Lang.Workspace.tab_code; - b.addClass("entryTabListItemWorkspace"); - b.addClass("entryTabSelected"); - c.appendChild(b); - b.bindOnClick(function(b) { - a.changeViewMode("code"); - a.blockMenu.reDraw(); - }); - this.tabViewElements.code = b; - Entry.pictureEditable && (b = Entry.createElement("li", "entryPictureTab"), b.innerHTML = Lang.Workspace.tab_picture, b.addClass("entryTabListItemWorkspace"), c.appendChild(b), b.bindOnClick(function(a) { - Entry.playground.changeViewMode("picture"); - }), this.tabViewElements.picture = b, b = Entry.createElement("li", "entryTextboxTab"), b.innerHTML = Lang.Workspace.tab_text, b.addClass("entryTabListItemWorkspace"), c.appendChild(b), b.bindOnClick(function(a) { - Entry.playground.changeViewMode("text"); - }), this.tabViewElements.text = b, b.addClass("entryRemove")); - Entry.soundEditable && (b = Entry.createElement("li", "entrySoundTab"), b.innerHTML = Lang.Workspace.tab_sound, b.addClass("entryTabListItemWorkspace"), c.appendChild(b), b.bindOnClick(function(a) { - Entry.playground.changeViewMode("sound"); - }), this.tabViewElements.sound = b); - Entry.hasVariableManager && (b = Entry.createElement("li", "entryVariableTab"), b.innerHTML = Lang.Workspace.tab_attribute, b.addClass("entryTabListItemWorkspace"), b.addClass("entryVariableTabWorkspace"), c.appendChild(b), b.bindOnClick(function(a) { - Entry.playground.toggleOnVariableView(); - Entry.playground.changeViewMode("variable"); - }), this.tabViewElements.variable = b); -}; -Entry.Playground.prototype.generateCodeView = function(b) { - var a = this.createVariableView(); - b.appendChild(a); - this.variableView_ = a; - b = Entry.Dom(b); - a = Entry.Dom("div", {parent:b, id:"entryWorkspaceBoard", class:"entryWorkspaceBoard"}); - b = Entry.Dom("div", {parent:b, id:"entryWorkspaceBlockMenu", class:"entryWorkspaceBlockMenu"}); - this.mainWorkspace = new Entry.Workspace({blockMenu:{dom:b, align:"LEFT", categoryData:EntryStatic.getAllBlocks(), scroll:!0}, board:{dom:a}}); - this.blockMenu = this.mainWorkspace.blockMenu; - this.board = this.mainWorkspace.board; - Entry.hw && this.updateHW(); -}; -Entry.Playground.prototype.generatePictureView = function(b) { - if ("workspace" == Entry.type) { - var a = Entry.createElement("div", "entryAddPicture"); - a.addClass("entryPlaygroundAddPicture"); - a.bindOnClick(function(a) { - Entry.dispatchEvent("openPictureManager"); - }); - var c = Entry.createElement("div", "entryAddPictureInner"); - c.addClass("entryPlaygroundAddPictureInner"); - c.innerHTML = Lang.Workspace.picture_add; - a.appendChild(c); - b.appendChild(a); - a = Entry.createElement("ul", "entryPictureList"); - a.addClass("entryPlaygroundPictureList"); - $ && $(a).sortable({start:function(a, b) { - b.item.data("start_pos", b.item.index()); - }, stop:function(a, b) { - var c = b.item.data("start_pos"), g = b.item.index(); - Entry.playground.movePicture(c, g); - }, axis:"y"}); - b.appendChild(a); - this.pictureListView_ = a; - a = Entry.createElement("div", "entryPainter"); - a.addClass("entryPlaygroundPainter"); - b.appendChild(a); - this.painter = new Entry.Painter; - this.painter.initialize(a); - } else { - "phone" == Entry.type && (a = Entry.createElement("div", "entryAddPicture"), a.addClass("entryPlaygroundAddPicturePhone"), a.bindOnClick(function(a) { - Entry.dispatchEvent("openPictureManager"); - }), c = Entry.createElement("div", "entryAddPictureInner"), c.addClass("entryPlaygroundAddPictureInnerPhone"), c.innerHTML = Lang.Workspace.picture_add, a.appendChild(c), b.appendChild(a), a = Entry.createElement("ul", "entryPictureList"), a.addClass("entryPlaygroundPictureListPhone"), $ && $(a).sortable({start:function(a, b) { - b.item.data("start_pos", b.item.index()); - }, stop:function(a, b) { - var c = b.item.data("start_pos"), g = b.item.index(); - Entry.playground.movePicture(c, g); - }, axis:"y"}), b.appendChild(a), this.pictureListView_ = a); - } +})(Entry.ConnectionRipple); +Entry.Executor = function(a, b) { + this.scope = new Entry.Scope(a, this); + this.entity = b; + this._callStack = []; + this.register = {}; }; -Entry.Playground.prototype.generateTextView = function(b) { - var a = Entry.createElement("div"); - b.appendChild(a); - b = Entry.createElement("div"); - b.addClass("textProperties"); - a.appendChild(b); - var c = Entry.createElement("div"); - c.addClass("entryTextFontSelect"); - b.appendChild(c); - var d = Entry.createElement("select", "entryPainterAttrFontName"); - d.addClass("entryPlaygroundPainterAttrFontName", "entryTextFontSelecter"); - d.size = "1"; - d.onchange = function(a) { - Entry.playground.object.entity.setFontType(a.target.value); - }; - for (var e = 0;e < Entry.fonts.length;e++) { - var f = Entry.fonts[e], g = Entry.createElement("option"); - g.value = f.family; - g.innerHTML = f.name; - d.appendChild(g); - } - this.fontName_ = d; - c.appendChild(d); - e = Entry.createElement("ul"); - e.addClass("entryPlayground_text_buttons"); - b.appendChild(e); - c = Entry.createElement("li"); - c.addClass("entryPlaygroundTextAlignLeft"); - c.bindOnClick(function(a) { - Entry.playground.setFontAlign(Entry.TEXT_ALIGN_LEFT); - }); - e.appendChild(c); - this.alignLeftBtn = c; - c = Entry.createElement("li"); - c.addClass("entryPlaygroundTextAlignCenter"); - c.bindOnClick(function(a) { - Entry.playground.setFontAlign(Entry.TEXT_ALIGN_CENTER); - }); - e.appendChild(c); - this.alignCenterBtn = c; - c = Entry.createElement("li"); - c.addClass("entryPlaygroundTextAlignRight"); - c.bindOnClick(function(a) { - Entry.playground.setFontAlign(Entry.TEXT_ALIGN_RIGHT); - }); - e.appendChild(c); - this.alignRightBtn = c; - c = Entry.createElement("li"); - e.appendChild(c); - d = Entry.createElement("a"); - c.appendChild(d); - d.bindOnClick(function() { - Entry.playground.object.entity.toggleFontBold() ? h.src = Entry.mediaFilePath + "text_button_bold_true.png" : h.src = Entry.mediaFilePath + "text_button_bold_false.png"; - }); - var h = Entry.createElement("img", "entryPlaygroundText_boldImage"); - d.appendChild(h); - h.src = Entry.mediaFilePath + "text_button_bold_false.png"; - c = Entry.createElement("li"); - e.appendChild(c); - d = Entry.createElement("a"); - c.appendChild(d); - d.bindOnClick(function() { - var a = !Entry.playground.object.entity.getUnderLine() || !1; - k.src = Entry.mediaFilePath + "text_button_underline_" + a + ".png"; - Entry.playground.object.entity.setUnderLine(a); - }); - var k = Entry.createElement("img", "entryPlaygroundText_underlineImage"); - d.appendChild(k); - k.src = Entry.mediaFilePath + "text_button_underline_false.png"; - c = Entry.createElement("li"); - e.appendChild(c); - d = Entry.createElement("a"); - c.appendChild(d); - d.bindOnClick(function() { - Entry.playground.object.entity.toggleFontItalic() ? l.src = Entry.mediaFilePath + "text_button_italic_true.png" : l.src = Entry.mediaFilePath + "/text_button_italic_false.png"; - }); - var l = Entry.createElement("img", "entryPlaygroundText_italicImage"); - d.appendChild(l); - l.src = Entry.mediaFilePath + "text_button_italic_false.png"; - c = Entry.createElement("li"); - e.appendChild(c); - d = Entry.createElement("a"); - c.appendChild(d); - d.bindOnClick(function() { - var a = !Entry.playground.object.entity.getStrike() || !1; - Entry.playground.object.entity.setStrike(a); - n.src = Entry.mediaFilePath + "text_button_strike_" + a + ".png"; - }); - var n = Entry.createElement("img", "entryPlaygroundText_strikeImage"); - d.appendChild(n); - n.src = Entry.mediaFilePath + "text_button_strike_false.png"; - d = Entry.createElement("li"); - e.appendChild(d); - c = Entry.createElement("a"); - d.appendChild(c); - c.bindOnClick(function() { - Entry.playground.toggleColourChooser("foreground"); - }); - d = Entry.createElement("img"); - c.appendChild(d); - d.src = Entry.mediaFilePath + "text_button_color_false.png"; - c = Entry.createElement("li"); - e.appendChild(c); - e = Entry.createElement("a"); - c.appendChild(e); - e.bindOnClick(function() { - Entry.playground.toggleColourChooser("background"); - }); - c = Entry.createElement("img"); - e.appendChild(c); - c.src = Entry.mediaFilePath + "text_button_background_false.png"; - e = Entry.createElement("div"); - e.addClass("entryPlayground_fgColorDiv"); - c = Entry.createElement("div"); - c.addClass("entryPlayground_bgColorDiv"); - b.appendChild(e); - b.appendChild(c); - d = Entry.createElement("div"); - d.addClass("entryPlaygroundTextColoursWrapper"); - this.coloursWrapper = d; - a.appendChild(d); - b = Entry.getColourCodes(); - for (e = 0;e < b.length;e++) { - c = Entry.createElement("div"), c.addClass("modal_colour"), c.setAttribute("colour", b[e]), c.style.backgroundColor = b[e], 0 === e && c.addClass("modalColourTrans"), c.bindOnClick(function(a) { - Entry.playground.setTextColour(a.target.getAttribute("colour")); - }), d.appendChild(c); - } - d.style.display = "none"; - d = Entry.createElement("div"); - d.addClass("entryPlaygroundTextBackgroundsWrapper"); - this.backgroundsWrapper = d; - a.appendChild(d); - for (e = 0;e < b.length;e++) { - c = Entry.createElement("div"), c.addClass("modal_colour"), c.setAttribute("colour", b[e]), c.style.backgroundColor = b[e], 0 === e && c.addClass("modalColourTrans"), c.bindOnClick(function(a) { - Entry.playground.setBackgroundColour(a.target.getAttribute("colour")); - }), d.appendChild(c); - } - d.style.display = "none"; - b = Entry.createElement("input"); - b.addClass("entryPlayground_textBox"); - b.onkeyup = function() { - Entry.playground.object.setText(this.value); - Entry.playground.object.entity.setText(this.value); +(function(a) { + a.execute = function() { + if (!this.isEnd()) { + for (;;) { + var a = null; + try { + a = this.scope.block.getSchema().func.call(this.scope, this.entity, this.scope); + } catch (d) { + if ("AsyncError" === d.name) { + a = Entry.STATIC.BREAK; + } else { + var c = !1; + "\ub7f0\ud0c0\uc784 \uc5d0\ub7ec" != d.message && (c = !0); + Entry.Utils.stopProjectWithToast(this.scope, "\ub7f0\ud0c0\uc784 \uc5d0\ub7ec", c); + } + } + if (this.isEnd()) { + break; + } + if (void 0 === a || null === a || a === Entry.STATIC.PASS) { + if (this.scope = new Entry.Scope(this.scope.block.getNextBlock(), this), null === this.scope.block) { + if (this._callStack.length) { + if (a = this.scope, this.scope = this._callStack.pop(), this.scope.isLooped !== a.isLooped) { + break; + } + } else { + break; + } + } + } else { + if (a !== Entry.STATIC.CONTINUE && (a === Entry.STATIC.BREAK || this.scope === a)) { + break; + } + } + } + } }; - b.onblur = function() { - Entry.dispatchEvent("textEdited"); + a.stepInto = function(a) { + a instanceof Entry.Thread || console.error("Must step in to thread"); + a = a.getFirstBlock(); + if (!a) { + return Entry.STATIC.BREAK; + } + this._callStack.push(this.scope); + this.scope = new Entry.Scope(a, this); + return Entry.STATIC.CONTINUE; }; - this.textEditInput = b; - a.appendChild(b); - b = Entry.createElement("textarea"); - b.addClass("entryPlayground_textArea"); - b.style.display = "none"; - b.onkeyup = function() { - Entry.playground.object.setText(this.value); - Entry.playground.object.entity.setText(this.value); + a.break = function() { + this._callStack.length && (this.scope = this._callStack.pop()); + return Entry.STATIC.PASS; }; - b.onblur = function() { - Entry.dispatchEvent("textEdited"); + a.breakLoop = function() { + this._callStack.length && (this.scope = this._callStack.pop()); + for (;this._callStack.length && "repeat" !== Entry.block[this.scope.block.type].class;) { + this.scope = this._callStack.pop(); + } + return Entry.STATIC.PASS; }; - this.textEditArea = b; - a.appendChild(b); - b = Entry.createElement("div"); - b.addClass("entryPlaygroundFontSizeWrapper"); - a.appendChild(b); - this.fontSizeWrapper = b; - var m = Entry.createElement("div"); - m.addClass("entryPlaygroundFontSizeSlider"); - b.appendChild(m); - var q = Entry.createElement("div"); - q.addClass("entryPlaygroundFontSizeIndicator"); - m.appendChild(q); - this.fontSizeIndiciator = q; - var r = Entry.createElement("div"); - r.addClass("entryPlaygroundFontSizeKnob"); - m.appendChild(r); - this.fontSizeKnob = r; - e = Entry.createElement("div"); - e.addClass("entryPlaygroundFontSizeLabel"); - e.innerHTML = "\uae00\uc790 \ud06c\uae30"; - b.appendChild(e); - var t = !1, u = 0; - r.onmousedown = function(a) { - t = !0; - u = $(m).offset().left; - }; - r.addEventListener("touchstart", function(a) { - t = !0; - u = $(m).offset().left; - }); - document.addEventListener("mousemove", function(a) { - t && (a = a.pageX - u, a = Math.max(a, 5), a = Math.min(a, 88), r.style.left = a + "px", a /= .88, q.style.width = a + "%", Entry.playground.object.entity.setFontSize(a)); - }); - document.addEventListener("touchmove", function(a) { - t && (a = a.touches[0].pageX - u, a = Math.max(a, 5), a = Math.min(a, 88), r.style.left = a + "px", a /= .88, q.style.width = a + "%", Entry.playground.object.entity.setFontSize(a)); - }); - document.addEventListener("mouseup", function(a) { - t = !1; - }); - document.addEventListener("touchend", function(a) { - t = !1; - }); - b = Entry.createElement("div"); - b.addClass("entryPlaygroundLinebreakWrapper"); - a.appendChild(b); - a = Entry.createElement("hr"); - a.addClass("entryPlaygroundLinebreakHorizontal"); - b.appendChild(a); - a = Entry.createElement("div"); - a.addClass("entryPlaygroundLinebreakButtons"); - b.appendChild(a); - e = Entry.createElement("img"); - e.bindOnClick(function() { - Entry.playground.toggleLineBreak(!1); - v.innerHTML = Lang.Menus.linebreak_off_desc_1; - x.innerHTML = Lang.Menus.linebreak_off_desc_2; - y.innerHTML = Lang.Menus.linebreak_off_desc_3; - }); - e.src = Entry.mediaFilePath + "text-linebreak-off-true.png"; - a.appendChild(e); - this.linebreakOffImage = e; - e = Entry.createElement("img"); - e.bindOnClick(function() { - Entry.playground.toggleLineBreak(!0); - v.innerHTML = Lang.Menus.linebreak_on_desc_1; - x.innerHTML = Lang.Menus.linebreak_on_desc_2; - y.innerHTML = Lang.Menus.linebreak_on_desc_3; - }); - e.src = Entry.mediaFilePath + "text-linebreak-on-false.png"; - a.appendChild(e); - this.linebreakOnImage = e; - a = Entry.createElement("div"); - a.addClass("entryPlaygroundLinebreakDescription"); - b.appendChild(a); - var v = Entry.createElement("p"); - v.innerHTML = Lang.Menus.linebreak_off_desc_1; - a.appendChild(v); - b = Entry.createElement("ul"); - a.appendChild(b); - var x = Entry.createElement("li"); - x.innerHTML = Lang.Menus.linebreak_off_desc_2; - b.appendChild(x); - var y = Entry.createElement("li"); - y.innerHTML = Lang.Menus.linebreak_off_desc_3; - b.appendChild(y); + a.end = function() { + this.scope.block = null; + }; + a.isEnd = function() { + return null === this.scope.block; + }; +})(Entry.Executor.prototype); +Entry.Scope = function(a, b) { + this.type = (this.block = a) ? a.type : null; + this.executor = b; + this.entity = b.entity; }; -Entry.Playground.prototype.generateSoundView = function(b) { - if ("workspace" == Entry.type) { - var a = Entry.createElement("div", "entryAddSound"); - a.addClass("entryPlaygroundAddSound"); - a.bindOnClick(function(a) { - Entry.dispatchEvent("openSoundManager"); +(function(a) { + a.callReturn = function() { + }; + a.getParam = function(a) { + a = this.block.params[a]; + var c = new Entry.Scope(a, this.executor); + return Entry.block[a.type].func.call(c, this.entity, c); + }; + a.getParams = function() { + var a = this; + return this.block.params.map(function(c) { + if (c instanceof Entry.Block) { + var d = new Entry.Scope(c, a.executor); + return Entry.block[c.type].func.call(d, a.entity, d); + } + return c; }); - var c = Entry.createElement("div", "entryAddSoundInner"); - c.addClass("entryPlaygroundAddSoundInner"); - c.innerHTML = Lang.Workspace.sound_add; - a.appendChild(c); - b.appendChild(a); - a = Entry.createElement("ul", "entrySoundList"); - a.addClass("entryPlaygroundSoundList"); - $ && $(a).sortable({start:function(a, b) { - b.item.data("start_pos", b.item.index()); - }, stop:function(a, b) { - var c = b.item.data("start_pos"), g = b.item.index(); - Entry.playground.moveSound(c, g); - }, axis:"y"}); - b.appendChild(a); - this.soundListView_ = a; - } else { - "phone" == Entry.type && (a = Entry.createElement("div", "entryAddSound"), a.addClass("entryPlaygroundAddSoundPhone"), a.bindOnClick(function(a) { - Entry.dispatchEvent("openSoundManager"); - }), c = Entry.createElement("div", "entryAddSoundInner"), c.addClass("entryPlaygroundAddSoundInnerPhone"), c.innerHTML = Lang.Workspace.sound_add, a.appendChild(c), b.appendChild(a), a = Entry.createElement("ul", "entrySoundList"), a.addClass("entryPlaygroundSoundListPhone"), $ && $(a).sortable({start:function(a, b) { - b.item.data("start_pos", b.item.index()); - }, stop:function(a, b) { - var c = b.item.data("start_pos"), g = b.item.index(); - Entry.playground.moveSound(c, g); - }, axis:"y"}), b.appendChild(a), this.soundListView_ = a); - } + }; + a.getValue = function(a, c) { + a = this.block.params[this._getParamIndex(a, c)]; + c = new Entry.Scope(a, this.executor); + return Entry.block[a.type].func.call(c, this.entity, c); + }; + a.getStringValue = function(a, c) { + return String(this.getValue(a, c)); + }; + a.getNumberValue = function(a, c) { + return Number(this.getValue(a)); + }; + a.getBooleanValue = function(a, c) { + return Number(this.getValue(a, c)) ? !0 : !1; + }; + a.getField = function(a, c) { + return this.block.params[this._getParamIndex(a)]; + }; + a.getStringField = function(a, c) { + return String(this.getField(a)); + }; + a.getNumberField = function(a) { + return Number(this.getField(a)); + }; + a.getStatement = function(a, c) { + return this.executor.stepInto(this.block.statements[this._getStatementIndex(a, c)]); + }; + a._getParamIndex = function(a) { + this._schema || (this._schema = Entry.block[this.type]); + return this._schema.paramsKeyMap[a]; + }; + a._getStatementIndex = function(a) { + this._schema || (this._schema = Entry.block[this.type]); + return this._schema.statementsKeyMap[a]; + }; + a.die = function() { + this.block = null; + return Entry.STATIC.BREAK; + }; +})(Entry.Scope.prototype); +Entry.FieldAngle = function(a, b, c) { + this._block = b.block; + this._blockView = b; + this.box = new Entry.BoxModel; + this.svgGroup = null; + this.position = a.position; + this._contents = a; + this._index = c; + a = this.getValue(); + this.setValue(this.modValue(void 0 !== a ? a : 90)); + this._CONTENT_HEIGHT = this.getContentHeight(); + this.renderStart(); }; -Entry.Playground.prototype.injectObject = function(b) { - if (!b) { - this.changeViewMode("code"), this.object = null; - } else { - if (b !== this.object) { - this.object && this.object.toggleInformation(!1); - this.object = b; - this.setMenu(b.objectType); - this.injectCode(); - "sprite" == b.objectType && Entry.pictureEditable ? (this.tabViewElements.text && this.tabViewElements.text.addClass("entryRemove"), this.tabViewElements.picture && this.tabViewElements.picture.removeClass("entryRemove")) : "textBox" == b.objectType && (this.tabViewElements.picture && this.tabViewElements.picture.addClass("entryRemove"), this.tabViewElements.text && this.tabViewElements.text.removeClass("entryRemove")); - var a = this.viewMode_; - "default" == a ? this.changeViewMode("code") : "picture" != a && "text" != a || "textBox" != b.objectType ? "text" != a && "picture" != a || "sprite" != b.objectType ? "sound" == a && this.changeViewMode("sound") : this.changeViewMode("picture") : this.changeViewMode("text"); - this.reloadPlayground(); +Entry.Utils.inherit(Entry.Field, Entry.FieldAngle); +(function(a) { + a.renderStart = function() { + this.svgGroup && $(this.svgGroup).remove(); + this.svgGroup = this._blockView.contentSvgGroup.elem("g", {class:"entry-input-field"}); + this.textElement = this.svgGroup.elem("text", {x:4, y:4, "font-size":"11px"}); + this.textElement.textContent = this.getText(); + var a = this.getTextWidth(), c = this._CONTENT_HEIGHT; + this._header = this.svgGroup.elem("rect", {x:0, y:(this.position && this.position.y ? this.position.y : 0) - c / 2, rx:3, ry:3, width:a, height:c, rx:3, ry:3, fill:"#fff", "fill-opacity":.4}); + this.svgGroup.appendChild(this.textElement); + this._bindRenderOptions(); + this.box.set({x:0, y:0, width:a, height:c}); + }; + a.renderOptions = function() { + var a = this; + this._attachDisposeEvent(function() { + a.applyValue(); + a.destroyOption(); + }); + this.optionGroup = Entry.Dom("input", {class:"entry-widget-input-field", parent:$("body")}); + this.optionGroup.val(this.value); + this.optionGroup.on("mousedown touchstart", function(a) { + a.stopPropagation(); + }); + this.optionGroup.on("keyup", function(c) { + var e = c.keyCode || c.which; + a.applyValue(c); + -1 < [13, 27].indexOf(e) && a.destroyOption(); + }); + var c = this.getAbsolutePosFromDocument(); + c.y -= this.box.height / 2; + this.optionGroup.css({height:this._CONTENT_HEIGHT, left:c.x, top:c.y, width:a.box.width}); + this.svgOptionGroup = this.appendSvgOptionGroup(); + this.svgOptionGroup.elem("circle", {x:0, y:0, r:49, class:"entry-field-angle-circle"}); + $(this.svgOptionGroup).on("mousedown touchstart", function(c) { + c.stopPropagation(); + a._updateByCoord(c); + }); + this._dividerGroup = this.svgOptionGroup.elem("g"); + for (c = 0;360 > c;c += 15) { + this._dividerGroup.elem("line", {x1:49, y1:0, x2:49 - (0 === c % 45 ? 10 : 5), y2:0, transform:"rotate(" + c + ", 0, 0)", class:"entry-angle-divider"}); + } + c = this.getAbsolutePosFromBoard(); + c.x += this.box.width / 2; + c.y = c.y + this.box.height / 2 + 49 + 1; + this.svgOptionGroup.attr({class:"entry-field-angle", transform:"translate(" + c.x + "," + c.y + ")"}); + $(this.svgOptionGroup).bind("mousemove touchmove", this._updateByCoord.bind(this)); + $(this.svgOptionGroup).bind("mouseup touchend", this.destroyOption.bind(this)); + this.updateGraph(); + this.optionGroup.focus(); + this.optionGroup.select(); + }; + a._updateByCoord = function(a) { + a.originalEvent && a.originalEvent.touches && (a = a.originalEvent.touches[0]); + a = [a.clientX, a.clientY]; + var c = this.getAbsolutePosFromDocument(); + this.optionGroup.val(this.modValue(function(a, b) { + var c = b[0] - a[0]; + a = b[1] - a[1] - 49 - 1; + b = Math.atan(-a / c); + b = Entry.toDegrees(b); + b = 90 - b; + 0 > c ? b += 180 : 0 < a && (b += 360); + return 15 * Math.round(b / 15); + }([c.x + this.box.width / 2, c.y + this.box.height / 2 + 1], a))); + this.applyValue(); + }; + a.updateGraph = function() { + this._fillPath && this._fillPath.remove(); + var a = Entry.toRadian(this.getValue()), c = 49 * Math.sin(a), d = -49 * Math.cos(a), a = a > Math.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", c).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:c, y2:d}); + this._indicator.attr({class:"entry-angle-indicator"}); + }; + a.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()); + }; + a.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(); + }; + a.getTextWidth = function() { + return this.textElement ? this.textElement.getComputedTextLength() + 8 : 8; + }; + a.getText = function() { + return this.getValue() + "\u00b0"; + }; + a.modValue = function(a) { + return a % 360; + }; + a.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.FieldColor = function(a, b, c) { + this._block = b.block; + this._blockView = b; + this.box = new Entry.BoxModel; + this.svgGroup = null; + this._contents = a; + this._index = c; + this._position = a.position; + this.key = a.key; + this.setValue(this.getValue() || "#FF0000"); + this._CONTENT_HEIGHT = this.getContentHeight(); + this._CONTENT_WIDTH = this.getContentWidth(); + this.renderStart(b); +}; +Entry.Utils.inherit(Entry.Field, Entry.FieldColor); +(function(a) { + a.renderStart = function() { + this.svgGroup && $(this.svgGroup).remove(); + this.svgGroup = this._blockView.contentSvgGroup.elem("g", {class:"entry-field-color"}); + var a = this._CONTENT_HEIGHT, c = this._CONTENT_WIDTH, d = this._position, e; + d ? (e = d.x || 0, d = d.y || 0) : (e = 0, d = -a / 2); + this._header = this.svgGroup.elem("rect", {x:e, y:d, width:c, height:a, fill:this.getValue()}); + this._bindRenderOptions(); + this.box.set({x:e, y:d, width:c, height:a}); + }; + a.renderOptions = function() { + var a = this; + this._attachDisposeEvent(); + var c = Entry.FieldColor.getWidgetColorList(); + this.optionGroup = Entry.Dom("table", {class:"entry-widget-color-table", parent:$("body")}); + for (var d = 0;d < c.length;d++) { + for (var e = Entry.Dom("tr", {class:"entry-widget-color-row", parent:this.optionGroup}), f = 0;f < c[d].length;f++) { + var g = Entry.Dom("td", {class:"entry-widget-color-cell", parent:e}), h = c[d][f]; + g.css({"background-color":h}); + g.attr({"data-color-value":h}); + (function(c, d) { + c.mousedown(function(a) { + a.stopPropagation(); + }); + c.mouseup(function(c) { + a.applyValue(d); + a.destroyOption(); + a._selectBlockView(); + }); + })(g, h); + } + } + c = this.getAbsolutePosFromDocument(); + c.y += this.box.height / 2 + 1; + this.optionGroup.css({left:c.x, top:c.y}); + }; + a.applyValue = function(a) { + this.value != a && (this.setValue(a), this._header.attr({fill:a})); + }; + a.getContentWidth = function() { + return Entry.isMobile() ? 20 : 14.5; + }; +})(Entry.FieldColor.prototype); +Entry.FieldColor.getWidgetColorList = function() { + return ["#FFFFFF #CCCCCC #C0C0C0 #999999 #666666 #333333 #000000".split(" "), "#FFCCCC #FF6666 #FF0000 #CC0000 #990000 #660000 #330000".split(" "), "#FFCC99 #FF9966 #FF9900 #FF6600 #CC6600 #993300 #663300".split(" "), "#FFFF99 #FFFF66 #FFCC66 #FFCC33 #CC9933 #996633 #663333".split(" "), "#FFFFCC #FFFF33 #FFFF00 #FFCC00 #999900 #666600 #333300".split(" "), "#99FF99 #66FF99 #33FF33 #33CC00 #009900 #006600 #003300".split(" "), "#99FFFF #33FFFF #66CCCC #00CCCC #339999 #336666 #003333".split(" "), "#CCFFFF #66FFFF #33CCFF #3366FF #3333FF #000099 #000066".split(" "), + "#CCCCFF #9999FF #6666CC #6633FF #6609CC #333399 #330099".split(" "), "#FFCCFF #FF99FF #CC66CC #CC33CC #993399 #663366 #330033".split(" ")]; +}; +Entry.FieldDropdown = function(a, b, c) { + this._block = b.block; + this._blockView = b; + this.box = new Entry.BoxModel; + this.svgGroup = null; + this._contents = a; + this._noArrow = a.noArrow; + this._arrowColor = a.arrowColor; + this._index = c; + this.setValue(this.getValue()); + this._CONTENT_HEIGHT = this.getContentHeight(a.dropdownHeight); + this._FONT_SIZE = this.getFontSize(a.fontSize); + this._ROUND = a.roundValue || 3; + this.renderStart(); +}; +Entry.Utils.inherit(Entry.Field, Entry.FieldDropdown); +(function(a) { + a.renderStart = function() { + this.svgGroup && $(this.svgGroup).remove(); + this instanceof Entry.FieldDropdownDynamic && this._updateValue(); + var a = this._blockView, c = Entry.isMobile(), d = c ? 33 : 20, c = c ? 24 : 10; + this.svgGroup = a.contentSvgGroup.elem("g", {class:"entry-field-dropdown"}); + this.textElement = this.svgGroup.elem("text", {x:5}); + this.textElement.textContent = this.getTextByValue(this.getValue()); + a = this.textElement.getBBox(); + this.textElement.attr({style:"white-space: pre;", "font-size":+this._FONT_SIZE + "px", y:.23 * a.height}); + d = this.textElement.getComputedTextLength() + d; + this._noArrow && (d -= c); + c = this._CONTENT_HEIGHT; + this._header = this.svgGroup.elem("rect", {width:d, height:c, y:-c / 2, rx:this._ROUND, ry:this._ROUND, fill:"#fff", "fill-opacity":.4}); + this.svgGroup.appendChild(this.textElement); + this._noArrow || (a = this.getArrow(), this._arrow = this.svgGroup.elem("polygon", {points:a.points, fill:a.color, stroke:a.color, transform:"translate(" + (d - a.width - 5) + "," + -a.height / 2 + ")"})); + this._bindRenderOptions(); + this.box.set({x:0, y:0, width:d, height:c}); + }; + a.resize = function() { + var a = Entry.isMobile(), c = a ? 33 : 20, a = a ? 24 : 10, c = this.textElement.getComputedTextLength() + c; + this._noArrow ? c -= a : (a = this.getArrow(), this._arrow.attr({transform:"translate(" + (c - a.width - 5) + "," + -a.height / 2 + ")"})); + this._header.attr({width:c}); + this.box.set({width:c}); + this._block.view.alignContent(); + }; + a.renderOptions = function() { + var a = this; + this._attachDisposeEvent(); + this.optionGroup = Entry.Dom("ul", {class:"entry-widget-dropdown", parent:$("body")}); + this.optionGroup.bind("mousedown touchstart", function(a) { + a.stopPropagation(); + }); + for (var c = this._contents.options, c = this._contents.options, d = 0, e = c.length;d < e;d++) { + var f = c[d], g = f[0], f = f[1], h = Entry.Dom("li", {class:"rect", parent:this.optionGroup}), k = Entry.Dom("span", {class:"left", parent:h}); + Entry.Dom("span", {class:"right", parent:h}).text(g); + this.getValue() == f && k.text("\u2713"); + (function(c, d) { + c.bind("mousedown touchstart", function(a) { + a.stopPropagation(); + }); + c.bind("mouseup touchend", function(c) { + c.stopPropagation(); + a.applyValue(d); + a.destroyOption(); + a._selectBlockView(); + }); + })(h, f); } - } -}; -Entry.Playground.prototype.injectCode = function() { - var b = this.mainWorkspace; - b.changeBoardCode(this.object.script); - b.getBoard().adjustThreadsPosition(); -}; -Entry.Playground.prototype.injectPicture = function() { - var b = this.pictureListView_; - if (b) { - for (;b.hasChildNodes();) { - b.removeChild(b.lastChild); + this._position(); + }; + a._position = function() { + var a = this.getAbsolutePosFromDocument(); + a.y += this.box.height / 2; + var c = $(document).height(), d = this.optionGroup.height(), e = this.optionGroup.width() + 30; + if (c < a.y + d + 30) { + var c = this._blockView.getBoard().svgDom.height(), f = this.getAbsolutePosFromBoard(); + this._blockView.y < c / 2 ? (a.x += this.box.width / 2 - e / 2, c -= f.y + 30, this.optionGroup.height(c)) : (a.x += this.box.width + 1, c -= c - f.y, c - 30 < d && this.optionGroup.height(c - c % 30), a.y -= this.optionGroup.height()); + } else { + a.x += this.box.width / 2 - e / 2; } - if (this.object) { - for (var a = this.object.pictures, c = 0, d = a.length;c < d;c++) { - var e = a[c].view; - e || console.log(e); - e.orderHolder.innerHTML = c + 1; - b.appendChild(e); + this.optionGroup.addClass("rendered"); + this.optionGroup.css({left:a.x, top:a.y, width:e}); + this.optionGroup.find(".right").width(e - 20); + }; + a.applyValue = function(a) { + this.value != a && this.setValue(a); + this.textElement.textContent = this.getTextByValue(a); + this.resize(); + }; + a.getTextByValue = function(a) { + if (!a || "null" === a) { + return Lang.Blocks.no_target; + } + for (var c = this._contents.options, d = 0, e = c.length;d < e;d++) { + var f = c[d]; + if (f[1] == a) { + return f[0]; } - this.selectPicture(this.object.selectedPicture); - } else { - Entry.dispatchEvent("pictureClear"); } - } -}; -Entry.Playground.prototype.addPicture = function(b, a) { - var c = Entry.cloneSimpleObject(b); - delete c.id; - delete c.view; - b = JSON.parse(JSON.stringify(c)); - b.id = Entry.generateHash(); - b.name = Entry.getOrderedName(b.name, this.object.pictures); - this.generatePictureElement(b); - this.object.addPicture(b); - this.injectPicture(); - this.selectPicture(b); + return Lang.Blocks.no_target; + }; + a.getContentHeight = function(a) { + return a = a || this._blockView.getSkeleton().dropdownHeight || (Entry.isMobile() ? 22 : 16); + }; + a.getArrow = function() { + var a = Entry.isMobile(); + return {color:this._arrowColor || this._blockView._schema.color, points:a ? "0,0 19,0 9.5,13" : "0,0 6.4,0 3.2,4.2", height:a ? 13 : 4.2, width:a ? 19 : 6.4}; + }; +})(Entry.FieldDropdown.prototype); +Entry.FieldDropdownDynamic = function(a, b, c) { + this._block = b.block; + this._blockView = b; + this.box = new Entry.BoxModel; + this.svgGroup = null; + this._contents = a; + this._index = c; + this._arrowColor = a.arrowColor; + c = this._contents.menuName; + Entry.Utils.isFunction(c) ? this._menuGenerator = c : this._menuName = c; + this._CONTENT_HEIGHT = this.getContentHeight(a.dropdownHeight); + this._FONT_SIZE = this.getFontSize(a.fontSize); + this._ROUND = a.roundValue || 3; + this.renderStart(b); }; -Entry.Playground.prototype.setPicture = function(b) { - var a = Entry.container.getPictureElement(b.id, b.objectId), c = $(a); - if (a) { - b.view = a; - a.picture = b; - a = c.find("#t_" + b.id)[0]; - if (b.fileurl) { - a.style.backgroundImage = 'url("' + b.fileurl + '")'; - } else { - var d = b.filename; - a.style.backgroundImage = 'url("' + Entry.defaultPath + "/uploads/" + d.substring(0, 2) + "/" + d.substring(2, 4) + "/thumb/" + d + '.png")'; +Entry.Utils.inherit(Entry.FieldDropdown, Entry.FieldDropdownDynamic); +(function(a) { + a.constructor = Entry.FieldDropDownDynamic; + a._updateValue = function() { + var a = this._block.getCode().object, c = []; + Entry.container && (c = this._menuName ? Entry.container.getDropdownList(this._menuName, a) : this._menuGenerator()); + this._contents.options = c; + a = this.getValue(); + if (this._blockView.isInBlockMenu || !a || "null" == a) { + a = 0 !== c.length ? c[0][1] : null; } - c.find("#s_" + b.id)[0].innerHTML = b.dimension.width + " X " + b.dimension.height; - } - Entry.container.setPicture(b); + this.setValue(a); + }; + a.renderOptions = function() { + var a = this; + this._attachDisposeEvent(); + this.optionGroup = Entry.Dom("ul", {class:"entry-widget-dropdown", parent:$("body")}); + this.optionGroup.bind("mousedown touchstart", function(a) { + a.stopPropagation(); + }); + var c; + c = this._menuName ? Entry.container.getDropdownList(this._contents.menuName) : this._menuGenerator(); + this._contents.options = c; + for (var d = 0;d < c.length;d++) { + var e = c[d], f = e[0], e = e[1], g = Entry.Dom("li", {class:"rect", parent:this.optionGroup}), h = Entry.Dom("span", {class:"left", parent:g}); + Entry.Dom("span", {class:"right", parent:g}).text(f); + this.getValue() == e && h.text("\u2713"); + (function(c, d) { + c.mousedown(function(a) { + a.stopPropagation(); + }); + c.mouseup(function(c) { + c.stopPropagation(); + a.applyValue(d); + a.destroyOption(); + a._selectBlockView(); + }); + })(g, e); + } + this._position(); + }; +})(Entry.FieldDropdownDynamic.prototype); +Entry.FieldImage = function(a, b, c) { + this._block = b.block; + this._blockView = b; + this._content = a; + this.box = new Entry.BoxModel; + this._size = a.size; + this._highlightColor = a.highlightColor ? a.highlightColor : "#F59900"; + this._position = a.position; + this._imgElement = this._path = this.svgGroup = null; + this._index = c; + this.setValue(null); + this.renderStart(); }; -Entry.Playground.prototype.clonePicture = function(b) { - b = Entry.playground.object.getPicture(b); - this.addPicture(b, !0); +Entry.Utils.inherit(Entry.Field, Entry.FieldImage); +(function(a) { + a.renderStart = function() { + this.svgGroup && this.svgGroup.remove(); + this._imgUrl = this._block.deletable === Entry.Block.DELETABLE_FALSE_LIGHTEN ? this._content.img.replace(".png", "_un.png") : this._content.img; + this.svgGroup = this._blockView.contentSvgGroup.elem("g"); + this._imgElement = this.svgGroup.elem("image", {href:this._imgUrl, x:0, y:-.5 * this._size, width:this._size, height:this._size}); + this.box.set({x:this._size, y:0, width:this._size, height:this._size}); + }; +})(Entry.FieldImage.prototype); +Entry.FieldIndicator = function(a, b, c) { + this._block = b.block; + this._blockView = b; + this.box = new Entry.BoxModel; + this._size = a.size; + this._imgUrl = this._block.deletable === Entry.Block.DELETABLE_FALSE_LIGHTEN ? a.img.replace(".png", "_un.png") : a.img; + this._boxMultiplier = a.boxMultiplier || 2; + this._highlightColor = a.highlightColor ? a.highlightColor : "#F59900"; + this._position = a.position; + this._index = c; + this._imgElement = this._path = this.svgGroup = null; + this.setValue(null); + this.renderStart(); }; -Entry.Playground.prototype.selectPicture = function(b) { - for (var a = this.object.pictures, c = 0, d = a.length;c < d;c++) { - var e = a[c]; - e.id === b.id ? e.view.addClass("entryPictureSelected") : e.view.removeClass("entryPictureSelected"); - } - var f; - b && b.id && (f = Entry.container.selectPicture(b.id, b.objectId)); - this.object.id === f && Entry.dispatchEvent("pictureSelected", b); +Entry.Utils.inherit(Entry.Field, Entry.FieldIndicator); +(function(a) { + a.renderStart = function() { + this.svgGroup && this.svgGroup.remove(); + this.svgGroup = this._blockView.contentSvgGroup.elem("g"); + this._imgElement = this.svgGroup.elem("image", {href:Entry.mediaFilePath + this._imgUrl, x:this._position ? -1 * this._size : 0, y:-1 * this._size, width:2 * this._size, height:2 * this._size}); + var a = "m 0,-%s a %s,%s 0 1,1 -0.1,0 z".replace(/%s/gi, this._size); + this._path = this.svgGroup.elem("path", {d:a, stroke:"none", fill:"none"}); + this.box.set({width:this._size * this._boxMultiplier + (this._position ? -this._size : 0), height:this._size * this._boxMultiplier}); + }; + a.enableHighlight = function() { + var a = this._path.getTotalLength(), c = this._path; + this._path.attr({stroke:this._highlightColor, strokeWidth:2, "stroke-linecap":"round", "stroke-dasharray":a + " " + a, "stroke-dashoffset":a}); + setInterval(function() { + c.attr({"stroke-dashoffset":a}).animate({"stroke-dashoffset":0}, 300); + }, 1400, mina.easeout); + setTimeout(function() { + setInterval(function() { + c.animate({"stroke-dashoffset":-a}, 300); + }, 1400, mina.easeout); + }, 500); + }; +})(Entry.FieldIndicator.prototype); +Entry.Keyboard = {}; +Entry.FieldKeyboard = function(a, b, c) { + this._block = b.block; + this._blockView = b; + this.box = new Entry.BoxModel; + this.svgGroup = null; + this.position = a.position; + this._contents = a; + this._index = c; + this.setValue(String(this.getValue())); + this._CONTENT_HEIGHT = this.getContentHeight(); + this._optionVisible = !1; + this.renderStart(b); }; -Entry.Playground.prototype.movePicture = function(b, a) { - this.object.pictures.splice(a, 0, this.object.pictures.splice(b, 1)[0]); - this.injectPicture(); - Entry.stage.sortZorder(); +Entry.Utils.inherit(Entry.Field, Entry.FieldKeyboard); +(function(a) { + a.renderStart = function() { + this.svgGroup && $(this.svgGroup).remove(); + this.svgGroup = this._blockView.contentSvgGroup.elem("g", {class:"entry-input-field"}); + this.textElement = this.svgGroup.elem("text").attr({x:5, y:4, "font-size":"11px"}); + this.textElement.textContent = Entry.getKeyCodeMap()[this.getValue()]; + var a = this.getTextWidth() + 1, c = this._CONTENT_HEIGHT; + this._header = this.svgGroup.elem("rect", {x:0, y:(this.position && this.position.y ? this.position.y : 0) - c / 2, width:a, height:c, rx:3, ry:3, fill:"#fff", "fill-opacity":.4}); + this.svgGroup.appendChild(this.textElement); + this._bindRenderOptions(); + this.box.set({x:0, y:0, width:a, height:c}); + }; + a.renderOptions = function() { + Entry.keyPressed && (this.keyPressed = Entry.keyPressed.attach(this, this._keyboardControl)); + this._optionVisible = !0; + this._attachDisposeEvent(); + var a = this.getAbsolutePosFromDocument(); + a.x -= this.box.width / 2; + a.y += this.box.height / 2 + 1; + this.optionGroup = Entry.Dom("img", {class:"entry-widget-keyboard-input", src:Entry.mediaFilePath + "/media/keyboard_workspace.png", parent:$("body")}); + this.optionGroup.css({left:a.x, top:a.y}); + }; + a.destroyOption = function() { + this.disposeEvent && (Entry.disposeEvent.detach(this.disposeEvent), delete this.disposeEvent); + this.optionGroup && (this.optionGroup.remove(), delete this.optionGroup); + this._optionVisible = !1; + this.command(); + this.keyPressed && (Entry.keyPressed.detach(this.keyPressed), delete this.keyPressed); + }; + a._keyboardControl = function(a) { + a.stopPropagation(); + if (this._optionVisible) { + a = a.keyCode; + var c = Entry.getKeyCodeMap()[a]; + void 0 !== c && this.applyValue(c, a); + } + }; + a.applyValue = function(a, c) { + this.setValue(String(c)); + this.destroyOption(); + this.textElement.textContent = a; + this.resize(); + }; + a.resize = function() { + var a = this.getTextWidth() + 1; + this._header.attr({width:a}); + this.box.set({width:a}); + this._blockView.alignContent(); + }; + a.getTextWidth = function() { + return this.textElement.getComputedTextLength() + 10; + }; + a.destroy = function() { + this.destroyOption(); + Entry.keyPressed && this.keyPressed && Entry.keyPressed.detach(this.keyPressed); + }; +})(Entry.FieldKeyboard.prototype); +Entry.FieldLineBreak = function(a, b, c) { + this._block = b.block; + this._blockView = b; + this._index = c; + this.box = new Entry.BoxModel; + this.setValue(null); + this.renderStart(); }; -Entry.Playground.prototype.injectText = function() { - if (Entry.playground.object) { - Entry.playground.textEditInput.value = Entry.playground.object.entity.getText(); - Entry.playground.textEditArea.value = Entry.playground.object.entity.getText(); - Entry.playground.fontName_.value = Entry.playground.object.entity.getFontName(); - if (Entry.playground.object.entity.font) { - var b = -1 < Entry.playground.object.entity.font.indexOf("bold") || !1; - $("#entryPlaygroundText_boldImage").attr("src", Entry.mediaFilePath + "text_button_bold_" + b + ".png"); - b = -1 < Entry.playground.object.entity.font.indexOf("italic") || !1; - $("#entryPlaygroundText_italicImage").attr("src", Entry.mediaFilePath + "text_button_italic_" + b + ".png"); - } - b = Entry.playground.object.entity.getUnderLine() || !1; - $("#entryPlaygroundText_underlineImage").attr("src", Entry.mediaFilePath + "text_button_underline_" + b + ".png"); - b = Entry.playground.object.entity.getStrike() || !1; - $("#entryPlaygroundText_strikeImage").attr("src", Entry.mediaFilePath + "text_button_strike_" + b + ".png"); - $(".entryPlayground_fgColorDiv").css("backgroundColor", Entry.playground.object.entity.colour); - $(".entryPlayground_bgColorDiv").css("backgroundColor", Entry.playground.object.entity.bgColour); - Entry.playground.toggleLineBreak(Entry.playground.object.entity.getLineBreak()); - Entry.playground.object.entity.getLineBreak() && ($(".entryPlaygroundLinebreakDescription > p").html(Lang.Menus.linebreak_on_desc_1), $(".entryPlaygroundLinebreakDescription > ul > li").eq(0).html(Lang.Menus.linebreak_on_desc_2), $(".entryPlaygroundLinebreakDescription > ul > li").eq(1).html(Lang.Menus.linebreak_on_desc_3)); - Entry.playground.setFontAlign(Entry.playground.object.entity.getTextAlign()); - b = Entry.playground.object.entity.getFontSize(); - Entry.playground.fontSizeIndiciator.style.width = b + "%"; - Entry.playground.fontSizeKnob.style.left = .88 * b + "px"; - } +Entry.Utils.inherit(Entry.Field, Entry.FieldLineBreak); +(function(a) { + a.renderStart = function() { + }; + a.align = function(a) { + var c = this._blockView; + 0 !== c._statements.length && this.box.set({y:(c._statements[a].height || 20) + Math.max(c.contentHeight % 1E3, 30)}); + }; +})(Entry.FieldLineBreak.prototype); +Entry.FieldOutput = function(a, b, c, d, e) { + Entry.Model(this, !1); + this._blockView = b; + this._block = b.block; + this._valueBlock = null; + this.box = new Entry.BoxModel; + this.changeEvent = new Entry.Event(this); + this._index = c; + this.contentIndex = e; + this._content = a; + this.acceptType = a.accept; + this.view = this; + this.svgGroup = null; + this._position = a.position; + this.box.observe(b, "alignContent", ["width", "height"]); + this.observe(this, "_updateBG", ["magneting"], !1); + this.renderStart(b.getBoard(), d); +}; +Entry.Utils.inherit(Entry.Field, Entry.FieldOutput); +(function(a) { + a.schema = {magneting:!1}; + a.renderStart = function(a, c) { + 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, c)); + this._updateValueBlock(d); + this._blockView.getBoard().constructor == Entry.BlockMenu && this._valueBlock && this._valueBlock.view.removeControl(); + }; + a.align = function(a, c, d) { + var e = this.svgGroup; + this._position && (this._position.x && (a = this._position.x), this._position.y && (c = this._position.y)); + var f = this._valueBlock; + f && (c = -.5 * f.view.height); + f = "translate(" + a + "," + c + ")"; + void 0 === d || d ? e.animate({transform:f}, 300, mina.easeinout) : e.attr({transform:f}); + this.box.set({x:a, y:c}); + }; + a.calcWH = function() { + var a = this._valueBlock; + a ? (a = a.view, this.box.set({width:a.width, height:a.height})) : this.box.set({width:0, height:20}); + }; + a.calcHeight = a.calcWH; + a.destroy = function() { + }; + a._inspectBlock = function() { + }; + a._setValueBlock = function(a) { + if (a != this._valueBlock || !this._valueBlock) { + return this._valueBlock = a, this.setValue(a), a && a.setThread(this), this._valueBlock; + } + }; + a._updateValueBlock = function(a) { + a instanceof Entry.Block || (a = void 0); + this._sizeObserver && this._sizeObserver.destroy(); + this._posObserver && this._posObserver.destroy(); + (a = this._setValueBlock(a)) ? (a = a.view, a.bindPrev(), this._posObserver = a.observe(this, "_updateValueBlock", ["x", "y"], !1), this._sizeObserver = a.observe(this, "calcWH", ["width", "height"])) : this.calcWH(); + this._blockView.alignContent(); + a = this._blockView.getBoard(); + a.constructor === Entry.Board && a.generateCodeMagnetMap(); + }; + a.getPrevBlock = function(a) { + return this._valueBlock === a ? this : null; + }; + a.getNextBlock = function() { + return null; + }; + a.requestAbsoluteCoordinate = function(a) { + a = this._blockView; + var c = a.contentPos; + a = a.getAbsoluteCoordinate(); + a.x += this.box.x + c.x; + a.y += this.box.y + c.y; + return a; + }; + a.dominate = function() { + this._blockView.dominate(); + }; + a.isGlobal = function() { + return !1; + }; + a.separate = function(a) { + this.getCode().createThread([a]); + this.changeEvent.notify(); + }; + a.getCode = function() { + return this._block.thread.getCode(); + }; + a.cut = function(a) { + return this._valueBlock === a ? (delete this._valueBlock, [a]) : null; + }; + a._updateBG = function() { + this.magneting ? this._bg = this.svgGroup.elem("path", {d:"m -4,-12 h 3 l 2,2 0,3 3,0 1,1 0,12 -1,1 -3,0 0,3 -2,2 h -3 ", fill:"#fff", stroke:"#fff", "fill-opacity":.7, transform:"translate(0," + (this._valueBlock ? 12 : 0) + ")"}) : this._bg && (this._bg.remove(), delete this._bg); + }; + a.replace = function(a) { + var c = this._valueBlock; + c && (c.view._toGlobalCoordinate(), a.getTerminateOutputBlock().view._contents[1].replace(c)); + this._updateValueBlock(a); + a.view._toLocalCoordinate(this.svgGroup); + this.calcWH(); + }; + a.setParent = function(a) { + this._parent = a; + }; + a.getParent = function() { + return this._parent; + }; + a.getThread = function() { + return this; + }; + a.getValueBlock = function() { + return this._valueBlock; + }; + a.pointer = function(a) { + a.unshift(this._index); + a.unshift(Entry.PARAM); + return this._block.pointer(a); + }; +})(Entry.FieldOutput.prototype); +Entry.FieldStatement = function(a, b, c) { + Entry.Model(this, !1); + this._blockView = b; + this.block = b.block; + this.view = this; + this._index = c; + this.acceptType = a.accept; + this._thread = this.statementSvgGroup = this.svgGroup = null; + this._position = a.position; + this.observe(b, "alignContent", ["height"], !1); + this.observe(this, "_updateBG", ["magneting"], !1); + this.renderStart(b.getBoard()); }; -Entry.Playground.prototype.injectSound = function() { - var b = this.soundListView_; - if (b) { - for (;b.hasChildNodes();) { - b.removeChild(b.lastChild); +(function(a) { + a.schema = {x:0, y:0, width:100, height:20, magneting:!1}; + a.magnet = {next:{x:0, y:0}}; + a.renderStart = function(a) { + this.svgGroup = this._blockView.statementSvgGroup.elem("g"); + this._nextGroup = this.statementSvgGroup = this.svgGroup.elem("g"); + this._initThread(a); + this._board = a; + }; + a._initThread = function(a) { + var c = this.getValue(); + this._thread = c; + c.createView(a); + c.view.setParent(this); + if (a = c.getFirstBlock()) { + a.view._toLocalCoordinate(this.statementSvgGroup), this.firstBlock = a; } - if (this.object) { - for (var a = this.object.sounds, c = 0, d = a.length;c < d;c++) { - var e = a[c].view; - e.orderHolder.innerHTML = c + 1; - b.appendChild(e); + c.changeEvent.attach(this, this.calcHeight); + c.changeEvent.attach(this, this.checkTopBlock); + this.calcHeight(); + }; + a.align = function(a, c, d) { + d = void 0 === d ? !0 : d; + var e = this.svgGroup; + this._position && (this._position.x && (a = this._position.x), this._position.y && (c = this._position.y)); + var f = "translate(" + a + "," + c + ")"; + this.set({x:a, y:c}); + d ? e.animate({transform:f}, 300, mina.easeinout) : e.attr({transform:f}); + }; + a.calcHeight = function() { + var a = this._thread.view.requestPartHeight(null); + this.set({height:a}); + }; + a.getValue = function() { + return this.block.statements[this._index]; + }; + a.requestAbsoluteCoordinate = function() { + var a = this._blockView.getAbsoluteCoordinate(); + a.x += this.x; + a.y += this.y; + return a; + }; + a.dominate = function() { + this._blockView.dominate(); + }; + a.destroy = function() { + }; + a._updateBG = function() { + if (this._board.dragBlock && this._board.dragBlock.dragInstance) { + if (this.magneting) { + var a = this._board.dragBlock.getShadow(), c = this.requestAbsoluteCoordinate(), c = "translate(" + c.x + "," + c.y + ")"; + $(a).attr({transform:c, display:"block"}); + this._clonedShadow = a; + this.background && (this.background.remove(), this.nextBackground.remove(), delete this.background, delete this.nextBackground); + a = this._board.dragBlock.getBelowHeight(); + this.statementSvgGroup.attr({transform:"translate(0," + a + ")"}); + this.set({height:this.height + a}); + } else { + this._clonedShadow && (this._clonedShadow.attr({display:"none"}), delete this._clonedShadow), a = this.originalHeight, void 0 !== a && (this.background && (this.background.remove(), this.nextBackground.remove(), delete this.background, delete this.nextBackground), delete this.originalHeight), this.statementSvgGroup.attr({transform:"translate(0,0)"}), this.calcHeight(); } + (a = this.block.thread.changeEvent) && a.notify(); } - } -}; -Entry.Playground.prototype.moveSound = function(b, a) { - this.object.sounds.splice(a, 0, this.object.sounds.splice(b, 1)[0]); - this.updateListViewOrder("sound"); - Entry.stage.sortZorder(); + }; + a.insertTopBlock = function(a) { + this._posObserver && this._posObserver.destroy(); + var c = this.firstBlock; + (this.firstBlock = a) && a.doInsert(this._thread); + return c; + }; + a.getNextBlock = function() { + return this.firstBlock; + }; + a.checkTopBlock = function() { + var a = this._thread.getFirstBlock(); + a && this.firstBlock !== a ? (this.firstBlock = a, a.view.bindPrev(this), a._updatePos()) : a || (this.firstBlock = null); + }; +})(Entry.FieldStatement.prototype); +Entry.FieldText = function(a, b, c) { + this._block = b.block; + this._blockView = b; + this._index = c; + this.box = new Entry.BoxModel; + this._fontSize = a.fontSize || b.getSkeleton().fontSize || 12; + this._color = a.color || this._block.getSchema().fontColor || b.getSkeleton().color || "white"; + this._align = a.align || "left"; + this._text = this.getValue() || a.text; + this.setValue(null); + this.textElement = null; + this.renderStart(b); }; -Entry.Playground.prototype.addSound = function(b, a) { - var c = Entry.cloneSimpleObject(b); - delete c.view; - delete c.id; - b = JSON.parse(JSON.stringify(c)); - b.id = Entry.generateHash(); - b.name = Entry.getOrderedName(b.name, this.object.sounds); - this.generateSoundElement(b); - this.object.addSound(b); - this.injectSound(); +Entry.Utils.inherit(Entry.Field, Entry.FieldText); +(function(a) { + a.renderStart = function() { + this.svgGroup && $(this.svgGroup).remove(); + this.svgGroup = this._blockView.contentSvgGroup.elem("g"); + this._text = this._text.replace(/(\r\n|\n|\r)/gm, " "); + this.textElement = this.svgGroup.elem("text").attr({style:"white-space: pre;", "font-size":this._fontSize + "px", "font-family":"nanumBarunRegular", "class":"dragNone", fill:this._color}); + this.textElement.textContent = this._text; + var a = 0, c = this.textElement.getBoundingClientRect(); + "center" == this._align && (a = -c.width / 2); + this.textElement.attr({x:a, y:.25 * c.height}); + this.box.set({x:0, y:0, width:c.width, height:c.height}); + }; +})(Entry.FieldText.prototype); +Entry.FieldTextInput = function(a, b, c) { + this._blockView = b; + this._block = b.block; + this.box = new Entry.BoxModel; + this.svgGroup = null; + this.position = a.position; + this._contents = a; + this._index = c; + this.value = this.getValue() || ""; + this._CONTENT_HEIGHT = this.getContentHeight(); + this.renderStart(); }; -Entry.Playground.prototype.changeViewMode = function(b) { - for (var a in this.tabViewElements) { - this.tabViewElements[a].removeClass("entryTabSelected"); - } - "default" != b && this.tabViewElements[b].addClass("entryTabSelected"); - if ("variable" != b) { - var c = this.view_.children; - for (a = 0;a < c.length;a++) { - var d = c[a]; - -1 < d.id.toUpperCase().indexOf(b.toUpperCase()) ? d.removeClass("entryRemove") : d.addClass("entryRemove"); +Entry.Utils.inherit(Entry.Field, Entry.FieldTextInput); +(function(a) { + a.renderStart = function() { + this.svgGroup && $(this.svgGroup).remove(); + this.svgGroup = this._blockView.contentSvgGroup.elem("g"); + this.svgGroup.attr({class:"entry-input-field"}); + this.textElement = this.svgGroup.elem("text", {x:3, y:4, "font-size":"12px"}); + this.textElement.textContent = this.truncate(); + var a = this.getTextWidth(), c = this._CONTENT_HEIGHT; + this._header = this.svgGroup.elem("rect", {width:a, height:c, y:(this.position && this.position.y ? this.position.y : 0) - c / 2, rx:3, ry:3, fill:"transparent"}); + this.svgGroup.appendChild(this.textElement); + this._bindRenderOptions(); + this.box.set({x:0, y:0, width:a, height:c}); + }; + a.renderOptions = function() { + var a = this; + this._attachDisposeEvent(function() { + a.applyValue(); + a.destroyOption(); + }); + this.optionGroup = Entry.Dom("input", {class:"entry-widget-input-field", parent:$("body")}); + this.optionGroup.val(this.getValue()); + this.optionGroup.on("mousedown", function(a) { + a.stopPropagation(); + }); + this.optionGroup.on("keyup", function(c) { + var e = c.keyCode || c.which; + a.applyValue(c); + -1 < [13, 27].indexOf(e) && a.destroyOption(); + }); + var c = this.getAbsolutePosFromDocument(); + c.y -= this.box.height / 2; + this.optionGroup.css({height:this._CONTENT_HEIGHT, left:c.x, top:c.y, width:a.box.width}); + this.optionGroup.focus(); + c = this.optionGroup[0]; + c.setSelectionRange(0, c.value.length, "backward"); + }; + a.applyValue = function(a) { + a = this.optionGroup.val(); + this.setValue(a); + this.textElement.textContent = this.truncate(); + this.resize(); + }; + a.resize = function() { + var a = this.getTextWidth(); + this._header.attr({width:a}); + this.optionGroup.css({width:a}); + this.box.set({width:a}); + this._blockView.alignContent(); + }; + a.getTextWidth = function() { + return this.textElement.getComputedTextLength() + 6 + 2; + }; +})(Entry.FieldTextInput.prototype); +Entry.GlobalSvg = {}; +(function(a) { + a.DONE = 0; + a._inited = !1; + a.REMOVE = 1; + a.RETURN = 2; + a.createDom = function() { + if (!this.inited) { + $("#globalSvgSurface").remove(); + $("#globalSvg").remove(); + var a = $("body"); + this._container = Entry.Dom("div", {classes:["globalSvgSurface", "entryRemove"], id:"globalSvgSurface", parent:a}); + this.svgDom = Entry.Dom($(''), {parent:this._container}); + this.svg = Entry.SVG("globalSvg"); + this.top = this.left = 0; + this._inited = !0; } - if ("picture" == b && (!this.pictureView_.object || this.pictureView_.object != this.object)) { - this.pictureView_.object = this.object, this.injectPicture(); - } else { - if ("sound" == b && (!this.soundView_.object || this.soundView_.object != this.object)) { - this.soundView_.object = this.object, this.injectSound(); - } else { - if ("text" == b && "textBox" == this.object.objectType || this.textView_.object != this.object) { - this.textView_.object = this.object, this.injectText(); - } - } + }; + a.setView = function(a, c) { + if (a != this._view && !a.block.isReadOnly() && a.movable) { + return this._view = a, this._mode = c, c !== Entry.Workspace.MODE_VIMBOARD && a.set({visible:!1}), this.draw(), this.show(), this.align(), this.position(), !0; } - "code" == b && this.resizeHandle_ && this.resizeHandle_.removeClass("entryRemove"); - Entry.engine.isState("run") && this.curtainView_.removeClass("entryRemove"); - this.viewMode_ = b; - this.toggleOffVariableView(); - } -}; -Entry.Playground.prototype.createVariableView = function() { - var b = Entry.createElement("div"); - Entry.type && "workspace" != Entry.type ? "phone" == Entry.type && b.addClass("entryVariablePanelPhone") : b.addClass("entryVariablePanelWorkspace"); - this.variableViewWrapper_ = b; - Entry.variableContainer.createDom(b); - return b; -}; -Entry.Playground.prototype.toggleOnVariableView = function() { - Entry.playground.changeViewMode("code"); - this.hideBlockMenu(); - Entry.variableContainer.updateList(); - this.variableView_.removeClass("entryRemove"); - this.resizeHandle_.removeClass("entryRemove"); -}; -Entry.Playground.prototype.toggleOffVariableView = function() { - this.showBlockMenu(); - this.variableView_.addClass("entryRemove"); -}; -Entry.Playground.prototype.editBlock = function() { - var b = Entry.playground; - Entry.stateManager && Entry.stateManager.addCommand("edit block", b, b.restoreBlock, b.object, b.object.getScriptText()); -}; -Entry.Playground.prototype.mouseupBlock = function() { - if (Entry.reporter) { - var b = Entry.playground, a = b.object; - Entry.reporter.report(new Entry.State("edit block mouseup", b, b.restoreBlock, a, a.getScriptText())); - } -}; -Entry.Playground.prototype.restoreBlock = function(b, a) { - Entry.container.selectObject(b.id); - Entry.stateManager && Entry.stateManager.addCommand("restore block", this, this.restoreBlock, this.object, this.object.getScriptText()); - Blockly.Xml.textToDom(a); -}; -Entry.Playground.prototype.setMenu = function(b) { - if (this.currentObjectType != b) { - var a = this.blockMenu; - a.unbanClass(this.currentObjectType); - a.banClass(b); - a.setMenu(); - a.selectMenu(0, !0); - this.currentObjectType = b; - } -}; -Entry.Playground.prototype.hideTabs = function() { - var b = ["picture", "text", "sound", "variable"], a; - for (a in b) { - this.hideTab([b[a]]); - } -}; -Entry.Playground.prototype.hideTab = function(b) { - this.tabViewElements[b] && (this.tabViewElements[b].addClass("hideTab"), this.tabViewElements[b].removeClass("showTab")); -}; -Entry.Playground.prototype.showTabs = function() { - var b = ["picture", "text", "sound", "variable"], a; - for (a in b) { - this.showTab(b[a]); - } -}; -Entry.Playground.prototype.showTab = function(b) { - this.tabViewElements[b] && (this.tabViewElements[b].addClass("showTab"), this.tabViewElements[b].removeClass("hideTab")); -}; -Entry.Playground.prototype.initializeResizeHandle = function(b) { - $(b).bind("mousedown touchstart", function(a) { - Entry.playground.resizing = !0; - Entry.documentMousemove && (Entry.playground.resizeEvent = Entry.documentMousemove.attach(this, function(a) { - Entry.playground.resizing && Entry.resizeElement({menuWidth:a.clientX - Entry.interfaceState.canvasWidth}); - })); - }); - $(document).bind("mouseup touchend", function(a) { - if (a = Entry.playground.resizeEvent) { - Entry.playground.resizing = !1, Entry.documentMousemove.detach(a), delete Entry.playground.resizeEvent; + }; + a.draw = function() { + var a = this._view; + this._svg && this.remove(); + var c = this._mode == Entry.Workspace.MODE_VIMBOARD; + this.svgGroup = Entry.SVG.createElement(a.svgGroup.cloneNode(!0), {opacity:1}); + this.svg.appendChild(this.svgGroup); + c && (a = $(this.svgGroup), a.find("g").css({filter:"none"}), a.find("path").velocity({opacity:0}, {duration:500}), a.find("text").velocity({fill:"#000000"}, {duration:530})); + }; + a.remove = function() { + this.svgGroup && (this.svgGroup.remove(), delete this.svgGroup, delete this._view, delete this._offsetX, delete this._offsetY, delete this._startX, delete this._startY, this.hide()); + }; + a.align = function() { + var a = this._view.getSkeleton().box(this._view).offsetX || 0, c = this._view.getSkeleton().box(this._view).offsetY || 0, a = -1 * a + 1, c = -1 * c + 1; + this._offsetX = a; + this._offsetY = c; + this.svgGroup.attr({transform:"translate(" + a + "," + c + ")"}); + }; + a.show = function() { + this._container.removeClass("entryRemove"); + }; + a.hide = function() { + this._container.addClass("entryRemove"); + }; + a.position = function() { + var a = this._view; + if (a) { + var c = a.getAbsoluteCoordinate(), a = a.getBoard().offset(); + this.left = c.x + a.left - this._offsetX; + this.top = c.y + a.top - this._offsetY; + this.svgDom.css({transform:"translate3d(" + this.left + "px," + this.top + "px, 0px)"}); } - }); -}; -Entry.Playground.prototype.reloadPlayground = function() { - var b = this.mainWorkspace; - b && (b.getBlockMenu().reDraw(), this.object && this.object.script.view.reDraw()); -}; -Entry.Playground.prototype.flushPlayground = function() { - this.object = null; - if (Entry.playground && Entry.playground.view_) { - this.injectPicture(); - this.injectSound(); - var b = Entry.playground.mainWorkspace.getBoard(); - b.clear(); - b.changeCode(null); - } -}; -Entry.Playground.prototype.refreshPlayground = function() { - Entry.playground && Entry.playground.view_ && ("picture" === this.getViewMode() && this.injectPicture(), "sound" === this.getViewMode() && this.injectSound()); + }; + a.terminateDrag = function(a) { + var c = Entry.mouseCoordinate, d = a.getBoard(), e = d.workspace.blockMenu, f = e.offset().left, g = e.offset().top, h = e.visible ? e.svgDom.width() : 0; + return c.y > d.offset().top - 20 && c.x > f + h ? this.DONE : c.y > g && c.x > f && e.visible ? a.block.isDeletable() ? this.REMOVE : this.RETURN : this.RETURN; + }; + a.addControl = function(a) { + this.onMouseDown.apply(this, arguments); + }; + a.onMouseDown = function(a) { + function c(a) { + var b = a.pageX; + a = a.pageY; + var c = e.left + (b - e._startX), d = e.top + (a - e._startY); + e.svgDom.css({left:c, top:d}); + e._startX = b; + e._startY = a; + e.left = c; + e.top = d; + } + function d(a) { + $(document).unbind(".block"); + } + this._startY = a.pageY; + var e = this; + a.stopPropagation(); + a.preventDefault(); + var f = $(document); + f.bind("mousemove.block", c); + f.bind("mouseup.block", d); + f.bind("touchmove.block", c); + f.bind("touchend.block", d); + this._startX = a.pageX; + this._startY = a.pageY; + }; +})(Entry.GlobalSvg); +Entry.Mutator = function() { }; -Entry.Playground.prototype.updateListViewOrder = function(b) { - b = "picture" == b ? this.pictureListView_.childNodes : this.soundListView_.childNodes; - for (var a = 0, c = b.length;a < c;a++) { - b[a].orderHolder.innerHTML = a + 1; +(function(a) { + a.mutate = function(a, c) { + a = Entry.block[a]; + void 0 === a.changeEvent && (a.changeEvent = new Entry.Event); + a.template = c.template; + a.params = c.params; + a.changeEvent.notify(1); + }; +})(Entry.Mutator); +(function(a) { +})(Entry.Mutator.prototype); +Entry.RenderView = function(a, b) { + this._align = b || "CENTER"; + a = "string" === typeof a ? $("#" + a) : $(a); + if ("DIV" !== a.prop("tagName")) { + return console.error("Dom is not div element"); } + this.view = a; + this.viewOnly = !0; + this.suffix = "renderView"; + this.disableMouseEvent = this.visible = !0; + this._svgId = "renderView_" + (new Date).getTime(); + this._generateView(); + this.offset = this.svgDom.offset(); + this.setWidth(); + this.svg = Entry.SVG(this._svgId); + Entry.Utils.addFilters(this.svg, this.suffix); + this.svg && (this.svgGroup = this.svg.elem("g"), this.svgThreadGroup = this.svgGroup.elem("g"), this.svgThreadGroup.board = this, this.svgBlockGroup = this.svgGroup.elem("g"), this.svgBlockGroup.board = this); }; -Entry.Playground.prototype.generatePictureElement = function(b) { - function a() { - if ("" === this.value.trim()) { - Entry.deAttachEventListener(this, "blur", a), alert("\uc774\ub984\uc744 \uc785\ub825\ud558\uc5ec \uc8fc\uc138\uc694."), this.focus(), Entry.attachEventListener(this, "blur", a); - } else { - for (var b = $(".entryPlaygroundPictureName"), c = 0;c < b.length;c++) { - if (b.eq(c).val() == f.value && b[c] != this) { - Entry.deAttachEventListener(this, "blur", a); - alert("\uc774\ub984\uc774 \uc911\ubcf5 \ub418\uc5c8\uc2b5\ub2c8\ub2e4."); - this.focus(); - Entry.attachEventListener(this, "blur", a); - return; - } - } - this.picture.name = this.value; - Entry.playground.reloadPlayground(); - Entry.dispatchEvent("pictureNameChanged", this.picture); +(function(a) { + a.schema = {code:null, dragBlock:null, closeBlock:null, selectedBlockView:null}; + a._generateView = function() { + this.renderViewContainer = Entry.Dom("div", {"class":"renderViewContainer", parent:this.view}); + this.svgDom = Entry.Dom($(''), {parent:this.renderViewContainer}); + }; + a.changeCode = function(a) { + if (!(a instanceof Entry.Code)) { + return console.error("You must inject code instance"); } - } - var c = Entry.createElement("li", b.id); - b.view = c; - c.addClass("entryPlaygroundPictureElement"); - c.picture = b; - c.bindOnClick(function(a) { - Entry.playground.selectPicture(this.picture); - }); - Entry.Utils.disableContextmenu(b.view); - $(b.view).on("contextmenu", function() { - Entry.ContextMenu.show([{text:Lang.Workspace.context_rename, callback:function() { - f.focus(); - }}, {text:Lang.Workspace.context_duplicate, callback:function() { - Entry.playground.clonePicture(b.id); - }}, {text:Lang.Workspace.context_remove, callback:function() { - Entry.playground.object.removePicture(b.id) ? (Entry.removeElement(c), Entry.toast.success(Lang.Workspace.shape_remove_ok, b.name + " " + Lang.Workspace.shape_remove_ok_msg)) : Entry.toast.alert(Lang.Workspace.shape_remove_fail, Lang.Workspace.shape_remove_fail_msg); - }}, {divider:!0}, {text:Lang.Workspace.context_download, callback:function() { - b.fileurl ? window.open(b.fileurl) : window.open("/api/sprite/download/image/" + encodeURIComponent(b.filename) + "/" + encodeURIComponent(b.name) + ".png"); - }}], "workspace-contextmenu"); - }); - var d = Entry.createElement("div"); - d.addClass("entryPlaygroundPictureOrder"); - c.orderHolder = d; - c.appendChild(d); - d = Entry.createElement("div", "t_" + b.id); - d.addClass("entryPlaygroundPictureThumbnail"); - if (b.fileurl) { - d.style.backgroundImage = 'url("' + b.fileurl + '")'; - } else { - var e = b.filename; - d.style.backgroundImage = 'url("' + Entry.defaultPath + "/uploads/" + e.substring(0, 2) + "/" + e.substring(2, 4) + "/thumb/" + e + '.png")'; - } - c.appendChild(d); - var f = Entry.createElement("input"); - f.addClass("entryPlaygroundPictureName"); - f.addClass("entryEllipsis"); - f.picture = b; - f.value = b.name; - Entry.attachEventListener(f, "blur", a); - f.onkeypress = function(a) { - 13 == a.keyCode && this.blur(); + this.code = a; + this.svg || (this.svg = Entry.SVG(this._svgId), this.svgGroup = this.svg.elem("g"), this.svgThreadGroup = this.svgGroup.elem("g"), this.svgThreadGroup.board = this, this.svgBlockGroup = this.svgGroup.elem("g"), this.svgBlockGroup.board = this); + a.createView(this); + this.align(); + this.resize(); }; - c.appendChild(f); - d = Entry.createElement("div", "s_" + b.id); - d.addClass("entryPlaygroundPictureSize"); - d.innerHTML = b.dimension.width + " X " + b.dimension.height; - c.appendChild(d); -}; -Entry.Playground.prototype.generateSoundElement = function(b) { - var a = Entry.createElement("sound", b.id); - b.view = a; - a.addClass("entryPlaygroundSoundElement"); - a.sound = b; - Entry.Utils.disableContextmenu(b.view); - $(b.view).on("contextmenu", function() { - Entry.ContextMenu.show([{text:Lang.Workspace.context_rename, callback:function() { - g.focus(); - }}, {text:Lang.Workspace.context_duplicate, callback:function() { - Entry.playground.addSound(b, !0); - }}, {text:Lang.Workspace.context_remove, callback:function() { - Entry.playground.object.removeSound(b.id) ? (Entry.removeElement(a), Entry.toast.success(Lang.Workspace.sound_remove_ok, b.name + " " + Lang.Workspace.sound_remove_ok_msg)) : Entry.toast.alert(Lang.Workspace.sound_remove_fail, ""); - Entry.removeElement(a); - }}], "workspace-contextmenu"); - }); - var c = Entry.createElement("div"); - c.addClass("entryPlaygroundSoundOrder"); - a.orderHolder = c; - a.appendChild(c); - var d = Entry.createElement("div"); - d.addClass("entryPlaygroundSoundThumbnail"); - d.addClass("entryPlaygroundSoundPlay"); - var e = !1, f; - d.addEventListener("click", function() { - e ? (e = !1, d.removeClass("entryPlaygroundSoundStop"), d.addClass("entryPlaygroundSoundPlay"), f.stop()) : (e = !0, d.removeClass("entryPlaygroundSoundPlay"), d.addClass("entryPlaygroundSoundStop"), f = createjs.Sound.play(b.id), f.addEventListener("complete", function(a) { - d.removeClass("entryPlaygroundSoundStop"); - d.addClass("entryPlaygroundSoundPlay"); - e = !1; - }), f.addEventListener("loop", function(a) { - }), f.addEventListener("failed", function(a) { - })); - }); - a.appendChild(d); - var g = Entry.createElement("input"); - g.addClass("entryPlaygroundSoundName"); - g.sound = b; - g.value = b.name; - var h = document.getElementsByClassName("entryPlaygroundSoundName"); - g.onblur = function() { - if ("" === this.value) { - alert("\uc774\ub984\uc744 \uc785\ub825\ud558\uc5ec \uc8fc\uc138\uc694."), this.focus(); - } else { - for (var a = 0, b = 0;b < h.length;b++) { - if (h[b].value == g.value && (a += 1, 1 < a)) { - alert("\uc774\ub984\uc774 \uc911\ubcf5 \ub418\uc5c8\uc2b5\ub2c8\ub2e4."); - this.focus(); - return; - } + a.align = function() { + var a = this.code.getThreads(); + if (a && 0 !== a.length) { + for (var c = 0, d = "LEFT" == this._align ? 20 : this.svgDom.width() / 2, e = 0, f = a.length;e < f;e++) { + var g = a[e].getFirstBlock().view; + g._moveTo(d, c - g.offsetY, !1); + g = g.svgGroup.getBBox().height; + c += g + 15; } - this.sound.name = this.value; - Entry.playground.reloadPlayground(); + this._bBox = this.svgGroup.getBBox(); + this.height = this._bBox.height; } }; - g.onkeypress = function(a) { - 13 == a.keyCode && this.blur(); + a.hide = function() { + this.view.addClass("entryRemove"); }; - a.appendChild(g); - c = Entry.createElement("div"); - c.addClass("entryPlaygroundSoundLength"); - c.innerHTML = b.duration + " \ucd08"; - a.appendChild(c); -}; -Entry.Playground.prototype.toggleColourChooser = function(b) { - "foreground" === b ? "none" === this.coloursWrapper.style.display ? (this.coloursWrapper.style.display = "block", this.backgroundsWrapper.style.display = "none") : this.coloursWrapper.style.display = "none" : "background" === b && ("none" === this.backgroundsWrapper.style.display ? (this.backgroundsWrapper.style.display = "block", this.coloursWrapper.style.display = "none") : this.backgroundsWrapper.style.display = "none"); -}; -Entry.Playground.prototype.setTextColour = function(b) { - Entry.playground.object.entity.setColour(b); - Entry.playground.toggleColourChooser("foreground"); - $(".entryPlayground_fgColorDiv").css("backgroundColor", b); -}; -Entry.Playground.prototype.setBackgroundColour = function(b) { - Entry.playground.object.entity.setBGColour(b); - Entry.playground.toggleColourChooser("background"); - $(".entryPlayground_bgColorDiv").css("backgroundColor", b); -}; -Entry.Playground.prototype.isTextBGMode = function() { - return this.isTextBGMode_; -}; -Entry.Playground.prototype.checkVariables = function() { - Entry.forEBS || (Entry.variableContainer.lists_.length ? this.blockMenu.unbanClass("listNotExist") : this.blockMenu.banClass("listNotExist"), Entry.variableContainer.variables_.length ? this.blockMenu.unbanClass("variableNotExist") : this.blockMenu.banClass("variableNotExist")); -}; -Entry.Playground.prototype.getViewMode = function() { - return this.viewMode_; -}; -Entry.Playground.prototype.updateHW = function() { - var b = Entry.playground.mainWorkspace.blockMenu; - if (b) { - var a = Entry.hw; - a && a.connected ? (b.unbanClass("arduinoConnected", !0), b.banClass("arduinoDisconnected", !0), a.banHW(), a.hwModule && b.unbanClass(a.hwModule.name)) : (b.banClass("arduinoConnected", !0), b.unbanClass("arduinoDisconnected", !0), Entry.hw.banHW()); - b.reDraw(); - } -}; -Entry.Playground.prototype.toggleLineBreak = function(b) { - this.object && "textBox" == this.object.objectType && (b ? (Entry.playground.object.entity.setLineBreak(!0), $(".entryPlayground_textArea").css("display", "block"), $(".entryPlayground_textBox").css("display", "none"), this.linebreakOffImage.src = Entry.mediaFilePath + "text-linebreak-off-false.png", this.linebreakOnImage.src = Entry.mediaFilePath + "text-linebreak-on-true.png", this.fontSizeWrapper.removeClass("entryHide")) : (Entry.playground.object.entity.setLineBreak(!1), $(".entryPlayground_textArea").css("display", - "none"), $(".entryPlayground_textBox").css("display", "block"), this.linebreakOffImage.src = Entry.mediaFilePath + "text-linebreak-off-true.png", this.linebreakOnImage.src = Entry.mediaFilePath + "text-linebreak-on-false.png", this.fontSizeWrapper.addClass("entryHide"))); + a.show = function() { + this.view.removeClass("entryRemove"); + }; + a.setWidth = function() { + this._svgWidth = this.svgDom.width(); + this.offset = this.svgDom.offset(); + }; + a.bindCodeView = function(a) { + this.svgBlockGroup.remove(); + this.svgThreadGroup.remove(); + this.svgBlockGroup = a.svgBlockGroup; + this.svgThreadGroup = a.svgThreadGroup; + this.svgGroup.appendChild(this.svgThreadGroup); + this.svgGroup.appendChild(this.svgBlockGroup); + }; + a.resize = function() { + this.svg && this._bBox && $(this.svg).css("height", this._bBox.height + 10); + }; +})(Entry.RenderView.prototype); +Entry.ThreadView = function(a, b) { + Entry.Model(this, !1); + this.thread = a; + this.svgGroup = b.svgThreadGroup.elem("g"); + this.parent = b; }; -Entry.Playground.prototype.setFontAlign = function(b) { - if ("textBox" == this.object.objectType) { - this.alignLeftBtn.removeClass("toggle"); - this.alignCenterBtn.removeClass("toggle"); - this.alignRightBtn.removeClass("toggle"); - switch(b) { - case Entry.TEXT_ALIGN_LEFT: - this.alignLeftBtn.addClass("toggle"); - break; - case Entry.TEXT_ALIGN_CENTER: - this.alignCenterBtn.addClass("toggle"); - break; - case Entry.TEXT_ALIGN_RIGHT: - this.alignRightBtn.addClass("toggle"); +(function(a) { + a.schema = {height:0, zIndex:0}; + a.destroy = function() { + this.svgGroup.remove(); + }; + a.setParent = function(a) { + this.parent = a; + }; + a.getParent = function() { + return this.parent; + }; + a.renderText = function() { + for (var a = this.thread.getBlocks(), c = 0;c < a.length;c++) { + a[c].view.renderText(); + } + }; + a.renderBlock = function() { + for (var a = this.thread.getBlocks(), c = 0;c < a.length;c++) { + a[c].view.renderBlock(); + } + }; + a.requestAbsoluteCoordinate = function(a) { + var c = this.thread.getBlocks(), d = c.shift(), e = {x:0, y:0}; + for (this.parent instanceof Entry.Board || this.parent instanceof Entry.BlockMenu || (e = this.parent.requestAbsoluteCoordinate());d && d.view !== a && d.view;) { + d = d.view, e.x += d.x + d.magnet.next.x, e.y += d.y + d.magnet.next.y, d = c.shift(); + } + return e; + }; + a.requestPartHeight = function(a, c) { + c = this.thread.getBlocks(); + for (var d = c.pop(), e = a ? a.magnet.next ? a.magnet.next.y : a.height : 0;d && d.view !== a && d.view;) { + d = d.view, e = d.magnet.next ? e + d.magnet.next.y : e + d.height, d.dragMode === Entry.DRAG_MODE_DRAG && (e = 0), d = c.pop(); + } + return e; + }; + a.dominate = function() { + this.parent.dominate(this.thread); + }; + a.isGlobal = function() { + return this.parent instanceof Entry.Board; + }; + a.reDraw = function() { + for (var a = this.thread._data, c = a.length - 1;0 <= c;c--) { + a[c].view.reDraw(); } - this.object.entity.setTextAlign(b); + }; + a.setZIndex = function(a) { + this.set({zIndex:a}); + }; +})(Entry.ThreadView.prototype); +Entry.Vim = function(a) { + a = "string" === typeof a ? $("#" + a) : $(a); + if ("DIV" !== a.prop("tagName")) { + return console.error("Dom is not div element"); } + this.createDom(a); + this._parser = new Entry.Parser("maze", "js", this.codeMirror); + this._blockParser = new Entry.Parser("maze", "block"); + Entry.Model(this, !1); + window.eventset = []; }; -Entry.Playground.prototype.hideBlockMenu = function() { - this.mainWorkspace.getBlockMenu().hide(); -}; -Entry.Playground.prototype.showBlockMenu = function() { - this.mainWorkspace.getBlockMenu().show(); -}; +(function(a) { + a.createDom = function(a) { + function c(a) { + var b = e.getCodeToText(a.block); + e.codeMirror.display.dragFunctions.leave(a); + var c = Entry.Utils.createMouseEvent("mousedown", a); + e.codeMirror.display.scroller.dispatchEvent(c); + var b = b.split("\n"), d = b.length - 1, l = 0; + b.forEach(function(a, b) { + e.codeMirror.replaceSelection(a); + l = e.doc.getCursor().line; + e.codeMirror.indentLine(l); + 0 !== b && d === b || e.codeMirror.replaceSelection("\n"); + }); + a = Entry.Utils.createMouseEvent("mouseup", a); + e.codeMirror.display.scroller.dispatchEvent(a); + } + 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", c); + a.removeEventListener("dragOver", d); + a.addEventListener("dragEnd", c); + a.addEventListener("dragOver", d); + }; + a.hide = function() { + this.view.addClass("entryRemove"); + }; + a.show = function() { + this.view.removeClass("entryRemove"); + }; + a.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; + }; + a.codeToText = function(a) { + a = this._blockParser.parse(a); + this.codeMirror.setValue(a); + }; + a.getCodeToText = function(a) { + return this._blockParser.parse(a); + }; +})(Entry.Vim.prototype); Entry.Xml = {}; -Entry.Xml.isTypeOf = function(b, a) { - return a.getAttribute("type") == b; +Entry.Xml.isTypeOf = function(a, b) { + return b.getAttribute("type") == a; }; -Entry.Xml.getNextBlock = function(b) { - b = b.childNodes; - for (var a = 0;a < b.length;a++) { - if ("NEXT" == b[a].tagName.toUpperCase()) { - return b[a].children[0]; +Entry.Xml.getNextBlock = function(a) { + a = a.childNodes; + for (var b = 0;b < a.length;b++) { + if ("NEXT" == a[b].tagName.toUpperCase()) { + return a[b].children[0]; } } return null; }; -Entry.Xml.getStatementBlock = function(b, a) { - var c = a.getElementsByTagName("statement"); +Entry.Xml.getStatementBlock = function(a, b) { + var c = b.getElementsByTagName("statement"); if (!c.length) { - return a; + return b; } for (var d in c) { - if (c[d].getAttribute("name") == b) { + if (c[d].getAttribute("name") == a) { return c[d].children[0]; } } return null; }; -Entry.Xml.getParentLoop = function(b) { +Entry.Xml.getParentLoop = function(a) { for (;;) { - if (!b) { + if (!a) { return null; } - if ((b = b.parentNode) && "STATEMENT" == b.tagName.toUpperCase()) { - return b.parentNode; + if ((a = a.parentNode) && "STATEMENT" == a.tagName.toUpperCase()) { + return a.parentNode; } - if (b) { - b = b.parentNode; + if (a) { + a = a.parentNode; } else { return null; } } }; -Entry.Xml.getParentIterateLoop = function(b) { +Entry.Xml.getParentIterateLoop = function(a) { for (;;) { - if (!b) { + if (!a) { return null; } - if ((b = b.parentNode) && b.getAttribute("type") && "REPEAT" == b.getAttribute("type").toUpperCase().substr(0, 6)) { - return b; + if ((a = a.parentNode) && a.getAttribute("type") && "REPEAT" == a.getAttribute("type").toUpperCase().substr(0, 6)) { + return a; } - if (!b) { + if (!a) { return null; } } }; -Entry.Xml.getParentBlock = function(b) { - return (b = b.parentNode) ? b.parentNode : null; +Entry.Xml.getParentBlock = function(a) { + return (a = a.parentNode) ? a.parentNode : null; }; -Entry.Xml.callReturn = function(b) { - var a = Entry.Xml.getNextBlock(b); - return a ? a : Entry.Xml.getParentLoop(b); +Entry.Xml.callReturn = function(a) { + var b = Entry.Xml.getNextBlock(a); + return b ? b : Entry.Xml.getParentLoop(a); }; -Entry.Xml.isRootBlock = function(b) { +Entry.Xml.isRootBlock = function(a) { }; -Entry.Xml.getValue = function(b, a) { - var c = a.childNodes; - if (!c.length) { +Entry.Xml.getValue = function(a, b) { + b = b.childNodes; + if (!b.length) { return null; } - for (var d in c) { - if ("VALUE" == c[d].tagName.toUpperCase() && c[d].getAttribute("name") == b) { - return c[d].children[0]; + for (var c in b) { + if ("VALUE" == b[c].tagName.toUpperCase() && b[c].getAttribute("name") == a) { + return b[c].children[0]; } } return null; }; -Entry.Xml.getNumberValue = function(b, a, c) { +Entry.Xml.getNumberValue = function(a, b, c) { c = c.childNodes; if (!c.length) { return null; } 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])); + if (c[d].tagName && "VALUE" == c[d].tagName.toUpperCase() && c[d].getAttribute("name") == b) { + return Number(Entry.Xml.operate(a, c[d].children[0])); } } return null; }; -Entry.Xml.getField = function(b, a) { - var c = a.childNodes; - if (!c.length) { +Entry.Xml.getField = function(a, b) { + b = b.childNodes; + if (!b.length) { return null; } - for (var d in c) { - if (c[d].tagName && "FIELD" == c[d].tagName.toUpperCase() && c[d].getAttribute("name") == b) { - return c[d].textContent; + for (var c in b) { + if (b[c].tagName && "FIELD" == b[c].tagName.toUpperCase() && b[c].getAttribute("name") == a) { + return b[c].textContent; } } }; -Entry.Xml.getNumberField = function(b, a) { - var c = a.childNodes; - if (!c.length) { +Entry.Xml.getNumberField = function(a, b) { + b = b.childNodes; + if (!b.length) { return null; } - for (var d in c) { - if ("FIELD" == c[d].tagName.toUpperCase() && c[d].getAttribute("name") == b) { - return Number(c[d].textContent); + for (var c in b) { + if ("FIELD" == b[c].tagName.toUpperCase() && b[c].getAttribute("name") == a) { + return Number(b[c].textContent); } } }; -Entry.Xml.getBooleanValue = function(b, a, c) { +Entry.Xml.getBooleanValue = function(a, b, c) { c = c.getElementsByTagName("value"); if (!c.length) { return null; } for (var d in c) { - if (c[d].getAttribute("name") == a) { - return Entry.Xml.operate(b, c[d].children[0]); + if (c[d].getAttribute("name") == b) { + return Entry.Xml.operate(a, c[d].children[0]); } } return null; }; -Entry.Xml.operate = function(b, a) { - return Entry.block[a.getAttribute("type")](b, a); +Entry.Xml.operate = function(a, b) { + return Entry.block[b.getAttribute("type")](a, b); }; -Entry.Xml.cloneBlock = function(b, a, c) { - var d = b.cloneNode(); - b.parentNode && "xml" != b.parentNode.tagName && Entry.Xml.cloneBlock(b.parentNode, d, "parent"); - for (var e = 0;e < b.childNodes.length;e++) { - var f = b.childNodes[e]; - f instanceof Text ? d.textContent = f.textContent : "parent" == c ? d.appendChild(a) : d.appendChild(Entry.Xml.cloneBlock(f, d, "child")); +Entry.Xml.cloneBlock = function(a, b, c) { + var d = a.cloneNode(); + a.parentNode && "xml" != a.parentNode.tagName && Entry.Xml.cloneBlock(a.parentNode, d, "parent"); + for (var e = 0;e < a.childNodes.length;e++) { + var f = a.childNodes[e]; + f instanceof Text ? d.textContent = f.textContent : "parent" == c ? d.appendChild(b) : d.appendChild(Entry.Xml.cloneBlock(f, d, "child")); } return d; }; -Entry.Youtube = function(b) { - this.generateView(b); +Entry.Youtube = function(a) { + this.generateView(a); }; p = Entry.Youtube.prototype; -p.init = function(b) { - this.youtubeHash = b; +p.init = function(a) { + this.youtubeHash = a; this.generateView(); }; -p.generateView = function(b) { - var a = Entry.createElement("div"); - a.addClass("entryContainerMovieWorkspace"); - a.addClass("entryRemove"); - this.movieContainer = a; - a = Entry.createElement("iframe"); - a.setAttribute("id", "youtubeIframe"); - a.setAttribute("allowfullscreen", ""); - a.setAttribute("frameborder", 0); - a.setAttribute("src", "https://www.youtube.com/embed/" + b); - this.movieFrame = a; - this.movieContainer.appendChild(a); +p.generateView = function(a) { + var b = Entry.createElement("div"); + b.addClass("entryContainerMovieWorkspace"); + b.addClass("entryRemove"); + this.movieContainer = b; + b = Entry.createElement("iframe"); + b.setAttribute("id", "youtubeIframe"); + b.setAttribute("allowfullscreen", ""); + b.setAttribute("frameborder", 0); + b.setAttribute("src", "https://www.youtube.com/embed/" + a); + this.movieFrame = b; + this.movieContainer.appendChild(b); }; p.getView = function() { return this.movieContainer; }; p.resize = function() { - var b = document.getElementsByClassName("propertyContent")[0], a = document.getElementById("youtubeIframe"); - w = b.offsetWidth; - a.width = w + "px"; - a.height = 9 * w / 16 + "px"; + var a = document.getElementsByClassName("propertyContent")[0], b = document.getElementById("youtubeIframe"); + w = a.offsetWidth; + b.width = w + "px"; + b.height = 9 * w / 16 + "px"; }; diff --git a/dist/entry.min.js b/dist/entry.min.js index fc42362a70..2cd1f48544 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -1,2248 +1,2259 @@ -Entry={block:{},TEXT_ALIGN_CENTER:0,TEXT_ALIGN_LEFT:1,TEXT_ALIGN_RIGHT:2,TEXT_ALIGNS:["center","left","right"],clipboard:null,loadProject:function(b){b||(b=Entry.getStartProject(Entry.mediaFilePath));"workspace"==this.type&&Entry.stateManager.startIgnore();Entry.projectId=b._id;Entry.variableContainer.setVariables(b.variables);Entry.variableContainer.setMessages(b.messages);Entry.scene.addScenes(b.scenes);Entry.stage.initObjectContainers();Entry.variableContainer.setFunctions(b.functions);Entry.container.setObjects(b.objects); -Entry.FPS=b.speed?b.speed:60;createjs.Ticker.setFPS(Entry.FPS);"workspace"==this.type&&setTimeout(function(){Entry.stateManager.endIgnore()},300);Entry.engine.projectTimer||Entry.variableContainer.generateTimer();0===Object.keys(Entry.container.inputValue).length&&Entry.variableContainer.generateAnswer();Entry.start();return b},exportProject:function(b){b||(b={});Entry.engine.isState("stop")||Entry.engine.toggleStop();Entry.Func&&Entry.Func.workspace&&Entry.Func.workspace.visible&&Entry.Func.cancelEdit(); -b.objects=Entry.container.toJSON();b.scenes=Entry.scene.toJSON();b.variables=Entry.variableContainer.getVariableJSON();b.messages=Entry.variableContainer.getMessageJSON();b.functions=Entry.variableContainer.getFunctionJSON();b.scenes=Entry.scene.toJSON();b.speed=Entry.FPS;return b},setBlockByText:function(b,a){for(var c=[],d=jQuery.parseXML(a).getElementsByTagName("category"),e=0;ea?a=325:720a?a=244:400svg").css({width:a-64+"px"});Entry.playground.mainWorkspace.blockMenu.setWidth(); -$(".entryWorkspaceBoard").css({left:a+"px"});Entry.playground.resizeHandle_.style.left=a+"px";Entry.playground.variableViewWrapper_.style.width=a+"px";this.interfaceState=b}Entry.windowResized.notify()},getUpTime:function(){return(new Date).getTime()-this.startTime},addActivity:function(b){Entry.stateManager&&Entry.stateManager.addActivity(b)},startActivityLogging:function(){Entry.reporter&&Entry.reporter.start(Entry.projectId,window.user?window.user._id:null,Entry.startTime)},getActivityLog:function(){var b= -{};Entry.stateManager&&(b.activityLog=Entry.stateManager.activityLog_);return b},DRAG_MODE_NONE:0,DRAG_MODE_MOUSEDOWN:1,DRAG_MODE_DRAG:2,cancelObjectEdit:function(b){var a=Entry.playground.object;if(a){var c=b.target;b=0!==$(a.view_).find(c).length;c=c.tagName.toUpperCase();!a.isEditing||"INPUT"===c&&b||a.editObjectValues(!1)}}};window.Entry=Entry;Entry.Albert={PORT_MAP:{leftWheel:0,rightWheel:0,buzzer:0,leftEye:0,rightEye:0,note:0,bodyLed:0,frontLed:0,padWidth:0,padHeight:0},setZero:function(){var b=Entry.Albert.PORT_MAP,a=Entry.hw.sendQueue,c;for(c in b)a[c]=b[c];Entry.hw.update();b=Entry.Albert;b.tempo=60;b.removeAllTimeouts()},monitorTemplate:{imgPath:"hw/albert.png",width:387,height:503,listPorts:{oid:{name:"OID",type:"input",pos:{x:0,y:0}},buzzer:{name:Lang.Hw.buzzer,type:"output",pos:{x:0,y:0}},note:{name:Lang.Hw.note,type:"output", -pos:{x:0,y:0}}},ports:{leftProximity:{name:Lang.Blocks.ALBERT_sensor_leftProximity,type:"input",pos:{x:178,y:401}},rightProximity:{name:Lang.Blocks.ALBERT_sensor_rightProximity,type:"input",pos:{x:66,y:359}},battery:{name:Lang.Blocks.ALBERT_sensor_battery,type:"input",pos:{x:88,y:368}},light:{name:Lang.Blocks.ALBERT_sensor_light,type:"input",pos:{x:127,y:391}},leftWheel:{name:Lang.Hw.leftWheel,type:"output",pos:{x:299,y:406}},rightWheel:{name:Lang.Hw.rightWheel,type:"output",pos:{x:22,y:325}},leftEye:{name:Lang.Hw.leftEye, -type:"output",pos:{x:260,y:26}},rightEye:{name:Lang.Hw.rightEye,type:"output",pos:{x:164,y:13}},bodyLed:{name:Lang.Hw.body+" "+Lang.Hw.led,type:"output",pos:{x:367,y:308}},frontLed:{name:Lang.Hw.front+" "+Lang.Hw.led,pos:{x:117,y:410}}},mode:"both"},tempo:60,timeouts:[],removeTimeout:function(b){clearTimeout(b);var a=this.timeouts;b=a.indexOf(b);0<=b&&a.splice(b,1)},removeAllTimeouts:function(){var b=this.timeouts,a;for(a in b)clearTimeout(b[a]);this.timeouts=[]},name:"albert"}; -Blockly.Blocks.albert_hand_found={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_hand_found);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.albert_hand_found=function(b,a){var c=Entry.hw.portData;return 40b?b=325:720b?b=244:400svg").css({width:b-64+"px"});Entry.playground.mainWorkspace.blockMenu.setWidth(); +$(".entryWorkspaceBoard").css({left:b+"px"});Entry.playground.resizeHandle_.style.left=b+"px";Entry.playground.variableViewWrapper_.style.width=b+"px";this.interfaceState=a}Entry.windowResized.notify()},getUpTime:function(){return(new Date).getTime()-this.startTime},addActivity:function(a){Entry.stateManager&&Entry.stateManager.addActivity(a)},startActivityLogging:function(){Entry.reporter&&Entry.reporter.start(Entry.projectId,window.user?window.user._id:null,Entry.startTime)},getActivityLog:function(){var a= +{};Entry.stateManager&&(a.activityLog=Entry.stateManager.activityLog_);return a},DRAG_MODE_NONE:0,DRAG_MODE_MOUSEDOWN:1,DRAG_MODE_DRAG:2,cancelObjectEdit:function(a){var b=Entry.playground.object;if(b){var c=a.target;a=0!==$(b.view_).find(c).length;c=c.tagName.toUpperCase();!b.isEditing||"INPUT"===c&&a||b.editObjectValues(!1)}}};window.Entry=Entry;Entry.Albert={PORT_MAP:{leftWheel:0,rightWheel:0,buzzer:0,leftEye:0,rightEye:0,note:0,bodyLed:0,frontLed:0,padWidth:0,padHeight:0},setZero:function(){var a=Entry.Albert.PORT_MAP,b=Entry.hw.sendQueue,c;for(c in a)b[c]=a[c];Entry.hw.update();a=Entry.Albert;a.tempo=60;a.removeAllTimeouts()},monitorTemplate:{imgPath:"hw/albert.png",width:387,height:503,listPorts:{temperature:{name:Lang.Blocks.ALBERT_sensor_temperature,type:"input",pos:{x:0,y:0}},accelerationX:{name:Lang.Blocks.ALBERT_sensor_acceleration_x, +type:"input",pos:{x:0,y:0}},accelerationY:{name:Lang.Blocks.ALBERT_sensor_acceleration_y,type:"input",pos:{x:0,y:0}},accelerationZ:{name:Lang.Blocks.ALBERT_sensor_acceleration_z,type:"input",pos:{x:0,y:0}},frontOid:{name:Lang.Blocks.ALBERT_sensor_front_oid,type:"input",pos:{x:0,y:0}},backOid:{name:Lang.Blocks.ALBERT_sensor_back_oid,type:"input",pos:{x:0,y:0}},positionX:{name:Lang.Blocks.ALBERT_sensor_position_x,type:"input",pos:{x:0,y:0}},positionY:{name:Lang.Blocks.ALBERT_sensor_position_y,type:"input", +pos:{x:0,y:0}},orientation:{name:Lang.Blocks.ALBERT_sensor_orientation,type:"input",pos:{x:0,y:0}},buzzer:{name:Lang.Hw.buzzer,type:"output",pos:{x:0,y:0}},note:{name:Lang.Hw.note,type:"output",pos:{x:0,y:0}}},ports:{leftProximity:{name:Lang.Blocks.ALBERT_sensor_leftProximity,type:"input",pos:{x:178,y:401}},rightProximity:{name:Lang.Blocks.ALBERT_sensor_rightProximity,type:"input",pos:{x:66,y:359}},battery:{name:Lang.Blocks.ALBERT_sensor_battery,type:"input",pos:{x:88,y:368}},light:{name:Lang.Blocks.ALBERT_sensor_light, +type:"input",pos:{x:127,y:391}},leftWheel:{name:Lang.Hw.leftWheel,type:"output",pos:{x:299,y:406}},rightWheel:{name:Lang.Hw.rightWheel,type:"output",pos:{x:22,y:325}},leftEye:{name:Lang.Hw.leftEye,type:"output",pos:{x:260,y:26}},rightEye:{name:Lang.Hw.rightEye,type:"output",pos:{x:164,y:13}},bodyLed:{name:Lang.Hw.body+" "+Lang.Hw.led_en,type:"output",pos:{x:367,y:308}},frontLed:{name:Lang.Hw.front+" "+Lang.Hw.led_en,pos:{x:117,y:410}}},mode:"both"},tempo:60,timeouts:[],removeTimeout:function(a){clearTimeout(a); +var b=this.timeouts;a=b.indexOf(a);0<=a&&b.splice(a,1)},removeAllTimeouts:function(){var a=this.timeouts,b;for(b in a)clearTimeout(a[b]);this.timeouts=[]},controller:{PI:3.14159265,PI2:6.2831853,prevDirection:0,prevDirectionFine:0,directionFineCount:0,positionCount:0,finalPositionCount:0,GAIN_ANGLE:30,GAIN_ANGLE_FINE:30,GAIN_POSITION_FINE:30,STRAIGHT_SPEED:20,MAX_BASE_SPEED:20,GAIN_BASE_SPEED:1,GAIN_POSITION:35,POSITION_TOLERANCE_FINE:3,POSITION_TOLERANCE_FINE_LARGE:5,POSITION_TOLERANCE_ROUGH:5,POSITION_TOLERANCE_ROUGH_LARGE:10, +ORIENTATION_TOLERANCE_FINE:.08,ORIENTATION_TOLERANCE_ROUGH:.09,ORIENTATION_TOLERANCE_ROUGH_LARGE:.18,MINIMUM_WHEEL_SPEED:18,MINIMUM_WHEEL_SPEED_FINE:15,clear:function(){this.finalPositionCount=this.positionCount=this.directionFineCount=this.prevDirectionFine=this.prevDirection=0},controlAngleFine:function(a,b){var c=Entry.hw.sendQueue;a=this.validateRadian(b-a);b=Math.abs(a);if(bd*this.prevDirectionFine&&5<++this.directionFineCount)return!1; +this.prevDirectionFine=d;0-this.MINIMUM_WHEEL_SPEED&&(a=-this.MINIMUM_WHEEL_SPEED));a=parseInt(a);c.leftWheel=-a;c.rightWheel=a;return!0},controlAngle:function(a,b){var c=Entry.hw.sendQueue;a=this.validateRadian(b-a);b=Math.abs(a);if(bd*this.prevDirection)return!1; +this.prevDirection=d;0-this.MINIMUM_WHEEL_SPEED&&(a=-this.MINIMUM_WHEEL_SPEED));a=parseInt(a);c.leftWheel=-a;c.rightWheel=a;return!0},controlPositionFine:function(a,b,c,d,e){var f=Entry.hw.sendQueue;c=this.validateRadian(Math.atan2(e-b,d-a)-c);var g=Math.abs(c);a=d-a;b=e-b;b=Math.sqrt(a*a+b*b);if(bg?(f.leftWheel=this.STRAIGHT_SPEED,f.rightWheel=this.STRAIGHT_SPEED):(b=(this.MINIMUM_WHEEL_SPEED+.5/g)*this.GAIN_BASE_SPEED,b>this.MAX_BASE_SPEED&&(b=this.MAX_BASE_SPEED),c=0this.PI?a-this.PI2:a<-this.PI?a+this.PI2:a},toRadian:function(a){return 3.14159265* +a/180}},name:"albert"};Blockly.Blocks.albert_hand_found={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_hand_found);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.albert_hand_found=function(a,b){a=Entry.hw.portData;return 40b.x||0>b.y){c.leftWheel=20;c.rightWheel=-20;break}b.initialized=!0}c=a.toRadian(b.theta);0==a.controlAngle(c,Math.atan2(b.targetY-b.y,b.targetX-b.x))&&(b.boardState=2);break;case 2:0==a.controlPosition(b.x, +b.y,a.toRadian(b.theta),b.targetX,b.targetY)&&(b.boardState=3);break;case 3:0==a.controlPositionFine(b.x,b.y,a.toRadian(b.theta),b.targetX,b.targetY)&&(c.leftWheel=0,c.rightWheel=0,b.isMoving=!1)}return b}delete b.isStart;delete b.isMoving;delete b.initialized;delete b.boardState;delete b.x;delete b.y;delete b.theta;delete b.targetX;delete b.targetY;Entry.engine.isContinue=!1;c.leftWheel=0;c.rightWheel=0;return b.callReturn()}b.isStart=!0;b.isMoving=!0;b.initialized=!1;b.boardState=1;b.x=-1;b.y=-1; +b.theta=-200;b.targetX=b.getNumberValue("X");b.targetY=b.getNumberValue("Y");a.clear();c.leftWheel=0;c.rightWheel=0;return b}; +Blockly.Blocks.albert_set_orientation_on_board={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_orientation_to_1);this.appendValueInput("ORIENTATION").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_orientation_to_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; +Entry.block.albert_set_orientation_on_board=function(a,b){a=Entry.hw.sendQueue;var c=Entry.hw.portData,d=Entry.Albert.controller;if(b.isStart){if(b.isMoving){b.theta=c.orientation;switch(b.boardState){case 1:var c=d.toRadian(b.theta),e=d.toRadian(b.targetTheta);0==d.controlAngle(c,e)&&(b.boardState=2);break;case 2:c=d.toRadian(b.theta),e=d.toRadian(b.targetTheta),0==d.controlAngleFine(c,e)&&(a.leftWheel=0,a.rightWheel=0,b.isMoving=!1)}return b}delete b.isStart;delete b.isMoving;delete b.boardState; +delete b.theta;delete b.targetTheta;Entry.engine.isContinue=!1;a.leftWheel=0;a.rightWheel=0;return b.callReturn()}b.isStart=!0;b.isMoving=!0;b.boardState=1;b.theta=-200;b.targetTheta=b.getNumberValue("ORIENTATION");d.clear();a.leftWheel=0;a.rightWheel=0;return b}; +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.Blocks.ALBERT_left_eye,"LEFT"],[Lang.Blocks.ALBERT_right_eye,"RIGHT"],[Lang.Blocks.ALBERT_both_eyes,"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.Blocks.ALBERT_color_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(a,b){a=Entry.hw.sendQueue;var c=b.getField("DIRECTION",b),d=Number(b.getField("COLOR",b));"LEFT"==c?a.leftEye=d:("RIGHT"!=c&&(a.leftEye=d),a.rightEye=d);return b.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.Blocks.ALBERT_left_eye,"LEFT"],[Lang.Blocks.ALBERT_right_eye,"RIGHT"],[Lang.Blocks.ALBERT_both_eyes,"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(a,b){a=Entry.hw.sendQueue;var c=b.getField("DIRECTION",b);"LEFT"==c?a.leftEye=0:("RIGHT"!=c&&(a.leftEye=0),a.rightEye=0);return b.callReturn()}; +Blockly.Blocks.albert_body_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_turn_body_led_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.ALBERT_turn_on,"ON"],[Lang.Blocks.ALBERT_turn_off,"OFF"]]),"STATE").appendField(Lang.Blocks.ALBERT_turn_body_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_body_led=function(a,b){a=Entry.hw.sendQueue;"ON"==b.getField("STATE",b)?a.bodyLed=1:a.bodyLed=0;return b.callReturn()}; +Blockly.Blocks.albert_front_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_turn_front_led_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.ALBERT_turn_on,"ON"],[Lang.Blocks.ALBERT_turn_off,"OFF"]]),"STATE").appendField(Lang.Blocks.ALBERT_turn_front_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_front_led=function(a,b){a=Entry.hw.sendQueue;"ON"==b.getField("STATE",b)?a.frontLed=1:a.frontLed=0;return b.callReturn()};Blockly.Blocks.albert_beep={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_beep).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; +Entry.block.albert_beep=function(a,b){a=Entry.hw.sendQueue;if(b.isStart){if(1==b.timeFlag)return b;delete b.isStart;delete b.timeFlag;Entry.engine.isContinue=!1;a.buzzer=0;return b.callReturn()}b.isStart=!0;b.timeFlag=1;a.buzzer=440;a.note=0;var c=setTimeout(function(){b.timeFlag=0;Entry.Albert.removeTimeout(c)},200);Entry.Albert.timeouts.push(c);return b}; Blockly.Blocks.albert_change_buzzer_by={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_change_buzzer_by_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ALBERT_change_buzzer_by_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.albert_change_buzzer_by=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()}; +Entry.block.albert_change_buzzer_by=function(a,b){a=Entry.hw.sendQueue;var c=b.getNumberValue("VALUE");a.buzzer=void 0!=a.buzzer?a.buzzer+c:c;a.note=0;return b.callReturn()}; Blockly.Blocks.albert_set_buzzer_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_buzzer_to_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_buzzer_to_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.albert_set_buzzer_to=function(b,a){var c=Entry.hw.sendQueue;c.buzzer=a.getNumberValue("VALUE");c.note=0;return a.callReturn()};Blockly.Blocks.albert_clear_buzzer={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_clear_buzzer).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.albert_clear_buzzer=function(b,a){var c=Entry.hw.sendQueue;c.buzzer=0;c.note=0;return a.callReturn()}; +Entry.block.albert_set_buzzer_to=function(a,b){a=Entry.hw.sendQueue;a.buzzer=b.getNumberValue("VALUE");a.note=0;return b.callReturn()};Blockly.Blocks.albert_clear_buzzer={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_clear_buzzer).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; +Entry.block.albert_clear_buzzer=function(a,b){a=Entry.hw.sendQueue;a.buzzer=0;a.note=0;return b.callReturn()}; Blockly.Blocks.albert_play_note_for={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_play_note_for_1).appendField(new Blockly.FieldDropdown([[Lang.General.note_c+"","4"],[Lang.General.note_c+"#","5"],[Lang.General.note_d+"","6"],[Lang.General.note_e+"b","7"],[Lang.General.note_e+"","8"],[Lang.General.note_f+"","9"],[Lang.General.note_f+"#","10"],[Lang.General.note_g+"","11"],[Lang.General.note_g+"#","12"],[Lang.General.note_a+"","13"],[Lang.General.note_b+ "b","14"],[Lang.General.note_b+"","15"]]),"NOTE").appendField(Lang.Blocks.ALBERT_play_note_for_2).appendField(new Blockly.FieldDropdown([["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"]]),"OCTAVE").appendField(Lang.Blocks.ALBERT_play_note_for_3);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ALBERT_play_note_for_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0); this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.albert_play_note_for=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.note=0;return a.callReturn()}var d=a.getNumberField("NOTE",a),e=a.getNumberField("OCTAVE",a),f=a.getNumberValue("VALUE",a),g=Entry.Albert.tempo,f=6E4*f/g;a.isStart=!0;a.timeFlag=1;c.buzzer=0;c.note=d+12*(e-1);if(100Entry.Albert.tempo&&(Entry.Albert.tempo=1);return a.callReturn()}; +Entry.block.albert_change_tempo_by=function(a,b){Entry.Albert.tempo+=b.getNumberValue("VALUE");1>Entry.Albert.tempo&&(Entry.Albert.tempo=1);return b.callReturn()}; Blockly.Blocks.albert_set_tempo_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_tempo_to_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ALBERT_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.albert_set_tempo_to=function(b,a){Entry.Albert.tempo=a.getNumberValue("VALUE");1>Entry.Albert.tempo&&(Entry.Albert.tempo=1);return a.callReturn()};Blockly.Blocks.albert_move_forward={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_move_forward).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.albert_move_forward=function(b,a){var c=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return 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;c.leftWheel=30;c.rightWheel=30;setTimeout(function(){a.timeFlag=0},1E3);return a}; -Blockly.Blocks.albert_move_backward={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_move_backward).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.albert_move_backward=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}; -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()}; -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+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.albert_change_wheels_by=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()}; -Blockly.Blocks.albert_set_wheels_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_wheels_to_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"FRONT"]]),"DIRECTION").appendField(Lang.Blocks.HAMSTER_set_wheels_to_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_wheels_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_wheels_to=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()};Entry.Arduino={name:"arduino",setZero:function(){Entry.hw.sendQueue.readablePorts=[];for(var b=0;20>b;b++)Entry.hw.sendQueue[b]=0,Entry.hw.sendQueue.readablePorts.push(b);Entry.hw.update()},monitorTemplate:{imgPath:"hw/arduino.png",width:605,height:434,listPorts:{2:{name:Lang.Hw.port_en+" 2 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},3:{name:Lang.Hw.port_en+" 3 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},4:{name:Lang.Hw.port_en+" 4 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},5:{name:Lang.Hw.port_en+ +Entry.block.albert_set_tempo_to=function(a,b){Entry.Albert.tempo=b.getNumberValue("VALUE");1>Entry.Albert.tempo&&(Entry.Albert.tempo=1);return b.callReturn()};Entry.Arduino={name:"arduino",setZero:function(){Entry.hw.sendQueue.readablePorts=[];for(var a=0;20>a;a++)Entry.hw.sendQueue[a]=0,Entry.hw.sendQueue.readablePorts.push(a);Entry.hw.update()},monitorTemplate:{imgPath:"hw/arduino.png",width:605,height:434,listPorts:{2:{name:Lang.Hw.port_en+" 2 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},3:{name:Lang.Hw.port_en+" 3 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},4:{name:Lang.Hw.port_en+" 4 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},5:{name:Lang.Hw.port_en+ " 5 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},6:{name:Lang.Hw.port_en+" 6 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},7:{name:Lang.Hw.port_en+" 7 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},8:{name:Lang.Hw.port_en+" 8 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},9:{name:Lang.Hw.port_en+" 9 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},10:{name:Lang.Hw.port_en+" 10 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},11:{name:Lang.Hw.port_en+" 11 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},12:{name:Lang.Hw.port_en+ " 12 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},13:{name:Lang.Hw.port_en+" 13 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},a0:{name:Lang.Hw.port_en+" A0 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},a1:{name:Lang.Hw.port_en+" A1 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},a2:{name:Lang.Hw.port_en+" A2 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},a3:{name:Lang.Hw.port_en+" A3 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},a4:{name:Lang.Hw.port_en+" A4 "+Lang.Hw.port_ko,type:"input",pos:{x:0, y:0}},a5:{name:Lang.Hw.port_en+" A5 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}}},mode:"both"}}; -Entry.ArduinoExt={name:"ArduinoExt",getSensorKey:function(){return"xxxxxxxx".replace(/[xy]/g,function(b){var a=16*Math.random()|0;return("x"==b?a:a&0|0).toString(16)}).toUpperCase()},getSensorTime:function(b){return(new Date).getTime()+b},setZero:function(){Entry.hw.sendQueue.SET?Object.keys(Entry.hw.sendQueue.SET).forEach(function(b){Entry.hw.sendQueue.SET[b].data=0;Entry.hw.sendQueue.TIME=Entry.ArduinoExt.getSensorTime(Entry.hw.sendQueue.SET[b].type);Entry.hw.sendQueue.KEY=Entry.ArduinoExt.getSensorKey()}): +Entry.ArduinoExt={name:"ArduinoExt",getSensorKey:function(){return"xxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0;return("x"==a?b:b&0|0).toString(16)}).toUpperCase()},getSensorTime:function(a){return(new Date).getTime()+a},setZero:function(){Entry.hw.sendQueue.SET?Object.keys(Entry.hw.sendQueue.SET).forEach(function(a){Entry.hw.sendQueue.SET[a].data=0;Entry.hw.sendQueue.TIME=Entry.ArduinoExt.getSensorTime(Entry.hw.sendQueue.SET[a].type);Entry.hw.sendQueue.KEY=Entry.ArduinoExt.getSensorKey()}): Entry.hw.sendQueue={SET:{0:{type:Entry.ArduinoExt.sensorTypes.DIGITAL,data:0},1:{type:Entry.ArduinoExt.sensorTypes.DIGITAL,data:0},2:{type:Entry.ArduinoExt.sensorTypes.DIGITAL,data:0},3:{type:Entry.ArduinoExt.sensorTypes.DIGITAL,data:0},4:{type:Entry.ArduinoExt.sensorTypes.DIGITAL,data:0},5:{type:Entry.ArduinoExt.sensorTypes.DIGITAL,data:0},6:{type:Entry.ArduinoExt.sensorTypes.DIGITAL,data:0},7:{type:Entry.ArduinoExt.sensorTypes.DIGITAL,data:0},8:{type:Entry.ArduinoExt.sensorTypes.DIGITAL,data:0}, 9:{type:Entry.ArduinoExt.sensorTypes.DIGITAL,data:0},10:{type:Entry.ArduinoExt.sensorTypes.DIGITAL,data:0},11:{type:Entry.ArduinoExt.sensorTypes.DIGITAL,data:0},12:{type:Entry.ArduinoExt.sensorTypes.DIGITAL,data:0},13:{type:Entry.ArduinoExt.sensorTypes.DIGITAL,data:0}},TIME:Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.DIGITAL),KEY:Entry.ArduinoExt.getSensorKey()};Entry.hw.update()},sensorTypes:{ALIVE:0,DIGITAL:1,ANALOG:2,PWM:3,SERVO_PIN:4,TONE:5,PULSEIN:6,ULTRASONIC:7,TIMER:8},toneMap:{1:[33, 65,131,262,523,1046,2093,4186],2:[35,69,139,277,554,1109,2217,4435],3:[37,73,147,294,587,1175,2349,4699],4:[39,78,156,311,622,1245,2849,4978],5:[41,82,165,330,659,1319,2637,5274],6:[44,87,175,349,698,1397,2794,5588],7:[46,92,185,370,740,1480,2960,5920],8:[49,98,196,392,784,1568,3136,6272],9:[52,104,208,415,831,1661,3322,6645],10:[55,110,220,440,880,1760,3520,7040],11:[58,117,233,466,932,1865,3729,7459],12:[62,123,247,494,988,1976,3951,7902]},BlockState:{}};Entry.SensorBoard={name:"sensorBoard",setZero:Entry.Arduino.setZero}; -Entry.ardublock={name:"ardublock",setZero:Entry.Arduino.setZero};Entry.dplay={name:"dplay",vel_value:255,Left_value:255,Right_value:255,setZero:Entry.Arduino.setZero,timeouts:[],removeTimeout:function(b){clearTimeout(b);var a=this.timeouts;b=a.indexOf(b);0<=b&&a.splice(b,1)},removeAllTimeouts:function(){var b=this.timeouts,a;for(a in b)clearTimeout(b[a]);this.timeouts=[]}};Entry.nemoino={name:"nemoino",setZero:Entry.Arduino.setZero};Entry.joystick={name:"joystick",setZero:Entry.Arduino.setZero}; -Entry.CODEino={name:"CODEino",setZero:Entry.Arduino.setZero,monitorTemplate:Entry.Arduino.monitorTemplate};Blockly.Blocks.arduino_text={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldTextInput("Arduino"),"NAME");this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.arduino_text=function(b,a){return a.getStringField("NAME")}; +Entry.ardublock={name:"ardublock",setZero:Entry.Arduino.setZero};Entry.dplay={name:"dplay",vel_value:255,Left_value:255,Right_value:255,setZero:Entry.Arduino.setZero,timeouts:[],removeTimeout:function(a){clearTimeout(a);var b=this.timeouts;a=b.indexOf(a);0<=a&&b.splice(a,1)},removeAllTimeouts:function(){var a=this.timeouts,b;for(b in a)clearTimeout(a[b]);this.timeouts=[]}};Entry.nemoino={name:"nemoino",setZero:Entry.Arduino.setZero};Entry.joystick={name:"joystick",setZero:Entry.Arduino.setZero}; +Entry.CODEino={name:"CODEino",setZero:Entry.Arduino.setZero,monitorTemplate:Entry.Arduino.monitorTemplate};Blockly.Blocks.arduino_text={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldTextInput("Arduino"),"NAME");this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.arduino_text=function(a,b){return b.getStringField("NAME")}; 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()}; +Entry.block.arduino_send=function(a,b){a=b.getValue("VALUE",b);var c=new XMLHttpRequest;c.open("POST","http://localhost:23518/arduino/",!1);c.send(String(a));Entry.assert(200==c.status,"arduino is not connected");return b.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(a,b){a=b.getValue("VALUE",b);b=new XMLHttpRequest;b.open("POST","http://localhost:23518/arduino/",!1);b.send(String(a));Entry.assert(200==b.status,"arduino is not connected");return Number(b.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}; +Entry.block.arduino_get_string=function(a,b){a=b.getValue("VALUE",b);b=new XMLHttpRequest;b.open("POST","http://localhost:23518/arduino/",!1);b.send(String(a));Entry.assert(200==b.status,"arduino is not connected");return b.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(" "); -this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.arduino_get_sensor_number=function(b,a){return a.getStringField("PORT")}; -Blockly.Blocks.arduino_get_port_number={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["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"]]),"PORT");this.appendDummyInput().appendField(" ");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.arduino_get_port_number=function(b,a){return a.getStringField("PORT")}; -Blockly.Blocks.arduino_get_pwm_port_number={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["3","3"],["5","5"],["6","6"],["9","9"],["10","10"],["11","11"]]),"PORT");this.appendDummyInput().appendField(" ");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.arduino_get_pwm_port_number=function(b,a){return a.getStringField("PORT")}; -Blockly.Blocks.arduino_get_number_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_sensor_value_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_sensor_value_2).appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.arduino_get_number_sensor_value=function(b,a){var c=a.getValue("VALUE",a);return Entry.hw.getAnalogPortValue(c[1])}; -Blockly.Blocks.arduino_get_digital_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_get_digital_value_1);this.appendValueInput("VALUE").setCheck("Number");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_sensor_value_2).appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}};Entry.block.arduino_get_digital_value=function(b,a){var c=a.getNumberValue("VALUE",a);return Entry.hw.getDigitalPortValue(c)}; +this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.arduino_get_sensor_number=function(a,b){return b.getStringField("PORT")}; +Blockly.Blocks.arduino_get_port_number={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["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"]]),"PORT");this.appendDummyInput().appendField(" ");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.arduino_get_port_number=function(a,b){return b.getStringField("PORT")}; +Blockly.Blocks.arduino_get_pwm_port_number={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["3","3"],["5","5"],["6","6"],["9","9"],["10","10"],["11","11"]]),"PORT");this.appendDummyInput().appendField(" ");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.arduino_get_pwm_port_number=function(a,b){return b.getStringField("PORT")}; +Blockly.Blocks.arduino_get_number_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_sensor_value_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_sensor_value_2).appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.arduino_get_number_sensor_value=function(a,b){a=b.getValue("VALUE",b);return Entry.hw.getAnalogPortValue(a[1])}; +Blockly.Blocks.arduino_get_digital_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_get_digital_value_1);this.appendValueInput("VALUE").setCheck("Number");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_sensor_value_2).appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}};Entry.block.arduino_get_digital_value=function(a,b){a=b.getNumberValue("VALUE",b);return Entry.hw.getDigitalPortValue(a)}; Blockly.Blocks.arduino_toggle_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_pin_1);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_pin_2);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.ARDUINO_on,"on"],[Lang.Blocks.ARDUINO_off,"off"]]),"OPERATOR").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*")); -this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.arduino_toggle_led=function(b,a){var c=a.getNumberValue("VALUE"),d="on"==a.getField("OPERATOR")?255:0;Entry.hw.setDigitalPortValue(c,d);return a.callReturn()}; +this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.arduino_toggle_led=function(a,b){a=b.getNumberValue("VALUE");var c=b.getField("OPERATOR");Entry.hw.setDigitalPortValue(a,"on"==c?255:0);return b.callReturn()}; Blockly.Blocks.arduino_toggle_pwm={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_toggle_pwm_1);this.appendValueInput("PORT").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_toggle_pwm_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_toggle_pwm_3);this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png", -"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.arduino_toggle_pwm=function(b,a){var c=a.getNumberValue("PORT"),d=a.getNumberValue("VALUE"),d=Math.round(d),d=Math.max(d,0),d=Math.min(d,255);Entry.hw.setDigitalPortValue(c,d);return a.callReturn()}; +"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.arduino_toggle_pwm=function(a,b){a=b.getNumberValue("PORT");var c=b.getNumberValue("VALUE"),c=Math.round(c),c=Math.max(c,0),c=Math.min(c,255);Entry.hw.setDigitalPortValue(a,c);return b.callReturn()}; Blockly.Blocks.arduino_convert_scale={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_1);this.appendValueInput("VALUE1").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_2);this.appendValueInput("VALUE2").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_3);this.appendValueInput("VALUE3").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_4); this.appendValueInput("VALUE4").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_5);this.appendValueInput("VALUE5").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_6);this.appendDummyInput().appendField(" ");this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.arduino_convert_scale=function(b,a){var c=a.getNumberValue("VALUE1",a),d=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a),f=a.getNumberValue("VALUE4",a),g=a.getNumberValue("VALUE5",a);if(d>e)var h=d,d=e,e=h;f>g&&(h=f,f=g,g=h);c-=d;c*=(g-f)/(e-d);c+=f;c=Math.min(g,c);c=Math.max(f,c);return Math.round(c)}; -Blockly.Blocks.sensorBoard_get_named_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["\uc18c\ub9ac","0"],["\ube5b \uac10\uc9c0","1"],["\uc2ac\ub77c\uc774\ub354","2"],["\uc628\ub3c4","3"]]),"PORT").appendField(" \uc13c\uc11c\uac12");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.sensorBoard_get_named_sensor_value=function(b,a){return Entry.hw.getAnalogPortValue(a.getField("PORT",a))}; +Entry.block.arduino_convert_scale=function(a,b){var c=b.getNumberValue("VALUE1",b),d=b.getNumberValue("VALUE2",b),e=b.getNumberValue("VALUE3",b);a=b.getNumberValue("VALUE4",b);b=b.getNumberValue("VALUE5",b);if(d>e)var f=d,d=e,e=f;a>b&&(f=a,a=b,b=f);c=(b-a)/(e-d)*(c-d);c+=a;c=Math.min(b,c);c=Math.max(a,c);return Math.round(c)}; +Blockly.Blocks.sensorBoard_get_named_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["\uc18c\ub9ac","0"],["\ube5b \uac10\uc9c0","1"],["\uc2ac\ub77c\uc774\ub354","2"],["\uc628\ub3c4","3"]]),"PORT").appendField(" \uc13c\uc11c\uac12");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.sensorBoard_get_named_sensor_value=function(a,b){return Entry.hw.getAnalogPortValue(b.getField("PORT",b))}; Blockly.Blocks.sensorBoard_is_button_pressed={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["\ube68\uac04","8"],["\ud30c\ub780","9"],["\ub178\ub780","10"],["\ucd08\ub85d","11"]]),"PORT");this.appendDummyInput().appendField(" \ubc84\ud2bc\uc744 \ub20c\ub800\ub294\uac00?");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}}; -Entry.block.sensorBoard_is_button_pressed=function(b,a){return Entry.hw.getDigitalPortValue(a.getNumberField("PORT",a))}; +Entry.block.sensorBoard_is_button_pressed=function(a,b){return Entry.hw.getDigitalPortValue(b.getNumberField("PORT",b))}; Blockly.Blocks.sensorBoard_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["\ube68\uac04","2"],["\ucd08\ub85d","3"],["\ud30c\ub780","4"],["\ud770\uc0c9","5"]]),"PORT").appendField(" LED").appendField(new Blockly.FieldDropdown([["\ucf1c\uae30","255"],["\ub044\uae30","0"]]),"OPERATOR").appendField(" ").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0); -this.setNextStatement(!0)}};Entry.block.sensorBoard_led=function(b,a){Entry.hw.setDigitalPortValue(a.getField("PORT"),a.getNumberField("OPERATOR"));return a.callReturn()};Entry.block.arduino_download_connector={skeleton:"basic_button",color:"#eee",template:"%1",params:[{type:"Text",text:"\uc5f0\uacb0 \ud504\ub85c\uadf8\ub7a8 \ub2e4\uc6b4\ub85c\ub4dc",color:"#333",align:"center"}],func:function(){},events:{mousedown:[function(){console.log("download connector")}]}}; +this.setNextStatement(!0)}};Entry.block.sensorBoard_led=function(a,b){Entry.hw.setDigitalPortValue(b.getField("PORT"),b.getNumberField("OPERATOR"));return b.callReturn()};Entry.block.arduino_download_connector={skeleton:"basic_button",color:"#eee",template:"%1",params:[{type:"Text",text:"\uc5f0\uacb0 \ud504\ub85c\uadf8\ub7a8 \ub2e4\uc6b4\ub85c\ub4dc",color:"#333",align:"center"}],func:function(){},events:{mousedown:[function(){console.log("download connector")}]}}; Entry.block.arduino_download_source={skeleton:"basic_button",color:"#eee",template:"%1",params:[{type:"Text",text:"\uc5d4\ud2b8\ub9ac \uc544\ub450\uc774\ub178 \uc18c\uc2a4",color:"#333",align:"center"}],func:function(){},events:{mousedown:[function(){console.log("download source")}]}};Entry.block.arduino_connected={skeleton:"basic_button",color:"#eee",template:"%1",params:[{type:"Text",text:"\uc5f0\uacb0 \ub428",color:"#333",align:"center"}],func:function(){},events:{mousedown:[function(){console.log("download source")}]}}; Entry.block.arduino_reconnect={skeleton:"basic_button",color:"#eee",template:"%1",params:[{type:"Text",text:"\ub2e4\uc2dc \uc5f0\uacb0\ud558\uae30",color:"#333",align:"center"}],func:function(){},events:{mousedown:[function(){console.log("download source")}]}}; Blockly.Blocks.CODEino_get_sensor_number={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.CODEino_get_sensor_number_0,"A0"],[Lang.Blocks.CODEino_get_sensor_number_1,"A1"],[Lang.Blocks.CODEino_get_sensor_number_2,"A2"],[Lang.Blocks.CODEino_get_sensor_number_3,"A3"],[Lang.Blocks.CODEino_get_sensor_number_4,"A4"],[Lang.Blocks.CODEino_get_sensor_number_5,"A5"],[Lang.Blocks.CODEino_get_sensor_number_6,"A6"]]),"PORT");this.appendDummyInput().appendField(" "); -this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.CODEino_get_sensor_number=function(b,a){return a.getStringField("PORT")}; +this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.CODEino_get_sensor_number=function(a,b){return b.getStringField("PORT")}; Blockly.Blocks.CODEino_get_named_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(" ").appendField(new Blockly.FieldDropdown([[Lang.Blocks.CODEino_sensor_name_0,"0"],[Lang.Blocks.CODEino_sensor_name_1,"1"],[Lang.Blocks.CODEino_sensor_name_2,"2"],[Lang.Blocks.CODEino_sensor_name_3,"3"],[Lang.Blocks.CODEino_sensor_name_4,"4"],[Lang.Blocks.CODEino_sensor_name_5,"5"],[Lang.Blocks.CODEino_sensor_name_6,"6"]]),"PORT").appendField(Lang.Blocks.CODEino_string_1); -this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.CODEino_get_named_sensor_value=function(b,a){return Entry.hw.getAnalogPortValue(a.getField("PORT",a))}; +this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.CODEino_get_named_sensor_value=function(a,b){return Entry.hw.getAnalogPortValue(b.getField("PORT",b))}; Blockly.Blocks.CODEino_get_sound_status={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.CODEino_string_10).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CODEino_string_11,"GREAT"],[Lang.Blocks.CODEino_string_12,"SMALL"]]),"STATUS").appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}}; -Entry.block.CODEino_get_sound_status=function(b,a){return"GREAT"==a.getField("STATUS",a)?600Entry.hw.getAnalogPortValue(0)?1:0}; +Entry.block.CODEino_get_sound_status=function(a,b){return"GREAT"==b.getField("STATUS",b)?600Entry.hw.getAnalogPortValue(0)?1:0}; Blockly.Blocks.CODEino_get_light_status={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.CODEino_string_13).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CODEino_string_14,"BRIGHT"],[Lang.Blocks.CODEino_string_15,"DARK"]]),"STATUS").appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}}; -Entry.block.CODEino_get_light_status=function(b,a){return"DARK"==a.getField("STATUS",a)?800Entry.hw.getAnalogPortValue(1)?1:0}; +Entry.block.CODEino_get_light_status=function(a,b){return"DARK"==b.getField("STATUS",b)?800Entry.hw.getAnalogPortValue(1)?1:0}; Blockly.Blocks.CODEino_is_button_pressed={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.CODEino_string_2).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CODEino_string_3,"4"],[Lang.Blocks.CODEino_string_4,"17"],[Lang.Blocks.CODEino_string_5,"18"],[Lang.Blocks.CODEino_string_6,"19"],[Lang.Blocks.CODEino_string_7,"20"]]),"PORT").appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}}; -Entry.block.CODEino_is_button_pressed=function(b,a){var c=a.getNumberField("PORT",a);return 14d?1:0;if("RIGHT"==c||"FRONT"==c)return 30d?1:0}; +Entry.block.CODEino_get_accelerometer_direction=function(a,b){a=b.getField("DIRECTION",b);b=0;"LEFT"==a||"RIGHT"==a?b=3:"FRONT"==a||"REAR"==a?b=4:"REVERSE"==a&&(b=5);b=Entry.hw.getAnalogPortValue(b)-265;b=Math.min(90,180/137*b+-90);b=Math.max(-90,b);b=Math.round(b);if("LEFT"==a||"REAR"==a)return-30>b?1:0;if("RIGHT"==a||"FRONT"==a)return 30b?1:0}; Blockly.Blocks.CODEino_get_accelerometer_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.CODEino_string_8).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CODEino_accelerometer_X,"3"],[Lang.Blocks.CODEino_accelerometer_Y,"4"],[Lang.Blocks.CODEino_accelerometer_Z,"5"]]),"PORT").appendField(Lang.Blocks.CODEino_string_9);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.CODEino_get_accelerometer_value=function(b,a){var c=265,d=402,e=-90,f=90,g=Entry.hw.getAnalogPortValue(a.getField("PORT",a));if(c>d)var h=c,c=d,d=h;e>f&&(h=e,e=f,f=h);g=(f-e)/(d-c)*(g-c);g+=e;g=Math.min(f,g);g=Math.max(e,g);return Math.round(g)}; +Entry.block.CODEino_get_accelerometer_value=function(a,b){var c=Entry.hw.getAnalogPortValue(b.getField("PORT",b)),d=265,e=402;a=-90;b=90;if(d>e)var f=d,d=e,e=f;a>b&&(f=a,a=b,b=f);c=(b-a)/(e-d)*(c-d);c+=a;c=Math.min(b,c);c=Math.max(a,c);return Math.round(c)}; Blockly.Blocks.dplay_select_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_num_pin_1);this.appendDummyInput().appendField(new Blockly.FieldDropdown([["7","7"],["8","8"],["9","9"],["10","10"]]),"PORT");this.appendDummyInput().appendField(Lang.Blocks.dplay_num_pin_1);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.ARDUINO_on,"on"],[Lang.Blocks.ARDUINO_off,"off"]]),"OPERATOR").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dplay_select_led=function(b,a){var c=a.getField("PORT"),d=7;"7"==c?d=7:"8"==c?d=8:"9"==c?d=9:"10"==c&&(d=10);c="on"==a.getField("OPERATOR")?255:0;Entry.hw.setDigitalPortValue(d,c);return a.callReturn()}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dplay_select_led=function(a,b){var c=b.getField("PORT");a=7;"7"==c?a=7:"8"==c?a=8:"9"==c?a=9:"10"==c&&(a=10);c=b.getField("OPERATOR");Entry.hw.setDigitalPortValue(a,"on"==c?255:0);return b.callReturn()}; Blockly.Blocks.dplay_get_switch_status={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ub514\uc9c0\ud138 ");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["2","2"],["4","4"]]),"PORT");this.appendDummyInput().appendField(Lang.Blocks.dplay_num_pin_2).appendField(new Blockly.FieldDropdown([[Lang.Blocks.dplay_string_5,"ON"],[Lang.Blocks.dplay_string_6,"OFF"]]),"STATUS").appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}}; -Entry.block.dplay_get_switch_status=function(b,a){var c=a.getField("PORT"),d=2;"2"==c?d=2:"4"==c&&(d=4);return"OFF"==a.getField("STATUS")?1==Entry.hw.getDigitalPortValue(d)?1:0:0==Entry.hw.getDigitalPortValue(d)?1:0}; +Entry.block.dplay_get_switch_status=function(a,b){a=b.getField("PORT");var c=2;"2"==a?c=2:"4"==a&&(c=4);return"OFF"==b.getField("STATUS")?1==Entry.hw.getDigitalPortValue(c)?1:0:0==Entry.hw.getDigitalPortValue(c)?1:0}; Blockly.Blocks.dplay_get_light_status={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.dplay_light).appendField(new Blockly.FieldDropdown([[Lang.Blocks.dplay_string_3,"BRIGHT"],[Lang.Blocks.dplay_string_4,"DARK"]]),"STATUS").appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}}; -Entry.block.dplay_get_light_status=function(b,a){return"DARK"==a.getField("STATUS",a)?800Entry.hw.getAnalogPortValue(1)?1:0}; +Entry.block.dplay_get_light_status=function(a,b){return"DARK"==b.getField("STATUS",b)?800Entry.hw.getAnalogPortValue(1)?1:0}; Blockly.Blocks.dplay_get_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.dplay_num_pin_3);this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField("\ubc88 ");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["\uac00\ubcc0\uc800\ud56d","ADJU"],["\ube5b\uc13c\uc11c","LIGHT"],["\uc628\ub3c4\uc13c\uc11c","TEMP"],["\uc870\uc774\uc2a4\ud2f1 X","JOYS"],["\uc870\uc774\uc2a4\ud2f1 Y","JOYS"],["\uc801\uc678\uc120", -"INFR"]]),"OPERATOR");this.appendDummyInput().appendField(Lang.Blocks.dplay_num_pin_5);this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.dplay_get_value=function(b,a){var c=a.getValue("VALUE",a);return Entry.hw.getAnalogPortValue(c[1])}; +"INFR"]]),"OPERATOR");this.appendDummyInput().appendField(Lang.Blocks.dplay_num_pin_5);this.setInputsInline(!0);this.setOutput(!0,"Number")}};Entry.block.dplay_get_value=function(a,b){a=b.getValue("VALUE",b);return Entry.hw.getAnalogPortValue(a[1])}; Blockly.Blocks.dplay_get_tilt={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.dplay_tilt).appendField(new Blockly.FieldDropdown([["\uc67c\ucabd \uae30\uc6b8\uc784","LEFT"],["\uc624\ub978\ucabd \uae30\uc6b8\uc784","LIGHT"]]),"STATUS").appendField(" ");this.setInputsInline(!0);this.setOutput(!0,"Boolean")}}; -Entry.block.dplay_get_tilt=function(b,a){return"LIGHT"==a.getField("STATUS",a)?1==Entry.hw.getDigitalPortValue(12)?1:0:0==Entry.hw.getDigitalPortValue(12)?1:0}; +Entry.block.dplay_get_tilt=function(a,b){return"LIGHT"==b.getField("STATUS",b)?1==Entry.hw.getDigitalPortValue(12)?1:0:0==Entry.hw.getDigitalPortValue(12)?1:0}; Blockly.Blocks.dplay_DCmotor={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["\uc67c\ucabd","3"],["\uc624\ub978\ucabd","6"]]),"PORT");this.appendDummyInput().appendField(" DC\ubaa8\ud130 \uc0c1\ud0dc\ub97c");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["\uc815\ubc29\ud5a5","FRONT"],["\uc5ed\ubc29\ud5a5","REAR"],["\uc815\uc9c0","OFF"]]),"OPERATOR").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png", -"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dplay_DCmotor=function(b,a){var c=a.getField("PORT"),d=0;"3"==c?d=5:"6"==c&&(d=11);var e=a.getField("OPERATOR"),f=0,g=0;"FRONT"==e?(f=255,g=0):"REAR"==e?(f=0,g=255):"OFF"==e&&(g=f=0);Entry.hw.setDigitalPortValue(c,f);Entry.hw.setDigitalPortValue(d,g);return a.callReturn()}; +"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dplay_DCmotor=function(a,b){a=b.getField("PORT");var c=0;"3"==a?c=5:"6"==a&&(c=11);var d=b.getField("OPERATOR"),e=0,f=0;"FRONT"==d?(e=255,f=0):"REAR"==d?(e=0,f=255):"OFF"==d&&(f=e=0);Entry.hw.setDigitalPortValue(a,e);Entry.hw.setDigitalPortValue(c,f);return b.callReturn()}; Blockly.Blocks.dplay_buzzer={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ubd80\uc800\ub97c ");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["\ub3c4","1"],["\ub808","2"],["\ubbf8","3"]]),"PORT");this.appendDummyInput().appendField("\ub85c");this.appendValueInput("VALUE").setCheck(["Number","String",null]);this.appendDummyInput().appendField("\ubc15\uc790\ub85c \uc5f0\uc8fc\ud558\uae30");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dplay_buzzer=function(b,a){var c=a.getField("PORT"),d=2;"1"==c?d=2:"2"==c?d=4:"3"==c&&(d=7);c=a.getNumberValue("VALUE");c=Math.round(c);c=Math.max(c,0);c=Math.min(c,100);Entry.hw.setDigitalPortValue(d,c);return a.callReturn()}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dplay_buzzer=function(a,b){var c=b.getField("PORT");a=2;"1"==c?a=2:"2"==c?a=4:"3"==c&&(a=7);c=b.getNumberValue("VALUE");c=Math.round(c);c=Math.max(c,0);c=Math.min(c,100);Entry.hw.setDigitalPortValue(a,c);return b.callReturn()}; Blockly.Blocks.dplay_servo={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc11c\ubcf4\ubaa8\ud130 \uac01\ub3c4\ub97c");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("\ub85c \uc774\ub3d9");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.dplay_servo=function(b,a){var c=a.getNumberValue("VALUE"),c=Math.round(c),c=Math.max(c,0),c=Math.min(c,180);Entry.hw.setDigitalPortValue(9,c);return a.callReturn()};Entry.Bitbrick={SENSOR_MAP:{1:"light",2:"IR",3:"touch",4:"potentiometer",5:"MIC",21:"UserSensor",11:"UserInput",20:"LED",19:"SERVO",18:"DC"},PORT_MAP:{buzzer:2,5:4,6:6,7:8,8:10,LEDR:12,LEDG:14,LEDB:16},sensorList:function(){for(var b=[],a=Entry.hw.portData,c=1;5>c;c++){var d=a[c];d&&(d.value||0===d.value)&&b.push([c+" - "+Lang.Blocks["BITBRICK_"+d.type],c.toString()])}return 0==b.length?[[Lang.Blocks.no_target,"null"]]:b},touchList:function(){for(var b=[],a=Entry.hw.portData,c=1;5>c;c++){var d=a[c]; -d&&"touch"===d.type&&b.push([c.toString(),c.toString()])}return 0==b.length?[[Lang.Blocks.no_target,"null"]]:b},servoList:function(){for(var b=[],a=Entry.hw.portData,c=5;9>c;c++){var d=a[c];d&&"SERVO"===d.type&&b.push(["ABCD"[c-5],c.toString()])}return 0==b.length?[[Lang.Blocks.no_target,"null"]]:b},dcList:function(){for(var b=[],a=Entry.hw.portData,c=5;9>c;c++){var d=a[c];d&&"DC"===d.type&&b.push(["ABCD"[c-5],c.toString()])}return 0==b.length?[[Lang.Blocks.no_target,"null"]]:b},setZero:function(){var b= -Entry.hw.sendQueue,a;for(a in Entry.Bitbrick.PORT_MAP)b[a]=0;Entry.hw.update()},name:"bitbrick",servoMaxValue:181,servoMinValue:1,dcMaxValue:100,dcMinValue:-100,monitorTemplate:{keys:["value"],imgPath:"hw/bitbrick.png",width:400,height:400,listPorts:{1:{name:Lang.Hw.port_en+" 1 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},2:{name:Lang.Hw.port_en+" 2 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},3:{name:Lang.Hw.port_en+" 3 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},4:{name:Lang.Hw.port_en+" 4 "+ +Entry.block.dplay_servo=function(a,b){a=b.getNumberValue("VALUE");a=Math.round(a);a=Math.max(a,0);a=Math.min(a,180);Entry.hw.setDigitalPortValue(9,a);return b.callReturn()};Entry.Bitbrick={SENSOR_MAP:{1:"light",2:"IR",3:"touch",4:"potentiometer",5:"MIC",21:"UserSensor",11:"UserInput",20:"LED",19:"SERVO",18:"DC"},PORT_MAP:{buzzer:2,5:4,6:6,7:8,8:10,LEDR:12,LEDG:14,LEDB:16},sensorList:function(){for(var a=[],b=Entry.hw.portData,c=1;5>c;c++){var d=b[c];d&&(d.value||0===d.value)&&a.push([c+" - "+Lang.Blocks["BITBRICK_"+d.type],c.toString()])}return 0==a.length?[[Lang.Blocks.no_target,"null"]]:a},touchList:function(){for(var a=[],b=Entry.hw.portData,c=1;5>c;c++){var d=b[c]; +d&&"touch"===d.type&&a.push([c.toString(),c.toString()])}return 0==a.length?[[Lang.Blocks.no_target,"null"]]:a},servoList:function(){for(var a=[],b=Entry.hw.portData,c=5;9>c;c++){var d=b[c];d&&"SERVO"===d.type&&a.push(["ABCD"[c-5],c.toString()])}return 0==a.length?[[Lang.Blocks.no_target,"null"]]:a},dcList:function(){for(var a=[],b=Entry.hw.portData,c=5;9>c;c++){var d=b[c];d&&"DC"===d.type&&a.push(["ABCD"[c-5],c.toString()])}return 0==a.length?[[Lang.Blocks.no_target,"null"]]:a},setZero:function(){var a= +Entry.hw.sendQueue,b;for(b in Entry.Bitbrick.PORT_MAP)a[b]=0;Entry.hw.update()},name:"bitbrick",servoMaxValue:181,servoMinValue:1,dcMaxValue:100,dcMinValue:-100,monitorTemplate:{keys:["value"],imgPath:"hw/bitbrick.png",width:400,height:400,listPorts:{1:{name:Lang.Hw.port_en+" 1 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},2:{name:Lang.Hw.port_en+" 2 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},3:{name:Lang.Hw.port_en+" 3 "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},4:{name:Lang.Hw.port_en+" 4 "+ Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},A:{name:Lang.Hw.port_en+" A "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},B:{name:Lang.Hw.port_en+" B "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},C:{name:Lang.Hw.port_en+" C "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}},D:{name:Lang.Hw.port_en+" D "+Lang.Hw.port_ko,type:"input",pos:{x:0,y:0}}},mode:"both"}}; -Blockly.Blocks.bitbrick_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.sensorList),"PORT").appendField(" \uac12");this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.bitbrick_sensor_value=function(b,a){var c=a.getStringField("PORT");return Entry.hw.portData[c].value}; -Blockly.Blocks.bitbrick_is_touch_pressed={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.BITBRICK_touch).appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.touchList),"PORT").appendField("\uc774(\uac00) \ub20c\ub838\ub294\uac00?");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.bitbrick_is_touch_pressed=function(b,a){return 0===Entry.hw.portData[a.getStringField("PORT")].value}; -Blockly.Blocks.bitbrick_turn_off_color_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uceec\ub7ec LED \ub044\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.bitbrick_turn_off_color_led=function(b,a){Entry.hw.sendQueue.LEDR=0;Entry.hw.sendQueue.LEDG=0;Entry.hw.sendQueue.LEDB=0;return a.callReturn()}; +Blockly.Blocks.bitbrick_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.sensorList),"PORT").appendField(" \uac12");this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.bitbrick_sensor_value=function(a,b){a=b.getStringField("PORT");return Entry.hw.portData[a].value}; +Blockly.Blocks.bitbrick_is_touch_pressed={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.BITBRICK_touch).appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.touchList),"PORT").appendField("\uc774(\uac00) \ub20c\ub838\ub294\uac00?");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.bitbrick_is_touch_pressed=function(a,b){return 0===Entry.hw.portData[b.getStringField("PORT")].value}; +Blockly.Blocks.bitbrick_turn_off_color_led={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uceec\ub7ec LED \ub044\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.bitbrick_turn_off_color_led=function(a,b){Entry.hw.sendQueue.LEDR=0;Entry.hw.sendQueue.LEDG=0;Entry.hw.sendQueue.LEDB=0;return b.callReturn()}; Blockly.Blocks.bitbrick_turn_on_color_led_by_rgb={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uceec\ub7ec LED \ucf1c\uae30 R");this.appendValueInput("rValue").setCheck(["Number","String"]);this.appendDummyInput().appendField("G");this.appendValueInput("gValue").setCheck(["Number","String"]);this.appendDummyInput().appendField("B");this.appendValueInput("bValue").setCheck(["Number","String"]);this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.bitbrick_turn_on_color_led_by_rgb=function(b,a){var c=a.getNumberValue("rValue"),d=a.getNumberValue("gValue"),e=a.getNumberValue("bValue"),f=Entry.adjustValueWithMaxMin,g=Entry.hw.sendQueue;g.LEDR=f(c,0,255);g.LEDG=f(d,0,255);g.LEDB=f(e,0,255);return a.callReturn()}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.bitbrick_turn_on_color_led_by_rgb=function(a,b){a=b.getNumberValue("rValue");var c=b.getNumberValue("gValue"),d=b.getNumberValue("bValue"),e=Entry.adjustValueWithMaxMin,f=Entry.hw.sendQueue;f.LEDR=e(a,0,255);f.LEDG=e(c,0,255);f.LEDB=e(d,0,255);return b.callReturn()}; Blockly.Blocks.bitbrick_turn_on_color_led_by_picker={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uceec\ub7ec LED \uc0c9 ").appendField(new Blockly.FieldColour("#ff0000"),"VALUE").appendField("\ub85c \uc815\ud558\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.bitbrick_turn_on_color_led_by_picker=function(b,a){var c=a.getStringField("VALUE");Entry.hw.sendQueue.LEDR=parseInt(c.substr(1,2),16);Entry.hw.sendQueue.LEDG=parseInt(c.substr(3,2),16);Entry.hw.sendQueue.LEDB=parseInt(c.substr(5,2),16);return a.callReturn()}; +Entry.block.bitbrick_turn_on_color_led_by_picker=function(a,b){a=b.getStringField("VALUE");Entry.hw.sendQueue.LEDR=parseInt(a.substr(1,2),16);Entry.hw.sendQueue.LEDG=parseInt(a.substr(3,2),16);Entry.hw.sendQueue.LEDB=parseInt(a.substr(5,2),16);return b.callReturn()}; Blockly.Blocks.bitbrick_turn_on_color_led_by_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uceec\ub7ec LED \ucf1c\uae30 \uc0c9");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("\ub85c \uc815\ud558\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.bitbrick_turn_on_color_led_by_value=function(b,a){var c=a.getNumberValue("VALUE"),d,e,f,c=c%200;67>c?(d=200-3*c,e=3*c,f=0):134>c?(c-=67,d=0,e=200-3*c,f=3*c):201>c&&(c-=134,d=3*c,e=0,f=200-3*c);Entry.hw.sendQueue.LEDR=d;Entry.hw.sendQueue.LEDG=e;Entry.hw.sendQueue.LEDB=f;return a.callReturn()}; +Entry.block.bitbrick_turn_on_color_led_by_value=function(a,b){a=b.getNumberValue("VALUE");var c,d,e;a%=200;67>a?(c=200-3*a,d=3*a,e=0):134>a?(a-=67,c=0,d=200-3*a,e=3*a):201>a&&(a-=134,c=3*a,d=0,e=200-3*a);Entry.hw.sendQueue.LEDR=c;Entry.hw.sendQueue.LEDG=d;Entry.hw.sendQueue.LEDB=e;return b.callReturn()}; Blockly.Blocks.bitbrick_buzzer={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ubc84\uc800\uc74c ");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("\ub0b4\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.bitbrick_buzzer=function(b,a){if(a.isStart)return Entry.hw.sendQueue.buzzer=0,delete a.isStart,a.callReturn();var c=a.getNumberValue("VALUE");Entry.hw.sendQueue.buzzer=c;a.isStart=!0;return a}; +Entry.block.bitbrick_buzzer=function(a,b){if(b.isStart)return Entry.hw.sendQueue.buzzer=0,delete b.isStart,b.callReturn();a=b.getNumberValue("VALUE");Entry.hw.sendQueue.buzzer=a;b.isStart=!0;return b}; Blockly.Blocks.bitbrick_turn_off_all_motors={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ubaa8\ub4e0 \ubaa8\ud130 \ub044\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.bitbrick_turn_off_all_motors=function(b,a){var c=Entry.hw.sendQueue,d=Entry.Bitbrick;d.servoList().map(function(a){c[a[1]]=0});d.dcList().map(function(a){c[a[1]]=128});return a.callReturn()}; +Entry.block.bitbrick_turn_off_all_motors=function(a,b){var c=Entry.hw.sendQueue;a=Entry.Bitbrick;a.servoList().map(function(b){c[b[1]]=0});a.dcList().map(function(b){c[b[1]]=128});return b.callReturn()}; Blockly.Blocks.bitbrick_dc_speed={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("DC \ubaa8\ud130").appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.dcList),"PORT").appendField(" \uc18d\ub3c4");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setPreviousStatement(!0);this.setNextStatement(!0);this.setInputsInline(!0)}}; -Entry.block.bitbrick_dc_speed=function(b,a){var c=a.getNumberValue("VALUE"),c=Math.min(c,Entry.Bitbrick.dcMaxValue),c=Math.max(c,Entry.Bitbrick.dcMinValue);Entry.hw.sendQueue[a.getStringField("PORT")]=c+128;return a.callReturn()}; +Entry.block.bitbrick_dc_speed=function(a,b){a=b.getNumberValue("VALUE");a=Math.min(a,Entry.Bitbrick.dcMaxValue);a=Math.max(a,Entry.Bitbrick.dcMinValue);Entry.hw.sendQueue[b.getStringField("PORT")]=a+128;return b.callReturn()}; Blockly.Blocks.bitbrick_dc_direction_speed={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("DC \ubaa8\ud130").appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.dcList),"PORT").appendField(" ").appendField(new Blockly.FieldDropdown([[Lang.Blocks.BITBRICK_dc_direction_cw,"CW"],[Lang.Blocks.BITBRICK_dc_direction_ccw,"CCW"]]),"DIRECTION").appendField(" \ubc29\ud5a5").appendField(" \uc18d\ub825");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setPreviousStatement(!0);this.setNextStatement(!0);this.setInputsInline(!0)}};Entry.block.bitbrick_dc_direction_speed=function(b,a){var c="CW"===a.getStringField("DIRECTION"),d=a.getNumberValue("VALUE"),d=Math.min(d,Entry.Bitbrick.dcMaxValue),d=Math.max(d,0);Entry.hw.sendQueue[a.getStringField("PORT")]=c?d+128:128-d;return a.callReturn()}; +"block_icon/hardware_03.png","*"));this.setPreviousStatement(!0);this.setNextStatement(!0);this.setInputsInline(!0)}};Entry.block.bitbrick_dc_direction_speed=function(a,b){a="CW"===b.getStringField("DIRECTION");var c=b.getNumberValue("VALUE"),c=Math.min(c,Entry.Bitbrick.dcMaxValue),c=Math.max(c,0);Entry.hw.sendQueue[b.getStringField("PORT")]=a?c+128:128-c;return b.callReturn()}; Blockly.Blocks.bitbrick_servomotor_angle={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc11c\ubcf4 \ubaa8\ud130").appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.servoList),"PORT").appendField(" \uac01\ub3c4");this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField("").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setPreviousStatement(!0);this.setNextStatement(!0); -this.setInputsInline(!0)}};Entry.block.bitbrick_servomotor_angle=function(b,a){var c=a.getNumberValue("VALUE")+1,c=Math.min(c,Entry.Bitbrick.servoMaxValue),c=Math.max(c,Entry.Bitbrick.servoMinValue);Entry.hw.sendQueue[a.getStringField("PORT")]=c;return a.callReturn()}; +this.setInputsInline(!0)}};Entry.block.bitbrick_servomotor_angle=function(a,b){a=b.getNumberValue("VALUE")+1;a=Math.min(a,Entry.Bitbrick.servoMaxValue);a=Math.max(a,Entry.Bitbrick.servoMinValue);Entry.hw.sendQueue[b.getStringField("PORT")]=a;return b.callReturn()}; Blockly.Blocks.bitbrick_convert_scale={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\ubcc0\ud658");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdownDynamic(Entry.Bitbrick.sensorList),"PORT");this.appendDummyInput().appendField("\uac12");this.appendValueInput("VALUE2").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_3);this.appendValueInput("VALUE3").setCheck(["Number","String",null]); this.appendDummyInput().appendField("\uc5d0\uc11c");this.appendValueInput("VALUE4").setCheck(["Number","String",null]);this.appendDummyInput().appendField(Lang.Blocks.ARDUINO_convert_scale_5);this.appendValueInput("VALUE5").setCheck(["Number","String",null]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.bitbrick_convert_scale=function(b,a){var c=a.getNumberField("PORT"),d=Entry.hw.portData[c].value,c=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a),f=a.getNumberValue("VALUE4",a),g=a.getNumberValue("VALUE5",a);if(f>g)var h=f,f=g,g=h;d-=c;d*=(g-f)/(e-c);d+=f;d=Math.min(g,d);d=Math.max(f,d);return Math.round(d)};var categoryColor="#FF9E20";Blockly.Blocks.start_drawing={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_start_drawing).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.start_drawing=function(b,a){b.brush?b.brush.stop=!1:Entry.setBasicBrush(b);Entry.stage.sortZorder();b.brush.moveTo(b.getX(),-1*b.getY());return a.callReturn()}; -Blockly.Blocks.stop_drawing={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_stop_drawing).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.stop_drawing=function(b,a){b.brush&&b.shape&&(b.brush.stop=!0);return a.callReturn()}; +Entry.block.bitbrick_convert_scale=function(a,b){a=b.getNumberField("PORT");var c=Entry.hw.portData[a].value,d=b.getNumberValue("VALUE2",b),e=b.getNumberValue("VALUE3",b);a=b.getNumberValue("VALUE4",b);b=b.getNumberValue("VALUE5",b);if(a>b){var f=a;a=b;b=f}c=(b-a)/(e-d)*(c-d);c+=a;c=Math.min(b,c);c=Math.max(a,c);return Math.round(c)};var categoryColor="#FF9E20";Blockly.Blocks.start_drawing={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_start_drawing).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.start_drawing=function(a,b){a.brush?a.brush.stop=!1:Entry.setBasicBrush(a);Entry.stage.sortZorder();a.brush.moveTo(a.getX(),-1*a.getY());return b.callReturn()}; +Blockly.Blocks.stop_drawing={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_stop_drawing).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.stop_drawing=function(a,b){a.brush&&a.shape&&(a.brush.stop=!0);return b.callReturn()}; Blockly.Blocks.set_color={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_color_1);this.appendDummyInput().appendField(new Blockly.FieldColour("#ff0000"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_color_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_color=function(b,a){var c=a.getField("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(c=Entry.hex2rgb(c),b.brush.rgb=c,b.brush.endStroke(),b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; +Entry.block.set_color=function(a,b){var c=b.getField("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(c=Entry.hex2rgb(c),a.brush.rgb=c,a.brush.endStroke(),a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}; Blockly.Blocks.set_random_color={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_random_color).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_random_color=function(b,a){b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);if(b.brush){var c=Entry.generateRgb();b.brush.rgb=c;b.brush.endStroke();b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")");b.brush.moveTo(b.getX(),-1*b.getY())}return a.callReturn()}; +Entry.block.set_random_color=function(a,b){a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);if(a.brush){var c=Entry.generateRgb();a.brush.rgb=c;a.brush.endStroke();a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")");a.brush.moveTo(a.getX(),-1*a.getY())}return b.callReturn()}; Blockly.Blocks.change_thickness={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_change_thickness_1);this.appendValueInput("VALUE").setCheck(["Number","Boolean"]);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_change_thickness_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_thickness=function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.thickness+=c,1>b.brush.thickness&&(b.brush.thickness=1),b.brush.setStrokeStyle(b.brush.thickness),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; +Entry.block.change_thickness=function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(a.brush.thickness+=c,1>a.brush.thickness&&(a.brush.thickness=1),a.brush.setStrokeStyle(a.brush.thickness),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}; Blockly.Blocks.set_thickness={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_thickness_1);this.appendValueInput("VALUE").setCheck(["Number","Boolean"]);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_thickness_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_thickness=function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.thickness=c,b.brush.setStrokeStyle(b.brush.thickness),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; +Entry.block.set_thickness=function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(a.brush.thickness=c,a.brush.setStrokeStyle(a.brush.thickness),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}; Blockly.Blocks.change_opacity={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_change_opacity_1);this.appendValueInput("VALUE").setCheck(["Number","Boolean"]);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_change_opacity_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_opacity=function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);c=Entry.adjustValueWithMaxMin(b.brush.opacity+c,0,100);b.brush&&(b.brush.opacity=c,b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; +Entry.block.change_opacity=function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);c=Entry.adjustValueWithMaxMin(a.brush.opacity+c,0,100);a.brush&&(a.brush.opacity=c,a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}; Blockly.Blocks.set_opacity={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_opacity_1);this.appendValueInput("VALUE").setCheck(["Number","Boolean"]);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_opacity_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_opacity=function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; +Entry.block.set_opacity=function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(a.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}; Blockly.Blocks.brush_erase_all={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_brush_erase_all).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.brush_erase_all=function(b,a){var c=b.brush;if(c){var d=c._stroke.style,e=c._strokeStyle.width;c.clear().setStrokeStyle(e).beginStroke(d);c.moveTo(b.getX(),-1*b.getY())}c=b.parent.getStampEntities();c.map(function(a){a.removeClone()});c=null;return a.callReturn()}; -Blockly.Blocks.brush_stamp={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_stamp).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.brush_stamp=function(b,a){b.parent.addStampEntity(b);return a.callReturn()}; +Entry.block.brush_erase_all=function(a,b){var c=a.brush;if(c){var d=c._stroke.style,e=c._strokeStyle.width;c.clear().setStrokeStyle(e).beginStroke(d);c.moveTo(a.getX(),-1*a.getY())}a=a.parent.getStampEntities();a.map(function(b){b.removeClone()});a=null;return b.callReturn()}; +Blockly.Blocks.brush_stamp={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_stamp).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.brush_stamp=function(a,b){a.parent.addStampEntity(a);return b.callReturn()}; Blockly.Blocks.change_brush_transparency={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_change_brush_transparency_1);this.appendValueInput("VALUE").setCheck(["Number","Boolean"]);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_change_brush_transparency_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_brush_transparency=function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);c=Entry.adjustValueWithMaxMin(b.brush.opacity-c,0,100);b.brush&&(b.brush.opacity=c,b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}; +Entry.block.change_brush_transparency=function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);c=Entry.adjustValueWithMaxMin(a.brush.opacity-c,0,100);a.brush&&(a.brush.opacity=c,a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}; Blockly.Blocks.set_brush_tranparency={init:function(){this.setColour(categoryColor);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_brush_transparency_1);this.appendValueInput("VALUE").setCheck(["Number","Boolean"]);this.appendDummyInput().appendField(Lang.Blocks.BRUSH_set_brush_transparency_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/brush_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_brush_tranparency=function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+(1-b.brush.opacity/100)+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()};var calcArrowColor="#e8b349",calcBlockColor="#FFD974",calcFontColor="#3D3D3D";Blockly.Blocks.number={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(new Blockly.FieldTextInput(""),"NUM");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.number=function(b,a){return a.getField("NUM",a)}; -Blockly.Blocks.angle={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(new Blockly.FieldAngle("90"),"ANGLE");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.angle=function(b,a){return a.getNumberField("ANGLE")};Blockly.Blocks.get_x_coordinate={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_x_coordinate,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.get_x_coordinate=function(b,a){return b.getX()};Blockly.Blocks.get_y_coordinate={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_y_coordinate,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.get_y_coordinate=function(b,a){return b.getY()}; -Blockly.Blocks.get_angle={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_angle,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.get_angle=function(b,a){return parseFloat(b.getRotation().toFixed(1))}; +Entry.block.set_brush_tranparency=function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(a.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+(1-a.brush.opacity/100)+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()};var calcArrowColor="#e8b349",calcBlockColor="#FFD974",calcFontColor="#3D3D3D";Blockly.Blocks.number={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(new Blockly.FieldTextInput(""),"NUM");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.number=function(a,b){return b.getField("NUM",b)}; +Blockly.Blocks.angle={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(new Blockly.FieldAngle("90"),"ANGLE");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.angle=function(a,b){return b.getNumberField("ANGLE")};Blockly.Blocks.get_x_coordinate={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_x_coordinate,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; +Entry.block.get_x_coordinate=function(a,b){return a.getX()};Blockly.Blocks.get_y_coordinate={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_y_coordinate,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.get_y_coordinate=function(a,b){return a.getY()}; +Blockly.Blocks.get_angle={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_angle,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.get_angle=function(a,b){return parseFloat(a.getRotation().toFixed(1))}; Blockly.Blocks.get_rotation_direction={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.CALC_rotation_value,"ROTATION"],[Lang.Blocks.CALC_direction_value,"DIRECTION"]],null,!0,calcArrowColor),"OPERATOR");this.appendDummyInput().appendField(" ");this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -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))}; +Entry.block.get_rotation_direction=function(a,b){return"DIRECTION"==b.getField("OPERATOR",b).toUpperCase()?parseFloat(a.getDirection().toFixed(1)):parseFloat(a.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)}; +Entry.block.distance_something=function(a,b){b=b.getField("VALUE",b);if("mouse"==b)return b=Entry.stage.mouseCoordinate,Math.sqrt(Math.pow(a.getX()-b.x,2)+Math.pow(a.getY()-b.y,2));b=Entry.container.getEntity(b);return Math.sqrt(Math.pow(a.getX()-b.getX(),2)+Math.pow(a.getY()-b.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(a,b){return"x"===b.getField("VALUE",b)?Number(Entry.stage.mouseCoordinate.x):Number(Entry.stage.mouseCoordinate.y)}; Blockly.Blocks.coordinate_object={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_coordinate_object_1,calcFontColor).appendField(new Blockly.FieldDropdownDynamic("spritesWithSelf",null,!0,calcArrowColor),"VALUE").appendField(Lang.Blocks.CALC_coordinate_object_2,calcFontColor).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CALC_coordinate_x_value,"x"],[Lang.Blocks.CALC_coordinate_y_value,"y"],[Lang.Blocks.CALC_coordinate_rotation_value,"rotation"], [Lang.Blocks.CALC_coordinate_direction_value,"direction"],[Lang.Blocks.CALC_coordinate_size_value,"size"],[Lang.Blocks.CALC_picture_index,"picture_index"],[Lang.Blocks.CALC_picture_name,"picture_name"]],null,!0,calcArrowColor),"COORDINATE").appendField(Lang.Blocks.CALC_coordinate_object_3,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.coordinate_object=function(b,a){var c=a.getField("VALUE",a),c="self"==c?b:Entry.container.getEntity(c);switch(a.getField("COORDINATE",a)){case "x":return c.getX();case "y":return c.getY();case "rotation":return c.getRotation();case "direction":return c.getDirection();case "picture_index":var d=c.parent,d=d.pictures;return d.indexOf(c.picture)+1;case "size":return 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(a,b){var c=b.getField("VALUE",b);a="self"==c?a:Entry.container.getEntity(c);switch(b.getField("COORDINATE",b)){case "x":return a.getX();case "y":return a.getY();case "rotation":return a.getRotation();case "direction":return a.getDirection();case "picture_index":return b=a.parent,b=b.pictures,b.indexOf(a.picture)+1;case "size":return Number(a.getSize().toFixed(1));case "picture_name":return b=a.parent,b=b.pictures,b[b.indexOf(a.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)}}; -Entry.block.calc_minus=function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c-d};Blockly.Blocks.calc_times={init:function(){this.setColour(calcBlockColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("x",calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.calc_times=function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c*d};Blockly.Blocks.calc_divide={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_divide=function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c/d}; +Entry.block.calc_basic=function(a,b){a=b.getField("OPERATOR",b);var c=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return"PLUS"==a?c+b:"MINUS"==a?c-b:"MULTI"==a?c*b:c/b};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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a+b};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)}}; +Entry.block.calc_minus=function(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a-b};Blockly.Blocks.calc_times={init:function(){this.setColour(calcBlockColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("x",calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; +Entry.block.calc_times=function(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a*b};Blockly.Blocks.calc_divide={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_divide=function(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a/b}; Blockly.Blocks.calc_mod={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_calc_mod_1,calcFontColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_mod_2,calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_mod_3,calcFontColor);this.setInputsInline(!0)}}; -Entry.block.calc_mod=function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c%d}; +Entry.block.calc_mod=function(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a%b}; Blockly.Blocks.calc_share={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_calc_share_1,calcFontColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.CALC_calc_share_2,calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_share_3,calcFontColor);this.setInputsInline(!0)}}; -Entry.block.calc_share=function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return Math.floor(c/d)}; +Entry.block.calc_share=function(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return Math.floor(a/b)}; Blockly.Blocks.calc_operation={init:function(){this.setColour(calcBlockColor);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_operation_of_1,calcFontColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_operation_of_2,calcFontColor);this.appendDummyInput("VALUE").appendField(new Blockly.FieldDropdown([[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"]],null,!0,calcArrowColor),"VALUE");this.setOutput(!0,"Number");this.appendDummyInput().appendField(" ");this.setInputsInline(!0)}}; -Entry.block.calc_operation=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}; +Entry.block.calc_operation=function(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getField("VALUE",b);if(-1<["asin_radian","acos_radian"].indexOf(b)&&(1a))throw Error("x range exceeded");b.indexOf("_")&&(b=b.split("_")[0]);-1<["sin","cos","tan"].indexOf(b)&&(a=Entry.toRadian(a));switch(b){case "square":b=a*a;break;case "factorial":b=Entry.factorial(a);break;case "root":b=Math.sqrt(a);break;case "log":b=Math.log(a)/Math.LN10;break;case "ln":b=Math.log(a);break;case "asin":case "acos":case "atan":b= +Entry.toDegrees(Math[b](a));break;case "unnatural":b=a-Math.floor(a);0>a&&(b=1-b);break;default:b=Math[b](a)}return Math.round(1E3*b)/1E3}; Blockly.Blocks.calc_rand={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_calc_rand_1,calcFontColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_rand_2,calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_calc_rand_3,calcFontColor);this.setInputsInline(!0)}}; -Entry.block.calc_rand=function(b,a){var c=a.getStringValue("LEFTHAND",a),d=a.getStringValue("RIGHTHAND",a),e=Math.min(c,d),f=Math.max(c,d),c=Entry.isFloat(c);return Entry.isFloat(d)||c?(Math.random()*(f-e)+e).toFixed(2):Math.floor(Math.random()*(f-e+1)+e)}; +Entry.block.calc_rand=function(a,b){a=b.getStringValue("LEFTHAND",b);b=b.getStringValue("RIGHTHAND",b);var c=Math.min(a,b),d=Math.max(a,b);a=Entry.isFloat(a);return Entry.isFloat(b)||a?(Math.random()*(d-c)+c).toFixed(2):Math.floor(Math.random()*(d-c+1)+c)}; Blockly.Blocks.get_date={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_date_1,calcFontColor).appendField(new Blockly.FieldDropdown([[Lang.Blocks.CALC_get_date_year,"YEAR"],[Lang.Blocks.CALC_get_date_month,"MONTH"],[Lang.Blocks.CALC_get_date_day,"DAY"],[Lang.Blocks.CALC_get_date_hour,"HOUR"],[Lang.Blocks.CALC_get_date_minute,"MINUTE"],[Lang.Blocks.CALC_get_date_second,"SECOND"]],null,!0,calcArrowColor),"VALUE");this.appendDummyInput().appendField(" ").appendField(Lang.Blocks.CALC_get_date_2, -calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.get_date=function(b,a){var c=a.getField("VALUE",a),d=new Date;return"YEAR"==c?d.getFullYear():"MONTH"==c?d.getMonth()+1:"DAY"==c?d.getDate():"HOUR"==c?d.getHours():"MINUTE"==c?d.getMinutes():d.getSeconds()}; +calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.get_date=function(a,b){a=b.getField("VALUE",b);b=new Date;return"YEAR"==a?b.getFullYear():"MONTH"==a?b.getMonth()+1:"DAY"==a?b.getDate():"HOUR"==a?b.getHours():"MINUTE"==a?b.getMinutes():b.getSeconds()}; Blockly.Blocks.get_sound_duration={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_get_sound_duration_1,calcFontColor);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("sounds",null,!0,calcArrowColor),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.CALC_get_sound_duration_2,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.get_sound_duration=function(b,a){for(var c=a.getField("VALUE",a),d=b.parent.sounds,e=0;ed||d>c.length-1)throw Error();return c[d]}; -Blockly.Blocks.length_of_string={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_length_of_string_1,calcFontColor);this.appendValueInput("STRING").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_length_of_string_2,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.length_of_string=function(b,a){return a.getStringValue("STRING",a).length}; +Entry.block.char_at=function(a,b){a=b.getStringValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b)-1;if(0>b||b>a.length-1)throw Error();return a[b]}; +Blockly.Blocks.length_of_string={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_length_of_string_1,calcFontColor);this.appendValueInput("STRING").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_length_of_string_2,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.length_of_string=function(a,b){return b.getStringValue("STRING",b).length}; Blockly.Blocks.substring={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_substring_1,calcFontColor);this.appendValueInput("STRING").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_substring_2,calcFontColor);this.appendValueInput("START").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_substring_3,calcFontColor);this.appendValueInput("END").setCheck(["Number","String"]); -this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_substring_4,calcFontColor);this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.substring=function(b,a){var c=a.getStringValue("STRING",a),d=a.getNumberValue("START",a)-1,e=a.getNumberValue("END",a)-1,f=c.length-1;if(0>d||0>e||d>f||e>f)throw Error();return c.substring(Math.min(d,e),Math.max(d,e)+1)}; +this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_substring_4,calcFontColor);this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.substring=function(a,b){a=b.getStringValue("STRING",b);var c=b.getNumberValue("START",b)-1;b=b.getNumberValue("END",b)-1;var d=a.length-1;if(0>c||0>b||c>d||b>d)throw Error();return a.substring(Math.min(c,b),Math.max(c,b)+1)}; Blockly.Blocks.replace_string={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_replace_string_1,calcFontColor);this.appendValueInput("STRING").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_replace_string_2,calcFontColor);this.appendValueInput("OLD_WORD").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_replace_string_3,calcFontColor);this.appendValueInput("NEW_WORD").setCheck(["Number", -"String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_replace_string_4,calcFontColor);this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.replace_string=function(b,a){return a.getStringValue("STRING",a).replace(new RegExp(a.getStringValue("OLD_WORD",a),"gm"),a.getStringValue("NEW_WORD",a))}; +"String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_replace_string_4,calcFontColor);this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.replace_string=function(a,b){return b.getStringValue("STRING",b).replace(new RegExp(b.getStringValue("OLD_WORD",b),"gm"),b.getStringValue("NEW_WORD",b))}; Blockly.Blocks.change_string_case={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_change_string_case_1,calcFontColor);this.appendValueInput("STRING").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.CALC_change_string_case_2,calcFontColor);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.CALC_change_string_case_sub_1,"toUpperCase"],[Lang.Blocks.CALC_change_string_case_sub_2,"toLowerCase"]], -null,!0,calcArrowColor),"CASE");this.appendDummyInput().appendField(Lang.Blocks.CALC_change_string_case_3,calcFontColor);this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.change_string_case=function(b,a){return a.getStringValue("STRING",a)[a.getField("CASE",a)]()}; +null,!0,calcArrowColor),"CASE");this.appendDummyInput().appendField(Lang.Blocks.CALC_change_string_case_3,calcFontColor);this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.change_string_case=function(a,b){return b.getStringValue("STRING",b)[b.getField("CASE",b)]()}; Blockly.Blocks.index_of_string={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_index_of_string_1,calcFontColor);this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_index_of_string_2,calcFontColor);this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Number");this.appendDummyInput("VALUE").appendField(Lang.Blocks.CALC_index_of_string_3,calcFontColor); -this.setInputsInline(!0)}};Entry.block.index_of_string=function(b,a){var c=a.getStringValue("LEFTHAND",a),d=a.getStringValue("RIGHTHAND",a),c=c.indexOf(d);return-1c)throw Error(Lang.Blocks.FLOW_repeat_basic_errorMsg);a.iterCount=Math.floor(c)}if(0==a.iterCount||0>a.iterCount)return delete a.isLooped,delete a.iterCount,a.callReturn();a.iterCount--;return a.getStatement("DO",a)}; -Blockly.Blocks.repeat_inf={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_inf).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.appendStatementInput("DO");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.repeat_inf=function(b,a){a.isLooped=!0;return a.getStatement("DO")}; -Blockly.Blocks.stop_repeat={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_stop_repeat).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.stop_repeat=function(b,a){return this.executor.break()}; +Entry.block.repeat_basic=function(a,b){if(!b.isLooped){b.isLooped=!0;a=b.getNumberValue("VALUE",b);if(0>a)throw Error(Lang.Blocks.FLOW_repeat_basic_errorMsg);b.iterCount=Math.floor(a)}if(0==b.iterCount||0>b.iterCount)return delete b.isLooped,delete b.iterCount,b.callReturn();b.iterCount--;return b.getStatement("DO",b)}; +Blockly.Blocks.repeat_inf={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_inf).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.appendStatementInput("DO");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.repeat_inf=function(a,b){b.isLooped=!0;return b.getStatement("DO")}; +Blockly.Blocks.stop_repeat={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_stop_repeat).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.stop_repeat=function(a,b){return this.executor.break()}; Blockly.Blocks.wait_until_true={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_wait_until_true_1);this.appendValueInput("BOOL").setCheck("Boolean");this.appendDummyInput().appendField(Lang.Blocks.FLOW_wait_until_true_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.wait_until_true=function(b,a){return a.getBooleanValue("BOOL",a)?a.callReturn():a}; +Entry.block.wait_until_true=function(a,b){return b.getBooleanValue("BOOL",b)?b.callReturn():b}; Blockly.Blocks._if={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW__if_1);this.appendValueInput("BOOL").setCheck("Boolean");this.appendDummyInput().appendField(Lang.Blocks.FLOW__if_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.appendStatementInput("STACK");this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block._if=function(b,a){return a.isLooped?(delete a.isLooped,a.callReturn()):a.getBooleanValue("BOOL",a)?(a.isLooped=!0,a.getStatement("STACK",a)):a.callReturn()}; +Entry.block._if=function(a,b){return b.isLooped?(delete b.isLooped,b.callReturn()):b.getBooleanValue("BOOL",b)?(b.isLooped=!0,b.getStatement("STACK",b)):b.callReturn()}; Blockly.Blocks.if_else={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_if_else_1);this.appendValueInput("BOOL").setCheck("Boolean");this.appendDummyInput().appendField(Lang.Blocks.FLOW_if_else_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.appendStatementInput("STACK_IF");this.appendDummyInput().appendField(Lang.Blocks.FLOW_if_else_3);this.appendStatementInput("STACK_ELSE");this.setInputsInline(!0);this.setPreviousStatement(!0); -this.setNextStatement(!0)}};Entry.block.if_else=function(b,a){if(a.isLooped)return delete a.isLooped,a.callReturn();var c=a.getBooleanValue("BOOL",a);a.isLooped=!0;return c?a.getStatement("STACK_IF",a):a.getStatement("STACK_ELSE",a)}; +this.setNextStatement(!0)}};Entry.block.if_else=function(a,b){if(b.isLooped)return delete b.isLooped,b.callReturn();a=b.getBooleanValue("BOOL",b);b.isLooped=!0;return a?b.getStatement("STACK_IF",b):b.getStatement("STACK_ELSE",b)}; Blockly.Blocks.create_clone={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_create_clone_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("clone"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.FLOW_create_clone_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.create_clone=function(b,a){var c=a.getField("VALUE",a),d=a.callReturn();"self"==c?b.parent.addCloneEntity(b.parent,b,null):Entry.container.getObject(c).addCloneEntity(b.parent,null,null);return d};Blockly.Blocks.delete_clone={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_delete_clone).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0)}}; -Entry.block.delete_clone=function(b,a){if(!b.isClone)return a.callReturn();b.removeClone()};Blockly.Blocks.when_clone_start={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_clone.png","*","start")).appendField(Lang.Blocks.FLOW_when_clone_start);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_clone_start=function(b,a){return a.callReturn()}; -Blockly.Blocks.stop_run={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_stop_run).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.stop_run=function(b,a){return Entry.engine.toggleStop()}; +Entry.block.create_clone=function(a,b){var c=b.getField("VALUE",b);b=b.callReturn();"self"==c?a.parent.addCloneEntity(a.parent,a,null):Entry.container.getObject(c).addCloneEntity(a.parent,null,null);return b};Blockly.Blocks.delete_clone={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_delete_clone).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0)}}; +Entry.block.delete_clone=function(a,b){if(!a.isClone)return b.callReturn();a.removeClone()};Blockly.Blocks.when_clone_start={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_clone.png","*","start")).appendField(Lang.Blocks.FLOW_when_clone_start);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_clone_start=function(a,b){return b.callReturn()}; +Blockly.Blocks.stop_run={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_stop_run).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.stop_run=function(a,b){return Entry.engine.toggleStop()}; Blockly.Blocks.repeat_while_true={init:function(){this.setColour("#498deb");"ko"==Lang.type?(this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_while_true_1),this.appendValueInput("BOOL").setCheck("Boolean"),this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.FLOW_repeat_while_true_until,"until"],[Lang.Blocks.FLOW_repeat_while_true_while,"while"]]),"OPTION").appendField(Lang.Blocks.FLOW_repeat_while_true_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png", "*"))):(this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_while_true_1),this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.FLOW_repeat_while_true_until,"until"],[Lang.Blocks.FLOW_repeat_while_true_while,"while"]]),"OPTION"),this.appendValueInput("BOOL").setCheck("Boolean"),this.appendDummyInput().appendField(Lang.Blocks.FLOW_repeat_while_true_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*")));this.appendStatementInput("DO"); -this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.repeat_while_true=function(b,a){var c=a.getBooleanValue("BOOL",a);"until"==a.getField("OPTION",a)&&(c=!c);return(a.isLooped=c)?a.getStatement("DO",a):a.callReturn()}; +this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.repeat_while_true=function(a,b){a=b.getBooleanValue("BOOL",b);"until"==b.getField("OPTION",b)&&(a=!a);return(b.isLooped=a)?b.getStatement("DO",b):b.callReturn()}; Blockly.Blocks.stop_object={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_stop_object_1);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.FLOW_stop_object_all,"all"],[Lang.Blocks.FLOW_stop_object_this_object,"thisOnly"],[Lang.Blocks.FLOW_stop_object_this_thread,"thisThread"],[Lang.Blocks.FLOW_stop_object_other_thread,"otherThread"]]),"TARGET");this.appendDummyInput().appendField(Lang.Blocks.FLOW_stop_object_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.stop_object=function(b,a){var c=a.getField("TARGET",a),d=Entry.container;switch(c){case "all":return d.clearRunningState(),this.die();case "thisOnly":return b.parent.script.clearExecutorsByEntity(b),this.die();case "thisThread":return this.die();case "otherThread":b.parent.script.clearExecutors(),b.parent.script.addExecutor(this.executor)}}; -Blockly.Blocks.restart_project={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_restart).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0)}};Entry.block.restart_project=function(b,a){Entry.engine.toggleStop();Entry.engine.toggleRun()}; -Blockly.Blocks.remove_all_clones={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_delete_clone_all).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.remove_all_clones=function(b,a){var c=b.parent.getClonedEntities();c.map(function(a){a.removeClone()});c=null;return a.callReturn()};Entry.block.functionAddButton={skeleton:"basic_button",color:"#eee",isNotFor:["functionInit"],template:"%1",params:[{type:"Text",text:"\ud568\uc218 \ucd94\uac00",color:"#333",align:"center"}],events:{mousedown:[function(){Entry.variableContainer.createFunction()}]}}; +"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.stop_object=function(a,b){b=b.getField("TARGET",b);var c=Entry.container;switch(b){case "all":return c.clearRunningState(),this.die();case "thisOnly":return a.parent.script.clearExecutorsByEntity(a),this.die();case "thisThread":return this.die();case "otherThread":a.parent.script.clearExecutors(),a.parent.script.addExecutor(this.executor)}}; +Blockly.Blocks.restart_project={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_restart).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0)}};Entry.block.restart_project=function(a,b){Entry.engine.toggleStop();Entry.engine.toggleRun()}; +Blockly.Blocks.remove_all_clones={init:function(){this.setColour("#498deb");this.appendDummyInput().appendField(Lang.Blocks.FLOW_delete_clone_all).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/flow_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.remove_all_clones=function(a,b){a=a.parent.getClonedEntities();a.map(function(b){b.removeClone()});a=null;return b.callReturn()};Entry.block.functionAddButton={skeleton:"basic_button",color:"#eee",isNotFor:["functionInit"],template:"%1",params:[{type:"Text",text:"\ud568\uc218 \ucd94\uac00",color:"#333",align:"center"}],events:{mousedown:[function(){Entry.variableContainer.createFunction()}]}}; Blockly.Blocks.function_field_label={init:function(){this.setColour("#f9c535");this.appendDummyInput().appendField(new Blockly.FieldTextInput(Lang.Blocks.FUNCTION_explanation_1),"NAME");this.appendValueInput("NEXT").setCheck(["Param"]);this.setOutput(!0,"Param");this.setInputsInline(!0)}};Entry.block.function_field_label={skeleton:"basic_param",isNotFor:["functionEdit"],color:"#f9c535",template:"%1%2",params:[{type:"TextInput",value:"\ud568\uc218"},{type:"Output",accept:"paramMagnet"}]}; Blockly.Blocks.function_field_string={init:function(){this.setColour("#FFD974");this.appendValueInput("PARAM").setCheck(["String"]);this.appendValueInput("NEXT").setCheck(["Param"]);this.setOutput(!0,"Param");this.setInputsInline(!0)}};Entry.block.function_field_string={skeleton:"basic_param",isNotFor:["functionEdit"],color:"#ffd974",template:"%1%2",params:[{type:"Block",accept:"stringMagnet",restore:!0},{type:"Output",accept:"paramMagnet"}]}; Blockly.Blocks.function_field_boolean={init:function(){this.setColour("#AEB8FF");this.appendValueInput("PARAM").setCheck(["Boolean"]);this.appendValueInput("NEXT").setCheck(["Param"]);this.setOutput(!0,"Param");this.setInputsInline(!0)}};Entry.block.function_field_boolean={skeleton:"basic_param",isNotFor:["functionEdit"],color:"#aeb8ff",template:"%1%2",params:[{type:"Block",accept:"booleanMagnet",restore:!0},{type:"Output",accept:"paramMagnet"}]}; -Blockly.Blocks.function_param_string={init:function(){this.setEditable(!1);this.setColour("#FFD974");this.setOutput(!0,["String","Number"]);this.setInputsInline(!0)},domToMutation:function(b){b.getElementsByTagName("field");this.hashId=b.getAttribute("hashid");(b=Entry.Func.targetFunc.stringHash[this.hashId])||(b="");this.appendDummyInput().appendField(new Blockly.FieldTextInput(Lang.Blocks.FUNCTION_character_variable+b),"")},mutationToDom:function(){var b=document.createElement("mutation");b.setAttribute("hashid", -this.hashId);return b}};Entry.block.function_param_string=function(b,a,c){return a.register[a.hashId].run()};Entry.block.function_param_string={skeleton:"basic_string_field",color:"#ffd974",template:"\ubb38\uc790/\uc22b\uc790\uac12",func:function(){return this.executor.register.params[this.executor.register.paramMap[this.block.type]]}}; -Blockly.Blocks.function_param_boolean={init:function(){this.setEditable(!1);this.setColour("#AEB8FF");this.setOutput(!0,"Boolean");this.setInputsInline(!0)},domToMutation:function(b){b.getElementsByTagName("field");this.hashId=b.getAttribute("hashid");(b=Entry.Func.targetFunc.booleanHash[this.hashId])||(b="");this.appendDummyInput().appendField(new Blockly.FieldTextInput(Lang.Blocks.FUNCTION_logical_variable+b),"")},mutationToDom:function(){var b=document.createElement("mutation");b.setAttribute("hashid", -this.hashId);return b}};Entry.block.function_param_boolean=function(b,a,c){return a.register[a.hashId].run()};Entry.block.function_param_boolean={skeleton:"basic_boolean_field",color:"#aeb8ff",template:"\ud310\ub2e8\uac12",func:function(){return this.executor.register.params[this.executor.register.paramMap[this.block.type]]}}; -Blockly.Blocks.function_create={init:function(){this.appendDummyInput().appendField(Lang.Blocks.FUNCTION_define);this.setColour("#cc7337");this.appendValueInput("FIELD").setCheck(["Param"]);this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/function_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.function_create=function(b,a){return a.callReturn()}; +Blockly.Blocks.function_param_string={init:function(){this.setEditable(!1);this.setColour("#FFD974");this.setOutput(!0,["String","Number"]);this.setInputsInline(!0)},domToMutation:function(a){a.getElementsByTagName("field");this.hashId=a.getAttribute("hashid");(a=Entry.Func.targetFunc.stringHash[this.hashId])||(a="");this.appendDummyInput().appendField(new Blockly.FieldTextInput(Lang.Blocks.FUNCTION_character_variable+a),"")},mutationToDom:function(){var a=document.createElement("mutation");a.setAttribute("hashid", +this.hashId);return a}};Entry.block.function_param_string=function(a,b,c){return b.register[b.hashId].run()};Entry.block.function_param_string={skeleton:"basic_string_field",color:"#ffd974",template:"\ubb38\uc790/\uc22b\uc790\uac12",func:function(){return this.executor.register.params[this.executor.register.paramMap[this.block.type]]}}; +Blockly.Blocks.function_param_boolean={init:function(){this.setEditable(!1);this.setColour("#AEB8FF");this.setOutput(!0,"Boolean");this.setInputsInline(!0)},domToMutation:function(a){a.getElementsByTagName("field");this.hashId=a.getAttribute("hashid");(a=Entry.Func.targetFunc.booleanHash[this.hashId])||(a="");this.appendDummyInput().appendField(new Blockly.FieldTextInput(Lang.Blocks.FUNCTION_logical_variable+a),"")},mutationToDom:function(){var a=document.createElement("mutation");a.setAttribute("hashid", +this.hashId);return a}};Entry.block.function_param_boolean=function(a,b,c){return b.register[b.hashId].run()};Entry.block.function_param_boolean={skeleton:"basic_boolean_field",color:"#aeb8ff",template:"\ud310\ub2e8\uac12",func:function(){return this.executor.register.params[this.executor.register.paramMap[this.block.type]]}}; +Blockly.Blocks.function_create={init:function(){this.appendDummyInput().appendField(Lang.Blocks.FUNCTION_define);this.setColour("#cc7337");this.appendValueInput("FIELD").setCheck(["Param"]);this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/function_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.function_create=function(a,b){return b.callReturn()}; Entry.block.function_create={skeleton:"basic",color:"#cc7337",event:"funcDef",template:"\ud568\uc218 \uc815\uc758\ud558\uae30 %1 %2",params:[{type:"Block",accept:"paramMagnet",value:{type:"function_field_label"}},{type:"Indicator",img:"/lib/entryjs/images/block_icon/function_03.png",size:12}],func:function(){}}; -Blockly.Blocks.function_general={init:function(){this.setColour("#cc7337");this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)},domToMutation:function(b){var a=b.getElementsByTagName("field");this.appendDummyInput().appendField("");a.length||this.appendDummyInput().appendField(Lang.Blocks.FUNCTION_function);for(var c=0;ca.count?(50>d.leftFloor&&50>d.rightFloor?a.count++:a.count=0,d=d.leftFloor-d.rightFloor,c.leftWheel=45+.25*d,c.rightWheel=45-.25*d):(a.count=0,a.boardState=2);break;case 2:d=d.leftFloor-d.rightFloor;c.leftWheel=45+.25*d;c.rightWheel=45-.25*d;a.boardState=3;var e=setTimeout(function(){a.boardState=4;Entry.Hamster.removeTimeout(e)},250);Entry.Hamster.timeouts.push(e); -break;case 3:d=d.leftFloor-d.rightFloor;c.leftWheel=45+.25*d;c.rightWheel=45-.25*d;break;case 4:c.leftWheel=0,c.rightWheel=0,a.boardState=0,a.isMoving=!1}return a}delete a.isStart;delete a.isMoving;delete a.count;delete a.boardState;Entry.engine.isContinue=!1;c.leftWheel=0;c.rightWheel=0;return a.callReturn()}a.isStart=!0;a.isMoving=!0;a.count=0;a.boardState=1;c.leftWheel=45;c.rightWheel=45;Entry.Hamster.setLineTracerMode(c,0);return a}; -Blockly.Blocks.hamster_turn_once={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_turn_once_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"]]),"DIRECTION").appendField(Lang.Blocks.HAMSTER_turn_once_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.hamster_turn_once=function(b,a){var c=Entry.hw.sendQueue,d=Entry.hw.portData;if(a.isStart){if(a.isMoving){if(a.isLeft)switch(a.boardState){case 1:2>a.count?50d.leftFloor&&(a.boardState=3);break;case 3:2>a.count?20>d.leftFloor&&a.count++:(a.count=0,a.boardState=4);break;case 4:50a.count?50d.rightFloor&&(a.boardState=3);break;case 3:2>a.count?20>d.rightFloor&&a.count++:(a.count=0,a.boardState=4);break;case 4:50b.count?(50>c.leftFloor&&50>c.rightFloor?b.count++:b.count=0,c=c.leftFloor-c.rightFloor,a.leftWheel=45+.25*c,a.rightWheel=45-.25*c):(b.count=0,b.boardState=2);break;case 2:c=c.leftFloor-c.rightFloor;a.leftWheel=45+.25*c;a.rightWheel=45-.25*c;b.boardState=3;var d=setTimeout(function(){b.boardState=4;Entry.Hamster.removeTimeout(d)},250);Entry.Hamster.timeouts.push(d); +break;case 3:c=c.leftFloor-c.rightFloor;a.leftWheel=45+.25*c;a.rightWheel=45-.25*c;break;case 4:a.leftWheel=0,a.rightWheel=0,b.boardState=0,b.isMoving=!1}return b}delete b.isStart;delete b.isMoving;delete b.count;delete b.boardState;Entry.engine.isContinue=!1;a.leftWheel=0;a.rightWheel=0;return b.callReturn()}b.isStart=!0;b.isMoving=!0;b.count=0;b.boardState=1;a.leftWheel=45;a.rightWheel=45;Entry.Hamster.setLineTracerMode(a,0);return b}; +Blockly.Blocks.hamster_turn_once={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_turn_once_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.HAMSTER_turn_once_left,"LEFT"],[Lang.Blocks.HAMSTER_turn_once_right,"RIGHT"]]),"DIRECTION").appendField(Lang.Blocks.HAMSTER_turn_once_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; +Entry.block.hamster_turn_once=function(a,b){a=Entry.hw.sendQueue;var c=Entry.hw.portData;if(b.isStart){if(b.isMoving){if(b.isLeft)switch(b.boardState){case 1:2>b.count?50c.leftFloor&&(b.boardState=3);break;case 3:2>b.count?20>c.leftFloor&&b.count++:(b.count=0,b.boardState=4);break;case 4:50b.count?50c.rightFloor&&(b.boardState=3);break;case 3:2>b.count?20>c.rightFloor&&b.count++:(b.count=0,b.boardState=4);break;case 4:50Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return a.callReturn()}; +Entry.block.hamster_change_tempo_by=function(a,b){Entry.Hamster.tempo+=b.getNumberValue("VALUE");1>Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return b.callReturn()}; 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()}; -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)}; +Entry.block.hamster_set_tempo_to=function(a,b){Entry.Hamster.tempo=b.getNumberValue("VALUE");1>Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return b.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_a_b,"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(a,b){a=Entry.hw.sendQueue;var c=b.getField("PORT",b),d=Number(b.getField("MODE",b));"A"==c?a.ioModeA=d:("B"!=c&&(a.ioModeA=d),a.ioModeB=d);return b.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_a_b,"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(a,b){a=Entry.hw.sendQueue;var c=b.getField("PORT"),d=b.getNumberValue("VALUE");"A"==c?a.outputA=void 0!=a.outputA?a.outputA+d:d:("B"!=c&&(a.outputA=void 0!=a.outputA?a.outputA+d:d),a.outputB=void 0!=a.outputB?a.outputB+d:d);return b.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_a_b,"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(a,b){a=Entry.hw.sendQueue;var c=b.getField("PORT"),d=b.getNumberValue("VALUE");"A"==c?a.outputA=d:("B"!=c&&(a.outputA=d),a.outputB=d);return b.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(a,b){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(a,b){a=Number(b.getField("VALUE",b));return 0<=Entry.pressedKeys.indexOf(a)}; 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","BIGGER"]]),"OPERATOR");this.appendValueInput("RIGHTHAND").setCheck(["String","Number"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; -Entry.block.boolean_comparison=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","#3D3D3D");this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; -Entry.block.boolean_bigger=function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c>d};Blockly.Blocks.boolean_smaller={init:function(){this.setColour("#AEB8FF");this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("<","#3D3D3D");this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; -Entry.block.boolean_smaller=function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c","BIGGER"]]),"OPERATOR");this.appendValueInput("RIGHTHAND").setCheck(["String","Number"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; +Entry.block.boolean_comparison=function(a,b){a=b.getField("OPERATOR",b);var c=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return"EQUAL"==a?c==b:"BIGGER"==a?c>b:c","#3D3D3D");this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; +Entry.block.boolean_bigger=function(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a>b};Blockly.Blocks.boolean_smaller={init:function(){this.setColour("#AEB8FF");this.appendValueInput("LEFTHAND").setCheck(["Number","String"]);this.appendDummyInput().appendField("<","#3D3D3D");this.appendValueInput("RIGHTHAND").setCheck(["Number","String"]);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; +Entry.block.boolean_smaller=function(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a","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()}; -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()}; +Entry.block.boolean_basic_operator=function(a,b){a=b.getField("OPERATOR",b);var c=b.getStringValue("LEFTHAND",b);b=b.getStringValue("RIGHTHAND",b);switch(a){case "EQUAL":return c==b;case "GREATER":return Number(c)>Number(b);case "LESS":return Number(c)=Number(b);case "LESS_OR_EQUAL":return Number(c)<=Number(b)}};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(a,b){a.setVisible(!0);return b.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(a,b){a.setVisible(!1);return b.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)}}; -Entry.block.dialog_time=function(b,a){if(!a.isStart){var c=a.getNumberValue("SECOND",a),d=a.getStringValue("VALUE",a),e=a.getField("OPTION",a);a.isStart=!0;a.timeFlag=1;d||"number"==typeof d||(d=" ");d=Entry.convertToRoundedDecimals(d,3);new Entry.Dialog(b,d,e);b.syncDialogVisible(b.getVisible());setTimeout(function(){a.timeFlag=0},1E3*c)}return 0==a.timeFlag?(delete a.timeFlag,delete a.isStart,b.dialog&&b.dialog.remove(),a.callReturn()):a}; +Entry.block.dialog_time=function(a,b){if(!b.isStart){var c=b.getNumberValue("SECOND",b),d=b.getStringValue("VALUE",b),e=b.getField("OPTION",b);b.isStart=!0;b.timeFlag=1;d||"number"==typeof d||(d=" ");d=Entry.convertToRoundedDecimals(d,3);new Entry.Dialog(a,d,e);a.syncDialogVisible(a.getVisible());setTimeout(function(){b.timeFlag=0},1E3*c)}return 0==b.timeFlag?(delete b.timeFlag,delete b.isStart,a.dialog&&a.dialog.remove(),b.callReturn()):b}; Blockly.Blocks.dialog={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_1);this.appendValueInput("VALUE").setCheck(["String","Number",null]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_2);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.speak,"speak"]]),"OPTION");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_dialog_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png", -"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dialog=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()}; -Blockly.Blocks.remove_dialog={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_remove_dialog).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.remove_dialog=function(b,a){b.dialog&&b.dialog.remove();return a.callReturn()}; +"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.dialog=function(a,b){var c=b.getStringValue("VALUE",b);c||"number"==typeof c||(c=" ");var d=b.getField("OPTION",b),c=Entry.convertToRoundedDecimals(c,3);new Entry.Dialog(a,c,d);a.syncDialogVisible(a.getVisible());return b.callReturn()}; +Blockly.Blocks.remove_dialog={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_remove_dialog).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.remove_dialog=function(a,b){a.dialog&&a.dialog.remove();return b.callReturn()}; Blockly.Blocks.change_to_nth_shape={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_to_nth_shape_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("pictures"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_to_nth_shape_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_to_nth_shape=function(b,a){var c=a.getField("VALUE",a),c=b.parent.getPicture(c);b.setImage(c);return a.callReturn()}; +Entry.block.change_to_nth_shape=function(a,b){var c=b.getField("VALUE",b),c=a.parent.getPicture(c);a.setImage(c);return b.callReturn()}; Blockly.Blocks.change_to_next_shape={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_to_near_shape_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.LOOKS_change_shape_next,"next"],[Lang.Blocks.LOOKS_change_shape_prev,"prev"]]),"DRIECTION").appendField(Lang.Blocks.LOOKS_change_to_near_shape_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_to_next_shape=function(b,a){var c;c=a.fields&&"prev"===a.getStringField("DRIECTION")?b.parent.getPrevPicture(b.picture.id):b.parent.getNextPicture(b.picture.id);b.setImage(c);return a.callReturn()}; +Entry.block.change_to_next_shape=function(a,b){var c;c=b.fields&&"prev"===b.getStringField("DRIECTION")?a.parent.getPrevPicture(a.picture.id):a.parent.getNextPicture(a.picture.id);a.setImage(c);return b.callReturn()}; Blockly.Blocks.set_effect_volume={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_effect_volume_1);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity,"opacity"]]),"EFFECT");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_effect_volume_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_effect_volume_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.set_effect_volume=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()}; +"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.set_effect_volume=function(a,b){var c=b.getField("EFFECT",b),d=b.getNumberValue("VALUE",b);"color"==c?a.effect.hue=d+a.effect.hue:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?a.effect.brightness=d+a.effect.brightness:"blur"!=c&&"opacity"==c&&(a.effect.alpha+=d/100));a.applyFilter();return b.callReturn()}; Blockly.Blocks.set_effect={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_effect_1);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.color,"color"],[Lang.Blocks.brightness,"brightness"],[Lang.Blocks.opacity,"opacity"]]),"EFFECT");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_effect_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_effect_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.set_effect=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()}; -Blockly.Blocks.erase_all_effects={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_erase_all_effects).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.erase_all_effects=function(b,a){b.resetFilter();return a.callReturn()}; +"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.set_effect=function(a,b){var c=b.getField("EFFECT",b),d=b.getNumberValue("VALUE",b);"color"==c?a.effect.hue=d:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?a.effect.brightness=d:"blur"!=c&&"opacity"==c&&(a.effect.alpha=d/100));a.applyFilter();return b.callReturn()}; +Blockly.Blocks.erase_all_effects={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_erase_all_effects).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.erase_all_effects=function(a,b){a.resetFilter();return b.callReturn()}; Blockly.Blocks.change_scale_percent={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_scale_percent_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_scale_percent_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_scale_percent=function(b,a){var c=(a.getNumberValue("VALUE",a)+100)/100;b.setScaleX(b.getScaleX()*c);b.setScaleY(b.getScaleY()*c);return a.callReturn()}; +Entry.block.change_scale_percent=function(a,b){var c=(b.getNumberValue("VALUE",b)+100)/100;a.setScaleX(a.getScaleX()*c);a.setScaleY(a.getScaleY()*c);return b.callReturn()}; Blockly.Blocks.set_scale_percent={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_scale_percent_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_scale_percent_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_scale_percent=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()}; +Entry.block.set_scale_percent=function(a,b){var c=b.getNumberValue("VALUE",b)/100,d=a.snapshot_;a.setScaleX(c*d.scaleX);a.setScaleY(c*d.scaleY);return b.callReturn()}; Blockly.Blocks.change_scale_size={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_scale_percent_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_change_scale_percent_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_scale_size=function(b,a){var c=a.getNumberValue("VALUE",a);b.setSize(b.getSize()+c);return a.callReturn()}; +Entry.block.change_scale_size=function(a,b){var c=b.getNumberValue("VALUE",b);a.setSize(a.getSize()+c);return b.callReturn()}; Blockly.Blocks.set_scale_size={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_scale_percent_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_scale_percent_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_scale_size=function(b,a){var c=a.getNumberValue("VALUE",a);b.setSize(c);return a.callReturn()};Blockly.Blocks.flip_y={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_flip_y).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_y=function(b,a){b.setScaleX(-1*b.getScaleX());return a.callReturn()}; -Blockly.Blocks.flip_x={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_flip_x).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_x=function(b,a){b.setScaleY(-1*b.getScaleY());return a.callReturn()}; +Entry.block.set_scale_size=function(a,b){var c=b.getNumberValue("VALUE",b);a.setSize(c);return b.callReturn()};Blockly.Blocks.flip_y={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_flip_y).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_y=function(a,b){a.setScaleX(-1*a.getScaleX());return b.callReturn()}; +Blockly.Blocks.flip_x={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_flip_x).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_x=function(a,b){a.setScaleY(-1*a.getScaleY());return b.callReturn()}; Blockly.Blocks.set_object_order={init:function(){this.setColour("#EC4466");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_object_order_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("objectSequence"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.LOOKS_set_object_order_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.set_object_order=function(b,a){var c=a.getField("VALUE",a),d=Entry.container.getCurrentObjects().indexOf(b.parent);if(-1f)throw Error("object is not available for current scene");switch(d){case "FRONT":c=0;break;case "FORWARD":c=Math.max(0,f-1);break;case "BACKWARD":c=Math.min(e,f+1);break;case "BACK":c=e}Entry.container.moveElementByBlock(f,c);return a.callReturn()};Blockly.Blocks.move_direction={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.move_direction=function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(b.getX()+c*Math.cos((b.getRotation()+b.getDirection()-90)/180*Math.PI));b.setY(b.getY()-c*Math.sin((b.getRotation()+b.getDirection()-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; +"block_icon/looks_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.change_object_index=function(a,b){var c,d=b.getField("LOCATION",b),e=Entry.container.getCurrentObjects();a=e.indexOf(a.parent);e=e.length-1;if(0>a)throw Error("object is not available for current scene");switch(d){case "FRONT":c=0;break;case "FORWARD":c=Math.max(0,a-1);break;case "BACKWARD":c=Math.min(e,a+1);break;case "BACK":c=e}Entry.container.moveElementByBlock(a,c);return b.callReturn()};Blockly.Blocks.move_direction={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; +Entry.block.move_direction=function(a,b){var c=b.getNumberValue("VALUE",b);a.setX(a.getX()+c*Math.cos((a.getRotation()+a.getDirection()-90)/180*Math.PI));a.setY(a.getY()-c*Math.sin((a.getRotation()+a.getDirection()-90)/180*Math.PI));a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}; Blockly.Blocks.move_x={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_x_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_x_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.move_x=function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(b.getX()+c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; +Entry.block.move_x=function(a,b){var c=b.getNumberValue("VALUE",b);a.setX(a.getX()+c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}; Blockly.Blocks.move_y={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_y_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_y_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.move_y=function(b,a){var c=a.getNumberValue("VALUE",a);b.setY(b.getY()+c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; +Entry.block.move_y=function(a,b){var c=b.getNumberValue("VALUE",b);a.setY(a.getY()+c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}; Blockly.Blocks.locate_xy_time={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_xy_time_1);this.appendValueInput("VALUE1").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_xy_time_2);this.appendValueInput("VALUE2").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_xy_time_3);this.appendValueInput("VALUE3").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_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.locate_xy_time=function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE1",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.x=a.getNumberValue("VALUE2",a);a.y=a.getNumberValue("VALUE3",a)}if(0!=a.frameCount){c=a.x-b.getX();var d=a.y-b.getY();c/=a.frameCount;d/=a.frameCount;b.setX(b.getX()+c);b.setY(b.getY()+d);a.frameCount--;b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a}delete a.isStart;delete a.frameCount;return a.callReturn()}; +Entry.block.locate_xy_time=function(a,b){if(!b.isStart){var c;c=b.getNumberValue("VALUE1",b);b.isStart=!0;b.frameCount=Math.floor(c*Entry.FPS);b.x=b.getNumberValue("VALUE2",b);b.y=b.getNumberValue("VALUE3",b)}if(0!=b.frameCount){c=b.x-a.getX();var d=b.y-a.getY();c/=b.frameCount;d/=b.frameCount;a.setX(a.getX()+c);a.setY(a.getY()+d);b.frameCount--;a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b}delete b.isStart;delete b.frameCount;return b.callReturn()}; 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()}; +Entry.block.rotate_by_angle=function(a,b){var c=b.getNumberValue("VALUE",b);a.setRotation(a.getRotation()+c);return b.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(a,b){var c=b.getField("VALUE",b);a.setRotation(a.getRotation()+Number(c));return b.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()}; +Entry.block.see_angle=function(a,b){var c=b.getNumberValue("VALUE",b);a.setDirection(c);return b.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)}}; -Entry.block.see_direction=function(b,a){var c=a.getField("VALUE",a),d=Entry.container.getEntity(c),c=d.getX()-b.getX(),d=d.getY()-b.getY();0<=c?b.setRotation(Math.atan(d/c)/Math.PI*180+90):b.setRotation(Math.atan(d/c)/Math.PI*180+270);return a.callReturn()}; +Entry.block.see_direction=function(a,b){var c=b.getField("VALUE",b),d=Entry.container.getEntity(c),c=d.getX()-a.getX(),d=d.getY()-a.getY();0<=c?a.setRotation(Math.atan(d/c)/Math.PI*180+90):a.setRotation(Math.atan(d/c)/Math.PI*180+270);return b.callReturn()}; Blockly.Blocks.locate_xy={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_xy_1);this.appendValueInput("VALUE1").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_xy_2);this.appendValueInput("VALUE2").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_xy_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0); -this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.locate_xy=function(b,a){var c=a.getNumberValue("VALUE1",a);b.setX(c);c=a.getNumberValue("VALUE2",a);b.setY(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; +this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.locate_xy=function(a,b){var c=b.getNumberValue("VALUE1",b);a.setX(c);c=b.getNumberValue("VALUE2",b);a.setY(c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}; Blockly.Blocks.locate_x={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_x_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_x_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.locate_x=function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; +Entry.block.locate_x=function(a,b){var c=b.getNumberValue("VALUE",b);a.setX(c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}; 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()}; +Entry.block.locate_y=function(a,b){var c=b.getNumberValue("VALUE",b);a.setY(c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.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(a,b){var c=b.getField("VALUE",b),d;"mouse"==c?(c=Entry.stage.mouseCoordinate.x,d=Entry.stage.mouseCoordinate.y):(d=Entry.container.getEntity(c),c=d.getX(),d=d.getY());a.setX(Number(c));a.setY(Number(d));a.brush&&!a.brush.stop&&a.brush.lineTo(c,-1*d);return b.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()}; +Entry.block.move_xy_time=function(a,b){if(!b.isStart){var c;c=b.getNumberValue("VALUE1",b);var d=b.getNumberValue("VALUE2",b),e=b.getNumberValue("VALUE3",b);b.isStart=!0;b.frameCount=Math.floor(c*Entry.FPS);b.dX=d/b.frameCount;b.dY=e/b.frameCount}if(0!=b.frameCount)return a.setX(a.getX()+b.dX),a.setY(a.getY()+b.dY),b.frameCount--,a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY()),b;delete b.isStart;delete b.frameCount;return b.callReturn()}; Blockly.Blocks.locate_time={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_time_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_time_2);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("sprites"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.MOVING_locate_time_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png", "*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Blockly.Blocks.rotate_by_angle_time={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_time_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_time_2);this.appendDummyInput().appendField(new Blockly.FieldAngle("90"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_time_3).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_time=function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE",a);var d=a.getNumberField("VALUE",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dAngle=d/a.frameCount}if(0!=a.frameCount)return b.setRotation(b.getRotation()+a.dAngle),a.frameCount--,a;delete a.isStart;delete a.frameCount;return a.callReturn()}; +"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.rotate_by_angle_time=function(a,b){if(!b.isStart){var c;c=b.getNumberValue("VALUE",b);var d=b.getNumberField("VALUE",b);b.isStart=!0;b.frameCount=Math.floor(c*Entry.FPS);b.dAngle=d/b.frameCount}if(0!=b.frameCount)return a.setRotation(a.getRotation()+b.dAngle),b.frameCount--,b;delete b.isStart;delete b.frameCount;return b.callReturn()}; Blockly.Blocks.bounce_when={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_bounce_when_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("bounce"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.MOVING_bounce_when_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setPreviousStatement(!0);this.setInputsInline(!0);this.setNextStatement(!0)}}; Blockly.Blocks.bounce_wall={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_bounce_wall).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.bounce_wall=function(b,a){var c=b.parent.getRotateMethod(),d="free"==c?(b.getRotation()+b.getDirection()).mod(360):b.getDirection(),e=Entry.Utils.COLLISION.NONE;if(90>d&&0<=d||360>d&&270<=d){var e=b.collision==Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,b.object,0,!1);!f&&e&&(b.collision=Entry.Utils.COLLISION.NONE);f&&e&&(f=!1);f?("free"==c?b.setRotation(-b.getRotation()-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&&e&&(f=!1),f&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN))}else 270>d&&90<=d&&(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&&e&&(f= -!1),f?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN):(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)));360>d&&180<=d?(e=b.collision==Entry.Utils.COLLISION.LEFT, -d=ndgmr.checkPixelCollision(Entry.stage.wall.left,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.LEFT):(e=b.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()): -b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.RIGHT))):180>d&&0<=d&&(e=b.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.RIGHT):(e=b.collision==Entry.Utils.COLLISION.LEFT,d=ndgmr.checkPixelCollision(Entry.stage.wall.left, -b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.LEFT)));return a.callReturn()}; -Blockly.Blocks.flip_arrow_horizontal={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_flip_arrow_horizontal).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_arrow_horizontal=function(b,a){b.setDirection(b.getDirection()+180);return a.callReturn()}; -Blockly.Blocks.flip_arrow_vertical={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_flip_arrow_vertical).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_arrow_vertical=function(b,a){b.setDirection(b.getDirection()+180);return a.callReturn()}; +Entry.block.bounce_wall=function(a,b){var c=a.parent.getRotateMethod(),d="free"==c?(a.getRotation()+a.getDirection()).mod(360):a.getDirection(),e;if(90>d&&0<=d||360>d&&270<=d){e=a.collision==Entry.Utils.COLLISION.UP;var f=ndgmr.checkPixelCollision(Entry.stage.wall.up,a.object,0,!1);!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE);f&&e&&(f=!1);f?("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+180),a.collision=Entry.Utils.COLLISION.UP):(e=a.collision== +Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,a.object,0,!1),!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+180),a.collision=Entry.Utils.COLLISION.DOWN))}else 270>d&&90<=d&&(e=a.collision==Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,a.object,0,!1),!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f?("free"==c? +a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+180),a.collision=Entry.Utils.COLLISION.DOWN):(e=a.collision==Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,a.object,0,!1),!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+180),a.collision=Entry.Utils.COLLISION.UP)));360>d&&180<=d?(e=a.collision==Entry.Utils.COLLISION.LEFT, +d=ndgmr.checkPixelCollision(Entry.stage.wall.left,a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()):a.setDirection(-a.getDirection()+360),a.collision=Entry.Utils.COLLISION.LEFT):(e=a.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()): +a.setDirection(-a.getDirection()+360),a.collision=Entry.Utils.COLLISION.RIGHT))):180>d&&0<=d&&(e=a.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()):a.setDirection(-a.getDirection()+360),a.collision=Entry.Utils.COLLISION.RIGHT):(e=a.collision==Entry.Utils.COLLISION.LEFT,d=ndgmr.checkPixelCollision(Entry.stage.wall.left, +a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()):a.setDirection(-a.getDirection()+360),a.collision=Entry.Utils.COLLISION.LEFT)));return b.callReturn()}; +Blockly.Blocks.flip_arrow_horizontal={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_flip_arrow_horizontal).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_arrow_horizontal=function(a,b){a.setDirection(a.getDirection()+180);return b.callReturn()}; +Blockly.Blocks.flip_arrow_vertical={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_flip_arrow_vertical).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.flip_arrow_vertical=function(a,b){a.setDirection(a.getDirection()+180);return b.callReturn()}; Blockly.Blocks.see_angle_object={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_object_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("spritesWithMouse"),"VALUE");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_object_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_object=function(b,a){var c=a.getField("VALUE",a),d=b.getX(),e=b.getY();if(b.parent.id==c)return a.callReturn();"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()}; +Entry.block.see_angle_object=function(a,b){var c=b.getField("VALUE",b),d=a.getX(),e=a.getY();if(a.parent.id==c)return b.callReturn();"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?a.getDirection()+a.getRotation():0<=d?-Math.atan(e/d)/Math.PI*180+90:-Math.atan(e/d)/Math.PI*180+270;d=a.getDirection()+a.getRotation();a.setRotation(a.getRotation()+e-d);return b.callReturn()}; Blockly.Blocks.see_angle_direction={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_direction_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_see_angle_direction_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_direction=function(b,a){var c=a.getNumberValue("VALUE",a),d=b.getDirection()+b.getRotation();b.setRotation(b.getRotation()+c-d);return a.callReturn()}; +Entry.block.see_angle_direction=function(a,b){var c=b.getNumberValue("VALUE",b),d=a.getDirection()+a.getRotation();a.setRotation(a.getRotation()+c-d);return b.callReturn()}; Blockly.Blocks.rotate_direction={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_direction_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_direction_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.rotate_direction=function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c+b.getDirection());return a.callReturn()}; +Entry.block.rotate_direction=function(a,b){var c=b.getNumberValue("VALUE",b);a.setDirection(c+a.getDirection());return b.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(a,b){if(!b.isStart){var c,d,e;d=b.getField("TARGET",b);c=b.getNumberValue("VALUE",b);c=Math.floor(c*Entry.FPS);e=Entry.stage.mouseCoordinate;if(0!=c)"mouse"==d?(d=e.x-a.getX(),e=e.y-a.getY()):(e=Entry.container.getEntity(d),d=e.getX()-a.getX(),e=e.getY()-a.getY()),b.isStart=!0,b.frameCount=c,b.dX=d/b.frameCount,b.dY=e/b.frameCount;else return"mouse"==d?(d=Number(e.x),e=Number(e.y)):(e=Entry.container.getEntity(d),d=e.getX(),e=e.getY()),a.setX(d),a.setY(e),a.brush&& +!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY()),b.callReturn()}if(0!=b.frameCount)return a.setX(a.getX()+b.dX),a.setY(a.getY()+b.dY),b.frameCount--,a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY()),b;delete b.isStart;delete b.frameCount;return b.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()}; +Entry.block.rotate_absolute=function(a,b){var c=b.getNumberValue("VALUE",b);a.setRotation(c);return b.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)}}; -Entry.block.rotate_relative=function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c+b.getRotation());return a.callReturn()}; +Entry.block.rotate_relative=function(a,b){var c=b.getNumberValue("VALUE",b);a.setRotation(c+a.getRotation());return b.callReturn()}; Blockly.Blocks.direction_absolute={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.direction_absolute=function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}; +Entry.block.direction_absolute=function(a,b){var c=b.getNumberValue("VALUE",b);a.setDirection(c);return b.callReturn()}; Blockly.Blocks.direction_relative={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_direction_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_direction_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.direction_relative=function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c+b.getDirection());return a.callReturn()}; +Entry.block.direction_relative=function(a,b){var c=b.getNumberValue("VALUE",b);a.setDirection(c+a.getDirection());return b.callReturn()}; Blockly.Blocks.move_to_angle={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_angle_1);this.appendValueInput("ANGLE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_angle_2);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_move_direction_angle_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png", -"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.move_to_angle=function(b,a){var c=a.getNumberValue("VALUE",a),d=a.getNumberValue("ANGLE",a);b.setX(b.getX()+c*Math.cos((d-90)/180*Math.PI));b.setY(b.getY()-c*Math.sin((d-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}; +"*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.move_to_angle=function(a,b){var c=b.getNumberValue("VALUE",b),d=b.getNumberValue("ANGLE",b);a.setX(a.getX()+c*Math.cos((d-90)/180*Math.PI));a.setY(a.getY()-c*Math.sin((d-90)/180*Math.PI));a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}; Blockly.Blocks.rotate_by_time={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_add_direction_by_angle_time_explain_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_add_direction_by_angle_time_2);this.appendDummyInput().appendField(Lang.Blocks.MOVING_add_direction_by_angle_time_1);this.appendValueInput("ANGLE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_add_direction_by_angle_time_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.rotate_by_time=function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE",a);var d=a.getNumberValue("ANGLE",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dAngle=d/a.frameCount}if(0!=a.frameCount)return b.setRotation(b.getRotation()+a.dAngle),a.frameCount--,a;delete a.isStart;delete a.frameCount;return a.callReturn()}; +"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.rotate_by_time=function(a,b){if(!b.isStart){var c;c=b.getNumberValue("VALUE",b);var d=b.getNumberValue("ANGLE",b);b.isStart=!0;b.frameCount=Math.floor(c*Entry.FPS);b.dAngle=d/b.frameCount}if(0!=b.frameCount)return a.setRotation(a.getRotation()+b.dAngle),b.frameCount--,b;delete b.isStart;delete b.frameCount;return b.callReturn()}; Blockly.Blocks.direction_relative_duration={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_direction_relative_duration_1);this.appendValueInput("DURATION").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_direction_relative_duration_2);this.appendValueInput("AMOUNT").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_direction_relative_duration_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.direction_relative_duration=function(b,a){if(!a.isStart){var c;c=a.getNumberValue("DURATION",a);var d=a.getNumberValue("AMOUNT",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dDirection=d/a.frameCount}if(0!=a.frameCount)return b.setDirection(b.getDirection()+a.dDirection),a.frameCount--,a;delete a.isStart;delete a.frameCount;delete a.dDirection;return a.callReturn()};Entry.Neobot={name:"neobot",LOCAL_MAP:["IN1","IN2","IN3","IR","BAT"],REMOTE_MAP:"OUT1 OUT2 OUT3 DCR DCL SND FND OPT".split(" "),setZero:function(){for(var b in Entry.Neobot.REMOTE_MAP)Entry.hw.sendQueue[Entry.Neobot.REMOTE_MAP[b]]=0;Entry.hw.update()},name:"neobot",monitorTemplate:{imgPath:"hw/neobot.png",width:700,height:700,listPorts:{IR:{name:"\ub9ac\ubaa8\ucee8",type:"input",pos:{x:0,y:0}},BAT:{name:"\ubca0\ud130\ub9ac",type:"input",pos:{x:0,y:0}},SND:{name:Lang.Hw.buzzer,type:"output",pos:{x:0, +"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.direction_relative_duration=function(a,b){if(!b.isStart){var c;c=b.getNumberValue("DURATION",b);var d=b.getNumberValue("AMOUNT",b);b.isStart=!0;b.frameCount=Math.floor(c*Entry.FPS);b.dDirection=d/b.frameCount}if(0!=b.frameCount)return a.setDirection(a.getDirection()+b.dDirection),b.frameCount--,b;delete b.isStart;delete b.frameCount;delete b.dDirection;return b.callReturn()};Entry.Neobot={name:"neobot",LOCAL_MAP:["IN1","IN2","IN3","IR","BAT"],REMOTE_MAP:"OUT1 OUT2 OUT3 DCR DCL SND FND OPT".split(" "),setZero:function(){for(var a in Entry.Neobot.REMOTE_MAP)Entry.hw.sendQueue[Entry.Neobot.REMOTE_MAP[a]]=0;Entry.hw.update()},name:"neobot",monitorTemplate:{imgPath:"hw/neobot.png",width:700,height:700,listPorts:{IR:{name:"\ub9ac\ubaa8\ucee8",type:"input",pos:{x:0,y:0}},BAT:{name:"\ubca0\ud130\ub9ac",type:"input",pos:{x:0,y:0}},SND:{name:Lang.Hw.buzzer,type:"output",pos:{x:0, y:0}},FND:{name:"FND",type:"output",pos:{x:0,y:0}}},ports:{IN1:{name:"IN1",type:"input",pos:{x:270,y:200}},IN2:{name:"IN2",type:"input",pos:{x:325,y:200}},IN3:{name:"IN3",type:"input",pos:{x:325,y:500}},DCL:{name:"L-Motor",type:"output",pos:{x:270,y:500}},DCR:{name:"R-Motor",type:"output",pos:{x:435,y:500}},OUT1:{name:"OUT1",type:"output",pos:{x:380,y:200}},OUT2:{name:"OUT2",type:"output",pos:{x:435,y:200}},OUT3:{name:"OUT3",type:"output",pos:{x:380,y:500}}},mode:"both"}}; -Blockly.Blocks.neobot_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["1\ubc88 \ud3ec\ud2b8","IN1"],["2\ubc88 \ud3ec\ud2b8","IN2"],["3\ubc88 \ud3ec\ud2b8","IN3"],["\ub9ac\ubaa8\ucee8","IR"],["\ubc30\ud130\ub9ac","BAT"]]),"PORT").appendField(" \uac12");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.neobot_sensor_value=function(b,a){var c=a.getStringField("PORT");return Entry.hw.portData[c]}; +Blockly.Blocks.neobot_sensor_value={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("").appendField(new Blockly.FieldDropdown([["1\ubc88 \ud3ec\ud2b8","IN1"],["2\ubc88 \ud3ec\ud2b8","IN2"],["3\ubc88 \ud3ec\ud2b8","IN3"],["\ub9ac\ubaa8\ucee8","IR"],["\ubc30\ud130\ub9ac","BAT"]]),"PORT").appendField(" \uac12");this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.neobot_sensor_value=function(a,b){a=b.getStringField("PORT");return Entry.hw.portData[a]}; Blockly.Blocks.neobot_left_motor={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc67c\ucabd\ubaa8\ud130\ub97c").appendField(new Blockly.FieldDropdown([["\uc55e\uc73c\ub85c","16"],["\ub4a4\ub85c","32"]]),"DIRECTION").appendField(new Blockly.FieldDropdown([["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"],["14","14"],["15","15"]]),"SPEED").appendField("\uc758 \uc18d\ub3c4\ub85c \ud68c\uc804").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_left_motor=function(b,a){var c=a.getNumberField("SPEED"),d=a.getNumberField("DIRECTION");Entry.hw.sendQueue.DCL=c+d;return a.callReturn()}; -Blockly.Blocks.neobot_stop_left_motor={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc67c\ucabd\ubaa8\ud130 \uc815\uc9c0").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_stop_left_motor=function(b,a){Entry.hw.sendQueue.DCL=0;return a.callReturn()}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_left_motor=function(a,b){a=b.getNumberField("SPEED");var c=b.getNumberField("DIRECTION");Entry.hw.sendQueue.DCL=a+c;return b.callReturn()}; +Blockly.Blocks.neobot_stop_left_motor={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc67c\ucabd\ubaa8\ud130 \uc815\uc9c0").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_stop_left_motor=function(a,b){Entry.hw.sendQueue.DCL=0;return b.callReturn()}; Blockly.Blocks.neobot_right_motor={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc624\ub978\ucabd\ubaa8\ud130\ub97c").appendField(new Blockly.FieldDropdown([["\uc55e\uc73c\ub85c","16"],["\ub4a4\ub85c","32"]]),"DIRECTION").appendField(new Blockly.FieldDropdown([["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"],["14","14"],["15","15"]]),"SPEED").appendField("\uc758 \uc18d\ub3c4\ub85c \ud68c\uc804").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_right_motor=function(b,a){var c=a.getNumberField("SPEED"),d=a.getNumberField("DIRECTION");Entry.hw.sendQueue.DCR=c+d;return a.callReturn()}; -Blockly.Blocks.neobot_stop_right_motor={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc624\ub978\ucabd\ubaa8\ud130 \uc815\uc9c0").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_stop_right_motor=function(b,a){Entry.hw.sendQueue.DCR=0;return a.callReturn()}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_right_motor=function(a,b){a=b.getNumberField("SPEED");var c=b.getNumberField("DIRECTION");Entry.hw.sendQueue.DCR=a+c;return b.callReturn()}; +Blockly.Blocks.neobot_stop_right_motor={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc624\ub978\ucabd\ubaa8\ud130 \uc815\uc9c0").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.neobot_stop_right_motor=function(a,b){Entry.hw.sendQueue.DCR=0;return b.callReturn()}; Blockly.Blocks.neobot_all_motor={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uc591\ucabd \ubaa8\ud130\ub97c ");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["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"],["14","14"],["15","15"]]),"SPEED").appendField(" \uc758 \uc18d\ub3c4\ub85c ").appendField(new Blockly.FieldDropdown([["\uc804\uc9c4","1"],["\ud6c4\uc9c4", "2"],["\uc81c\uc790\ub9ac \uc88c\ud68c\uc804","3"],["\uc81c\uc790\ub9ac \uc6b0\ud68c\uc804","4"],["\uc88c\ud68c\uc804","5"],["\uc6b0\ud68c\uc804","6"]]),"DIRECTION").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.neobot_all_motor=function(b,a){a.getNumberField("TYPE");var c=a.getNumberField("SPEED");switch(a.getNumberField("DIRECTION")){case 1:Entry.hw.sendQueue.DCL=16+c;Entry.hw.sendQueue.DCR=16+c;break;case 2:Entry.hw.sendQueue.DCL=32+c;Entry.hw.sendQueue.DCR=32+c;break;case 3:Entry.hw.sendQueue.DCL=32+c;Entry.hw.sendQueue.DCR=16+c;break;case 4:Entry.hw.sendQueue.DCL=16+c;Entry.hw.sendQueue.DCR=32+c;break;case 5:Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR=16+c;break;case 6:Entry.hw.sendQueue.DCL= -16+c,Entry.hw.sendQueue.DCR=0}return a.callReturn()}; +Entry.block.neobot_all_motor=function(a,b){b.getNumberField("TYPE");a=b.getNumberField("SPEED");switch(b.getNumberField("DIRECTION")){case 1:Entry.hw.sendQueue.DCL=16+a;Entry.hw.sendQueue.DCR=16+a;break;case 2:Entry.hw.sendQueue.DCL=32+a;Entry.hw.sendQueue.DCR=32+a;break;case 3:Entry.hw.sendQueue.DCL=32+a;Entry.hw.sendQueue.DCR=16+a;break;case 4:Entry.hw.sendQueue.DCL=16+a;Entry.hw.sendQueue.DCR=32+a;break;case 5:Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR=16+a;break;case 6:Entry.hw.sendQueue.DCL= +16+a,Entry.hw.sendQueue.DCR=0}return b.callReturn()}; Blockly.Blocks.neobot_set_servo={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["OUT1","1"],["OUT2","2"],["OUT3","3"]]),"PORT").appendField("\ud3ec\ud2b8\uc758 \uc11c\ubcf4\ubaa8\ud130\ub97c").appendField(new Blockly.FieldDropdown([["0\ub3c4","0"],["10\ub3c4","10"],["20\ub3c4","20"],["30\ub3c4","30"],["40\ub3c4","40"],["50\ub3c4","50"],["60\ub3c4","60"],["70\ub3c4","70"],["80\ub3c4","80"],["90\ub3c4","90"],["100\ub3c4","100"],["110\ub3c4", "110"],["120\ub3c4","120"],["130\ub3c4","130"],["140\ub3c4","140"],["150\ub3c4","150"],["160\ub3c4","160"],["170\ub3c4","170"],["180\ub3c4","180"]]),"DEGREE").appendField(" \uc774\ub3d9").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.neobot_set_servo=function(b,a){var c=a.getNumberField("PORT"),d=a.getNumberField("DEGREE");Entry.hw.sendQueue["OUT"+c]=d;3===c&&(c=4);Entry.hw.sendQueue.OPT|=c;return a.callReturn()}; +Entry.block.neobot_set_servo=function(a,b){a=b.getNumberField("PORT");var c=b.getNumberField("DEGREE");Entry.hw.sendQueue["OUT"+a]=c;3===a&&(a=4);Entry.hw.sendQueue.OPT|=a;return b.callReturn()}; Blockly.Blocks.neobot_set_output={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([["OUT1","1"],["OUT2","2"],["OUT3","3"]]),"PORT").appendField("\ubc88 \ud3ec\ud2b8\uc758 \uac12\uc744");this.appendValueInput("VALUE").setCheck(["Number"]);this.appendDummyInput().appendField("\ub9cc\ud07c \ucd9c\ub825").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0); -this.setNextStatement(!0)}};Entry.block.neobot_set_output=function(b,a){var c=a.getStringField("PORT",a),d=a.getNumberValue("VALUE",a),e=c;0>d?d=0:255c?c=0:255c&&(c=0);Entry.hw.sendQueue.FND=c;return a.callReturn()}; +Entry.block.neobot_set_fnd=function(a,b){a=b.getNumberValue("VALUE",b);255a&&(a=0);Entry.hw.sendQueue.FND=a;return b.callReturn()}; Blockly.Blocks.neobot_play_note_for={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField("\uba5c\ub85c\ub514").appendField(new Blockly.FieldDropdown([["\ubb34\uc74c","0"],[Lang.General.note_c,"1"],[Lang.General.note_c+"#","2"],[Lang.General.note_d,"3"],[Lang.General.note_d+"#","4"],[Lang.General.note_e,"5"],[Lang.General.note_f,"6"],[Lang.General.note_f+"#","7"],[Lang.General.note_g,"8"],[Lang.General.note_g+"#","9"],[Lang.General.note_a,"10"],[Lang.General.note_a+"#","11"], [Lang.General.note_b,"12"]]),"NOTE").appendField("\uc744(\ub97c)").appendField(new Blockly.FieldDropdown([["1","0"],["2","1"],["3","2"],["4","3"],["5","4"],["6","5"]]),"OCTAVE").appendField("\uc625\ud0c0\ube0c\ub85c").appendField(new Blockly.FieldDropdown([["2\ubd84\uc74c\ud45c","2"],["4\ubd84\uc74c\ud45c","4"],["8\ubd84\uc74c\ud45c","8"],["16\ubd84\uc74c\ud45c","16"]]),"DURATION");this.appendDummyInput().appendField("\uae38\uc774\ub9cc\ud07c \uc18c\ub9ac\ub0b4\uae30").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ "block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.neobot_play_note_for=function(b,a){var c=Entry.hw.sendQueue;if(a.isStart){if(1==a.timeFlag)return a;delete a.timeFlag;delete a.isStart;Entry.hw.sendQueue.SND=0;Entry.engine.isContinue=!1;return a.callReturn()}var d=a.getNumberField("NOTE",a),e=a.getNumberField("OCTAVE",a),f=a.getNumberField("DURATION",a),d=d+12*e;a.isStart=!0;a.timeFlag=1;65=c)return this.setRobotisData(a),this.update(),b.callReturn();if(b.isStart){if(1==b.timeFlag)return this.setRobotisData(null),b;delete b.timeFlag;delete b.isStart;Entry.engine.isContinue=!1;this.update();return b.callReturn()}b.isStart=!0;b.timeFlag=1;this.setRobotisData(a);setTimeout(function(){b.timeFlag= -0},c);return b},wait:function(b,a){Entry.hw.socket.send(JSON.stringify(b));for(var c=(new Date).getTime(),d=c;d=c)return this.setRobotisData(b),this.update(),a.callReturn();if(a.isStart){if(1==a.timeFlag)return this.setRobotisData(null),a;delete a.timeFlag;delete a.isStart;Entry.engine.isContinue=!1;this.update();return a.callReturn()}a.isStart=!0;a.timeFlag=1;this.setRobotisData(b);setTimeout(function(){a.timeFlag= +0},c);return a},wait:function(a,b){Entry.hw.socket.send(JSON.stringify(a));for(var c=a=(new Date).getTime();cd&&(d=0);return Entry.Robotis_carCont.postCallReturn(a,[[e,f+(c-1)*g,g,d]],Entry.Robotis_openCM70.delay)}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.robotis_openCM70_aux_servo_position=function(a,b){a=b.getField("PORT",b);var c=b.getNumberValue("VALUE"),d=Entry.Robotis_openCM70.INSTRUCTION.WRITE,e,f;e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0];f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1];1023c&&(c=0);return Entry.Robotis_carCont.postCallReturn(b,[[d,e+(a-1)*f,f,c]],Entry.Robotis_openCM70.delay)}; Blockly.Blocks.robotis_openCM70_aux_led_module={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.robotis_common_port_3,"3"],[Lang.Blocks.robotis_common_port_4,"4"],[Lang.Blocks.robotis_common_port_5,"5"],[Lang.Blocks.robotis_common_port_6,"6"]]),"PORT").appendField(Lang.Blocks.robotis_openCM70_aux_led_module_1).appendField(new Blockly.FieldDropdown([[Lang.Blocks.robotis_cm_led_both+Lang.Blocks.robotis_common_off,"0"],[Lang.Blocks.robotis_cm_led_right+ Lang.Blocks.robotis_common_on,"1"],[Lang.Blocks.robotis_cm_led_left+Lang.Blocks.robotis_common_on,"2"],[Lang.Blocks.robotis_cm_led_both+Lang.Blocks.robotis_common_on,"3"]]),"LED_MODULE");this.appendDummyInput().appendField(Lang.Blocks.robotis_common_set).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.robotis_openCM70_aux_led_module=function(b,a){var c=a.getField("PORT",a),d=a.getField("LED_MODULE",a),e=Entry.Robotis_openCM70.INSTRUCTION.WRITE,f=0,g=0,f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[1];return Entry.Robotis_carCont.postCallReturn(a,[[e,f+(c-1)*g,g,d]],Entry.Robotis_openCM70.delay)}; +Entry.block.robotis_openCM70_aux_led_module=function(a,b){a=b.getField("PORT",b);var c=b.getField("LED_MODULE",b),d=Entry.Robotis_openCM70.INSTRUCTION.WRITE,e,f;e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[0];f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[1];return Entry.Robotis_carCont.postCallReturn(b,[[d,e+(a-1)*f,f,c]],Entry.Robotis_openCM70.delay)}; Blockly.Blocks.robotis_openCM70_aux_custom={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.robotis_common_port_3,"3"],[Lang.Blocks.robotis_common_port_4,"4"],[Lang.Blocks.robotis_common_port_5,"5"],[Lang.Blocks.robotis_common_port_6,"6"]]),"PORT").appendField(Lang.Blocks.robotis_openCM70_aux_custom_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.robotis_common_set).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.robotis_openCM70_aux_custom=function(b,a){var c=a.getField("PORT",a),d=a.getNumberValue("VALUE"),e=Entry.Robotis_openCM70.INSTRUCTION.WRITE,f=0,g=0,f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1];return Entry.Robotis_carCont.postCallReturn(a,[[e,f+(c-1)*g,g,d]],Entry.Robotis_openCM70.delay)}; +"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.robotis_openCM70_aux_custom=function(a,b){a=b.getField("PORT",b);var c=b.getNumberValue("VALUE"),d=Entry.Robotis_openCM70.INSTRUCTION.WRITE,e,f;e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0];f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1];return Entry.Robotis_carCont.postCallReturn(b,[[d,e+(a-1)*f,f,c]],Entry.Robotis_openCM70.delay)}; Blockly.Blocks.robotis_openCM70_cm_custom={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.robotis_cm_custom);this.appendDummyInput().appendField("(");this.appendValueInput("ADDRESS").setCheck(["Number","String"]);this.appendDummyInput().appendField(")");this.appendDummyInput().appendField(Lang.Blocks.robotis_common_case_01);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.robotis_common_set).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.robotis_openCM70_cm_custom=function(b,a){var c=Entry.Robotis_openCM70.INSTRUCTION.WRITE,d=0,e=0,d=a.getNumberValue("ADDRESS"),e=a.getNumberValue("VALUE");return Entry.Robotis_carCont.postCallReturn(a,[[c,d,65535c&&(c=0);createjs.Sound.setVolume(c);return a.callReturn()}; +Entry.block.sound_volume_change=function(a,b){a=b.getNumberValue("VALUE",b)/100;a+=createjs.Sound.getVolume();1a&&(a=0);createjs.Sound.setVolume(a);return b.callReturn()}; Blockly.Blocks.sound_volume_set={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_volume_set_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_volume_set_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; -Entry.block.sound_volume_set=function(b,a){var c=a.getNumberValue("VALUE",a)/100;1c&&(c=0);createjs.Sound.setVolume(c);return a.callReturn()};Blockly.Blocks.sound_silent_all={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_silent_all).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; -Entry.block.sound_silent_all=function(b,a){createjs.Sound.stop();return a.callReturn()};Blockly.Blocks.get_sounds={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField("");this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("sounds"),"VALUE");this.appendDummyInput().appendField(" ");this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.get_sounds=function(b,a){return a.getStringField("VALUE")}; +Entry.block.sound_volume_set=function(a,b){a=b.getNumberValue("VALUE",b)/100;1a&&(a=0);createjs.Sound.setVolume(a);return b.callReturn()};Blockly.Blocks.sound_silent_all={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_silent_all).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; +Entry.block.sound_silent_all=function(a,b){createjs.Sound.stop();return b.callReturn()};Blockly.Blocks.get_sounds={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField("");this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("sounds"),"VALUE");this.appendDummyInput().appendField(" ");this.setOutput(!0,"String");this.setInputsInline(!0)}};Entry.block.get_sounds=function(a,b){return b.getStringField("VALUE")}; Blockly.Blocks.sound_something_with_block={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_1);this.appendValueInput("VALUE").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; -Entry.block.sound_something_with_block=function(b,a){var c=a.getStringValue("VALUE",a);(c=b.parent.getSound(c))&&createjs.Sound.play(c.id);return a.callReturn()}; +Entry.block.sound_something_with_block=function(a,b){var c=b.getStringValue("VALUE",b);(a=a.parent.getSound(c))&&createjs.Sound.play(a.id);return b.callReturn()}; Blockly.Blocks.sound_something_second_with_block={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_second_1);this.appendValueInput("VALUE").setCheck(["String","Number"]);this.appendDummyInput().appendField(" ").appendField(Lang.Blocks.SOUND_sound_something_second_2);this.appendValueInput("SECOND").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_second_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}};Entry.block.sound_something_second_with_block=function(b,a){var c=a.getStringValue("VALUE",a),d=a.getNumberValue("SECOND",a);(c=b.parent.getSound(c))&&createjs.Sound.play(c.id,{startTime:0,duration:1E3*d});return a.callReturn()}; +"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}};Entry.block.sound_something_second_with_block=function(a,b){var c=b.getStringValue("VALUE",b),d=b.getNumberValue("SECOND",b);(a=a.parent.getSound(c))&&createjs.Sound.play(a.id,{startTime:0,duration:1E3*d});return b.callReturn()}; Blockly.Blocks.sound_something_wait_with_block={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_wait_1);this.appendValueInput("VALUE").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_wait_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; -Entry.block.sound_something_wait_with_block=function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.playState;delete a.isPlay;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(c=b.parent.getSound(c))createjs.Sound.play(c.id),setTimeout(function(){a.playState=0},1E3*c.duration);return a}; +Entry.block.sound_something_wait_with_block=function(a,b){if(b.isPlay){if(1==b.playState)return b;delete b.playState;delete b.isPlay;return b.callReturn()}b.isPlay=!0;b.playState=1;var c=b.getStringValue("VALUE",b);if(a=a.parent.getSound(c))createjs.Sound.play(a.id),setTimeout(function(){b.playState=0},1E3*a.duration);return b}; Blockly.Blocks.sound_something_second_wait_with_block={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_second_wait_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_second_wait_2).appendField(" ");this.appendValueInput("SECOND").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_something_second_wait_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ "block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; -Entry.block.sound_something_second_wait_with_block=function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.isPlay;delete a.playState;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(c=b.parent.getSound(c)){var d=createjs.Sound.play(c.id),c=a.getNumberValue("SECOND",a);setTimeout(function(){d.stop();a.playState=0},1E3*c);d.addEventListener("complete",function(a){})}return a}; +Entry.block.sound_something_second_wait_with_block=function(a,b){if(b.isPlay){if(1==b.playState)return b;delete b.isPlay;delete b.playState;return b.callReturn()}b.isPlay=!0;b.playState=1;var c=b.getStringValue("VALUE",b);if(a=a.parent.getSound(c)){var d=createjs.Sound.play(a.id);a=b.getNumberValue("SECOND",b);setTimeout(function(){d.stop();b.playState=0},1E3*a);d.addEventListener("complete",function(b){})}return b}; Blockly.Blocks.sound_from_to={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_2);this.appendValueInput("START").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_3);this.appendValueInput("END").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+ -"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}};Entry.block.sound_from_to=function(b,a){var c=a.getStringValue("VALUE",a);if(c=b.parent.getSound(c)){var d=1E3*a.getNumberValue("START",a),e=1E3*a.getNumberValue("END",a);createjs.Sound.play(c.id,{startTime:Math.min(d,e),duration:Math.max(d,e)-Math.min(d,e)})}return a.callReturn()}; +"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}};Entry.block.sound_from_to=function(a,b){var c=b.getStringValue("VALUE",b);if(a=a.parent.getSound(c)){var c=1E3*b.getNumberValue("START",b),d=1E3*b.getNumberValue("END",b);createjs.Sound.play(a.id,{startTime:Math.min(c,d),duration:Math.max(c,d)-Math.min(c,d)})}return b.callReturn()}; Blockly.Blocks.sound_from_to_and_wait={init:function(){this.setColour("#A4D01D");this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_and_wait_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_and_wait_2);this.appendValueInput("START").setCheck(["String","Number"]);this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_and_wait_3);this.appendValueInput("END").setCheck(["String","Number"]); this.appendDummyInput().appendField(Lang.Blocks.SOUND_sound_from_to_and_wait_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/sound_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)}}; -Entry.block.sound_from_to_and_wait=function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.isPlay;delete a.playState;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(c=b.parent.getSound(c)){var d=1E3*a.getNumberValue("START",a),e=1E3*a.getNumberValue("END",a),f=Math.min(d,e),d=Math.max(d,e)-f;createjs.Sound.play(c.id,{startTime:f,duration:d});setTimeout(function(){a.playState=0},d)}return a};Blockly.Blocks.when_run_button_click={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_play.png","*","start")).appendField(Lang.Blocks.START_when_run_button_click);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_run_button_click=function(b,a){return a.callReturn()}; +Entry.block.sound_from_to_and_wait=function(a,b){if(b.isPlay){if(1==b.playState)return b;delete b.isPlay;delete b.playState;return b.callReturn()}b.isPlay=!0;b.playState=1;var c=b.getStringValue("VALUE",b);if(a=a.parent.getSound(c)){var d=1E3*b.getNumberValue("START",b),e=1E3*b.getNumberValue("END",b),c=Math.min(d,e),d=Math.max(d,e)-c;createjs.Sound.play(a.id,{startTime:c,duration:d});setTimeout(function(){b.playState=0},d)}return b};Blockly.Blocks.when_run_button_click={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_play.png","*","start")).appendField(Lang.Blocks.START_when_run_button_click);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_run_button_click=function(a,b){return b.callReturn()}; Blockly.Blocks.press_some_key={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_keyboard.png","*","start")).appendField(Lang.Blocks.START_press_some_key_1).appendField(new Blockly.FieldDropdown([["q","81"],["w","87"],["e","69"],["r","82"],["a","65"],["s","83"],["d","68"],[Lang.Blocks.START_press_some_key_up,"38"],[Lang.Blocks.START_press_some_key_down,"40"],[Lang.Blocks.START_press_some_key_left,"37"],[Lang.Blocks.START_press_some_key_right, -"39"],[Lang.Blocks.START_press_some_key_enter,"13"],[Lang.Blocks.START_press_some_key_space,"32"]]),"VALUE").appendField(Lang.Blocks.START_press_some_key_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.press_some_key=function(b,a){return a.callReturn()}; -Blockly.Blocks.when_some_key_pressed={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_keyboard.png","*","start")).appendField(Lang.Blocks.START_press_some_key_1).appendField(new Blockly.FieldKeydownInput("81"),"VALUE").appendField(Lang.Blocks.START_press_some_key_2);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_some_key_pressed=function(b,a){return a.callReturn()}; -Blockly.Blocks.mouse_clicked={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_mouse.png","*","start")).appendField(Lang.Blocks.START_mouse_clicked);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.mouse_clicked=function(b,a){return a.callReturn()}; -Blockly.Blocks.mouse_click_cancled={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_mouse.png","*","start")).appendField(Lang.Blocks.START_mouse_click_cancled);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.mouse_click_cancled=function(b,a){return a.callReturn()}; -Blockly.Blocks.when_object_click={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_mouse.png","*","start")).appendField(Lang.Blocks.START_when_object_click);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_object_click=function(b,a){return a.callReturn()}; -Blockly.Blocks.when_object_click_canceled={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_mouse.png","*","start")).appendField(Lang.Blocks.START_when_object_click_canceled);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_object_click_canceled=function(b,a){return a.callReturn()}; -Blockly.Blocks.when_some_key_click={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_keyboard.png","*","start")).appendField(Lang.Blocks.START_when_some_key_click);this.setInputsInline(!0);this.setNextStatement(!0)}};Entry.block.when_some_key_click=function(b,a){return a.callReturn()}; -Blockly.Blocks.when_message_cast={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_icon_signal.png","*","start")).appendField(Lang.Blocks.START_when_message_cast_1).appendField(new Blockly.FieldDropdownDynamic("messages"),"VALUE").appendField(Lang.Blocks.START_when_message_cast_2);this.setInputsInline(!0);this.setNextStatement(!0)},whenAdd:function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs",b)}, -whenRemove:function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}};Entry.block.when_message_cast=function(b,a){return a.callReturn()}; -Blockly.Blocks.message_cast={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(Lang.Blocks.START_message_cast_1).appendField(new Blockly.FieldDropdownDynamic("messages"),"VALUE").appendField(Lang.Blocks.START_message_cast_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_03.png","*"));this.setInputsInline(!0);this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)},whenAdd:function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs", -b)},whenRemove:function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}};Entry.block.message_cast=function(b,a){var c=a.getField("VALUE",a),d=Entry.isExist(c,"id",Entry.variableContainer.messages_);if("null"==c||!d)throw Error("value can not be null or undefined");Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent,["when_message_cast",c]);return a.callReturn()}; -Blockly.Blocks.message_cast_wait={init:function(){this.setColour("#3BBD70");this.appendDummyInput().appendField(Lang.Blocks.START_message_send_wait_1).appendField(new Blockly.FieldDropdownDynamic("messages"),"VALUE").appendField(Lang.Blocks.START_message_send_wait_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/start_03.png","*"));this.setInputsInline(!0);this.setNextStatement(!0);this.setPreviousStatement(!0)},whenAdd:function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs", -b)},whenRemove:function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}}; -Entry.block.message_cast_wait=function(b,a){if(a.runningScript){for(var c=a.runningScript,d=c.length,e=0;ec.array_.length)throw Error("can not remove value from array");c.array_.splice(d-1,1);c.updateView();return a.callReturn()}; +"block_icon/variable_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.remove_value_from_list=function(a,b){var c=b.getField("LIST",b),d=b.getValue("VALUE",b);a=Entry.variableContainer.getList(c,a);if(!a.array_||isNaN(d)||d>a.array_.length)throw Error("can not remove value from array");a.array_.splice(d-1,1);a.updateView();return b.callReturn()}; Blockly.Blocks.insert_value_to_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_insert_value_to_list_1);this.appendValueInput("DATA").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_insert_value_to_list_2);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_insert_value_to_list_3);this.appendValueInput("INDEX").setCheck(["Number", "String"]);this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_insert_value_to_list_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/variable_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.insert_value_to_list=function(b,a){var c=a.getField("LIST",a),d=a.getValue("DATA",a),e=a.getValue("INDEX",a),c=Entry.variableContainer.getList(c,b);if(!c.array_||isNaN(e)||0==e||e>c.array_.length+1)throw Error("can not insert value to array");c.array_.splice(e-1,0,{data:d});c.updateView();return a.callReturn()}; +Entry.block.insert_value_to_list=function(a,b){var c=b.getField("LIST",b),d=b.getValue("DATA",b),e=b.getValue("INDEX",b);a=Entry.variableContainer.getList(c,a);if(!a.array_||isNaN(e)||0==e||e>a.array_.length+1)throw Error("can not insert value to array");a.array_.splice(e-1,0,{data:d});a.updateView();return b.callReturn()}; Blockly.Blocks.change_value_list_index={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_change_value_list_index_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_change_value_list_index_2);this.appendValueInput("INDEX").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_change_value_list_index_3);this.appendValueInput("DATA").setCheck(["Number", "String"]);this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_change_value_list_index_4).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/variable_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.change_value_list_index=function(b,a){var c=a.getField("LIST",a),d=a.getValue("DATA",a),e=a.getValue("INDEX",a),c=Entry.variableContainer.getList(c,b);if(!c.array_||isNaN(e)||e>c.array_.length)throw Error("can not insert value to array");c.array_[e-1].data=d;c.updateView();return a.callReturn()}; +Entry.block.change_value_list_index=function(a,b){var c=b.getField("LIST",b),d=b.getValue("DATA",b),e=b.getValue("INDEX",b);a=Entry.variableContainer.getList(c,a);if(!a.array_||isNaN(e)||e>a.array_.length)throw Error("can not insert value to array");a.array_[e-1].data=d;a.updateView();return b.callReturn()}; Blockly.Blocks.value_of_index_from_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_value_of_index_from_list_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_value_of_index_from_list_2);this.appendValueInput("INDEX").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_value_of_index_from_list_3);this.setOutput(!0, -"String");this.setInputsInline(!0)}};Entry.block.value_of_index_from_list=function(b,a){var c=a.getField("LIST",a),d=a.getValue("INDEX",a),c=Entry.variableContainer.getList(c,b),d=Entry.getListRealIndex(d,c);if(!c.array_||isNaN(d)||d>c.array_.length)throw Error("can not insert value to array");return c.array_[d-1].data}; -Blockly.Blocks.length_of_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_length_of_list_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_length_of_list_2);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.length_of_list=function(b,a){var c=a.getField("LIST",a);return Entry.variableContainer.getList(c).array_.length}; +"String");this.setInputsInline(!0)}};Entry.block.value_of_index_from_list=function(a,b){var c=b.getField("LIST",b);b=b.getValue("INDEX",b);a=Entry.variableContainer.getList(c,a);b=Entry.getListRealIndex(b,a);if(!a.array_||isNaN(b)||b>a.array_.length)throw Error("can not insert value to array");return a.array_[b-1].data}; +Blockly.Blocks.length_of_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_length_of_list_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_length_of_list_2);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.length_of_list=function(a,b){a=b.getField("LIST",b);return Entry.variableContainer.getList(a).array_.length}; Blockly.Blocks.show_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_show_list_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST").appendField(Lang.Blocks.VARIABLE_show_list_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/variable_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.show_list=function(b,a){var c=a.getField("LIST",a);Entry.variableContainer.getList(c).setVisible(!0);return a.callReturn()}; +Entry.block.show_list=function(a,b){a=b.getField("LIST",b);Entry.variableContainer.getList(a).setVisible(!0);return b.callReturn()}; Blockly.Blocks.hide_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_hide_list_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST").appendField(Lang.Blocks.VARIABLE_hide_list_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/variable_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.hide_list=function(b,a){var c=a.getField("LIST",a);Entry.variableContainer.getList(c).setVisible(!1);return a.callReturn()}; +Entry.block.hide_list=function(a,b){a=b.getField("LIST",b);Entry.variableContainer.getList(a).setVisible(!1);return b.callReturn()}; Blockly.Blocks.options_for_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField("");this.appendDummyInput("VALUE").appendField(new Blockly.FieldDropdown([[Lang.Blocks.VARIABLE_list_option_first,"FIRST"],[Lang.Blocks.VARIABLE_list_option_last,"LAST"],[Lang.Blocks.VARIABLE_list_option_random,"RANDOM"]]),"OPERATOR");this.appendDummyInput().appendField(" ");this.setOutput(!0,"Number");this.setInputsInline(!0)}}; -Entry.block.options_for_list=function(b,a){return a.getField("OPERATOR",a)}; +Entry.block.options_for_list=function(a,b){return b.getField("OPERATOR",b)}; Blockly.Blocks.set_visible_answer={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_get_canvas_input_value);this.appendDummyInput().appendField(new Blockly.FieldDropdown([[Lang.Blocks.CALC_timer_visible_show,"SHOW"],[Lang.Blocks.CALC_timer_visible_hide,"HIDE"]]),"BOOL");this.appendDummyInput().appendField("").appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/variable_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0); -this.setNextStatement(!0)},whenAdd:function(){Entry.container&&Entry.container.showProjectAnswer()},whenRemove:function(b){Entry.container&&Entry.container.hideProjectAnswer(b)}};Entry.block.set_visible_answer=function(b,a){"HIDE"==a.getField("BOOL",a)?Entry.container.inputValue.setVisible(!1):Entry.container.inputValue.setVisible(!0);return a.callReturn()}; +this.setNextStatement(!0)},whenAdd:function(){Entry.container&&Entry.container.showProjectAnswer()},whenRemove:function(a){Entry.container&&Entry.container.hideProjectAnswer(a)}};Entry.block.set_visible_answer=function(a,b){"HIDE"==b.getField("BOOL",b)?Entry.container.inputValue.setVisible(!1):Entry.container.inputValue.setVisible(!0);return b.callReturn()}; Blockly.Blocks.is_included_in_list={init:function(){this.setColour("#E457DC");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_is_included_in_list_1);this.appendDummyInput().appendField(new Blockly.FieldDropdownDynamic("lists"),"LIST");this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_is_included_in_list_2);this.appendValueInput("DATA").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.VARIABLE_is_included_in_list_3);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}}; -Entry.block.is_included_in_list=function(b,a){var c=a.getField("LIST",a),d=a.getStringValue("DATA",a),c=Entry.variableContainer.getList(c);if(!c)return!1;for(var c=c.array_,e=0,f=c.length;eb||0>d||b>e||d>e||a.splice.call(this,d,0,a.splice.call(this,b,1)[0])};b.sort=function(){};b.fromJSON=function(){};b.toJSON=function(){for(var a=[],b=0,e=this.length;b/,d;d=b instanceof HTMLElement?$(b):b instanceof jQuery?b:c.test(b)?$(b):$("<"+b+">");if(void 0===a)return d;a.id&&d.attr("id",a.id);a.class&&d.addClass(a.class);a.classes&&a.classes.map(function(a){d.addClass(a)});a.src&&d.attr("src",a.src);a.parent&&a.parent.append(d);d.bindOnClick=function(){var a,b,c=function(a){a.stopImmediatePropagation();a.handled||(a.handled=!0,b.call(this,a))};1b.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= +this.setNextStatement(!0)}};Entry.block.xbot_lcd=function(a,b){a=Entry.hw.sendQueue;var c=b.getNumberField("LINE",b),d=b.getStringValue("VALUE",b);0==c?(a.lcdNum=0,a.lcdTxt=d):1==c&&(a.lcdNum=1,a.lcdTxt=d);return b.callReturn()};Entry.Collection=function(a){this.length=0;this._hashMap={};this._observers=[];this.set(a)}; +(function(a,b){a.set=function(a){for(;this.length;)b.pop.call(this);var d=this._hashMap,e;for(e in d)delete d[e];if(void 0!==a){e=0;for(var f=a.length;ea||0>d||a>e||d>e||b.splice.call(this,d,0,b.splice.call(this,a,1)[0])};a.sort=function(){};a.fromJSON=function(){};a.toJSON=function(){for(var b=[],a=0,e=this.length;a=b.x&&e-c<=b.y&&e+a.height+c>=b.y}; +Entry.Utils.colorDarken=function(a,b){function c(b){2!=b.length&&(b="0"+b);return b}var d,e;7===a.length?(d=parseInt(a.substr(1,2),16),e=parseInt(a.substr(3,2),16),a=parseInt(a.substr(5,2),16)):(d=parseInt(a.substr(1,2),16),e=parseInt(a.substr(2,2),16),a=parseInt(a.substr(3,2),16));b=void 0===b?.7:b;d=c(Math.floor(d*b).toString(16));e=c(Math.floor(e*b).toString(16));a=c(Math.floor(a*b).toString(16));return"#"+d+e+a}; +Entry.Utils.colorLighten=function(a,b){b=0===b?0:b||20;a=Entry.Utils.hexToHsl(a);a.l+=b/100;a.l=Math.min(1,Math.max(0,a.l));return Entry.Utils.hslToHex(a)};Entry.Utils.bound01=function(a,b){var c=a;"string"==typeof c&&-1!=c.indexOf(".")&&1===parseFloat(c)&&(a="100%");c="string"===typeof a&&-1!=a.indexOf("%");a=Math.min(b,Math.max(0,parseFloat(a)));c&&(a=parseInt(a*b,10)/100);return 1E-6>Math.abs(a-b)?1:a%b/parseFloat(b)}; +Entry.Utils.hexToHsl=function(a){var b,c;7===a.length?(b=parseInt(a.substr(1,2),16),c=parseInt(a.substr(3,2),16),a=parseInt(a.substr(5,2),16)):(b=parseInt(a.substr(1,2),16),c=parseInt(a.substr(2,2),16),a=parseInt(a.substr(3,2),16));b=Entry.Utils.bound01(b,255);c=Entry.Utils.bound01(c,255);a=Entry.Utils.bound01(a,255);var d=Math.max(b,c,a),e=Math.min(b,c,a),f,g=(d+e)/2;if(d==e)f=e=0;else{var h=d-e,e=.5c&&(c+=1);1c?a:c<2/3?b+(a-b)*(2/3-c)*6:b}function c(b){return 1==b.length?"0"+b:""+b}var d,e;e=Entry.Utils.bound01(a.h,360);d=Entry.Utils.bound01(a.s,1);a=Entry.Utils.bound01(a.l,1);if(0===d)d=a=e=a;else{var f=.5>a?a*(1+d):a+d-a*d,g=2*a-f;d=b(g,f,e+1/3);a=b(g,f,e);e=b(g,f,e-1/3)}a*=255;e*=255;return"#"+[c(Math.round(255*d).toString(16)),c(Math.round(a).toString(16)),c(Math.round(e).toString(16))].join("")}; +Entry.Utils.bindGlobalEvent=function(a){var b=$(document);void 0===a&&(a="resize mousedown mousemove keydown keyup dispose".split(" "));-1Entry.pressedKeys.indexOf(a)&&Entry.pressedKeys.push(a);Entry.keyPressed.notify(b)}));-1$1://$2").replace(/([xA1-xFEa-z0-9_-]+@[xA1-xFEa-z0-9-]+.[a-z0-9-]+)/gi,"$1"):""};Entry.generateHash=function(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).substr(-4)}; +Entry.addEventListener=function(a,b){this.events_||(this.events_={});this.events_[a]||(this.events_[a]=[]);b instanceof Function&&this.events_[a].push(b);return!0};Entry.dispatchEvent=function(a,b){this.events_||(this.events_={});if(this.events_[a])for(var c=0,d=this.events_[a].length;c=f?(parseFloat(a)+parseFloat(b)).toFixed(e):(parseFloat(a)+parseFloat(b)).toFixed(f):parseInt(a)+parseInt(b)}; +Entry.hex2rgb=function(a){return(a=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a))?{r:parseInt(a[1],16),g:parseInt(a[2],16),b:parseInt(a[3],16)}:null};Entry.rgb2hex=function(a,b,c){return"#"+(16777216+(a<<16)+(b<<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(a,b,c){return a>c?c:ab.y+b.height||a.x+a.widthb.x+b.width)};Entry.bindAnimationCallback=function(a,b){a.addEventListener("webkitAnimationEnd",b,!1);a.addEventListener("animationend",b,!1);a.addEventListener("oanimationend",b,!1)};Entry.cloneSimpleObject=function(a){var b={},c;for(c in a)b[c]=a[c];return b};Entry.nodeListToArray=function(a){for(var b=Array(a.length),c=-1,d=a.length;++c!==d;b[c]=a[c]);return b}; +Entry.computeInputWidth=function(a){var b=document.createElement("span");b.className="tmp-element";b.innerHTML=a.replace(/&/g,"&").replace(//g,">");document.body.appendChild(b);a=b.offsetWidth;document.body.removeChild(b);return Number(a+10)+"px"};Entry.isArrowOrBackspace=function(a){return-1<[37,38,39,40,8].indexOf(a)};Entry.hexStringToBin=function(a){for(var b=[],c=0;cd&&(d=h.index)}return 0b&&(b=e))}return Math.min(b,20)};Entry.convertToRoundedDecimals=function(a,b){return isNaN(a)||!this.isFloat(a)?a:Number(Math.round(a+"e"+b)+"e-"+b)};Entry.attachEventListener=function(a,b,c){setTimeout(function(){a.addEventListener(b,c)},0)};Entry.deAttachEventListener=function(a,b,c){a.removeEventListener(b,c)}; +Entry.isEmpty=function(a){if(!a)return!0;for(var b in a)if(a.hasOwnProperty(b))return!1;return!0};Entry.Utils.disableContextmenu=function(a){if(a)$(a).on("contextmenu",function(b){b.stopPropagation();b.preventDefault();return!1})};Entry.Utils.isRightButton=function(a){return 2==a.button||a.ctrlKey};Entry.Utils.isTouchEvent=function(a){return"mousedown"!==a.type.toLowerCase()};Entry.Utils.inherit=function(a,b){function c(){}c.prototype=a.prototype;b.prototype=new c;return b}; +Entry.bindAnimationCallbackOnce=function(a,b){a.one("webkitAnimationEnd animationendo animationend",b)};Entry.Utils.isInInput=function(a){return"textarea"==a.target.type||"text"==a.target.type};Entry.Utils.isFunction=function(a){return"function"===typeof a}; +Entry.Utils.addFilters=function(a,b){a=a.elem("defs");var c=a.elem("filter",{id:"entryTrashcanFilter_"+b});c.elem("feGaussianBlur",{"in":"SourceAlpha",stdDeviation:2,result:"blur"});c.elem("feOffset",{"in":"blur",dx:1,dy:1,result:"offsetBlur"});c=c.elem("feMerge");c.elem("feMergeNode",{"in":"offsetBlur"});c.elem("feMergeNode",{"in":"SourceGraphic"},c);c=a.elem("filter",{id:"entryBlockShadowFilter_"+b,height:"200%"});c.elem("feOffset",{result:"offOut",in:"SourceGraphic",dx:0,dy:1});c.elem("feColorMatrix", +{result:"matrixOut",in:"offOut",type:"matrix",values:"0.7 0 0 0 0 0 0.7 0 0 0 0 0 0.7 0 0 0 0 0 1 0"});c.elem("feBlend",{in:"SourceGraphic",in1:"offOut",mode:"normal"});b=a.elem("filter",{id:"entryBlockHighlightFilter_"+b});b.elem("feOffset",{result:"offOut",in:"SourceGraphic",dx:0,dy:0});b.elem("feColorMatrix",{result:"matrixOut",in:"offOut",type:"matrix",values:"1.3 0 0 0 0 0 1.3 0 0 0 0 0 1.3 0 0 0 0 0 1 0"})}; +Entry.Utils.addBlockPattern=function(a,b){a=a.elem("pattern",{id:"blockHoverPattern_"+b,class:"blockHoverPattern",patternUnits:"userSpaceOnUse",patternTransform:"translate(12, 0)",x:0,y:0,width:125,height:33,style:"display: none"});b=a.elem("g");for(var c=b.elem("rect",{x:0,y:0,width:125,height:33}),d=Entry.mediaFilePath+"block_pattern_(order).png",e=1;5>e;e++)b.elem("image",{class:"pattern"+e,href:d.replace("(order)",e),x:0,y:0,width:125,height:33});return{pattern:a,rect:c}}; +Entry.Utils.COLLISION={NONE:0,UP:1,RIGHT:2,LEFT:3,DOWN:4};Entry.Utils.createMouseEvent=function(a,b){var c=document.createEvent("MouseEvent");c.initMouseEvent(a,!0,!0,window,0,0,0,b.clientX,b.clientY,!1,!1,!1,!1,0,null);return c};Entry.Utils.xmlToJsonData=function(a){a=$.parseXML(a);var b=[];a=a.childNodes[0].childNodes;for(var c in a){var d=a[c];if(d.tagName){var e={category:d.getAttribute("id"),blocks:[]},d=d.childNodes;for(c in d){var f=d[c];f.tagName&&(f=f.getAttribute("type"))&&e.blocks.push(f)}b.push(e)}}return b}; +Entry.Utils.stopProjectWithToast=function(a,b,c){var d=a.block;b=b||"\ub7f0\ud0c0\uc784 \uc5d0\ub7ec \ubc1c\uc0dd";Entry.toast&&!c&&Entry.toast.alert(Lang.Msgs.warn,Lang.Workspace.check_runtime_error,!0);Entry.engine&&Entry.engine.toggleStop();"workspace"===Entry.type&&(a.block&&"funcBlock"in a.block?d=a.block.funcBlock:a.funcExecutor&&(d=a.funcExecutor.scope.block,a=a.type.replace("func_",""),Entry.Func.edit(Entry.variableContainer.functions_[a])),d&&(Entry.container.selectObject(d.getCode().object.id, +!0),d.view.getBoard().activateBlock(d)));throw Error(b);};Entry.Utils.AsyncError=function(a){this.name="AsyncError";this.message=a||"\ube44\ub3d9\uae30 \ud638\ucd9c \ub300\uae30"};Entry.Utils.AsyncError.prototype=Error();Entry.Utils.AsyncError.prototype.constructor=Entry.Utils.AsyncError;Entry.Utils.isChrome=function(){return/chrom(e|ium)/.test(navigator.userAgent.toLowerCase())}; +Entry.Utils.waitForWebfonts=function(a,b){for(var c=0,d=0,e=a.length;d=a.length&&(l&&clearInterval(l),c==a.length))return b(),!0}var h=document.createElement("span");h.innerHTML="giItT1WQy@!-/#";h.style.position="absolute";h.style.left="-10000px";h.style.top="-10000px";h.style.fontSize="300px";h.style.fontFamily="sans-serif";h.style.fontVariant="normal";h.style.fontStyle="normal";h.style.fontWeight= +"normal";h.style.letterSpacing="0";document.body.appendChild(h);var k=h.offsetWidth;h.style.fontFamily=d;var l;e()||(l=setInterval(e,50))})(a[d])};window.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(a){window.setTimeout(a,1E3/60)}}(); +Entry.isMobile=function(){if(Entry.device)return"tablet"===Entry.device;var a=window.platform;if(a&&a.type&&("tablet"===a.type||"mobile"===a.type))return Entry.device="tablet",!0;Entry.device="desktop";return!1};Entry.Utils.convertMouseEvent=function(a){return a.originalEvent&&a.originalEvent.touches?a.originalEvent.touches[0]:a};Entry.Utils.convertIntToHex=function(a){return a.toString(16).toUpperCase()};Entry.Model=function(a,b){var c=Entry.Model;c.generateSchema(a);c.generateSetter(a);c.generateObserve(a);(void 0===b||b)&&Object.seal(a);return a}; +(function(a){a.generateSchema=function(b){var a=b.schema;if(void 0!==a){a=JSON.parse(JSON.stringify(a));b.data={};for(var d in a)(function(d){b.data[d]=a[d];Object.defineProperty(b,d,{get:function(){return b.data[d]}})})(d);b._toJSON=this._toJSON}};a.generateSetter=function(b){b.set=this.set};a.set=function(b,a){var d={},e;for(e in this.data)void 0!==b[e]&&(b[e]===this.data[e]?delete b[e]:(d[e]=this.data[e],this.data[e]=b[e]instanceof Array?b[e].concat():b[e]));a||this.notify(Object.keys(b),d)};a.generateObserve= +function(b){b.observers=[];b.observe=this.observe;b.unobserve=this.unobserve;b.notify=this.notify};a.observe=function(b,a,d,e){d=new Entry.Observer(this.observers,b,a,d);if(!1!==e)b[a]([]);return d};a.unobserve=function(b){b.destroy()};a.notify=function(b,a){"string"===typeof b&&(b=[b]);var d=this;d.observers.map(function(e){var f=b;void 0!==e.attrs&&(f=Entry.Utils.intersectArray(e.attrs,b));if(f.length)e.object[e.funcName](f.map(function(b){return{name:b,object:d,oldValue:a[b]}}))})};a._toJSON=function(){var b= +{},a;for(a in this.data)b[a]=this.data[a];return b}})(Entry.Model);Entry.Observer=function(a,b,c,d){this.parent=a;this.object=b;this.funcName=c;this.attrs=d;a.push(this)};(function(a){a.destroy=function(){var b=this.parent,a=b.indexOf(this);-1/,d;d=a instanceof HTMLElement?$(a):a instanceof jQuery?a:c.test(a)?$(a):$("<"+a+">");if(void 0===b)return d;b.id&&d.attr("id",b.id);b.class&&d.addClass(b.class);b.classes&&b.classes.map(function(b){d.addClass(b)});b.src&&d.attr("src",b.src);b.parent&&b.parent.append(d);d.bindOnClick=function(){var b,a,c=function(b){b.stopImmediatePropagation();b.handled||(b.handled=!0,a.call(this,b))};1a.x+a.width+this.width?(this.object.x=a.x+a.width+this.width/2,b+="e"):(this.object.x=a.x-this.width/2,b+="w");this.notch.type!=b&&(this.object.removeChild(this.notch),this.notch=this.createSpeakNotch(b),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.requestUpdate=!0};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()||-1c;c++)(function(c){var d=Entry.createElement("td","progressCell"+c);d.bindOnClick(function(){Entry.engine.setSpeedMeter(a[c])});b.appendChild(d)})(c);this.view_.insertBefore(this.speedProgress_,this.maximizeButton);this.speedProgress_.appendChild(b);this.speedHandle_=Entry.createElement("div","entrySpeedHandleWorkspace");var d=(Entry.interfaceState.canvasWidth-84)/5;$(this.speedHandle_).bind("mousedown.speedPanel touchstart.speedPanel",function(a){function b(a){a.stopPropagation();a=Entry.Utils.convertMouseEvent(a); -a=Math.floor((a.clientX-80)/(5*d)*5);0>a||4a||(a=Math.min(4,a),a=Math.max(0,a),this.speedPanelOn&&(this.speedHandle_.style.left=(Entry.interfaceState.canvasWidth-80)/10*(2*a+1)+80-9+"px"),Entry.FPS!=b&&(clearInterval(this.ticker),this.ticker=setInterval(this.update,Math.floor(1E3/b)),Entry.FPS=b))};Entry.Engine.prototype.start=function(b){createjs.Ticker.setFPS(Entry.FPS);this.ticker=setInterval(this.update,Math.floor(1E3/Entry.FPS))}; -Entry.Engine.prototype.stop=function(){clearInterval(this.ticker);this.ticker=null};Entry.Engine.prototype.update=function(){Entry.engine.isState("run")&&(Entry.engine.computeObjects(),Entry.hw.update())};Entry.Engine.prototype.computeObjects=function(){Entry.container.mapObjectOnScene(this.computeFunction)};Entry.Engine.prototype.computeFunction=function(b){b.script.tick()}; -Entry.Engine.computeThread=function(b,a){Entry.engine.isContinue=!0;for(var c=!1;a&&Entry.engine.isContinue&&!c;){Entry.engine.isContinue=!a.isRepeat;var d=a.run(),c=d&&d===a;a=d}return a};Entry.Engine.prototype.isState=function(b){return-1c;c++)(function(c){var d=Entry.createElement("td","progressCell"+c);d.bindOnClick(function(){Entry.engine.setSpeedMeter(b[c])});a.appendChild(d)})(c);this.view_.insertBefore(this.speedProgress_,this.maximizeButton);this.speedProgress_.appendChild(a);this.speedHandle_=Entry.createElement("div","entrySpeedHandleWorkspace");var d=(Entry.interfaceState.canvasWidth-84)/5;$(this.speedHandle_).bind("mousedown.speedPanel touchstart.speedPanel",function(b){function a(b){b.stopPropagation();b=Entry.Utils.convertMouseEvent(b); +b=Math.floor((b.clientX-80)/(5*d)*5);0>b||4b||(b=Math.min(4,b),b=Math.max(0,b),this.speedPanelOn&&(this.speedHandle_.style.left=(Entry.interfaceState.canvasWidth-80)/10*(2*b+1)+80-9+"px"),Entry.FPS!=a&&(clearInterval(this.ticker),this.ticker=setInterval(this.update,Math.floor(1E3/a)),Entry.FPS=a))};Entry.Engine.prototype.start=function(a){createjs.Ticker.setFPS(Entry.FPS);this.ticker=setInterval(this.update,Math.floor(1E3/Entry.FPS))}; +Entry.Engine.prototype.stop=function(){clearInterval(this.ticker);this.ticker=null};Entry.Engine.prototype.update=function(){Entry.engine.isState("run")&&(Entry.engine.computeObjects(),Entry.hw.update())};Entry.Engine.prototype.computeObjects=function(){Entry.container.mapObjectOnScene(this.computeFunction)};Entry.Engine.prototype.computeFunction=function(a){a.script.tick()}; +Entry.Engine.computeThread=function(a,b){Entry.engine.isContinue=!0;for(a=!1;b&&Entry.engine.isContinue&&!a;){Entry.engine.isContinue=!b.isRepeat;var c=b.run();a=c&&c===b;b=c}return b};Entry.Engine.prototype.isState=function(a){return-1=a&&Entry.stage.moveSprite(b)}; -Entry.Engine.prototype.raiseKeyEvent=function(b,a){return b.parent.script.raiseEvent(a[0],b,String(a[1]))};Entry.Engine.prototype.updateMouseView=function(){var b=Entry.stage.mouseCoordinate;this.mouseView.textContent="X : "+b.x+", Y : "+b.y;this.mouseView.removeClass("entryRemove")};Entry.Engine.prototype.hideMouseView=function(){this.mouseView.addClass("entryRemove")}; -Entry.Engine.prototype.toggleFullscreen=function(){if(this.popup)this.popup.remove(),this.popup=null;else{this.popup=new Entry.Popup;if("workspace"!=Entry.type){var b=$(document);$(this.popup.body_).css("top",b.scrollTop());$("body").css("overflow","hidden");popup.window_.appendChild(Entry.stage.canvas.canvas);popup.window_.appendChild(Entry.engine.runButton[0])}popup.window_.appendChild(Entry.engine.view_)}Entry.windowResized.notify()}; +Entry.Engine.prototype.togglePause=function(){var a=Entry.engine.projectTimer;"pause"==this.state?(a.pausedTime+=(new Date).getTime()-a.pauseStart,a.isPaused?a.pauseStart=(new Date).getTime():delete a.pauseStart,this.state="run",this.pauseButton.innerHTML=Lang.Workspace.pause,this.runButton.addClass("entryRemove"),this.runButton2&&this.runButton2.addClass("entryRemove")):(this.state="pause",a.isPaused&&(a.pausedTime+=(new Date).getTime()-a.pauseStart),a.pauseStart=(new Date).getTime(),this.pauseButton.innerHTML= +Lang.Workspace.restart,this.runButton.removeClass("entryRemove"),this.stopButton.removeClass("entryRemove"),this.runButton2&&this.runButton2.removeClass("entryRemove"))};Entry.Engine.prototype.fireEvent=function(a){"run"==this.state&&Entry.container.mapEntityIncludeCloneOnScene(this.raiseEvent,a)};Entry.Engine.prototype.raiseEvent=function(a,b){a.parent.script.raiseEvent(b,a)}; +Entry.Engine.prototype.fireEventOnEntity=function(a,b){"run"==this.state&&Entry.container.mapEntityIncludeCloneOnScene(this.raiseEventOnEntity,[b,a])};Entry.Engine.prototype.raiseEventOnEntity=function(a,b){a===b[0]&&a.parent.script.raiseEvent(b[1],a)}; +Entry.Engine.prototype.captureKeyEvent=function(a){var b=a.keyCode,c=Entry.type;a.ctrlKey&&"workspace"==c?83==b?(a.preventDefault(),Entry.dispatchEvent("saveWorkspace")):82==b?(a.preventDefault(),Entry.engine.run()):90==b&&(a.preventDefault(),console.log("engine"),Entry.dispatchEvent(a.shiftKey?"redo":"undo")):Entry.engine.isState("run")&&Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent,["keyPress",b]);Entry.engine.isState("stop")&&"workspace"===c&&37<=b&&40>=b&&Entry.stage.moveSprite(a)}; +Entry.Engine.prototype.raiseKeyEvent=function(a,b){return a.parent.script.raiseEvent(b[0],a,String(b[1]))};Entry.Engine.prototype.updateMouseView=function(){var a=Entry.stage.mouseCoordinate;this.mouseView.textContent="X : "+a.x+", Y : "+a.y;this.mouseView.removeClass("entryRemove")};Entry.Engine.prototype.hideMouseView=function(){this.mouseView.addClass("entryRemove")}; +Entry.Engine.prototype.toggleFullscreen=function(){if(this.popup)this.popup.remove(),this.popup=null;else{this.popup=new Entry.Popup;if("workspace"!=Entry.type){var a=$(document);$(this.popup.body_).css("top",a.scrollTop());$("body").css("overflow","hidden");popup.window_.appendChild(Entry.stage.canvas.canvas);popup.window_.appendChild(Entry.engine.runButton[0])}popup.window_.appendChild(Entry.engine.view_)}Entry.windowResized.notify()}; Entry.Engine.prototype.exitFullScreen=function(){document.webkitIsFullScreen||document.mozIsFullScreen||document.isFullScreen||(Entry.engine.footerView_.removeClass("entryRemove"),Entry.engine.headerView_.removeClass("entryRemove"));Entry.windowResized.notify()};Entry.Engine.prototype.showProjectTimer=function(){Entry.engine.projectTimer&&this.projectTimer.setVisible(!0)}; -Entry.Engine.prototype.hideProjectTimer=function(){var b=this.projectTimer;if(b&&b.isVisible()&&!this.isState("run")){for(var a=Entry.container.getAllObjects(),c=["get_project_timer_value","reset_project_timer","set_visible_project_timer","choose_project_timer_action"],d=0,e=a.length;dthis.direction)==(0<=b&&180>b)||(this.setScaleX(-this.getScaleX()),Entry.stage.updateObject(),this.flip=!this.flip);this.direction=b.mod(360);this.object.direction=this.direction;this.isClone||this.parent.updateRotationView();Entry.dispatchEvent("updateObject");Entry.requestUpdate=!0}; -Entry.EntityObject.prototype.setRotation=function(b){"free"!=this.parent.getRotateMethod()&&(b=0);this.rotation=b.mod(360);this.object.rotation=this.rotation;this.updateDialog();this.isClone||this.parent.updateRotationView();Entry.dispatchEvent("updateObject");Entry.requestUpdate=!0};Entry.EntityObject.prototype.getRotation=function(){return this.rotation};Entry.EntityObject.prototype.setRegX=function(b){"textBox"==this.type&&(b=0);this.regX=b;this.object.regX=this.regX;Entry.requestUpdate=!0}; -Entry.EntityObject.prototype.getRegX=function(){return this.regX};Entry.EntityObject.prototype.setRegY=function(b){"textBox"==this.type&&(b=0);this.regY=b;this.object.regY=this.regY;Entry.requestUpdate=!0};Entry.EntityObject.prototype.getRegY=function(){return this.regY};Entry.EntityObject.prototype.setScaleX=function(b){this.scaleX=b;this.object.scaleX=this.scaleX;this.parent.updateCoordinateView();this.updateDialog();Entry.requestUpdate=!0};Entry.EntityObject.prototype.getScaleX=function(){return this.scaleX}; -Entry.EntityObject.prototype.setScaleY=function(b){this.scaleY=b;this.object.scaleY=this.scaleY;this.parent.updateCoordinateView();this.updateDialog();Entry.requestUpdate=!0};Entry.EntityObject.prototype.getScaleY=function(){return this.scaleY};Entry.EntityObject.prototype.setSize=function(b){1>b&&(b=1);b/=this.getSize();this.setScaleX(this.getScaleX()*b);this.setScaleY(this.getScaleY()*b);this.isClone||this.parent.updateCoordinateView();Entry.requestUpdate=!0}; -Entry.EntityObject.prototype.getSize=function(){return(this.getWidth()*Math.abs(this.getScaleX())+this.getHeight()*Math.abs(this.getScaleY()))/2};Entry.EntityObject.prototype.setWidth=function(b){this.width=b;this.object.width=this.width;this.textObject&&this.getLineBreak()&&(this.textObject.lineWidth=this.width);this.updateDialog();this.updateBG();Entry.requestUpdate=!0};Entry.EntityObject.prototype.getWidth=function(){return this.width}; -Entry.EntityObject.prototype.setHeight=function(b){this.height=b;this.textObject&&(this.object.height=this.height,this.alignTextBox());this.updateDialog();this.updateBG();Entry.requestUpdate=!0};Entry.EntityObject.prototype.getHeight=function(){return this.height};Entry.EntityObject.prototype.setColour=function(b){b||(b="#000000");this.colour=b;this.textObject&&(this.textObject.color=this.colour);Entry.requestUpdate=!0};Entry.EntityObject.prototype.getColour=function(){return this.colour}; -Entry.EntityObject.prototype.setBGColour=function(b){b||(b="transparent");this.bgColor=b;this.updateBG();Entry.requestUpdate=!0};Entry.EntityObject.prototype.getBGColour=function(){return this.bgColor};Entry.EntityObject.prototype.setUnderLine=function(b){void 0===b&&(b=!1);this.underLine=b;this.textObject.underLine=b;Entry.requestUpdate=!0};Entry.EntityObject.prototype.getUnderLine=function(){return this.underLine}; -Entry.EntityObject.prototype.setStrike=function(b){void 0===b&&(b=!1);this.strike=b;this.textObject.strike=b;Entry.requestUpdate=!0};Entry.EntityObject.prototype.getStrike=function(){return this.strike};Entry.EntityObject.prototype.getFont=function(){var b=[];this.fontBold&&b.push("bold");this.fontItalic&&b.push("italic");b.push(this.getFontSize()+"px");b.push(this.fontType);return b.join(" ")}; -Entry.EntityObject.prototype.setFont=function(b){if("textBox"==this.parent.objectType&&this.font!==b){b||(b="20px Nanum Gothic");var a=b.split(" "),c=0;if(c=-1this.direction)==(0<=a&&180>a)||(this.setScaleX(-this.getScaleX()),Entry.stage.updateObject(),this.flip=!this.flip);this.direction=a.mod(360);this.object.direction=this.direction;this.isClone||this.parent.updateRotationView();Entry.dispatchEvent("updateObject");Entry.requestUpdate=!0}; +Entry.EntityObject.prototype.setRotation=function(a){"free"!=this.parent.getRotateMethod()&&(a=0);this.rotation=a.mod(360);this.object.rotation=this.rotation;this.updateDialog();this.isClone||this.parent.updateRotationView();Entry.dispatchEvent("updateObject");Entry.requestUpdate=!0};Entry.EntityObject.prototype.getRotation=function(){return this.rotation};Entry.EntityObject.prototype.setRegX=function(a){"textBox"==this.type&&(a=0);this.regX=a;this.object.regX=this.regX;Entry.requestUpdate=!0}; +Entry.EntityObject.prototype.getRegX=function(){return this.regX};Entry.EntityObject.prototype.setRegY=function(a){"textBox"==this.type&&(a=0);this.regY=a;this.object.regY=this.regY;Entry.requestUpdate=!0};Entry.EntityObject.prototype.getRegY=function(){return this.regY};Entry.EntityObject.prototype.setScaleX=function(a){this.scaleX=a;this.object.scaleX=this.scaleX;this.parent.updateCoordinateView();this.updateDialog();Entry.requestUpdate=!0};Entry.EntityObject.prototype.getScaleX=function(){return this.scaleX}; +Entry.EntityObject.prototype.setScaleY=function(a){this.scaleY=a;this.object.scaleY=this.scaleY;this.parent.updateCoordinateView();this.updateDialog();Entry.requestUpdate=!0};Entry.EntityObject.prototype.getScaleY=function(){return this.scaleY};Entry.EntityObject.prototype.setSize=function(a){1>a&&(a=1);a/=this.getSize();this.setScaleX(this.getScaleX()*a);this.setScaleY(this.getScaleY()*a);this.isClone||this.parent.updateCoordinateView();Entry.requestUpdate=!0}; +Entry.EntityObject.prototype.getSize=function(){return(this.getWidth()*Math.abs(this.getScaleX())+this.getHeight()*Math.abs(this.getScaleY()))/2};Entry.EntityObject.prototype.setWidth=function(a){this.width=a;this.object.width=this.width;this.textObject&&this.getLineBreak()&&(this.textObject.lineWidth=this.width);this.updateDialog();this.updateBG();Entry.requestUpdate=!0};Entry.EntityObject.prototype.getWidth=function(){return this.width}; +Entry.EntityObject.prototype.setHeight=function(a){this.height=a;this.textObject&&(this.object.height=this.height,this.alignTextBox());this.updateDialog();this.updateBG();Entry.requestUpdate=!0};Entry.EntityObject.prototype.getHeight=function(){return this.height};Entry.EntityObject.prototype.setColour=function(a){a||(a="#000000");this.colour=a;this.textObject&&(this.textObject.color=this.colour);Entry.requestUpdate=!0};Entry.EntityObject.prototype.getColour=function(){return this.colour}; +Entry.EntityObject.prototype.setBGColour=function(a){a||(a="transparent");this.bgColor=a;this.updateBG();Entry.requestUpdate=!0};Entry.EntityObject.prototype.getBGColour=function(){return this.bgColor};Entry.EntityObject.prototype.setUnderLine=function(a){void 0===a&&(a=!1);this.underLine=a;this.textObject.underLine=a;Entry.requestUpdate=!0};Entry.EntityObject.prototype.getUnderLine=function(){return this.underLine}; +Entry.EntityObject.prototype.setStrike=function(a){void 0===a&&(a=!1);this.strike=a;this.textObject.strike=a;Entry.requestUpdate=!0};Entry.EntityObject.prototype.getStrike=function(){return this.strike};Entry.EntityObject.prototype.getFont=function(){var a=[];this.fontBold&&a.push("bold");this.fontItalic&&a.push("italic");a.push(this.getFontSize()+"px");a.push(this.fontType);return a.join(" ")}; +Entry.EntityObject.prototype.setFont=function(a){if("textBox"==this.parent.objectType&&this.font!==a){a||(a="20px Nanum Gothic");var b=a.split(" "),c;if(c=-1=m?k=[1,0,0,0,0,0,n,l,0,0,0,-1*l,n,0,0,0,0,0,1,0,0,0,0,0,1]:.66>=m?k=[n,0,l,0,0,0,1,0,0,0,l,0,n,0,0,0,0,0,1,0,0,0,0,0,1]:.99>=m&&(k=[n,l,0,0,0,-1*l,n,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1]);k=(new createjs.ColorMatrix).concat(k);k=new createjs.ColorMatrixFilter(k);c.push(k);b.alpha=a.alpha=d(a.alpha,0,1);b.filters=c})(c,d),d.cache(0, +Entry.EntityObject.prototype.applyFilter=function(a){function b(b,a){for(var c in b)if(b[c]!==a[c])return!1;return!0}var c=this.effect,d=this.object;if(a||!b(c,this.getInitialEffectValue()))(function(b,a){var c=[],d=Entry.adjustValueWithMaxMin;b.brightness=b.brightness;var k=new createjs.ColorMatrix;k.adjustColor(d(b.brightness,-100,100),0,0,0);k=new createjs.ColorMatrixFilter(k);c.push(k);b.hue=b.hue.mod(360);k=new createjs.ColorMatrix;k.adjustColor(0,0,0,b.hue);k=new createjs.ColorMatrixFilter(k); +c.push(k);var k=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1],l=10.8*b.hsv*Math.PI/180,n=Math.cos(l),l=Math.sin(l),m=Math.abs(b.hsv/100);1=m?k=[1,0,0,0,0,0,n,l,0,0,0,-1*l,n,0,0,0,0,0,1,0,0,0,0,0,1]:.66>=m?k=[n,0,l,0,0,0,1,0,0,0,l,0,n,0,0,0,0,0,1,0,0,0,0,0,1]:.99>=m&&(k=[n,l,0,0,0,-1*l,n,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1]);k=(new createjs.ColorMatrix).concat(k);k=new createjs.ColorMatrixFilter(k);c.push(k);a.alpha=b.alpha=d(b.alpha,0,1);a.filters=c})(c,d),d.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.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.removeClone=function(){if(this.isClone){this.dialog&&this.dialog.remove();this.brush&&this.removeBrush();Entry.stage.unloadEntity(this);var a=this.parent.clonedEntities.indexOf(this);this.parent.clonedEntities.splice(a,1);Entry.Utils.isFunction(this.clearExecutor)&&this.clearExecutor()}};Entry.EntityObject.prototype.clearExecutor=function(){this.parent.script.clearExecutorsByEntity(this)}; +Entry.EntityObject.prototype.toJSON=function(){var a={};a.x=Entry.cutDecimal(this.getX());a.y=Entry.cutDecimal(this.getY());a.regX=Entry.cutDecimal(this.getRegX());a.regY=Entry.cutDecimal(this.getRegY());a.scaleX=this.getScaleX();a.scaleY=this.getScaleY();a.rotation=Entry.cutDecimal(this.getRotation());a.direction=Entry.cutDecimal(this.getDirection());a.width=Entry.cutDecimal(this.getWidth());a.height=Entry.cutDecimal(this.getHeight());a.font=this.getFont();a.visible=this.getVisible();"textBox"== +this.parent.objectType&&(a.colour=this.getColour(),a.text=this.getText(),a.textAlign=this.getTextAlign(),a.lineBreak=this.getLineBreak(),a.bgColor=this.getBGColour(),a.underLine=this.getUnderLine(),a.strike=this.getStrike(),a.fontSize=this.getFontSize());return a};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}; -Entry.EntityObject.prototype.updateBG=function(){if(this.bgObject){this.bgObject.graphics.clear();var b=this.getWidth(),a=this.getHeight();this.bgObject.graphics.setStrokeStyle(1).beginStroke().beginFill(this.getBGColour()).drawRect(-b/2,-a/2,b,a);if(this.getLineBreak())this.bgObject.x=0;else switch(this.getTextAlign()){case Entry.TEXT_ALIGN_LEFT:this.bgObject.x=b/2;break;case Entry.TEXT_ALIGN_CENTER:this.bgObject.x=0;break;case Entry.TEXT_ALIGN_RIGHT:this.bgObject.x=-b/2}}}; -Entry.EntityObject.prototype.alignTextBox=function(){if("textBox"==this.type){var b=this.textObject;if(this.lineBreak){var a=b.getMeasuredLineHeight();b.y=a/2-this.getHeight()/2;switch(this.textAlign){case Entry.TEXT_ALIGN_CENTER:b.x=0;break;case Entry.TEXT_ALIGN_LEFT:b.x=-this.getWidth()/2;break;case Entry.TEXT_ALIGN_RIGHT:b.x=this.getWidth()/2}b.maxHeight=this.getHeight()}else b.x=0,b.y=0}};Entry.EntityObject.prototype.syncDialogVisible=function(){this.dialog&&(this.dialog.object.visible=this.visible)};Entry.Helper=function(){this.visible=!1};p=Entry.Helper.prototype; -p.generateView=function(b,a){if(!this.parentView_){this.parentView_=b;this.blockHelpData=EntryStatic.blockInfo;var c=Entry.createElement("div","entryBlockHelperWorkspace");this.view=c;Entry.isForLecture&&c.addClass("lecture");this.parentView_.appendChild(c);var d=Entry.createElement("div","entryBlockHelperContentWorkspace");d.addClass("entryBlockHelperIntro");Entry.isForLecture&&d.addClass("lecture");c.appendChild(d);this.blockHelperContent_=d;this.blockHelperView_=c;c=Entry.createElement("div","entryBlockHelperBlockWorkspace"); -this.blockHelperContent_.appendChild(c);d=Entry.createElement("div","entryBlockHelperDescriptionWorkspace");this.blockHelperContent_.appendChild(d);d.innerHTML=Lang.Helper.Block_click_msg;this.blockHelperDescription_=d;this._renderView=new Entry.RenderView($(c),"LEFT");this.code=new Entry.Code([]);this._renderView.changeCode(this.code);this.first=!0}}; -p.bindWorkspace=function(b){b&&(this._blockViewObserver&&this._blockViewObserver.destroy(),this.workspace=b,this._blockViewObserver=b.observe(this,"_updateSelectedBlock",["selectedBlockView"]))};p._updateSelectedBlock=function(){var b=this.workspace.selectedBlockView;if(b&&this.visible&&b!=this._blockView){var a=b.block.type;this._blockView=b;this.renderBlock(a)}}; -p.renderBlock=function(b){var a=Lang.Helper[b];if(b&&this.visible&&a&&!Entry.block[b].isPrimitive){this.first&&(this.blockHelperContent_.removeClass("entryBlockHelperIntro"),this.first=!1);this.code.clear();var c=Entry.block[b].def,c=c||{type:b};this.code.createThread([c]);this.code.board.align();this.code.board.resize();var c=this.code.getThreads()[0].getFirstBlock().view,d=c.svgGroup.getBBox();b=d.width;d=d.height;c=c.getSkeleton().box(c).offsetX;isNaN(c)&&(c=0);this.blockHelperDescription_.innerHTML= -a;this._renderView.align();$(this.blockHelperDescription_).css({top:d+30});this._renderView.svgDom.css({"margin-left":-(b/2)-20-c})}};p.getView=function(){return this.view};p.resize=function(){};Entry.Activity=function(b,a){this.name=b;this.timestamp=new Date;var c=[];if(void 0!==a)for(var d=0,e=a.length;d"+a.block+"").childNodes[0]};Entry.Func.prototype.destroy=function(){this.blockMenuBlock.destroy()}; +Entry.Func.edit=function(a){this.cancelEdit();this.targetFunc=a;this.initEditView(a.content);this.bindFuncChangeEvent();this.updateMenu()};Entry.Func.initEditView=function(a){this.menuCode||this.setupMenuCode();var b=Entry.playground.mainWorkspace;b.setMode(Entry.Workspace.MODE_OVERLAYBOARD);b.changeOverlayBoardCode(a);this._workspaceStateEvent=b.changeEvent.attach(this,this.endEdit)}; +Entry.Func.endEdit=function(a){this.unbindFuncChangeEvent();this._workspaceStateEvent.destroy();delete this._workspaceStateEvent;switch(a){case "save":this.save();case "cancelEdit":this.cancelEdit()}};Entry.Func.save=function(){this.targetFunc.generateBlock(!0);Entry.variableContainer.saveFunction(this.targetFunc)}; +Entry.Func.syncFuncName=function(a){var b=0;a=a.split(" ");var c="",d;d=Blockly.mainWorkspace.getAllBlocks();for(var e=0;eBlockly.Block.dragMode_&&(a.updateMenu(),a.fieldText=b,a.workspaceLength=c)}}; +Entry.Func.setupMenuCode=function(){var a=Entry.playground.mainWorkspace;a&&(a=a.getBlockMenu().getCategoryCodes("func"),this._fieldLabel=a.createThread([{type:"function_field_label"}]).getFirstBlock(),this._fieldString=a.createThread([{type:"function_field_string",params:[{type:this.requestParamBlock("string")}]}]).getFirstBlock(),this._fieldBoolean=a.createThread([{type:"function_field_boolean",params:[{type:this.requestParamBlock("boolean")}]}]).getFirstBlock(),this.menuCode=a)}; +Entry.Func.refreshMenuCode=function(){if(Entry.playground.mainWorkspace){this.menuCode||this.setupMenuCode();var a=Entry.block[this._fieldString.params[0].type].changeEvent._listeners.length;2'));this._hwModule=a;var b=this;Entry.addEventListener("windowResized",function(){var a=b._hwModule.monitorTemplate.mode;"both"==a&&(b.resize(),b.resizeList());"list"==a?b.resizeList():b.resize()});Entry.addEventListener("hwModeChange",function(){b.changeMode()});this.changeOffset=0;this.scale=.5;this._listPortViews={}}; +(function(a){a.initView=function(){this.svgDom=Entry.Dom($(''))};a.generateView=function(){this.snap=Entry.SVG("hwMonitor");this._svgGroup=this.snap.elem("g");this._portMap={n:[],e:[],s:[],w:[]};var b=this._hwModule.monitorTemplate,a={href:Entry.mediaFilePath+b.imgPath,x:-b.width/2,y:-b.height/2,width:b.width,height:b.height};this._portViews={};this.hwView=this._svgGroup.elem("image");this.hwView= +this.hwView.attr(a);this._template=b;b=b.ports;this.pathGroup=null;this.pathGroup=this._svgGroup.elem("g");var a=[],d;for(d in b){var e=this.generatePortView(b[d],"_svgGroup");this._portViews[d]=e;a.push(e)}a.sort(function(b,a){return b.box.x-a.box.x});var f=this._portMap;a.map(function(b){(1>(Math.atan2(-b.box.y,b.box.x)/Math.PI+2)%2?f.n:f.s).push(b)});this.resize()};a.toggleMode=function(b){var a=this._hwModule.monitorTemplate;"list"==b?(a.TempPort=null,this._hwModule.monitorTemplate.ports&&(this._hwModule.monitorTemplate.TempPort= +this._hwModule.monitorTemplate.ports,this._hwModule.monitorTemplate.listPorts=this.addPortEle(this._hwModule.monitorTemplate.listPorts,this._hwModule.monitorTemplate.ports)),$(this._svglistGroup).remove(),this._svgGroup&&$(this._svgGroup).remove(),$(this._pathGroup).remove(),this._hwModule.monitorTemplate.mode="list",this.generateListView()):(this._hwModule.monitorTemplate.TempPort&&(this._hwModule.monitorTemplate.ports=this._hwModule.monitorTemplate.TempPort,this._hwModule.monitorTemplate.listPorts= +this.removePortEle(this._hwModule.monitorTemplate.listPorts,this._hwModule.monitorTemplate.ports)),$(this._svglistGroup).remove(),this._hwModule.monitorTemplate.mode="both",this.generateListView(),this.generateView())};a.setHwmonitor=function(b){this._hwmodule=b};a.changeMode=function(b){"both"==this._hwModule.monitorTemplate.mode?this.toggleMode("list"):"list"==this._hwModule.monitorTemplate.mode&&this.toggleMode("both")};a.addPortEle=function(b,a){if("object"!=typeof a)return b;for(var d in a)b[d]= +a[d];return b};a.removePortEle=function(b,a){if("object"!=typeof a)return b;for(var d in a)delete b[d];return b};a.generateListView=function(){this._portMapList={n:[]};this._svglistGroup=null;this.listsnap=Entry.SVG("hwMonitor");this._svglistGroup=this.listsnap.elem("g");var b=this._hwModule.monitorTemplate;this._template=b;b=b.listPorts;this.pathGroup=this._svglistGroup.elem("g");var a=[],d;for(d in b){var e=this.generatePortView(b[d],"_svglistGroup");this._listPortViews[d]=e;a.push(e)}var f=this._portMapList; +a.map(function(b){f.n.push(b)});this.resizeList()};a.generatePortView=function(b,a){a=this[a].elem("g");a.addClass("hwComponent");var d;d=this.pathGroup.elem("path").attr({d:"m0,0",fill:"none",stroke:"input"===b.type?"#00979d":"#A751E3","stroke-width":3});var e=a.elem("rect").attr({x:0,y:0,width:150,height:22,rx:4,ry:4,fill:"#fff",stroke:"#a0a1a1"}),f=a.elem("text").attr({x:4,y:12,fill:"#000","class":"hwComponentName","alignment-baseline":"central"});f.textContent=b.name;f=f.getComputedTextLength(); +a.elem("rect").attr({x:f+8,y:2,width:30,height:18,rx:9,ry:9,fill:"input"===b.type?"#00979d":"#A751E3"});var g=a.elem("text").attr({x:f+13,y:12,fill:"#fff","class":"hwComponentValue","alignment-baseline":"central"});g.textContent=0;f+=40;e.attr({width:f});return{group:a,value:g,type:b.type,path:d,box:{x:b.pos.x-this._template.width/2,y:b.pos.y-this._template.height/2,width:f},width:f}};a.getView=function(){return this.svgDom};a.update=function(){var b=Entry.hw.portData,a=Entry.hw.sendQueue,d=this._hwModule.monitorTemplate.mode, +e=this._hwModule.monitorTemplate.keys||[],f=[];if("list"==d)f=this._listPortViews;else if("both"==d){if(f=this._listPortViews,this._portViews)for(var g in this._portViews)f[g]=this._portViews[g]}else f=this._portViews;if(a)for(g in a)0!=a[g]&&f[g]&&(f[g].type="output");for(var h in f)if(d=f[h],"input"==d.type){var k=b[h];0=this._template.height||0>=b.height||(this.scale=b.height/this._template.height* +this._template.height/1E3,this.align())};a.resizeList=function(){var b=this.svgDom.get(0).getBoundingClientRect();this._svglistGroup.attr({transform:"translate("+b.width/2+","+b.height/2+")"});this._rect=b;this.alignList()};a.align=function(){var b;b=this._portMap.s.concat();this._alignNS(b,this.scale/3*this._template.height+5,27);b=this._portMap.n.concat();this._alignNS(b,-this._template.height*this.scale/3-32,-27);b=this._portMap.e.concat();this._alignEW(b,-this._template.width*this.scale/3-5,-27); +b=this._portMap.w.concat();this._alignEW(b,this._template.width*this.scale/3-32,-27)};a.alignList=function(){var b;b=this._hwModule.monitorTemplate.listPorts;for(var a=b.length,d=0;da-(k.width+l.width/2.2)&&(e+=1,initX=g,f=0)};a._movePort=function(b,a,d,e){var f=a,g=b.box.x*this.scale,h=b.box.y*this.scale; +a>e?(f=a-b.width,a=a>g&&g>e?"M"+g+","+d+"L"+g+","+h:"M"+(a+e)/2+","+d+"l0,"+(h>d?28:-3)+"H"+g+"L"+g+","+h):a=ad?28:-3)+"H"+g+"L"+g+","+h;b.group.attr({transform:"translate("+f+","+d+")"});b.path.attr({d:a})}})(Entry.HWMonitor.prototype);Entry.HW=function(){this.connectTrial=0;this.isFirstConnect=!0;this.initSocket();this.connected=!1;this.portData={};this.sendQueue={};this.outputQueue={};this.settingQueue={};this.socketType=this.hwModule=this.selectedDevice=null;Entry.addEventListener("stop",this.setZero);this.hwInfo={"1.1":Entry.Arduino,"1.9":Entry.ArduinoExt,"1.2":Entry.SensorBoard,"1.3":Entry.CODEino,"1.4":Entry.joystick,"1.5":Entry.dplay,"1.6":Entry.nemoino,"1.7":Entry.Xbot,"1.8":Entry.ardublock,"2.4":Entry.Hamster,"2.5":Entry.Albert, +"3.1":Entry.Bitbrick,"4.2":Entry.Arduino,"5.1":Entry.Neobot,"7.1":Entry.Robotis_carCont,"7.2":Entry.Robotis_openCM70,"8.1":Entry.Arduino}};Entry.HW.TRIAL_LIMIT=1;p=Entry.HW.prototype; +p.initSocket=function(){try{if(this.connectTrial>=Entry.HW.TRIAL_LIMIT)this.isFirstConnect||Entry.toast.alert(Lang.Menus.connect_hw,Lang.Menus.connect_fail,!1),this.isFirstConnect=!1;else{var a=this,b,c;this.connected=!1;this.connectTrial++;if(-1"+Lang.Menus[b]+"",{classes:["propertyTabElement","propertyTab"+b],parent:this._tabView}),f=this;e.bind("click",function(){f.select(b)});this.modes[b]&&(this.modes[b].tabDom.remove(),this.modes[b].contentDom.remove(),"hw"==b&&($(this.modes).removeClass(".propertyTabhw"),$(".propertyTabhw").unbind("dblclick")));this.modes[b]={obj:a,tabDom:e,contentDom:d};"hw"==b&&$(".propertyTabhw").bind("dblclick",function(){Entry.dispatchEvent("hwModeChange")})}; +a.resize=function(b){this._view.css({width:b+"px",top:9*b/16+123-22+"px"});430<=b?this._view.removeClass("collapsed"):this._view.addClass("collapsed");Entry.dispatchEvent("windowResized");b=this.selected;"hw"==b?this.modes.hw.obj.listPorts?this.modes[b].obj.resizeList():this.modes[b].obj.resize():this.modes[b].obj.resize()};a.select=function(b){for(var a in this.modes){var d=this.modes[a];d.tabDom.removeClass("selected");d.contentDom.addClass("entryRemove");d.obj.visible=!1}a=this.modes[b];a.tabDom.addClass("selected"); +a.contentDom.removeClass("entryRemove");a.obj.resize&&a.obj.resize();a.obj.visible=!0;this.selected=b};a.initializeSplitter=function(b){var a=this;b.bind("mousedown touchstart",function(b){a._cover.removeClass("entryRemove");Entry.container.disableSort();Entry.container.splitterEnable=!0;Entry.documentMousemove&&(Entry.container.resizeEvent=Entry.documentMousemove.attach(this,function(b){Entry.container.splitterEnable&&Entry.resizeElement({canvasWidth:b.clientX||b.x})}))});$(document).bind("mouseup touchend", +function(b){if(b=Entry.container.resizeEvent)Entry.container.splitterEnable=!1,Entry.documentMousemove.detach(b),a._cover.addClass("entryRemove"),delete Entry.container.resizeEvent;Entry.container.enableSort()})}})(Entry.PropertyPanel.prototype);Entry.init=function(a,b){Entry.assert("object"===typeof b,"Init option is not object");this.events_={};this.interfaceState={menuWidth:264};Entry.Utils.bindGlobalEvent("resize mousedown mousemove keydown keyup dispose".split(" "));this.options=b;this.parseOptions(b);this.mediaFilePath=(b.libDir?b.libDir:"/lib")+"/entryjs/images/";this.defaultPath=b.defaultDir||"";this.blockInjectPath=b.blockInjectDir||"";"workspace"==this.type&&this.isPhone()&&(this.type="phone");this.initialize_();this.view_=a;"tablet"=== +this.device?this.view_.setAttribute("class","entry tablet"):this.view_.setAttribute("class","entry");Entry.initFonts(b.fonts);this.createDom(a,this.type);this.loadInterfaceState();this.overridePrototype();this.maxCloneLimit=302;this.cloudSavable=!0;this.startTime=(new Date).getTime();document.onkeydown=function(b){Entry.dispatchEvent("keyPressed",b)};document.onkeyup=function(b){Entry.dispatchEvent("keyUpped",b)};window.onresize=function(b){Entry.dispatchEvent("windowResized",b)};window.onbeforeunload= +this.beforeUnload;Entry.addEventListener("saveWorkspace",function(b){Entry.addActivity("save")});"IE"!=Entry.getBrowserType().substr(0,2)||window.flashaudio?createjs.Sound.registerPlugins([createjs.WebAudioPlugin]):(createjs.FlashAudioPlugin.swfPath=this.mediaFilePath+"media/",createjs.Sound.registerPlugins([createjs.FlashAudioPlugin]),window.flashaudio=!0);Entry.soundQueue=new createjs.LoadQueue;Entry.soundQueue.installPlugin(createjs.Sound);Entry.loadAudio_([Entry.mediaFilePath+"sounds/click.mp3", +Entry.mediaFilePath+"sounds/click.wav",Entry.mediaFilePath+"sounds/click.ogg"],"entryMagneting");Entry.loadAudio_([Entry.mediaFilePath+"sounds/delete.mp3",Entry.mediaFilePath+"sounds/delete.ogg",Entry.mediaFilePath+"sounds/delete.wav"],"entryDelete");createjs.Sound.stop()};Entry.loadAudio_=function(a,b){if(window.Audio&&a.length)for(;0this.pictures.length)return!1;b=this.getPicture(b);var a=this.pictures.indexOf(b);Entry.stateManager&&Entry.stateManager.addCommand("remove sprite",this,this.addPicture,b,a);this.pictures.splice(a,1);b===this.selectedPicture&&Entry.playground.selectPicture(this.pictures[0]);Entry.playground.injectPicture(this);Entry.playground.reloadPlayground();return new Entry.State(this,this.addPicture,b,a)}; -Entry.EntryObject.prototype.getPicture=function(b){if(!b)return this.selectedPicture;b=b.trim();for(var a=this.pictures,c=a.length,d=0;d=b&&0Entry.maxCloneLimit||(b=new Entry.EntityObject(this),a?(b.injectModel(a.picture?a.picture:null,a.toJSON()),b.snapshot_=a.snapshot_,a.effect&&(b.effect=Entry.cloneSimpleObject(a.effect),b.applyFilter()),a.brush&&Entry.setCloneBrush(b,a.brush)):(b.injectModel(this.entity.picture?this.entity.picture:null,this.entity.toJSON(b)),b.snapshot_=this.entity.snapshot_,this.entity.effect&&(b.effect=Entry.cloneSimpleObject(this.entity.effect), -b.applyFilter()),this.entity.brush&&Entry.setCloneBrush(b,this.entity.brush)),Entry.engine.raiseEventOnEntity(b,[b,"when_clone_start"]),b.isClone=!0,b.isStarted=!0,this.addCloneVariables(this,b,a?a.variables:null,a?a.lists:null),this.clonedEntities.push(b),Entry.stage.loadEntity(b))}; -Entry.EntryObject.prototype.initializeSplitter=function(b){b.onmousedown=function(a){Entry.container.disableSort();Entry.container.splitterEnable=!0};document.addEventListener("mousemove",function(a){Entry.container.splitterEnable&&Entry.resizeElement({canvasWidth:a.x||a.clientX})});document.addEventListener("mouseup",function(a){Entry.container.splitterEnable=!1;Entry.container.enableSort()})};Entry.EntryObject.prototype.isSelected=function(){return this.isSelected_}; -Entry.EntryObject.prototype.toJSON=function(){var b={};b.id=this.id;b.name=this.name;"textBox"==this.objectType&&(b.text=this.text);b.script=this.getScriptText();"sprite"==this.objectType&&(b.selectedPictureId=this.selectedPicture.id);b.objectType=this.objectType;b.rotateMethod=this.getRotateMethod();b.scene=this.scene.id;b.sprite={pictures:Entry.getPicturesJSON(this.pictures),sounds:Entry.getSoundsJSON(this.sounds)};b.lock=this.lock;b.entity=this.entity.toJSON();return b}; -Entry.EntryObject.prototype.destroy=function(){Entry.stage.unloadEntity(this.entity);this.view_&&Entry.removeElement(this.view_)};Entry.EntryObject.prototype.getSound=function(b){b=b.trim();for(var a=this.sounds,c=a.length,d=0;d=b&&0this.pictures.length)return!1;a=this.getPicture(a);var b=this.pictures.indexOf(a);Entry.stateManager&&Entry.stateManager.addCommand("remove sprite",this,this.addPicture,a,b);this.pictures.splice(b,1);a===this.selectedPicture&&Entry.playground.selectPicture(this.pictures[0]);Entry.playground.injectPicture(this);Entry.playground.reloadPlayground();return new Entry.State(this,this.addPicture,a,b)}; +Entry.EntryObject.prototype.getPicture=function(a){if(!a)return this.selectedPicture;a=a.trim();for(var b=this.pictures,c=b.length,d=0;d=a&&0Entry.maxCloneLimit||(a=new Entry.EntityObject(this),b?(a.injectModel(b.picture?b.picture:null,b.toJSON()),a.snapshot_=b.snapshot_,b.effect&&(a.effect=Entry.cloneSimpleObject(b.effect),a.applyFilter()),b.brush&&Entry.setCloneBrush(a,b.brush)):(a.injectModel(this.entity.picture?this.entity.picture:null,this.entity.toJSON(a)),a.snapshot_=this.entity.snapshot_,this.entity.effect&&(a.effect=Entry.cloneSimpleObject(this.entity.effect), +a.applyFilter()),this.entity.brush&&Entry.setCloneBrush(a,this.entity.brush)),Entry.engine.raiseEventOnEntity(a,[a,"when_clone_start"]),a.isClone=!0,a.isStarted=!0,this.addCloneVariables(this,a,b?b.variables:null,b?b.lists:null),this.clonedEntities.push(a),Entry.stage.loadEntity(a))}; +Entry.EntryObject.prototype.initializeSplitter=function(a){a.onmousedown=function(b){Entry.container.disableSort();Entry.container.splitterEnable=!0};document.addEventListener("mousemove",function(b){Entry.container.splitterEnable&&Entry.resizeElement({canvasWidth:b.x||b.clientX})});document.addEventListener("mouseup",function(b){Entry.container.splitterEnable=!1;Entry.container.enableSort()})};Entry.EntryObject.prototype.isSelected=function(){return this.isSelected_}; +Entry.EntryObject.prototype.toJSON=function(){var a={};a.id=this.id;a.name=this.name;"textBox"==this.objectType&&(a.text=this.text);a.script=this.getScriptText();"sprite"==this.objectType&&(a.selectedPictureId=this.selectedPicture.id);a.objectType=this.objectType;a.rotateMethod=this.getRotateMethod();a.scene=this.scene.id;a.sprite={pictures:Entry.getPicturesJSON(this.pictures),sounds:Entry.getSoundsJSON(this.sounds)};a.lock=this.lock;a.entity=this.entity.toJSON();return a}; +Entry.EntryObject.prototype.destroy=function(){Entry.stage.unloadEntity(this.entity);this.view_&&Entry.removeElement(this.view_)};Entry.EntryObject.prototype.getSound=function(a){a=a.trim();for(var b=this.sounds,c=b.length,d=0;d=a&&0=a-e/100*a&&f<=a+e/100*a&&g>=c-e/100*c&&g<=c+e/100*c&&b>=d-e/100*d&&b<=d+e/100*d};Entry.Painter.prototype.matchColorOnly=function(b,a,c,d){return a===this.colorLayerData.data[b]&&c===this.colorLayerData.data[b+1]&&d===this.colorLayerData.data[b+2]?!0:!1}; -Entry.Painter.prototype.matchColor=function(b,a,c,d,e){return a===this.colorLayerData.data[b]&&c===this.colorLayerData.data[b+1]&&d===this.colorLayerData.data[b+2]&&e===this.colorLayerData.data[b+3]?!0:!1};Entry.Painter.prototype.colorPixel=function(b,a,c,d,e){e||(e=255);this.stroke.transparent&&(e=d=c=a=0);this.colorLayerData.data[b]=a;this.colorLayerData.data[b+1]=c;this.colorLayerData.data[b+2]=d;this.colorLayerData.data[b+3]=e}; -Entry.Painter.prototype.pickStrokeColor=function(b){b=4*(Math.round(b.stageY)*this.canvas.width+Math.round(b.stageX));this.stroke.lineColor=Entry.rgb2hex(this.colorLayerData.data[b],this.colorLayerData.data[b+1],this.colorLayerData.data[b+2]);document.getElementById("entryPainterAttrCircle").style.backgroundColor=this.stroke.lineColor;document.getElementById("entryPainterAttrCircleInput").value=this.stroke.lineColor}; -Entry.Painter.prototype.drawText=function(b){var a=document.getElementById("entryPainterAttrFontStyle").value,c=document.getElementById("entryPainterAttrFontName").value,d=document.getElementById("entryPainterAttrFontSize").value;b=new createjs.Text(b,a+" "+d+'px "'+c+'"',this.stroke.lineColor);b.textBaseline="top";b.x=this.oldPt.x;b.y=this.oldPt.y;this.objectContainer.addChild(b);this.selectTextObject(b);this.file.modified=!0}; -Entry.Painter.prototype.addImage=function(b){var a=new createjs.Bitmap(b);this.objectContainer.addChild(a);a.x=this.stage.canvas.width/2;a.y=this.stage.canvas.height/2;a.regX=a.image.width/2|0;a.regY=a.image.height/2|0;if(540=b-e/100*b&&f<=b+e/100*b&&g>=c-e/100*c&&g<=c+e/100*c&&a>=d-e/100*d&&a<=d+e/100*d};Entry.Painter.prototype.matchColorOnly=function(a,b,c,d){return b===this.colorLayerData.data[a]&&c===this.colorLayerData.data[a+1]&&d===this.colorLayerData.data[a+2]?!0:!1}; +Entry.Painter.prototype.matchColor=function(a,b,c,d,e){return b===this.colorLayerData.data[a]&&c===this.colorLayerData.data[a+1]&&d===this.colorLayerData.data[a+2]&&e===this.colorLayerData.data[a+3]?!0:!1};Entry.Painter.prototype.colorPixel=function(a,b,c,d,e){e||(e=255);this.stroke.transparent&&(e=d=c=b=0);this.colorLayerData.data[a]=b;this.colorLayerData.data[a+1]=c;this.colorLayerData.data[a+2]=d;this.colorLayerData.data[a+3]=e}; +Entry.Painter.prototype.pickStrokeColor=function(a){a=4*(Math.round(a.stageY)*this.canvas.width+Math.round(a.stageX));this.stroke.lineColor=Entry.rgb2hex(this.colorLayerData.data[a],this.colorLayerData.data[a+1],this.colorLayerData.data[a+2]);document.getElementById("entryPainterAttrCircle").style.backgroundColor=this.stroke.lineColor;document.getElementById("entryPainterAttrCircleInput").value=this.stroke.lineColor}; +Entry.Painter.prototype.drawText=function(a){var b=document.getElementById("entryPainterAttrFontStyle").value,c=document.getElementById("entryPainterAttrFontName").value,d=document.getElementById("entryPainterAttrFontSize").value;a=new createjs.Text(a,b+" "+d+'px "'+c+'"',this.stroke.lineColor);a.textBaseline="top";a.x=this.oldPt.x;a.y=this.oldPt.y;this.objectContainer.addChild(a);this.selectTextObject(a);this.file.modified=!0}; +Entry.Painter.prototype.addImage=function(a){var b=new createjs.Bitmap(a);this.objectContainer.addChild(b);b.x=this.stage.canvas.width/2;b.y=this.stage.canvas.height/2;b.regX=b.image.width/2|0;b.regY=b.image.height/2|0;if(540>1,this.oldPt.y+this.stage.mouseY>>1);this.brush.graphics.setStrokeStyle(this.stroke.thickness,"round").beginStroke(this.stroke.lineColor).moveTo(b.x,b.y).curveTo(this.oldPt.x,this.oldPt.y,this.oldMidPt.x,this.oldMidPt.y);this.oldPt.x=this.stage.mouseX;this.oldPt.y=this.stage.mouseY;this.oldMidPt.x=b.x;this.oldMidPt.y=b.y;this.file.modified=!0;this.stage.update()}; +Entry.Painter.prototype.fill=function(){if(!this.stroke.locked){this.stroke.locked=!0;this.initCommand();this.doCommand();this.clearHandle();var a=this.canvas.width,b=this.canvas.height;this.colorLayerData=this.ctx.getImageData(0,0,a,b);var c=new createjs.Point(this.stage.mouseX,this.stage.mouseY);c.x=Math.round(c.x);c.y=Math.round(c.y);for(var d=4*(c.y*a+c.x),e=this.colorLayerData.data[d],f=this.colorLayerData.data[d+1],g=this.colorLayerData.data[d+2],h=this.colorLayerData.data[d+3],k,l,c=[[c.x, +c.y]],n=Entry.hex2rgb(this.stroke.lineColor);c.length;){for(var d=c.pop(),m=d[0],q=d[1],d=4*(q*a+m);0<=q&&this.matchColor(d,e,f,g,h);)--q,d-=4*a;d+=4*a;q+=1;for(l=k=!1;q>1,this.oldPt.y+this.stage.mouseY>>1);this.brush.graphics.setStrokeStyle(this.stroke.thickness,"round").beginStroke(this.stroke.lineColor).moveTo(a.x,a.y).curveTo(this.oldPt.x,this.oldPt.y,this.oldMidPt.x,this.oldMidPt.y);this.oldPt.x=this.stage.mouseX;this.oldPt.y=this.stage.mouseY;this.oldMidPt.x=a.x;this.oldMidPt.y=a.y;this.file.modified=!0;this.stage.update()}; Entry.Painter.prototype.move_line=function(){this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").moveTo(this.oldPt.x,this.oldPt.y).lineTo(this.stage.mouseX,this.stage.mouseY);this.file.modified=!0;this.stage.update()}; -Entry.Painter.prototype.move_rect=function(){var b=this.stage.mouseX-this.oldPt.x,a=this.stage.mouseY-this.oldPt.y;event.shiftKey&&(a=b);this.stroke.fill?0===this.stroke.thickness?this.brush.graphics.clear().setStrokeStyle(this.stroke.thickness,"round").beginFill(this.stroke.fillColor).drawRect(this.oldPt.x,this.oldPt.y,b,a):this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").beginFill(this.stroke.fillColor).drawRect(this.oldPt.x,this.oldPt.y, -b,a):0===this.stroke.thickness?this.brush.graphics.clear().setStrokeStyle(this.stroke.thickness,"round").drawRect(this.oldPt.x,this.oldPt.y,b,a):this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").drawRect(this.oldPt.x,this.oldPt.y,b,a);this.file.modified=!0;this.stage.update()}; -Entry.Painter.prototype.move_circle=function(){var b=this.stage.mouseX-this.oldPt.x,a=this.stage.mouseY-this.oldPt.y;event.shiftKey&&(a=b);this.stroke.fill?0===this.stroke.thickness?this.brush.graphics.clear().beginStroke(this.stroke.fillColor).setStrokeStyle(this.stroke.thickness,"round").beginFill(this.stroke.fillColor).drawEllipse(this.oldPt.x,this.oldPt.y,b,a):this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").beginFill(this.stroke.fillColor).drawEllipse(this.oldPt.x, -this.oldPt.y,b,a):this.stroke.fill||(0===this.stroke.thickness?this.brush.graphics.clear().drawEllipse(this.oldPt.x,this.oldPt.y,b,a):this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").drawEllipse(this.oldPt.x,this.oldPt.y,b,a));this.file.modified=!0;this.stage.update()}; +Entry.Painter.prototype.move_rect=function(){var a=this.stage.mouseX-this.oldPt.x,b=this.stage.mouseY-this.oldPt.y;event.shiftKey&&(b=a);this.stroke.fill?0===this.stroke.thickness?this.brush.graphics.clear().setStrokeStyle(this.stroke.thickness,"round").beginFill(this.stroke.fillColor).drawRect(this.oldPt.x,this.oldPt.y,a,b):this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").beginFill(this.stroke.fillColor).drawRect(this.oldPt.x,this.oldPt.y, +a,b):0===this.stroke.thickness?this.brush.graphics.clear().setStrokeStyle(this.stroke.thickness,"round").drawRect(this.oldPt.x,this.oldPt.y,a,b):this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").drawRect(this.oldPt.x,this.oldPt.y,a,b);this.file.modified=!0;this.stage.update()}; +Entry.Painter.prototype.move_circle=function(){var a=this.stage.mouseX-this.oldPt.x,b=this.stage.mouseY-this.oldPt.y;event.shiftKey&&(b=a);this.stroke.fill?0===this.stroke.thickness?this.brush.graphics.clear().beginStroke(this.stroke.fillColor).setStrokeStyle(this.stroke.thickness,"round").beginFill(this.stroke.fillColor).drawEllipse(this.oldPt.x,this.oldPt.y,a,b):this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").beginFill(this.stroke.fillColor).drawEllipse(this.oldPt.x, +this.oldPt.y,a,b):this.stroke.fill||(0===this.stroke.thickness?this.brush.graphics.clear().drawEllipse(this.oldPt.x,this.oldPt.y,a,b):this.brush.graphics.clear().beginStroke(this.stroke.lineColor).setStrokeStyle(this.stroke.thickness,"round").drawEllipse(this.oldPt.x,this.oldPt.y,a,b));this.file.modified=!0;this.stage.update()}; Entry.Painter.prototype.edit_copy=function(){this.selectArea?(this.clearHandle(),this.selectedObject&&delete this.selectedObject,this.copyLayerData=this.ctx.getImageData(this.selectArea.x1,this.selectArea.y1,this.selectArea.x2,this.selectArea.y2),this.copy={},this.copy.width=this.selectArea.x2,this.copy.height=this.selectArea.y2,this.canvas_.width=this.copy.width,this.canvas_.height=this.copy.height,this.ctx_.clearRect(0,0,this.canvas_.width,this.canvas_.height),this.ctx_.putImageData(this.copyLayerData, 0,0)):alert("\ubcf5\uc0ac\ud560 \uc601\uc5ed\uc744 \uc120\ud0dd\ud558\uc138\uc694.")}; Entry.Painter.prototype.edit_cut=function(){this.selectArea?(this.clearHandle(),this.selectedObject&&delete this.selectedObject,this.copyLayerData=this.ctx.getImageData(this.selectArea.x1,this.selectArea.y1,this.selectArea.x2,this.selectArea.y2),this.copy={},this.copy.width=this.selectArea.x2,this.copy.height=this.selectArea.y2,this.canvas_.width=this.copy.width,this.canvas_.height=this.copy.height,this.ctx_.clearRect(0,0,this.canvas_.width,this.canvas_.height),this.ctx_.putImageData(this.copyLayerData, 0,0),this.ctx.clearRect(this.selectArea.x1,this.selectArea.y1,this.selectArea.x2,this.selectArea.y2),this.colorLayerData=this.ctx.getImageData(0,0,this.canvas.width,this.canvas.height),this.reloadContext(),this.file.modified=!0):alert("\uc790\ub97c \uc601\uc5ed\uc744 \uc120\ud0dd\ud558\uc138\uc694.")}; -Entry.Painter.prototype.edit_paste=function(){var b=new Image;b.src=this.canvas_.toDataURL();var a=this;b.onload=function(b){b=new createjs.Bitmap(b.target);b.x=a.canvas.width/2;b.y=a.canvas.height/2;b.regX=a.copy.width/2|0;b.regY=a.copy.height/2|0;b.id=Entry.generateHash();a.objectContainer.addChild(b);a.selectObject(b,!0)};this.file.modified=!0}; +Entry.Painter.prototype.edit_paste=function(){var a=new Image;a.src=this.canvas_.toDataURL();var b=this;a.onload=function(a){a=new createjs.Bitmap(a.target);a.x=b.canvas.width/2;a.y=b.canvas.height/2;a.regX=b.copy.width/2|0;a.regY=b.copy.height/2|0;a.id=Entry.generateHash();b.objectContainer.addChild(a);b.selectObject(a,!0)};this.file.modified=!0}; Entry.Painter.prototype.edit_select=function(){this.clearHandle();this.selectedObject&&delete this.selectedObject;this.copyLayerData=this.ctx.getImageData(this.selectArea.x1,this.selectArea.y1,this.selectArea.x2,this.selectArea.y2);this.copy={};this.copy.width=this.selectArea.x2;this.copy.height=this.selectArea.y2;this.canvas_.width=this.copy.width;this.canvas_.height=this.copy.height;this.ctx_.clearRect(0,0,this.canvas_.width,this.canvas_.height);this.ctx_.putImageData(this.copyLayerData,0,0);this.ctx.clearRect(this.selectArea.x1, -this.selectArea.y1,this.selectArea.x2,this.selectArea.y2);this.colorLayerData=this.ctx.getImageData(0,0,this.canvas.width,this.canvas.height);this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);this.ctx.putImageData(this.colorLayerData,0,0);var b=new Image;b.src=this.canvas.toDataURL();var a=this;b.onload=function(b){b=new createjs.Bitmap(b.target);a.objectContainer.removeAllChildren();a.objectContainer.addChild(b);b=new Image;b.src=a.canvas_.toDataURL();b.onload=function(b){b=new createjs.Bitmap(b.target); -b.x=a.selectArea.x1+a.copy.width/2;b.y=a.selectArea.y1+a.copy.height/2;b.regX=a.copy.width/2|0;b.regY=a.copy.height/2|0;b.id=Entry.generateHash();b.name=b.id;a.objectContainer.addChild(b);a.selectObject(b,!0)}}}; -Entry.Painter.prototype.move_erase=function(b){b=new createjs.Point(this.oldPt.x+this.stage.mouseX>>1,this.oldPt.y+this.stage.mouseY>>1);this.eraser.graphics.setStrokeStyle(this.stroke.thickness,"round").beginStroke("#ffffff").moveTo(b.x,b.y).curveTo(this.oldPt.x,this.oldPt.y,this.oldMidPt.x,this.oldMidPt.y);this.oldPt.x=this.stage.mouseX;this.oldPt.y=this.stage.mouseY;this.oldMidPt.x=b.x;this.oldMidPt.y=b.y;this.file.modified=!0;this.stage.update()}; +this.selectArea.y1,this.selectArea.x2,this.selectArea.y2);this.colorLayerData=this.ctx.getImageData(0,0,this.canvas.width,this.canvas.height);this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);this.ctx.putImageData(this.colorLayerData,0,0);var a=new Image;a.src=this.canvas.toDataURL();var b=this;a.onload=function(a){a=new createjs.Bitmap(a.target);b.objectContainer.removeAllChildren();b.objectContainer.addChild(a);a=new Image;a.src=b.canvas_.toDataURL();a.onload=function(a){a=new createjs.Bitmap(a.target); +a.x=b.selectArea.x1+b.copy.width/2;a.y=b.selectArea.y1+b.copy.height/2;a.regX=b.copy.width/2|0;a.regY=b.copy.height/2|0;a.id=Entry.generateHash();a.name=a.id;b.objectContainer.addChild(a);b.selectObject(a,!0)}}}; +Entry.Painter.prototype.move_erase=function(a){a=new createjs.Point(this.oldPt.x+this.stage.mouseX>>1,this.oldPt.y+this.stage.mouseY>>1);this.eraser.graphics.setStrokeStyle(this.stroke.thickness,"round").beginStroke("#ffffff").moveTo(a.x,a.y).curveTo(this.oldPt.x,this.oldPt.y,this.oldMidPt.x,this.oldMidPt.y);this.oldPt.x=this.stage.mouseX;this.oldPt.y=this.stage.mouseY;this.oldMidPt.x=a.x;this.oldMidPt.y=a.y;this.file.modified=!0;this.stage.update()}; Entry.Painter.prototype.settingShapeBlur=function(){this.objectWidthInput.blur();this.objectHeightInput.blur();this.objectRotateInput.blur()}; -Entry.Painter.prototype.stagemousedown=function(b){"picture"==Entry.playground.getViewMode()&&(this.settingShapeBlur(),this.oldPt=new createjs.Point(b.stageX,b.stageY),this.oldMidPt=this.oldPt.clone(),"select"===this.toolbox.selected?this.stage.addChild(this._handle):"spoid"===this.toolbox.selected?this.pickStrokeColor(b):"text"===this.toolbox.selected?(this.showInputField(b),this.stage.update()):"erase"===this.toolbox.selected?(this.createEraser(),this.stroke.enabled=!0):"fill"===this.toolbox.selected? +Entry.Painter.prototype.stagemousedown=function(a){"picture"==Entry.playground.getViewMode()&&(this.settingShapeBlur(),this.oldPt=new createjs.Point(a.stageX,a.stageY),this.oldMidPt=this.oldPt.clone(),"select"===this.toolbox.selected?this.stage.addChild(this._handle):"spoid"===this.toolbox.selected?this.pickStrokeColor(a):"text"===this.toolbox.selected?(this.showInputField(a),this.stage.update()):"erase"===this.toolbox.selected?(this.createEraser(),this.stroke.enabled=!0):"fill"===this.toolbox.selected? this.fill():"cursor"!==this.toolbox.selected&&(this.createBrush(),this.stroke.enabled=!0))}; -Entry.Painter.prototype.stagemousemove=function(b){"picture"==Entry.playground.getViewMode()&&("select"===this.toolbox.selected&&-1this.value&&(this.value=360+this.value%360);a.handle.rotation=this.value;a.updateImageHandle()};this.objectRotateInput.addClass("entryPlaygroundPainterNumberInput"); +this.attrRotateArea.appendChild(d);c=Entry.createElement("div");c.addClass("painterAttrRotateTop");c.innerHTML="\u03bf";d.appendChild(c);this.objectRotateInput=Entry.createElement("input","entryPainterAttrDegree");this.objectRotateInput.onblur=function(){if(isNaN(this.value))return alert("\uc22b\uc790\ub9cc \uc785\ub825 \uac00\ub2a5\ud569\ub2c8\ub2e4."),!1;360<=this.value?this.value%=360:0>this.value&&(this.value=360+this.value%360);b.handle.rotation=this.value;b.updateImageHandle()};this.objectRotateInput.addClass("entryPlaygroundPainterNumberInput"); this.objectRotateInput.defaultValue="0";d.appendChild(this.objectRotateInput);this.attrColorArea=Entry.createElement("fieldset","entryPainterAttrColor");this.attrColorArea.addClass("entryPlaygroundPainterAttrColor");g.appendChild(this.attrColorArea);var n=Entry.createElement("div");n.addClass("entryPlaygroundPainterAttrColorContainer");this.attrColorArea.appendChild(n);this.attrCircleArea=Entry.createElement("div");this.attrCircleArea.addClass("painterAttrCircleArea");g.appendChild(this.attrCircleArea); -d=Entry.createElement("div","entryPainterAttrCircle");d.addClass("painterAttrCircle");this.attrCircleArea.appendChild(d);this.attrCircleArea.painterAttrCircle=d;d=Entry.createElement("input","entryPainterAttrCircleInput");d.value="#000000";d.addClass("painterAttrCircleInput");this.attrCircleArea.appendChild(d);this.attrColorSpoid=Entry.createElement("div");this.attrColorSpoid.bindOnClick(function(){a.selectToolbox("spoid")});this.attrColorSpoid.addClass("painterAttrColorSpoid");g.appendChild(this.attrColorSpoid); -Entry.getColourCodes().forEach(function(b){var c=Entry.createElement("div");c.addClass("entryPlaygroundPainterAttrColorElement");"transparent"===b?c.style.backgroundImage="url("+(Entry.mediaFilePath+"/transparent.png")+")":c.style.backgroundColor=b;c.bindOnClick(function(c){"transparent"===b?(a.stroke.transparent=!0,a.stroke.lineColor="#ffffff"):(a.stroke.transparent=!1,r&&(document.getElementById("entryPainterShapeBackgroundColor").style.backgroundColor=b,a.stroke.fillColor=b),r||(document.getElementById("entryPainterShapeLineColor").style.backgroundColor= -b,a.stroke.lineColor=b));document.getElementById("entryPainterAttrCircle").style.backgroundColor=a.stroke.lineColor;document.getElementById("entryPainterAttrCircleInput").value=b});n.appendChild(c)});this.attrThickArea=Entry.createElement("div","painterAttrThickArea");this.attrThickArea.addClass("entryPlaygroundentryPlaygroundPainterAttrThickArea");g.appendChild(this.attrThickArea);d=Entry.createElement("legend");d.addClass("painterAttrThickName");d.innerHTML=Lang.Workspace.thickness;this.attrThickArea.appendChild(d); -var m=Entry.createElement("fieldset","entryPainterAttrThick");m.addClass("entryPlaygroundPainterAttrThick");this.attrThickArea.appendChild(m);d=Entry.createElement("div");d.addClass("paintAttrThickTop");m.appendChild(d);e=Entry.createElement("select","entryPainterAttrThick");e.addClass("entryPlaygroundPainterAttrThickInput");e.size="1";e.onchange=function(b){a.stroke.thickness=b.target.value};for(d=1;10>=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,e.appendChild(c);m.appendChild(e); +d=Entry.createElement("div","entryPainterAttrCircle");d.addClass("painterAttrCircle");this.attrCircleArea.appendChild(d);this.attrCircleArea.painterAttrCircle=d;d=Entry.createElement("input","entryPainterAttrCircleInput");d.value="#000000";d.addClass("painterAttrCircleInput");this.attrCircleArea.appendChild(d);this.attrColorSpoid=Entry.createElement("div");this.attrColorSpoid.bindOnClick(function(){b.selectToolbox("spoid")});this.attrColorSpoid.addClass("painterAttrColorSpoid");g.appendChild(this.attrColorSpoid); +Entry.getColourCodes().forEach(function(a){var c=Entry.createElement("div");c.addClass("entryPlaygroundPainterAttrColorElement");"transparent"===a?c.style.backgroundImage="url("+(Entry.mediaFilePath+"/transparent.png")+")":c.style.backgroundColor=a;c.bindOnClick(function(c){"transparent"===a?(b.stroke.transparent=!0,b.stroke.lineColor="#ffffff"):(b.stroke.transparent=!1,r&&(document.getElementById("entryPainterShapeBackgroundColor").style.backgroundColor=a,b.stroke.fillColor=a),r||(document.getElementById("entryPainterShapeLineColor").style.backgroundColor= +a,b.stroke.lineColor=a));document.getElementById("entryPainterAttrCircle").style.backgroundColor=b.stroke.lineColor;document.getElementById("entryPainterAttrCircleInput").value=a});n.appendChild(c)});this.attrThickArea=Entry.createElement("div","painterAttrThickArea");this.attrThickArea.addClass("entryPlaygroundentryPlaygroundPainterAttrThickArea");g.appendChild(this.attrThickArea);d=Entry.createElement("legend");d.addClass("painterAttrThickName");d.innerHTML=Lang.Workspace.thickness;this.attrThickArea.appendChild(d); +var m=Entry.createElement("fieldset","entryPainterAttrThick");m.addClass("entryPlaygroundPainterAttrThick");this.attrThickArea.appendChild(m);d=Entry.createElement("div");d.addClass("paintAttrThickTop");m.appendChild(d);e=Entry.createElement("select","entryPainterAttrThick");e.addClass("entryPlaygroundPainterAttrThickInput");e.size="1";e.onchange=function(a){b.stroke.thickness=a.target.value};for(d=1;10>=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,e.appendChild(c);m.appendChild(e); d=Entry.createElement("div","entryPainterShapeLineColor");d.addClass("painterAttrShapeLineColor");c=Entry.createElement("div","entryPainterShapeInnerBackground");c.addClass("painterAttrShapeInnerBackground");d.appendChild(c);m.appendChild(d);this.attrThickArea.painterAttrShapeLineColor=d;m.bindOnClick(function(){q.style.zIndex="1";this.style.zIndex="10";r=!1});this.attrBackgroundArea=Entry.createElement("div","painterAttrBackgroundArea");this.attrBackgroundArea.addClass("entryPlaygroundPainterBackgroundArea"); -g.appendChild(this.attrBackgroundArea);d=Entry.createElement("fieldset","entryPainterAttrbackground");d.addClass("entryPlaygroundPainterAttrBackground");this.attrBackgroundArea.appendChild(d);c=Entry.createElement("div");c.addClass("paintAttrBackgroundTop");d.appendChild(c);var q=Entry.createElement("div","entryPainterShapeBackgroundColor");q.addClass("painterAttrShapeBackgroundColor");this.attrBackgroundArea.painterAttrShapeBackgroundColor=q;c.appendChild(q);var r=!1;q.bindOnClick(function(a){m.style.zIndex= +g.appendChild(this.attrBackgroundArea);d=Entry.createElement("fieldset","entryPainterAttrbackground");d.addClass("entryPlaygroundPainterAttrBackground");this.attrBackgroundArea.appendChild(d);c=Entry.createElement("div");c.addClass("paintAttrBackgroundTop");d.appendChild(c);var q=Entry.createElement("div","entryPainterShapeBackgroundColor");q.addClass("painterAttrShapeBackgroundColor");this.attrBackgroundArea.painterAttrShapeBackgroundColor=q;c.appendChild(q);var r=!1;q.bindOnClick(function(b){m.style.zIndex= "1";this.style.zIndex="10";r=!0});this.attrFontArea=Entry.createElement("div","painterAttrFont");this.attrFontArea.addClass("entryPlaygroundPainterAttrFont");g.appendChild(this.attrFontArea);e=Entry.createElement("div");e.addClass("entryPlaygroundPainterAttrTop");this.attrFontArea.appendChild(e);d=Entry.createElement("div");d.addClass("entryPlaygroundPaintAttrTop_");e.appendChild(d);d=Entry.createElement("legend");d.addClass("panterAttrFontTitle");d.innerHTML=Lang.Workspace.textStyle;k=Entry.createElement("select", -"entryPainterAttrFontName");k.addClass("entryPlaygroundPainterAttrFontName");k.size="1";k.onchange=function(b){a.font.name=b.target.value};for(d=0;d=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,k.appendChild(c);e.appendChild(k);e=Entry.createElement("div");e.addClass("entryPlaygroundPainterAttrFontStyleArea");this.attrFontArea.appendChild(e);d=Entry.createElement("div");d.addClass("entryPlaygroundPainterAttrFontTop");e.appendChild(d);k=Entry.createElement("select","entryPainterAttrFontStyle"); -k.addClass("entryPlaygroundPainterAttrFontStyle");k.size="1";k.onchange=function(b){a.font.style=b.target.value};h=[{label:"\ubcf4\ud1b5",value:"normal"},{label:"\uad75\uac8c",value:"bold"},{label:"\uae30\uc6b8\uc784",value:"italic"}];for(d=0;d=d;d++)c=Entry.createElement("option"),c.value=d,c.innerHTML=d,k.appendChild(c);e.appendChild(k);e=Entry.createElement("div");e.addClass("entryPlaygroundPainterAttrFontStyleArea");this.attrFontArea.appendChild(e);d=Entry.createElement("div");d.addClass("entryPlaygroundPainterAttrFontTop");e.appendChild(d);k=Entry.createElement("select","entryPainterAttrFontStyle"); +k.addClass("entryPlaygroundPainterAttrFontStyle");k.size="1";k.onchange=function(a){b.font.style=a.target.value};h=[{label:"\ubcf4\ud1b5",value:"normal"},{label:"\uad75\uac8c",value:"bold"},{label:"\uae30\uc6b8\uc784",value:"italic"}];for(d=0;d":h=b-d;break;case ">=":h=b+1-d}return this.BasicIteration(a,h,f)};b.BlockStatement=function(a){var b=[];a=a.body;for(var d=0;d >= << >> >>> + - * / % , ^ & in instanceof".split(" ")}; -b.AssignmentExpression=function(a){throw{message:a.operator+"\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub839\uc5b4 \uc785\ub2c8\ub2e4.",node:a};};b.AssignmentOperator=function(){return"= += -= *= /= %= <<= >>= >>>= ,= ^= &=".split(" ")};b.LogicalExpression=function(a){throw{message:a.operator+"\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub839\uc5b4 \uc785\ub2c8\ub2e4.",node:a};};b.LogicalOperator=function(){return["||","&&"]};b.MemberExpression=function(a){var b= -a.object,d=a.property;console.log(b.type);b=this[b.type](b);console.log(b);d=this[d.type](d,b);if(Object(b)!==b||Object.getPrototypeOf(b)!==Object.prototype)throw{message:b+"\uc740(\ub294) \uc798\ubabb\ub41c \uba64\ubc84 \ubcc0\uc218\uc785\ub2c8\ub2e4.",node:a};b=d;if(!b)throw{message:d+"\uc774(\uac00) \uc874\uc7ac\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.",node:a};return b};b.ConditionalExpression=function(a){throw{message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", -node:a};};b.UpdateExpression=function(a){throw{message:a.operator+"\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub801\uc5b4 \uc785\ub2c8\ub2e4.",node:a};};b.CallExpression=function(a){a=a.callee;return{type:this[a.type](a)}};b.NewExpression=function(a){throw{message:"new\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.",node:a};};b.SequenceExpression=function(a){throw{message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", -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":h=a-d;break;case ">=":h=a+1-d}return this.BasicIteration(b,h,f)};a.BlockStatement=function(b){var a=[];b=b.body;for(var d=0;d >= << >> >>> + - * / % , ^ & in instanceof".split(" ")}; +a.AssignmentExpression=function(b){throw{message:b.operator+"\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub839\uc5b4 \uc785\ub2c8\ub2e4.",node:b};};a.AssignmentOperator=function(){return"= += -= *= /= %= <<= >>= >>>= ,= ^= &=".split(" ")};a.LogicalExpression=function(b){throw{message:b.operator+"\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub839\uc5b4 \uc785\ub2c8\ub2e4.",node:b};};a.LogicalOperator=function(){return["||","&&"]};a.MemberExpression=function(b){var a= +b.object,d=b.property;console.log(a.type);a=this[a.type](a);console.log(a);d=this[d.type](d,a);if(Object(a)!==a||Object.getPrototypeOf(a)!==Object.prototype)throw{message:a+"\uc740(\ub294) \uc798\ubabb\ub41c \uba64\ubc84 \ubcc0\uc218\uc785\ub2c8\ub2e4.",node:b};a=d;if(!a)throw{message:d+"\uc774(\uac00) \uc874\uc7ac\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.",node:b};return a};a.ConditionalExpression=function(b){throw{message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", +node:b};};a.UpdateExpression=function(b){throw{message:b.operator+"\uc740(\ub294) \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uba85\ub801\uc5b4 \uc785\ub2c8\ub2e4.",node:b};};a.CallExpression=function(b){b=b.callee;return{type:this[b.type](b)}};a.NewExpression=function(b){throw{message:"new\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.",node:b};};a.SequenceExpression=function(b){throw{message:"\uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud45c\ud604\uc2dd \uc785\ub2c8\ub2e4.", +node:b};};a.initScope=function(b){if(null===this.scope){var a=function(){};a.prototype=this.syntax.Scope}else a=function(){},a.prototype=this.scope;this.scope=new a;this.scopeChain.push(this.scope);return this.scanDefinition(b)};a.unloadScope=function(){this.scopeChain.pop();this.scope=this.scopeChain.length?this.scopeChain[this.scopeChain.length-1]:null};a.scanDefinition=function(b){b=b.body;for(var a=[],d=0;d=a.keyCode&&CodeMirror.showHint(b,null,{completeSingle:!1,globalScope:d})});break;case "block":this._parser=new Entry.BlockParser(this.syntax)}}; +(function(a){a.parse=function(b){var a=null;switch(this._lang){case "js":try{var d=acorn.parse(b),a=this._parser.Program(d)}catch(e){this.codeMirror&&(e instanceof SyntaxError?(b={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."):(b=this.getLineNumber(e.node.start,e.node.end),b.message=e.message,b.severity="error",this.codeMirror.markText(b.from,b.to,{className:"CodeMirror-lint-mark-error",__annotation:b, +clearOnEnter:!0})),Entry.toast.alert("Error",e.message)),a=[]}break;case "block":b=this._parser.Code(b).match(/(.*{.*[\S|\s]+?}|.+)/g),a=Array.isArray(b)?b.reduce(function(b,a,c){1===c&&(b+="\n");return(-1=e&&g>=a)}};a.align=function(){var b=this.getPosition();this.svgGroup.attr({transform:"translate("+b.x+","+b.y+")"})};a.setPosition=function(){if(this.board){var b=this.board.svgDom;this._x=b.width()-110;this._y=b.height()-110;this.align()}};a.getPosition=function(){return{x:this._x,y:this._y}};a.tAnimation=function(b){if(b!==this.isOver){b=void 0===b?!0:b;var a,d=this.trashcanTop;a=b?{translateX:15,translateY:-25, +rotateZ:30}:{translateX:0,translateY:0,rotateZ:0};$(d).velocity(a,{duration:50});this.isOver=b}};a.setBoard=function(b){this._dragBlockObserver&&this._dragBlockObserver.destroy();this.board=b;this.svgGroup||this._generateView();var a=b.svg,d=a.firstChild;d?a.insertBefore(this.svgGroup,d):a.appendChild(this.svgGroup);this._dragBlockObserver=b.observe(this,"updateDragBlock",["dragBlock"]);this.svgGroup.attr({filter:"url(#entryTrashcanFilter_"+b.suffix+")"});this.setPosition()}})(Entry.FieldTrashcan.prototype);Entry.Workspace=function(a){Entry.Model(this,!1);this.observe(this,"_handleChangeBoard",["selectedBoard"],!1);this.trashcan=new Entry.FieldTrashcan;var b=a.blockMenu;b&&(this.blockMenu=new Entry.BlockMenu(b.dom,b.align,b.categoryData,b.scroll),this.blockMenu.workspace=this,this.blockMenu.observe(this,"_setSelectedBlockView",["selectedBlockView"],!1));if(b=a.board)b.workspace=this,this.board=new Entry.Board(b),this.board.observe(this,"_setSelectedBlockView",["selectedBlockView"],!1),this.set({selectedBoard:this.board}); +if(b=a.vimBoard)this.vimBoard=new Entry.Vim(b.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(a){a.schema={selectedBlockView:null,selectedBoard:null};a.getBoard=function(){return this.board};a.getSelectedBoard=function(){return this.selectedBoard};a.getBlockMenu=function(){return this.blockMenu};a.getVimBoard=function(){return this.vimBoard};a.getMode=function(){return this.mode};a.setMode=function(b,a){b=Number(b);var d=this.mode;this.mode=b;switch(b){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(a)};a.changeBoardCode=function(b){this.board.changeCode(b)};a.changeOverlayBoardCode=function(b){this.overlayBoard&&this.overlayBoard.changeCode(b)};a.changeBlockMenuCode=function(b){this.blockMenu.changeCode(b)};a.textToCode=function(b){if(b==Entry.Workspace.MODE_VIMBOARD){b= +this.vimBoard.textToCode();var a=this.board,d=a.code;d.load(b);d.createView(a);a.reDraw();this.board.alignThreads()}};a.codeToText=function(b){return this.vimBoard.codeToText(b)};a.getCodeToText=function(b){return this.vimBoard.getCodeToText(b)};a._setSelectedBlockView=function(){this.set({selectedBlockView:this.board.selectedBlockView||this.blockMenu.selectedBlockView||(this.overlayBoard?this.overlayBoard.selectedBlockView:null)})};a.initOverlayBoard=function(){this.overlayBoard=new Entry.Board({dom:this.board.view, +workspace:this,isOverlay:!0});this.overlayBoard.changeCode(new Entry.Code([]));this.overlayBoard.workspace=this;this.overlayBoard.observe(this,"_setSelectedBlockView",["selectedBlockView"],!1)};a._keyboardControl=function(b){var a=b.keyCode||b.which,d=b.ctrlKey;if(!Entry.Utils.isInInput(b)){var e=this.selectedBlockView;e&&!e.isInBlockMenu&&e.block.isDeletable()&&(8==a||46==a?(Entry.do("destroyBlock",e.block),b.preventDefault()):d&&(67==a?e.block.copyToClipboard():88==a&&(b=e.block,b.copyToClipboard(), +b.destroy(!0,!0),e.getBoard().setSelectedBlock(null))));d&&86==a&&(a=this.selectedBoard)&&a instanceof Entry.Board&&Entry.clipboard&&Entry.do("addThread",Entry.clipboard).value.getFirstBlock().copyToClipboard()}};a._handleChangeBoard=function(){var b=this.selectedBoard;b&&b.constructor===Entry.Board&&this.trashcan.setBoard(b)}})(Entry.Workspace.prototype);Entry.BlockDriver=function(){}; +(function(a){a.convert=function(){var b=new Date,a;for(a in Entry.block)"function"===typeof Entry.block[a]&&this._convertBlock(a);console.log((new Date).getTime()-b.getTime())};a._convertBlock=function(b){function a(b){var d={type:b.getAttribute("type"),index:{}};b=$(b).children();if(!b)return d;for(var e=0;e"+b[1], +a.addEventListener("click",function(){Entry.engine.toggleStop()}),this.view_.appendChild(a),this.curtainView_=a,Entry.pictureEditable&&(a=Entry.createElement("div","entryPicture"),a.addClass("entryPlaygroundPictureWorkspace"),a.addClass("entryRemove"),this.view_.appendChild(a),this.generatePictureView(a),this.pictureView_=a),a=Entry.createElement("div","entryText"),a.addClass("entryPlaygroundTextWorkspace"),a.addClass("entryRemove"),this.view_.appendChild(a),this.generateTextView(a),this.textView_= +a,Entry.soundEditable&&(a=Entry.createElement("div","entrySound"),a.addClass("entryPlaygroundSoundWorkspace"),a.addClass("entryRemove"),this.view_.appendChild(a),this.generateSoundView(a),this.soundView_=a),a=Entry.createElement("div","entryDefault"),a.addClass("entryPlaygroundDefaultWorkspace"),this.view_.appendChild(a),this.generateDefaultView(a),this.defaultView_=a,a=Entry.createElement("div","entryCode"),a.addClass("entryPlaygroundCodeWorkspace"),a.addClass("entryRemove"),this.view_.appendChild(a), +this.generateCodeView(a),this.codeView_=a,b=Entry.createElement("div"),b.addClass("entryPlaygroundResizeWorkspace","entryRemove"),this.resizeHandle_=b,this.view_.appendChild(b),this.initializeResizeHandle(b),this.codeView_=a,Entry.addEventListener("run",function(b){Entry.playground.curtainView_.removeClass("entryRemove")}),Entry.addEventListener("stop",function(b){Entry.playground.curtainView_.addClass("entryRemove")}))};Entry.Playground.prototype.generateDefaultView=function(a){return a}; +Entry.Playground.prototype.generateTabView=function(a){var b=this,c=Entry.createElement("ul");c.addClass("entryTabListWorkspace");this.tabList_=c;a.appendChild(c);this.tabViewElements={};a=Entry.createElement("li","entryCodeTab");a.innerHTML=Lang.Workspace.tab_code;a.addClass("entryTabListItemWorkspace");a.addClass("entryTabSelected");c.appendChild(a);a.bindOnClick(function(a){b.changeViewMode("code");b.blockMenu.reDraw()});this.tabViewElements.code=a;Entry.pictureEditable&&(a=Entry.createElement("li", +"entryPictureTab"),a.innerHTML=Lang.Workspace.tab_picture,a.addClass("entryTabListItemWorkspace"),c.appendChild(a),a.bindOnClick(function(b){Entry.playground.changeViewMode("picture")}),this.tabViewElements.picture=a,a=Entry.createElement("li","entryTextboxTab"),a.innerHTML=Lang.Workspace.tab_text,a.addClass("entryTabListItemWorkspace"),c.appendChild(a),a.bindOnClick(function(b){Entry.playground.changeViewMode("text")}),this.tabViewElements.text=a,a.addClass("entryRemove"));Entry.soundEditable&&(a= +Entry.createElement("li","entrySoundTab"),a.innerHTML=Lang.Workspace.tab_sound,a.addClass("entryTabListItemWorkspace"),c.appendChild(a),a.bindOnClick(function(b){Entry.playground.changeViewMode("sound")}),this.tabViewElements.sound=a);Entry.hasVariableManager&&(a=Entry.createElement("li","entryVariableTab"),a.innerHTML=Lang.Workspace.tab_attribute,a.addClass("entryTabListItemWorkspace"),a.addClass("entryVariableTabWorkspace"),c.appendChild(a),a.bindOnClick(function(b){Entry.playground.toggleOnVariableView(); +Entry.playground.changeViewMode("variable")}),this.tabViewElements.variable=a)}; +Entry.Playground.prototype.generateCodeView=function(a){var b=this.createVariableView();a.appendChild(b);this.variableView_=b;a=Entry.Dom(a);b=Entry.Dom("div",{parent:a,id:"entryWorkspaceBoard",class:"entryWorkspaceBoard"});a=Entry.Dom("div",{parent:a,id:"entryWorkspaceBlockMenu",class:"entryWorkspaceBlockMenu"});this.mainWorkspace=new Entry.Workspace({blockMenu:{dom:a,align:"LEFT",categoryData:EntryStatic.getAllBlocks(),scroll:!0},board:{dom:b}});this.blockMenu=this.mainWorkspace.blockMenu;this.board= +this.mainWorkspace.board;Entry.hw&&this.updateHW()}; +Entry.Playground.prototype.generatePictureView=function(a){if("workspace"==Entry.type){var b=Entry.createElement("div","entryAddPicture");b.addClass("entryPlaygroundAddPicture");b.bindOnClick(function(b){Entry.dispatchEvent("openPictureManager")});var c=Entry.createElement("div","entryAddPictureInner");c.addClass("entryPlaygroundAddPictureInner");c.innerHTML=Lang.Workspace.picture_add;b.appendChild(c);a.appendChild(b);b=Entry.createElement("ul","entryPictureList");b.addClass("entryPlaygroundPictureList"); +$&&$(b).sortable({start:function(b,a){a.item.data("start_pos",a.item.index())},stop:function(b,a){b=a.item.data("start_pos");a=a.item.index();Entry.playground.movePicture(b,a)},axis:"y"});a.appendChild(b);this.pictureListView_=b;b=Entry.createElement("div","entryPainter");b.addClass("entryPlaygroundPainter");a.appendChild(b);this.painter=new Entry.Painter;this.painter.initialize(b)}else"phone"==Entry.type&&(b=Entry.createElement("div","entryAddPicture"),b.addClass("entryPlaygroundAddPicturePhone"), +b.bindOnClick(function(b){Entry.dispatchEvent("openPictureManager")}),c=Entry.createElement("div","entryAddPictureInner"),c.addClass("entryPlaygroundAddPictureInnerPhone"),c.innerHTML=Lang.Workspace.picture_add,b.appendChild(c),a.appendChild(b),b=Entry.createElement("ul","entryPictureList"),b.addClass("entryPlaygroundPictureListPhone"),$&&$(b).sortable({start:function(b,a){a.item.data("start_pos",a.item.index())},stop:function(b,a){b=a.item.data("start_pos");a=a.item.index();Entry.playground.movePicture(b, +a)},axis:"y"}),a.appendChild(b),this.pictureListView_=b)}; +Entry.Playground.prototype.generateTextView=function(a){var b=Entry.createElement("div");a.appendChild(b);a=Entry.createElement("div");a.addClass("textProperties");b.appendChild(a);var c=Entry.createElement("div");c.addClass("entryTextFontSelect");a.appendChild(c);var d=Entry.createElement("select","entryPainterAttrFontName");d.addClass("entryPlaygroundPainterAttrFontName","entryTextFontSelecter");d.size="1";d.onchange=function(b){Entry.playground.object.entity.setFontType(b.target.value)};for(var e= +0;e p").html(Lang.Menus.linebreak_on_desc_1),$(".entryPlaygroundLinebreakDescription > ul > li").eq(0).html(Lang.Menus.linebreak_on_desc_2),$(".entryPlaygroundLinebreakDescription > ul > li").eq(1).html(Lang.Menus.linebreak_on_desc_3)); +Entry.playground.setFontAlign(Entry.playground.object.entity.getTextAlign());a=Entry.playground.object.entity.getFontSize();Entry.playground.fontSizeIndiciator.style.width=a+"%";Entry.playground.fontSizeKnob.style.left=.88*a+"px"}};Entry.Playground.prototype.injectSound=function(){var a=this.soundListView_;if(a){for(;a.hasChildNodes();)a.removeChild(a.lastChild);if(this.object)for(var b=this.object.sounds,c=0,d=b.length;c"+Lang.Menus[a]+"",{classes:["propertyTabElement","propertyTab"+a],parent:this._tabView}),f=this;e.bind("click",function(){f.select(a)});this.modes[a]&&(this.modes[a].tabDom.remove(),this.modes[a].contentDom.remove(),"hw"==a&&($(this.modes).removeClass(".propertyTabhw"),$(".propertyTabhw").unbind("dblclick")));this.modes[a]={obj:b,tabDom:e,contentDom:d};"hw"==a&&$(".propertyTabhw").bind("dblclick",function(){Entry.dispatchEvent("hwModeChange")})}; -b.resize=function(a){this._view.css({width:a+"px",top:9*a/16+123-22+"px"});430<=a?this._view.removeClass("collapsed"):this._view.addClass("collapsed");Entry.dispatchEvent("windowResized");a=this.selected;"hw"==a?this.modes.hw.obj.listPorts?this.modes[a].obj.resizeList():this.modes[a].obj.resize():this.modes[a].obj.resize()};b.select=function(a){for(var b in this.modes){var d=this.modes[b];d.tabDom.removeClass("selected");d.contentDom.addClass("entryRemove");d.obj.visible=!1}b=this.modes[a];b.tabDom.addClass("selected"); -b.contentDom.removeClass("entryRemove");b.obj.resize&&b.obj.resize();b.obj.visible=!0;this.selected=a};b.initializeSplitter=function(a){var b=this;a.bind("mousedown touchstart",function(a){b._cover.removeClass("entryRemove");Entry.container.disableSort();Entry.container.splitterEnable=!0;Entry.documentMousemove&&(Entry.container.resizeEvent=Entry.documentMousemove.attach(this,function(a){Entry.container.splitterEnable&&Entry.resizeElement({canvasWidth:a.clientX||a.x})}))});$(document).bind("mouseup touchend", -function(a){if(a=Entry.container.resizeEvent)Entry.container.splitterEnable=!1,Entry.documentMousemove.detach(a),b._cover.addClass("entryRemove"),delete Entry.container.resizeEvent;Entry.container.enableSort()})}})(Entry.PropertyPanel.prototype);Entry.init=function(b,a){Entry.assert("object"===typeof a,"Init option is not object");this.events_={};this.interfaceState={menuWidth:264};Entry.Utils.bindGlobalEvent("resize mousedown mousemove keydown keyup dispose".split(" "));this.options=a;this.parseOptions(a);this.mediaFilePath=(a.libDir?a.libDir:"/lib")+"/entryjs/images/";this.defaultPath=a.defaultDir||"";this.blockInjectPath=a.blockInjectDir||"";"workspace"==this.type&&this.isPhone()&&(this.type="phone");this.initialize_();this.view_=b;"tablet"=== -this.device?this.view_.setAttribute("class","entry tablet"):this.view_.setAttribute("class","entry");Entry.initFonts(a.fonts);this.createDom(b,this.type);this.loadInterfaceState();this.overridePrototype();this.maxCloneLimit=302;this.cloudSavable=!0;this.startTime=(new Date).getTime();document.onkeydown=function(a){Entry.dispatchEvent("keyPressed",a)};document.onkeyup=function(a){Entry.dispatchEvent("keyUpped",a)};window.onresize=function(a){Entry.dispatchEvent("windowResized",a)};window.onbeforeunload= -this.beforeUnload;Entry.addEventListener("saveWorkspace",function(a){Entry.addActivity("save")});"IE"!=Entry.getBrowserType().substr(0,2)||window.flashaudio?createjs.Sound.registerPlugins([createjs.WebAudioPlugin]):(createjs.FlashAudioPlugin.swfPath=this.mediaFilePath+"media/",createjs.Sound.registerPlugins([createjs.FlashAudioPlugin]),window.flashaudio=!0);Entry.soundQueue=new createjs.LoadQueue;Entry.soundQueue.installPlugin(createjs.Sound);Entry.loadAudio_([Entry.mediaFilePath+"sounds/click.mp3", -Entry.mediaFilePath+"sounds/click.wav",Entry.mediaFilePath+"sounds/click.ogg"],"entryMagneting");Entry.loadAudio_([Entry.mediaFilePath+"sounds/delete.mp3",Entry.mediaFilePath+"sounds/delete.ogg",Entry.mediaFilePath+"sounds/delete.wav"],"entryDelete");createjs.Sound.stop()};Entry.loadAudio_=function(b,a){if(window.Audio&&b.length)for(;0d+55)&&a>40+b*(h-d)&&(h=c.getNextScene())&&(h=$(h.view),$(document).trigger("mouseup"), -h.trigger("mousedown"))});var d=Entry.createElement("ul");d.addClass("entrySceneListWorkspace");Entry.sceneEditable&&$&&$(d).sortable({start:function(a,b){b.item.data("start_pos",b.item.index());$(b.item[0]).clone(!0)},stop:function(a,b){var c=b.item.data("start_pos"),d=b.item.index();Entry.scene.moveScene(c,d)},axis:"x",tolerance:"pointer"});this.view_.appendChild(d);this.listView_=d;Entry.sceneEditable&&(d=Entry.createElement("span"),d.addClass("entrySceneElementWorkspace"),d.addClass("entrySceneAddButtonWorkspace"), -d.bindOnClick(function(a){Entry.engine.isState("run")||Entry.scene.addScene()}),this.view_.appendChild(d),this.addButton_=d)}}; -Entry.Scene.prototype.generateElement=function(b){var a=this,c=Entry.createElement("li",b.id);c.addClass("entrySceneElementWorkspace");c.addClass("entrySceneButtonWorkspace");c.addClass("minValue");$(c).on("mousedown",function(a){Entry.engine.isState("run")?a.preventDefault():Entry.scene.selectScene(b)});var d=Entry.createElement("input");d.addClass("entrySceneFieldWorkspace");d.value=b.name;Entry.sceneEditable||(d.disabled="disabled");var e=Entry.createElement("span");e.addClass("entrySceneLeftWorkspace"); -c.appendChild(e);var f=Entry.createElement("span");f.addClass("entrySceneInputCover");f.style.width=Entry.computeInputWidth(b.name);c.appendChild(f);b.inputWrapper=f;d.onkeyup=function(c){c=c.keyCode;Entry.isArrowOrBackspace(c)||(b.name=this.value,f.style.width=Entry.computeInputWidth(b.name),a.resize(),13==c&&this.blur(),10=this.getScenes().length)Entry.toast.alert(Lang.Msgs.runtime_error,Lang.Workspace.Scene_delete_error,!1);else{var a=this.getScenes().indexOf(this.getSceneById(b.id));this.getScenes().splice(a,1);for(var a=Entry.container.getSceneObjects(b),c=0;c=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;af+55)&&b>40+a*(g-f)&&(g=c.getNextScene())&&(g=$(g.view),$(document).trigger("mouseup"), +g.trigger("mousedown"))}),a=Entry.createElement("ul"),a.addClass("entrySceneListWorkspace"),Entry.sceneEditable&&$&&$(a).sortable({start:function(b,a){a.item.data("start_pos",a.item.index());$(a.item[0]).clone(!0)},stop:function(b,a){b=a.item.data("start_pos");a=a.item.index();Entry.scene.moveScene(b,a)},axis:"x",tolerance:"pointer"}),this.view_.appendChild(a),this.listView_=a,Entry.sceneEditable&&(a=Entry.createElement("span"),a.addClass("entrySceneElementWorkspace"),a.addClass("entrySceneAddButtonWorkspace"), +a.bindOnClick(function(b){Entry.engine.isState("run")||Entry.scene.addScene()}),this.view_.appendChild(a),this.addButton_=a))}; +Entry.Scene.prototype.generateElement=function(a){var b=this,c=Entry.createElement("li",a.id);c.addClass("entrySceneElementWorkspace");c.addClass("entrySceneButtonWorkspace");c.addClass("minValue");$(c).on("mousedown",function(b){Entry.engine.isState("run")?b.preventDefault():Entry.scene.selectScene(a)});var d=Entry.createElement("input");d.addClass("entrySceneFieldWorkspace");d.value=a.name;Entry.sceneEditable||(d.disabled="disabled");var e=Entry.createElement("span");e.addClass("entrySceneLeftWorkspace"); +c.appendChild(e);var f=Entry.createElement("span");f.addClass("entrySceneInputCover");f.style.width=Entry.computeInputWidth(a.name);c.appendChild(f);a.inputWrapper=f;d.onkeyup=function(c){c=c.keyCode;Entry.isArrowOrBackspace(c)||(a.name=this.value,f.style.width=Entry.computeInputWidth(a.name),b.resize(),13==c&&this.blur(),10=this.getScenes().length)Entry.toast.alert(Lang.Msgs.runtime_error,Lang.Workspace.Scene_delete_error,!1);else{var b=this.getScenes().indexOf(this.getSceneById(a.id));this.getScenes().splice(b,1);for(var b=Entry.container.getSceneObjects(a),c=0;c=this.maxCount)Entry.toast.alert(Lang.Msgs.runtime_error,Lang.Workspace.Scene_add_error,!1);else{var b={name:a.name+Lang.Workspace.replica_of_object,id:Entry.generateHash()};this.generateElement(b);this.addScene(b);a=Entry.container.getSceneObjects(a);for(var c=a.length-1;0<=c;c--)Entry.container.addCloneObject(a[c],b.id)}}; +Entry.Scene.prototype.resize=function(){var a=this.getScenes(),b=this.selectedScene,c=a[0];if(0!==a.length&&c){var d=$(c.view).offset().left,c=parseFloat($(b.view).css("margin-left")),e=$(this.view_).width()-d,f=0,g;for(g in a){var d=a[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-=$(b.view).width(),c=e/(a.length-1)-(Entry.Scene.viewBasicWidth+c),a)d=a[g],b.id!=d.id?(d.view.removeClass("minValue"),$(d.inputWrapper).width(c)): +d.view.addClass("minValue")}};Entry.Scene.prototype.getNextScene=function(){var a=this.getScenes();return a[a.indexOf(this.selectedScene)+1]};Entry.Script=function(a){this.entity=a};p=Entry.Script.prototype; +p.init=function(a,b,c){Entry.assert("BLOCK"==a.tagName.toUpperCase(),a.tagName);this.type=a.getAttribute("type");this.id=Number(a.getAttribute("id"));a.getElementsByTagName("mutation").length&&a.getElementsByTagName("mutation")[0].hasAttribute("hashid")&&(this.hashId=a.childNodes[0].getAttribute("hashid"));"REPEAT"==this.type.substr(0,6).toUpperCase()&&(this.isRepeat=!0);b instanceof Entry.Script&&(this.previousScript=b,b.parentScript&&(this.parentScript=b.parentScript));c instanceof Entry.Script&& +(this.parentScript=c);a=a.childNodes;for(b=0;bd.style.opacity&&(clearInterval(a),d.style.display="none",Entry.removeElement(d));d.style.opacity*=.9},20)},1E3)}; -Entry.Toast.prototype.success=function(b,a,c){var d=Entry.createElement("div","entryToast");d.addClass("entryToast");d.addClass("entryToastSuccess");d.bindOnClick(function(){Entry.toast.body_.removeChild(this)});var e=Entry.createElement("div","entryToast");e.addClass("entryToastTitle");e.innerHTML=b;d.appendChild(e);b=Entry.createElement("p","entryToast");b.addClass("entryToastMessage");b.innerHTML=a;d.appendChild(b);this.toasts_.push(d);this.body_.appendChild(d);c||window.setTimeout(function(){d.style.opacity= -1;var a=setInterval(function(){.05>d.style.opacity&&(clearInterval(a),d.style.display="none",Entry.removeElement(d));d.style.opacity*=.9},20)},1E3)}; -Entry.Toast.prototype.alert=function(b,a,c){var d=Entry.createElement("div","entryToast");d.addClass("entryToast");d.addClass("entryToastAlert");d.bindOnClick(function(){Entry.toast.body_.removeChild(this)});var e=Entry.createElement("div","entryToast");e.addClass("entryToastTitle");e.innerHTML=b;d.appendChild(e);b=Entry.createElement("p","entryToast");b.addClass("entryToastMessage");b.innerHTML=a;d.appendChild(b);this.toasts_.push(d);this.body_.appendChild(d);c||window.setTimeout(function(){d.style.opacity= -1;var a=setInterval(function(){.05>d.style.opacity&&(clearInterval(a),d.style.display="none",Entry.toast.body_.removeChild(d));d.style.opacity*=.9},20)},5E3)};Entry.TvCast=function(b){this.generateView(b)};p=Entry.TvCast.prototype;p.init=function(b){this.tvCastHash=b};p.generateView=function(b){var a=Entry.createElement("div");a.addClass("entryContainerMovieWorkspace");a.addClass("entryRemove");this.movieContainer=a;a=Entry.createElement("iframe");a.setAttribute("id","tvCastIframe");a.setAttribute("allowfullscreen","");a.setAttribute("frameborder",0);a.setAttribute("src",b);this.movieFrame=a;this.movieContainer.appendChild(this.movieFrame)};p.getView=function(){return this.movieContainer}; -p.resize=function(){document.getElementById("entryContainerWorkspaceId");var b=document.getElementById("tvCastIframe");w=this.movieContainer.offsetWidth;b.width=w+"px";b.height=9*w/16+"px"};Entry.BlockDriver=function(){}; -(function(b){b.convert=function(){var a=new Date,b;for(b in Entry.block)"function"===typeof Entry.block[b]&&this._convertBlock(b);console.log((new Date).getTime()-a.getTime())};b._convertBlock=function(a){function b(a){var d={type:a.getAttribute("type"),index:{}};a=$(a).children();if(!a)return d;for(var e=0;eg&&(a.x-=d+3);a.y+e>f&& -(a.y-=e);b.css({left:a.x,top:a.y})};b.hide=function(){this.visible=!1;this.dom.empty();this.dom.addClass("entryRemove");this._className&&(this.dom.removeClass(this._className),delete this._className)}})(Entry.ContextMenu);Entry.Loader={queueCount:0,totalCount:0};Entry.Loader.addQueue=function(b){this.queueCount||Entry.dispatchEvent("loadStart");this.queueCount++;this.totalCount++};Entry.Loader.removeQueue=function(b){this.queueCount--;this.queueCount||(Entry.dispatchEvent("loadComplete"),this.totalCount=0)};Entry.Loader.getLoadedPercent=function(){return 0===this.totalCount?1:this.queueCount/this.totalCount};Entry.STATIC={OBJECT:0,ENTITY:1,SPRITE:2,SOUND:3,VARIABLE:4,FUNCTION:5,SCENE:6,MESSAGE:7,BLOCK_MODEL:8,BLOCK_RENDER_MODEL:9,BOX_MODEL:10,THREAD_MODEL:11,DRAG_INSTANCE:12,BLOCK_STATIC:0,BLOCK_MOVE:1,BLOCK_FOLLOW:2,RETURN:0,CONTINUE:1,BREAK:2,PASS:3};Entry.Utils={};Entry.overridePrototype=function(){Number.prototype.mod=function(b){return(this%b+b)%b}};Entry.Utils.generateId=function(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).substr(-4)};Entry.Utils.intersectArray=function(b,a){for(var c=[],d=0;d=a.x&&e-c<=a.y&&e+b.height+c>=a.y}; -Entry.Utils.colorDarken=function(b,a){function c(a){2!=a.length&&(a="0"+a);return a}var d,e,f;7===b.length?(d=parseInt(b.substr(1,2),16),e=parseInt(b.substr(3,2),16),f=parseInt(b.substr(5,2),16)):(d=parseInt(b.substr(1,2),16),e=parseInt(b.substr(2,2),16),f=parseInt(b.substr(3,2),16));a=void 0===a?.7:a;d=c(Math.floor(d*a).toString(16));e=c(Math.floor(e*a).toString(16));f=c(Math.floor(f*a).toString(16));return"#"+d+e+f}; -Entry.Utils.colorLighten=function(b,a){a=0===a?0:a||20;var c=Entry.Utils.hexToHsl(b);c.l+=a/100;c.l=Math.min(1,Math.max(0,c.l));return Entry.Utils.hslToHex(c)};Entry.Utils.bound01=function(b,a){var c=b;"string"==typeof c&&-1!=c.indexOf(".")&&1===parseFloat(c)&&(b="100%");c="string"===typeof b&&-1!=b.indexOf("%");b=Math.min(a,Math.max(0,parseFloat(b)));c&&(b=parseInt(b*a,10)/100);return 1E-6>Math.abs(b-a)?1:b%a/parseFloat(a)}; -Entry.Utils.hexToHsl=function(b){var a,c;7===b.length?(a=parseInt(b.substr(1,2),16),c=parseInt(b.substr(3,2),16),b=parseInt(b.substr(5,2),16)):(a=parseInt(b.substr(1,2),16),c=parseInt(b.substr(2,2),16),b=parseInt(b.substr(3,2),16));a=Entry.Utils.bound01(a,255);c=Entry.Utils.bound01(c,255);b=Entry.Utils.bound01(b,255);var d=Math.max(a,c,b),e=Math.min(a,c,b),f,g=(d+e)/2;if(d==e)f=e=0;else{var h=d-e,e=.5c&&(c+=1);1c?b:c<2/3?a+(b-a)*(2/3-c)*6:a}function c(a){return 1==a.length?"0"+a:""+a}var d,e;e=Entry.Utils.bound01(b.h,360);d=Entry.Utils.bound01(b.s,1);b=Entry.Utils.bound01(b.l,1);if(0===d)d=b=e=b;else{var f=.5>b?b*(1+d):b+d-b*d,g=2*b-f;d=a(g,f,e+1/3);b=a(g,f,e);e=a(g,f,e-1/3)}b*=255;e*=255;return"#"+[c(Math.round(255*d).toString(16)),c(Math.round(b).toString(16)),c(Math.round(e).toString(16))].join("")}; -Entry.Utils.bindGlobalEvent=function(b){var a=$(document);void 0===b&&(b="resize mousedown mousemove keydown keyup dispose".split(" "));-1Entry.pressedKeys.indexOf(b)&&Entry.pressedKeys.push(b);Entry.keyPressed.notify(a)}));-1$1://$2").replace(/([xA1-xFEa-z0-9_-]+@[xA1-xFEa-z0-9-]+.[a-z0-9-]+)/gi,"$1"):""};Entry.generateHash=function(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).substr(-4)}; -Entry.addEventListener=function(b,a){this.events_||(this.events_={});this.events_[b]||(this.events_[b]=[]);a instanceof Function&&this.events_[b].push(a);return!0};Entry.dispatchEvent=function(b,a){this.events_||(this.events_={});if(this.events_[b])for(var c=0,d=this.events_[b].length;c=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;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.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", -{result:"matrixOut",in:"offOut",type:"matrix",values:"0.7 0 0 0 0 0 0.7 0 0 0 0 0 0.7 0 0 0 0 0 1 0"});d.elem("feBlend",{in:"SourceGraphic",in1:"offOut",mode:"normal"});c=c.elem("filter",{id:"entryBlockHighlightFilter_"+a});c.elem("feOffset",{result:"offOut",in:"SourceGraphic",dx:0,dy:0});c.elem("feColorMatrix",{result:"matrixOut",in:"offOut",type:"matrix",values:"1.3 0 0 0 0 0 1.3 0 0 0 0 0 1.3 0 0 0 0 0 1 0"})}; -Entry.Utils.addBlockPattern=function(b,a){for(var c=b.elem("pattern",{id:"blockHoverPattern_"+a,class:"blockHoverPattern",patternUnits:"userSpaceOnUse",patternTransform:"translate(12, 0)",x:0,y:0,width:125,height:33,style:"display: none"}),d=c.elem("g"),e=d.elem("rect",{x:0,y:0,width:125,height:33}),f=Entry.mediaFilePath+"block_pattern_(order).png",g=1;5>g;g++)d.elem("image",{class:"pattern"+g,href:f.replace("(order)",g),x:0,y:0,width:125,height:33});return{pattern:c,rect:e}}; -Entry.Utils.COLLISION={NONE:0,UP:1,RIGHT:2,LEFT:3,DOWN:4};Entry.Utils.createMouseEvent=function(b,a){var c=document.createEvent("MouseEvent");c.initMouseEvent(b,!0,!0,window,0,0,0,a.clientX,a.clientY,!1,!1,!1,!1,0,null);return c};Entry.Utils.xmlToJsonData=function(b){b=$.parseXML(b);var a=[];b=b.childNodes[0].childNodes;for(var c in b){var d=b[c];if(d.tagName){var e={category:d.getAttribute("id"),blocks:[]},d=d.childNodes;for(c in d){var f=d[c];f.tagName&&(f=f.getAttribute("type"))&&e.blocks.push(f)}a.push(e)}}return a}; -Entry.Utils.stopProjectWithToast=function(b,a,c){var d=b.block;a=a||"\ub7f0\ud0c0\uc784 \uc5d0\ub7ec \ubc1c\uc0dd";Entry.toast&&!c&&Entry.toast.alert(Lang.Msgs.warn,Lang.Workspace.check_runtime_error,!0);Entry.engine&&Entry.engine.toggleStop();"workspace"===Entry.type&&(b.block&&"funcBlock"in b.block?d=b.block.funcBlock:b.funcExecutor&&(d=b.funcExecutor.scope.block,b=b.type.replace("func_",""),Entry.Func.edit(Entry.variableContainer.functions_[b])),d&&(Entry.container.selectObject(d.getCode().object.id, -!0),d.view.getBoard().activateBlock(d)));throw Error(a);};Entry.Utils.AsyncError=function(b){this.name="AsyncError";this.message=b||"\ube44\ub3d9\uae30 \ud638\ucd9c \ub300\uae30"};Entry.Utils.AsyncError.prototype=Error();Entry.Utils.AsyncError.prototype.constructor=Entry.Utils.AsyncError;Entry.Utils.isChrome=function(){return/chrom(e|ium)/.test(navigator.userAgent.toLowerCase())}; -Entry.Utils.waitForWebfonts=function(b,a){for(var c=0,d=0,e=b.length;d=b.length&&(l&&clearInterval(l),c==b.length))return a(),!0}var h=document.createElement("span");h.innerHTML="giItT1WQy@!-/#";h.style.position="absolute";h.style.left="-10000px";h.style.top="-10000px";h.style.fontSize="300px";h.style.fontFamily="sans-serif";h.style.fontVariant="normal";h.style.fontStyle="normal";h.style.fontWeight= -"normal";h.style.letterSpacing="0";document.body.appendChild(h);var k=h.offsetWidth;h.style.fontFamily=d;var l;e()||(l=setInterval(e,50))})(b[d])};window.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(b){window.setTimeout(b,1E3/60)}}(); -Entry.isMobile=function(){if(Entry.device)return"tablet"===Entry.device;var b=window.platform;if(b&&b.type&&("tablet"===b.type||"mobile"===b.type))return Entry.device="tablet",!0;Entry.device="desktop";return!1};Entry.Utils.convertMouseEvent=function(b){return b.originalEvent&&b.originalEvent.touches?b.originalEvent.touches[0]:b};Entry.Utils.convertIntToHex=function(b){return b.toString(16).toUpperCase()};Entry.Model=function(b,a){var c=Entry.Model;c.generateSchema(b);c.generateSetter(b);c.generateObserve(b);(void 0===a||a)&&Object.seal(b);return b}; -(function(b){b.generateSchema=function(a){var b=a.schema;if(void 0!==b){b=JSON.parse(JSON.stringify(b));a.data={};for(var d in b)(function(d){a.data[d]=b[d];Object.defineProperty(a,d,{get:function(){return a.data[d]}})})(d);a._toJSON=this._toJSON}};b.generateSetter=function(a){a.set=this.set};b.set=function(a,b){var d={},e;for(e in this.data)void 0!==a[e]&&(a[e]===this.data[e]?delete a[e]:(d[e]=this.data[e],this.data[e]=a[e]instanceof Array?a[e].concat():a[e]));b||this.notify(Object.keys(a),d)};b.generateObserve= -function(a){a.observers=[];a.observe=this.observe;a.unobserve=this.unobserve;a.notify=this.notify};b.observe=function(a,b,d,e){d=new Entry.Observer(this.observers,a,b,d);if(!1!==e)a[b]([]);return d};b.unobserve=function(a){a.destroy()};b.notify=function(a,b){"string"===typeof a&&(a=[a]);var d=this;d.observers.map(function(e){var f=a;void 0!==e.attrs&&(f=Entry.Utils.intersectArray(e.attrs,a));if(f.length)e.object[e.funcName](f.map(function(a){return{name:a,object:d,oldValue:b[a]}}))})};b._toJSON=function(){var a= -{},b;for(b in this.data)a[b]=this.data[b];return a}})(Entry.Model);Entry.Func=function(b){this.id=b?b.id:Entry.generateHash();this.content=b?new Entry.Code(b.content):new Entry.Code([[{type:"function_create",copyable:!1,deletable:!1,x:40,y:40}]]);this.blockMenuBlock=this.block=null;this.hashMap={};this.paramMap={};var a=function(){};a.prototype=Entry.block.function_general;a=new a;a.changeEvent=new Entry.Event;a.template=Lang.template.function_general;Entry.block["func_"+this.id]=a;if(b){b=this.content._blockMap;for(var c in b)Entry.Func.registerParamBlock(b[c].type); -Entry.Func.generateWsBlock(this)}Entry.Func.registerFunction(this);Entry.Func.updateMenu()};Entry.Func.threads={};Entry.Func.registerFunction=function(b){if(Entry.playground){var a=Entry.playground.mainWorkspace;a&&(this._targetFuncBlock=a.getBlockMenu().getCategoryCodes("func").createThread([{type:"func_"+b.id}]),b.blockMenuBlock=this._targetFuncBlock)}}; -Entry.Func.executeFunction=function(b){var a=this.threads[b];if(a=Entry.Engine.computeThread(a.entity,a))return this.threads[b]=a,!0;delete this.threads[b];return!1};Entry.Func.clearThreads=function(){this.threads={}};Entry.Func.prototype.init=function(b){this.id=b.id;this.content=Blockly.Xml.textToDom(b.content);this.block=Blockly.Xml.textToDom(""+b.block+"").childNodes[0]};Entry.Func.prototype.destroy=function(){this.blockMenuBlock.destroy()}; -Entry.Func.edit=function(b){this.cancelEdit();this.targetFunc=b;this.initEditView(b.content);this.bindFuncChangeEvent();this.updateMenu()};Entry.Func.initEditView=function(b){this.menuCode||this.setupMenuCode();var a=Entry.playground.mainWorkspace;a.setMode(Entry.Workspace.MODE_OVERLAYBOARD);a.changeOverlayBoardCode(b);this._workspaceStateEvent=a.changeEvent.attach(this,this.endEdit)}; -Entry.Func.endEdit=function(b){this.unbindFuncChangeEvent();this._workspaceStateEvent.destroy();delete this._workspaceStateEvent;switch(b){case "save":this.save();case "cancelEdit":this.cancelEdit()}};Entry.Func.save=function(){this.targetFunc.generateBlock(!0);Entry.variableContainer.saveFunction(this.targetFunc)}; -Entry.Func.syncFuncName=function(b){var a=0,c=[],c=b.split(" "),d="";b=[];b=Blockly.mainWorkspace.getAllBlocks();for(var e=0;eBlockly.Block.dragMode_&&(b.updateMenu(),b.fieldText=a,b.workspaceLength=c)}}; -Entry.Func.setupMenuCode=function(){var b=Entry.playground.mainWorkspace;b&&(b=b.getBlockMenu().getCategoryCodes("func"),this._fieldLabel=b.createThread([{type:"function_field_label"}]).getFirstBlock(),this._fieldString=b.createThread([{type:"function_field_string",params:[{type:this.requestParamBlock("string")}]}]).getFirstBlock(),this._fieldBoolean=b.createThread([{type:"function_field_boolean",params:[{type:this.requestParamBlock("boolean")}]}]).getFirstBlock(),this.menuCode=b)}; -Entry.Func.refreshMenuCode=function(){if(Entry.playground.mainWorkspace){this.menuCode||this.setupMenuCode();var b=Entry.block[this._fieldString.params[0].type].changeEvent._listeners.length;2'));this._hwModule=b;var a=this;Entry.addEventListener("windowResized",function(){var b=a._hwModule.monitorTemplate.mode;"both"==b&&(a.resize(),a.resizeList());"list"==b?a.resizeList():a.resize()});Entry.addEventListener("hwModeChange",function(){a.changeMode()});this.changeOffset=0;this.scale=.5;this._listPortViews={}}; -(function(b){b.initView=function(){this.svgDom=Entry.Dom($(''))};b.generateView=function(){this.snap=Entry.SVG("hwMonitor");this._svgGroup=this.snap.elem("g");this._portMap={n:[],e:[],s:[],w:[]};var a=this._hwModule.monitorTemplate,b={href:Entry.mediaFilePath+a.imgPath,x:-a.width/2,y:-a.height/2,width:a.width,height:a.height};this._portViews={};this.hwView=this._svgGroup.elem("image");this.hwView= -this.hwView.attr(b);this._template=a;a=a.ports;this.pathGroup=null;this.pathGroup=this._svgGroup.elem("g");var b=[],d;for(d in a){var e=this.generatePortView(a[d],"_svgGroup");this._portViews[d]=e;b.push(e)}b.sort(function(a,b){return a.box.x-b.box.x});var f=this._portMap;b.map(function(a){(1>(Math.atan2(-a.box.y,a.box.x)/Math.PI+2)%2?f.n:f.s).push(a)});this.resize()};b.toggleMode=function(a){var b=this._hwModule.monitorTemplate;"list"==a?(b.TempPort=null,this._hwModule.monitorTemplate.ports&&(this._hwModule.monitorTemplate.TempPort= -this._hwModule.monitorTemplate.ports,this._hwModule.monitorTemplate.listPorts=this.addPortEle(this._hwModule.monitorTemplate.listPorts,this._hwModule.monitorTemplate.ports)),$(this._svglistGroup).remove(),this._svgGroup&&$(this._svgGroup).remove(),$(this._pathGroup).remove(),this._hwModule.monitorTemplate.mode="list",this.generateListView()):(this._hwModule.monitorTemplate.TempPort&&(this._hwModule.monitorTemplate.ports=this._hwModule.monitorTemplate.TempPort,this._hwModule.monitorTemplate.listPorts= -this.removePortEle(this._hwModule.monitorTemplate.listPorts,this._hwModule.monitorTemplate.ports)),$(this._svglistGroup).remove(),this._hwModule.monitorTemplate.mode="both",this.generateListView(),this.generateView())};b.setHwmonitor=function(a){this._hwmodule=a};b.changeMode=function(a){"both"==this._hwModule.monitorTemplate.mode?this.toggleMode("list"):"list"==this._hwModule.monitorTemplate.mode&&this.toggleMode("both")};b.addPortEle=function(a,b){if("object"!=typeof b)return a;for(var d in b)a[d]= -b[d];return a};b.removePortEle=function(a,b){if("object"!=typeof b)return a;for(var d in b)delete a[d];return a};b.generateListView=function(){this._portMapList={n:[]};this._svglistGroup=null;this.listsnap=Entry.SVG("hwMonitor");this._svglistGroup=this.listsnap.elem("g");var a=this._hwModule.monitorTemplate;this._template=a;a=a.listPorts;this.pathGroup=this._svglistGroup.elem("g");var b=[],d;for(d in a){var e=this.generatePortView(a[d],"_svglistGroup");this._listPortViews[d]=e;b.push(e)}var f=this._portMapList; -b.map(function(a){f.n.push(a)});this.resizeList()};b.generatePortView=function(a,b){var d=this[b].elem("g");d.addClass("hwComponent");var e=null,e=this.pathGroup.elem("path").attr({d:"m0,0",fill:"none",stroke:"input"===a.type?"#00979d":"#A751E3","stroke-width":3}),f=d.elem("rect").attr({x:0,y:0,width:150,height:22,rx:4,ry:4,fill:"#fff",stroke:"#a0a1a1"}),g=d.elem("text").attr({x:4,y:12,fill:"#000","class":"hwComponentName","alignment-baseline":"central"});g.textContent=a.name;g=g.getComputedTextLength(); -d.elem("rect").attr({x:g+8,y:2,width:30,height:18,rx:9,ry:9,fill:"input"===a.type?"#00979d":"#A751E3"});var h=d.elem("text").attr({x:g+13,y:12,fill:"#fff","class":"hwComponentValue","alignment-baseline":"central"});h.textContent=0;g+=40;f.attr({width:g});return{group:d,value:h,type:a.type,path:e,box:{x:a.pos.x-this._template.width/2,y:a.pos.y-this._template.height/2,width:g},width:g}};b.getView=function(){return this.svgDom};b.update=function(){var a=Entry.hw.portData,b=Entry.hw.sendQueue,d=this._hwModule.monitorTemplate.mode, -e=this._hwModule.monitorTemplate.keys||[],f=[];if("list"==d)f=this._listPortViews;else if("both"==d){if(f=this._listPortViews,this._portViews)for(var g in this._portViews)f[g]=this._portViews[g]}else f=this._portViews;if(b)for(g in b)0!=b[g]&&f[g]&&(f[g].type="output");for(var h in f)if(d=f[h],"input"==d.type){var k=a[h];0=this._template.height||0>=a.height||(this.scale=a.height/this._template.height* -this._template.height/1E3,this.align())};b.resizeList=function(){var a=this.svgDom.get(0).getBoundingClientRect();this._svglistGroup.attr({transform:"translate("+a.width/2+","+a.height/2+")"});this._rect=a;this.alignList()};b.align=function(){var a=[],a=this._portMap.s.concat();this._alignNS(a,this.scale/3*this._template.height+5,27);a=this._portMap.n.concat();this._alignNS(a,-this._template.height*this.scale/3-32,-27);a=this._portMap.e.concat();this._alignEW(a,-this._template.width*this.scale/3- -5,-27);a=this._portMap.w.concat();this._alignEW(a,this._template.width*this.scale/3-32,-27)};b.alignList=function(){for(var a={},a=this._hwModule.monitorTemplate.listPorts,b=a.length,d=0;dd-(l.width+n.width/2.2)&&(f+=1,initX=h,g=0)};b._movePort=function(a,b,d,e){var f=b,g=a.box.x*this.scale,h=a.box.y*this.scale; -b>e?(f=b-a.width,b=b>g&&g>e?"M"+g+","+d+"L"+g+","+h:"M"+(b+e)/2+","+d+"l0,"+(h>d?28:-3)+"H"+g+"L"+g+","+h):b=bd?28:-3)+"H"+g+"L"+g+","+h;a.group.attr({transform:"translate("+f+","+d+")"});a.path.attr({d:b})}})(Entry.HWMonitor.prototype);Entry.HW=function(){this.connectTrial=0;this.isFirstConnect=!0;this.initSocket();this.connected=!1;this.portData={};this.sendQueue={};this.outputQueue={};this.settingQueue={};this.socketType=this.hwModule=this.selectedDevice=null;Entry.addEventListener("stop",this.setZero);this.hwInfo={"1.1":Entry.Arduino,"1.9":Entry.ArduinoExt,"1.2":Entry.SensorBoard,"1.3":Entry.CODEino,"1.4":Entry.joystick,"1.5":Entry.dplay,"1.6":Entry.nemoino,"1.7":Entry.Xbot,"1.8":Entry.ardublock,"2.4":Entry.Hamster,"2.5":Entry.Albert, -"3.1":Entry.Bitbrick,"4.2":Entry.Arduino,"5.1":Entry.Neobot,"7.1":Entry.Robotis_carCont,"7.2":Entry.Robotis_openCM70,"8.1":Entry.Arduino}};Entry.HW.TRIAL_LIMIT=1;p=Entry.HW.prototype; -p.initSocket=function(){try{if(this.connectTrial>=Entry.HW.TRIAL_LIMIT)this.isFirstConnect||Entry.toast.alert(Lang.Menus.connect_hw,Lang.Menus.connect_fail,!1),this.isFirstConnect=!1;else{var b=this,a,c;this.connected=!1;this.connectTrial++;if(-1this.offsetX?0:a+c.maxWidth+10>this.offsetX?this.offsetX-a:c.maxWidth+10))}});this.valueSetter_.on("pressup",function(a){c.isAdjusting=!1});this.view_.addChild(this.valueSetter_); -a=Entry.variableContainer.variables_.length;this.getX()&&this.getY()?(this.setX(this.getX()),this.setY(this.getY())):(this.setX(-230+80*Math.floor(a/11)),this.setY(24*b+20-135-264*Math.floor(a/11)))}else this.view_=new createjs.Container,this.rect_=new createjs.Shape,this.view_.addChild(this.rect_),this.view_.variable=this,this.titleView_=new createjs.Text("asdf",this.FONT,"#000"),this.titleView_.textBaseline="alphabetic",this.titleView_.textAlign="center",this.titleView_.width=this.width_-2*this.BORDER, -this.titleView_.y=this.BORDER+10,this.titleView_.x=this.width_/2,this.view_.addChild(this.titleView_),this.resizeHandle_=new createjs.Shape,this.resizeHandle_.graphics.f("#1bafea").ss(1,0,0).s("#1bafea").lt(0,-9).lt(-9,0).lt(0,0),this.view_.addChild(this.resizeHandle_),this.resizeHandle_.list=this,this.resizeHandle_.on("mouseover",function(a){this.cursor="nwse-resize"}),this.resizeHandle_.on("mousedown",function(a){this.list.isResizing=!0;this.offset={x:.75*a.stageX-this.list.getWidth(),y:.75*a.stageY- -this.list.getHeight()};this.parent.cursor="nwse-resize"}),this.resizeHandle_.on("pressmove",function(a){this.list.setWidth(.75*a.stageX-this.offset.x);this.list.setHeight(.75*a.stageY-this.offset.y);this.list.updateView()}),this.view_.on("mouseover",function(a){this.cursor="move"}),this.view_.on("mousedown",function(a){"workspace"!=Entry.type||this.variable.isResizing||(this.offset={x:this.x-(.75*a.stageX-240),y:this.y-(.75*a.stageY-135)},this.cursor="move")}),this.view_.on("pressup",function(a){this.cursor= -"initial";this.variable.isResizing=!1}),this.view_.on("pressmove",function(a){"workspace"!=Entry.type||this.variable.isResizing||(this.variable.setX(.75*a.stageX-240+this.offset.x),this.variable.setY(.75*a.stageY-135+this.offset.y),this.variable.updateView())}),this.elementView=new createjs.Container,a=new createjs.Text("asdf",this.FONT,"#000"),a.textBaseline="middle",a.y=5,this.elementView.addChild(a),this.elementView.indexView=a,a=new createjs.Shape,this.elementView.addChild(a),this.elementView.valueWrapper= -a,a=new createjs.Text("fdsa",this.FONT,"#eee"),a.x=24,a.y=6,a.textBaseline="middle",this.elementView.addChild(a),this.elementView.valueView=a,this.elementView.x=this.BORDER,this.scrollButton_=new createjs.Shape,this.scrollButton_.graphics.f("#aaa").rr(0,0,7,30,3.5),this.view_.addChild(this.scrollButton_),this.scrollButton_.y=23,this.scrollButton_.list=this,this.scrollButton_.on("mousedown",function(a){this.list.isResizing=!0;this.cursor="pointer";this.offsetY=isNaN(this.offsetY)||0>this.offsetY?a.rawY/ -2:this.offsetY}),this.scrollButton_.on("pressmove",function(a){void 0===this.moveAmount?(this.y=a.target.y,this.moveAmount=!0):this.y=a.rawY/2-this.offsetY+this.list.height_/100*23;23>this.y&&(this.y=23);this.y>this.list.getHeight()-40&&(this.y=this.list.getHeight()-40);this.list.updateView()}),this.scrollButton_.on("pressup",function(a){this.moveAmount=void 0}),this.getX()&&this.getY()?(this.setX(this.getX()),this.setY(this.getY())):(a=Entry.variableContainer.lists_.length,this.setX(110*-Math.floor(a/ -6)+120),this.setY(24*b+20-135-145*Math.floor(a/6)));this.setVisible(this.isVisible());this.updateView();Entry.stage.loadVariable(this)}; -Entry.Variable.prototype.updateView=function(){if(this.view_){if(this.isVisible())if("variable"==this.type){this.view_.x=this.getX();this.view_.y=this.getY();if(this.object_){var b=Entry.container.getObject(this.object_);this.textView_.text=b?b.name+":"+this.getName():this.getName()}else this.textView_.text=this.getName();null===this._nameWidth&&(this._nameWidth=this.textView_.getMeasuredWidth());this.valueView_.x=this._nameWidth+14;this.valueView_.y=1;this.isNumber()?this.valueView_.text=this.getValue().toFixed(2).replace(".00", -""):this.valueView_.text=this.getValue();null===this._valueWidth&&(this._valueWidth=this.valueView_.getMeasuredWidth());this.rect_.graphics.clear().f("#ffffff").ss(1,2,0).s("#A0A1A1").rc(0,-14,this._nameWidth+this._valueWidth+26,20,4,4,4,4);this.wrapper_.graphics.clear().f("#1bafea").ss(1,2,0).s("#1bafea").rc(this._nameWidth+7,-11,this._valueWidth+15,14,7,7,7,7)}else if("slide"==this.type)this.view_.x=this.getX(),this.view_.y=this.getY(),this.object_?(b=Entry.container.getObject(this.object_),this.textView_.text= -b?b.name+":"+this.getName():this.getName()):this.textView_.text=this.getName(),null===this._nameWidth&&(this._nameWidth=this.textView_.getMeasuredWidth()),this.valueView_.x=this._nameWidth+14,this.valueView_.y=1,this.isNumber()?this.valueView_.text=this.getValue().toFixed(2).replace(".00",""):this.valueView_.text=this.getValue(),null===this._valueWidth&&(this._valueWidth=this.valueView_.getMeasuredWidth()),b=this._nameWidth+this._valueWidth+26,b=Math.max(b,90),this.rect_.graphics.clear().f("#ffffff").ss(1, -2,0).s("#A0A1A1").rc(0,-14,b,33,4,4,4,4),this.wrapper_.graphics.clear().f("#1bafea").ss(1,2,0).s("#1bafea").rc(this._nameWidth+7,-11,this._valueWidth+15,14,7,7,7,7),b=this._nameWidth+this._valueWidth+26,b=Math.max(b,90),this.maxWidth=b-20,this.slideBar_.graphics.clear().beginFill("#A0A1A1").s("#A0A1A1").ss(1).dr(10,10,this.maxWidth,1.5),b=this.getSlidePosition(this.maxWidth),this.valueSetter_.graphics.clear().beginFill("#1bafea").s("#A0A1A1").ss(1).dc(b,10.5,3);else if("list"==this.type){this.view_.x= -this.getX();this.view_.y=this.getY();this.resizeHandle_.x=this.width_-2;this.resizeHandle_.y=this.height_-2;var a=this.getName();this.object_&&(b=Entry.container.getObject(this.object_))&&(a=b.name+":"+a);a=7this.getHeight()-40&&(this.scrollButton_.y=this.getHeight()-40),this.elementView.valueWrapper.graphics.clear().f("#1bafea").rr(20,-2,this.getWidth()-20-10-2*this.BORDER,17,2),this.scrollButton_.visible=!0,this.scrollButton_.x=this.getWidth()-12,this.scrollPosition=Math.floor((this.scrollButton_.y-23)/(this.getHeight()-23-40)*(this.array_.length-b))):(this.elementView.valueWrapper.graphics.clear().f("#1bafea").rr(20,-2,this.getWidth()-20-2*this.BORDER, -17,2),this.scrollButton_.visible=!1,this.scrollPosition=0);for(a=this.scrollPosition;ac.length?c+"..":c;this.elementView.valueView.text=c;c=this.elementView.clone(!0);c.y=20*(a-this.scrollPosition)+23;this.view_.addChild(c)}}else"answer"==this.type?(this.view_.x=this.getX(),this.view_.y= +Entry.Stage.prototype.initObjectContainers=function(){var a=Entry.scene.scenes_;if(a&&0!==a.length){for(var b=0;bd.style.opacity&&(clearInterval(b),d.style.display="none",Entry.removeElement(d));d.style.opacity*=.9},20)},1E3)}; +Entry.Toast.prototype.success=function(a,b,c){var d=Entry.createElement("div","entryToast");d.addClass("entryToast");d.addClass("entryToastSuccess");d.bindOnClick(function(){Entry.toast.body_.removeChild(this)});var e=Entry.createElement("div","entryToast");e.addClass("entryToastTitle");e.innerHTML=a;d.appendChild(e);a=Entry.createElement("p","entryToast");a.addClass("entryToastMessage");a.innerHTML=b;d.appendChild(a);this.toasts_.push(d);this.body_.appendChild(d);c||window.setTimeout(function(){d.style.opacity= +1;var b=setInterval(function(){.05>d.style.opacity&&(clearInterval(b),d.style.display="none",Entry.removeElement(d));d.style.opacity*=.9},20)},1E3)}; +Entry.Toast.prototype.alert=function(a,b,c){var d=Entry.createElement("div","entryToast");d.addClass("entryToast");d.addClass("entryToastAlert");d.bindOnClick(function(){Entry.toast.body_.removeChild(this)});var e=Entry.createElement("div","entryToast");e.addClass("entryToastTitle");e.innerHTML=a;d.appendChild(e);a=Entry.createElement("p","entryToast");a.addClass("entryToastMessage");a.innerHTML=b;d.appendChild(a);this.toasts_.push(d);this.body_.appendChild(d);c||window.setTimeout(function(){d.style.opacity= +1;var b=setInterval(function(){.05>d.style.opacity&&(clearInterval(b),d.style.display="none",Entry.toast.body_.removeChild(d));d.style.opacity*=.9},20)},5E3)};Entry.TvCast=function(a){this.generateView(a)};p=Entry.TvCast.prototype;p.init=function(a){this.tvCastHash=a};p.generateView=function(a){var b=Entry.createElement("div");b.addClass("entryContainerMovieWorkspace");b.addClass("entryRemove");this.movieContainer=b;b=Entry.createElement("iframe");b.setAttribute("id","tvCastIframe");b.setAttribute("allowfullscreen","");b.setAttribute("frameborder",0);b.setAttribute("src",a);this.movieFrame=b;this.movieContainer.appendChild(this.movieFrame)};p.getView=function(){return this.movieContainer}; +p.resize=function(){document.getElementById("entryContainerWorkspaceId");var a=document.getElementById("tvCastIframe");w=this.movieContainer.offsetWidth;a.width=w+"px";a.height=9*w/16+"px"};Entry.ContextMenu={}; +(function(a){a.visible=!1;a.createDom=function(){this.dom=Entry.Dom("ul",{id:"entry-contextmenu",parent:$("body")});this.dom.bind("mousedown touchstart",function(b){b.stopPropagation()});Entry.Utils.disableContextmenu(this.dom);Entry.documentMousedown.attach(this,function(){this.hide()})};a.show=function(b,a,d){this.dom||this.createDom();if(0!==b.length){var e=this;void 0!==a&&(this._className=a,this.dom.addClass(a));var f=this.dom;f.empty();for(var g=0,h=b.length;gg&&(b.x-=d+3);b.y+e>f&& +(b.y-=e);a.css({left:b.x,top:b.y})};a.hide=function(){this.visible=!1;this.dom.empty();this.dom.addClass("entryRemove");this._className&&(this.dom.removeClass(this._className),delete this._className)}})(Entry.ContextMenu);Entry.Loader={queueCount:0,totalCount:0};Entry.Loader.addQueue=function(a){this.queueCount||Entry.dispatchEvent("loadStart");this.queueCount++;this.totalCount++};Entry.Loader.removeQueue=function(a){this.queueCount--;this.queueCount||(Entry.dispatchEvent("loadComplete"),this.totalCount=0)};Entry.Loader.getLoadedPercent=function(){return 0===this.totalCount?1:this.queueCount/this.totalCount};Entry.Variable=function(a){Entry.assert("string"==typeof a.name,"Variable name must be given");this.name_=a.name;this.id_=a.id?a.id:Entry.generateHash();this.type=a.variableType?a.variableType:"variable";this.object_=a.object||null;this.isCloud_=a.isCloud||!1;this._valueWidth=this._nameWidth=null;var b=Entry.parseNumber(a.value);this.value_="number"==typeof b?b:a.value?a.value:0;"slide"==this.type?(this.setMinValue(a.minValue),this.setMaxValue(a.maxValue)):"list"==this.type&&(this.array_=a.array? +a.array:[]);a.isClone||(this.visible_=a.visible||"boolean"==typeof a.visible?a.visible:!0,this.x_=a.x?a.x:null,this.y_=a.y?a.y:null,"list"==this.type&&(this.width_=a.width?a.width:100,this.height_=a.height?a.height:120,this.scrollPosition=0),this.BORDER=6,this.FONT="10pt NanumGothic")}; +Entry.Variable.prototype.generateView=function(a){var b=this.type;if("variable"==b||"timer"==b||"answer"==b)this.view_=new createjs.Container,this.rect_=new createjs.Shape,this.view_.addChild(this.rect_),this.view_.variable=this,this.wrapper_=new createjs.Shape,this.view_.addChild(this.wrapper_),this.textView_=new createjs.Text("asdf",this.FONT,"#000000"),this.textView_.textBaseline="alphabetic",this.textView_.x=4,this.textView_.y=1,this.view_.addChild(this.textView_),this.valueView_=new createjs.Text("asdf", +"10pt NanumGothic","#ffffff"),this.valueView_.textBaseline="alphabetic",b=Entry.variableContainer.variables_.length,this.getX()&&this.getY()?(this.setX(this.getX()),this.setY(this.getY())):(this.setX(-230+80*Math.floor(b/11)),this.setY(24*a+20-135-264*Math.floor(b/11))),this.view_.visible=this.visible_,this.view_.addChild(this.valueView_),this.view_.on("mousedown",function(b){"workspace"==Entry.type&&(this.offset={x:this.x-(.75*b.stageX-240),y:this.y-(.75*b.stageY-135)},this.cursor="move")}),this.view_.on("pressmove", +function(b){"workspace"==Entry.type&&(this.variable.setX(.75*b.stageX-240+this.offset.x),this.variable.setY(.75*b.stageY-135+this.offset.y),this.variable.updateView())});else if("slide"==b){var c=this;this.view_=new createjs.Container;this.rect_=new createjs.Shape;this.view_.addChild(this.rect_);this.view_.variable=this;this.wrapper_=new createjs.Shape;this.view_.addChild(this.wrapper_);this.textView_=new createjs.Text("name",this.FONT,"#000000");this.textView_.textBaseline="alphabetic";this.textView_.x= +4;this.textView_.y=1;this.view_.addChild(this.textView_);this.valueView_=new createjs.Text("value","10pt NanumGothic","#ffffff");this.valueView_.textBaseline="alphabetic";this.view_.on("mousedown",function(b){"workspace"==Entry.type&&(this.offset={x:this.x-(.75*b.stageX-240),y:this.y-(.75*b.stageY-135)})});this.view_.on("pressmove",function(b){"workspace"!=Entry.type||c.isAdjusting||(this.variable.setX(.75*b.stageX-240+this.offset.x),this.variable.setY(.75*b.stageY-135+this.offset.y),this.variable.updateView())}); +this.view_.visible=this.visible_;this.view_.addChild(this.valueView_);b=this.textView_.getMeasuredWidth()+this.valueView_.getMeasuredWidth()+26;b=Math.max(b,90);this.maxWidth=b-20;this.slideBar_=new createjs.Shape;this.slideBar_.graphics.beginFill("#A0A1A1").s("#A0A1A1").ss(1).dr(10,10,this.maxWidth,1.5);this.view_.addChild(this.slideBar_);b=this.getSlidePosition(this.maxWidth);this.valueSetter_=new createjs.Shape;this.valueSetter_.graphics.beginFill("#1bafea").s("#A0A1A1").ss(1).dc(b,10.5,3);this.valueSetter_.cursor= +"pointer";this.valueSetter_.on("mousedown",function(b){Entry.engine.isState("run")&&(c.isAdjusting=!0,this.offsetX=-(this.x-.75*b.stageX+240))});this.valueSetter_.on("pressmove",function(b){if(Entry.engine.isState("run")){var a=this.offsetX;this.offsetX=-(this.x-.75*b.stageX+240);a!==this.offsetX&&(b=c.getX(),c.setSlideCommandX(b+10>this.offsetX?0:b+c.maxWidth+10>this.offsetX?this.offsetX-b:c.maxWidth+10))}});this.valueSetter_.on("pressup",function(b){c.isAdjusting=!1});this.view_.addChild(this.valueSetter_); +b=Entry.variableContainer.variables_.length;this.getX()&&this.getY()?(this.setX(this.getX()),this.setY(this.getY())):(this.setX(-230+80*Math.floor(b/11)),this.setY(24*a+20-135-264*Math.floor(b/11)))}else this.view_=new createjs.Container,this.rect_=new createjs.Shape,this.view_.addChild(this.rect_),this.view_.variable=this,this.titleView_=new createjs.Text("asdf",this.FONT,"#000"),this.titleView_.textBaseline="alphabetic",this.titleView_.textAlign="center",this.titleView_.width=this.width_-2*this.BORDER, +this.titleView_.y=this.BORDER+10,this.titleView_.x=this.width_/2,this.view_.addChild(this.titleView_),this.resizeHandle_=new createjs.Shape,this.resizeHandle_.graphics.f("#1bafea").ss(1,0,0).s("#1bafea").lt(0,-9).lt(-9,0).lt(0,0),this.view_.addChild(this.resizeHandle_),this.resizeHandle_.list=this,this.resizeHandle_.on("mouseover",function(b){this.cursor="nwse-resize"}),this.resizeHandle_.on("mousedown",function(b){this.list.isResizing=!0;this.offset={x:.75*b.stageX-this.list.getWidth(),y:.75*b.stageY- +this.list.getHeight()};this.parent.cursor="nwse-resize"}),this.resizeHandle_.on("pressmove",function(b){this.list.setWidth(.75*b.stageX-this.offset.x);this.list.setHeight(.75*b.stageY-this.offset.y);this.list.updateView()}),this.view_.on("mouseover",function(b){this.cursor="move"}),this.view_.on("mousedown",function(b){"workspace"!=Entry.type||this.variable.isResizing||(this.offset={x:this.x-(.75*b.stageX-240),y:this.y-(.75*b.stageY-135)},this.cursor="move")}),this.view_.on("pressup",function(b){this.cursor= +"initial";this.variable.isResizing=!1}),this.view_.on("pressmove",function(b){"workspace"!=Entry.type||this.variable.isResizing||(this.variable.setX(.75*b.stageX-240+this.offset.x),this.variable.setY(.75*b.stageY-135+this.offset.y),this.variable.updateView())}),this.elementView=new createjs.Container,b=new createjs.Text("asdf",this.FONT,"#000"),b.textBaseline="middle",b.y=5,this.elementView.addChild(b),this.elementView.indexView=b,b=new createjs.Shape,this.elementView.addChild(b),this.elementView.valueWrapper= +b,b=new createjs.Text("fdsa",this.FONT,"#eee"),b.x=24,b.y=6,b.textBaseline="middle",this.elementView.addChild(b),this.elementView.valueView=b,this.elementView.x=this.BORDER,this.scrollButton_=new createjs.Shape,this.scrollButton_.graphics.f("#aaa").rr(0,0,7,30,3.5),this.view_.addChild(this.scrollButton_),this.scrollButton_.y=23,this.scrollButton_.list=this,this.scrollButton_.on("mousedown",function(b){this.list.isResizing=!0;this.cursor="pointer";this.offsetY=isNaN(this.offsetY)||0>this.offsetY?b.rawY/ +2:this.offsetY}),this.scrollButton_.on("pressmove",function(b){void 0===this.moveAmount?(this.y=b.target.y,this.moveAmount=!0):this.y=b.rawY/2-this.offsetY+this.list.height_/100*23;23>this.y&&(this.y=23);this.y>this.list.getHeight()-40&&(this.y=this.list.getHeight()-40);this.list.updateView()}),this.scrollButton_.on("pressup",function(b){this.moveAmount=void 0}),this.getX()&&this.getY()?(this.setX(this.getX()),this.setY(this.getY())):(b=Entry.variableContainer.lists_.length,this.setX(110*-Math.floor(b/ +6)+120),this.setY(24*a+20-135-145*Math.floor(b/6)));this.setVisible(this.isVisible());this.updateView();Entry.stage.loadVariable(this)}; +Entry.Variable.prototype.updateView=function(){if(this.view_){if(this.isVisible())if("variable"==this.type){this.view_.x=this.getX();this.view_.y=this.getY();if(this.object_){var a=Entry.container.getObject(this.object_);this.textView_.text=a?a.name+":"+this.getName():this.getName()}else this.textView_.text=this.getName();null===this._nameWidth&&(this._nameWidth=this.textView_.getMeasuredWidth());this.valueView_.x=this._nameWidth+14;this.valueView_.y=1;this.isNumber()?this.valueView_.text=this.getValue().toFixed(2).replace(".00", +""):this.valueView_.text=this.getValue();null===this._valueWidth&&(this._valueWidth=this.valueView_.getMeasuredWidth());this.rect_.graphics.clear().f("#ffffff").ss(1,2,0).s("#A0A1A1").rc(0,-14,this._nameWidth+this._valueWidth+26,20,4,4,4,4);this.wrapper_.graphics.clear().f("#1bafea").ss(1,2,0).s("#1bafea").rc(this._nameWidth+7,-11,this._valueWidth+15,14,7,7,7,7)}else if("slide"==this.type)this.view_.x=this.getX(),this.view_.y=this.getY(),this.object_?(a=Entry.container.getObject(this.object_),this.textView_.text= +a?a.name+":"+this.getName():this.getName()):this.textView_.text=this.getName(),null===this._nameWidth&&(this._nameWidth=this.textView_.getMeasuredWidth()),this.valueView_.x=this._nameWidth+14,this.valueView_.y=1,this.isNumber()?this.valueView_.text=this.getValue().toFixed(2).replace(".00",""):this.valueView_.text=this.getValue(),null===this._valueWidth&&(this._valueWidth=this.valueView_.getMeasuredWidth()),a=this._nameWidth+this._valueWidth+26,a=Math.max(a,90),this.rect_.graphics.clear().f("#ffffff").ss(1, +2,0).s("#A0A1A1").rc(0,-14,a,33,4,4,4,4),this.wrapper_.graphics.clear().f("#1bafea").ss(1,2,0).s("#1bafea").rc(this._nameWidth+7,-11,this._valueWidth+15,14,7,7,7,7),a=this._nameWidth+this._valueWidth+26,a=Math.max(a,90),this.maxWidth=a-20,this.slideBar_.graphics.clear().beginFill("#A0A1A1").s("#A0A1A1").ss(1).dr(10,10,this.maxWidth,1.5),a=this.getSlidePosition(this.maxWidth),this.valueSetter_.graphics.clear().beginFill("#1bafea").s("#A0A1A1").ss(1).dc(a,10.5,3);else if("list"==this.type){this.view_.x= +this.getX();this.view_.y=this.getY();this.resizeHandle_.x=this.width_-2;this.resizeHandle_.y=this.height_-2;var b=this.getName();this.object_&&(a=Entry.container.getObject(this.object_))&&(b=a.name+":"+b);b=7this.getHeight()-40&&(this.scrollButton_.y=this.getHeight()-40),this.elementView.valueWrapper.graphics.clear().f("#1bafea").rr(20,-2,this.getWidth()-20-10-2*this.BORDER,17,2),this.scrollButton_.visible=!0,this.scrollButton_.x=this.getWidth()-12,this.scrollPosition=Math.floor((this.scrollButton_.y-23)/(this.getHeight()-23-40)*(this.array_.length-a))):(this.elementView.valueWrapper.graphics.clear().f("#1bafea").rr(20,-2,this.getWidth()-20-2*this.BORDER, +17,2),this.scrollButton_.visible=!1,this.scrollPosition=0);for(b=this.scrollPosition;bc.length?c+"..":c;this.elementView.valueView.text=c;c=this.elementView.clone(!0);c.y=20*(b-this.scrollPosition)+23;this.view_.addChild(c)}}else"answer"==this.type?(this.view_.x=this.getX(),this.view_.y= this.getY(),this.textView_.text=this.getName(),this.valueView_.y=1,this.isNumber()?parseInt(this.getValue(),10)==this.getValue()?this.valueView_.text=this.getValue():this.valueView_.text=this.getValue().toFixed(1).replace(".00",""):this.valueView_.text=this.getValue(),null===this._nameWidth&&(this._nameWidth=this.textView_.getMeasuredWidth()),null===this._valueWidth&&(this._valueWidth=this.valueView_.getMeasuredWidth()),this.valueView_.x=this._nameWidth+14,this.rect_.graphics.clear().f("#ffffff").ss(1, 2,0).s("#A0A1A1").rc(0,-14,this._nameWidth+this._valueWidth+26,20,4,4,4,4),this.wrapper_.graphics.clear().f("#E457DC").ss(1,2,0).s("#E457DC").rc(this._nameWidth+7,-11,this._valueWidth+15,14,7,7,7,7)):(this.view_.x=this.getX(),this.view_.y=this.getY(),this.textView_.text=this.getName(),null===this._nameWidth&&(this._nameWidth=this.textView_.getMeasuredWidth()),this.valueView_.x=this._nameWidth+14,this.valueView_.y=1,this.isNumber()?this.valueView_.text=this.getValue().toFixed(1).replace(".00",""): this.valueView_.text=this.getValue(),null===this._valueWidth&&(this._valueWidth=this.valueView_.getMeasuredWidth()),this.rect_.graphics.clear().f("#ffffff").ss(1,2,0).s("#A0A1A1").rc(0,-14,this._nameWidth+this._valueWidth+26,20,4,4,4,4),this.wrapper_.graphics.clear().f("#ffbb14").ss(1,2,0).s("orange").rc(this._nameWidth+7,-11,this._valueWidth+15,14,7,7,7,7));Entry.requestUpdate=!0}};Entry.Variable.prototype.getName=function(){return this.name_}; -Entry.Variable.prototype.setName=function(b){Entry.assert("string"==typeof b,"Variable name must be string");this.name_=b;this._nameWidth=null;this.updateView();Entry.requestUpdateTwice=!0};Entry.Variable.prototype.getId=function(){return this.id_};Entry.Variable.prototype.getValue=function(){return this.isNumber()?Number(this.value_):this.value_};Entry.Variable.prototype.isNumber=function(){return isNaN(this.value_)?!1:!0}; -Entry.Variable.prototype.setValue=function(b){"slide"!=this.type?this.value_=b:(b=Number(b),this.value_=bthis.maxValue_?this.maxValue_:b);this.isCloud_&&Entry.variableContainer.updateCloudVariables();this._valueWidth=null;this.updateView();Entry.requestUpdateTwice=!0};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!==b&&(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.setMinValue=function(b){this.minValue_=b=b||0;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; -var c=b.view.name.value.trim();b.isOpen?c&&0!==c.length?a.addVariable():(b.view.addClass("entryRemove"),b.isOpen=!1):(b.view.removeClass("entryRemove"),b.view.name.focus(),b.isOpen=!0)});this.generateVariableAddView();this.generateListAddView();this.generateVariableSplitterView();this.generateVariableSettingView();this.generateListSettingView();c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.message_create; -this.messageAddButton_=c;c.bindOnClick(function(b){a.addMessage({name:Lang.Workspace.message+" "+(a.messages_.length+1)})});c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.list_create;this.listAddButton_=c;c.bindOnClick(function(b){b=f.listAddPanel;var c=b.view.name.value.trim();b.isOpen?c&&0!==c.length?a.addList():(b.view.addClass("entryRemove"),b.isOpen=!1):(b.view.removeClass("entryRemove"),b.view.name.focus(), -b.isOpen=!0)});c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.function_add;this.functionAddButton_=c;c.bindOnClick(function(b){b=a._getBlockMenu();Entry.playground.changeViewMode("code");"func"!=b.lastSelector&&b.selectMenu("func");a.createFunction()});return b}; -Entry.VariableContainer.prototype.createSelectButton=function(b,a){var c=this;void 0===a&&(a=!0);var d=Entry.createElement("td");d.addClass("entryVariableSelectButtonWorkspace",b);d.innerHTML=Lang.Workspace[b];a?d.bindOnClick(function(a){c.selectFilter(b);this.addClass("selected")}):d.addClass("disable");return d}; -Entry.VariableContainer.prototype.selectFilter=function(b){for(var a=this.view_.getElementsByTagName("td"),c=0;cb.x_&&a.xe?!0:!1}; -Entry.VariableContainer.prototype.getListById=function(b){var a=this.lists_,c=[];if(0this._maxNameLength&&(b=this._truncName(b,"variable"));b=this.checkAllVariableName(b,"variables_")?Entry.getOrderedName(b,this.variables_,"name_"):b;var c=a.info;b={name:b,isCloud:c.isCloud,object:c.object,variableType:"variable"};a.view.addClass("entryRemove");this.resetVariableAddPanel("variable")}b=new Entry.Variable(b);Entry.stateManager&& -Entry.stateManager.addCommand("add variable",this,this.removeVariable,b);b.generateView(this.variables_.length);this.createVariableView(b);this.variables_.unshift(b);Entry.playground.reloadPlayground();this.updateList();return new Entry.State(this,this.removeVariable,b)}; -Entry.VariableContainer.prototype.removeVariable=function(b){var a=this.variables_.indexOf(b),c=b.toJSON();this.selected==b&&this.select(null);b.remove();this.variables_.splice(a,1);Entry.stateManager&&Entry.stateManager.addCommand("remove variable",this,this.addVariable,c);Entry.playground.reloadPlayground();this.updateList();return new Entry.State(this,this.addVariable,c)}; -Entry.VariableContainer.prototype.changeVariableName=function(b,a){b.name_!=a&&(Entry.isExist(a,"name_",this.variables_)?(b.listElement.nameField.value=b.name_,Entry.toast.alert(Lang.Workspace.variable_rename_failed,Lang.Workspace.variable_dup)):10this._maxNameLength&&(b=this._truncName(b,"list"));b=this.checkAllVariableName(b,"lists_")?Entry.getOrderedName(b,this.lists_,"name_"):b;b={name:b,isCloud:c.isCloud,object:c.object,variableType:"list"};a.view.addClass("entryRemove");this.resetVariableAddPanel("list")}b=new Entry.Variable(b);Entry.stateManager&&Entry.stateManager.addCommand("add list", -this,this.removeList,b);b.generateView(this.lists_.length);this.createListView(b);this.lists_.unshift(b);Entry.playground.reloadPlayground();this.updateList();return new Entry.State(this,this.removelist,b)}; -Entry.VariableContainer.prototype.createListView=function(b){var a=this,c=Entry.createElement("li"),d=Entry.createElement("div");d.addClass("entryVariableListElementWrapperWorkspace");c.appendChild(d);c.addClass("entryVariableListElementWorkspace");b.object_?c.addClass("entryListLocalElementWorkspace"):b.isCloud_?c.addClass("entryListCloudElementWorkspace"):c.addClass("entryListGlobalElementWorkspace");c.bindOnClick(function(c){a.select(b)});var e=Entry.createElement("button");e.addClass("entryVariableListElementDeleteWorkspace"); -e.bindOnClick(function(c){c.stopPropagation();a.removeList(b);a.selectedList=null;a.listSettingView.addClass("entryRemove")});var f=Entry.createElement("button");f.addClass("entryVariableListElementEditWorkspace");f.bindOnClick(function(c){c.stopPropagation();h.removeAttribute("disabled");g.removeClass("entryRemove");this.addClass("entryRemove");a.updateSelectedVariable(b);h.focus()});c.editButton=f;var g=Entry.createElement("button");g.addClass("entryVariableListElementEditWorkspace");g.addClass("entryRemove"); -g.bindOnClick(function(c){c.stopPropagation();h.blur();h.setAttribute("disabled","disabled");f.removeClass("entryRemove");this.addClass("entryRemove");a.select(b);a.updateSelectedVariable(null,"list")});c.editSaveButton=g;var h=Entry.createElement("input");h.setAttribute("disabled","disabled");h.addClass("entryVariableListElementNameWorkspace");h.value=b.name_;h.bindOnClick(function(a){a.stopPropagation()});h.onblur=function(c){(c=this.value.trim())&&0!==c.length?a.changeListName(b,this.value):(Entry.toast.alert(Lang.Msgs.warn, -Lang.Msgs.list_can_not_space),this.value=b.getName())};h.onkeydown=function(a){13==a.keyCode&&this.blur()};c.nameField=h;d.appendChild(h);d.appendChild(f);d.appendChild(g);d.appendChild(e);b.listElement=c};Entry.VariableContainer.prototype.mapVariable=function(b,a){for(var c=this.variables_.length,d=0;dc.getValue()&&c.setValue(0),100b&&(a.length=b)}this.updateListSettingView()};Entry.VariableContainer.prototype.updateViews=function(){var b=this.lists_;this.variables_.map(function(a){a.updateView()});b.map(function(a){a.updateView()})}; -Entry.VariableContainer.prototype.updateSelectedVariable=function(b,a){b?"variable"==b.type?(this.selectedVariable=b,this.updateVariableSettingView(b)):"slide"==b.type?(this.selectedVariable=b,this.updateVariableSettingView(b)):"list"==b.type&&(this.selectedList=b,this.updateListSettingView(b)):(this.selectedVariable=null,"variable"==(a||"variable")?this.variableSettingView.addClass("entryRemove"):this.listSettingView.addClass("entryRemove"))}; -Entry.VariableContainer.prototype.removeLocalVariables=function(b){var a=[],c=this;this.mapVariable(function(b,c){b.object_&&b.object_==c&&a.push(b)},b);a.map(function(a){c.removeVariable(a)})}; -Entry.VariableContainer.prototype.updateCloudVariables=function(){var b=Entry.projectId;if(Entry.cloudSavable&&b){var a=Entry.variableContainer,b=a.variables_.filter(function(a){return a.isCloud_}),b=b.map(function(a){return a.toJSON()}),a=a.lists_.filter(function(a){return a.isCloud_}),a=a.map(function(a){return a.toJSON()});$.ajax({url:"/api/project/variable/"+Entry.projectId,type:"PUT",data:{variables:b,lists:a}}).done(function(){})}}; -Entry.VariableContainer.prototype.addRef=function(b,a){if(this.view_&&Entry.playground.mainWorkspace&&Entry.playground.mainWorkspace.getMode()===Entry.Workspace.MODE_BOARD){var c={object:a.getCode().object,block:a};a.funcBlock&&(c.funcBlock=a.funcBlock,delete a.funcBlock);this[b].push(c);if("_functionRefs"==b)for(var d=a.type.substr(5),e=Entry.variableContainer.functions_[d].content.getBlockList(),f=0;fthis.maxValue_?this.maxValue_:a);this.isCloud_&&Entry.variableContainer.updateCloudVariables();this._valueWidth=null;this.updateView();Entry.requestUpdateTwice=!0};Entry.Variable.prototype.isVisible=function(){return this.visible_}; +Entry.Variable.prototype.setVisible=function(a){Entry.assert("boolean"==typeof a,"Variable visible state must be boolean");this.visible!==a&&(this.visible_=this.view_.visible=a,this.updateView())};Entry.Variable.prototype.setX=function(a){this.x_=a;this.updateView()};Entry.Variable.prototype.getX=function(){return this.x_};Entry.Variable.prototype.setY=function(a){this.y_=a;this.updateView()};Entry.Variable.prototype.getY=function(){return this.y_}; +Entry.Variable.prototype.setWidth=function(a){this.width_=100>a?100:a;this.updateView()};Entry.Variable.prototype.getWidth=function(){return this.width_};Entry.Variable.prototype.isInList=function(a,b){this.getX();this.getY()};Entry.Variable.prototype.setHeight=function(a){this.height_=100>a?100:a;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(a){this.setX(a.x);this.setY(a.y);this.id_=a.id;this.setVisible(a.visible);this.setValue(a.value);this.setName(a.name);this.isCloud_=a.isCloud;"list"==this.type&&(this.setWidth(a.width),this.setHeight(a.height),this.array_=a.array)}; +Entry.Variable.prototype.toJSON=function(){var a={};a.name=this.name_;a.id=this.id_;a.visible=this.visible_;a.value=this.value_;a.variableType=this.type;"list"==this.type?(a.width=this.getWidth(),a.height=this.getHeight(),a.array=JSON.parse(JSON.stringify(this.array_))):"slide"==this.type&&(a.minValue=this.minValue_,a.maxValue=this.maxValue_);a.isCloud=this.isCloud_;a.object=this.object_;a.x=this.x_;a.y=this.y_;return a};Entry.Variable.prototype.remove=function(){Entry.stage.removeVariable(this)}; +Entry.Variable.prototype.clone=function(){var a=this.toJSON();a.isClone=!0;return a=new Entry.Variable(a)};Entry.Variable.prototype.getType=function(){return this.type};Entry.Variable.prototype.setType=function(a){this.type=a};Entry.Variable.prototype.getSlidePosition=function(a){var b=this.minValue_;return Math.abs(this.value_-b)/Math.abs(this.maxValue_-b)*a+10}; +Entry.Variable.prototype.setSlideCommandX=function(a){var b=this.valueSetter_.graphics.command;a=Math.max("undefined"==typeof a?10:a,10);a=Math.min(this.maxWidth+10,a);b.x=a;this.updateSlideValueByView()}; +Entry.Variable.prototype.updateSlideValueByView=function(){var a=Math.max(this.valueSetter_.graphics.command.x-10,0)/this.maxWidth;0>a&&(a=0);1c&&(a=this.maxValue_);this.isFloatPoint()||(a=Math.round(a));this.setValue(a)};Entry.Variable.prototype.getMinValue=function(){return this.minValue_}; +Entry.Variable.prototype.setMinValue=function(a){this.minValue_=a=a||0;this.value_a&&(this.value_=a);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(a){var b=this;this.view_=a;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(a){a=f.variableAddPanel; +var c=a.view.name.value.trim();a.isOpen?c&&0!==c.length?b.addVariable():(a.view.addClass("entryRemove"),a.isOpen=!1):(a.view.removeClass("entryRemove"),a.view.name.focus(),a.isOpen=!0)});this.generateVariableAddView();this.generateListAddView();this.generateVariableSplitterView();this.generateVariableSettingView();this.generateListSettingView();c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.message_create; +this.messageAddButton_=c;c.bindOnClick(function(a){b.addMessage({name:Lang.Workspace.message+" "+(b.messages_.length+1)})});c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.list_create;this.listAddButton_=c;c.bindOnClick(function(a){a=f.listAddPanel;var c=a.view.name.value.trim();a.isOpen?c&&0!==c.length?b.addList():(a.view.addClass("entryRemove"),a.isOpen=!1):(a.view.removeClass("entryRemove"),a.view.name.focus(), +a.isOpen=!0)});c=Entry.createElement("li");c.addClass("entryVariableAddWorkspace");c.addClass("entryVariableListElementWorkspace");c.innerHTML="+ "+Lang.Workspace.function_add;this.functionAddButton_=c;c.bindOnClick(function(a){a=b._getBlockMenu();Entry.playground.changeViewMode("code");"func"!=a.lastSelector&&a.selectMenu("func");b.createFunction()});return a}; +Entry.VariableContainer.prototype.createSelectButton=function(a,b){var c=this;void 0===b&&(b=!0);var d=Entry.createElement("td");d.addClass("entryVariableSelectButtonWorkspace",a);d.innerHTML=Lang.Workspace[a];b?d.bindOnClick(function(b){c.selectFilter(a);this.addClass("selected")}):d.addClass("disable");return d}; +Entry.VariableContainer.prototype.selectFilter=function(a){for(var b=this.view_.getElementsByTagName("td"),c=0;ca.x_&&b.xe?!0:!1}; +Entry.VariableContainer.prototype.getListById=function(a){var b=this.lists_,c=[];if(0this._maxNameLength&&(a=this._truncName(a,"variable"));a=this.checkAllVariableName(a,"variables_")?Entry.getOrderedName(a,this.variables_,"name_"):a;var c=b.info;a={name:a,isCloud:c.isCloud,object:c.object,variableType:"variable"};b.view.addClass("entryRemove");this.resetVariableAddPanel("variable")}a=new Entry.Variable(a);Entry.stateManager&& +Entry.stateManager.addCommand("add variable",this,this.removeVariable,a);a.generateView(this.variables_.length);this.createVariableView(a);this.variables_.unshift(a);Entry.playground.reloadPlayground();this.updateList();return new Entry.State(this,this.removeVariable,a)}; +Entry.VariableContainer.prototype.removeVariable=function(a){var b=this.variables_.indexOf(a),c=a.toJSON();this.selected==a&&this.select(null);a.remove();this.variables_.splice(b,1);Entry.stateManager&&Entry.stateManager.addCommand("remove variable",this,this.addVariable,c);Entry.playground.reloadPlayground();this.updateList();return new Entry.State(this,this.addVariable,c)}; +Entry.VariableContainer.prototype.changeVariableName=function(a,b){a.name_!=b&&(Entry.isExist(b,"name_",this.variables_)?(a.listElement.nameField.value=a.name_,Entry.toast.alert(Lang.Workspace.variable_rename_failed,Lang.Workspace.variable_dup)):10this._maxNameLength&&(a=this._truncName(a,"list"));a=this.checkAllVariableName(a,"lists_")?Entry.getOrderedName(a,this.lists_,"name_"):a;a={name:a,isCloud:c.isCloud,object:c.object,variableType:"list"};b.view.addClass("entryRemove");this.resetVariableAddPanel("list")}a=new Entry.Variable(a);Entry.stateManager&&Entry.stateManager.addCommand("add list", +this,this.removeList,a);a.generateView(this.lists_.length);this.createListView(a);this.lists_.unshift(a);Entry.playground.reloadPlayground();this.updateList();return new Entry.State(this,this.removelist,a)}; +Entry.VariableContainer.prototype.createListView=function(a){var b=this,c=Entry.createElement("li"),d=Entry.createElement("div");d.addClass("entryVariableListElementWrapperWorkspace");c.appendChild(d);c.addClass("entryVariableListElementWorkspace");a.object_?c.addClass("entryListLocalElementWorkspace"):a.isCloud_?c.addClass("entryListCloudElementWorkspace"):c.addClass("entryListGlobalElementWorkspace");c.bindOnClick(function(c){b.select(a)});var e=Entry.createElement("button");e.addClass("entryVariableListElementDeleteWorkspace"); +e.bindOnClick(function(c){c.stopPropagation();b.removeList(a);b.selectedList=null;b.listSettingView.addClass("entryRemove")});var f=Entry.createElement("button");f.addClass("entryVariableListElementEditWorkspace");f.bindOnClick(function(c){c.stopPropagation();h.removeAttribute("disabled");g.removeClass("entryRemove");this.addClass("entryRemove");b.updateSelectedVariable(a);h.focus()});c.editButton=f;var g=Entry.createElement("button");g.addClass("entryVariableListElementEditWorkspace");g.addClass("entryRemove"); +g.bindOnClick(function(c){c.stopPropagation();h.blur();h.setAttribute("disabled","disabled");f.removeClass("entryRemove");this.addClass("entryRemove");b.select(a);b.updateSelectedVariable(null,"list")});c.editSaveButton=g;var h=Entry.createElement("input");h.setAttribute("disabled","disabled");h.addClass("entryVariableListElementNameWorkspace");h.value=a.name_;h.bindOnClick(function(b){b.stopPropagation()});h.onblur=function(c){(c=this.value.trim())&&0!==c.length?b.changeListName(a,this.value):(Entry.toast.alert(Lang.Msgs.warn, +Lang.Msgs.list_can_not_space),this.value=a.getName())};h.onkeydown=function(b){13==b.keyCode&&this.blur()};c.nameField=h;d.appendChild(h);d.appendChild(f);d.appendChild(g);d.appendChild(e);a.listElement=c};Entry.VariableContainer.prototype.mapVariable=function(a,b){for(var c=this.variables_.length,d=0;dc.getValue()&&c.setValue(0),100a&&(b.length=a)}this.updateListSettingView()};Entry.VariableContainer.prototype.updateViews=function(){var a=this.lists_;this.variables_.map(function(b){b.updateView()});a.map(function(b){b.updateView()})}; +Entry.VariableContainer.prototype.updateSelectedVariable=function(a,b){a?"variable"==a.type?(this.selectedVariable=a,this.updateVariableSettingView(a)):"slide"==a.type?(this.selectedVariable=a,this.updateVariableSettingView(a)):"list"==a.type&&(this.selectedList=a,this.updateListSettingView(a)):(this.selectedVariable=null,"variable"==(b||"variable")?this.variableSettingView.addClass("entryRemove"):this.listSettingView.addClass("entryRemove"))}; +Entry.VariableContainer.prototype.removeLocalVariables=function(a){var b=[],c=this;this.mapVariable(function(a,c){a.object_&&a.object_==c&&b.push(a)},a);b.map(function(b){c.removeVariable(b)})}; +Entry.VariableContainer.prototype.updateCloudVariables=function(){var a=Entry.projectId;if(Entry.cloudSavable&&a){var b=Entry.variableContainer,a=b.variables_.filter(function(b){return b.isCloud_}),a=a.map(function(b){return b.toJSON()}),b=b.lists_.filter(function(b){return b.isCloud_}),b=b.map(function(b){return b.toJSON()});$.ajax({url:"/api/project/variable/"+Entry.projectId,type:"PUT",data:{variables:a,lists:b}}).done(function(){})}}; +Entry.VariableContainer.prototype.addRef=function(a,b){if(this.view_&&Entry.playground.mainWorkspace&&Entry.playground.mainWorkspace.getMode()===Entry.Workspace.MODE_BOARD){var c={object:b.getCode().object,block:b};b.funcBlock&&(c.funcBlock=b.funcBlock,delete b.funcBlock);this[a].push(c);if("_functionRefs"==a){a=b.type.substr(5);for(var d=Entry.variableContainer.functions_[a].content.getBlockList(),e=0;eEntry.Albert.tempo&&(Entry.Albert.tempo=1);return a.callReturn()}}, -albert_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:"albert_set_tempo_to"},paramsKeyMap:{VALUE:0},"class":"albert_buzzer",isNotFor:["albert"],func:function(b,a){Entry.Albert.tempo=a.getNumberValue("VALUE");1>Entry.Albert.tempo&&(Entry.Albert.tempo=1);return a.callReturn()}},albert_move_forward:{color:"#00979D",skeleton:"basic", -statements:[],params:[{type:"Indicator",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 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;c.leftWheel=30;c.rightWheel=30;setTimeout(function(){a.timeFlag=0},1E3);return a}},albert_move_backward:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator", -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", -"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", -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])}}, -arduino_get_digital_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[{type:"arduino_get_port_number"}],type:"arduino_get_digital_value"},paramsKeyMap:{VALUE:0},"class":"arduino_value",isNotFor:["arduino"],func:function(b,a){var c=a.getNumberValue("VALUE",a);return Entry.hw.getDigitalPortValue(c)}},arduino_toggle_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"}, -{type:"Dropdown",options:[[Lang.Blocks.ARDUINO_on,"on"],[Lang.Blocks.ARDUINO_off,"off"]],value:"on",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"arduino_get_port_number"},null,null],type:"arduino_toggle_led"},paramsKeyMap:{VALUE:0,OPERATOR:1},"class":"arduino_set",isNotFor:["arduino"],func:function(b,a){var c=a.getNumberValue("VALUE"),d="on"==a.getField("OPERATOR")?255:0;Entry.hw.setDigitalPortValue(c, -d);return a.callReturn()}},arduino_toggle_pwm:{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:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"arduino_toggle_pwm"},paramsKeyMap:{PORT:0,VALUE:1},"class":"arduino_set",isNotFor:["arduino"],func:function(b,a){var c=a.getNumberValue("PORT"),d=a.getNumberValue("VALUE"), -d=Math.round(d),d=Math.max(d,0),d=Math.min(d,255);Entry.hw.setDigitalPortValue(c,d);return a.callReturn()}},arduino_convert_scale:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number",id:"bl5e"}]},{type:"number", -params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"arduino_convert_scale"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2,VALUE4:3,VALUE5:4},"class":"arduino",isNotFor:["arduino"],func:function(b,a){var c=a.getNumberValue("VALUE1",a),d=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a),f=a.getNumberValue("VALUE4",a),g=a.getNumberValue("VALUE5",a);if(d>e)var h=d,d=e,e=h;f>g&&(h=f,f=g,g=h);c-=d;c*=(g-f)/(e-d);c+=f;c=Math.min(g,c);c=Math.max(f, -c);return Math.round(c)}},arduino_ext_get_analog_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["A0","0"],["A1","1"],["A2","2"],["A3","3"],["A4","4"],["A5","5"]],value:"0",fontSize:11}],events:{},def:{params:[null],type:"arduino_ext_get_analog_value"},paramsKeyMap:{PORT:0},"class":"ArduinoExtGet",isNotFor:["ArduinoExt"],func:function(b,a){var c=a.getField("PORT",a),d=Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.ANALOG), -e=Entry.hw.portData.TIME||0;Entry.ArduinoExt.BlockState[this.type]||(Entry.ArduinoExt.BlockState[this.type]={isStart:!1,stamp:0});var f=Entry.ArduinoExt.BlockState[this.type],g=Entry.hw.portData.ANALOG;if(f.isStart){if(e&&e===f.stamp||64Entry.hw.getAnalogPortValue(0)?1:0}},CODEino_get_light_status:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CODEino_string_14,"BRIGHT"],[Lang.Blocks.CODEino_string_15, -"DARK"]],value:"BRIGHT",fontSize:11}],events:{},def:{params:[null],type:"CODEino_get_light_status"},paramsKeyMap:{STATUS:0},"class":"CODEino",isNotFor:["CODEino"],func:function(b,a){return"DARK"==a.getField("STATUS",a)?800Entry.hw.getAnalogPortValue(1)?1:0}},CODEino_is_button_pressed:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CODEino_string_3,"4"],[Lang.Blocks.CODEino_string_4, -"17"],[Lang.Blocks.CODEino_string_5,"18"],[Lang.Blocks.CODEino_string_6,"19"],[Lang.Blocks.CODEino_string_7,"20"]],value:"4",fontSize:11}],events:{},def:{params:[null],type:"CODEino_is_button_pressed"},paramsKeyMap:{PORT:0},"class":"CODEino",isNotFor:["CODEino"],func:function(b,a){var c=a.getNumberField("PORT",a);return 14d?1:0;if("RIGHT"==c||"FRONT"==c)return 30d?1:0}},CODEino_get_accelerometer_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["X","3"],["Y","4"],["Z","5"]],value:"3",fontSize:11}],events:{},def:{params:[null],type:"CODEino_get_accelerometer_value"}, -paramsKeyMap:{PORT:0},"class":"CODEino",isNotFor:["CODEino"],func:function(b,a){var c=265,d=402,e=-90,f=90,g=Entry.hw.getAnalogPortValue(a.getField("PORT",a));if(c>d)var h=c,c=d,d=h;e>f&&(h=e,e=f,f=h);g=(f-e)/(d-c)*(g-c);g+=e;g=Math.min(f,g);g=Math.max(e,g);return Math.round(g)}},nemoino_get_named_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"%1 \uc13c\uc11c\uac12",params:[{type:"Dropdown",options:[["\uc18c\ub9ac","0"],["\ube5b","1"],["\uc2ac\ub77c\uc774\ub354", -"2"],["\uc800\ud56d-A","3"],["\uc800\ud56d-B","4"],["\uc800\ud56d-C","5"],["\uc800\ud56d-D","6"]],value:"0",fontSize:11}],events:{},def:{params:[null],type:"nemoino_get_named_sensor_value"},paramsKeyMap:{PORT:0},"class":"nemoino",isNotFor:["nemoino"],func:function(b,a){return Entry.hw.getAnalogPortValue(a.getField("PORT",a))}},nemoino_get_sound_status:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],template:"\uc18c\ub9ac\uc13c\uc11c %1",params:[{type:"Dropdown",options:[["\uc18c\ub9ac\ud07c", -"GREAT"],["\uc18c\ub9ac\uc791\uc74c","SMALL"]],value:"GREAT",fontSize:11}],events:{},def:{params:[null],type:"nemoino_get_sound_status"},paramsKeyMap:{STATUS:0},"class":"nemoino",isNotFor:["nemoino"],func:function(b,a){return"GREAT"==a.getField("STATUS",a)?600Entry.hw.getAnalogPortValue(0)?1:0}},nemoino_is_button_pressed:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],template:"\ubcf4\ub4dc\uc758 %1",params:[{type:"Dropdown",options:[["\ubc84\ud2bc\ub204\ub984", -"4"],["A\uc5f0\uacb0\ub428","17"],["B\uc5f0\uacb0\ub428","18"],["C\uc5f0\uacb0\ub428","19"],["D\uc5f0\uacb0\ub428","20"]],value:"4",fontSize:11}],events:{},def:{params:[null],type:"nemoino_is_button_pressed"},paramsKeyMap:{PORT:0},"class":"nemoino",isNotFor:["nemoino"],func:function(b,a){var c=a.getNumberField("PORT",a);return 14d?1:0;if("RIGHT"==c||"FRONT"==c)return 30d?1:0}},nemoino_get_accelerometer_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"3\ucd95 \uac00\uc18d\ub3c4\uc13c\uc11c %1 \ucd95\uc758 \uc13c\uc11c\uac12", -params:[{type:"Dropdown",options:[["X","3"],["Y","4"],["Z","5"]],value:"3",fontSize:11}],events:{},def:{params:[null],type:"nemoino_get_accelerometer_value"},paramsKeyMap:{PORT:0},"class":"nemoino",isNotFor:["nemoino"],func:function(b,a){var c=265,d=402,e=-90,f=90,g=Entry.hw.getAnalogPortValue(a.getField("PORT",a));if(c>d)var h=c,c=d,d=h;e>f&&(h=e,e=f,f=h);g=(f-e)/(d-c)*(g-c);g+=e;g=Math.min(f,g);g=Math.max(e,g);return Math.round(g)}},bitbrick_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field", -statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW,menuName:Entry.Bitbrick.sensorList}],events:{},def:{params:[null],type:"bitbrick_sensor_value"},paramsKeyMap:{PORT:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=a.getStringField("PORT");return Entry.hw.portData[c].value}},bitbrick_is_touch_pressed:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"DropdownDynamic",value:null, -fontSize:11,menuName:Entry.Bitbrick.touchList}],events:{},def:{params:[null],type:"bitbrick_is_touch_pressed"},paramsKeyMap:{PORT:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){return 0===Entry.hw.portData[a.getStringField("PORT")].value}},bitbrick_turn_off_color_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"bitbrick_turn_off_color_led",id:"i3je"},"class":"condition",isNotFor:["bitbrick"], -func:function(b,a){Entry.hw.sendQueue.LEDR=0;Entry.hw.sendQueue.LEDG=0;Entry.hw.sendQueue.LEDB=0;return a.callReturn()}},bitbrick_turn_on_color_led_by_rgb:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["255"]},{type:"text",params:["255"]},{type:"text",params:["255"]},null],type:"bitbrick_turn_on_color_led_by_rgb"}, -paramsKeyMap:{rValue:0,gValue:1,bValue:2},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=a.getNumberValue("rValue"),d=a.getNumberValue("gValue"),e=a.getNumberValue("bValue"),f=Entry.adjustValueWithMaxMin,g=Entry.hw.sendQueue;g.LEDR=f(c,0,255);g.LEDG=f(d,0,255);g.LEDB=f(e,0,255);return a.callReturn()}},bitbrick_turn_on_color_led_by_picker:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Color"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{}, -def:{params:[null],type:"bitbrick_turn_on_color_led_by_picker"},paramsKeyMap:{VALUE:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=a.getStringField("VALUE");Entry.hw.sendQueue.LEDR=parseInt(c.substr(1,2),16);Entry.hw.sendQueue.LEDG=parseInt(c.substr(3,2),16);Entry.hw.sendQueue.LEDB=parseInt(c.substr(5,2),16);return a.callReturn()}},bitbrick_turn_on_color_led_by_value:{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:["0"]},null],type:"bitbrick_turn_on_color_led_by_value"},paramsKeyMap:{VALUE:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=a.getNumberValue("VALUE"),d,e,f,c=c%200;67>c?(d=200-3*c,e=3*c,f=0):134>c?(c-=67,d=0,e=200-3*c,f=3*c):201>c&&(c-=134,d=3*c,e=0,f=200-3*c);Entry.hw.sendQueue.LEDR=d;Entry.hw.sendQueue.LEDG=e;Entry.hw.sendQueue.LEDB=f;return a.callReturn()}},bitbrick_buzzer:{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:"bitbrick_buzzer"},paramsKeyMap:{VALUE:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){if(a.isStart)return Entry.hw.sendQueue.buzzer=0,delete a.isStart,a.callReturn();var c=a.getNumberValue("VALUE");Entry.hw.sendQueue.buzzer=c;a.isStart=!0;return a}},bitbrick_turn_off_all_motors:{color:"#00979D",skeleton:"basic",statements:[], -params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"bitbrick_turn_off_all_motors"},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=Entry.hw.sendQueue,d=Entry.Bitbrick;d.servoList().map(function(a){c[a[1]]=0});d.dcList().map(function(a){c[a[1]]=128});return a.callReturn()}},bitbrick_dc_speed:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.dcList},{type:"Block", -accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"text",params:["60"]},null],type:"bitbrick_dc_speed"},paramsKeyMap:{PORT:0,VALUE:1},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=a.getNumberValue("VALUE"),c=Math.min(c,Entry.Bitbrick.dcMaxValue),c=Math.max(c,Entry.Bitbrick.dcMinValue);Entry.hw.sendQueue[a.getStringField("PORT")]=c+128;return a.callReturn()}},bitbrick_dc_direction_speed:{color:"#00979D",skeleton:"basic", -statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.dcList},{type:"Dropdown",options:[[Lang.Blocks.BITBRICK_dc_direction_cw,"CW"],[Lang.Blocks.BITBRICK_dc_direction_ccw,"CCW"]],value:"CW",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,{type:"text",params:["100"]},null],type:"bitbrick_dc_direction_speed"},paramsKeyMap:{PORT:0,DIRECTION:1,VALUE:2},"class":"condition",isNotFor:["bitbrick"], -func:function(b,a){var c="CW"===a.getStringField("DIRECTION"),d=a.getNumberValue("VALUE"),d=Math.min(d,Entry.Bitbrick.dcMaxValue),d=Math.max(d,0);Entry.hw.sendQueue[a.getStringField("PORT")]=c?d+128:128-d;return a.callReturn()}},bitbrick_servomotor_angle:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.servoList},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null, -{type:"text",params:["100"]},null],type:"bitbrick_servomotor_angle"},paramsKeyMap:{PORT:0,VALUE:1},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=Entry.Bitbrick.servoMaxValue-(a.getNumberValue("VALUE")+1),c=Math.min(c,Entry.Bitbrick.servoMaxValue),c=Math.max(c,Entry.Bitbrick.servoMinValue);Entry.hw.sendQueue[a.getStringField("PORT")]=c;return a.callReturn()}},bitbrick_convert_scale:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"DropdownDynamic", -value:null,fontSize:11,menuName:Entry.Bitbrick.sensorList},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"}],events:{},def:{params:[null,{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["-100"]},{type:"number",params:["100"]}],type:"bitbrick_convert_scale"},paramsKeyMap:{PORT:0,VALUE2:1,VALUE3:2,VALUE4:3,VALUE5:4},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=a.getNumberField("PORT"), -d=Entry.hw.portData[c].value,c=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a),f=a.getNumberValue("VALUE4",a),g=a.getNumberValue("VALUE5",a);if(f>g)var h=f,f=g,g=h;d-=c;d*=(g-f)/(e-c);d+=f;d=Math.min(g,d);d=Math.max(f,d);return Math.round(d)}},start_drawing:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"start_drawing"},"class":"brush_control",isNotFor:["textBox"],func:function(b,a){b.brush? -b.brush.stop=!1:Entry.setBasicBrush(b);Entry.stage.sortZorder();b.brush.moveTo(b.getX(),-1*b.getY());return a.callReturn()}},stop_drawing:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"stop_drawing"},"class":"brush_control",isNotFor:["textBox"],func:function(b,a){b.brush&&b.shape&&(b.brush.stop=!0);return a.callReturn()}},set_color:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Color"}, -{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"set_color"},paramsKeyMap:{VALUE:0},"class":"brush_color",isNotFor:["textBox"],func:function(b,a){var c=a.getField("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(c=Entry.hex2rgb(c),b.brush.rgb=c,b.brush.endStroke(),b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}},set_random_color:{color:"#FF9E20", -skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"set_random_color"},"class":"brush_color",isNotFor:["textBox"],func:function(b,a){b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);if(b.brush){var c=Entry.generateRgb();b.brush.rgb=c;b.brush.endStroke();b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")");b.brush.moveTo(b.getX(),-1*b.getY())}return a.callReturn()}},change_thickness:{color:"#FF9E20", -skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["1"]},null],type:"change_thickness"},paramsKeyMap:{VALUE:0},"class":"brush_thickness",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.thickness+=c,1>b.brush.thickness&&(b.brush.thickness=1),b.brush.setStrokeStyle(b.brush.thickness),b.brush.moveTo(b.getX(), --1*b.getY()));return a.callReturn()}},set_thickness:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["1"]},null],type:"set_thickness"},paramsKeyMap:{VALUE:0},"class":"brush_thickness",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.thickness=c,b.brush.setStrokeStyle(b.brush.thickness), -b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}},change_opacity:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_opacity"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);c=Entry.adjustValueWithMaxMin(b.brush.opacity+ -c,0,100);b.brush&&(b.brush.opacity=c,b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}},set_opacity:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["50"]},null],type:"set_opacity"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"], -func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}},brush_erase_all:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"brush_erase_all"}, -"class":"brush_clear",isNotFor:["textBox"],func:function(b,a){var c=b.brush;if(c){var d=c._stroke.style,e=c._strokeStyle.width;c.clear().setStrokeStyle(e).beginStroke(d);c.moveTo(b.getX(),-1*b.getY())}c=b.parent.getStampEntities();c.map(function(a){a.removeClone()});c=null;return a.callReturn()}},brush_stamp:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"brush_stamp"},"class":"stamp",isNotFor:["textBox"], -func:function(b,a){b.parent.addStampEntity(b);return a.callReturn()}},change_brush_transparency:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_brush_transparency"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop= -!0);c=Entry.adjustValueWithMaxMin(b.brush.opacity-c,0,100);b.brush&&(b.brush.opacity=c,b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}},set_brush_tranparency:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["50"]},null],type:"set_brush_tranparency"}, -paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+(1-b.brush.opacity/100)+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}},number:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"TextInput", -value:10}],events:{},def:{params:[]},paramsKeyMap:{NUM:0},func:function(b,a){return a.getField("NUM",a)},isPrimitive:!0},angle:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Angle"}],events:{},def:{params:[null],type:"angle"},paramsKeyMap:{ANGLE:0},func:function(b,a){return a.getNumberField("ANGLE")}},get_x_coordinate:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_x_coordinate,color:"#3D3D3D"}],events:{},def:{params:[null], -type:"get_x_coordinate"},"class":"calc",isNotFor:[],func:function(b,a){return b.getX()}},get_y_coordinate:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_y_coordinate,color:"#3D3D3D"}],events:{},def:{params:[null],type:"get_y_coordinate"},"class":"calc",isNotFor:[],func:function(b,a){return b.getY()}},get_angle:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_angle,color:"#3D3D3D"}], -events:{},def:{params:[null]},func:function(b,a){return parseFloat(b.getRotation().toFixed(1))}},get_rotation_direction:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CALC_rotation_value,"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,"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 e}},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,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_rand_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"number",params:["0"]},null,{type:"number",params:["10"]},null],type:"calc_rand"},paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3},"class":"calc",isNotFor:[],func:function(b, -a){var c=a.getStringValue("LEFTHAND",a),d=a.getStringValue("RIGHTHAND",a),e=Math.min(c,d),f=Math.max(c,d),c=Entry.isFloat(c);return Entry.isFloat(d)||c?(Math.random()*(f-e)+e).toFixed(2):Math.floor(Math.random()*(f-e+1)+e)}},get_date:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_date_1,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_get_date_year,"YEAR"],[Lang.Blocks.CALC_get_date_month,"MONTH"],[Lang.Blocks.CALC_get_date_day, -"DAY"],[Lang.Blocks.CALC_get_date_hour,"HOUR"],[Lang.Blocks.CALC_get_date_minute,"MINUTE"],[Lang.Blocks.CALC_get_date_second,"SECOND"]],value:"YEAR",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_get_date_2,color:"#3D3D3D"}],events:{},def:{params:[null,"YEAR",null],type:"get_date"},paramsKeyMap:{VALUE:1},"class":"calc_date",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d=new Date;return"YEAR"==c?d.getFullYear():"MONTH"==c?d.getMonth()+1:"DAY"== -c?d.getDate():"HOUR"==c?d.getHours():"MINUTE"==c?d.getMinutes():d.getSeconds()}},get_sound_duration:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_sound_duration_1,color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"sounds",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_get_sound_duration_2,color:"#3D3D3D"}],events:{},def:{params:[null,null,null],type:"get_sound_duration"},paramsKeyMap:{VALUE:1}, -"class":"calc_duration",isNotFor:[],func:function(b,a){for(var c=a.getField("VALUE",a),d=b.parent.sounds,e=0;ed||d>c.length-1)throw Error();return c[d]}},length_of_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_length_of_string_1, -color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_length_of_string_2,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.entry]},null],type:"length_of_string"},paramsKeyMap:{STRING:1},"class":"calc_string",isNotFor:[],func:function(b,a){return a.getStringValue("STRING",a).length}},substring:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_substring_1,color:"#3D3D3D"},{type:"Block",accept:"string"}, -{type:"Text",text:Lang.Blocks.CALC_substring_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_substring_3,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_substring_4,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"number",params:["2"]},null,{type:"number",params:["5"]},null],type:"substring"},paramsKeyMap:{STRING:1,START:3,END:5},"class":"calc_string",isNotFor:[],func:function(b, -a){var c=a.getStringValue("STRING",a),d=a.getNumberValue("START",a)-1,e=a.getNumberValue("END",a)-1,f=c.length-1;if(0>d||0>e||d>f||e>f)throw Error();return c.substring(Math.min(d,e),Math.max(d,e)+1)}},replace_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_replace_string_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_3, -color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_4,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"text",params:[Lang.Blocks.hello]},null,{type:"text",params:[Lang.Blocks.nice]},null],type:"replace_string"},paramsKeyMap:{STRING:1,OLD_WORD:3,NEW_WORD:5},"class":"calc_string",isNotFor:[],func:function(b,a){return a.getStringValue("STRING",a).replace(new RegExp(a.getStringValue("OLD_WORD",a),"gm"), -a.getStringValue("NEW_WORD",a))}},change_string_case:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_change_string_case_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_change_string_case_2,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_change_string_case_sub_1,"toUpperCase"],[Lang.Blocks.CALC_change_string_case_sub_2,"toLowerCase"]],value:"toUpperCase",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}, -{type:"Text",text:Lang.Blocks.CALC_change_string_case_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:["Hello Entry!"]},null,null,null],type:"change_string_case"},paramsKeyMap:{STRING:1,CASE:3},"class":"calc_string",isNotFor:[],func:function(b,a){return a.getStringValue("STRING",a)[a.getField("CASE",a)]()}},index_of_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_index_of_string_1,color:"#3D3D3D"},{type:"Block",accept:"string"}, -{type:"Text",text:Lang.Blocks.CALC_index_of_string_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_index_of_string_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"text",params:[Lang.Blocks.entry]},null],type:"index_of_string"},paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3},"class":"calc_string",isNotFor:[],func:function(b,a){var c=a.getStringValue("LEFTHAND",a),d=a.getStringValue("RIGHTHAND",a),c=c.indexOf(d);return-1< -c?c+1:0}},combine_something:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_combine_something_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.VARIABLE_combine_something_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.VARIABLE_combine_something_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.block_hi]},null,{type:"text",params:[Lang.Blocks.entry]}, -null],type:"combine_something"},paramsKeyMap:{VALUE1:1,VALUE2:3},"class":"calc_string",isNotFor:[],func:function(b,a){var c=a.getStringValue("VALUE1",a),d=a.getStringValue("VALUE2",a);return c+d}},get_sound_volume:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_sound_volume,color:"#3D3D3D"},{type:"Text",text:"",color:"#3D3D3D"}],events:{},def:{params:[null,null],type:"get_sound_volume"},"class":"calc",isNotFor:[""],func:function(b,a){return 100* +Entry.block.maze_step_if_2={skeleton:"basic_loop",mode:"maze",color:"#498DEB",template:"\ub9cc\uc57d \uc55e\uc5d0 %1 \uc788\ub2e4\uba74%2",syntax:["BasicIf",'front == "bee"'],params:[{type:"Image",img:"/img/assets/ntry/bitmap/maze2/obstacle_01.png",size:18},{type:"Image",img:"/img/assets/week/blocks/if.png",size:24}],statements:[{accept:"basic"}],func:function(){if(!this.isContinue){var a=Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT),b,c;for(c in a)b=a[c];a=Ntry.entityManager.getComponent(b.id, +Ntry.STATIC.UNIT);b=Ntry.entityManager.getComponent(b.id,Ntry.STATIC.GRID);b={x:b.x,y:b.y};Ntry.addVectorByDirection(b,a.direction,1);b=Ntry.entityManager.find({type:Ntry.STATIC.GRID,x:b.x,y:b.y},{type:Ntry.STATIC.TILE,tileType:Ntry.STATIC.OBSTACLE_BEE});this.isContinue=!0;a=this.block.statements[0];if(0!==b.length&&0!==a.getBlocks().length)return this.executor.stepInto(a),Entry.STATIC.CONTINUE}}}; +Entry.block.maze_call_function={skeleton:"basic",mode:"maze",color:"#B57242",template:"\uc57d\uc18d \ubd88\ub7ec\uc624\uae30%1",syntax:["Scope","promise"],params:[{type:"Image",img:"/img/assets/week/blocks/function.png",size:24}],func:function(){if(!this.funcExecutor){var a=Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.CODE),b;for(b in a)this.funcExecutor=new Entry.Executor(a[b].components[Ntry.STATIC.CODE].code.getEventMap("define")[0])}this.funcExecutor.execute();if(null!==this.funcExecutor.scope.block)return Entry.STATIC.CONTINUE}}; +Entry.block.maze_define_function={skeleton:"basic_define",mode:"maze",color:"#B57242",event:"define",template:"\uc57d\uc18d\ud558\uae30%1",syntax:["BasicFunction"],params:[{type:"Image",img:"/img/assets/week/blocks/function.png",size:24}],statements:[{accept:"basic"}],func:function(a){if(!this.executed&&(a=this.block.statements[0],0!==a.getBlocks().length))return this.executor.stepInto(a),this.executed=!0,Entry.STATIC.CONTINUE}}; +Entry.block.maze_step_if_3={skeleton:"basic_loop",mode:"maze",color:"#498DEB",template:"\ub9cc\uc57d \uc55e\uc5d0 %1 \uc788\ub2e4\uba74%2",syntax:["BasicIf",'front == "banana"'],params:[{type:"Image",img:"/img/assets/ntry/block_inner/if_target_3.png",size:18},{type:"Image",img:"/img/assets/week/blocks/if.png",size:24}],statements:[{accept:"basic"}],func:function(){if(!this.isContinue){var a=Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT),b,c;for(c in a)b=a[c];a=Ntry.entityManager.getComponent(b.id, +Ntry.STATIC.UNIT);b=Ntry.entityManager.getComponent(b.id,Ntry.STATIC.GRID);b={x:b.x,y:b.y};Ntry.addVectorByDirection(b,a.direction,1);b=Ntry.entityManager.find({type:Ntry.STATIC.GRID,x:b.x,y:b.y},{type:Ntry.STATIC.TILE,tileType:Ntry.STATIC.OBSTACLE_BANANA});this.isContinue=!0;a=this.block.statements[0];if(0!==b.length&&0!==a.getBlocks().length)return this.executor.stepInto(a),Entry.STATIC.CONTINUE}}}; +Entry.block.maze_step_if_4={skeleton:"basic_loop",mode:"maze",color:"#498DEB",template:"\ub9cc\uc57d \uc55e\uc5d0 %1 \uc788\ub2e4\uba74%2",syntax:["BasicIf",'front == "wall"'],params:[{type:"Image",img:"/img/assets/ntry/block_inner/if_target_2.png",size:18},{type:"Image",img:"/img/assets/week/blocks/if.png",size:24}],statements:[{accept:"basic"}],func:function(){if(!this.isContinue){var a=Ntry.entityManager.getEntitiesByComponent(Ntry.STATIC.UNIT),b,c;for(c in a)b=a[c];a=Ntry.entityManager.getComponent(b.id, +Ntry.STATIC.UNIT);b=Ntry.entityManager.getComponent(b.id,Ntry.STATIC.GRID);b={x:b.x,y:b.y};Ntry.addVectorByDirection(b,a.direction,1);b=Ntry.entityManager.find({type:Ntry.STATIC.GRID,x:b.x,y:b.y},{type:Ntry.STATIC.TILE,tileType:Ntry.STATIC.WALL});this.isContinue=!0;a=this.block.statements[0];if(0!==b.length&&0!==a.getBlocks().length)return this.executor.stepInto(a),Entry.STATIC.CONTINUE}}}; +Entry.block.maze_step_move_step={skeleton:"basic",mode:"maze",color:"#A751E3",template:"\uc55e\uc73c\ub85c \ud55c \uce78 \uc774\ub3d9%1",syntax:["Scope","move"],params:[{type:"Image",img:"/img/assets/week/blocks/moveStep.png",size:24}],func:function(){if(this.isContinue){if(this.isAction)return Entry.STATIC.CONTINUE;delete this.isAction;delete this.isContinue}else{this.isAction=this.isContinue=!0;var a=this;Ntry.dispatchEvent("unitAction",Ntry.STATIC.WALK,function(){a.isAction=!1});return Entry.STATIC.CONTINUE}}}; +Entry.block.maze_step_rotate_left={skeleton:"basic",mode:"maze",color:"#A751E3",template:"\uc67c\ucabd\uc73c\ub85c \ud68c\uc804%1",syntax:["Scope","left"],params:[{type:"Image",img:"/img/assets/week/blocks/turnL.png",size:24}],func:function(){if(this.isContinue){if(this.isAction)return Entry.STATIC.CONTINUE;delete this.isAction;delete this.isContinue}else{this.isAction=this.isContinue=!0;var a=this;Ntry.dispatchEvent("unitAction",Ntry.STATIC.TURN_LEFT,function(){a.isAction=!1});return Entry.STATIC.CONTINUE}}}; +Entry.block.maze_step_rotate_right={skeleton:"basic",mode:"maze",color:"#A751E3",template:"\uc624\ub978\ucabd\uc73c\ub85c \ud68c\uc804%1",syntax:["Scope","right"],params:[{type:"Image",img:"/img/assets/week/blocks/turnR.png",size:24}],func:function(){if(this.isContinue){if(this.isAction)return Entry.STATIC.CONTINUE;delete this.isAction;delete this.isContinue}else{this.isAction=this.isContinue=!0;var a=this;Ntry.dispatchEvent("unitAction",Ntry.STATIC.TURN_RIGHT,function(){a.isAction=!1});return Entry.STATIC.CONTINUE}}}; +Entry.block.test_wrapper={skeleton:"basic",mode:"maze",color:"#3BBD70",template:"%1 this is test block %2",params:[{type:"Block",accept:"basic_boolean_field",value:[{type:"test",params:[30,50]}]},{type:"Dropdown",options:[[1,1],[2,2],[3,3],[4,4],[5,5],[6,6],[7,7],[8,8],[9,9],[10,10]],value:1}],func:function(){}};Entry.block.basic_button={skeleton:"basic_button",color:"#eee",template:"%1",params:[{type:"Text",text:"basic button",color:"#333",align:"center"}],func:function(){}};Entry.Thread=function(a,b,c){this._data=new Entry.Collection;this._code=b;this.changeEvent=new Entry.Event(this);this.changeEvent.attach(this,this.handleChange);this._event=null;this.parent=c?c:b;this.load(a)}; +(function(a){a.load=function(b,a){void 0===b&&(b=[]);if(!(b instanceof Array))return console.error("thread must be array");for(var d=0;dthis.events[a].indexOf(f)&&this.events[a].push(f)}}this._schema.event&&this.thread.registerEvent(this,this._schema.event);b=this.params;a=this._schema.params;for(e=0;a&&eb.x||0>b.y){c.leftWheel=20;c.rightWheel=-20;break}b.initialized=!0}c=a.toRadian(b.theta);0==a.controlAngle(c,Math.atan2(b.targetY-b.y,b.targetX-b.x))&&(b.boardState=2);break;case 2:0==a.controlPosition(b.x,b.y,a.toRadian(b.theta),b.targetX,b.targetY)&&(b.boardState=3);break;case 3:0==a.controlPositionFine(b.x,b.y,a.toRadian(b.theta),b.targetX,b.targetY)&&(c.leftWheel=0,c.rightWheel=0,b.isMoving= +!1)}return b}delete b.isStart;delete b.isMoving;delete b.initialized;delete b.boardState;delete b.x;delete b.y;delete b.theta;delete b.targetX;delete b.targetY;Entry.engine.isContinue=!1;c.leftWheel=0;c.rightWheel=0;return b.callReturn()}b.isStart=!0;b.isMoving=!0;b.initialized=!1;b.boardState=1;b.x=-1;b.y=-1;b.theta=-200;b.targetX=b.getNumberValue("X");b.targetY=b.getNumberValue("Y");a.clear();c.leftWheel=0;c.rightWheel=0;return b}},albert_set_orientation_on_board:{color:"#00979D",skeleton:"basic", +statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"number",params:["0"]},null],type:"albert_set_orientation_on_board"},paramsKeyMap:{ORIENTATION:0},"class":"albert_wheel",isNotFor:["albert"],func:function(a,b){a=Entry.hw.sendQueue;var c=Entry.hw.portData,d=Entry.Albert.controller;if(b.isStart){if(b.isMoving){b.theta=c.orientation;switch(b.boardState){case 1:var c=d.toRadian(b.theta),e=d.toRadian(b.targetTheta); +0==d.controlAngle(c,e)&&(b.boardState=2);break;case 2:c=d.toRadian(b.theta),e=d.toRadian(b.targetTheta),0==d.controlAngleFine(c,e)&&(a.leftWheel=0,a.rightWheel=0,b.isMoving=!1)}return b}delete b.isStart;delete b.isMoving;delete b.boardState;delete b.theta;delete b.targetTheta;Entry.engine.isContinue=!1;a.leftWheel=0;a.rightWheel=0;return b.callReturn()}b.isStart=!0;b.isMoving=!0;b.boardState=1;b.theta=-200;b.targetTheta=b.getNumberValue("ORIENTATION");d.clear();a.leftWheel=0;a.rightWheel=0;return b}}, +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(a,b){a=Entry.hw.sendQueue;var c=b.getField("DIRECTION",b),d=Number(b.getField("COLOR",b));"LEFT"==c?a.leftEye=d:("RIGHT"!=c&&(a.leftEye=d),a.rightEye=d);return b.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(a,b){a=Entry.hw.sendQueue;var c=b.getField("DIRECTION",b);"LEFT"==c?a.leftEye=0:("RIGHT"!=c&&(a.leftEye=0),a.rightEye=0);return b.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(a,b){a=Entry.hw.sendQueue;"ON"==b.getField("STATE",b)?a.bodyLed=1:a.bodyLed=0;return b.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(a,b){a=Entry.hw.sendQueue;"ON"==b.getField("STATE",b)?a.frontLed=1:a.frontLed=0;return b.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(a,b){a=Entry.hw.sendQueue;if(b.isStart){if(1==b.timeFlag)return b;delete b.isStart;delete b.timeFlag;Entry.engine.isContinue=!1;a.buzzer=0;return b.callReturn()}b.isStart=!0;b.timeFlag=1;a.buzzer=440;a.note=0;var c=setTimeout(function(){b.timeFlag=0;Entry.Albert.removeTimeout(c)},200);Entry.Albert.timeouts.push(c);return b}},albert_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:"albert_change_buzzer_by"},paramsKeyMap:{VALUE:0},"class":"albert_buzzer",isNotFor:["albert"],func:function(a,b){a=Entry.hw.sendQueue;var c=b.getNumberValue("VALUE");a.buzzer=void 0!=a.buzzer?a.buzzer+c:c;a.note=0;return b.callReturn()}},albert_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:"albert_set_buzzer_to"},paramsKeyMap:{VALUE:0},"class":"albert_buzzer",isNotFor:["albert"],func:function(a,b){a=Entry.hw.sendQueue;a.buzzer=b.getNumberValue("VALUE");a.note=0;return b.callReturn()}},albert_clear_buzzer:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"albert_clear_buzzer"},"class":"albert_buzzer",isNotFor:["albert"],func:function(a,b){a=Entry.hw.sendQueue; +a.buzzer=0;a.note=0;return b.callReturn()}},albert_play_note_for:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.note_c+"","4"],[Lang.General.note_c+"#","5"],[Lang.General.note_d+"","6"],[Lang.General.note_e+"b","7"],[Lang.General.note_e+"","8"],[Lang.General.note_f+"","9"],[Lang.General.note_f+"#","10"],[Lang.General.note_g+"","11"],[Lang.General.note_g+"#","12"],[Lang.General.note_a+"","13"],[Lang.General.note_b+"b","14"],[Lang.General.note_b+"","15"]], +value:"4",fontSize:11},{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"]],value:"1",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,"4",{type:"text",params:["0.5"]},null],type:"albert_play_note_for"},paramsKeyMap:{NOTE:0,OCTAVE:1,VALUE:2},"class":"albert_buzzer",isNotFor:["albert"],func:function(a,b){var c=Entry.hw.sendQueue;if(b.isStart){if(1==b.timeFlag)return b;delete b.isStart; +delete b.timeFlag;Entry.engine.isContinue=!1;c.note=0;return b.callReturn()}a=b.getNumberField("NOTE",b);var d=b.getNumberField("OCTAVE",b),e=6E4*b.getNumberValue("VALUE",b)/Entry.Albert.tempo;b.isStart=!0;b.timeFlag=1;c.buzzer=0;c.note=a+12*(d-1);if(100Entry.Albert.tempo&&(Entry.Albert.tempo=1);return b.callReturn()}},albert_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:"albert_set_tempo_to"},paramsKeyMap:{VALUE:0},"class":"albert_buzzer",isNotFor:["albert"],func:function(a,b){Entry.Albert.tempo=b.getNumberValue("VALUE"); +1>Entry.Albert.tempo&&(Entry.Albert.tempo=1);return b.callReturn()}},albert_move_forward:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null]},func:function(a,b){a=Entry.hw.sendQueue;if(b.isStart){if(1==b.timeFlag)return b;delete b.timeFlag;delete b.isStart;Entry.engine.isContinue=!1;a.leftWheel=0;a.rightWheel=0;return b.callReturn()}b.isStart=!0;b.timeFlag=1;a.leftWheel=30;a.rightWheel=30;setTimeout(function(){b.timeFlag= +0},1E3);return b}},albert_move_backward:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null]},func:function(a,b){a=Entry.hw.sendQueue;if(b.isStart){if(1==b.timeFlag)return a.leftWheel=-30,a.rightWheel=-30,b;delete b.timeFlag;delete b.isStart;Entry.engine.isContinue=!1;a.leftWheel=0;a.rightWheel=0;return b.callReturn()}b.isStart=!0;b.timeFlag=1;setTimeout(function(){b.timeFlag=0},1E3);return b}},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(a,b){a=Entry.hw.sendQueue;if(b.isStart){if(1==b.timeFlag)return a.leftWheel=b.leftValue,a.rightWheel=b.rightValue,b;delete b.timeFlag;delete b.isStart;delete b.leftValue;delete b.rightValue;Entry.engine.isContinue=!1; +a.leftWheel=0;a.rightWheel=0;return b.callReturn()}a="LEFT"==b.getField("DIRECTION",b);b.leftValue=a?-30:30;b.rightValue=a?30:-30;b.isStart=!0;b.timeFlag=1;setTimeout(function(){b.timeFlag=0},1E3);return b}},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(a,b){a=Entry.hw.sendQueue;var c=b.getField("DIRECTION",b),d=Number(b.getField("COLOR",b));"FRONT"==c?(a.leftEye=d,a.rightEye=d):"LEFT"==c?a.leftEye=d:a.rightEye=d;return b.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(a,b){a=Entry.hw.sendQueue;var c=b.getField("DIRECTION",b);"FRONT"==c?(a.leftEye=0,a.rightEye=0):"LEFT"==c?a.leftEye=0:a.rightEye=0;return b.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(a,b){a=Entry.hw.sendQueue;var c=Entry.hw.portData,d=b.getField("DIRECTION"),e=b.getNumberValue("VALUE");"LEFT"==d?a.leftWheel=void 0!=a.leftWheel?a.leftWheel+ +e:c.leftWheel+e:("RIGHT"!=d&&(a.leftWheel=void 0!=a.leftWheel?a.leftWheel+e:c.leftWheel+e),a.rightWheel=void 0!=a.rightWheel?a.rightWheel+e:c.rightWheel+e);return b.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(a,b){a=Entry.hw.sendQueue;var c=b.getField("DIRECTION"),d=b.getNumberValue("VALUE");"LEFT"==c?a.leftWheel=d:("RIGHT"!=c&&(a.leftWheel=d),a.rightWheel=d);return b.callReturn()}},arduino_text:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"TextInput",value:10}],events:{},def:{params:[]},paramsKeyMap:{NAME:0},func:function(a,b){return b.getStringField("NAME")}},arduino_send:{color:"#00979D",skeleton:"basic",statements:[], +params:[{type:"Block",accept:"string"}],events:{},def:{params:[]},paramsKeyMap:{VALUE:0},func:function(a,b){a=b.getValue("VALUE",b);var c=new XMLHttpRequest;c.open("POST","http://localhost:23518/arduino/",!1);c.send(String(a));Entry.assert(200==c.status,"arduino is not connected");return b.callReturn()}},arduino_get_number:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[]},paramsKeyMap:{VALUE:0},func:function(a,b){a=b.getValue("VALUE", +b);b=new XMLHttpRequest;b.open("POST","http://localhost:23518/arduino/",!1);b.send(String(a));Entry.assert(200==b.status,"arduino is not connected");return Number(b.responseText)}},arduino_get_string:{color:"#00979D",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[]},paramsKeyMap:{VALUE:0},func:function(a,b){a=b.getValue("VALUE",b);b=new XMLHttpRequest;b.open("POST","http://localhost:23518/arduino/",!1);b.send(String(a));Entry.assert(200== +b.status,"arduino is not connected");return b.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(a,b){return b.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(a,b){return b.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(a,b){return b.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(a,b){a=b.getValue("VALUE",b);return Entry.hw.getAnalogPortValue(a[1])}},arduino_get_digital_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Block",accept:"string"}],events:{},def:{params:[{type:"arduino_get_port_number"}],type:"arduino_get_digital_value"},paramsKeyMap:{VALUE:0},"class":"arduino_value",isNotFor:["arduino"],func:function(a,b){a=b.getNumberValue("VALUE",b);return Entry.hw.getDigitalPortValue(a)}},arduino_toggle_led:{color:"#00979D", +skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown",options:[[Lang.Blocks.ARDUINO_on,"on"],[Lang.Blocks.ARDUINO_off,"off"]],value:"on",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"arduino_get_port_number"},null,null],type:"arduino_toggle_led"},paramsKeyMap:{VALUE:0,OPERATOR:1},"class":"arduino_set",isNotFor:["arduino"],func:function(a,b){a=b.getNumberValue("VALUE");var c= +b.getField("OPERATOR");Entry.hw.setDigitalPortValue(a,"on"==c?255:0);return b.callReturn()}},arduino_toggle_pwm:{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:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"arduino_toggle_pwm"},paramsKeyMap:{PORT:0,VALUE:1},"class":"arduino_set",isNotFor:["arduino"],func:function(a, +b){a=b.getNumberValue("PORT");var c=b.getNumberValue("VALUE"),c=Math.round(c),c=Math.max(c,0),c=Math.min(c,255);Entry.hw.setDigitalPortValue(a,c);return b.callReturn()}},arduino_convert_scale:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number", +id:"bl5e"}]},{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"arduino_convert_scale"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2,VALUE4:3,VALUE5:4},"class":"arduino",isNotFor:["arduino"],func:function(a,b){var c=b.getNumberValue("VALUE1",b),d=b.getNumberValue("VALUE2",b),e=b.getNumberValue("VALUE3",b);a=b.getNumberValue("VALUE4",b);b=b.getNumberValue("VALUE5",b);if(d>e)var f=d,d=e,e=f;a>b&&(f=a,a=b,b=f);c=(b-a)/(e-d)*(c- +d);c+=a;c=Math.min(b,c);c=Math.max(a,c);return Math.round(c)}},arduino_ext_get_analog_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["A0","0"],["A1","1"],["A2","2"],["A3","3"],["A4","4"],["A5","5"]],value:"0",fontSize:11}],events:{},def:{params:[null],type:"arduino_ext_get_analog_value"},paramsKeyMap:{PORT:0},"class":"ArduinoExtGet",isNotFor:["ArduinoExt"],func:function(a,b){a=b.getField("PORT",b);var c=Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.ANALOG), +d=Entry.hw.portData.TIME||0;b=b.executor.scope;var e=Entry.hw.portData.ANALOG;if(b.isStart){if(d&&d===b.stamp||64Entry.hw.getAnalogPortValue(0)?1:0}},CODEino_get_light_status:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Dropdown", +options:[[Lang.Blocks.CODEino_string_14,"BRIGHT"],[Lang.Blocks.CODEino_string_15,"DARK"]],value:"BRIGHT",fontSize:11}],events:{},def:{params:[null],type:"CODEino_get_light_status"},paramsKeyMap:{STATUS:0},"class":"CODEino",isNotFor:["CODEino"],func:function(a,b){return"DARK"==b.getField("STATUS",b)?800Entry.hw.getAnalogPortValue(1)?1:0}},CODEino_is_button_pressed:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Dropdown", +options:[[Lang.Blocks.CODEino_string_3,"4"],[Lang.Blocks.CODEino_string_4,"17"],[Lang.Blocks.CODEino_string_5,"18"],[Lang.Blocks.CODEino_string_6,"19"],[Lang.Blocks.CODEino_string_7,"20"]],value:"4",fontSize:11}],events:{},def:{params:[null],type:"CODEino_is_button_pressed"},paramsKeyMap:{PORT:0},"class":"CODEino",isNotFor:["CODEino"],func:function(a,b){a=b.getNumberField("PORT",b);return 14b?1:0;if("RIGHT"==a||"FRONT"==a)return 30b?1:0}},CODEino_get_accelerometer_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["X","3"],["Y","4"],["Z","5"]],value:"3",fontSize:11}],events:{}, +def:{params:[null],type:"CODEino_get_accelerometer_value"},paramsKeyMap:{PORT:0},"class":"CODEino",isNotFor:["CODEino"],func:function(a,b){var c=Entry.hw.getAnalogPortValue(b.getField("PORT",b)),d=265,e=402;a=-90;b=90;if(d>e)var f=d,d=e,e=f;a>b&&(f=a,a=b,b=f);c=(b-a)/(e-d)*(c-d);c+=a;c=Math.min(b,c);c=Math.max(a,c);return Math.round(c)}},nemoino_get_named_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"%1 \uc13c\uc11c\uac12",params:[{type:"Dropdown", +options:[["\uc18c\ub9ac","0"],["\ube5b","1"],["\uc2ac\ub77c\uc774\ub354","2"],["\uc800\ud56d-A","3"],["\uc800\ud56d-B","4"],["\uc800\ud56d-C","5"],["\uc800\ud56d-D","6"]],value:"0",fontSize:11}],events:{},def:{params:[null],type:"nemoino_get_named_sensor_value"},paramsKeyMap:{PORT:0},"class":"nemoino",isNotFor:["nemoino"],func:function(a,b){return Entry.hw.getAnalogPortValue(b.getField("PORT",b))}},nemoino_get_sound_status:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[], +template:"\uc18c\ub9ac\uc13c\uc11c %1",params:[{type:"Dropdown",options:[["\uc18c\ub9ac\ud07c","GREAT"],["\uc18c\ub9ac\uc791\uc74c","SMALL"]],value:"GREAT",fontSize:11}],events:{},def:{params:[null],type:"nemoino_get_sound_status"},paramsKeyMap:{STATUS:0},"class":"nemoino",isNotFor:["nemoino"],func:function(a,b){return"GREAT"==b.getField("STATUS",b)?600Entry.hw.getAnalogPortValue(0)?1:0}},nemoino_is_button_pressed:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field", +statements:[],template:"\ubcf4\ub4dc\uc758 %1",params:[{type:"Dropdown",options:[["\ubc84\ud2bc\ub204\ub984","4"],["A\uc5f0\uacb0\ub428","17"],["B\uc5f0\uacb0\ub428","18"],["C\uc5f0\uacb0\ub428","19"],["D\uc5f0\uacb0\ub428","20"]],value:"4",fontSize:11}],events:{},def:{params:[null],type:"nemoino_is_button_pressed"},paramsKeyMap:{PORT:0},"class":"nemoino",isNotFor:["nemoino"],func:function(a,b){a=b.getNumberField("PORT",b);return 14b?1:0;if("RIGHT"==a||"FRONT"==a)return 30b?1:0}},nemoino_get_accelerometer_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field", +statements:[],template:"3\ucd95 \uac00\uc18d\ub3c4\uc13c\uc11c %1 \ucd95\uc758 \uc13c\uc11c\uac12",params:[{type:"Dropdown",options:[["X","3"],["Y","4"],["Z","5"]],value:"3",fontSize:11}],events:{},def:{params:[null],type:"nemoino_get_accelerometer_value"},paramsKeyMap:{PORT:0},"class":"nemoino",isNotFor:["nemoino"],func:function(a,b){var c=Entry.hw.getAnalogPortValue(b.getField("PORT",b)),d=265,e=402;a=-90;b=90;if(d>e)var f=d,d=e,e=f;a>b&&(f=a,a=b,b=f);c=(b-a)/(e-d)*(c-d);c+=a;c=Math.min(b,c);c= +Math.max(a,c);return Math.round(c)}},bitbrick_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW,menuName:Entry.Bitbrick.sensorList}],events:{},def:{params:[null],type:"bitbrick_sensor_value"},paramsKeyMap:{PORT:0},"class":"condition",isNotFor:["bitbrick"],func:function(a,b){a=b.getStringField("PORT");return Entry.hw.portData[a].value}},bitbrick_is_touch_pressed:{color:"#00979D", +fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.touchList}],events:{},def:{params:[null],type:"bitbrick_is_touch_pressed"},paramsKeyMap:{PORT:0},"class":"condition",isNotFor:["bitbrick"],func:function(a,b){return 0===Entry.hw.portData[b.getStringField("PORT")].value}},bitbrick_turn_off_color_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}], +events:{},def:{params:[null],type:"bitbrick_turn_off_color_led",id:"i3je"},"class":"condition",isNotFor:["bitbrick"],func:function(a,b){Entry.hw.sendQueue.LEDR=0;Entry.hw.sendQueue.LEDG=0;Entry.hw.sendQueue.LEDB=0;return b.callReturn()}},bitbrick_turn_on_color_led_by_rgb:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text", +params:["255"]},{type:"text",params:["255"]},{type:"text",params:["255"]},null],type:"bitbrick_turn_on_color_led_by_rgb"},paramsKeyMap:{rValue:0,gValue:1,bValue:2},"class":"condition",isNotFor:["bitbrick"],func:function(a,b){a=b.getNumberValue("rValue");var c=b.getNumberValue("gValue"),d=b.getNumberValue("bValue"),e=Entry.adjustValueWithMaxMin,f=Entry.hw.sendQueue;f.LEDR=e(a,0,255);f.LEDG=e(c,0,255);f.LEDB=e(d,0,255);return b.callReturn()}},bitbrick_turn_on_color_led_by_picker:{color:"#00979D",skeleton:"basic", +statements:[],params:[{type:"Color"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"bitbrick_turn_on_color_led_by_picker"},paramsKeyMap:{VALUE:0},"class":"condition",isNotFor:["bitbrick"],func:function(a,b){a=b.getStringField("VALUE");Entry.hw.sendQueue.LEDR=parseInt(a.substr(1,2),16);Entry.hw.sendQueue.LEDG=parseInt(a.substr(3,2),16);Entry.hw.sendQueue.LEDB=parseInt(a.substr(5,2),16);return b.callReturn()}},bitbrick_turn_on_color_led_by_value:{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:["0"]},null],type:"bitbrick_turn_on_color_led_by_value"},paramsKeyMap:{VALUE:0},"class":"condition",isNotFor:["bitbrick"],func:function(a,b){a=b.getNumberValue("VALUE");var c,d,e;a%=200;67>a?(c=200-3*a,d=3*a,e=0):134>a?(a-=67,c=0,d=200-3*a,e=3*a):201>a&&(a-=134,c=3*a,d=0,e=200-3*a);Entry.hw.sendQueue.LEDR=c;Entry.hw.sendQueue.LEDG= +d;Entry.hw.sendQueue.LEDB=e;return b.callReturn()}},bitbrick_buzzer:{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:"bitbrick_buzzer"},paramsKeyMap:{VALUE:0},"class":"condition",isNotFor:["bitbrick"],func:function(a,b){if(b.isStart)return Entry.hw.sendQueue.buzzer=0,delete b.isStart,b.callReturn();a=b.getNumberValue("VALUE");Entry.hw.sendQueue.buzzer= +a;b.isStart=!0;return b}},bitbrick_turn_off_all_motors:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"bitbrick_turn_off_all_motors"},"class":"condition",isNotFor:["bitbrick"],func:function(a,b){var c=Entry.hw.sendQueue;a=Entry.Bitbrick;a.servoList().map(function(b){c[b[1]]=0});a.dcList().map(function(b){c[b[1]]=128});return b.callReturn()}},bitbrick_dc_speed:{color:"#00979D",skeleton:"basic",statements:[], +params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.dcList},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"text",params:["60"]},null],type:"bitbrick_dc_speed"},paramsKeyMap:{PORT:0,VALUE:1},"class":"condition",isNotFor:["bitbrick"],func:function(a,b){a=b.getNumberValue("VALUE");a=Math.min(a,Entry.Bitbrick.dcMaxValue);a=Math.max(a,Entry.Bitbrick.dcMinValue);Entry.hw.sendQueue[b.getStringField("PORT")]= +a+128;return b.callReturn()}},bitbrick_dc_direction_speed:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.dcList},{type:"Dropdown",options:[[Lang.Blocks.BITBRICK_dc_direction_cw,"CW"],[Lang.Blocks.BITBRICK_dc_direction_ccw,"CCW"]],value:"CW",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,{type:"text",params:["100"]},null],type:"bitbrick_dc_direction_speed"}, +paramsKeyMap:{PORT:0,DIRECTION:1,VALUE:2},"class":"condition",isNotFor:["bitbrick"],func:function(a,b){a="CW"===b.getStringField("DIRECTION");var c=b.getNumberValue("VALUE"),c=Math.min(c,Entry.Bitbrick.dcMaxValue),c=Math.max(c,0);Entry.hw.sendQueue[b.getStringField("PORT")]=a?c+128:128-c;return b.callReturn()}},bitbrick_servomotor_angle:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.servoList},{type:"Block",accept:"string"}, +{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"text",params:["100"]},null],type:"bitbrick_servomotor_angle"},paramsKeyMap:{PORT:0,VALUE:1},"class":"condition",isNotFor:["bitbrick"],func:function(a,b){a=Entry.Bitbrick.servoMaxValue-(b.getNumberValue("VALUE")+1);a=Math.min(a,Entry.Bitbrick.servoMaxValue);a=Math.max(a,Entry.Bitbrick.servoMinValue);Entry.hw.sendQueue[b.getStringField("PORT")]=a;return b.callReturn()}},bitbrick_convert_scale:{color:"#00979D", +fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.sensorList},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"}],events:{},def:{params:[null,{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["-100"]},{type:"number",params:["100"]}],type:"bitbrick_convert_scale"},paramsKeyMap:{PORT:0,VALUE2:1,VALUE3:2,VALUE4:3, +VALUE5:4},"class":"condition",isNotFor:["bitbrick"],func:function(a,b){a=b.getNumberField("PORT");var c=Entry.hw.portData[a].value,d=b.getNumberValue("VALUE2",b),e=b.getNumberValue("VALUE3",b);a=b.getNumberValue("VALUE4",b);b=b.getNumberValue("VALUE5",b);if(a>b){var f=a;a=b;b=f}c=(b-a)/(e-d)*(c-d);c+=a;c=Math.min(b,c);c=Math.max(a,c);return Math.round(c)}},start_drawing:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null], +type:"start_drawing"},"class":"brush_control",isNotFor:["textBox"],func:function(a,b){a.brush?a.brush.stop=!1:Entry.setBasicBrush(a);Entry.stage.sortZorder();a.brush.moveTo(a.getX(),-1*a.getY());return b.callReturn()}},stop_drawing:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"stop_drawing"},"class":"brush_control",isNotFor:["textBox"],func:function(a,b){a.brush&&a.shape&&(a.brush.stop=!0);return b.callReturn()}}, +set_color:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Color"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"set_color"},paramsKeyMap:{VALUE:0},"class":"brush_color",isNotFor:["textBox"],func:function(a,b){var c=b.getField("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(c=Entry.hex2rgb(c),a.brush.rgb=c,a.brush.endStroke(),a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")"),a.brush.moveTo(a.getX(), +-1*a.getY()));return b.callReturn()}},set_random_color:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"set_random_color"},"class":"brush_color",isNotFor:["textBox"],func:function(a,b){a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);if(a.brush){var c=Entry.generateRgb();a.brush.rgb=c;a.brush.endStroke();a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")");a.brush.moveTo(a.getX(), +-1*a.getY())}return b.callReturn()}},change_thickness:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["1"]},null],type:"change_thickness"},paramsKeyMap:{VALUE:0},"class":"brush_thickness",isNotFor:["textBox"],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(a.brush.thickness+=c,1>a.brush.thickness&& +(a.brush.thickness=1),a.brush.setStrokeStyle(a.brush.thickness),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}},set_thickness:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["1"]},null],type:"set_thickness"},paramsKeyMap:{VALUE:0},"class":"brush_thickness",isNotFor:["textBox"],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a), +a.brush.stop=!0);a.brush&&(a.brush.thickness=c,a.brush.setStrokeStyle(a.brush.thickness),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}},change_opacity:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_opacity"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(a,b){var c=b.getNumberValue("VALUE", +b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);c=Entry.adjustValueWithMaxMin(a.brush.opacity+c,0,100);a.brush&&(a.brush.opacity=c,a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}},set_opacity:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number", +params:["50"]},null],type:"set_opacity"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(a.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}},brush_erase_all:{color:"#FF9E20",skeleton:"basic",statements:[], +params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"brush_erase_all"},"class":"brush_clear",isNotFor:["textBox"],func:function(a,b){var c=a.brush;if(c){var d=c._stroke.style,e=c._strokeStyle.width;c.clear().setStrokeStyle(e).beginStroke(d);c.moveTo(a.getX(),-1*a.getY())}a=a.parent.getStampEntities();a.map(function(b){b.removeClone()});a=null;return b.callReturn()}},brush_stamp:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator", +img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"brush_stamp"},"class":"stamp",isNotFor:["textBox"],func:function(a,b){a.parent.addStampEntity(a);return b.callReturn()}},change_brush_transparency:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_brush_transparency"},paramsKeyMap:{VALUE:0},"class":"brush_opacity", +isNotFor:["textBox"],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);c=Entry.adjustValueWithMaxMin(a.brush.opacity-c,0,100);a.brush&&(a.brush.opacity=c,a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+a.brush.opacity/100+")"),a.brush.moveTo(a.getX(),-1*a.getY()));return b.callReturn()}},set_brush_tranparency:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator", +img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["50"]},null],type:"set_brush_tranparency"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.brush||(Entry.setBasicBrush(a),a.brush.stop=!0);a.brush&&(a.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),a.brush.endStroke(),c=a.brush.rgb,a.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+(1-a.brush.opacity/100)+")"),a.brush.moveTo(a.getX(), +-1*a.getY()));return b.callReturn()}},number:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"TextInput",value:10}],events:{},def:{params:[]},paramsKeyMap:{NUM:0},func:function(a,b){return b.getField("NUM",b)},isPrimitive:!0},angle:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Angle"}],events:{},def:{params:[null],type:"angle"},paramsKeyMap:{ANGLE:0},func:function(a,b){return b.getNumberField("ANGLE")}},get_x_coordinate:{color:"#FFD974",skeleton:"basic_string_field", +statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_x_coordinate,color:"#3D3D3D"}],events:{},def:{params:[null],type:"get_x_coordinate"},"class":"calc",isNotFor:[],func:function(a,b){return a.getX()}},get_y_coordinate:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_y_coordinate,color:"#3D3D3D"}],events:{},def:{params:[null],type:"get_y_coordinate"},"class":"calc",isNotFor:[],func:function(a,b){return a.getY()}},get_angle:{color:"#FFD974", +skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_angle,color:"#3D3D3D"}],events:{},def:{params:[null]},func:function(a,b){return parseFloat(a.getRotation().toFixed(1))}},get_rotation_direction:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CALC_rotation_value,"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(a,b){return"DIRECTION"==b.getField("OPERATOR",b).toUpperCase()?parseFloat(a.getDirection().toFixed(1)):parseFloat(a.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(a,b){b=b.getField("VALUE",b);if("mouse"==b)return b=Entry.stage.mouseCoordinate,Math.sqrt(Math.pow(a.getX()-b.x,2)+Math.pow(a.getY()-b.y,2));b=Entry.container.getEntity(b);return Math.sqrt(Math.pow(a.getX()-b.getX(),2)+Math.pow(a.getY()-b.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(a,b){return"x"===b.getField("VALUE",b)?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(a,b){var c=b.getField("VALUE",b);a="self"==c?a:Entry.container.getEntity(c);switch(b.getField("COORDINATE", +b)){case "x":return a.getX();case "y":return a.getY();case "rotation":return a.getRotation();case "direction":return a.getDirection();case "picture_index":return b=a.parent,b=b.pictures,b.indexOf(a.picture)+1;case "size":return Number(a.getSize().toFixed(1));case "picture_name":return b=a.parent,b=b.pictures,b[b.indexOf(a.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(a,b){a=b.getField("OPERATOR",b);var c=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return"PLUS"==a?c+b:"MINUS"==a?c-b:"MULTI"==a?c*b:c/b}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a+b}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND", +b);return a-b}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a*b}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a/b}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a%b}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return Math.floor(a/b)}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getField("VALUE",b); +if(-1<["asin_radian","acos_radian"].indexOf(b)&&(1a))throw Error("x range exceeded");b.indexOf("_")&&(b=b.split("_")[0]);-1<["sin","cos","tan"].indexOf(b)&&(a=Entry.toRadian(a));switch(b){case "square":b=a*a;break;case "factorial":b=Entry.factorial(a);break;case "root":b=Math.sqrt(a);break;case "log":b=Math.log(a)/Math.LN10;break;case "ln":b=Math.log(a);break;case "asin":case "acos":case "atan":b=Entry.toDegrees(Math[b](a));break;case "unnatural":b=a-Math.floor(a);0>a&&(b=1-b);break;default:b= +Math[b](a)}return b}},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,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_rand_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"number",params:["0"]},null,{type:"number",params:["10"]},null],type:"calc_rand"},paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3}, +"class":"calc",isNotFor:[],func:function(a,b){a=b.getStringValue("LEFTHAND",b);b=b.getStringValue("RIGHTHAND",b);var c=Math.min(a,b),d=Math.max(a,b);a=Entry.isFloat(a);return Entry.isFloat(b)||a?(Math.random()*(d-c)+c).toFixed(2):Math.floor(Math.random()*(d-c+1)+c)}},get_date:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_date_1,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_get_date_year,"YEAR"],[Lang.Blocks.CALC_get_date_month, +"MONTH"],[Lang.Blocks.CALC_get_date_day,"DAY"],[Lang.Blocks.CALC_get_date_hour,"HOUR"],[Lang.Blocks.CALC_get_date_minute,"MINUTE"],[Lang.Blocks.CALC_get_date_second,"SECOND"]],value:"YEAR",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_get_date_2,color:"#3D3D3D"}],events:{},def:{params:[null,"YEAR",null],type:"get_date"},paramsKeyMap:{VALUE:1},"class":"calc_date",isNotFor:[],func:function(a,b){a=b.getField("VALUE",b);b=new Date;return"YEAR"==a?b.getFullYear(): +"MONTH"==a?b.getMonth()+1:"DAY"==a?b.getDate():"HOUR"==a?b.getHours():"MINUTE"==a?b.getMinutes():b.getSeconds()}},get_sound_duration:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_sound_duration_1,color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"sounds",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_get_sound_duration_2,color:"#3D3D3D"}],events:{},def:{params:[null,null,null],type:"get_sound_duration"}, +paramsKeyMap:{VALUE:1},"class":"calc_duration",isNotFor:[],func:function(a,b){b=b.getField("VALUE",b);a=a.parent.sounds;for(var c=0;cb||b>a.length-1)throw Error();return a[b]}},length_of_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_length_of_string_1, +color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_length_of_string_2,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.entry]},null],type:"length_of_string"},paramsKeyMap:{STRING:1},"class":"calc_string",isNotFor:[],func:function(a,b){return b.getStringValue("STRING",b).length}},substring:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_substring_1,color:"#3D3D3D"},{type:"Block",accept:"string"}, +{type:"Text",text:Lang.Blocks.CALC_substring_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_substring_3,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_substring_4,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"number",params:["2"]},null,{type:"number",params:["5"]},null],type:"substring"},paramsKeyMap:{STRING:1,START:3,END:5},"class":"calc_string",isNotFor:[],func:function(a, +b){a=b.getStringValue("STRING",b);var c=b.getNumberValue("START",b)-1;b=b.getNumberValue("END",b)-1;var d=a.length-1;if(0>c||0>b||c>d||b>d)throw Error();return a.substring(Math.min(c,b),Math.max(c,b)+1)}},replace_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_replace_string_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text", +text:Lang.Blocks.CALC_replace_string_3,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_4,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"text",params:[Lang.Blocks.hello]},null,{type:"text",params:[Lang.Blocks.nice]},null],type:"replace_string"},paramsKeyMap:{STRING:1,OLD_WORD:3,NEW_WORD:5},"class":"calc_string",isNotFor:[],func:function(a,b){return b.getStringValue("STRING",b).replace(new RegExp(b.getStringValue("OLD_WORD", +b),"gm"),b.getStringValue("NEW_WORD",b))}},change_string_case:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_change_string_case_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_change_string_case_2,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_change_string_case_sub_1,"toUpperCase"],[Lang.Blocks.CALC_change_string_case_sub_2,"toLowerCase"]],value:"toUpperCase",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}, +{type:"Text",text:Lang.Blocks.CALC_change_string_case_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:["Hello Entry!"]},null,null,null],type:"change_string_case"},paramsKeyMap:{STRING:1,CASE:3},"class":"calc_string",isNotFor:[],func:function(a,b){return b.getStringValue("STRING",b)[b.getField("CASE",b)]()}},index_of_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_index_of_string_1,color:"#3D3D3D"},{type:"Block",accept:"string"}, +{type:"Text",text:Lang.Blocks.CALC_index_of_string_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_index_of_string_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"text",params:[Lang.Blocks.entry]},null],type:"index_of_string"},paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3},"class":"calc_string",isNotFor:[],func:function(a,b){a=b.getStringValue("LEFTHAND",b);b=b.getStringValue("RIGHTHAND",b);b=a.indexOf(b);return-1< +b?b+1:0}},combine_something:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_combine_something_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.VARIABLE_combine_something_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.VARIABLE_combine_something_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.block_hi]},null,{type:"text",params:[Lang.Blocks.entry]}, +null],type:"combine_something"},paramsKeyMap:{VALUE1:1,VALUE2:3},"class":"calc_string",isNotFor:[],func:function(a,b){a=b.getStringValue("VALUE1",b);b=b.getStringValue("VALUE2",b);return a+b}},get_sound_volume:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_sound_volume,color:"#3D3D3D"},{type:"Text",text:"",color:"#3D3D3D"}],events:{},def:{params:[null,null],type:"get_sound_volume"},"class":"calc",isNotFor:[""],func:function(a,b){return 100* createjs.Sound.getVolume()}},quotient_and_mod:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_quotient_and_mod_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_quotient_and_mod_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_quotient_and_mod_3,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_quotient_and_mod_sub_1,"QUOTIENT"],[Lang.Blocks.CALC_quotient_and_mod_sub_2, -"MOD"]],value:"QUOTIENT",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}],events:{},def:{params:[null,{type:"text",params:["10"]},null,{type:"text",params:["10"]},null,null],type:"quotient_and_mod"},paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3,OPERATOR:5},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);if(isNaN(c)||isNaN(d))throw Error();return"QUOTIENT"==a.getField("OPERATOR",a)?Math.floor(c/d):c%d}},choose_project_timer_action:{color:"#FFD974", +"MOD"]],value:"QUOTIENT",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}],events:{},def:{params:[null,{type:"text",params:["10"]},null,{type:"text",params:["10"]},null,null],type:"quotient_and_mod"},paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3,OPERATOR:5},"class":"calc",isNotFor:[],func:function(a,b){a=b.getNumberValue("LEFTHAND",b);var c=b.getNumberValue("RIGHTHAND",b);if(isNaN(a)||isNaN(c))throw Error();return"QUOTIENT"==b.getField("OPERATOR",b)?Math.floor(a/c):a%c}},choose_project_timer_action:{color:"#FFD974", skeleton:"basic",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_choose_project_timer_action_1,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_choose_project_timer_action_sub_1,"START"],[Lang.Blocks.CALC_choose_project_timer_action_sub_2,"STOP"],[Lang.Blocks.CALC_choose_project_timer_action_sub_3,"RESET"]],value:"START",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_choose_project_timer_action_2,color:"#3D3D3D"},{type:"Indicator",img:"block_icon/calc_01.png", -size:12}],events:{viewAdd:[function(){Entry.engine&&Entry.engine.showProjectTimer()}],dataDestroy:[function(b){Entry.engine&&Entry.engine.hideProjectTimer(b)}]},def:{params:[null,"START",null,null],type:"choose_project_timer_action"},paramsKeyMap:{ACTION:1},"class":"calc_timer",isNotFor:[],func:function(b,a){var c=a.getField("ACTION"),d=Entry.engine,e=d.projectTimer;"START"==c?e.isInit?e.isInit&&e.isPaused&&(e.pauseStart&&(e.pausedTime+=(new Date).getTime()-e.pauseStart),delete e.pauseStart,e.isPaused= -!1):d.startProjectTimer():"STOP"==c?e.isInit&&!e.isPaused&&(e.isPaused=!0,e.pauseStart=(new Date).getTime()):"RESET"==c&&e.isInit&&(e.setValue(0),e.start=(new Date).getTime(),e.pausedTime=0,delete e.pauseStart);return a.callReturn()}},wait_second:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},null],type:"wait_second"},paramsKeyMap:{SECOND:0},"class":"delay", -isNotFor:[],func:function(b,a){if(a.isStart){if(1==a.timeFlag)return a;delete a.timeFlag;delete a.isStart;Entry.engine.isContinue=!1;return a.callReturn()}a.isStart=!0;a.timeFlag=1;var c=a.getNumberValue("SECOND",a),c=60/(Entry.FPS||60)*c*1E3;setTimeout(function(){a.timeFlag=0},c);return a}},repeat_basic:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"number", -params:["10"]},null],type:"repeat_basic"},paramsKeyMap:{VALUE:0},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(b,a){var c;if(!a.isLooped){a.isLooped=!0;c=a.getNumberValue("VALUE",a);if(0>c)throw Error(Lang.Blocks.FLOW_repeat_basic_errorMsg);a.iterCount=Math.floor(c)}if(0==a.iterCount||0>a.iterCount)return delete a.isLooped,delete a.iterCount,a.callReturn();a.iterCount--;return a.getStatement("DO",a)}},repeat_inf:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}], -params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null],type:"repeat_inf"},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(b,a){a.isLooped=!0;return a.getStatement("DO")}},stop_repeat:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null],type:"stop_repeat"},"class":"repeat",isNotFor:[],func:function(b,a){return this.executor.breakLoop()}},wait_until_true:{color:"#498deb", -skeleton:"basic",statements:[],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"},null],type:"wait_until_true"},paramsKeyMap:{BOOL:0},"class":"wait",isNotFor:[],func:function(b,a){return a.getBooleanValue("BOOL",a)?a.callReturn():a}},_if:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"}, -null],type:"_if"},paramsKeyMap:{BOOL:0},statementsKeyMap:{STACK:0},"class":"condition",isNotFor:[],func:function(b,a){return a.isCondition?(delete a.isCondition,a.callReturn()):a.getBooleanValue("BOOL",a)?(a.isCondition=!0,a.getStatement("STACK",a)):a.callReturn()}},if_else:{color:"#498deb",skeleton:"basic_double_loop",statements:[{accept:"basic"},{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12},{type:"LineBreak"}],events:{},def:{params:[{type:"True"}, -null],type:"if_else"},paramsKeyMap:{BOOL:0},statementsKeyMap:{STACK_IF:0,STACK_ELSE:1},"class":"condition",isNotFor:[],func:function(b,a){if(a.isCondition)return delete a.isCondition,a.callReturn();var c=a.getBooleanValue("BOOL",a);a.isCondition=!0;return c?a.getStatement("STACK_IF",a):a.getStatement("STACK_ELSE",a)}},create_clone:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"clone",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator", -img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null,null],type:"create_clone"},paramsKeyMap:{VALUE:0},"class":"clone",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d=a.callReturn();"self"==c?b.parent.addCloneEntity(b.parent,b,null):Entry.container.getObject(c).addCloneEntity(b.parent,null,null);return d}},delete_clone:{color:"#498deb",skeleton:"basic_without_next",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null], -type:"delete_clone"},"class":"clone",isNotFor:[],func:function(b,a){if(!b.isClone)return a.callReturn();b.removeClone();return this.die()}},when_clone_start:{color:"#498deb",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_clone.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"when_clone_start"},"class":"clone",isNotFor:[],func:function(b,a){return a.callReturn()},event:"when_clone_start"},stop_run:{color:"#498deb",skeleton:"basic",statements:[], -params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null]},func:function(b,a){return Entry.engine.toggleStop()}},repeat_while_true:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Dropdown",options:[[Lang.Blocks.FLOW_repeat_while_true_until,"until"],[Lang.Blocks.FLOW_repeat_while_true_while,"while"]],value:"until",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator",img:"block_icon/flow_03.png", -size:12}],events:{},def:{params:[{type:"True"},null,null],type:"repeat_while_true"},paramsKeyMap:{BOOL:0,OPTION:1},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(b,a){var c=a.getBooleanValue("BOOL",a);"until"==a.getField("OPTION",a)&&(c=!c);return(a.isLooped=c)?a.getStatement("DO",a):a.callReturn()}},stop_object:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.FLOW_stop_object_all,"all"],[Lang.Blocks.FLOW_stop_object_this_object,"thisOnly"], -[Lang.Blocks.FLOW_stop_object_this_thread,"thisThread"],[Lang.Blocks.FLOW_stop_object_other_thread,"otherThread"]],value:"all",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null,null],type:"stop_object"},paramsKeyMap:{TARGET:0},"class":"terminate",isNotFor:[],func:function(b,a){var c=a.getField("TARGET",a),d=Entry.container;switch(c){case "all":return d.clearRunningState(),this.die();case "thisOnly":return b.parent.script.clearExecutorsByEntity(b), -this.die();case "thisObject":return b.parent.script.clearExecutors(),this.die();case "thisThread":return this.die();case "otherThread":for(var c=this.executor,d=b.parent.script,e=d.executors,f=0;fa)throw Error(Lang.Blocks.FLOW_repeat_basic_errorMsg);b.iterCount=Math.floor(a)}if(0==b.iterCount||0>b.iterCount)return delete b.isLooped,delete b.iterCount,b.callReturn();b.iterCount--;return b.getStatement("DO",b)}},repeat_inf:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Indicator", +img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null],type:"repeat_inf"},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(a,b){b.isLooped=!0;return b.getStatement("DO")}},stop_repeat:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null],type:"stop_repeat"},"class":"repeat",isNotFor:[],func:function(a,b){return this.executor.breakLoop()}},wait_until_true:{color:"#498deb",skeleton:"basic", +statements:[],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"},null],type:"wait_until_true"},paramsKeyMap:{BOOL:0},"class":"wait",isNotFor:[],func:function(a,b){return b.getBooleanValue("BOOL",b)?b.callReturn():b}},_if:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"}, +null],type:"_if"},paramsKeyMap:{BOOL:0},statementsKeyMap:{STACK:0},"class":"condition",isNotFor:[],func:function(a,b){return b.isCondition?(delete b.isCondition,b.callReturn()):b.getBooleanValue("BOOL",b)?(b.isCondition=!0,b.getStatement("STACK",b)):b.callReturn()}},if_else:{color:"#498deb",skeleton:"basic_double_loop",statements:[{accept:"basic"},{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12},{type:"LineBreak"}],events:{},def:{params:[{type:"True"}, +null],type:"if_else"},paramsKeyMap:{BOOL:0},statementsKeyMap:{STACK_IF:0,STACK_ELSE:1},"class":"condition",isNotFor:[],func:function(a,b){if(b.isCondition)return delete b.isCondition,b.callReturn();a=b.getBooleanValue("BOOL",b);b.isCondition=!0;return a?b.getStatement("STACK_IF",b):b.getStatement("STACK_ELSE",b)}},create_clone:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"clone",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator", +img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null,null],type:"create_clone"},paramsKeyMap:{VALUE:0},"class":"clone",isNotFor:[],func:function(a,b){var c=b.getField("VALUE",b);b=b.callReturn();"self"==c?a.parent.addCloneEntity(a.parent,a,null):Entry.container.getObject(c).addCloneEntity(a.parent,null,null);return b}},delete_clone:{color:"#498deb",skeleton:"basic_without_next",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null], +type:"delete_clone"},"class":"clone",isNotFor:[],func:function(a,b){if(!a.isClone)return b.callReturn();a.removeClone();return this.die()}},when_clone_start:{color:"#498deb",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_clone.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"when_clone_start"},"class":"clone",isNotFor:[],func:function(a,b){return b.callReturn()},event:"when_clone_start"},stop_run:{color:"#498deb",skeleton:"basic",statements:[], +params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null]},func:function(a,b){return Entry.engine.toggleStop()}},repeat_while_true:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Dropdown",options:[[Lang.Blocks.FLOW_repeat_while_true_until,"until"],[Lang.Blocks.FLOW_repeat_while_true_while,"while"]],value:"until",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator",img:"block_icon/flow_03.png", +size:12}],events:{},def:{params:[{type:"True"},null,null],type:"repeat_while_true"},paramsKeyMap:{BOOL:0,OPTION:1},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(a,b){a=b.getBooleanValue("BOOL",b);"until"==b.getField("OPTION",b)&&(a=!a);return(b.isLooped=a)?b.getStatement("DO",b):b.callReturn()}},stop_object:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.FLOW_stop_object_all,"all"],[Lang.Blocks.FLOW_stop_object_this_object,"thisOnly"], +[Lang.Blocks.FLOW_stop_object_this_thread,"thisThread"],[Lang.Blocks.FLOW_stop_object_other_thread,"otherThread"]],value:"all",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null,null],type:"stop_object"},paramsKeyMap:{TARGET:0},"class":"terminate",isNotFor:[],func:function(a,b){var c=b.getField("TARGET",b),d=Entry.container;switch(c){case "all":return d.clearRunningState(),this.die();case "thisOnly":return a.parent.script.clearExecutorsByEntity(a), +this.die();case "thisObject":return a.parent.script.clearExecutors(),this.die();case "thisThread":return this.die();case "otherThread":c=this.executor;a=a.parent.script;for(var d=a.executors,e=0;ea.count?(50>d.leftFloor&&50>d.rightFloor?a.count++:a.count=0,d=d.leftFloor-d.rightFloor,c.leftWheel=45+.25*d,c.rightWheel=45-.25*d):(a.count=0,a.boardState=2);break;case 2:d=d.leftFloor-d.rightFloor;c.leftWheel=45+.25*d;c.rightWheel= -45-.25*d;a.boardState=3;var e=setTimeout(function(){a.boardState=4;Entry.Hamster.removeTimeout(e)},250);Entry.Hamster.timeouts.push(e);break;case 3:d=d.leftFloor-d.rightFloor;c.leftWheel=45+.25*d;c.rightWheel=45-.25*d;break;case 4:c.leftWheel=0,c.rightWheel=0,a.boardState=0,a.isMoving=!1}return a}delete a.isStart;delete a.isMoving;delete a.count;delete a.boardState;Entry.engine.isContinue=!1;c.leftWheel=0;c.rightWheel=0;return a.callReturn()}a.isStart=!0;a.isMoving=!0;a.count=0;a.boardState=1;c.leftWheel= -45;c.rightWheel=45;Entry.Hamster.setLineTracerMode(c,0);return a}},hamster_turn_once:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null],type:"hamster_turn_once"},paramsKeyMap:{DIRECTION:0},"class":"hamster_board",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=Entry.hw.portData; -if(a.isStart){if(a.isMoving){if(a.isLeft)switch(a.boardState){case 1:2>a.count?50d.leftFloor&&(a.boardState=3);break;case 3:2>a.count?20>d.leftFloor&&a.count++:(a.count=0,a.boardState=4);break;case 4:50a.count?50d.rightFloor&&(a.boardState=3);break;case 3:2>a.count?20>d.rightFloor&&a.count++:(a.count=0,a.boardState=4);break;case 4:50Entry.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":return!!(f(d,e.up,.2,!0)||f(d,e.down,.2,!0)||f(d,e.left,.2,!0)||f(d, -e.right,.2,!0));case "wall_up":return!!f(d,e.up,.2,!0);case "wall_down":return!!f(d,e.down,.2,!0);case "wall_right":return!!f(d,e.right,.2,!0);case "wall_left":return!!f(d,e.left,.2,!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",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(!0);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(!0);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(-1f)throw Error("object is not available for current scene");switch(d){case "FRONT":c=0;break;case "FORWARD":c=Math.max(0,f-1);break;case "BACKWARD":c=Math.min(e,f+1);break;case "BACK":c=e}Entry.container.moveElementByBlock(f,c);return a.callReturn()}},move_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:["10"]},null],type:"move_direction"},paramsKeyMap:{VALUE:0},"class":"walk",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(b.getX()+c*Math.cos((b.getRotation()+b.getDirection()-90)/180*Math.PI));b.setY(b.getY()-c*Math.sin((b.getRotation()+b.getDirection()-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},move_x:{color:"#A751E3",skeleton:"basic", -statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"move_x"},paramsKeyMap:{VALUE:0},"class":"move_relative",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(b.getX()+c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},move_y:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator", -img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"move_y"},paramsKeyMap:{VALUE:0},"class":"move_relative",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setY(b.getY()+c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},locate_xy_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator", -img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"locate_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_absolute",isNotFor:[],func:function(b,a){function c(){var c=a.x-b.getX(),d=a.y-b.getY(),c=c/a.frameCount,d=d/a.frameCount;b.setX(b.getX()+c);b.setY(b.getY()+d);a.frameCount--;b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY())}if(!a.isStart){var d;d=a.getNumberValue("VALUE1", -a);a.isStart=!0;a.frameCount=Math.max(Math.floor(d*Entry.FPS),1);a.x=a.getNumberValue("VALUE2",a);a.y=a.getNumberValue("VALUE3",a);1==a.frameCount&&c()}if(0!=a.frameCount)return c(),a;delete a.isStart;delete a.frameCount;return a.callReturn()}},rotate_by_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"rotate_by_angle"},paramsKeyMap:{VALUE:0}, -"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(b.getRotation()+c);return a.callReturn()}},rotate_by_angle_dropdown:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["45","45"],["90","90"],["135","135"],["180","180"]],value:"45",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:["45",null],type:"rotate_by_angle_dropdown"},paramsKeyMap:{VALUE:0},"class":"ebs",isNotFor:[],func:function(b, -a){var c=a.getField("VALUE",a);b.setRotation(b.getRotation()+Number(c));return a.callReturn()}},see_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"see_angle"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}},see_direction:{color:"#A751E3", -skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"sprites",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null]},paramsKeyMap:{VALUE:0},func:function(b,a){var c=a.getField("VALUE",a),d=Entry.container.getEntity(c),c=d.getX()-b.getX(),d=d.getY()-b.getY();0<=c?b.setRotation(Math.atan(d/c)/Math.PI*180+90):b.setRotation(Math.atan(d/c)/Math.PI*180+270);return a.callReturn()}},locate_xy:{color:"#A751E3",skeleton:"basic", -statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["0"]},{type:"number",params:["0"]},null],type:"locate_xy"},paramsKeyMap:{VALUE1:0,VALUE2:1},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE1",a),d=a.getNumberValue("VALUE2",a);b.setX(c);b.setY(d);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}}, -locate_x:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_x"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setX(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},locate_y:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block", -accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_y"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setY(c);b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},locate:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING}, -{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"locate"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d;"mouse"==c?(c=Entry.stage.mouseCoordinate.x,d=Entry.stage.mouseCoordinate.y):(d=Entry.container.getEntity(c),c=d.getX(),d=d.getY());b.setX(Number(c));b.setY(Number(d));b.brush&&!b.brush.stop&&b.brush.lineTo(c,-1*d);return a.callReturn()}},move_xy_time:{color:"#A751E3",skeleton:"basic", -statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"move_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_relative",isNotFor:[],func:function(b,a){function c(){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())}if(!a.isStart){var d;d=a.getNumberValue("VALUE1",a);var e=a.getNumberValue("VALUE2",a),f=a.getNumberValue("VALUE3",a);a.isStart=!0;a.frameCount=Math.max(Math.floor(d*Entry.FPS),1);a.dX=e/a.frameCount;a.dY=f/a.frameCount;1==a.frameCount&&c()}if(0!=a.frameCount)return c(),a;delete a.isStart;delete a.frameCount;return a.callReturn()}},rotate_by_angle_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Angle"},{type:"Indicator", -img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},null,null],type:"rotate_by_angle_time"},paramsKeyMap:{VALUE:1},"class":"rotate",isNotFor:[],func:function(b,a){if(!a.isStart){var c;c=a.getNumberValue("VALUE",a);var d=a.getNumberField("VALUE",a);a.isStart=!0;a.frameCount=Math.floor(c*Entry.FPS);a.dAngle=d/a.frameCount}if(0!=a.frameCount)return b.setRotation(b.getRotation()+a.dAngle),a.frameCount--,a;delete a.isStart;delete a.frameCount;return a.callReturn()}}, -bounce_wall:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null],type:"bounce_wall"},"class":"walk",isNotFor:[],func:function(b,a){var c=b.parent.getRotateMethod(),d="free"==c?(b.getRotation()+b.getDirection()).mod(360):b.getDirection(),e=Entry.Utils.COLLISION.NONE;if(90>d&&0<=d||360>d&&270<=d){var e=b.collision==Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,b.object,0,!1);!f&&e&& -(b.collision=Entry.Utils.COLLISION.NONE);f&&e&&(f=!1);f?("free"==c?b.setRotation(-b.getRotation()-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&&e&&(f=!1),f&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN))}else 270> -d&&90<=d&&(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&&e&&(f=!1),f?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()+180):b.setDirection(-b.getDirection()+180),b.collision=Entry.Utils.COLLISION.DOWN):(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)));360>d&&180<=d?(e=b.collision==Entry.Utils.COLLISION.LEFT,d=ndgmr.checkPixelCollision(Entry.stage.wall.left,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.LEFT):(e=b.collision==Entry.Utils.COLLISION.RIGHT, -d=ndgmr.checkPixelCollision(Entry.stage.wall.right,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.RIGHT))):180>d&&0<=d&&(e=b.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?b.setRotation(-b.getRotation()- -2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.RIGHT):(e=b.collision==Entry.Utils.COLLISION.LEFT,d=ndgmr.checkPixelCollision(Entry.stage.wall.left,b.object,0,!1),!d&&e&&(b.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?b.setRotation(-b.getRotation()-2*b.getDirection()):b.setDirection(-b.getDirection()+360),b.collision=Entry.Utils.COLLISION.LEFT)));return a.callReturn()}},flip_arrow_horizontal:{color:"#A751E3",skeleton:"basic",statements:[], -params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null]},func:function(b,a){b.setDirection(b.getDirection()+180);return a.callReturn()}},flip_arrow_vertical:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null]},func:function(b,a){b.setDirection(b.getDirection()+180);return a.callReturn()}},see_angle_object:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic", -value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"see_angle_object"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d=b.getX(),e=b.getY();if(b.parent.id==c)return a.callReturn();"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",size:12}],events:{},def:{params:[{type:"angle"},null],type:"rotate_absolute"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute", -isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c);return a.callReturn()}},rotate_relative:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"rotate_relative"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setRotation(c+b.getRotation());return a.callReturn()}},direction_absolute:{color:"#A751E3", -skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},null],type:"direction_absolute"},paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c);return a.callReturn()}},direction_relative:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png", -size:12}],events:{},def:{params:[{type:"angle"},null],type:"direction_relative"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.setDirection(c+b.getDirection());return a.callReturn()}},move_to_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},{type:"number",params:["10"]}, -null],type:"move_to_angle"},paramsKeyMap:{ANGLE:0,VALUE:1},"class":"move_rotate",isNotFor:[],func:function(b,a){var c=a.getNumberValue("VALUE",a),d=a.getNumberValue("ANGLE",a);b.setX(b.getX()+c*Math.cos((d-90)/180*Math.PI));b.setY(b.getY()-c*Math.sin((d-90)/180*Math.PI));b.brush&&!b.brush.stop&&b.brush.lineTo(b.getX(),-1*b.getY());return a.callReturn()}},rotate_by_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator", -img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"angle"},null],type:"rotate_by_time"},paramsKeyMap:{VALUE:0,ANGLE:1},"class":"rotate",isNotFor:[],func:function(b,a){function c(){b.setRotation(b.getRotation()+a.dAngle);a.frameCount--}if(!a.isStart){var d;d=a.getNumberValue("VALUE",a);var e=a.getNumberValue("ANGLE",a);a.isStart=!0;a.frameCount=Math.max(Math.floor(d*Entry.FPS),1);a.dAngle=e/a.frameCount;1==a.frameCount&&c()}if(0!=a.frameCount)return c(), -a;delete a.isStart;delete a.frameCount;return a.callReturn()}},direction_relative_duration:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"text",params:["2"]},{type:"angle"},null],type:"direction_relative_duration"},paramsKeyMap:{DURATION:0,AMOUNT:1},"class":"rotate",isNotFor:[],func:function(b,a){function c(){b.setDirection(b.getDirection()+ -a.dDirection);a.frameCount--}if(!a.isStart){var d;d=a.getNumberValue("DURATION",a);var e=a.getNumberValue("AMOUNT",a);a.isStart=!0;a.frameCount=Math.max(Math.floor(d*Entry.FPS),1);a.dDirection=e/a.frameCount;1==a.frameCount&&c()}if(0!=a.frameCount)return c(),a;delete a.isStart;delete a.frameCount;delete a.dDirection;return a.callReturn()}},neobot_sensor_value:{color:"#00979D",skeleton:"basic_string_field",fontColor:"#fff",statements:[],template:"%1 \uac12",params:[{type:"Dropdown",options:[["1\ubc88 \ud3ec\ud2b8", -"IN1"],["2\ubc88 \ud3ec\ud2b8","IN2"],["3\ubc88 \ud3ec\ud2b8","IN3"],["\ub9ac\ubaa8\ucee8","IR"],["\ubc30\ud130\ub9ac","BAT"]],value:"IN1",fontSize:11}],events:{},def:{params:[null],type:"neobot_sensor_value"},paramsKeyMap:{PORT:0},"class":"neobot_value",isNotFor:["neobot"],func:function(b,a){var c=a.getStringField("PORT");return Entry.hw.portData[c]}},neobot_sensor_convert_scale:{color:"#00979D",skeleton:"basic_string_field",fontColor:"#fff",statements:[],template:"%1 \uac12\uc758 \ubc94\uc704\ub97c %2 ~ %3 \uc5d0\uc11c %4 ~ %5 (\uc73c)\ub85c \ubcc0\ud658", -params:[{type:"Dropdown",options:[["1\ubc88 \ud3ec\ud2b8","IN1"],["2\ubc88 \ud3ec\ud2b8","IN2"],["3\ubc88 \ud3ec\ud2b8","IN3"],["\ub9ac\ubaa8\ucee8","IR"],["\ubc30\ud130\ub9ac","BAT"]],value:"IN1",fontSize:11},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"}],events:{},def:{params:[null,{type:"number",params:["0"]},{type:"number",params:["255"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"neobot_sensor_convert_scale"}, -paramsKeyMap:{PORT:0,OMIN:1,OMAX:2,MIN:3,MAX:4},"class":"neobot_value",isNotFor:["neobot"],func:function(b,a){var c=a.getStringField("PORT"),c=Entry.hw.portData[c],d=a.getNumberValue("OMIN",a),e=a.getNumberValue("OMAX",a),f=a.getNumberValue("MIN",a),g=a.getNumberValue("MAX",a);if(d>e)var h=d,d=e,e=h;f>g&&(h=f,f=g,g=h);c=(g-f)/(e-d)*(c-d);c+=f;c=Math.min(g,c);c=Math.max(f,c);return Math.round(c)}},neobot_left_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc67c\ucabd \ubaa8\ud130\ub97c %1 %2 \uc758 \uc18d\ub3c4\ub85c \ud68c\uc804 %3", -params:[{type:"Dropdown",options:[["\uc55e\uc73c\ub85c","16"],["\ub4a4\ub85c","32"]],value:"16",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{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"],["14","14"],["15","15"]],value:"0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,"15", -null],type:"neobot_left_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){var c=a.getNumberField("SPEED"),d=a.getNumberField("DIRECTION");Entry.hw.sendQueue.DCL=c+d;return a.callReturn()}},neobot_stop_left_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc67c\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_left_motor"}, -"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){Entry.hw.sendQueue.DCL=0;return a.callReturn()}},neobot_right_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubaa8\ud130\ub97c %1 %2 \uc758 \uc18d\ub3c4\ub85c \ud68c\uc804 %3",params:[{type:"Dropdown",options:[["\uc55e\uc73c\ub85c","16"],["\ub4a4\ub85c","32"]],value:"16",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{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"],["14","14"],["15","15"]],value:"0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,"15",null],type:"neobot_right_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){var c=a.getNumberField("SPEED"),d=a.getNumberField("DIRECTION");Entry.hw.sendQueue.DCR=c+d;return a.callReturn()}}, -neobot_stop_right_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_right_motor"},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){Entry.hw.sendQueue.DCR=0;return a.callReturn()}},neobot_all_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc591\ucabd \ubaa8\ud130\ub97c %1 %2\uc758 \uc18d\ub3c4\ub85c %3\ucd08 \ub3d9\uc548 \ud68c\uc804 %4", -params:[{type:"Dropdown",options:[["\uc55e\uc73c\ub85c","1"],["\ub4a4\ub85c","2"],["\uc81c\uc790\ub9ac\uc5d0\uc11c \uc67c\ucabd \ub3cc\uae30","3"],["\uc81c\uc790\ub9ac\uc5d0\uc11c \uc624\ub978\ucabd \ub3cc\uae30","4"],["\uc67c\ucabd\uc73c\ub85c \ub3cc\uae30","5"],["\uc624\ub978\ucabd\uc73c\ub85c \ub3cc\uae30","6"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{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"],["14","14"],["15","15"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:["1","15",{type:"number",params:["0"]}],type:"neobot_all_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1,DURATION:2},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){if(a.isStart){if(1==a.timeFlag)return a;delete a.timeFlag;delete a.isStart;Entry.hw.sendQueue.DCL= -0;Entry.hw.sendQueue.DCR=0;Entry.engine.isContinue=!1;return a.callReturn()}var c=a.getNumberField("SPEED"),d=a.getNumberField("DIRECTION"),e=a.getNumberValue("DURATION");0>e&&(e=0);switch(d){case 1:Entry.hw.sendQueue.DCL=16+c;Entry.hw.sendQueue.DCR=16+c;break;case 2:Entry.hw.sendQueue.DCL=32+c;Entry.hw.sendQueue.DCR=32+c;break;case 3:Entry.hw.sendQueue.DCL=32+c;Entry.hw.sendQueue.DCR=16+c;break;case 4:Entry.hw.sendQueue.DCL=16+c;Entry.hw.sendQueue.DCR=32+c;break;case 5:Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR= -16+c;break;case 6:Entry.hw.sendQueue.DCL=16+c,Entry.hw.sendQueue.DCR=0}if(0===e)return a.callReturn();a.isStart=!0;a.timeFlag=1;setTimeout(function(){a.timeFlag=0},1E3*e);return a}},neobot_stop_all_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc591\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_all_motor"},"class":"neobot_motor",isNotFor:["neobot"],func:function(b,a){Entry.hw.sendQueue.DCL= -0;Entry.hw.sendQueue.DCR=0;return a.callReturn()}},neobot_set_servo:{color:"#00979D",skeleton:"basic",statements:[],template:"%1 \ud3ec\ud2b8\uc758 \uc11c\ubcf4\ubaa8\ud130\ub97c %2 \ub3c4 \uc774\ub3d9 %3",params:[{type:"Dropdown",options:[["OUT1","1"],["OUT2","2"],["OUT3","3"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"neobot_set_servo"},paramsKeyMap:{PORT:0, -DEGREE:1},"class":"neobot_output",isNotFor:["neobot"],func:function(b,a){var c=a.getNumberField("PORT"),d=a.getNumberValue("DEGREE");0>d?d=0:180d?d=0:255b.count?(50>c.leftFloor&&50>c.rightFloor?b.count++:b.count=0,c=c.leftFloor-c.rightFloor,a.leftWheel=45+.25*c,a.rightWheel=45-.25*c):(b.count=0,b.boardState=2);break;case 2:c=c.leftFloor-c.rightFloor;a.leftWheel=45+.25*c;a.rightWheel= +45-.25*c;b.boardState=3;var d=setTimeout(function(){b.boardState=4;Entry.Hamster.removeTimeout(d)},250);Entry.Hamster.timeouts.push(d);break;case 3:c=c.leftFloor-c.rightFloor;a.leftWheel=45+.25*c;a.rightWheel=45-.25*c;break;case 4:a.leftWheel=0,a.rightWheel=0,b.boardState=0,b.isMoving=!1}return b}delete b.isStart;delete b.isMoving;delete b.count;delete b.boardState;Entry.engine.isContinue=!1;a.leftWheel=0;a.rightWheel=0;return b.callReturn()}b.isStart=!0;b.isMoving=!0;b.count=0;b.boardState=1;a.leftWheel= +45;a.rightWheel=45;Entry.Hamster.setLineTracerMode(a,0);return b}},hamster_turn_once:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null],type:"hamster_turn_once"},paramsKeyMap:{DIRECTION:0},"class":"hamster_board",isNotFor:["hamster"],func:function(a,b){a=Entry.hw.sendQueue;var c=Entry.hw.portData; +if(b.isStart){if(b.isMoving){if(b.isLeft)switch(b.boardState){case 1:2>b.count?50c.leftFloor&&(b.boardState=3);break;case 3:2>b.count?20>c.leftFloor&&b.count++:(b.count=0,b.boardState=4);break;case 4:50b.count?50c.rightFloor&&(b.boardState=3);break;case 3:2>b.count?20>c.rightFloor&&b.count++:(b.count=0,b.boardState=4);break;case 4:50Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return b.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(a,b){Entry.Hamster.tempo=b.getNumberValue("VALUE");1>Entry.Hamster.tempo&&(Entry.Hamster.tempo=1);return b.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(a,b){a=Entry.hw.sendQueue;var c=b.getField("PORT",b),d=Number(b.getField("MODE",b));"A"==c?a.ioModeA=d:("B"!=c&&(a.ioModeA=d),a.ioModeB=d);return b.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(a,b){a=Entry.hw.sendQueue;var c=b.getField("PORT"),d=b.getNumberValue("VALUE");"A"==c?a.outputA=void 0!=a.outputA?a.outputA+d:d:("B"!=c&&(a.outputA=void 0!=a.outputA?a.outputA+d:d),a.outputB=void 0!=a.outputB?a.outputB+d:d);return b.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(a,b){a=Entry.hw.sendQueue;var c=b.getField("PORT"),d=b.getNumberValue("VALUE"); +"A"==c?a.outputA=d:("B"!=c&&(a.outputA=d),a.outputB=d);return b.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(a,b){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(a,b){a=Number(b.getField("VALUE",b));return 0<=Entry.pressedKeys.indexOf(a)}},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(a,b){if(!a.getVisible())return!1;var c=b.getField("VALUE",b);b=a.object;var d=/wall/.test(c),e=ndgmr.checkPixelCollision;if(d)switch(a=Entry.stage.wall,c){case "wall":return!!(e(b,a.up,.2,!0)||e(b,a.down,.2,!0)||e(b,a.left,.2,!0)||e(b,a.right,.2,!0));case "wall_up":return!!e(b,a.up,.2,!0);case "wall_down":return!!e(b, +a.down,.2,!0);case "wall_right":return!!e(b,a.right,.2,!0);case "wall_left":return!!e(b,a.left,.2,!0)}else{if("mouse"==c)return e=Entry.stage.canvas,e=b.globalToLocal(e.mouseX,e.mouseY),b.hitTest(e.x,e.y);c=Entry.container.getEntity(c);if("textBox"==c.type||"textBox"==a.type){e=c.object.getTransformedBounds();b=b.getTransformedBounds();if(Entry.checkCollisionRect(b,e))return!0;a=c.parent.clonedEntities;c=0;for(d=a.length;c","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(a,b){a=b.getField("OPERATOR",b);var c=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return"EQUAL"==a?c==b:"BIGGER"==a?c>b:c",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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a>b}},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(a,b){a=b.getNumberValue("LEFTHAND",b);b=b.getNumberValue("RIGHTHAND",b);return a","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(a,b){a=b.getField("OPERATOR",b);var c=b.getStringValue("LEFTHAND",b);b=b.getStringValue("RIGHTHAND",b);switch(a){case "EQUAL":return c==b;case "GREATER":return Number(c)>Number(b);case "LESS":return Number(c)= +Number(b);case "LESS_OR_EQUAL":return Number(c)<=Number(b)}}},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(a,b){a.setVisible(!0);return b.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(a,b){a.setVisible(!1);return b.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(a,b){if(!b.isStart){var c=b.getNumberValue("SECOND",b),d=b.getStringValue("VALUE",b),e=b.getField("OPTION",b);b.isStart=!0;b.timeFlag=1;d||"number"==typeof d||(d=" ");d=Entry.convertToRoundedDecimals(d,3);new Entry.Dialog(a,d,e);a.syncDialogVisible(a.getVisible());setTimeout(function(){b.timeFlag=0},1E3*c)}if(0==b.timeFlag)return delete b.timeFlag,delete b.isStart,a.dialog&&a.dialog.remove(),b.callReturn();a.dialog||(d=b.getStringValue("VALUE", +b),e=b.getField("OPTION",b),d||"number"==typeof d||(d=" "),d=Entry.convertToRoundedDecimals(d,3),new Entry.Dialog(a,d,e),a.syncDialogVisible(a.getVisible()));return b}},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(a,b){var c=b.getStringValue("VALUE",b);c||"number"==typeof c||(c=" ");var d=b.getField("OPTION",b),c=Entry.convertToRoundedDecimals(c,3);new Entry.Dialog(a,c,d);a.syncDialogVisible(a.getVisible());return b.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(a,b){a.dialog&&a.dialog.remove();return b.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(a,b){var c=b.getField("VALUE",b),c=a.parent.getPicture(c);a.setImage(c); +return b.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(a,b){var c;c="prev"!== +b.getStringField("DRIECTION")?a.parent.getNextPicture(a.picture.id):a.parent.getPrevPicture(a.picture.id);a.setImage(c);return b.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(a,b){var c=b.getField("EFFECT",b),d=b.getNumberValue("VALUE",b);"color"==c?a.effect.hue=d+a.effect.hue:"lens"!=c&&"swriling"!=c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?a.effect.brightness=d+a.effect.brightness:"blur"!=c&&"opacity"==c&&(a.effect.alpha+=d/100));a.applyFilter(!0);return b.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(a,b){var c=b.getField("EFFECT",b),d=b.getNumberValue("VALUE",b);"color"==c?a.effect.hue=d:"lens"!=c&&"swriling"!= +c&&"pixel"!=c&&"mosaic"!=c&&("brightness"==c?a.effect.brightness=d:"blur"!=c&&"opacity"==c&&(a.effect.alpha=d/100));a.applyFilter(!0);return b.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(a,b){a.resetFilter();return b.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(a,b){var c=(b.getNumberValue("VALUE",b)+100)/100;a.setScaleX(a.getScaleX()*c);a.setScaleY(a.getScaleY()*c);return b.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(a,b){var c=b.getNumberValue("VALUE",b)/100,d=a.snapshot_;a.setScaleX(c*d.scaleX);a.setScaleY(c*d.scaleY);return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setSize(a.getSize()+c);return b.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(a, +b){var c=b.getNumberValue("VALUE",b);a.setSize(c);return b.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(a,b){a.setScaleX(-1*a.getScaleX());return b.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(a,b){a.setScaleY(-1*a.getScaleY());return b.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(a,b){var c=b.getField("VALUE",b);a=Entry.container.getCurrentObjects().indexOf(a.parent); +if(-1a)throw Error("object is not available for current scene"); +switch(d){case "FRONT":c=0;break;case "FORWARD":c=Math.max(0,a-1);break;case "BACKWARD":c=Math.min(e,a+1);break;case "BACK":c=e}Entry.container.moveElementByBlock(a,c);return b.callReturn()}},move_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:["10"]},null],type:"move_direction"},paramsKeyMap:{VALUE:0},"class":"walk",isNotFor:[],func:function(a, +b){var c=b.getNumberValue("VALUE",b);a.setX(a.getX()+c*Math.cos((a.getRotation()+a.getDirection()-90)/180*Math.PI));a.setY(a.getY()-c*Math.sin((a.getRotation()+a.getDirection()-90)/180*Math.PI));a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}},move_x:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"move_x"}, +paramsKeyMap:{VALUE:0},"class":"move_relative",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.setX(a.getX()+c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}},move_y:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"move_y"},paramsKeyMap:{VALUE:0},"class":"move_relative",isNotFor:[], +func:function(a,b){var c=b.getNumberValue("VALUE",b);a.setY(a.getY()+c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}},locate_xy_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"locate_xy_time"}, +paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_absolute",isNotFor:[],func:function(a,b){function c(){var c=b.x-a.getX(),d=b.y-a.getY(),c=c/b.frameCount,d=d/b.frameCount;a.setX(a.getX()+c);a.setY(a.getY()+d);b.frameCount--;a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY())}if(!b.isStart){var d;d=b.getNumberValue("VALUE1",b);b.isStart=!0;b.frameCount=Math.max(Math.floor(d*Entry.FPS),1);b.x=b.getNumberValue("VALUE2",b);b.y=b.getNumberValue("VALUE3",b);1==b.frameCount&&c()}if(0!=b.frameCount)return c(), +b;delete b.isStart;delete b.frameCount;return b.callReturn()}},rotate_by_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"rotate_by_angle"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.setRotation(a.getRotation()+c);return b.callReturn()}},rotate_by_angle_dropdown:{color:"#A751E3", +skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[["45","45"],["90","90"],["135","135"],["180","180"]],value:"45",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:["45",null],type:"rotate_by_angle_dropdown"},paramsKeyMap:{VALUE:0},"class":"ebs",isNotFor:[],func:function(a,b){var c=b.getField("VALUE",b);a.setRotation(a.getRotation()+Number(c));return b.callReturn()}},see_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block", +accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["90"]},null],type:"see_angle"},paramsKeyMap:{VALUE:0},"class":"rotate",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.setDirection(c);return b.callReturn()}},see_direction:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"sprites",fontSize:11},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{}, +def:{params:[null,null]},paramsKeyMap:{VALUE:0},func:function(a,b){var c=b.getField("VALUE",b),d=Entry.container.getEntity(c),c=d.getX()-a.getX(),d=d.getY()-a.getY();0<=c?a.setRotation(Math.atan(d/c)/Math.PI*180+90):a.setRotation(Math.atan(d/c)/Math.PI*180+270);return b.callReturn()}},locate_xy:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number", +params:["0"]},{type:"number",params:["0"]},null],type:"locate_xy"},paramsKeyMap:{VALUE1:0,VALUE2:1},"class":"move_absolute",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE1",b),d=b.getNumberValue("VALUE2",b);a.setX(c);a.setY(d);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}},locate_x:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number", +params:["10"]},null],type:"locate_x"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.setX(c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}},locate_y:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"locate_y"},paramsKeyMap:{VALUE:0},"class":"move_absolute", +isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b);a.setY(c);a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}},locate:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"locate"},paramsKeyMap:{VALUE:0},"class":"move_absolute",isNotFor:[], +func:function(a,b){var c=b.getField("VALUE",b),d;"mouse"==c?(c=Entry.stage.mouseCoordinate.x,d=Entry.stage.mouseCoordinate.y):(d=Entry.container.getEntity(c),c=d.getX(),d=d.getY());a.setX(Number(c));a.setY(Number(d));a.brush&&!a.brush.stop&&a.brush.lineTo(c,-1*d);return b.callReturn()}},move_xy_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}], +events:{},def:{params:[{type:"number",params:["2"]},{type:"number",params:["10"]},{type:"number",params:["10"]},null],type:"move_xy_time"},paramsKeyMap:{VALUE1:0,VALUE2:1,VALUE3:2},"class":"move_relative",isNotFor:[],func:function(a,b){function c(){a.setX(a.getX()+b.dX);a.setY(a.getY()+b.dY);b.frameCount--;a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY())}if(!b.isStart){var d;d=b.getNumberValue("VALUE1",b);var e=b.getNumberValue("VALUE2",b),f=b.getNumberValue("VALUE3",b);b.isStart=!0;b.frameCount= +Math.max(Math.floor(d*Entry.FPS),1);b.dX=e/b.frameCount;b.dY=f/b.frameCount;1==b.frameCount&&c()}if(0!=b.frameCount)return c(),b;delete b.isStart;delete b.frameCount;return b.callReturn()}},rotate_by_angle_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Angle"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},null,null],type:"rotate_by_angle_time"},paramsKeyMap:{VALUE:1},"class":"rotate", +isNotFor:[],func:function(a,b){if(!b.isStart){var c;c=b.getNumberValue("VALUE",b);var d=b.getNumberField("VALUE",b);b.isStart=!0;b.frameCount=Math.floor(c*Entry.FPS);b.dAngle=d/b.frameCount}if(0!=b.frameCount)return a.setRotation(a.getRotation()+b.dAngle),b.frameCount--,b;delete b.isStart;delete b.frameCount;return b.callReturn()}},bounce_wall:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null],type:"bounce_wall"}, +"class":"walk",isNotFor:[],func:function(a,b){var c=a.parent.getRotateMethod(),d="free"==c?(a.getRotation()+a.getDirection()).mod(360):a.getDirection(),e;if(90>d&&0<=d||360>d&&270<=d){e=a.collision==Entry.Utils.COLLISION.UP;var f=ndgmr.checkPixelCollision(Entry.stage.wall.up,a.object,0,!1);!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE);f&&e&&(f=!1);f?("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+180),a.collision=Entry.Utils.COLLISION.UP):(e=a.collision== +Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,a.object,0,!1),!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+180),a.collision=Entry.Utils.COLLISION.DOWN))}else 270>d&&90<=d&&(e=a.collision==Entry.Utils.COLLISION.DOWN,f=ndgmr.checkPixelCollision(Entry.stage.wall.down,a.object,0,!1),!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f?("free"==c? +a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+180),a.collision=Entry.Utils.COLLISION.DOWN):(e=a.collision==Entry.Utils.COLLISION.UP,f=ndgmr.checkPixelCollision(Entry.stage.wall.up,a.object,0,!1),!f&&e&&(a.collision=Entry.Utils.COLLISION.NONE),f&&e&&(f=!1),f&&("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()+180):a.setDirection(-a.getDirection()+180),a.collision=Entry.Utils.COLLISION.UP)));360>d&&180<=d?(e=a.collision==Entry.Utils.COLLISION.LEFT, +d=ndgmr.checkPixelCollision(Entry.stage.wall.left,a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()):a.setDirection(-a.getDirection()+360),a.collision=Entry.Utils.COLLISION.LEFT):(e=a.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()): +a.setDirection(-a.getDirection()+360),a.collision=Entry.Utils.COLLISION.RIGHT))):180>d&&0<=d&&(e=a.collision==Entry.Utils.COLLISION.RIGHT,d=ndgmr.checkPixelCollision(Entry.stage.wall.right,a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d?("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()):a.setDirection(-a.getDirection()+360),a.collision=Entry.Utils.COLLISION.RIGHT):(e=a.collision==Entry.Utils.COLLISION.LEFT,d=ndgmr.checkPixelCollision(Entry.stage.wall.left, +a.object,0,!1),!d&&e&&(a.collision=Entry.Utils.COLLISION.NONE),d&&e&&(d=!1),d&&("free"==c?a.setRotation(-a.getRotation()-2*a.getDirection()):a.setDirection(-a.getDirection()+360),a.collision=Entry.Utils.COLLISION.LEFT)));return b.callReturn()}},flip_arrow_horizontal:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null]},func:function(a,b){a.setDirection(a.getDirection()+180);return b.callReturn()}},flip_arrow_vertical:{color:"#A751E3", +skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null]},func:function(a,b){a.setDirection(a.getDirection()+180);return b.callReturn()}},see_angle_object:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_MOVING},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[null,null],type:"see_angle_object"}, +paramsKeyMap:{VALUE:0},"class":"rotate_absolute",isNotFor:[],func:function(a,b){var c=b.getField("VALUE",b),d=a.getX(),e=a.getY();if(a.parent.id==c)return b.callReturn();"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?a.getDirection()+a.getRotation():0<=d?-Math.atan(e/d)/Math.PI*180+90:-Math.atan(e/d)/Math.PI*180+270;d=a.getDirection()+a.getRotation();a.setRotation(a.getRotation()+e-d);return b.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(a,b){var c=b.getNumberValue("VALUE",b),d=a.getDirection()+a.getRotation();a.setRotation(a.getRotation()+c-d);return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setDirection(c+a.getDirection());return b.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(a,b){if(!b.isStart){var c,d,e;d=b.getField("TARGET",b);c=b.getNumberValue("VALUE",b);c=Math.floor(c*Entry.FPS);e=Entry.stage.mouseCoordinate;if(0!=c)"mouse"==d?(d=e.x-a.getX(),e=e.y-a.getY()): +(e=Entry.container.getEntity(d),d=e.getX()-a.getX(),e=e.getY()-a.getY()),b.isStart=!0,b.frameCount=c,b.dX=d/b.frameCount,b.dY=e/b.frameCount;else return"mouse"==d?(d=Number(e.x),e=Number(e.y)):(e=Entry.container.getEntity(d),d=e.getX(),e=e.getY()),a.setX(d),a.setY(e),a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY()),b.callReturn()}if(0!=b.frameCount)return a.setX(a.getX()+b.dX),a.setY(a.getY()+b.dY),b.frameCount--,a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY()),b;delete b.isStart; +delete b.frameCount;return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setRotation(c);return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setRotation(c+a.getRotation());return b.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(a,b){var c=b.getNumberValue("VALUE",b);a.setDirection(c);return b.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(a,b){var c= +b.getNumberValue("VALUE",b);a.setDirection(c+a.getDirection());return b.callReturn()}},move_to_angle:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"angle"},{type:"number",params:["10"]},null],type:"move_to_angle"},paramsKeyMap:{ANGLE:0,VALUE:1},"class":"move_rotate",isNotFor:[],func:function(a,b){var c=b.getNumberValue("VALUE",b),d=b.getNumberValue("ANGLE", +b);a.setX(a.getX()+c*Math.cos((d-90)/180*Math.PI));a.setY(a.getY()-c*Math.sin((d-90)/180*Math.PI));a.brush&&!a.brush.stop&&a.brush.lineTo(a.getX(),-1*a.getY());return b.callReturn()}},rotate_by_time:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},{type:"angle"},null],type:"rotate_by_time"},paramsKeyMap:{VALUE:0,ANGLE:1}, +"class":"rotate",isNotFor:[],func:function(a,b){function c(){a.setRotation(a.getRotation()+b.dAngle);b.frameCount--}if(!b.isStart){var d;d=b.getNumberValue("VALUE",b);var e=b.getNumberValue("ANGLE",b);b.isStart=!0;b.frameCount=Math.max(Math.floor(d*Entry.FPS),1);b.dAngle=e/b.frameCount;1==b.frameCount&&c()}if(0!=b.frameCount)return c(),b;delete b.isStart;delete b.frameCount;return b.callReturn()}},direction_relative_duration:{color:"#A751E3",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"}, +{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/moving_03.png",size:12}],events:{},def:{params:[{type:"text",params:["2"]},{type:"angle"},null],type:"direction_relative_duration"},paramsKeyMap:{DURATION:0,AMOUNT:1},"class":"rotate",isNotFor:[],func:function(a,b){function c(){a.setDirection(a.getDirection()+b.dDirection);b.frameCount--}if(!b.isStart){var d;d=b.getNumberValue("DURATION",b);var e=b.getNumberValue("AMOUNT",b);b.isStart=!0;b.frameCount=Math.max(Math.floor(d*Entry.FPS), +1);b.dDirection=e/b.frameCount;1==b.frameCount&&c()}if(0!=b.frameCount)return c(),b;delete b.isStart;delete b.frameCount;delete b.dDirection;return b.callReturn()}},neobot_sensor_value:{color:"#00979D",skeleton:"basic_string_field",fontColor:"#fff",statements:[],template:"%1 \uac12",params:[{type:"Dropdown",options:[["1\ubc88 \ud3ec\ud2b8","IN1"],["2\ubc88 \ud3ec\ud2b8","IN2"],["3\ubc88 \ud3ec\ud2b8","IN3"],["\ub9ac\ubaa8\ucee8","IR"],["\ubc30\ud130\ub9ac","BAT"]],value:"IN1",fontSize:11}],events:{}, +def:{params:[null],type:"neobot_sensor_value"},paramsKeyMap:{PORT:0},"class":"neobot_value",isNotFor:["neobot"],func:function(a,b){a=b.getStringField("PORT");return Entry.hw.portData[a]}},neobot_sensor_convert_scale:{color:"#00979D",skeleton:"basic_string_field",fontColor:"#fff",statements:[],template:"%1 \uac12\uc758 \ubc94\uc704\ub97c %2 ~ %3 \uc5d0\uc11c %4 ~ %5 (\uc73c)\ub85c \ubcc0\ud658",params:[{type:"Dropdown",options:[["1\ubc88 \ud3ec\ud2b8","IN1"],["2\ubc88 \ud3ec\ud2b8","IN2"],["3\ubc88 \ud3ec\ud2b8", +"IN3"],["\ub9ac\ubaa8\ucee8","IR"],["\ubc30\ud130\ub9ac","BAT"]],value:"IN1",fontSize:11},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"}],events:{},def:{params:[null,{type:"number",params:["0"]},{type:"number",params:["255"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"neobot_sensor_convert_scale"},paramsKeyMap:{PORT:0,OMIN:1,OMAX:2,MIN:3,MAX:4},"class":"neobot_value",isNotFor:["neobot"],func:function(a, +b){a=b.getStringField("PORT");a=Entry.hw.portData[a];var c=b.getNumberValue("OMIN",b),d=b.getNumberValue("OMAX",b),e=b.getNumberValue("MIN",b);b=b.getNumberValue("MAX",b);if(c>d)var f=c,c=d,d=f;e>b&&(f=e,e=b,b=f);a=Math.min(b,(b-e)/(d-c)*(a-c)+e);a=Math.max(e,a);return Math.round(a)}},neobot_left_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc67c\ucabd \ubaa8\ud130\ub97c %1 %2 \uc758 \uc18d\ub3c4\ub85c \ud68c\uc804 %3",params:[{type:"Dropdown",options:[["\uc55e\uc73c\ub85c","16"], +["\ub4a4\ub85c","32"]],value:"16",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{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"],["14","14"],["15","15"]],value:"0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,"15",null],type:"neobot_left_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1}, +"class":"neobot_motor",isNotFor:["neobot"],func:function(a,b){a=b.getNumberField("SPEED");var c=b.getNumberField("DIRECTION");Entry.hw.sendQueue.DCL=a+c;return b.callReturn()}},neobot_stop_left_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc67c\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_left_motor"},"class":"neobot_motor",isNotFor:["neobot"],func:function(a,b){Entry.hw.sendQueue.DCL= +0;return b.callReturn()}},neobot_right_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubaa8\ud130\ub97c %1 %2 \uc758 \uc18d\ub3c4\ub85c \ud68c\uc804 %3",params:[{type:"Dropdown",options:[["\uc55e\uc73c\ub85c","16"],["\ub4a4\ub85c","32"]],value:"16",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{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"],["14","14"],["15","15"]],value:"0",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,"15",null],type:"neobot_right_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1},"class":"neobot_motor",isNotFor:["neobot"],func:function(a,b){a=b.getNumberField("SPEED");var c=b.getNumberField("DIRECTION");Entry.hw.sendQueue.DCR=a+c;return b.callReturn()}},neobot_stop_right_motor:{color:"#00979D",skeleton:"basic",statements:[], +template:"\uc624\ub978\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_right_motor"},"class":"neobot_motor",isNotFor:["neobot"],func:function(a,b){Entry.hw.sendQueue.DCR=0;return b.callReturn()}},neobot_all_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc591\ucabd \ubaa8\ud130\ub97c %1 %2\uc758 \uc18d\ub3c4\ub85c %3\ucd08 \ub3d9\uc548 \ud68c\uc804 %4",params:[{type:"Dropdown", +options:[["\uc55e\uc73c\ub85c","1"],["\ub4a4\ub85c","2"],["\uc81c\uc790\ub9ac\uc5d0\uc11c \uc67c\ucabd \ub3cc\uae30","3"],["\uc81c\uc790\ub9ac\uc5d0\uc11c \uc624\ub978\ucabd \ub3cc\uae30","4"],["\uc67c\ucabd\uc73c\ub85c \ub3cc\uae30","5"],["\uc624\ub978\ucabd\uc73c\ub85c \ub3cc\uae30","6"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{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"],["14","14"],["15","15"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:["1","15",{type:"number",params:["0"]}],type:"neobot_all_motor"},paramsKeyMap:{DIRECTION:0,SPEED:1,DURATION:2},"class":"neobot_motor",isNotFor:["neobot"],func:function(a,b){if(b.isStart){if(1==b.timeFlag)return b;delete b.timeFlag;delete b.isStart;Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR= +0;Entry.engine.isContinue=!1;return b.callReturn()}a=b.getNumberField("SPEED");var c=b.getNumberField("DIRECTION"),d=b.getNumberValue("DURATION");0>d&&(d=0);switch(c){case 1:Entry.hw.sendQueue.DCL=16+a;Entry.hw.sendQueue.DCR=16+a;break;case 2:Entry.hw.sendQueue.DCL=32+a;Entry.hw.sendQueue.DCR=32+a;break;case 3:Entry.hw.sendQueue.DCL=32+a;Entry.hw.sendQueue.DCR=16+a;break;case 4:Entry.hw.sendQueue.DCL=16+a;Entry.hw.sendQueue.DCR=32+a;break;case 5:Entry.hw.sendQueue.DCL=0;Entry.hw.sendQueue.DCR=16+ +a;break;case 6:Entry.hw.sendQueue.DCL=16+a,Entry.hw.sendQueue.DCR=0}if(0===d)return b.callReturn();b.isStart=!0;b.timeFlag=1;setTimeout(function(){b.timeFlag=0},1E3*d);return b}},neobot_stop_all_motor:{color:"#00979D",skeleton:"basic",statements:[],template:"\uc591\ucabd \ubaa8\ud130\ub97c \uc815\uc9c0 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"neobot_stop_all_motor"},"class":"neobot_motor",isNotFor:["neobot"],func:function(a,b){Entry.hw.sendQueue.DCL= +0;Entry.hw.sendQueue.DCR=0;return b.callReturn()}},neobot_set_servo:{color:"#00979D",skeleton:"basic",statements:[],template:"%1 \ud3ec\ud2b8\uc758 \uc11c\ubcf4\ubaa8\ud130\ub97c %2 \ub3c4 \uc774\ub3d9 %3",params:[{type:"Dropdown",options:[["OUT1","1"],["OUT2","2"],["OUT3","3"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"neobot_set_servo"},paramsKeyMap:{PORT:0, +DEGREE:1},"class":"neobot_output",isNotFor:["neobot"],func:function(a,b){a=b.getNumberField("PORT");var c=b.getNumberValue("DEGREE");0>c?c=0:180c?c=0:255c.count)throw c.count++, -new Entry.Utils.AsyncError;c.isStart=!1;d=Entry.hw.portData[c.data_default_address];c.data_default_address=void 0;return d}},robotis_openCM70_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.robotis_cm_sound_detected,"CM_SOUND_DETECTED"],[Lang.Blocks.robotis_cm_sound_detecting,"CM_SOUND_DETECTING"],[Lang.Blocks.robotis_cm_user_button,"CM_USER_BUTTON"]],value:"CM_SOUND_DETECTED",fontSize:11}],events:{},def:{params:[null], -type:"robotis_openCM70_sensor_value"},paramsKeyMap:{SENSOR:0},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(b,a){var c=a.executor.scope;if(!c.isStart){c.isStart=!0;c.count=0;var d=Entry.Robotis_openCM70.INSTRUCTION.READ,e=0,f=0,g=0,h=0,k=a.getStringField("SENSOR");"CM_SOUND_DETECTED"==k?(g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1]): -"CM_SOUND_DETECTING"==k?(g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1]):"CM_USER_BUTTON"==k&&(g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1]); -g+=0*h;Entry.Robotis_carCont.setRobotisData([[d,e,f,0,h]]);Entry.Robotis_carCont.update();c.data_default_address=g;throw new Entry.Utils.AsyncError;}if(2>c.count)throw c.count++,new Entry.Utils.AsyncError;c.isStart=!1;d=Entry.hw.portData[c.data_default_address];c.data_default_address=void 0;return d}},robotis_openCM70_aux_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["3","PORT_3"],["4","PORT_4"],["5","PORT_5"],["6","PORT_6"]], +"16"]],value:"2",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:["1","2","4",null],type:"neobot_play_note_for"},paramsKeyMap:{NOTE:0,OCTAVE:1,DURATION:2},"class":"neobot_note",isNotFor:["neobot"],func:function(a,b){a=Entry.hw.sendQueue;if(b.isStart){if(1==b.timeFlag)return b;delete b.timeFlag;delete b.isStart;Entry.hw.sendQueue.SND=0;Entry.engine.isContinue=!1;return b.callReturn()}var c=b.getNumberField("NOTE",b),d=b.getNumberField("OCTAVE",b),e=b.getNumberField("DURATION", +b),c=0a.count)throw a.count++,new Entry.Utils.AsyncError;a.isStart=!1; +b=Entry.hw.portData[a.data_default_address];a.data_default_address=void 0;return b}},robotis_openCM70_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.robotis_cm_sound_detected,"CM_SOUND_DETECTED"],[Lang.Blocks.robotis_cm_sound_detecting,"CM_SOUND_DETECTING"],[Lang.Blocks.robotis_cm_user_button,"CM_USER_BUTTON"]],value:"CM_SOUND_DETECTED",fontSize:11}],events:{},def:{params:[null],type:"robotis_openCM70_sensor_value"}, +paramsKeyMap:{SENSOR:0},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(a,b){a=b.executor.scope;if(!a.isStart){a.isStart=!0;a.count=0;var c=Entry.Robotis_openCM70.INSTRUCTION.READ,d=0,e=0,f=0,g=0;b=b.getStringField("SENSOR");"CM_SOUND_DETECTED"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTED[1]): +"CM_SOUND_DETECTING"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_SOUND_DETECTING[1]):"CM_USER_BUTTON"==b&&(f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_USER_BUTTON[1]); +f+=0*g;Entry.Robotis_carCont.setRobotisData([[c,d,e,0,g]]);Entry.Robotis_carCont.update();a.data_default_address=f;throw new Entry.Utils.AsyncError;}if(2>a.count)throw a.count++,new Entry.Utils.AsyncError;a.isStart=!1;b=Entry.hw.portData[a.data_default_address];a.data_default_address=void 0;return b}},robotis_openCM70_aux_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["3","PORT_3"],["4","PORT_4"],["5","PORT_5"],["6","PORT_6"]], value:"PORT_3",fontSize:11},{type:"Dropdown",options:[[Lang.Blocks.robotis_aux_servo_position,"AUX_SERVO_POSITION"],[Lang.Blocks.robotis_aux_ir,"AUX_IR"],[Lang.Blocks.robotis_aux_touch,"AUX_TOUCH"],[Lang.Blocks.robotis_aux_brightness,"AUX_BRIGHTNESS"],[Lang.Blocks.robotis_aux_hydro_themo_humidity,"AUX_HYDRO_THEMO_HUMIDITY"],[Lang.Blocks.robotis_aux_hydro_themo_temper,"AUX_HYDRO_THEMO_TEMPER"],[Lang.Blocks.robotis_aux_temperature,"AUX_TEMPERATURE"],[Lang.Blocks.robotis_aux_ultrasonic,"AUX_ULTRASONIC"], -[Lang.Blocks.robotis_aux_magnetic,"AUX_MAGNETIC"],[Lang.Blocks.robotis_aux_motion_detection,"AUX_MOTION_DETECTION"],[Lang.Blocks.robotis_aux_color,"AUX_COLOR"],[Lang.Blocks.robotis_aux_custom,"AUX_CUSTOM"]],value:"AUX_SERVO_POSITION",fontSize:11}],events:{},def:{params:[null,null],type:"robotis_openCM70_aux_sensor_value"},paramsKeyMap:{PORT:0,SENSOR:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(b,a){var c=a.executor.scope;if(!c.isStart){c.isStart=!0;c.count=0;var d= -Entry.Robotis_openCM70.INSTRUCTION.READ,e=0,f=0,g=0,h=0,k=a.getStringField("PORT"),l=a.getStringField("SENSOR"),n=0;"PORT_3"==k?n=2:"PORT_4"==k?n=3:"PORT_5"==k?n=4:"PORT_6"==k&&(n=5);"AUX_SERVO_POSITION"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1]):"AUX_IR"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0], -h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1]):"AUX_TOUCH"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1]):"AUX_TEMPERATURE"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1], -e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1]):"AUX_BRIGHTNESS"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1]):"AUX_HYDRO_THEMO_HUMIDITY"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1], -e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1]):"AUX_HYDRO_THEMO_TEMPER"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1]):"AUX_ULTRASONIC"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0], -h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1]):"AUX_MAGNETIC"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1]):"AUX_MOTION_DETECTION"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0], -h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1]):"AUX_COLOR"==l?(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1]):"AUX_CUSTOM"==l&&(g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0],h=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1], -e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0],f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1]);g+=n*h;0!=n&&(f=6*h);Entry.Robotis_carCont.setRobotisData([[d,e,f,0,h]]);Entry.Robotis_carCont.update();c.data_default_address=g;console.log(g);throw new Entry.Utils.AsyncError;}if(2>c.count)throw c.count++,new Entry.Utils.AsyncError;c.isStart=!1;d=Entry.hw.portData[c.data_default_address];c.data_default_address=void 0;return d}},robotis_openCM70_cm_buzzer_index:{color:"#00979D",skeleton:"basic", -statements:[],params:[{type:"Dropdown",options:[[Lang.General.note_a+"(0)","0"],[Lang.General.note_a+"#(1)","1"],[Lang.General.note_b+"(2)","2"],[Lang.General.note_c+"(3)","3"],[Lang.General.note_c+"#(4)","4"],[Lang.General.note_d+"(5)","5"],[Lang.General.note_d+"#(6)","6"],[Lang.General.note_e+"(7)","7"],[Lang.General.note_f+"(8)","8"],[Lang.General.note_f+"#(9)","9"],[Lang.General.note_g+"(10)","10"],[Lang.General.note_g+"#(11)","11"],[Lang.General.note_a+"(12)","12"],[Lang.General.note_a+"#(13)", -"13"],[Lang.General.note_b+"(14)","14"],[Lang.General.note_c+"(15)","15"],[Lang.General.note_c+"#(16)","16"],[Lang.General.note_d+"(17)","17"],[Lang.General.note_d+"#(18)","18"],[Lang.General.note_e+"(19)","19"],[Lang.General.note_f+"(20)","20"],[Lang.General.note_f+"#(21)","21"],[Lang.General.note_g+"(22)","22"],[Lang.General.note_g+"#(23)","23"],[Lang.General.note_a+"(24)","24"],[Lang.General.note_a+"#(25)","25"],[Lang.General.note_b+"(26)","26"],[Lang.General.note_c+"(27)","27"],[Lang.General.note_c+ -"#(28)","28"],[Lang.General.note_d+"(29)","29"],[Lang.General.note_d+"#(30)","30"],[Lang.General.note_e+"(31)","31"],[Lang.General.note_f+"(32)","32"],[Lang.General.note_f+"#(33)","33"],[Lang.General.note_g+"(34)","34"],[Lang.General.note_g+"#(35)","35"],[Lang.General.note_a+"(36)","36"],[Lang.General.note_a+"#(37)","37"],[Lang.General.note_b+"(38)","38"],[Lang.General.note_c+"(39)","39"],[Lang.General.note_c+"#(40)","40"],[Lang.General.note_d+"(41)","41"],[Lang.General.note_d+"#(42)","42"],[Lang.General.note_e+ -"(43)","43"],[Lang.General.note_f+"(44)","44"],[Lang.General.note_f+"#(45)","45"],[Lang.General.note_g+"(46)","46"],[Lang.General.note_g+"#(47)","47"],[Lang.General.note_a+"(48)","48"],[Lang.General.note_a+"#(49)","49"],[Lang.General.note_b+"(50)","50"],[Lang.General.note_c+"(51)","51"]],value:"0",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["1"]},null],type:"robotis_openCM70_cm_buzzer_index"}, -paramsKeyMap:{CM_BUZZER_INDEX:0,CM_BUZZER_TIME:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(b,a){var c=a.getField("CM_BUZZER_INDEX",a),d=a.getNumberValue("CM_BUZZER_TIME",a),e=Entry.Robotis_openCM70.INSTRUCTION.WRITE,f=0,g=0,h=0,k=0,l=0,f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[1],h=parseInt(10*d);50d&&(d=0);return Entry.Robotis_carCont.postCallReturn(a,[[e,f+(c-1)*g,g,d]],Entry.Robotis_openCM70.delay)}},robotis_openCM70_aux_led_module:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.robotis_common_port_3,"3"],[Lang.Blocks.robotis_common_port_4,"4"],[Lang.Blocks.robotis_common_port_5,"5"],[Lang.Blocks.robotis_common_port_6,"6"]],value:"3",fontSize:11},{type:"Dropdown",options:[[Lang.Blocks.robotis_cm_led_both+Lang.Blocks.robotis_common_off, -"0"],[Lang.Blocks.robotis_cm_led_right+Lang.Blocks.robotis_common_on,"1"],[Lang.Blocks.robotis_cm_led_left+Lang.Blocks.robotis_common_on,"2"],[Lang.Blocks.robotis_cm_led_both+Lang.Blocks.robotis_common_on,"3"]],value:"0",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"robotis_openCM70_aux_led_module"},paramsKeyMap:{PORT:0,LED_MODULE:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(b,a){var c=a.getField("PORT", -a),d=a.getField("LED_MODULE",a),e=Entry.Robotis_openCM70.INSTRUCTION.WRITE,f=0,g=0,f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[1];return Entry.Robotis_carCont.postCallReturn(a,[[e,f+(c-1)*g,g,d]],Entry.Robotis_openCM70.delay)}},robotis_openCM70_aux_custom:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.robotis_common_port_3,"3"],[Lang.Blocks.robotis_common_port_4,"4"],[Lang.Blocks.robotis_common_port_5, -"5"],[Lang.Blocks.robotis_common_port_6,"6"]],value:"3",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["0"]},null],type:"robotis_openCM70_aux_custom"},paramsKeyMap:{PORT:0,VALUE:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(b,a){var c=a.getField("PORT",a),d=a.getNumberValue("VALUE"),e=Entry.Robotis_openCM70.INSTRUCTION.WRITE,f=0,g=0,f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0], -g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1];return Entry.Robotis_carCont.postCallReturn(a,[[e,f+(c-1)*g,g,d]],Entry.Robotis_openCM70.delay)}},robotis_openCM70_cm_custom:{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:"number",params:["0"]},{type:"number",params:["0"]},null],type:"robotis_openCM70_cm_custom"},paramsKeyMap:{ADDRESS:0, -VALUE:1},"class":"robotis_openCM70_custom",isNotFor:["robotis_openCM70"],func:function(b,a){var c=Entry.Robotis_openCM70.INSTRUCTION.WRITE,d=0,e=0,d=a.getNumberValue("ADDRESS"),e=a.getNumberValue("VALUE");return Entry.Robotis_carCont.postCallReturn(a,[[c,d,65535c&&(c=0);createjs.Sound.setVolume(c);return a.callReturn()}},sound_volume_set:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"sound_volume_set"},paramsKeyMap:{VALUE:0},"class":"sound_volume",isNotFor:[],func:function(b,a){var c= -a.getNumberValue("VALUE",a)/100;1c&&(c=0);createjs.Sound.setVolume(c);return a.callReturn()}},sound_silent_all:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[null],type:"sound_silent_all"},"class":"sound_stop",isNotFor:[],func:function(b,a){createjs.Sound.stop();return a.callReturn()}},get_sounds:{color:"#A4D01D",skeleton:"basic_string_field",statements:[],params:[{type:"DropdownDynamic",value:null, -menuName:"sounds",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_SOUNDS}],events:{},def:{params:[null],type:"get_sounds"},paramsKeyMap:{VALUE:0},func:function(b,a){return a.getStringField("VALUE")}},sound_something_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},null],type:"sound_something_with_block"},paramsKeyMap:{VALUE:0},"class":"sound_play",isNotFor:[], -func:function(b,a){var c=a.getStringValue("VALUE",a);(c=b.parent.getSound(c))&&createjs.Sound.play(c.id);return a.callReturn()}},sound_something_second_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds",id:"95dw"},{type:"number",params:["1"]},null],type:"sound_something_second_with_block"},paramsKeyMap:{VALUE:0,SECOND:1}, -"class":"sound_play",isNotFor:[],func:function(b,a){var c=a.getStringValue("VALUE",a),d=a.getNumberValue("SECOND",a);(c=b.parent.getSound(c))&&createjs.Sound.play(c.id,{startTime:0,duration:1E3*d});return a.callReturn()}},sound_something_wait_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},null],type:"sound_something_wait_with_block"},paramsKeyMap:{VALUE:0}, -"class":"sound_wait",isNotFor:[],func:function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.playState;delete a.isPlay;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(c=b.parent.getSound(c))createjs.Sound.play(c.id),setTimeout(function(){a.playState=0},1E3*c.duration);return a}},sound_something_second_wait_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png", -size:12}],events:{},def:{params:[{type:"get_sounds"},{type:"number",params:["1"]},null],type:"sound_something_second_wait_with_block"},paramsKeyMap:{VALUE:0,SECOND:1},"class":"sound_wait",isNotFor:[],func:function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.isPlay;delete a.playState;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(c=b.parent.getSound(c)){var d=createjs.Sound.play(c.id),c=a.getNumberValue("SECOND",a);setTimeout(function(){d.stop();a.playState= -0},1E3*c);d.addEventListener("complete",function(a){})}return a}},sound_from_to:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},{type:"text",params:["1"]},{type:"text",params:["10"]},null],type:"sound_from_to"},paramsKeyMap:{VALUE:0,START:1,END:2},"class":"sound_play",isNotFor:[],func:function(b,a){var c= -a.getStringValue("VALUE",a);if(c=b.parent.getSound(c)){var d=1E3*a.getNumberValue("START",a),e=1E3*a.getNumberValue("END",a);createjs.Sound.play(c.id,{startTime:Math.min(d,e),duration:Math.max(d,e)-Math.min(d,e)})}return a.callReturn()}},sound_from_to_and_wait:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"}, -{type:"text",params:["1"]},{type:"text",params:["10"]},null],type:"sound_from_to_and_wait"},paramsKeyMap:{VALUE:0,START:1,END:2},"class":"sound_wait",isNotFor:[],func:function(b,a){if(a.isPlay){if(1==a.playState)return a;delete a.isPlay;delete a.playState;return a.callReturn()}a.isPlay=!0;a.playState=1;var c=a.getStringValue("VALUE",a);if(c=b.parent.getSound(c)){var d=1E3*a.getNumberValue("START",a),e=1E3*a.getNumberValue("END",a),f=Math.min(d,e),d=Math.max(d,e)-f;createjs.Sound.play(c.id,{startTime:f, -duration:d});setTimeout(function(){a.playState=0},d)}return a}},when_run_button_click:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_play.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"when_run_button_click"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"start"},press_some_key:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_keyboard.png", -size:17,position:{x:0,y:-2}},{type:"Dropdown",options:[["q","81"],["w","87"],["e","69"],["r","82"],["a","65"],["s","83"],["d","68"],["\uc704\ucabd \ud654\uc0b4\ud45c","38"],["\uc544\ub798\ucabd \ud654\uc0b4\ud45c","40"],["\uc67c\ucabd \ud654\uc0b4\ud45c","37"],["\uc624\ub978\ucabd \ud654\uc0b4\ud45c","39"],["\uc5d4\ud130","13"],["\uc2a4\ud398\uc774\uc2a4","32"]],value:"81",fontSize:11},{type:"Indicator",img:"block_icon/start_03.png",size:12}],events:{},def:{params:[null,null,null]},paramsKeyMap:{VALUE:1}, -func:function(b,a){return a.callReturn()}},when_some_key_pressed:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_keyboard.png",size:17,position:{x:0,y:-2}},{type:"Keyboard",value:"81"}],events:{},def:{params:[null,"81"],type:"when_some_key_pressed"},paramsKeyMap:{VALUE:1},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"keyPress"},mouse_clicked:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator", -img:"block_icon/start_icon_mouse.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"mouse_clicked"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"mouse_clicked"},mouse_click_cancled:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_mouse.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"mouse_click_cancled"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()}, -event:"mouse_click_cancled"},when_object_click:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_mouse.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"when_object_click"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"when_object_click"},when_object_click_canceled:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_mouse.png",size:17,position:{x:0, -y:-2}}],events:{},def:{params:[null],type:"when_object_click_canceled"},"class":"event",isNotFor:[],func:function(b,a){return a.callReturn()},event:"when_object_click_canceled"},when_some_key_click:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_keyboard.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null]},func:function(b,a){return a.callReturn()},event:"keyPress"},when_message_cast:{color:"#3BBD70",skeleton:"basic_event",statements:[], -params:[{type:"Indicator",img:"block_icon/start_icon_signal.png",size:17,position:{x:0,y:-2}},{type:"DropdownDynamic",value:null,menuName:"messages",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_START}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs",b)}],viewDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}]},def:{params:[null,null],type:"when_message_cast"},paramsKeyMap:{VALUE:1},"class":"message",isNotFor:["message"],func:function(b, -a){return a.callReturn()},event:"when_message_cast"},message_cast:{color:"#3BBD70",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"messages",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_START},{type:"Indicator",img:"block_icon/start_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs",b)}],viewDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}]},def:{params:[null,null],type:"message_cast"}, -paramsKeyMap:{VALUE:0},"class":"message",isNotFor:["message"],func:function(b,a){var c=a.getField("VALUE",a),d=Entry.isExist(c,"id",Entry.variableContainer.messages_);if("null"==c||!d)throw Error("value can not be null or undefined");Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent,["when_message_cast",c]);return a.callReturn()}},message_cast_wait:{color:"#3BBD70",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"messages",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_START}, -{type:"Indicator",img:"block_icon/start_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_messageRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_messageRefs",b)}]},def:{params:[null,null],type:"message_cast_wait"},paramsKeyMap:{VALUE:0},"class":"message",isNotFor:["message"],func:function(b,a){if(a.runningScript){for(var c=a.runningScript,d=c.length,e=0;ec.array_.length)throw Error("can not remove value from array"); -c.array_.splice(d-1,1);c.updateView();return a.callReturn()}},insert_value_to_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer; -a&&a.removeRef("_variableRefs",b)}]},def:{params:[{type:"text",params:["10"]},null,{type:"text",params:["1"]},null],type:"insert_value_to_list"},paramsKeyMap:{DATA:0,LIST:1,INDEX:2},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a),d=a.getValue("DATA",a),e=a.getValue("INDEX",a),c=Entry.variableContainer.getList(c,b);if(!c.array_||isNaN(e)||0==e||e>c.array_.length+1)throw Error("can not insert value to array");c.array_.splice(e-1,0,{data:d});c.updateView(); -return a.callReturn()}},change_value_list_index:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs", -b)}]},def:{params:[null,{type:"text",params:["1"]},{type:"text",params:["10"]},null],type:"change_value_list_index"},paramsKeyMap:{LIST:0,INDEX:1,DATA:2},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a),d=a.getValue("DATA",a),e=a.getValue("INDEX",a),c=Entry.variableContainer.getList(c,b);if(!c.array_||isNaN(e)||e>c.array_.length)throw Error("can not insert value to array");c.array_[e-1].data=d;c.updateView();return a.callReturn()}},value_of_index_from_list:{color:"#E457DC", -skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_value_of_index_from_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Text",text:Lang.Blocks.VARIABLE_value_of_index_from_list_2,color:"white"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.VARIABLE_value_of_index_from_list_3,color:"white"}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs", -b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null,null,{type:"number",params:["1"]}],type:"value_of_index_from_list"},paramsKeyMap:{LIST:1,INDEX:3},"class":"list_element",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a),d=a.getValue("INDEX",a),c=Entry.variableContainer.getList(c,b),d=Entry.getListRealIndex(d,c);if(!c.array_||isNaN(d)||d>c.array_.length)throw Error("can not insert value to array");return c.array_[d- -1].data}},length_of_list:{color:"#E457DC",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_length_of_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Text",text:Lang.Blocks.VARIABLE_length_of_list_2,color:"white"}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs", -b)}]},def:{params:[null,null,null],type:"length_of_list"},paramsKeyMap:{LIST:1},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a);return Entry.variableContainer.getList(c,b).array_.length}},show_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a= -Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null],type:"show_list"},paramsKeyMap:{LIST:0},"class":"list_visibility",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a);Entry.variableContainer.getList(c).setVisible(!0);return a.callReturn()}},hide_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists", -fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null],type:"hide_list"},paramsKeyMap:{LIST:0},"class":"list_visibility",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a);Entry.variableContainer.getList(c).setVisible(!1); -return a.callReturn()}},options_for_list:{color:"#E457DC",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["\uccab\ubc88\uc9f8","FIRST"],["\ub9c8\uc9c0\ub9c9","LAST"],["\ubb34\uc791\uc704","RANDOM"]],value:"FIRST",fontSize:11}],events:{},def:{params:[null]},paramsKeyMap:{OPERATOR:0},func:function(b,a){return a.getField("OPERATOR",a)}},set_visible_answer:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CALC_timer_visible_show, -"SHOW"],[Lang.Blocks.CALC_timer_visible_hide,"HIDE"]],value:"SHOW",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{viewAdd:[function(b){Entry.container&&Entry.container.showProjectAnswer()}],viewDestroy:[function(b){Entry.container&&Entry.container.hideProjectAnswer(b)}]},def:{params:["HIDE",null],type:"set_visible_answer"},paramsKeyMap:{BOOL:0},"class":"ask",isNotFor:[],func:function(b,a){"HIDE"==a.getField("BOOL",a)?Entry.container.inputValue.setVisible(!1): -Entry.container.inputValue.setVisible(!0);return a.callReturn()}},is_included_in_list:{color:"#E457DC",skeleton:"basic_boolean_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_is_included_in_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Text",text:Lang.Blocks.VARIABLE_is_included_in_list_2,color:"white"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.VARIABLE_is_included_in_list_3, -color:"white"}],events:{dataAdd:[function(b){var a=Entry.variableContainer;a&&a.addRef("_variableRefs",b)}],dataDestroy:[function(b){var a=Entry.variableContainer;a&&a.removeRef("_variableRefs",b)}]},def:{params:[null,null,null,{type:"text",params:["10"]},null],type:"is_included_in_list"},paramsKeyMap:{LIST:1,DATA:3},"class":"list",isNotFor:["list","listNotExist"],func:function(b,a){var c=a.getField("LIST",a),d=a.getStringValue("DATA",a),c=Entry.variableContainer.getList(c,b);if(!c)return!1;for(var c= -c.array_,e=0,f=c.length;ek&&(k=Math.round(k-155),g=-k,h=0,Entry.dplay.vel_value=g);if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11, -0),a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(c,g),Entry.hw.setDigitalPortValue(d,h),Entry.hw.setDigitalPortValue(e,g),Entry.hw.setDigitalPortValue(f,h),delete a.isStart,delete a.timeFlag,Entry.engine.isContinue=!1,a.callReturn()}else{a.isStart=!0;a.timeFlag=1;var l=setTimeout(function(){a.timeFlag=2;Entry.dplay.removeTimeout(l)},50);Entry.dplay.timeouts.push(l);return a}}},dplay_buzzer:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\ub514\uc9c0\ud138 10\ubc88 \ubd80\uc800\ub97c %1 %2 %3 \ubc15\uc790\ub85c \uc5f0\uc8fc\ud558\uae30", -params:[{type:"Dropdown",options:[["\ub3c4","1"],["\ub3c4#","2"],["\ub808","3"],["\ubbf8b","4"],["\ubbf8","5"],["\ud30c","6"],["\ud30c#","7"],["\uc194","8"],["\uc194#","9"],["\ub77c","10"],["\uc2dcb","11"],["\uc2dc","12"],["\ubb34\uc74c","100"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png", -size:12}],events:{},def:{params:["1","1",{type:"text",params:["0.5"]},null],type:"dplay_buzzer"},paramsKeyMap:{NOTE:0,OCTAVE:1,VALUE:2},"class":"dplay_set",isNotFor:["dplay"],func:function(b,a){if(a.isStart){if(1==a.timeFlag)return a;Entry.hw.setDigitalPortValue(10,100);delete a.isStart;delete a.timeFlag;Entry.engine.isContinue=!1;return a.callReturn()}var c=a.getNumberField("NOTE",a),d=a.getNumberField("OCTAVE",a),e=a.getNumberValue("VALUE"),d=c+12*(d-1),e=6E4*e/60;a.isStart=!0;a.timeFlag=1;100== -c?Entry.hw.setDigitalPortValue(10,100):Entry.hw.setDigitalPortValue(10,d);if(100q?(n=Math.round(q-155),g=-n,h=0,Entry.dplay.Left_value=g):0==q&&(h=g=0,Entry.dplay.Left_value=0));"2"==m&&(e=6,f=11,0q?(n=Math.round(q-155),k=-n,l=0,Entry.dplay.Right_value= -k):0==q&&(l=k=0,Entry.dplay.Right_value=k));"3"==m&&(c=3,d=5,e=6,f=11,0q?(n=Math.round(q-155),g=-n,h=0,k=-n,l=0,Entry.dplay.Left_value=g,Entry.dplay.Right_value=k):0==q&&(l=k=h=g=0,Entry.dplay.Left_value=0,Entry.dplay.Right_value=0));if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0), -a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(c,g),Entry.hw.setDigitalPortValue(d,h),Entry.hw.setDigitalPortValue(e,l),Entry.hw.setDigitalPortValue(f,k),delete a.isStart,delete a.timeFlag,Entry.engine.isContinue=!1,a.callReturn()}else{a.isStart=!0;a.timeFlag=1;var r=setTimeout(function(){a.timeFlag=2;Entry.dplay.removeTimeout(r)},50);Entry.dplay.timeouts.push(r);return a}}},dplay_robot_speed_set:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubc14\ud034 %1 \uc67c\ucabd \ubc14\ud034 %2(\uc73c)\ub85c \uc815\ud558\uae30 %3", -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:["100"]},{type:"text",params:["100"]},null],type:"dplay_robot_speed_set"},paramsKeyMap:{R_VALUE:0,L_VALUE:1},"class":"dplay_robot",isNotFor:["dplay"],func:function(b,a){var c=0,d=0,e=0,f=0,g=0,g=0,g=a.getNumberValue("L_VALUE",a),g=Math.max(g,-100),g=Math.min(g,100);0 -g?(g=Math.round(g-155),c=-g,d=0,Entry.dplay.Left_value=c):0==g&&(d=c=0,Entry.dplay.Left_value=0);g=a.getNumberValue("R_VALUE",a);g=Math.max(g,-100);g=Math.min(g,100);0g?(g=Math.round(g-155),e=-g,f=0,Entry.dplay.Right_value=e):0==g&&(f=e=0,Entry.dplay.Right_value=0);if(a.isStart){if(1==a.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0), -a;if(2==a.timeFlag)return Entry.hw.setDigitalPortValue(3,c),Entry.hw.setDigitalPortValue(5,d),Entry.hw.setDigitalPortValue(6,f),Entry.hw.setDigitalPortValue(11,e),delete a.isStart,delete a.timeFlag,Entry.engine.isContinue=!1,a.callReturn()}else{a.isStart=!0;a.timeFlag=1;var h=setTimeout(function(){a.timeFlag=2;Entry.dplay.removeTimeout(h)},50);Entry.dplay.timeouts.push(h);return a}}},dplay_robot_stop:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\ub85c\ubd07\uc744 \uc815\uc9c0\ud558\uae30 %1", -params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"dplay_robot_stop"},paramsKeyMap:{},"class":"dplay_robot",isNotFor:["dplay"],func:function(b,a){Entry.hw.setDigitalPortValue(3,0);Entry.hw.setDigitalPortValue(5,0);Entry.hw.setDigitalPortValue(11,0);Entry.hw.setDigitalPortValue(6,0);return a.callReturn()}},nemoino_get_number_sensor_value:{parent:"arduino_get_number_sensor_value",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_sensor_number"}], -type:"nemoino_get_number_sensor_value"},"class":"arduino_value"},nemoino_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_port_number"}],type:"nemoino_get_digital_value"},"class":"arduino_value"},nemoino_toggle_led:{parent:"arduino_toggle_led",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"nemoino_toggle_led"},"class":"arduino_set"},nemoino_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_pwm_port_number"}, -{type:"arduino_text",params:["255"]},null],type:"nemoino_toggle_pwm"},"class":"arduino_set"},nemoino_convert_scale:{parent:"arduino_convert_scale",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number"}]},{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"nemoino_convert_scale"},"class":"arduino"},sensorBoard_get_number_sensor_value:{parent:"arduino_get_number_sensor_value", -isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_sensor_number"}],type:"sensorBoard_get_number_sensor_value"},"class":"arduino_value"},sensorBoard_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_port_number"}],type:"sensorBoard_get_digital_value"},"class":"arduino_value"},sensorBoard_toggle_led:{parent:"arduino_toggle_led",isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"sensorBoard_toggle_led"}, -"class":"arduino_set"},sensorBoard_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"sensorBoard_toggle_pwm"},"class":"arduino_set"},sensorBoard_convert_scale:{parent:"arduino_convert_scale",isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number",id:"bl5e"}]},{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number", -params:["0"]},{type:"number",params:["100"]}],type:"sensorBoard_convert_scale"},"class":"arduino"},CODEino_get_number_sensor_value:{parent:"arduino_get_number_sensor_value",isNotFor:["CODEino"],def:{params:[{type:"arduino_get_sensor_number"}],type:"CODEino_get_number_sensor_value"},"class":"arduino_value"},CODEino_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["CODEino"],def:{params:[{type:"arduino_get_port_number"}],type:"CODEino_get_digital_value"},"class":"arduino_value"},CODEino_toggle_led:{parent:"arduino_toggle_led", -isNotFor:["CODEino"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"CODEino_toggle_led"},"class":"arduino_set"},CODEino_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["CODEino"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"CODEino_toggle_pwm"},"class":"arduino_set"},CODEino_convert_scale:{parent:"arduino_convert_scale",isNotFor:["CODEino"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number"}]}, -{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"CODEino_convert_scale"},"class":"arduino"},ardublock_get_number_sensor_value:{parent:"arduino_get_number_sensor_value",isNotFor:["ardublock"],def:{params:[{type:"arduino_get_sensor_number"}],type:"ardublock_get_number_sensor_value"},"class":"arduino_value"},ardublock_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["ardublock"],def:{params:[{type:"arduino_get_port_number"}], -type:"ardublock_get_digital_value"},"class":"arduino_value"},ardublock_toggle_led:{parent:"arduino_toggle_led",isNotFor:["ardublock"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"ardublock_toggle_led"},"class":"arduino_set"},ardublock_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["ardublock"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"ardublock_toggle_pwm"},"class":"arduino_set"},ardublock_convert_scale:{parent:"arduino_convert_scale", -isNotFor:["ardublock"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number"}]},{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"ardublock_convert_scale"},"class":"arduino"},joystick_get_number_sensor_value:{parent:"arduino_get_number_sensor_value",isNotFor:["joystick"],def:{params:[{type:"arduino_get_sensor_number"}],type:"joystick_get_number_sensor_value"},"class":"arduino_value"}, -joystick_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["joystick"],def:{params:[{type:"arduino_get_port_number"}],type:"joystick_get_digital_value"},"class":"arduino_value"},joystick_toggle_led:{parent:"arduino_toggle_led",isNotFor:["joystick"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"joystick_toggle_led"},"class":"arduino_set"},joystick_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["joystick"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text", -params:["255"]},null],type:"joystick_toggle_pwm"},"class":"arduino_set"},joystick_convert_scale:{parent:"arduino_convert_scale",isNotFor:["joystick"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number"}]},{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"joystick_convert_scale"},"class":"arduino"},ebs_if:{parent:"_if",def:{type:"_if",params:[{type:"reach_something",params:[null, -"wall"]}]}},ebs_if2:{parent:"_if",def:{type:"_if",params:[{type:"reach_something",params:[null,"cwz5"]}]}}};(function(){for(var b in Entry.block){var a=Entry.block[b];if(a.parent){var c=function(){};c.prototype=Entry.block[a.parent];var c=new c,d;for(d in a)c[d]=a[d];Entry.block[b]=c}}})();"object"==typeof exports&&(exports.block=Entry.block);Entry.BlockMenu=function(b,a,c,d){Entry.Model(this,!1);this._align=a||"CENTER";this._scroll=void 0!==d?d:!1;this._bannedClass=[];this._categories=[];this.suffix="blockMenu";b="string"===typeof b?$("#"+b):$(b);if("DIV"!==b.prop("tagName"))return console.error("Dom is not div element");this.view=b;this.visible=!0;this._svgId="blockMenu"+(new Date).getTime();this._clearCategory();this._categoryData=c;this._generateView(c);this._splitters=[];this.setWidth();this.svg=Entry.SVG(this._svgId);Entry.Utils.addFilters(this.svg, -this.suffix);a=Entry.Utils.addBlockPattern(this.svg,this.suffix);this.patternRect=a.rect;this.pattern=a.pattern;this.svgGroup=this.svg.elem("g");this.svgThreadGroup=this.svgGroup.elem("g");this.svgThreadGroup.board=this;this.svgBlockGroup=this.svgGroup.elem("g");this.svgBlockGroup.board=this;this.changeEvent=new Entry.Event(this);c&&this._generateCategoryCodes(c);this.observe(this,"_handleDragBlock",["dragBlock"]);this._scroll&&(this._scroller=new Entry.BlockMenuScroller(this),this._addControl(b)); -Entry.documentMousedown&&Entry.documentMousedown.attach(this,this.setSelectedBlock);this._categoryCodes&&Entry.keyPressed&&Entry.keyPressed.attach(this,this._captureKeyEvent);Entry.windowResized&&(b=_.debounce(this.updateOffset,200),Entry.windowResized.attach(this,b))}; -(function(b){b.schema={code:null,dragBlock:null,closeBlock:null,selectedBlockView:null};b._generateView=function(a){var b=this.view,d=this;a&&(this._categoryCol=Entry.Dom("ul",{class:"entryCategoryListWorkspace",parent:b}),this._generateCategoryView(a));this.blockMenuContainer=Entry.Dom("div",{"class":"blockMenuContainer",parent:b});this.svgDom=Entry.Dom($(''),{parent:this.blockMenuContainer});this.svgDom.mouseenter(function(a){d._scroller&& -d._scroller.setOpacity(1);a=d.workspace.selectedBlockView;!Entry.playground||Entry.playground.resizing||a&&a.dragMode===Entry.DRAG_MODE_DRAG||(Entry.playground.focusBlockMenu=!0,a=d.svgGroup.getBBox(),a=a.width+a.x+64,a>Entry.interfaceState.menuWidth&&(this.widthBackup=Entry.interfaceState.menuWidth-64,$(this).stop().animate({width:a-62},200)))});this.svgDom.mouseleave(function(a){Entry.playground&&!Entry.playground.resizing&&(d._scroller&&d._scroller.setOpacity(0),(a=this.widthBackup)&&$(this).stop().animate({width:a}, -200),delete this.widthBackup,delete Entry.playground.focusBlockMenu)});$(window).scroll(function(){d.updateOffset()})};b.changeCode=function(a){if(!(a instanceof Entry.Code))return console.error("You must inject code instance");this.codeListener&&this.code.changeEvent.detach(this.codeListener);var b=this;this.set({code:a});this.codeListener=this.code.changeEvent.attach(this,function(){b.changeEvent.notify()});a.createView(this);this.align()};b.bindCodeView=function(a){this.svgBlockGroup.remove(); -this.svgThreadGroup.remove();this.svgBlockGroup=a.svgBlockGroup;this.svgThreadGroup=a.svgThreadGroup;this.svgGroup.appendChild(this.svgThreadGroup);this.svgGroup.appendChild(this.svgBlockGroup);this._scroller&&this.svgGroup.appendChild(this._scroller.svgGroup)};b.align=function(a){var b=this.code;if(b){this._clearSplitters();b.view&&!a&&b.view.reDraw();a=b.getThreads();for(var b=10,d="LEFT"==this._align?10:this.svgDom.width()/2,e,f=0,g=a.length;fthis._bannedClass.indexOf(a)&&this._bannedClass.push(a);this.align(b)};b.unbanClass=function(a,b){var d=this._bannedClass.indexOf(a);-1b&&(a.preventDefault(),this.selectMenu(b-49))};b.setPatternRectFill= -function(a){this.patternRect.attr({fill:a});this.pattern.attr({style:""})};b.disablePattern=function(){this.pattern.attr({style:"display: none"})};b._clearCategory=function(){this._selectedCategoryView=null;this._categories=[];var a=this._categoryElems,b;for(b in a)a[b].remove();this._categoryElems={};a=this._categoryCodes;for(b in a){var d=a[b];d.constructor==Entry.Code&&d.clear()}this._categoryCodes=null};b.setCategoryData=function(a){this._clearCategory();this._categoryData=a;this._generateCategoryView(a); -this._generateCategoryCodes(a)};b._generateCategoryView=function(a){if(a)for(var b=0;b=b?this.setVisible(!1):this.setVisible(!0)};b._reset=function(){this.vY=0;this.vScrollbar.attr({y:this.vY});this.resizeScrollBar()};b.onMouseDown=function(a){function b(a){a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();a=a.originalEvent&&a.originalEvent.touches?a.originalEvent.touches[0]:a;var c=e.dragInstance; -e.scroll(a.pageY-c.offsetY);c.set({offsetY:a.pageY})}function d(a){$(document).unbind(".scroll");delete e.dragInstance}var e=this;a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();if(0===a.button||a.originalEvent&&a.originalEvent.touches){Entry.documentMousedown&&Entry.documentMousedown.notify(a);var f;f=a.originalEvent&&a.originalEvent.touches?a.originalEvent.touches[0]:a;var g=$(document);g.bind("mousemove.scroll",b);g.bind("mouseup.scroll",d);g.bind("touchmove.scroll", -b);g.bind("touchend.scroll",d);e.dragInstance=new Entry.DragInstance({startY:f.pageY,offsetY:f.pageY})}a.stopPropagation()};b._addControl=function(){$(this.vScrollbar).bind("mousedown touchstart",this.mouseHandler)}})(Entry.BlockMenuScroller.prototype);Entry.BlockView=function(b,a,c){Entry.Model(this,!1);this.block=b;this._lazyUpdatePos=_.debounce(b._updatePos.bind(b),200);this._board=a;this._observers=[];this.set(b);this.svgGroup=a.svgBlockGroup.elem("g");this._schema=Entry.block[b.type];this._schema.changeEvent&&(this._schemaChangeEvent=this._schema.changeEvent.attach(this,this._updateSchema));var d=this._skeleton=Entry.skeleton[this._schema.skeleton];this._contents=[];this._statements=[];this.magnet={};this._paramMap={};d.magnets&&d.magnets(this).next&& -(this.svgGroup.nextMagnet=this.block,this._nextGroup=this.svgGroup.elem("g"),this._observers.push(this.observe(this,"_updateMagnet",["contentHeight"])));this.isInBlockMenu=this.getBoard()instanceof Entry.BlockMenu;var e=this;this.mouseHandler=function(){var a=e.block.events;a&&a.mousedown&&a.mousedown.forEach(function(a){a(e)});e.onMouseDown.apply(e,arguments)};this._startRender(b,c);this._observers.push(this.block.observe(this,"_setMovable",["movable"]));this._observers.push(this.block.observe(this, +[Lang.Blocks.robotis_aux_magnetic,"AUX_MAGNETIC"],[Lang.Blocks.robotis_aux_motion_detection,"AUX_MOTION_DETECTION"],[Lang.Blocks.robotis_aux_color,"AUX_COLOR"],[Lang.Blocks.robotis_aux_custom,"AUX_CUSTOM"]],value:"AUX_SERVO_POSITION",fontSize:11}],events:{},def:{params:[null,null],type:"robotis_openCM70_aux_sensor_value"},paramsKeyMap:{PORT:0,SENSOR:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(a,b){a=b.executor.scope;if(!a.isStart){a.isStart=!0;a.count=0;var c=Entry.Robotis_openCM70.INSTRUCTION.READ, +d=0,e=0,f=0,g=0,h=b.getStringField("PORT");b=b.getStringField("SENSOR");var k=0;"PORT_3"==h?k=2:"PORT_4"==h?k=3:"PORT_5"==h?k=4:"PORT_6"==h&&(k=5);"AUX_SERVO_POSITION"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_SERVO_POSITION[1]):"AUX_IR"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1], +d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_IR[1]):"AUX_TOUCH"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TOUCH[1]):"AUX_TEMPERATURE"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[0], +e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_TEMPERATURE[1]):"AUX_BRIGHTNESS"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_BRIGHTNESS[1]):"AUX_HYDRO_THEMO_HUMIDITY"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[0], +e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_HUMIDITY[1]):"AUX_HYDRO_THEMO_TEMPER"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_HYDRO_THEMO_TEMPER[1]):"AUX_ULTRASONIC"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[0], +e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_ULTRASONIC[1]):"AUX_MAGNETIC"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MAGNETIC[1]):"AUX_MOTION_DETECTION"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[0], +e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_MOTION_DETECTION[1]):"AUX_COLOR"==b?(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_COLOR[1]):"AUX_CUSTOM"==b&&(f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0],g=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1],d=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0],e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1]); +f+=k*g;0!=k&&(e=6*g);Entry.Robotis_carCont.setRobotisData([[c,d,e,0,g]]);Entry.Robotis_carCont.update();a.data_default_address=f;console.log(f);throw new Entry.Utils.AsyncError;}if(2>a.count)throw a.count++,new Entry.Utils.AsyncError;a.isStart=!1;c=Entry.hw.portData[a.data_default_address];a.data_default_address=void 0;return c}},robotis_openCM70_cm_buzzer_index:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.note_a+"(0)","0"],[Lang.General.note_a+"#(1)", +"1"],[Lang.General.note_b+"(2)","2"],[Lang.General.note_c+"(3)","3"],[Lang.General.note_c+"#(4)","4"],[Lang.General.note_d+"(5)","5"],[Lang.General.note_d+"#(6)","6"],[Lang.General.note_e+"(7)","7"],[Lang.General.note_f+"(8)","8"],[Lang.General.note_f+"#(9)","9"],[Lang.General.note_g+"(10)","10"],[Lang.General.note_g+"#(11)","11"],[Lang.General.note_a+"(12)","12"],[Lang.General.note_a+"#(13)","13"],[Lang.General.note_b+"(14)","14"],[Lang.General.note_c+"(15)","15"],[Lang.General.note_c+"#(16)","16"], +[Lang.General.note_d+"(17)","17"],[Lang.General.note_d+"#(18)","18"],[Lang.General.note_e+"(19)","19"],[Lang.General.note_f+"(20)","20"],[Lang.General.note_f+"#(21)","21"],[Lang.General.note_g+"(22)","22"],[Lang.General.note_g+"#(23)","23"],[Lang.General.note_a+"(24)","24"],[Lang.General.note_a+"#(25)","25"],[Lang.General.note_b+"(26)","26"],[Lang.General.note_c+"(27)","27"],[Lang.General.note_c+"#(28)","28"],[Lang.General.note_d+"(29)","29"],[Lang.General.note_d+"#(30)","30"],[Lang.General.note_e+ +"(31)","31"],[Lang.General.note_f+"(32)","32"],[Lang.General.note_f+"#(33)","33"],[Lang.General.note_g+"(34)","34"],[Lang.General.note_g+"#(35)","35"],[Lang.General.note_a+"(36)","36"],[Lang.General.note_a+"#(37)","37"],[Lang.General.note_b+"(38)","38"],[Lang.General.note_c+"(39)","39"],[Lang.General.note_c+"#(40)","40"],[Lang.General.note_d+"(41)","41"],[Lang.General.note_d+"#(42)","42"],[Lang.General.note_e+"(43)","43"],[Lang.General.note_f+"(44)","44"],[Lang.General.note_f+"#(45)","45"],[Lang.General.note_g+ +"(46)","46"],[Lang.General.note_g+"#(47)","47"],[Lang.General.note_a+"(48)","48"],[Lang.General.note_a+"#(49)","49"],[Lang.General.note_b+"(50)","50"],[Lang.General.note_c+"(51)","51"]],value:"0",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["1"]},null],type:"robotis_openCM70_cm_buzzer_index"},paramsKeyMap:{CM_BUZZER_INDEX:0,CM_BUZZER_TIME:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"], +func:function(a,b){a=b.getField("CM_BUZZER_INDEX",b);var c=b.getNumberValue("CM_BUZZER_TIME",b),d=Entry.Robotis_openCM70.INSTRUCTION.WRITE,e,f,g;e=Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[0];f=Entry.Robotis_openCM70.CONTROL_TABLE.CM_BUZZER_TIME[1];g=parseInt(10*c);50c&&(c=0);return Entry.Robotis_carCont.postCallReturn(b,[[d,e+(a-1)*f,f,c]],Entry.Robotis_openCM70.delay)}},robotis_openCM70_aux_led_module:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.robotis_common_port_3, +"3"],[Lang.Blocks.robotis_common_port_4,"4"],[Lang.Blocks.robotis_common_port_5,"5"],[Lang.Blocks.robotis_common_port_6,"6"]],value:"3",fontSize:11},{type:"Dropdown",options:[[Lang.Blocks.robotis_cm_led_both+Lang.Blocks.robotis_common_off,"0"],[Lang.Blocks.robotis_cm_led_right+Lang.Blocks.robotis_common_on,"1"],[Lang.Blocks.robotis_cm_led_left+Lang.Blocks.robotis_common_on,"2"],[Lang.Blocks.robotis_cm_led_both+Lang.Blocks.robotis_common_on,"3"]],value:"0",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png", +size:12}],events:{},def:{params:[null,null,null],type:"robotis_openCM70_aux_led_module"},paramsKeyMap:{PORT:0,LED_MODULE:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(a,b){a=b.getField("PORT",b);var c=b.getField("LED_MODULE",b),d=Entry.Robotis_openCM70.INSTRUCTION.WRITE,e,f;e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[0];f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_LED_MODULE[1];return Entry.Robotis_carCont.postCallReturn(b,[[d,e+(a-1)*f,f,c]],Entry.Robotis_openCM70.delay)}}, +robotis_openCM70_aux_custom:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.robotis_common_port_3,"3"],[Lang.Blocks.robotis_common_port_4,"4"],[Lang.Blocks.robotis_common_port_5,"5"],[Lang.Blocks.robotis_common_port_6,"6"]],value:"3",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"number",params:["0"]},null],type:"robotis_openCM70_aux_custom"},paramsKeyMap:{PORT:0, +VALUE:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func:function(a,b){a=b.getField("PORT",b);var c=b.getNumberValue("VALUE"),d=Entry.Robotis_openCM70.INSTRUCTION.WRITE,e,f;e=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[0];f=Entry.Robotis_openCM70.CONTROL_TABLE.AUX_CUSTOM[1];return Entry.Robotis_carCont.postCallReturn(b,[[d,e+(a-1)*f,f,c]],Entry.Robotis_openCM70.delay)}},robotis_openCM70_cm_custom:{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:"number",params:["0"]},{type:"number",params:["0"]},null],type:"robotis_openCM70_cm_custom"},paramsKeyMap:{ADDRESS:0,VALUE:1},"class":"robotis_openCM70_custom",isNotFor:["robotis_openCM70"],func:function(a,b){a=Entry.Robotis_openCM70.INSTRUCTION.WRITE;var c,d;c=b.getNumberValue("ADDRESS");d=b.getNumberValue("VALUE");return Entry.Robotis_carCont.postCallReturn(b,[[a,c,65535a&&(a=0);createjs.Sound.setVolume(a);return b.callReturn()}},sound_volume_set:{color:"#A4D01D", +skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"sound_volume_set"},paramsKeyMap:{VALUE:0},"class":"sound_volume",isNotFor:[],func:function(a,b){a=b.getNumberValue("VALUE",b)/100;1a&&(a=0);createjs.Sound.setVolume(a);return b.callReturn()}},sound_silent_all:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/sound_03.png", +size:12}],events:{},def:{params:[null],type:"sound_silent_all"},"class":"sound_stop",isNotFor:[],func:function(a,b){createjs.Sound.stop();return b.callReturn()}},get_sounds:{color:"#A4D01D",skeleton:"basic_string_field",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"sounds",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_SOUNDS}],events:{},def:{params:[null],type:"get_sounds"},paramsKeyMap:{VALUE:0},func:function(a,b){return b.getStringField("VALUE")}},sound_something_with_block:{color:"#A4D01D", +skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},null],type:"sound_something_with_block"},paramsKeyMap:{VALUE:0},"class":"sound_play",isNotFor:[],func:function(a,b){var c=b.getStringValue("VALUE",b);(a=a.parent.getSound(c))&&createjs.Sound.play(a.id);return b.callReturn()}},sound_something_second_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block", +accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds",id:"95dw"},{type:"number",params:["1"]},null],type:"sound_something_second_with_block"},paramsKeyMap:{VALUE:0,SECOND:1},"class":"sound_play",isNotFor:[],func:function(a,b){var c=b.getStringValue("VALUE",b),d=b.getNumberValue("SECOND",b);(a=a.parent.getSound(c))&&createjs.Sound.play(a.id,{startTime:0,duration:1E3*d});return b.callReturn()}},sound_something_wait_with_block:{color:"#A4D01D", +skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},null],type:"sound_something_wait_with_block"},paramsKeyMap:{VALUE:0},"class":"sound_wait",isNotFor:[],func:function(a,b){if(b.isPlay){if(1==b.playState)return b;delete b.playState;delete b.isPlay;return b.callReturn()}b.isPlay=!0;b.playState=1;var c=b.getStringValue("VALUE",b);if(a=a.parent.getSound(c))createjs.Sound.play(a.id), +setTimeout(function(){b.playState=0},1E3*a.duration);return b}},sound_something_second_wait_with_block:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},{type:"number",params:["1"]},null],type:"sound_something_second_wait_with_block"},paramsKeyMap:{VALUE:0,SECOND:1},"class":"sound_wait",isNotFor:[],func:function(a,b){if(b.isPlay){if(1== +b.playState)return b;delete b.isPlay;delete b.playState;return b.callReturn()}b.isPlay=!0;b.playState=1;var c=b.getStringValue("VALUE",b);if(a=a.parent.getSound(c)){var d=createjs.Sound.play(a.id);a=b.getNumberValue("SECOND",b);setTimeout(function(){d.stop();b.playState=0},1E3*a);d.addEventListener("complete",function(b){})}return b}},sound_from_to:{color:"#A4D01D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator", +img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},{type:"text",params:["1"]},{type:"text",params:["10"]},null],type:"sound_from_to"},paramsKeyMap:{VALUE:0,START:1,END:2},"class":"sound_play",isNotFor:[],func:function(a,b){var c=b.getStringValue("VALUE",b);if(a=a.parent.getSound(c)){var c=1E3*b.getNumberValue("START",b),d=1E3*b.getNumberValue("END",b);createjs.Sound.play(a.id,{startTime:Math.min(c,d),duration:Math.max(c,d)-Math.min(c,d)})}return b.callReturn()}},sound_from_to_and_wait:{color:"#A4D01D", +skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/sound_03.png",size:12}],events:{},def:{params:[{type:"get_sounds"},{type:"text",params:["1"]},{type:"text",params:["10"]},null],type:"sound_from_to_and_wait"},paramsKeyMap:{VALUE:0,START:1,END:2},"class":"sound_wait",isNotFor:[],func:function(a,b){if(b.isPlay){if(1==b.playState)return b;delete b.isPlay;delete b.playState;return b.callReturn()}b.isPlay= +!0;b.playState=1;var c=b.getStringValue("VALUE",b);if(a=a.parent.getSound(c)){var d=1E3*b.getNumberValue("START",b),e=1E3*b.getNumberValue("END",b),c=Math.min(d,e),d=Math.max(d,e)-c;createjs.Sound.play(a.id,{startTime:c,duration:d});setTimeout(function(){b.playState=0},d)}return b}},when_run_button_click:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_play.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"when_run_button_click"}, +"class":"event",isNotFor:[],func:function(a,b){return b.callReturn()},event:"start"},press_some_key:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_keyboard.png",size:17,position:{x:0,y:-2}},{type:"Dropdown",options:[["q","81"],["w","87"],["e","69"],["r","82"],["a","65"],["s","83"],["d","68"],["\uc704\ucabd \ud654\uc0b4\ud45c","38"],["\uc544\ub798\ucabd \ud654\uc0b4\ud45c","40"],["\uc67c\ucabd \ud654\uc0b4\ud45c","37"],["\uc624\ub978\ucabd \ud654\uc0b4\ud45c", +"39"],["\uc5d4\ud130","13"],["\uc2a4\ud398\uc774\uc2a4","32"]],value:"81",fontSize:11},{type:"Indicator",img:"block_icon/start_03.png",size:12}],events:{},def:{params:[null,null,null]},paramsKeyMap:{VALUE:1},func:function(a,b){return b.callReturn()}},when_some_key_pressed:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_keyboard.png",size:17,position:{x:0,y:-2}},{type:"Keyboard",value:"81"}],events:{},def:{params:[null,"81"],type:"when_some_key_pressed"}, +paramsKeyMap:{VALUE:1},"class":"event",isNotFor:[],func:function(a,b){return b.callReturn()},event:"keyPress"},mouse_clicked:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_mouse.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"mouse_clicked"},"class":"event",isNotFor:[],func:function(a,b){return b.callReturn()},event:"mouse_clicked"},mouse_click_cancled:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator", +img:"block_icon/start_icon_mouse.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"mouse_click_cancled"},"class":"event",isNotFor:[],func:function(a,b){return b.callReturn()},event:"mouse_click_cancled"},when_object_click:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_mouse.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"when_object_click"},"class":"event",isNotFor:[],func:function(a,b){return b.callReturn()}, +event:"when_object_click"},when_object_click_canceled:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_mouse.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"when_object_click_canceled"},"class":"event",isNotFor:[],func:function(a,b){return b.callReturn()},event:"when_object_click_canceled"},when_some_key_click:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_keyboard.png", +size:17,position:{x:0,y:-2}}],events:{},def:{params:[null]},func:function(a,b){return b.callReturn()},event:"keyPress"},when_message_cast:{color:"#3BBD70",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_signal.png",size:17,position:{x:0,y:-2}},{type:"DropdownDynamic",value:null,menuName:"messages",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_START}],events:{dataAdd:[function(a){var b=Entry.variableContainer;b&&b.addRef("_messageRefs",a)}],viewDestroy:[function(a){var b= +Entry.variableContainer;b&&b.removeRef("_messageRefs",a)}]},def:{params:[null,null],type:"when_message_cast"},paramsKeyMap:{VALUE:1},"class":"message",isNotFor:["message"],func:function(a,b){return b.callReturn()},event:"when_message_cast"},message_cast:{color:"#3BBD70",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"messages",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_START},{type:"Indicator",img:"block_icon/start_03.png",size:12}],events:{dataAdd:[function(a){var b= +Entry.variableContainer;b&&b.addRef("_messageRefs",a)}],viewDestroy:[function(a){var b=Entry.variableContainer;b&&b.removeRef("_messageRefs",a)}]},def:{params:[null,null],type:"message_cast"},paramsKeyMap:{VALUE:0},"class":"message",isNotFor:["message"],func:function(a,b){a=b.getField("VALUE",b);var c=Entry.isExist(a,"id",Entry.variableContainer.messages_);if("null"==a||!c)throw Error("value can not be null or undefined");Entry.container.mapEntityIncludeCloneOnScene(Entry.engine.raiseKeyEvent,["when_message_cast", +a]);return b.callReturn()}},message_cast_wait:{color:"#3BBD70",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"messages",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_START},{type:"Indicator",img:"block_icon/start_03.png",size:12}],events:{dataAdd:[function(a){var b=Entry.variableContainer;b&&b.addRef("_messageRefs",a)}],dataDestroy:[function(a){var b=Entry.variableContainer;b&&b.removeRef("_messageRefs",a)}]},def:{params:[null,null],type:"message_cast_wait"}, +paramsKeyMap:{VALUE:0},"class":"message",isNotFor:["message"],func:function(a,b){if(b.runningScript){a=b.runningScript;for(var c=a.length,d=0;da.array_.length)throw Error("can not remove value from array");a.array_.splice(d-1,1);a.updateView();return b.callReturn()}},insert_value_to_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(a){var b=Entry.variableContainer; +b&&b.addRef("_variableRefs",a)}],dataDestroy:[function(a){var b=Entry.variableContainer;b&&b.removeRef("_variableRefs",a)}]},def:{params:[{type:"text",params:["10"]},null,{type:"text",params:["1"]},null],type:"insert_value_to_list"},paramsKeyMap:{DATA:0,LIST:1,INDEX:2},"class":"list",isNotFor:["list","listNotExist"],func:function(a,b){var c=b.getField("LIST",b),d=b.getValue("DATA",b),e=b.getValue("INDEX",b);a=Entry.variableContainer.getList(c,a);if(!a.array_||isNaN(e)||0==e||e>a.array_.length+1)throw Error("can not insert value to array"); +a.array_.splice(e-1,0,{data:d});a.updateView();return b.callReturn()}},change_value_list_index:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(a){var b=Entry.variableContainer;b&&b.addRef("_variableRefs",a)}],dataDestroy:[function(a){var b= +Entry.variableContainer;b&&b.removeRef("_variableRefs",a)}]},def:{params:[null,{type:"text",params:["1"]},{type:"text",params:["10"]},null],type:"change_value_list_index"},paramsKeyMap:{LIST:0,INDEX:1,DATA:2},"class":"list",isNotFor:["list","listNotExist"],func:function(a,b){var c=b.getField("LIST",b),d=b.getValue("DATA",b),e=b.getValue("INDEX",b);a=Entry.variableContainer.getList(c,a);if(!a.array_||isNaN(e)||e>a.array_.length)throw Error("can not insert value to array");a.array_[e-1].data=d;a.updateView(); +return b.callReturn()}},value_of_index_from_list:{color:"#E457DC",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_value_of_index_from_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Text",text:Lang.Blocks.VARIABLE_value_of_index_from_list_2,color:"white"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.VARIABLE_value_of_index_from_list_3,color:"white"}], +events:{dataAdd:[function(a){var b=Entry.variableContainer;b&&b.addRef("_variableRefs",a)}],dataDestroy:[function(a){var b=Entry.variableContainer;b&&b.removeRef("_variableRefs",a)}]},def:{params:[null,null,null,{type:"number",params:["1"]}],type:"value_of_index_from_list"},paramsKeyMap:{LIST:1,INDEX:3},"class":"list_element",isNotFor:["list","listNotExist"],func:function(a,b){var c=b.getField("LIST",b);b=b.getValue("INDEX",b);a=Entry.variableContainer.getList(c,a);b=Entry.getListRealIndex(b,a);if(!a.array_|| +isNaN(b)||b>a.array_.length)throw Error("can not insert value to array");return a.array_[b-1].data}},length_of_list:{color:"#E457DC",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_length_of_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Text",text:Lang.Blocks.VARIABLE_length_of_list_2,color:"white"}],events:{dataAdd:[function(a){var b=Entry.variableContainer;b&&b.addRef("_variableRefs", +a)}],dataDestroy:[function(a){var b=Entry.variableContainer;b&&b.removeRef("_variableRefs",a)}]},def:{params:[null,null,null],type:"length_of_list"},paramsKeyMap:{LIST:1},"class":"list",isNotFor:["list","listNotExist"],func:function(a,b){b=b.getField("LIST",b);return Entry.variableContainer.getList(b,a).array_.length}},show_list:{color:"#E457DC",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator", +img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(a){var b=Entry.variableContainer;b&&b.addRef("_variableRefs",a)}],dataDestroy:[function(a){var b=Entry.variableContainer;b&&b.removeRef("_variableRefs",a)}]},def:{params:[null,null],type:"show_list"},paramsKeyMap:{LIST:0},"class":"list_visibility",isNotFor:["list","listNotExist"],func:function(a,b){a=b.getField("LIST",b);Entry.variableContainer.getList(a).setVisible(!0);return b.callReturn()}},hide_list:{color:"#E457DC",skeleton:"basic", +statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{dataAdd:[function(a){var b=Entry.variableContainer;b&&b.addRef("_variableRefs",a)}],dataDestroy:[function(a){var b=Entry.variableContainer;b&&b.removeRef("_variableRefs",a)}]},def:{params:[null,null],type:"hide_list"},paramsKeyMap:{LIST:0},"class":"list_visibility",isNotFor:["list","listNotExist"],func:function(a, +b){a=b.getField("LIST",b);Entry.variableContainer.getList(a).setVisible(!1);return b.callReturn()}},options_for_list:{color:"#E457DC",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["\uccab\ubc88\uc9f8","FIRST"],["\ub9c8\uc9c0\ub9c9","LAST"],["\ubb34\uc791\uc704","RANDOM"]],value:"FIRST",fontSize:11}],events:{},def:{params:[null]},paramsKeyMap:{OPERATOR:0},func:function(a,b){return b.getField("OPERATOR",b)}},set_visible_answer:{color:"#E457DC",skeleton:"basic",statements:[], +params:[{type:"Dropdown",options:[[Lang.Blocks.CALC_timer_visible_show,"SHOW"],[Lang.Blocks.CALC_timer_visible_hide,"HIDE"]],value:"SHOW",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Indicator",img:"block_icon/variable_03.png",size:12}],events:{viewAdd:[function(a){Entry.container&&Entry.container.showProjectAnswer()}],viewDestroy:[function(a){Entry.container&&Entry.container.hideProjectAnswer(a)}]},def:{params:["HIDE",null],type:"set_visible_answer"},paramsKeyMap:{BOOL:0},"class":"ask", +isNotFor:[],func:function(a,b){"HIDE"==b.getField("BOOL",b)?Entry.container.inputValue.setVisible(!1):Entry.container.inputValue.setVisible(!0);return b.callReturn()}},is_included_in_list:{color:"#E457DC",skeleton:"basic_boolean_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_is_included_in_list_1,color:"white"},{type:"DropdownDynamic",value:null,menuName:"lists",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_VARIABLE},{type:"Text",text:Lang.Blocks.VARIABLE_is_included_in_list_2, +color:"white"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.VARIABLE_is_included_in_list_3,color:"white"}],events:{dataAdd:[function(a){var b=Entry.variableContainer;b&&b.addRef("_variableRefs",a)}],dataDestroy:[function(a){var b=Entry.variableContainer;b&&b.removeRef("_variableRefs",a)}]},def:{params:[null,null,null,{type:"text",params:["10"]},null],type:"is_included_in_list"},paramsKeyMap:{LIST:1,DATA:3},"class":"list",isNotFor:["list","listNotExist"],func:function(a,b){var c=b.getField("LIST", +b);b=b.getStringValue("DATA",b);a=Entry.variableContainer.getList(c,a);if(!a)return!1;a=a.array_;for(var c=0,d=a.length;ch&&(h=Math.round(h-155),f=-h,g=0,Entry.dplay.vel_value=f);if(b.isStart){if(1==b.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0),b;if(2==b.timeFlag)return Entry.hw.setDigitalPortValue(a,f),Entry.hw.setDigitalPortValue(c,g),Entry.hw.setDigitalPortValue(d,f),Entry.hw.setDigitalPortValue(e,g),delete b.isStart,delete b.timeFlag, +Entry.engine.isContinue=!1,b.callReturn()}else{b.isStart=!0;b.timeFlag=1;var k=setTimeout(function(){b.timeFlag=2;Entry.dplay.removeTimeout(k)},50);Entry.dplay.timeouts.push(k);return b}}},dplay_buzzer:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\ub514\uc9c0\ud138 10\ubc88 \ubd80\uc800\ub97c %1 %2 %3 \ubc15\uc790\ub85c \uc5f0\uc8fc\ud558\uae30",params:[{type:"Dropdown",options:[["\ub3c4","1"],["\ub3c4#","2"],["\ub808","3"],["\ubbf8b","4"],["\ubbf8","5"],["\ud30c","6"], +["\ud30c#","7"],["\uc194","8"],["\uc194#","9"],["\ub77c","10"],["\uc2dcb","11"],["\uc2dc","12"],["\ubb34\uc74c","100"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Dropdown",options:[["1","1"],["2","2"],["3","3"]],value:"1",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:["1","1",{type:"text",params:["0.5"]},null],type:"dplay_buzzer"},paramsKeyMap:{NOTE:0,OCTAVE:1, +VALUE:2},"class":"dplay_set",isNotFor:["dplay"],func:function(a,b){if(b.isStart){if(1==b.timeFlag)return b;Entry.hw.setDigitalPortValue(10,100);delete b.isStart;delete b.timeFlag;Entry.engine.isContinue=!1;return b.callReturn()}a=b.getNumberField("NOTE",b);var c=b.getNumberField("OCTAVE",b),d=b.getNumberValue("VALUE"),c=a+12*(c-1),d=6E4*d/60;b.isStart=!0;b.timeFlag=1;100==a?Entry.hw.setDigitalPortValue(10,100):Entry.hw.setDigitalPortValue(10,c);if(100m?(l=Math.round(m-155),f=-l,g=0,Entry.dplay.Left_value=f):0==m&&(g=f=0,Entry.dplay.Left_value=0));"2"==n&&(d=6,e=11,0m?(l=Math.round(m-155),h=-l,k=0,Entry.dplay.Right_value=h):0==m&&(k=h=0,Entry.dplay.Right_value=h));"3"==n&&(a=3,c=5,d=6,e=11,0m?(l=Math.round(m-155),f=-l,g=0,h=-l,k=0,Entry.dplay.Left_value=f,Entry.dplay.Right_value=h):0==m&&(k=h=g=f=0,Entry.dplay.Left_value=0,Entry.dplay.Right_value=0));if(b.isStart){if(1==b.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0),b;if(2==b.timeFlag)return Entry.hw.setDigitalPortValue(a,f),Entry.hw.setDigitalPortValue(c,g),Entry.hw.setDigitalPortValue(d,k),Entry.hw.setDigitalPortValue(e, +h),delete b.isStart,delete b.timeFlag,Entry.engine.isContinue=!1,b.callReturn()}else{b.isStart=!0;b.timeFlag=1;var q=setTimeout(function(){b.timeFlag=2;Entry.dplay.removeTimeout(q)},50);Entry.dplay.timeouts.push(q);return b}}},dplay_robot_speed_set:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\uc624\ub978\ucabd \ubc14\ud034 %1 \uc67c\ucabd \ubc14\ud034 %2(\uc73c)\ub85c \uc815\ud558\uae30 %3",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:["100"]},{type:"text",params:["100"]},null],type:"dplay_robot_speed_set"},paramsKeyMap:{R_VALUE:0,L_VALUE:1},"class":"dplay_robot",isNotFor:["dplay"],func:function(a,b){var c=a=0,d=0,e=0,f=0,f=0,f=b.getNumberValue("L_VALUE",b),f=Math.max(f,-100),f=Math.min(f,100);0f?(f=Math.round(f-155),a=-f,c=0,Entry.dplay.Left_value=a):0==f&&(c=a=0,Entry.dplay.Left_value= +0);f=b.getNumberValue("R_VALUE",b);f=Math.max(f,-100);f=Math.min(f,100);0f?(f=Math.round(f-155),d=-f,e=0,Entry.dplay.Right_value=d):0==f&&(e=d=0,Entry.dplay.Right_value=0);if(b.isStart){if(1==b.timeFlag)return Entry.hw.setDigitalPortValue(3,0),Entry.hw.setDigitalPortValue(5,0),Entry.hw.setDigitalPortValue(6,0),Entry.hw.setDigitalPortValue(11,0),b;if(2==b.timeFlag)return Entry.hw.setDigitalPortValue(3,a),Entry.hw.setDigitalPortValue(5,c), +Entry.hw.setDigitalPortValue(6,e),Entry.hw.setDigitalPortValue(11,d),delete b.isStart,delete b.timeFlag,Entry.engine.isContinue=!1,b.callReturn()}else{b.isStart=!0;b.timeFlag=1;var g=setTimeout(function(){b.timeFlag=2;Entry.dplay.removeTimeout(g)},50);Entry.dplay.timeouts.push(g);return b}}},dplay_robot_stop:{color:"#00979D",fontColor:"#FFF",skeleton:"basic",statements:[],template:"\ub85c\ubd07\uc744 \uc815\uc9c0\ud558\uae30 %1",params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}], +events:{},def:{params:[null],type:"dplay_robot_stop"},paramsKeyMap:{},"class":"dplay_robot",isNotFor:["dplay"],func:function(a,b){Entry.hw.setDigitalPortValue(3,0);Entry.hw.setDigitalPortValue(5,0);Entry.hw.setDigitalPortValue(11,0);Entry.hw.setDigitalPortValue(6,0);return b.callReturn()}},nemoino_get_number_sensor_value:{parent:"arduino_get_number_sensor_value",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_sensor_number"}],type:"nemoino_get_number_sensor_value"},"class":"arduino_value"},nemoino_get_digital_value:{parent:"arduino_get_digital_value", +isNotFor:["nemoino"],def:{params:[{type:"arduino_get_port_number"}],type:"nemoino_get_digital_value"},"class":"arduino_value"},nemoino_toggle_led:{parent:"arduino_toggle_led",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"nemoino_toggle_led"},"class":"arduino_set"},nemoino_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"nemoino_toggle_pwm"},"class":"arduino_set"}, +nemoino_convert_scale:{parent:"arduino_convert_scale",isNotFor:["nemoino"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number"}]},{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"nemoino_convert_scale"},"class":"arduino"},sensorBoard_get_number_sensor_value:{parent:"arduino_get_number_sensor_value",isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_sensor_number"}],type:"sensorBoard_get_number_sensor_value"}, +"class":"arduino_value"},sensorBoard_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_port_number"}],type:"sensorBoard_get_digital_value"},"class":"arduino_value"},sensorBoard_toggle_led:{parent:"arduino_toggle_led",isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"sensorBoard_toggle_led"},"class":"arduino_set"},sensorBoard_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_pwm_port_number"}, +{type:"arduino_text",params:["255"]},null],type:"sensorBoard_toggle_pwm"},"class":"arduino_set"},sensorBoard_convert_scale:{parent:"arduino_convert_scale",isNotFor:["sensorBoard"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number",id:"bl5e"}]},{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"sensorBoard_convert_scale"},"class":"arduino"},CODEino_get_number_sensor_value:{parent:"arduino_get_number_sensor_value", +isNotFor:["CODEino"],def:{params:[{type:"arduino_get_sensor_number"}],type:"CODEino_get_number_sensor_value"},"class":"arduino_value"},CODEino_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["CODEino"],def:{params:[{type:"arduino_get_port_number"}],type:"CODEino_get_digital_value"},"class":"arduino_value"},CODEino_toggle_led:{parent:"arduino_toggle_led",isNotFor:["CODEino"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"CODEino_toggle_led"},"class":"arduino_set"},CODEino_toggle_pwm:{parent:"arduino_toggle_pwm", +isNotFor:["CODEino"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"CODEino_toggle_pwm"},"class":"arduino_set"},CODEino_convert_scale:{parent:"arduino_convert_scale",isNotFor:["CODEino"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number"}]},{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"CODEino_convert_scale"},"class":"arduino"}, +ardublock_get_number_sensor_value:{parent:"arduino_get_number_sensor_value",isNotFor:["ardublock"],def:{params:[{type:"arduino_get_sensor_number"}],type:"ardublock_get_number_sensor_value"},"class":"arduino_value"},ardublock_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["ardublock"],def:{params:[{type:"arduino_get_port_number"}],type:"ardublock_get_digital_value"},"class":"arduino_value"},ardublock_toggle_led:{parent:"arduino_toggle_led",isNotFor:["ardublock"],def:{params:[{type:"arduino_get_port_number"}, +null,null],type:"ardublock_toggle_led"},"class":"arduino_set"},ardublock_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["ardublock"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"ardublock_toggle_pwm"},"class":"arduino_set"},ardublock_convert_scale:{parent:"arduino_convert_scale",isNotFor:["ardublock"],def:{params:[{type:"arduino_get_number_sensor_value",params:[{type:"arduino_get_sensor_number"}]},{type:"number",params:["0"]},{type:"number", +params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"ardublock_convert_scale"},"class":"arduino"},joystick_get_number_sensor_value:{parent:"arduino_get_number_sensor_value",isNotFor:["joystick"],def:{params:[{type:"arduino_get_sensor_number"}],type:"joystick_get_number_sensor_value"},"class":"arduino_value"},joystick_get_digital_value:{parent:"arduino_get_digital_value",isNotFor:["joystick"],def:{params:[{type:"arduino_get_port_number"}],type:"joystick_get_digital_value"}, +"class":"arduino_value"},joystick_toggle_led:{parent:"arduino_toggle_led",isNotFor:["joystick"],def:{params:[{type:"arduino_get_port_number"},null,null],type:"joystick_toggle_led"},"class":"arduino_set"},joystick_toggle_pwm:{parent:"arduino_toggle_pwm",isNotFor:["joystick"],def:{params:[{type:"arduino_get_pwm_port_number"},{type:"arduino_text",params:["255"]},null],type:"joystick_toggle_pwm"},"class":"arduino_set"},joystick_convert_scale:{parent:"arduino_convert_scale",isNotFor:["joystick"],def:{params:[{type:"arduino_get_number_sensor_value", +params:[{type:"arduino_get_sensor_number"}]},{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["0"]},{type:"number",params:["100"]}],type:"joystick_convert_scale"},"class":"arduino"},ebs_if:{parent:"_if",def:{type:"_if",params:[{type:"reach_something",params:[null,"wall"]}]}},ebs_if2:{parent:"_if",def:{type:"_if",params:[{type:"reach_something",params:[null,"cwz5"]}]}}}; +(function(){for(var a in Entry.block){var b=Entry.block[a];if(b.parent){var c=function(){};c.prototype=Entry.block[b.parent];var c=new c,d;for(d in b)c[d]=b[d];Entry.block[a]=c}}})();"object"==typeof exports&&(exports.block=Entry.block);Entry.BlockMenu=function(a,b,c,d){Entry.Model(this,!1);this._align=b||"CENTER";this._scroll=void 0!==d?d:!1;this._bannedClass=[];this._categories=[];this.suffix="blockMenu";a="string"===typeof a?$("#"+a):$(a);if("DIV"!==a.prop("tagName"))return console.error("Dom is not div element");this.view=a;this.visible=!0;this._svgId="blockMenu"+(new Date).getTime();this._clearCategory();this._categoryData=c;this._generateView(c);this._splitters=[];this.setWidth();this.svg=Entry.SVG(this._svgId);Entry.Utils.addFilters(this.svg, +this.suffix);b=Entry.Utils.addBlockPattern(this.svg,this.suffix);this.patternRect=b.rect;this.pattern=b.pattern;this.svgGroup=this.svg.elem("g");this.svgThreadGroup=this.svgGroup.elem("g");this.svgThreadGroup.board=this;this.svgBlockGroup=this.svgGroup.elem("g");this.svgBlockGroup.board=this;this.changeEvent=new Entry.Event(this);c&&this._generateCategoryCodes(c);this.observe(this,"_handleDragBlock",["dragBlock"]);this._scroll&&(this._scroller=new Entry.BlockMenuScroller(this),this._addControl(a)); +Entry.documentMousedown&&Entry.documentMousedown.attach(this,this.setSelectedBlock);this._categoryCodes&&Entry.keyPressed&&Entry.keyPressed.attach(this,this._captureKeyEvent);Entry.windowResized&&(a=_.debounce(this.updateOffset,200),Entry.windowResized.attach(this,a))}; +(function(a){a.schema={code:null,dragBlock:null,closeBlock:null,selectedBlockView:null};a._generateView=function(b){var a=this.view,d=this;b&&(this._categoryCol=Entry.Dom("ul",{class:"entryCategoryListWorkspace",parent:a}),this._generateCategoryView(b));this.blockMenuContainer=Entry.Dom("div",{"class":"blockMenuContainer",parent:a});this.svgDom=Entry.Dom($(''),{parent:this.blockMenuContainer});this.svgDom.mouseenter(function(b){d._scroller&& +d._scroller.setOpacity(1);b=d.workspace.selectedBlockView;!Entry.playground||Entry.playground.resizing||b&&b.dragMode===Entry.DRAG_MODE_DRAG||(Entry.playground.focusBlockMenu=!0,b=d.svgGroup.getBBox(),b=b.width+b.x+64,b>Entry.interfaceState.menuWidth&&(this.widthBackup=Entry.interfaceState.menuWidth-64,$(this).stop().animate({width:b-62},200)))});this.svgDom.mouseleave(function(b){Entry.playground&&!Entry.playground.resizing&&(d._scroller&&d._scroller.setOpacity(0),(b=this.widthBackup)&&$(this).stop().animate({width:b}, +200),delete this.widthBackup,delete Entry.playground.focusBlockMenu)});$(window).scroll(function(){d.updateOffset()})};a.changeCode=function(b){if(!(b instanceof Entry.Code))return console.error("You must inject code instance");this.codeListener&&this.code.changeEvent.detach(this.codeListener);var a=this;this.set({code:b});this.codeListener=this.code.changeEvent.attach(this,function(){a.changeEvent.notify()});b.createView(this);this.align()};a.bindCodeView=function(b){this.svgBlockGroup.remove(); +this.svgThreadGroup.remove();this.svgBlockGroup=b.svgBlockGroup;this.svgThreadGroup=b.svgThreadGroup;this.svgGroup.appendChild(this.svgThreadGroup);this.svgGroup.appendChild(this.svgBlockGroup);this._scroller&&this.svgGroup.appendChild(this._scroller.svgGroup)};a.align=function(b){var a=this.code;if(a){this._clearSplitters();a.view&&!b&&a.view.reDraw();b=a.getThreads();for(var a=10,d="LEFT"==this._align?10:this.svgDom.width()/2,e,f=0,g=b.length;fthis._bannedClass.indexOf(b)&&this._bannedClass.push(b);this.align(a)};a.unbanClass=function(b,a){b=this._bannedClass.indexOf(b);-1a&&(b.preventDefault(),this.selectMenu(a-49))};a.setPatternRectFill=function(b){this.patternRect.attr({fill:b}); +this.pattern.attr({style:""})};a.disablePattern=function(){this.pattern.attr({style:"display: none"})};a._clearCategory=function(){this._selectedCategoryView=null;this._categories=[];var b=this._categoryElems,a;for(a in b)b[a].remove();this._categoryElems={};b=this._categoryCodes;for(a in b){var d=b[a];d.constructor==Entry.Code&&d.clear()}this._categoryCodes=null};a.setCategoryData=function(b){this._clearCategory();this._categoryData=b;this._generateCategoryView(b);this._generateCategoryCodes(b)}; +a._generateCategoryView=function(b){if(b)for(var a=0;a=a?this.setVisible(!1):this.setVisible(!0)};a._reset=function(){this.vY=0;this.vScrollbar.attr({y:this.vY});this.resizeScrollBar()};a.onMouseDown=function(b){function a(b){b.stopPropagation&&b.stopPropagation();b.preventDefault&&b.preventDefault();b=b.originalEvent&&b.originalEvent.touches?b.originalEvent.touches[0]:b;var c=e.dragInstance; +e.scroll(b.pageY-c.offsetY);c.set({offsetY:b.pageY})}function d(b){$(document).unbind(".scroll");delete e.dragInstance}var e=this;b.stopPropagation&&b.stopPropagation();b.preventDefault&&b.preventDefault();if(0===b.button||b.originalEvent&&b.originalEvent.touches){Entry.documentMousedown&&Entry.documentMousedown.notify(b);var f;f=b.originalEvent&&b.originalEvent.touches?b.originalEvent.touches[0]:b;var g=$(document);g.bind("mousemove.scroll",a);g.bind("mouseup.scroll",d);g.bind("touchmove.scroll", +a);g.bind("touchend.scroll",d);e.dragInstance=new Entry.DragInstance({startY:f.pageY,offsetY:f.pageY})}b.stopPropagation()};a._addControl=function(){$(this.vScrollbar).bind("mousedown touchstart",this.mouseHandler)}})(Entry.BlockMenuScroller.prototype);Entry.BlockView=function(a,b,c){Entry.Model(this,!1);this.block=a;this._lazyUpdatePos=_.debounce(a._updatePos.bind(a),200);this._board=b;this._observers=[];this.set(a);this.svgGroup=b.svgBlockGroup.elem("g");this._schema=Entry.block[a.type];this._schema.changeEvent&&(this._schemaChangeEvent=this._schema.changeEvent.attach(this,this._updateSchema));var d=this._skeleton=Entry.skeleton[this._schema.skeleton];this._contents=[];this._statements=[];this.magnet={};this._paramMap={};d.magnets&&d.magnets(this).next&& +(this.svgGroup.nextMagnet=this.block,this._nextGroup=this.svgGroup.elem("g"),this._observers.push(this.observe(this,"_updateMagnet",["contentHeight"])));this.isInBlockMenu=this.getBoard()instanceof Entry.BlockMenu;var e=this;this.mouseHandler=function(){var b=e.block.events;b&&b.mousedown&&b.mousedown.forEach(function(b){b(e)});e.onMouseDown.apply(e,arguments)};this._startRender(a,c);this._observers.push(this.block.observe(this,"_setMovable",["movable"]));this._observers.push(this.block.observe(this, "_setReadOnly",["movable"]));this._observers.push(this.block.observe(this,"_setCopyable",["copyable"]));this._observers.push(this.block.observe(this,"_updateColor",["deletable"],!1));this._observers.push(this.observe(this,"_updateBG",["magneting"],!1));this._observers.push(this.observe(this,"_updateOpacity",["visible"],!1));this._observers.push(this.observe(this,"_updateDisplay",["display"],!1));this._observers.push(this.observe(this,"_updateShadow",["shadow"]));this._observers.push(this.observe(this, -"_updateMagnet",["offsetY"]));this._observers.push(a.code.observe(this,"_setBoard",["board"],!1));this.dragMode=Entry.DRAG_MODE_NONE;Entry.Utils.disableContextmenu(this.svgGroup.node);a=b.events.viewAdd;"workspace"==Entry.type&&a&&!this.isInBlockMenu&&a.forEach(function(a){Entry.Utils.isFunction(a)&&a(b)})};Entry.BlockView.PARAM_SPACE=5;Entry.BlockView.DRAG_RADIUS=5;Entry.BlockView.pngMap={}; -(function(b){b.schema={id:0,type:Entry.STATIC.BLOCK_RENDER_MODEL,x:0,y:0,offsetX:0,offsetY:0,width:0,height:0,contentWidth:0,contentHeight:0,magneting:!1,visible:!0,animating:!1,shadow:!0,display:!0};b._startRender=function(a,b){var d=this,e=this._skeleton;this.svgGroup.attr({class:"block"});var f=e.classes;f&&0!==f.length&&f.forEach(function(a){d.svgGroup.addClass(a)});f=e.path(this);this.pathGroup=this.svgGroup.elem("g");this._updateMagnet();this._path=this.pathGroup.elem("path");this.getBoard().patternRect&& -($(this._path).mouseenter(function(a){d._mouseEnable&&d._changeFill(!0)}),$(this._path).mouseleave(function(a){d._mouseEnable&&d._changeFill(!1)}));var g=this._schema.color;this.block.deletable===Entry.Block.DELETABLE_FALSE_LIGHTEN&&(g=Entry.Utils.colorLighten(g));this._fillColor=g;f={d:f,fill:g,class:"blockPath"};if(this.magnet.next||this._skeleton.nextShadow)g=this.getBoard().suffix,this.pathGroup.attr({filter:"url(#entryBlockShadowFilter_"+g+")"});else if(this.magnet.string||this.magnet.boolean)f.stroke= -e.outerLine;e.outerLine&&(f["stroke-width"]="0.6");this._path.attr(f);this._moveTo(this.x,this.y,!1);this._startContentRender(b);!0!==this._board.disableMouseEvent&&this._addControl();this.bindPrev()};b._startContentRender=function(a){a=void 0===a?Entry.Workspace.MODE_BOARD:a;this.contentSvgGroup&&this.contentSvgGroup.remove();var b=this._schema;b.statements&&b.statements.length&&this.statementSvgGroup&&this.statementSvgGroup.remove();this._contents=[];this.contentSvgGroup=this.svgGroup.elem("g"); -b.statements&&b.statements.length&&(this.statementSvgGroup=this.svgGroup.elem("g"));switch(a){case Entry.Workspace.MODE_BOARD:case Entry.Workspace.MODE_OVERLAYBOARD:for(var d=/(%\d)/mi,e=(b.template?b.template:Lang.template[this.block.type]).split(d),f=b.params,g=0;gEntry.BlockView.DRAG_RADIUS)e&&(clearTimeout(e),e=null),f.movable&&(f.isInBlockMenu?g.cloneToGlobal(a):(a=!1,f.dragMode!=Entry.DRAG_MODE_DRAG&&(f._toGlobalCoordinate(), -f.dragMode=Entry.DRAG_MODE_DRAG,f.block.getThread().changeEvent.notify(),Entry.GlobalSvg.setView(f,c),a=!0),this.animating&&this.set({animating:!1}),0===f.dragInstance.height&&f.dragInstance.set({height:-1+f.height}),c=f.dragInstance,f._moveBy(d.pageX-c.offsetX,d.pageY-c.offsetY,!1),c.set({offsetX:d.pageX,offsetY:d.pageY}),Entry.GlobalSvg.position(),f.originPos||(f.originPos={x:f.x,y:f.y}),a&&g.generateCodeMagnetMap(),f._updateCloseBlock()))}function d(a){e&&(clearTimeout(e),e=null);$(document).unbind(".block"); -f.terminateDrag(a);g&&g.set({dragBlock:null});f._changeFill(!1);Entry.GlobalSvg.remove();delete this.mouseDownCoordinate;delete f.dragInstance}a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();var e=null,f=this;this._changeFill(!1);var g=this.getBoard();Entry.documentMousedown&&Entry.documentMousedown.notify(a);if(!this.readOnly&&!g.viewOnly){g.setSelectedBlock(this);this.dominate();if(0===a.button||a.originalEvent&&a.originalEvent.touches){var h=a.type,k;k=a.originalEvent&& -a.originalEvent.touches?a.originalEvent.touches[0]:a;this.mouseDownCoordinate={x:k.pageX,y:k.pageY};var l=$(document);l.bind("mousemove.block touchmove.block",c);l.bind("mouseup.block touchend.block",d);this.dragInstance=new Entry.DragInstance({startX:k.pageX,startY:k.pageY,offsetX:k.pageX,offsetY:k.pageY,height:0,mode:!0});g.set({dragBlock:this});this.addDragging();this.dragMode=Entry.DRAG_MODE_MOUSEDOWN;"touchstart"===h&&(e=setTimeout(function(){e&&(e=null,d(),f._rightClick(a))},1E3))}else Entry.Utils.isRightButton(a)&& -this._rightClick(a);g.workspace.getMode()===Entry.Workspace.MODE_VIMBOARD&&a&&document.getElementsByClassName("CodeMirror")[0].dispatchEvent(Entry.Utils.createMouseEvent("dragStart",event))}};b.vimBoardEvent=function(a,b,d){a&&(a=Entry.Utils.createMouseEvent(b,a),d&&(a.block=d),document.getElementsByClassName("CodeMirror")[0].dispatchEvent(a))};b.terminateDrag=function(a){var b=this.getBoard(),d=this.dragMode,e=this.block,f=b.workspace.getMode();this.removeDragging();this.set({visible:!0});this.dragMode= -Entry.DRAG_MODE_NONE;if(f===Entry.Workspace.MODE_VIMBOARD)b instanceof Entry.BlockMenu?(b.terminateDrag(),this.vimBoardEvent(a,"dragEnd",e)):b.clear();else if(d===Entry.DRAG_MODE_DRAG){var f=this.dragInstance&&this.dragInstance.isNew,g=Entry.GlobalSvg;a=!1;var h=this.block.getPrevBlock(this.block);a=!1;switch(Entry.GlobalSvg.terminateDrag(this)){case g.DONE:g=b.magnetedBlockView;g instanceof Entry.BlockView&&(g=g.block);h&&!g?Entry.do("separateBlock",e):h||g||f?g?("next"===g.view.magneting?(h=e.getLastBlock(), -this.dragMode=d,b.separate(e),this.dragMode=Entry.DRAG_MODE_NONE,Entry.do("insertBlock",g,h).isPass(f),Entry.ConnectionRipple.setView(g.view).dispose()):(Entry.do("insertBlock",e,g).isPass(f),a=!0),createjs.Sound.play("entryMagneting")):Entry.do("moveBlock",e).isPass(f):e.getThread().view.isGlobal()?Entry.do("moveBlock",e):Entry.do("separateBlock",e);break;case g.RETURN:e=this.block;d=this.originPos;h?(this.set({animating:!1}),createjs.Sound.play("entryMagneting"),this.bindPrev(h),e.insert(h)):(f= -e.getThread().view.getParent(),f instanceof Entry.Board?this._moveTo(d.x,d.y,!1):(createjs.Sound.play("entryMagneting"),Entry.do("insertBlock",e,f)));break;case g.REMOVE:createjs.Sound.play("entryDelete"),f?this.block.destroy(!1,!0):this.block.doDestroyBelow(!1)}b.setMagnetedBlock(null);a&&Entry.ConnectionRipple.setView(e.view).dispose()}this.destroyShadow();delete this.originPos;this.dominate()};b._updateCloseBlock=function(){var a=this.getBoard(),b;if(this._skeleton.magnets){for(var d in this.magnet)if(b= -"next"===d?this.getBoard().getNearestMagnet(this.x,this.y+this.getBelowHeight(),d):this.getBoard().getNearestMagnet(this.x,this.y,d))return a.setMagnetedBlock(b.view,d);a.setMagnetedBlock(null)}};b.dominate=function(){this.block.getThread().view.dominate()};b.getSvgRoot=function(){for(var a=this.getBoard().svgBlockGroup,b=this.svgGroup;b.parentNode!==a;)b=b.parentNode;return b};b.getBoard=function(){return this._board};b._setBoard=function(){this._board=this._board.code.board};b.destroy=function(a){$(this.svgGroup).unbind(".blockViewMousedown"); -this._destroyObservers();var b=this.svgGroup;a?$(b).fadeOut(100,function(){b.remove()}):b.remove();this._contents.forEach(function(a){a.constructor!==Entry.Block&&a.destroy()});var d=this.block;a=d.events.viewDestroy;"workspace"==Entry.type&&a&&!this.isInBlockMenu&&a.forEach(function(a){Entry.Utils.isFunction(a)&&a(d)});this._schemaChangeEvent&&this._schemaChangeEvent.destroy()};b.getShadow=function(){this._shadow||(this._shadow=Entry.SVG.createElement(this.svgGroup.cloneNode(!0),{opacity:.5}),this.getBoard().svgGroup.appendChild(this._shadow)); -return this._shadow};b.destroyShadow=function(){this._shadow&&(this._shadow.remove(),delete this._shadow)};b._updateMagnet=function(){if(this._skeleton.magnets){var a=this._skeleton.magnets(this);a.next&&this._nextGroup.attr("transform","translate("+a.next.x+","+a.next.y+")");this.magnet=a;this.block.getThread().changeEvent.notify()}};b._updateBG=function(){if(this._board.dragBlock&&this._board.dragBlock.dragInstance){var a=this.svgGroup;if(this.magnet.next){if(a=this.magneting){var b=this._board.dragBlock.getShadow(), -d=this.getAbsoluteCoordinate(),e;if("previous"===a)e=this.magnet.next,e="translate("+(d.x+e.x)+","+(d.y+e.y)+")";else if("next"===a){e=this.magnet.previous;var f=this._board.dragBlock.getBelowHeight();e="translate("+(d.x+e.x)+","+(d.y+e.y-f)+")"}$(b).attr({transform:e,display:"block"});this._clonedShadow=b;this.background&&(this.background.remove(),this.nextBackground.remove(),delete this.background,delete this.nextBackground);"previous"===a&&(a=this._board.dragBlock.getBelowHeight()+this.offsetY, -this.originalHeight=this.offsetY,this.set({offsetY:a}))}else this._clonedShadow&&(this._clonedShadow.attr({display:"none"}),delete this._clonedShadow),a=this.originalHeight,void 0!==a&&(this.background&&(this.background.remove(),this.nextBackground.remove(),delete this.background,delete this.nextBackground),this.set({offsetY:a}),delete this.originalHeight);(a=this.block.thread.changeEvent)&&a.notify()}else this.magneting?(a.attr({filter:"url(#entryBlockHighlightFilter_"+this.getBoard().suffix+")"}), -a.addClass("outputHighlight")):(a.removeClass("outputHighlight"),a.removeAttr("filter"))}};b.addDragging=function(){this.svgGroup.addClass("dragging")};b.removeDragging=function(){this.svgGroup.removeClass("dragging")};b.addSelected=function(){this.svgGroup.addClass("selected")};b.removeSelected=function(){this.svgGroup.removeClass("selected")};b.getSkeleton=function(){return this._skeleton};b.getContentPos=function(){return this._skeleton.contentPos(this)};b.renderText=function(){this._startContentRender(Entry.Workspace.MODE_VIMBOARD)}; -b.renderBlock=function(){this._startContentRender(Entry.Workspace.MODE_BOARD)};b._updateOpacity=function(){this.svgGroup.attr({opacity:!1===this.visible?0:1});this.visible&&this._setPosition()};b._updateShadow=function(){this.shadow&&Entry.Utils.colorDarken(this._schema.color,.7)};b._setMovable=function(){this.movable=null!==this.block.isMovable()?this.block.isMovable():void 0!==this._skeleton.movable?this._skeleton.movable:!0};b._setReadOnly=function(){this.readOnly=null!==this.block.isReadOnly()? -this.block.isReadOnly():void 0!==this._skeleton.readOnly?this._skeleton.readOnly:!1};b._setCopyable=function(){this.copyable=null!==this.block.isCopyable()?this.block.isCopyable():void 0!==this._skeleton.copyable?this._skeleton.copyable:!0};b.bumpAway=function(a,b){var d=this;a=a||15;b?window.setTimeout(function(){d._moveBy(a,a,!1)},b):d._moveBy(a,a,!1)};b.bindPrev=function(a){if(a){if(this._toLocalCoordinate(a.view._nextGroup),(a=a.getNextBlock())&&a!==this.block){var b=this.block.getLastBlock(); -b.view.magnet.next?a.view._toLocalCoordinate(b.view._nextGroup):(a.view._toGlobalCoordinate(),a.separate(),a.view.bumpAway(null,100))}}else if(a=this.block.getPrevBlock())this._toLocalCoordinate(a.view._nextGroup),(a=this.block.getNextBlock())&&a.view&&a.view._toLocalCoordinate(this._nextGroup)};b.getAbsoluteCoordinate=function(a){a=void 0!==a?a:this.dragMode;if(a===Entry.DRAG_MODE_DRAG)return{x:this.x,y:this.y};a=this.block.getThread().view.requestAbsoluteCoordinate(this);a.x+=this.x;a.y+=this.y; -return a};b.getBelowHeight=function(){return this.block.getThread().view.requestPartHeight(this)};b._updateDisplay=function(){this.svgGroup.attr({display:!1===this.display?"none":"block"});this.display&&this._setPosition()};b._updateColor=function(){var a=this._schema.color;this.block.deletable===Entry.Block.DELETABLE_FALSE_LIGHTEN&&(a=Entry.Utils.colorLighten(a));this._fillColor=a;this._path.attr({fill:a});this._updateContents()};b._updateContents=function(){for(var a=0;a\s+/g, -">").replace(/\s+(svgGroup)(defs)',h=this.svgGroup.getBoundingClientRect(),k=a?this.svgGroup:this.svgGroup.cloneNode(!0), -l=this._skeleton.box(this),n=b?1:1.5,m=function(){var a=window.platform;return a&&"windows"===a.name.toLowerCase()&&"7"===a.version[0]?!0:!1}()?.9:.95;-1<=+-x/".split(""),v=0;ve||d.splice(e,1)}};b.raiseEvent=function(a,b,d){a=this._eventMap[a];var e=[];if(void 0!==a){for(var f=0;fe||d.splice(e,1)};b.doDestroyThread=function(a,b){var d=this._data,e=d.indexOf(a);0>e||d.splice(e,1)};b.getThreads=function(){return this._data.map(function(a){return a})};b.toJSON=function(){for(var a= -this.getThreads(),b=[],d=0,e=a.length;db&&(d+="...");return d};b.appendSvgOptionGroup=function(){return this._block.view.getBoard().svgGroup.elem("g")};b.getValue=function(){return this._block.params[this._index]};b.setValue=function(a,b){this.value!=a&&(this.value=a,this._block.params[this._index]=a,b&&this._blockView.reDraw())};b._isEditable=function(){if(Entry.ContextMenu.visible||this._block.view.dragMode==Entry.DRAG_MODE_DRAG)return!1; -var a=this._block.view,b=a.getBoard();if(!0===b.disableMouseEvent)return!1;var d=b.workspace.selectedBlockView;if(!d||b!=d.getBoard())return!1;b=a.getSvgRoot();return b==d.svgGroup||$(b).has($(a.svgGroup))};b._selectBlockView=function(){var a=this._block.view;a.getBoard().setSelectedBlock(a)};b._bindRenderOptions=function(){var a=this;$(this.svgGroup).bind("mouseup touchend",function(b){a._isEditable()&&(a.destroyOption(),a._startValue=a.getValue(),a.renderOptions())})};b.pointer=function(a){a=a|| -[];a.unshift(this._index);a.unshift(Entry.PARAM);return this._block.pointer(a)};b.getFontSize=function(a){return a=a||this._blockView.getSkeleton().fontSize||12};b.getContentHeight=function(){return Entry.isMobile()?22:16}})(Entry.Field.prototype);Entry.FieldAngle=function(b,a,c){this._block=a.block;this._blockView=a;this.box=new Entry.BoxModel;this.svgGroup=null;this.position=b.position;this._contents=b;this._index=c;b=this.getValue();this.setValue(this.modValue(void 0!==b?b:90));this._CONTENT_HEIGHT=this.getContentHeight();this.renderStart()};Entry.Utils.inherit(Entry.Field,Entry.FieldAngle); -(function(b){b.renderStart=function(){this.svgGroup&&$(this.svgGroup).remove();this.svgGroup=this._blockView.contentSvgGroup.elem("g",{class:"entry-input-field"});this.textElement=this.svgGroup.elem("text",{x:4,y:4,"font-size":"11px"});this.textElement.textContent=this.getText();var a=this.getTextWidth(),b=this._CONTENT_HEIGHT,d=this.position&&this.position.y?this.position.y:0;this._header=this.svgGroup.elem("rect",{x:0,y:d-b/2,rx:3,ry:3,width:a,height:b,rx:3,ry:3,fill:"#fff","fill-opacity":.4}); -this.svgGroup.appendChild(this.textElement);this._bindRenderOptions();this.box.set({x:0,y:0,width:a,height:b})};b.renderOptions=function(){var a=this;this._attachDisposeEvent(function(){a.applyValue();a.destroyOption()});this.optionGroup=Entry.Dom("input",{class:"entry-widget-input-field",parent:$("body")});this.optionGroup.val(this.value);this.optionGroup.on("mousedown touchstart",function(a){a.stopPropagation()});this.optionGroup.on("keyup",function(b){var c=b.keyCode||b.which;a.applyValue(b);-1< -[13,27].indexOf(c)&&a.destroyOption()});var b=this.getAbsolutePosFromDocument();b.y-=this.box.height/2;this.optionGroup.css({height:this._CONTENT_HEIGHT,left:b.x,top:b.y,width:a.box.width});this.svgOptionGroup=this.appendSvgOptionGroup();this.svgOptionGroup.elem("circle",{x:0,y:0,r:49,class:"entry-field-angle-circle"});$(this.svgOptionGroup).on("mousedown touchstart",function(b){b.stopPropagation();a._updateByCoord(b)});this._dividerGroup=this.svgOptionGroup.elem("g");for(b=0;360>b;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+")"});$(this.svgOptionGroup).bind("mousemove touchmove",this._updateByCoord.bind(this));$(this.svgOptionGroup).bind("mouseup touchend",this.destroyOption.bind(this));this.updateGraph();this.optionGroup.focus();this.optionGroup.select()}; -b._updateByCoord=function(a){a.originalEvent&&a.originalEvent.touches&&(a=a.originalEvent.touches[0]);a=[a.clientX,a.clientY];var b=this.getAbsolutePosFromDocument();this.optionGroup.val(this.modValue(function(a,b){var c=b[0]-a[0],g=b[1]-a[1]-49-1,h=Math.atan(-g/c),h=Entry.toDegrees(h),h=90-h;0>c?h+=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||(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)}; +"_updateMagnet",["offsetY"]));this._observers.push(b.code.observe(this,"_setBoard",["board"],!1));this.dragMode=Entry.DRAG_MODE_NONE;Entry.Utils.disableContextmenu(this.svgGroup.node);b=a.events.viewAdd;"workspace"==Entry.type&&b&&!this.isInBlockMenu&&b.forEach(function(b){Entry.Utils.isFunction(b)&&b(a)})};Entry.BlockView.PARAM_SPACE=5;Entry.BlockView.DRAG_RADIUS=5;Entry.BlockView.pngMap={}; +(function(a){a.schema={id:0,type:Entry.STATIC.BLOCK_RENDER_MODEL,x:0,y:0,offsetX:0,offsetY:0,width:0,height:0,contentWidth:0,contentHeight:0,magneting:!1,visible:!0,animating:!1,shadow:!0,display:!0};a._startRender=function(b,a){var d=this;b=this._skeleton;this.svgGroup.attr({class:"block"});var e=b.classes;e&&0!==e.length&&e.forEach(function(b){d.svgGroup.addClass(b)});e=b.path(this);this.pathGroup=this.svgGroup.elem("g");this._updateMagnet();this._path=this.pathGroup.elem("path");this.getBoard().patternRect&& +($(this._path).mouseenter(function(b){d._mouseEnable&&d._changeFill(!0)}),$(this._path).mouseleave(function(b){d._mouseEnable&&d._changeFill(!1)}));var f=this._schema.color;this.block.deletable===Entry.Block.DELETABLE_FALSE_LIGHTEN&&(f=Entry.Utils.colorLighten(f));this._fillColor=f;e={d:e,fill:f,class:"blockPath"};if(this.magnet.next||this._skeleton.nextShadow)f=this.getBoard().suffix,this.pathGroup.attr({filter:"url(#entryBlockShadowFilter_"+f+")"});else if(this.magnet.string||this.magnet.boolean)e.stroke= +b.outerLine;b.outerLine&&(e["stroke-width"]="0.6");this._path.attr(e);this._moveTo(this.x,this.y,!1);this._startContentRender(a);!0!==this._board.disableMouseEvent&&this._addControl();this.bindPrev()};a._startContentRender=function(b){b=void 0===b?Entry.Workspace.MODE_BOARD:b;this.contentSvgGroup&&this.contentSvgGroup.remove();var a=this._schema;a.statements&&a.statements.length&&this.statementSvgGroup&&this.statementSvgGroup.remove();this._contents=[];this.contentSvgGroup=this.svgGroup.elem("g"); +a.statements&&a.statements.length&&(this.statementSvgGroup=this.svgGroup.elem("g"));switch(b){case Entry.Workspace.MODE_BOARD:case Entry.Workspace.MODE_OVERLAYBOARD:for(var d=/(%\d)/mi,e=(a.template?a.template:Lang.template[this.block.type]).split(d),f=a.params,g=0;gEntry.BlockView.DRAG_RADIUS)e&&(clearTimeout(e),e=null),f.movable&&(f.isInBlockMenu?g.cloneToGlobal(b):(b=!1,f.dragMode!=Entry.DRAG_MODE_DRAG&&(f._toGlobalCoordinate(), +f.dragMode=Entry.DRAG_MODE_DRAG,f.block.getThread().changeEvent.notify(),Entry.GlobalSvg.setView(f,c),b=!0),this.animating&&this.set({animating:!1}),0===f.dragInstance.height&&f.dragInstance.set({height:-1+f.height}),c=f.dragInstance,f._moveBy(d.pageX-c.offsetX,d.pageY-c.offsetY,!1),c.set({offsetX:d.pageX,offsetY:d.pageY}),Entry.GlobalSvg.position(),f.originPos||(f.originPos={x:f.x,y:f.y}),b&&g.generateCodeMagnetMap(),f._updateCloseBlock()))}function d(b){e&&(clearTimeout(e),e=null);$(document).unbind(".block"); +f.terminateDrag(b);g&&g.set({dragBlock:null});f._changeFill(!1);Entry.GlobalSvg.remove();delete this.mouseDownCoordinate;delete f.dragInstance}b.stopPropagation&&b.stopPropagation();b.preventDefault&&b.preventDefault();var e=null,f=this;this._changeFill(!1);var g=this.getBoard();Entry.documentMousedown&&Entry.documentMousedown.notify(b);if(!this.readOnly&&!g.viewOnly){g.setSelectedBlock(this);this.dominate();if(0===b.button||b.originalEvent&&b.originalEvent.touches){var h=b.type,k;k=b.originalEvent&& +b.originalEvent.touches?b.originalEvent.touches[0]:b;this.mouseDownCoordinate={x:k.pageX,y:k.pageY};var l=$(document);l.bind("mousemove.block touchmove.block",c);l.bind("mouseup.block touchend.block",d);this.dragInstance=new Entry.DragInstance({startX:k.pageX,startY:k.pageY,offsetX:k.pageX,offsetY:k.pageY,height:0,mode:!0});g.set({dragBlock:this});this.addDragging();this.dragMode=Entry.DRAG_MODE_MOUSEDOWN;"touchstart"===h&&(e=setTimeout(function(){e&&(e=null,d(),f._rightClick(b))},1E3))}else Entry.Utils.isRightButton(b)&& +this._rightClick(b);g.workspace.getMode()===Entry.Workspace.MODE_VIMBOARD&&b&&document.getElementsByClassName("CodeMirror")[0].dispatchEvent(Entry.Utils.createMouseEvent("dragStart",event))}};a.vimBoardEvent=function(b,a,d){b&&(b=Entry.Utils.createMouseEvent(a,b),d&&(b.block=d),document.getElementsByClassName("CodeMirror")[0].dispatchEvent(b))};a.terminateDrag=function(b){var a=this.getBoard(),d=this.dragMode,e=this.block,f=a.workspace.getMode();this.removeDragging();this.set({visible:!0});this.dragMode= +Entry.DRAG_MODE_NONE;if(f===Entry.Workspace.MODE_VIMBOARD)a instanceof Entry.BlockMenu?(a.terminateDrag(),this.vimBoardEvent(b,"dragEnd",e)):a.clear();else if(d===Entry.DRAG_MODE_DRAG){var f=this.dragInstance&&this.dragInstance.isNew,g=Entry.GlobalSvg,h=this.block.getPrevBlock(this.block);b=!1;switch(Entry.GlobalSvg.terminateDrag(this)){case g.DONE:g=a.magnetedBlockView;g instanceof Entry.BlockView&&(g=g.block);h&&!g?Entry.do("separateBlock",e):h||g||f?g?("next"===g.view.magneting?(h=e.getLastBlock(), +this.dragMode=d,a.separate(e),this.dragMode=Entry.DRAG_MODE_NONE,Entry.do("insertBlock",g,h).isPass(f),Entry.ConnectionRipple.setView(g.view).dispose()):(Entry.do("insertBlock",e,g).isPass(f),b=!0),createjs.Sound.play("entryMagneting")):Entry.do("moveBlock",e).isPass(f):e.getThread().view.isGlobal()?Entry.do("moveBlock",e):Entry.do("separateBlock",e);break;case g.RETURN:e=this.block;d=this.originPos;h?(this.set({animating:!1}),createjs.Sound.play("entryMagneting"),this.bindPrev(h),e.insert(h)):(f= +e.getThread().view.getParent(),f instanceof Entry.Board?this._moveTo(d.x,d.y,!1):(createjs.Sound.play("entryMagneting"),Entry.do("insertBlock",e,f)));break;case g.REMOVE:createjs.Sound.play("entryDelete"),f?this.block.destroy(!1,!0):this.block.doDestroyBelow(!1)}a.setMagnetedBlock(null);b&&Entry.ConnectionRipple.setView(e.view).dispose()}this.destroyShadow();delete this.originPos;this.dominate()};a._updateCloseBlock=function(){var b=this.getBoard(),a;if(this._skeleton.magnets){for(var d in this.magnet)if(a= +"next"===d?this.getBoard().getNearestMagnet(this.x,this.y+this.getBelowHeight(),d):this.getBoard().getNearestMagnet(this.x,this.y,d))return b.setMagnetedBlock(a.view,d);b.setMagnetedBlock(null)}};a.dominate=function(){this.block.getThread().view.dominate()};a.getSvgRoot=function(){for(var b=this.getBoard().svgBlockGroup,a=this.svgGroup;a.parentNode!==b;)a=a.parentNode;return a};a.getBoard=function(){return this._board};a._setBoard=function(){this._board=this._board.code.board};a.destroy=function(b){$(this.svgGroup).unbind(".blockViewMousedown"); +this._destroyObservers();var a=this.svgGroup;b?$(a).fadeOut(100,function(){a.remove()}):a.remove();this._contents.forEach(function(b){b.constructor!==Entry.Block&&b.destroy()});var d=this.block;b=d.events.viewDestroy;"workspace"==Entry.type&&b&&!this.isInBlockMenu&&b.forEach(function(b){Entry.Utils.isFunction(b)&&b(d)});this._schemaChangeEvent&&this._schemaChangeEvent.destroy()};a.getShadow=function(){this._shadow||(this._shadow=Entry.SVG.createElement(this.svgGroup.cloneNode(!0),{opacity:.5}),this.getBoard().svgGroup.appendChild(this._shadow)); +return this._shadow};a.destroyShadow=function(){this._shadow&&(this._shadow.remove(),delete this._shadow)};a._updateMagnet=function(){if(this._skeleton.magnets){var b=this._skeleton.magnets(this);b.next&&this._nextGroup.attr("transform","translate("+b.next.x+","+b.next.y+")");this.magnet=b;this.block.getThread().changeEvent.notify()}};a._updateBG=function(){if(this._board.dragBlock&&this._board.dragBlock.dragInstance){var b=this.svgGroup;if(this.magnet.next){if(b=this.magneting){var a=this._board.dragBlock.getShadow(), +d=this.getAbsoluteCoordinate(),e;if("previous"===b)e=this.magnet.next,e="translate("+(d.x+e.x)+","+(d.y+e.y)+")";else if("next"===b){e=this.magnet.previous;var f=this._board.dragBlock.getBelowHeight();e="translate("+(d.x+e.x)+","+(d.y+e.y-f)+")"}$(a).attr({transform:e,display:"block"});this._clonedShadow=a;this.background&&(this.background.remove(),this.nextBackground.remove(),delete this.background,delete this.nextBackground);"previous"===b&&(b=this._board.dragBlock.getBelowHeight()+this.offsetY, +this.originalHeight=this.offsetY,this.set({offsetY:b}))}else this._clonedShadow&&(this._clonedShadow.attr({display:"none"}),delete this._clonedShadow),b=this.originalHeight,void 0!==b&&(this.background&&(this.background.remove(),this.nextBackground.remove(),delete this.background,delete this.nextBackground),this.set({offsetY:b}),delete this.originalHeight);(b=this.block.thread.changeEvent)&&b.notify()}else this.magneting?(b.attr({filter:"url(#entryBlockHighlightFilter_"+this.getBoard().suffix+")"}), +b.addClass("outputHighlight")):(b.removeClass("outputHighlight"),b.removeAttr("filter"))}};a.addDragging=function(){this.svgGroup.addClass("dragging")};a.removeDragging=function(){this.svgGroup.removeClass("dragging")};a.addSelected=function(){this.svgGroup.addClass("selected")};a.removeSelected=function(){this.svgGroup.removeClass("selected")};a.getSkeleton=function(){return this._skeleton};a.getContentPos=function(){return this._skeleton.contentPos(this)};a.renderText=function(){this._startContentRender(Entry.Workspace.MODE_VIMBOARD)}; +a.renderBlock=function(){this._startContentRender(Entry.Workspace.MODE_BOARD)};a._updateOpacity=function(){this.svgGroup.attr({opacity:!1===this.visible?0:1});this.visible&&this._setPosition()};a._updateShadow=function(){this.shadow&&Entry.Utils.colorDarken(this._schema.color,.7)};a._setMovable=function(){this.movable=null!==this.block.isMovable()?this.block.isMovable():void 0!==this._skeleton.movable?this._skeleton.movable:!0};a._setReadOnly=function(){this.readOnly=null!==this.block.isReadOnly()? +this.block.isReadOnly():void 0!==this._skeleton.readOnly?this._skeleton.readOnly:!1};a._setCopyable=function(){this.copyable=null!==this.block.isCopyable()?this.block.isCopyable():void 0!==this._skeleton.copyable?this._skeleton.copyable:!0};a.bumpAway=function(b,a){var d=this;b=b||15;a?window.setTimeout(function(){d._moveBy(b,b,!1)},a):d._moveBy(b,b,!1)};a.bindPrev=function(b){if(b){if(this._toLocalCoordinate(b.view._nextGroup),(b=b.getNextBlock())&&b!==this.block){var a=this.block.getLastBlock(); +a.view.magnet.next?b.view._toLocalCoordinate(a.view._nextGroup):(b.view._toGlobalCoordinate(),b.separate(),b.view.bumpAway(null,100))}}else if(b=this.block.getPrevBlock())this._toLocalCoordinate(b.view._nextGroup),(b=this.block.getNextBlock())&&b.view&&b.view._toLocalCoordinate(this._nextGroup)};a.getAbsoluteCoordinate=function(b){b=void 0!==b?b:this.dragMode;if(b===Entry.DRAG_MODE_DRAG)return{x:this.x,y:this.y};b=this.block.getThread().view.requestAbsoluteCoordinate(this);b.x+=this.x;b.y+=this.y; +return b};a.getBelowHeight=function(){return this.block.getThread().view.requestPartHeight(this)};a._updateDisplay=function(){this.svgGroup.attr({display:!1===this.display?"none":"block"});this.display&&this._setPosition()};a._updateColor=function(){var b=this._schema.color;this.block.deletable===Entry.Block.DELETABLE_FALSE_LIGHTEN&&(b=Entry.Utils.colorLighten(b));this._fillColor=b;this._path.attr({fill:b});this._updateContents()};a._updateContents=function(){for(var b=0;b\s+/g, +">").replace(/\s+(svgGroup)(defs)',h=this.svgGroup.getBoundingClientRect(),k=b?this.svgGroup:this.svgGroup.cloneNode(!0); +b=this._skeleton.box(this);var l=a?1:1.5,n=function(){var b=window.platform;return b&&"windows"===b.name.toLowerCase()&&"7"===b.version[0]?!0:!1}()?.9:.95;-1<=+-x/".split(""),t= +0;ta&&(d+="...");return d};a.appendSvgOptionGroup=function(){return this._block.view.getBoard().svgGroup.elem("g")};a.getValue=function(){return this._block.params[this._index]};a.setValue=function(b,a){this.value!=b&&(this.value=b,this._block.params[this._index]=b,a&&this._blockView.reDraw())};a._isEditable=function(){if(Entry.ContextMenu.visible||this._block.view.dragMode==Entry.DRAG_MODE_DRAG)return!1; +var b=this._block.view,a=b.getBoard();if(!0===a.disableMouseEvent)return!1;var d=a.workspace.selectedBlockView;if(!d||a!=d.getBoard())return!1;a=b.getSvgRoot();return a==d.svgGroup||$(a).has($(b.svgGroup))};a._selectBlockView=function(){var b=this._block.view;b.getBoard().setSelectedBlock(b)};a._bindRenderOptions=function(){var b=this;$(this.svgGroup).bind("mouseup touchend",function(a){b._isEditable()&&(b.destroyOption(),b._startValue=b.getValue(),b.renderOptions())})};a.pointer=function(b){b=b|| +[];b.unshift(this._index);b.unshift(Entry.PARAM);return this._block.pointer(b)};a.getFontSize=function(b){return b=b||this._blockView.getSkeleton().fontSize||12};a.getContentHeight=function(){return Entry.isMobile()?22:16}})(Entry.Field.prototype);Entry.FieldBlock=function(a,b,c,d,e){Entry.Model(this,!1);this._blockView=b;this._block=b.block;this._valueBlock=null;this.box=new Entry.BoxModel;this.changeEvent=new Entry.Event(this);this._index=c;this.contentIndex=e;this._content=a;this.acceptType=a.accept;this._restoreCurrent=a.restore;this.view=this;this.svgGroup=null;this._position=a.position;this.box.observe(b,"alignContent",["width","height"]);this.observe(this,"_updateBG",["magneting"],!1);this.renderStart(b.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, -delete this._originBlock;else switch(this.acceptType){case "boolean":a="True";break;case "string":a="text";break;case "param":a="function_field_label"}return this._createBlockByType(a)};b._setValueBlock=function(a){this._restoreCurrent&&(this._originBlock=this._valueBlock);a||(a=this.inspectBlock());this._valueBlock=a;this.setValue(a);a.setThread(this);a.getThread().view.setParent(this);return this._valueBlock};b.getValueBlock=function(){return this._valueBlock};b.updateValueBlock=function(a){a instanceof -Entry.Block||(a=void 0);this._destroyObservers();a=this._setValueBlock(a).view;a.bindPrev(this);this._blockView.alignContent();this._posObserver=a.observe(this,"updateValueBlock",["x","y"],!1);this._sizeObserver=a.observe(this,"calcWH",["width","height"]);a=this._blockView.getBoard();a.constructor===Entry.Board&&a.generateCodeMagnetMap()};b._destroyObservers=function(){this._sizeObserver&&this._sizeObserver.destroy();this._posObserver&&this._posObserver.destroy()};b.getPrevBlock=function(a){return this._valueBlock=== -a?this:null};b.getNextBlock=function(){return null};b.requestAbsoluteCoordinate=function(a){a=this._blockView;var b=a.contentPos;a=a.getAbsoluteCoordinate();a.x+=this.box.x+b.x;a.y+=this.box.y+b.y;return a};b.dominate=function(){this._blockView.dominate()};b.isGlobal=function(){return!1};b.separate=function(a){this.getCode().createThread([a]);this.calcWH();this.changeEvent.notify()};b.getCode=function(){return this._block.thread.getCode()};b.cut=function(a){return this._valueBlock===a?[a]:null};b.replace= -function(a){"string"===typeof a&&(a=this._createBlockByType(a));var b=this._valueBlock;Entry.block[b.type].isPrimitive?(b.doNotSplice=!0,b.destroy()):"param"===this.acceptType?(this._destroyObservers(),b.view._toGlobalCoordinate(),a.getTerminateOutputBlock().view._contents[1].replace(b)):(this._destroyObservers(),b.view._toGlobalCoordinate(),this.separate(b),b.view.bumpAway(30,150));this.updateValueBlock(a);a.view._toLocalCoordinate(this.svgGroup);this.calcWH();this.changeEvent.notify()};b.setParent= -function(a){this._parent=a};b.getParent=function(){return this._parent};b._createBlockByType=function(a){this._block.getThread();var b=this._blockView.getBoard();a=new Entry.Block({type:a},this);var d=b.workspace,e;d&&(e=d.getMode());a.createView(b,e);return a};b.spliceBlock=function(){this.updateValueBlock()};b._updateBG=function(){this.magneting?this._bg=this.svgGroup.elem("path",{d:"m 8,12 l -4,0 -2,-2 0,-3 3,0 1,-1 0,-12 -1,-1 -3,0 0,-3 2,-2 l 4,0 z",fill:"#fff",stroke:"#fff","fill-opacity":.7, -transform:"translate(0,12)"}):this._bg&&(this._bg.remove(),delete this._bg)};b.getThread=function(){return this};b.pointer=function(a){a.unshift(this._index);a.unshift(Entry.PARAM);return this._block.pointer(a)}})(Entry.FieldBlock.prototype);Entry.FieldColor=function(b,a,c){this._block=a.block;this._blockView=a;this.box=new Entry.BoxModel;this.svgGroup=null;this._contents=b;this._index=c;this._position=b.position;this.key=b.key;this.setValue(this.getValue()||"#FF0000");this._CONTENT_HEIGHT=this.getContentHeight();this._CONTENT_WIDTH=this.getContentWidth();this.renderStart(a)};Entry.Utils.inherit(Entry.Field,Entry.FieldColor); -(function(b){b.renderStart=function(){this.svgGroup&&$(this.svgGroup).remove();this.svgGroup=this._blockView.contentSvgGroup.elem("g",{class:"entry-field-color"});var a=this._CONTENT_HEIGHT,b=this._CONTENT_WIDTH,d=this._position,e;d?(e=d.x||0,d=d.y||0):(e=0,d=-a/2);this._header=this.svgGroup.elem("rect",{x:e,y:d,width:b,height:a,fill:this.getValue()});this._bindRenderOptions();this.box.set({x:e,y:d,width:b,height:a})};b.renderOptions=function(){var a=this;this._attachDisposeEvent();var b=Entry.FieldColor.getWidgetColorList(); -this.optionGroup=Entry.Dom("table",{class:"entry-widget-color-table",parent:$("body")});for(var d=0;d'), +{parent:this.wrapper});this.visible=!0;var d=this;this.svg=Entry.SVG(this._svgId);$(window).scroll(function(){d.updateOffset()});this.svgGroup=this.svg.elem("g");this.svgThreadGroup=this.svgGroup.elem("g");this.svgThreadGroup.board=this;this.svgBlockGroup=this.svgGroup.elem("g");this.svgBlockGroup.board=this;b.isOverlay?(this.wrapper.addClass("entryOverlayBoard"),this.generateButtons(),this.suffix="overlayBoard"):this.suffix="board";Entry.Utils.addFilters(this.svg,this.suffix);b=Entry.Utils.addBlockPattern(this.svg, +this.suffix);this.patternRect=b.rect;this.pattern=b.pattern};a.changeCode=function(b){this.code&&this.codeListener&&this.code.changeEvent.detach(this.codeListener);this.set({code:b});var a=this;b&&(this.codeListener=this.code.changeEvent.attach(this,function(){a.changeEvent.notify()}),b.createView(this));this.scroller.resizeScrollBar()};a.bindCodeView=function(b){this.svgBlockGroup.remove();this.svgThreadGroup.remove();this.svgBlockGroup=b.svgBlockGroup;this.svgThreadGroup=b.svgThreadGroup;this.svgGroup.appendChild(this.svgThreadGroup); +this.svgGroup.appendChild(this.svgBlockGroup)};a.setMagnetedBlock=function(b,a){if(this.magnetedBlockView){if(this.magnetedBlockView===b)return;this.magnetedBlockView.set({magneting:!1})}this.set({magnetedBlockView:b});b&&(b.set({magneting:a}),b.dominate())};a.getCode=function(){return this.code};a.findById=function(b){return this.code.findById(b)};a._addControl=function(){var b=this.svgDom,a=this;b.mousedown(function(){a.onMouseDown.apply(a,arguments)});b.bind("touchstart",function(){a.onMouseDown.apply(a, +arguments)});b.on("wheel",function(){a.mouseWheel.apply(a,arguments)});var d=a.scroller;d&&(b.mouseenter(function(b){d.setOpacity(1)}),b.mouseleave(function(b){d.setOpacity(0)}))};a.onMouseDown=function(b){function a(b){b.stopPropagation&&b.stopPropagation();b.preventDefault&&b.preventDefault();b=Entry.Utils.convertMouseEvent(b);var c=e.mouseDownCoordinate;Math.sqrt(Math.pow(b.pageX-c.x,2)+Math.pow(b.pageY-c.y,2))b&&(f=f+e+10,e=0,d=15);e=Math.max(e,k.width);l=d+15;h._moveTo(f,l,!1);d=d+k.height+15}}this.scroller.resizeScrollBar()};a.clear=function(){this.svgBlockGroup.remove();this.svgThreadGroup.remove()};a.updateOffset= +function(){this._offset=this.svg.getBoundingClientRect();var b=$(window),a=b.scrollTop(),b=b.scrollLeft(),d=this._offset;this.relativeOffset={top:d.top-a,left:d.left-b};this.btnWrapper&&this.btnWrapper.attr({transform:"translate("+(d.width/2-65)+","+(d.height-200)+")"})};a.generateButtons=function(){var b=this,a=this.svgGroup.elem("g");this.btnWrapper=a;var d=a.elem("text",{x:27,y:33,class:"entryFunctionButtonText"});d.textContent=Lang.Buttons.save;var e=a.elem("text",{x:102.5,y:33,class:"entryFunctionButtonText"}); +e.textContent=Lang.Buttons.cancel;var f=a.elem("circle",{cx:27.5,cy:27.5,r:27.5,class:"entryFunctionButton"}),a=a.elem("circle",{cx:102.5,cy:27.5,r:27.5,class:"entryFunctionButton"});$(f).bind("mousedown touchstart",function(){b.save()});$(d).bind("mousedown touchstart",function(){b.save()});$(a).bind("mousedown touchstart",function(){b.cancelEdit()});$(e).bind("mousedown touchstart",function(){b.cancelEdit()})};a.cancelEdit=function(){this.workspace.setMode(Entry.Workspace.MODE_BOARD,"cancelEdit")}; +a.save=function(){this.workspace.setMode(Entry.Workspace.MODE_BOARD,"save")};a.generateCodeMagnetMap=function(){var b=this.code;if(b&&this.dragBlock)for(var a in this.dragBlock.magnet){var d=this._getCodeBlocks(b,a);d.sort(function(b,a){return b.point-a.point});d.unshift({point:-Number.MAX_VALUE,blocks:[]});for(var e=1;eg.point&&(g.blocks.push(h),l++,g=d[l],g););delete f.startBlock}f.endPoint=Number.MAX_VALUE;d[e-1].endPoint= +f.point}this._magnetMap[a]=d}};a._getCodeBlocks=function(b,a){b=b.getThreads();var d=[],e;switch(a){case "previous":e=this._getNextMagnets;break;case "next":e=this._getPreviousMagnets;break;case "string":e=this._getFieldMagnets;break;case "boolean":e=this._getFieldMagnets;break;case "param":e=this._getOutputMagnets;break;default:return[]}for(var f=0;fd.endPoint)f=h+1;else{e=d.blocks;for(f=0;fb||a.splice(b,1))};a.raiseEvent=function(b,a,d){b=this._eventMap[b];var e=[];if(void 0!==b){for(var f=0;fb||a.splice(b,1)};a.doDestroyThread=function(b,a){a=this._data;b=a.indexOf(b);0>b||a.splice(b,1)};a.getThreads=function(){return this._data.map(function(b){return b})};a.toJSON=function(){for(var b=this.getThreads(),a=[],d=0, +e=b.length;da;a+=15)this._dividerGroup.elem("line",{x1:49,y1:0,x2:49-(0=== +a%45?10:5),y2:0,transform:"rotate("+a+", 0, 0)",class:"entry-angle-divider"});a=this.getAbsolutePosFromBoard();a.x+=this.box.width/2;a.y=a.y+this.box.height/2+49+1;this.svgOptionGroup.attr({class:"entry-field-angle",transform:"translate("+a.x+","+a.y+")"});$(this.svgOptionGroup).bind("mousemove touchmove",this._updateByCoord.bind(this));$(this.svgOptionGroup).bind("mouseup touchend",this.destroyOption.bind(this));this.updateGraph();this.optionGroup.focus();this.optionGroup.select()};a._updateByCoord= +function(b){b.originalEvent&&b.originalEvent.touches&&(b=b.originalEvent.touches[0]);b=[b.clientX,b.clientY];var a=this.getAbsolutePosFromDocument();this.optionGroup.val(this.modValue(function(b,a){var c=a[0]-b[0];b=a[1]-b[1]-49-1;a=Math.atan(-b/c);a=Entry.toDegrees(a);a=90-a;0>c?a+=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",a).replace("%Y",d).replace("%LARGE",b),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:a,y2:d});this._indicator.attr({class:"entry-angle-indicator"})};a.applyValue=function(){var b=this.optionGroup.val();isNaN(b)|| +""===b||(b=this.modValue(b),this.setValue(b),this.updateGraph(),this.textElement.textContent=this.getValue(),this.optionGroup&&this.optionGroup.val(b),this.resize())};a.resize=function(){var b=this.getTextWidth();this._header.attr({width:b});this.optionGroup&&this.optionGroup.css({width:b});this.box.set({width:b});this._block.view.alignContent()};a.getTextWidth=function(){return this.textElement?this.textElement.getComputedTextLength()+8:8};a.getText=function(){return this.getValue()+"\u00b0"};a.modValue= +function(b){return b%360};a.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.FieldColor=function(a,b,c){this._block=b.block;this._blockView=b;this.box=new Entry.BoxModel;this.svgGroup=null;this._contents=a;this._index=c;this._position=a.position;this.key=a.key;this.setValue(this.getValue()||"#FF0000");this._CONTENT_HEIGHT=this.getContentHeight();this._CONTENT_WIDTH=this.getContentWidth();this.renderStart(b)};Entry.Utils.inherit(Entry.Field,Entry.FieldColor); +(function(a){a.renderStart=function(){this.svgGroup&&$(this.svgGroup).remove();this.svgGroup=this._blockView.contentSvgGroup.elem("g",{class:"entry-field-color"});var b=this._CONTENT_HEIGHT,a=this._CONTENT_WIDTH,d=this._position,e;d?(e=d.x||0,d=d.y||0):(e=0,d=-b/2);this._header=this.svgGroup.elem("rect",{x:e,y:d,width:a,height:b,fill:this.getValue()});this._bindRenderOptions();this.box.set({x:e,y:d,width:a,height:b})};a.renderOptions=function(){var b=this;this._attachDisposeEvent();var a=Entry.FieldColor.getWidgetColorList(); +this.optionGroup=Entry.Dom("table",{class:"entry-widget-color-table",parent:$("body")});for(var d=0;d'),{parent:this._container});this.svg=Entry.SVG("globalSvg");this.top=this.left=0;this._inited=!0}}; -b.setView=function(a,b){if(a!=this._view&&!a.block.isReadOnly()&&a.movable)return this._view=a,this._mode=b,b!==Entry.Workspace.MODE_VIMBOARD&&a.set({visible:!1}),this.draw(),this.show(),this.align(),this.position(),!0};b.draw=function(){var a=this._view;this._svg&&this.remove();var b=this._mode==Entry.Workspace.MODE_VIMBOARD;this.svgGroup=Entry.SVG.createElement(a.svgGroup.cloneNode(!0),{opacity:1});this.svg.appendChild(this.svgGroup);b&&(a=$(this.svgGroup),a.find("g").css({filter:"none"}),a.find("path").velocity({opacity:0}, -{duration:500}),a.find("text").velocity({fill:"#000000"},{duration:530}))};b.remove=function(){this.svgGroup&&(this.svgGroup.remove(),delete this.svgGroup,delete this._view,delete this._offsetX,delete this._offsetY,delete this._startX,delete this._startY,this.hide())};b.align=function(){var a=this._view.getSkeleton().box(this._view).offsetX||0,b=this._view.getSkeleton().box(this._view).offsetY||0,a=-1*a+1,b=-1*b+1;this._offsetX=a;this._offsetY=b;this.svgGroup.attr({transform:"translate("+a+","+b+ -")"})};b.show=function(){this._container.removeClass("entryRemove")};b.hide=function(){this._container.addClass("entryRemove")};b.position=function(){var a=this._view;if(a){var b=a.getAbsoluteCoordinate(),a=a.getBoard().offset();this.left=b.x+a.left-this._offsetX;this.top=b.y+a.top-this._offsetY;this.svgDom.css({transform:"translate3d("+this.left+"px,"+this.top+"px, 0px)"})}};b.terminateDrag=function(a){var b=Entry.mouseCoordinate,d=a.getBoard(),e=d.workspace.blockMenu,f=e.offset().left,g=e.offset().top, -h=e.visible?e.svgDom.width():0;return b.y>d.offset().top-20&&b.x>f+h?this.DONE:b.y>g&&b.x>f&&e.visible?a.block.isDeletable()?this.REMOVE:this.RETURN:this.RETURN};b.addControl=function(a){this.onMouseDown.apply(this,arguments)};b.onMouseDown=function(a){function b(a){var c=a.pageX;a=a.pageY;var d=e.left+(c-e._startX),f=e.top+(a-e._startY);e.svgDom.css({left:d,top:f});e._startX=c;e._startY=a;e.left=d;e.top=f}function d(a){$(document).unbind(".block")}this._startY=a.pageY;var e=this;a.stopPropagation(); -a.preventDefault();var f=$(document);f.bind("mousemove.block",b);f.bind("mouseup.block",d);f.bind("touchmove.block",b);f.bind("touchend.block",d);this._startX=a.pageX;this._startY=a.pageY}})(Entry.GlobalSvg);Entry.Mutator=function(){};(function(b){b.mutate=function(a,b){var d=Entry.block[a];void 0===d.changeEvent&&(d.changeEvent=new Entry.Event);d.template=b.template;d.params=b.params;d.changeEvent.notify(1)}})(Entry.Mutator);(function(b){})(Entry.Mutator.prototype);Entry.RenderView=function(b,a){this._align=a||"CENTER";b="string"===typeof b?$("#"+b):$(b);if("DIV"!==b.prop("tagName"))return console.error("Dom is not div element");this.view=b;this.viewOnly=!0;this.suffix="renderView";this.disableMouseEvent=this.visible=!0;this._svgId="renderView_"+(new Date).getTime();this._generateView();this.offset=this.svgDom.offset();this.setWidth();this.svg=Entry.SVG(this._svgId);Entry.Utils.addFilters(this.svg,this.suffix);this.svg&&(this.svgGroup=this.svg.elem("g"),this.svgThreadGroup= +(function(a){a.DONE=0;a._inited=!1;a.REMOVE=1;a.RETURN=2;a.createDom=function(){if(!this.inited){$("#globalSvgSurface").remove();$("#globalSvg").remove();var b=$("body");this._container=Entry.Dom("div",{classes:["globalSvgSurface","entryRemove"],id:"globalSvgSurface",parent:b});this.svgDom=Entry.Dom($(''),{parent:this._container});this.svg=Entry.SVG("globalSvg");this.top=this.left=0;this._inited=!0}}; +a.setView=function(b,a){if(b!=this._view&&!b.block.isReadOnly()&&b.movable)return this._view=b,this._mode=a,a!==Entry.Workspace.MODE_VIMBOARD&&b.set({visible:!1}),this.draw(),this.show(),this.align(),this.position(),!0};a.draw=function(){var b=this._view;this._svg&&this.remove();var a=this._mode==Entry.Workspace.MODE_VIMBOARD;this.svgGroup=Entry.SVG.createElement(b.svgGroup.cloneNode(!0),{opacity:1});this.svg.appendChild(this.svgGroup);a&&(b=$(this.svgGroup),b.find("g").css({filter:"none"}),b.find("path").velocity({opacity:0}, +{duration:500}),b.find("text").velocity({fill:"#000000"},{duration:530}))};a.remove=function(){this.svgGroup&&(this.svgGroup.remove(),delete this.svgGroup,delete this._view,delete this._offsetX,delete this._offsetY,delete this._startX,delete this._startY,this.hide())};a.align=function(){var b=this._view.getSkeleton().box(this._view).offsetX||0,a=this._view.getSkeleton().box(this._view).offsetY||0,b=-1*b+1,a=-1*a+1;this._offsetX=b;this._offsetY=a;this.svgGroup.attr({transform:"translate("+b+","+a+ +")"})};a.show=function(){this._container.removeClass("entryRemove")};a.hide=function(){this._container.addClass("entryRemove")};a.position=function(){var b=this._view;if(b){var a=b.getAbsoluteCoordinate(),b=b.getBoard().offset();this.left=a.x+b.left-this._offsetX;this.top=a.y+b.top-this._offsetY;this.svgDom.css({transform:"translate3d("+this.left+"px,"+this.top+"px, 0px)"})}};a.terminateDrag=function(b){var a=Entry.mouseCoordinate,d=b.getBoard(),e=d.workspace.blockMenu,f=e.offset().left,g=e.offset().top, +h=e.visible?e.svgDom.width():0;return a.y>d.offset().top-20&&a.x>f+h?this.DONE:a.y>g&&a.x>f&&e.visible?b.block.isDeletable()?this.REMOVE:this.RETURN:this.RETURN};a.addControl=function(b){this.onMouseDown.apply(this,arguments)};a.onMouseDown=function(b){function a(b){var c=b.pageX;b=b.pageY;var d=e.left+(c-e._startX),f=e.top+(b-e._startY);e.svgDom.css({left:d,top:f});e._startX=c;e._startY=b;e.left=d;e.top=f}function d(b){$(document).unbind(".block")}this._startY=b.pageY;var e=this;b.stopPropagation(); +b.preventDefault();var f=$(document);f.bind("mousemove.block",a);f.bind("mouseup.block",d);f.bind("touchmove.block",a);f.bind("touchend.block",d);this._startX=b.pageX;this._startY=b.pageY}})(Entry.GlobalSvg);Entry.Mutator=function(){};(function(a){a.mutate=function(b,a){b=Entry.block[b];void 0===b.changeEvent&&(b.changeEvent=new Entry.Event);b.template=a.template;b.params=a.params;b.changeEvent.notify(1)}})(Entry.Mutator);(function(a){})(Entry.Mutator.prototype);Entry.RenderView=function(a,b){this._align=b||"CENTER";a="string"===typeof a?$("#"+a):$(a);if("DIV"!==a.prop("tagName"))return console.error("Dom is not div element");this.view=a;this.viewOnly=!0;this.suffix="renderView";this.disableMouseEvent=this.visible=!0;this._svgId="renderView_"+(new Date).getTime();this._generateView();this.offset=this.svgDom.offset();this.setWidth();this.svg=Entry.SVG(this._svgId);Entry.Utils.addFilters(this.svg,this.suffix);this.svg&&(this.svgGroup=this.svg.elem("g"),this.svgThreadGroup= this.svgGroup.elem("g"),this.svgThreadGroup.board=this,this.svgBlockGroup=this.svgGroup.elem("g"),this.svgBlockGroup.board=this)}; -(function(b){b.schema={code:null,dragBlock:null,closeBlock:null,selectedBlockView:null};b._generateView=function(){this.renderViewContainer=Entry.Dom("div",{"class":"renderViewContainer",parent:this.view});this.svgDom=Entry.Dom($(''),{parent:this.renderViewContainer})};b.changeCode=function(a){if(!(a instanceof Entry.Code))return console.error("You must inject code instance");this.code=a;this.svg|| -(this.svg=Entry.SVG(this._svgId),this.svgGroup=this.svg.elem("g"),this.svgThreadGroup=this.svgGroup.elem("g"),this.svgThreadGroup.board=this,this.svgBlockGroup=this.svgGroup.elem("g"),this.svgBlockGroup.board=this);a.createView(this);this.align();this.resize()};b.align=function(){var a=this.code.getThreads();if(a&&0!==a.length){for(var b=0,d="LEFT"==this._align?20:this.svgDom.width()/2,e=0,f=a.length;e'), -{parent:this.wrapper});this.visible=!0;var d=this;this.svg=Entry.SVG(this._svgId);$(window).scroll(function(){d.updateOffset()});this.svgGroup=this.svg.elem("g");this.svgThreadGroup=this.svgGroup.elem("g");this.svgThreadGroup.board=this;this.svgBlockGroup=this.svgGroup.elem("g");this.svgBlockGroup.board=this;a.isOverlay?(this.wrapper.addClass("entryOverlayBoard"),this.generateButtons(),this.suffix="overlayBoard"):this.suffix="board";Entry.Utils.addFilters(this.svg,this.suffix);a=Entry.Utils.addBlockPattern(this.svg, -this.suffix);this.patternRect=a.rect;this.pattern=a.pattern};b.changeCode=function(a){this.code&&this.codeListener&&this.code.changeEvent.detach(this.codeListener);this.set({code:a});var b=this;a&&(this.codeListener=this.code.changeEvent.attach(this,function(){b.changeEvent.notify()}),a.createView(this));this.scroller.resizeScrollBar()};b.bindCodeView=function(a){this.svgBlockGroup.remove();this.svgThreadGroup.remove();this.svgBlockGroup=a.svgBlockGroup;this.svgThreadGroup=a.svgThreadGroup;this.svgGroup.appendChild(this.svgThreadGroup); -this.svgGroup.appendChild(this.svgBlockGroup)};b.setMagnetedBlock=function(a,b){if(this.magnetedBlockView){if(this.magnetedBlockView===a)return;this.magnetedBlockView.set({magneting:!1})}this.set({magnetedBlockView:a});a&&(a.set({magneting:b}),a.dominate())};b.getCode=function(){return this.code};b.findById=function(a){return this.code.findById(a)};b._addControl=function(){var a=this.svgDom,b=this;a.mousedown(function(){b.onMouseDown.apply(b,arguments)});a.bind("touchstart",function(){b.onMouseDown.apply(b, -arguments)});a.on("wheel",function(){b.mouseWheel.apply(b,arguments)});var d=b.scroller;d&&(a.mouseenter(function(a){d.setOpacity(1)}),a.mouseleave(function(a){d.setOpacity(0)}))};b.onMouseDown=function(a){function b(a){a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();a=Entry.Utils.convertMouseEvent(a);var c=e.mouseDownCoordinate;Math.sqrt(Math.pow(a.pageX-c.x,2)+Math.pow(a.pageY-c.y,2))a&&(f=f+e+10,e=0,d=15);e=Math.max(e,k.width);l=d+15;h._moveTo(f,l,!1);d=d+k.height+15}}this.scroller.resizeScrollBar()};b.clear=function(){this.svgBlockGroup.remove();this.svgThreadGroup.remove()};b.updateOffset= -function(){this._offset=this.svg.getBoundingClientRect();var a=$(window),b=a.scrollTop(),a=a.scrollLeft(),d=this._offset;this.relativeOffset={top:d.top-b,left:d.left-a};this.btnWrapper&&this.btnWrapper.attr({transform:"translate("+(d.width/2-65)+","+(d.height-200)+")"})};b.generateButtons=function(){var a=this,b=this.svgGroup.elem("g");this.btnWrapper=b;var d=b.elem("text",{x:27,y:33,class:"entryFunctionButtonText"});d.textContent=Lang.Buttons.save;var e=b.elem("text",{x:102.5,y:33,class:"entryFunctionButtonText"}); -e.textContent=Lang.Buttons.cancel;var f=b.elem("circle",{cx:27.5,cy:27.5,r:27.5,class:"entryFunctionButton"}),b=b.elem("circle",{cx:102.5,cy:27.5,r:27.5,class:"entryFunctionButton"});$(f).bind("mousedown touchstart",function(){a.save()});$(d).bind("mousedown touchstart",function(){a.save()});$(b).bind("mousedown touchstart",function(){a.cancelEdit()});$(e).bind("mousedown touchstart",function(){a.cancelEdit()})};b.cancelEdit=function(){this.workspace.setMode(Entry.Workspace.MODE_BOARD,"cancelEdit")}; -b.save=function(){this.workspace.setMode(Entry.Workspace.MODE_BOARD,"save")};b.generateCodeMagnetMap=function(){var a=this.code;if(a&&this.dragBlock)for(var b in this.dragBlock.magnet){var d=this._getCodeBlocks(a,b);d.sort(function(a,b){return a.point-b.point});d.unshift({point:-Number.MAX_VALUE,blocks:[]});for(var e=1;eg.point&&(g.blocks.push(h),l++,g=d[l],g););delete f.startBlock}f.endPoint=Number.MAX_VALUE;d[e-1].endPoint= -f.point}this._magnetMap[b]=d}};b._getCodeBlocks=function(a,b){var d=a.getThreads(),e=[],f;switch(b){case "previous":f=this._getNextMagnets;break;case "next":f=this._getPreviousMagnets;break;case "string":f=this._getFieldMagnets;break;case "boolean":f=this._getFieldMagnets;break;case "param":f=this._getOutputMagnets;break;default:return[]}for(var g=0;gd.endPoint)f=h+1;else{e=d.blocks;for(f=0;fthis.events[b].indexOf(f)&&this.events[b].push(f)}}this._schema.event&&this.thread.registerEvent(this,this._schema.event);a=this.params;b=this._schema.params;for(e=0;b&&e=e&&g>=b)}};b.align=function(){var a=this.getPosition();this.svgGroup.attr({transform:"translate("+a.x+","+a.y+")"})};b.setPosition=function(){if(this.board){var a=this.board.svgDom;this._x=a.width()-110;this._y=a.height()-110;this.align()}};b.getPosition=function(){return{x:this._x,y:this._y}};b.tAnimation=function(a){if(a!==this.isOver){a=void 0===a?!0:a;var b,d=this.trashcanTop;b=a?{translateX:15,translateY:-25, -rotateZ:30}:{translateX:0,translateY:0,rotateZ:0};$(d).velocity(b,{duration:50});this.isOver=a}};b.setBoard=function(a){this._dragBlockObserver&&this._dragBlockObserver.destroy();this.board=a;this.svgGroup||this._generateView();var b=a.svg,d=b.firstChild;d?b.insertBefore(this.svgGroup,d):b.appendChild(this.svgGroup);this._dragBlockObserver=a.observe(this,"updateDragBlock",["dragBlock"]);this.svgGroup.attr({filter:"url(#entryTrashcanFilter_"+a.suffix+")"});this.setPosition()}})(Entry.FieldTrashcan.prototype);Entry.Vim=function(b){b="string"===typeof b?$("#"+b):$(b);if("DIV"!==b.prop("tagName"))return console.error("Dom is not div element");this.createDom(b);this._parser=new Entry.Parser("maze","js",this.codeMirror);this._blockParser=new Entry.Parser("maze","block");Entry.Model(this,!1);window.eventset=[]}; -(function(b){b.createDom=function(a){function b(a){var c=e.getCodeToText(a.block);e.codeMirror.display.dragFunctions.leave(a);var d=Entry.Utils.createMouseEvent("mousedown",a);e.codeMirror.display.scroller.dispatchEvent(d);var c=c.split("\n"),k=c.length-1,l=0;c.forEach(function(a,b){e.codeMirror.replaceSelection(a);l=e.doc.getCursor().line;e.codeMirror.indentLine(l);0!==b&&k===b||e.codeMirror.replaceSelection("\n")});a=Entry.Utils.createMouseEvent("mouseup",a);e.codeMirror.display.scroller.dispatchEvent(a)} +(function(a){a.schema={code:null,dragBlock:null,closeBlock:null,selectedBlockView:null};a._generateView=function(){this.renderViewContainer=Entry.Dom("div",{"class":"renderViewContainer",parent:this.view});this.svgDom=Entry.Dom($(''),{parent:this.renderViewContainer})};a.changeCode=function(b){if(!(b instanceof Entry.Code))return console.error("You must inject code instance");this.code=b;this.svg|| +(this.svg=Entry.SVG(this._svgId),this.svgGroup=this.svg.elem("g"),this.svgThreadGroup=this.svgGroup.elem("g"),this.svgThreadGroup.board=this,this.svgBlockGroup=this.svgGroup.elem("g"),this.svgBlockGroup.board=this);b.createView(this);this.align();this.resize()};a.align=function(){var b=this.code.getThreads();if(b&&0!==b.length){for(var a=0,d="LEFT"==this._align?20:this.svgDom.width()/2,e=0,f=b.length;e"+d[1];c.addEventListener("click",function(){Entry.engine.toggleStop()});this.view_.appendChild(c);this.curtainView_=c;Entry.pictureEditable&&(c=Entry.createElement("div","entryPicture"),c.addClass("entryPlaygroundPictureWorkspace"),c.addClass("entryRemove"),this.view_.appendChild(c),this.generatePictureView(c),this.pictureView_=c);c=Entry.createElement("div","entryText");c.addClass("entryPlaygroundTextWorkspace");c.addClass("entryRemove");this.view_.appendChild(c);this.generateTextView(c); -this.textView_=c;Entry.soundEditable&&(c=Entry.createElement("div","entrySound"),c.addClass("entryPlaygroundSoundWorkspace"),c.addClass("entryRemove"),this.view_.appendChild(c),this.generateSoundView(c),this.soundView_=c);c=Entry.createElement("div","entryDefault");c.addClass("entryPlaygroundDefaultWorkspace");this.view_.appendChild(c);this.generateDefaultView(c);this.defaultView_=c;c=Entry.createElement("div","entryCode");c.addClass("entryPlaygroundCodeWorkspace");c.addClass("entryRemove");this.view_.appendChild(c); -this.generateCodeView(c);this.codeView_=c;d=Entry.createElement("div");d.addClass("entryPlaygroundResizeWorkspace","entryRemove");this.resizeHandle_=d;this.view_.appendChild(d);this.initializeResizeHandle(d);this.codeView_=c;Entry.addEventListener("run",function(a){Entry.playground.curtainView_.removeClass("entryRemove")});Entry.addEventListener("stop",function(a){Entry.playground.curtainView_.addClass("entryRemove")})}};Entry.Playground.prototype.generateDefaultView=function(b){return b}; -Entry.Playground.prototype.generateTabView=function(b){var a=this,c=Entry.createElement("ul");c.addClass("entryTabListWorkspace");this.tabList_=c;b.appendChild(c);this.tabViewElements={};b=Entry.createElement("li","entryCodeTab");b.innerHTML=Lang.Workspace.tab_code;b.addClass("entryTabListItemWorkspace");b.addClass("entryTabSelected");c.appendChild(b);b.bindOnClick(function(b){a.changeViewMode("code");a.blockMenu.reDraw()});this.tabViewElements.code=b;Entry.pictureEditable&&(b=Entry.createElement("li", -"entryPictureTab"),b.innerHTML=Lang.Workspace.tab_picture,b.addClass("entryTabListItemWorkspace"),c.appendChild(b),b.bindOnClick(function(a){Entry.playground.changeViewMode("picture")}),this.tabViewElements.picture=b,b=Entry.createElement("li","entryTextboxTab"),b.innerHTML=Lang.Workspace.tab_text,b.addClass("entryTabListItemWorkspace"),c.appendChild(b),b.bindOnClick(function(a){Entry.playground.changeViewMode("text")}),this.tabViewElements.text=b,b.addClass("entryRemove"));Entry.soundEditable&&(b= -Entry.createElement("li","entrySoundTab"),b.innerHTML=Lang.Workspace.tab_sound,b.addClass("entryTabListItemWorkspace"),c.appendChild(b),b.bindOnClick(function(a){Entry.playground.changeViewMode("sound")}),this.tabViewElements.sound=b);Entry.hasVariableManager&&(b=Entry.createElement("li","entryVariableTab"),b.innerHTML=Lang.Workspace.tab_attribute,b.addClass("entryTabListItemWorkspace"),b.addClass("entryVariableTabWorkspace"),c.appendChild(b),b.bindOnClick(function(a){Entry.playground.toggleOnVariableView(); -Entry.playground.changeViewMode("variable")}),this.tabViewElements.variable=b)}; -Entry.Playground.prototype.generateCodeView=function(b){var a=this.createVariableView();b.appendChild(a);this.variableView_=a;b=Entry.Dom(b);a=Entry.Dom("div",{parent:b,id:"entryWorkspaceBoard",class:"entryWorkspaceBoard"});b=Entry.Dom("div",{parent:b,id:"entryWorkspaceBlockMenu",class:"entryWorkspaceBlockMenu"});this.mainWorkspace=new Entry.Workspace({blockMenu:{dom:b,align:"LEFT",categoryData:EntryStatic.getAllBlocks(),scroll:!0},board:{dom:a}});this.blockMenu=this.mainWorkspace.blockMenu;this.board= -this.mainWorkspace.board;Entry.hw&&this.updateHW()}; -Entry.Playground.prototype.generatePictureView=function(b){if("workspace"==Entry.type){var a=Entry.createElement("div","entryAddPicture");a.addClass("entryPlaygroundAddPicture");a.bindOnClick(function(a){Entry.dispatchEvent("openPictureManager")});var c=Entry.createElement("div","entryAddPictureInner");c.addClass("entryPlaygroundAddPictureInner");c.innerHTML=Lang.Workspace.picture_add;a.appendChild(c);b.appendChild(a);a=Entry.createElement("ul","entryPictureList");a.addClass("entryPlaygroundPictureList"); -$&&$(a).sortable({start:function(a,b){b.item.data("start_pos",b.item.index())},stop:function(a,b){var c=b.item.data("start_pos"),g=b.item.index();Entry.playground.movePicture(c,g)},axis:"y"});b.appendChild(a);this.pictureListView_=a;a=Entry.createElement("div","entryPainter");a.addClass("entryPlaygroundPainter");b.appendChild(a);this.painter=new Entry.Painter;this.painter.initialize(a)}else"phone"==Entry.type&&(a=Entry.createElement("div","entryAddPicture"),a.addClass("entryPlaygroundAddPicturePhone"), -a.bindOnClick(function(a){Entry.dispatchEvent("openPictureManager")}),c=Entry.createElement("div","entryAddPictureInner"),c.addClass("entryPlaygroundAddPictureInnerPhone"),c.innerHTML=Lang.Workspace.picture_add,a.appendChild(c),b.appendChild(a),a=Entry.createElement("ul","entryPictureList"),a.addClass("entryPlaygroundPictureListPhone"),$&&$(a).sortable({start:function(a,b){b.item.data("start_pos",b.item.index())},stop:function(a,b){var c=b.item.data("start_pos"),g=b.item.index();Entry.playground.movePicture(c, -g)},axis:"y"}),b.appendChild(a),this.pictureListView_=a)}; -Entry.Playground.prototype.generateTextView=function(b){var a=Entry.createElement("div");b.appendChild(a);b=Entry.createElement("div");b.addClass("textProperties");a.appendChild(b);var c=Entry.createElement("div");c.addClass("entryTextFontSelect");b.appendChild(c);var d=Entry.createElement("select","entryPainterAttrFontName");d.addClass("entryPlaygroundPainterAttrFontName","entryTextFontSelecter");d.size="1";d.onchange=function(a){Entry.playground.object.entity.setFontType(a.target.value)};for(var e= -0;e p").html(Lang.Menus.linebreak_on_desc_1),$(".entryPlaygroundLinebreakDescription > ul > li").eq(0).html(Lang.Menus.linebreak_on_desc_2),$(".entryPlaygroundLinebreakDescription > ul > li").eq(1).html(Lang.Menus.linebreak_on_desc_3)); -Entry.playground.setFontAlign(Entry.playground.object.entity.getTextAlign());b=Entry.playground.object.entity.getFontSize();Entry.playground.fontSizeIndiciator.style.width=b+"%";Entry.playground.fontSizeKnob.style.left=.88*b+"px"}};Entry.Playground.prototype.injectSound=function(){var b=this.soundListView_;if(b){for(;b.hasChildNodes();)b.removeChild(b.lastChild);if(this.object)for(var a=this.object.sounds,c=0,d=a.length;c Date: Thu, 18 Aug 2016 10:46:27 +0900 Subject: [PATCH 15/15] =?UTF-8?q?=EC=BD=94=EB=B8=94=20=EB=B8=94=EB=A1=9D?= =?UTF-8?q?=20=EC=88=98=EC=A0=95.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/workspace/block_entry.js | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/src/workspace/block_entry.js b/src/workspace/block_entry.js index f97731e711..f1b71e337d 100644 --- a/src/workspace/block_entry.js +++ b/src/workspace/block_entry.js @@ -3966,7 +3966,7 @@ Entry.block = { color: "#00979D", fontColor: "#fff", skeleton: "basic_string_field", - template: "8.온도센서@포트%1 %2", + template: "8.온도센서@포트%1", params: [ { type: "Dropdown", @@ -3975,11 +3975,6 @@ Entry.block = { [ "2", "2" ], ], fontSize: 11 - }, - { - type: "Indicator", - img: "block_icon/hardware_03.png", - size: 12 } ], def: { @@ -4014,7 +4009,7 @@ Entry.block = { color: "#00979D", fontColor: "#fff", skeleton: "basic_string_field", - template: "9.빛센서@포트%1 %2", + template: "9.빛센서@포트%1", params: [ { type: "Dropdown", @@ -4023,11 +4018,6 @@ Entry.block = { [ "2", "2" ], ], fontSize: 11 - }, - { - type: "Indicator", - img: "block_icon/hardware_03.png", - size: 12 } ], def: { @@ -4058,7 +4048,7 @@ Entry.block = { color: "#00979D", fontColor: "#fff", skeleton: "basic_boolean_field", - template: "10.버튼스위치@포트%1 %2", + template: "10.버튼스위치@포트%1", params: [ { type: "Dropdown", @@ -4067,11 +4057,6 @@ Entry.block = { [ "2", "2" ], ], fontSize: 11 - }, - { - type: "Indicator", - img: "block_icon/hardware_03.png", - size: 12 } ], def: {