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

@ccclass('event_show_scene_title')
export class event_show_scene_title extends Component {
    @property(Node) edit_box:Node = null;
    private m_data:event_item_show_scene_title = null;
    public initView(data:event_item_show_scene_title){
        this.m_data = data;
        this.edit_box.on(EditBox.EventType.EDITING_DID_ENDED,()=>{
            this.m_data.title = this.edit_box.getComponent(EditBox).string;
            this.updateStatus()
        })
        this.updateStatus()
    }

    updateStatus(){
        if(this.m_data.title.length<=0){
            this.edit_box.getComponent(EditBox).string = ""
        }else{
            this.edit_box.getComponent(EditBox).string = this.m_data.title;
        }
    }
}


