修复滑冰和多行文本绘制

This commit is contained in:
ckcz123 2020-05-09 17:58:12 +08:00
parent b25029ec72
commit 472bc4fc58
3 changed files with 57 additions and 59 deletions

View File

@ -867,7 +867,7 @@ ui.prototype.drawTextContent = function (ctx, content, config) {
config.index = 0;
config.currcolor = config.color;
config.currfont = config.fontSize;
config.lineMargin = Math.max(0, config.lineHeight - config.fontSize);
config.lineMargin = Math.max(Math.round(config.fontSize / 4), config.lineHeight - config.fontSize);
config.topMargin = parseInt(config.lineMargin / 2);
config.lineMaxHeight = config.lineMargin + config.fontSize;
config.offsetX = 0;

View File

@ -163,84 +163,82 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 =
},
{
"type": "if",
"condition": "core.canMoveHero()",
"condition": "core.getBgNumber() == 167",
"true": [
{
"type": "comment",
"text": "检测下一个点是否可通行"
},
{
"type": "setValue",
"name": "flag:nx",
"value": "core.nextX()"
},
{
"type": "setValue",
"name": "flag:ny",
"value": "core.nextY()"
},
{
"type": "if",
"condition": "core.noPass(flag:nx, flag:ny)",
"condition": "core.canMoveHero()",
"true": [
{
"type": "comment",
"text": "不可通行,触发下一个点的事件"
"text": "检测下一个点是否可通行"
},
{
"type": "trigger",
"loc": [
"flag:nx",
"flag:ny"
]
}
],
"false": [
{
"type": "comment",
"text": "可通行,先移动到下个点,然后检查阻激夹域,并尝试触发该点事件"
"type": "setValue",
"name": "flag:nx",
"value": "core.nextX()"
},
{
"type": "moveHero",
"time": 80,
"steps": [
"forward"
]
},
{
"type": "function",
"function": "function(){\ncore.checkBlock();\n}"
},
{
"type": "comment",
"text": "【触发事件】如果该点存在事件则会立刻结束当前事件"
},
{
"type": "trigger",
"loc": [
"flag:nx",
"flag:ny"
]
},
{
"type": "comment",
"text": "如果该点不存在事件,则继续检测该点是否是滑冰点"
"type": "setValue",
"name": "flag:ny",
"value": "core.nextY()"
},
{
"type": "if",
"condition": "core.getBgNumber() == 167",
"condition": "core.noPass(flag:nx, flag:ny)",
"true": [
{
"type": "comment",
"text": "不可通行,触发下一个点的事件"
},
{
"type": "trigger",
"loc": [
"flag:nx",
"flag:ny"
]
}
],
"false": [
{
"type": "comment",
"text": "可通行,先移动到下个点,然后检查阻激夹域,并尝试触发该点事件"
},
{
"type": "moveHero",
"time": 80,
"steps": [
"forward"
]
},
{
"type": "function",
"function": "function(){\ncore.checkBlock();\n}"
},
{
"type": "comment",
"text": "【触发事件】如果该点存在事件则会立刻结束当前事件"
},
{
"type": "trigger",
"loc": [
"flag:nx",
"flag:ny"
]
},
{
"type": "comment",
"text": "如果该点不存在事件,则继续检测该点是否是滑冰点"
},
{
"type": "function",
"function": "function(){\ncore.insertAction(\"滑冰事件\",null,null,null,true)\n}"
}
],
"false": []
]
}
]
}
],
"false": []
]
}
],
"回收钥匙商店": [

View File

@ -181,7 +181,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
var text = core.material.items[item.id].text || "该道具暂无描述";
try { text = core.replaceText(text); } catch (e) {}
for (var fontSize = 20; fontSize >= 8; fontSize -= 2) {
var config = { left: 10, fontSize: fontSize, maxWidth: 403, lineHeight: 1.4 };
var config = { left: 10, fontSize: fontSize, maxWidth: 403 };
var height = core.getTextContentHeight(text, config);
if (height <= 50) {
config.top = (56 - height) / 2;