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

@ccclass('attributes_rotation')
export class attributes_rotation extends Component {
    @property(Node) editBox:Node = null;
    private m_callback: Function = null;
    initView(callback:Function) {
        this.m_callback = callback
    }

    public update_att(rotation:number){
        if(rotation==undefined||rotation==null){ rotation = 0}
        this.editBox.getComponent(EditBox).string = rotation.toString()
    }

    public editBoxEditingDidEnded(editBox: EditBox) {
        if(this.m_callback != null) {
            if(editBox.string=='') {
                editBox.string = '0'
            }
            this.m_callback(parseInt(editBox.string))
        }
    }
}

