task_zhao_xi_jie.ts 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import { _decorator, Component, Label, Node } from 'cc';
  2. import { tools } from '../../tools';
  3. import { event_item, zhao_xi_jie_data } from '../../../data/data';
  4. import { Attributes } from '../Attributes';
  5. import { config } from '../../config';
  6. const { ccclass, property } = _decorator;
  7. @ccclass('task_zhao_xi_jie')
  8. export class task_zhao_xi_jie extends Component {
  9. @property(Node) btn_setting:Node = null;
  10. @property(Node) btn_setting_finish_event:Node = null;
  11. @property(Node) lab_setting_finish_event:Node = null;
  12. @property(Node) btn_select_type:Node = null;
  13. @property(Node) lab_select_type:Node = null;
  14. protected m_data:zhao_xi_jie_data = null;
  15. public updateView(data:zhao_xi_jie_data){
  16. this.m_data = data;
  17. this.btn_setting.off(Node.EventType.TOUCH_END);
  18. this.btn_setting.on(Node.EventType.TOUCH_END,()=>{
  19. tools.select_task_zhao_xi_jie(this.m_data)
  20. })
  21. this.btn_select_type.on(Node.EventType.TOUCH_END,()=>{
  22. tools.show_tip_type_select((type:number)=>{
  23. if(this.m_data.tip_type!=type){
  24. this.m_data.tip_type = type;
  25. }
  26. this.updateStatus()
  27. })
  28. })
  29. this.btn_setting_finish_event.off(Node.EventType.TOUCH_END);
  30. this.btn_setting_finish_event.on(Node.EventType.TOUCH_END,()=>{
  31. let list = Attributes.Singleton.getEventList()
  32. tools.show_select_evele_list(list,(data:event_item)=>{
  33. this.m_data.finish_event_id = data.event_id;
  34. this.updateStatus()
  35. })
  36. })
  37. this.updateStatus()
  38. }
  39. updateStatus(){
  40. if(this.m_data.finish_event_id==undefined){
  41. this.m_data.finish_event_id = -1;
  42. }
  43. this.lab_select_type.getComponent(Label).string = config.zhao_xi_jie_tip_type_map.get(this.m_data.tip_type)
  44. this.lab_setting_finish_event.getComponent(Label).string = this.m_data.finish_event_id==-1?"暂未设置完成事件":`事件id:${this.m_data.finish_event_id}`
  45. }
  46. }