SafeDepositBoxData.ts 3.5 KB

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