From 1879d69670a4ba7dd5766a18fff3ada57d77ea14 Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Sun, 28 Jun 2020 22:28:28 +0800 Subject: [PATCH] Fix searchBlock bug --- _server/editor_blockly.js | 2 +- libs/ui.js | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/_server/editor_blockly.js b/_server/editor_blockly.js index 15d26ef0..36e122a9 100644 --- a/_server/editor_blockly.js +++ b/_server/editor_blockly.js @@ -414,7 +414,7 @@ editor_blockly = function () { editor_blockly.reopenToolbox = function(index) { if (index < 0) index += editor_blockly.workspace.toolbox_.tree_.children_.length; editor_blockly.workspace.toolbox_.tree_.setSelectedItem(editor_blockly.workspace.toolbox_.tree_.children_[index]); - editor_blockly.workspace.getFlyout_().show(editor_blockly.workspace.toolbox_.tree_.children_[index].blocks); + editor_blockly.workspace.getFlyout().show(editor_blockly.workspace.toolbox_.tree_.children_[index].blocks); } editor_blockly.closeToolbox = function() { diff --git a/libs/ui.js b/libs/ui.js index 8af94db7..4bae76a7 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -1864,10 +1864,7 @@ ui.prototype.drawBook = function (index) { core.setAlpha('ui', 1); if (enemys.length == 0) { - core.setTextAlign('ui', 'center'); - core.fillText('ui', "本层无怪物", this.HPIXEL, this.HPIXEL + 14, '#999999', this._buildFont(50, true)); - core.fillText('ui', '返回游戏', this.PIXEL - 46, this.PIXEL - 13,'#DDDDDD', this._buildFont(15, true)); - return; + return this._drawBook_drawEmpty(); } index = core.clamp(index, 0, enemys.length - 1); @@ -1904,6 +1901,12 @@ ui.prototype._drawBook_drawBackground = function () { core.fillRect('ui', 0, 0, this.PIXEL, this.PIXEL); } +ui.prototype._drawBook_drawEmpty = function () { + core.setTextAlign('ui', 'center'); + core.fillText('ui', "本层无怪物", this.HPIXEL, this.HPIXEL + 14, '#999999', this._buildFont(50, true)); + core.fillText('ui', '返回游戏', this.PIXEL - 46, this.PIXEL - 13,'#DDDDDD', this._buildFont(15, true)); +} + ui.prototype._drawBook_drawOne = function (floorId, index, enemy, pageinfo, selected) { // --- 区域规划:每个区域总高度默认为62,宽度为 PIXEL var top = pageinfo.per_height * index + pageinfo.padding_top; // 最上面margin默认是12px