home_modules.ts 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. import { _decorator, Component, Node, Animation } from 'cc';
  2. import { base_ui } from '../../fw/base_ui';
  3. import { uiManager } from '../../manager/uiManager';
  4. import { config } from '../../config';
  5. import { home_modules_more } from './home_modules_more';
  6. import { tools } from '../../tools';
  7. const { ccclass, property } = _decorator;
  8. @ccclass('home_modules')
  9. export class home_modules extends base_ui {
  10. @property(Node) btn_qiandao:Node = null
  11. @property(Node) btn_gengduo:Node = null
  12. @property(Node) btn_cheku:Node = null
  13. @property(Node) btn_beibao:Node = null
  14. @property(Node) node_gengduo:Node = null
  15. @property(Node) img_dot_qiandao:Node = null
  16. @property(Node) img_dot_gengduo:Node = null
  17. start() {
  18. this.onButtonListen(this.btn_qiandao, ()=>{
  19. uiManager.Instance().showUi(config.UI.ui_sign_view)
  20. })
  21. this.onButtonListen(this.btn_gengduo, ()=>{
  22. this.node_gengduo.active = !this.node_gengduo.active
  23. if(this.node_gengduo.active) {
  24. this.node_gengduo.getComponent(Animation).play()
  25. }
  26. })
  27. this.onButtonListen(this.btn_cheku, ()=>{
  28. this.node.parent.active = false
  29. uiManager.Instance().showUi(config.UI.car_lib, null, ()=>{
  30. this.node.parent.active = true
  31. })
  32. })
  33. this.onButtonListen(this.btn_beibao, ()=>{
  34. uiManager.Instance().showUi(config.UI.bag)
  35. })
  36. this.node_gengduo.active = false
  37. this.startAnimation()
  38. }
  39. public init() {
  40. let data = tools.user_red_dot_data
  41. this.showRedDotQiandao(data.sign_red_dot==1?true:false)
  42. this.showRedDotYoujian(data.mail_red_dot==1?true:false)
  43. this.showRedDotGonggao(data.bulletin_red_dot==1?true:false)
  44. }
  45. private startAnimation() {
  46. setTimeout(()=>{
  47. this.btn_qiandao.getComponent(Animation).play()
  48. this.btn_gengduo.getComponent(Animation).play()
  49. this.btn_cheku.getComponent(Animation).play()
  50. this.btn_beibao.getComponent(Animation).play()
  51. },200)
  52. }
  53. public showRedDotQiandao(is_show:boolean) {
  54. this.img_dot_qiandao.active = is_show
  55. }
  56. public showRedDotYoujian(is_show:boolean) {
  57. this.node_gengduo.getComponent(home_modules_more).showRedDotYoujian(is_show)
  58. this.checkRedDotMore()
  59. }
  60. public showRedDotGonggao(is_show:boolean) {
  61. this.node_gengduo.getComponent(home_modules_more).showRedDotGonggao(is_show)
  62. this.checkRedDotMore()
  63. }
  64. private checkRedDotMore() {
  65. let is_show = this.node_gengduo.getComponent(home_modules_more).getDotAllShow()
  66. this.img_dot_gengduo.active = is_show
  67. }
  68. }