|
|
|
@ -228,6 +228,8 @@ export class UIBattleWeaponDesc1 extends Auto_BattleWeaponDesc1 { |
|
|
|
resolve(true); |
|
|
|
resolve(true); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 须在 prepareDestroyForRender 之前回池:否则 Sprite/Skeleton 被关掉再入池,下次出池图标空白
|
|
|
|
|
|
|
|
this._clearGlyphNode(); |
|
|
|
this.prepareDestroyForRender(); |
|
|
|
this.prepareDestroyForRender(); |
|
|
|
if (this.node.isValid) { |
|
|
|
if (this.node.isValid) { |
|
|
|
this.node.destroy(); |
|
|
|
this.node.destroy(); |
|
|
|
@ -307,16 +309,24 @@ export class UIBattleWeaponDesc1 extends Auto_BattleWeaponDesc1 { |
|
|
|
private _clearGlyphNode(): void { |
|
|
|
private _clearGlyphNode(): void { |
|
|
|
const held = this._glyphNode; |
|
|
|
const held = this._glyphNode; |
|
|
|
this._glyphNode = null; |
|
|
|
this._glyphNode = null; |
|
|
|
|
|
|
|
const fromPool = this._glyphFromPool; |
|
|
|
|
|
|
|
this._glyphFromPool = false; |
|
|
|
if (held?.isValid) { |
|
|
|
if (held?.isValid) { |
|
|
|
if (this._glyphFromPool) { |
|
|
|
if (fromPool) { |
|
|
|
gg.res.putNode(held); |
|
|
|
gg.res.putNode(held); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
held.destroy(); |
|
|
|
held.destroy(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
this._glyphFromPool = false; |
|
|
|
// 勿 removeAllChildren:池节点若尚未摘父会被destroy,污染对象池
|
|
|
|
if (this.ui_node?.isValid) { |
|
|
|
if (this.ui_node?.isValid && this.ui_node.children.length > 0) { |
|
|
|
this.ui_node.removeAllChildren(); |
|
|
|
const left = this.ui_node.children.slice(); |
|
|
|
|
|
|
|
for (let i = 0; i < left.length; i++) { |
|
|
|
|
|
|
|
const c = left[i]; |
|
|
|
|
|
|
|
if (!c?.isValid || c === held) continue; |
|
|
|
|
|
|
|
if (c['resKey']) gg.res.putNode(c); |
|
|
|
|
|
|
|
else c.destroy(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -420,6 +430,8 @@ export class UIBattleWeaponDesc1 extends Auto_BattleWeaponDesc1 { |
|
|
|
this.ui_node.active = false; |
|
|
|
this.ui_node.active = false; |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 关页 prepareDestroy 会关 Sprite;出池须重新打开渲染(getNode 只恢复 Skeleton)
|
|
|
|
|
|
|
|
this._revivePooledGlyphRenderers(node); |
|
|
|
node.parent = this.ui_node; |
|
|
|
node.parent = this.ui_node; |
|
|
|
node.setPosition(0, 0, 0); |
|
|
|
node.setPosition(0, 0, 0); |
|
|
|
node.setScale(GLYPH_SCALE, GLYPH_SCALE, 1); |
|
|
|
node.setScale(GLYPH_SCALE, GLYPH_SCALE, 1); |
|
|
|
@ -429,6 +441,25 @@ export class UIBattleWeaponDesc1 extends Auto_BattleWeaponDesc1 { |
|
|
|
this.ui_node.active = true; |
|
|
|
this.ui_node.active = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 恢复池节点上被关掉的 Sprite / Skeleton。 |
|
|
|
|
|
|
|
* @param node 出池的卡面预制体 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private _revivePooledGlyphRenderers(node: Node): void { |
|
|
|
|
|
|
|
const renderers = node.getComponentsInChildren(UIRenderer); |
|
|
|
|
|
|
|
for (let i = 0; i < renderers.length; i++) { |
|
|
|
|
|
|
|
const r = renderers[i]; |
|
|
|
|
|
|
|
if (r?.isValid) r.enabled = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
const sks = node.getComponentsInChildren(sp.Skeleton); |
|
|
|
|
|
|
|
for (let i = 0; i < sks.length; i++) { |
|
|
|
|
|
|
|
const sk = sks[i]; |
|
|
|
|
|
|
|
if (!sk?.isValid) continue; |
|
|
|
|
|
|
|
sk.enabled = true; |
|
|
|
|
|
|
|
sk.setAnimationCacheMode(sp.SpineAnimationCacheMode.REALTIME); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** 解析 Hero 行(部署快照缺失时按 weapon1Id / 蟠桃 id 兜底) */ |
|
|
|
/** 解析 Hero 行(部署快照缺失时按 weapon1Id / 蟠桃 id 兜底) */ |
|
|
|
private _resolveHero(entity: TileEntitySnapshot): ITableHero | null { |
|
|
|
private _resolveHero(entity: TileEntitySnapshot): ITableHero | null { |
|
|
|
const fromTower = entity.tower?.config ?? null; |
|
|
|
const fromTower = entity.tower?.config ?? null; |
|
|
|
|