import { _decorator, Component, Node, Toggle } from 'cc'; const { ccclass, property } = _decorator; @ccclass('attributes_be_active') export class attributes_be_active extends Component { @property(Node) check_select:Node = null; private call_back = null; private isCheckBeActive = false; public initView(call){ this.call_back = call; this.check_select.on(Node.EventType.TOUCH_END,()=>{ this.isCheckBeActive=!this.isCheckBeActive; this.change() }) } change(){ if(this.call_back!=null){ this.call_back(this.isCheckBeActive) } } public update_att(is_check:boolean){ this.isCheckBeActive = is_check; this.check_select.getComponent(Toggle).isChecked = this.isCheckBeActive; } }