drawTip icon

This commit is contained in:
oc 2019-04-17 13:50:31 +08:00
parent 32b73796da
commit 0b0fa6714c
2 changed files with 8 additions and 1 deletions

View File

@ -1706,6 +1706,7 @@ core.drawTip(text, id)
在左上角以气泡的形式绘制一段提示。
text为文字内容仅支持${}的表达式计算,不支持换行和变色。
id可选为同时绘制的图标ID如果不为null则会同时绘制该图标仅对32x32的素材有效
也可以使用状态栏的图标ID例如lv, hp, up, save, settings等。
core.drawText(content, callback)

View File

@ -275,7 +275,13 @@ ui.prototype.drawTip = function (text, id) {
core.setTextAlign('data', 'left');
if (id != null) {
var info = core.getBlockInfo(id);
if (info == null || !info.image || info.height != 32) id = null;
if (info == null || !info.image || info.height != 32) {
// 检查状态栏图标
if (core.statusBar.icons[id] instanceof Image) {
id = {image: core.statusBar.icons[id], posX: 0, posY: 0};
}
else id = null;
}
else id = info;
}
if (!id) {