import { _decorator, Component, Node, Toggle } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('attributes_active')
export class attributes_active extends Component {
    @property(Node) check_select:Node = null;
    private call_back = null;
    private isEditActive = false;
    public initView(call){
        this.call_back = call;
        this.check_select.on(Node.EventType.TOUCH_END,()=>{
            this.isEditActive=!this.isEditActive;
            this.change()
        })
    }
    
    change(){
        if(this.call_back!=null){
            this.call_back(this.isEditActive)
        }
    }

    public update_att(is_check:boolean){
        this.isEditActive = is_check;
        this.check_select.getComponent(Toggle).isChecked = this.isEditActive;
    }
}


