RedPointM.ts 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. const { ccclass, property } = cc._decorator;
  2. @ccclass
  3. export default class RedPointM extends cc.Component {
  4. static instance: RedPointM;
  5. @property(cc.Node)
  6. chatPoint: cc.Node = null;
  7. @property(cc.Node)
  8. touZiPoint: cc.Node = null;
  9. @property(cc.Node)
  10. turnTablePoint: cc.Node = null;
  11. @property(cc.Node)
  12. taskPoint: cc.Node = null;
  13. @property(cc.Node)
  14. shopPoint: cc.Node = null;
  15. @property(cc.Node)
  16. chatPage: cc.Node = null;
  17. @property(cc.Node)
  18. matePoint: cc.Node = null;
  19. @property(cc.Node)
  20. dailyNode: cc.Node = null;
  21. // LIFE-CYCLE CALLBACKS:
  22. onLoad() {
  23. RedPointM.instance = this;
  24. }
  25. start() {
  26. }
  27. // update (dt) {}
  28. ActiveRedPoint(redPointType: RedPointType, active: boolean) {
  29. switch (redPointType) {
  30. case RedPointType.ChatReaPacket:
  31. // if (active) {
  32. // this.chatAniNode.active = true
  33. // this.chatPage.active = false
  34. // }
  35. // else {
  36. // this.chatAniNode.active = false
  37. // this.chatPage.active = true
  38. // }
  39. break;
  40. case RedPointType.Invest:
  41. this.touZiPoint.active = active;
  42. // this.touZiPoint.color = GameM.commonData.roleData.lv >= 5 ? cc.color(255, 255, 255, 255) : cc.color(126, 126, 126, 255);
  43. break;
  44. case RedPointType.Turnplate:
  45. this.turnTablePoint.active = active;
  46. // this.turnTablePoint.color = GameM.commonData.roleData.lv >= 4 ? cc.color(255, 255, 255, 255) : cc.color(126, 126, 126, 255);
  47. break;
  48. case RedPointType.Task:
  49. if (this.taskPoint.active == active) {
  50. return
  51. }
  52. this.taskPoint.active = active;
  53. if (active) {
  54. // this.taskPoint.getChildByName('rectpoint copy').getChildByName('common_img_geted').getComponent(cc.Label).string = '可领取'
  55. // if (GameM.commonData.roleData.lv >= 4) this.taskPoint.getComponent(cc.Animation).play("rectpointAni");
  56. // else this.taskPoint.getComponent(cc.Animation).play("rectpointAni - 001");
  57. this.taskPoint.getComponent(cc.Animation).play("rectpointAni");
  58. }
  59. break;
  60. case RedPointType.Shop:
  61. // this.shopPoint.active = active;
  62. // if (active) {
  63. // this.shopPoint.getComponent(cc.Animation).play("rectpointAni");
  64. // }
  65. break;
  66. case RedPointType.Mate:
  67. if (this.matePoint.active == active) {
  68. return
  69. }
  70. this.matePoint.active = active
  71. break;
  72. case RedPointType.Daily:
  73. if (this.dailyNode.active == active) {
  74. return
  75. }
  76. this.dailyNode.active = active
  77. break;
  78. }
  79. }
  80. UpdateRedPointState() {
  81. // this.touZiPoint.color = GameM.commonData.roleData.lv >= 5 ? cc.color(255, 255, 255, 255) : cc.color(126, 126, 126, 255);
  82. // this.turnTablePoint.color = GameM.commonData.roleData.lv >= 4 ? cc.color(255, 255, 255, 255) : cc.color(126, 126, 126, 255);
  83. // this.speedUpPoint.color = GameM.commonData.roleData.lv >= 7 ? cc.color(255, 255, 255, 255) : cc.color(126, 126, 126, 255);
  84. // if (this.taskPoint.active) {
  85. // if (GameM.commonData.roleData.lv >= 4) this.taskPoint.getComponent(cc.Animation).play("rectpointAni");
  86. // else this.taskPoint.getComponent(cc.Animation).play("rectpointAni - 001");
  87. // }
  88. // if (this.shopPoint.active) {
  89. // if (GameM.commonData.roleData.lv >= 3) this.shopPoint.getComponent(cc.Animation).play("rectpointAni");
  90. // else this.shopPoint.getComponent(cc.Animation).play("rectpointAni - 001");
  91. // }
  92. }
  93. }
  94. export enum RedPointType {
  95. /**聊天代码 */
  96. ChatReaPacket,
  97. /**投资 */
  98. Invest,
  99. /**转盘 */
  100. Turnplate,
  101. /**任务 */
  102. Task,
  103. /**商店 */
  104. Shop,
  105. /**日常任务 */
  106. DailyTask,
  107. /**任务成就 */
  108. TaskAchievement,
  109. /**银行 */
  110. Bank,
  111. /**伙伴 */
  112. Mate,
  113. /**每日登录 */
  114. Daily,
  115. }