attributes_dir.ts 1010 B

1234567891011121314151617181920212223242526272829303132333435
  1. import { _decorator, Component, Label, Node } from 'cc';
  2. import { config } from '../../config';
  3. import { tools } from '../../tools';
  4. const { ccclass, property } = _decorator;
  5. @ccclass('attributes_dir')
  6. export class attributes_dir extends Component {
  7. @property(Node) check_select:Node = null;
  8. @property(Node) lab_select_zIndex:Node = null;
  9. private call_back = null;
  10. private dir = config.widget_scale_dir.normal;
  11. public initView(call){
  12. this.call_back = call;
  13. this.check_select.on(Node.EventType.TOUCH_END,()=>{
  14. tools.show_select_dir((dir:number)=>{
  15. this.dir = dir;
  16. this.update_att(this.dir)
  17. this.change()
  18. })
  19. })
  20. }
  21. change(){
  22. if(this.call_back!=null){
  23. this.call_back(this.dir)
  24. }
  25. }
  26. public update_att(dir:number){
  27. this.dir = dir;
  28. this.lab_select_zIndex.getComponent(Label).string = config.widget_scale_dir_map.get(this.dir)
  29. }
  30. }