更新了EventContent.chooseTarget,使其不再报warning,修复了$damagepop中node没有被及时释放的问题

This commit is contained in:
539943419 committed 2024-07-20 19:58:16 +08:00
1 parent a02015cd73
commit 5c1b64c93c
1 file changed
+16 -11
+16 -11
View File
@@ -393,7 +393,9 @@ game.import('extension', async function(lib, game, ui, get, ai, _status){
} }
if (event.result.bool && event.animate !== false) { if (event.result.bool && event.animate !== false) {
for (var i = 0; i < event.result.targets.length; i++) { for (var i = 0; i < event.result.targets.length; i++) {
event.result.targets[i].animate('target'); // animate已被废弃 -miao
// event.result.targets[i].animate('target');
event.result.targets[i].addTempClass('target');
} }
} }
if (event.dialog) event.dialog.close(); if (event.dialog) event.dialog.close();
@@ -4986,12 +4988,12 @@ game.import('extension', async function(lib, game, ui, get, ai, _status){
}, this, num, nature, font); }, this, num, nature, font);
} }
var node; // let node;
if (this.popupNodeCache && this.popupNodeCache.length) { // if (this.popupNodeCache && this.popupNodeCache.length) {
node = this.popupNodeCache.shift(); // node = this.popupNodeCache.shift();
} else { // } else {
node = decadeUI.element.create('damage'); let node = decadeUI.element.create('damage');
} // }
if (font) { if (font) {
node.classList.add('normal-font'); node.classList.add('normal-font');
@@ -5020,7 +5022,7 @@ game.import('extension', async function(lib, game, ui, get, ai, _status){
} }
if (this.damagepopups.length && !this.damagepopLocked) { if (this.damagepopups.length && !this.damagepopLocked) {
var node = this.damagepopups.shift(); let node = this.damagepopups.shift();
this.damagepopLocked = true; this.damagepopLocked = true;
if (this != node.parentNode) this.appendChild(node); if (this != node.parentNode) this.appendChild(node);
@@ -5062,9 +5064,12 @@ game.import('extension', async function(lib, game, ui, get, ai, _status){
node.style.animation = 'open-fade-in-out 1.2s'; node.style.animation = 'open-fade-in-out 1.2s';
setTimeout(function (player, node) { setTimeout(function (player, node) {
if (!player.popupNodeCache) player.popupNodeCache = []; // if (!player.popupNodeCache) player.popupNodeCache = [];
node.style.animation = ''; // node.style.animation = '';
player.popupNodeCache.push(node); // 释放播放完成动画后的node
node.remove()
// player.popupNodeCache.push(node);
// console.log(player.popupNodeCache.length)
}, 1210, player, node); }, 1210, player, node);
setTimeout(function (player) { setTimeout(function (player) {