import { _decorator, Component, Node, Animation, EventHandler } from 'cc'; const { ccclass, property } = _decorator; @ccclass('WinAnim') export class WinAnim extends Component { @property({ tooltip: "中奖动画", type: Animation }) public winAnim: Animation; @property({ tooltip: "动画结束回调", type: EventHandler }) public animEndBack: EventHandler; private times = 5; private winAnimTimes = this.times; start() { } //中奖帧回调 public winAnimBack() { this.winAnimTimes--; if (!this.winAnimTimes) { this.winAnim.stop(); this.winAnimTimes = this.times; this.animEndBack.emit([]); } } }