difenduandada
2024-12-31 34abe6963b344c882358274957f4b992456fee40
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
"use strict";
cc._RF.push(module, '28775ubKnJDb7l3GSeOCKkh', 'stone_dungeon_model');
// Scripts/mod/stone_dungeon/stone_dungeon_model.js
 
"use strict";
 
// --------------------------------------------------------------------
// @author: xxx@syg.com(必填, 创建模块的人员)
// @description:
//      这里填写详细说明,主要填写该模块的功能简要
// <br/>Create: 2019-01-08 11:59:10
// --------------------------------------------------------------------
var MainuiController = require("mainui_controller");
 
var Stone_dungeonModel = cc.Class({
  "extends": BaseClass,
  ctor: function ctor() {
    this.change_count = {};
    this.passClearanceId = {};
  },
  properties: {},
  initConfig: function initConfig() {},
  // 通关的副本ID
  setPassClearanceID: function setPassClearanceID(data) {
    if (data && Utils.next(data) != null) {
      for (var i in data) {
        this.passClearanceId[data[i].id] = {
          status: 1
        };
      }
    }
  },
  getPassClearanceID: function getPassClearanceID(id) {
    if (!this.passClearanceId) return null;
    return this.passClearanceId[id];
  },
  // 今天已挑战/扫荡次数
  setChangeSweepCount: function setChangeSweepCount(data) {
    if (data && Utils.next(data) != null) {
      for (var i in data) {
        this.change_count[data[i].type] = data[i].day_num;
      }
    }
 
    this.updateRedPoint();
  },
  getChangeSweepCount: function getChangeSweepCount(_type) {
    if (!this.change_count) return 2;
 
    if (this.change_count[_type] != null) {
      return this.change_count[_type];
    }
 
    return 2;
  },
  updateRedPoint: function updateRedPoint() {
    RedMgr.getInstance().addCalHandler(this.checkRed.bind(this), RedIds.StoneDungeon);
  },
  checkRed: function checkRed() {
    var status = this.checkRedStatus();
 
    var MainuiConst = require("mainui_const");
 
    var SceneConst = require("scene_const");
 
    MainuiController.getInstance().setBtnRedPoint(MainuiConst.btn_index.esecsice, {
      bid: SceneConst.RedPointType.dungeonstone,
      status: status
    });
  },
  // ==============================
  // desc:宝石副本红点
  // time:2018-09-11 12:45:33
  // @return 
  // ==============================
  checkRedStatus: function checkRedStatus() {
    var type_open = Config.dungeon_stone_data.data_type_open;
 
    if (type_open && type_open[1] && type_open[1].activate) {
      var bool = MainuiController.getInstance().checkIsOpenByActivate(type_open[1].activate);
      if (bool == false) return false;
      if (!this.change_count) return;
      var length = Config.dungeon_stone_data.data_type_open_length;
 
      for (var i = 1; i <= length; i++) {
        var bool = MainuiController.getInstance().checkIsOpenByActivate(type_open[i].activate) || false;
        var count = this.change_count[i] || 0;
 
        if (count < 2 && bool == true) {
          return true;
        }
      }
 
      return false;
    }
 
    return false;
  }
});
 
cc._RF.pop();