{"size": 1446, "ext": "js", "max_stars_repo_path": "Client/bin/js/Model/View/EffectPool.js", "max_stars_repo_name": "niuniuzhu/KOW", "max_stars_repo_stars_event_min_datetime": "2019-10-19T02:28:02.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-30T20:52:25.000Z", "max_issues_repo_path": "Client/bin/js/Model/View/EffectPool.js", "max_issues_repo_name": "niuniuzhu/KOW", "max_issues_repo_issues_event_min_datetime": "2018-10-26T17:19:18.000Z", "max_issues_repo_issues_event_max_datetime": "2019-02-13T05:17:05.000Z", "max_forks_repo_path": "Client/bin/js/Model/View/EffectPool.js", "max_forks_repo_name": "niuniuzhu/KOW", "max_forks_repo_forks_event_min_datetime": "2019-09-04T09:10:17.000Z", "max_forks_repo_forks_event_max_datetime": "2019-09-04T10:13:30.000Z"}
{"max_stars_count": 2, "max_issues_count": 11, "max_forks_count": 2, "avg_line_length": 30.125, "max_line_length": 123, "alphanum_fraction": 0.4177040111}
define(["require", "exports", "./VEffect", "../../RC/Collections/Stack"], function (require, exports, VEffect_1, Stack_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    class EffectPool {
        constructor(battle) {
            this.POOL = new Map();
            this._battle = battle;
        }
        Dispose() {
            this.POOL.forEach((v, k, m) => {
                v.forEach(e => e.Destroy());
            });
            this.POOL.clear();
        }
        Get(id) {
            let fx;
            if (this.POOL.has(id)) {
                const stack = this.POOL.get(id);
                if (stack.size() > 0) {
                    fx = stack.pop();
                }
                else {
                    fx = new VEffect_1.VEffect(this._battle, id);
                }
            }
            else {
                fx = new VEffect_1.VEffect(this._battle, id);
            }
            fx.OnSpawn();
            return fx;
        }
        Release(fx) {
            const id = fx.id;
            fx.OnDespawn();
            let stack;
            if (this.POOL.has(id)) {
                stack = this.POOL.get(id);
            }
            else {
                stack = new Stack_1.default();
                this.POOL.set(id, stack);
            }
            stack.push(fx);
        }
    }
    exports.EffectPool = EffectPool;
});
//# sourceMappingURL=EffectPool.js.map