0f553887-b5ed-48f8-8e2d-a39209f0c8be.js
2.26 KB
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
"use strict";
cc._RF.push(module, '0f553iHte1I+I4to5IJ8Mi+', 'BlockColorTableMgr');
// scripts/kernel/table/BlockColorTableMgr.ts
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BlockColorTableMgr = void 0;
var Global_1 = require("../../Global");
var TableDefine_1 = require("./TableDefine");
var BlockColorTableMgr = /** @class */ (function () {
function BlockColorTableMgr() {
this._list = [];
}
Object.defineProperty(BlockColorTableMgr, "ins", {
get: function () {
if (this._ins == null) {
this._ins = new BlockColorTableMgr();
var all = Global_1.tMgr.map[TableDefine_1.TableName.BLOCK_COLOR];
for (var key in all) {
if (Object.prototype.hasOwnProperty.call(all, key)) {
if (!Number(key)) {
continue;
}
var element = all[key];
this._ins._list.push(element);
}
}
this._ins._list.sort(function (a, b) {
return a.ID - b.ID;
});
}
return this._ins;
},
enumerable: false,
configurable: true
});
/**
*
* @param hp
* @returns 如果血量大于所有配置,则返回最后一个
*/
BlockColorTableMgr.prototype.getByHp = function (hp) {
for (var i = 0; i < this._list.length; ++i) {
if (hp <= this._list[i].MaxHP) {
return this._list[i];
}
}
return this._list[this._list.length - 1];
};
BlockColorTableMgr.prototype.getTrangleByHp = function (hp) {
for (var i = 0; i < this._list.length; ++i) {
if (hp <= this._list[i].MaxHP && this._list[i].TrangleImg != '') {
return this._list[i];
}
}
// return this._list[this._list.length - 1];
for (var i = this._list.length - 1; i >= 0; --i) {
if (this._list[i].TrangleImg != '') {
return this._list[i];
}
}
};
BlockColorTableMgr._ins = null;
return BlockColorTableMgr;
}());
exports.BlockColorTableMgr = BlockColorTableMgr;
cc._RF.pop();