BlessingBagData.ts 4.0 KB

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