From 66fd2c86dc9af80ca6ba935a0990877b36d4b85d Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Fri, 30 Nov 2018 21:45:33 +0800 Subject: [PATCH] V2.5.2 --- README.md | 6 ++++-- docs/element.md | 2 ++ docs/event.md | 6 ++++++ libs/ui.js | 28 ++++++++++++++++------------ 更新说明.txt | 6 ++++-- 5 files changed, 32 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index dbe04285..f96d71d9 100644 --- a/README.md +++ b/README.md @@ -57,13 +57,15 @@ HTML5 canvas制作的魔塔样板,支持全平台游戏! * [x] 怪物和NPC的行走图和朝向问题 * [x] 可以引入WindowSkin作为对话框的背景素材 -* [x] \r可以动态调整剧情文本的颜色 +* [x] 对话框允许使用\t[标题,1.png]来绘制大头像图 +* [x] \r[red]可以动态调整剧情文本的颜色 * [x] 升级事件改用事件编辑器完成 * [x] 每层楼都增添该层的并行事件处理 * [x] 新增快捷键:N返回标题;P查看评论;O打开工程 * [x] 道具可以设置是否在回放时绘制道具栏或直接使用 -* [x] 追加素材一次可以追加多个 +* [x] 可以同时异步移动/跳跃勇士和多个NPC * [x] 可以同时异步移动两张或以上的图片了 +* [x] 追加素材一次可以追加多个 * [x] 菜单栏中新增虚拟键盘的弹出 * [x] 修复所有已知Bug;部分细节优化 diff --git a/docs/element.md b/docs/element.md index 5e838743..7e790e90 100644 --- a/docs/element.md +++ b/docs/element.md @@ -314,6 +314,8 @@ floorId指定的是目标楼层的唯一标识符(ID)。 - 使用`\r[...]`来动态修改局部文本的颜色,如`\r[red]`。 - 使用`${}`来计算一个表达式的值,如`${status:atk+status:def}`。 +从V2.5.2开始,也允许绘制一张头像图在对话框中。 + 详细信息请参见[剧情文本控制](event#text:显示一段文字(剧情))中的说明。 从V2.5.2开始,可以用一张WindowSkin图片作为对话框的背景皮肤。 diff --git a/docs/event.md b/docs/event.md index 59c2cb22..bb8925fa 100644 --- a/docs/event.md +++ b/docs/event.md @@ -207,6 +207,10 @@ 对于hero和怪物,也可以不写名字代表使用默认值。 +从V2.5.2以后,新增了绘制大头像的功能。如果需要使用头像图片(比如1.png),需先在全塔属性中注册后使用。 + +大头像图的基本写法是`\t[1.png]`或者`\t[标题,1.png]`。 + ``` js "x,y": [ // 实际执行的事件列表 "一段普通文字", @@ -216,6 +220,8 @@ "\t[blackMagician]如果使用怪物的默认名称也可以简写怪物id", "\t[小妖精,fairy]这是一段小妖精说的话,使用仙子(fairy)的图标", "\t[你赢了]直接显示标题为【你赢了】", + "\t[1.png]绘制1.png这个头像图", + "\t[标题,1.png]绘制标题1.png这个头像图" ] ``` diff --git a/libs/ui.js b/libs/ui.js index f59f2e2f..6d55b440 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -314,15 +314,20 @@ ui.prototype.getTitleAndIcon = function (content) { content=content.substring(index+1); var ss=str.split(","); if (ss.length==1) { - id=ss[0]; - if (id=='hero') name = core.status.hero.name; - else if (core.isset(core.material.enemys[id])) { - name = core.material.enemys[id].name; - getInfo(id); + if (/^\w+\.png$/.test(ss[0])) { + image = core.material.images.images[ss[0]]; } else { - name=id; - id='npc'; + id=ss[0]; + if (id=='hero') name = core.status.hero.name; + else if (core.isset(core.material.enemys[id])) { + name = core.material.enemys[id].name; + getInfo(id); + } + else { + name=id; + id='npc'; + } } } else { @@ -483,7 +488,7 @@ ui.prototype.drawTextBox = function(content, showAll) { height = Math.max(height, core.material.icons.hero.height+50); else if (core.isset(icon)) height = Math.max(height, iconHeight+50); - if (core.isset(image) && !core.isset(icon)) + else if (core.isset(image)) height = Math.max(height, 90); var xoffset = 11, yoffset = 16; @@ -575,14 +580,13 @@ ui.prototype.drawTextBox = function(content, showAll) { 'image': image, 'pos': icon*iconHeight }); - core.drawBoxAnimate(); } - else if (core.isset(image)) { - core.canvas.ui.drawImage(image, 0, 0, image.width, image.height, left+10, top+10, 70, 70); - } } } + if (core.isset(image) && !core.isset(icon)) { + core.canvas.ui.drawImage(image, 0, 0, image.width, image.height, left+10, top+10, 70, 70); + } var offsetx = content_left, offsety = content_top; core.setFont('ui', font); diff --git a/更新说明.txt b/更新说明.txt index 7dc8a64e..5ed4cc46 100644 --- a/更新说明.txt +++ b/更新说明.txt @@ -2,13 +2,15 @@ 怪物和NPC的行走图和朝向问题(详见文档) 可以引入WindowSkin作为对话框的背景素材 -\r可以动态调整剧情文本的颜色 +对话框允许使用\t[标题,1.png]来绘制大头像图 +\r[red]可以动态调整剧情文本的颜色 升级事件改用事件编辑器完成 每层楼都增添该层的并行事件处理 新增快捷键:N返回标题;P查看评论;O打开工程 道具可以设置是否在回放时绘制道具栏或直接使用 -追加素材一次可以追加多个 +可以同时异步移动/跳跃勇士和多个NPC 可以同时异步移动两张或以上的图片了 +追加素材一次可以追加多个 菜单栏中新增虚拟键盘的弹出 修复所有已知Bug;部分细节优化