BlessingBagData.ts 4.1 KB

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