BlessingBagData.ts 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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(redMoneyId: number, num: number) {
  41. this.taskRbId = redMoneyId;
  42. this.rbNum = num;
  43. this.init_openRb = true;
  44. }
  45. /**更新视频进度*/
  46. async UpdateVideoProgress(data: any) {
  47. await mk.time.WaitForSeconds(0.5);
  48. this.isPlayAniUpdate = true;
  49. this.videoRbData = data.data;
  50. }
  51. /**
  52. * 免费加进度
  53. * @param cb 提现回调
  54. */
  55. async addProgress() {
  56. let data = {"updateType": this.videoRbData.isVideo};
  57. let response = await mk.http.sendData('/welFare/updateWelFareTask', data);
  58. if (response.errcode != 0) {
  59. return;
  60. }
  61. this.isPlayAniUpdate = true;
  62. this.videoRbData = response.data.userWelFareTaskInfo;
  63. }
  64. /**
  65. * 大额红包提现
  66. * @param cb 提现回调
  67. */
  68. async HttpCashBig() {
  69. let data = {};
  70. let response = await mk.http.sendData('redMoneyVideoCash', data);
  71. if (response.errcode != 0) {
  72. return null;
  73. }
  74. this.isPlayAniUpdate = false;
  75. this.videoRbData = response.data.UserRedMoneyInfo;
  76. return response;
  77. }
  78. /**
  79. * 任务红包提现
  80. * @param cb 提现回调
  81. */
  82. async HttpCashTask() {
  83. let data = { Id: this.taskRbId };
  84. let response = await mk.http.sendData('welFare/welFareCash', data);
  85. mk.console.logSingle("'welFare/welFareCash", response);
  86. if (response.errcode != 0) {
  87. return null;
  88. }
  89. this.isPlayAniUpdate = false;
  90. this.videoRbData = response.data.userWelFareTaskInfo;
  91. //const rewardNum = Math.round(gData.blessingBag.rbNum * 100);
  92. gData.receiptNotice.receip_rmb = gData.blessingBag.rbNum;
  93. //gData.cashNormal.receip_total_rmb += gData.receiptNotice.receip_rmb;
  94. //mk.ui.openPanel('module/receiptNotice/receiptNotice');
  95. mk.ui.openPanel('module/newNotice/newNotice');
  96. // if (response.data.code == 1) {
  97. // AdM.onSendEvent('VideoCash_' + this.taskRbId, '视频红包第' + this.taskRbId + '档领取成功', 'VideoCash');
  98. // }
  99. return response
  100. }
  101. /**清空数据*/
  102. async HttpInitAdRbData() {
  103. let data = {};
  104. let response = await mk.http.sendData('tuCaoRedMoney/initUserInfo', data);
  105. if (response.errcode != 0) {
  106. return;
  107. }
  108. this.isPlayAniUpdate = false;
  109. this.videoRbData = response.data.UserRedMoneyInfo;
  110. // if (response.data.code == 1) {
  111. // AdM.onSendEvent('VideoCashBig_' + response.data.UserRedMoneyInfo.preLargeAmountCashId, ' 视频红包大额提现第' + response.data.UserRedMoneyInfo.preLargeAmountCashId + '档领取成功', 'VideoCashBig');
  112. // }
  113. }
  114. /**
  115. * 红点功能
  116. */
  117. public redPoint(): boolean {
  118. return false;
  119. }
  120. }
  121. /*
  122. 1.RedPackageNode jinrititle mingrititle null
  123. let targetPos: cc.Vec2 = this.target.getPosition();
  124. let bulletPos: cc.Vec2 = this.node.getPosition();
  125. let normalizeVec: cc.Vec2 = targetPos.subtract(bulletPos).normalize();
  126. //角度变化以y轴正方向为起点,逆时针角度递增
  127. this.node.angle = cc.v2(0, 1).signAngle(normalizeVec) * 180 / Math.PI;
  128. */