修复动画显示 bug

This commit is contained in:
2025-01-13 10:43:23 +08:00
parent 0f1c30e666
commit bfec31829e
3 changed files with 157 additions and 150 deletions

View File

@@ -16,19 +16,22 @@ export class EndAnmBomCom extends Component {
if(this.base.box_group ==BoxSet.HERO) this.collider.group = BoxSet.MONSTER
if(this.base.box_group ==BoxSet.MONSTER) this.collider.group = BoxSet.HERO
let anim = this.node.getComponent(Animation);
if(anim){
if(this.node.getComponent(Animation)){
let anim = this.node.getComponent(Animation);
console.log("has anim",anim)
anim.on(Animation.EventType.FINISHED, this.onAnimationFinished, this);
}
var spine = this.node.getChildByName('anm').getComponent('sp.Skeleton') as sp.Skeleton;
if(spine){
console.log("has spine",spine)
spine.setCompleteListener((trackEntry) => {
this.onAnimationFinished()
console.log("[track %s][animation %s] complete: %s", trackEntry.trackIndex);
});
if(this.node.getChildByName('anm')){
if(this.node.getChildByName('anm').getComponent('sp.Skeleton')){
var spine = this.node.getChildByName('anm').getComponent('sp.Skeleton') as sp.Skeleton;
console.log("has spine",spine)
spine.setCompleteListener((trackEntry) => {
this.onAnimationFinished()
console.log("[track %s][animation %s] complete: %s", trackEntry.trackIndex);
});
}
}
}
onAnimationFinished(){