From 2a03d7c98d316cc10ddb321bc4815b945e6c46a6 Mon Sep 17 00:00:00 2001 From: strawberry42271 <2806566736@qq.com> Date: Sun, 5 Jan 2025 14:12:11 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BA=8B=E4=BB=B6=E5=9D=97?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/_server/MotaAction.g4 | 479 ++++--------------------- public/_server/MotaActionParser.js | 136 +------ public/_server/editor_blocklyconfig.js | 18 +- src/core/render/preset/graphics.ts | 18 +- src/core/render/preset/misc.ts | 23 +- 5 files changed, 107 insertions(+), 567 deletions(-) diff --git a/public/_server/MotaAction.g4 b/public/_server/MotaAction.g4 index 4b9753f..df19cf6 100644 --- a/public/_server/MotaAction.g4 +++ b/public/_server/MotaAction.g4 @@ -806,22 +806,13 @@ return code; //为了避免关键字冲突,全部加了_s //动作 action - : text_0_s - | text_1_s - | text_2_s - | moveTextBox_s - | clearTextBox_s + : text_s | comment_s | autoText_s | scrollText_s | setText_s | tip_s | setValue_s - | setEnemy_s - | setEnemyOnPoint_s - | resetEnemyOnPoint_s - | moveEnemyOnPoint_s - | moveEnemyOnPoint_1_s | setEquip_s | setFloor_s | setGlobalAttribute_s @@ -831,7 +822,6 @@ action | show_s | hide_s | setBlockOpacity_s - | setBlockFilter_s | trigger_s | insert_1_s | insert_2_s @@ -866,8 +856,6 @@ action | unloadEquip_s | openShop_s | disableShop_s - | follow_s - | unfollow_s | animate_s | animate_1_s | stopAnimate_s @@ -879,7 +867,6 @@ action | moveImage_s | rotateImage_s | scaleImage_s - | showGif_s | setCurtain_0_s | setCurtain_1_s | screenFlash_s @@ -950,188 +937,31 @@ action | pass_s ; -text_0_s - : '显示文章' ':' EvalString_Multi Newline + + +text_s + : '标题' EvalString? '图标' EvalString? '像素坐标 x' IntString? 'y' IntString? '宽' IntString? '高' IntString? '维持文本' Bool '打字间隔' IntString? '行高' IntString? BGNL? Newline + EvalString_Multi Newline -/* text_0_s -tooltip : text:显示一段文字(剧情) -helpUrl : /_docs/#/instruction -previewBlock : true -default : ["欢迎使用事件编辑器(双击方块可直接预览)"] -var code = '"'+EvalString_Multi_0+'"'; -if (block.isCollapsed() || !block.isEnabled()) { - code = '{"type": "text", "text": '+code; - if (block.isCollapsed()) code += ', "_collapsed": true'; - if (!block.isEnabled()) code += ', "_disabled": true'; - code += '}'; -} -return code+',\n'; -*/; - -text_1_s - : '标题' EvalString? '图像' EvalString? '对话框效果' EvalString? '起点 px' PosString? 'py' PosString? '宽' PosString? '编号' Int '不等待操作' Bool BGNL? Newline EvalString_Multi Newline - - -/* text_1_s +/* text_s tooltip : text:显示一段文字(剧情),选项较多请右键点击帮助 helpUrl : /_docs/#/instruction previewBlock : true allIds : ['EvalString_1'] -default : ["小妖精","fairy","","","","",0,false,"欢迎使用事件编辑器(双击方块可直接预览)"] -var title=''; -if (EvalString_0==''){ - if (EvalString_1=='' )title=''; - else title='\\t['+EvalString_1+']'; -} else { - if (EvalString_1=='')title='\\t['+EvalString_0+']'; - else title='\\t['+EvalString_0+','+EvalString_1+']'; -} -var pos = ''; -if (PosString_0 || PosString_1) { - if (EvalString_2) throw new Error('对话框效果和起点像素位置只能设置一项!'); - pos = '[' + (PosString_0||0) + ',' + (PosString_1||0); - if (PosString_2) pos += ',' + PosString_2; - pos += ']'; -} -if(EvalString_2 && !(/^(up|center|down|hero|this)(,(hero|null|\d+,\d+|\d+))?$/.test(EvalString_2))) { - throw new Error('对话框效果的用法请右键点击帮助'); -} -EvalString_2 = EvalString_2 && ('\\b['+EvalString_2+']'); -var code = '"'+title+EvalString_2+EvalString_Multi_0+'"'; -if (block.isCollapsed() || !block.isEnabled() || pos || Int_0 || Bool_0) { - code = '{"type": "text", "text": '+code; - if (pos) code += ', "pos": ' + pos; - if (Int_0) code += ', "code": ' + Int_0; - if (Bool_0) code += ', "async": true'; - if (block.isCollapsed()) code += ', "_collapsed": true'; - if (!block.isEnabled()) code += ', "_disabled": true'; - code += '}'; -} -return code+',\n'; +default : ["小妖精","fairy","","","","",false,"","","欢迎使用事件编辑器"] +EvalString_0= EvalString_0 ? (', "title": "'+EvalString_0+'"') : ''; +EvalString_1= EvalString_1 ? (', "icon": "'+EvalString_1+'"') : ''; +IntString_0= IntString_0 ? (', "x": '+IntString_0) : ''; +IntString_1= IntString_1 ? (', "y": '+IntString_1) : ''; +IntString_2= IntString_2 ? (', "width": '+IntString_2) : ''; +IntString_3= IntString_3 ? (', "height": '+IntString_3) : ''; +IntString_4= IntString_4 ? (', "interval": '+IntString_4) : ''; +IntString_5= IntString_5 ? (', "lineHeight": '+IntString_5) : ''; +var code = '{"type": "text"'+EvalString_0+EvalString_1+IntString_0+IntString_1+IntString_2+IntString_3+',"keepLast":'+Bool_0+IntString_4+IntString_5+'"text":"'+EvalString_Multi_0+'"},\n'; +return code */; -text_2_s - : '标题' EvalString? '图像' EvalString? '对话框效果' EvalString? '起点 px' PosString? 'py' PosString? '宽' PosString? '编号' Int '不等待操作' Bool BGNL? Newline EvalString_Multi BGNL? Newline textDrawingList* Newline - - -/* text_2_s -tooltip : text:显示一段文字(剧情),选项较多请右键点击帮助 -helpUrl : /_docs/#/instruction -previewBlock : true -allIds : ['EvalString_1'] -default : ["小妖精","fairy","","","","",0,"欢迎使用事件编辑器(双击方块可直接预览)",null] -var title=''; -if (EvalString_0==''){ - if (EvalString_1=='' )title=''; - else title='\\t['+EvalString_1+']'; -} else { - if (EvalString_1=='')title='\\t['+EvalString_0+']'; - else title='\\t['+EvalString_0+','+EvalString_1+']'; -} -var pos = ''; -if (PosString_0 || PosString_1) { - if (EvalString_2) throw new Error('对话框效果和起点像素位置只能设置一项!'); - pos = '[' + (PosString_0||0) + ',' + (PosString_1||0); - if (PosString_2) pos += ',' + PosString_2; - pos += ']'; -} -if(EvalString_2 && !(/^(up|center|down|hero|this)(,(hero|null|\d+,\d+|\d+))?$/.test(EvalString_2))) { - throw new Error('对话框效果的用法请右键点击帮助'); -} -EvalString_2 = EvalString_2 && ('\\b['+EvalString_2+']'); -var code = '"'+title+EvalString_2+textDrawingList_0.replace(/\s/g, '')+EvalString_Multi_0+'"'; -if (block.isCollapsed() || !block.isEnabled() || pos || Int_0 || Bool_0) { - code = '{"type": "text", "text": '+code; - if (pos) code += ', "pos": ' + pos; - if (Int_0) code += ', "code": ' + Int_0; - if (Bool_0) code += ', "async": true'; - if (block.isCollapsed()) code += ', "_collapsed": true'; - if (!block.isEnabled()) code += ', "_disabled": true'; - code += '}'; -} -return code+',\n'; -*/; - -textDrawingList - : textDrawing - | textDrawingEmpty; - - -textDrawing - : '立绘' EvalString '翻转' Reverse_List '绘制坐标' 'x' IntString 'y' IntString '宽' IntString? '高' IntString? BGNL? Newline - '裁剪坐标' 'x' IntString? 'y' IntString? '宽' IntString? '高' IntString? '不透明度' EvalString? '旋转角度' IntString? - -/* textDrawing -tooltip : 立绘 -helpUrl : /_docs/#/instruction -default : ["fairy.png","null","0","0","","","","","","","",""] -colour : this.subColor -previewBlock : true -allImages : ['EvalString_0'] -if (Reverse_List_0 && Reverse_List_0 != 'null') EvalString_0 += Reverse_List_0; -var list = [EvalString_0, IntString_0, IntString_1]; -if (IntString_2 || IntString_3) { - if (list.length != 3 || !IntString_2 || !IntString_3) { - throw "绘制的宽和高需同时设置"; - } - list.push(IntString_2); - list.push(IntString_3); -} -if (IntString_4 || IntString_5 || IntString_6 || IntString_7) { - if (list.length != 5) throw "如设置裁剪区域,请先设置绘制区域的宽高"; - if (!IntString_4 || !IntString_5 || !IntString_6 || !IntString_7) { - throw "如设置裁剪区域,请同时设置全部的裁剪坐标和宽高"; - } - list.splice(1, 0, IntString_4, IntString_5, IntString_6, IntString_7); -} -if (EvalString_1) { - if (list.length != 9) throw "如设置不透明度,需填满所有坐标和宽高"; - var opacity = parseFloat(EvalString_1); - if (isNaN(opacity) || opacity < 0 || opacity > 1) throw "不合法的不透明度,必须是0到1之间" - list.push(opacity); -} -if (IntString_8) { - if (list.length != 10) throw "如设置旋转角度,需填满所有坐标和宽高,以及不透明度"; - list.push(IntString_8); -} -return "\\f[" + list.join(",")+"]"; -*/; - -textDrawingEmpty - : Newline - -/* textDrawingEmpty -var code = ''; -return code; -*/; - -moveTextBox_s - : '移动对话框' ':' Int 'px' PosString 'py' PosString '使用增量' Bool '移动方式' MoveMode_List '动画时间' Int '不等待执行完毕' Bool Newline - -/* moveTextBox_s -tooltip : 移动对话框 -helpUrl : /_docs/#/instruction -default : [1,"0","0",false,'',500,false] -MoveMode_List_0 = (MoveMode_List_0!=='') ? (', "moveMode": "'+MoveMode_List_0+'"'):''; -Bool_0 = Bool_0 ?', "relative": true':''; -Bool_1 = Bool_1 ?', "async": true':''; -var code = '{"type": "moveTextBox", "code": '+Int_0+', "loc": ['+PosString_0+','+PosString_1+']'+Bool_0+MoveMode_List_0+', "time": '+Int_1+Bool_1+'},\n'; -return code; -*/; - -clearTextBox_s - : '清除对话框' ':' EvalString? Newline - -/* clearTextBox_s -tooltip : 清除对话框 -helpUrl : /_docs/#/instruction -default : ["1"] -if (EvalString_0 && !/^\d+(,\d+)*$/.test(EvalString_0)) throw new Error('对话框编号需要以逗号分隔'); -EvalString_0 = EvalString_0 ? (', "code": ['+EvalString_0+']') : ''; -var code = '{"type": "clearTextBox"'+EvalString_0+'},\n'; -return code; -*/; comment_s @@ -1189,39 +1019,38 @@ return code; */; setText_s - : '设置剧情文本的属性' '位置' SetTextPosition_List '偏移像素' IntString? '对齐' TextAlign_List? '粗体' B_1_List? BGNL? '标题颜色' ColorString? Colour '正文颜色' ColorString? Colour '背景色' EvalString? Colour BGNL? '标题大小' IntString? '正文大小' IntString? '行距' IntString? '打字间隔' IntString? '字符间距' IntString? '淡入淡出时间' IntString? Newline + : '设置剧情文本的属性' '位置像素x' IntString? 'y' IntString? '宽' IntString? '高' IntString? '字体类型' EvalString? '字体大小' IntString? '字体线宽' IntString? BGNL? + '是否斜体' Bool? '维持文本' Bool? '打字间隔' IntString? '行高' IntString? '文字颜色' ColorString? Colour '文字描边颜色' ColorString? Colour '描边线宽' IntString? '是否填充' Bool '是否描边' Bool BGNL? + '背景色' ColorString? Colour '背景winskin' EvalString? '文字与边框距离' IntString? '标题是否填充' Bool '标题是否描边' Bool'标题与边框的距离' IntString? BGNL? + '对齐方式' TextAlign_List '分词原则' WordBreak_List '行首禁则' EvalString? '行尾禁则' EvalString? '分词规则识别字符' EvalString? Newline /* setText_s -tooltip : setText:设置剧情文本的属性,颜色为RGB三元组或RGBA四元组,打字间隔为剧情文字添加的时间间隔,为整数或不填,字符间距为字符之间的距离,为整数或不填。 +tooltip : setText:设置文本的属性,颜色为RGB三元组或RGBA四元组,打字间隔为剧情文字添加的时间间隔,为整数或不填,字符间距为字符之间的距离,为整数或不填。 helpUrl : /_docs/#/instruction previewBlock : true -default : [null,"",null,null,"",'rgba(255,255,255,1)',"",'rgba(255,255,255,1)',"",'rgba(255,255,255,1)',"","","","","",""] -SetTextPosition_List_0 =SetTextPosition_List_0==='null'?'': ', "position": "'+SetTextPosition_List_0+'"'; -TextAlign_List_0 = TextAlign_List_0==='null'?'': ', "align": "'+TextAlign_List_0+'"'; -var colorRe = MotaActionFunctions.pattern.colorRe; -IntString_0 = IntString_0 ? (', "offset": '+IntString_0) : ''; -ColorString_0 = ColorString_0 ? (', "title": ['+ColorString_0+']') : ''; -ColorString_1 = ColorString_1 ? (', "text": ['+ColorString_1+']') : ''; -if (EvalString_0) { - if (colorRe.test(EvalString_0)) { - EvalString_0 = ', "background": ['+EvalString_0+']'; - } - else if (/^\w+\.png$/.test(EvalString_0)) { - EvalString_0 = ', "background": "'+EvalString_0+'"'; - } - else { - throw new Error('背景格式错误,必须是形如0~255,0~255,0~255,0~1的颜色,或一个WindowSkin的png图片名称'); - } -} -IntString_1 = IntString_1 ? (', "titlefont": '+IntString_1) : ''; -IntString_2 = IntString_2 ? (', "textfont": '+IntString_2) : ''; -IntString_3 = IntString_3 ? (', "lineHeight": '+IntString_3) : ''; -IntString_4 = IntString_4 ? (', "time": '+IntString_4) : ''; -IntString_5 = IntString_5 ? (', "letterSpacing": '+IntString_5) : ''; -IntString_6 = IntString_6 ? (', "animateTime": ' + IntString_6) : ''; -B_1_List_0 = B_1_List_0==='null'?'':', "bold": '+B_1_List_0; -var code = '{"type": "setText"'+SetTextPosition_List_0+IntString_0+TextAlign_List_0+B_1_List_0+ColorString_0+ColorString_1+EvalString_0+IntString_1+IntString_2+IntString_3+IntString_4+IntString_5+IntString_6+'},\n'; +default : ["","","","","","","",false,false,"","","",'rgba(255,255,255,1)',"",'rgba(255,255,255,1)',"",true,false,"",'rgba(255,255,255,1)',"","",true,false,"",'null','space',"","",""] +IntString_0= IntString_0 ? (', "x": '+IntString_0) : ''; +IntString_1 = IntString_1 ? (', "y": '+IntString_1) : ''; +IntString_2 = IntString_2 ? (', "width": '+IntString_2) : ''; +IntString_3 = IntString_3 ? (', "height": '+IntString_3) : ''; +EvalString_0 = EvalString_0 ? (', "fontFamily": '+EvalString_0) : ''; +IntString_4 = IntString_4 ? (', "fontSize": '+IntString_4) : ''; +IntString_5 = IntString_5 ? (', " interval": '+IntString_5) : ''; +IntString_6 = IntString_6 ? (', "lineHeight": ' + IntString_6) : ''; +IntString_7 = IntString_7? (', "strokeWidth": ' + IntString_7) : ''; +EvalString_1 = EvalString_1 ? (', "winskin": '+EvalString_1) : ''; +IntString_8 = IntString_8? (', "padding": ' + IntString_8) : ''; +IntString_9 = IntString_9? (', "titlePadding": ' + IntString_9) : ''; +TextAlign_List_0 = TextAlign_List_0==='null'?'':', "textAlign": "'+TextAlign_List_0+'"'; +WordBreak_List_0 = WordBreak_List_0==='null'?'':', "wordBreak": "'+WordBreak_List_0+'"'; +EvalString_2 = EvalString_2? (', "ignoreLineStart": '+EvalString_2) : ''; +EvalString_3 = EvalString_3 ? (', "ignoreLineEnd": '+EvalString_3) : ''; +EvalString_4 = EvalString_4 ? (', "breakChars": '+EvalString_4) : ''; +ColorString_0=ColorString_0?(', "fillStyle": ['+ColorString_0+']'):''; +ColorString_1=ColorString_1?(', "strokeStyle": ['+ColorString_1+']'):''; +ColorString_2=ColorString_2?(', "backColor": ['+ColorString_2+']'):''; +var code = '{"type": "setText"'+IntString_0+IntString_1+IntString_2+IntString_3+EvalString_0+IntString_4+', " fontItalic": '+Bool_0+', " keepLast": '+Bool_1+IntString_5+IntString_6+ColorString_0+ColorString_1+IntString_7 +',"fill":'+Bool_2+',"stroke":'+Bool_3+ColorString_2+EvalString_1+IntString_8+',"titleFill":'+Bool_4+',"titleStroke":'+Bool_5+IntString_9 +TextAlign_List_0+WordBreak_List_0+EvalString_2+EvalString_3+EvalString_4+'},\n'; return code; */; @@ -1257,23 +1086,6 @@ return code; */; -setEnemy_s - : '设置怪物属性' ':' '怪物ID' IdString '的' EnemyId_List AssignOperator_List expression '不刷新显伤' Bool Newline - - -/* setEnemy_s -tooltip : setEnemy:设置某个怪物的属性 -helpUrl : /_docs/#/instruction -default : ["greenSlime", "atk", "=", "", false] -allEnemys : ['IdString_0'] -colour : this.dataColor -if (AssignOperator_List_0 && AssignOperator_List_0 != '=') { - AssignOperator_List_0 = ', "operator": "' + AssignOperator_List_0 + '"'; -} else AssignOperator_List_0 = ''; -Bool_0 = Bool_0 ? ', "norefresh": true' : ''; -var code = '{"type": "setEnemy", "id": "'+IdString_0+'", "name": "'+EnemyId_List_0+'"'+AssignOperator_List_0+', "value": "'+expression_0+'"'+Bool_0+'},\n'; -return code; -*/; setEquip_s @@ -1295,84 +1107,6 @@ return code; */; -setEnemyOnPoint_s - : '设置某点怪物属性' ':' 'x' EvalString? ',' 'y' EvalString? '楼层' IdString? '的' EnemyPoint_List AssignOperator_List expression '不刷新显伤' Bool Newline - - -/* setEnemyOnPoint_s -tooltip : setEnemyOnPoint:设置某个点上怪物的属性 -helpUrl : /_docs/#/instruction -default : ["", "", "", "atk", "=", "", false] -selectPoint : ["EvalString_0", "EvalString_1", "IdString_0"] -allFloorIds : ['IdString_0'] -colour : this.dataColor -var floorstr = MotaActionFunctions.processMultiLoc(EvalString_0, EvalString_1); -if (AssignOperator_List_0 && AssignOperator_List_0 != '=') { - AssignOperator_List_0 = ', "operator": "' + AssignOperator_List_0 + '"'; -} else AssignOperator_List_0 = ''; -IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"'); -Bool_0 = Bool_0 ? ', "norefresh": true' : ''; -var code = '{"type": "setEnemyOnPoint"'+floorstr+IdString_0+', "name": "'+EnemyPoint_List_0+'"'+AssignOperator_List_0+', "value": "'+expression_0+'"'+Bool_0+'},\n'; -return code; -*/; - -resetEnemyOnPoint_s - : '重置某点怪物属性' ':' 'x' EvalString? ',' 'y' EvalString? '楼层' IdString? '不刷新显伤' Bool Newline - - -/* resetEnemyOnPoint_s -tooltip : resetEnemyOnPoint:重置某个点上怪物的属性 -helpUrl : /_docs/#/instruction -default : ["", "", "", false] -selectPoint : ["EvalString_0", "EvalString_1", "IdString_0"] -allFloorIds : ['IdString_0'] -colour : this.dataColor -var floorstr = MotaActionFunctions.processMultiLoc(EvalString_0, EvalString_1); -IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"'); -Bool_0 = Bool_0 ? ', "norefresh": true' : ''; -var code = '{"type": "resetEnemyOnPoint"'+floorstr+IdString_0+Bool_0+'},\n'; -return code; -*/; - -moveEnemyOnPoint_s - : '移动某点怪物属性' ':' '起点' 'x' PosString? ',' 'y' PosString? '终点' 'x' PosString? 'y' PosString? '楼层' IdString? '不刷新显伤' Bool Newline - - -/* moveEnemyOnPoint_s -tooltip : moveEnemyOnPoint:移动某个点上怪物的属性到其他点 -helpUrl : /_docs/#/instruction -default : ["", "", "", "", "", false] -allFloorIds : ['IdString_0'] -selectPoint : ["PosString_2", "PosString_3"] -menu : [['选择起点位置','editor_blockly.selectPoint(block,["PosString_0", "PosString_1"])']] -colour : this.dataColor -IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"'); -var floorstr = PosString_0 && PosString_1 ? ', "from": ['+PosString_0+','+PosString_1+']' : ''; -if (PosString_2 && PosString_3) floorstr += ', "to": ['+PosString_2+','+PosString_3+']' -Bool_0 = Bool_0 ? ', "norefresh": true' : ''; -var code = '{"type": "moveEnemyOnPoint"'+floorstr+IdString_0+Bool_0+'},\n'; -return code; -*/; - -moveEnemyOnPoint_1_s - : '移动某点怪物属性' ':' '起点' 'x' PosString? ',' 'y' PosString? '增量' 'dx' PosString? 'dy' PosString? '楼层' IdString? '不刷新显伤' Bool Newline - - -/* moveEnemyOnPoint_1_s -tooltip : moveEnemyOnPoint:移动某个点上怪物的属性到其他点 -helpUrl : /_docs/#/instruction -default : ["", "", "", "", "", false] -allFloorIds : ['IdString_0'] -selectPoint : ["PosString_0", "PosString_1"] -colour : this.dataColor -IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"'); -var floorstr = PosString_0 && PosString_1 ? ', "from": ['+PosString_0+','+PosString_1+']' : ''; -if (PosString_2 && PosString_3) floorstr += ', "dxy": ['+PosString_2+','+PosString_3+']' -Bool_0 = Bool_0 ? ', "norefresh": true' : ''; -var code = '{"type": "moveEnemyOnPoint"'+floorstr+IdString_0+Bool_0+'},\n'; -return code; -*/; - setFloor_s : '设置楼层属性' ':' Floor_Meta_List '楼层名' IdString? '为' JsonEvalString Newline @@ -1432,7 +1166,7 @@ return code; setNameMap_s - : '设置文件别名' ':' EvalString '为' EvalString? Newline + : '(已弃用)设置文件别名' ':' EvalString '为' EvalString? Newline /* setNameMap_s @@ -1504,27 +1238,6 @@ var code = '{"type": "setBlockOpacity"'+floorstr+IdString_0+', "opacity": '+Numb return code; */; -setBlockFilter_s - : '设置图块特效' 'x' EvalString? ',' 'y' EvalString? '楼层' IdString? '虚化' Number '色相' Int '灰度' Number '反色' Bool '阴影' Number Newline - - -/* setBlockFilter_s -tooltip : setBlockFilter: 设置图块特效 -helpUrl : /_docs/#/instruction -default : ["","","",0,0,0,false,0] -selectPoint : ["EvalString_0", "EvalString_1", "IdString_0"] -allFloorIds : ['IdString_0'] -colour : this.mapColor -var floorstr = MotaActionFunctions.processMultiLoc(EvalString_0, EvalString_1); -if (Number_0 < 0) throw '虚化不得小于0;0为完全没有虚化'; -if (Int_0 < 0 || Int_0 >= 360) throw '色相需要在0~359之间'; -if (Number_1 < 0 || Number_1 > 1) throw '灰度需要在0~1之间'; -if (Number_2 < 0) throw '阴影不得小于0;0为完全没有阴影'; - -var code = '{"type": "setBlockFilter"'+floorstr+IdString_0+', "blur": '+Number_0+', "hue": '+Int_0+', "grayscale": '+Number_1+', "invert": '+Bool_0+', "shadow": '+Number_2+'},\n'; -return code; -*/; - trigger_s : '触发系统事件' 'x' PosString? ',' 'y' PosString? Newline @@ -2003,36 +1716,6 @@ var code = '{"type": "disableShop", "id": "'+IdString_0+'"},\n'; return code; */; -follow_s - : '跟随勇士' '行走图' EvalString Newline - - -/* follow_s -tooltip : follow: 跟随勇士 -helpUrl : /_docs/#/instruction -default : ["npc.png"] -allImages : ['EvalString_0'] -material : ["./project/images/:images", "EvalString_0"] -colour : this.dataColor -var code = '{"type": "follow", "name": "'+EvalString_0+'"},\n'; -return code; -*/; - -unfollow_s - : '取消跟随' '行走图' EvalString? Newline - - -/* unfollow_s -tooltip : unfollow: 取消跟随 -helpUrl : /_docs/#/instruction -default : [""] -allImages : ['EvalString_0'] -material : ["./project/images/:images", "EvalString_0"] -colour : this.dataColor -EvalString_0 = EvalString_0 ? (', "name": "' + EvalString_0 + '"') : ""; -var code = '{"type": "unfollow"' + EvalString_0 + '},\n'; -return code; -*/; vibrate_s : '画面震动' '方向' Vibrate_List '时间' Int '速度' Int '振幅' Int '不等待执行完毕' Bool Newline @@ -2229,22 +1912,6 @@ var code = '{"type": "hideImage", "code": '+NInt_0+', "time": '+Int_0+async+'},\ return code; */; -showGif_s - : '显示或清除动图' EvalString? '起点像素位置' 'x' PosString? 'y' PosString? Newline - - -/* showGif_s -tooltip : showGif:显示动图 -helpUrl : /_docs/#/instruction -default : ["","",""] -allImages : ['EvalString_0'] -previewBlock : true -colour : this.imageColor -EvalString_0 = EvalString_0 ? (', "name": "'+EvalString_0+'"') : ''; -var loc = (PosString_0 && PosString_1) ? (', "loc": ['+PosString_0+','+PosString_1+']') : ''; -var code = '{"type": "showGif"'+EvalString_0+loc+'},\n'; -return code; -*/; moveImage_s : '图片移动' '图片编号' NInt '终点像素位置' 'x' PosString? 'y' PosString? BGNL? @@ -2354,7 +2021,7 @@ return code; */; setWeather_s - : '更改天气' Weather_List '强度' Int '持续到下个本事件' Bool Newline + : '(已弃用)更改天气' Weather_List '强度' Int '持续到下个本事件' Bool Newline /* setWeather_s @@ -2964,7 +2631,7 @@ return code; wait_s - : '等待用户操作并获得按键或点击信息' '仅检测子块' Bool '超时毫秒数' Int BGNL? Newline waitContext* BEND Newline + : '(已弃用)等待用户操作并获得按键或点击信息' '仅检测子块' Bool '超时毫秒数' Int BGNL? Newline waitContext* BEND Newline /* wait_s @@ -3162,7 +2829,7 @@ return code; previewUI_s - : 'ui绘制并预览' '(双击此项可进行预览)' BGNL? Newline action+ BEND Newline + : '(已弃用)ui绘制并预览' '(双击此项可进行预览)' BGNL? Newline action+ BEND Newline /* previewUI_s @@ -3177,7 +2844,7 @@ return code; clearMap_s - : '清除画布' '起点像素' 'x' PosString? 'y' PosString? '宽' PosString? '高' PosString? Newline + : '(已弃用)清除画布' '起点像素' 'x' PosString? 'y' PosString? '宽' PosString? '高' PosString? Newline /* clearMap_s tooltip : clearMap: 清除画布 @@ -3195,7 +2862,7 @@ return code; setAttribute_s - : '设置画布属性' '字体' FontString? '填充样式' ColorString? Colour '边框样式' ColorString? Colour BGNL? '线宽度' IntString? '不透明度' EvalString? '对齐' TextAlign_List '基准线' TextBaseline_List 'z值' IntString? Newline + : '(已弃用)设置画布属性' '字体' FontString? '填充样式' ColorString? Colour '边框样式' ColorString? Colour BGNL? '线宽度' IntString? '不透明度' EvalString? '对齐' TextAlign_List '基准线' TextBaseline_List 'z值' IntString? Newline /* setAttribute_s tooltip : setAttribute:设置画布属性 @@ -3222,7 +2889,7 @@ return code; setFilter_s - : '设置画布特效' '虚化' Number '色相' Int '灰度' Number '反色' Bool '阴影' Number Newline + : '(已弃用)设置画布特效' '虚化' Number '色相' Int '灰度' Number '反色' Bool '阴影' Number Newline /* setFilter_s @@ -3241,7 +2908,7 @@ return code; fillText_s - : '绘制文本' 'x' PosString 'y' PosString '样式' ColorString? Colour '字体' FontString? '最大宽度' IntString? BGNL? EvalString Newline + : '(已弃用)绘制文本' 'x' PosString 'y' PosString '样式' ColorString? Colour '字体' FontString? '最大宽度' IntString? BGNL? EvalString Newline /* fillText_s tooltip : fillText:绘制一行文本;可以设置最大宽度进行放缩 @@ -3257,7 +2924,7 @@ return code; */; fillBoldText_s - : '绘制描边文本' 'x' PosString 'y' PosString '样式' ColorString? Colour '描边颜色' ColorString? Colour '字体' FontString? BGNL? EvalString Newline + : '(已弃用)绘制描边文本' 'x' PosString 'y' PosString '样式' ColorString? Colour '描边颜色' ColorString? Colour '字体' FontString? BGNL? EvalString Newline /* fillBoldText_s tooltip : fillBoldText:绘制一行描边文本 @@ -3273,7 +2940,7 @@ return code; */; drawTextContent_s - : '绘制多行文本' EvalString_Multi BGNL? '起点像素' 'x' PosString 'y' PosString '最大宽度' IntString? '颜色' ColorString? Colour BGNL? '对齐' TextAlign_List '字体大小' IntString? '行距' IntString? '粗体' Bool Newline + : '(已弃用)绘制多行文本' EvalString_Multi BGNL? '起点像素' 'x' PosString 'y' PosString '最大宽度' IntString? '颜色' ColorString? Colour BGNL? '对齐' TextAlign_List '字体大小' IntString? '行距' IntString? '粗体' Bool Newline /* drawTextContent_s tooltip : drawTextContent:绘制多行文本 @@ -3293,7 +2960,7 @@ return code; */; fillRect_s - : '绘制矩形' '起点像素' 'x' PosString 'y' PosString '宽' PosString '高' PosString '圆角半径' PosString? '旋转度数' PosString? '颜色' ColorString? Colour Newline + : '(已弃用)绘制矩形' '起点像素' 'x' PosString 'y' PosString '宽' PosString '高' PosString '圆角半径' PosString? '旋转度数' PosString? '颜色' ColorString? Colour Newline /* fillRect_s tooltip : fillRect:绘制矩形 @@ -3309,7 +2976,7 @@ return code; */; strokeRect_s - : '绘制矩形边框' '起点像素' 'x' PosString 'y' PosString '宽' PosString '高' PosString '圆角半径' PosString? '旋转度数' PosString? '颜色' ColorString? Colour '线宽' IntString? Newline + : '(已弃用)绘制矩形边框' '起点像素' 'x' PosString 'y' PosString '宽' PosString '高' PosString '圆角半径' PosString? '旋转度数' PosString? '颜色' ColorString? Colour '线宽' IntString? Newline /* strokeRect_s tooltip : strokeRect:绘制矩形边框 @@ -3326,7 +2993,7 @@ return code; */; drawLine_s - : '绘制线段' '起点像素' 'x' PosString 'y' PosString '终点像素' 'x' PosString 'y' PosString '颜色' ColorString? Colour '线宽' IntString? Newline + : '(已弃用)绘制线段' '起点像素' 'x' PosString 'y' PosString '终点像素' 'x' PosString 'y' PosString '颜色' ColorString? Colour '线宽' IntString? Newline /* drawLine_s tooltip : drawLine:绘制线段 @@ -3341,7 +3008,7 @@ return code; */; drawArrow_s - : '绘制箭头' '起点像素' 'x' PosString 'y' PosString '终点像素' 'x' PosString 'y' PosString '颜色' ColorString? Colour '线宽' IntString? Newline + : '(已弃用)绘制箭头' '起点像素' 'x' PosString 'y' PosString '终点像素' 'x' PosString 'y' PosString '颜色' ColorString? Colour '线宽' IntString? Newline /* drawArrow_s tooltip : drawArrow:绘制箭头 @@ -3357,7 +3024,7 @@ return code; fillPolygon_s - : '绘制多边形' '顶点像素列表' 'x' EvalString 'y' EvalString '颜色' ColorString? Colour Newline + : '(已弃用)绘制多边形' '顶点像素列表' 'x' EvalString 'y' EvalString '颜色' ColorString? Colour Newline /* fillPolygon_s tooltip : fillPolygon:绘制多边形 @@ -3378,7 +3045,7 @@ return code; strokePolygon_s - : '绘制多边形边框' '顶点像素列表' 'x' EvalString 'y' EvalString '颜色' ColorString? Colour '线宽' IntString? Newline + : '(已弃用)绘制多边形边框' '顶点像素列表' 'x' EvalString 'y' EvalString '颜色' ColorString? Colour '线宽' IntString? Newline /* strokePolygon_s tooltip : strokePolygon:绘制多边形边框 @@ -3399,7 +3066,7 @@ return code; */; fillEllipse_s - : '绘制椭圆' '中心' 'x' PosString 'y' PosString '长半径' PosString '短半径' PosString '旋转度数' PosString? '颜色' ColorString? Colour Newline + : '(已弃用)绘制椭圆' '中心' 'x' PosString 'y' PosString '长半径' PosString '短半径' PosString '旋转度数' PosString? '颜色' ColorString? Colour Newline /* fillEllipse_s tooltip : fillEllipse:绘制椭圆 @@ -3414,7 +3081,7 @@ return code; */; strokeEllipse_s - : '绘制椭圆边框' '中心' 'x' PosString 'y' PosString '长半径' PosString '短半径' PosString '旋转度数' PosString? '颜色' ColorString? Colour '线宽' IntString? Newline + : '(已弃用)绘制椭圆边框' '中心' 'x' PosString 'y' PosString '长半径' PosString '短半径' PosString '旋转度数' PosString? '颜色' ColorString? Colour '线宽' IntString? Newline /* strokeEllipse_s tooltip : strokeEllipse:绘制椭圆边框 @@ -3430,7 +3097,7 @@ return code; */; fillArc_s - : '绘制扇形' '中心' 'x' PosString 'y' PosString '半径' PosString '起点角度' PosString '终点角度' PosString '颜色' ColorString? Colour Newline + : '(已弃用)绘制扇形' '中心' 'x' PosString 'y' PosString '半径' PosString '起点角度' PosString '终点角度' PosString '颜色' ColorString? Colour Newline /* fillArc_s tooltip : fillArc:绘制扇形 @@ -3444,7 +3111,7 @@ return code; strokeArc_s - : '绘制弧' '中心' 'x' PosString 'y' PosString '半径' PosString '起点角度' PosString '终点角度' PosString '颜色' ColorString? Colour '线宽' IntString? Newline + : '(已弃用)绘制弧' '中心' 'x' PosString 'y' PosString '半径' PosString '起点角度' PosString '终点角度' PosString '颜色' ColorString? Colour '线宽' IntString? Newline /* strokeArc_s tooltip : strokeArc:绘制弧 @@ -3460,7 +3127,7 @@ return code; drawImage_s - : '绘制图片' EvalString '翻转' Reverse_List '起点像素' 'x' PosString 'y' PosString '宽' PosString? '高' PosString? '旋转度数' PosString? Newline + : '(已弃用)绘制图片' EvalString '翻转' Reverse_List '起点像素' 'x' PosString 'y' PosString '宽' PosString? '高' PosString? '旋转度数' PosString? Newline /* drawImage_s @@ -3481,7 +3148,7 @@ return code; */; drawImage_1_s - : '绘制图片' EvalString '翻转' Reverse_List '裁剪的起点像素' 'x' PosString 'y' PosString '宽' PosString '高' PosString BGNL? + : '(已弃用)绘制图片' EvalString '翻转' Reverse_List '裁剪的起点像素' 'x' PosString 'y' PosString '宽' PosString '高' PosString BGNL? '绘制的起点像素' 'x' PosString 'y' PosString '宽' PosString '高' PosString '旋转度数' PosString? Newline @@ -3503,7 +3170,7 @@ return code; */; drawIcon_s - : '绘制图标' 'ID' IdString '帧' Int '起点像素' 'x' PosString 'y' PosString '宽' PosString? '高' PosString? Newline + : '(已弃用)绘制图标' 'ID' IdString '帧' Int '起点像素' 'x' PosString 'y' PosString '宽' PosString? '高' PosString? Newline /* drawIcon_s @@ -3521,7 +3188,7 @@ return code; */; drawBackground_s - : '绘制背景图' EvalString Colour '起点像素' 'x' PosString 'y' PosString '宽' PosString '高' PosString Newline + : '(已弃用)绘制背景图' EvalString Colour '起点像素' 'x' PosString 'y' PosString '宽' PosString '高' PosString Newline /* drawBackground_s @@ -3545,7 +3212,7 @@ return code; */; drawSelector_s - : '绘制闪烁光标' EvalString '编号' Int '起点像素' 'x' PosString 'y' PosString '宽' PosString '高' PosString Newline + : '(已弃用)绘制闪烁光标' EvalString '编号' Int '起点像素' 'x' PosString 'y' PosString '宽' PosString '高' PosString Newline /* drawSelector_s @@ -3559,7 +3226,7 @@ return code; */; drawSelector_1_s - : '清除闪烁光标' '编号' Int Newline + : '(已弃用)清除闪烁光标' '编号' Int Newline /* drawSelector_1_s @@ -4005,6 +3672,10 @@ TextAlign_List : '不改变'|'左对齐'|'左右居中'|'右对齐' /*TextAlign_List ['null','left','center','right']*/; +WordBreak_List + : '不改变'|'不分词'|'空格分词'|'全部分词' + /*WordBreak_List ['null','none','space','all']*/; + TextBaseline_List : '不改变'|'顶部'|'悬挂'|'居中'|'标准值'|'ideographic'|'底部' /*TextBaseline_List ['null','top','hanging','middle','alphabetic','ideographic','bottom']*/; diff --git a/public/_server/MotaActionParser.js b/public/_server/MotaActionParser.js index 23cac8a..115e78e 100644 --- a/public/_server/MotaActionParser.js +++ b/public/_server/MotaActionParser.js @@ -249,10 +249,6 @@ ActionParser.prototype.parseAction = function() { // 不同种类的事件 - // 如果是文字:显示 - if (typeof data == "string") { - data={"type": "text", "text": data} - } this.event.data.type=data.type; switch (data.type) { case "_next": @@ -260,57 +256,9 @@ ActionParser.prototype.parseAction = function() { this.next = data.next; return; case "text": // 文字/对话 - var info = this.getTitleAndPosition(data.text); - var textDrawing = []; - info[3] = (info[3] || "").replace(/(\f|\\f)\[(.*?)]/g, function (text, sympol, str) { - var ss = str.split(","); - if (ss.length == 3 || ss.length == 5 || ss.length >=9) { - var swap = function (i, j) { var x = ss[i]; ss[i] = ss[j]; ss[j] = x;} - if (ss.length >= 9) { - swap(1,5); swap(2,6); swap(3,7); swap(4,8); - } - textDrawing.push(ss); - } - return ''; - }); - if (textDrawing.length > 0) { - var buildTextDrawing = function (obj) { - if(!obj) obj=[]; - var text_choices = null; - for(var ii=obj.length-1,choice;choice=obj[ii];ii--) { - var reverse = 'null'; - if (choice[0].endsWith(':o') || choice[0].endsWith(':x') || choice[0].endsWith(':y')) { - reverse = choice[0].substring(choice[0].length - 2); - choice[0] = choice[0].substring(0, choice[0].length - 2); - } - text_choices=MotaActionBlocks['textDrawing'].xmlText([ - choice[0], reverse, choice[1], choice[2], choice[3], choice[4], choice[5], choice[6], - choice[7], choice[8], choice[9], choice[10], text_choices]); - } - return text_choices; - } - data.pos = data.pos || []; - this.next = MotaActionFunctions.xmlText('text_2_s', [ - info[0], info[1], info[2], data.pos[0], data.pos[1], data.pos[2], data.code||0, data.async||false, info[3], buildTextDrawing(textDrawing), this.next - ], /* isShadow */false, /*comment*/ null, /*collapsed*/ data._collapsed, /*disabled*/ data._disabled); - } else if (info[0] || info[1] || info[2] || data.pos || data.code) { - data.pos = data.pos || []; - this.next = MotaActionFunctions.xmlText('text_1_s',[ - info[0], info[1], info[2], data.pos[0], data.pos[1], data.pos[2], data.code||0, data.async||false, info[3], this.next], /* isShadow */false, /*comment*/ null, /*collapsed*/ data._collapsed, /*disabled*/ data._disabled); - } - else { - this.next = MotaActionFunctions.xmlText('text_0_s', [info[3],this.next], - /* isShadow */false, /*comment*/ null, /*collapsed*/ data._collapsed, /*disabled*/ data._disabled); - } - break; - case "moveTextBox": // 移动对话框 - data.loc = data.loc || ['','']; - this.next = MotaActionBlocks['moveTextBox_s'].xmlText([ - data.code, data.loc[0], data.loc[1], data.relative||false, data.moveMode, data.time, data.async, this.next]); - break; - case "clearTextBox": // 清除对话框 - this.next = MotaActionBlocks['clearTextBox_s'].xmlText([(data.code||"").toString(),this.next]); - break; + this.next = MotaActionBlocks['text_s'].xmlText([ + data.title, data.icon, data.x, data.y, data.width, data.height, data.keepLast,data.interval,data.lineHeight, this.next]); + break; case "autoText": // 自动剧情文本 var info = this.getTitleAndPosition(data.text); this.next = MotaActionBlocks['autoText_s'].xmlText([ @@ -324,14 +272,14 @@ ActionParser.prototype.parseAction = function() { this.next = MotaActionBlocks['comment_s'].xmlText([this.EvalString_Multi(data.text),this.next]); break; case "setText": // 设置剧情文本的属性 - data.title=this.Colour(data.title); - data.text=this.Colour(data.text); - if (!/^\w+\.png$/.test(data.background)) - data.background=this.Colour(data.background); + //data.backColor=this.Colour(data.backColor); + //data.fillStyle=this.Colour(data.fillStyle); + //data.strokeStyle=this.Colour(data.strokeStyle); this.next = MotaActionBlocks['setText_s'].xmlText([ - data.position,data.offset,data.align,data.bold,data.title,'rgba('+data.title+')', - data.text,'rgba('+data.text+')',data.background,'rgba('+data.background+')', - data.titlefont,data.textfont,data.lineHeight,data.time,data.letterSpacing,data.animateTime,this.next]); + data.x,data.y,data.width,data.height,data.fontFamily,data.fontSize,data.fontWeight, + data.fontItalic,data.keepLast,data.interval,data.lineHeight,,data.fillStyle,'rgba('+data.fillStyle+')', + data.strokeStyle,'rgba('+data.strokeStyle+')',data.strokeWidth,data.fill,data.stroke,data.backColor,'rgba('+data.backColor+')', + data.winskin,data.padding,data.titleFill,data.titleStroke,data.titlePadding,data.textAlign,data.wordBreak,data.ignoreLineStart,data.ignoreLineEnd,data.breakChars,this.next]); break; case "tip": this.next = MotaActionBlocks['tip_s'].xmlText([ @@ -385,18 +333,6 @@ ActionParser.prototype.parseAction = function() { this.next = MotaActionBlocks['setBlockOpacity_s'].xmlText([ x_str.join(','),y_str.join(','),data.floorId||'',data.opacity,data.time,data.async||false,this.next]); break; - case "setBlockFilter": // 设置图块不透明度 - data.loc=data.loc||[]; - if (!(data.loc[0] instanceof Array)) - data.loc = [data.loc]; - var x_str=[],y_str=[]; - data.loc.forEach(function (t) { - x_str.push(t[0]); - y_str.push(t[1]); - }) - this.next = MotaActionBlocks['setBlockFilter_s'].xmlText([ - x_str.join(','),y_str.join(','),data.floorId||'',data.blur,data.hue,data.grayscale,data.invert||false,data.shadow,this.next]); - break; case "turnBlock": // 事件转向 data.loc=data.loc||[]; if (!(data.loc[0] instanceof Array)) @@ -542,12 +478,6 @@ ActionParser.prototype.parseAction = function() { this.next = MotaActionBlocks['changePos_s'].xmlText([ data.loc[0],data.loc[1],data.direction,this.next]); break; - case "follow": // 跟随勇士 - this.next = MotaActionBlocks['follow_s'].xmlText([data.name||"", this.next]); - break; - case "unfollow": // 取消跟随 - this.next = MotaActionBlocks['unfollow_s'].xmlText([data.name||"", this.next]); - break; case "animate": // 显示动画 if (data.loc == 'hero') { this.next = MotaActionBlocks['animate_1_s'].xmlText([ @@ -616,11 +546,6 @@ ActionParser.prototype.parseAction = function() { this.next = MotaActionBlocks['scaleImage_s'].xmlText([ data.code, data.center[0], data.center[1], data.moveMode||'', data.scale, data.time||0, data.async||false, this.next]); break; - case "showGif": // 显示动图 - data.loc=data.loc||['',''] - this.next = MotaActionBlocks['showGif_s'].xmlText([ - data.name,data.loc[0],data.loc[1],this.next]); - break; case "setCurtain": // 颜色渐变 if(this.isset(data.color)){ data.color = this.Colour(data.color); @@ -750,47 +675,6 @@ ActionParser.prototype.parseAction = function() { data.norefresh || false, this.next]); break; - case "setEnemy": - this.next = MotaActionBlocks['setEnemy_s'].xmlText([ - MotaActionFunctions.replaceToName_token(data.id), data.name, data["operator"]||'=', this.expandEvalBlock([data.value]), - data.norefresh||false, this.next]); - break; - case "setEnemyOnPoint": - data.loc=data.loc||[]; - if (!(data.loc[0] instanceof Array)) - data.loc = [data.loc]; - var x_str=[],y_str=[]; - data.loc.forEach(function (t) { - x_str.push(t[0]); - y_str.push(t[1]); - }) - this.next = MotaActionBlocks['setEnemyOnPoint_s'].xmlText([ - x_str.join(','),y_str.join(','),data.floorId||'',data.name, data["operator"]||'=', this.expandEvalBlock([data.value]), - data.norefresh||false, this.next]); - break; - case "resetEnemyOnPoint": - data.loc=data.loc||[]; - if (!(data.loc[0] instanceof Array)) - data.loc = [data.loc]; - var x_str=[],y_str=[]; - data.loc.forEach(function (t) { - x_str.push(t[0]); - y_str.push(t[1]); - }) - this.next = MotaActionBlocks['resetEnemyOnPoint_s'].xmlText([ - x_str.join(','),y_str.join(','), data.floorId||'',data.norefresh||false,this.next]); - break; - case "moveEnemyOnPoint": - data.from=data.from||['',''] - if (data.dxy) { - this.next = MotaActionBlocks['moveEnemyOnPoint_1_s'].xmlText([ - data.from[0], data.from[1], data.dxy[0], data.dxy[1], data.floorId||'',data.norefresh||false,this.next]); - } else { - data.to=data.to||['',''] - this.next = MotaActionBlocks['moveEnemyOnPoint_s'].xmlText([ - data.from[0], data.from[1], data.to[0], data.to[1], data.floorId||'',data.norefresh||false,this.next]); - } - break; case "setEquip": this.next = MotaActionBlocks['setEquip_s'].xmlText([ MotaActionFunctions.replaceToName_token(data.id), data.valueType||'value', data.name, data["operator"]||'=', this.expandEvalBlock([data.value]), this.next]); diff --git a/public/_server/editor_blocklyconfig.js b/public/_server/editor_blocklyconfig.js index 5d95776..f12a973 100644 --- a/public/_server/editor_blocklyconfig.js +++ b/public/_server/editor_blocklyconfig.js @@ -96,11 +96,8 @@ editor_blocklyconfig=(function(){ ], 'splitImages'), ], '显示文字':[ - MotaActionBlocks['text_0_s'].xmlText(), - MotaActionBlocks['text_1_s'].xmlText(), - MotaActionFunctions.actionParser.parseList("\t[小妖精,fairy]\f[fairy.png,0,0]欢迎使用事件编辑器(双击方块可直接预览)"), - MotaActionBlocks['moveTextBox_s'].xmlText(), - MotaActionBlocks['clearTextBox_s'].xmlText(), + MotaActionBlocks['text_s'].xmlText(), + MotaActionBlocks['comment_s'].xmlText(), MotaActionBlocks['autoText_s'].xmlText(), MotaActionBlocks['scrollText_s'].xmlText(), @@ -120,11 +117,6 @@ editor_blocklyconfig=(function(){ MotaActionBlocks['setValue_s'].xmlText([ MotaActionBlocks['idIdList_e'].xmlText(['status','生命']), '=', '', false ]), - MotaActionBlocks['setEnemy_s'].xmlText(), - MotaActionBlocks['setEnemyOnPoint_s'].xmlText(), - MotaActionBlocks['resetEnemyOnPoint_s'].xmlText(), - MotaActionBlocks['moveEnemyOnPoint_s'].xmlText(), - MotaActionBlocks['moveEnemyOnPoint_1_s'].xmlText(), MotaActionBlocks['setEquip_s'].xmlText(), MotaActionBlocks['setFloor_s'].xmlText(), MotaActionBlocks['setGlobalAttribute_s'].xmlText(), @@ -143,9 +135,7 @@ editor_blocklyconfig=(function(){ MotaActionBlocks['unloadEquip_s'].xmlText(), MotaActionBlocks['openShop_s'].xmlText(), MotaActionBlocks['disableShop_s'].xmlText(), - MotaActionBlocks['setHeroIcon_s'].xmlText(), - MotaActionBlocks['follow_s'].xmlText(), - MotaActionBlocks['unfollow_s'].xmlText(), + MotaActionBlocks['setHeroIcon_s'].xmlText() ], '地图处理':[ MotaActionBlocks['battle_1_s'].xmlText(), @@ -155,7 +145,6 @@ editor_blocklyconfig=(function(){ MotaActionBlocks['hide_s'].xmlText(), MotaActionBlocks['setBlock_s'].xmlText(), MotaActionBlocks['setBlockOpacity_s'].xmlText(), - MotaActionBlocks['setBlockFilter_s'].xmlText(), MotaActionBlocks['turnBlock_s'].xmlText(), MotaActionBlocks['moveHero_s'].xmlText(), MotaActionBlocks['move_s'].xmlText(), @@ -225,7 +214,6 @@ editor_blocklyconfig=(function(){ MotaActionBlocks['moveImage_s'].xmlText(), MotaActionBlocks['rotateImage_s'].xmlText(), MotaActionBlocks['scaleImage_s'].xmlText(), - MotaActionBlocks['showGif_s'].xmlText(), MotaActionBlocks['playBgm_s'].xmlText(), MotaActionBlocks['pauseBgm_s'].xmlText(), MotaActionBlocks['resumeBgm_s'].xmlText(), diff --git a/src/core/render/preset/graphics.ts b/src/core/render/preset/graphics.ts index 56dc874..4328b8d 100644 --- a/src/core/render/preset/graphics.ts +++ b/src/core/render/preset/graphics.ts @@ -184,8 +184,6 @@ export abstract class GraphicItemBase ctx.lineJoin = this.lineJoin; ctx.lineCap = this.lineCap; ctx.miterLimit = this.miterLimit; - ctx.fill(this.fillRule); - this.update(); } patchProp( @@ -257,7 +255,7 @@ export abstract class GraphicItemBase export class Rect extends GraphicItemBase { protected render( canvas: MotaOffscreenCanvas2D, - transform: Transform + _transform: Transform ): void { const ctx = canvas.ctx; this.setCanvasState(canvas); @@ -290,7 +288,7 @@ export class Circle extends GraphicItemBase { protected render( canvas: MotaOffscreenCanvas2D, - transform: Transform + _transform: Transform ): void { const ctx = canvas.ctx; this.setCanvasState(canvas); @@ -369,7 +367,7 @@ export class Ellipse extends GraphicItemBase { protected render( canvas: MotaOffscreenCanvas2D, - transform: Transform + _transform: Transform ): void { const ctx = canvas.ctx; this.setCanvasState(canvas); @@ -461,7 +459,7 @@ export class Line extends GraphicItemBase { protected render( canvas: MotaOffscreenCanvas2D, - transform: Transform + _transform: Transform ): void { const ctx = canvas.ctx; this.setCanvasState(canvas); @@ -530,7 +528,7 @@ export class BezierCurve extends GraphicItemBase { protected render( canvas: MotaOffscreenCanvas2D, - transform: Transform + _transform: Transform ): void { const ctx = canvas.ctx; this.setCanvasState(canvas); @@ -638,7 +636,7 @@ export class QuadraticCurve extends GraphicItemBase { protected render( canvas: MotaOffscreenCanvas2D, - transform: Transform + _transform: Transform ): void { const ctx = canvas.ctx; this.setCanvasState(canvas); @@ -718,7 +716,7 @@ export class Path extends GraphicItemBase { protected render( canvas: MotaOffscreenCanvas2D, - transform: Transform + _transform: Transform ): void { const ctx = canvas.ctx; this.setCanvasState(canvas); @@ -839,7 +837,7 @@ export class RectR extends GraphicItemBase { protected render( canvas: MotaOffscreenCanvas2D, - transform: Transform + _transform: Transform ): void { const ctx = canvas.ctx; this.setCanvasState(canvas); diff --git a/src/core/render/preset/misc.ts b/src/core/render/preset/misc.ts index 7fa69fd..523aa68 100644 --- a/src/core/render/preset/misc.ts +++ b/src/core/render/preset/misc.ts @@ -1,5 +1,4 @@ import { MotaOffscreenCanvas2D } from '@/core/fx/canvas2d'; -import { Sprite } from '../sprite'; import { ERenderItemEvent, IAnimateFrame, @@ -11,8 +10,6 @@ import { Transform } from '../transform'; import { ElementNamespace, ComponentInternalInstance } from 'vue'; import { AutotileRenderable, RenderableData } from '../cache'; import { texture } from '../cache'; -import { isNil } from 'lodash-es'; -import { logger } from '@/core/common/logger'; type CanvasStyle = string | CanvasGradient | CanvasPattern; @@ -42,7 +39,7 @@ export class Text extends RenderItem { protected render( canvas: MotaOffscreenCanvas2D, - transform: Transform + _transform: Transform ): void { const ctx = canvas.ctx; ctx.textBaseline = 'bottom'; @@ -171,7 +168,7 @@ export class Image extends RenderItem { protected render( canvas: MotaOffscreenCanvas2D, - transform: Transform + _transform: Transform ): void { const ctx = canvas.ctx; ctx.drawImage(this.image, 0, 0, canvas.width, canvas.height); @@ -209,8 +206,8 @@ export class Comment extends RenderItem { } protected render( - canvas: MotaOffscreenCanvas2D, - transform: Transform + _canvas: MotaOffscreenCanvas2D, + _transform: Transform ): void {} } @@ -228,7 +225,7 @@ export class Icon extends RenderItem implements IAnimateFrame { protected render( canvas: MotaOffscreenCanvas2D, - transform: Transform + _transform: Transform ): void { const ctx = canvas.ctx; const renderable = this.renderable; @@ -239,7 +236,7 @@ export class Icon extends RenderItem implements IAnimateFrame { const frame = this.animate ? RenderItem.animatedFrame % renderable.frame : 0; - if (this.animate) { + if (!this.animate) { if (renderable.autotile) { ctx.drawImage(renderable.image[0], x, y, w, h, 0, 0, cw, ch); } else { @@ -336,7 +333,7 @@ export class Winskin extends RenderItem { protected render( canvas: MotaOffscreenCanvas2D, - transform: Transform + _transform: Transform ): void { const ctx = canvas.ctx; const img = this.image; @@ -346,7 +343,8 @@ export class Winskin extends RenderItem { const h = canvas.height; const sz = this.borderSize / 32; ctx.drawImage(img, 128, 0, 16, 16, x, y, 16 * sz, 16 * sz); - for (var dx = 0; dx < w - 64 * sz; dx += 32 * sz) { + let dx; + for (dx = 0; dx < w - 64 * sz; dx += 32 * sz) { ctx.drawImage( img, 144, @@ -404,7 +402,8 @@ export class Winskin extends RenderItem { 16 * sz ); // 左右 - for (var dy = 0; dy < h - 64 * sz; dy += 32 * sz) { + let dy; + for (dy = 0; dy < h - 64 * sz; dy += 32 * sz) { ctx.drawImage( img, 128,