diff --git a/_server/blockly/MotaAction.g4 b/_server/blockly/MotaAction.g4 index ad12ff1a..5db2748e 100644 --- a/_server/blockly/MotaAction.g4 +++ b/_server/blockly/MotaAction.g4 @@ -1675,8 +1675,8 @@ Global_Attribute_List /*Global_Attribute_List ['font','statusLeftBackground','statusTopBackground', 'toolsBackground', 'borderColor', 'statusBarColor', 'hardLabelColor', 'floorChangingBackground', 'floorChangingTextColor']*/; Global_Value_List - : '血网伤害'|'中毒伤害'|'衰弱效果'|'红宝石效果'|'蓝宝石效果'|'绿宝石效果'|'红血瓶效果'|'蓝血瓶效果'|'黄血瓶效果'|'绿血瓶效果'|'破甲比例'|'反击比例'|'净化比例'|'仇恨增加值'|'行走速度'|'动画时间' - /*Global_Value_List ['lavaDamage','poisonDamage','weakValue', 'redJewel', 'blueJewel', 'greenJewel', 'redPotion', 'bluePotion', 'yellowPotion', 'greenPotion', 'breakArmor', 'counterAttack', 'purify', 'hatred', 'moveSpeed', 'animateSpeed']*/; + : '血网伤害'|'中毒伤害'|'衰弱效果'|'红宝石效果'|'蓝宝石效果'|'绿宝石效果'|'红血瓶效果'|'蓝血瓶效果'|'黄血瓶效果'|'绿血瓶效果'|'破甲比例'|'反击比例'|'净化比例'|'仇恨增加值'|'行走速度'|'动画时间'|'楼层切换时间' + /*Global_Value_List ['lavaDamage','poisonDamage','weakValue', 'redJewel', 'blueJewel', 'greenJewel', 'redPotion', 'bluePotion', 'yellowPotion', 'greenPotion', 'breakArmor', 'counterAttack', 'purify', 'hatred', 'moveSpeed', 'animateSpeed', 'floorChangeTime']*/; Bool: 'TRUE' | 'FALSE' @@ -1904,7 +1904,7 @@ ActionParser.prototype.parseAction = function() { case "autoText": // 自动剧情文本 data.time=this.isset(data.time)?data.time:MotaActionBlocks['autoText_s'].fieldDefault[3]; this.next = MotaActionBlocks['autoText_s'].xmlText([ - '','','',data.time,this.EvalString(data.text),this.next]); + '','','',data.time||0,this.EvalString(data.text),this.next]); break; case "comment": // 注释 this.next = MotaActionBlocks['comment_s'].xmlText([data.text,this.next]); @@ -1916,7 +1916,7 @@ ActionParser.prototype.parseAction = function() { if (!/^\w+\.png$/.test(data.background)) data.background=setTextfunc(data.background); this.next = MotaActionBlocks['setText_s'].xmlText([ - data.position,data.offset,data.title,data.text,data.background,data.bold,data.titlefont,data.textfont,data.time,this.next]); + data.position,data.offset,data.title,data.text,data.background,data.bold,data.titlefont,data.textfont,data.time||0,this.next]); break; case "tip": this.next = MotaActionBlocks['tip_s'].xmlText([ @@ -2069,10 +2069,10 @@ ActionParser.prototype.parseAction = function() { case "animateImage": // 显示图片 if(data.action == 'show'){ this.next = MotaActionBlocks['animateImage_0_s'].xmlText([ - data.name,data.loc[0],data.loc[1],data.time,data.keep||false,data.async||false,this.next]); + data.name,data.loc[0],data.loc[1],data.time||0,data.keep||false,data.async||false,this.next]); } else if (data.action == 'hide') { this.next = MotaActionBlocks['animateImage_1_s'].xmlText([ - data.name,data.loc[0],data.loc[1],data.time,data.keep||false,data.async||false,this.next]); + data.name,data.loc[0],data.loc[1],data.time||0,data.keep||false,data.async||false,this.next]); } break; case "showGif": // 显示动图 @@ -2086,7 +2086,7 @@ ActionParser.prototype.parseAction = function() { break; case "moveImage": // 移动图片 this.next = MotaActionBlocks['moveImage_0_s'].xmlText([ - data.name, data.from[0], data.from[1], data.to[0], data.to[1], data.time, data.keep||false, data.async||false, this.next + data.name, data.from[0], data.from[1], data.to[0], data.to[1], data.time||0, data.keep||false, data.async||false, this.next ]); break; case "setFg": // 颜色渐变 @@ -2147,7 +2147,7 @@ ActionParser.prototype.parseAction = function() { break case "setVolume": this.next = MotaActionBlocks['setVolume_s'].xmlText([ - data.value, data.time, data.async||false, this.next]); + data.value, data.time||0, data.async||false, this.next]); break case "setValue": this.next = MotaActionBlocks['setValue_s'].xmlText([ @@ -2246,7 +2246,7 @@ ActionParser.prototype.parseAction = function() { break; case "sleep": // 等待多少毫秒 this.next = MotaActionBlocks['sleep_s'].xmlText([ - data.time,this.next]); + data.time||0,this.next]); break; case "wait": // 等待用户操作 this.next = MotaActionBlocks['wait_s'].xmlText([ diff --git a/_server/data.comment.js b/_server/data.comment.js index 7e7e136a..16a36c24 100644 --- a/_server/data.comment.js +++ b/_server/data.comment.js @@ -389,6 +389,11 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = "_leaf": true, "_type": "textarea", "_data": "全局动画时间,即怪物振动频率,一般300比较合适" + }, + "floorChangeTime": { + "_leaf": true, + "_type": "textarea", + "_data": "默认楼层切换时间" } } }, diff --git a/_server/editor.js b/_server/editor.js index 6c92568c..f83e68b4 100644 --- a/_server/editor.js +++ b/_server/editor.js @@ -197,7 +197,12 @@ editor.prototype.fetchMapFromCore = function(){ var mapArray = core.maps.save(core.status.maps, core.status.floorId); editor.map = mapArray.map(function (v) { return v.map(function (v) { - return editor.ids[[editor.indexs[parseInt(v)][0]]] + var x = parseInt(v), y = editor.indexs[x]; + if (!core.isset(y)) { + printe("素材数字"+x+"未定义。是不是忘了注册,或者接档时没有覆盖icons.js和maps.js?"); + y = [0]; + } + return editor.ids[y[0]] }) }); editor.currentFloorId = core.status.floorId; @@ -210,7 +215,12 @@ editor.prototype.fetchMapFromCore = function(){ } editor[name]=mapArray.map(function (v) { return v.map(function (v) { - return editor.ids[[editor.indexs[parseInt(v)][0]]] + var x = parseInt(v), y = editor.indexs[x]; + if (!core.isset(y)) { + printe("素材数字"+x+"未定义。是不是忘了注册,或者接档时没有覆盖icons.js和maps.js?"); + y = [0]; + } + return editor.ids[y[0]] }) }); } diff --git a/docs/element.md b/docs/element.md index 5a7189a3..e3388285 100644 --- a/docs/element.md +++ b/docs/element.md @@ -318,7 +318,7 @@ floorId指定的是目标楼层的唯一标识符(ID)。 另外一点是,V2.5.2以后,对话框`\b`可以根据文字长度来自动控制文本框宽度,其基本控制原理如下: - 如果用户存在手动换行`\n`,则选取**最长的一段话**作为文本框宽度。 -- 如果用户不存在手动换行,则会将文本框宽度调整为**尽量刚好达到三行**的最佳宽度。 +- 如果用户不存在手动换行,则会将文本框宽度调整为X行半的最佳宽度。 - 文本框宽度存在上下界,最终宽度一定会控制在该范围内。 该自动调整仅对`\b`的对话框效果有效。非对话框仍然会绘制整个界面的宽度。 diff --git a/libs/core.js b/libs/core.js index 6d01ebb9..3131844c 100644 --- a/libs/core.js +++ b/libs/core.js @@ -759,8 +759,8 @@ core.prototype.animateBlock = function (loc,type,time,callback) { } ////// 将某个块从禁用变成启用状态 ////// -core.prototype.showBlock = function(x, y, floodId) { - core.maps.showBlock(x,y,floodId); +core.prototype.showBlock = function(x, y, floorId) { + core.maps.showBlock(x,y,floorId); } ////// 将某个块从启用变成禁用状态,但是并不删除它 ////// diff --git a/libs/events.js b/libs/events.js index 8b47da2d..dd31665b 100644 --- a/libs/events.js +++ b/libs/events.js @@ -1396,10 +1396,11 @@ events.prototype.changeFloor = function (floorId, stair, heroLoc, time, callback if (index=100) && !core.status.replay.replaying; + var displayAnimate = time>=100 && !core.status.replay.replaying; - time = time || 800; time /= 20; core.lockControl(); core.stopHero(); diff --git a/libs/loader.js b/libs/loader.js index d5a4d3d3..5ff3c386 100644 --- a/libs/loader.js +++ b/libs/loader.js @@ -238,7 +238,7 @@ loader.prototype.loadMusic = function () { console.log(ee); core.material.sounds[t] = null; } - }, function () { + }, function (e) { console.log(e); core.material.sounds[t] = null; }, null, 'arraybuffer'); diff --git a/libs/ui.js b/libs/ui.js index c6067779..1be9ee61 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -403,6 +403,11 @@ ui.prototype.calTextBoxWidth = function (canvas, content, min_width, max_width) // 如果不存在手动换行,则二分自动换行 if (allLines.length == 1) { + var w = core.canvas[canvas].measureText(allLines[0]).width; + if (w