cc.Class({ extends: cc.Component, properties: { BG: { default: null, type: cc.Node, serializable: true, }, BgSpFrame: [cc.SpriteFrame], WinNode: { default: null, type: cc.Node, serializable: true, }, FailNode: { default: null, type: cc.Node, serializable: true, }, }, ShowResult(bWin) { this.BG.getComponent(cc.Sprite).spriteFrame = this.BgSpFrame[1]; if(bWin) { this.WinNode.active = true; let animation = this.WinNode.getComponent(cc.Animation); animation.play(); } else { this.FailNode.active = true; let animation = this.FailNode.getComponent(cc.Animation); animation.play(); } }, ShutDown() { this.BG.getComponent(cc.Sprite).spriteFrame = this.BgSpFrame[0]; this.WinNode.active = false; this.FailNode.active = false; } });