diff --git a/dist/entry.js b/dist/entry.js index 303de251d7..26e078bfad 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -1,6 +1,5 @@ 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)); - this.setFuncRefs(b.functions); "workspace" == this.type && Entry.stateManager.startIgnore(); Entry.projectId = b._id; Entry.variableContainer.setVariables(b.variables); @@ -17,7 +16,6 @@ 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(); - this.removeFuncRefs(); return b; }, exportProject:function(b) { b || (b = {}); @@ -125,12 +123,6 @@ var Entry = {block:{}, TEXT_ALIGN_CENTER:0, TEXT_ALIGN_LEFT:1, TEXT_ALIGN_RIGHT: a.template = Lang.template.function_general; Entry.block[b] = a; } -}, setFuncRefs:function(b) { - this.functions = b ? b.map(function(a) { - return a.id; - }) : []; -}, removeFuncRefs:function() { - delete this.functions; }}; 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() { @@ -8095,17 +8087,30 @@ Entry.EntryObject = function(b) { this.clonedEntities = []; Entry.stage.loadObject(this); for (c in this.pictures) { - var d = this.pictures[c]; - d.objectId = this.id; - d.id || (d.id = Entry.generateHash()); - var e = new Image; - d.fileurl ? e.src = d.fileurl : d.fileurl ? e.src = d.fileurl : (b = d.filename, e.src = Entry.defaultPath + "/uploads/" + b.substring(0, 2) + "/" + b.substring(2, 4) + "/image/" + b + ".png"); - Entry.Loader.addQueue(); - e.onload = function(b) { - Entry.container.cachePicture(d.id + a.entity.id, e); - Entry.Loader.removeQueue(); - Entry.requestUpdate = !0; - }; + (function(b) { + b.objectId = this.id; + b.id || (b.id = Entry.generateHash()); + var c = new Image; + if (b.fileurl) { + c.src = b.fileurl; + } else { + if (b.fileurl) { + c.src = b.fileurl; + } else { + var f = b.filename; + c.src = Entry.defaultPath + "/uploads/" + f.substring(0, 2) + "/" + f.substring(2, 4) + "/image/" + f + ".png"; + } + } + Entry.Loader.addQueue(); + c.onload = function(c) { + Entry.container.cachePicture(b.id + a.entity.id, this); + Entry.requestUpdate = !0; + Entry.Loader.removeQueue(); + }; + c.onerror = function(a) { + Entry.Loader.removeQueue(); + }; + })(this.pictures[c]); } } }; @@ -11969,7 +11974,7 @@ Entry.setCloneBrush = function(b, a) { b.shape = d; }; Entry.isFloat = function(b) { - return /\d+\.{1}\d+/.test(b); + return /\d+\.{1}\d+$/.test(b); }; Entry.getStringIndex = function(b) { if (!b) { @@ -12941,6 +12946,9 @@ Entry.Stage.prototype.initStage = function(b) { Entry.windowResized.attach(this, function() { Entry.stage.updateBoundRect(); }); + $(window).scroll(function() { + Entry.stage.updateBoundRect(); + }); a = function(a) { a.preventDefault(); var b = Entry.stage.getBoundRect(), e; @@ -15868,6 +15876,7 @@ Entry.BlockMenuScroller.RADIUS = 7; }; })(Entry.BlockMenuScroller.prototype); Entry.BlockView = function(b, a, c) { + var d = this; Entry.Model(this, !1); this.block = b; this._lazyUpdatePos = _.debounce(b._updatePos.bind(b), 200); @@ -15876,39 +15885,42 @@ Entry.BlockView = function(b, a, c) { 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); + if (void 0 === this._schema) { + this.block.destroy(!1, !1); + } else { + this._schema.changeEvent && (this._schemaChangeEvent = this._schema.changeEvent.attach(this, this._updateSchema)); + var e = this._skeleton = Entry.skeleton[this._schema.skeleton]; + this._contents = []; + this._statements = []; + this.magnet = {}; + this._paramMap = {}; + e.magnets && e.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; + this.mouseHandler = function() { + var a = d.block.events; + a && a.mousedown && a.mousedown.forEach(function(a) { + a(d); + }); + d.onMouseDown.apply(d, arguments); + }; + this._startRender(b, c); + this._observers.push(this.block.observe(this, "_setMovable", ["movable"])); + this._observers.push(this.block.observe(this, "_setReadOnly", ["movable"])); + this._observers.push(this.block.observe(this, "_setCopyable", ["copyable"])); + this._observers.push(this.block.observe(this, "_updateColor", ["deletable"], !1)); + this._observers.push(this.observe(this, "_updateBG", ["magneting"], !1)); + this._observers.push(this.observe(this, "_updateOpacity", ["visible"], !1)); + this._observers.push(this.observe(this, "_updateDisplay", ["display"], !1)); + this._observers.push(this.observe(this, "_updateShadow", ["shadow"])); + this._observers.push(this.observe(this, "_updateMagnet", ["offsetY"])); + this._observers.push(a.code.observe(this, "_setBoard", ["board"], !1)); + this.dragMode = Entry.DRAG_MODE_NONE; + Entry.Utils.disableContextmenu(this.svgGroup.node); + a = b.events.viewAdd; + "workspace" == Entry.type && a && !this.isInBlockMenu && a.forEach(function(a) { + Entry.Utils.isFunction(a) && a(b); }); - e.onMouseDown.apply(e, arguments); - }; - this._startRender(b, c); - this._observers.push(this.block.observe(this, "_setMovable", ["movable"])); - this._observers.push(this.block.observe(this, "_setReadOnly", ["movable"])); - this._observers.push(this.block.observe(this, "_setCopyable", ["copyable"])); - this._observers.push(this.block.observe(this, "_updateColor", ["deletable"], !1)); - this._observers.push(this.observe(this, "_updateBG", ["magneting"], !1)); - this._observers.push(this.observe(this, "_updateOpacity", ["visible"], !1)); - this._observers.push(this.observe(this, "_updateDisplay", ["display"], !1)); - this._observers.push(this.observe(this, "_updateShadow", ["shadow"])); - this._observers.push(this.observe(this, "_updateMagnet", ["offsetY"])); - this._observers.push(a.code.observe(this, "_setBoard", ["board"], !1)); - this.dragMode = Entry.DRAG_MODE_NONE; - Entry.Utils.disableContextmenu(this.svgGroup.node); - a = b.events.viewAdd; - "workspace" == Entry.type && a && !this.isInBlockMenu && a.forEach(function(a) { - Entry.Utils.isFunction(a) && a(b); - }); + } }; Entry.BlockView.PARAM_SPACE = 5; Entry.BlockView.DRAG_RADIUS = 5; @@ -16737,14 +16749,15 @@ Entry.Executor = function(b, a) { for (;;) { var a = null; try { - a = this.scope.block.getSchema().func.call(this.scope, this.entity, this.scope); - } catch (b) { - if ("AsyncError" === b.name) { + var b = this.scope.block.getSchema(); + b && (a = b.func.call(this.scope, this.entity, this.scope)); + } catch (e) { + if ("AsyncError" === e.name) { a = Entry.STATIC.BREAK; } else { - var c = !1; - "\ub7f0\ud0c0\uc784 \uc5d0\ub7ec" != b.message && (c = !0); - Entry.Utils.stopProjectWithToast(this.scope, "\ub7f0\ud0c0\uc784 \uc5d0\ub7ec", c); + var d = !1; + "\ub7f0\ud0c0\uc784 \uc5d0\ub7ec" != e.message && (d = !0); + Entry.Utils.stopProjectWithToast(this.scope, "\ub7f0\ud0c0\uc784 \uc5d0\ub7ec", d); } } if (this.isEnd()) { @@ -18886,12 +18899,7 @@ Entry.Thread = function(b, a, c) { } for (var d = 0;d < a.length;d++) { var e = a[d]; - if (e instanceof Entry.Block || e.isDummy) { - e.setThread(this), this._data.push(e); - } else { - var f = Entry.functions, g = e.type; - (Entry.block[g] || f && -1 < f.indexOf(g.split("_")[1])) && this._data.push(new Entry.Block(e, this)); - } + e instanceof Entry.Block || e.isDummy ? (e.setThread(this), this._data.push(e)) : this._data.push(new Entry.Block(e, this)); } (d = this._code.view) && this.createView(d.board, b); }; @@ -18904,7 +18912,7 @@ Entry.Thread = function(b, a, c) { }; b.createView = function(a, b) { this.view || (this.view = new Entry.ThreadView(this, a)); - this._data.map(function(d) { + this._data.getAll().forEach(function(d) { d.createView(a, b); }); }; @@ -19179,7 +19187,7 @@ Entry.Block.DELETABLE_FALSE_LIGHTEN = 3; f = this.getNextBlock(); this.getCode().unregisterBlock(this); e = this.getThread(); - this._schema.event && e.unregisterEvent(this, this._schema.event); + this._schema && this._schema.event && e.unregisterEvent(this, this._schema.event); f && (b ? f.destroy(a, b) : g ? f.view && f.view.bindPrev(g) : (g = this.getThread().view.getParent(), g.constructor === Entry.FieldStatement ? (f.view && f.view.bindPrev(g), g.insertTopBlock(f)) : g.constructor === Entry.FieldStatement ? f.replace(g._valueBlock) : f.view._toGlobalCoordinate())); !this.doNotSplice && e.spliceBlock ? e.spliceBlock(this) : delete this.doNotSplice; this.view && this.view.destroy(a); diff --git a/dist/entry.min.js b/dist/entry.min.js index cb14d88159..8ea55d0094 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -1,14 +1,14 @@ -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));this.setFuncRefs(b.functions);"workspace"==this.type&&Entry.stateManager.startIgnore();Entry.projectId=b._id;Entry.variableContainer.setVariables(b.variables);Entry.variableContainer.setMessages(b.messages);Entry.scene.addScenes(b.scenes);Entry.stage.initObjectContainers();Entry.variableContainer.setFunctions(b.functions); -Entry.container.setObjects(b.objects);Entry.FPS=b.speed?b.speed:60;createjs.Ticker.setFPS(Entry.FPS);"workspace"==this.type&&setTimeout(function(){Entry.stateManager.endIgnore()},300);Entry.engine.projectTimer||Entry.variableContainer.generateTimer();0===Object.keys(Entry.container.inputValue).length&&Entry.variableContainer.generateAnswer();Entry.start();this.removeFuncRefs();return b},exportProject:function(b){b||(b={});Entry.engine.isState("stop")||Entry.engine.toggleStop();Entry.Func&&Entry.Func.workspace&& -Entry.Func.workspace.visible&&Entry.Func.cancelEdit();b.objects=Entry.container.toJSON();b.scenes=Entry.scene.toJSON();b.variables=Entry.variableContainer.getVariableJSON();b.messages=Entry.variableContainer.getMessageJSON();b.functions=Entry.variableContainer.getFunctionJSON();b.scenes=Entry.scene.toJSON();b.speed=Entry.FPS;return b},setBlockByText:function(b,a){for(var c=[],d=jQuery.parseXML(a).getElementsByTagName("category"),e=0;ea?a=325:720a?a=244:400svg").css({width:a- -64+"px"});Entry.playground.mainWorkspace.blockMenu.setWidth();$(".entryWorkspaceBoard").css({left:a+"px"});Entry.playground.resizeHandle_.style.left=a+"px";Entry.playground.variableViewWrapper_.style.width=a+"px";this.interfaceState=b}Entry.windowResized.notify()},getUpTime:function(){return(new Date).getTime()-this.startTime},addActivity:function(b){Entry.stateManager&&Entry.stateManager.addActivity(b)},startActivityLogging:function(){Entry.reporter&&Entry.reporter.start(Entry.projectId,window.user? -window.user._id:null,Entry.startTime)},getActivityLog:function(){var b={};Entry.stateManager&&(b.activityLog=Entry.stateManager.activityLog_);return b},DRAG_MODE_NONE:0,DRAG_MODE_MOUSEDOWN:1,DRAG_MODE_DRAG:2,cancelObjectEdit:function(b){var a=Entry.playground.object;if(a){var c=b.target;b=0!==$(a.view_).find(c).length;c=c.tagName.toUpperCase();!a.isEditing||"INPUT"===c&&b||a.editObjectValues(!1)}},generateFunctionSchema:function(b){b="func_"+b;if(!Entry.block[b]){var a=function(){};a.prototype=Entry.block.function_general; -a=new a;a.changeEvent=new Entry.Event;a.template=Lang.template.function_general;Entry.block[b]=a}},setFuncRefs:function(b){this.functions=b?b.map(function(a){return a.id}):[]},removeFuncRefs:function(){delete this.functions}};window.Entry=Entry;Entry.Albert={PORT_MAP:{leftWheel:0,rightWheel:0,buzzer:0,leftEye:0,rightEye:0,note:0,bodyLed:0,frontLed:0,padWidth:0,padHeight:0},setZero:function(){var b=Entry.Albert.PORT_MAP,a=Entry.hw.sendQueue,c;for(c in b)a[c]=b[c];Entry.hw.update();b=Entry.Albert;b.tempo=60;b.removeAllTimeouts()},monitorTemplate:{imgPath:"hw/albert.png",width:387,height:503,listPorts:{oid:{name:"OID",type:"input",pos:{x:0,y:0}},buzzer:{name:Lang.Hw.buzzer,type:"output",pos:{x:0,y:0}},note:{name:Lang.Hw.note,type:"output", +Entry={block:{},TEXT_ALIGN_CENTER:0,TEXT_ALIGN_LEFT:1,TEXT_ALIGN_RIGHT:2,TEXT_ALIGNS:["center","left","right"],clipboard:null,loadProject:function(b){b||(b=Entry.getStartProject(Entry.mediaFilePath));"workspace"==this.type&&Entry.stateManager.startIgnore();Entry.projectId=b._id;Entry.variableContainer.setVariables(b.variables);Entry.variableContainer.setMessages(b.messages);Entry.scene.addScenes(b.scenes);Entry.stage.initObjectContainers();Entry.variableContainer.setFunctions(b.functions);Entry.container.setObjects(b.objects); +Entry.FPS=b.speed?b.speed:60;createjs.Ticker.setFPS(Entry.FPS);"workspace"==this.type&&setTimeout(function(){Entry.stateManager.endIgnore()},300);Entry.engine.projectTimer||Entry.variableContainer.generateTimer();0===Object.keys(Entry.container.inputValue).length&&Entry.variableContainer.generateAnswer();Entry.start();return b},exportProject:function(b){b||(b={});Entry.engine.isState("stop")||Entry.engine.toggleStop();Entry.Func&&Entry.Func.workspace&&Entry.Func.workspace.visible&&Entry.Func.cancelEdit(); +b.objects=Entry.container.toJSON();b.scenes=Entry.scene.toJSON();b.variables=Entry.variableContainer.getVariableJSON();b.messages=Entry.variableContainer.getMessageJSON();b.functions=Entry.variableContainer.getFunctionJSON();b.scenes=Entry.scene.toJSON();b.speed=Entry.FPS;return b},setBlockByText:function(b,a){for(var c=[],d=jQuery.parseXML(a).getElementsByTagName("category"),e=0;ea?a=325:720a?a=244:400svg").css({width:a-64+"px"});Entry.playground.mainWorkspace.blockMenu.setWidth(); +$(".entryWorkspaceBoard").css({left:a+"px"});Entry.playground.resizeHandle_.style.left=a+"px";Entry.playground.variableViewWrapper_.style.width=a+"px";this.interfaceState=b}Entry.windowResized.notify()},getUpTime:function(){return(new Date).getTime()-this.startTime},addActivity:function(b){Entry.stateManager&&Entry.stateManager.addActivity(b)},startActivityLogging:function(){Entry.reporter&&Entry.reporter.start(Entry.projectId,window.user?window.user._id:null,Entry.startTime)},getActivityLog:function(){var b= +{};Entry.stateManager&&(b.activityLog=Entry.stateManager.activityLog_);return b},DRAG_MODE_NONE:0,DRAG_MODE_MOUSEDOWN:1,DRAG_MODE_DRAG:2,cancelObjectEdit:function(b){var a=Entry.playground.object;if(a){var c=b.target;b=0!==$(a.view_).find(c).length;c=c.tagName.toUpperCase();!a.isEditing||"INPUT"===c&&b||a.editObjectValues(!1)}},generateFunctionSchema:function(b){b="func_"+b;if(!Entry.block[b]){var a=function(){};a.prototype=Entry.block.function_general;a=new a;a.changeEvent=new Entry.Event;a.template= +Lang.template.function_general;Entry.block[b]=a}}};window.Entry=Entry;Entry.Albert={PORT_MAP:{leftWheel:0,rightWheel:0,buzzer:0,leftEye:0,rightEye:0,note:0,bodyLed:0,frontLed:0,padWidth:0,padHeight:0},setZero:function(){var b=Entry.Albert.PORT_MAP,a=Entry.hw.sendQueue,c;for(c in b)a[c]=b[c];Entry.hw.update();b=Entry.Albert;b.tempo=60;b.removeAllTimeouts()},monitorTemplate:{imgPath:"hw/albert.png",width:387,height:503,listPorts:{oid:{name:"OID",type:"input",pos:{x:0,y:0}},buzzer:{name:Lang.Hw.buzzer,type:"output",pos:{x:0,y:0}},note:{name:Lang.Hw.note,type:"output", pos:{x:0,y:0}}},ports:{leftProximity:{name:Lang.Blocks.ALBERT_sensor_leftProximity,type:"input",pos:{x:178,y:401}},rightProximity:{name:Lang.Blocks.ALBERT_sensor_rightProximity,type:"input",pos:{x:66,y:359}},battery:{name:Lang.Blocks.ALBERT_sensor_battery,type:"input",pos:{x:88,y:368}},light:{name:Lang.Blocks.ALBERT_sensor_light,type:"input",pos:{x:127,y:391}},leftWheel:{name:Lang.Hw.leftWheel,type:"output",pos:{x:299,y:406}},rightWheel:{name:Lang.Hw.rightWheel,type:"output",pos:{x:22,y:325}},leftEye:{name:Lang.Hw.leftEye, type:"output",pos:{x:260,y:26}},rightEye:{name:Lang.Hw.rightEye,type:"output",pos:{x:164,y:13}},bodyLed:{name:Lang.Hw.body+" "+Lang.Hw.led,type:"output",pos:{x:367,y:308}},frontLed:{name:Lang.Hw.front+" "+Lang.Hw.led,pos:{x:117,y:410}}},mode:"both"},tempo:60,timeouts:[],removeTimeout:function(b){clearTimeout(b);var a=this.timeouts;b=a.indexOf(b);0<=b&&a.splice(b,1)},removeAllTimeouts:function(){var b=this.timeouts,a;for(a in b)clearTimeout(b[a]);this.timeouts=[]},name:"albert"}; Blockly.Blocks.albert_hand_found={init:function(){this.setColour("#00979D");this.appendDummyInput().appendField(Lang.Blocks.ALBERT_hand_found);this.setOutput(!0,"Boolean");this.setInputsInline(!0)}};Entry.block.albert_hand_found=function(b,a){var c=Entry.hw.portData;return 40d&&(d=h.index)}return 0a&&(a=e))}return Math.min(a,20)};Entry.convertToRoundedDecimals=function(b,a){return isNaN(b)||!this.isFloat(b)?b:Number(Math.round(b+"e"+a)+"e-"+a)};Entry.attachEventListener=function(b,a,c){setTimeout(function(){b.addEventListener(a,c)},0)};Entry.deAttachEventListener=function(b,a,c){b.removeEventListener(a,c)}; @@ -1191,9 +1191,9 @@ p.checkDevice=function(b){void 0!==b.company&&(b=[Entry.Utils.convertIntToHex(b. p.banHW=function(){var b=this.hwInfo,a;for(a in b)Entry.playground.mainWorkspace.blockMenu.banClass(b[a].name,!0)};Entry.BlockModel=function(){Entry.Model(this)};Entry.BlockModel.prototype.schema={id:null,x:0,y:0,type:null,params:{},statements:{},prev:null,next:null,view:null};Entry.BlockRenderModel=function(){Entry.Model(this)};Entry.BlockRenderModel.prototype.schema={id:0,type:Entry.STATIC.BLOCK_RENDER_MODEL,x:0,y:0,width:0,height:0,magneting:!1};Entry.BoxModel=function(){Entry.Model(this)};Entry.BoxModel.prototype.schema={id:0,type:Entry.STATIC.BOX_MODEL,x:0,y:0,width:0,height:0};Entry.DragInstance=function(b){Entry.Model(this);this.set(b)};Entry.DragInstance.prototype.schema={type:Entry.STATIC.DRAG_INSTANCE,startX:0,startY:0,offsetX:0,offsetY:0,absX:0,absY:0,prev:null,height:0,mode:0,isNew:!1};Entry.ThreadModel=function(){Entry.Model(this)};Entry.ThreadModel.prototype.schema={id:0,type:Entry.STATIC.THREAD_MODEL,x:0,y:0,width:0,minWidth:0,height:0};Entry.Stage=function(){this.variables={};this.background=new createjs.Shape;this.background.graphics.beginFill("#ffffff").drawRect(-480,-240,960,480);this.objectContainers=[];this.selectedObjectContainer=null;this.variableContainer=new createjs.Container;this.dialogContainer=new createjs.Container;this.selectedObject=null;this.isObjectClick=!1}; Entry.Stage.prototype.initStage=function(b){this.canvas=new createjs.Stage(b.id);this.canvas.x=320;this.canvas.y=180;this.canvas.scaleX=this.canvas.scaleY=2/1.5;createjs.Touch.enable(this.canvas);this.canvas.enableMouseOver(10);this.canvas.mouseMoveOutside=!0;this.canvas.addChild(this.background);this.canvas.addChild(this.variableContainer);this.canvas.addChild(this.dialogContainer);this.inputField=null;this.initCoordinator();this.initHandle();this.mouseCoordinate={x:0,y:0};if(Entry.isPhone())b.ontouchstart= function(a){Entry.dispatchEvent("canvasClick",a);Entry.stage.isClick=!0},b.ontouchend=function(a){Entry.stage.isClick=!1;Entry.dispatchEvent("canvasClickCanceled",a)};else{var a=function(a){Entry.dispatchEvent("canvasClick",a);Entry.stage.isClick=!0};b.onmousedown=a;b.ontouchstart=a;a=function(a){Entry.stage.isClick=!1;Entry.dispatchEvent("canvasClickCanceled",a)};b.onmouseup=a;b.ontouchend=a;$(document).click(function(a){Entry.stage.focused="entryCanvas"===a.target.id?!0:!1})}Entry.addEventListener("canvasClick", -function(a){Entry.stage.isObjectClick=!1});Entry.windowResized.attach(this,function(){Entry.stage.updateBoundRect()});a=function(a){a.preventDefault();var b=Entry.stage.getBoundRect(),e;-1e)var h=d,d=e,e=h;f>g&&(h=f,f=g,g=h);c-=d;c*=(g-f)/(e-d);c+=f;c=Math.min(g,c);c=Math.max(f, c);return Math.round(c)}},arduino_ext_get_analog_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["A0","0"],["A1","1"],["A2","2"],["A3","3"],["A4","4"],["A5","5"]],value:"0",fontSize:11}],events:{},def:{params:[null],type:"arduino_ext_get_analog_value"},paramsKeyMap:{PORT:0},"class":"ArduinoExtGet",isNotFor:["ArduinoExt"],func:function(b,a){var c=a.getField("PORT",a),d=Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.ANALOG), -e=Entry.hw.portData.TIME||0;Entry.ArduinoExt.BlockState[this.type]||(Entry.ArduinoExt.BlockState[this.type]={isStart:!1,stamp:0});var f=Entry.ArduinoExt.BlockState[this.type],g=Entry.hw.portData.ANALOG;if(f.isStart){if(e&&e===f.stamp||64Entry.hw.getAnalogPortValue(0)?1:0}},CODEino_get_light_status:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CODEino_string_14,"BRIGHT"],[Lang.Blocks.CODEino_string_15, -"DARK"]],value:"BRIGHT",fontSize:11}],events:{},def:{params:[null],type:"CODEino_get_light_status"},paramsKeyMap:{STATUS:0},"class":"CODEino",isNotFor:["CODEino"],func:function(b,a){return"DARK"==a.getField("STATUS",a)?800Entry.hw.getAnalogPortValue(1)?1:0}},CODEino_is_button_pressed:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CODEino_string_3,"4"],[Lang.Blocks.CODEino_string_4, -"17"],[Lang.Blocks.CODEino_string_5,"18"],[Lang.Blocks.CODEino_string_6,"19"],[Lang.Blocks.CODEino_string_7,"20"]],value:"4",fontSize:11}],events:{},def:{params:[null],type:"CODEino_is_button_pressed"},paramsKeyMap:{PORT:0},"class":"CODEino",isNotFor:["CODEino"],func:function(b,a){var c=a.getNumberField("PORT",a);return 14d?1:0;if("RIGHT"==c||"FRONT"==c)return 30d?1:0}},CODEino_get_accelerometer_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["X","3"],["Y","4"],["Z","5"]],value:"3",fontSize:11}],events:{},def:{params:[null],type:"CODEino_get_accelerometer_value"}, -paramsKeyMap:{PORT:0},"class":"CODEino",isNotFor:["CODEino"],func:function(b,a){var c=265,d=402,e=-90,f=90,g=Entry.hw.getAnalogPortValue(a.getField("PORT",a));if(c>d)var h=c,c=d,d=h;e>f&&(h=e,e=f,f=h);g=(f-e)/(d-c)*(g-c);g+=e;g=Math.min(f,g);g=Math.max(e,g);return Math.round(g)}},nemoino_get_named_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"%1 \uc13c\uc11c\uac12",params:[{type:"Dropdown",options:[["\uc18c\ub9ac","0"],["\ube5b","1"],["\uc2ac\ub77c\uc774\ub354", -"2"],["\uc800\ud56d-A","3"],["\uc800\ud56d-B","4"],["\uc800\ud56d-C","5"],["\uc800\ud56d-D","6"]],value:"0",fontSize:11}],events:{},def:{params:[null],type:"nemoino_get_named_sensor_value"},paramsKeyMap:{PORT:0},"class":"nemoino",isNotFor:["nemoino"],func:function(b,a){return Entry.hw.getAnalogPortValue(a.getField("PORT",a))}},nemoino_get_sound_status:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],template:"\uc18c\ub9ac\uc13c\uc11c %1",params:[{type:"Dropdown",options:[["\uc18c\ub9ac\ud07c", -"GREAT"],["\uc18c\ub9ac\uc791\uc74c","SMALL"]],value:"GREAT",fontSize:11}],events:{},def:{params:[null],type:"nemoino_get_sound_status"},paramsKeyMap:{STATUS:0},"class":"nemoino",isNotFor:["nemoino"],func:function(b,a){return"GREAT"==a.getField("STATUS",a)?600Entry.hw.getAnalogPortValue(0)?1:0}},nemoino_is_button_pressed:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],template:"\ubcf4\ub4dc\uc758 %1",params:[{type:"Dropdown",options:[["\ubc84\ud2bc\ub204\ub984", -"4"],["A\uc5f0\uacb0\ub428","17"],["B\uc5f0\uacb0\ub428","18"],["C\uc5f0\uacb0\ub428","19"],["D\uc5f0\uacb0\ub428","20"]],value:"4",fontSize:11}],events:{},def:{params:[null],type:"nemoino_is_button_pressed"},paramsKeyMap:{PORT:0},"class":"nemoino",isNotFor:["nemoino"],func:function(b,a){var c=a.getNumberField("PORT",a);return 14d?1:0;if("RIGHT"==c||"FRONT"==c)return 30d?1:0}},nemoino_get_accelerometer_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"3\ucd95 \uac00\uc18d\ub3c4\uc13c\uc11c %1 \ucd95\uc758 \uc13c\uc11c\uac12", -params:[{type:"Dropdown",options:[["X","3"],["Y","4"],["Z","5"]],value:"3",fontSize:11}],events:{},def:{params:[null],type:"nemoino_get_accelerometer_value"},paramsKeyMap:{PORT:0},"class":"nemoino",isNotFor:["nemoino"],func:function(b,a){var c=265,d=402,e=-90,f=90,g=Entry.hw.getAnalogPortValue(a.getField("PORT",a));if(c>d)var h=c,c=d,d=h;e>f&&(h=e,e=f,f=h);g=(f-e)/(d-c)*(g-c);g+=e;g=Math.min(f,g);g=Math.max(e,g);return Math.round(g)}},bitbrick_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field", -statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW,menuName:Entry.Bitbrick.sensorList}],events:{},def:{params:[null],type:"bitbrick_sensor_value"},paramsKeyMap:{PORT:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=a.getStringField("PORT");return Entry.hw.portData[c].value}},bitbrick_is_touch_pressed:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"DropdownDynamic",value:null, -fontSize:11,menuName:Entry.Bitbrick.touchList}],events:{},def:{params:[null],type:"bitbrick_is_touch_pressed"},paramsKeyMap:{PORT:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){return 0===Entry.hw.portData[a.getStringField("PORT")].value}},bitbrick_turn_off_color_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"bitbrick_turn_off_color_led",id:"i3je"},"class":"condition",isNotFor:["bitbrick"], -func:function(b,a){Entry.hw.sendQueue.LEDR=0;Entry.hw.sendQueue.LEDG=0;Entry.hw.sendQueue.LEDB=0;return a.callReturn()}},bitbrick_turn_on_color_led_by_rgb:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["255"]},{type:"text",params:["255"]},{type:"text",params:["255"]},null],type:"bitbrick_turn_on_color_led_by_rgb"}, -paramsKeyMap:{rValue:0,gValue:1,bValue:2},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=a.getNumberValue("rValue"),d=a.getNumberValue("gValue"),e=a.getNumberValue("bValue"),f=Entry.adjustValueWithMaxMin,g=Entry.hw.sendQueue;g.LEDR=f(c,0,255);g.LEDG=f(d,0,255);g.LEDB=f(e,0,255);return a.callReturn()}},bitbrick_turn_on_color_led_by_picker:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Color"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{}, -def:{params:[null],type:"bitbrick_turn_on_color_led_by_picker"},paramsKeyMap:{VALUE:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=a.getStringField("VALUE");Entry.hw.sendQueue.LEDR=parseInt(c.substr(1,2),16);Entry.hw.sendQueue.LEDG=parseInt(c.substr(3,2),16);Entry.hw.sendQueue.LEDB=parseInt(c.substr(5,2),16);return a.callReturn()}},bitbrick_turn_on_color_led_by_value:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png", -size:12}],events:{},def:{params:[{type:"text",params:["0"]},null],type:"bitbrick_turn_on_color_led_by_value"},paramsKeyMap:{VALUE:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=a.getNumberValue("VALUE"),d,e,f,c=c%200;67>c?(d=200-3*c,e=3*c,f=0):134>c?(c-=67,d=0,e=200-3*c,f=3*c):201>c&&(c-=134,d=3*c,e=0,f=200-3*c);Entry.hw.sendQueue.LEDR=d;Entry.hw.sendQueue.LEDG=e;Entry.hw.sendQueue.LEDB=f;return a.callReturn()}},bitbrick_buzzer:{color:"#00979D",skeleton:"basic",statements:[], -params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["60"]},null],type:"bitbrick_buzzer"},paramsKeyMap:{VALUE:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){if(a.isStart)return Entry.hw.sendQueue.buzzer=0,delete a.isStart,a.callReturn();var c=a.getNumberValue("VALUE");Entry.hw.sendQueue.buzzer=c;a.isStart=!0;return a}},bitbrick_turn_off_all_motors:{color:"#00979D",skeleton:"basic",statements:[], -params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"bitbrick_turn_off_all_motors"},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=Entry.hw.sendQueue,d=Entry.Bitbrick;d.servoList().map(function(a){c[a[1]]=0});d.dcList().map(function(a){c[a[1]]=128});return a.callReturn()}},bitbrick_dc_speed:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.dcList},{type:"Block", -accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"text",params:["60"]},null],type:"bitbrick_dc_speed"},paramsKeyMap:{PORT:0,VALUE:1},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=a.getNumberValue("VALUE"),c=Math.min(c,Entry.Bitbrick.dcMaxValue),c=Math.max(c,Entry.Bitbrick.dcMinValue);Entry.hw.sendQueue[a.getStringField("PORT")]=c+128;return a.callReturn()}},bitbrick_dc_direction_speed:{color:"#00979D",skeleton:"basic", -statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.dcList},{type:"Dropdown",options:[[Lang.Blocks.BITBRICK_dc_direction_cw,"CW"],[Lang.Blocks.BITBRICK_dc_direction_ccw,"CCW"]],value:"CW",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,{type:"text",params:["100"]},null],type:"bitbrick_dc_direction_speed"},paramsKeyMap:{PORT:0,DIRECTION:1,VALUE:2},"class":"condition",isNotFor:["bitbrick"], -func:function(b,a){var c="CW"===a.getStringField("DIRECTION"),d=a.getNumberValue("VALUE"),d=Math.min(d,Entry.Bitbrick.dcMaxValue),d=Math.max(d,0);Entry.hw.sendQueue[a.getStringField("PORT")]=c?d+128:128-d;return a.callReturn()}},bitbrick_servomotor_angle:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.servoList},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null, -{type:"text",params:["100"]},null],type:"bitbrick_servomotor_angle"},paramsKeyMap:{PORT:0,VALUE:1},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=Entry.Bitbrick.servoMaxValue-(a.getNumberValue("VALUE")+1),c=Math.min(c,Entry.Bitbrick.servoMaxValue),c=Math.max(c,Entry.Bitbrick.servoMinValue);Entry.hw.sendQueue[a.getStringField("PORT")]=c;return a.callReturn()}},bitbrick_convert_scale:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"DropdownDynamic", -value:null,fontSize:11,menuName:Entry.Bitbrick.sensorList},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"}],events:{},def:{params:[null,{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["-100"]},{type:"number",params:["100"]}],type:"bitbrick_convert_scale"},paramsKeyMap:{PORT:0,VALUE2:1,VALUE3:2,VALUE4:3,VALUE5:4},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=a.getNumberField("PORT"), -d=Entry.hw.portData[c].value,c=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a),f=a.getNumberValue("VALUE4",a),g=a.getNumberValue("VALUE5",a);if(f>g)var h=f,f=g,g=h;d-=c;d*=(g-f)/(e-c);d+=f;d=Math.min(g,d);d=Math.max(f,d);return Math.round(d)}},start_drawing:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"start_drawing"},"class":"brush_control",isNotFor:["textBox"],func:function(b,a){b.brush? -b.brush.stop=!1:Entry.setBasicBrush(b);Entry.stage.sortZorder();b.brush.moveTo(b.getX(),-1*b.getY());return a.callReturn()}},stop_drawing:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"stop_drawing"},"class":"brush_control",isNotFor:["textBox"],func:function(b,a){b.brush&&b.shape&&(b.brush.stop=!0);return a.callReturn()}},set_color:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Color"}, -{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"set_color"},paramsKeyMap:{VALUE:0},"class":"brush_color",isNotFor:["textBox"],func:function(b,a){var c=a.getField("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(c=Entry.hex2rgb(c),b.brush.rgb=c,b.brush.endStroke(),b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}},set_random_color:{color:"#FF9E20", -skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"set_random_color"},"class":"brush_color",isNotFor:["textBox"],func:function(b,a){b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);if(b.brush){var c=Entry.generateRgb();b.brush.rgb=c;b.brush.endStroke();b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")");b.brush.moveTo(b.getX(),-1*b.getY())}return a.callReturn()}},change_thickness:{color:"#FF9E20", -skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["1"]},null],type:"change_thickness"},paramsKeyMap:{VALUE:0},"class":"brush_thickness",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.thickness+=c,1>b.brush.thickness&&(b.brush.thickness=1),b.brush.setStrokeStyle(b.brush.thickness),b.brush.moveTo(b.getX(), --1*b.getY()));return a.callReturn()}},set_thickness:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["1"]},null],type:"set_thickness"},paramsKeyMap:{VALUE:0},"class":"brush_thickness",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.thickness=c,b.brush.setStrokeStyle(b.brush.thickness), -b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}},change_opacity:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_opacity"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);c=Entry.adjustValueWithMaxMin(b.brush.opacity+ -c,0,100);b.brush&&(b.brush.opacity=c,b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}},set_opacity:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["50"]},null],type:"set_opacity"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"], -func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}},brush_erase_all:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"brush_erase_all"}, -"class":"brush_clear",isNotFor:["textBox"],func:function(b,a){var c=b.brush;if(c){var d=c._stroke.style,e=c._strokeStyle.width;c.clear().setStrokeStyle(e).beginStroke(d);c.moveTo(b.getX(),-1*b.getY())}c=b.parent.getStampEntities();c.map(function(a){a.removeClone()});c=null;return a.callReturn()}},brush_stamp:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"brush_stamp"},"class":"stamp",isNotFor:["textBox"], -func:function(b,a){b.parent.addStampEntity(b);return a.callReturn()}},change_brush_transparency:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_brush_transparency"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop= -!0);c=Entry.adjustValueWithMaxMin(b.brush.opacity-c,0,100);b.brush&&(b.brush.opacity=c,b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}},set_brush_tranparency:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["50"]},null],type:"set_brush_tranparency"}, -paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+(1-b.brush.opacity/100)+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}},number:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"TextInput", -value:10}],events:{},def:{params:[]},paramsKeyMap:{NUM:0},func:function(b,a){return a.getField("NUM",a)},isPrimitive:!0},angle:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Angle"}],events:{},def:{params:[null],type:"angle"},paramsKeyMap:{ANGLE:0},func:function(b,a){return a.getNumberField("ANGLE")}},get_x_coordinate:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_x_coordinate,color:"#3D3D3D"}],events:{},def:{params:[null], -type:"get_x_coordinate"},"class":"calc",isNotFor:[],func:function(b,a){return b.getX()}},get_y_coordinate:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_y_coordinate,color:"#3D3D3D"}],events:{},def:{params:[null],type:"get_y_coordinate"},"class":"calc",isNotFor:[],func:function(b,a){return b.getY()}},get_angle:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_angle,color:"#3D3D3D"}], -events:{},def:{params:[null]},func:function(b,a){return parseFloat(b.getRotation().toFixed(1))}},get_rotation_direction:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CALC_rotation_value,"ROTATION"],[Lang.Blocks.CALC_direction_value,"DIRECTION"]],value:"ROTATION",fontSize:11}],events:{},def:{params:[null],type:"get_rotation_direction"},paramsKeyMap:{OPERATOR:0},"class":"calc",isNotFor:[],func:function(b,a){return"DIRECTION"==a.getField("OPERATOR", -a).toUpperCase()?parseFloat(b.getDirection().toFixed(1)):parseFloat(b.getRotation().toFixed(1))}},distance_something:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_distance_something_1,color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_distance_something_2,color:"#3D3D3D"}],events:{},def:{params:[null,null,null],type:"distance_something"}, -paramsKeyMap:{VALUE:1},"class":"calc_distance",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a);if("mouse"==c)return c=Entry.stage.mouseCoordinate,Math.sqrt(Math.pow(b.getX()-c.x,2)+Math.pow(b.getY()-c.y,2));c=Entry.container.getEntity(c);return Math.sqrt(Math.pow(b.getX()-c.getX(),2)+Math.pow(b.getY()-c.getY(),2))}},coordinate_mouse:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_coordinate_mouse_1,color:"#3D3D3D"},{type:"Dropdown", -options:[["x","x"],["y","y"]],value:"x",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_coordinate_mouse_2,color:"#3D3D3D"}],events:{},def:{params:[null,null,null],type:"coordinate_mouse"},paramsKeyMap:{VALUE:1},"class":"calc",isNotFor:[],func:function(b,a){return"x"===a.getField("VALUE",a)?Number(Entry.stage.mouseCoordinate.x):Number(Entry.stage.mouseCoordinate.y)}},coordinate_object:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text", -text:Lang.Blocks.CALC_coordinate_object_1,color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"spritesWithSelf",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_coordinate_object_2,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_coordinate_x_value,"x"],[Lang.Blocks.CALC_coordinate_y_value,"y"],[Lang.Blocks.CALC_coordinate_rotation_value,"rotation"],[Lang.Blocks.CALC_coordinate_direction_value,"direction"],[Lang.Blocks.CALC_coordinate_size_value, -"size"],[Lang.Blocks.CALC_picture_index,"picture_index"],[Lang.Blocks.CALC_picture_name,"picture_name"]],value:"x",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}],events:{},def:{params:[null,null,null,null],type:"coordinate_object"},paramsKeyMap:{VALUE:1,COORDINATE:3},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),c="self"==c?b:Entry.container.getEntity(c);switch(a.getField("COORDINATE",a)){case "x":return c.getX();case "y":return c.getY();case "rotation":return c.getRotation(); -case "direction":return c.getDirection();case "picture_index":var d=c.parent,d=d.pictures;return d.indexOf(c.picture)+1;case "size":return Number(c.getSize().toFixed(1));case "picture_name":return d=c.parent,d=d.pictures,d[d.indexOf(c.picture)].name}}},calc_basic:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown",options:[["+","PLUS"],["-","MINUS"],["x","MULTI"],["/","DIVIDE"]],value:"PLUS",fontSize:11,noArrow:!0},{type:"Block",accept:"string"}], -events:{},def:{params:[{type:"number",params:["10"]},"PLUS",{type:"number",params:["10"]}],type:"calc_basic"},defs:[{params:[{type:"number",params:["10"]},"PLUS",{type:"number",params:["10"]}],type:"calc_basic"},{params:[{type:"number",params:["10"]},"MINUS",{type:"number",params:["10"]}],type:"calc_basic"},{params:[{type:"number",params:["10"]},"MULTI",{type:"number",params:["10"]}],type:"calc_basic"},{params:[{type:"number",params:["10"]},"DIVIDE",{type:"number",params:["10"]}],type:"calc_basic"}], -paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getField("OPERATOR",a),d=a.getNumberValue("LEFTHAND",a),e=a.getNumberValue("RIGHTHAND",a);return"PLUS"==c?d+e:"MINUS"==c?d-e:"MULTI"==c?d*e:d/e}},calc_plus:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"+",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b, -a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c+d}},calc_minus:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"-",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c-d}},calc_times:{color:"#FFD974",skeleton:"basic_string_field",statements:[], -params:[{type:"Block",accept:"string"},{type:"Text",text:"x",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c*d}},calc_divide:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"/",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0, -RIGHTHAND:2},func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c/d}},calc_mod:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"/",color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_mod_3,color:"#3D3D3D"}],events:{},def:{params:[{type:"number",params:["10"]},null,{type:"number",params:["10"]},null],type:"calc_mod"},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2}, -"class":"calc",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c%d}},calc_share:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"/",color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:"\uc758 \ubaab",color:"#3D3D3D"}],events:{},def:{params:[{type:"number",params:["10"]},null,{type:"number",params:["10"]},null],type:"calc_share"},paramsKeyMap:{LEFTHAND:0, -RIGHTHAND:2},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return Math.floor(c/d)}},calc_operation:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_calc_operation_of_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_operation_of_2,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_calc_operation_square,"square"],[Lang.Blocks.CALC_calc_operation_root, -"root"],[Lang.Blocks.CALC_calc_operation_sin,"sin"],[Lang.Blocks.CALC_calc_operation_cos,"cos"],[Lang.Blocks.CALC_calc_operation_tan,"tan"],[Lang.Blocks.CALC_calc_operation_asin,"asin_radian"],[Lang.Blocks.CALC_calc_operation_acos,"acos_radian"],[Lang.Blocks.CALC_calc_operation_atan,"atan_radian"],[Lang.Blocks.CALC_calc_operation_log,"log"],[Lang.Blocks.CALC_calc_operation_ln,"ln"],[Lang.Blocks.CALC_calc_operation_unnatural,"unnatural"],[Lang.Blocks.CALC_calc_operation_floor,"floor"],[Lang.Blocks.CALC_calc_operation_ceil, -"ceil"],[Lang.Blocks.CALC_calc_operation_round,"round"],[Lang.Blocks.CALC_calc_operation_factorial,"factorial"],[Lang.Blocks.CALC_calc_operation_abs,"abs"]],value:"square",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}],events:{},def:{params:[null,{type:"number",params:["10"]},null,null],type:"calc_operation"},paramsKeyMap:{LEFTHAND:1,VALUE:3},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getField("VALUE",a);if(-1<["asin_radian","acos_radian"].indexOf(d)&& -(1c))throw Error("x range exceeded");d.indexOf("_")&&(d=d.split("_")[0]);-1<["sin","cos","tan"].indexOf(d)&&(c=Entry.toRadian(c));var e=0;switch(d){case "square":e=c*c;break;case "factorial":e=Entry.factorial(c);break;case "root":e=Math.sqrt(c);break;case "log":e=Math.log(c)/Math.LN10;break;case "ln":e=Math.log(c);break;case "asin":case "acos":case "atan":e=Entry.toDegrees(Math[d](c));break;case "unnatural":e=c-Math.floor(c);0>c&&(e=1-e);break;default:e=Math[d](c)}return e}},calc_rand:{color:"#FFD974", -skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_calc_rand_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_rand_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_rand_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"number",params:["0"]},null,{type:"number",params:["10"]},null],type:"calc_rand"},paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3},"class":"calc",isNotFor:[],func:function(b, -a){var c=a.getStringValue("LEFTHAND",a),d=a.getStringValue("RIGHTHAND",a),e=Math.min(c,d),f=Math.max(c,d),c=Entry.isFloat(c);return Entry.isFloat(d)||c?(Math.random()*(f-e)+e).toFixed(2):Math.floor(Math.random()*(f-e+1)+e)}},get_date:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_date_1,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_get_date_year,"YEAR"],[Lang.Blocks.CALC_get_date_month,"MONTH"],[Lang.Blocks.CALC_get_date_day, -"DAY"],[Lang.Blocks.CALC_get_date_hour,"HOUR"],[Lang.Blocks.CALC_get_date_minute,"MINUTE"],[Lang.Blocks.CALC_get_date_second,"SECOND"]],value:"YEAR",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_get_date_2,color:"#3D3D3D"}],events:{},def:{params:[null,"YEAR",null],type:"get_date"},paramsKeyMap:{VALUE:1},"class":"calc_date",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d=new Date;return"YEAR"==c?d.getFullYear():"MONTH"==c?d.getMonth()+1:"DAY"== -c?d.getDate():"HOUR"==c?d.getHours():"MINUTE"==c?d.getMinutes():d.getSeconds()}},get_sound_duration:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_sound_duration_1,color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"sounds",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_get_sound_duration_2,color:"#3D3D3D"}],events:{},def:{params:[null,null,null],type:"get_sound_duration"},paramsKeyMap:{VALUE:1}, -"class":"calc_duration",isNotFor:[],func:function(b,a){for(var c=a.getField("VALUE",a),d=b.parent.sounds,e=0;ed||d>c.length-1)throw Error();return c[d]}},length_of_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_length_of_string_1, -color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_length_of_string_2,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.entry]},null],type:"length_of_string"},paramsKeyMap:{STRING:1},"class":"calc_string",isNotFor:[],func:function(b,a){return a.getStringValue("STRING",a).length}},substring:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_substring_1,color:"#3D3D3D"},{type:"Block",accept:"string"}, -{type:"Text",text:Lang.Blocks.CALC_substring_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_substring_3,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_substring_4,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"number",params:["2"]},null,{type:"number",params:["5"]},null],type:"substring"},paramsKeyMap:{STRING:1,START:3,END:5},"class":"calc_string",isNotFor:[],func:function(b, -a){var c=a.getStringValue("STRING",a),d=a.getNumberValue("START",a)-1,e=a.getNumberValue("END",a)-1,f=c.length-1;if(0>d||0>e||d>f||e>f)throw Error();return c.substring(Math.min(d,e),Math.max(d,e)+1)}},replace_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_replace_string_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_3, -color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_4,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"text",params:[Lang.Blocks.hello]},null,{type:"text",params:[Lang.Blocks.nice]},null],type:"replace_string"},paramsKeyMap:{STRING:1,OLD_WORD:3,NEW_WORD:5},"class":"calc_string",isNotFor:[],func:function(b,a){return a.getStringValue("STRING",a).replace(new RegExp(a.getStringValue("OLD_WORD",a),"gm"), -a.getStringValue("NEW_WORD",a))}},change_string_case:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_change_string_case_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_change_string_case_2,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_change_string_case_sub_1,"toUpperCase"],[Lang.Blocks.CALC_change_string_case_sub_2,"toLowerCase"]],value:"toUpperCase",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}, -{type:"Text",text:Lang.Blocks.CALC_change_string_case_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:["Hello Entry!"]},null,null,null],type:"change_string_case"},paramsKeyMap:{STRING:1,CASE:3},"class":"calc_string",isNotFor:[],func:function(b,a){return a.getStringValue("STRING",a)[a.getField("CASE",a)]()}},index_of_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_index_of_string_1,color:"#3D3D3D"},{type:"Block",accept:"string"}, -{type:"Text",text:Lang.Blocks.CALC_index_of_string_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_index_of_string_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"text",params:[Lang.Blocks.entry]},null],type:"index_of_string"},paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3},"class":"calc_string",isNotFor:[],func:function(b,a){var c=a.getStringValue("LEFTHAND",a),d=a.getStringValue("RIGHTHAND",a),c=c.indexOf(d);return-1< -c?c+1:0}},combine_something:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.VARIABLE_combine_something_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.VARIABLE_combine_something_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.VARIABLE_combine_something_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.block_hi]},null,{type:"text",params:[Lang.Blocks.entry]}, -null],type:"combine_something"},paramsKeyMap:{VALUE1:1,VALUE2:3},"class":"calc_string",isNotFor:[],func:function(b,a){var c=a.getStringValue("VALUE1",a),d=a.getStringValue("VALUE2",a);return c+d}},get_sound_volume:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_sound_volume,color:"#3D3D3D"},{type:"Text",text:"",color:"#3D3D3D"}],events:{},def:{params:[null,null],type:"get_sound_volume"},"class":"calc",isNotFor:[""],func:function(b,a){return 100* -createjs.Sound.getVolume()}},quotient_and_mod:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_quotient_and_mod_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_quotient_and_mod_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_quotient_and_mod_3,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_quotient_and_mod_sub_1,"QUOTIENT"],[Lang.Blocks.CALC_quotient_and_mod_sub_2, -"MOD"]],value:"QUOTIENT",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}],events:{},def:{params:[null,{type:"text",params:["10"]},null,{type:"text",params:["10"]},null,null],type:"quotient_and_mod"},paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3,OPERATOR:5},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);if(isNaN(c)||isNaN(d))throw Error();return"QUOTIENT"==a.getField("OPERATOR",a)?Math.floor(c/d):c%d}},choose_project_timer_action:{color:"#FFD974", -skeleton:"basic",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_choose_project_timer_action_1,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_choose_project_timer_action_sub_1,"START"],[Lang.Blocks.CALC_choose_project_timer_action_sub_2,"STOP"],[Lang.Blocks.CALC_choose_project_timer_action_sub_3,"RESET"]],value:"START",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_choose_project_timer_action_2,color:"#3D3D3D"},{type:"Indicator",img:"block_icon/calc_01.png", -size:12}],events:{viewAdd:[function(){Entry.engine&&Entry.engine.showProjectTimer()}],dataDestroy:[function(b){Entry.engine&&Entry.engine.hideProjectTimer(b)}]},def:{params:[null,"START",null,null],type:"choose_project_timer_action"},paramsKeyMap:{ACTION:1},"class":"calc_timer",isNotFor:[],func:function(b,a){var c=a.getField("ACTION"),d=Entry.engine,e=d.projectTimer;"START"==c?e.isInit?e.isInit&&e.isPaused&&(e.pauseStart&&(e.pausedTime+=(new Date).getTime()-e.pauseStart),delete e.pauseStart,e.isPaused= -!1):d.startProjectTimer():"STOP"==c?e.isInit&&!e.isPaused&&(e.isPaused=!0,e.pauseStart=(new Date).getTime()):"RESET"==c&&e.isInit&&(e.setValue(0),e.start=(new Date).getTime(),e.pausedTime=0,delete e.pauseStart);return a.callReturn()}},wait_second:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"number",params:["2"]},null],type:"wait_second"},paramsKeyMap:{SECOND:0},"class":"delay", -isNotFor:[],func:function(b,a){if(a.isStart){if(1==a.timeFlag)return a;delete a.timeFlag;delete a.isStart;Entry.engine.isContinue=!1;return a.callReturn()}a.isStart=!0;a.timeFlag=1;var c=a.getNumberValue("SECOND",a);setTimeout(function(){a.timeFlag=0},60/(Entry.FPS||60)*c*1E3);return a}},repeat_basic:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"number", -params:["10"]},null],type:"repeat_basic"},paramsKeyMap:{VALUE:0},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(b,a){var c;if(!a.isLooped){a.isLooped=!0;c=a.getNumberValue("VALUE",a);if(0>c)throw Error(Lang.Blocks.FLOW_repeat_basic_errorMsg);a.iterCount=Math.floor(c)}if(0==a.iterCount||0>a.iterCount)return delete a.isLooped,delete a.iterCount,a.callReturn();a.iterCount--;return a.getStatement("DO",a)}},repeat_inf:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}], -params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null],type:"repeat_inf"},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(b,a){a.isLooped=!0;return a.getStatement("DO")}},stop_repeat:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null],type:"stop_repeat"},"class":"repeat",isNotFor:[],func:function(b,a){return this.executor.breakLoop()}},wait_until_true:{color:"#498deb", -skeleton:"basic",statements:[],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"},null],type:"wait_until_true"},paramsKeyMap:{BOOL:0},"class":"wait",isNotFor:[],func:function(b,a){return a.getBooleanValue("BOOL",a)?a.callReturn():a}},_if:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"}, -null],type:"_if"},paramsKeyMap:{BOOL:0},statementsKeyMap:{STACK:0},"class":"condition",isNotFor:[],func:function(b,a){return a.isCondition?(delete a.isCondition,a.callReturn()):a.getBooleanValue("BOOL",a)?(a.isCondition=!0,a.getStatement("STACK",a)):a.callReturn()}},if_else:{color:"#498deb",skeleton:"basic_double_loop",statements:[{accept:"basic"},{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12},{type:"LineBreak"}],events:{},def:{params:[{type:"True"}, -null],type:"if_else"},paramsKeyMap:{BOOL:0},statementsKeyMap:{STACK_IF:0,STACK_ELSE:1},"class":"condition",isNotFor:[],func:function(b,a){if(a.isCondition)return delete a.isCondition,a.callReturn();var c=a.getBooleanValue("BOOL",a);a.isCondition=!0;return c?a.getStatement("STACK_IF",a):a.getStatement("STACK_ELSE",a)}},create_clone:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"clone",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator", -img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null,null],type:"create_clone"},paramsKeyMap:{VALUE:0},"class":"clone",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d=a.callReturn();"self"==c?b.parent.addCloneEntity(b.parent,b,null):Entry.container.getObject(c).addCloneEntity(b.parent,null,null);return d}},delete_clone:{color:"#498deb",skeleton:"basic_without_next",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null], -type:"delete_clone"},"class":"clone",isNotFor:[],func:function(b,a){if(!b.isClone)return a.callReturn();b.removeClone();return this.die()}},when_clone_start:{color:"#498deb",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_clone.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"when_clone_start"},"class":"clone",isNotFor:[],func:function(b,a){return a.callReturn()},event:"when_clone_start"},stop_run:{color:"#498deb",skeleton:"basic",statements:[], -params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null]},func:function(b,a){return Entry.engine.toggleStop()}},repeat_while_true:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Dropdown",options:[[Lang.Blocks.FLOW_repeat_while_true_until,"until"],[Lang.Blocks.FLOW_repeat_while_true_while,"while"]],value:"until",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator",img:"block_icon/flow_03.png", -size:12}],events:{},def:{params:[{type:"True"},null,null],type:"repeat_while_true"},paramsKeyMap:{BOOL:0,OPTION:1},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(b,a){var c=a.getBooleanValue("BOOL",a);"until"==a.getField("OPTION",a)&&(c=!c);return(a.isLooped=c)?a.getStatement("DO",a):a.callReturn()}},stop_object:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.FLOW_stop_object_all,"all"],[Lang.Blocks.FLOW_stop_object_this_object,"thisOnly"], -[Lang.Blocks.FLOW_stop_object_this_thread,"thisThread"],[Lang.Blocks.FLOW_stop_object_other_thread,"otherThread"]],value:"all",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null,null],type:"stop_object"},paramsKeyMap:{TARGET:0},"class":"terminate",isNotFor:[],func:function(b,a){var c=a.getField("TARGET",a),d=Entry.container;switch(c){case "all":return d.clearRunningState(),this.die();case "thisOnly":return b.parent.script.clearExecutorsByEntity(b), -this.die();case "thisObject":return b.parent.script.clearExecutors(),this.die();case "thisThread":return this.die();case "otherThread":for(var c=this.executor,d=b.parent.script,e=d.executors,f=0;fa.count?(50>d.leftFloor&&50>d.rightFloor?a.count++:a.count=0,d=d.leftFloor-d.rightFloor,c.leftWheel=45+.25*d,c.rightWheel=45-.25*d):(a.count=0,a.boardState=2);break;case 2:d=d.leftFloor-d.rightFloor;c.leftWheel=45+.25*d;c.rightWheel= -45-.25*d;a.boardState=3;var e=setTimeout(function(){a.boardState=4;Entry.Hamster.removeTimeout(e)},250);Entry.Hamster.timeouts.push(e);break;case 3:d=d.leftFloor-d.rightFloor;c.leftWheel=45+.25*d;c.rightWheel=45-.25*d;break;case 4:c.leftWheel=0,c.rightWheel=0,a.boardState=0,a.isMoving=!1}return a}delete a.isStart;delete a.isMoving;delete a.count;delete a.boardState;Entry.engine.isContinue=!1;c.leftWheel=0;c.rightWheel=0;return a.callReturn()}a.isStart=!0;a.isMoving=!0;a.count=0;a.boardState=1;c.leftWheel= -45;c.rightWheel=45;Entry.Hamster.setLineTracerMode(c,0);return a}},hamster_turn_once:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null],type:"hamster_turn_once"},paramsKeyMap:{DIRECTION:0},"class":"hamster_board",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=Entry.hw.portData; -if(a.isStart){if(a.isMoving){if(a.isLeft)switch(a.boardState){case 1:2>a.count?50d.leftFloor&&(a.boardState=3);break;case 3:2>a.count?20>d.leftFloor&&a.count++:(a.count=0,a.boardState=4);break;case 4:50a.count?50d.rightFloor&&(a.boardState=3);break;case 3:2>a.count?20>d.rightFloor&&a.count++:(a.count=0,a.boardState=4);break;case 4:50Entry.hw.getAnalogPortValue(0)?1:0}},CODEino_get_light_status:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Dropdown", +options:[[Lang.Blocks.CODEino_string_14,"BRIGHT"],[Lang.Blocks.CODEino_string_15,"DARK"]],value:"BRIGHT",fontSize:11}],events:{},def:{params:[null],type:"CODEino_get_light_status"},paramsKeyMap:{STATUS:0},"class":"CODEino",isNotFor:["CODEino"],func:function(b,a){return"DARK"==a.getField("STATUS",a)?800Entry.hw.getAnalogPortValue(1)?1:0}},CODEino_is_button_pressed:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"Dropdown", +options:[[Lang.Blocks.CODEino_string_3,"4"],[Lang.Blocks.CODEino_string_4,"17"],[Lang.Blocks.CODEino_string_5,"18"],[Lang.Blocks.CODEino_string_6,"19"],[Lang.Blocks.CODEino_string_7,"20"]],value:"4",fontSize:11}],events:{},def:{params:[null],type:"CODEino_is_button_pressed"},paramsKeyMap:{PORT:0},"class":"CODEino",isNotFor:["CODEino"],func:function(b,a){var c=a.getNumberField("PORT",a);return 14d?1:0;if("RIGHT"==c||"FRONT"==c)return 30d?1:0}},CODEino_get_accelerometer_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[["X","3"],["Y","4"],["Z","5"]],value:"3",fontSize:11}], +events:{},def:{params:[null],type:"CODEino_get_accelerometer_value"},paramsKeyMap:{PORT:0},"class":"CODEino",isNotFor:["CODEino"],func:function(b,a){var c=265,d=402,e=-90,f=90,g=Entry.hw.getAnalogPortValue(a.getField("PORT",a));if(c>d)var h=c,c=d,d=h;e>f&&(h=e,e=f,f=h);g=(f-e)/(d-c)*(g-c);g+=e;g=Math.min(f,g);g=Math.max(e,g);return Math.round(g)}},nemoino_get_named_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],template:"%1 \uc13c\uc11c\uac12",params:[{type:"Dropdown", +options:[["\uc18c\ub9ac","0"],["\ube5b","1"],["\uc2ac\ub77c\uc774\ub354","2"],["\uc800\ud56d-A","3"],["\uc800\ud56d-B","4"],["\uc800\ud56d-C","5"],["\uc800\ud56d-D","6"]],value:"0",fontSize:11}],events:{},def:{params:[null],type:"nemoino_get_named_sensor_value"},paramsKeyMap:{PORT:0},"class":"nemoino",isNotFor:["nemoino"],func:function(b,a){return Entry.hw.getAnalogPortValue(a.getField("PORT",a))}},nemoino_get_sound_status:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field",statements:[], +template:"\uc18c\ub9ac\uc13c\uc11c %1",params:[{type:"Dropdown",options:[["\uc18c\ub9ac\ud07c","GREAT"],["\uc18c\ub9ac\uc791\uc74c","SMALL"]],value:"GREAT",fontSize:11}],events:{},def:{params:[null],type:"nemoino_get_sound_status"},paramsKeyMap:{STATUS:0},"class":"nemoino",isNotFor:["nemoino"],func:function(b,a){return"GREAT"==a.getField("STATUS",a)?600Entry.hw.getAnalogPortValue(0)?1:0}},nemoino_is_button_pressed:{color:"#00979D",fontColor:"#fff",skeleton:"basic_boolean_field", +statements:[],template:"\ubcf4\ub4dc\uc758 %1",params:[{type:"Dropdown",options:[["\ubc84\ud2bc\ub204\ub984","4"],["A\uc5f0\uacb0\ub428","17"],["B\uc5f0\uacb0\ub428","18"],["C\uc5f0\uacb0\ub428","19"],["D\uc5f0\uacb0\ub428","20"]],value:"4",fontSize:11}],events:{},def:{params:[null],type:"nemoino_is_button_pressed"},paramsKeyMap:{PORT:0},"class":"nemoino",isNotFor:["nemoino"],func:function(b,a){var c=a.getNumberField("PORT",a);return 14d?1:0;if("RIGHT"==c||"FRONT"==c)return 30d?1:0}},nemoino_get_accelerometer_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field", +statements:[],template:"3\ucd95 \uac00\uc18d\ub3c4\uc13c\uc11c %1 \ucd95\uc758 \uc13c\uc11c\uac12",params:[{type:"Dropdown",options:[["X","3"],["Y","4"],["Z","5"]],value:"3",fontSize:11}],events:{},def:{params:[null],type:"nemoino_get_accelerometer_value"},paramsKeyMap:{PORT:0},"class":"nemoino",isNotFor:["nemoino"],func:function(b,a){var c=265,d=402,e=-90,f=90,g=Entry.hw.getAnalogPortValue(a.getField("PORT",a));if(c>d)var h=c,c=d,d=h;e>f&&(h=e,e=f,f=h);g=(f-e)/(d-c)*(g-c);g+=e;g=Math.min(f,g);g= +Math.max(e,g);return Math.round(g)}},bitbrick_sensor_value:{color:"#00979D",fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_HW,menuName:Entry.Bitbrick.sensorList}],events:{},def:{params:[null],type:"bitbrick_sensor_value"},paramsKeyMap:{PORT:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=a.getStringField("PORT");return Entry.hw.portData[c].value}},bitbrick_is_touch_pressed:{color:"#00979D", +fontColor:"#fff",skeleton:"basic_boolean_field",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.touchList}],events:{},def:{params:[null],type:"bitbrick_is_touch_pressed"},paramsKeyMap:{PORT:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){return 0===Entry.hw.portData[a.getStringField("PORT")].value}},bitbrick_turn_off_color_led:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}], +events:{},def:{params:[null],type:"bitbrick_turn_off_color_led",id:"i3je"},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){Entry.hw.sendQueue.LEDR=0;Entry.hw.sendQueue.LEDG=0;Entry.hw.sendQueue.LEDB=0;return a.callReturn()}},bitbrick_turn_on_color_led_by_rgb:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text", +params:["255"]},{type:"text",params:["255"]},{type:"text",params:["255"]},null],type:"bitbrick_turn_on_color_led_by_rgb"},paramsKeyMap:{rValue:0,gValue:1,bValue:2},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=a.getNumberValue("rValue"),d=a.getNumberValue("gValue"),e=a.getNumberValue("bValue"),f=Entry.adjustValueWithMaxMin,g=Entry.hw.sendQueue;g.LEDR=f(c,0,255);g.LEDG=f(d,0,255);g.LEDB=f(e,0,255);return a.callReturn()}},bitbrick_turn_on_color_led_by_picker:{color:"#00979D",skeleton:"basic", +statements:[],params:[{type:"Color"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"bitbrick_turn_on_color_led_by_picker"},paramsKeyMap:{VALUE:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=a.getStringField("VALUE");Entry.hw.sendQueue.LEDR=parseInt(c.substr(1,2),16);Entry.hw.sendQueue.LEDG=parseInt(c.substr(3,2),16);Entry.hw.sendQueue.LEDB=parseInt(c.substr(5,2),16);return a.callReturn()}},bitbrick_turn_on_color_led_by_value:{color:"#00979D", +skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["0"]},null],type:"bitbrick_turn_on_color_led_by_value"},paramsKeyMap:{VALUE:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=a.getNumberValue("VALUE"),d,e,f,c=c%200;67>c?(d=200-3*c,e=3*c,f=0):134>c?(c-=67,d=0,e=200-3*c,f=3*c):201>c&&(c-=134,d=3*c,e=0,f=200-3*c);Entry.hw.sendQueue.LEDR=d;Entry.hw.sendQueue.LEDG= +e;Entry.hw.sendQueue.LEDB=f;return a.callReturn()}},bitbrick_buzzer:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[{type:"text",params:["60"]},null],type:"bitbrick_buzzer"},paramsKeyMap:{VALUE:0},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){if(a.isStart)return Entry.hw.sendQueue.buzzer=0,delete a.isStart,a.callReturn();var c=a.getNumberValue("VALUE");Entry.hw.sendQueue.buzzer= +c;a.isStart=!0;return a}},bitbrick_turn_off_all_motors:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null],type:"bitbrick_turn_off_all_motors"},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=Entry.hw.sendQueue,d=Entry.Bitbrick;d.servoList().map(function(a){c[a[1]]=0});d.dcList().map(function(a){c[a[1]]=128});return a.callReturn()}},bitbrick_dc_speed:{color:"#00979D",skeleton:"basic",statements:[], +params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.dcList},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"text",params:["60"]},null],type:"bitbrick_dc_speed"},paramsKeyMap:{PORT:0,VALUE:1},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=a.getNumberValue("VALUE"),c=Math.min(c,Entry.Bitbrick.dcMaxValue),c=Math.max(c,Entry.Bitbrick.dcMinValue);Entry.hw.sendQueue[a.getStringField("PORT")]= +c+128;return a.callReturn()}},bitbrick_dc_direction_speed:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.dcList},{type:"Dropdown",options:[[Lang.Blocks.BITBRICK_dc_direction_cw,"CW"],[Lang.Blocks.BITBRICK_dc_direction_ccw,"CCW"]],value:"CW",fontSize:11},{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,null,{type:"text",params:["100"]},null],type:"bitbrick_dc_direction_speed"}, +paramsKeyMap:{PORT:0,DIRECTION:1,VALUE:2},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c="CW"===a.getStringField("DIRECTION"),d=a.getNumberValue("VALUE"),d=Math.min(d,Entry.Bitbrick.dcMaxValue),d=Math.max(d,0);Entry.hw.sendQueue[a.getStringField("PORT")]=c?d+128:128-d;return a.callReturn()}},bitbrick_servomotor_angle:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.servoList},{type:"Block",accept:"string"}, +{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null,{type:"text",params:["100"]},null],type:"bitbrick_servomotor_angle"},paramsKeyMap:{PORT:0,VALUE:1},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=Entry.Bitbrick.servoMaxValue-(a.getNumberValue("VALUE")+1),c=Math.min(c,Entry.Bitbrick.servoMaxValue),c=Math.max(c,Entry.Bitbrick.servoMinValue);Entry.hw.sendQueue[a.getStringField("PORT")]=c;return a.callReturn()}},bitbrick_convert_scale:{color:"#00979D", +fontColor:"#fff",skeleton:"basic_string_field",statements:[],params:[{type:"DropdownDynamic",value:null,fontSize:11,menuName:Entry.Bitbrick.sensorList},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"},{type:"Block",accept:"string"}],events:{},def:{params:[null,{type:"number",params:["0"]},{type:"number",params:["1023"]},{type:"number",params:["-100"]},{type:"number",params:["100"]}],type:"bitbrick_convert_scale"},paramsKeyMap:{PORT:0,VALUE2:1,VALUE3:2,VALUE4:3, +VALUE5:4},"class":"condition",isNotFor:["bitbrick"],func:function(b,a){var c=a.getNumberField("PORT"),d=Entry.hw.portData[c].value,c=a.getNumberValue("VALUE2",a),e=a.getNumberValue("VALUE3",a),f=a.getNumberValue("VALUE4",a),g=a.getNumberValue("VALUE5",a);if(f>g)var h=f,f=g,g=h;d-=c;d*=(g-f)/(e-c);d+=f;d=Math.min(g,d);d=Math.max(f,d);return Math.round(d)}},start_drawing:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null], +type:"start_drawing"},"class":"brush_control",isNotFor:["textBox"],func:function(b,a){b.brush?b.brush.stop=!1:Entry.setBasicBrush(b);Entry.stage.sortZorder();b.brush.moveTo(b.getX(),-1*b.getY());return a.callReturn()}},stop_drawing:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"stop_drawing"},"class":"brush_control",isNotFor:["textBox"],func:function(b,a){b.brush&&b.shape&&(b.brush.stop=!0);return a.callReturn()}}, +set_color:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Color"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"set_color"},paramsKeyMap:{VALUE:0},"class":"brush_color",isNotFor:["textBox"],func:function(b,a){var c=a.getField("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(c=Entry.hex2rgb(c),b.brush.rgb=c,b.brush.endStroke(),b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(), +-1*b.getY()));return a.callReturn()}},set_random_color:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"set_random_color"},"class":"brush_color",isNotFor:["textBox"],func:function(b,a){b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);if(b.brush){var c=Entry.generateRgb();b.brush.rgb=c;b.brush.endStroke();b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")");b.brush.moveTo(b.getX(), +-1*b.getY())}return a.callReturn()}},change_thickness:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["1"]},null],type:"change_thickness"},paramsKeyMap:{VALUE:0},"class":"brush_thickness",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.thickness+=c,1>b.brush.thickness&& +(b.brush.thickness=1),b.brush.setStrokeStyle(b.brush.thickness),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}},set_thickness:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["1"]},null],type:"set_thickness"},paramsKeyMap:{VALUE:0},"class":"brush_thickness",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b), +b.brush.stop=!0);b.brush&&(b.brush.thickness=c,b.brush.setStrokeStyle(b.brush.thickness),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}},change_opacity:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_opacity"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE", +a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);c=Entry.adjustValueWithMaxMin(b.brush.opacity+c,0,100);b.brush&&(b.brush.opacity=c,b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}},set_opacity:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number", +params:["50"]},null],type:"set_opacity"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}},brush_erase_all:{color:"#FF9E20",skeleton:"basic",statements:[], +params:[{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"brush_erase_all"},"class":"brush_clear",isNotFor:["textBox"],func:function(b,a){var c=b.brush;if(c){var d=c._stroke.style,e=c._strokeStyle.width;c.clear().setStrokeStyle(e).beginStroke(d);c.moveTo(b.getX(),-1*b.getY())}c=b.parent.getStampEntities();c.map(function(a){a.removeClone()});c=null;return a.callReturn()}},brush_stamp:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Indicator", +img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[null],type:"brush_stamp"},"class":"stamp",isNotFor:["textBox"],func:function(b,a){b.parent.addStampEntity(b);return a.callReturn()}},change_brush_transparency:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator",img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["10"]},null],type:"change_brush_transparency"},paramsKeyMap:{VALUE:0},"class":"brush_opacity", +isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);c=Entry.adjustValueWithMaxMin(b.brush.opacity-c,0,100);b.brush&&(b.brush.opacity=c,b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+b.brush.opacity/100+")"),b.brush.moveTo(b.getX(),-1*b.getY()));return a.callReturn()}},set_brush_tranparency:{color:"#FF9E20",skeleton:"basic",statements:[],params:[{type:"Block",accept:"string"},{type:"Indicator", +img:"block_icon/brush_03.png",size:12}],events:{},def:{params:[{type:"number",params:["50"]},null],type:"set_brush_tranparency"},paramsKeyMap:{VALUE:0},"class":"brush_opacity",isNotFor:["textBox"],func:function(b,a){var c=a.getNumberValue("VALUE",a);b.brush||(Entry.setBasicBrush(b),b.brush.stop=!0);b.brush&&(b.brush.opacity=Entry.adjustValueWithMaxMin(c,0,100),b.brush.endStroke(),c=b.brush.rgb,b.brush.beginStroke("rgba("+c.r+","+c.g+","+c.b+","+(1-b.brush.opacity/100)+")"),b.brush.moveTo(b.getX(), +-1*b.getY()));return a.callReturn()}},number:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"TextInput",value:10}],events:{},def:{params:[]},paramsKeyMap:{NUM:0},func:function(b,a){return a.getField("NUM",a)},isPrimitive:!0},angle:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Angle"}],events:{},def:{params:[null],type:"angle"},paramsKeyMap:{ANGLE:0},func:function(b,a){return a.getNumberField("ANGLE")}},get_x_coordinate:{color:"#FFD974",skeleton:"basic_string_field", +statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_x_coordinate,color:"#3D3D3D"}],events:{},def:{params:[null],type:"get_x_coordinate"},"class":"calc",isNotFor:[],func:function(b,a){return b.getX()}},get_y_coordinate:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_y_coordinate,color:"#3D3D3D"}],events:{},def:{params:[null],type:"get_y_coordinate"},"class":"calc",isNotFor:[],func:function(b,a){return b.getY()}},get_angle:{color:"#FFD974", +skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_angle,color:"#3D3D3D"}],events:{},def:{params:[null]},func:function(b,a){return parseFloat(b.getRotation().toFixed(1))}},get_rotation_direction:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Dropdown",options:[[Lang.Blocks.CALC_rotation_value,"ROTATION"],[Lang.Blocks.CALC_direction_value,"DIRECTION"]],value:"ROTATION",fontSize:11}],events:{},def:{params:[null],type:"get_rotation_direction"}, +paramsKeyMap:{OPERATOR:0},"class":"calc",isNotFor:[],func:function(b,a){return"DIRECTION"==a.getField("OPERATOR",a).toUpperCase()?parseFloat(b.getDirection().toFixed(1)):parseFloat(b.getRotation().toFixed(1))}},distance_something:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_distance_something_1,color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"spritesWithMouse",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text", +text:Lang.Blocks.CALC_distance_something_2,color:"#3D3D3D"}],events:{},def:{params:[null,null,null],type:"distance_something"},paramsKeyMap:{VALUE:1},"class":"calc_distance",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a);if("mouse"==c)return c=Entry.stage.mouseCoordinate,Math.sqrt(Math.pow(b.getX()-c.x,2)+Math.pow(b.getY()-c.y,2));c=Entry.container.getEntity(c);return Math.sqrt(Math.pow(b.getX()-c.getX(),2)+Math.pow(b.getY()-c.getY(),2))}},coordinate_mouse:{color:"#FFD974",skeleton:"basic_string_field", +statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_coordinate_mouse_1,color:"#3D3D3D"},{type:"Dropdown",options:[["x","x"],["y","y"]],value:"x",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_coordinate_mouse_2,color:"#3D3D3D"}],events:{},def:{params:[null,null,null],type:"coordinate_mouse"},paramsKeyMap:{VALUE:1},"class":"calc",isNotFor:[],func:function(b,a){return"x"===a.getField("VALUE",a)?Number(Entry.stage.mouseCoordinate.x):Number(Entry.stage.mouseCoordinate.y)}}, +coordinate_object:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_coordinate_object_1,color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"spritesWithSelf",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_coordinate_object_2,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_coordinate_x_value,"x"],[Lang.Blocks.CALC_coordinate_y_value,"y"],[Lang.Blocks.CALC_coordinate_rotation_value,"rotation"], +[Lang.Blocks.CALC_coordinate_direction_value,"direction"],[Lang.Blocks.CALC_coordinate_size_value,"size"],[Lang.Blocks.CALC_picture_index,"picture_index"],[Lang.Blocks.CALC_picture_name,"picture_name"]],value:"x",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}],events:{},def:{params:[null,null,null,null],type:"coordinate_object"},paramsKeyMap:{VALUE:1,COORDINATE:3},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),c="self"==c?b:Entry.container.getEntity(c);switch(a.getField("COORDINATE", +a)){case "x":return c.getX();case "y":return c.getY();case "rotation":return c.getRotation();case "direction":return c.getDirection();case "picture_index":var d=c.parent,d=d.pictures;return d.indexOf(c.picture)+1;case "size":return Number(c.getSize().toFixed(1));case "picture_name":return d=c.parent,d=d.pictures,d[d.indexOf(c.picture)].name}}},calc_basic:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Dropdown",options:[["+","PLUS"],["-", +"MINUS"],["x","MULTI"],["/","DIVIDE"]],value:"PLUS",fontSize:11,noArrow:!0},{type:"Block",accept:"string"}],events:{},def:{params:[{type:"number",params:["10"]},"PLUS",{type:"number",params:["10"]}],type:"calc_basic"},defs:[{params:[{type:"number",params:["10"]},"PLUS",{type:"number",params:["10"]}],type:"calc_basic"},{params:[{type:"number",params:["10"]},"MINUS",{type:"number",params:["10"]}],type:"calc_basic"},{params:[{type:"number",params:["10"]},"MULTI",{type:"number",params:["10"]}],type:"calc_basic"}, +{params:[{type:"number",params:["10"]},"DIVIDE",{type:"number",params:["10"]}],type:"calc_basic"}],paramsKeyMap:{LEFTHAND:0,OPERATOR:1,RIGHTHAND:2},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getField("OPERATOR",a),d=a.getNumberValue("LEFTHAND",a),e=a.getNumberValue("RIGHTHAND",a);return"PLUS"==c?d+e:"MINUS"==c?d-e:"MULTI"==c?d*e:d/e}},calc_plus:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"+",color:"#3D3D3D"},{type:"Block", +accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c+d}},calc_minus:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"-",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND", +a);return c-d}},calc_times:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"x",color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c*d}},calc_divide:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"/", +color:"#3D3D3D"},{type:"Block",accept:"string"}],events:{},def:{params:[null]},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c/d}},calc_mod:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"/",color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_mod_3,color:"#3D3D3D"}],events:{},def:{params:[{type:"number", +params:["10"]},null,{type:"number",params:["10"]},null],type:"calc_mod"},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return c%d}},calc_share:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Block",accept:"string"},{type:"Text",text:"/",color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:"\uc758 \ubaab",color:"#3D3D3D"}],events:{},def:{params:[{type:"number", +params:["10"]},null,{type:"number",params:["10"]},null],type:"calc_share"},paramsKeyMap:{LEFTHAND:0,RIGHTHAND:2},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getNumberValue("LEFTHAND",a),d=a.getNumberValue("RIGHTHAND",a);return Math.floor(c/d)}},calc_operation:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_calc_operation_of_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_operation_of_2,color:"#3D3D3D"}, +{type:"Dropdown",options:[[Lang.Blocks.CALC_calc_operation_square,"square"],[Lang.Blocks.CALC_calc_operation_root,"root"],[Lang.Blocks.CALC_calc_operation_sin,"sin"],[Lang.Blocks.CALC_calc_operation_cos,"cos"],[Lang.Blocks.CALC_calc_operation_tan,"tan"],[Lang.Blocks.CALC_calc_operation_asin,"asin_radian"],[Lang.Blocks.CALC_calc_operation_acos,"acos_radian"],[Lang.Blocks.CALC_calc_operation_atan,"atan_radian"],[Lang.Blocks.CALC_calc_operation_log,"log"],[Lang.Blocks.CALC_calc_operation_ln,"ln"],[Lang.Blocks.CALC_calc_operation_unnatural, +"unnatural"],[Lang.Blocks.CALC_calc_operation_floor,"floor"],[Lang.Blocks.CALC_calc_operation_ceil,"ceil"],[Lang.Blocks.CALC_calc_operation_round,"round"],[Lang.Blocks.CALC_calc_operation_factorial,"factorial"],[Lang.Blocks.CALC_calc_operation_abs,"abs"]],value:"square",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC}],events:{},def:{params:[null,{type:"number",params:["10"]},null,null],type:"calc_operation"},paramsKeyMap:{LEFTHAND:1,VALUE:3},"class":"calc",isNotFor:[],func:function(b,a){var c= +a.getNumberValue("LEFTHAND",a),d=a.getField("VALUE",a);if(-1<["asin_radian","acos_radian"].indexOf(d)&&(1c))throw Error("x range exceeded");d.indexOf("_")&&(d=d.split("_")[0]);-1<["sin","cos","tan"].indexOf(d)&&(c=Entry.toRadian(c));var e=0;switch(d){case "square":e=c*c;break;case "factorial":e=Entry.factorial(c);break;case "root":e=Math.sqrt(c);break;case "log":e=Math.log(c)/Math.LN10;break;case "ln":e=Math.log(c);break;case "asin":case "acos":case "atan":e=Entry.toDegrees(Math[d](c));break; +case "unnatural":e=c-Math.floor(c);0>c&&(e=1-e);break;default:e=Math[d](c)}return e}},calc_rand:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_calc_rand_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_rand_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_calc_rand_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"number",params:["0"]},null,{type:"number",params:["10"]}, +null],type:"calc_rand"},paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3},"class":"calc",isNotFor:[],func:function(b,a){var c=a.getStringValue("LEFTHAND",a),d=a.getStringValue("RIGHTHAND",a),e=Math.min(c,d),f=Math.max(c,d),c=Entry.isFloat(c);return Entry.isFloat(d)||c?(Math.random()*(f-e)+e).toFixed(2):Math.floor(Math.random()*(f-e+1)+e)}},get_date:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_date_1,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_get_date_year, +"YEAR"],[Lang.Blocks.CALC_get_date_month,"MONTH"],[Lang.Blocks.CALC_get_date_day,"DAY"],[Lang.Blocks.CALC_get_date_hour,"HOUR"],[Lang.Blocks.CALC_get_date_minute,"MINUTE"],[Lang.Blocks.CALC_get_date_second,"SECOND"]],value:"YEAR",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_get_date_2,color:"#3D3D3D"}],events:{},def:{params:[null,"YEAR",null],type:"get_date"},paramsKeyMap:{VALUE:1},"class":"calc_date",isNotFor:[],func:function(b,a){var c=a.getField("VALUE", +a),d=new Date;return"YEAR"==c?d.getFullYear():"MONTH"==c?d.getMonth()+1:"DAY"==c?d.getDate():"HOUR"==c?d.getHours():"MINUTE"==c?d.getMinutes():d.getSeconds()}},get_sound_duration:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_get_sound_duration_1,color:"#3D3D3D"},{type:"DropdownDynamic",value:null,menuName:"sounds",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_get_sound_duration_2,color:"#3D3D3D"}], +events:{},def:{params:[null,null,null],type:"get_sound_duration"},paramsKeyMap:{VALUE:1},"class":"calc_duration",isNotFor:[],func:function(b,a){for(var c=a.getField("VALUE",a),d=b.parent.sounds,e=0;ed||d>c.length-1)throw Error();return c[d]}},length_of_string:{color:"#FFD974", +skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_length_of_string_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_length_of_string_2,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.entry]},null],type:"length_of_string"},paramsKeyMap:{STRING:1},"class":"calc_string",isNotFor:[],func:function(b,a){return a.getStringValue("STRING",a).length}},substring:{color:"#FFD974",skeleton:"basic_string_field", +statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_substring_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_substring_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_substring_3,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_substring_4,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"number",params:["2"]},null,{type:"number",params:["5"]}, +null],type:"substring"},paramsKeyMap:{STRING:1,START:3,END:5},"class":"calc_string",isNotFor:[],func:function(b,a){var c=a.getStringValue("STRING",a),d=a.getNumberValue("START",a)-1,e=a.getNumberValue("END",a)-1,f=c.length-1;if(0>d||0>e||d>f||e>f)throw Error();return c.substring(Math.min(d,e),Math.max(d,e)+1)}},replace_string:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_replace_string_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text", +text:Lang.Blocks.CALC_replace_string_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_3,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_replace_string_4,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"text",params:[Lang.Blocks.hello]},null,{type:"text",params:[Lang.Blocks.nice]},null],type:"replace_string"},paramsKeyMap:{STRING:1,OLD_WORD:3,NEW_WORD:5},"class":"calc_string", +isNotFor:[],func:function(b,a){return a.getStringValue("STRING",a).replace(new RegExp(a.getStringValue("OLD_WORD",a),"gm"),a.getStringValue("NEW_WORD",a))}},change_string_case:{color:"#FFD974",skeleton:"basic_string_field",statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_change_string_case_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_change_string_case_2,color:"#3D3D3D"},{type:"Dropdown",options:[[Lang.Blocks.CALC_change_string_case_sub_1,"toUpperCase"], +[Lang.Blocks.CALC_change_string_case_sub_2,"toLowerCase"]],value:"toUpperCase",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_CALC},{type:"Text",text:Lang.Blocks.CALC_change_string_case_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:["Hello Entry!"]},null,null,null],type:"change_string_case"},paramsKeyMap:{STRING:1,CASE:3},"class":"calc_string",isNotFor:[],func:function(b,a){return a.getStringValue("STRING",a)[a.getField("CASE",a)]()}},index_of_string:{color:"#FFD974",skeleton:"basic_string_field", +statements:[],params:[{type:"Text",text:Lang.Blocks.CALC_index_of_string_1,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_index_of_string_2,color:"#3D3D3D"},{type:"Block",accept:"string"},{type:"Text",text:Lang.Blocks.CALC_index_of_string_3,color:"#3D3D3D"}],events:{},def:{params:[null,{type:"text",params:[Lang.Blocks.hi_entry]},null,{type:"text",params:[Lang.Blocks.entry]},null],type:"index_of_string"},paramsKeyMap:{LEFTHAND:1,RIGHTHAND:3},"class":"calc_string", +isNotFor:[],func:function(b,a){var c=a.getStringValue("LEFTHAND",a),d=a.getStringValue("RIGHTHAND",a),c=c.indexOf(d);return-1c)throw Error(Lang.Blocks.FLOW_repeat_basic_errorMsg);a.iterCount=Math.floor(c)}if(0==a.iterCount||0>a.iterCount)return delete a.isLooped,delete a.iterCount,a.callReturn();a.iterCount--; +return a.getStatement("DO",a)}},repeat_inf:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null],type:"repeat_inf"},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(b,a){a.isLooped=!0;return a.getStatement("DO")}},stop_repeat:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null],type:"stop_repeat"}, +"class":"repeat",isNotFor:[],func:function(b,a){return this.executor.breakLoop()}},wait_until_true:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"},null],type:"wait_until_true"},paramsKeyMap:{BOOL:0},"class":"wait",isNotFor:[],func:function(b,a){return a.getBooleanValue("BOOL",a)?a.callReturn():a}},_if:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}], +params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"},null],type:"_if"},paramsKeyMap:{BOOL:0},statementsKeyMap:{STACK:0},"class":"condition",isNotFor:[],func:function(b,a){return a.isCondition?(delete a.isCondition,a.callReturn()):a.getBooleanValue("BOOL",a)?(a.isCondition=!0,a.getStatement("STACK",a)):a.callReturn()}},if_else:{color:"#498deb",skeleton:"basic_double_loop",statements:[{accept:"basic"},{accept:"basic"}], +params:[{type:"Block",accept:"boolean"},{type:"Indicator",img:"block_icon/flow_03.png",size:12},{type:"LineBreak"}],events:{},def:{params:[{type:"True"},null],type:"if_else"},paramsKeyMap:{BOOL:0},statementsKeyMap:{STACK_IF:0,STACK_ELSE:1},"class":"condition",isNotFor:[],func:function(b,a){if(a.isCondition)return delete a.isCondition,a.callReturn();var c=a.getBooleanValue("BOOL",a);a.isCondition=!0;return c?a.getStatement("STACK_IF",a):a.getStatement("STACK_ELSE",a)}},create_clone:{color:"#498deb", +skeleton:"basic",statements:[],params:[{type:"DropdownDynamic",value:null,menuName:"clone",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null,null],type:"create_clone"},paramsKeyMap:{VALUE:0},"class":"clone",isNotFor:[],func:function(b,a){var c=a.getField("VALUE",a),d=a.callReturn();"self"==c?b.parent.addCloneEntity(b.parent,b,null):Entry.container.getObject(c).addCloneEntity(b.parent,null,null);return d}},delete_clone:{color:"#498deb", +skeleton:"basic_without_next",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null],type:"delete_clone"},"class":"clone",isNotFor:[],func:function(b,a){if(!b.isClone)return a.callReturn();b.removeClone();return this.die()}},when_clone_start:{color:"#498deb",skeleton:"basic_event",statements:[],params:[{type:"Indicator",img:"block_icon/start_icon_clone.png",size:17,position:{x:0,y:-2}}],events:{},def:{params:[null],type:"when_clone_start"},"class":"clone", +isNotFor:[],func:function(b,a){return a.callReturn()},event:"when_clone_start"},stop_run:{color:"#498deb",skeleton:"basic",statements:[],params:[{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null]},func:function(b,a){return Entry.engine.toggleStop()}},repeat_while_true:{color:"#498deb",skeleton:"basic_loop",statements:[{accept:"basic"}],params:[{type:"Block",accept:"boolean"},{type:"Dropdown",options:[[Lang.Blocks.FLOW_repeat_while_true_until,"until"],[Lang.Blocks.FLOW_repeat_while_true_while, +"while"]],value:"until",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[{type:"True"},null,null],type:"repeat_while_true"},paramsKeyMap:{BOOL:0,OPTION:1},statementsKeyMap:{DO:0},"class":"repeat",isNotFor:[],func:function(b,a){var c=a.getBooleanValue("BOOL",a);"until"==a.getField("OPTION",a)&&(c=!c);return(a.isLooped=c)?a.getStatement("DO",a):a.callReturn()}},stop_object:{color:"#498deb",skeleton:"basic",statements:[], +params:[{type:"Dropdown",options:[[Lang.Blocks.FLOW_stop_object_all,"all"],[Lang.Blocks.FLOW_stop_object_this_object,"thisOnly"],[Lang.Blocks.FLOW_stop_object_this_thread,"thisThread"],[Lang.Blocks.FLOW_stop_object_other_thread,"otherThread"]],value:"all",fontSize:11,arrowColor:EntryStatic.ARROW_COLOR_FLOW},{type:"Indicator",img:"block_icon/flow_03.png",size:12}],events:{},def:{params:[null,null],type:"stop_object"},paramsKeyMap:{TARGET:0},"class":"terminate",isNotFor:[],func:function(b,a){var c= +a.getField("TARGET",a),d=Entry.container;switch(c){case "all":return d.clearRunningState(),this.die();case "thisOnly":return b.parent.script.clearExecutorsByEntity(b),this.die();case "thisObject":return b.parent.script.clearExecutors(),this.die();case "thisThread":return this.die();case "otherThread":for(var c=this.executor,d=b.parent.script,e=d.executors,f=0;fa.count?(50>d.leftFloor&&50>d.rightFloor?a.count++:a.count=0,d=d.leftFloor- +d.rightFloor,c.leftWheel=45+.25*d,c.rightWheel=45-.25*d):(a.count=0,a.boardState=2);break;case 2:d=d.leftFloor-d.rightFloor;c.leftWheel=45+.25*d;c.rightWheel=45-.25*d;a.boardState=3;var e=setTimeout(function(){a.boardState=4;Entry.Hamster.removeTimeout(e)},250);Entry.Hamster.timeouts.push(e);break;case 3:d=d.leftFloor-d.rightFloor;c.leftWheel=45+.25*d;c.rightWheel=45-.25*d;break;case 4:c.leftWheel=0,c.rightWheel=0,a.boardState=0,a.isMoving=!1}return a}delete a.isStart;delete a.isMoving;delete a.count; +delete a.boardState;Entry.engine.isContinue=!1;c.leftWheel=0;c.rightWheel=0;return a.callReturn()}a.isStart=!0;a.isMoving=!0;a.count=0;a.boardState=1;c.leftWheel=45;c.rightWheel=45;Entry.Hamster.setLineTracerMode(c,0);return a}},hamster_turn_once:{color:"#00979D",skeleton:"basic",statements:[],params:[{type:"Dropdown",options:[[Lang.General.left,"LEFT"],[Lang.General.right,"RIGHT"]],value:"LEFT",fontSize:11},{type:"Indicator",img:"block_icon/hardware_03.png",size:12}],events:{},def:{params:[null, +null],type:"hamster_turn_once"},paramsKeyMap:{DIRECTION:0},"class":"hamster_board",isNotFor:["hamster"],func:function(b,a){var c=Entry.hw.sendQueue,d=Entry.hw.portData;if(a.isStart){if(a.isMoving){if(a.isLeft)switch(a.boardState){case 1:2>a.count?50d.leftFloor&&(a.boardState=3);break;case 3:2>a.count?20>d.leftFloor&&a.count++:(a.count=0,a.boardState=4);break;case 4:50a.count?50d.rightFloor&&(a.boardState=3);break;case 3:2>a.count?20>d.rightFloor&&a.count++:(a.count=0,a.boardState=4);break;case 4:50=b?this.setVisible(!1):this.setVisible(!0)};b._reset=function(){this.vY=0;this.vScrollbar.attr({y:this.vY});this.resizeScrollBar()};b.onMouseDown=function(a){function b(a){a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();a=a.originalEvent&&a.originalEvent.touches?a.originalEvent.touches[0]:a;var c=e.dragInstance; e.scroll(a.pageY-c.offsetY);c.set({offsetY:a.pageY})}function d(a){$(document).unbind(".scroll");delete e.dragInstance}var e=this;a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();if(0===a.button||a.originalEvent&&a.originalEvent.touches){Entry.documentMousedown&&Entry.documentMousedown.notify(a);var f;f=a.originalEvent&&a.originalEvent.touches?a.originalEvent.touches[0]:a;var g=$(document);g.bind("mousemove.scroll",b);g.bind("mouseup.scroll",d);g.bind("touchmove.scroll", -b);g.bind("touchend.scroll",d);e.dragInstance=new Entry.DragInstance({startY:f.pageY,offsetY:f.pageY})}a.stopPropagation()};b._addControl=function(){$(this.vScrollbar).bind("mousedown touchstart",this.mouseHandler)}})(Entry.BlockMenuScroller.prototype);Entry.BlockView=function(b,a,c){Entry.Model(this,!1);this.block=b;this._lazyUpdatePos=_.debounce(b._updatePos.bind(b),200);this._board=a;this._observers=[];this.set(b);this.svgGroup=a.svgBlockGroup.elem("g");this._schema=Entry.block[b.type];this._schema.changeEvent&&(this._schemaChangeEvent=this._schema.changeEvent.attach(this,this._updateSchema));var d=this._skeleton=Entry.skeleton[this._schema.skeleton];this._contents=[];this._statements=[];this.magnet={};this._paramMap={};d.magnets&&d.magnets(this).next&& -(this.svgGroup.nextMagnet=this.block,this._nextGroup=this.svgGroup.elem("g"),this._observers.push(this.observe(this,"_updateMagnet",["contentHeight"])));this.isInBlockMenu=this.getBoard()instanceof Entry.BlockMenu;var e=this;this.mouseHandler=function(){var a=e.block.events;a&&a.mousedown&&a.mousedown.forEach(function(a){a(e)});e.onMouseDown.apply(e,arguments)};this._startRender(b,c);this._observers.push(this.block.observe(this,"_setMovable",["movable"]));this._observers.push(this.block.observe(this, -"_setReadOnly",["movable"]));this._observers.push(this.block.observe(this,"_setCopyable",["copyable"]));this._observers.push(this.block.observe(this,"_updateColor",["deletable"],!1));this._observers.push(this.observe(this,"_updateBG",["magneting"],!1));this._observers.push(this.observe(this,"_updateOpacity",["visible"],!1));this._observers.push(this.observe(this,"_updateDisplay",["display"],!1));this._observers.push(this.observe(this,"_updateShadow",["shadow"]));this._observers.push(this.observe(this, -"_updateMagnet",["offsetY"]));this._observers.push(a.code.observe(this,"_setBoard",["board"],!1));this.dragMode=Entry.DRAG_MODE_NONE;Entry.Utils.disableContextmenu(this.svgGroup.node);a=b.events.viewAdd;"workspace"==Entry.type&&a&&!this.isInBlockMenu&&a.forEach(function(a){Entry.Utils.isFunction(a)&&a(b)})};Entry.BlockView.PARAM_SPACE=5;Entry.BlockView.DRAG_RADIUS=5;Entry.BlockView.pngMap={}; +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){var d=this;Entry.Model(this,!1);this.block=b;this._lazyUpdatePos=_.debounce(b._updatePos.bind(b),200);this._board=a;this._observers=[];this.set(b);this.svgGroup=a.svgBlockGroup.elem("g");this._schema=Entry.block[b.type];if(void 0===this._schema)this.block.destroy(!1,!1);else{this._schema.changeEvent&&(this._schemaChangeEvent=this._schema.changeEvent.attach(this,this._updateSchema));var e=this._skeleton=Entry.skeleton[this._schema.skeleton];this._contents=[];this._statements= +[];this.magnet={};this._paramMap={};e.magnets&&e.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;this.mouseHandler=function(){var a=d.block.events;a&&a.mousedown&&a.mousedown.forEach(function(a){a(d)});d.onMouseDown.apply(d,arguments)};this._startRender(b,c);this._observers.push(this.block.observe(this,"_setMovable", +["movable"]));this._observers.push(this.block.observe(this,"_setReadOnly",["movable"]));this._observers.push(this.block.observe(this,"_setCopyable",["copyable"]));this._observers.push(this.block.observe(this,"_updateColor",["deletable"],!1));this._observers.push(this.observe(this,"_updateBG",["magneting"],!1));this._observers.push(this.observe(this,"_updateOpacity",["visible"],!1));this._observers.push(this.observe(this,"_updateDisplay",["display"],!1));this._observers.push(this.observe(this,"_updateShadow", +["shadow"]));this._observers.push(this.observe(this,"_updateMagnet",["offsetY"]));this._observers.push(a.code.observe(this,"_setBoard",["board"],!1));this.dragMode=Entry.DRAG_MODE_NONE;Entry.Utils.disableContextmenu(this.svgGroup.node);a=b.events.viewAdd;"workspace"==Entry.type&&a&&!this.isInBlockMenu&&a.forEach(function(a){Entry.Utils.isFunction(a)&&a(b)})}};Entry.BlockView.PARAM_SPACE=5;Entry.BlockView.DRAG_RADIUS=5;Entry.BlockView.pngMap={}; (function(b){b.schema={id:0,type:Entry.STATIC.BLOCK_RENDER_MODEL,x:0,y:0,offsetX:0,offsetY:0,width:0,height:0,contentWidth:0,contentHeight:0,magneting:!1,visible:!0,animating:!1,shadow:!0,display:!0};b._startRender=function(a,b){var d=this,e=this._skeleton;this.svgGroup.attr({class:"block"});var f=e.classes;f&&0!==f.length&&f.forEach(function(a){d.svgGroup.addClass(a)});f=e.path(this);this.pathGroup=this.svgGroup.elem("g");this._updateMagnet();this._path=this.pathGroup.elem("path");this.getBoard().patternRect&& ($(this._path).mouseenter(function(a){d._mouseEnable&&d._changeFill(!0)}),$(this._path).mouseleave(function(a){d._mouseEnable&&d._changeFill(!1)}));var g=this._schema.color;this.block.deletable===Entry.Block.DELETABLE_FALSE_LIGHTEN&&(g=Entry.Utils.colorLighten(g));this._fillColor=g;f={d:f,fill:g,class:"blockPath"};if(this.magnet.next||this._skeleton.nextShadow)g=this.getBoard().suffix,this.pathGroup.attr({filter:"url(#entryBlockShadowFilter_"+g+")"});else if(this.magnet.string||this.magnet.boolean)f.stroke= e.outerLine;e.outerLine&&(f["stroke-width"]="0.6");this._path.attr(f);this._moveTo(this.x,this.y,!1);this._startContentRender(b);!0!==this._board.disableMouseEvent&&this._addControl();this.bindPrev()};b._startContentRender=function(a){a=void 0===a?Entry.Workspace.MODE_BOARD:a;this.contentSvgGroup&&this.contentSvgGroup.remove();var b=this._schema;b.statements&&b.statements.length&&this.statementSvgGroup&&this.statementSvgGroup.remove();this._contents=[];this.contentSvgGroup=this.svgGroup.elem("g"); @@ -1991,9 +1990,9 @@ b.getBlockList=function(a,b){for(var d=this.getThreads(),e=[],f=0;fthis.events[b].indexOf(f)&&this.events[b].push(f)}}this._schema.event&&this.thread.registerEvent(this,this._schema.event);a=this.params;b=this._schema.params;for(e=0;b&&e 64) { - delete state.isStart; - delete state.stamp; + } else if(nowTime - scope.stamp > 64) { + delete scope.isStart; + delete scope.stamp; return (ANALOG) ? ANALOG[port] || 0 : 0; } else { throw new Entry.Utils.AsyncError(); @@ -2034,19 +2027,12 @@ Entry.block = { "func": function (sprite, script) { var port1 = script.getField("PORT1", script); var port2 = script.getField("PORT2", script); - if(!Entry.ArduinoExt.BlockState[this.type]) { - Entry.ArduinoExt.BlockState[this.type] = { - isStart: false, - stamp: 0 - } - } - - var state = Entry.ArduinoExt.BlockState[this.type]; + var scope = script.executor.scope; var nowTime = Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.ULTRASONIC); var hardwareTime = Entry.hw.portData['TIME'] || 0; - if(!state.isStart) { - state.isStart = true; - state.stamp = nowTime; + if(!scope.isStart) { + scope.isStart = true; + scope.stamp = nowTime; Entry.hw.sendQueue['TIME'] = nowTime; Entry.hw.sendQueue['KEY'] = Entry.ArduinoExt.getSensorKey(); Entry.hw.sendQueue['GET'] = { @@ -2055,13 +2041,13 @@ Entry.block = { }; throw new Entry.Utils.AsyncError(); return; - } else if(hardwareTime && (hardwareTime === state.stamp)) { - delete state.isStart; - delete state.stamp; + } else if(hardwareTime && (hardwareTime === scope.stamp)) { + delete scope.isStart; + delete scope.stamp; return Entry.hw.portData.ULTRASONIC || 0; - } else if(nowTime - state.stamp > 64) { - delete state.isStart; - delete state.stamp; + } else if(nowTime - scope.stamp > 64) { + delete scope.isStart; + delete scope.stamp; return Entry.hw.portData.ULTRASONIC || 0; } else { throw new Entry.Utils.AsyncError(); @@ -2388,18 +2374,11 @@ Entry.block = { var port = script.getNumberValue("PORT", script); var nowTime = Entry.ArduinoExt.getSensorTime(Entry.ArduinoExt.sensorTypes.DIGITAL); var hardwareTime = Entry.hw.portData['TIME'] || 0; - if(!Entry.ArduinoExt.BlockState[this.type]) { - Entry.ArduinoExt.BlockState[this.type] = { - isStart: false, - stamp: 0 - } - } - - var state = Entry.ArduinoExt.BlockState[this.type]; + var scope = script.executor.scope; var DIGITAL = Entry.hw.portData.DIGITAL; - if(!state.isStart) { - state.isStart = true; - state.stamp = nowTime; + if(!scope.isStart) { + scope.isStart = true; + scope.stamp = nowTime; Entry.hw.sendQueue['TIME'] = nowTime; Entry.hw.sendQueue['KEY'] = Entry.ArduinoExt.getSensorKey(); Entry.hw.sendQueue['GET'] = { @@ -2408,13 +2387,13 @@ Entry.block = { }; throw new Entry.Utils.AsyncError(); return; - } else if(hardwareTime && (hardwareTime === state.stamp)) { - delete state.isStart; - delete state.stamp; + } else if(hardwareTime && (hardwareTime === scope.stamp)) { + delete scope.isStart; + delete scope.stamp; return (DIGITAL) ? DIGITAL[port] || 0 : 0; - } else if(nowTime - state.stamp > 64) { - delete state.isStart; - delete state.stamp; + } else if(nowTime - scope.stamp > 64) { + delete scope.isStart; + delete scope.stamp; return (DIGITAL) ? DIGITAL[port] || 0 : 0; } else { throw new Entry.Utils.AsyncError(); diff --git a/src/workspace/block_view.js b/src/workspace/block_view.js index 1af01b1003..d7ddab4f14 100644 --- a/src/workspace/block_view.js +++ b/src/workspace/block_view.js @@ -9,6 +9,7 @@ goog.provide("Entry.BlockView"); * */ Entry.BlockView = function(block, board, mode) { + var that = this; Entry.Model(this, false); this.block = block; this._lazyUpdatePos = _.debounce(block._updatePos.bind(block), 200); @@ -18,6 +19,11 @@ Entry.BlockView = function(block, board, mode) { this.svgGroup = board.svgBlockGroup.elem("g"); this._schema = Entry.block[block.type]; + if (this._schema === undefined) { + this.block.destroy(false, false); + return; + } + if (this._schema.changeEvent) this._schemaChangeEvent = this._schema.changeEvent.attach( this, this._updateSchema); @@ -35,10 +41,6 @@ Entry.BlockView = function(block, board, mode) { this.isInBlockMenu = this.getBoard() instanceof Entry.BlockMenu; - //if (skeleton.morph) - //this._observers.push(this.block.observe(this, "_renderPath", skeleton.morph, false)); - - var that = this; this.mouseHandler = function() { var events = that.block.events; if (events && events.mousedown) diff --git a/src/workspace/executors.js b/src/workspace/executors.js index 7099a481a6..46da3069a6 100644 --- a/src/workspace/executors.js +++ b/src/workspace/executors.js @@ -19,7 +19,9 @@ Entry.Executor = function(block, entity) { while (true) { var returnVal = null; try { - returnVal = this.scope.block.getSchema().func.call(this.scope, this.entity, this.scope); + var schema = this.scope.block.getSchema(); + if (schema) + returnVal = schema.func.call(this.scope, this.entity, this.scope); } catch(e) { if(e.name === 'AsyncError') { returnVal = Entry.STATIC.BREAK; diff --git a/src/workspace/thread.js b/src/workspace/thread.js index 2699a8a76b..b7382fd4f1 100644 --- a/src/workspace/thread.js +++ b/src/workspace/thread.js @@ -35,13 +35,7 @@ Entry.Thread = function(thread, code, parent) { if (block instanceof Entry.Block || block.isDummy) { block.setThread(this); this._data.push(block); - } else { - var functions = Entry.functions; - var blockType = block.type; - if (Entry.block[blockType] || ( - functions && functions.indexOf(blockType.split('_')[1]) > -1)) - this._data.push(new Entry.Block(block, this)); - } + } else this._data.push(new Entry.Block(block, this)); } var codeView = this._code.view; @@ -61,7 +55,7 @@ Entry.Thread = function(thread, code, parent) { if (!this.view) this.view = new Entry.ThreadView(this, board); var prevBlock = null; - this._data.map(function(b) { + this._data.getAll().forEach(function(b) { b.createView(board, mode); }); };