diff --git a/dist/entry.js b/dist/entry.js
index 600137447f..b09440ad10 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,88 +55,88 @@ 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.height = c + "px";
- 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"};
@@ -144,9 +146,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");
@@ -155,9 +157,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");
@@ -168,29 +171,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");
@@ -201,29 +205,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");
@@ -234,28 +239,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");
@@ -268,11 +274,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");
@@ -285,11 +292,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");
@@ -300,10 +307,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");
@@ -314,10 +322,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");
@@ -326,11 +335,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");
@@ -343,11 +352,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");
@@ -357,10 +366,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");
@@ -369,10 +379,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");
@@ -381,10 +392,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");
@@ -393,10 +404,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");
@@ -405,28 +416,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");
@@ -437,11 +448,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");
@@ -452,11 +464,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");
@@ -465,11 +477,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");
@@ -481,36 +493,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");
@@ -521,28 +534,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");
@@ -553,10 +566,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");
@@ -567,10 +580,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");
@@ -579,27 +592,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");
@@ -608,25 +621,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");
@@ -635,30 +648,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");
@@ -668,10 +681,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");
@@ -680,10 +694,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");
@@ -694,10 +709,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");
@@ -708,15 +724,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 +
@@ -725,15 +742,15 @@ 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}}}, mode:"both"}};
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 = [];
}};
@@ -746,8 +763,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");
@@ -758,12 +775,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");
@@ -773,12 +791,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");
@@ -788,12 +807,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");
@@ -802,8 +822,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");
@@ -812,8 +832,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");
@@ -822,8 +842,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");
@@ -833,9 +853,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");
@@ -845,9 +865,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");
@@ -859,10 +879,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");
@@ -876,10 +897,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");
@@ -898,17 +920,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() {
@@ -917,8 +940,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");
@@ -927,8 +950,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");
@@ -937,9 +960,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() {
@@ -964,8 +987,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");
@@ -973,8 +996,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");
@@ -982,8 +1005,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");
@@ -991,8 +1014,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");
@@ -1000,9 +1023,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");
@@ -1011,23 +1034,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() {
@@ -1036,17 +1058,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");
@@ -1058,12 +1082,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");
@@ -1073,10 +1098,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");
@@ -1084,8 +1110,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");
@@ -1097,9 +1123,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");
@@ -1107,8 +1133,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");
@@ -1119,14 +1145,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");
@@ -1140,15 +1167,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");
@@ -1160,39 +1188,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,
@@ -1203,9 +1234,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");
@@ -1213,8 +1244,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");
@@ -1223,11 +1254,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");
@@ -1242,12 +1273,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");
@@ -1256,12 +1288,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");
@@ -1272,13 +1304,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");
@@ -1289,14 +1323,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");
@@ -1305,15 +1339,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");
@@ -1324,10 +1359,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");
@@ -1338,10 +1375,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");
@@ -1352,10 +1390,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");
@@ -1372,17 +1412,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() {
@@ -1392,11 +1436,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);
@@ -1405,9 +1449,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);
@@ -1418,11 +1462,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);
@@ -1431,16 +1475,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);
@@ -1451,11 +1495,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);
@@ -1466,11 +1510,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);
@@ -1481,12 +1525,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);
@@ -1497,11 +1541,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);
@@ -1510,19 +1554,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);
@@ -1531,9 +1575,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);
@@ -1544,12 +1588,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);
@@ -1560,11 +1604,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() {
@@ -1573,8 +1617,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);
@@ -1582,8 +1626,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);
@@ -1591,8 +1635,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);
@@ -1600,8 +1644,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);
@@ -1609,8 +1653,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);
@@ -1619,8 +1663,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);
@@ -1628,13 +1672,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);
@@ -1642,8 +1686,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);
@@ -1652,24 +1696,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() {
@@ -1680,9 +1724,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);
@@ -1692,9 +1738,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);
@@ -1704,9 +1751,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);
@@ -1716,9 +1764,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);
@@ -1728,9 +1777,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);
@@ -1742,9 +1792,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);
@@ -1756,9 +1807,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);
@@ -1771,45 +1823,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);
@@ -1821,9 +1873,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);
@@ -1832,9 +1887,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);
@@ -1844,10 +1900,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;
}
}
};
@@ -1859,12 +1917,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);
@@ -1876,13 +1934,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);
@@ -1890,7 +1949,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() {
@@ -1900,10 +1959,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() {
@@ -1916,12 +1975,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);
@@ -1931,8 +1991,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);
@@ -1946,12 +2006,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);
@@ -1965,8 +2028,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);
@@ -1978,8 +2041,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);
@@ -1991,9 +2054,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);
@@ -2005,9 +2070,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);
@@ -2015,7 +2081,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() {
@@ -2027,12 +2093,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);
@@ -2043,13 +2110,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");
@@ -2060,23 +2128,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);
+ 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");
@@ -2088,21 +2156,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");
@@ -2112,9 +2179,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");
@@ -2123,7 +2190,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() {
@@ -2135,8 +2202,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");
@@ -2148,8 +2215,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");
@@ -2163,13 +2230,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");
@@ -2180,10 +2247,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");
@@ -2191,11 +2259,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");
@@ -2203,8 +2271,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");
@@ -2213,7 +2281,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() {
@@ -2225,10 +2293,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");
@@ -2239,17 +2307,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() {
@@ -2258,7 +2327,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();
};
@@ -2269,13 +2338,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();
@@ -2309,18 +2378,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]];
@@ -2330,18 +2399,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]];
@@ -2354,8 +2423,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() {
}};
@@ -2364,12 +2433,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"));
@@ -2381,11 +2450,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");
@@ -2393,34 +2462,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()) {
@@ -2428,31 +2497,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"}};
@@ -2462,9 +2531,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");
@@ -2473,9 +2542,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");
@@ -2484,52 +2554,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");
@@ -2538,64 +2609,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");
@@ -2606,30 +2678,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");
@@ -2640,30 +2713,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");
@@ -2674,29 +2748,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");
@@ -2709,12 +2784,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");
@@ -2727,12 +2803,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");
@@ -2743,11 +2819,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");
@@ -2758,11 +2835,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");
@@ -2772,14 +2850,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");
@@ -2789,18 +2868,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");
@@ -2809,9 +2889,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");
@@ -2820,12 +2900,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");
@@ -2835,10 +2915,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");
@@ -2847,10 +2928,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");
@@ -2859,28 +2941,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");
@@ -2891,11 +2973,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");
@@ -2906,11 +2989,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");
@@ -2919,11 +3002,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");
@@ -2935,36 +3018,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");
@@ -2975,28 +3059,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");
@@ -3007,10 +3091,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");
@@ -3021,10 +3105,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");
@@ -3034,10 +3118,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");
@@ -3048,10 +3133,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");
@@ -3062,10 +3148,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");
@@ -3073,7 +3160,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() {
@@ -3083,9 +3170,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");
@@ -3095,64 +3182,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;
}
}
@@ -3168,9 +3259,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");
@@ -3180,9 +3273,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");
@@ -3192,9 +3286,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");
@@ -3204,9 +3299,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");
@@ -3216,9 +3312,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");
@@ -3228,9 +3326,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");
@@ -3240,9 +3339,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");
@@ -3253,8 +3353,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");
@@ -3263,8 +3363,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");
@@ -3272,7 +3372,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() {
@@ -3281,7 +3381,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() {
@@ -3292,19 +3392,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() {
@@ -3314,9 +3416,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");
@@ -3325,9 +3427,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");
@@ -3342,20 +3444,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");
@@ -3368,13 +3470,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");
@@ -3383,9 +3485,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");
@@ -3396,10 +3498,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");
@@ -3408,11 +3510,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");
@@ -3425,11 +3527,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");
@@ -3442,11 +3544,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");
@@ -3455,9 +3557,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");
@@ -3468,11 +3570,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");
@@ -3483,11 +3585,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");
@@ -3498,10 +3600,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");
@@ -3512,10 +3614,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");
@@ -3524,9 +3626,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");
@@ -3535,9 +3637,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");
@@ -3548,10 +3650,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");
};
@@ -3563,8 +3666,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");
@@ -3575,12 +3678,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");
@@ -3593,11 +3696,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");
@@ -3610,11 +3713,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");
@@ -3627,11 +3730,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");
@@ -3644,11 +3747,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");
@@ -3658,9 +3761,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) {
@@ -3668,16 +3773,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");
@@ -3688,12 +3793,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");
@@ -3704,11 +3809,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");
@@ -3719,11 +3824,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");
@@ -3738,29 +3843,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");
@@ -3771,10 +3876,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");
@@ -3784,10 +3889,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");
@@ -3798,10 +3903,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");
@@ -3812,10 +3917,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");
@@ -3828,13 +3933,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");
@@ -3845,11 +3950,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");
@@ -3860,11 +3965,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");
@@ -3875,13 +3980,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");
@@ -3896,22 +4001,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");
@@ -3935,21 +4040,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");
@@ -3967,22 +4072,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");
@@ -3991,9 +4097,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");
@@ -4002,9 +4108,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");
@@ -4015,16 +4121,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");
@@ -4035,10 +4141,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");
@@ -4049,10 +4155,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");
@@ -4065,25 +4171,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");
@@ -4094,10 +4200,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");
@@ -4108,10 +4214,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");
@@ -4122,10 +4228,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");
@@ -4136,10 +4242,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");
@@ -4152,12 +4258,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");
@@ -4171,21 +4277,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");
@@ -4198,26 +4304,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",
@@ -4228,9 +4334,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");
@@ -4240,10 +4346,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");
@@ -4252,9 +4359,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");
@@ -4264,10 +4371,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");
@@ -4276,9 +4384,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");
@@ -4289,34 +4397,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");
@@ -4326,12 +4434,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");
@@ -4342,13 +4451,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");
@@ -4359,11 +4469,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");
@@ -4374,27 +4484,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]]);
@@ -4403,37 +4513,37 @@ 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();
this.setRobotisData(null);
-}, setRobotisData:function(b) {
- Entry.hw.sendQueue.ROBOTIS_DATA = null == b ? null : Entry.hw.sendQueue.ROBOTIS_DATA ? Entry.hw.sendQueue.ROBOTIS_DATA.concat(b) : b;
+}, setRobotisData:function(a) {
+ Entry.hw.sendQueue.ROBOTIS_DATA = null == a ? null : Entry.hw.sendQueue.ROBOTIS_DATA ? Entry.hw.sendQueue.ROBOTIS_DATA.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() {
@@ -4456,13 +4566,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");
@@ -4472,20 +4583,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");
@@ -4497,43 +4610,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");
@@ -4550,12 +4666,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");
@@ -4568,9 +4686,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");
@@ -4579,9 +4698,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");
@@ -4591,10 +4709,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");
@@ -4606,9 +4725,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");
@@ -4619,10 +4742,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");
@@ -4632,9 +4758,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");
@@ -4645,10 +4774,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");
@@ -4659,10 +4791,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");
@@ -4673,9 +4808,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");
@@ -4686,9 +4824,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");
@@ -4703,9 +4844,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");
@@ -4714,17 +4858,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");
@@ -4733,11 +4879,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");
@@ -4746,9 +4895,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");
@@ -4759,11 +4907,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");
@@ -4774,10 +4924,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");
@@ -4785,8 +4937,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");
@@ -4795,10 +4947,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;
};
@@ -4809,9 +4961,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() {
@@ -4823,10 +4977,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");
@@ -4839,15 +4993,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");
@@ -4858,22 +5012,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");
@@ -4886,28 +5040,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");
@@ -4918,12 +5073,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");
@@ -4934,12 +5090,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");
@@ -4948,9 +5104,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");
@@ -4960,8 +5116,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");
@@ -4972,10 +5128,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");
@@ -4988,10 +5144,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");
@@ -5002,24 +5158,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");
@@ -5032,28 +5188,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");
@@ -5068,13 +5225,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");
@@ -5089,26 +5246,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");
@@ -5116,8 +5273,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");
@@ -5126,8 +5283,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");
@@ -5135,8 +5292,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");
@@ -5144,8 +5301,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");
@@ -5153,8 +5310,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");
@@ -5162,8 +5319,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");
@@ -5171,8 +5328,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");
@@ -5180,23 +5337,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");
@@ -5205,20 +5362,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");
@@ -5226,32 +5384,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() {
@@ -5260,8 +5419,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);
@@ -5272,10 +5431,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);
@@ -5286,10 +5445,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);
@@ -5300,10 +5459,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);
@@ -5312,9 +5471,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() {
@@ -5334,22 +5493,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");
@@ -5361,17 +5520,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");
@@ -5380,18 +5539,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");
@@ -5400,17 +5560,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);
@@ -5423,16 +5583,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");
@@ -5444,30 +5604,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");
@@ -5477,10 +5637,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() {
@@ -5493,19 +5653,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");
@@ -5518,14 +5679,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");
@@ -5540,14 +5702,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");
@@ -5562,14 +5725,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");
@@ -5581,12 +5745,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");
@@ -5596,9 +5763,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");
@@ -5608,10 +5775,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");
@@ -5621,10 +5788,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");
@@ -5634,8 +5801,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");
@@ -5647,12 +5814,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");
@@ -5664,34 +5831,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"};
@@ -5701,9 +5871,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");
@@ -5711,9 +5882,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");
@@ -5723,13 +5895,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");
@@ -5740,10 +5913,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");
@@ -5754,10 +5928,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");
@@ -5768,10 +5943,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");
@@ -5784,11 +5960,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");
@@ -5803,12 +5979,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");
@@ -5817,12 +5993,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");
@@ -5833,12 +6010,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");
@@ -5849,7216 +6027,8230 @@ 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.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.do = this.do.bind(this);
- Entry.undo = this.undo.bind(this);
- this.editor = {};
- this.reporters = [];
- this._tempStorage = null;
- Entry.Command.editor = this.editor;
+ return c;
};
-(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.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;
}
+ 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|$)"));
};
- b.addReporter = function(a) {
- this.reporters.push(a);
- };
- b.removeReporter = function(a) {
- a = this.reporters.indexOf(a);
- -1 < a && this.reporters.splice(a, 1);
+ a.addClass = function(b) {
+ for (var a = 0;a < arguments.length;a++) {
+ b = arguments[a], this.hasClass(b) || (this.className += " " + b);
+ }
};
- 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);
- });
+ 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|$)"), " "));
}
};
-})(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;
-};
-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);
- } 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");
+ a.bindOnClick = function(b) {
+ $(this).on("click tab", function(a) {
+ a.stopImmediatePropagation();
+ b.call(this, a);
});
- this._view.appendChild(c);
- var d = Entry.createElement("ul");
- d.addClass("entryContainerListWorkspace");
- c.appendChild(d);
- this.listView_ = d;
- this.enableSort();
- }
+ };
+ 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;
- }
- 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.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.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.removeElement = function(a) {
+ a && a.parentNode && a.parentNode.removeChild(a);
};
-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.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]);
+ }
+ return b;
};
-Entry.Container.prototype.getAllObjects = function() {
- return this.objects_;
+Entry.parseNumber = function(a) {
+ return "string" != typeof a || isNaN(Number(a)) ? "number" != typeof a || isNaN(Number(a)) ? !1 : a : Number(a);
};
-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.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.getEntity = function(b) {
- if (b = this.getObject(b)) {
- return b.entity;
+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++;
}
- Entry.toast.alert(Lang.Msgs.runtime_error, Lang.Workspace.object_not_found, !0);
+ return a.substr(0, c);
};
-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.isChild = function(a, b) {
+ if (!b) {
+ for (;b.parentNode;) {
+ if ((b = b.parentNode) == a) {
+ return !0;
+ }
}
}
+ 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();
- return new Entry.State(Entry.container, Entry.container.moveElement, a, b, !0);
+Entry.launchFullScreen = function(a) {
+ a.requestFullscreen ? a.requestFullscreen() : a.mozRequestFulScreen ? a.mozRequestFulScreen() : a.webkitRequestFullscreen ? a.webkitRequestFullscreen() : a.msRequestFullScreen && a.msRequestFullScreen();
};
-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.exitFullScreen = function() {
+ document.exitFullScreen ? document.exitFullScreen() : document.mozCancelFullScreen ? document.mozCancelFullScreen() : document.webkitExitFullscreen && document.webkitExitFullscreen();
};
-Entry.Container.prototype.getDropdownList = function(b) {
- var a = [];
- switch(b) {
- case "sprites":
- var c = this.getCurrentObjects(), d = c.length;
- for (b = 0;b < d;b++) {
- var e = c[b];
- a.push([e.name, e.id]);
- }
- break;
- case "spritesWithMouse":
- c = this.getCurrentObjects();
- d = c.length;
- for (b = 0;b < d;b++) {
- e = c[b], a.push([e.name, e.id]);
- }
- a.push([Lang.Blocks.mouse_pointer, "mouse"]);
- break;
- case "spritesWithSelf":
- c = this.getCurrentObjects();
- d = c.length;
- for (b = 0;b < d;b++) {
- e = c[b], a.push([e.name, e.id]);
- }
- a.push([Lang.Blocks.self, "self"]);
- break;
- case "collision":
- a.push([Lang.Blocks.mouse_pointer, "mouse"]);
- c = this.getCurrentObjects();
- d = c.length;
- for (b = 0;b < d;b++) {
- e = c[b], a.push([e.name, e.id]);
- }
- a.push([Lang.Blocks.wall, "wall"]);
- a.push([Lang.Blocks.wall_up, "wall_up"]);
- a.push([Lang.Blocks.wall_down, "wall_down"]);
- a.push([Lang.Blocks.wall_right, "wall_right"]);
- a.push([Lang.Blocks.wall_left, "wall_left"]);
- break;
- case "pictures":
- if (!Entry.playground.object) {
- break;
- }
- c = Entry.playground.object.pictures;
- for (b = 0;b < c.length;b++) {
- d = c[b], a.push([d.name, d.id]);
- }
- break;
- case "messages":
- c = Entry.variableContainer.messages_;
- for (b = 0;b < c.length;b++) {
- d = c[b], a.push([d.name, d.id]);
- }
- break;
- case "variables":
- c = Entry.variableContainer.variables_;
- for (b = 0;b < c.length;b++) {
- d = c[b], d.object_ && d.object_ != Entry.playground.object.id || a.push([d.getName(), d.getId()]);
- }
- a && 0 !== a.length || a.push([Lang.Blocks.VARIABLE_variable, "null"]);
- break;
- case "lists":
- c = Entry.variableContainer.lists_;
- for (b = 0;b < c.length;b++) {
- d = c[b], a.push([d.getName(), d.getId()]);
- }
- a && 0 !== a.length || a.push([Lang.Blocks.VARIABLE_list, "null"]);
- break;
- case "scenes":
- c = Entry.scene.scenes_;
- for (b = 0;b < c.length;b++) {
- d = c[b], a.push([d.name, d.id]);
- }
- break;
- case "sounds":
- if (!Entry.playground.object) {
- break;
- }
- c = Entry.playground.object.sounds;
- for (b = 0;b < c.length;b++) {
- d = c[b], a.push([d.name, d.id]);
- }
- break;
- case "clone":
- a.push([Lang.Blocks.oneself, "self"]);
- d = this.objects_.length;
- for (b = 0;b < d;b++) {
- e = this.objects_[b], a.push([e.name, e.id]);
- }
- break;
- case "objectSequence":
- for (d = this.getCurrentObjects().length, b = 0;b < d;b++) {
- a.push([(b + 1).toString(), b.toString()]);
- }
- ;
- }
- a.length || (a = [[Lang.Blocks.no_target, "null"]]);
- return a;
+Entry.isPhone = function() {
+ return !1;
};
-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.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.mapObject = function(b, a) {
- for (var c = this.objects_.length, d = [], e = 0;e < c;e++) {
- d.push(b(this.objects_[e], a));
+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 d;
+ return b;
};
-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.nodeListToArray = function(a) {
+ for (var b = Array(a.length), c = -1, d = a.length;++c !== d;b[c] = a[c]) {
}
- return e;
+ return b;
};
-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.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.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;
+Entry.isArrowOrBackspace = function(a) {
+ return -1 < [37, 38, 39, 40, 8].indexOf(a);
};
-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.hexStringToBin = function(a) {
+ for (var b = [], c = 0;c < a.length - 1;c += 2) {
+ b.push(parseInt(a.substr(c, 2), 16));
}
- return e;
+ return String.fromCharCode.apply(String, 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));
- }
+Entry.findObjsByKey = function(a, b, c) {
+ for (var d = [], e = 0;e < a.length;e++) {
+ a[e][b] == c && d.push(a[e]);
}
- return e;
+ return d;
};
-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.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.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;
}
}
- return e;
+ return a;
};
-Entry.Container.prototype.getCachedPicture = function(b) {
- Entry.assert("string" == typeof b, "pictureId must be string");
- return this.cachedPicture[b];
+Entry.toRadian = function(a) {
+ return a * Math.PI / 180;
};
-Entry.Container.prototype.cachePicture = function(b, a) {
- this.cachedPicture[b] = a;
+Entry.toDegrees = function(a) {
+ return 180 * a / Math.PI;
};
-Entry.Container.prototype.toJSON = function() {
- for (var b = [], a = this.objects_.length, c = 0;c < a;c++) {
- b.push(this.objects_[c].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.takeSequenceSnapshot = function() {
- for (var b = this.objects_.length, a = this.objects_, c = 0;c < b;c++) {
- a[c].index = c;
+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.loadSequenceSnapshot = function() {
- for (var b = this.objects_.length, a = Array(b), c = 0;c < b;c++) {
- var d = this.objects_[c];
- a[d.index] = d;
- delete d.index;
+Entry.cutDecimal = function(a) {
+ return Math.round(100 * a) / 100;
+};
+Entry.getBrowserType = function() {
+ if (Entry.userAgent) {
+ return Entry.userAgent;
}
- this.objects_ = a;
- this.setCurrentObjects();
- Entry.stage.sortZorder();
- this.updateListView();
+ 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.getInputValue = function() {
- return this.inputValue.getValue();
+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.setInputValue = function(b) {
- b ? this.inputValue.setValue(b) : this.inputValue.setValue(0);
+Entry.isFloat = function(a) {
+ return /\d+\.{1}\d+/.test(a);
};
-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.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.setCopiedObject = function(b) {
- this.copiedObject = b;
+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.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.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;
+ return 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]);
+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 a;
+ return Math.min(b, 20);
};
-Entry.Container.prototype.setCurrentObjects = function() {
- this.currentObjects_ = this.getSceneObjects();
+Entry.convertToRoundedDecimals = function(a, b) {
+ return isNaN(a) || !this.isFloat(a) ? a : Number(Math.round(a + "e" + b) + "e-" + b);
};
-Entry.Container.prototype.getCurrentObjects = function() {
- var b = this.currentObjects_;
- b && 0 !== b.length || this.setCurrentObjects();
- return this.currentObjects_;
+Entry.attachEventListener = function(a, b, c) {
+ setTimeout(function() {
+ a.addEventListener(b, c);
+ }, 0);
};
-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();
- return b;
+Entry.deAttachEventListener = function(a, b, c) {
+ a.removeEventListener(b, c);
};
-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.isEmpty = function(a) {
+ if (!a) {
+ return !0;
+ }
+ for (var b in a) {
+ if (a.hasOwnProperty(b)) {
+ return !1;
}
- });
+ }
+ return !0;
};
-Entry.Container.prototype.showProjectAnswer = function() {
- var b = this.inputValue;
- b && b.setVisible(!0);
+Entry.Utils.disableContextmenu = function(a) {
+ if (a) {
+ $(a).on("contextmenu", function(b) {
+ b.stopPropagation();
+ b.preventDefault();
+ return !1;
+ });
+ }
};
-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.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.Container.prototype.getView = function() {
- return this._view;
+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.Container.prototype.resize = function() {
+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.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);
+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) {
+ b = b || "\ub7f0\ud0c0\uc784 \uc5d0\ub7ec \ubc1c\uc0dd";
+ Entry.toast && Entry.toast.alert(Lang.Msgs.warn, Lang.Workspace.check_runtime_error, !0);
+ Entry.engine && Entry.engine.toggleStop();
+ "workspace" === Entry.type && (Entry.container.selectObject(a.getCode().object.id, !0), a.view.getBoard().activateBlock(a));
+ throw Error(b);
+};
+window.requestAnimFrame = function() {
+ return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(a) {
+ window.setTimeout(a, 1E3 / 60);
};
- b.remove = function(a) {
- this.has(a) && (delete this.typeMap[this.data[a].type][a], delete this.data[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;
+ }
};
- b.get = function(a) {
- return this.data[a];
+ a.generateSetter = function(b) {
+ b.set = this.set;
};
- b.find = function() {
+ 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.clear = function() {
- this.data = {};
- this.typeMap = {};
+ a.generateObserve = function(b) {
+ b.observers = [];
+ b.observe = this.observe;
+ b.unobserve = this.unobserve;
+ b.notify = this.notify;
};
-})(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 + ">" + b + ">");
- if (void 0 === a) {
+ a.observe = function(b, a, d, e) {
+ d = new Entry.Observer(this.observers, b, a, d);
+ if (!1 !== e) {
+ b[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.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;
};
- return d;
+})(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 = function(b) {
- b = document.getElementById(b);
- return Entry.SVG.createElement(b);
+(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.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.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);
}
- }
- 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;
+ };
+ 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.SVG.attr = function(b, a) {
- if ("string" === typeof b) {
- var c = {};
- c[b] = a;
- b = c;
- }
- if (b) {
- b.href && (this.setAttributeNS(Entry.SVG.NS_XLINK, "href", b.href), delete b.href);
- for (var d in b) {
- this.setAttribute(d, b[d]);
+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.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();
}
- 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);
+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.setAttribute("class", a);
- return this;
+ 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.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.getPictureElement = function(a, b) {
+ if (a = this.getObject(b).getPicture(a)) {
+ return a.view;
}
- this.setAttribute("class", a);
- return this;
-};
-Entry.SVG.hasClass = function(b) {
- var a = this.getAttribute("class");
- return a ? a.match(new RegExp("(\\s|^)" + b + "(\\s|$)")) : !1;
-};
-Entry.SVG.remove = function() {
- this.parentNode && this.parentNode.removeChild(this);
+ throw Error("No picture found");
};
-Entry.SVG.removeAttr = function(b) {
- this.removeAttribute(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;
+ }
+ }
+ throw Error("No picture found");
};
-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.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.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.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.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.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.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.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.prototype.remove = function() {
- Entry.stage.unloadDialog(this);
- this.parent.dialog = null;
+Entry.Container.prototype.getAllObjects = function() {
+ return this.objects_;
};
-Entry.DoneProject = function(b) {
- this.generateView(b);
+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;
+ }
+ }
};
-var p = Entry.DoneProject.prototype;
-p.init = function(b) {
- this.projectId = b;
+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);
};
-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.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;
+ }
+ }
};
-p.getView = function() {
- return this.doneContainer;
+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);
};
-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.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 = 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];
- 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) {
- Entry.engine.updateMouseView();
- }), Entry.addEventListener("stageMouseOut", function(a) {
- Entry.engine.hideMouseView();
- }));
- Entry.addEventListener("run", function() {
- $(window).bind("keydown", b);
- });
- Entry.addEventListener("stop", function() {
- $(window).unbind("keydown", b);
+Entry.Container.prototype.getDropdownList = function(a) {
+ var b = [];
+ switch(a) {
+ case "sprites":
+ var c = this.getCurrentObjects(), d = c.length;
+ for (a = 0;a < d;a++) {
+ var e = c[a];
+ b.push([e.name, e.id]);
+ }
+ break;
+ case "spritesWithMouse":
+ c = this.getCurrentObjects();
+ d = c.length;
+ for (a = 0;a < d;a++) {
+ e = c[a], b.push([e.name, e.id]);
+ }
+ b.push([Lang.Blocks.mouse_pointer, "mouse"]);
+ break;
+ case "spritesWithSelf":
+ c = this.getCurrentObjects();
+ d = c.length;
+ for (a = 0;a < d;a++) {
+ e = c[a], b.push([e.name, e.id]);
+ }
+ b.push([Lang.Blocks.self, "self"]);
+ break;
+ case "collision":
+ b.push([Lang.Blocks.mouse_pointer, "mouse"]);
+ c = this.getCurrentObjects();
+ d = c.length;
+ for (a = 0;a < d;a++) {
+ e = c[a], b.push([e.name, e.id]);
+ }
+ b.push([Lang.Blocks.wall, "wall"]);
+ b.push([Lang.Blocks.wall_up, "wall_up"]);
+ b.push([Lang.Blocks.wall_down, "wall_down"]);
+ b.push([Lang.Blocks.wall_right, "wall_right"]);
+ b.push([Lang.Blocks.wall_left, "wall_left"]);
+ break;
+ case "pictures":
+ if (!Entry.playground.object) {
+ break;
+ }
+ c = Entry.playground.object.pictures;
+ for (a = 0;a < c.length;a++) {
+ d = c[a], b.push([d.name, d.id]);
+ }
+ break;
+ case "messages":
+ c = Entry.variableContainer.messages_;
+ for (a = 0;a < c.length;a++) {
+ d = c[a], b.push([d.name, d.id]);
+ }
+ break;
+ case "variables":
+ c = Entry.variableContainer.variables_;
+ for (a = 0;a < c.length;a++) {
+ d = c[a], d.object_ && d.object_ != Entry.playground.object.id || b.push([d.getName(), d.getId()]);
+ }
+ b && 0 !== b.length || b.push([Lang.Blocks.VARIABLE_variable, "null"]);
+ break;
+ case "lists":
+ c = Entry.variableContainer.lists_;
+ for (a = 0;a < c.length;a++) {
+ d = c[a], b.push([d.getName(), d.getId()]);
+ }
+ b && 0 !== b.length || b.push([Lang.Blocks.VARIABLE_list, "null"]);
+ break;
+ case "scenes":
+ c = Entry.scene.scenes_;
+ for (a = 0;a < c.length;a++) {
+ d = c[a], b.push([d.name, d.id]);
+ }
+ break;
+ case "sounds":
+ if (!Entry.playground.object) {
+ break;
+ }
+ c = Entry.playground.object.sounds;
+ for (a = 0;a < c.length;a++) {
+ d = c[a], b.push([d.name, d.id]);
+ }
+ break;
+ case "clone":
+ b.push([Lang.Blocks.oneself, "self"]);
+ d = this.objects_.length;
+ for (a = 0;a < d;a++) {
+ e = this.objects_[a], b.push([e.name, e.id]);
+ }
+ break;
+ case "objectSequence":
+ for (d = this.getCurrentObjects().length, a = 0;a < d;a++) {
+ b.push([(a + 1).toString(), a.toString()]);
+ }
+ ;
+ }
+ b.length || (b = [[Lang.Blocks.no_target, "null"]]);
+ return b;
+};
+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.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.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.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.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.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.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.Engine.prototype.start = function(b) {
- createjs.Ticker.setFPS(Entry.FPS);
- this.ticker = setInterval(this.update, Math.floor(1E3 / Entry.FPS));
+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.Engine.prototype.stop = function() {
- clearInterval(this.ticker);
- this.ticker = null;
+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.Engine.prototype.update = function() {
- Entry.engine.isState("run") && (Entry.engine.computeObjects(), Entry.hw.update());
+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.Engine.prototype.computeObjects = function() {
- Entry.container.mapObjectOnScene(this.computeFunction);
+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.Engine.prototype.computeFunction = function(b) {
- b.script.tick();
+Entry.Container.prototype.getCachedPicture = function(a) {
+ Entry.assert("string" == typeof a, "pictureId must be string");
+ return this.cachedPicture[a];
};
-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.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.Engine.prototype.isState = function(b) {
- return -1 < this.state.indexOf(b);
+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] = d;
+ delete d.index;
+ }
+ this.objects_ = b;
+ this.setCurrentObjects();
+ Entry.stage.sortZorder();
+ this.updateListView();
};
-Entry.Engine.prototype.run = function() {
- this.isState("run") ? this.toggleStop() : (this.isState("stop") || this.isState("pause")) && this.toggleRun();
+Entry.Container.prototype.getInputValue = function() {
+ return this.inputValue.getValue();
};
-Entry.Engine.prototype.toggleRun = function() {
- 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.setInputValue = function(a) {
+ a ? this.inputValue.setValue(a) : this.inputValue.setValue(0);
};
-Entry.Engine.prototype.toggleStop = function() {
- Entry.addActivity("stop");
- var b = Entry.container, a = Entry.variableContainer;
- b.mapEntity(function(a) {
+Entry.Container.prototype.resetSceneDuringRun = function() {
+ this.mapEntityOnScene(function(a) {
a.loadSnapshot();
a.object.filters = [];
a.resetFilter();
a.dialog && a.dialog.remove();
- a.brush && a.removeBrush();
- });
- a.mapVariable(function(a) {
- a.loadSnapshot();
+ a.shape && a.removeBrush();
});
- a.mapList(function(a) {
- a.loadSnapshot();
- a.updateView();
- });
- 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() {
- "pause" == this.state ? (this.state = "run", this.pauseButton.innerHTML = Lang.Workspace.pause) : (this.state = "pause", this.pauseButton.innerHTML = Lang.Workspace.restart, this.runButton.removeClass("entryRemove"), this.stopButton.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);
+ this.clearRunningStateOnScene();
};
-Entry.Engine.prototype.fireEventOnEntity = function(b, a) {
- "run" == this.state && Entry.container.mapEntityIncludeCloneOnScene(this.raiseEventOnEntity, [a, b]);
+Entry.Container.prototype.setCopiedObject = function(a) {
+ this.copiedObject = a;
};
-Entry.Engine.prototype.raiseEventOnEntity = function(b, a) {
- b === a[0] && b.parent.script.raiseEvent(a[1], b);
+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.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.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.Engine.prototype.raiseKeyEvent = function(b, a) {
- return b.parent.script.raiseEvent(a[0], b, String(a[1]));
+Entry.Container.prototype.setCurrentObjects = function() {
+ this.currentObjects_ = this.getSceneObjects();
};
-Entry.Engine.prototype.updateMouseView = function() {
- var b = Entry.stage.mouseCoordinate;
- this.mouseView.innerHTML = "X : " + b.x + ", Y : " + b.y;
- this.mouseView.removeClass("entryRemove");
+Entry.Container.prototype.getCurrentObjects = function() {
+ var a = this.currentObjects_;
+ a && 0 !== a.length || this.setCurrentObjects();
+ return this.currentObjects_;
};
-Entry.Engine.prototype.hideMouseView = function() {
- this.mouseView.addClass("entryRemove");
+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.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);
+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();
}
- popup.window_.appendChild(Entry.engine.view_);
- }
-};
-Entry.Engine.prototype.exitFullScreen = function() {
- document.webkitIsFullScreen || document.mozIsFullScreen || document.isFullScreen || (Entry.engine.footerView_.removeClass("entryRemove"), Entry.engine.headerView_.removeClass("entryRemove"));
+ });
};
-Entry.Engine.prototype.showProjectTimer = function() {
- Entry.engine.projectTimer && this.projectTimer.setVisible(!0);
+Entry.Container.prototype.showProjectAnswer = function() {
+ var a = this.inputValue;
+ a && a.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++) {
+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;
}
}
}
- b.setVisible(!1);
+ a.setVisible(!1);
}
};
-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.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.getView = function() {
+ return this._view;
};
-Entry.Engine.prototype.updateProjectTimer = function(b) {
- var a = Entry.engine.projectTimer, c = (new Date).getTime();
- a && ("undefined" == typeof b ? a.isPaused || a.setValue((c - a.start - a.pausedTime) / 1E3) : (a.setValue(b), a.pausedTime = 0, a.start = c));
+Entry.Container.prototype.resize = function() {
};
-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.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 + ">" + 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.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.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(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.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.SVG = function(a) {
+ a = document.getElementById(a);
+ return Entry.SVG.createElement(a);
};
-Entry.EntityObject.prototype.setRegY = function(b) {
- "textBox" == this.type && (b = 0);
- this.regY = b;
- this.object.regY = this.regY;
+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.getRegY = function() {
- return this.regY;
+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.setScaleX = function(b) {
- this.scaleX = b;
- this.object.scaleX = this.scaleX;
- this.parent.updateCoordinateView();
- this.updateDialog();
+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.getScaleX = function() {
- return this.scaleX;
+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.setScaleY = function(b) {
- this.scaleY = b;
- this.object.scaleY = this.scaleY;
- this.parent.updateCoordinateView();
- this.updateDialog();
+Entry.SVG.hasClass = function(a) {
+ var b = this.getAttribute("class");
+ return b ? b.match(new RegExp("(\\s|^)" + a + "(\\s|$)")) : !1;
};
-Entry.EntityObject.prototype.getScaleY = function() {
- return this.scaleY;
+Entry.SVG.remove = function() {
+ this.parentNode && this.parentNode.removeChild(this);
};
-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.SVG.removeAttr = function(a) {
+ this.removeAttribute(a);
};
-Entry.EntityObject.prototype.getSize = function() {
- return (this.getWidth() * Math.abs(this.getScaleX()) + this.getHeight() * Math.abs(this.getScaleY())) / 2;
+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.setWidth = function(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.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;
+ this.height = c;
+ this.notch = this.createSpeakNotch("ne");
+ this.update();
+ this.object.addChild(this.notch);
+ this.object.addChild(a);
};
-Entry.EntityObject.prototype.setColour = function(b) {
- b || (b = "#000000");
- this.colour = b;
- this.textObject && (this.textObject.color = this.colour);
+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.EntityObject.prototype.getColour = function() {
- return this.colour;
+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.setBGColour = function(b) {
- b || (b = "transparent");
- this.bgColor = b;
- this.updateBG();
+Entry.Dialog.prototype.remove = function() {
+ Entry.stage.unloadDialog(this);
+ this.parent.dialog = null;
};
-Entry.EntityObject.prototype.getBGColour = function() {
- return this.bgColor;
+Entry.DoneProject = function(a) {
+ this.generateView(a);
};
-Entry.EntityObject.prototype.setUnderLine = function(b) {
- void 0 === b && (b = !1);
- this.underLine = b;
- this.textObject.underLine = b;
+var p = Entry.DoneProject.prototype;
+p.init = function(a) {
+ this.projectId = a;
};
-Entry.EntityObject.prototype.getUnderLine = function() {
- return this.underLine;
+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.setStrike = function(b) {
- void 0 === b && (b = !1);
- this.strike = b;
- this.textObject.strike = b;
+p.getView = function() {
+ return this.doneContainer;
};
-Entry.EntityObject.prototype.getStrike = function() {
- return this.strike;
+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.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.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.syncFont = function() {
- this.textObject.font = this.getFont();
- Entry.stage.update();
- this.getLineBreak() || this.setWidth(this.textObject.getMeasuredWidth());
- Entry.stage.updateObject();
-};
-Entry.EntityObject.prototype.getFontType = function() {
- return this.fontType;
+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 {
+ 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.EntityObject.prototype.setFontType = function(b) {
- "textBox" == this.parent.objectType && (this.fontType = b ? b : "Nanum Gothic", this.syncFont());
+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) {
+ 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.getFontSize = function(b) {
- return this.fontSize;
+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.setFontSize = function(b) {
- "textBox" == this.parent.objectType && this.fontSize != b && (this.fontSize = b ? b : 20, this.syncFont(), this.alignTextBox());
+Entry.Engine.prototype.start = function(a) {
+ createjs.Ticker.setFPS(Entry.FPS);
+ this.ticker = setInterval(this.update, Math.floor(1E3 / Entry.FPS));
};
-Entry.EntityObject.prototype.setFontBold = function(b) {
- this.fontBold = b;
+Entry.Engine.prototype.stop = function() {
+ clearInterval(this.ticker);
+ this.ticker = null;
};
-Entry.EntityObject.prototype.toggleFontBold = function() {
- this.fontBold = !this.fontBold;
- this.syncFont();
- return this.fontBold;
+Entry.Engine.prototype.update = function() {
+ Entry.engine.isState("run") && (Entry.engine.computeObjects(), Entry.hw.update());
};
-Entry.EntityObject.prototype.setFontItalic = function(b) {
- this.fontItalic = b;
+Entry.Engine.prototype.computeObjects = function() {
+ Entry.container.mapObjectOnScene(this.computeFunction);
};
-Entry.EntityObject.prototype.toggleFontItalic = function() {
- this.fontItalic = !this.fontItalic;
- this.syncFont();
- return this.fontItalic;
+Entry.Engine.prototype.computeFunction = function(a) {
+ a.script.tick();
};
-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.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;
}
- this.setFont(c.join(" ") + " " + b);
+ return b;
};
-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.Engine.prototype.isState = function(a) {
+ return -1 < this.state.indexOf(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());
+Entry.Engine.prototype.run = function() {
+ this.isState("run") ? this.toggleStop() : (this.isState("stop") || this.isState("pause")) && this.toggleRun();
};
-Entry.EntityObject.prototype.getText = function() {
- return this.text;
+Entry.Engine.prototype.toggleRun = function() {
+ 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.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.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.EntityObject.prototype.getTextAlign = function() {
- return this.textAlign;
+Entry.Engine.prototype.togglePause = function() {
+ "pause" == this.state ? (this.state = "run", this.pauseButton.innerHTML = Lang.Workspace.pause) : (this.state = "pause", this.pauseButton.innerHTML = Lang.Workspace.restart, this.runButton.removeClass("entryRemove"), this.stopButton.removeClass("entryRemove"));
};
-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.prototype.fireEvent = function(a) {
+ "run" == this.state && Entry.container.mapEntityIncludeCloneOnScene(this.raiseEvent, a);
};
-Entry.EntityObject.prototype.getLineBreak = function() {
- return this.lineBreak;
+Entry.Engine.prototype.raiseEvent = function(a, b) {
+ a.parent.script.raiseEvent(b, a);
};
-Entry.EntityObject.prototype.setVisible = function(b) {
- void 0 === b && (b = !0);
- this.visible = b;
- this.object.visible = this.visible;
- this.dialog && this.syncDialogVisible();
- return this.visible;
+Entry.Engine.prototype.fireEventOnEntity = function(a, b) {
+ "run" == this.state && Entry.container.mapEntityIncludeCloneOnScene(this.raiseEventOnEntity, [b, a]);
};
-Entry.EntityObject.prototype.getVisible = function() {
- return this.visible;
+Entry.Engine.prototype.raiseEventOnEntity = function(a, b) {
+ a === b[0] && a.parent.script.raiseEvent(b[1], a);
};
-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());
- } 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.dispatchEvent("updateObject");
+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.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;
- }
- }
- 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.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.Engine.prototype.raiseKeyEvent = function(a, b) {
+ return a.parent.script.raiseEvent(b[0], a, String(b[1]));
};
-Entry.EntityObject.prototype.takeSnapshot = function() {
- this.snapshot_ = this.toJSON();
- this.collision = Entry.Utils.COLLISION.NONE;
+Entry.Engine.prototype.updateMouseView = function() {
+ var a = Entry.stage.mouseCoordinate;
+ this.mouseView.textContent = "X : " + a.x + ", Y : " + a.y;
+ this.mouseView.removeClass("entryRemove");
};
-Entry.EntityObject.prototype.loadSnapshot = function() {
- this.snapshot_ && this.syncModel_(this.snapshot_);
- "sprite" == this.parent.objectType && this.setImage(this.parent.getPicture());
+Entry.Engine.prototype.hideMouseView = function() {
+ this.mouseView.addClass("entryRemove");
};
-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.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.view_);
}
+ Entry.windowResized.notify();
};
-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.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.exitFullScreen = function() {
+ document.webkitIsFullScreen || document.mozIsFullScreen || document.isFullScreen || (Entry.engine.footerView_.removeClass("entryRemove"), Entry.engine.headerView_.removeClass("entryRemove"));
+ Entry.windowResized.notify();
};
-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.showProjectTimer = function() {
+ Entry.engine.projectTimer && this.projectTimer.setVisible(!0);
};
-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;
+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;
+ }
}
- b.maxHeight = this.getHeight();
- } else {
- b.x = 0, b.y = 0;
}
+ a.setVisible(!1);
}
};
-Entry.EntityObject.prototype.syncDialogVisible = function() {
- this.dialog && (this.dialog.object.visible = this.visible);
+Entry.Engine.prototype.clearTimer = function() {
+ clearInterval(this.ticker);
+ clearInterval(this.projectTimer.tick);
};
-Entry.Helper = function() {
- this.visible = !1;
+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));
};
-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.stopProjectTimer = function() {
+ var a = this.projectTimer;
+ a && (this.updateProjectTimer(0), a.isPaused = !1, a.isInit = !1, a.pausedTime = 0, clearInterval(a.tick));
};
-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.updateProjectTimer = function(a) {
+ var b = Entry.engine.projectTimer, c = (new Date).getTime();
+ b && ("undefined" == typeof a ? b.isPaused || b.setValue((c - b.start - b.pausedTime) / 1E3) : (b.setValue(a), b.pausedTime = 0, b.start = c));
};
-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.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));
+ });
+ this.object.on("pressup", function(b) {
+ Entry.dispatchEvent("entityClickCanceled", this.entity);
+ this.cursor = "pointer";
+ this.entity.checkCommand();
+ });
+ 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());
+ });
};
-p.getView = function() {
- return this.view;
+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);
};
-p.resize = function() {
+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.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]});
- }
- }
- this.data = c;
+Entry.EntityObject.prototype.doCommand = function() {
+ this.isCommandValid = !0;
};
-Entry.ActivityReporter = function() {
- this._activities = [];
+Entry.EntityObject.prototype.checkCommand = function() {
+ Entry.engine.isState("stop") && !this.isCommandValid && Entry.dispatchEvent("cancelLastCommand");
};
-(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);
- }
- 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;
+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.State.prototype.generateMessage = function() {
+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 = 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.EntityObject.prototype.getX = function() {
+ return this.x;
};
-Entry.StateManager.prototype.generateView = function(b, a) {
+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.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.getY = function() {
+ return this.y;
};
-Entry.StateManager.prototype.cancelLastCommand = function() {
- this.canUndo() && (this.undoStack_.pop(), this.updateView(), Entry.creationChangedEvent && Entry.creationChangedEvent.notify());
+Entry.EntityObject.prototype.getDirection = function() {
+ return this.direction;
};
-Entry.StateManager.prototype.getLastCommand = function() {
- return this.undoStack_[this.undoStack_.length - 1];
+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.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.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.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.getRotation = function() {
+ return this.rotation;
};
-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.setRegX = function(a) {
+ "textBox" == this.type && (a = 0);
+ this.regX = a;
+ this.object.regX = this.regX;
+ Entry.requestUpdate = !0;
};
-Entry.StateManager.prototype.startRestore = function() {
- this.isRestore = !0;
+Entry.EntityObject.prototype.getRegX = function() {
+ return this.regX;
};
-Entry.StateManager.prototype.endRestore = function() {
- this.isRestore = !1;
+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.isRestoring = function() {
- return this.isRestore;
+Entry.EntityObject.prototype.getRegY = function() {
+ return this.regY;
};
-Entry.StateManager.prototype.startIgnore = function() {
- this.isIgnore = !0;
+Entry.EntityObject.prototype.setScaleX = function(a) {
+ this.scaleX = a;
+ this.object.scaleX = this.scaleX;
+ this.parent.updateCoordinateView();
+ this.updateDialog();
+ Entry.requestUpdate = !0;
};
-Entry.StateManager.prototype.endIgnore = function() {
- this.isIgnore = !1;
+Entry.EntityObject.prototype.getScaleX = function() {
+ return this.scaleX;
};
-Entry.StateManager.prototype.isIgnoring = function() {
- return this.isIgnore;
+Entry.EntityObject.prototype.setScaleY = function(a) {
+ this.scaleY = a;
+ this.object.scaleY = this.scaleY;
+ this.parent.updateCoordinateView();
+ this.updateDialog();
+ Entry.requestUpdate = !0;
};
-Entry.StateManager.prototype.canUndo = function() {
- return 0 < this.undoStack_.length && Entry.engine.isState("stop");
+Entry.EntityObject.prototype.getScaleY = function() {
+ return this.scaleY;
};
-Entry.StateManager.prototype.canRedo = function() {
- return 0 < this.redoStack_.length && Entry.engine.isState("stop");
+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.StateManager.prototype.addStamp = function() {
- this.stamp = Entry.generateHash();
- this.undoStack_.length && (this.undoStack_[this.undoStack_.length - 1].stamp = this.stamp);
+Entry.EntityObject.prototype.getSize = function() {
+ return (this.getWidth() * Math.abs(this.getScaleX()) + this.getHeight() * Math.abs(this.getScaleY())) / 2;
};
-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.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.StateManager.prototype.addActivity = function(b) {
- Entry.reporter && Entry.reporter.report(new Entry.State(b));
+Entry.EntityObject.prototype.getWidth = function() {
+ return this.width;
};
-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.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.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 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.EntityObject.prototype.getHeight = function() {
+ return this.height;
};
-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.setColour = function(a) {
+ a || (a = "#000000");
+ this.colour = a;
+ this.textObject && (this.textObject.color = this.colour);
+ Entry.requestUpdate = !0;
};
-Entry.EntryObject.prototype.setText = function(b) {
- Entry.assert("string" == typeof b, "object text must be string");
- this.text = b;
+Entry.EntityObject.prototype.getColour = function() {
+ return this.colour;
};
-Entry.EntryObject.prototype.setScript = function(b) {
- this.script = b;
+Entry.EntityObject.prototype.setBGColour = function(a) {
+ a || (a = "transparent");
+ this.bgColor = a;
+ this.updateBG();
+ Entry.requestUpdate = !0;
};
-Entry.EntryObject.prototype.getScriptText = function() {
- return JSON.stringify(this.script.toJSON());
+Entry.EntityObject.prototype.getBGColour = function() {
+ return this.bgColor;
};
-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.setUnderLine = function(a) {
+ void 0 === a && (a = !1);
+ this.underLine = a;
+ this.textObject.underLine = a;
+ Entry.requestUpdate = !0;
};
-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.getUnderLine = function() {
+ return this.underLine;
};
-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.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.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.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.select = function(b) {
- console.log(this);
+Entry.EntityObject.prototype.syncFont = function() {
+ this.textObject.font = this.getFont();
+ Entry.stage.update();
+ this.getLineBreak() || this.setWidth(this.textObject.getMeasuredWidth());
+ Entry.stage.updateObject();
+ Entry.requestUpdate = !0;
};
-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.getFontType = function() {
+ return this.fontType;
};
-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.setFontType = function(a) {
+ "textBox" == this.parent.objectType && (this.fontType = a ? a : "Nanum Gothic", this.syncFont());
};
-Entry.EntryObject.prototype.getPicture = function(b) {
- if (!b) {
- return this.selectedPicture;
+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 < e;d++) {
+ ("bold" === b[d] || "italic" === b[d] || -1 < b[d].indexOf("px")) && c.push(b[d]);
}
- b = b.trim();
- for (var a = this.pictures, c = a.length, d = 0;d < c;d++) {
- if (a[d].id == b) {
- return a[d];
+ this.setFont(c.join(" ") + " " + a);
+};
+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];
- }
- throw Error("No picture found");
};
-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.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.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.getText = function() {
+ return this.text;
};
-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.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.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.getTextAlign = function() {
+ return this.textAlign;
};
-Entry.EntryObject.prototype.getRotateMethod = function() {
- this.rotateMethod || (this.rotateMethod = "free");
- return this.rotateMethod;
+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();
+ }
};
-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.getLineBreak = function() {
+ return this.lineBreak;
};
-Entry.EntryObject.prototype.initRotateValue = function(b) {
- this.rotateMethod != b && (b = this.entity, b.rotation = 0, b.direction = 90, b.flip = !1);
+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.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.getVisible = function() {
+ return this.visible;
};
-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.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;
+ };
+ }
+ Entry.dispatchEvent("updateObject");
};
-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.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.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.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.EntryObject.prototype.isSelected = function() {
- return this.isSelected_;
+Entry.EntityObject.prototype.updateDialog = function() {
+ this.dialog && this.dialog.update();
};
-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.takeSnapshot = function() {
+ this.snapshot_ = this.toJSON();
+ this.collision = Entry.Utils.COLLISION.NONE;
};
-Entry.EntryObject.prototype.destroy = function() {
- Entry.stage.unloadEntity(this.entity);
- this.view_ && Entry.removeElement(this.view_);
+Entry.EntityObject.prototype.loadSnapshot = function() {
+ this.snapshot_ && this.syncModel_(this.snapshot_);
+ "sprite" == this.parent.objectType && this.setImage(this.parent.getPicture());
+ Entry.requestUpdate = !0;
};
-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];
+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();
}
- 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());
- }
- for (b = 0;b < d.length;b++) {
- a.lists.push(d[b].clone());
- }
+Entry.EntityObject.prototype.clearExecutor = function() {
+ this.parent.script.clearExecutorsByEntity(this);
};
-Entry.EntryObject.prototype.getLock = function() {
- return this.lock;
+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.EntryObject.prototype.setLock = function(b) {
- this.lock = b;
- Entry.stage.updateObject();
- 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.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) {
+ var b = Entry.playground.mainWorkspace;
+ b && (this._targetFuncBlock = b.getBlockMenu().getCategoryCodes("func").createThread([{type:"func_" + a.id}]), a.blockMenuBlock = this._targetFuncBlock);
+};
+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.addStampEntity = function(b) {
- b = new Entry.StampEntity(this, b);
- Entry.stage.loadEntity(b);
- this.clonedEntities.push(b);
- Entry.stage.sortZorder();
+Entry.Func.clearThreads = function() {
+ this.threads = {};
};
-Entry.EntryObject.prototype.getClonedEntities = 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("
q?(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);0 g?(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);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&& -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 this._bannedClass.indexOf(a)&&this._bannedClass.push(a);this.align(b)};b.unbanClass=function(a,b){var d=this._bannedClass.indexOf(a);-1 b&&(a.preventDefault(),this.selectMenu(b-49))};b.setPatternRectFill=function(a){this.patternRect.attr({fill:a})};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, +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);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)}},robotis_openCM70_cm_buzzer_melody:{color:"#00979D",skeleton:"basic",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"],["14","14"],["15","15"],["16","16"],["17", +"17"],["18","18"],["19","19"],["20","20"],["21","21"],["22","22"],["23","23"],["24","24"]],value:"0",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null],type:"robotis_openCM70_cm_buzzer_melody"},paramsKeyMap:{CM_BUZZER_MELODY:0},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func: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)}},robotis_openCM70_cm_sound_detected_clear:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"robotis_openCM70_cm_sound_detected_clear"},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func: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)}},robotis_openCM70_cm_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.robotis_common_red_color,"CM_LED_R"],[Lang.Blocks.robotis_common_green_color,"CM_LED_G"],[Lang.Blocks.robotis_common_blue_color,"CM_LED_B"]],value:"CM_LED_R",fontSize:11},{type:"Dropdown", +options:[[Lang.Blocks.robotis_common_on,"1"],[Lang.Blocks.robotis_common_off,"0"]],value:"1",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,null],type:"robotis_openCM70_cm_led"},paramsKeyMap:{CM_LED:0,VALUE:1},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func: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)}},robotis_openCM70_cm_motion:{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:["1"]},null],type:"robotis_openCM70_cm_motion"},paramsKeyMap:{VALUE:0},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func: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)}}, +robotis_openCM70_aux_motor_speed:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.robotis_common_port_1,"1"],[Lang.Blocks.robotis_common_port_2,"2"]],value:"1",fontSize:11},{type:"Dropdown",options:[[Lang.Blocks.robotis_common_clockwhise,"CW"],[Lang.Blocks.robotis_common_counter_clockwhise,"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:"number", +params:["500"]},null],type:"robotis_openCM70_aux_motor_speed"},paramsKeyMap:{PORT:0,DIRECTION_ANGLE:1,VALUE:2},"class":"robotis_openCM70_cm",isNotFor:["robotis_openCM70"],func: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 c&&(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,65535 a&&(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;d a.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;c h&&(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(100 m?(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,0 m?(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,0 m?(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);0 f?(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);0 f?(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;f this._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)&&!this.isInBlockMenu&&a.forEach(function(a){Entry.Utils.isFunction(a)&&a(b)})};Entry.BlockView.PARAM_SPACE=5;Entry.BlockView.DRAG_RADIUS=5; -(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 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()}},n={text:Lang.Blocks.Delete_Blocks,enable:k.isDeletable(),callback:function(){Entry.do("destroyBlock",h.block)}};f.push(g);f.push(l);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()}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._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)&&!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 e||d.splice(e,1)}};b.raiseEvent=function(a,b,d){a=this._eventMap[a];var e=[];if(void 0!==a){for(var f=0;f 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})};b.toJSON=function(){for(var a= -this.getThreads(),b=[],d=0,e=a.length;d b&&(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":"9pt"});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 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=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)&&!this.isInBlockMenu&&b.forEach(function(b){Entry.Utils.isFunction(b)&&b(a)})};Entry.BlockView.PARAM_SPACE=5;Entry.BlockView.DRAG_RADIUS=5; +(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;g 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(b){$(document).unbind(".block");m.terminateDrag(b);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()}},n={text:Lang.Blocks.Delete_Blocks,enable:k.isDeletable(),callback:function(){Entry.do("destroyBlock",h.block)}};f.push(g);f.push(l);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))}};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._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)&&!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 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(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;for(e=0;e 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;e 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[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;f d.endPoint)f=h+1;else{e=d.blocks;for(f=0;f b||a.splice(b,1))};a.raiseEvent=function(b,a,d){b=this._eventMap[b];var e=[];if(void 0!==b){for(var f=0;f b||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;d a;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(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: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=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);this.patternRect=Entry.Utils.addBlockPattern(this.svg, -this.suffix)};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;for(e=0;e 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;e 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}};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.endPoint)f=h+1;else{e=d.blocks;for(f=0;f 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 =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 alphaThreshold at one coordinate - pixelIntersection = _compareAlphaValues(imageData1,imageData2,intersection.width,intersection.height,alphaThreshold, getRect); + pixelIntersection = _compareAlphaValues(imageData1,imageData2,intersection.width / threshold,intersection.height,alphaThreshold / threshold, getRect); if ( pixelIntersection ) { pixelIntersection.x += intersection.x; @@ -147,18 +151,15 @@ this.ndgmr = this.ndgmr || {}; ctx.restore(); ctx.save(); //ctx.clearRect(0,0,intersetion.width,intersetion.height); - ctx.rotate(_getParentalCumulatedProperty(bitmap,'rotation')*(Math.PI/180)); - ctx.scale(_getParentalCumulatedProperty(bitmap,'scaleX','*'),_getParentalCumulatedProperty(bitmap,'scaleY','*')); - ctx.translate(-bl.x-intersetion['rect'+i].regX,-bl.y-intersetion['rect'+i].regY); + ctx.rotate(_getParentalCumulatedProperty(bitmap,'rotation')*(Math.PI/181)); + ctx.scale(_getParentalCumulatedProperty(bitmap,'scaleX','*') / threshold,_getParentalCumulatedProperty(bitmap,'scaleY','*') / threshold); + ctx.translate((-bl.x-intersetion['rect'+i].regX) / threshold,( -bl.y-intersetion['rect'+i].regY) / threshold); if ( (sr = bitmap.sourceRect) != undefined ) { ctx.drawImage(image,sr.x,sr.y,sr.width,sr.height,0,0,sr.width,sr.height); } else { - ctx.drawImage(image,0,0,image.width,image.height); + ctx.drawImage(image,0,0,image.width / threshold,image.height / threshold); } - if (intersection.width === 0 || intersection.height == 0) - return false; - else - return ctx.getImageData(0, 0, intersetion.width, intersetion.height).data; + return ctx.getImageData(0, 0, intersetion.width / threshold, intersetion.height / threshold).data; } var _compareAlphaValues = function(imageData1,imageData2,width,height,alphaThreshold,getRect) { diff --git a/src/container.js b/src/container.js index 5448235dcd..3276ef2242 100644 --- a/src/container.js +++ b/src/container.js @@ -471,6 +471,7 @@ Entry.Container.prototype.moveElement = function(start, end, isCallFromState) { this.objects_.splice(endIndex, 0, this.objects_.splice(startIndex, 1)[0]); this.setCurrentObjects(); Entry.container.updateListView(); + Entry.requestUpdate = true; return new Entry.State(Entry.container, Entry.container.moveElement, endIndex, startIndex, true); diff --git a/src/engine.js b/src/engine.js index f152341c61..81eb5c8c5b 100644 --- a/src/engine.js +++ b/src/engine.js @@ -14,6 +14,7 @@ Entry.Engine = function() { this.isUpdating = true; this.speeds = [1, 15, 30, 45, 60]; + this._mouseMoved = false;; if (Entry.keyPressed) Entry.keyPressed.attach(this, this.captureKeyEvent); @@ -32,8 +33,8 @@ Entry.Engine = function() { }); if (Entry.type != 'phone') { Entry.addEventListener('stageMouseMove', function(e){ - Entry.engine.updateMouseView(); - }); + this._mouseMoved = true; + }.bind(this)); Entry.addEventListener('stageMouseOut', function(e){ Entry.engine.hideMouseView(); }); @@ -57,6 +58,13 @@ Entry.Engine = function() { if(arrows.indexOf(code) > -1) e.preventDefault(); } + + setInterval(function() { + if (this._mouseMoved) { + this.updateMouseView(); + this._mouseMoved = false; + } + }.bind(this), 100) }; /** @@ -645,7 +653,7 @@ Entry.Engine.prototype.raiseKeyEvent = function(entity, param) { */ Entry.Engine.prototype.updateMouseView = function() { var coordinate = Entry.stage.mouseCoordinate; - this.mouseView.innerHTML = 'X : ' + coordinate.x + ', Y : ' + coordinate.y; + this.mouseView.textContent = 'X : ' + coordinate.x + ', Y : ' + coordinate.y; this.mouseView.removeClass('entryRemove'); }; @@ -675,6 +683,7 @@ Entry.Engine.prototype.toggleFullscreen = function() { this.popup.remove(); this.popup = null; } + Entry.windowResized.notify(); }; Entry.Engine.prototype.exitFullScreen = function() { @@ -685,6 +694,7 @@ Entry.Engine.prototype.exitFullScreen = function() { Entry.engine.footerView_.removeClass('entryRemove'); Entry.engine.headerView_.removeClass('entryRemove'); } + Entry.windowResized.notify(); }; diff --git a/src/entity.js b/src/entity.js index 886394f165..a1e6941b49 100644 --- a/src/entity.js +++ b/src/entity.js @@ -181,6 +181,7 @@ Entry.EntityObject.prototype.setX = function(x) { if (!this.isClone) this.parent.updateCoordinateView(); this.updateDialog(); + Entry.requestUpdate = true; }; /** @@ -204,6 +205,7 @@ Entry.EntityObject.prototype.setY = function(y) { if (!this.isClone) this.parent.updateCoordinateView(); this.updateDialog(); + Entry.requestUpdate = true; }; /** @@ -246,6 +248,7 @@ Entry.EntityObject.prototype.setDirection = function(direction, flippable) { if (!this.isClone) this.parent.updateRotationView(); Entry.dispatchEvent('updateObject'); + Entry.requestUpdate = true; }; /** @@ -263,6 +266,7 @@ Entry.EntityObject.prototype.setRotation = function(rotation) { if (!this.isClone) this.parent.updateRotationView(); Entry.dispatchEvent('updateObject'); + Entry.requestUpdate = true; }; /** @@ -283,7 +287,7 @@ Entry.EntityObject.prototype.setRegX = function(regX) { /** @type {number} */ this.regX = regX; this.object.regX = this.regX; - + Entry.requestUpdate = true; }; /** @@ -304,6 +308,7 @@ Entry.EntityObject.prototype.setRegY = function(regY) { /** @type {number} */ this.regY = regY; this.object.regY = this.regY; + Entry.requestUpdate = true; }; /** @@ -324,6 +329,7 @@ Entry.EntityObject.prototype.setScaleX = function(scaleX) { this.object.scaleX = this.scaleX; this.parent.updateCoordinateView(); this.updateDialog(); + Entry.requestUpdate = true; }; /** @@ -344,6 +350,7 @@ Entry.EntityObject.prototype.setScaleY = function(scaleY) { this.object.scaleY = this.scaleY; this.parent.updateCoordinateView(); this.updateDialog(); + Entry.requestUpdate = true; }; /** @@ -366,6 +373,7 @@ Entry.EntityObject.prototype.setSize = function(size) { this.setScaleY(this.getScaleY() * scale); if (!this.isClone) this.parent.updateCoordinateView(); + Entry.requestUpdate = true; }; /** @@ -388,6 +396,7 @@ Entry.EntityObject.prototype.setWidth = function(width) { this.textObject.lineWidth = this.width; this.updateDialog(); this.updateBG(); + Entry.requestUpdate = true; }; /** @@ -411,6 +420,7 @@ Entry.EntityObject.prototype.setHeight = function(height) { } this.updateDialog(); this.updateBG(); + Entry.requestUpdate = true; }; /** @@ -432,6 +442,7 @@ Entry.EntityObject.prototype.setColour = function(colour) { this.colour = colour; if (this.textObject) this.textObject.color = this.colour; + Entry.requestUpdate = true; }; /** @@ -453,6 +464,7 @@ Entry.EntityObject.prototype.setBGColour = function(colour) { this.bgColor = colour; this.updateBG(); //this.object.color = this.colour; + Entry.requestUpdate = true; }; /** @@ -468,6 +480,7 @@ Entry.EntityObject.prototype.setUnderLine = function(underLine) { underLine = false; this.underLine = underLine; this.textObject.underLine = underLine; + Entry.requestUpdate = true; }; Entry.EntityObject.prototype.getUnderLine = function() { @@ -479,6 +492,7 @@ Entry.EntityObject.prototype.setStrike = function(strike) { strike = false; this.strike = strike; this.textObject.strike = strike; + Entry.requestUpdate = true; }; Entry.EntityObject.prototype.getStrike = function() { @@ -543,6 +557,7 @@ Entry.EntityObject.prototype.syncFont = function() { this.setWidth(this.textObject.getMeasuredWidth()); } Entry.stage.updateObject(); + Entry.requestUpdate = true; }; /** @@ -588,6 +603,7 @@ Entry.EntityObject.prototype.setFontSize = function(fontSize) { */ Entry.EntityObject.prototype.setFontBold = function(isFontBold) { this.fontBold = isFontBold; + Entry.requestUpdate = true; }; /** @@ -604,6 +620,7 @@ Entry.EntityObject.prototype.toggleFontBold = function() { */ Entry.EntityObject.prototype.setFontItalic = function(isFontItalic) { this.fontItalic = isFontItalic; + Entry.requestUpdate = true; }; /** @@ -750,6 +767,7 @@ Entry.EntityObject.prototype.setVisible = function(visible) { this.object.visible = this.visible; if (this.dialog) this.syncDialogVisible(); + Entry.requestUpdate = true; return this.visible; }; @@ -806,6 +824,7 @@ Entry.EntityObject.prototype.setImage = function(pictureModel) { thisPointer.object.cache(0,0,thisPointer.getWidth(),thisPointer.getHeight()); //Entry.dispatchEvent('updateObject'); thisPointer = null; + Entry.requestUpdate = true; }; } else { Entry.image = image; @@ -905,6 +924,7 @@ Entry.EntityObject.prototype.applyFilter = function() { } return true; } + Entry.requestUpdate = true; }; @@ -919,6 +939,7 @@ Entry.EntityObject.prototype.resetFilter = function() { this.object.alpha = this.effect.alpha; this.object.cache(0,0,this.getWidth(),this.getHeight()); + Entry.requestUpdate = true; }; /** @@ -945,6 +966,7 @@ Entry.EntityObject.prototype.loadSnapshot = function() { this.syncModel_(this.snapshot_); if (this.parent.objectType == 'sprite') this.setImage(this.parent.getPicture()); + Entry.requestUpdate = true; }; /** @@ -1005,6 +1027,7 @@ Entry.EntityObject.prototype.toJSON = function() { */ Entry.EntityObject.prototype.setInitialEffectValue = function () { this.effect = this.getInitialEffectValue(); + Entry.requestUpdate = true; }; /* diff --git a/src/object.js b/src/object.js index b1992db5c4..5266e7b3fd 100644 --- a/src/object.js +++ b/src/object.js @@ -87,6 +87,7 @@ Entry.EntryObject = function(model) { image.onload = function(e) { Entry.container.cachePicture(picture.id, image); Entry.Loader.removeQueue(); + Entry.requestUpdate = true; }; } } diff --git a/src/playground.js b/src/playground.js index dbfc61bce4..f777d70bb2 100644 --- a/src/playground.js +++ b/src/playground.js @@ -1260,8 +1260,10 @@ Entry.Playground.prototype.flushPlayground = function () { Entry.Playground.prototype.refreshPlayground = function () { if (Entry.playground && Entry.playground.view_) { - this.injectPicture(); - this.injectSound(); + if (this.getViewMode() === "picture") + this.injectPicture(); + if (this.getViewMode() === "sound") + this.injectSound(); } }; diff --git a/src/scene.js b/src/scene.js index 8b3ef1bbc9..7db99d4a35 100644 --- a/src/scene.js +++ b/src/scene.js @@ -314,6 +314,7 @@ Entry.Scene.prototype.selectScene = function(scene) { Entry.stage.sortZorder(); Entry.container.updateListView(); this.updateView(); + Entry.requestUpdate = true; }; /** diff --git a/src/stage.js b/src/stage.js index d4387bf07e..dee17451a1 100644 --- a/src/stage.js +++ b/src/stage.js @@ -5,6 +5,8 @@ */ 'use strict'; +goog.require('Entry.Utils'); + /** * class for a canvas * @constructor @@ -85,9 +87,14 @@ Entry.Stage.prototype.initStage = function(canvas) { // Entry.container.selectObject(); Entry.stage.isObjectClick = false; }); + + Entry.windowResized.attach(this, function() { + Entry.stage.updateBoundRect(); + }); + var moveFunc = function(e){ e.preventDefault(); - var roundRect = this.getBoundingClientRect(); + var roundRect = Entry.stage.getBoundRect(); var x, y; if (Entry.getBrowserType().indexOf("IE") > -1) { x = ((e.pageX - roundRect.left - document.documentElement.scrollLeft) / roundRect.width - 0.5) * 480; @@ -109,6 +116,7 @@ Entry.Stage.prototype.initStage = function(canvas) { canvas.onmouseout = function(e) { Entry.dispatchEvent('stageMouseOut'); }; + Entry.addEventListener('updateObject', function(e){ if (Entry.engine.isState('stop')) Entry.stage.updateObject(); @@ -130,8 +138,10 @@ Entry.Stage.prototype.initStage = function(canvas) { this.initWall(); + this.render(); }; + Entry.Stage.prototype.render = function() { if (Entry.stage.timer) clearTimeout(Entry.stage.timer); @@ -145,6 +155,10 @@ Entry.Stage.prototype.render = function() { * redraw canvas */ Entry.Stage.prototype.update = function() { + if (!Entry.requestUpdate) { + Entry.requestUpdate = false; + return; + } if (Entry.engine.isState('stop') && this.objectUpdated) { this.canvas.update(); this.objectUpdated = false; @@ -153,6 +167,7 @@ Entry.Stage.prototype.update = function() { } if ( this.inputField && !this.inputField._isHidden ) this.inputField.render(); + Entry.requestUpdate = false; }; /** @@ -199,7 +214,7 @@ Entry.Stage.prototype.loadVariable = function(variable) { var variableView = variable.view_; this.variables[variable.id] = variableView; this.variableContainer.addChild(variableView); - this.canvas.update(); + Entry.requestUpdate = true; }; /** @@ -209,7 +224,7 @@ Entry.Stage.prototype.loadVariable = function(variable) { Entry.Stage.prototype.removeVariable = function(variable) { var variableView = variable.view_; this.variableContainer.removeChild(variableView); - this.canvas.update(); + Entry.requestUpdate = true; }; /** @@ -310,6 +325,7 @@ Entry.Stage.prototype.initHandle = function() { * object -> handle */ Entry.Stage.prototype.updateObject = function() { + Entry.requestUpdate = true; this.handle.setDraggable(true); if (this.editEntity) return; @@ -682,3 +698,13 @@ Entry.Stage.prototype.moveSprite = function (e) { this.updateObject(); }; +Entry.Stage.prototype.getBoundRect = function (e) { + if (!this._boundRect) + this.updateBoundRect(); + return this._boundRect; +}; + +Entry.Stage.prototype.updateBoundRect = function (e) { + this._boundRect = this.canvas.canvas.getBoundingClientRect(); +}; + diff --git a/src/util/utils.js b/src/util/utils.js index 1db36f77bc..ee795334db 100644 --- a/src/util/utils.js +++ b/src/util/utils.js @@ -1064,7 +1064,8 @@ Entry.Utils.addBlockPattern = function (boardSvgDom, suffix) { patternTransform: "translate(12, 0)", x: 0, y: 0, width: 125, - height: 33 + height: 33, + style: "display: none" }); var group = pattern.elem('g'); @@ -1088,7 +1089,10 @@ Entry.Utils.addBlockPattern = function (boardSvgDom, suffix) { }); } - return elem; + return { + pattern: pattern, + rect: elem + } }; Entry.Utils.COLLISION = { @@ -1153,3 +1157,13 @@ Entry.Utils.stopProjectWithToast = function(block, message) { } throw new Error(message); }; + +window.requestAnimFrame = (function(){ + return window.requestAnimationFrame || + window.webkitRequestAnimationFrame || + window.mozRequestAnimationFrame || + function( callback ){ + window.setTimeout(callback, 1000 / 60); + }; +})(); + diff --git a/src/variable.js b/src/variable.js index 700628d59e..4ff0700cfb 100644 --- a/src/variable.js +++ b/src/variable.js @@ -19,6 +19,10 @@ Entry.Variable = function(variable) { this.object_ = variable.object || null; /** @type {boolean} */ this.isCloud_ = variable.isCloud || false; + + this._nameWidth = null; + this._valueWidth = null; + /** @type {number||string} */ var parsedValue = Entry.parseNumber(variable.value); if (typeof parsedValue == 'number') @@ -328,22 +332,24 @@ Entry.Variable.prototype.updateView = function() { this.textView_.text = this.getName(); } else this.textView_.text = this.getName(); - this.valueView_.x = this.textView_.getMeasuredWidth() + 14; + if (this._nameWidth === null) + this._nameWidth = this.textView_.getMeasuredWidth(); + this.valueView_.x = this._nameWidth + 14; this.valueView_.y = 1; - if (this.isNumber()) { + if (this.isNumber()) this.valueView_.text = this.getValue().toFixed(2).replace('.00', ''); - } - else { + else this.valueView_.text = this.getValue(); - } + if (this._valueWidth === null) + this._valueWidth = this.valueView_.getMeasuredWidth(); this.rect_.graphics.clear().f("#ffffff").ss(1, 2, 0).s("#A0A1A1") .rc(0, -14, - this.textView_.getMeasuredWidth() + this.valueView_.getMeasuredWidth() + 26, 20, + this._nameWidth + this._valueWidth + 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, + .rc(this._nameWidth + 7, -11, + this._valueWidth + 15, 14, 7, 7, 7, 7); } else if (this.type == 'slide') { this.view_.x = this.getX(); @@ -356,7 +362,9 @@ Entry.Variable.prototype.updateView = function() { this.textView_.text = this.getName(); } else this.textView_.text = this.getName(); - this.valueView_.x = this.textView_.getMeasuredWidth() + 14; + if (this._nameWidth === null) + this._nameWidth = this.textView_.getMeasuredWidth(); + this.valueView_.x = this._nameWidth + 14; this.valueView_.y = 1; if (this.isNumber()) { this.valueView_.text = this.getValue().toFixed(2).replace('.00', ''); @@ -364,18 +372,20 @@ Entry.Variable.prototype.updateView = function() { this.valueView_.text = this.getValue(); } - var width = this.textView_.getMeasuredWidth() + this.valueView_.getMeasuredWidth() + 26; + if (this._valueWidth === null) + this._valueWidth = this.valueView_.getMeasuredWidth(); + var width = this._nameWidth + this._valueWidth + 26; width = Math.max(width, 90); this.rect_.graphics.clear().f("#ffffff").ss(1, 2, 0).s("#A0A1A1") .rc(0, -14, width, 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, + .rc(this._nameWidth + 7, -11, + this._valueWidth + 15, 14, 7, 7, 7, 7); - var width = this.textView_.getMeasuredWidth() + this.valueView_.getMeasuredWidth() + 26; + var width = this._nameWidth + this._valueWidth + 26; width = Math.max(width, 90); this.maxWidth = width -20; @@ -447,7 +457,6 @@ Entry.Variable.prototype.updateView = function() { 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; if (this.isNumber()) { if (parseInt(this.getValue(),10) == this.getValue()) @@ -457,39 +466,50 @@ Entry.Variable.prototype.updateView = function() { } else { this.valueView_.text = this.getValue(); - } + if (this._nameWidth === null) + this._nameWidth = this.textView_.getMeasuredWidth(); + if (this._valueWidth === null) + 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.textView_.getMeasuredWidth() + this.valueView_.getMeasuredWidth() + 26, 20, + this._nameWidth + this._valueWidth + 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, + .rc(this._nameWidth + 7, -11, + this._valueWidth + 15, 14, 7, 7, 7, 7); } else { this.view_.x = this.getX(); this.view_.y = this.getY(); this.textView_.text = this.getName(); - this.valueView_.x = this.textView_.getMeasuredWidth() + 14; + + if (this._nameWidth === null) + this._nameWidth = this.textView_.getMeasuredWidth(); + + this.valueView_.x = this._nameWidth + 14; this.valueView_.y = 1; - if (this.isNumber()) { + if (this.isNumber()) this.valueView_.text = this.getValue().toFixed(1).replace('.00', ''); - } - else { + else this.valueView_.text = this.getValue(); - } + if (this._valueWidth === null) + this._valueWidth = this.valueView_.getMeasuredWidth(); + this.rect_.graphics.clear().f("#ffffff").ss(1, 2, 0).s("#A0A1A1") .rc(0, -14, - this.textView_.getMeasuredWidth() + this.valueView_.getMeasuredWidth() + 26, 20, + this._nameWidth + this._valueWidth + 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, + .rc(this._nameWidth + 7, -11, + this._valueWidth + 15, 14, 7, 7, 7, 7); } } + Entry.requestUpdate = true; }; /** @@ -508,6 +528,7 @@ Entry.Variable.prototype.setName = function(variableName) { Entry.assert(typeof variableName == 'string', 'Variable name must be string'); this.name_ = variableName; + this._nameWidth = null; this.updateView(); }; @@ -555,6 +576,7 @@ Entry.Variable.prototype.setValue = function(value) { } if (this.isCloud_) Entry.variableContainer.updateCloudVariables(); + this._valueWidth = null; this.updateView(); }; diff --git a/src/workspace/block_entry.js b/src/workspace/block_entry.js index 6c548560d9..20960281ec 100644 --- a/src/workspace/block_entry.js +++ b/src/workspace/block_entry.js @@ -9881,8 +9881,8 @@ Entry.block = { "isNotFor": [], "func": function (sprite, script) { var value1 = script.getNumberValue("VALUE1", script); - sprite.setX(value1); var value2 = script.getNumberValue("VALUE2", script); + sprite.setX(value1); sprite.setY(value2); if (sprite.brush && !sprite.brush.stop) { sprite.brush.lineTo(sprite.getX(), sprite.getY()*-1); diff --git a/src/workspace/block_menu.js b/src/workspace/block_menu.js index e31d80c570..853f65905e 100644 --- a/src/workspace/block_menu.js +++ b/src/workspace/block_menu.js @@ -37,7 +37,9 @@ Entry.BlockMenu = function(dom, align, categoryData, scroll) { this.svg = Entry.SVG(this._svgId); Entry.Utils.addFilters(this.svg, this.suffix); - this.patternRect = Entry.Utils.addBlockPattern(this.svg, this.suffix); + var returnVal = Entry.Utils.addBlockPattern(this.svg, this.suffix); + this.patternRect = returnVal.rect; + this.pattern = returnVal.pattern; this.svgGroup = this.svg.elem("g"); @@ -560,7 +562,18 @@ Entry.BlockMenu = function(dom, align, categoryData, scroll) { }; p.setPatternRectFill = function(color) { - this.patternRect.attr({fill:color}); + this.patternRect.attr({ + fill:color + }); + this.pattern.attr({ + style: "" + }); + }; + + p.disablePattern = function() { + this.pattern.attr({ + style: "display: none" + }); }; p._clearCategory = function() { diff --git a/src/workspace/block_view.js b/src/workspace/block_view.js index 2657215ae6..64747ed918 100644 --- a/src/workspace/block_view.js +++ b/src/workspace/block_view.js @@ -956,13 +956,15 @@ Entry.BlockView.DRAG_RADIUS = 5; p._changeFill = function(isPattern) { var board = this.getBoard(); if (!board.patternRect || board.dragBlock) return; - var path = this._path; var fillColor = this._fillColor; + var path = this._path; + var board = this.getBoard(); if (isPattern) { - var board = this.getBoard(); board.setPatternRectFill(fillColor); fillColor = "url(#blockHoverPattern_" + this.getBoard().suffix +")"; + } else { + board.disablePattern(); } path.attr({fill:fillColor}); }; diff --git a/src/workspace/board.js b/src/workspace/board.js index 2e74a99b84..887e39d64e 100644 --- a/src/workspace/board.js +++ b/src/workspace/board.js @@ -99,7 +99,9 @@ Entry.Board.OPTION_CLEAR = 2; } else this.suffix = 'board'; Entry.Utils.addFilters(this.svg, this.suffix); - this.patternRect = Entry.Utils.addBlockPattern(this.svg, this.suffix); + var returnVal = Entry.Utils.addBlockPattern(this.svg, this.suffix); + this.patternRect = returnVal.rect; + this.pattern = returnVal.pattern; }; p.changeCode = function(code) { @@ -785,7 +787,18 @@ Entry.Board.OPTION_CLEAR = 2; }; p.setPatternRectFill = function(color) { - this.patternRect.attr({fill:color}); + this.patternRect.attr({ + fill:color + }); + this.pattern.attr({ + style: "" + }); + }; + + p.disablePattern = function() { + this.pattern.attr({ + style: "display: none" + }); }; p._removeActivated = function() { diff --git a/src/workspace/executors.js b/src/workspace/executors.js index c118e48aee..b767d1f694 100644 --- a/src/workspace/executors.js +++ b/src/workspace/executors.js @@ -154,11 +154,15 @@ Entry.Scope = function(block, executor) { }; p._getParamIndex = function(key) { - return Entry.block[this.type].paramsKeyMap[key]; + if (!this._schema) + this._schema = Entry.block[this.type]; + return this._schema.paramsKeyMap[key]; }; p._getStatementIndex = function(key) { - return Entry.block[this.type].statementsKeyMap[key]; + if (!this._schema) + this._schema = Entry.block[this.type]; + return this._schema.statementsKeyMap[key]; }; p.die = function() {