import { _decorator, Component, EditBox, Node, Toggle } from 'cc'; import { event_item_fail_event } from '../../../data/data'; const { ccclass, property } = _decorator; @ccclass('event_fail_event') export class event_fail_event extends Component { @property(Toggle) isReLife:Toggle = null; @property(Toggle) isShowZhuaziAnimation:Toggle = null; private m_data:event_item_fail_event = null; public initView(data:event_item_fail_event){ this.m_data = data; this.updateStatus() this.isReLife.node.on(Toggle.EventType.TOGGLE,()=>{ this.m_data.is_relife = this.isReLife.getComponent(Toggle).isChecked; }) this.isShowZhuaziAnimation.node.on(Toggle.EventType.TOGGLE,()=>{ this.m_data.is_show_animation = this.isShowZhuaziAnimation.getComponent(Toggle).isChecked; }) } updateStatus() { this.isReLife.getComponent(Toggle).isChecked = this.m_data.is_relife; if(this.m_data.is_show_animation==undefined|| this.m_data.is_show_animation==null) { this.m_data.is_show_animation = true } this.isShowZhuaziAnimation.getComponent(Toggle).isChecked = this.m_data.is_show_animation; } }