import { _decorator, Component, Node, sp } from 'cc'; const { ccclass, property } = _decorator; @ccclass('ResultUI') export class ResultUI extends Component { @property({type:Node,tooltip:'胜利界面'}) win:Node = null; @property({type:Node,tooltip:'失败界面'}) lose:Node = null; @property({type:sp.Skeleton,tooltip:'胜利动画'}) winSpine:sp.Skeleton = null; @property({type:sp.Skeleton,tooltip:'失败动画'}) loseSpine:sp.Skeleton = null; private _endcallback:Function protected onLoad(): void { this.loseSpine.setCompleteListener(this.actionComplete.bind(this)) this.winSpine.setCompleteListener(this.actionComplete.bind(this)) } show(bWin:boolean,callback:Function = null) { this.node.active = true if(bWin){ this.win.active = true this.lose.active = false this.winSpine.setAnimation(0,'animation1',false) }else{ this.win.active = false this.lose.active = true this.loseSpine.setAnimation(0,'animation1',false) } this._endcallback = callback } actionComplete(trackEntry:sp.spine.TrackEntry) { this.node.active = false this._endcallback&&this._endcallback() this._endcallback = null } }