SafeDepositBoxData.ts 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. qipaoType = -1;
  20. freshQipao = false;
  21. cashRecordData = null;
  22. /** 现金进入富翁银行动画 */
  23. creatPacketAnim(type) {
  24. this.qipaoType = type;
  25. }
  26. /**
  27. * 检查在哪个段位
  28. */
  29. getBankTaskIndex(next = false): any {
  30. mk.console.logSingle("getBankTaskIndex addRichBankFinishIndex:", gData.safeDepositBoxData.addRichBankFinishIndex)
  31. let configInfo = gData.safeDepositBoxData.richBankConfig
  32. if (configInfo == null || configInfo == undefined) {
  33. return
  34. }
  35. let curIndex = gData.safeDepositBoxData.addRichBankFinishIndex
  36. if (next) {
  37. curIndex += 1;
  38. }
  39. if (curIndex < 1) {
  40. curIndex = 1;
  41. }
  42. if (curIndex > configInfo.length) {
  43. return configInfo[configInfo.length - 1]
  44. }
  45. for (let entry of configInfo) {
  46. if (entry.index == curIndex) {
  47. return entry
  48. }
  49. }
  50. }
  51. async updateQipao() {
  52. await mk.time.WaitForSeconds(1);
  53. let response = await mk.http.sendData('richbank/getCashRecord', {});
  54. if (response && response.errcode == 0) {
  55. this.cashRecordData = response.data;
  56. this.freshQipao = true;
  57. }
  58. }
  59. }