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

@ -602,34 +602,54 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"canUseItemEffect": "true", "canUseItemEffect": "true",
"useItemEvent": [ "useItemEvent": [
{ {
"type": "choices", "type": "while",
"text": "本功能需要您在h5mota.com在线游玩并处于登录状态时使用可以发送和接受留言。\n发言后需要选择\"获取最新留言\"才能看到自己新发的留言。\n您当前\"在地图上显示在线留言\"功能处于${flag:comment?'打开状态':'关闭状态,在设置中可打开。'}", "condition": "true",
"choices": [ "data": [
{ {
"text": "获取最新留言", "type": "choices",
"action": [ "text": "本功能需要您在h5mota.com在线游玩并处于登录状态时使用可以发送和接受留言。\n发言后需要选择\"获取最新留言\"才能看到自己新发的留言。",
"choices": [
{ {
"type": "function", "text": "地图上显示在线留言:${flag:comment?'开':'关'}",
"function": "function(){\nif (!core.isReplaying()) {\n\tcore.plugin.getComment();\n\tsetTimeout(core.plugin.drawCommentSign, 1000);\n}\n}" "icon": "postman",
} "action": [
] {
}, "type": "function",
{ "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}"
"text": "写留言", }
"action": [ ]
{
"type": "input2",
"text": "请输入要发送的评论,文明友善发言,拒绝放假、剧透。"
}, },
{ {
"type": "function", "text": "写留言",
"function": "function(){\nconst input = core.getFlag('input', '');\nconst tags = [core.status.floorId,\n\tcore.getHeroLoc().x.toString(), core.getHeroLoc().y.toString()\n]\nif (!core.isReplaying()) {\n\tcore.plugin.postComment(input, tags);\n}\n}" "action": [
{
"type": "input2",
"text": "请输入要发送的评论,文明友善发言,拒绝放假、剧透。"
},
{
"type": "function",
"function": "function(){\nconst input = core.getFlag('input', '');\nconst tags = [core.status.floorId,\n\tcore.getHeroLoc().x.toString(), core.getHeroLoc().y.toString()\n]\nif (!core.isReplaying()) {\n\tcore.plugin.postComment(input, tags);\n}\n}"
}
]
},
{
"text": "获取最新留言",
"action": [
{
"type": "function",
"function": "function(){\nif (!core.isReplaying()) {\n\tcore.plugin.getComment();\n\tsetTimeout(core.plugin.drawCommentSign, 1000);\n}\n}"
}
]
},
{
"text": "退出",
"action": [
{
"type": "exit"
}
]
} }
] ]
},
{
"text": "退出",
"action": []
} }
] ]
} }

View File

@ -2399,10 +2399,12 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
ani.ticker.add(() => { ani.ticker.add(() => {
core.fillText(ctxName, content, x + ani.x, y, 'white', '16px Verdana'); 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()) ani.mode(linear())
.time(600 / vx) .time(aim / vx)
.absolute() .absolute()
.move(-600, 0) .move(-aim, 0)
ani.all().then(() => { ani.all().then(() => {
ani.ticker.destroy(); ani.ticker.destroy();
}); });