slide_dir_select_item.ts 1006 B

123456789101112131415161718192021222324252627282930313233
  1. import { _decorator, Component, Label, Node } from 'cc';
  2. import { config } from '../config';
  3. const { ccclass, property } = _decorator;
  4. @ccclass('slide_dir_select_item')
  5. export class slide_dir_select_item extends Component {
  6. @property(Node) lab_name:Node = null;
  7. private call_back = null;
  8. private m_dir:number = 0;
  9. public initView(dir:number,call){
  10. this.call_back = call;
  11. this.m_dir = dir;
  12. this.lab_name.getComponent(Label).string = config.slide_type_map.get(dir)
  13. this.node.on(Node.EventType.TOUCH_END,()=>{
  14. if(this.call_back!=null){
  15. this.call_back(this.m_dir)
  16. }
  17. })
  18. }
  19. public initTipView(type:number,name:string,call){
  20. this.call_back = call;
  21. this.m_dir = type;
  22. this.lab_name.getComponent(Label).string = name;
  23. this.node.on(Node.EventType.TOUCH_END,()=>{
  24. if(this.call_back!=null){
  25. this.call_back(this.m_dir)
  26. }
  27. })
  28. }
  29. }