import { _decorator, Component, Node } from 'cc'; import { config } from '../../config'; const { ccclass, property } = _decorator; @ccclass('effect_node') export class effect_node extends Component { @property(Node) effect_dun:Node = null @property(Node) effect_xi:Node = null @property(Node) effect_xing:Node = null private curShowBuffType:number = -1; public init(){ this.curShowBuffType = -1 this.hideAllEffect() } public hideAllEffect(){ this.effect_dun.active = false this.effect_xi.active = false this.effect_xing.active = false } updateStatus(type:number){ if(type===this.curShowBuffType){ return } this.curShowBuffType = type this.hideAllEffect() switch (type) { case config.SHOW_BUFF_STATUS.DUN: this.effect_dun.active = true break; case config.SHOW_BUFF_STATUS.XI: this.effect_xi.active = true break; case config.SHOW_BUFF_STATUS.XING: this.effect_xing.active = true break; } } public cancelStatus(type:number){ if(type===this.curShowBuffType){ this.curShowBuffType=-1; } switch (type) { case config.SHOW_BUFF_STATUS.DUN: this.effect_dun.active = false break; case config.SHOW_BUFF_STATUS.XI: this.effect_xi.active = false break; case config.SHOW_BUFF_STATUS.XING: this.effect_xing.active = false break; } } }