12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- /** @format */
- import {EventProcess} from './EventProcess'
- import FrameAnimation from '../../uiutils/FrameAnimation'
- import {ISkillConfig} from '../../config/SkillConfig'
- import {EventAttack, EventBase, EventDie, EventGraphicsDraw, EventHPChange, EventRoleTip, EventType} from './NodeEvent'
- import {FrameAniConfig} from '../../config/FrameAniConfig'
- import {ANI_TYPE} from '../../enums/Enum'
- const {ccclass, property} = cc._decorator
- @ccclass
- export class SkillEventProcess extends EventProcess {
- frameAnimation: FrameAnimation
- skillCfg: ISkillConfig
- onAttach(): void {
- this.frameAnimation = this.getComponent(FrameAnimation)
- if (this.skillCfg.url) {
- if (FrameAniConfig[this.skillCfg.url]) {
- let aniConfig = FrameAniConfig[this.skillCfg.url]
- if (aniConfig.type == ANI_TYPE.frameAni) {
- this.playFrameAni(`skill/${aniConfig.url}`, Boolean(aniConfig.loop), aniConfig.duration)
- } else if (aniConfig.type == ANI_TYPE.action) {
- this.playAnimation(`skill/${aniConfig.url}`)
- }
- } else {
- this.playFrameAni(`skill/${this.skillCfg.url}`, Boolean(this.skillCfg.loop), this.skillCfg.duration)
- }
- }
- }
- processEvent(event: EventBase): void {
- if (!cc.isValid(this.node)) return
- switch (event.type) {
- case EventType.GraphicsDraw:
- if (cc.debug.isDisplayStats()) {
- this.graphicsDraw(event as EventGraphicsDraw)
- } else {
- this.graphicsDraw(null)
- }
- break
- }
- }
- }
|