SafeDepositBoxData.ts 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /** 富翁银行数据类 */
  2. const { ccclass } = cc._decorator;
  3. @ccclass
  4. export default class SafeDepositBoxData {
  5. /** 保险箱配置信息 */
  6. richBankConfig = null
  7. /** 银行存入金额 */
  8. richBankCashAmount = 0
  9. /** 当前任务的id,也就是index字段 */
  10. currentRichBankCashTaskIndex = 0
  11. /** 开始银行任务后 每日观看的视频数 */
  12. richBankDailyVideoTimes = 0
  13. /** 开始银行任务后 连续登录数 */
  14. richbankLoginDays = 0
  15. /** 开始银行任务后 今日需要视频总次数 */
  16. richBankDailyTotelVideoTimes = 0
  17. //富翁银行正在进行过的档位
  18. addRichBankFinishIndex = 0;
  19. //是否开启任务
  20. isStartBankTask = 0;
  21. qipaoType = -1;
  22. freshQipao = false;
  23. cashRecordData = null;
  24. /** 现金进入富翁银行动画 */
  25. creatPacketAnim(type) {
  26. this.qipaoType = type;
  27. }
  28. /**
  29. * 检查在哪个段位
  30. */
  31. getBankTaskIndex(next = false): any {
  32. mk.console.logSingle("getBankTaskIndex addRichBankFinishIndex:", gData.safeDepositBoxData.addRichBankFinishIndex)
  33. let configInfo = gData.safeDepositBoxData.richBankConfig
  34. if (configInfo == null || configInfo == undefined) {
  35. return
  36. }
  37. let curIndex = gData.safeDepositBoxData.addRichBankFinishIndex
  38. if (next) {
  39. curIndex += 1;
  40. }
  41. if (curIndex < 1) {
  42. curIndex = 1;
  43. }
  44. if (curIndex > configInfo.length) {
  45. return configInfo[configInfo.length - 1]
  46. }
  47. for (let entry of configInfo) {
  48. if (entry.index == curIndex) {
  49. return entry
  50. }
  51. }
  52. }
  53. getBankTaskIndexExtra(isMinusOne = false){
  54. let configInfo = gData.safeDepositBoxData.richBankConfig
  55. if (configInfo == null || configInfo == undefined) {
  56. return
  57. }
  58. let curIndex = gData.safeDepositBoxData.currentRichBankCashTaskIndex;
  59. if(isMinusOne)
  60. {
  61. curIndex -= 1;
  62. }
  63. if (curIndex > configInfo.length) {
  64. return configInfo[configInfo.length - 1]
  65. }
  66. for (let entry of configInfo) {
  67. if (entry.index == curIndex) {
  68. return entry
  69. }
  70. }
  71. }
  72. async updateQipao() {
  73. await mk.time.WaitForSeconds(1);
  74. let response = await mk.http.sendData('richbank/getCashRecord', {});
  75. if (response && response.errcode == 0) {
  76. this.cashRecordData = response.data;
  77. this.freshQipao = true;
  78. }
  79. }
  80. }