opt_frame.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import { _decorator, Color, Component, Label, Node, Sprite } from 'cc';
  2. import { frame_item } from './frame_item';
  3. const { ccclass, property } = _decorator;
  4. @ccclass('opt_frame')
  5. export class opt_frame extends Component {
  6. @property(Node) lab_title:Node = null;
  7. @property(Node) btn_delete:Node = null;
  8. @property(Node) btn_edit:Node = null;
  9. @property(Node) btn_cancel:Node = null;
  10. private m_call_delete = null;
  11. private m_call_edit = null;
  12. private m_item = null;
  13. public show(item:frame_item){
  14. this.m_item = item;
  15. this.lab_title.getComponent(Label).string = '第' + item.getIndex() + '帧'
  16. this.node.active = true;
  17. }
  18. public initView(delete_call,edit_call){
  19. this.m_call_delete = delete_call;
  20. this.m_call_edit = edit_call;
  21. this.btn_delete.on(Node.EventType.TOUCH_END,()=>{
  22. if(this.m_call_delete!=null){
  23. this.m_call_delete(this.m_item)
  24. }
  25. this.close()
  26. })
  27. this.btn_edit.on(Node.EventType.TOUCH_END,()=>{
  28. if(this.m_call_edit!=null){
  29. this.m_call_edit(this.m_item)
  30. }
  31. this.close()
  32. })
  33. this.btn_cancel.on(Node.EventType.TOUCH_END,()=>{
  34. this.close()
  35. })
  36. }
  37. close(){
  38. this.node.active = false;
  39. }
  40. }