diff --git a/_docs/api.md b/_docs/api.md index c1c65a3d..712e04cd 100644 --- a/_docs/api.md +++ b/_docs/api.md @@ -952,10 +952,11 @@ core.startEvents(list, x, y, callback) 此函数将调用core.setEvents,然后停止勇士,再执行core.doAction()。 -core.doAction() +core.doAction(keepUI) 执行下一个自定义事件。 此函数将检测事件列表是否全部执行完毕,如果是则执行回调函数。 否则,将从事件列表中弹出下一个事件,并调用core.doEvent进行执行。 +如果keepUI为true,则不会清掉UI层和selector,适合于自己用脚本的绘制。 core.insertAction(action, x, y, callback, addToLast) diff --git a/libs/events.js b/libs/events.js index 8c72173f..f0807d4c 100644 --- a/libs/events.js +++ b/libs/events.js @@ -788,11 +788,13 @@ events.prototype.startEvents = function (list, x, y, callback) { } ////// 执行当前自定义事件列表中的下一个事件 ////// -events.prototype.doAction = function () { - // 清空boxAnimate和UI层 - core.clearUI(); - clearInterval(core.status.event.interval); - core.status.event.interval = null; +events.prototype.doAction = function (keepUI) { + if (!keepUI) { + // 清空boxAnimate和UI层 + core.clearUI(); + clearInterval(core.status.event.interval); + core.status.event.interval = null; + } // 判定是否执行完毕 if (this._doAction_finishEvents()) return; // 当前点坐标和前缀 @@ -1874,7 +1876,7 @@ events.prototype.setGlobalFlag = function (name, value) { events.prototype.closeDoor = function (x, y, id, callback) { id = id || ""; if (!(id.endsWith("Door") || id.endsWith("Wall")) - || !core.material.icons.animates[id] || core.getBlock(x, y) != null) { + || core.material.icons.animates[id] == null || core.getBlock(x, y) != null) { if (callback) callback(); return; } diff --git a/libs/ui.js b/libs/ui.js index d67f17db..4cbb3260 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -1664,8 +1664,19 @@ ui.prototype.drawFly = function(page) { core.setTextAlign('ui', 'center'); core.fillText('ui', '楼层跳跃', this.HPIXEL, 60, '#FFFFFF', this._buildFont(28, true)); core.fillText('ui', '返回游戏', this.HPIXEL, this.PIXEL - 13, null, this._buildFont(15, true)) - core.fillText('ui', title, this.PIXEL - 60, this.HPIXEL + 39, null, this._buildFont(19, true)); + var middle = this.HPIXEL + 39; + + // 换行 + var lines = core.splitLines('ui', title, 120, this._buildFont(19, true)); + var start_y = middle - (lines.length - 1) * 11; + for (var i in lines) { + core.fillText('ui', lines[i], this.PIXEL - 60, start_y); + start_y += 22; + } + + // core.fillText('ui', title, this.PIXEL - 60, this.HPIXEL + 39, null, this._buildFont(19, true)); + if (core.actions._getNextFlyFloor(1) != page) { core.fillText('ui', '▲', this.PIXEL - 60, middle - 64, null, this._buildFont(17, false)); core.fillText('ui', '▲', this.PIXEL - 60, middle - 96); @@ -1913,9 +1924,12 @@ ui.prototype._drawToolbox_drawDescription = function (info, max_height) { // 检查能否eval text = core.replaceText(text); } catch (e) {} - var lines = core.splitLines('ui', text, this.PIXEL - 15, this._buildFont(17, false)); - // --- 开始逐行绘制 - var curr = 62, line_height = 25; + + for (var font_size = 17; font_size >= 14; font_size -= 3) { + var lines = core.splitLines('ui', text, this.PIXEL - 15, this._buildFont(font_size, false)); + var line_height = parseInt(font_size * 1.4), curr = 37 + line_height; + if (curr + lines.length * line_height < max_height) break; + } core.setFillStyle('ui', '#FFFFFF'); for (var i=0;i= 11; font_size -= 3) { + var lines = core.splitLines('ui', text, this.PIXEL - 15, this._buildFont(font_size, false)); + var line_height = parseInt(font_size * 1.4), curr = 37 + line_height; + if (curr + lines.length * line_height < max_height) break; + } core.setFillStyle('ui', '#FFFFFF'); for (var i = 0; i < lines.length; ++i) { core.fillText('ui', lines[i], 10, curr);