new_animation.ts 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { _decorator, Component, EditBox, Node, Toggle } from 'cc';
  2. import { att_ani_data } from '../../../data/data';
  3. import { tools } from '../../tools';
  4. const { ccclass, property } = _decorator;
  5. @ccclass('new_animation')
  6. export class new_animation extends Component {
  7. @property(Node) btn_sure:Node = null;
  8. @property(Node) btn_cancel:Node = null;
  9. @property(Node) eb_ani_name:Node = null;
  10. @property(Node) eb_ani_id:Node = null;
  11. private m_data:att_ani_data = null;
  12. private m_create_call = null;
  13. public initView(create_call){
  14. this.m_create_call =create_call;
  15. this.btn_sure.on(Node.EventType.TOUCH_END,()=>{
  16. if(this.eb_ani_name.getComponent(EditBox).string.length<=0){
  17. return tools.showToast("必须要填写动画名字")
  18. }
  19. this.m_data.ani_name = this.eb_ani_name.getComponent(EditBox).string;
  20. if(this.m_create_call !=null ){
  21. this.m_create_call(this.m_data)
  22. }
  23. this.node.active =false;
  24. })
  25. this.btn_cancel.on(Node.EventType.TOUCH_END,()=>{
  26. this.node.active = false;
  27. })
  28. }
  29. public show(ani_id:number,binding_widget_id:number){
  30. this.m_data = new att_ani_data;
  31. this.node.active = true;
  32. this.m_data.ani_name = this.eb_ani_name.getComponent(EditBox).string;
  33. this.m_data.ani_id = ani_id;
  34. this.eb_ani_id.getComponent(EditBox).placeholder = this.m_data.ani_id.toString()
  35. this.m_data.binding_widget_id = binding_widget_id;
  36. }
  37. }