add_task_item.ts 664 B

12345678910111213141516171819202122
  1. import { _decorator, Component, Label, Node } from 'cc';
  2. import { config } from '../../config';
  3. const { ccclass, property } = _decorator;
  4. @ccclass('add_task_item')
  5. export class add_task_item extends Component {
  6. @property(Node) lab_name:Node = null;
  7. private call_back = null;
  8. private m_type:number = 0;
  9. public initView(type:number,call){
  10. this.call_back = call;
  11. this.m_type = type;
  12. this.lab_name.getComponent(Label).string = config.task_type_map.get(type)
  13. this.node.on(Node.EventType.TOUCH_END,()=>{
  14. if(this.call_back!=null){
  15. this.call_back(this.m_type)
  16. }
  17. })
  18. }
  19. }