event_show_scene_title.ts 892 B

123456789101112131415161718192021222324252627
  1. import { _decorator, Component, EditBox, Node } from 'cc';
  2. import { event_item_show_scene_title } from '../../../data/data';
  3. const { ccclass, property } = _decorator;
  4. @ccclass('event_show_scene_title')
  5. export class event_show_scene_title extends Component {
  6. @property(Node) edit_box:Node = null;
  7. private m_data:event_item_show_scene_title = null;
  8. public initView(data:event_item_show_scene_title){
  9. this.m_data = data;
  10. this.edit_box.on(EditBox.EventType.EDITING_DID_ENDED,()=>{
  11. this.m_data.title = this.edit_box.getComponent(EditBox).string;
  12. this.updateStatus()
  13. })
  14. this.updateStatus()
  15. }
  16. updateStatus(){
  17. if(this.m_data.title.length<=0){
  18. this.edit_box.getComponent(EditBox).string = ""
  19. }else{
  20. this.edit_box.getComponent(EditBox).string = this.m_data.title;
  21. }
  22. }
  23. }