fix:修改弹幕相关的若干小bug

This commit is contained in:
ShakeFlower 2025-03-02 17:04:49 +08:00
parent 8f3dc23cd1
commit b1086f5218
2 changed files with 46 additions and 24 deletions

View File

@ -601,16 +601,21 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"name": "言灵",
"canUseItemEffect": "true",
"useItemEvent": [
{
"type": "while",
"condition": "true",
"data": [
{
"type": "choices",
"text": "本功能需要您在h5mota.com在线游玩并处于登录状态时使用可以发送和接受留言。\n发言后需要选择\"获取最新留言\"才能看到自己新发的留言。\n您当前\"在地图上显示在线留言\"功能处于${flag:comment?'打开状态':'关闭状态,在设置中可打开。'}",
"text": "本功能需要您在h5mota.com在线游玩并处于登录状态时使用可以发送和接受留言。\n发言后需要选择\"获取最新留言\"才能看到自己新发的留言。",
"choices": [
{
"text": "获取最新留言",
"text": "地图上显示在线留言:${flag:comment?'开':'关'}",
"icon": "postman",
"action": [
{
"type": "function",
"function": "function(){\nif (!core.isReplaying()) {\n\tcore.plugin.getComment();\n\tsetTimeout(core.plugin.drawCommentSign, 1000);\n}\n}"
"function": "function(){\nif (core.hasFlag('comment')) {\n\tcore.setFlag('comment', false);\n\tcore.plugin.clearCommentSign();\n} else {\n\tcore.setFlag('comment', true);\n\tcore.plugin.drawCommentSign();\n}\n}"
}
]
},
@ -627,9 +632,24 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
}
]
},
{
"text": "获取最新留言",
"action": [
{
"type": "function",
"function": "function(){\nif (!core.isReplaying()) {\n\tcore.plugin.getComment();\n\tsetTimeout(core.plugin.drawCommentSign, 1000);\n}\n}"
}
]
},
{
"text": "退出",
"action": []
"action": [
{
"type": "exit"
}
]
}
]
}
]
}

View File

@ -2399,10 +2399,12 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
ani.ticker.add(() => {
core.fillText(ctxName, content, x + ani.x, y, 'white', '16px Verdana');
})
// 弹幕的最大长度5600再长属于异常数据
const aim = 600 + Math.min(core.calWidth(ctxName, content, '16px Verdana'), 5000);
ani.mode(linear())
.time(600 / vx)
.time(aim / vx)
.absolute()
.move(-600, 0)
.move(-aim, 0)
ani.all().then(() => {
ani.ticker.destroy();
});