ui_manifestations.ts 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import { _decorator, Component, Node } from 'cc';
  2. import { zhao_xi_jie_data, zhao_xi_jie_item_data } from '../../../data/data';
  3. import { config } from '../../config';
  4. import { tip_type_single } from './tip_type_single';
  5. import { tip_type_all } from './tip_type_all';
  6. import { shouji_item } from './shouji_item';
  7. import { ClientEvent } from '../../clientEvent';
  8. import { gameManager } from '../gameManager';
  9. const { ccclass, property } = _decorator;
  10. @ccclass('ui_manifestations')
  11. export class ui_manifestations extends Component {
  12. @property(Node) tip_type_single:Node = null;
  13. @property(Node) tip_type_all:Node = null;
  14. @property(Node) btn_single_click_hide_tip:Node = null;
  15. private mData:zhao_xi_jie_data = null;
  16. public initView(data:zhao_xi_jie_data){
  17. this.mData = data;
  18. if(this.mData.tip_type===config.zhao_xi_jie_tip_type.select_tips){
  19. this.tip_type_single.active = true;
  20. this.btn_single_click_hide_tip.active = false;
  21. this.btn_single_click_hide_tip.on(Node.EventType.TOUCH_END,()=>{
  22. this.btn_single_click_hide_tip.active = false;
  23. this.tip_type_single.getComponent(tip_type_single).hideTipBtn()
  24. })
  25. this.tip_type_all.active = false;
  26. this.tip_type_single.getComponent(tip_type_single).initView(data,this.onItemClick.bind(this),this.onItemTips.bind(this))
  27. }else{
  28. this.tip_type_all.active = true;
  29. this.tip_type_single.active = false;
  30. this.tip_type_all.getComponent(tip_type_all).initView(data,this.onShowTips.bind(this))
  31. }
  32. ClientEvent.on(config.EventRun.SHOW_ZHAO_BU_TONG_FINISH_STATUS,this.on_zhao_bu_tong_finish.bind(this),this)
  33. ClientEvent.on(config.EventRun.ON_ZHAO_BU_TONG_ALL_FINISH,this.on_zhao_bu_tong_all_finish.bind(this),this)
  34. }
  35. on_zhao_bu_tong_finish(widget:zhao_xi_jie_item_data){
  36. if(this.mData.tip_type===config.zhao_xi_jie_tip_type.select_tips){
  37. this.tip_type_single.getComponent(tip_type_single).showFinishIcon(widget.widget_id)
  38. }else{
  39. this.tip_type_all.getComponent(tip_type_all).showFinishIcon(widget.widget_id)
  40. }
  41. }
  42. on_zhao_bu_tong_all_finish(data: zhao_xi_jie_data) {
  43. this.node.active = false
  44. }
  45. onItemClick(){
  46. this.btn_single_click_hide_tip.active = true;
  47. }
  48. public onItemTips(data:zhao_xi_jie_item_data){
  49. ClientEvent.dispatchEvent(config.EventRun.SHOW_TIPS,data.tips_res)
  50. }
  51. public onShowTips(){
  52. gameManager.Singleton.showTips()
  53. }
  54. }