ChangeChapter.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import { _decorator, Component, Node, sp } from 'cc';
  2. import { BattleManager } from '../../../manager/BattleManager';
  3. import { BattleData } from '../../../data/BattleData';
  4. import { Framework } from '../../../../framework/Framework';
  5. import { GameEvent } from '../../../data/GameEvent';
  6. const { ccclass, property } = _decorator;
  7. @ccclass('ChangeChapter')
  8. export class ChangeChapter extends Component {
  9. @property({type:sp.Skeleton,tooltip:'胜利动画'})
  10. winSpine:sp.Skeleton = null;
  11. private _endcallback:Function
  12. protected onLoad(): void {
  13. Framework.event.addEvent(GameEvent.BattleDuplicateReset, this.duplicateReset.bind(this),this);
  14. }
  15. show(callback:Function) {
  16. this.node.active = true
  17. this.winSpine.setAnimation(0,'animation1',false)
  18. this._endcallback = callback
  19. }
  20. actionComplete(trackEntry:sp.spine.TrackEntry) {
  21. // this.bAnimOver = true
  22. // if(this.bWait) return
  23. // this.node.active = false
  24. // this._endcallback&&this._endcallback()
  25. // this._endcallback = null
  26. }
  27. onTouchButton() {
  28. BattleManager.sendBattleDuplicateResetMsg(BattleData.duplicate.chapter+1)
  29. }
  30. duplicateReset() {
  31. this.node.active = false
  32. this._endcallback&&this._endcallback()
  33. this._endcallback = null
  34. }
  35. }