From b1086f52187b4527106b9136602582845f1b47bd Mon Sep 17 00:00:00 2001 From: ShakeFlower Date: Sun, 2 Mar 2025 17:04:49 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E6=94=B9=E5=BC=B9=E5=B9=95?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E7=9A=84=E8=8B=A5=E5=B9=B2=E5=B0=8Fbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- project/items.js | 64 ++++++++++++++++++++++++++++++---------------- project/plugins.js | 6 +++-- 2 files changed, 46 insertions(+), 24 deletions(-) diff --git a/project/items.js b/project/items.js index ccff695a..cd88243e 100644 --- a/project/items.js +++ b/project/items.js @@ -602,34 +602,54 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "canUseItemEffect": "true", "useItemEvent": [ { - "type": "choices", - "text": "本功能需要您在h5mota.com在线游玩并处于登录状态时使用,可以发送和接受留言。\n发言后需要选择\"获取最新留言\"才能看到自己新发的留言。\n您当前\"在地图上显示在线留言\"功能处于${flag:comment?'打开状态':'关闭状态,在设置中可打开。'}", - "choices": [ + "type": "while", + "condition": "true", + "data": [ { - "text": "获取最新留言", - "action": [ + "type": "choices", + "text": "本功能需要您在h5mota.com在线游玩并处于登录状态时使用,可以发送和接受留言。\n发言后需要选择\"获取最新留言\"才能看到自己新发的留言。", + "choices": [ { - "type": "function", - "function": "function(){\nif (!core.isReplaying()) {\n\tcore.plugin.getComment();\n\tsetTimeout(core.plugin.drawCommentSign, 1000);\n}\n}" - } - ] - }, - { - "text": "写留言", - "action": [ - { - "type": "input2", - "text": "请输入要发送的评论,文明友善发言,拒绝放假、剧透。" + "text": "地图上显示在线留言:${flag:comment?'开':'关'}", + "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}" + } + ] }, { - "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": "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": [] } ] } diff --git a/project/plugins.js b/project/plugins.js index 3381f226..feb2f082 100644 --- a/project/plugins.js +++ b/project/plugins.js @@ -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(); });