From ee77e1c4c77d01110e806e67c323a97076346ab6 Mon Sep 17 00:00:00 2001 From: kimorkim Date: Fri, 5 Feb 2016 14:11:01 +0900 Subject: [PATCH 1/2] bugfix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 장면 전환시 picture가 아닌 글상자 일경우 id를 찾지 못하여 발생하는 오류 수정 --- dist/entry.js | 94 ++++++++++++++++++++++++----------------------- dist/entry.min.js | 89 ++++++++++++++++++++++---------------------- src/playground.js | 3 ++ 3 files changed, 95 insertions(+), 91 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index 4184ae5069..9763677833 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -346,7 +346,7 @@ Blockly.Blocks.albert_set_eye_to = {init:function() { this.setNextStatement(!0); }}; Entry.block.albert_set_eye_to = function(a, b) { - var c = Entry.hw.sendQueue, d = b.getField("DIRECTION", b), e = Number(b.getField("COLOR", b)); + var c = Entry.hw.sendQueue, d = b.getField("DIRECTION", b), e = +b.getField("COLOR", b); "LEFT" == d ? c.leftEye = e : ("RIGHT" != d && (c.leftEye = e), c.rightEye = e); return b.callReturn(); }; @@ -606,7 +606,7 @@ Entry.block.arduino_get_number = function(a, b) { 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"); @@ -1293,7 +1293,7 @@ Blockly.Blocks.coordinate_mouse = {init:function() { 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); + return "x" === b.getField("VALUE", b) ? +Entry.stage.mouseCoordinate.x : +Entry.stage.mouseCoordinate.y; }; Blockly.Blocks.coordinate_object = {init:function() { this.setColour(calcBlockColor); @@ -1317,7 +1317,7 @@ Entry.block.coordinate_object = function(a, b) { 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; } @@ -2448,7 +2448,7 @@ Blockly.Blocks.hamster_set_following_speed_to = {init:function() { this.setNextStatement(!0); }}; Entry.block.hamster_set_following_speed_to = function(a, b) { - Entry.hw.sendQueue.lineTracerSpeed = Number(b.getField("SPEED", b)); + Entry.hw.sendQueue.lineTracerSpeed = +b.getField("SPEED", b); return b.callReturn(); }; Blockly.Blocks.hamster_stop = {init:function() { @@ -2474,7 +2474,7 @@ Blockly.Blocks.hamster_set_led_to = {init:function() { this.setNextStatement(!0); }}; Entry.block.hamster_set_led_to = function(a, b) { - var c = Entry.hw.sendQueue, d = b.getField("DIRECTION", b), e = Number(b.getField("COLOR", b)); + var c = Entry.hw.sendQueue, d = b.getField("DIRECTION", b), e = +b.getField("COLOR", b); "LEFT" == d ? c.leftLed = e : ("RIGHT" != d && (c.leftLed = e), c.rightLed = e); return b.callReturn(); }; @@ -2673,7 +2673,7 @@ Blockly.Blocks.hamster_set_port_to = {init:function() { this.setNextStatement(!0); }}; Entry.block.hamster_set_port_to = function(a, b) { - var c = Entry.hw.sendQueue, d = b.getField("PORT", b), e = Number(b.getField("MODE", 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(); }; @@ -2722,7 +2722,7 @@ Blockly.Blocks.is_press_some_key = {init:function() { this.setInputsInline(!0); }}; Entry.block.is_press_some_key = function(a, b) { - var c = Number(b.getField("VALUE", b)); + var c = +b.getField("VALUE", b); return 0 <= Entry.engine.pressedKeys.indexOf(c); }; Blockly.Blocks.reach_something = {init:function() { @@ -2936,13 +2936,13 @@ Entry.block.boolean_basic_operator = function(a, b) { 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() { @@ -3417,7 +3417,7 @@ Blockly.Blocks.rotate_by_angle_dropdown = {init:function() { }}; Entry.block.rotate_by_angle_dropdown = function(a, b) { var c = b.getField("VALUE", b); - a.setRotation(a.getRotation() + Number(c)); + a.setRotation(a.getRotation() + +c); return b.callReturn(); }; Blockly.Blocks.see_angle = {init:function() { @@ -3509,8 +3509,8 @@ Blockly.Blocks.locate = {init:function() { 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.setX(+c); + a.setY(+d); a.brush && !a.brush.stop && a.brush.lineTo(c, -1 * d); return b.callReturn(); }; @@ -3706,7 +3706,7 @@ Entry.block.locate_object_time = function(a, b) { 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(); + 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) { @@ -7030,7 +7030,7 @@ Entry.EntryObject.prototype.generateView = function() { 13 == a.keyCode && c.editObjectValues(tog); }; f.onblur = function(a) { - isNaN(f.value) || c.entity.setX(Number(f.value)); + isNaN(f.value) || c.entity.setX(+f.value); c.updateCoordinateView(); Entry.stage.updateObject(); }; @@ -7038,7 +7038,7 @@ Entry.EntryObject.prototype.generateView = function() { 13 == a.keyCode && c.editObjectValues(tog); }; h.onblur = function(a) { - isNaN(h.value) || c.entity.setY(Number(h.value)); + isNaN(h.value) || c.entity.setY(+h.value); c.updateCoordinateView(); Entry.stage.updateObject(); }; @@ -7046,7 +7046,7 @@ Entry.EntryObject.prototype.generateView = function() { 13 == a.keyCode && c.editObjectValues(tog); }; l.onblur = function(a) { - isNaN(l.value) || c.entity.setSize(Number(l.value)); + isNaN(l.value) || c.entity.setSize(+l.value); c.updateCoordinateView(); Entry.stage.updateObject(); }; @@ -7090,7 +7090,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(); }; @@ -7100,7 +7100,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(); }; @@ -7172,24 +7172,24 @@ Entry.EntryObject.prototype.generateView = function() { } }), 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, g = Entry.createElement("span"), g.addClass("entryObjectDirectionSpanWorkspace"), g.innerHTML = Lang.Workspace.direction + " : ", m = Entry.createElement("input"), m.addClass("entryObjectDirectionInputWorkspace"), this.directionInput_ = m, d.appendChild(e), d.appendChild(n), d.appendChild(g), 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(); }, 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:", f = Entry.createElement("input"), f.addClass("entryObjectCoordinateInputWorkspace"), g = Entry.createElement("span"), g.addClass("entryObjectCoordinateSpanWorkspace"), g.innerHTML = "Y:", h = Entry.createElement("input"), h.addClass("entryObjectCoordinateInputWorkspace entryObjectCoordinateInputWorkspace_right"), k = Entry.createElement("span"), k.addClass("entryObjectCoordinateSpanWorkspace"), k.innerHTML = Lang.Workspace.Size, l = Entry.createElement("input"), l.addClass("entryObjectCoordinateInputWorkspace", "entryObjectCoordinateInputWorkspace_size"), d.appendChild(e), d.appendChild(f), d.appendChild(g), d.appendChild(h), d.appendChild(k), d.appendChild(l), d.xInput_ = f, d.yInput_ = h, d.sizeInput_ = l, this.coordinateView_ = d, c = this, f.onkeypress = function(a) { - 13 == a.keyCode && (isNaN(f.value) || c.entity.setX(Number(f.value)), c.updateCoordinateView(), f.blur()); + 13 == a.keyCode && (isNaN(f.value) || c.entity.setX(+f.value), c.updateCoordinateView(), f.blur()); }, f.onblur = function(a) { c.entity.setX(c.entity.getX()); Entry.stage.updateObject(); }, h.onkeypress = function(a) { - 13 == a.keyCode && (isNaN(h.value) || c.entity.setY(Number(h.value)), c.updateCoordinateView(), h.blur()); + 13 == a.keyCode && (isNaN(h.value) || c.entity.setY(+h.value), c.updateCoordinateView(), h.blur()); }, h.onblur = function(a) { c.entity.setY(c.entity.getY()); Entry.stage.updateObject(); @@ -9313,12 +9313,14 @@ Entry.Playground.prototype.clonePicture = function(a) { this.addPicture(a, !0); }; 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"); + if (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"); + } + b = Entry.container.selectPicture(a.id); + this.object.id === b && Entry.dispatchEvent("pictureSelected", a); } - b = Entry.container.selectPicture(a.id); - this.object.id === b && Entry.dispatchEvent("pictureSelected", a); }; Entry.Playground.prototype.movePicture = function(a, b) { this.object.pictures.splice(b, 0, this.object.pictures.splice(a, 1)[0]); @@ -10010,7 +10012,7 @@ 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")); + 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)); @@ -10074,7 +10076,7 @@ p.getValue = function(a) { return this.values[a].run(); }; p.getNumberValue = function(a) { - return Number(this.values[a].run()); + return +this.values[a].run(); }; p.getStringValue = function(a) { return String(this.values[a].run()); @@ -10089,7 +10091,7 @@ p.getStringField = function(a) { return String(this.fields[a]); }; p.getNumberField = function(a) { - return Number(this.fields[a]); + return +this.fields[a]; }; p.callReturn = function() { return this.nextScript ? this.nextScript : this.parentScript ? this.parentScript : null; @@ -10891,7 +10893,7 @@ Entry.getElementsByClassName = function(a) { return b; }; Entry.parseNumber = function(a) { - return "string" != typeof a || isNaN(Number(a)) ? "number" != typeof a || isNaN(Number(a)) ? !1 : a : Number(a); + return "string" != typeof a || isNaN(+a) ? "number" != typeof a || isNaN(+a) ? !1 : a : +a; }; Entry.countStringLength = function(a) { var b, c = 0; @@ -10957,7 +10959,7 @@ Entry.computeInputWidth = function(a) { document.body.appendChild(b); a = b.offsetWidth; document.body.removeChild(b); - return Number(a + 10) + "px"; + return +(a + 10) + "px"; }; Entry.isArrowOrBackspace = function(a) { return -1 < [37, 38, 39, 40, 8].indexOf(a); @@ -11122,7 +11124,7 @@ Entry.getMaxFloatPoint = function(a) { 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); + return isNaN(a) || !this.isFloat(a) ? a : +(Math.round(a + "e" + b) + "e-" + b); }; Entry.attachEventListener = function(a, b, c) { setTimeout(function() { @@ -11749,7 +11751,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; @@ -11856,7 +11858,7 @@ 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); - a = (this.minValue_ + Number(Math.abs(this.maxValue_ - this.minValue_) * a)).toFixed(2); + a = (this.minValue_ + Math.abs(this.maxValue_ - this.minValue_) * a).toFixed(2); a < this.minValue_ ? this.setValue(this.minValue_) : a > this.maxValue_ ? this.setValue(this.maxValue_) : this.setValue(a); }; Entry.Variable.prototype.getMinValue = function() { @@ -12017,7 +12019,7 @@ Entry.VariableContainer.prototype.renderMessageReference = 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)); a = this.caller; a = a.funcBlock ? a.funcBlock.getAttribute("id") : a.block.getAttribute("id"); - Blockly.mainWorkspace.activatePreviousBlock(Number(a)); + Blockly.mainWorkspace.activatePreviousBlock(+a); Entry.playground.toggleOnVariableView(); Entry.playground.changeViewMode("variable"); }), f.appendChild(d); @@ -12056,7 +12058,7 @@ Entry.VariableContainer.prototype.renderVariableReference = 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.funcBlock.getAttribute("id") : a.block.getAttribute("id"); - Blockly.mainWorkspace.activatePreviousBlock(Number(a)); + Blockly.mainWorkspace.activatePreviousBlock(+a); Entry.playground.toggleOnVariableView(); Entry.playground.changeViewMode("variable"); }), f.appendChild(d); @@ -12079,7 +12081,7 @@ Entry.VariableContainer.prototype.renderFunctionReference = function(a) { 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), b.select(null), b.select(a)); 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); @@ -12906,7 +12908,7 @@ Entry.VariableContainer.prototype.generateVariableSettingView = function() { d = a.selectedVariable; e.value = d && "slide" == d.type ? d.minValue_ : 0; e.onblur = function(b) { - isNaN(this.value) || (b = a.selectedVariable, b.setMinValue(Number(this.value)), a.updateVariableSettingView(b)); + isNaN(this.value) || (b = a.selectedVariable, b.setMinValue(+this.value), a.updateVariableSettingView(b)); }; b.minValueInput = e; c.appendChild(e); @@ -12918,7 +12920,7 @@ Entry.VariableContainer.prototype.generateVariableSettingView = function() { g.addClass("entryVariableSettingMaxValueInputWorkspace"); g.value = d && "slide" == d.type ? d.maxValue_ : 100; g.onblur = function(b) { - isNaN(this.value) || (b = a.selectedVariable, b.setMaxValue(Number(this.value)), a.updateVariableSettingView(b)); + isNaN(this.value) || (b = a.selectedVariable, b.setMaxValue(+this.value), a.updateVariableSettingView(b)); }; b.maxValueInput = g; c.appendChild(g); @@ -13046,7 +13048,7 @@ Entry.VariableContainer.prototype.updateListSettingView = function(a) { c.removeClass("entryRemove"); }; Entry.VariableContainer.prototype.setListLength = function(a) { - a = Number(a); + a = +a; var b = this.selectedList.array_; if (!isNaN(a)) { var c = b.length; @@ -15020,7 +15022,7 @@ Entry.Xml.getNumberValue = function(a, b, c) { } for (var d in c) { 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 +Entry.Xml.operate(a, c[d].children[0]); } } return null; @@ -15043,7 +15045,7 @@ Entry.Xml.getNumberField = function(a, b) { } for (var d in c) { if ("FIELD" == c[d].tagName.toUpperCase() && c[d].getAttribute("name") == a) { - return Number(c[d].textContent); + return +c[d].textContent; } } }; diff --git a/dist/entry.min.js b/dist/entry.min.js index e866ac39a0..e925df8edf 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -30,7 +30,7 @@ Blockly.Blocks.albert_stop={init:function(){this.setColour("#00979D");this.appen Blockly.Blocks.albert_set_pad_size_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_pad_size_to_1);this.appendValueInput("WIDTH").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_pad_size_to_2);this.appendValueInput("HEIGHT").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_pad_size_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png", "*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.albert_set_pad_size_to=function(a,b){var c=Entry.hw.sendQueue;c.padWidth=b.getNumberValue("WIDTH");c.padHeight=b.getNumberValue("HEIGHT");return b.callReturn()}; Blockly.Blocks.albert_set_eye_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_set_eye_to_1).appendField(new Blockly.FieldDropdown([[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"],[Lang.General.both,"BOTH"]]),"DIRECTION").appendField(Lang.Blocks.ALBERT_set_eye_to_2).appendField(new Blockly.FieldDropdown([[Lang.General.red,"4"],[Lang.General.yellow,"6"],[Lang.General.green,"2"],[Lang.Blocks.ALBERT_color_cyan,"3"],[Lang.General.blue,"1"],[Lang.Blocks.ALBERT_color_magenta, -"5"],[Lang.General.white,"7"]]),"COLOR").appendField(Lang.Blocks.ALBERT_set_eye_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.albert_set_eye_to=function(a,b){var c=Entry.hw.sendQueue,d=b.getField("DIRECTION",b),e=Number(b.getField("COLOR",b));"LEFT"==d?c.leftEye=e:("RIGHT"!=d&&(c.leftEye=e),c.rightEye=e);return b.callReturn()}; +"5"],[Lang.General.white,"7"]]),"COLOR").appendField(Lang.Blocks.ALBERT_set_eye_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.albert_set_eye_to=function(a,b){var c=Entry.hw.sendQueue,d=b.getField("DIRECTION",b),e=+b.getField("COLOR",b);"LEFT"==d?c.leftEye=e:("RIGHT"!=d&&(c.leftEye=e),c.rightEye=e);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.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.albert_clear_eye=function(a,b){var c=Entry.hw.sendQueue,d=b.getField("DIRECTION",b);"LEFT"==d?c.leftEye=0:("RIGHT"!=d&&(c.leftEye=0),c.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.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; @@ -57,7 +57,7 @@ Entry.block.albert_set_tempo_to=function(a,b){Entry.Albert.tempo=b.getNumberValu 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()}; 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 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(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(" "); @@ -137,10 +137,10 @@ Blockly.Blocks.get_rotation_direction={init:function(){this.setColour(calcBlockC 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(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)?Number(Entry.stage.mouseCoordinate.x):Number(Entry.stage.mouseCoordinate.y)}; +Blockly.Blocks.coordinate_mouse={init:function(){this.setColour(calcBlockColor);this.appendDummyInput().appendField(Lang.Blocks.CALC_coordinate_mouse_1,calcFontColor).appendField(new Blockly.FieldDropdown([["x","x"],["y","y"]],null,!0,calcArrowColor),"VALUE").appendField(Lang.Blocks.CALC_coordinate_mouse_2,calcFontColor);this.setOutput(!0,"Number");this.setInputsInline(!0)}};Entry.block.coordinate_mouse=function(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(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 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(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)}}; @@ -256,10 +256,10 @@ Blockly.Blocks.hamster_follow_line_until={init:function(){this.setColour("#00979 Entry.block.hamster_follow_line_until=function(a,b){var c=Entry.hw.sendQueue,d=Entry.hw.portData,e=b.getField("COLOR"),f=b.getField("DIRECTION"),g=4;"RIGHT"==f?g=5:"FRONT"==f?g=6:"REAR"==f&&(g=7);"WHITE"==e&&(g+=7);if(b.isStart){if(e=Entry.Hamster,d.lineTracerStateId!=e.lineTracerStateId&&(e.lineTracerStateId=d.lineTracerStateId,64==d.lineTracerState))return delete b.isStart,Entry.engine.isContinue=!1,e.setLineTracerMode(c,0),b.callReturn()}else b.isStart=!0,c.leftWheel=0,c.rightWheel=0,Entry.Hamster.setLineTracerMode(c, g);return b}; Blockly.Blocks.hamster_set_following_speed_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_following_speed_to_1).appendField(new Blockly.FieldDropdown([["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"]]),"SPEED").appendField(Lang.Blocks.HAMSTER_set_following_speed_to_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; -Entry.block.hamster_set_following_speed_to=function(a,b){Entry.hw.sendQueue.lineTracerSpeed=Number(b.getField("SPEED",b));return b.callReturn()};Blockly.Blocks.hamster_stop={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_stop).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; +Entry.block.hamster_set_following_speed_to=function(a,b){Entry.hw.sendQueue.lineTracerSpeed=+b.getField("SPEED",b);return b.callReturn()};Blockly.Blocks.hamster_stop={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_stop).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.hamster_stop=function(a,b){var c=Entry.hw.sendQueue;c.leftWheel=0;c.rightWheel=0;Entry.Hamster.setLineTracerMode(c,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.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_set_led_to=function(a,b){var c=Entry.hw.sendQueue,d=b.getField("DIRECTION",b),e=Number(b.getField("COLOR",b));"LEFT"==d?c.leftLed=e:("RIGHT"!=d&&(c.leftLed=e),c.rightLed=e);return b.callReturn()}; +[Lang.Blocks.HAMSTER_color_magenta,"5"],[Lang.General.white,"7"]]),"COLOR").appendField(Lang.Blocks.HAMSTER_set_led_to_3).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}};Entry.block.hamster_set_led_to=function(a,b){var c=Entry.hw.sendQueue,d=b.getField("DIRECTION",b),e=+b.getField("COLOR",b);"LEFT"==d?c.leftLed=e:("RIGHT"!=d&&(c.leftLed=e),c.rightLed=e);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.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.hamster_clear_led=function(a,b){var c=Entry.hw.sendQueue,d=b.getField("DIRECTION",b);"LEFT"==d?c.leftLed=0:("RIGHT"!=d&&(c.leftLed=0),c.rightLed=0);return b.callReturn()};Blockly.Blocks.hamster_beep={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_beep).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.hamster_beep=function(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.buzzer=0;return b.callReturn()}b.isStart=!0;b.timeFlag=1;c.buzzer=440;c.note=0;var d=setTimeout(function(){b.timeFlag=0;Entry.Hamster.removeTimeout(d)},200);Entry.Hamster.timeouts.push(d);return b}; @@ -280,12 +280,12 @@ Entry.block.hamster_change_tempo_by=function(a,b){Entry.Hamster.tempo+=b.getNumb Blockly.Blocks.hamster_set_tempo_to={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_tempo_to_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.HAMSTER_set_tempo_to_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/hardware_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.hamster_set_tempo_to=function(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(a,b){var c=Entry.hw.sendQueue,d=b.getField("PORT",b),e=Number(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(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(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(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=Number(b.getField("VALUE",b));return 0<=Entry.engine.pressedKeys.indexOf(c)}; +Blockly.Blocks.is_press_some_key={init:function(){this.setColour("#AEB8FF");this.appendDummyInput().appendField(Lang.Blocks.JUDGEMENT_is_press_some_key_1,"#3D3D3D");this.appendDummyInput().appendField(new Blockly.FieldKeydownInput("81"),"VALUE").appendField(Lang.Blocks.JUDGEMENT_is_press_some_key_2,"#3D3D3D");this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.is_press_some_key=function(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(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","GREATER"],["<","LESS"],[">=","GREATER_OR_EQUAL"],["<=","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 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(a,b){a.setVisible(!0);return b.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)}}; @@ -352,7 +352,7 @@ Entry.block.locate_xy_time=function(a,b){if(!b.isStart){var c;c=b.getNumberValue Blockly.Blocks.rotate_by_angle={init:function(){this.setColour("#A751E3");this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_1);this.appendValueInput("VALUE").setCheck(["Number","String"]);this.appendDummyInput().appendField(Lang.Blocks.MOVING_rotate_by_angle_2).appendField(new Blockly.FieldIcon(Entry.mediaFilePath+"block_icon/moving_03.png","*"));this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0)}}; Entry.block.rotate_by_angle=function(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(a,b){var c=b.getField("VALUE",b);a.setRotation(a.getRotation()+Number(c));return b.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(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)}}; @@ -364,7 +364,7 @@ Entry.block.locate_x=function(a,b){var c=b.getNumberValue("VALUE",b);a.setX(c);a 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()}; 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(Number(c));a.setY(Number(d));a.brush&&!a.brush.stop&&a.brush.lineTo(c,-1*d);return b.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(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()}; @@ -390,8 +390,8 @@ Blockly.Blocks.rotate_direction={init:function(){this.setColour("#A751E3");this. 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(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()}; +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(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)}}; @@ -659,10 +659,10 @@ d.object=this;this.editView_=d;this.view_.appendChild(d);Entry.objectEditable?(d d=Entry.createElement("div");d.addClass("entryObjectSelectedImgWorkspace");this.selectedImgView_=d;this.view_.appendChild(d);this.initializeSplitter(d);this.splitter=d;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 f=Entry.createElement("input");f.addClass("entryObjectCoordinateInputWorkspace");f.setAttribute("disabled","disabled");f.bindOnClick(function(a){a.stopPropagation();this.select()});var g=Entry.createElement("span");g.addClass("entryObjectCoordinateSpanWorkspace");g.innerHTML="Y:";var h=Entry.createElement("input");h.addClass("entryObjectCoordinateInputWorkspace entryObjectCoordinateInputWorkspace_right"); h.bindOnClick(function(a){a.stopPropagation();this.select()});h.setAttribute("disabled","disabled");var k=Entry.createElement("span");k.addClass("entryObjectCoordinateSizeWorkspace");k.innerHTML="\ud06c\uae30 :";var l=Entry.createElement("input");l.addClass("entryObjectCoordinateInputWorkspace","entryObjectCoordinateInputWorkspace_size");l.bindOnClick(function(a){a.stopPropagation();this.select()});l.setAttribute("disabled","disabled");d.appendChild(e);d.appendChild(f);d.appendChild(g);d.appendChild(h); -d.appendChild(k);d.appendChild(l);d.xInput_=f;d.yInput_=h;d.sizeInput_=l;this.coordinateView_=d;c=this;f.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(tog)};f.onblur=function(a){isNaN(f.value)||c.entity.setX(Number(f.value));c.updateCoordinateView();Entry.stage.updateObject()};h.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(tog)};h.onblur=function(a){isNaN(h.value)||c.entity.setY(Number(h.value));c.updateCoordinateView();Entry.stage.updateObject()};l.onkeypress=function(a){13== -a.keyCode&&c.editObjectValues(tog)};l.onblur=function(a){isNaN(l.value)||c.entity.setSize(Number(l.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("disabled", +d.appendChild(k);d.appendChild(l);d.xInput_=f;d.yInput_=h;d.sizeInput_=l;this.coordinateView_=d;c=this;f.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(tog)};f.onblur=function(a){isNaN(f.value)||c.entity.setX(+f.value);c.updateCoordinateView();Entry.stage.updateObject()};h.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(tog)};h.onblur=function(a){isNaN(h.value)||c.entity.setY(+h.value);c.updateCoordinateView();Entry.stage.updateObject()};l.onkeypress=function(a){13==a.keyCode&& +c.editObjectValues(tog)};l.onblur=function(a){isNaN(l.value)||c.entity.setSize(+l.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("disabled", "disabled");n.bindOnClick(function(a){a.stopPropagation();this.select()});this.rotateSpan_=e;this.rotateInput_=n;g=Entry.createElement("span");g.addClass("entryObjectDirectionSpanWorkspace");g.innerHTML=Lang.Workspace.direction+" : ";var m=Entry.createElement("input");m.addClass("entryObjectDirectionInputWorkspace");m.setAttribute("disabled","disabled");m.bindOnClick(function(a){a.stopPropagation();this.select()});this.directionInput_=m;d.appendChild(e);d.appendChild(n);d.appendChild(g);d.appendChild(m); -d.rotateInput_=n;d.directionInput_=m;c=this;n.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(tog)};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(tog)};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(); +d.rotateInput_=n;d.directionInput_=m;c=this;n.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(tog)};n.onblur=function(a){a=n.value;-1!=a.indexOf("\u02da")&&(a=a.substring(0,a.indexOf("\u02da")));isNaN(a)||c.entity.setRotation(+a);c.updateRotationView();Entry.stage.updateObject()};m.onkeypress=function(a){13==a.keyCode&&c.editObjectValues(tog)};m.onblur=function(a){a=m.value;-1!=a.indexOf("\u02da")&&(a=a.substring(0,a.indexOf("\u02da")));isNaN(a)||c.entity.setDirection(+a);c.updateRotationView(); Entry.stage.updateObject()};d=Entry.createElement("div");d.addClass("rotationMethodWrapper");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(a){Entry.engine.isState("run")|| this.object.getLock()||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(a){Entry.engine.isState("run")||this.object.getLock()||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(a){Entry.engine.isState("run")||this.object.getLock()||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(a){Entry.container.getObject(this.id)&& @@ -671,13 +671,13 @@ d.addClass("objectInfo_visible"),e=Entry.createElement("li"),e.addClass("objectI this.nameView_.onblur=function(){this.entryObject.name=this.value;Entry.playground.reloadPlayground()},this.nameView_.onkeypress=function(a){13==a.keyCode&&this.blur()},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,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,g=Entry.createElement("span"),g.addClass("entryObjectDirectionSpanWorkspace"),g.innerHTML=Lang.Workspace.direction+" : ",m=Entry.createElement("input"),m.addClass("entryObjectDirectionInputWorkspace"),this.directionInput_=m,d.appendChild(e),d.appendChild(n),d.appendChild(g), -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()},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:",f=Entry.createElement("input"),f.addClass("entryObjectCoordinateInputWorkspace"), -g=Entry.createElement("span"),g.addClass("entryObjectCoordinateSpanWorkspace"),g.innerHTML="Y:",h=Entry.createElement("input"),h.addClass("entryObjectCoordinateInputWorkspace entryObjectCoordinateInputWorkspace_right"),k=Entry.createElement("span"),k.addClass("entryObjectCoordinateSpanWorkspace"),k.innerHTML=Lang.Workspace.Size,l=Entry.createElement("input"),l.addClass("entryObjectCoordinateInputWorkspace","entryObjectCoordinateInputWorkspace_size"),d.appendChild(e),d.appendChild(f),d.appendChild(g), -d.appendChild(h),d.appendChild(k),d.appendChild(l),d.xInput_=f,d.yInput_=h,d.sizeInput_=l,this.coordinateView_=d,c=this,f.onkeypress=function(a){13==a.keyCode&&(isNaN(f.value)||c.entity.setX(Number(f.value)),c.updateCoordinateView(),f.blur())},f.onblur=function(a){c.entity.setX(c.entity.getX());Entry.stage.updateObject()},h.onkeypress=function(a){13==a.keyCode&&(isNaN(h.value)||c.entity.setY(Number(h.value)),c.updateCoordinateView(),h.blur())},h.onblur=function(a){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(a){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(a){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(a){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}; +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(+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(+a),c.updateRotationView(), +m.blur())},m.onblur=function(a){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:",f=Entry.createElement("input"),f.addClass("entryObjectCoordinateInputWorkspace"),g=Entry.createElement("span"), +g.addClass("entryObjectCoordinateSpanWorkspace"),g.innerHTML="Y:",h=Entry.createElement("input"),h.addClass("entryObjectCoordinateInputWorkspace entryObjectCoordinateInputWorkspace_right"),k=Entry.createElement("span"),k.addClass("entryObjectCoordinateSpanWorkspace"),k.innerHTML=Lang.Workspace.Size,l=Entry.createElement("input"),l.addClass("entryObjectCoordinateInputWorkspace","entryObjectCoordinateInputWorkspace_size"),d.appendChild(e),d.appendChild(f),d.appendChild(g),d.appendChild(h),d.appendChild(k), +d.appendChild(l),d.xInput_=f,d.yInput_=h,d.sizeInput_=l,this.coordinateView_=d,c=this,f.onkeypress=function(a){13==a.keyCode&&(isNaN(f.value)||c.entity.setX(+f.value),c.updateCoordinateView(),f.blur())},f.onblur=function(a){c.entity.setX(c.entity.getX());Entry.stage.updateObject()},h.onkeypress=function(a){13==a.keyCode&&(isNaN(h.value)||c.entity.setY(+h.value),c.updateCoordinateView(),h.blur())},h.onblur=function(a){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(a){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(a){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(a){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(a){a=Blockly.Xml.domToText(this.script);a=a.replace(/\sxmlns=\"(.*?)\"/,"");a=a.replace(/\sclass=\"(.*?)\"/g,"");a=a.replace(/\sid=\"(.*?)\"/g,"");return a=a.replace(/\sinline=\"(.*?)\"/g,"")}; 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.name,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){a=b.text.split("\n");if(1c&&(c=a[d].length);b.width=25*c;b.height=24*a.length}else b.width=25*b.text.length;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"; @@ -862,7 +862,7 @@ Entry.Playground.prototype.injectObject=function(a){if(!a)this.changeViewMode("c Entry.Playground.prototype.injectCode=function(){var a=this.object;Blockly.mainWorkspace.clear();Blockly.Xml.domToWorkspace(Blockly.mainWorkspace,a.script)};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=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")),d=$(this.view_).width()-d,e=0,f;for(f in a){var g=a[f],h=g.view;h.addClass("minValue");g=g.inputWrapper;$(g).width(Entry.computeInputWidth(g.nameField));h=$(h);e=e+h.width()+c}if(e>d)for(f in d-=$(b.view).width(),c=d/(a.length-1)-(Entry.Scene.viewBasicWidth+c),a)g=a[f],b.id!=g.id?(g.view.removeClass("minValue"),$(g.inputWrapper).width(c)): g.view.addClass("minValue")}};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=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.value.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/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: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.getMaxFloatPoint=function(a){for(var b=0,c=0,d=a.length;cb&&(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(a){a.stopPropagation();a.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(a){var c=a.schema;if(void 0!==c){c=JSON.parse(JSON.stringify(c));a.data={};for(var d in c)(function(d){a.data[d]=c[d];Object.defineProperty(a,d,{get:function(){return a.data[d]}})})(d);a._toJSON=this._toJSON}};a.generateSetter=function(a){a.set=this.set};a.set=function(a,c){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]));c||this.notify(Object.keys(a),d)};a.generateObserve=function(a){a.observers= [];a.observe=this.observe;a.unobserve=this.unobserve;a.notify=this.notify};a.observe=function(a,c,d,e){d=new Entry.Observer(this.observers,a,c,d);if(!1!==e)a[c]([]);return d};a.unobserve=function(a){a.destroy()};a.notify=function(a,c){"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:c[a]}}))})};a._toJSON=function(){var a={},c;for(c in this.data)a[c]= @@ -1053,16 +1053,15 @@ this.textView_.text=this.getName(),this.valueView_.x=this.textView_.getMeasuredW 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(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()?Number(this.value_):this.value_}; +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){this.value_="slide"!=this.type?a:athis.maxValue_?this.maxValue_:a;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.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);1this.maxValue_?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.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);1this.maxValue_?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; @@ -1075,16 +1074,16 @@ c.name.focus());b.object?(c.localCheck.addClass("entryVariableAddChecked"),c.clo Entry.VariableContainer.prototype.select=function(a){a=this.selected==a?null:a;this.selected&&(this.selected.listElement.removeClass("selected"),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){var b=this,c=Entry.container.objects_,d=["when_message_cast","message_cast","message_cast_wait"],e=[],f=Entry.createElement("ul");f.addClass("entryVariableListCallerListWorkspace");for(var g in c)for(var h=c[g],k=h.script.getElementsByTagName("block"),l=0;lc.getValue()&&c.setValue(0),100a&&(b.length=a)}this.updateListSettingView()};Entry.VariableContainer.prototype.updateViews=function(){var a=this.lists_;this.variables_.map(function(a){a.updateView()});a.map(function(a){a.updateView()})}; +f.addClass("entryListSettingValueRemoveWorkspace");e.appendChild(f);d.appendChild(e)})(e);a.updateView();c.removeClass("entryRemove")};Entry.VariableContainer.prototype.setListLength=function(a){a=+a;var b=this.selectedList.array_;if(!isNaN(a)){var c=b.length;if(ca&&(b.length=a)}this.updateListSettingView()};Entry.VariableContainer.prototype.updateViews=function(){var a=this.lists_;this.variables_.map(function(a){a.updateView()});a.map(function(a){a.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(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(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(){})}};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)}}; @@ -1280,6 +1279,6 @@ this._board.findById(a.cloneId):this._board.findById(a.target);if(a.dest.id){var f._getCloseBlock();d?g.setMagnetedBlock(d.view):g.setMagnetedBlock(null);f.terminateDrag();g&&g.set({dragBoard:null});c._stopEvent.notify(a)},a.duration-300)};a.moveMouse=function(a,c){};a.generateImage=function(a){var c=this.getBoard().svgDom[0],d=c.clientWidth/2,c=c.clientHeight/2;this.svgGroup=this._board.snap.group();this.image=this.svgGroup.image(a,d,c,30,30)}})(Entry.Workspace.prototype);Entry.Xml={};Entry.Xml.isTypeOf=function(a,b){return b.getAttribute("type")==a};Entry.Xml.getNextBlock=function(a){a=a.childNodes;for(var b=0;b Date: Fri, 5 Feb 2016 14:19:53 +0900 Subject: [PATCH 2/2] bugfix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 이슈 #1942 수정과 겹침 --- dist/entry.js | 13 ++++++------- dist/entry.min.js | 2 +- src/playground.js | 8 ++++---- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/dist/entry.js b/dist/entry.js index 9763677833..169196224c 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -9313,14 +9313,13 @@ Entry.Playground.prototype.clonePicture = function(a) { this.addPicture(a, !0); }; Entry.Playground.prototype.selectPicture = function(a) { - if (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"); - } - b = Entry.container.selectPicture(a.id); - this.object.id === b && Entry.dispatchEvent("pictureSelected", 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)); + this.object.id === f && Entry.dispatchEvent("pictureSelected", a); }; Entry.Playground.prototype.movePicture = function(a, b) { this.object.pictures.splice(b, 0, this.object.pictures.splice(a, 1)[0]); diff --git a/dist/entry.min.js b/dist/entry.min.js index e925df8edf..877cddec83 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -862,7 +862,7 @@ Entry.Playground.prototype.injectObject=function(a){if(!a)this.changeViewMode("c Entry.Playground.prototype.injectCode=function(){var a=this.object;Blockly.mainWorkspace.clear();Blockly.Xml.domToWorkspace(Blockly.mainWorkspace,a.script)};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