block name

This commit is contained in:
oc 2019-06-08 20:15:12 +08:00
parent b75f475443
commit 2080b7a885
4 changed files with 14 additions and 4 deletions

View File

@ -190,7 +190,7 @@
从V2.5.2以后,新增了绘制大头像的功能。绘制大头像图的基本写法是`\t[1.png]`或者`\t[标题,1.png]`。
从V2.6开始所有图块都允许只写ID对于非怪物则没有标题
从V2.6开始所有图块都允许只写ID对于非怪物则仅当图块属性中设置了name才有标题否则不显示标题
``` js
[

View File

@ -225,6 +225,12 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_range": "false",
"_data": "图块类别"
},
"name": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_data": "图块名称"
},
"trigger": {
"_leaf": true,
"_type": "select",

View File

@ -1223,7 +1223,7 @@ maps.prototype.getBlockInfo = function (block) {
if (block == 0) return null;
block = this.initBlock(0, 0, block, true);
}
var number = block.id, id = block.event.id, cls = block.event.cls,
var number = block.id, id = block.event.id, cls = block.event.cls, name = block.event.name,
image = null, posX = 0, posY = 0, animate = block.event.animate,
height = block.event.height || 32, faceIds = {};
@ -1231,6 +1231,7 @@ maps.prototype.getBlockInfo = function (block) {
else if (id == 'airwall') {
if (!core.material.images.airwall) return null;
image = core.material.images.airwall;
name = "空气墙";
}
else if (cls == 'tileset') {
var offset = core.icons.getTilesetOffset(id);
@ -1246,9 +1247,12 @@ maps.prototype.getBlockInfo = function (block) {
image = core.material.images[cls];
posY = core.material.icons[cls][id];
faceIds = block.event.faceIds || {};
if (core.material.enemys[id]) {
name = core.material.enemys[id].name;
}
}
return {number: number, id: id, cls: cls, image: image, posX: posX, posY: posY, height: height, faceIds: faceIds, animate: animate};
return {number: number, id: id, cls: cls, name: name, image: image, posX: posX, posY: posY, height: height, faceIds: faceIds, animate: animate};
}
////// 搜索某个图块出现的所有位置 //////

View File

@ -535,7 +535,7 @@ ui.prototype._getTitleAndIcon = function (content) {
else {
var blockInfo = core.getBlockInfo(s4);
if (blockInfo != null) {
if (core.material.enemys[s4]) title = core.material.enemys[s4].name;
if (blockInfo.name) title = blockInfo.name;
image = blockInfo.image;
icon = blockInfo.posY;
height = blockInfo.height;