{
  "code": "var Sprite3D = Laya.Sprite3D;\r\nvar Vector3 = Laya.Vector3;\r\nexport class modelConfig {\r\n    constructor(model) {\r\n        this.modelcur = model;\r\n        this.modelPos = model.transform.position.clone();\r\n        this.modelRot = model.transform.rotation.clone();\r\n        this.modelSca = model.transform.scale.clone();\r\n    }\r\n}\r\nexport default class GamePool {\r\n    constructor() {\r\n        this.modelpool = {};\r\n        this.maxAcount = 30;\r\n        GamePool.Ins = this;\r\n    }\r\n    static get Instance() {\r\n        if (GamePool.Ins) {\r\n            return GamePool.Ins;\r\n        }\r\n        else {\r\n            return new GamePool();\r\n        }\r\n    }\r\n    GetModel(_model, title) {\r\n        var poolname = title + _model.name;\r\n        if (this.modelpool[poolname] != null && this.modelpool[poolname] != undefined) {\r\n            if (this.modelpool[poolname].length > 0) {\r\n                var model1 = this.modelpool[poolname][0];\r\n                this.modelpool[poolname].splice(0, 1);\r\n                if (model1.modelcur.destroyed) {\r\n                    model1.modelcur = Sprite3D.instantiate(_model);\r\n                    if (!model1.modelcur.active) {\r\n                        model1.modelcur.active = true;\r\n                    }\r\n                }\r\n                model1.modelcur.active = true;\r\n                model1.modelcur.transform.position = _model.transform.position.clone();\r\n                model1.modelcur.transform.rotation = _model.transform.rotation.clone();\r\n                model1.modelcur.transform.scale = _model.transform.scale.clone();\r\n                return model1.modelcur;\r\n            }\r\n            else {\r\n                var model = Sprite3D.instantiate(_model);\r\n                model.active = true;\r\n                return model;\r\n            }\r\n        }\r\n        else {\r\n            var model = Sprite3D.instantiate(_model);\r\n            model.active = true;\r\n            return model;\r\n        }\r\n    }\r\n    RecoveryModel(model, title = \"\", modelstate = false) {\r\n        if (model.destroyed) {\r\n            return;\r\n        }\r\n        if (!modelstate && model.active == false) {\r\n            return;\r\n        }\r\n        var poolname = title + model.name;\r\n        if (this.modelpool[poolname] != null && this.modelpool[poolname] != undefined) {\r\n            var modelnum = this.modelpool[poolname];\r\n            if (modelnum.length > this.maxAcount) {\r\n                model.destroy();\r\n                return;\r\n            }\r\n            else {\r\n                modelnum.push(new modelConfig(model));\r\n            }\r\n        }\r\n        else {\r\n            modelnum = [];\r\n            modelnum.push(new modelConfig(model));\r\n            this.modelpool[poolname] = modelnum;\r\n        }\r\n        model.transform.position = new Vector3(0, 0, -10000);\r\n        model.removeSelf();\r\n        model.active = false;\r\n    }\r\n    ResetsModelPool() {\r\n        for (var Key in this.modelpool) {\r\n            var model = this.modelpool[Key];\r\n            for (var i = 0; i < model.length; i++) {\r\n                model[i].modelcur.destroy();\r\n            }\r\n        }\r\n        this.modelpool = {};\r\n    }\r\n}\r\n//# sourceMappingURL=GamePool.js.map",
  "references": [],
  "map": "{\"version\":3,\"file\":\"GamePool.js\",\"sourceRoot\":\"\",\"sources\":[\"../../../src/Tools/GamePool.ts\"],\"names\":[],\"mappings\":\"AAAA,IAAO,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;AAChC,IAAO,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;AAE9B,MAAM,OAAO,WAAW;IACpB,YAAY,KAAmB;QAC3B,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QACjD,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QACjD,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IAClD,CAAC;CAKJ;AACD,MAAM,CAAC,OAAO,OAAO,QAAQ;IAOzB;QAHO,cAAS,GAAwC,EAAE,CAAC;QAErD,cAAS,GAAG,EAAE,CAAC;QAEjB,QAAQ,CAAC,GAAG,GAAG,IAAI,CAAC;IACtB,CAAC;IACI,MAAM,KAAK,QAAQ;QACtB,IAAG,QAAQ,CAAC,GAAG,EAAC;YACZ,OAAO,QAAQ,CAAC,GAAG,CAAA;SAC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