fix:弹幕系统Ticker管理测试

This commit is contained in:
ShakeFlower 2025-02-15 09:48:42 +08:00
parent e662f80287
commit 30455f7a3e

View File

@ -1213,6 +1213,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
this.status = "stop", w = w.filter((i) => i !== this); this.status = "stop", w = w.filter((i) => i !== this);
} }
} }
// F is Ticker
class F { class F {
constructor(name) { constructor(name) {
o(this, "timing"); o(this, "timing");
@ -1289,9 +1290,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
async function R(n) { async function R(n) {
return new Promise((i) => setTimeout(i, n)); return new Promise((i) => setTimeout(i, n));
} }
// j is Animation
class j extends F { class j extends F {
constructor() { constructor(name) {
super(); super(name);
o(this, "shakeTiming"); o(this, "shakeTiming");
o(this, "path"); o(this, "path");
o(this, "multiTiming"); o(this, "multiTiming");
@ -2389,6 +2391,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
}); });
} }
let commentCount = 0;
/** /**
* 绘制弹幕 * 绘制弹幕
* @example * @example
@ -2400,7 +2403,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
*/ */
function drawCommentStr(content, x, y, vx) { function drawCommentStr(content, x, y, vx) {
if (core.isReplaying() || !Animation) return; if (core.isReplaying() || !Animation) return;
const ani = new Animation(); commentCount++;
const aniName = 'comment' + commentCount;
const ani = new Animation(aniName);
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');
}) })
@ -4175,7 +4180,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.setFlag('comment', false); core.setFlag('comment', false);
core.plugin.clearCommentSign(); core.plugin.clearCommentSign();
} }
else core.setFlag('comment', true); else {
core.setFlag('comment', true);
core.plugin.drawCommentSign();
}
}, },
'在地图上显示玩家的在线留言。', '在地图上显示玩家的在线留言。',
true, true,