BlessingBagData.ts 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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. }
  26. setAdData(data) {
  27. super.setAdData(data);
  28. }
  29. ServerInit(data: any) {
  30. this.isPlayAniUpdate = false;
  31. this.videoRbData = data;
  32. console.log("---------------->", data);
  33. }
  34. /**
  35. * 打开任务红包页面
  36. * @param taskRbNum 红包金额
  37. * @param redMoneyId 任务红包id
  38. * @param type 打开红包类型 1 大额红包 2 任务红包
  39. * @param num 红包金额
  40. */
  41. OpenTaskRbPanel(taskRbNum: number, redMoneyId: number, type: number, num: number) {
  42. this.taskRbId = redMoneyId;
  43. this.taskRbNum = taskRbNum;
  44. this.rbType = type;
  45. this.rbNum = num;
  46. this.init_openRb = true;
  47. // if (this.adRbPanel != null) {
  48. // this.adRbPanel.OpenRbPanel(type, num);
  49. // }
  50. }
  51. /**更新视频进度*/
  52. async UpdateVideoProgress(data: any) {
  53. this.isPlayAniUpdate = true;
  54. this.videoRbData = data.UserRedMoneyInfo;
  55. await mk.time.WaitForSeconds(0.5);
  56. // if (this.adRbPanel != null) {
  57. // //显示动画
  58. // this.adRbPanel.UpdateInfo(true);
  59. // this.adRbPanel.AdProgressEnd();
  60. // }
  61. }
  62. /**更新视频进度失败*/
  63. UpdateVideoProgressFial() {
  64. }
  65. /**
  66. * 免费加进度
  67. * @param cb 提现回调
  68. */
  69. async HttpNoAdProgress() {
  70. let data = {};
  71. let response = await mk.http.sendRequest('tuCaoRedMoney/noNeedVideo', 'POST', JSON.stringify(data));
  72. if (response.errcode != 0) {
  73. return;
  74. }
  75. this.isPlayAniUpdate = true;
  76. this.videoRbData = response.data.UserRedMoneyInfo;
  77. }
  78. /**
  79. * 大额红包提现
  80. * @param cb 提现回调
  81. */
  82. async HttpCashBig() {
  83. let data = {};
  84. let response = await mk.http.sendRequest('redMoneyVideoCash', 'POST', JSON.stringify(data));
  85. if (response.errcode != 0) {
  86. return null;
  87. }
  88. this.isPlayAniUpdate = false;
  89. this.videoRbData = response.data.UserRedMoneyInfo;
  90. return response;
  91. }
  92. /**
  93. * 任务红包提现
  94. * @param cb 提现回调
  95. */
  96. async HttpCashTask() {
  97. let data = { redMoneyId: this.taskRbId };
  98. let response = await mk.http.sendRequest('tuCaoRedMoney/gearCash', 'POST', JSON.stringify(data));
  99. if (response.errcode != 0) {
  100. return null;
  101. }
  102. this.isPlayAniUpdate = false;
  103. this.videoRbData = response.data.UserRedMoneyInfo;
  104. // if (response.data.code == 1) {
  105. // AdM.onSendEvent('VideoCash_' + this.taskRbId, '视频红包第' + this.taskRbId + '档领取成功', 'VideoCash');
  106. // }
  107. return response
  108. }
  109. /**清空数据*/
  110. async HttpInitAdRbData() {
  111. let data = {};
  112. let response = await mk.http.sendRequest('tuCaoRedMoney/initUserInfo', 'POST', JSON.stringify(data));
  113. if (response.errcode != 0) {
  114. return;
  115. }
  116. this.isPlayAniUpdate = false;
  117. this.videoRbData = response.data.UserRedMoneyInfo;
  118. // if (response.data.code == 1) {
  119. // AdM.onSendEvent('VideoCashBig_' + response.data.UserRedMoneyInfo.preLargeAmountCashId, ' 视频红包大额提现第' + response.data.UserRedMoneyInfo.preLargeAmountCashId + '档领取成功', 'VideoCashBig');
  120. // }
  121. }
  122. }
  123. /*
  124. 1.RedPackageNode jinrititle mingrititle null
  125. let targetPos: cc.Vec2 = this.target.getPosition();
  126. let bulletPos: cc.Vec2 = this.node.getPosition();
  127. let normalizeVec: cc.Vec2 = targetPos.subtract(bulletPos).normalize();
  128. //角度变化以y轴正方向为起点,逆时针角度递增
  129. this.node.angle = cc.v2(0, 1).signAngle(normalizeVec) * 180 / Math.PI;
  130. */