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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
"use strict";
cc._RF.push(module, 'ed980xTXUBBbIyIzuUQCRMO', 'build_vo');
// Scripts/mod/mainscene/vo/build_vo.js
 
"use strict";
 
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
 
var BuildVo = cc.Class({
  "extends": gcore.BaseEvent,
  properties: {
    config: {
      // mainscene_data中的配置数据
      "default": {}
    },
    is_loack: false,
    // 没有通关指定的剧情副本,则为锁定状态
    activare: [],
    // 开启条件
    tips_list: {
      // 红点状态,因为一个建筑可能有多个红点状态        
      "default": {}
    },
    tips_status: false,
    // 是否有红点
    desc: "",
    // 描述
    in_fight: false,
    fight_status_list: {
      "default": {}
    },
    group_id: 0
  },
  ctor: function ctor() {
    this.config = arguments[0];
    this.is_lock = arguments[1];
    this.activate = arguments[2];
    this.desc = arguments[3];
  },
  setLockStatus: function setLockStatus(status) {
    if (this.is_lock !== status) {
      this.is_lock = status;
      this.fire(this.Update_self_event, "lock_status");
    }
  },
  // 
  getTipsStatus: function getTipsStatus() {
    for (var i in this.tips_list) {
      if (this.tips_list[i] == true) {
        return true;
      }
    }
 
    return this.tips_status;
  },
  setTipsStatus: function setTipsStatus(data) {
    var need_update = false;
 
    if (data == null) {
      data = !this.tips_status;
    }
 
    if (data instanceof Array) {
      for (var i in data) {
        var v = data[i];
 
        if (v.bid != null) {
          if (this.tips_list[v.bid] != v.status) {
            need_update = true;
            this.tips_list[v.bid] = v.status;
          }
        }
      }
    } else if (_typeof(data) == "object") {
      if (data.bid != null) {
        if (this.tips_list[data.bid] != data.status) {
          need_update = true;
          this.tips_list[data.bid] = data.status;
        }
      }
    } else {
      if (this.tips_status !== data) {
        need_update = true;
        this.tips_status = data;
      }
    }
 
    if (need_update == true) {
      this.fire(this.Update_self_event, "tips_status");
    }
  },
  setFightStatus: function setFightStatus(status_list) {
    // cc.log("vvvvvvvvvvvvvvv");
    // cc.log(status_list);
    if (!status_list) return;
    var old_status = false;
 
    for (var stauts_i in this.fight_status_list) {
      if (this.fight_status_list[stauts_i]) {
        old_status = true;
      }
    }
 
    var cur_status = false;
 
    for (var stauts_i in status_list) {
      if (status_list[stauts_i]) {
        cur_status = true;
      }
    }
 
    if (old_status == cur_status) return;
    this.fight_status_list = status_list;
    this.fire(this.Update_self_event, "fight_status");
  },
  getFightStatus: function getFightStatus() {
    for (var status_i in this.fight_status_list) {
      if (this.fight_status_list[status_i]) return true;
    }
 
    return false;
  }
});
BuildVo.prototype.Update_self_event = "Update_self_event";
module.exports = BuildVo;
 
cc._RF.pop();