BlessingBagData.ts 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. /**
  2. * @description 福袋数据
  3. * @author kaka
  4. */
  5. import { Data } from "../../../mk/data/Data";
  6. import { DataEventId } from "../GameData";
  7. export class BlessingBagData extends Data {
  8. _videoRbData: any = null;
  9. isPlayAniUpdate = false;
  10. init_videoRbData = false;
  11. get videoRbData() {
  12. return this._videoRbData;
  13. }
  14. set videoRbData(data) {
  15. this._videoRbData = data;
  16. this.init_videoRbData = true;
  17. }
  18. rbType = 0;
  19. rbNum = 0;
  20. init_openRb = false;
  21. bigRbNum: number = 0;
  22. taskRbId: number = 0;
  23. taskRbNum: number = 0;
  24. adsource_id_value = "";
  25. init() {
  26. this.isPlayAniUpdate = false;
  27. this.videoRbData = gData.gameData.playerProp.userTuCaoInfo;
  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 data = { "updateType": 0 };
  58. let response = await mk.http.sendData('/welFare/updateWelFareTask', data);
  59. if (response.errcode != 0) {
  60. return;
  61. }
  62. this.isPlayAniUpdate = true;
  63. this.videoRbData = response.data.userWelFareTaskInfo;
  64. mk.tip.pop('已增加所有的提现进度');
  65. }
  66. /**
  67. * 大额红包提现
  68. * @param cb 提现回调
  69. */
  70. async HttpCashBig() {
  71. let data = {};
  72. let response = await mk.http.sendData('redMoneyVideoCash', data);
  73. if (response.errcode != 0) {
  74. return null;
  75. }
  76. mk.data.sendDataEvent(DataEventId.Sundry, '福利大额提现成功');
  77. this.isPlayAniUpdate = false;
  78. this.videoRbData = response.data.UserRedMoneyInfo;
  79. return response;
  80. }
  81. /**
  82. * 任务红包提现
  83. * @param cb 提现回调
  84. */
  85. async HttpCashTask() {
  86. // gData.cashPro.openCashPro(gData.blessingBag.rbNum);
  87. let data = { Id: this.taskRbId };
  88. let response = await mk.http.sendData('welFare/welFareCash', data);
  89. mk.console.logSingle("'welFare/welFareCash", response);
  90. if (response.errcode != 0) {
  91. // gData.cashPro.init_fail = true;
  92. if (response.errcode == 405) {
  93. mk.tip.pop("今日提现额度已到上限,请明天再提现");
  94. mk.data.sendDataEvent(DataEventId.cashLimit, "提现触发上限");
  95. }
  96. return null;
  97. }
  98. // gData.cashPro.init_success = true;
  99. this.isPlayAniUpdate = false;
  100. this.videoRbData = response.data.userWelFareTaskInfo;
  101. mk.data.sendDataEvent(DataEventId.fudaiFunction, `视频红包第${this.taskRbId}档提现成功`);
  102. mk.data.sendDataEvent(DataEventId.Sundry, '福利提现成功');
  103. gData.gameData.doPointToXYLogic();
  104. //gData.gameData.addCashOutTimes();
  105. gData.receiptNotice.receip_rmb = gData.blessingBag.rbNum;
  106. mk.ui.openPanel('module/newNotice/newNotice');
  107. gData.safeDepositBoxData.updateQipao();
  108. return response
  109. }
  110. /**清空数据*/
  111. async HttpInitAdRbData() {
  112. let data = {};
  113. let response = await mk.http.sendData('tuCaoRedMoney/initUserInfo', data);
  114. if (response.errcode != 0) {
  115. return;
  116. }
  117. this.isPlayAniUpdate = false;
  118. this.videoRbData = response.data.UserRedMoneyInfo;
  119. // if (response.data.code == 1) {
  120. // AdM.onSendEvent('VideoCashBig_' + response.data.UserRedMoneyInfo.preLargeAmountCashId, ' 视频红包大额提现第' + response.data.UserRedMoneyInfo.preLargeAmountCashId + '档领取成功', 'VideoCashBig');
  121. // }
  122. }
  123. /**
  124. * 红点功能
  125. */
  126. public redPoint(): boolean {
  127. return false;
  128. }
  129. }
  130. /*
  131. 1.RedPackageNode jinrititle mingrititle null
  132. let targetPos: cc.Vec2 = this.target.getPosition();
  133. let bulletPos: cc.Vec2 = this.node.getPosition();
  134. let normalizeVec: cc.Vec2 = targetPos.subtract(bulletPos).normalize();
  135. //角度变化以y轴正方向为起点,逆时针角度递增
  136. this.node.angle = cc.v2(0, 1).signAngle(normalizeVec) * 180 / Math.PI;
  137. */