"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();