Merge pull request #373 from ckcz123/v2.x

V2.x
This commit is contained in:
Zhang Chen 2019-05-21 16:42:57 +08:00 committed by GitHub
commit a9244c1f70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 13 deletions

View File

@ -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)

View File

@ -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;
}

View File

@ -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<lines.length;++i) {
core.fillText('ui', lines[i], 10, curr);
@ -2019,8 +2033,12 @@ ui.prototype._drawEquipbox_description = function (info, max_height) {
try {
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 >= 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);