FrameAniProcess.ts 855 B

12345678910111213141516171819202122232425
  1. /** @format */
  2. import {EventProcess} from './EventProcess'
  3. import FrameAnimation from '../../uiutils/FrameAnimation'
  4. import {IFrameAniConfig} from '../../config/FrameAniConfig'
  5. import {ANI_TYPE} from '../../enums/Enum'
  6. const {ccclass, property} = cc._decorator
  7. @ccclass
  8. export class FrameAniProcess extends EventProcess {
  9. frameAnimation: FrameAnimation
  10. aniConfig: IFrameAniConfig
  11. onAttach(): void {
  12. this.frameAnimation = this.getComponent(FrameAnimation)
  13. if (this.aniConfig.url) {
  14. if (this.aniConfig.type == ANI_TYPE.frameAni) {
  15. this.playFrameAni(`skill/${this.aniConfig.url}`, Boolean(this.aniConfig.loop), this.aniConfig.duration)
  16. } else if (this.aniConfig.type == ANI_TYPE.action) {
  17. this.playAnimation(`skill/${this.aniConfig.url}`)
  18. }
  19. }
  20. }
  21. }