WinAnim.ts 700 B

12345678910111213141516171819202122232425
  1. import { _decorator, Component, Node, Animation, EventHandler } from 'cc';
  2. const { ccclass, property } = _decorator;
  3. @ccclass('WinAnim')
  4. export class WinAnim extends Component {
  5. @property({ tooltip: "中奖动画", type: Animation }) public winAnim: Animation;
  6. @property({ tooltip: "动画结束回调", type: EventHandler }) public animEndBack: EventHandler;
  7. private times = 5;
  8. private winAnimTimes = this.times;
  9. start() {
  10. }
  11. //中奖帧回调
  12. public winAnimBack() {
  13. this.winAnimTimes--;
  14. if (!this.winAnimTimes) {
  15. this.winAnim.stop();
  16. this.winAnimTimes = this.times;
  17. this.animEndBack.emit([]);
  18. }
  19. }
  20. }