BlessingBagData.ts 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. /**
  2. * @description 福袋数据
  3. * @author kaka
  4. */
  5. import { Data } from "../../../mk/data/Data";
  6. export class BlessingBagData extends Data {
  7. _videoRbData: any = null;
  8. isPlayAniUpdate = false;
  9. init_videoRbData = false;
  10. get videoRbData() {
  11. return this._videoRbData;
  12. }
  13. set videoRbData(data) {
  14. this._videoRbData = data;
  15. this.init_videoRbData = true;
  16. }
  17. rbType = 0;
  18. rbNum = 0;
  19. init_openRb = false;
  20. bigRbNum: number = 0;
  21. taskRbId: number = 0;
  22. taskRbNum: number = 0;
  23. adsource_id_value = "";
  24. init() {
  25. this.isPlayAniUpdate = false;
  26. this.videoRbData = gData.gameData.gameData.userTuCaoInfo;
  27. console.log("---------------->", this.videoRbData);
  28. }
  29. setAdData(data) {
  30. super.setAdData(data);
  31. this.UpdateVideoProgress(data);
  32. }
  33. /**
  34. * 打开任务红包页面
  35. * @param taskRbNum 红包金额
  36. * @param redMoneyId 任务红包id
  37. * @param type 打开红包类型 1 大额红包 2 任务红包
  38. * @param num 红包金额
  39. */
  40. OpenTaskRbPanel(taskRbNum: number, redMoneyId: number, type: number, num: number) {
  41. this.taskRbId = redMoneyId;
  42. this.taskRbNum = taskRbNum;
  43. this.rbType = type;
  44. this.rbNum = num;
  45. this.init_openRb = true;
  46. }
  47. /**更新视频进度*/
  48. async UpdateVideoProgress(data: any) {
  49. await mk.time.WaitForSeconds(0.5);
  50. this.isPlayAniUpdate = true;
  51. this.videoRbData = data.data;
  52. }
  53. /**
  54. * 免费加进度
  55. * @param cb 提现回调
  56. */
  57. async HttpNoAdProgress() {
  58. let data = {};
  59. let response = await mk.http.sendData('tuCaoRedMoney/noNeedVideo', data);
  60. if (response.errcode != 0) {
  61. return;
  62. }
  63. this.isPlayAniUpdate = true;
  64. this.videoRbData = response.data.UserRedMoneyInfo;
  65. }
  66. /**
  67. * 大额红包提现
  68. * @param cb 提现回调
  69. */
  70. async HttpCashBig() {
  71. let data = {};
  72. let response = await mk.http.sendData('redMoneyVideoCash', data);
  73. mk.console.logSingle('redMoneyVideoCash ', response);
  74. if (response.errcode != 0) {
  75. if (response.data.count) {
  76. gData.tipPanelData.openCashFailTip(response.data.count);
  77. }
  78. else {
  79. mk.tip.pop('提现排队中,多看视频优先提现');
  80. }
  81. gData.cashPro.init_fail = true;
  82. return null;
  83. }
  84. this.isPlayAniUpdate = false;
  85. this.videoRbData = response.data.UserRedMoneyInfo;
  86. return response;
  87. }
  88. /**
  89. * 任务红包提现
  90. * @param cb 提现回调
  91. */
  92. async HttpCashTask() {
  93. let data = { redMoneyId: this.taskRbId };
  94. let response = await mk.http.sendData('tuCaoRedMoney/gearCash', data);
  95. mk.console.logSingle('gearCash ', response);
  96. if (response.errcode != 0) {
  97. if (response.data.count) {
  98. gData.tipPanelData.openCashFailTip(response.data.count);
  99. }
  100. else {
  101. mk.tip.pop('提现排队中,多看视频优先提现');
  102. }
  103. gData.cashPro.init_fail = true;
  104. return null;
  105. }
  106. this.isPlayAniUpdate = false;
  107. this.videoRbData = response.data.UserRedMoneyInfo;
  108. const rewardNum = Math.round(gData.blessingBag.taskRbNum * 100);
  109. gData.receiptNotice.receip_rmb = rewardNum;
  110. gData.cashNormal.receip_total_rmb += gData.receiptNotice.receip_rmb;
  111. mk.ui.openPanel('module/receiptNotice/receiptNotice');
  112. // if (response.data.code == 1) {
  113. // AdM.onSendEvent('VideoCash_' + this.taskRbId, '视频红包第' + this.taskRbId + '档领取成功', 'VideoCash');
  114. // }
  115. return response
  116. }
  117. /**清空数据*/
  118. async HttpInitAdRbData() {
  119. let data = {};
  120. let response = await mk.http.sendData('tuCaoRedMoney/initUserInfo', data);
  121. if (response.errcode != 0) {
  122. return;
  123. }
  124. this.isPlayAniUpdate = false;
  125. this.videoRbData = response.data.UserRedMoneyInfo;
  126. // if (response.data.code == 1) {
  127. // AdM.onSendEvent('VideoCashBig_' + response.data.UserRedMoneyInfo.preLargeAmountCashId, ' 视频红包大额提现第' + response.data.UserRedMoneyInfo.preLargeAmountCashId + '档领取成功', 'VideoCashBig');
  128. // }
  129. }
  130. /**
  131. * 红点功能
  132. */
  133. public redPoint(): boolean {
  134. return false;
  135. }
  136. }
  137. /*
  138. 1.RedPackageNode jinrititle mingrititle null
  139. let targetPos: cc.Vec2 = this.target.getPosition();
  140. let bulletPos: cc.Vec2 = this.node.getPosition();
  141. let normalizeVec: cc.Vec2 = targetPos.subtract(bulletPos).normalize();
  142. //角度变化以y轴正方向为起点,逆时针角度递增
  143. this.node.angle = cc.v2(0, 1).signAngle(normalizeVec) * 180 / Math.PI;
  144. */