@esengine/ecs-framework 2.2.21 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.es5.js","sources":["../../../node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs","../bin/Utils/Time.js","../bin/Utils/Timers/Timer.js","../bin/Utils/PerformanceMonitor.js","../bin/Core/DI/Decorators.js","../bin/Utils/Timers/TimerManager.js","../bin/Utils/Pool/Pool.js","../bin/Utils/Pool/PoolManager.js","../bin/ECS/Decorators/TypeDecorators.js","../bin/ECS/Core/ReferenceTracker.js","../bin/Utils/Logger/Constants.js","../bin/Utils/Logger/ConsoleLogger.js","../bin/Utils/Logger/LoggerManager.js","../bin/ECS/Decorators/EntityRefDecorator.js","../../../node_modules/.pnpm/reflect-metadata@0.2.2/node_modules/reflect-metadata/Reflect.js","../bin/ECS/Decorators/PropertyDecorator.js","../bin/ECS/Core/SoATypeRegistry.js","../bin/ECS/Core/SoASerializer.js","../bin/ECS/Core/SoAStorage.js","../bin/ECS/Component.js","../bin/ECS/Serialization/SerializationDecorators.js","../bin/ECS/Components/HierarchyComponent.js","../bin/ECS/Utils/Matcher.js","../bin/ECS/Core/CommandBuffer.js","../bin/ECS/Systems/EntityCache.js","../bin/ECS/Systems/EntitySystem.js","../bin/ECS/Systems/HierarchySystem.js","../bin/Utils/Debug/EntityDataCollector.js","../bin/Utils/Debug/SystemDataCollector.js","../bin/Utils/Debug/PerformanceDataCollector.js","../bin/ECS/Core/ComponentPool.js","../bin/Utils/Debug/ComponentDataCollector.js","../bin/Utils/Debug/SceneDataCollector.js","../bin/Utils/Profiler/ProfilerTypes.js","../bin/Utils/Debug/WebSocketManager.js","../bin/Utils/Profiler/ProfilerSDK.js","../bin/Utils/Debug/AdvancedProfilerCollector.js","../bin/ECS/Utils/BigIntCompatibility.js","../bin/ECS/Core/ComponentStorage/ComponentRegistry.js","../bin/ECS/Core/ComponentStorage.js","../bin/ECS/Entity.js","../bin/ECS/Utils/EntityList.js","../bin/ECS/Utils/IdentifierPool.js","../bin/ECS/Utils/EntityProcessorList.js","../bin/ECS/Utils/Bits.js","../bin/ECS/Utils/SparseSet.js","../bin/ECS/Utils/ComponentSparseSet.js","../bin/ECS/Utils/BitMaskHashMap.js","../bin/ECS/Core/QueryTypes.js","../bin/ECS/Core/ArchetypeSystem.js","../bin/ECS/Core/ReactiveQuery.js","../bin/ECS/Core/QuerySystem.js","../bin/ECS/Core/EventSystem.js","../bin/ECS/Core/Query/TypedQuery.js","../bin/ECS/Serialization/ComponentSerializer.js","../bin/ECS/Serialization/IncrementalSerializer.js","../bin/ECS/Serialization/EntitySerializer.js","../bin/Utils/BinarySerializer.js","../bin/ECS/Serialization/SceneSerializer.js","../bin/Utils/Profiler/AutoProfiler.js","../bin/Core/ServiceContainer.js","../bin/ECS/Scene.js","../bin/ECS/Core/FluentAPI/EntityBuilder.js","../bin/ECS/Core/FluentAPI/SceneBuilder.js","../bin/ECS/Core/FluentAPI/ComponentBuilder.js","../bin/ECS/Core/FluentAPI/EntityBatchOperator.js","../bin/ECS/Core/FluentAPI/ECSFluentAPI.js","../bin/ECS/World.js","../bin/Core/Plugin.js","../bin/ECS/SceneManager.js","../bin/Utils/Debug/DebugConfigService.js","../bin/Utils/Debug/DebugManager.js","../bin/Core/PluginManager.js","../bin/ECS/WorldManager.js","../bin/Core.js","../bin/Plugins/DebugPlugin.js","../bin/Utils/Emitter.js","../bin/ECS/CoreEvents.js","../bin/Utils/GlobalManager.js","../bin/ECS/Systems/ProcessingSystem.js","../bin/ECS/Systems/PassiveSystem.js","../bin/ECS/Systems/IntervalSystem.js","../bin/Platform/PlatformManager.js","../bin/ECS/Systems/WorkerEntitySystem.js","../bin/ECS/Core/EventBus.js","../bin/ECS/Serialization/VersionMigration.js","../bin/ECS/EntityTags.js","../bin/ECS/TypedEntity.js","../bin/Utils/Extensions/TypeUtils.js","../bin/Utils/Extensions/NumberExtension.js","../bin/Types/TypeHelpers.js","../bin/Platform/PlatformDetector.js","../bin/Platform/index.js"],"sourcesContent":["/******************************************************************************\nCopyright (c) Microsoft Corporation.\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n***************************************************************************** */\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\n\nvar extendStatics = function(d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n};\n\nexport function __extends(d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\n\nexport var __assign = function() {\n __assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n }\n return __assign.apply(this, arguments);\n}\n\nexport function __rest(s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n}\n\nexport function __decorate(decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\n\nexport function __param(paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n}\n\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\n var _, done = false;\n for (var i = decorators.length - 1; i >= 0; i--) {\n var context = {};\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\n if (kind === \"accessor\") {\n if (result === void 0) continue;\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\n if (_ = accept(result.get)) descriptor.get = _;\n if (_ = accept(result.set)) descriptor.set = _;\n if (_ = accept(result.init)) initializers.unshift(_);\n }\n else if (_ = accept(result)) {\n if (kind === \"field\") initializers.unshift(_);\n else descriptor[key] = _;\n }\n }\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\n done = true;\n};\n\nexport function __runInitializers(thisArg, initializers, value) {\n var useValue = arguments.length > 2;\n for (var i = 0; i < initializers.length; i++) {\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\n }\n return useValue ? value : void 0;\n};\n\nexport function __propKey(x) {\n return typeof x === \"symbol\" ? x : \"\".concat(x);\n};\n\nexport function __setFunctionName(f, name, prefix) {\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\n};\n\nexport function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\n\nexport function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\n\nexport function __generator(thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n}\n\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n});\n\nexport function __exportStar(m, o) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\n}\n\nexport function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\n\nexport function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n}\n\n/** @deprecated */\nexport function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++)\n ar = ar.concat(__read(arguments[i]));\n return ar;\n}\n\n/** @deprecated */\nexport function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n}\n\nexport function __spreadArray(to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n}\n\nexport function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n}\n\nexport function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n}\n\nexport function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\n}\n\nexport function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n}\n\nexport function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\n return cooked;\n};\n\nvar __setModuleDefault = Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n};\n\nvar ownKeys = function(o) {\n ownKeys = Object.getOwnPropertyNames || function (o) {\n var ar = [];\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\n return ar;\n };\n return ownKeys(o);\n};\n\nexport function __importStar(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\n __setModuleDefault(result, mod);\n return result;\n}\n\nexport function __importDefault(mod) {\n return (mod && mod.__esModule) ? mod : { default: mod };\n}\n\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n}\n\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n}\n\nexport function __classPrivateFieldIn(state, receiver) {\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\n}\n\nexport function __addDisposableResource(env, value, async) {\n if (value !== null && value !== void 0) {\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\n var dispose, inner;\n if (async) {\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\n dispose = value[Symbol.asyncDispose];\n }\n if (dispose === void 0) {\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\n dispose = value[Symbol.dispose];\n if (async) inner = dispose;\n }\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\n env.stack.push({ value: value, dispose: dispose, async: async });\n }\n else if (async) {\n env.stack.push({ async: true });\n }\n return value;\n}\n\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\n var e = new Error(message);\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\n};\n\nexport function __disposeResources(env) {\n function fail(e) {\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\n env.hasError = true;\n }\n var r, s = 0;\n function next() {\n while (r = env.stack.pop()) {\n try {\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\n if (r.dispose) {\n var result = r.dispose.call(r.value);\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\n }\n else s |= 1;\n }\n catch (e) {\n fail(e);\n }\n }\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\n if (env.hasError) throw env.error;\n }\n return next();\n}\n\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\n });\n }\n return path;\n}\n\nexport default {\n __extends,\n __assign,\n __rest,\n __decorate,\n __param,\n __esDecorate,\n __runInitializers,\n __propKey,\n __setFunctionName,\n __metadata,\n __awaiter,\n __generator,\n __createBinding,\n __exportStar,\n __values,\n __read,\n __spread,\n __spreadArrays,\n __spreadArray,\n __await,\n __asyncGenerator,\n __asyncDelegator,\n __asyncValues,\n __makeTemplateObject,\n __importStar,\n __importDefault,\n __classPrivateFieldGet,\n __classPrivateFieldSet,\n __classPrivateFieldIn,\n __addDisposableResource,\n __disposeResources,\n __rewriteRelativeImportExtension,\n};\n","/**\n * 时间管理工具类\n * 提供游戏时间相关的功能,包括帧时间、总时间、时间缩放等\n */\nexport class Time {\n /**\n * 使用外部引擎提供的deltaTime更新时间信息\n * @param deltaTime 外部引擎提供的帧时间间隔(秒)\n */\n static update(deltaTime) {\n // 设置未缩放的帧时间\n this.unscaledDeltaTime = deltaTime;\n this.deltaTime = deltaTime * this.timeScale;\n // 更新总时间\n this.unscaledTotalTime += this.unscaledDeltaTime;\n this.totalTime += this.deltaTime;\n // 更新帧数\n this.frameCount++;\n }\n /**\n * 场景改变时重置时间\n */\n static sceneChanged() {\n this.frameCount = 0;\n this.totalTime = 0;\n this.unscaledTotalTime = 0;\n this.deltaTime = 0;\n this.unscaledDeltaTime = 0;\n }\n /**\n * 检查指定的时间间隔是否已经过去\n * @param interval 时间间隔(秒)\n * @param lastTime 上次检查的时间\n * @returns 是否已经过去指定时间\n */\n static checkEvery(interval, lastTime) {\n return this.totalTime - lastTime >= interval;\n }\n}\n/**\n * 上一帧到当前帧的时间间隔(秒)\n */\nTime.deltaTime = 0;\n/**\n * 未缩放的帧时间间隔(秒)\n */\nTime.unscaledDeltaTime = 0;\n/**\n * 游戏开始以来的总时间(秒)\n */\nTime.totalTime = 0;\n/**\n * 未缩放的总时间(秒)\n */\nTime.unscaledTotalTime = 0;\n/**\n * 时间缩放比例\n */\nTime.timeScale = 1;\n/**\n * 当前帧数\n */\nTime.frameCount = 0;\n//# sourceMappingURL=Time.js.map","import { Time } from '../Time';\n/**\n * 私有类隐藏ITimer的实现\n */\nexport class Timer {\n constructor() {\n this._timeInSeconds = 0;\n this._repeats = false;\n this._isDone = false;\n this._elapsedTime = 0;\n }\n getContext() {\n return this.context;\n }\n /**\n * 定时器是否已完成\n */\n get isDone() {\n return this._isDone;\n }\n /**\n * 定时器已运行的时间\n */\n get elapsedTime() {\n return this._elapsedTime;\n }\n reset() {\n this._elapsedTime = 0;\n }\n stop() {\n this._isDone = true;\n }\n tick() {\n // 如果stop在tick之前被调用,那么isDone将为true,我们不应该再做任何事情\n if (!this._isDone && this._elapsedTime > this._timeInSeconds) {\n this._elapsedTime -= this._timeInSeconds;\n this._onTime(this);\n if (!this._isDone && !this._repeats)\n this._isDone = true;\n }\n this._elapsedTime += Time.deltaTime;\n return this._isDone;\n }\n initialize(timeInsSeconds, repeats, context, onTime) {\n this._timeInSeconds = timeInsSeconds;\n this._repeats = repeats;\n this.context = context;\n this._onTime = onTime.bind(context);\n }\n /**\n * 空出对象引用,以便在js需要时GC可以清理它们的引用\n */\n unload() {\n this.context = null;\n this._onTime = null;\n }\n}\n//# sourceMappingURL=Timer.js.map","/**\n * 性能警告类型\n */\nexport var PerformanceWarningType;\n(function (PerformanceWarningType) {\n PerformanceWarningType[\"HIGH_EXECUTION_TIME\"] = \"high_execution_time\";\n PerformanceWarningType[\"HIGH_MEMORY_USAGE\"] = \"high_memory_usage\";\n PerformanceWarningType[\"HIGH_CPU_USAGE\"] = \"high_cpu_usage\";\n PerformanceWarningType[\"FREQUENT_GC\"] = \"frequent_gc\";\n PerformanceWarningType[\"LOW_FPS\"] = \"low_fps\";\n PerformanceWarningType[\"HIGH_ENTITY_COUNT\"] = \"high_entity_count\";\n})(PerformanceWarningType || (PerformanceWarningType = {}));\n/**\n * 高性能监控器\n * 用于监控ECS系统的性能表现,提供详细的分析和优化建议\n */\nexport class PerformanceMonitor {\n constructor() {\n this._systemData = new Map();\n this._systemStats = new Map();\n this._isEnabled = false;\n this._maxRecentSamples = 60; // 保留最近60帧的数据\n }\n /**\n * 启用性能监控\n */\n enable() {\n this._isEnabled = true;\n }\n /**\n * 禁用性能监控\n */\n disable() {\n this._isEnabled = false;\n }\n /**\n * 检查是否启用了性能监控\n */\n get isEnabled() {\n return this._isEnabled;\n }\n /**\n * 开始监控系统性能\n * @param systemName 系统名称\n * @returns 开始时间戳\n */\n startMonitoring(_systemName) {\n if (!this._isEnabled) {\n return 0;\n }\n return performance.now();\n }\n /**\n * 结束监控并记录性能数据\n * @param systemName 系统名称\n * @param startTime 开始时间戳\n * @param entityCount 处理的实体数量\n */\n endMonitoring(systemName, startTime, entityCount = 0) {\n if (!this._isEnabled || startTime === 0) {\n return;\n }\n const endTime = performance.now();\n const executionTime = endTime - startTime;\n const averageTimePerEntity = entityCount > 0 ? executionTime / entityCount : 0;\n // 更新当前性能数据\n const data = {\n name: systemName,\n executionTime,\n entityCount,\n averageTimePerEntity,\n lastUpdateTime: endTime\n };\n this._systemData.set(systemName, data);\n // 更新统计信息\n this.updateStats(systemName, executionTime);\n }\n /**\n * 更新系统统计信息\n * @param systemName 系统名称\n * @param executionTime 执行时间\n */\n updateStats(systemName, executionTime) {\n let stats = this._systemStats.get(systemName);\n if (!stats) {\n stats = {\n totalTime: 0,\n averageTime: 0,\n minTime: Number.MAX_VALUE,\n maxTime: 0,\n executionCount: 0,\n recentTimes: [],\n standardDeviation: 0,\n percentile95: 0,\n percentile99: 0\n };\n this._systemStats.set(systemName, stats);\n }\n // 更新基本统计\n stats.totalTime += executionTime;\n stats.executionCount++;\n stats.averageTime = stats.totalTime / stats.executionCount;\n stats.minTime = Math.min(stats.minTime, executionTime);\n stats.maxTime = Math.max(stats.maxTime, executionTime);\n // 更新最近时间列表\n stats.recentTimes.push(executionTime);\n if (stats.recentTimes.length > this._maxRecentSamples) {\n stats.recentTimes.shift();\n }\n // 计算高级统计信息\n this.calculateAdvancedStats(stats);\n }\n /**\n * 计算高级统计信息\n * @param stats 统计信息对象\n */\n calculateAdvancedStats(stats) {\n if (stats.recentTimes.length === 0)\n return;\n // 计算标准差\n const mean = stats.recentTimes.reduce((a, b) => a + b, 0) / stats.recentTimes.length;\n const variance = stats.recentTimes.reduce((acc, time) => acc + Math.pow(time - mean, 2), 0) / stats.recentTimes.length;\n stats.standardDeviation = Math.sqrt(variance);\n // 计算百分位数\n const sortedTimes = [...stats.recentTimes].sort((a, b) => a - b);\n const len = sortedTimes.length;\n stats.percentile95 = sortedTimes[Math.floor(len * 0.95)] || 0;\n stats.percentile99 = sortedTimes[Math.floor(len * 0.99)] || 0;\n }\n /**\n * 获取系统的当前性能数据\n * @param systemName 系统名称\n * @returns 性能数据或undefined\n */\n getSystemData(systemName) {\n return this._systemData.get(systemName);\n }\n /**\n * 获取系统的统计信息\n * @param systemName 系统名称\n * @returns 统计信息或undefined\n */\n getSystemStats(systemName) {\n return this._systemStats.get(systemName);\n }\n /**\n * 获取所有系统的性能数据\n * @returns 所有系统的性能数据\n */\n getAllSystemData() {\n return new Map(this._systemData);\n }\n /**\n * 获取所有系统的统计信息\n * @returns 所有系统的统计信息\n */\n getAllSystemStats() {\n return new Map(this._systemStats);\n }\n /**\n * 获取性能报告\n * @returns 格式化的性能报告字符串\n */\n getPerformanceReport() {\n if (!this._isEnabled) {\n return 'Performance monitoring is disabled.';\n }\n const lines = [];\n lines.push('=== ECS Performance Report ===');\n lines.push('');\n // 按平均执行时间排序\n const sortedSystems = Array.from(this._systemStats.entries())\n .sort((a, b) => b[1].averageTime - a[1].averageTime);\n for (const [systemName, stats] of sortedSystems) {\n const data = this._systemData.get(systemName);\n lines.push(`System: ${systemName}`);\n lines.push(` Current: ${data?.executionTime.toFixed(2)}ms (${data?.entityCount} entities)`);\n lines.push(` Average: ${stats.averageTime.toFixed(2)}ms`);\n lines.push(` Min/Max: ${stats.minTime.toFixed(2)}ms / ${stats.maxTime.toFixed(2)}ms`);\n lines.push(` Total: ${stats.totalTime.toFixed(2)}ms (${stats.executionCount} calls)`);\n if (data?.averageTimePerEntity && data.averageTimePerEntity > 0) {\n lines.push(` Per Entity: ${data.averageTimePerEntity.toFixed(4)}ms`);\n }\n lines.push('');\n }\n // 总体统计\n const totalCurrentTime = Array.from(this._systemData.values())\n .reduce((sum, data) => sum + data.executionTime, 0);\n lines.push(`Total Frame Time: ${totalCurrentTime.toFixed(2)}ms`);\n lines.push(`Systems Count: ${this._systemData.size}`);\n return lines.join('\\n');\n }\n /**\n * 重置所有性能数据\n */\n reset() {\n this._systemData.clear();\n this._systemStats.clear();\n }\n /**\n * 重置指定系统的性能数据\n * @param systemName 系统名称\n */\n resetSystem(systemName) {\n this._systemData.delete(systemName);\n this._systemStats.delete(systemName);\n }\n /**\n * 获取性能警告\n * @param thresholdMs 警告阈值(毫秒)\n * @returns 超过阈值的系统列表\n */\n getPerformanceWarnings(thresholdMs = 16.67) {\n const warnings = [];\n for (const [systemName, data] of this._systemData.entries()) {\n if (data.executionTime > thresholdMs) {\n warnings.push(`${systemName}: ${data.executionTime.toFixed(2)}ms (>${thresholdMs}ms)`);\n }\n }\n return warnings;\n }\n /**\n * 设置最大保留样本数\n * @param maxSamples 最大样本数\n */\n setMaxRecentSamples(maxSamples) {\n this._maxRecentSamples = maxSamples;\n // 裁剪现有数据\n for (const stats of this._systemStats.values()) {\n while (stats.recentTimes.length > maxSamples) {\n stats.recentTimes.shift();\n }\n }\n }\n /**\n * 释放资源\n */\n dispose() {\n this._systemData.clear();\n this._systemStats.clear();\n this._isEnabled = false;\n }\n}\n//# sourceMappingURL=PerformanceMonitor.js.map","/**\n * 依赖注入装饰器\n *\n * 提供 @Injectable、@InjectProperty 和 @Updatable 装饰器,用于标记可注入的类和依赖注入点\n */\nconst injectableMetadata = new WeakMap();\nconst updatableMetadata = new WeakMap();\n/**\n * @Injectable() 装饰器\n *\n * 标记类为可注入的服务,使其可以通过ServiceContainer进行依赖注入\n *\n * @example\n * ```typescript\n * @Injectable()\n * class TimeService implements IService {\n * constructor() {}\n * dispose() {}\n * }\n *\n * @Injectable()\n * class PhysicsSystem extends EntitySystem {\n * @InjectProperty(TimeService)\n * private timeService!: TimeService;\n *\n * constructor() {\n * super(Matcher.empty());\n * }\n * }\n * ```\n */\nexport function Injectable() {\n return function (target) {\n const existing = injectableMetadata.get(target);\n injectableMetadata.set(target, {\n injectable: true,\n dependencies: [],\n ...(existing?.properties && { properties: existing.properties })\n });\n };\n}\n/**\n * @Updatable() 装饰器\n *\n * 标记服务类为可更新的,使其在每帧自动被ServiceContainer调用update方法。\n * 使用此装饰器的类必须实现IUpdatable接口(包含update方法)。\n *\n * @param priority - 更新优先级(数值越小越先执行,默认0)\n * @throws 如果类没有实现update方法,将在运行时抛出错误\n *\n * @example\n * ```typescript\n * @Injectable()\n * @Updatable()\n * class TimerManager implements IService, IUpdatable {\n * update(deltaTime?: number) {\n * // 每帧更新逻辑\n * }\n * dispose() {}\n * }\n *\n * // 指定优先级\n * @Injectable()\n * @Updatable(10)\n * class PhysicsManager implements IService, IUpdatable {\n * update() { }\n * dispose() {}\n * }\n * ```\n */\nexport function Updatable(priority = 0) {\n return function (target) {\n // 验证类原型上是否有update方法\n const prototype = target.prototype;\n if (!prototype || typeof prototype.update !== 'function') {\n throw new Error(`@Updatable() decorator requires class ${target.name} to implement IUpdatable interface with update() method. ` +\n 'Please add \\'implements IUpdatable\\' and define update(deltaTime?: number): void method.');\n }\n // 标记为可更新\n updatableMetadata.set(target, {\n updatable: true,\n priority\n });\n };\n}\n/**\n * @InjectProperty() 装饰器\n *\n * 通过属性装饰器注入依赖\n *\n * 注入时机:在构造函数执行后、onInitialize() 调用前完成\n *\n * @param serviceType 服务类型\n *\n * @example\n * ```typescript\n * @Injectable()\n * class PhysicsSystem extends EntitySystem {\n * @InjectProperty(TimeService)\n * private timeService!: TimeService;\n *\n * @InjectProperty(CollisionService)\n * private collision!: CollisionService;\n *\n * constructor() {\n * super(Matcher.empty());\n * }\n *\n * public onInitialize(): void {\n * // 此时属性已注入完成,可以安全使用\n * console.log(this.timeService.getDeltaTime());\n * }\n * }\n * ```\n */\nexport function InjectProperty(serviceType) {\n return function (target, propertyKey) {\n let metadata = injectableMetadata.get(target.constructor);\n if (!metadata) {\n metadata = {\n injectable: true,\n dependencies: []\n };\n injectableMetadata.set(target.constructor, metadata);\n }\n if (!metadata.properties) {\n metadata.properties = new Map();\n }\n metadata.properties.set(propertyKey, serviceType);\n };\n}\n/**\n * 检查类是否标记为可注入\n *\n * @param target 目标类\n * @returns 是否可注入\n */\nexport function isInjectable(target) {\n const metadata = injectableMetadata.get(target);\n return metadata?.injectable ?? false;\n}\n/**\n * 获取类的依赖注入元数据\n *\n * @param target 目标类\n * @returns 依赖注入元数据\n */\nexport function getInjectableMetadata(target) {\n return injectableMetadata.get(target);\n}\n/**\n * 获取属性注入元数据\n *\n * @param target 目标类\n * @returns 属性名到服务类型的映射\n */\nexport function getPropertyInjectMetadata(target) {\n const metadata = injectableMetadata.get(target);\n return metadata?.properties || new Map();\n}\n/**\n * 创建实例并自动注入依赖\n *\n * @param constructor 构造函数\n * @param container 服务容器\n * @returns 创建的实例\n *\n * @example\n * ```typescript\n * const instance = createInstance(MySystem, container);\n * ```\n */\nexport function createInstance(constructor, container) {\n // 创建实例(无参数注入)\n const instance = new constructor();\n // 注入属性依赖\n injectProperties(instance, container);\n return instance;\n}\n/**\n * 为实例注入属性依赖\n *\n * @param instance 目标实例\n * @param container 服务容器\n */\nexport function injectProperties(instance, container) {\n const constructor = instance.constructor;\n const metadata = getInjectableMetadata(constructor);\n if (!metadata?.properties || metadata.properties.size === 0) {\n return;\n }\n for (const [propertyKey, serviceType] of metadata.properties) {\n const service = container.resolve(serviceType);\n if (service !== null) {\n instance[propertyKey] = service;\n }\n }\n}\n/**\n * 检查类是否标记为可更新\n *\n * @param target 目标类\n * @returns 是否可更新\n */\nexport function isUpdatable(target) {\n const metadata = updatableMetadata.get(target);\n return metadata?.updatable ?? false;\n}\n/**\n * 获取类的可更新元数据\n *\n * @param target 目标类\n * @returns 可更新元数据\n */\nexport function getUpdatableMetadata(target) {\n return updatableMetadata.get(target);\n}\n/**\n * 注册可注入的服务到容器\n *\n * 自动检测@Injectable装饰器并注册服务\n *\n * @param container 服务容器\n * @param serviceType 服务类型\n * @param singleton 是否注册为单例(默认true)\n *\n * @example\n * ```typescript\n * @Injectable()\n * class MyService implements IService {\n * dispose() {}\n * }\n *\n * // 自动注册\n * registerInjectable(Core.services, MyService);\n * ```\n */\nexport function registerInjectable(container, serviceType, singleton = true) {\n if (!isInjectable(serviceType)) {\n throw new Error(`${serviceType.name} is not marked as @Injectable(). ` +\n 'Please add @Injectable() decorator to the class.');\n }\n // 创建工厂函数,使用createInstance自动解析依赖\n const factory = (c) => createInstance(serviceType, c);\n // 注册到容器\n if (singleton) {\n container.registerSingleton(serviceType, factory);\n }\n else {\n container.registerTransient(serviceType, factory);\n }\n}\n//# sourceMappingURL=Decorators.js.map","import { __decorate } from \"tslib\";\nimport { Timer } from './Timer';\nimport { Updatable } from '../../Core/DI';\n/**\n * 定时器管理器\n *\n * 允许动作的延迟和重复执行\n */\nlet TimerManager = class TimerManager {\n constructor() {\n this._timers = [];\n }\n update() {\n for (let i = this._timers.length - 1; i >= 0; i--) {\n if (this._timers[i].tick()) {\n this._timers[i].unload();\n this._timers.splice(i, 1);\n }\n }\n }\n /**\n * 调度一个一次性或重复的计时器,该计时器将调用已传递的动作\n * @param timeInSeconds\n * @param repeats\n * @param context\n * @param onTime\n */\n schedule(timeInSeconds, repeats, context, onTime) {\n const timer = new Timer();\n timer.initialize(timeInSeconds, repeats, context, onTime);\n this._timers.push(timer);\n return timer;\n }\n /**\n * 释放资源\n */\n dispose() {\n for (const timer of this._timers) {\n timer.unload();\n }\n this._timers = [];\n }\n};\nTimerManager = __decorate([\n Updatable()\n], TimerManager);\nexport { TimerManager };\n//# sourceMappingURL=TimerManager.js.map","/**\n * 高性能通用对象池\n * 支持任意类型的对象池化,包含详细的统计信息\n */\nexport class Pool {\n /**\n * 构造函数\n * @param createFn 创建对象的函数\n * @param maxSize 池的最大大小,默认100\n * @param estimatedObjectSize 估算的单个对象大小(字节),默认1024\n */\n constructor(createFn, maxSize = 100, estimatedObjectSize = 1024) {\n this._objects = [];\n this._createFn = createFn;\n this._maxSize = maxSize;\n this._objectSize = estimatedObjectSize;\n this._stats = {\n size: 0,\n maxSize,\n totalCreated: 0,\n totalObtained: 0,\n totalReleased: 0,\n hitRate: 0,\n estimatedMemoryUsage: 0\n };\n }\n /**\n * 获取指定类型的对象池\n * @param type 对象类型\n * @param maxSize 池的最大大小\n * @param estimatedObjectSize 估算的单个对象大小\n * @returns 对象池实例\n */\n static getPool(type, maxSize = 100, estimatedObjectSize = 1024) {\n let pool = this._pools.get(type);\n if (!pool) {\n pool = new Pool(() => new type(), maxSize, estimatedObjectSize);\n this._pools.set(type, pool);\n }\n return pool;\n }\n /**\n * 从池中获取对象\n * @returns 对象实例\n */\n obtain() {\n this._stats.totalObtained++;\n if (this._objects.length > 0) {\n const obj = this._objects.pop();\n this._stats.size--;\n this._updateHitRate();\n this._updateMemoryUsage();\n return obj;\n }\n // 池中没有可用对象,创建新对象\n this._stats.totalCreated++;\n this._updateHitRate();\n return this._createFn();\n }\n /**\n * 释放对象回池中\n * @param obj 要释放的对象\n */\n release(obj) {\n if (!obj)\n return;\n this._stats.totalReleased++;\n // 如果池未满,将对象放回池中\n if (this._stats.size < this._maxSize) {\n // 重置对象状态\n obj.reset();\n this._objects.push(obj);\n this._stats.size++;\n this._updateMemoryUsage();\n }\n // 如果池已满,让对象被垃圾回收\n }\n /**\n * 获取池统计信息\n * @returns 统计信息对象\n */\n getStats() {\n return { ...this._stats };\n }\n /**\n * 清空池\n */\n clear() {\n // 重置所有对象\n for (const obj of this._objects) {\n obj.reset();\n }\n this._objects.length = 0;\n this._stats.size = 0;\n this._updateMemoryUsage();\n }\n /**\n * 压缩池(移除多余的对象)\n * @param targetSize 目标大小,默认为当前大小的一半\n */\n compact(targetSize) {\n const target = targetSize ?? Math.floor(this._objects.length / 2);\n while (this._objects.length > target) {\n const obj = this._objects.pop();\n if (obj) {\n obj.reset();\n this._stats.size--;\n }\n }\n this._updateMemoryUsage();\n }\n /**\n * 预填充池\n * @param count 预填充的对象数量\n */\n prewarm(count) {\n const actualCount = Math.min(count, this._maxSize - this._objects.length);\n for (let i = 0; i < actualCount; i++) {\n const obj = this._createFn();\n obj.reset();\n this._objects.push(obj);\n this._stats.totalCreated++;\n this._stats.size++;\n }\n this._updateMemoryUsage();\n }\n /**\n * 设置最大池大小\n * @param maxSize 新的最大大小\n */\n setMaxSize(maxSize) {\n this._maxSize = maxSize;\n this._stats.maxSize = maxSize;\n // 如果当前池大小超过新的最大值,进行压缩\n if (this._objects.length > maxSize) {\n this.compact(maxSize);\n }\n }\n /**\n * 获取池中可用对象数量\n * @returns 可用对象数量\n */\n getAvailableCount() {\n return this._objects.length;\n }\n /**\n * 检查池是否为空\n * @returns 如果池为空返回true\n */\n isEmpty() {\n return this._objects.length === 0;\n }\n /**\n * 检查池是否已满\n * @returns 如果池已满返回true\n */\n isFull() {\n return this._objects.length >= this._maxSize;\n }\n /**\n * 获取所有已注册的池类型\n * @returns 所有池类型的数组\n */\n static getAllPoolTypes() {\n return Array.from(this._pools.keys());\n }\n /**\n * 获取所有池的统计信息\n * @returns 包含所有池统计信息的对象\n */\n static getAllPoolStats() {\n const stats = {};\n for (const [type, pool] of this._pools) {\n const typeName = type.name || type.toString();\n stats[typeName] = pool.getStats();\n }\n return stats;\n }\n /**\n * 压缩所有池\n */\n static compactAllPools() {\n for (const pool of this._pools.values()) {\n pool.compact();\n }\n }\n /**\n * 清空所有池\n */\n static clearAllPools() {\n for (const pool of this._pools.values()) {\n pool.clear();\n }\n this._pools.clear();\n }\n /**\n * 获取全局池统计信息的格式化字符串\n * @returns 格式化的统计信息字符串\n */\n static getGlobalStatsString() {\n const stats = this.getAllPoolStats();\n const lines = ['=== Object Pool Global Statistics ===', ''];\n if (Object.keys(stats).length === 0) {\n lines.push('No pools registered');\n return lines.join('\\n');\n }\n for (const [typeName, stat] of Object.entries(stats)) {\n lines.push(`${typeName}:`);\n lines.push(` Size: ${stat.size}/${stat.maxSize}`);\n lines.push(` Hit Rate: ${(stat.hitRate * 100).toFixed(1)}%`);\n lines.push(` Total Created: ${stat.totalCreated}`);\n lines.push(` Total Obtained: ${stat.totalObtained}`);\n lines.push(` Memory: ${(stat.estimatedMemoryUsage / 1024).toFixed(1)} KB`);\n lines.push('');\n }\n return lines.join('\\n');\n }\n /**\n * 更新命中率\n */\n _updateHitRate() {\n if (this._stats.totalObtained === 0) {\n this._stats.hitRate = 0;\n }\n else {\n const hits = this._stats.totalObtained - this._stats.totalCreated;\n this._stats.hitRate = hits / this._stats.totalObtained;\n }\n }\n /**\n * 更新内存使用估算\n */\n _updateMemoryUsage() {\n this._stats.estimatedMemoryUsage = this._stats.size * this._objectSize;\n }\n}\nPool._pools = new Map();\n//# sourceMappingURL=Pool.js.map","import { Pool } from './Pool';\n/**\n * 池管理器\n * 统一管理所有对象池\n */\nexport class PoolManager {\n constructor() {\n this.pools = new Map();\n this.autoCompactInterval = 60000; // 60秒\n this.lastCompactTime = 0;\n // 普通构造函数,不再使用单例模式\n }\n /**\n * 注册池\n * @param name 池名称\n * @param pool 池实例\n */\n registerPool(name, pool) {\n this.pools.set(name, pool);\n }\n /**\n * 获取池\n * @param name 池名称\n * @returns 池实例\n */\n getPool(name) {\n return this.pools.get(name) || null;\n }\n /**\n * 更新池管理器(应在游戏循环中调用)\n */\n update() {\n const now = Date.now();\n if (now - this.lastCompactTime > this.autoCompactInterval) {\n this.compactAllPools();\n this.lastCompactTime = now;\n }\n }\n /**\n * 创建或获取标准池\n * @param name 池名称\n * @param createFn 创建函数\n * @param maxSize 最大大小\n * @param estimatedObjectSize 估算对象大小\n * @returns 池实例\n */\n createPool(name, createFn, maxSize = 100, estimatedObjectSize = 1024) {\n let pool = this.pools.get(name);\n if (!pool) {\n pool = new Pool(createFn, maxSize, estimatedObjectSize);\n this.pools.set(name, pool);\n }\n return pool;\n }\n /**\n * 移除池\n * @param name 池名称\n * @returns 是否成功移除\n */\n removePool(name) {\n const pool = this.pools.get(name);\n if (pool) {\n pool.clear();\n this.pools.delete(name);\n return true;\n }\n return false;\n }\n /**\n * 获取所有池名称\n * @returns 池名称数组\n */\n getPoolNames() {\n return Array.from(this.pools.keys());\n }\n /**\n * 获取池数量\n * @returns 池数量\n */\n getPoolCount() {\n return this.pools.size;\n }\n /**\n * 压缩所有池\n */\n compactAllPools() {\n for (const pool of this.pools.values()) {\n pool.compact();\n }\n }\n /**\n * 清空所有池\n */\n clearAllPools() {\n for (const pool of this.pools.values()) {\n pool.clear();\n }\n }\n /**\n * 获取所有池的统计信息\n * @returns 统计信息映射\n */\n getAllStats() {\n const stats = new Map();\n for (const [name, pool] of this.pools) {\n stats.set(name, pool.getStats());\n }\n return stats;\n }\n /**\n * 获取总体统计信息\n * @returns 总体统计信息\n */\n getGlobalStats() {\n let totalSize = 0;\n let totalMaxSize = 0;\n let totalCreated = 0;\n let totalObtained = 0;\n let totalReleased = 0;\n let totalMemoryUsage = 0;\n for (const pool of this.pools.values()) {\n const stats = pool.getStats();\n totalSize += stats.size;\n totalMaxSize += stats.maxSize;\n totalCreated += stats.totalCreated;\n totalObtained += stats.totalObtained;\n totalReleased += stats.totalReleased;\n totalMemoryUsage += stats.estimatedMemoryUsage;\n }\n const hitRate = totalObtained === 0 ? 0 : (totalObtained - totalCreated) / totalObtained;\n return {\n size: totalSize,\n maxSize: totalMaxSize,\n totalCreated,\n totalObtained,\n totalReleased,\n hitRate,\n estimatedMemoryUsage: totalMemoryUsage\n };\n }\n /**\n * 获取格式化的统计信息字符串\n * @returns 格式化字符串\n */\n getStatsString() {\n const lines = ['=== Pool Manager Statistics ===', ''];\n if (this.pools.size === 0) {\n lines.push('No pools registered');\n return lines.join('\\n');\n }\n const globalStats = this.getGlobalStats();\n lines.push(`Total Pools: ${this.pools.size}`);\n lines.push(`Global Hit Rate: ${(globalStats.hitRate * 100).toFixed(1)}%`);\n lines.push(`Global Memory Usage: ${(globalStats.estimatedMemoryUsage / 1024).toFixed(1)} KB`);\n lines.push('');\n for (const [name, pool] of this.pools) {\n const stats = pool.getStats();\n lines.push(`${name}:`);\n lines.push(` Size: ${stats.size}/${stats.maxSize}`);\n lines.push(` Hit Rate: ${(stats.hitRate * 100).toFixed(1)}%`);\n lines.push(` Memory: ${(stats.estimatedMemoryUsage / 1024).toFixed(1)} KB`);\n lines.push('');\n }\n return lines.join('\\n');\n }\n /**\n * 设置自动压缩间隔\n * @param intervalMs 间隔毫秒数\n */\n setAutoCompactInterval(intervalMs) {\n this.autoCompactInterval = intervalMs;\n }\n /**\n * 预填充所有池\n */\n prewarmAllPools() {\n for (const pool of this.pools.values()) {\n const stats = pool.getStats();\n const prewarmCount = Math.floor(stats.maxSize * 0.2); // 预填充20%\n pool.prewarm(prewarmCount);\n }\n }\n /**\n * 重置池管理器\n */\n reset() {\n this.clearAllPools();\n this.pools.clear();\n this.lastCompactTime = 0;\n }\n /**\n * 释放资源\n * 实现 IService 接口\n */\n dispose() {\n this.reset();\n }\n}\n//# sourceMappingURL=PoolManager.js.map","/**\n * 存储组件类型名称的Symbol键\n */\nexport const COMPONENT_TYPE_NAME = Symbol('ComponentTypeName');\n/**\n * 存储组件依赖的Symbol键\n */\nexport const COMPONENT_DEPENDENCIES = Symbol('ComponentDependencies');\n/**\n * 存储系统类型名称的Symbol键\n */\nexport const SYSTEM_TYPE_NAME = Symbol('SystemTypeName');\n/**\n * 组件类型装饰器\n * 用于为组件类指定固定的类型名称,避免在代码混淆后失效\n *\n * @param typeName 组件类型名称\n * @param options 组件配置选项\n * @example\n * ```typescript\n * @ECSComponent('Position')\n * class PositionComponent extends Component {\n * x: number = 0;\n * y: number = 0;\n * }\n *\n * // 带依赖声明\n * @ECSComponent('SpriteAnimator', { requires: ['Sprite'] })\n * class SpriteAnimatorComponent extends Component {\n * // ...\n * }\n * ```\n */\nexport function ECSComponent(typeName, options) {\n return function (target) {\n if (!typeName || typeof typeName !== 'string') {\n throw new Error('ECSComponent装饰器必须提供有效的类型名称');\n }\n // 在构造函数上存储类型名称\n target[COMPONENT_TYPE_NAME] = typeName;\n // 存储依赖关系\n if (options?.requires) {\n target[COMPONENT_DEPENDENCIES] = options.requires;\n }\n return target;\n };\n}\n/**\n * 获取组件的依赖列表\n */\nexport function getComponentDependencies(componentType) {\n return componentType[COMPONENT_DEPENDENCIES];\n}\n/**\n * 系统类型装饰器\n * 用于为系统类指定固定的类型名称,避免在代码混淆后失效\n *\n * @param typeName 系统类型名称\n * @param metadata 系统元数据配置\n * @example\n * ```typescript\n * // 基本使用\n * @ECSSystem('Movement')\n * class MovementSystem extends EntitySystem {\n * protected process(entities: Entity[]): void {\n * // 系统逻辑\n * }\n * }\n *\n * // 配置更新顺序和依赖注入\n * @Injectable()\n * @ECSSystem('Physics', { updateOrder: 10 })\n * class PhysicsSystem extends EntitySystem {\n * @InjectProperty(CollisionSystem)\n * private collision!: CollisionSystem;\n *\n * constructor() {\n * super(Matcher.empty().all(Transform, RigidBody));\n * }\n * }\n * ```\n */\nexport function ECSSystem(typeName, metadata) {\n return function (target) {\n if (!typeName || typeof typeName !== 'string') {\n throw new Error('ECSSystem装饰器必须提供有效的类型名称');\n }\n // 在构造函数上存储类型名称\n target[SYSTEM_TYPE_NAME] = typeName;\n // 存储元数据\n if (metadata) {\n target.__systemMetadata__ = metadata;\n }\n return target;\n };\n}\n/**\n * 获取System的元数据\n */\nexport function getSystemMetadata(systemType) {\n return systemType.__systemMetadata__;\n}\n/**\n * 获取组件类型的名称,优先使用装饰器指定的名称\n *\n * @param componentType 组件构造函数\n * @returns 组件类型名称\n */\nexport function getComponentTypeName(componentType) {\n // 优先使用装饰器指定的名称\n const decoratorName = componentType[COMPONENT_TYPE_NAME];\n if (decoratorName) {\n return decoratorName;\n }\n // 回退到constructor.name\n return componentType.name || 'UnknownComponent';\n}\n/**\n * 获取系统类型的名称,优先使用装饰器指定的名称\n *\n * @param systemType 系统构造函数\n * @returns 系统类型名称\n */\nexport function getSystemTypeName(systemType) {\n // 优先使用装饰器指定的名称\n const decoratorName = systemType[SYSTEM_TYPE_NAME];\n if (decoratorName) {\n return decoratorName;\n }\n // 回退到constructor.name\n return systemType.name || 'UnknownSystem';\n}\n/**\n * 从组件实例获取类型名称\n *\n * @param component 组件实例\n * @returns 组件类型名称\n */\nexport function getComponentInstanceTypeName(component) {\n return getComponentTypeName(component.constructor);\n}\n/**\n * 从系统实例获取类型名称\n *\n * @param system 系统实例\n * @returns 系统类型名称\n */\nexport function getSystemInstanceTypeName(system) {\n return getSystemTypeName(system.constructor);\n}\n//# sourceMappingURL=TypeDecorators.js.map","/**\n * WeakRef Polyfill for ES2020 compatibility\n *\n * 为了兼容 Cocos Creator、Laya、微信小游戏等目标平台(仅支持 ES2020),\n * 提供 WeakRef 的 Polyfill 实现。\n *\n * - 现代浏览器:自动使用原生 WeakRef (自动 GC)\n * - 旧环境:使用 Polyfill (无自动 GC,但 Scene 销毁时会手动清理)\n */\nclass WeakRefPolyfill {\n constructor(target) {\n this._target = target;\n }\n deref() {\n return this._target;\n }\n}\n/**\n * WeakRef 实现\n *\n * 优先使用原生 WeakRef,不支持时降级到 Polyfill\n */\nconst WeakRefImpl = ((typeof globalThis !== 'undefined' && globalThis.WeakRef) ||\n (typeof global !== 'undefined' && global.WeakRef) ||\n (typeof window !== 'undefined' && window.WeakRef) ||\n WeakRefPolyfill);\n/**\n * 全局EntityID到Scene的映射\n *\n * 使用全局Map记录每个Entity ID对应的Scene,用于装饰器通过Component.entityId查找Scene。\n */\nconst globalEntitySceneMap = new Map();\n/**\n * 通过Entity ID获取Scene\n *\n * @param entityId Entity ID\n * @returns Scene实例,如果不存在则返回null\n */\nexport function getSceneByEntityId(entityId) {\n const sceneRef = globalEntitySceneMap.get(entityId);\n return sceneRef?.deref() || null;\n}\n/**\n * Entity引用追踪器\n *\n * 追踪Component中对Entity的引用,当Entity被销毁时自动清理所有引用。\n *\n * @example\n * ```typescript\n * const tracker = new ReferenceTracker();\n * tracker.registerReference(targetEntity, component, 'parent');\n * targetEntity.destroy(); // 自动将 component.parent 设为 null\n * ```\n */\nexport class ReferenceTracker {\n constructor() {\n /**\n * Entity ID -> 引用该Entity的所有组件记录\n */\n this._references = new Map();\n }\n /**\n * 注册Entity引用\n *\n * @param entity 被引用的Entity\n * @param component 持有引用的Component\n * @param propertyKey Component中存储引用的属性名\n */\n registerReference(entity, component, propertyKey) {\n const entityId = entity.id;\n let records = this._references.get(entityId);\n if (!records) {\n records = new Set();\n this._references.set(entityId, records);\n }\n const existingRecord = this._findRecord(records, component, propertyKey);\n if (existingRecord) {\n return;\n }\n records.add({\n component: new WeakRefImpl(component),\n propertyKey\n });\n }\n /**\n * 注销Entity引用\n *\n * @param entity 被引用的Entity\n * @param component 持有引用的Component\n * @param propertyKey Component中存储引用的属性名\n */\n unregisterReference(entity, component, propertyKey) {\n const entityId = entity.id;\n const records = this._references.get(entityId);\n if (!records) {\n return;\n }\n const record = this._findRecord(records, component, propertyKey);\n if (record) {\n records.delete(record);\n if (records.size === 0) {\n this._references.delete(entityId);\n }\n }\n }\n /**\n * 清理所有指向指定Entity的引用\n *\n * 将所有引用该Entity的Component属性设为null。\n *\n * @param entityId 被销毁的Entity ID\n */\n clearReferencesTo(entityId) {\n const records = this._references.get(entityId);\n if (!records) {\n return;\n }\n const validRecords = [];\n for (const record of records) {\n const component = record.component.deref();\n if (component) {\n validRecords.push(record);\n }\n }\n for (const record of validRecords) {\n const component = record.component.deref();\n if (component) {\n component[record.propertyKey] = null;\n }\n }\n this._references.delete(entityId);\n }\n /**\n * 清理Component的所有引用注册\n *\n * 当Component被移除时调用,清理该Component注册的所有引用。\n *\n * @param component 被移除的Component\n */\n clearComponentReferences(component) {\n for (const [entityId, records] of this._references.entries()) {\n const toDelete = [];\n for (const record of records) {\n const comp = record.component.deref();\n if (!comp || comp === component) {\n toDelete.push(record);\n }\n }\n for (const record of toDelete) {\n records.delete(record);\n }\n if (records.size === 0) {\n this._references.delete(entityId);\n }\n }\n }\n /**\n * 获取指向指定Entity的所有引用记录\n *\n * @param entityId Entity ID\n * @returns 引用记录数组(仅包含有效引用)\n */\n getReferencesTo(entityId) {\n const records = this._references.get(entityId);\n if (!records) {\n return [];\n }\n const validRecords = [];\n for (const record of records) {\n const component = record.component.deref();\n if (component) {\n validRecords.push(record);\n }\n }\n return validRecords;\n }\n /**\n * 清理所有失效的WeakRef引用\n *\n * 遍历所有记录,移除已被GC回收的Component引用。\n */\n cleanup() {\n const entitiesToDelete = [];\n for (const [entityId, records] of this._references.entries()) {\n const toDelete = [];\n for (const record of records) {\n if (!record.component.deref()) {\n toDelete.push(record);\n }\n }\n for (const record of toDelete) {\n records.delete(record);\n }\n if (records.size === 0) {\n entitiesToDelete.push(entityId);\n }\n }\n for (const entityId of entitiesToDelete) {\n this._references.delete(entityId);\n }\n }\n /**\n * 注册Entity到Scene的映射\n *\n * @param entityId Entity ID\n * @param scene Scene实例\n */\n registerEntityScene(entityId, scene) {\n globalEntitySceneMap.set(entityId, new WeakRefImpl(scene));\n }\n /**\n * 注销Entity到Scene的映射\n *\n * @param entityId Entity ID\n */\n unregisterEntityScene(entityId) {\n globalEntitySceneMap.delete(entityId);\n }\n /**\n * 获取调试信息\n */\n getDebugInfo() {\n const info = {};\n for (const [entityId, records] of this._references.entries()) {\n const validRecords = [];\n for (const record of records) {\n const component = record.component.deref();\n if (component) {\n validRecords.push({\n componentId: component.id,\n propertyKey: record.propertyKey\n });\n }\n }\n if (validRecords.length > 0) {\n info[`entity_${entityId}`] = validRecords;\n }\n }\n return info;\n }\n /**\n * 查找指定的引用记录\n */\n _findRecord(records, component, propertyKey) {\n for (const record of records) {\n const comp = record.component.deref();\n if (comp === component && record.propertyKey === propertyKey) {\n return record;\n }\n }\n return undefined;\n }\n}\n//# sourceMappingURL=ReferenceTracker.js.map","/**\n * 日志级别\n */\nexport var LogLevel;\n(function (LogLevel) {\n LogLevel[LogLevel[\"Debug\"] = 0] = \"Debug\";\n LogLevel[LogLevel[\"Info\"] = 1] = \"Info\";\n LogLevel[LogLevel[\"Warn\"] = 2] = \"Warn\";\n LogLevel[LogLevel[\"Error\"] = 3] = \"Error\";\n LogLevel[LogLevel[\"Fatal\"] = 4] = \"Fatal\";\n LogLevel[LogLevel[\"None\"] = 5] = \"None\";\n})(LogLevel || (LogLevel = {}));\n/**\n * 预定义的颜色常量\n */\nexport const Colors = {\n // 基础颜色\n BLACK: '\\x1b[30m',\n RED: '\\x1b[31m',\n GREEN: '\\x1b[32m',\n YELLOW: '\\x1b[33m',\n BLUE: '\\x1b[34m',\n MAGENTA: '\\x1b[35m',\n CYAN: '\\x1b[36m',\n WHITE: '\\x1b[37m',\n // 亮色版本\n BRIGHT_BLACK: '\\x1b[90m',\n BRIGHT_RED: '\\x1b[91m',\n BRIGHT_GREEN: '\\x1b[92m',\n BRIGHT_YELLOW: '\\x1b[93m',\n BRIGHT_BLUE: '\\x1b[94m',\n BRIGHT_MAGENTA: '\\x1b[95m',\n BRIGHT_CYAN: '\\x1b[96m',\n BRIGHT_WHITE: '\\x1b[97m',\n // 特殊\n RESET: '\\x1b[0m',\n BOLD: '\\x1b[1m',\n UNDERLINE: '\\x1b[4m'\n};\n//# sourceMappingURL=Constants.js.map","import { Colors, LogLevel } from './Constants';\n/**\n * 默认控制台日志实现\n */\nexport class ConsoleLogger {\n constructor(config = {}) {\n this._config = {\n level: LogLevel.Info,\n enableTimestamp: true,\n enableColors: typeof window === 'undefined',\n ...config\n };\n }\n /**\n * 输出调试级别日志\n * @param message 日志消息\n * @param args 附加参数\n */\n debug(message, ...args) {\n this.log(LogLevel.Debug, message, ...args);\n }\n /**\n * 输出信息级别日志\n * @param message 日志消息\n * @param args 附加参数\n */\n info(message, ...args) {\n this.log(LogLevel.Info, message, ...args);\n }\n /**\n * 输出警告级别日志\n * @param message 日志消息\n * @param args 附加参数\n */\n warn(message, ...args) {\n this.log(LogLevel.Warn, message, ...args);\n }\n /**\n * 输出错误级别日志\n * @param message 日志消息\n * @param args 附加参数\n */\n error(message, ...args) {\n this.log(LogLevel.Error, message, ...args);\n }\n /**\n * 输出致命错误级别日志\n * @param message 日志消息\n * @param args 附加参数\n */\n fatal(message, ...args) {\n this.log(LogLevel.Fatal, message, ...args);\n }\n /**\n * 设置日志级别\n * @param level 日志级别\n */\n setLevel(level) {\n this._config.level = level;\n }\n /**\n * 设置颜色配置\n * @param colors 颜色配置\n */\n setColors(colors) {\n if (Object.keys(colors).length === 0) {\n // 重置为默认颜色\n delete this._config.colors;\n }\n else {\n this._config.colors = {\n ...this._config.colors,\n ...colors\n };\n }\n }\n /**\n * 设置日志前缀\n * @param prefix 前缀字符串\n */\n setPrefix(prefix) {\n this._config.prefix = prefix;\n }\n /**\n * 内部日志输出方法\n * @param level 日志级别\n * @param message 日志消息\n * @param args 附加参数\n */\n log(level, message, ...args) {\n if (level < this._config.level) {\n return;\n }\n let formattedMessage = message;\n // 添加时间戳\n if (this._config.enableTimestamp) {\n const timestamp = new Date().toISOString();\n formattedMessage = `[${timestamp}] ${formattedMessage}`;\n }\n // 添加前缀\n if (this._config.prefix) {\n formattedMessage = `[${this._config.prefix}] ${formattedMessage}`;\n }\n // 添加日志级别\n const levelName = LogLevel[level].toUpperCase();\n formattedMessage = `[${levelName}] ${formattedMessage}`;\n // 使用自定义输出或默认控制台输出\n if (this._config.output) {\n this._config.output(level, formattedMessage);\n }\n else {\n this.outputToConsole(level, formattedMessage, ...args);\n }\n }\n /**\n * 输出到控制台\n * @param level 日志级别\n * @param message 格式化后的消息\n * @param args 附加参数\n */\n outputToConsole(level, message, ...args) {\n const colors = this._config.enableColors ? this.getColors() : null;\n switch (level) {\n case LogLevel.Debug:\n if (colors) {\n console.debug(`${colors.debug}${message}${colors.reset}`, ...args);\n }\n else {\n console.debug(message, ...args);\n }\n break;\n case LogLevel.Info:\n if (colors) {\n console.info(`${colors.info}${message}${colors.reset}`, ...args);\n }\n else {\n console.info(message, ...args);\n }\n break;\n case LogLevel.Warn:\n if (colors) {\n console.warn(`${colors.warn}${message}${colors.reset}`, ...args);\n }\n else {\n console.warn(message, ...args);\n }\n break;\n case LogLevel.Error:\n if (colors) {\n console.error(`${colors.error}${message}${colors.reset}`, ...args);\n }\n else {\n console.error(message, ...args);\n }\n break;\n case LogLevel.Fatal:\n if (colors) {\n console.error(`${colors.fatal}${message}${colors.reset}`, ...args);\n }\n else {\n console.error(message, ...args);\n }\n break;\n }\n }\n /**\n * 获取控制台颜色配置\n * @returns 颜色配置对象\n */\n getColors() {\n // 默认颜色配置\n const defaultColors = {\n debug: Colors.BRIGHT_BLACK, // 灰色\n info: Colors.GREEN, // 绿色\n warn: Colors.YELLOW, // 黄色\n error: Colors.RED, // 红色\n fatal: Colors.BRIGHT_RED, // 亮红色\n reset: Colors.RESET // 重置\n };\n // 合并用户自定义颜色\n return {\n ...defaultColors,\n ...this._config.colors\n };\n }\n}\n//# sourceMappingURL=ConsoleLogger.js.map","import { ConsoleLogger } from './ConsoleLogger';\nimport { LogLevel } from './Constants';\n/**\n * 日志管理器\n */\nexport class LoggerManager {\n constructor() {\n this._loggers = new Map();\n this._defaultLevel = LogLevel.Info;\n }\n get defaultLogger() {\n if (!this._defaultLogger) {\n this._defaultLogger = this.createDefaultLogger();\n }\n return this._defaultLogger;\n }\n // 新增: 创建默认 logger 的逻辑\n createDefaultLogger() {\n if (this._loggerFactory) {\n return this._loggerFactory();\n }\n return new ConsoleLogger({ level: this._defaultLevel });\n }\n /**\n * 获取日志管理器实例\n * @returns 日志管理器实例\n */\n static getInstance() {\n if (!LoggerManager._instance) {\n LoggerManager._instance = new LoggerManager();\n }\n return LoggerManager._instance;\n }\n /**\n * 获取或创建日志器\n * @param name 日志器名称\n * @returns 日志器实例\n */\n getLogger(name) {\n if (!name) {\n return this.defaultLogger;\n }\n // 如果有自定义 factory, 每次都调用(不缓存), 由使用方自行管理\n if (this._loggerFactory) {\n return this._loggerFactory(name);\n }\n // 默认 ConsoleLogger 仍然缓存(保持向后兼容)\n if (!this._loggers.has(name)) {\n this._loggers.set(name, new ConsoleLogger({ prefix: name, level: this._defaultLevel }));\n }\n return this._loggers.get(name);\n }\n /**\n * 设置日志器\n * @param name 日志器名称\n * @param logger 日志器实例\n */\n setLogger(name, logger) {\n this._loggers.set(name, logger);\n }\n /**\n * 设置全局日志级别\n * @param level 日志级别\n */\n setGlobalLevel(level) {\n this._defaultLevel = level;\n if (this._defaultLogger instanceof ConsoleLogger) {\n this._defaultLogger.setLevel(level);\n }\n for (const logger of this._loggers.values()) {\n if (logger instanceof ConsoleLogger) {\n logger.setLevel(level);\n }\n }\n }\n /**\n * 创建子日志器\n * @param parentName 父日志器名称\n * @param childName 子日志器名称\n * @returns 子日志器实例\n */\n createChildLogger(parentName, childName) {\n const fullName = `${parentName}.${childName}`;\n return this.getLogger(fullName);\n }\n /**\n * 设置全局颜色配置\n * @param colors 颜色配置\n */\n setGlobalColors(colors) {\n if (this._defaultLogger instanceof ConsoleLogger) {\n this._defaultLogger.setColors(colors);\n }\n for (const logger of this._loggers.values()) {\n if (logger instanceof ConsoleLogger) {\n logger.setColors(colors);\n }\n }\n }\n /**\n * 重置为默认颜色配置\n */\n resetColors() {\n if (this._defaultLogger instanceof ConsoleLogger) {\n this._defaultLogger.setColors({});\n }\n for (const logger of this._loggers.values()) {\n if (logger instanceof ConsoleLogger) {\n logger.setColors({});\n }\n }\n }\n /**\n * 设置日志器工厂方法\n * @param factory 日志器工厂方法\n *\n * 注意: 应该在导入 ECS 模块之前调用此方法。\n * 设置后, 每次调用 getLogger() 都会通过 factory 创建新的 logger 实例, 由用户侧管理\n */\n setLoggerFactory(factory) {\n this._loggerFactory = factory;\n // 清空默认 logger,下次获取时使用新工厂方法\n delete this._defaultLogger;\n // 清空缓存\n this._loggers.clear();\n }\n}\n/**\n * 默认日志器实例\n */\nexport const Logger = LoggerManager.getInstance().getLogger();\n/**\n * 创建命名日志器\n * @param name 日志器名称\n * @returns 日志器实例\n */\nexport function createLogger(name) {\n return LoggerManager.getInstance().getLogger(name);\n}\n/**\n * 设置全局日志颜色配置\n * @param colors 颜色配置\n */\nexport function setLoggerColors(colors) {\n LoggerManager.getInstance().setGlobalColors(colors);\n}\n/**\n * 重置日志颜色为默认配置\n */\nexport function resetLoggerColors() {\n LoggerManager.getInstance().resetColors();\n}\n/**\n * 设置全局日志级别\n * @param level 日志级别\n */\nexport function setGlobalLogLevel(level) {\n LoggerManager.getInstance().setGlobalLevel(level);\n}\n/**\n * 设置日志器工厂方法\n * @param factory 日志器工厂方法\n */\nexport function setLoggerFactory(factory) {\n LoggerManager.getInstance().setLoggerFactory(factory);\n}\n//# sourceMappingURL=LoggerManager.js.map","import { getSceneByEntityId } from '../Core/ReferenceTracker';\nimport { createLogger } from '../../Utils/Logger';\nconst logger = createLogger('EntityRefDecorator');\n/**\n * EntityRef元数据的Symbol键\n */\nexport const ENTITY_REF_METADATA = Symbol('EntityRefMetadata');\n/**\n * EntityRef值存储的Symbol键\n */\nconst ENTITY_REF_VALUES = Symbol('EntityRefValues');\n/**\n * 获取或创建组件的EntityRef值存储Map\n */\nfunction getValueMap(component) {\n let map = component[ENTITY_REF_VALUES];\n if (!map) {\n map = new Map();\n component[ENTITY_REF_VALUES] = map;\n }\n return map;\n}\n/**\n * Entity引用装饰器\n *\n * 标记Component属性为Entity引用,自动追踪引用关系。\n * 当被引用的Entity销毁时,该属性会自动设为null。\n *\n * @example\n * ```typescript\n * class ParentComponent extends Component {\n * @EntityRef() parent: Entity | null = null;\n * }\n *\n * const parent = scene.createEntity('Parent');\n * const child = scene.createEntity('Child');\n * const comp = child.addComponent(new ParentComponent());\n *\n * comp.parent = parent;\n * parent.destroy(); // comp.parent 自动变为 null\n * ```\n */\nexport function EntityRef() {\n return function (target, propertyKey) {\n const constructor = target.constructor;\n let metadata = constructor[ENTITY_REF_METADATA];\n if (!metadata) {\n metadata = {\n properties: new Set()\n };\n constructor[ENTITY_REF_METADATA] = metadata;\n }\n const propKeyString = typeof propertyKey === 'symbol' ? propertyKey.toString() : propertyKey;\n metadata.properties.add(propKeyString);\n Object.defineProperty(target, propertyKey, {\n get: function () {\n const valueMap = getValueMap(this);\n return valueMap.get(propKeyString) || null;\n },\n set: function (newValue) {\n const valueMap = getValueMap(this);\n const oldValue = valueMap.get(propKeyString) || null;\n if (oldValue === newValue) {\n return;\n }\n const scene = this.entityId !== null ? getSceneByEntityId(this.entityId) : null;\n if (!scene || !scene.referenceTracker) {\n valueMap.set(propKeyString, newValue);\n return;\n }\n const tracker = scene.referenceTracker;\n if (oldValue) {\n tracker.unregisterReference(oldValue, this, propKeyString);\n }\n if (newValue) {\n if (newValue.scene !== scene) {\n logger.error(`Cannot reference Entity from different Scene. Entity: ${newValue.name}, Scene: ${newValue.scene?.name || 'null'}`);\n return;\n }\n if (newValue.isDestroyed) {\n logger.warn(`Cannot reference destroyed Entity: ${newValue.name}`);\n valueMap.set(propKeyString, null);\n return;\n }\n tracker.registerReference(newValue, this, propKeyString);\n }\n valueMap.set(propKeyString, newValue);\n },\n enumerable: true,\n configurable: true\n });\n };\n}\n/**\n * 获取Component的EntityRef元数据\n *\n * @param component Component实例或Component类\n * @returns EntityRef元数据,如果不存在则返回null\n */\nexport function getEntityRefMetadata(component) {\n if (!component) {\n return null;\n }\n const constructor = typeof component === 'function'\n ? component\n : component.constructor;\n return constructor[ENTITY_REF_METADATA] || null;\n}\n/**\n * 检查Component是否有EntityRef属性\n *\n * @param component Component实例或Component类\n * @returns 如果有EntityRef属性返回true\n */\nexport function hasEntityRef(component) {\n return getEntityRefMetadata(component) !== null;\n}\n//# sourceMappingURL=EntityRefDecorator.js.map","/*! *****************************************************************************\nCopyright (C) Microsoft. All rights reserved.\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\nthis file except in compliance with the License. You may obtain a copy of the\nLicense at http://www.apache.org/licenses/LICENSE-2.0\n\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\nMERCHANTABLITY OR NON-INFRINGEMENT.\n\nSee the Apache Version 2.0 License for specific language governing permissions\nand limitations under the License.\n***************************************************************************** */\nvar Reflect;\n(function (Reflect) {\n // Metadata Proposal\n // https://rbuckton.github.io/reflect-metadata/\n (function (factory) {\n var root = typeof globalThis === \"object\" ? globalThis :\n typeof global === \"object\" ? global :\n typeof self === \"object\" ? self :\n typeof this === \"object\" ? this :\n sloppyModeThis();\n var exporter = makeExporter(Reflect);\n if (typeof root.Reflect !== \"undefined\") {\n exporter = makeExporter(root.Reflect, exporter);\n }\n factory(exporter, root);\n if (typeof root.Reflect === \"undefined\") {\n root.Reflect = Reflect;\n }\n function makeExporter(target, previous) {\n return function (key, value) {\n Object.defineProperty(target, key, { configurable: true, writable: true, value: value });\n if (previous)\n previous(key, value);\n };\n }\n function functionThis() {\n try {\n return Function(\"return this;\")();\n }\n catch (_) { }\n }\n function indirectEvalThis() {\n try {\n return (void 0, eval)(\"(function() { return this; })()\");\n }\n catch (_) { }\n }\n function sloppyModeThis() {\n return functionThis() || indirectEvalThis();\n }\n })(function (exporter, root) {\n var hasOwn = Object.prototype.hasOwnProperty;\n // feature test for Symbol support\n var supportsSymbol = typeof Symbol === \"function\";\n var toPrimitiveSymbol = supportsSymbol && typeof Symbol.toPrimitive !== \"undefined\" ? Symbol.toPrimitive : \"@@toPrimitive\";\n var iteratorSymbol = supportsSymbol && typeof Symbol.iterator !== \"undefined\" ? Symbol.iterator : \"@@iterator\";\n var supportsCreate = typeof Object.create === \"function\"; // feature test for Object.create support\n var supportsProto = { __proto__: [] } instanceof Array; // feature test for __proto__ support\n var downLevel = !supportsCreate && !supportsProto;\n var HashMap = {\n // create an object in dictionary mode (a.k.a. \"slow\" mode in v8)\n create: supportsCreate\n ? function () { return MakeDictionary(Object.create(null)); }\n : supportsProto\n ? function () { return MakeDictionary({ __proto__: null }); }\n : function () { return MakeDictionary({}); },\n has: downLevel\n ? function (map, key) { return hasOwn.call(map, key); }\n : function (map, key) { return key in map; },\n get: downLevel\n ? function (map, key) { return hasOwn.call(map, key) ? map[key] : undefined; }\n : function (map, key) { return map[key]; },\n };\n // Load global or shim versions of Map, Set, and WeakMap\n var functionPrototype = Object.getPrototypeOf(Function);\n var _Map = typeof Map === \"function\" && typeof Map.prototype.entries === \"function\" ? Map : CreateMapPolyfill();\n var _Set = typeof Set === \"function\" && typeof Set.prototype.entries === \"function\" ? Set : CreateSetPolyfill();\n var _WeakMap = typeof WeakMap === \"function\" ? WeakMap : CreateWeakMapPolyfill();\n var registrySymbol = supportsSymbol ? Symbol.for(\"@reflect-metadata:registry\") : undefined;\n var metadataRegistry = GetOrCreateMetadataRegistry();\n var metadataProvider = CreateMetadataProvider(metadataRegistry);\n /**\n * Applies a set of decorators to a property of a target object.\n * @param decorators An array of decorators.\n * @param target The target object.\n * @param propertyKey (Optional) The property key to decorate.\n * @param attributes (Optional) The property descriptor for the target key.\n * @remarks Decorators are applied in reverse order.\n * @example\n *\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * constructor(p) { }\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * Example = Reflect.decorate(decoratorsArray, Example);\n *\n * // property (on constructor)\n * Reflect.decorate(decoratorsArray, Example, \"staticProperty\");\n *\n * // property (on prototype)\n * Reflect.decorate(decoratorsArray, Example.prototype, \"property\");\n *\n * // method (on constructor)\n * Object.defineProperty(Example, \"staticMethod\",\n * Reflect.decorate(decoratorsArray, Example, \"staticMethod\",\n * Object.getOwnPropertyDescriptor(Example, \"staticMethod\")));\n *\n * // method (on prototype)\n * Object.defineProperty(Example.prototype, \"method\",\n * Reflect.decorate(decoratorsArray, Example.prototype, \"method\",\n * Object.getOwnPropertyDescriptor(Example.prototype, \"method\")));\n *\n */\n function decorate(decorators, target, propertyKey, attributes) {\n if (!IsUndefined(propertyKey)) {\n if (!IsArray(decorators))\n throw new TypeError();\n if (!IsObject(target))\n throw new TypeError();\n if (!IsObject(attributes) && !IsUndefined(attributes) && !IsNull(attributes))\n throw new TypeError();\n if (IsNull(attributes))\n attributes = undefined;\n propertyKey = ToPropertyKey(propertyKey);\n return DecorateProperty(decorators, target, propertyKey, attributes);\n }\n else {\n if (!IsArray(decorators))\n throw new TypeError();\n if (!IsConstructor(target))\n throw new TypeError();\n return DecorateConstructor(decorators, target);\n }\n }\n exporter(\"decorate\", decorate);\n // 4.1.2 Reflect.metadata(metadataKey, metadataValue)\n // https://rbuckton.github.io/reflect-metadata/#reflect.metadata\n /**\n * A default metadata decorator factory that can be used on a class, class member, or parameter.\n * @param metadataKey The key for the metadata entry.\n * @param metadataValue The value for the metadata entry.\n * @returns A decorator function.\n * @remarks\n * If `metadataKey` is already defined for the target and target key, the\n * metadataValue for that key will be overwritten.\n * @example\n *\n * // constructor\n * @Reflect.metadata(key, value)\n * class Example {\n * }\n *\n * // property (on constructor, TypeScript only)\n * class Example {\n * @Reflect.metadata(key, value)\n * static staticProperty;\n * }\n *\n * // property (on prototype, TypeScript only)\n * class Example {\n * @Reflect.metadata(key, value)\n * property;\n * }\n *\n * // method (on constructor)\n * class Example {\n * @Reflect.metadata(key, value)\n * static staticMethod() { }\n * }\n *\n * // method (on prototype)\n * class Example {\n * @Reflect.metadata(key, value)\n * method() { }\n * }\n *\n */\n function metadata(metadataKey, metadataValue) {\n function decorator(target, propertyKey) {\n if (!IsObject(target))\n throw new TypeError();\n if (!IsUndefined(propertyKey) && !IsPropertyKey(propertyKey))\n throw new TypeError();\n OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey);\n }\n return decorator;\n }\n exporter(\"metadata\", metadata);\n /**\n * Define a unique metadata entry on the target.\n * @param metadataKey A key used to store and retrieve metadata.\n * @param metadataValue A value that contains attached metadata.\n * @param target The target object on which to define metadata.\n * @param propertyKey (Optional) The property key for the target.\n * @example\n *\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * constructor(p) { }\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * Reflect.defineMetadata(\"custom:annotation\", options, Example);\n *\n * // property (on constructor)\n * Reflect.defineMetadata(\"custom:annotation\", options, Example, \"staticProperty\");\n *\n * // property (on prototype)\n * Reflect.defineMetadata(\"custom:annotation\", options, Example.prototype, \"property\");\n *\n * // method (on constructor)\n * Reflect.defineMetadata(\"custom:annotation\", options, Example, \"staticMethod\");\n *\n * // method (on prototype)\n * Reflect.defineMetadata(\"custom:annotation\", options, Example.prototype, \"method\");\n *\n * // decorator factory as metadata-producing annotation.\n * function MyAnnotation(options): Decorator {\n * return (target, key?) => Reflect.defineMetadata(\"custom:annotation\", options, target, key);\n * }\n *\n */\n function defineMetadata(metadataKey, metadataValue, target, propertyKey) {\n if (!IsObject(target))\n throw new TypeError();\n if (!IsUndefined(propertyKey))\n propertyKey = ToPropertyKey(propertyKey);\n return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey);\n }\n exporter(\"defineMetadata\", defineMetadata);\n /**\n * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined.\n * @param metadataKey A key used to store and retrieve metadata.\n * @param target The target object on which the metadata is defined.\n * @param propertyKey (Optional) The property key for the target.\n * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`.\n * @example\n *\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * constructor(p) { }\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * result = Reflect.hasMetadata(\"custom:annotation\", Example);\n *\n * // property (on constructor)\n * result = Reflect.hasMetadata(\"custom:annotation\", Example, \"staticProperty\");\n *\n * // property (on prototype)\n * result = Reflect.hasMetadata(\"custom:annotation\", Example.prototype, \"property\");\n *\n * // method (on constructor)\n * result = Reflect.hasMetadata(\"custom:annotation\", Example, \"staticMethod\");\n *\n * // method (on prototype)\n * result = Reflect.hasMetadata(\"custom:annotation\", Example.prototype, \"method\");\n *\n */\n function hasMetadata(metadataKey, target, propertyKey) {\n if (!IsObject(target))\n throw new TypeError();\n if (!IsUndefined(propertyKey))\n propertyKey = ToPropertyKey(propertyKey);\n return OrdinaryHasMetadata(metadataKey, target, propertyKey);\n }\n exporter(\"hasMetadata\", hasMetadata);\n /**\n * Gets a value indicating whether the target object has the provided metadata key defined.\n * @param metadataKey A key used to store and retrieve metadata.\n * @param target The target object on which the metadata is defined.\n * @param propertyKey (Optional) The property key for the target.\n * @returns `true` if the metadata key was defined on the target object; otherwise, `false`.\n * @example\n *\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * constructor(p) { }\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * result = Reflect.hasOwnMetadata(\"custom:annotation\", Example);\n *\n * // property (on constructor)\n * result = Reflect.hasOwnMetadata(\"custom:annotation\", Example, \"staticProperty\");\n *\n * // property (on prototype)\n * result = Reflect.hasOwnMetadata(\"custom:annotation\", Example.prototype, \"property\");\n *\n * // method (on constructor)\n * result = Reflect.hasOwnMetadata(\"custom:annotation\", Example, \"staticMethod\");\n *\n * // method (on prototype)\n * result = Reflect.hasOwnMetadata(\"custom:annotation\", Example.prototype, \"method\");\n *\n */\n function hasOwnMetadata(metadataKey, target, propertyKey) {\n if (!IsObject(target))\n throw new TypeError();\n if (!IsUndefined(propertyKey))\n propertyKey = ToPropertyKey(propertyKey);\n return OrdinaryHasOwnMetadata(metadataKey, target, propertyKey);\n }\n exporter(\"hasOwnMetadata\", hasOwnMetadata);\n /**\n * Gets the metadata value for the provided metadata key on the target object or its prototype chain.\n * @param metadataKey A key used to store and retrieve metadata.\n * @param target The target object on which the metadata is defined.\n * @param propertyKey (Optional) The property key for the target.\n * @returns The metadata value for the metadata key if found; otherwise, `undefined`.\n * @example\n *\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * constructor(p) { }\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * result = Reflect.getMetadata(\"custom:annotation\", Example);\n *\n * // property (on constructor)\n * result = Reflect.getMetadata(\"custom:annotation\", Example, \"staticProperty\");\n *\n * // property (on prototype)\n * result = Reflect.getMetadata(\"custom:annotation\", Example.prototype, \"property\");\n *\n * // method (on constructor)\n * result = Reflect.getMetadata(\"custom:annotation\", Example, \"staticMethod\");\n *\n * // method (on prototype)\n * result = Reflect.getMetadata(\"custom:annotation\", Example.prototype, \"method\");\n *\n */\n function getMetadata(metadataKey, target, propertyKey) {\n if (!IsObject(target))\n throw new TypeError();\n if (!IsUndefined(propertyKey))\n propertyKey = ToPropertyKey(propertyKey);\n return OrdinaryGetMetadata(metadataKey, target, propertyKey);\n }\n exporter(\"getMetadata\", getMetadata);\n /**\n * Gets the metadata value for the provided metadata key on the target object.\n * @param metadataKey A key used to store and retrieve metadata.\n * @param target The target object on which the metadata is defined.\n * @param propertyKey (Optional) The property key for the target.\n * @returns The metadata value for the metadata key if found; otherwise, `undefined`.\n * @example\n *\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * constructor(p) { }\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * result = Reflect.getOwnMetadata(\"custom:annotation\", Example);\n *\n * // property (on constructor)\n * result = Reflect.getOwnMetadata(\"custom:annotation\", Example, \"staticProperty\");\n *\n * // property (on prototype)\n * result = Reflect.getOwnMetadata(\"custom:annotation\", Example.prototype, \"property\");\n *\n * // method (on constructor)\n * result = Reflect.getOwnMetadata(\"custom:annotation\", Example, \"staticMethod\");\n *\n * // method (on prototype)\n * result = Reflect.getOwnMetadata(\"custom:annotation\", Example.prototype, \"method\");\n *\n */\n function getOwnMetadata(metadataKey, target, propertyKey) {\n if (!IsObject(target))\n throw new TypeError();\n if (!IsUndefined(propertyKey))\n propertyKey = ToPropertyKey(propertyKey);\n return OrdinaryGetOwnMetadata(metadataKey, target, propertyKey);\n }\n exporter(\"getOwnMetadata\", getOwnMetadata);\n /**\n * Gets the metadata keys defined on the target object or its prototype chain.\n * @param target The target object on which the metadata is defined.\n * @param propertyKey (Optional) The property key for the target.\n * @returns An array of unique metadata keys.\n * @example\n *\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * constructor(p) { }\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * result = Reflect.getMetadataKeys(Example);\n *\n * // property (on constructor)\n * result = Reflect.getMetadataKeys(Example, \"staticProperty\");\n *\n * // property (on prototype)\n * result = Reflect.getMetadataKeys(Example.prototype, \"property\");\n *\n * // method (on constructor)\n * result = Reflect.getMetadataKeys(Example, \"staticMethod\");\n *\n * // method (on prototype)\n * result = Reflect.getMetadataKeys(Example.prototype, \"method\");\n *\n */\n function getMetadataKeys(target, propertyKey) {\n if (!IsObject(target))\n throw new TypeError();\n if (!IsUndefined(propertyKey))\n propertyKey = ToPropertyKey(propertyKey);\n return OrdinaryMetadataKeys(target, propertyKey);\n }\n exporter(\"getMetadataKeys\", getMetadataKeys);\n /**\n * Gets the unique metadata keys defined on the target object.\n * @param target The target object on which the metadata is defined.\n * @param propertyKey (Optional) The property key for the target.\n * @returns An array of unique metadata keys.\n * @example\n *\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * constructor(p) { }\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * result = Reflect.getOwnMetadataKeys(Example);\n *\n * // property (on constructor)\n * result = Reflect.getOwnMetadataKeys(Example, \"staticProperty\");\n *\n * // property (on prototype)\n * result = Reflect.getOwnMetadataKeys(Example.prototype, \"property\");\n *\n * // method (on constructor)\n * result = Reflect.getOwnMetadataKeys(Example, \"staticMethod\");\n *\n * // method (on prototype)\n * result = Reflect.getOwnMetadataKeys(Example.prototype, \"method\");\n *\n */\n function getOwnMetadataKeys(target, propertyKey) {\n if (!IsObject(target))\n throw new TypeError();\n if (!IsUndefined(propertyKey))\n propertyKey = ToPropertyKey(propertyKey);\n return OrdinaryOwnMetadataKeys(target, propertyKey);\n }\n exporter(\"getOwnMetadataKeys\", getOwnMetadataKeys);\n /**\n * Deletes the metadata entry from the target object with the provided key.\n * @param metadataKey A key used to store and retrieve metadata.\n * @param target The target object on which the metadata is defined.\n * @param propertyKey (Optional) The property key for the target.\n * @returns `true` if the metadata entry was found and deleted; otherwise, false.\n * @example\n *\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * constructor(p) { }\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * result = Reflect.deleteMetadata(\"custom:annotation\", Example);\n *\n * // property (on constructor)\n * result = Reflect.deleteMetadata(\"custom:annotation\", Example, \"staticProperty\");\n *\n * // property (on prototype)\n * result = Reflect.deleteMetadata(\"custom:annotation\", Example.prototype, \"property\");\n *\n * // method (on constructor)\n * result = Reflect.deleteMetadata(\"custom:annotation\", Example, \"staticMethod\");\n *\n * // method (on prototype)\n * result = Reflect.deleteMetadata(\"custom:annotation\", Example.prototype, \"method\");\n *\n */\n function deleteMetadata(metadataKey, target, propertyKey) {\n if (!IsObject(target))\n throw new TypeError();\n if (!IsUndefined(propertyKey))\n propertyKey = ToPropertyKey(propertyKey);\n if (!IsObject(target))\n throw new TypeError();\n if (!IsUndefined(propertyKey))\n propertyKey = ToPropertyKey(propertyKey);\n var provider = GetMetadataProvider(target, propertyKey, /*Create*/ false);\n if (IsUndefined(provider))\n return false;\n return provider.OrdinaryDeleteMetadata(metadataKey, target, propertyKey);\n }\n exporter(\"deleteMetadata\", deleteMetadata);\n function DecorateConstructor(decorators, target) {\n for (var i = decorators.length - 1; i >= 0; --i) {\n var decorator = decorators[i];\n var decorated = decorator(target);\n if (!IsUndefined(decorated) && !IsNull(decorated)) {\n if (!IsConstructor(decorated))\n throw new TypeError();\n target = decorated;\n }\n }\n return target;\n }\n function DecorateProperty(decorators, target, propertyKey, descriptor) {\n for (var i = decorators.length - 1; i >= 0; --i) {\n var decorator = decorators[i];\n var decorated = decorator(target, propertyKey, descriptor);\n if (!IsUndefined(decorated) && !IsNull(decorated)) {\n if (!IsObject(decorated))\n throw new TypeError();\n descriptor = decorated;\n }\n }\n return descriptor;\n }\n // 3.1.1.1 OrdinaryHasMetadata(MetadataKey, O, P)\n // https://rbuckton.github.io/reflect-metadata/#ordinaryhasmetadata\n function OrdinaryHasMetadata(MetadataKey, O, P) {\n var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P);\n if (hasOwn)\n return true;\n var parent = OrdinaryGetPrototypeOf(O);\n if (!IsNull(parent))\n return OrdinaryHasMetadata(MetadataKey, parent, P);\n return false;\n }\n // 3.1.2.1 OrdinaryHasOwnMetadata(MetadataKey, O, P)\n // https://rbuckton.github.io/reflect-metadata/#ordinaryhasownmetadata\n function OrdinaryHasOwnMetadata(MetadataKey, O, P) {\n var provider = GetMetadataProvider(O, P, /*Create*/ false);\n if (IsUndefined(provider))\n return false;\n return ToBoolean(provider.OrdinaryHasOwnMetadata(MetadataKey, O, P));\n }\n // 3.1.3.1 OrdinaryGetMetadata(MetadataKey, O, P)\n // https://rbuckton.github.io/reflect-metadata/#ordinarygetmetadata\n function OrdinaryGetMetadata(MetadataKey, O, P) {\n var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P);\n if (hasOwn)\n return OrdinaryGetOwnMetadata(MetadataKey, O, P);\n var parent = OrdinaryGetPrototypeOf(O);\n if (!IsNull(parent))\n return OrdinaryGetMetadata(MetadataKey, parent, P);\n return undefined;\n }\n // 3.1.4.1 OrdinaryGetOwnMetadata(MetadataKey, O, P)\n // https://rbuckton.github.io/reflect-metadata/#ordinarygetownmetadata\n function OrdinaryGetOwnMetadata(MetadataKey, O, P) {\n var provider = GetMetadataProvider(O, P, /*Create*/ false);\n if (IsUndefined(provider))\n return;\n return provider.OrdinaryGetOwnMetadata(MetadataKey, O, P);\n }\n // 3.1.5.1 OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P)\n // https://rbuckton.github.io/reflect-metadata/#ordinarydefineownmetadata\n function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) {\n var provider = GetMetadataProvider(O, P, /*Create*/ true);\n provider.OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P);\n }\n // 3.1.6.1 OrdinaryMetadataKeys(O, P)\n // https://rbuckton.github.io/reflect-metadata/#ordinarymetadatakeys\n function OrdinaryMetadataKeys(O, P) {\n var ownKeys = OrdinaryOwnMetadataKeys(O, P);\n var parent = OrdinaryGetPrototypeOf(O);\n if (parent === null)\n return ownKeys;\n var parentKeys = OrdinaryMetadataKeys(parent, P);\n if (parentKeys.length <= 0)\n return ownKeys;\n if (ownKeys.length <= 0)\n return parentKeys;\n var set = new _Set();\n var keys = [];\n for (var _i = 0, ownKeys_1 = ownKeys; _i < ownKeys_1.length; _i++) {\n var key = ownKeys_1[_i];\n var hasKey = set.has(key);\n if (!hasKey) {\n set.add(key);\n keys.push(key);\n }\n }\n for (var _a = 0, parentKeys_1 = parentKeys; _a < parentKeys_1.length; _a++) {\n var key = parentKeys_1[_a];\n var hasKey = set.has(key);\n if (!hasKey) {\n set.add(key);\n keys.push(key);\n }\n }\n return keys;\n }\n // 3.1.7.1 OrdinaryOwnMetadataKeys(O, P)\n // https://rbuckton.github.io/reflect-metadata/#ordinaryownmetadatakeys\n function OrdinaryOwnMetadataKeys(O, P) {\n var provider = GetMetadataProvider(O, P, /*create*/ false);\n if (!provider) {\n return [];\n }\n return provider.OrdinaryOwnMetadataKeys(O, P);\n }\n // 6 ECMAScript Data Types and Values\n // https://tc39.github.io/ecma262/#sec-ecmascript-data-types-and-values\n function Type(x) {\n if (x === null)\n return 1 /* Null */;\n switch (typeof x) {\n case \"undefined\": return 0 /* Undefined */;\n case \"boolean\": return 2 /* Boolean */;\n case \"string\": return 3 /* String */;\n case \"symbol\": return 4 /* Symbol */;\n case \"number\": return 5 /* Number */;\n case \"object\": return x === null ? 1 /* Null */ : 6 /* Object */;\n default: return 6 /* Object */;\n }\n }\n // 6.1.1 The Undefined Type\n // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-undefined-type\n function IsUndefined(x) {\n return x === undefined;\n }\n // 6.1.2 The Null Type\n // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-null-type\n function IsNull(x) {\n return x === null;\n }\n // 6.1.5 The Symbol Type\n // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-symbol-type\n function IsSymbol(x) {\n return typeof x === \"symbol\";\n }\n // 6.1.7 The Object Type\n // https://tc39.github.io/ecma262/#sec-object-type\n function IsObject(x) {\n return typeof x === \"object\" ? x !== null : typeof x === \"function\";\n }\n // 7.1 Type Conversion\n // https://tc39.github.io/ecma262/#sec-type-conversion\n // 7.1.1 ToPrimitive(input [, PreferredType])\n // https://tc39.github.io/ecma262/#sec-toprimitive\n function ToPrimitive(input, PreferredType) {\n switch (Type(input)) {\n case 0 /* Undefined */: return input;\n case 1 /* Null */: return input;\n case 2 /* Boolean */: return input;\n case 3 /* String */: return input;\n case 4 /* Symbol */: return input;\n case 5 /* Number */: return input;\n }\n var hint = PreferredType === 3 /* String */ ? \"string\" : PreferredType === 5 /* Number */ ? \"number\" : \"default\";\n var exoticToPrim = GetMethod(input, toPrimitiveSymbol);\n if (exoticToPrim !== undefined) {\n var result = exoticToPrim.call(input, hint);\n if (IsObject(result))\n throw new TypeError();\n return result;\n }\n return OrdinaryToPrimitive(input, hint === \"default\" ? \"number\" : hint);\n }\n // 7.1.1.1 OrdinaryToPrimitive(O, hint)\n // https://tc39.github.io/ecma262/#sec-ordinarytoprimitive\n function OrdinaryToPrimitive(O, hint) {\n if (hint === \"string\") {\n var toString_1 = O.toString;\n if (IsCallable(toString_1)) {\n var result = toString_1.call(O);\n if (!IsObject(result))\n return result;\n }\n var valueOf = O.valueOf;\n if (IsCallable(valueOf)) {\n var result = valueOf.call(O);\n if (!IsObject(result))\n return result;\n }\n }\n else {\n var valueOf = O.valueOf;\n if (IsCallable(valueOf)) {\n var result = valueOf.call(O);\n if (!IsObject(result))\n return result;\n }\n var toString_2 = O.toString;\n if (IsCallable(toString_2)) {\n var result = toString_2.call(O);\n if (!IsObject(result))\n return result;\n }\n }\n throw new TypeError();\n }\n // 7.1.2 ToBoolean(argument)\n // https://tc39.github.io/ecma262/2016/#sec-toboolean\n function ToBoolean(argument) {\n return !!argument;\n }\n // 7.1.12 ToString(argument)\n // https://tc39.github.io/ecma262/#sec-tostring\n function ToString(argument) {\n return \"\" + argument;\n }\n // 7.1.14 ToPropertyKey(argument)\n // https://tc39.github.io/ecma262/#sec-topropertykey\n function ToPropertyKey(argument) {\n var key = ToPrimitive(argument, 3 /* String */);\n if (IsSymbol(key))\n return key;\n return ToString(key);\n }\n // 7.2 Testing and Comparison Operations\n // https://tc39.github.io/ecma262/#sec-testing-and-comparison-operations\n // 7.2.2 IsArray(argument)\n // https://tc39.github.io/ecma262/#sec-isarray\n function IsArray(argument) {\n return Array.isArray\n ? Array.isArray(argument)\n : argument instanceof Object\n ? argument instanceof Array\n : Object.prototype.toString.call(argument) === \"[object Array]\";\n }\n // 7.2.3 IsCallable(argument)\n // https://tc39.github.io/ecma262/#sec-iscallable\n function IsCallable(argument) {\n // NOTE: This is an approximation as we cannot check for [[Call]] internal method.\n return typeof argument === \"function\";\n }\n // 7.2.4 IsConstructor(argument)\n // https://tc39.github.io/ecma262/#sec-isconstructor\n function IsConstructor(argument) {\n // NOTE: This is an approximation as we cannot check for [[Construct]] internal method.\n return typeof argument === \"function\";\n }\n // 7.2.7 IsPropertyKey(argument)\n // https://tc39.github.io/ecma262/#sec-ispropertykey\n function IsPropertyKey(argument) {\n switch (Type(argument)) {\n case 3 /* String */: return true;\n case 4 /* Symbol */: return true;\n default: return false;\n }\n }\n function SameValueZero(x, y) {\n return x === y || x !== x && y !== y;\n }\n // 7.3 Operations on Objects\n // https://tc39.github.io/ecma262/#sec-operations-on-objects\n // 7.3.9 GetMethod(V, P)\n // https://tc39.github.io/ecma262/#sec-getmethod\n function GetMethod(V, P) {\n var func = V[P];\n if (func === undefined || func === null)\n return undefined;\n if (!IsCallable(func))\n throw new TypeError();\n return func;\n }\n // 7.4 Operations on Iterator Objects\n // https://tc39.github.io/ecma262/#sec-operations-on-iterator-objects\n function GetIterator(obj) {\n var method = GetMethod(obj, iteratorSymbol);\n if (!IsCallable(method))\n throw new TypeError(); // from Call\n var iterator = method.call(obj);\n if (!IsObject(iterator))\n throw new TypeError();\n return iterator;\n }\n // 7.4.4 IteratorValue(iterResult)\n // https://tc39.github.io/ecma262/2016/#sec-iteratorvalue\n function IteratorValue(iterResult) {\n return iterResult.value;\n }\n // 7.4.5 IteratorStep(iterator)\n // https://tc39.github.io/ecma262/#sec-iteratorstep\n function IteratorStep(iterator) {\n var result = iterator.next();\n return result.done ? false : result;\n }\n // 7.4.6 IteratorClose(iterator, completion)\n // https://tc39.github.io/ecma262/#sec-iteratorclose\n function IteratorClose(iterator) {\n var f = iterator[\"return\"];\n if (f)\n f.call(iterator);\n }\n // 9.1 Ordinary Object Internal Methods and Internal Slots\n // https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots\n // 9.1.1.1 OrdinaryGetPrototypeOf(O)\n // https://tc39.github.io/ecma262/#sec-ordinarygetprototypeof\n function OrdinaryGetPrototypeOf(O) {\n var proto = Object.getPrototypeOf(O);\n if (typeof O !== \"function\" || O === functionPrototype)\n return proto;\n // TypeScript doesn't set __proto__ in ES5, as it's non-standard.\n // Try to determine the superclass constructor. Compatible implementations\n // must either set __proto__ on a subclass constructor to the superclass constructor,\n // or ensure each class has a valid `constructor` property on its prototype that\n // points back to the constructor.\n // If this is not the same as Function.[[Prototype]], then this is definately inherited.\n // This is the case when in ES6 or when using __proto__ in a compatible browser.\n if (proto !== functionPrototype)\n return proto;\n // If the super prototype is Object.prototype, null, or undefined, then we cannot determine the heritage.\n var prototype = O.prototype;\n var prototypeProto = prototype && Object.getPrototypeOf(prototype);\n if (prototypeProto == null || prototypeProto === Object.prototype)\n return proto;\n // If the constructor was not a function, then we cannot determine the heritage.\n var constructor = prototypeProto.constructor;\n if (typeof constructor !== \"function\")\n return proto;\n // If we have some kind of self-reference, then we cannot determine the heritage.\n if (constructor === O)\n return proto;\n // we have a pretty good guess at the heritage.\n return constructor;\n }\n // Global metadata registry\n // - Allows `import \"reflect-metadata\"` and `import \"reflect-metadata/no-conflict\"` to interoperate.\n // - Uses isolated metadata if `Reflect` is frozen before the registry can be installed.\n /**\n * Creates a registry used to allow multiple `reflect-metadata` providers.\n */\n function CreateMetadataRegistry() {\n var fallback;\n if (!IsUndefined(registrySymbol) &&\n typeof root.Reflect !== \"undefined\" &&\n !(registrySymbol in root.Reflect) &&\n typeof root.Reflect.defineMetadata === \"function\") {\n // interoperate with older version of `reflect-metadata` that did not support a registry.\n fallback = CreateFallbackProvider(root.Reflect);\n }\n var first;\n var second;\n var rest;\n var targetProviderMap = new _WeakMap();\n var registry = {\n registerProvider: registerProvider,\n getProvider: getProvider,\n setProvider: setProvider,\n };\n return registry;\n function registerProvider(provider) {\n if (!Object.isExtensible(registry)) {\n throw new Error(\"Cannot add provider to a frozen registry.\");\n }\n switch (true) {\n case fallback === provider: break;\n case IsUndefined(first):\n first = provider;\n break;\n case first === provider: break;\n case IsUndefined(second):\n second = provider;\n break;\n case second === provider: break;\n default:\n if (rest === undefined)\n rest = new _Set();\n rest.add(provider);\n break;\n }\n }\n function getProviderNoCache(O, P) {\n if (!IsUndefined(first)) {\n if (first.isProviderFor(O, P))\n return first;\n if (!IsUndefined(second)) {\n if (second.isProviderFor(O, P))\n return first;\n if (!IsUndefined(rest)) {\n var iterator = GetIterator(rest);\n while (true) {\n var next = IteratorStep(iterator);\n if (!next) {\n return undefined;\n }\n var provider = IteratorValue(next);\n if (provider.isProviderFor(O, P)) {\n IteratorClose(iterator);\n return provider;\n }\n }\n }\n }\n }\n if (!IsUndefined(fallback) && fallback.isProviderFor(O, P)) {\n return fallback;\n }\n return undefined;\n }\n function getProvider(O, P) {\n var providerMap = targetProviderMap.get(O);\n var provider;\n if (!IsUndefined(providerMap)) {\n provider = providerMap.get(P);\n }\n if (!IsUndefined(provider)) {\n return provider;\n }\n provider = getProviderNoCache(O, P);\n if (!IsUndefined(provider)) {\n if (IsUndefined(providerMap)) {\n providerMap = new _Map();\n targetProviderMap.set(O, providerMap);\n }\n providerMap.set(P, provider);\n }\n return provider;\n }\n function hasProvider(provider) {\n if (IsUndefined(provider))\n throw new TypeError();\n return first === provider || second === provider || !IsUndefined(rest) && rest.has(provider);\n }\n function setProvider(O, P, provider) {\n if (!hasProvider(provider)) {\n throw new Error(\"Metadata provider not registered.\");\n }\n var existingProvider = getProvider(O, P);\n if (existingProvider !== provider) {\n if (!IsUndefined(existingProvider)) {\n return false;\n }\n var providerMap = targetProviderMap.get(O);\n if (IsUndefined(providerMap)) {\n providerMap = new _Map();\n targetProviderMap.set(O, providerMap);\n }\n providerMap.set(P, provider);\n }\n return true;\n }\n }\n /**\n * Gets or creates the shared registry of metadata providers.\n */\n function GetOrCreateMetadataRegistry() {\n var metadataRegistry;\n if (!IsUndefined(registrySymbol) && IsObject(root.Reflect) && Object.isExtensible(root.Reflect)) {\n metadataRegistry = root.Reflect[registrySymbol];\n }\n if (IsUndefined(metadataRegistry)) {\n metadataRegistry = CreateMetadataRegistry();\n }\n if (!IsUndefined(registrySymbol) && IsObject(root.Reflect) && Object.isExtensible(root.Reflect)) {\n Object.defineProperty(root.Reflect, registrySymbol, {\n enumerable: false,\n configurable: false,\n writable: false,\n value: metadataRegistry\n });\n }\n return metadataRegistry;\n }\n function CreateMetadataProvider(registry) {\n // [[Metadata]] internal slot\n // https://rbuckton.github.io/reflect-metadata/#ordinary-object-internal-methods-and-internal-slots\n var metadata = new _WeakMap();\n var provider = {\n isProviderFor: function (O, P) {\n var targetMetadata = metadata.get(O);\n if (IsUndefined(targetMetadata))\n return false;\n return targetMetadata.has(P);\n },\n OrdinaryDefineOwnMetadata: OrdinaryDefineOwnMetadata,\n OrdinaryHasOwnMetadata: OrdinaryHasOwnMetadata,\n OrdinaryGetOwnMetadata: OrdinaryGetOwnMetadata,\n OrdinaryOwnMetadataKeys: OrdinaryOwnMetadataKeys,\n OrdinaryDeleteMetadata: OrdinaryDeleteMetadata,\n };\n metadataRegistry.registerProvider(provider);\n return provider;\n function GetOrCreateMetadataMap(O, P, Create) {\n var targetMetadata = metadata.get(O);\n var createdTargetMetadata = false;\n if (IsUndefined(targetMetadata)) {\n if (!Create)\n return undefined;\n targetMetadata = new _Map();\n metadata.set(O, targetMetadata);\n createdTargetMetadata = true;\n }\n var metadataMap = targetMetadata.get(P);\n if (IsUndefined(metadataMap)) {\n if (!Create)\n return undefined;\n metadataMap = new _Map();\n targetMetadata.set(P, metadataMap);\n if (!registry.setProvider(O, P, provider)) {\n targetMetadata.delete(P);\n if (createdTargetMetadata) {\n metadata.delete(O);\n }\n throw new Error(\"Wrong provider for target.\");\n }\n }\n return metadataMap;\n }\n // 3.1.2.1 OrdinaryHasOwnMetadata(MetadataKey, O, P)\n // https://rbuckton.github.io/reflect-metadata/#ordinaryhasownmetadata\n function OrdinaryHasOwnMetadata(MetadataKey, O, P) {\n var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false);\n if (IsUndefined(metadataMap))\n return false;\n return ToBoolean(metadataMap.has(MetadataKey));\n }\n // 3.1.4.1 OrdinaryGetOwnMetadata(MetadataKey, O, P)\n // https://rbuckton.github.io/reflect-metadata/#ordinarygetownmetadata\n function OrdinaryGetOwnMetadata(MetadataKey, O, P) {\n var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false);\n if (IsUndefined(metadataMap))\n return undefined;\n return metadataMap.get(MetadataKey);\n }\n // 3.1.5.1 OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P)\n // https://rbuckton.github.io/reflect-metadata/#ordinarydefineownmetadata\n function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) {\n var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ true);\n metadataMap.set(MetadataKey, MetadataValue);\n }\n // 3.1.7.1 OrdinaryOwnMetadataKeys(O, P)\n // https://rbuckton.github.io/reflect-metadata/#ordinaryownmetadatakeys\n function OrdinaryOwnMetadataKeys(O, P) {\n var keys = [];\n var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false);\n if (IsUndefined(metadataMap))\n return keys;\n var keysObj = metadataMap.keys();\n var iterator = GetIterator(keysObj);\n var k = 0;\n while (true) {\n var next = IteratorStep(iterator);\n if (!next) {\n keys.length = k;\n return keys;\n }\n var nextValue = IteratorValue(next);\n try {\n keys[k] = nextValue;\n }\n catch (e) {\n try {\n IteratorClose(iterator);\n }\n finally {\n throw e;\n }\n }\n k++;\n }\n }\n function OrdinaryDeleteMetadata(MetadataKey, O, P) {\n var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false);\n if (IsUndefined(metadataMap))\n return false;\n if (!metadataMap.delete(MetadataKey))\n return false;\n if (metadataMap.size === 0) {\n var targetMetadata = metadata.get(O);\n if (!IsUndefined(targetMetadata)) {\n targetMetadata.delete(P);\n if (targetMetadata.size === 0) {\n metadata.delete(targetMetadata);\n }\n }\n }\n return true;\n }\n }\n function CreateFallbackProvider(reflect) {\n var defineMetadata = reflect.defineMetadata, hasOwnMetadata = reflect.hasOwnMetadata, getOwnMetadata = reflect.getOwnMetadata, getOwnMetadataKeys = reflect.getOwnMetadataKeys, deleteMetadata = reflect.deleteMetadata;\n var metadataOwner = new _WeakMap();\n var provider = {\n isProviderFor: function (O, P) {\n var metadataPropertySet = metadataOwner.get(O);\n if (!IsUndefined(metadataPropertySet) && metadataPropertySet.has(P)) {\n return true;\n }\n if (getOwnMetadataKeys(O, P).length) {\n if (IsUndefined(metadataPropertySet)) {\n metadataPropertySet = new _Set();\n metadataOwner.set(O, metadataPropertySet);\n }\n metadataPropertySet.add(P);\n return true;\n }\n return false;\n },\n OrdinaryDefineOwnMetadata: defineMetadata,\n OrdinaryHasOwnMetadata: hasOwnMetadata,\n OrdinaryGetOwnMetadata: getOwnMetadata,\n OrdinaryOwnMetadataKeys: getOwnMetadataKeys,\n OrdinaryDeleteMetadata: deleteMetadata,\n };\n return provider;\n }\n /**\n * Gets the metadata provider for an object. If the object has no metadata provider and this is for a create operation,\n * then this module's metadata provider is assigned to the object.\n */\n function GetMetadataProvider(O, P, Create) {\n var registeredProvider = metadataRegistry.getProvider(O, P);\n if (!IsUndefined(registeredProvider)) {\n return registeredProvider;\n }\n if (Create) {\n if (metadataRegistry.setProvider(O, P, metadataProvider)) {\n return metadataProvider;\n }\n throw new Error(\"Illegal state.\");\n }\n return undefined;\n }\n // naive Map shim\n function CreateMapPolyfill() {\n var cacheSentinel = {};\n var arraySentinel = [];\n var MapIterator = /** @class */ (function () {\n function MapIterator(keys, values, selector) {\n this._index = 0;\n this._keys = keys;\n this._values = values;\n this._selector = selector;\n }\n MapIterator.prototype[\"@@iterator\"] = function () { return this; };\n MapIterator.prototype[iteratorSymbol] = function () { return this; };\n MapIterator.prototype.next = function () {\n var index = this._index;\n if (index >= 0 && index < this._keys.length) {\n var result = this._selector(this._keys[index], this._values[index]);\n if (index + 1 >= this._keys.length) {\n this._index = -1;\n this._keys = arraySentinel;\n this._values = arraySentinel;\n }\n else {\n this._index++;\n }\n return { value: result, done: false };\n }\n return { value: undefined, done: true };\n };\n MapIterator.prototype.throw = function (error) {\n if (this._index >= 0) {\n this._index = -1;\n this._keys = arraySentinel;\n this._values = arraySentinel;\n }\n throw error;\n };\n MapIterator.prototype.return = function (value) {\n if (this._index >= 0) {\n this._index = -1;\n this._keys = arraySentinel;\n this._values = arraySentinel;\n }\n return { value: value, done: true };\n };\n return MapIterator;\n }());\n var Map = /** @class */ (function () {\n function Map() {\n this._keys = [];\n this._values = [];\n this._cacheKey = cacheSentinel;\n this._cacheIndex = -2;\n }\n Object.defineProperty(Map.prototype, \"size\", {\n get: function () { return this._keys.length; },\n enumerable: true,\n configurable: true\n });\n Map.prototype.has = function (key) { return this._find(key, /*insert*/ false) >= 0; };\n Map.prototype.get = function (key) {\n var index = this._find(key, /*insert*/ false);\n return index >= 0 ? this._values[index] : undefined;\n };\n Map.prototype.set = function (key, value) {\n var index = this._find(key, /*insert*/ true);\n this._values[index] = value;\n return this;\n };\n Map.prototype.delete = function (key) {\n var index = this._find(key, /*insert*/ false);\n if (index >= 0) {\n var size = this._keys.length;\n for (var i = index + 1; i < size; i++) {\n this._keys[i - 1] = this._keys[i];\n this._values[i - 1] = this._values[i];\n }\n this._keys.length--;\n this._values.length--;\n if (SameValueZero(key, this._cacheKey)) {\n this._cacheKey = cacheSentinel;\n this._cacheIndex = -2;\n }\n return true;\n }\n return false;\n };\n Map.prototype.clear = function () {\n this._keys.length = 0;\n this._values.length = 0;\n this._cacheKey = cacheSentinel;\n this._cacheIndex = -2;\n };\n Map.prototype.keys = function () { return new MapIterator(this._keys, this._values, getKey); };\n Map.prototype.values = function () { return new MapIterator(this._keys, this._values, getValue); };\n Map.prototype.entries = function () { return new MapIterator(this._keys, this._values, getEntry); };\n Map.prototype[\"@@iterator\"] = function () { return this.entries(); };\n Map.prototype[iteratorSymbol] = function () { return this.entries(); };\n Map.prototype._find = function (key, insert) {\n if (!SameValueZero(this._cacheKey, key)) {\n this._cacheIndex = -1;\n for (var i = 0; i < this._keys.length; i++) {\n if (SameValueZero(this._keys[i], key)) {\n this._cacheIndex = i;\n break;\n }\n }\n }\n if (this._cacheIndex < 0 && insert) {\n this._cacheIndex = this._keys.length;\n this._keys.push(key);\n this._values.push(undefined);\n }\n return this._cacheIndex;\n };\n return Map;\n }());\n return Map;\n function getKey(key, _) {\n return key;\n }\n function getValue(_, value) {\n return value;\n }\n function getEntry(key, value) {\n return [key, value];\n }\n }\n // naive Set shim\n function CreateSetPolyfill() {\n var Set = /** @class */ (function () {\n function Set() {\n this._map = new _Map();\n }\n Object.defineProperty(Set.prototype, \"size\", {\n get: function () { return this._map.size; },\n enumerable: true,\n configurable: true\n });\n Set.prototype.has = function (value) { return this._map.has(value); };\n Set.prototype.add = function (value) { return this._map.set(value, value), this; };\n Set.prototype.delete = function (value) { return this._map.delete(value); };\n Set.prototype.clear = function () { this._map.clear(); };\n Set.prototype.keys = function () { return this._map.keys(); };\n Set.prototype.values = function () { return this._map.keys(); };\n Set.prototype.entries = function () { return this._map.entries(); };\n Set.prototype[\"@@iterator\"] = function () { return this.keys(); };\n Set.prototype[iteratorSymbol] = function () { return this.keys(); };\n return Set;\n }());\n return Set;\n }\n // naive WeakMap shim\n function CreateWeakMapPolyfill() {\n var UUID_SIZE = 16;\n var keys = HashMap.create();\n var rootKey = CreateUniqueKey();\n return /** @class */ (function () {\n function WeakMap() {\n this._key = CreateUniqueKey();\n }\n WeakMap.prototype.has = function (target) {\n var table = GetOrCreateWeakMapTable(target, /*create*/ false);\n return table !== undefined ? HashMap.has(table, this._key) : false;\n };\n WeakMap.prototype.get = function (target) {\n var table = GetOrCreateWeakMapTable(target, /*create*/ false);\n return table !== undefined ? HashMap.get(table, this._key) : undefined;\n };\n WeakMap.prototype.set = function (target, value) {\n var table = GetOrCreateWeakMapTable(target, /*create*/ true);\n table[this._key] = value;\n return this;\n };\n WeakMap.prototype.delete = function (target) {\n var table = GetOrCreateWeakMapTable(target, /*create*/ false);\n return table !== undefined ? delete table[this._key] : false;\n };\n WeakMap.prototype.clear = function () {\n // NOTE: not a real clear, just makes the previous data unreachable\n this._key = CreateUniqueKey();\n };\n return WeakMap;\n }());\n function CreateUniqueKey() {\n var key;\n do\n key = \"@@WeakMap@@\" + CreateUUID();\n while (HashMap.has(keys, key));\n keys[key] = true;\n return key;\n }\n function GetOrCreateWeakMapTable(target, create) {\n if (!hasOwn.call(target, rootKey)) {\n if (!create)\n return undefined;\n Object.defineProperty(target, rootKey, { value: HashMap.create() });\n }\n return target[rootKey];\n }\n function FillRandomBytes(buffer, size) {\n for (var i = 0; i < size; ++i)\n buffer[i] = Math.random() * 0xff | 0;\n return buffer;\n }\n function GenRandomBytes(size) {\n if (typeof Uint8Array === \"function\") {\n var array = new Uint8Array(size);\n if (typeof crypto !== \"undefined\") {\n crypto.getRandomValues(array);\n }\n else if (typeof msCrypto !== \"undefined\") {\n msCrypto.getRandomValues(array);\n }\n else {\n FillRandomBytes(array, size);\n }\n return array;\n }\n return FillRandomBytes(new Array(size), size);\n }\n function CreateUUID() {\n var data = GenRandomBytes(UUID_SIZE);\n // mark as random - RFC 4122 § 4.4\n data[6] = data[6] & 0x4f | 0x40;\n data[8] = data[8] & 0xbf | 0x80;\n var result = \"\";\n for (var offset = 0; offset < UUID_SIZE; ++offset) {\n var byte = data[offset];\n if (offset === 4 || offset === 6 || offset === 8)\n result += \"-\";\n if (byte < 16)\n result += \"0\";\n result += byte.toString(16).toLowerCase();\n }\n return result;\n }\n }\n // uses a heuristic used by v8 and chakra to force an object into dictionary mode.\n function MakeDictionary(obj) {\n obj.__ = undefined;\n delete obj.__;\n return obj;\n }\n });\n})(Reflect || (Reflect = {}));\n","import 'reflect-metadata';\n// 使用 Symbol.for 创建全局 Symbol,确保跨包共享元数据\n// Use Symbol.for to create a global Symbol to ensure metadata sharing across packages\nexport const PROPERTY_METADATA = Symbol.for('@esengine/property:metadata');\n/**\n * 属性装饰器 - 声明组件属性的编辑器元数据\n *\n * @example\n * ```typescript\n * @ECSComponent('Transform')\n * export class TransformComponent extends Component {\n * @Property({ type: 'vector3', label: 'Position' })\n * public position: Vector3 = { x: 0, y: 0, z: 0 };\n *\n * @Property({ type: 'number', label: 'Speed', min: 0, max: 100 })\n * public speed: number = 10;\n * }\n * ```\n */\nexport function Property(options) {\n return (target, propertyKey) => {\n const constructor = target.constructor;\n const existingMetadata = Reflect.getMetadata(PROPERTY_METADATA, constructor) || {};\n existingMetadata[propertyKey] = options;\n Reflect.defineMetadata(PROPERTY_METADATA, existingMetadata, constructor);\n };\n}\n/**\n * 获取组件类的所有属性元数据\n */\nexport function getPropertyMetadata(target) {\n return Reflect.getMetadata(PROPERTY_METADATA, target);\n}\n/**\n * 检查组件类是否有属性元数据\n */\nexport function hasPropertyMetadata(target) {\n return Reflect.hasMetadata(PROPERTY_METADATA, target);\n}\n//# sourceMappingURL=PropertyDecorator.js.map","/**\n * SoA 类型注册器\n * 负责类型推断、TypedArray 创建和元数据管理\n */\nexport class SoATypeRegistry {\n /**\n * 获取 TypedArray 构造函数\n */\n static getConstructor(typeName) {\n return this.TYPE_CONSTRUCTORS[typeName] || Float32Array;\n }\n /**\n * 获取每个元素的字节数\n */\n static getBytesPerElement(typeName) {\n return this.TYPE_BYTES[typeName] || 4;\n }\n /**\n * 从 TypedArray 实例获取类型名称\n */\n static getTypeName(array) {\n if (array instanceof Float32Array)\n return 'float32';\n if (array instanceof Float64Array)\n return 'float64';\n if (array instanceof Int32Array)\n return 'int32';\n if (array instanceof Uint32Array)\n return 'uint32';\n if (array instanceof Int16Array)\n return 'int16';\n if (array instanceof Uint16Array)\n return 'uint16';\n if (array instanceof Int8Array)\n return 'int8';\n if (array instanceof Uint8Array)\n return 'uint8';\n if (array instanceof Uint8ClampedArray)\n return 'uint8clamped';\n return 'float32';\n }\n /**\n * 创建新的 TypedArray(与原数组同类型)\n */\n static createSameType(source, capacity) {\n const typeName = this.getTypeName(source);\n const Constructor = this.getConstructor(typeName);\n return new Constructor(capacity);\n }\n /**\n * 从组件类型提取字段元数据\n */\n static extractFieldMetadata(componentType) {\n const instance = new componentType();\n const metadata = new Map();\n const typeWithMeta = componentType;\n // 收集装饰器标记\n const decoratorMap = new Map();\n const addDecorators = (fields, type) => {\n if (fields) {\n for (const key of fields)\n decoratorMap.set(key, type);\n }\n };\n addDecorators(typeWithMeta.__float64Fields, 'float64');\n addDecorators(typeWithMeta.__float32Fields, 'float32');\n addDecorators(typeWithMeta.__int32Fields, 'int32');\n addDecorators(typeWithMeta.__uint32Fields, 'uint32');\n addDecorators(typeWithMeta.__int16Fields, 'int16');\n addDecorators(typeWithMeta.__uint16Fields, 'uint16');\n addDecorators(typeWithMeta.__int8Fields, 'int8');\n addDecorators(typeWithMeta.__uint8Fields, 'uint8');\n addDecorators(typeWithMeta.__uint8ClampedFields, 'uint8clamped');\n // 遍历实例属性\n const instanceKeys = Object.keys(instance).filter((key) => key !== 'id');\n for (const key of instanceKeys) {\n const value = instance[key];\n const type = typeof value;\n if (type === 'function')\n continue;\n const fieldMeta = {\n name: key,\n type: type\n };\n const decoratorType = decoratorMap.get(key);\n if (decoratorType) {\n fieldMeta.arrayType = decoratorType;\n }\n else if (type === 'number') {\n fieldMeta.arrayType = 'float32';\n }\n else if (type === 'boolean') {\n fieldMeta.arrayType = 'uint8';\n }\n // 序列化标记\n if (typeWithMeta.__serializeMapFields?.has(key)) {\n fieldMeta.isSerializedMap = true;\n }\n if (typeWithMeta.__serializeSetFields?.has(key)) {\n fieldMeta.isSerializedSet = true;\n }\n if (typeWithMeta.__serializeArrayFields?.has(key)) {\n fieldMeta.isSerializedArray = true;\n }\n if (typeWithMeta.__deepCopyFields?.has(key)) {\n fieldMeta.isDeepCopy = true;\n }\n metadata.set(key, fieldMeta);\n }\n return metadata;\n }\n}\nSoATypeRegistry.TYPE_CONSTRUCTORS = {\n float32: Float32Array,\n float64: Float64Array,\n int32: Int32Array,\n uint32: Uint32Array,\n int16: Int16Array,\n uint16: Uint16Array,\n int8: Int8Array,\n uint8: Uint8Array,\n uint8clamped: Uint8ClampedArray\n};\nSoATypeRegistry.TYPE_BYTES = {\n float32: 4,\n float64: 8,\n int32: 4,\n uint32: 4,\n int16: 2,\n uint16: 2,\n int8: 1,\n uint8: 1,\n uint8clamped: 1\n};\n//# sourceMappingURL=SoATypeRegistry.js.map","import { createLogger } from '../../Utils/Logger';\n/**\n * SoA 序列化器\n * 负责复杂类型的序列化/反序列化和深拷贝\n */\nexport class SoASerializer {\n /**\n * 序列化值为 JSON 字符串\n */\n static serialize(value, fieldName, options = {}) {\n try {\n if (options.isMap && value instanceof Map) {\n return JSON.stringify(Array.from(value.entries()));\n }\n if (options.isSet && value instanceof Set) {\n return JSON.stringify(Array.from(value));\n }\n if (options.isArray && Array.isArray(value)) {\n return JSON.stringify(value);\n }\n return JSON.stringify(value);\n }\n catch (error) {\n this._logger.warn(`SoA序列化字段 ${fieldName} 失败:`, error);\n return '{}';\n }\n }\n /**\n * 反序列化 JSON 字符串为值\n */\n static deserialize(serialized, fieldName, options = {}) {\n try {\n const parsed = JSON.parse(serialized);\n if (options.isMap) {\n return new Map(parsed);\n }\n if (options.isSet) {\n return new Set(parsed);\n }\n return parsed;\n }\n catch (error) {\n this._logger.warn(`SoA反序列化字段 ${fieldName} 失败:`, error);\n return null;\n }\n }\n /**\n * 深拷贝对象\n */\n static deepClone(obj) {\n if (obj === null || typeof obj !== 'object') {\n return obj;\n }\n if (obj instanceof Date) {\n return new Date(obj.getTime());\n }\n if (Array.isArray(obj)) {\n return obj.map((item) => this.deepClone(item));\n }\n if (obj instanceof Map) {\n const cloned = new Map();\n for (const [key, value] of obj.entries()) {\n cloned.set(key, this.deepClone(value));\n }\n return cloned;\n }\n if (obj instanceof Set) {\n const cloned = new Set();\n for (const value of obj.values()) {\n cloned.add(this.deepClone(value));\n }\n return cloned;\n }\n // 普通对象\n const cloned = {};\n for (const key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n cloned[key] = this.deepClone(obj[key]);\n }\n }\n return cloned;\n }\n}\nSoASerializer._logger = createLogger('SoASerializer');\n//# sourceMappingURL=SoASerializer.js.map","import { SoATypeRegistry } from './SoATypeRegistry';\nimport { SoASerializer } from './SoASerializer';\nexport { SoATypeRegistry } from './SoATypeRegistry';\nexport { SoASerializer } from './SoASerializer';\n/**\n * 启用SoA优化装饰器\n * 默认关闭SoA,只有在大规模批量操作场景下才建议开启\n */\nexport function EnableSoA(target) {\n target.__enableSoA = true;\n return target;\n}\n/**\n * 64位浮点数装饰器\n * 标记字段使用Float64Array存储(更高精度但更多内存)\n */\nexport function Float64(target, propertyKey) {\n const key = String(propertyKey);\n if (!target.constructor.__float64Fields) {\n target.constructor.__float64Fields = new Set();\n }\n target.constructor.__float64Fields.add(key);\n}\n/**\n * 32位浮点数装饰器\n * 标记字段使用Float32Array存储(默认类型,平衡性能和精度)\n */\nexport function Float32(target, propertyKey) {\n const key = String(propertyKey);\n if (!target.constructor.__float32Fields) {\n target.constructor.__float32Fields = new Set();\n }\n target.constructor.__float32Fields.add(key);\n}\n/**\n * 32位整数装饰器\n * 标记字段使用Int32Array存储(适用于整数值)\n */\nexport function Int32(target, propertyKey) {\n const key = String(propertyKey);\n if (!target.constructor.__int32Fields) {\n target.constructor.__int32Fields = new Set();\n }\n target.constructor.__int32Fields.add(key);\n}\n/**\n * 32位无符号整数装饰器\n * 标记字段使用Uint32Array存储(适用于无符号整数,如ID、标志位等)\n */\nexport function Uint32(target, propertyKey) {\n const key = String(propertyKey);\n if (!target.constructor.__uint32Fields) {\n target.constructor.__uint32Fields = new Set();\n }\n target.constructor.__uint32Fields.add(key);\n}\n/**\n * 16位整数装饰器\n * 标记字段使用Int16Array存储(适用于小范围整数)\n */\nexport function Int16(target, propertyKey) {\n const key = String(propertyKey);\n if (!target.constructor.__int16Fields) {\n target.constructor.__int16Fields = new Set();\n }\n target.constructor.__int16Fields.add(key);\n}\n/**\n * 16位无符号整数装饰器\n * 标记字段使用Uint16Array存储(适用于小范围无符号整数)\n */\nexport function Uint16(target, propertyKey) {\n const key = String(propertyKey);\n if (!target.constructor.__uint16Fields) {\n target.constructor.__uint16Fields = new Set();\n }\n target.constructor.__uint16Fields.add(key);\n}\n/**\n * 8位整数装饰器\n * 标记字段使用Int8Array存储(适用于很小的整数值)\n */\nexport function Int8(target, propertyKey) {\n const key = String(propertyKey);\n if (!target.constructor.__int8Fields) {\n target.constructor.__int8Fields = new Set();\n }\n target.constructor.__int8Fields.add(key);\n}\n/**\n * 8位无符号整数装饰器\n * 标记字段使用Uint8Array存储(适用于字节值、布尔标志等)\n */\nexport function Uint8(target, propertyKey) {\n const key = String(propertyKey);\n if (!target.constructor.__uint8Fields) {\n target.constructor.__uint8Fields = new Set();\n }\n target.constructor.__uint8Fields.add(key);\n}\n/**\n * 8位夹紧整数装饰器\n * 标记字段使用Uint8ClampedArray存储(适用于颜色值等需要夹紧的数据)\n */\nexport function Uint8Clamped(target, propertyKey) {\n const key = String(propertyKey);\n if (!target.constructor.__uint8ClampedFields) {\n target.constructor.__uint8ClampedFields = new Set();\n }\n target.constructor.__uint8ClampedFields.add(key);\n}\n/**\n * 序列化Map装饰器\n * 标记Map字段需要序列化/反序列化存储\n */\nexport function SerializeMap(target, propertyKey) {\n const key = String(propertyKey);\n if (!target.constructor.__serializeMapFields) {\n target.constructor.__serializeMapFields = new Set();\n }\n target.constructor.__serializeMapFields.add(key);\n}\n/**\n * 序列化Set装饰器\n * 标记Set字段需要序列化/反序列化存储\n */\nexport function SerializeSet(target, propertyKey) {\n const key = String(propertyKey);\n if (!target.constructor.__serializeSetFields) {\n target.constructor.__serializeSetFields = new Set();\n }\n target.constructor.__serializeSetFields.add(key);\n}\n/**\n * 序列化Array装饰器\n * 标记Array字段需要序列化/反序列化存储\n */\nexport function SerializeArray(target, propertyKey) {\n const key = String(propertyKey);\n if (!target.constructor.__serializeArrayFields) {\n target.constructor.__serializeArrayFields = new Set();\n }\n target.constructor.__serializeArrayFields.add(key);\n}\n/**\n * 深拷贝装饰器\n * 标记字段需要深拷贝处理(适用于嵌套对象)\n */\nexport function DeepCopy(target, propertyKey) {\n const key = String(propertyKey);\n if (!target.constructor.__deepCopyFields) {\n target.constructor.__deepCopyFields = new Set();\n }\n target.constructor.__deepCopyFields.add(key);\n}\n/**\n * SoA存储器(需要装饰器启用)\n * 使用Structure of Arrays存储模式,在大规模批量操作时提供优异性能\n */\nexport class SoAStorage {\n constructor(componentType) {\n this.fields = new Map();\n this.stringFields = new Map();\n this.serializedFields = new Map();\n this.complexFields = new Map();\n this.entityToIndex = new Map();\n this.indexToEntity = [];\n this.freeIndices = [];\n this._size = 0;\n this._capacity = 1000;\n // 缓存字段类型信息,避免重复创建实例\n this.fieldTypes = new Map();\n // 缓存装饰器元数据\n this.serializeMapFields = new Set();\n this.serializeSetFields = new Set();\n this.serializeArrayFields = new Set();\n this.type = componentType;\n this.initializeFields(componentType);\n }\n initializeFields(componentType) {\n const instance = new componentType();\n const typeWithMeta = componentType;\n const float64Fields = typeWithMeta.__float64Fields || new Set();\n const float32Fields = typeWithMeta.__float32Fields || new Set();\n const int32Fields = typeWithMeta.__int32Fields || new Set();\n const uint32Fields = typeWithMeta.__uint32Fields || new Set();\n const int16Fields = typeWithMeta.__int16Fields || new Set();\n const uint16Fields = typeWithMeta.__uint16Fields || new Set();\n const int8Fields = typeWithMeta.__int8Fields || new Set();\n const uint8Fields = typeWithMeta.__uint8Fields || new Set();\n const uint8ClampedFields = typeWithMeta.__uint8ClampedFields || new Set();\n // 缓存装饰器元数据\n this.serializeMapFields = typeWithMeta.__serializeMapFields || new Set();\n this.serializeSetFields = typeWithMeta.__serializeSetFields || new Set();\n this.serializeArrayFields = typeWithMeta.__serializeArrayFields || new Set();\n // 先收集所有有装饰器的字段,避免重复遍历\n const decoratedFields = new Map(); // fieldName -> arrayType\n // 处理各类型装饰器标记的字段\n for (const key of float64Fields)\n decoratedFields.set(key, 'float64');\n for (const key of float32Fields)\n decoratedFields.set(key, 'float32');\n for (const key of int32Fields)\n decoratedFields.set(key, 'int32');\n for (const key of uint32Fields)\n decoratedFields.set(key, 'uint32');\n for (const key of int16Fields)\n decoratedFields.set(key, 'int16');\n for (const key of uint16Fields)\n decoratedFields.set(key, 'uint16');\n for (const key of int8Fields)\n decoratedFields.set(key, 'int8');\n for (const key of uint8Fields)\n decoratedFields.set(key, 'uint8');\n for (const key of uint8ClampedFields)\n decoratedFields.set(key, 'uint8clamped');\n // 只遍历实例自身的属性(不包括原型链),跳过 id\n const instanceKeys = Object.keys(instance).filter((key) => key !== 'id');\n for (const key of instanceKeys) {\n const value = instance[key];\n const type = typeof value;\n // 跳过函数(通常不会出现在 Object.keys 中,但以防万一)\n if (type === 'function')\n continue;\n // 检查装饰器类型\n const decoratorType = decoratedFields.get(key);\n const effectiveType = decoratorType ? 'number' : type;\n this.fieldTypes.set(key, effectiveType);\n if (decoratorType) {\n // 有装饰器标记的数字字段\n const ArrayConstructor = SoATypeRegistry.getConstructor(decoratorType);\n this.fields.set(key, new ArrayConstructor(this._capacity));\n }\n else if (type === 'number') {\n // 无装饰器的数字字段,默认使用 Float32Array\n this.fields.set(key, new Float32Array(this._capacity));\n }\n else if (type === 'boolean') {\n // 布尔值使用 Uint8Array 存储为 0/1\n this.fields.set(key, new Uint8Array(this._capacity));\n }\n else if (type === 'string') {\n // 字符串专门处理\n this.stringFields.set(key, new Array(this._capacity));\n }\n else if (type === 'object' && value !== null) {\n // 处理集合类型\n if (this.serializeMapFields.has(key) || this.serializeSetFields.has(key) || this.serializeArrayFields.has(key)) {\n // 序列化存储\n this.serializedFields.set(key, new Array(this._capacity));\n }\n // 其他对象类型会在updateComponentAtIndex中作为复杂对象处理\n }\n }\n }\n addComponent(entityId, component) {\n if (this.entityToIndex.has(entityId)) {\n const index = this.entityToIndex.get(entityId);\n this.updateComponentAtIndex(index, component);\n return;\n }\n let index;\n if (this.freeIndices.length > 0) {\n index = this.freeIndices.pop();\n }\n else {\n index = this._size;\n if (index >= this._capacity) {\n this.resize(this._capacity * 2);\n }\n }\n this.entityToIndex.set(entityId, index);\n this.indexToEntity[index] = entityId;\n this.updateComponentAtIndex(index, component);\n this._size++;\n }\n updateComponentAtIndex(index, component) {\n const entityId = this.indexToEntity[index];\n const complexFieldMap = new Map();\n const highPrecisionFields = this.type.__highPrecisionFields || new Set();\n const serializeMapFields = this.type.__serializeMapFields || new Set();\n const serializeSetFields = this.type.__serializeSetFields || new Set();\n const serializeArrayFields = this.type.__serializeArrayFields || new Set();\n const deepCopyFields = this.type.__deepCopyFields || new Set();\n // 处理所有字段\n for (const key in component) {\n if (component.hasOwnProperty(key) && key !== 'id') {\n const value = component[key];\n const type = typeof value;\n if (type === 'number') {\n if (highPrecisionFields.has(key) || !this.fields.has(key)) {\n // 标记为高精度或未在TypedArray中的数值作为复杂对象存储\n complexFieldMap.set(key, value);\n }\n else {\n // 存储到TypedArray\n const array = this.fields.get(key);\n array[index] = value;\n }\n }\n else if (type === 'boolean' && this.fields.has(key)) {\n // 布尔值存储到TypedArray\n const array = this.fields.get(key);\n array[index] = value ? 1 : 0;\n }\n else if (this.stringFields.has(key)) {\n // 字符串字段专门处理\n const stringArray = this.stringFields.get(key);\n stringArray[index] = String(value);\n }\n else if (this.serializedFields.has(key)) {\n // 序列化字段处理\n const serializedArray = this.serializedFields.get(key);\n serializedArray[index] = SoASerializer.serialize(value, key, {\n isMap: serializeMapFields.has(key),\n isSet: serializeSetFields.has(key),\n isArray: serializeArrayFields.has(key)\n });\n }\n else {\n // 复杂字段单独存储\n if (deepCopyFields.has(key)) {\n // 深拷贝处理\n complexFieldMap.set(key, SoASerializer.deepClone(value));\n }\n else {\n complexFieldMap.set(key, value);\n }\n }\n }\n }\n // 存储复杂字段\n if (complexFieldMap.size > 0) {\n this.complexFields.set(entityId, complexFieldMap);\n }\n }\n getComponent(entityId) {\n const index = this.entityToIndex.get(entityId);\n if (index === undefined) {\n return null;\n }\n // 返回 Proxy,直接操作底层 TypedArray\n return this.createProxyView(entityId, index);\n }\n /**\n * 创建组件的 Proxy 视图\n * 读写操作直接映射到底层 TypedArray,无数据复制\n */\n createProxyView(entityId, index) {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const self = this;\n // Proxy handler 类型定义\n const handler = {\n get(_, prop) {\n const propStr = String(prop);\n // TypedArray 字段\n const array = self.fields.get(propStr);\n if (array) {\n const fieldType = self.getFieldType(propStr);\n if (fieldType === 'boolean') {\n return array[index] === 1;\n }\n return array[index];\n }\n // 字符串字段\n const stringArray = self.stringFields.get(propStr);\n if (stringArray) {\n return stringArray[index];\n }\n // 序列化字段\n const serializedArray = self.serializedFields.get(propStr);\n if (serializedArray) {\n const serialized = serializedArray[index];\n if (serialized) {\n return SoASerializer.deserialize(serialized, propStr, {\n isMap: self.serializeMapFields.has(propStr),\n isSet: self.serializeSetFields.has(propStr),\n isArray: self.serializeArrayFields.has(propStr)\n });\n }\n return undefined;\n }\n // 复杂字段\n const complexFieldMap = self.complexFields.get(entityId);\n if (complexFieldMap?.has(propStr)) {\n return complexFieldMap.get(propStr);\n }\n return undefined;\n },\n set(_, prop, value) {\n const propStr = String(prop);\n // entityId 是只读的\n if (propStr === 'entityId') {\n return false;\n }\n // TypedArray 字段\n const array = self.fields.get(propStr);\n if (array) {\n const fieldType = self.getFieldType(propStr);\n if (fieldType === 'boolean') {\n array[index] = value ? 1 : 0;\n }\n else {\n array[index] = value;\n }\n return true;\n }\n // 字符串字段\n const stringArray = self.stringFields.get(propStr);\n if (stringArray) {\n stringArray[index] = String(value);\n return true;\n }\n // 序列化字段\n if (self.serializedFields.has(propStr)) {\n const serializedArray = self.serializedFields.get(propStr);\n serializedArray[index] = SoASerializer.serialize(value, propStr, {\n isMap: self.serializeMapFields.has(propStr),\n isSet: self.serializeSetFields.has(propStr),\n isArray: self.serializeArrayFields.has(propStr)\n });\n return true;\n }\n // 复杂字段\n let complexFieldMap = self.complexFields.get(entityId);\n if (!complexFieldMap) {\n complexFieldMap = new Map();\n self.complexFields.set(entityId, complexFieldMap);\n }\n complexFieldMap.set(propStr, value);\n return true;\n },\n has(_, prop) {\n const propStr = String(prop);\n return self.fields.has(propStr) ||\n self.stringFields.has(propStr) ||\n self.serializedFields.has(propStr) ||\n self.complexFields.get(entityId)?.has(propStr) || false;\n },\n ownKeys() {\n const keys = [];\n for (const key of self.fields.keys())\n keys.push(key);\n for (const key of self.stringFields.keys())\n keys.push(key);\n for (const key of self.serializedFields.keys())\n keys.push(key);\n const complexFieldMap = self.complexFields.get(entityId);\n if (complexFieldMap) {\n for (const key of complexFieldMap.keys())\n keys.push(key);\n }\n return keys;\n },\n getOwnPropertyDescriptor(_, prop) {\n const propStr = String(prop);\n if (self.fields.has(propStr) ||\n self.stringFields.has(propStr) ||\n self.serializedFields.has(propStr) ||\n self.complexFields.get(entityId)?.has(propStr)) {\n return {\n enumerable: true,\n configurable: true,\n // entityId 是只读的\n writable: propStr !== 'entityId'\n };\n }\n return undefined;\n }\n };\n return new Proxy({}, handler);\n }\n /**\n * 获取组件的快照副本(用于序列化等需要独立副本的场景)\n */\n getComponentSnapshot(entityId) {\n const index = this.entityToIndex.get(entityId);\n if (index === undefined) {\n return null;\n }\n // 需要 any 因为要动态写入泛型 T 的属性\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const component = new this.type();\n // 恢复数值字段\n for (const [fieldName, array] of this.fields.entries()) {\n const value = array[index];\n const fieldType = this.getFieldType(fieldName);\n if (fieldType === 'boolean') {\n component[fieldName] = value === 1;\n }\n else {\n component[fieldName] = value;\n }\n }\n // 恢复字符串字段\n for (const [fieldName, stringArray] of this.stringFields.entries()) {\n component[fieldName] = stringArray[index];\n }\n // 恢复序列化字段\n for (const [fieldName, serializedArray] of this.serializedFields.entries()) {\n const serialized = serializedArray[index];\n if (serialized) {\n component[fieldName] = SoASerializer.deserialize(serialized, fieldName, {\n isMap: this.serializeMapFields.has(fieldName),\n isSet: this.serializeSetFields.has(fieldName),\n isArray: this.serializeArrayFields.has(fieldName)\n });\n }\n }\n // 恢复复杂字段\n const complexFieldMap = this.complexFields.get(entityId);\n if (complexFieldMap) {\n for (const [fieldName, value] of complexFieldMap.entries()) {\n component[fieldName] = value;\n }\n }\n return component;\n }\n getFieldType(fieldName) {\n // 使用缓存的字段类型\n return this.fieldTypes.get(fieldName) || 'unknown';\n }\n hasComponent(entityId) {\n return this.entityToIndex.has(entityId);\n }\n removeComponent(entityId) {\n const index = this.entityToIndex.get(entityId);\n if (index === undefined) {\n return null;\n }\n // 获取组件副本以便返回\n const component = this.getComponent(entityId);\n // 清理复杂字段\n this.complexFields.delete(entityId);\n this.entityToIndex.delete(entityId);\n this.freeIndices.push(index);\n this._size--;\n return component;\n }\n resize(newCapacity) {\n // 调整数值字段的TypedArray\n for (const [fieldName, oldArray] of this.fields.entries()) {\n const newArray = SoATypeRegistry.createSameType(oldArray, newCapacity);\n newArray.set(oldArray);\n this.fields.set(fieldName, newArray);\n }\n // 调整字符串字段的数组\n for (const [fieldName, oldArray] of this.stringFields.entries()) {\n const newArray = new Array(newCapacity);\n for (let i = 0; i < oldArray.length; i++) {\n newArray[i] = oldArray[i];\n }\n this.stringFields.set(fieldName, newArray);\n }\n // 调整序列化字段的数组\n for (const [fieldName, oldArray] of this.serializedFields.entries()) {\n const newArray = new Array(newCapacity);\n for (let i = 0; i < oldArray.length; i++) {\n newArray[i] = oldArray[i];\n }\n this.serializedFields.set(fieldName, newArray);\n }\n this._capacity = newCapacity;\n }\n getActiveIndices() {\n return Array.from(this.entityToIndex.values());\n }\n getFieldArray(fieldName) {\n return this.fields.get(fieldName) || null;\n }\n getTypedFieldArray(fieldName) {\n return this.fields.get(String(fieldName)) || null;\n }\n getEntityIndex(entityId) {\n return this.entityToIndex.get(entityId);\n }\n getEntityIdByIndex(index) {\n return this.indexToEntity[index];\n }\n size() {\n return this._size;\n }\n clear() {\n this.entityToIndex.clear();\n this.indexToEntity = [];\n this.freeIndices = [];\n this.complexFields.clear();\n this._size = 0;\n // 重置数值字段数组\n for (const array of this.fields.values()) {\n array.fill(0);\n }\n // 重置字符串字段数组\n for (const stringArray of this.stringFields.values()) {\n for (let i = 0; i < stringArray.length; i++) {\n stringArray[i] = undefined;\n }\n }\n // 重置序列化字段数组\n for (const serializedArray of this.serializedFields.values()) {\n for (let i = 0; i < serializedArray.length; i++) {\n serializedArray[i] = undefined;\n }\n }\n }\n compact() {\n if (this.freeIndices.length === 0) {\n return;\n }\n const activeEntries = Array.from(this.entityToIndex.entries())\n .sort((a, b) => a[1] - b[1]);\n // 重新映射索引\n const newEntityToIndex = new Map();\n const newIndexToEntity = [];\n for (let newIndex = 0; newIndex < activeEntries.length; newIndex++) {\n const entry = activeEntries[newIndex];\n if (!entry)\n continue;\n const [entityId, oldIndex] = entry;\n newEntityToIndex.set(entityId, newIndex);\n newIndexToEntity[newIndex] = entityId;\n // 移动字段数据\n if (newIndex !== oldIndex) {\n // 移动数值字段\n for (const [, array] of this.fields.entries()) {\n const value = array[oldIndex];\n if (value !== undefined) {\n array[newIndex] = value;\n }\n }\n // 移动字符串字段\n for (const [, stringArray] of this.stringFields.entries()) {\n const value = stringArray[oldIndex];\n if (value !== undefined) {\n stringArray[newIndex] = value;\n }\n }\n // 移动序列化字段\n for (const [, serializedArray] of this.serializedFields.entries()) {\n const value = serializedArray[oldIndex];\n if (value !== undefined) {\n serializedArray[newIndex] = value;\n }\n }\n }\n }\n this.entityToIndex = newEntityToIndex;\n this.indexToEntity = newIndexToEntity;\n this.freeIndices = [];\n this._size = activeEntries.length;\n }\n getStats() {\n let totalMemory = 0;\n const fieldStats = new Map();\n for (const [fieldName, array] of this.fields.entries()) {\n const typeName = SoATypeRegistry.getTypeName(array);\n const bytesPerElement = SoATypeRegistry.getBytesPerElement(typeName);\n const memory = array.length * bytesPerElement;\n totalMemory += memory;\n fieldStats.set(fieldName, {\n size: this._size,\n capacity: array.length,\n type: typeName,\n memory: memory\n });\n }\n return {\n size: this._size,\n capacity: this._capacity,\n usedSlots: this._size, // 兼容原测试\n fragmentation: this.freeIndices.length / this._capacity,\n memoryUsage: totalMemory,\n fieldStats: fieldStats\n };\n }\n /**\n * 执行向量化批量操作\n * @param operation 操作函数,接收字段数组和活跃索引\n */\n performVectorizedOperation(operation) {\n const activeIndices = this.getActiveIndices();\n operation(this.fields, activeIndices);\n }\n}\n//# sourceMappingURL=SoAStorage.js.map","import { __decorate, __metadata } from \"tslib\";\nimport { Int32 } from './Core/SoAStorage';\n/**\n * 游戏组件基类\n *\n * ECS架构中的组件(Component)应该是纯数据容器。\n * 所有游戏逻辑应该在 EntitySystem 中实现,而不是在组件内部。\n *\n * @example\n * 推荐做法:纯数据组件\n * ```typescript\n * class HealthComponent extends Component {\n * public health: number = 100;\n * public maxHealth: number = 100;\n * }\n * ```\n *\n * @example\n * 推荐做法:在 System 中处理逻辑\n * ```typescript\n * class HealthSystem extends EntitySystem {\n * process(entities: Entity[]): void {\n * for (const entity of entities) {\n * const health = entity.getComponent(HealthComponent);\n * if (health && health.health <= 0) {\n * entity.destroy();\n * }\n * }\n * }\n * }\n * ```\n */\nexport class Component {\n /**\n * 创建组件实例\n *\n * 自动分配唯一ID给组件。\n */\n constructor() {\n /**\n * 所属实体ID\n *\n * 存储实体ID而非引用,避免循环引用,符合ECS数据导向设计。\n */\n this.entityId = null;\n this.id = Component.idGenerator++;\n }\n /**\n * 组件添加到实体时的回调\n *\n * 当组件被添加到实体时调用,可以在此方法中进行初始化操作。\n *\n * @remarks\n * 这是一个生命周期钩子,用于组件的初始化逻辑。\n * 虽然保留此方法,但建议将复杂的初始化逻辑放在 System 中处理。\n */\n onAddedToEntity() { }\n /**\n * 组件从实体移除时的回调\n *\n * 当组件从实体中移除时调用,可以在此方法中进行清理操作。\n *\n * @remarks\n * 这是一个生命周期钩子,用于组件的清理逻辑。\n * 虽然保留此方法,但建议将复杂的清理逻辑放在 System 中处理。\n */\n onRemovedFromEntity() { }\n /**\n * 组件反序列化后的回调\n *\n * 当组件从场景文件加载或快照恢复后调用,可以在此方法中恢复运行时数据。\n *\n * @remarks\n * 这是一个生命周期钩子,用于恢复无法序列化的运行时数据。\n * 例如:从图片路径重新加载图片尺寸信息,重建缓存等。\n *\n * @example\n * ```typescript\n * class TilemapComponent extends Component {\n * public tilesetImage: string = '';\n * private _tilesetData: TilesetData | undefined;\n *\n * public async onDeserialized(): Promise<void> {\n * if (this.tilesetImage) {\n * // 重新加载 tileset 图片并恢复运行时数据\n * const img = await loadImage(this.tilesetImage);\n * this.setTilesetInfo(img.width, img.height, ...);\n * }\n * }\n * }\n * ```\n */\n onDeserialized() { }\n}\n/**\n * 组件ID生成器\n *\n * 用于为每个组件分配唯一的ID。\n */\nComponent.idGenerator = 0;\n__decorate([\n Int32,\n __metadata(\"design:type\", Object)\n], Component.prototype, \"entityId\", void 0);\n//# sourceMappingURL=Component.js.map","/**\n * 序列化装饰器\n *\n * 提供组件级别的序列化支持,包括字段级装饰器和类级装饰器\n */\n/**\n * 序列化元数据的Symbol键\n */\nexport const SERIALIZABLE_METADATA = Symbol('SerializableMetadata');\nexport const SERIALIZE_FIELD = Symbol('SerializeField');\nexport const SERIALIZE_OPTIONS = Symbol('SerializeOptions');\n/**\n * 组件可序列化装饰器\n *\n * 标记组件类为可序列化,必须与字段装饰器配合使用\n *\n * @param options 序列化配置选项\n *\n * @example\n * ```typescript\n * @ECSComponent('Player')\n * @Serializable({ version: 1 })\n * class PlayerComponent extends Component {\n * @Serialize() name: string = 'Player';\n * @Serialize() level: number = 1;\n * }\n * ```\n */\nexport function Serializable(options) {\n return function (target) {\n if (!options || typeof options.version !== 'number') {\n throw new Error('Serializable装饰器必须提供有效的版本号');\n }\n // 检查是否有自己的元数据(不是从父类继承的)\n const hasOwnMetadata = Object.prototype.hasOwnProperty.call(target, SERIALIZABLE_METADATA);\n let metadata;\n if (hasOwnMetadata) {\n // 已有自己的元数据,更新 options\n metadata = target[SERIALIZABLE_METADATA];\n metadata.options = options;\n }\n else {\n // 没有自己的元数据,检查是否有继承的元数据\n const inheritedMetadata = target[SERIALIZABLE_METADATA];\n // 创建新的元数据对象(从继承的元数据复制字段,但使用新的 options)\n metadata = {\n options,\n fields: inheritedMetadata ? new Map(inheritedMetadata.fields) : new Map(),\n ignoredFields: inheritedMetadata ? new Set(inheritedMetadata.ignoredFields) : new Set()\n };\n target[SERIALIZABLE_METADATA] = metadata;\n }\n return target;\n };\n}\n/**\n * 字段序列化装饰器\n *\n * 标记字段为可序列化\n *\n * @param options 字段序列化选项(可选)\n *\n * @example\n * ```typescript\n * @Serialize()\n * name: string = 'Player';\n *\n * @Serialize({ alias: 'hp' })\n * health: number = 100;\n * ```\n */\nexport function Serialize(options) {\n return function (target, propertyKey) {\n const constructor = target.constructor;\n // 检查是否有自己的元数据(不是从父类继承的)\n const hasOwnMetadata = Object.prototype.hasOwnProperty.call(constructor, SERIALIZABLE_METADATA);\n let metadata;\n if (hasOwnMetadata) {\n // 已有自己的元数据\n metadata = constructor[SERIALIZABLE_METADATA];\n }\n else {\n // 没有自己的元数据,检查是否有继承的元数据\n const inheritedMetadata = constructor[SERIALIZABLE_METADATA];\n // 创建新的元数据对象(从继承的元数据复制)\n metadata = {\n options: inheritedMetadata ? { ...inheritedMetadata.options } : { version: 1 },\n fields: inheritedMetadata ? new Map(inheritedMetadata.fields) : new Map(),\n ignoredFields: inheritedMetadata ? new Set(inheritedMetadata.ignoredFields) : new Set()\n };\n constructor[SERIALIZABLE_METADATA] = metadata;\n }\n // 记录字段\n metadata.fields.set(propertyKey, options || {});\n };\n}\n/**\n * Map序列化装饰器\n *\n * 专门用于序列化Map类型字段\n *\n * @example\n * ```typescript\n * @SerializeAsMap()\n * inventory: Map<string, number> = new Map();\n * ```\n */\nexport function SerializeAsMap() {\n return function (target, propertyKey) {\n Serialize({\n serializer: (value) => {\n if (!(value instanceof Map)) {\n return null;\n }\n return Array.from(value.entries());\n },\n deserializer: (value) => {\n if (!Array.isArray(value)) {\n return new Map();\n }\n return new Map(value);\n }\n })(target, propertyKey);\n };\n}\n/**\n * Set序列化装饰器\n *\n * 专门用于序列化Set类型字段\n *\n * @example\n * ```typescript\n * @SerializeAsSet()\n * tags: Set<string> = new Set();\n * ```\n */\nexport function SerializeAsSet() {\n return function (target, propertyKey) {\n Serialize({\n serializer: (value) => {\n if (!(value instanceof Set)) {\n return null;\n }\n return Array.from(value);\n },\n deserializer: (value) => {\n if (!Array.isArray(value)) {\n return new Set();\n }\n return new Set(value);\n }\n })(target, propertyKey);\n };\n}\n/**\n * 忽略序列化装饰器\n *\n * 标记字段不参与序列化\n *\n * @example\n * ```typescript\n * @IgnoreSerialization()\n * tempCache: any = null;\n * ```\n */\nexport function IgnoreSerialization() {\n return function (target, propertyKey) {\n const constructor = target.constructor;\n // 检查是否有自己的元数据(不是从父类继承的)\n const hasOwnMetadata = Object.prototype.hasOwnProperty.call(constructor, SERIALIZABLE_METADATA);\n let metadata;\n if (hasOwnMetadata) {\n // 已有自己的元数据\n metadata = constructor[SERIALIZABLE_METADATA];\n }\n else {\n // 没有自己的元数据,检查是否有继承的元数据\n const inheritedMetadata = constructor[SERIALIZABLE_METADATA];\n // 创建新的元数据对象(从继承的元数据复制)\n metadata = {\n options: inheritedMetadata ? { ...inheritedMetadata.options } : { version: 1 },\n fields: inheritedMetadata ? new Map(inheritedMetadata.fields) : new Map(),\n ignoredFields: inheritedMetadata ? new Set(inheritedMetadata.ignoredFields) : new Set()\n };\n constructor[SERIALIZABLE_METADATA] = metadata;\n }\n // 记录忽略字段\n metadata.ignoredFields.add(propertyKey);\n };\n}\n/**\n * 获取组件的序列化元数据\n *\n * @param componentClass 组件类或组件实例\n * @returns 序列化元数据,如果组件不可序列化则返回null\n */\nexport function getSerializationMetadata(componentClass) {\n if (!componentClass) {\n return null;\n }\n // 如果是实例,获取其构造函数\n const constructor = typeof componentClass === 'function'\n ? componentClass\n : componentClass.constructor;\n return constructor[SERIALIZABLE_METADATA] || null;\n}\n/**\n * 检查组件是否可序列化\n *\n * @param component 组件类或组件实例\n * @returns 如果组件可序列化返回true\n */\nexport function isSerializable(component) {\n return getSerializationMetadata(component) !== null;\n}\n//# sourceMappingURL=SerializationDecorators.js.map","import { __decorate, __metadata } from \"tslib\";\nimport { Component } from '../Component';\nimport { ECSComponent } from '../Decorators';\nimport { Serializable, Serialize } from '../Serialization/SerializationDecorators';\n/**\n * 层级关系组件 - 用于建立实体间的父子关系\n *\n * 只有需要层级关系的实体才添加此组件,遵循 ECS 组合原则。\n * 层级操作应通过 HierarchySystem 进行,而非直接修改此组件。\n *\n * @example\n * ```typescript\n * // 通过 HierarchySystem 设置父子关系\n * const hierarchySystem = scene.getSystem(HierarchySystem);\n * hierarchySystem.setParent(childEntity, parentEntity);\n *\n * // 查询层级信息\n * const parent = hierarchySystem.getParent(entity);\n * const children = hierarchySystem.getChildren(entity);\n * ```\n */\nlet HierarchyComponent = class HierarchyComponent extends Component {\n constructor() {\n super(...arguments);\n /**\n * 父实体 ID\n * null 表示根实体(无父级)\n */\n this.parentId = null;\n /**\n * 子实体 ID 列表\n * 顺序即为子级的排列顺序\n */\n this.childIds = [];\n /**\n * 在层级中的深度\n * 根实体深度为 0,由 HierarchySystem 维护\n */\n this.depth = 0;\n /**\n * 层级中是否激活\n * 考虑所有祖先的激活状态,由 HierarchySystem 维护\n */\n this.bActiveInHierarchy = true;\n /**\n * 层级缓存是否脏\n * 用于优化缓存更新\n */\n this.bCacheDirty = true;\n }\n};\n__decorate([\n Serialize(),\n __metadata(\"design:type\", Object)\n], HierarchyComponent.prototype, \"parentId\", void 0);\n__decorate([\n Serialize(),\n __metadata(\"design:type\", Array)\n], HierarchyComponent.prototype, \"childIds\", void 0);\nHierarchyComponent = __decorate([\n ECSComponent('Hierarchy'),\n Serializable({ version: 1, typeId: 'Hierarchy' })\n], HierarchyComponent);\nexport { HierarchyComponent };\n//# sourceMappingURL=HierarchyComponent.js.map","import { getComponentTypeName } from '../Decorators';\n/**\n * 实体匹配条件描述符\n *\n * 用于描述实体查询条件,不执行实际查询\n *\n * @example\n * ```typescript\n * const matcher = Matcher.all(Position, Velocity)\n * .any(Health, Shield)\n * .none(Dead);\n *\n * // 获取查询条件\n * const condition = matcher.getCondition();\n * ```\n */\nexport class Matcher {\n constructor() {\n this.condition = {\n all: [],\n any: [],\n none: []\n };\n // 私有构造函数,只能通过静态方法创建\n }\n /**\n * 创建匹配器,要求所有指定的组件\n * @param types 组件类型\n */\n static all(...types) {\n const matcher = new Matcher();\n return matcher.all(...types);\n }\n /**\n * 创建匹配器,要求至少一个指定的组件\n * @param types 组件类型\n */\n static any(...types) {\n const matcher = new Matcher();\n return matcher.any(...types);\n }\n /**\n * 创建匹配器,排除指定的组件\n * @param types 组件类型\n */\n static none(...types) {\n const matcher = new Matcher();\n return matcher.none(...types);\n }\n /**\n * 创建按标签查询的匙配器\n * @param tag 标签值\n */\n static byTag(tag) {\n const matcher = new Matcher();\n return matcher.withTag(tag);\n }\n /**\n * 创建按名称查询的匙配器\n * @param name 实体名称\n */\n static byName(name) {\n const matcher = new Matcher();\n return matcher.withName(name);\n }\n /**\n * 创建单组件查询的匙配器\n * @param componentType 组件类型\n */\n static byComponent(componentType) {\n const matcher = new Matcher();\n return matcher.withComponent(componentType);\n }\n /**\n * 创建复杂查询构建器\n */\n static complex() {\n return new Matcher();\n }\n /**\n * 创建空匙配器\n */\n static empty() {\n return new Matcher();\n }\n /**\n * 创建不匹配任何实体的匹配器\n * 用于只需要 onBegin/onEnd 生命周期方法但不需要处理实体的系统\n *\n * @example\n * ```typescript\n * // 创建一个只在帧开始时执行的系统\n * class FrameBeginSystem extends EntitySystem {\n * constructor() {\n * super(Matcher.nothing());\n * }\n *\n * protected onBegin(): void {\n * // 每帧开始时执行\n * }\n *\n * protected process(entities: readonly Entity[]): void {\n * // 永远不会被调用,因为没有实体匹配\n * }\n * }\n * ```\n */\n static nothing() {\n const matcher = new Matcher();\n matcher.condition.matchNothing = true;\n return matcher;\n }\n /**\n * 必须包含所有指定组件\n * @param types 组件类型\n */\n all(...types) {\n this.condition.all.push(...types);\n return this;\n }\n /**\n * 必须包含至少一个指定组件\n * @param types 组件类型\n */\n any(...types) {\n this.condition.any.push(...types);\n return this;\n }\n /**\n * 不能包含任何指定组件\n * @param types 组件类型\n */\n none(...types) {\n this.condition.none.push(...types);\n return this;\n }\n /**\n * 排除指定组件(别名方法)\n * @param types 组件类型\n */\n exclude(...types) {\n return this.none(...types);\n }\n /**\n * 至少包含其中之一(别名方法)\n * @param types 组件类型\n */\n one(...types) {\n return this.any(...types);\n }\n /**\n * 按标签查询\n * @param tag 标签值\n */\n withTag(tag) {\n this.condition.tag = tag;\n return this;\n }\n /**\n * 按名称查询\n * @param name 实体名称\n */\n withName(name) {\n this.condition.name = name;\n return this;\n }\n /**\n * 单组件查询\n * @param componentType 组件类型\n */\n withComponent(componentType) {\n this.condition.component = componentType;\n return this;\n }\n /**\n * 移除标签条件\n */\n withoutTag() {\n delete this.condition.tag;\n return this;\n }\n /**\n * 移除名称条件\n */\n withoutName() {\n delete this.condition.name;\n return this;\n }\n /**\n * 移除单组件条件\n */\n withoutComponent() {\n delete this.condition.component;\n return this;\n }\n /**\n * 获取查询条件(只读)\n */\n getCondition() {\n return {\n all: [...this.condition.all],\n any: [...this.condition.any],\n none: [...this.condition.none],\n ...(this.condition.tag !== undefined && { tag: this.condition.tag }),\n ...(this.condition.name !== undefined && { name: this.condition.name }),\n ...(this.condition.component !== undefined && { component: this.condition.component }),\n ...(this.condition.matchNothing && { matchNothing: true })\n };\n }\n /**\n * 检查是否为空条件\n * 注意:matchNothing 不算空条件,因为它是明确的\"不匹配任何实体\"语义\n */\n isEmpty() {\n return this.condition.all.length === 0 &&\n this.condition.any.length === 0 &&\n this.condition.none.length === 0 &&\n this.condition.tag === undefined &&\n this.condition.name === undefined &&\n this.condition.component === undefined &&\n !this.condition.matchNothing;\n }\n /**\n * 检查是否为\"不匹配任何实体\"的匹配器\n */\n isNothing() {\n return this.condition.matchNothing === true;\n }\n /**\n * 重置所有条件\n */\n reset() {\n this.condition.all.length = 0;\n this.condition.any.length = 0;\n this.condition.none.length = 0;\n delete this.condition.tag;\n delete this.condition.name;\n delete this.condition.component;\n delete this.condition.matchNothing;\n return this;\n }\n /**\n * 克隆匹配器\n */\n clone() {\n const cloned = new Matcher();\n cloned.condition.all.push(...this.condition.all);\n cloned.condition.any.push(...this.condition.any);\n cloned.condition.none.push(...this.condition.none);\n if (this.condition.tag !== undefined) {\n cloned.condition.tag = this.condition.tag;\n }\n if (this.condition.name !== undefined) {\n cloned.condition.name = this.condition.name;\n }\n if (this.condition.component !== undefined) {\n cloned.condition.component = this.condition.component;\n }\n if (this.condition.matchNothing) {\n cloned.condition.matchNothing = true;\n }\n return cloned;\n }\n /**\n * 字符串表示\n */\n toString() {\n if (this.condition.matchNothing) {\n return 'Matcher[nothing]';\n }\n const parts = [];\n if (this.condition.all.length > 0) {\n parts.push(`all(${this.condition.all.map((t) => getComponentTypeName(t)).join(', ')})`);\n }\n if (this.condition.any.length > 0) {\n parts.push(`any(${this.condition.any.map((t) => getComponentTypeName(t)).join(', ')})`);\n }\n if (this.condition.none.length > 0) {\n parts.push(`none(${this.condition.none.map((t) => getComponentTypeName(t)).join(', ')})`);\n }\n if (this.condition.tag !== undefined) {\n parts.push(`tag(${this.condition.tag})`);\n }\n if (this.condition.name !== undefined) {\n parts.push(`name(${this.condition.name})`);\n }\n if (this.condition.component !== undefined) {\n parts.push(`component(${getComponentTypeName(this.condition.component)})`);\n }\n return `Matcher[${parts.join(' & ')}]`;\n }\n}\n//# sourceMappingURL=Matcher.js.map","import { createLogger } from '../../Utils/Logger';\nconst logger = createLogger('CommandBuffer');\n/**\n * 延迟命令类型\n * Deferred command type\n */\nexport var CommandType;\n(function (CommandType) {\n /** 添加组件 | Add component */\n CommandType[\"ADD_COMPONENT\"] = \"add_component\";\n /** 移除组件 | Remove component */\n CommandType[\"REMOVE_COMPONENT\"] = \"remove_component\";\n /** 销毁实体 | Destroy entity */\n CommandType[\"DESTROY_ENTITY\"] = \"destroy_entity\";\n /** 设置实体激活状态 | Set entity active state */\n CommandType[\"SET_ENTITY_ACTIVE\"] = \"set_entity_active\";\n})(CommandType || (CommandType = {}));\n/**\n * 命令缓冲区 - 用于延迟执行实体操作\n * Command Buffer - for deferred entity operations\n *\n * 在系统的 process() 方法中使用 CommandBuffer 可以避免迭代过程中修改实体列表,\n * 从而提高性能(无需每帧拷贝数组)并保证迭代安全。\n *\n * Using CommandBuffer in system's process() method avoids modifying entity list during iteration,\n * improving performance (no array copy per frame) and ensuring iteration safety.\n *\n * @example\n * ```typescript\n * class DamageSystem extends EntitySystem {\n * protected process(entities: readonly Entity[]): void {\n * for (const entity of entities) {\n * const health = entity.getComponent(Health);\n * if (health.value <= 0) {\n * // 延迟到帧末执行,不影响当前迭代\n * // Deferred to end of frame, doesn't affect current iteration\n * this.commands.addComponent(entity, new DeadMarker());\n * this.commands.destroyEntity(entity);\n * }\n * }\n * }\n * }\n * ```\n */\nexport class CommandBuffer {\n /**\n * 创建命令缓冲区\n * Create command buffer\n *\n * @param scene - 关联的场景 | Associated scene\n * @param debug - 是否启用调试 | Enable debug\n */\n constructor(scene, debug = false) {\n /** 命令队列 | Command queue */\n this._commands = [];\n /** 关联的场景 | Associated scene */\n this._scene = null;\n /** 是否启用调试日志 | Enable debug logging */\n this._debug = false;\n this._scene = scene ?? null;\n this._debug = debug;\n }\n /**\n * 设置关联的场景\n * Set associated scene\n */\n setScene(scene) {\n this._scene = scene;\n }\n /**\n * 获取关联的场景\n * Get associated scene\n */\n get scene() {\n return this._scene;\n }\n /**\n * 获取待执行的命令数量\n * Get pending command count\n */\n get pendingCount() {\n return this._commands.length;\n }\n /**\n * 检查是否有待执行的命令\n * Check if there are pending commands\n */\n get hasPending() {\n return this._commands.length > 0;\n }\n /**\n * 延迟添加组件\n * Deferred add component\n *\n * @param entity - 目标实体 | Target entity\n * @param component - 要添加的组件 | Component to add\n */\n addComponent(entity, component) {\n this._commands.push({\n type: CommandType.ADD_COMPONENT,\n entity,\n component\n });\n if (this._debug) {\n logger.debug(`CommandBuffer: 延迟添加组件 ${component.constructor.name} 到实体 ${entity.name}`);\n }\n }\n /**\n * 延迟移除组件\n * Deferred remove component\n *\n * @param entity - 目标实体 | Target entity\n * @param componentType - 要移除的组件类型 | Component type to remove\n */\n removeComponent(entity, componentType) {\n this._commands.push({\n type: CommandType.REMOVE_COMPONENT,\n entity,\n componentType\n });\n if (this._debug) {\n logger.debug(`CommandBuffer: 延迟移除组件 ${componentType.name} 从实体 ${entity.name}`);\n }\n }\n /**\n * 延迟销毁实体\n * Deferred destroy entity\n *\n * @param entity - 要销毁的实体 | Entity to destroy\n */\n destroyEntity(entity) {\n this._commands.push({\n type: CommandType.DESTROY_ENTITY,\n entity\n });\n if (this._debug) {\n logger.debug(`CommandBuffer: 延迟销毁实体 ${entity.name}`);\n }\n }\n /**\n * 延迟设置实体激活状态\n * Deferred set entity active state\n *\n * @param entity - 目标实体 | Target entity\n * @param active - 激活状态 | Active state\n */\n setEntityActive(entity, active) {\n this._commands.push({\n type: CommandType.SET_ENTITY_ACTIVE,\n entity,\n value: active\n });\n if (this._debug) {\n logger.debug(`CommandBuffer: 延迟设置实体 ${entity.name} 激活状态为 ${active}`);\n }\n }\n /**\n * 执行所有待处理的命令\n * Execute all pending commands\n *\n * 通常在帧末由 Scene 自动调用。\n * Usually called automatically by Scene at end of frame.\n *\n * @returns 执行的命令数量 | Number of commands executed\n */\n flush() {\n if (this._commands.length === 0) {\n return 0;\n }\n const count = this._commands.length;\n if (this._debug) {\n logger.debug(`CommandBuffer: 开始执行 ${count} 个延迟命令`);\n }\n // 复制命令列表并清空,防止执行过程中有新命令加入\n // Copy and clear command list to prevent new commands during execution\n const commands = this._commands;\n this._commands = [];\n for (const cmd of commands) {\n this.executeCommand(cmd);\n }\n if (this._debug) {\n logger.debug(`CommandBuffer: 完成执行 ${count} 个延迟命令`);\n }\n return count;\n }\n /**\n * 执行单个命令\n * Execute single command\n */\n executeCommand(cmd) {\n // 检查实体是否仍然有效\n // Check if entity is still valid\n if (!cmd.entity.scene) {\n if (this._debug) {\n logger.debug(`CommandBuffer: 跳过命令,实体 ${cmd.entity.name} 已无效`);\n }\n return;\n }\n try {\n switch (cmd.type) {\n case CommandType.ADD_COMPONENT:\n if (cmd.component) {\n cmd.entity.addComponent(cmd.component);\n }\n break;\n case CommandType.REMOVE_COMPONENT:\n if (cmd.componentType) {\n cmd.entity.removeComponentByType(cmd.componentType);\n }\n break;\n case CommandType.DESTROY_ENTITY:\n cmd.entity.destroy();\n break;\n case CommandType.SET_ENTITY_ACTIVE:\n if (cmd.value !== undefined) {\n cmd.entity.active = cmd.value;\n }\n break;\n }\n }\n catch (error) {\n logger.error(`CommandBuffer: 执行命令失败`, { command: cmd, error });\n }\n }\n /**\n * 清空所有待处理的命令(不执行)\n * Clear all pending commands (without executing)\n */\n clear() {\n if (this._debug && this._commands.length > 0) {\n logger.debug(`CommandBuffer: 清空 ${this._commands.length} 个未执行的命令`);\n }\n this._commands.length = 0;\n }\n /**\n * 销毁命令缓冲区\n * Dispose command buffer\n */\n dispose() {\n this.clear();\n this._scene = null;\n }\n}\n//# sourceMappingURL=CommandBuffer.js.map","/**\n * 实体缓存管理器\n *\n * 负责管理 EntitySystem 中的实体缓存,提供帧缓存和持久缓存两级缓存机制。\n * 使用面向对象设计,将数据和行为封装在类中。\n *\n * @example\n * ```typescript\n * const cache = new EntityCache();\n * cache.setPersistent(entities);\n * const cached = cache.getPersistent();\n * cache.invalidate();\n * ```\n */\nexport class EntityCache {\n constructor() {\n /**\n * 帧缓存\n *\n * 在update周期内使用,每帧结束后清理\n */\n this._frameCache = null;\n /**\n * 持久缓存\n *\n * 跨帧使用,直到被显式失效\n */\n this._persistentCache = null;\n /**\n * 被跟踪的实体集合\n *\n * 用于跟踪哪些实体正在被此系统处理\n */\n this._trackedEntities = new Set();\n }\n /**\n * 获取帧缓存\n */\n getFrame() {\n return this._frameCache;\n }\n /**\n * 设置帧缓存\n *\n * @param entities 要缓存的实体列表\n */\n setFrame(entities) {\n this._frameCache = entities;\n }\n /**\n * 获取持久缓存\n */\n getPersistent() {\n return this._persistentCache;\n }\n /**\n * 设置持久缓存\n *\n * @param entities 要缓存的实体列表\n */\n setPersistent(entities) {\n this._persistentCache = entities;\n }\n /**\n * 获取被跟踪的实体集合\n */\n getTracked() {\n return this._trackedEntities;\n }\n /**\n * 添加被跟踪的实体\n *\n * @param entity 要跟踪的实体\n */\n addTracked(entity) {\n this._trackedEntities.add(entity);\n }\n /**\n * 移除被跟踪的实体\n *\n * @param entity 要移除的实体\n */\n removeTracked(entity) {\n this._trackedEntities.delete(entity);\n }\n /**\n * 检查实体是否被跟踪\n *\n * @param entity 要检查的实体\n */\n isTracked(entity) {\n return this._trackedEntities.has(entity);\n }\n /**\n * 使持久缓存失效\n *\n * 当实体变化时调用,强制下次查询时重新计算\n */\n invalidate() {\n this._persistentCache = null;\n }\n /**\n * 清除帧缓存\n *\n * 在每帧结束时调用\n */\n clearFrame() {\n this._frameCache = null;\n }\n /**\n * 清除所有缓存\n *\n * 在系统重置或销毁时调用\n */\n clearAll() {\n this._frameCache = null;\n this._persistentCache = null;\n this._trackedEntities.clear();\n }\n /**\n * 检查是否有有效的持久缓存\n */\n hasPersistent() {\n return this._persistentCache !== null;\n }\n /**\n * 检查是否有有效的帧缓存\n */\n hasFrame() {\n return this._frameCache !== null;\n }\n /**\n * 获取缓存统计信息\n */\n getStats() {\n return {\n hasFrame: this._frameCache !== null,\n hasPersistent: this._persistentCache !== null,\n trackedCount: this._trackedEntities.size,\n frameEntityCount: this._frameCache?.length ?? 0,\n persistentEntityCount: this._persistentCache?.length ?? 0\n };\n }\n}\n//# sourceMappingURL=EntityCache.js.map","import { Matcher } from '../Utils/Matcher';\nimport { getSystemInstanceTypeName } from '../Decorators';\nimport { createLogger } from '../../Utils/Logger';\nimport { EntityCache } from './EntityCache';\nimport { CommandBuffer } from '../Core/CommandBuffer';\n/**\n * 实体系统的基类\n *\n * 用于处理一组符合特定条件的实体。系统是ECS架构中的逻辑处理单元,\n * 负责对拥有特定组件组合的实体执行业务逻辑。\n *\n * 支持泛型参数以提供类型安全的组件访问:\n *\n * @template TComponents - 系统需要的组件类型数组\n *\n * @example\n * ```typescript\n * // 传统方式\n * class MovementSystem extends EntitySystem {\n * constructor() {\n * super(Matcher.empty().all(Transform, Velocity));\n * }\n *\n * protected process(entities: readonly Entity[]): void {\n * for (const entity of entities) {\n * const transform = entity.getComponent(Transform);\n * const velocity = entity.getComponent(Velocity);\n * transform.position.add(velocity.value);\n * }\n * }\n * }\n *\n * // 类型安全方式\n * class MovementSystem extends EntitySystem<[typeof Transform, typeof Velocity]> {\n * constructor() {\n * super(Matcher.empty().all(Transform, Velocity));\n * }\n *\n * protected process(entities: readonly Entity[]): void {\n * for (const entity of entities) {\n * // 类型安全的组件访问\n * const [transform, velocity] = this.getComponents(entity);\n * transform.position.add(velocity.value);\n * }\n * }\n * }\n * ```\n */\nexport class EntitySystem {\n /**\n * 获取系统处理的实体列表\n */\n get entities() {\n // 如果在update周期内,优先使用帧缓存\n const frameCache = this._entityCache.getFrame();\n if (frameCache !== null) {\n return frameCache;\n }\n // 否则使用持久缓存\n if (!this._entityCache.hasPersistent()) {\n this._entityCache.setPersistent(this.queryEntities());\n }\n return this._entityCache.getPersistent();\n }\n /**\n * 获取系统的更新时序\n */\n get updateOrder() {\n return this._updateOrder;\n }\n set updateOrder(value) {\n this.setUpdateOrder(value);\n }\n /**\n * 获取系统的添加顺序\n * Get the add order of the system\n * @internal\n */\n get addOrder() {\n return this._addOrder;\n }\n /**\n * 设置系统的添加顺序(由 Scene 在添加时设置)\n * Set the add order of the system (set by Scene when adding)\n * @internal\n */\n set addOrder(value) {\n this._addOrder = value;\n }\n /**\n * 获取系统的启用状态\n */\n get enabled() {\n return this._enabled;\n }\n /**\n * 设置系统的启用状态\n */\n set enabled(value) {\n this._enabled = value;\n }\n /**\n * 获取系统名称\n */\n get systemName() {\n return this._systemName;\n }\n constructor(matcher) {\n /**\n * 命令缓冲区 - 用于延迟执行实体操作\n * Command buffer - for deferred entity operations\n *\n * 在 process() 中使用 commands 可以避免迭代过程中修改实体列表,\n * 提高性能并保证迭代安全。命令会在帧末由 Scene 统一执行。\n *\n * Using commands in process() avoids modifying entity list during iteration,\n * improving performance and ensuring iteration safety. Commands are executed by Scene at end of frame.\n *\n * @example\n * ```typescript\n * protected process(entities: readonly Entity[]): void {\n * for (const entity of entities) {\n * if (shouldDie(entity)) {\n * // 延迟执行,不影响当前迭代\n * this.commands.destroyEntity(entity);\n * }\n * }\n * }\n * ```\n */\n this.commands = new CommandBuffer();\n this._updateOrder = 0;\n this._addOrder = 0;\n this._enabled = true;\n this._performanceMonitor = null;\n this._systemName = getSystemInstanceTypeName(this);\n this._initialized = false;\n this._matcher = matcher || Matcher.empty();\n this._eventListeners = [];\n this._scene = null;\n this._destroyed = false;\n this._entityIdMap = null;\n this._entityIdMapVersion = -1;\n // 初始化logger\n this.logger = createLogger(this.getLoggerName());\n this._entityCache = new EntityCache();\n }\n /**\n * 这个系统所属的场景\n */\n get scene() {\n return this._scene;\n }\n set scene(value) {\n this._scene = value;\n // 同步更新 CommandBuffer 的场景引用\n // Sync CommandBuffer scene reference\n this.commands.setScene(value);\n }\n /**\n * 设置性能监控器\n */\n setPerformanceMonitor(monitor) {\n this._performanceMonitor = monitor;\n }\n /**\n * 获取性能监控器\n */\n getPerformanceMonitor() {\n if (!this._performanceMonitor) {\n throw new Error(`${this._systemName}: PerformanceMonitor未注入,请确保在Core.create()之后再添加System到Scene`);\n }\n return this._performanceMonitor;\n }\n /**\n * 获取实体匹配器\n */\n get matcher() {\n return this._matcher;\n }\n /**\n * 设置更新时序\n * @param order 更新时序\n */\n setUpdateOrder(order) {\n if (this._updateOrder === order)\n return;\n this._updateOrder = order;\n this._scene?.markSystemsOrderDirty();\n }\n /**\n * 系统初始化(框架调用)\n *\n * 在系统创建时调用。框架内部使用,用户不应直接调用。\n */\n initialize() {\n // 防止重复初始化 | Prevent re-initialization\n if (this._initialized) {\n return;\n }\n this._initialized = true;\n // 框架内部初始化:触发一次实体查询,以便正确跟踪现有实体\n // Framework initialization: query entities once to track existing entities\n if (this.scene) {\n // 清理缓存确保初始化时重新查询 | Clear cache to ensure fresh query\n this._entityCache.invalidate();\n const entities = this.queryEntities();\n // 初始化时对已存在的匹配实体触发 onAdded\n // Trigger onAdded for existing matching entities during initialization\n for (const entity of entities) {\n this.onAdded(entity);\n }\n }\n // 调用用户可重写的初始化方法 | Call user-overridable initialization method\n this.onInitialize();\n }\n /**\n * 系统初始化回调\n *\n * 子类可以重写此方法进行初始化操作。\n */\n onInitialize() {\n // 子类可以重写此方法进行初始化\n }\n /**\n * 清除实体缓存(内部使用)\n * 当Scene中的实体发生变化时调用\n */\n clearEntityCache() {\n this._entityCache.invalidate();\n }\n /**\n * 完全重置实体跟踪状态\n * 清除所有缓存和跟踪的实体,强制下次 update 时重新扫描所有实体并触发 onAdded\n * 用于场景重载/预览重置等场景\n */\n resetEntityTracking() {\n this._entityCache.clearAll();\n this._entityIdMap = null;\n this._entityIdMapVersion = -1;\n }\n /**\n * 重置系统状态\n *\n * 当系统从场景中移除时调用,重置初始化状态以便重新添加时能正确初始化。\n *\n * 注意:此方法由 Scene.removeEntityProcessor 调用,在 unregister(触发dispose)之后调用。\n * dispose 已经调用了 onDestroy 并设置了 _destroyed 标志,所以这里不需要重置该标志。\n * 重置 _destroyed 会违反服务容器的语义(dispose 后不应重用)。\n */\n reset() {\n // 如果系统已经被销毁,不需要再次调用destroy\n if (this._destroyed) {\n return;\n }\n this.scene = null;\n this._initialized = false;\n this._entityCache.clearAll();\n // 清理实体ID映射缓存\n this._entityIdMap = null;\n this._entityIdMapVersion = -1;\n // 清理所有事件监听器并调用销毁回调\n this.destroy();\n }\n /**\n * 查询匹配的实体\n */\n queryEntities() {\n if (!this.scene?.querySystem || !this._matcher) {\n return [];\n }\n const condition = this._matcher.getCondition();\n const querySystem = this.scene.querySystem;\n let currentEntities = [];\n // matchNothing 条件返回空数组(用于只需要生命周期方法的系统)\n if (this._matcher.isNothing()) {\n return [];\n }\n // 空条件返回所有实体\n if (this._matcher.isEmpty()) {\n currentEntities = querySystem.getAllEntities();\n }\n else if (this.isSingleCondition(condition)) {\n // 单一条件优化查询\n currentEntities = this.executeSingleConditionQuery(condition, querySystem);\n }\n else {\n // 复合查询\n currentEntities = this.executeComplexQuery(condition, querySystem);\n }\n // 检查实体变化并触发回调\n this.updateEntityTracking(currentEntities);\n return currentEntities;\n }\n /**\n * 检查是否为单一条件查询\n *\n * 使用位运算优化多条件检测。将每种查询条件映射到不同的位:\n * - all: 第0位 (1)\n * - any: 第1位 (2)\n * - none: 第2位 (4)\n * - tag: 第3位 (8)\n * - name: 第4位 (16)\n * - component: 第5位 (32)\n */\n isSingleCondition(condition) {\n // 使用位OR运算合并所有条件标记\n const flags = (condition.all.length > 0 ? 1 : 0) |\n (condition.any.length > 0 ? 2 : 0) |\n (condition.none.length > 0 ? 4 : 0) |\n (condition.tag !== undefined ? 8 : 0) |\n (condition.name !== undefined ? 16 : 0) |\n (condition.component !== undefined ? 32 : 0);\n // 位运算技巧:如果只有一个位被设置,则 flags & (flags - 1) == 0\n // 例如:flags=4 (100), flags-1=3 (011), 4&3=0\n // 但如果 flags=6 (110), flags-1=5 (101), 6&5=4≠0\n return flags !== 0 && (flags & (flags - 1)) === 0;\n }\n /**\n * 执行单一条件查询\n */\n executeSingleConditionQuery(condition, querySystem) {\n // 按标签查询\n if (condition.tag !== undefined) {\n return querySystem.queryByTag(condition.tag).entities;\n }\n // 按名称查询\n if (condition.name !== undefined) {\n return querySystem.queryByName(condition.name).entities;\n }\n // 单组件查询\n if (condition.component !== undefined) {\n return querySystem.queryByComponent(condition.component).entities;\n }\n // 基础组件查询\n if (condition.all.length > 0 && condition.any.length === 0 && condition.none.length === 0) {\n return querySystem.queryAll(...condition.all).entities;\n }\n if (condition.all.length === 0 && condition.any.length > 0 && condition.none.length === 0) {\n return querySystem.queryAny(...condition.any).entities;\n }\n if (condition.all.length === 0 && condition.any.length === 0 && condition.none.length > 0) {\n return querySystem.queryNone(...condition.none).entities;\n }\n return [];\n }\n /**\n * 执行复合查询\n */\n executeComplexQueryWithIdSets(condition, querySystem) {\n let resultIds = null;\n // 1. 应用标签条件作为基础集合\n if (condition.tag !== undefined) {\n const tagResult = querySystem.queryByTag(condition.tag);\n resultIds = this.extractEntityIds(tagResult.entities);\n }\n // 2. 应用名称条件 (交集)\n if (condition.name !== undefined) {\n const nameIds = this.extractEntityIds(querySystem.queryByName(condition.name).entities);\n resultIds = resultIds ? this.intersectIdSets(resultIds, nameIds) : nameIds;\n }\n // 3. 应用单组件条件 (交集)\n if (condition.component !== undefined) {\n const componentIds = this.extractEntityIds(querySystem.queryByComponent(condition.component).entities);\n resultIds = resultIds ? this.intersectIdSets(resultIds, componentIds) : componentIds;\n }\n // 4. 应用all条件 (交集)\n if (condition.all.length > 0) {\n const allIds = this.extractEntityIds(querySystem.queryAll(...condition.all).entities);\n resultIds = resultIds ? this.intersectIdSets(resultIds, allIds) : allIds;\n }\n // 5. 应用any条件 (交集)\n if (condition.any.length > 0) {\n const anyIds = this.extractEntityIds(querySystem.queryAny(...condition.any).entities);\n resultIds = resultIds ? this.intersectIdSets(resultIds, anyIds) : anyIds;\n }\n // 6. 应用none条件 (差集)\n if (condition.none.length > 0) {\n if (!resultIds) {\n resultIds = this.extractEntityIds(querySystem.getAllEntities());\n }\n const noneResult = querySystem.queryAny(...condition.none);\n const noneIds = this.extractEntityIds(noneResult.entities);\n resultIds = this.differenceIdSets(resultIds, noneIds);\n }\n return resultIds ? this.idSetToEntityArray(resultIds, querySystem.getAllEntities()) : [];\n }\n /**\n * 提取实体ID集合\n */\n extractEntityIds(entities) {\n const len = entities.length;\n const idSet = new Set();\n for (let i = 0; i < len; i = (i + 1) | 0) {\n idSet.add(entities[i].id | 0);\n }\n return idSet;\n }\n /**\n * ID集合交集运算\n */\n intersectIdSets(setA, setB) {\n let smaller, larger;\n if (setA.size <= setB.size) {\n smaller = setA;\n larger = setB;\n }\n else {\n smaller = setB;\n larger = setA;\n }\n const result = new Set();\n for (const id of smaller) {\n if (larger.has(id)) {\n result.add(id);\n }\n }\n return result;\n }\n /**\n * ID集合差集运算\n */\n differenceIdSets(setA, setB) {\n const result = new Set();\n for (const id of setA) {\n if (!setB.has(id)) {\n result.add(id);\n }\n }\n return result;\n }\n /**\n * 获取或构建实体ID映射\n */\n getEntityIdMap(allEntities) {\n const currentVersion = this.scene?.querySystem?.version ?? 0;\n if (this._entityIdMap !== null && this._entityIdMapVersion === currentVersion) {\n return this._entityIdMap;\n }\n return this.rebuildEntityIdMap(allEntities, currentVersion);\n }\n /**\n * 重建实体ID映射\n */\n rebuildEntityIdMap(allEntities, version) {\n let entityMap = this._entityIdMap;\n if (!entityMap) {\n entityMap = new Map();\n }\n else {\n entityMap.clear();\n }\n const len = allEntities.length;\n for (let i = 0; i < len; i = (i + 1) | 0) {\n const entity = allEntities[i];\n entityMap.set(entity.id | 0, entity);\n }\n this._entityIdMap = entityMap;\n this._entityIdMapVersion = version;\n return entityMap;\n }\n /**\n * 从ID集合构建Entity数组\n */\n idSetToEntityArray(idSet, allEntities) {\n const entityMap = this.getEntityIdMap(allEntities);\n const size = idSet.size;\n const result = new Array(size);\n let index = 0;\n for (const id of idSet) {\n const entity = entityMap.get(id);\n if (entity !== undefined) {\n result[index] = entity;\n index = (index + 1) | 0;\n }\n }\n if (index < size) {\n result.length = index;\n }\n return result;\n }\n /**\n * 执行复合查询\n *\n * 使用基于ID集合的单次扫描算法进行复杂查询\n */\n executeComplexQuery(condition, querySystem) {\n return this.executeComplexQueryWithIdSets(condition, querySystem);\n }\n /**\n * 更新系统\n */\n update() {\n if (!this._enabled || !this.onCheckProcessing()) {\n return;\n }\n const monitor = this.getPerformanceMonitor();\n const startTime = monitor.startMonitoring(this._systemName);\n let entityCount = 0;\n try {\n this.onBegin();\n // 查询实体并存储到帧缓存中\n // ReactiveQuery.getEntities() 返回的是安全快照,只在实体变化时才创建新数组\n // ReactiveQuery.getEntities() returns a safe snapshot, only creates new array when entities change\n const entities = this.queryEntities();\n this._entityCache.setFrame(entities);\n entityCount = entities.length;\n this.process(entities);\n }\n finally {\n monitor.endMonitoring(this._systemName, startTime, entityCount);\n }\n }\n /**\n * 后期更新系统\n */\n lateUpdate() {\n if (!this._enabled || !this.onCheckProcessing()) {\n return;\n }\n const monitor = this.getPerformanceMonitor();\n const startTime = monitor.startMonitoring(`${this._systemName}_Late`);\n let entityCount = 0;\n try {\n // 重新查询实体以获取最新列表\n // 在 update 和 lateUpdate 之间可能有新组件被添加(事件驱动设计)\n // Re-query entities to get the latest list\n // New components may have been added between update and lateUpdate (event-driven design)\n // ReactiveQuery.getEntities() 返回的是安全快照,只在实体变化时才创建新数组\n const entities = this.queryEntities();\n this._entityCache.setFrame(entities);\n entityCount = entities.length;\n this.lateProcess(entities);\n this.onEnd();\n }\n finally {\n monitor.endMonitoring(`${this._systemName}_Late`, startTime, entityCount);\n // 清理帧缓存\n this._entityCache.clearFrame();\n }\n }\n /**\n * 执行命令缓冲区中的所有延迟命令\n * Flush all deferred commands in the command buffer\n *\n * 由 Scene 在帧末自动调用。\n * Called automatically by Scene at end of frame.\n *\n * @returns 执行的命令数量 | Number of commands executed\n */\n flushCommands() {\n return this.commands.flush();\n }\n /**\n * 在系统处理开始前调用\n *\n * 子类可以重写此方法进行预处理操作。\n */\n onBegin() {\n // 子类可以重写此方法\n }\n /**\n * 处理实体列表\n *\n * 系统的核心逻辑,子类必须实现此方法来定义具体的处理逻辑。\n *\n * @param entities 要处理的实体列表\n */\n process(_entities) {\n // 子类必须实现此方法\n }\n /**\n * 后期处理实体列表\n *\n * 在主要处理逻辑之后执行,子类可以重写此方法。\n *\n * @param entities 要处理的实体列表\n */\n lateProcess(_entities) {\n // 子类可以重写此方法\n }\n /**\n * 系统处理完毕后调用\n *\n * 子类可以重写此方法进行后处理操作。\n */\n onEnd() {\n // 子类可以重写此方法\n }\n /**\n * 检查系统是否需要处理\n *\n * 在启用系统时有用,但仅偶尔需要处理。\n * 这只影响处理,不影响事件或订阅列表。\n *\n * @returns 如果系统应该处理,则为true,如果不处理则为false\n */\n onCheckProcessing() {\n return true;\n }\n /**\n * 获取系统的性能数据\n *\n * @returns 性能数据或undefined\n */\n getPerformanceData() {\n return this.getPerformanceMonitor().getSystemData(this._systemName);\n }\n /**\n * 获取系统的性能统计\n *\n * @returns 性能统计或undefined\n */\n getPerformanceStats() {\n return this.getPerformanceMonitor().getSystemStats(this._systemName);\n }\n /**\n * 重置系统的性能数据\n */\n resetPerformanceData() {\n this.getPerformanceMonitor().resetSystem(this._systemName);\n }\n /**\n * 获取系统信息的字符串表示\n *\n * @returns 系统信息字符串\n */\n toString() {\n const entityCount = this.entities.length;\n const perfData = this.getPerformanceData();\n const perfInfo = perfData ? ` (${perfData.executionTime.toFixed(2)}ms)` : '';\n return `${this._systemName}[${entityCount} entities]${perfInfo}`;\n }\n /**\n * 检查实体是否匹配当前系统的查询条件\n * Check if an entity matches this system's query condition\n *\n * @param entity 要检查的实体 / The entity to check\n * @returns 是否匹配 / Whether the entity matches\n */\n matchesEntity(entity) {\n if (!this._matcher) {\n return false;\n }\n // nothing 匹配器不匹配任何实体\n if (this._matcher.isNothing()) {\n return false;\n }\n // 空匹配器匹配所有实体\n if (this._matcher.isEmpty()) {\n return true;\n }\n const condition = this._matcher.getCondition();\n // 检查 all 条件\n for (const componentType of condition.all) {\n if (!entity.hasComponent(componentType)) {\n return false;\n }\n }\n // 检查 any 条件\n if (condition.any.length > 0) {\n let hasAny = false;\n for (const componentType of condition.any) {\n if (entity.hasComponent(componentType)) {\n hasAny = true;\n break;\n }\n }\n if (!hasAny) {\n return false;\n }\n }\n // 检查 none 条件\n for (const componentType of condition.none) {\n if (entity.hasComponent(componentType)) {\n return false;\n }\n }\n // 检查 tag 条件\n if (condition.tag !== undefined && entity.tag !== condition.tag) {\n return false;\n }\n // 检查 name 条件\n if (condition.name !== undefined && entity.name !== condition.name) {\n return false;\n }\n // 检查单组件条件\n if (condition.component !== undefined && !entity.hasComponent(condition.component)) {\n return false;\n }\n return true;\n }\n /**\n * 检查实体是否正在被此系统跟踪\n * Check if an entity is being tracked by this system\n *\n * @param entity 要检查的实体 / The entity to check\n * @returns 是否正在跟踪 / Whether the entity is being tracked\n */\n isTracking(entity) {\n return this._entityCache.isTracked(entity);\n }\n /**\n * 当实体的组件发生变化时由 Scene 调用\n *\n * 立即检查实体是否匹配并触发 onAdded/onRemoved 回调。\n * 这是事件驱动设计的核心:组件变化时立即通知相关系统。\n *\n * Called by Scene when an entity's components change.\n * Immediately checks if the entity matches and triggers onAdded/onRemoved callbacks.\n * This is the core of event-driven design: notify relevant systems immediately when components change.\n *\n * @param entity 组件发生变化的实体 / The entity whose components changed\n * @internal 由 Scene.notifyEntityComponentChanged 调用 / Called by Scene.notifyEntityComponentChanged\n */\n handleEntityComponentChanged(entity) {\n if (!this._matcher || !this._enabled) {\n return;\n }\n const wasTracked = this._entityCache.isTracked(entity);\n const nowMatches = this.matchesEntity(entity);\n if (!wasTracked && nowMatches) {\n // 新匹配:添加跟踪并触发 onAdded | New match: add tracking and trigger onAdded\n this._entityCache.addTracked(entity);\n this._entityCache.invalidate();\n this.onAdded(entity);\n }\n else if (wasTracked && !nowMatches) {\n // 不再匹配:移除跟踪并触发 onRemoved | No longer matches: remove tracking and trigger onRemoved\n this._entityCache.removeTracked(entity);\n this._entityCache.invalidate();\n this.onRemoved(entity);\n }\n }\n /**\n * 更新实体跟踪,检查新增和移除的实体\n *\n * 由于采用了事件驱动设计,运行时的 onAdded/onRemoved 已在 handleEntityComponentChanged 中\n * 立即触发。此方法不再触发回调,只同步跟踪状态。\n *\n * With event-driven design, runtime onAdded/onRemoved are triggered immediately in\n * handleEntityComponentChanged. This method no longer triggers callbacks, only syncs tracking state.\n */\n updateEntityTracking(currentEntities) {\n const currentSet = new Set(currentEntities);\n let hasChanged = false;\n // 检查新增的实体 | Check for newly added entities\n for (const entity of currentEntities) {\n if (!this._entityCache.isTracked(entity)) {\n this._entityCache.addTracked(entity);\n hasChanged = true;\n }\n }\n // 检查移除的实体 | Check for removed entities\n for (const entity of this._entityCache.getTracked()) {\n if (!currentSet.has(entity)) {\n this._entityCache.removeTracked(entity);\n hasChanged = true;\n }\n }\n // 如果实体发生了变化,使缓存失效 | If entities changed, invalidate cache\n if (hasChanged) {\n this._entityCache.invalidate();\n }\n }\n /**\n * 当实体被添加到系统时调用\n *\n * 子类可以重写此方法来处理实体添加事件。\n *\n * @param entity 被添加的实体\n */\n onAdded(_entity) {\n // 子类可以重写此方法\n }\n /**\n * 当实体从系统中移除时调用\n *\n * 子类可以重写此方法来处理实体移除事件。\n *\n * @param entity 被移除的实体\n */\n onRemoved(_entity) {\n // 子类可以重写此方法\n }\n /**\n * 释放系统资源\n *\n * 实现IService接口要求的dispose方法。\n * 当系统从Scene中移除或Scene销毁时调用。\n *\n * 默认行为:\n * - 移除所有事件监听器\n * - 调用 onDestroy 回调(仅首次)\n * - 清空所有缓存\n * - 重置初始化状态\n *\n * 子类可以重写此方法来清理自定义资源,但应该调用super.dispose()。\n */\n dispose() {\n // 防止重复销毁\n if (this._destroyed) {\n return;\n }\n // 移除所有事件监听器\n this.cleanupManualEventListeners();\n // 调用用户销毁回调\n this.onDestroy();\n // 清空所有缓存\n this._entityCache.clearAll();\n this._entityIdMap = null;\n // 清理命令缓冲区\n // Clear command buffer\n this.commands.dispose();\n // 重置状态\n this._initialized = false;\n this._scene = null;\n this._destroyed = true;\n this.logger.debug(`System ${this._systemName} disposed`);\n }\n /**\n * 添加事件监听器\n *\n * 推荐使用此方法而不是直接调用eventSystem.on(),\n * 这样可以确保系统移除时自动清理监听器,避免内存泄漏。\n *\n * @param eventType 事件类型\n * @param handler 事件处理函数\n * @param config 监听器配置\n * @returns 监听器引用ID,可用于手动移除监听器\n */\n addEventListener(eventType, handler, config) {\n if (!this.scene?.eventSystem) {\n this.logger.warn(`${this.systemName}: 无法添加事件监听器,scene.eventSystem 不可用`);\n return null;\n }\n const listenerRef = this.scene.eventSystem.on(eventType, handler, config);\n // 跟踪监听器以便后续清理\n if (listenerRef) {\n this._eventListeners.push({\n eventSystem: this.scene.eventSystem,\n eventType,\n listenerRef\n });\n }\n return listenerRef;\n }\n /**\n * 移除特定的事件监听器\n *\n * @param eventType 事件类型\n * @param listenerRef 监听器引用ID(由 addEventListener 返回)\n */\n removeEventListener(eventType, listenerRef) {\n const listenerIndex = this._eventListeners.findIndex((listener) => listener.eventType === eventType && listener.listenerRef === listenerRef);\n if (listenerIndex >= 0) {\n const listener = this._eventListeners[listenerIndex];\n if (!listener)\n return;\n // 从事件系统中移除\n listener.eventSystem.off(eventType, listener.listenerRef);\n // 从跟踪列表中移除\n this._eventListeners.splice(listenerIndex, 1);\n }\n }\n /**\n * 清理手动添加的事件监听器\n */\n cleanupManualEventListeners() {\n for (const listener of this._eventListeners) {\n try {\n listener.eventSystem.off(listener.eventType, listener.listenerRef);\n }\n catch (error) {\n this.logger.warn(`${this.systemName}: 移除事件监听器失败 \"${listener.eventType}\"`, error);\n }\n }\n // 清空跟踪列表\n this._eventListeners.length = 0;\n }\n /**\n * 框架内部销毁方法\n * 由框架调用,处理系统的完整销毁流程\n */\n destroy() {\n // 防止重复销毁\n if (this._destroyed) {\n return;\n }\n this.cleanupManualEventListeners();\n this._destroyed = true;\n this.onDestroy();\n }\n /**\n * 获取Logger名称\n * 默认返回类的构造函数名称, 子类可以重写此方法来自定义logger名称\n */\n getLoggerName() {\n return getSystemInstanceTypeName(this);\n }\n /**\n * 用户销毁回调\n *\n * 当系统从场景中移除时调用,子类可以重写此方法进行清理操作。\n * 注意:事件监听器会被框架自动清理,无需手动处理。\n */\n onDestroy() {\n // 子类可以重写此方法进行清理操作\n }\n /**\n * 类型安全地获取单个组件\n *\n * 相比Entity.getComponent,此方法保证返回非空值,\n * 如果组件不存在会抛出错误而不是返回null\n *\n * @param entity 实体\n * @param componentType 组件类型\n * @returns 组件实例(保证非空)\n * @throws 如果组件不存在则抛出错误\n *\n * @example\n * ```typescript\n * protected process(entities: readonly Entity[]): void {\n * for (const entity of entities) {\n * const transform = this.requireComponent(entity, Transform);\n * // transform 保证非空,类型为 Transform\n * }\n * }\n * ```\n */\n requireComponent(entity, componentType) {\n const component = entity.getComponent(componentType);\n if (!component) {\n throw new Error(`Component ${componentType.name} not found on entity ${entity.name} in ${this.systemName}`);\n }\n return component;\n }\n /**\n * 批量获取实体的所有必需组件\n *\n * 根据泛型参数TComponents推断返回类型,\n * 返回一个元组,包含所有组件实例\n *\n * @param entity 实体\n * @param components 组件类型数组\n * @returns 组件实例元组\n *\n * @example\n * ```typescript\n * class MySystem extends EntitySystem<[typeof Position, typeof Velocity]> {\n * protected process(entities: readonly Entity[]): void {\n * for (const entity of entities) {\n * const [pos, vel] = this.getComponents(entity, Position, Velocity);\n * // pos: Position, vel: Velocity (自动类型推断)\n * pos.x += vel.x;\n * }\n * }\n * }\n * ```\n */\n getComponents(entity, ...components) {\n return components.map((type) => this.requireComponent(entity, type));\n }\n /**\n * 遍历实体并处理每个实体\n *\n * 提供更简洁的语法糖,避免手动遍历\n *\n * @param entities 实体列表\n * @param processor 处理函数\n *\n * @example\n * ```typescript\n * protected process(entities: readonly Entity[]): void {\n * this.forEach(entities, (entity) => {\n * const transform = this.requireComponent(entity, Transform);\n * transform.position.y -= 9.8 * Time.deltaTime;\n * });\n * }\n * ```\n */\n forEach(entities, processor) {\n for (let i = 0; i < entities.length; i++) {\n processor(entities[i], i);\n }\n }\n /**\n * 过滤实体\n *\n * @param entities 实体列表\n * @param predicate 过滤条件\n * @returns 过滤后的实体数组\n *\n * @example\n * ```typescript\n * protected process(entities: readonly Entity[]): void {\n * const activeEntities = this.filterEntities(entities, (entity) => {\n * const health = this.requireComponent(entity, Health);\n * return health.value > 0;\n * });\n * }\n * ```\n */\n filterEntities(entities, predicate) {\n return Array.from(entities).filter(predicate);\n }\n /**\n * 映射实体到另一种类型\n *\n * @param entities 实体列表\n * @param mapper 映射函数\n * @returns 映射后的结果数组\n *\n * @example\n * ```typescript\n * protected process(entities: readonly Entity[]): void {\n * const positions = this.mapEntities(entities, (entity) => {\n * const transform = this.requireComponent(entity, Transform);\n * return transform.position;\n * });\n * }\n * ```\n */\n mapEntities(entities, mapper) {\n return Array.from(entities).map(mapper);\n }\n /**\n * 查找第一个满足条件的实体\n *\n * @param entities 实体列表\n * @param predicate 查找条件\n * @returns 第一个满足条件的实体,或undefined\n *\n * @example\n * ```typescript\n * protected process(entities: readonly Entity[]): void {\n * const player = this.findEntity(entities, (entity) =>\n * entity.hasComponent(PlayerTag)\n * );\n * }\n * ```\n */\n findEntity(entities, predicate) {\n for (let i = 0; i < entities.length; i++) {\n if (predicate(entities[i], i)) {\n return entities[i];\n }\n }\n return undefined;\n }\n /**\n * 检查是否存在满足条件的实体\n *\n * @param entities 实体列表\n * @param predicate 检查条件\n * @returns 是否存在满足条件的实体\n *\n * @example\n * ```typescript\n * protected process(entities: readonly Entity[]): void {\n * const hasLowHealth = this.someEntity(entities, (entity) => {\n * const health = this.requireComponent(entity, Health);\n * return health.value < 20;\n * });\n * }\n * ```\n */\n someEntity(entities, predicate) {\n for (let i = 0; i < entities.length; i++) {\n if (predicate(entities[i], i)) {\n return true;\n }\n }\n return false;\n }\n /**\n * 检查是否所有实体都满足条件\n *\n * @param entities 实体列表\n * @param predicate 检查条件\n * @returns 是否所有实体都满足条件\n *\n * @example\n * ```typescript\n * protected process(entities: readonly Entity[]): void {\n * const allHealthy = this.everyEntity(entities, (entity) => {\n * const health = this.requireComponent(entity, Health);\n * return health.value > 50;\n * });\n * }\n * ```\n */\n everyEntity(entities, predicate) {\n for (let i = 0; i < entities.length; i++) {\n if (!predicate(entities[i], i)) {\n return false;\n }\n }\n return true;\n }\n}\n//# sourceMappingURL=EntitySystem.js.map","import { EntitySystem } from './EntitySystem';\nimport { Matcher } from '../Utils/Matcher';\nimport { HierarchyComponent } from '../Components/HierarchyComponent';\n/**\n * 层级关系系统 - 管理实体间的父子关系\n *\n * 提供层级操作的统一 API,维护层级缓存(depth、activeInHierarchy)。\n * 所有层级操作应通过此系统进行,而非直接修改 HierarchyComponent。\n *\n * @example\n * ```typescript\n * const hierarchySystem = scene.getSystem(HierarchySystem);\n *\n * // 设置父子关系\n * hierarchySystem.setParent(child, parent);\n *\n * // 查询层级\n * const parent = hierarchySystem.getParent(entity);\n * const children = hierarchySystem.getChildren(entity);\n * const depth = hierarchySystem.getDepth(entity);\n * ```\n */\nexport class HierarchySystem extends EntitySystem {\n constructor() {\n super(Matcher.empty().all(HierarchyComponent));\n /**\n * 脏实体集合 - 只有这些实体需要在 process() 中更新缓存\n * Dirty entity set - only these entities need cache update in process()\n */\n this.dirtyEntities = new Set();\n }\n /**\n * 系统优先级,确保在其他系统之前更新层级缓存\n */\n get updateOrder() {\n return -1000;\n }\n process(_entities) {\n // 只更新脏实体,不遍历所有实体 | Only update dirty entities, no full iteration\n if (this.dirtyEntities.size === 0) {\n return;\n }\n for (const entity of this.dirtyEntities) {\n // 确保实体仍然有效 | Ensure entity is still valid\n if (entity.scene) {\n this.updateHierarchyCache(entity);\n }\n }\n this.dirtyEntities.clear();\n }\n /**\n * 设置实体的父级\n *\n * @param child - 子实体\n * @param parent - 父实体,null 表示移动到根级\n */\n setParent(child, parent) {\n let childHierarchy = child.getComponent(HierarchyComponent);\n // 如果子实体没有 HierarchyComponent,自动添加\n if (!childHierarchy) {\n childHierarchy = new HierarchyComponent();\n child.addComponent(childHierarchy);\n }\n // 检查是否需要变更\n const currentParentId = childHierarchy.parentId;\n const newParentId = parent?.id ?? null;\n if (currentParentId === newParentId) {\n return;\n }\n // 防止循环引用\n if (parent && this.isAncestorOf(child, parent)) {\n throw new Error('Cannot set parent: would create circular reference');\n }\n // 从旧父级移除\n if (currentParentId !== null) {\n const oldParent = this.scene?.findEntityById(currentParentId);\n if (oldParent) {\n const oldParentHierarchy = oldParent.getComponent(HierarchyComponent);\n if (oldParentHierarchy) {\n const idx = oldParentHierarchy.childIds.indexOf(child.id);\n if (idx !== -1) {\n oldParentHierarchy.childIds.splice(idx, 1);\n }\n }\n }\n }\n // 添加到新父级\n if (parent) {\n let parentHierarchy = parent.getComponent(HierarchyComponent);\n if (!parentHierarchy) {\n parentHierarchy = new HierarchyComponent();\n parent.addComponent(parentHierarchy);\n }\n childHierarchy.parentId = parent.id;\n parentHierarchy.childIds.push(child.id);\n }\n else {\n childHierarchy.parentId = null;\n }\n // 标记缓存脏\n this.markCacheDirty(child);\n }\n /**\n * 在指定位置插入子实体\n *\n * @param parent - 父实体\n * @param child - 子实体\n * @param index - 插入位置索引,-1 表示追加到末尾\n */\n insertChildAt(parent, child, index) {\n let childHierarchy = child.getComponent(HierarchyComponent);\n let parentHierarchy = parent.getComponent(HierarchyComponent);\n // 自动添加 HierarchyComponent\n if (!childHierarchy) {\n childHierarchy = new HierarchyComponent();\n child.addComponent(childHierarchy);\n }\n if (!parentHierarchy) {\n parentHierarchy = new HierarchyComponent();\n parent.addComponent(parentHierarchy);\n }\n // 防止循环引用\n if (this.isAncestorOf(child, parent)) {\n throw new Error('Cannot set parent: would create circular reference');\n }\n // 从旧父级移除\n if (childHierarchy.parentId !== null && childHierarchy.parentId !== parent.id) {\n const oldParent = this.scene?.findEntityById(childHierarchy.parentId);\n if (oldParent) {\n const oldParentHierarchy = oldParent.getComponent(HierarchyComponent);\n if (oldParentHierarchy) {\n const idx = oldParentHierarchy.childIds.indexOf(child.id);\n if (idx !== -1) {\n oldParentHierarchy.childIds.splice(idx, 1);\n }\n }\n }\n }\n // 设置新父级\n childHierarchy.parentId = parent.id;\n // 从当前父级的子列表中移除(如果已存在)\n const existingIdx = parentHierarchy.childIds.indexOf(child.id);\n if (existingIdx !== -1) {\n parentHierarchy.childIds.splice(existingIdx, 1);\n }\n // 插入到指定位置\n if (index < 0 || index >= parentHierarchy.childIds.length) {\n parentHierarchy.childIds.push(child.id);\n }\n else {\n parentHierarchy.childIds.splice(index, 0, child.id);\n }\n // 标记缓存脏\n this.markCacheDirty(child);\n }\n /**\n * 移除子实体(将其移动到根级)\n */\n removeChild(parent, child) {\n const parentHierarchy = parent.getComponent(HierarchyComponent);\n const childHierarchy = child.getComponent(HierarchyComponent);\n if (!parentHierarchy || !childHierarchy) {\n return false;\n }\n if (childHierarchy.parentId !== parent.id) {\n return false;\n }\n const idx = parentHierarchy.childIds.indexOf(child.id);\n if (idx !== -1) {\n parentHierarchy.childIds.splice(idx, 1);\n }\n childHierarchy.parentId = null;\n this.markCacheDirty(child);\n return true;\n }\n /**\n * 移除所有子实体\n */\n removeAllChildren(parent) {\n const parentHierarchy = parent.getComponent(HierarchyComponent);\n if (!parentHierarchy)\n return;\n const childIds = [...parentHierarchy.childIds];\n for (const childId of childIds) {\n const child = this.scene?.findEntityById(childId);\n if (child) {\n this.removeChild(parent, child);\n }\n }\n }\n /**\n * 获取实体的父级\n */\n getParent(entity) {\n const hierarchy = entity.getComponent(HierarchyComponent);\n if (!hierarchy || hierarchy.parentId === null) {\n return null;\n }\n return this.scene?.findEntityById(hierarchy.parentId) ?? null;\n }\n /**\n * 获取实体的子级列表\n */\n getChildren(entity) {\n const hierarchy = entity.getComponent(HierarchyComponent);\n if (!hierarchy)\n return [];\n const children = [];\n for (const childId of hierarchy.childIds) {\n const child = this.scene?.findEntityById(childId);\n if (child) {\n children.push(child);\n }\n }\n return children;\n }\n /**\n * 获取子级数量\n */\n getChildCount(entity) {\n const hierarchy = entity.getComponent(HierarchyComponent);\n return hierarchy?.childIds.length ?? 0;\n }\n /**\n * 检查实体是否有子级\n */\n hasChildren(entity) {\n return this.getChildCount(entity) > 0;\n }\n /**\n * 检查 ancestor 是否是 entity 的祖先\n */\n isAncestorOf(ancestor, entity) {\n let current = this.getParent(entity);\n let depth = 0;\n while (current && depth < HierarchySystem.MAX_DEPTH) {\n if (current.id === ancestor.id) {\n return true;\n }\n current = this.getParent(current);\n depth++;\n }\n return false;\n }\n /**\n * 检查 descendant 是否是 entity 的后代\n */\n isDescendantOf(descendant, entity) {\n return this.isAncestorOf(entity, descendant);\n }\n /**\n * 获取根实体\n */\n getRoot(entity) {\n let current = entity;\n let parent = this.getParent(current);\n let depth = 0;\n while (parent && depth < HierarchySystem.MAX_DEPTH) {\n current = parent;\n parent = this.getParent(current);\n depth++;\n }\n return current;\n }\n /**\n * 获取实体在层级中的深度\n */\n getDepth(entity) {\n const hierarchy = entity.getComponent(HierarchyComponent);\n if (!hierarchy)\n return 0;\n // 如果缓存有效,直接返回\n if (!hierarchy.bCacheDirty) {\n return hierarchy.depth;\n }\n // 重新计算\n let depth = 0;\n let current = this.getParent(entity);\n while (current && depth < HierarchySystem.MAX_DEPTH) {\n depth++;\n current = this.getParent(current);\n }\n hierarchy.depth = depth;\n return depth;\n }\n /**\n * 检查实体在层级中是否激活\n */\n isActiveInHierarchy(entity) {\n if (!entity.active)\n return false;\n const hierarchy = entity.getComponent(HierarchyComponent);\n if (!hierarchy)\n return entity.active;\n // 如果缓存有效,直接返回\n if (!hierarchy.bCacheDirty) {\n return hierarchy.bActiveInHierarchy;\n }\n // 重新计算\n const parent = this.getParent(entity);\n if (!parent) {\n hierarchy.bActiveInHierarchy = entity.active;\n }\n else {\n hierarchy.bActiveInHierarchy = entity.active && this.isActiveInHierarchy(parent);\n }\n return hierarchy.bActiveInHierarchy;\n }\n /**\n * 获取所有根实体(没有父级的实体)\n */\n getRootEntities() {\n const roots = [];\n for (const entity of this.entities) {\n const hierarchy = entity.getComponent(HierarchyComponent);\n if (hierarchy && hierarchy.parentId === null) {\n roots.push(entity);\n }\n }\n return roots;\n }\n /**\n * 根据名称查找子实体\n *\n * @param entity - 父实体\n * @param name - 子实体名称\n * @param bRecursive - 是否递归查找\n */\n findChild(entity, name, bRecursive = false) {\n const children = this.getChildren(entity);\n for (const child of children) {\n if (child.name === name) {\n return child;\n }\n }\n if (bRecursive) {\n for (const child of children) {\n const found = this.findChild(child, name, true);\n if (found) {\n return found;\n }\n }\n }\n return null;\n }\n /**\n * 根据标签查找子实体\n *\n * @param entity - 父实体\n * @param tag - 标签值\n * @param bRecursive - 是否递归查找\n */\n findChildrenByTag(entity, tag, bRecursive = false) {\n const result = [];\n const children = this.getChildren(entity);\n for (const child of children) {\n if ((child.tag & tag) !== 0) {\n result.push(child);\n }\n if (bRecursive) {\n result.push(...this.findChildrenByTag(child, tag, true));\n }\n }\n return result;\n }\n /**\n * 遍历所有子级\n *\n * @param entity - 父实体\n * @param callback - 回调函数\n * @param bRecursive - 是否递归遍历\n */\n forEachChild(entity, callback, bRecursive = false) {\n const children = this.getChildren(entity);\n for (const child of children) {\n callback(child);\n if (bRecursive) {\n this.forEachChild(child, callback, true);\n }\n }\n }\n /**\n * 扁平化层级树(用于虚拟化渲染)\n *\n * @param expandedIds - 展开的实体 ID 集合\n * @returns 扁平化的节点列表\n */\n flattenHierarchy(expandedIds) {\n const result = [];\n const traverse = (entity, depth) => {\n const bHasChildren = this.hasChildren(entity);\n const bIsExpanded = expandedIds.has(entity.id);\n result.push({\n entity,\n depth,\n bHasChildren,\n bIsExpanded\n });\n if (bHasChildren && bIsExpanded) {\n for (const child of this.getChildren(entity)) {\n traverse(child, depth + 1);\n }\n }\n };\n for (const root of this.getRootEntities()) {\n traverse(root, 0);\n }\n return result;\n }\n /**\n * 标记缓存为脏,并添加到脏实体集合\n * Mark cache as dirty and add to dirty entity set\n */\n markCacheDirty(entity) {\n const hierarchy = entity.getComponent(HierarchyComponent);\n if (!hierarchy)\n return;\n // 如果已经是脏的,跳过(避免重复递归)\n // Skip if already dirty (avoid redundant recursion)\n if (hierarchy.bCacheDirty)\n return;\n hierarchy.bCacheDirty = true;\n this.dirtyEntities.add(entity);\n // 递归标记所有子级 | Recursively mark all children\n for (const childId of hierarchy.childIds) {\n const child = this.scene?.findEntityById(childId);\n if (child) {\n this.markCacheDirty(child);\n }\n }\n }\n /**\n * 更新层级缓存\n */\n updateHierarchyCache(entity) {\n const hierarchy = entity.getComponent(HierarchyComponent);\n if (!hierarchy)\n return;\n // 计算深度\n hierarchy.depth = this.getDepth(entity);\n // 计算激活状态\n hierarchy.bActiveInHierarchy = this.isActiveInHierarchy(entity);\n // 标记缓存有效\n hierarchy.bCacheDirty = false;\n }\n /**\n * 当实体被添加到系统时,将其加入脏集合\n * When entity is added to system, add it to dirty set\n */\n onAdded(entity) {\n const hierarchy = entity.getComponent(HierarchyComponent);\n if (hierarchy && hierarchy.bCacheDirty) {\n this.dirtyEntities.add(entity);\n }\n }\n /**\n * 当实体被移除时清理层级关系\n * When entity is removed, clean up hierarchy relationships\n */\n onRemoved(entity) {\n // 从脏集合中移除 | Remove from dirty set\n this.dirtyEntities.delete(entity);\n const hierarchy = entity.getComponent(HierarchyComponent);\n if (!hierarchy)\n return;\n // 从父级移除 | Remove from parent\n if (hierarchy.parentId !== null) {\n const parent = this.scene?.findEntityById(hierarchy.parentId);\n if (parent) {\n const parentHierarchy = parent.getComponent(HierarchyComponent);\n if (parentHierarchy) {\n const idx = parentHierarchy.childIds.indexOf(entity.id);\n if (idx !== -1) {\n parentHierarchy.childIds.splice(idx, 1);\n }\n }\n }\n }\n // 处理子级:将子级移动到根级\n // Handle children: move children to root level\n for (const childId of hierarchy.childIds) {\n const child = this.scene?.findEntityById(childId);\n if (child) {\n const childHierarchy = child.getComponent(HierarchyComponent);\n if (childHierarchy) {\n childHierarchy.parentId = null;\n this.markCacheDirty(child);\n }\n }\n }\n }\n dispose() {\n // 清理脏实体集合 | Clear dirty entity set\n this.dirtyEntities.clear();\n }\n}\nHierarchySystem.MAX_DEPTH = 32;\n//# sourceMappingURL=HierarchySystem.js.map","import { getComponentInstanceTypeName } from '../../ECS/Decorators';\nimport { HierarchyComponent } from '../../ECS/Components/HierarchyComponent';\nimport { HierarchySystem } from '../../ECS/Systems/HierarchySystem';\n/**\n * 实体数据收集器\n */\nexport class EntityDataCollector {\n /**\n * 收集实体数据\n * @param scene 场景实例\n */\n collectEntityData(scene) {\n if (!scene) {\n return this.getEmptyEntityDebugData();\n }\n const entityList = scene.entities;\n if (!entityList) {\n return this.getEmptyEntityDebugData();\n }\n let stats;\n try {\n stats = entityList.getStats ? entityList.getStats() : this.calculateFallbackEntityStats(entityList);\n }\n catch (error) {\n return {\n totalEntities: 0,\n activeEntities: 0,\n pendingAdd: 0,\n pendingRemove: 0,\n entitiesPerArchetype: [],\n topEntitiesByComponents: [],\n entityHierarchy: [],\n entityDetailsMap: {}\n };\n }\n const archetypeData = this.collectArchetypeData(scene);\n return {\n totalEntities: stats.totalEntities,\n activeEntities: stats.activeEntities,\n pendingAdd: stats.pendingAdd || 0,\n pendingRemove: stats.pendingRemove || 0,\n entitiesPerArchetype: archetypeData.distribution,\n topEntitiesByComponents: archetypeData.topEntities,\n entityHierarchy: [],\n entityDetailsMap: {}\n };\n }\n /**\n * 获取原始实体列表\n * @param scene 场景实例\n */\n getRawEntityList(scene) {\n if (!scene)\n return [];\n const entityList = scene.entities;\n if (!entityList?.buffer)\n return [];\n const hierarchySystem = scene.getSystem(HierarchySystem);\n return entityList.buffer.map((entity) => {\n const hierarchy = entity.getComponent(HierarchyComponent);\n const bActiveInHierarchy = hierarchySystem?.isActiveInHierarchy(entity) ?? entity.active;\n const depth = hierarchySystem?.getDepth(entity) ?? 0;\n return {\n id: entity.id,\n name: entity.name || `Entity_${entity.id}`,\n active: entity.active !== false,\n enabled: entity.enabled !== false,\n activeInHierarchy: bActiveInHierarchy,\n componentCount: entity.components.length,\n componentTypes: entity.components.map((component) => getComponentInstanceTypeName(component)),\n parentId: hierarchy?.parentId ?? null,\n childIds: hierarchy?.childIds ?? [],\n depth,\n tag: entity.tag || 0,\n updateOrder: entity.updateOrder || 0\n };\n });\n }\n /**\n * 获取实体详细信息\n * @param entityId 实体ID\n * @param scene 场景实例\n */\n getEntityDetails(entityId, scene) {\n try {\n if (!scene)\n return null;\n const entityList = scene.entities;\n if (!entityList?.buffer)\n return null;\n const entity = entityList.buffer.find((e) => e.id === entityId);\n if (!entity)\n return null;\n const baseDebugInfo = entity.getDebugInfo\n ? entity.getDebugInfo()\n : this.buildFallbackEntityInfo(entity, scene);\n const componentDetails = this.extractComponentDetails(entity.components);\n const sceneInfo = this.getSceneInfo(scene);\n return {\n ...baseDebugInfo,\n scene: sceneInfo.name,\n sceneName: sceneInfo.name,\n sceneType: sceneInfo.type,\n parentName: entity.parent?.name || null,\n components: componentDetails || [],\n componentCount: entity.components?.length || 0,\n componentTypes: entity.components?.map((comp) => getComponentInstanceTypeName(comp)) || []\n };\n }\n catch (error) {\n return {\n error: `获取实体详情失败: ${error instanceof Error ? error.message : String(error)}`,\n scene: '获取失败',\n components: [],\n componentCount: 0,\n componentTypes: []\n };\n }\n }\n getSceneInfo(scene) {\n let sceneName = '当前场景';\n let sceneType = 'Scene';\n try {\n if (scene.name && typeof scene.name === 'string' && scene.name.trim()) {\n sceneName = scene.name.trim();\n }\n else if (scene.constructor && scene.constructor.name) {\n sceneName = scene.constructor.name;\n sceneType = scene.constructor.name;\n }\n else if (scene._name && typeof scene._name === 'string' && scene._name.trim()) {\n sceneName = scene._name.trim();\n }\n else {\n const sceneClassName = Object.getPrototypeOf(scene)?.constructor?.name;\n if (sceneClassName && sceneClassName !== 'Object') {\n sceneName = sceneClassName;\n sceneType = sceneClassName;\n }\n }\n }\n catch (error) {\n sceneName = '场景名获取失败';\n }\n return { name: sceneName, type: sceneType };\n }\n /**\n * 收集实体数据(包含内存信息)\n * @param scene 场景实例\n */\n collectEntityDataWithMemory(scene) {\n if (!scene) {\n return this.getEmptyEntityDebugData();\n }\n const entityList = scene.entities;\n if (!entityList) {\n return this.getEmptyEntityDebugData();\n }\n let stats;\n try {\n stats = entityList.getStats ? entityList.getStats() : this.calculateFallbackEntityStats(entityList);\n }\n catch (error) {\n return {\n totalEntities: 0,\n activeEntities: 0,\n pendingAdd: 0,\n pendingRemove: 0,\n entitiesPerArchetype: [],\n topEntitiesByComponents: [],\n entityHierarchy: [],\n entityDetailsMap: {}\n };\n }\n const archetypeData = this.collectArchetypeDataWithMemory(scene);\n return {\n totalEntities: stats.totalEntities,\n activeEntities: stats.activeEntities,\n pendingAdd: stats.pendingAdd || 0,\n pendingRemove: stats.pendingRemove || 0,\n entitiesPerArchetype: archetypeData.distribution,\n topEntitiesByComponents: archetypeData.topEntities,\n entityHierarchy: this.buildEntityHierarchyTree(entityList, scene),\n entityDetailsMap: this.buildEntityDetailsMap(entityList, scene)\n };\n }\n collectArchetypeData(scene) {\n if (scene && scene.archetypeSystem && typeof scene.archetypeSystem.getAllArchetypes === 'function') {\n return this.extractArchetypeStatistics(scene.archetypeSystem);\n }\n const entityContainer = { entities: scene.entities?.buffer || [] };\n return {\n distribution: this.getArchetypeDistributionFast(entityContainer),\n topEntities: this.getTopEntitiesByComponentsFast(entityContainer)\n };\n }\n getArchetypeDistributionFast(entityContainer) {\n const distribution = new Map();\n if (entityContainer && entityContainer.entities) {\n entityContainer.entities.forEach((entity) => {\n const componentTypes = entity.components?.map((comp) => getComponentInstanceTypeName(comp)) || [];\n const signature = componentTypes.length > 0 ? componentTypes.sort().join(', ') : '无组件';\n const existing = distribution.get(signature);\n if (existing) {\n existing.count++;\n }\n else {\n distribution.set(signature, { count: 1, componentTypes });\n }\n });\n }\n return Array.from(distribution.entries())\n .map(([signature, data]) => ({\n signature,\n count: data.count,\n memory: 0\n }))\n .sort((a, b) => b.count - a.count)\n .slice(0, 20);\n }\n getTopEntitiesByComponentsFast(entityContainer) {\n if (!entityContainer || !entityContainer.entities) {\n return [];\n }\n return entityContainer.entities\n .map((entity) => ({\n id: entity.id.toString(),\n name: entity.name || `Entity_${entity.id}`,\n componentCount: entity.components?.length || 0,\n memory: 0\n }))\n .sort((a, b) => b.componentCount - a.componentCount);\n }\n collectArchetypeDataWithMemory(scene) {\n if (scene && scene.archetypeSystem && typeof scene.archetypeSystem.getAllArchetypes === 'function') {\n return this.extractArchetypeStatisticsWithMemory(scene.archetypeSystem);\n }\n const entityContainer = { entities: scene.entities?.buffer || [] };\n return {\n distribution: this.getArchetypeDistributionWithMemory(entityContainer),\n topEntities: this.getTopEntitiesByComponentsWithMemory(entityContainer)\n };\n }\n extractArchetypeStatistics(archetypeSystem) {\n const archetypes = archetypeSystem.getAllArchetypes();\n const distribution = [];\n const topEntities = [];\n archetypes.forEach((archetype) => {\n const signature = archetype.componentTypes?.map((type) => type.name).join(',') || 'Unknown';\n const entityCount = archetype.entities?.length || 0;\n distribution.push({\n signature,\n count: entityCount,\n memory: 0\n });\n if (archetype.entities) {\n archetype.entities.forEach((entity) => {\n topEntities.push({\n id: entity.id.toString(),\n name: entity.name || `Entity_${entity.id}`,\n componentCount: entity.components?.length || 0,\n memory: 0\n });\n });\n }\n });\n distribution.sort((a, b) => b.count - a.count);\n topEntities.sort((a, b) => b.componentCount - a.componentCount);\n return { distribution, topEntities };\n }\n extractArchetypeStatisticsWithMemory(archetypeSystem) {\n const archetypes = archetypeSystem.getAllArchetypes();\n const distribution = [];\n const topEntities = [];\n archetypes.forEach((archetype) => {\n const signature = archetype.componentTypes?.map((type) => type.name).join(',') || 'Unknown';\n const entityCount = archetype.entities?.length || 0;\n let actualMemory = 0;\n if (archetype.entities && archetype.entities.length > 0) {\n const sampleSize = Math.min(5, archetype.entities.length);\n let sampleMemory = 0;\n for (let i = 0; i < sampleSize; i++) {\n sampleMemory += this.estimateEntityMemoryUsage(archetype.entities[i]);\n }\n actualMemory = (sampleMemory / sampleSize) * entityCount;\n }\n distribution.push({\n signature,\n count: entityCount,\n memory: actualMemory\n });\n if (archetype.entities) {\n archetype.entities.forEach((entity) => {\n topEntities.push({\n id: entity.id.toString(),\n name: entity.name || `Entity_${entity.id}`,\n componentCount: entity.components?.length || 0,\n memory: this.estimateEntityMemoryUsage(entity)\n });\n });\n }\n });\n distribution.sort((a, b) => b.count - a.count);\n topEntities.sort((a, b) => b.componentCount - a.componentCount);\n return { distribution, topEntities };\n }\n getArchetypeDistributionWithMemory(entityContainer) {\n const distribution = new Map();\n if (entityContainer && entityContainer.entities) {\n entityContainer.entities.forEach((entity) => {\n const componentTypes = entity.components?.map((comp) => getComponentInstanceTypeName(comp)) || [];\n const signature = componentTypes.length > 0 ? componentTypes.sort().join(', ') : '无组件';\n const existing = distribution.get(signature);\n let memory = this.estimateEntityMemoryUsage(entity);\n if (isNaN(memory) || memory < 0) {\n memory = 0;\n }\n if (existing) {\n existing.count++;\n existing.memory += memory;\n }\n else {\n distribution.set(signature, { count: 1, memory, componentTypes });\n }\n });\n }\n return Array.from(distribution.entries())\n .map(([signature, data]) => ({\n signature,\n count: data.count,\n memory: isNaN(data.memory) ? 0 : data.memory\n }))\n .sort((a, b) => b.count - a.count);\n }\n getTopEntitiesByComponentsWithMemory(entityContainer) {\n if (!entityContainer || !entityContainer.entities) {\n return [];\n }\n return entityContainer.entities\n .map((entity) => ({\n id: entity.id.toString(),\n name: entity.name || `Entity_${entity.id}`,\n componentCount: entity.components?.length || 0,\n memory: this.estimateEntityMemoryUsage(entity)\n }))\n .sort((a, b) => b.componentCount - a.componentCount);\n }\n getEmptyEntityDebugData() {\n return {\n totalEntities: 0,\n activeEntities: 0,\n pendingAdd: 0,\n pendingRemove: 0,\n entitiesPerArchetype: [],\n topEntitiesByComponents: [],\n entityHierarchy: [],\n entityDetailsMap: {}\n };\n }\n calculateFallbackEntityStats(entityList) {\n const allEntities = entityList.buffer || [];\n const activeEntities = allEntities.filter((entity) => entity.enabled && !entity.isDestroyed);\n return {\n totalEntities: allEntities.length,\n activeEntities: activeEntities.length,\n pendingAdd: 0,\n pendingRemove: 0,\n averageComponentsPerEntity: activeEntities.length > 0\n ? allEntities.reduce((sum, e) => sum + (e.components?.length || 0), 0) /\n activeEntities.length\n : 0\n };\n }\n estimateEntityMemoryUsage(entity) {\n try {\n let totalSize = 0;\n const entitySize = this.calculateObjectSize(entity, ['components', 'children', 'parent']);\n if (!isNaN(entitySize) && entitySize > 0) {\n totalSize += entitySize;\n }\n if (entity.components && Array.isArray(entity.components)) {\n entity.components.forEach((component) => {\n const componentSize = this.calculateObjectSize(component, ['entity']);\n if (!isNaN(componentSize) && componentSize > 0) {\n totalSize += componentSize;\n }\n });\n }\n return isNaN(totalSize) || totalSize < 0 ? 0 : totalSize;\n }\n catch (error) {\n return 0;\n }\n }\n calculateObjectSize(obj, excludeKeys = []) {\n if (!obj || typeof obj !== 'object')\n return 0;\n const visited = new WeakSet();\n const maxDepth = 2;\n const calculate = (item, depth = 0) => {\n if (!item || typeof item !== 'object' || depth >= maxDepth) {\n return 0;\n }\n if (visited.has(item))\n return 0;\n visited.add(item);\n let itemSize = 32;\n try {\n const keys = Object.keys(item);\n const maxKeys = Math.min(keys.length, 20);\n for (let i = 0; i < maxKeys; i++) {\n const key = keys[i];\n if (!key ||\n excludeKeys.includes(key) ||\n key === 'constructor' ||\n key === '__proto__' ||\n key.startsWith('_cc_') ||\n key.startsWith('__')) {\n continue;\n }\n const value = item[key];\n itemSize += key.length * 2;\n if (typeof value === 'string') {\n itemSize += Math.min(value.length * 2, 200);\n }\n else if (typeof value === 'number') {\n itemSize += 8;\n }\n else if (typeof value === 'boolean') {\n itemSize += 4;\n }\n else if (Array.isArray(value)) {\n itemSize += 40 + Math.min(value.length * 8, 160);\n }\n else if (typeof value === 'object' && value !== null) {\n itemSize += calculate(value, depth + 1);\n }\n }\n }\n catch (error) {\n return 64;\n }\n return itemSize;\n };\n try {\n const size = calculate(obj);\n return Math.max(size, 32);\n }\n catch (error) {\n return 64;\n }\n }\n buildEntityHierarchyTree(entityList, scene) {\n if (!entityList?.buffer)\n return [];\n const hierarchySystem = scene?.getSystem(HierarchySystem);\n const rootEntities = [];\n entityList.buffer.forEach((entity) => {\n const hierarchy = entity.getComponent(HierarchyComponent);\n const bHasNoParent = hierarchy?.parentId === null || hierarchy?.parentId === undefined;\n if (bHasNoParent) {\n const hierarchyNode = this.buildEntityHierarchyNode(entity, hierarchySystem);\n rootEntities.push(hierarchyNode);\n }\n });\n // 按实体名称排序,提供一致的显示顺序\n rootEntities.sort((nodeA, nodeB) => {\n if (nodeA.name < nodeB.name)\n return -1;\n if (nodeA.name > nodeB.name)\n return 1;\n return nodeA.id - nodeB.id;\n });\n return rootEntities;\n }\n /**\n * 构建实体层次结构节点\n */\n buildEntityHierarchyNode(entity, hierarchySystem) {\n const hierarchy = entity.getComponent(HierarchyComponent);\n const bActiveInHierarchy = hierarchySystem?.isActiveInHierarchy(entity) ?? entity.active;\n const depth = hierarchySystem?.getDepth(entity) ?? 0;\n let node = {\n id: entity.id,\n name: entity.name || `Entity_${entity.id}`,\n active: entity.active !== false,\n enabled: entity.enabled !== false,\n activeInHierarchy: bActiveInHierarchy,\n componentCount: entity.components.length,\n componentTypes: entity.components.map((component) => getComponentInstanceTypeName(component)),\n parentId: hierarchy?.parentId ?? null,\n children: [],\n depth,\n tag: entity.tag || 0,\n updateOrder: entity.updateOrder || 0\n };\n // 递归构建子实体节点\n if (hierarchySystem) {\n const children = hierarchySystem.getChildren(entity);\n if (children.length > 0) {\n node.children = children.map((child) => this.buildEntityHierarchyNode(child, hierarchySystem));\n }\n }\n // 优先使用Entity的getDebugInfo方法\n if (typeof entity.getDebugInfo === 'function') {\n const debugInfo = entity.getDebugInfo();\n node = {\n ...node,\n ...debugInfo\n };\n }\n // 收集所有组件详细属性信息\n if (entity.components && entity.components.length > 0) {\n node.componentDetails = this.extractComponentDetails(entity.components);\n }\n return node;\n }\n /**\n * 构建实体详情映射\n */\n buildEntityDetailsMap(entityList, scene) {\n if (!entityList?.buffer)\n return {};\n const hierarchySystem = scene?.getSystem(HierarchySystem);\n const entityDetailsMap = {};\n const entities = entityList.buffer;\n const batchSize = 100;\n for (let i = 0; i < entities.length; i += batchSize) {\n const batch = entities.slice(i, i + batchSize);\n batch.forEach((entity) => {\n const baseDebugInfo = entity.getDebugInfo\n ? entity.getDebugInfo()\n : this.buildFallbackEntityInfo(entity, scene, hierarchySystem);\n const componentCacheStats = entity.getComponentCacheStats\n ? entity.getComponentCacheStats()\n : null;\n const componentDetails = this.extractComponentDetails(entity.components);\n // 获取父实体名称\n const parent = hierarchySystem?.getParent(entity);\n const parentName = parent?.name ?? null;\n entityDetailsMap[entity.id] = {\n ...baseDebugInfo,\n parentName,\n components: componentDetails,\n componentTypes: baseDebugInfo.componentTypes || componentDetails.map((comp) => comp.typeName),\n cachePerformance: componentCacheStats\n ? {\n hitRate: componentCacheStats.cacheStats.hitRate,\n size: componentCacheStats.cacheStats.size,\n maxSize: componentCacheStats.cacheStats.maxSize\n }\n : null\n };\n });\n }\n return entityDetailsMap;\n }\n /**\n * 构建实体基础信息\n */\n buildFallbackEntityInfo(entity, scene, hierarchySystem) {\n const sceneInfo = this.getSceneInfo(scene);\n const hierarchy = entity.getComponent(HierarchyComponent);\n const bActiveInHierarchy = hierarchySystem?.isActiveInHierarchy(entity) ?? entity.active;\n const depth = hierarchySystem?.getDepth(entity) ?? 0;\n return {\n name: entity.name || `Entity_${entity.id}`,\n id: entity.id,\n enabled: entity.enabled !== false,\n active: entity.active !== false,\n activeInHierarchy: bActiveInHierarchy,\n destroyed: entity.isDestroyed || false,\n scene: sceneInfo.name,\n sceneName: sceneInfo.name,\n sceneType: sceneInfo.type,\n componentCount: entity.components.length,\n componentTypes: entity.components.map((component) => getComponentInstanceTypeName(component)),\n componentMask: entity.componentMask?.toString() || '0',\n parentId: hierarchy?.parentId ?? null,\n childCount: hierarchy?.childIds?.length ?? 0,\n childIds: hierarchy?.childIds ?? [],\n depth,\n tag: entity.tag || 0,\n updateOrder: entity.updateOrder || 0\n };\n }\n /**\n * 提取组件详细信息\n */\n extractComponentDetails(components) {\n return components.map((component) => {\n const typeName = getComponentInstanceTypeName(component);\n const properties = {};\n try {\n const propertyKeys = Object.keys(component);\n propertyKeys.forEach((propertyKey) => {\n if (!propertyKey.startsWith('_') && propertyKey !== 'entity' && propertyKey !== 'constructor') {\n const propertyValue = component[propertyKey];\n if (propertyValue !== undefined && propertyValue !== null) {\n properties[propertyKey] = this.formatPropertyValue(propertyValue);\n }\n }\n });\n // 如果没有找到任何属性,添加一些调试信息\n if (Object.keys(properties).length === 0) {\n properties['_info'] = '该组件没有公开属性';\n properties['_componentId'] = getComponentInstanceTypeName(component);\n }\n }\n catch (error) {\n properties['_error'] = '属性提取失败';\n properties['_componentId'] = getComponentInstanceTypeName(component);\n }\n return {\n typeName: typeName,\n properties: properties\n };\n });\n }\n /**\n * 获取组件的完整属性信息(仅在需要时调用)\n * @param entityId 实体ID\n * @param componentIndex 组件索引\n * @param scene 场景实例\n */\n getComponentProperties(entityId, componentIndex, scene) {\n try {\n if (!scene)\n return {};\n const entityList = scene.entities;\n if (!entityList?.buffer)\n return {};\n const entity = entityList.buffer.find((e) => e.id === entityId);\n if (!entity || componentIndex >= entity.components.length)\n return {};\n const component = entity.components[componentIndex];\n const properties = {};\n const propertyKeys = Object.keys(component);\n propertyKeys.forEach((propertyKey) => {\n if (!propertyKey.startsWith('_') && propertyKey !== 'entity') {\n const propertyValue = component[propertyKey];\n if (propertyValue !== undefined && propertyValue !== null) {\n properties[propertyKey] = this.formatPropertyValue(propertyValue);\n }\n }\n });\n return properties;\n }\n catch (error) {\n return { _error: '属性提取失败' };\n }\n }\n /**\n * 格式化属性值\n */\n formatPropertyValue(value, depth = 0) {\n if (value === null || value === undefined) {\n return value;\n }\n if (typeof value !== 'object') {\n if (typeof value === 'string' && value.length > 200) {\n return `[长字符串: ${value.length}字符] ${value.substring(0, 100)}...`;\n }\n return value;\n }\n if (depth === 0) {\n return this.formatObjectFirstLevel(value);\n }\n else {\n return this.createLazyLoadPlaceholder(value);\n }\n }\n /**\n * 格式化对象第一层\n */\n formatObjectFirstLevel(obj) {\n try {\n if (Array.isArray(obj)) {\n if (obj.length === 0)\n return [];\n if (obj.length > 10) {\n const sample = obj.slice(0, 3).map((item) => this.formatPropertyValue(item, 1));\n return {\n _isLazyArray: true,\n _arrayLength: obj.length,\n _sample: sample,\n _summary: `数组[${obj.length}个元素]`\n };\n }\n return obj.map((item) => this.formatPropertyValue(item, 1));\n }\n const keys = Object.keys(obj);\n if (keys.length === 0)\n return {};\n const result = {};\n let processedCount = 0;\n const maxProperties = 15;\n for (const key of keys) {\n if (processedCount >= maxProperties) {\n result._hasMoreProperties = true;\n result._totalProperties = keys.length;\n result._hiddenCount = keys.length - processedCount;\n break;\n }\n if (key.startsWith('_') || key.startsWith('$') || typeof obj[key] === 'function') {\n continue;\n }\n try {\n const value = obj[key];\n if (value !== null && value !== undefined) {\n result[key] = this.formatPropertyValue(value, 1);\n processedCount++;\n }\n }\n catch (error) {\n result[key] = `[访问失败: ${error instanceof Error ? error.message : String(error)}]`;\n processedCount++;\n }\n }\n return result;\n }\n catch (error) {\n return `[对象解析失败: ${error instanceof Error ? error.message : String(error)}]`;\n }\n }\n /**\n * 创建懒加载占位符\n */\n createLazyLoadPlaceholder(obj) {\n try {\n const typeName = obj.constructor?.name || 'Object';\n const summary = this.getObjectSummary(obj, typeName);\n return {\n _isLazyObject: true,\n _typeName: typeName,\n _summary: summary,\n _objectId: this.generateObjectId(obj)\n };\n }\n catch (error) {\n return {\n _isLazyObject: true,\n _typeName: 'Unknown',\n _summary: `无法分析的对象: ${error instanceof Error ? error.message : String(error)}`,\n _objectId: Math.random().toString(36).substr(2, 9)\n };\n }\n }\n /**\n * 获取对象摘要信息\n */\n getObjectSummary(obj, typeName) {\n try {\n if (typeName.toLowerCase().includes('vec') || typeName.toLowerCase().includes('vector')) {\n if (obj.x !== undefined && obj.y !== undefined) {\n const z = obj.z !== undefined ? obj.z : '';\n return `${typeName}(${obj.x}, ${obj.y}${z ? ', ' + z : ''})`;\n }\n }\n if (typeName.toLowerCase().includes('color')) {\n if (obj.r !== undefined && obj.g !== undefined && obj.b !== undefined) {\n const a = obj.a !== undefined ? obj.a : 1;\n return `${typeName}(${obj.r}, ${obj.g}, ${obj.b}, ${a})`;\n }\n }\n if (typeName.toLowerCase().includes('node')) {\n const name = obj.name || obj._name || '未命名';\n return `${typeName}: ${name}`;\n }\n if (typeName.toLowerCase().includes('component')) {\n const nodeName = obj.node?.name || obj.node?._name || '';\n return `${typeName}${nodeName ? ` on ${nodeName}` : ''}`;\n }\n const keys = Object.keys(obj);\n if (keys.length === 0) {\n return `${typeName} (空对象)`;\n }\n return `${typeName} (${keys.length}个属性)`;\n }\n catch (error) {\n return `${typeName} (无法分析)`;\n }\n }\n /**\n * 生成对象ID\n */\n generateObjectId(obj) {\n try {\n if (obj.id !== undefined)\n return `obj_${obj.id}`;\n if (obj._id !== undefined)\n return `obj_${obj._id}`;\n if (obj.uuid !== undefined)\n return `obj_${obj.uuid}`;\n if (obj._uuid !== undefined)\n return `obj_${obj._uuid}`;\n return `obj_${Math.random().toString(36).substr(2, 9)}`;\n }\n catch {\n return `obj_${Math.random().toString(36).substr(2, 9)}`;\n }\n }\n /**\n * 展开懒加载对象(供调试面板调用)\n * @param entityId 实体ID\n * @param componentIndex 组件索引\n * @param propertyPath 属性路径\n * @param scene 场景实例\n */\n expandLazyObject(entityId, componentIndex, propertyPath, scene) {\n try {\n if (!scene)\n return null;\n const entityList = scene.entities;\n if (!entityList?.buffer)\n return null;\n // 找到对应的实体\n const entity = entityList.buffer.find((e) => e.id === entityId);\n if (!entity)\n return null;\n // 找到对应的组件\n if (componentIndex >= entity.components.length)\n return null;\n const component = entity.components[componentIndex];\n // 根据属性路径找到对象\n const targetObject = this.getObjectByPath(component, propertyPath);\n if (!targetObject)\n return null;\n // 展开这个对象的第一层属性\n return this.formatObjectFirstLevel(targetObject);\n }\n catch (error) {\n return {\n error: `展开失败: ${error instanceof Error ? error.message : String(error)}`\n };\n }\n }\n /**\n * 根据路径获取对象\n */\n getObjectByPath(root, path) {\n if (!path)\n return root;\n const parts = path.split('.');\n let current = root;\n for (const part of parts) {\n if (current === null || current === undefined)\n return null;\n // 处理数组索引\n if (part.includes('[') && part.includes(']')) {\n const arrayName = part.substring(0, part.indexOf('['));\n const index = parseInt(part.substring(part.indexOf('[') + 1, part.indexOf(']')));\n if (arrayName) {\n current = current[arrayName];\n }\n if (Array.isArray(current) && index >= 0 && index < current.length) {\n current = current[index];\n }\n else {\n return null;\n }\n }\n else {\n current = current[part];\n }\n }\n return current;\n }\n}\n//# sourceMappingURL=EntityDataCollector.js.map","import { getSystemInstanceTypeName } from '../../ECS/Decorators';\n/**\n * 系统数据收集器\n */\nexport class SystemDataCollector {\n /**\n * 收集系统数据\n * @param performanceMonitor 性能监视器实例\n * @param scene 场景实例\n */\n collectSystemData(performanceMonitor, scene) {\n if (!scene) {\n return {\n totalSystems: 0,\n systemsInfo: []\n };\n }\n const entityProcessors = scene.entityProcessors;\n if (!entityProcessors) {\n return {\n totalSystems: 0,\n systemsInfo: []\n };\n }\n const systems = entityProcessors.processors || [];\n // 获取性能监控数据\n let systemStats = new Map();\n let systemData = new Map();\n if (performanceMonitor) {\n try {\n systemStats = performanceMonitor.getAllSystemStats();\n systemData = performanceMonitor.getAllSystemData();\n }\n catch (error) {\n // 忽略错误,使用空的Map\n }\n }\n return {\n totalSystems: systems.length,\n systemsInfo: systems.map((system) => {\n const systemName = system.systemName || getSystemInstanceTypeName(system);\n const stats = systemStats.get(systemName);\n const data = systemData.get(systemName);\n return {\n name: systemName,\n type: getSystemInstanceTypeName(system),\n entityCount: system.entities?.length || 0,\n executionTime: stats?.averageTime || data?.executionTime || 0,\n minExecutionTime: stats?.minTime === Number.MAX_VALUE ? 0 : (stats?.minTime || 0),\n maxExecutionTime: stats?.maxTime || 0,\n executionTimeHistory: stats?.recentTimes || [],\n updateOrder: system.updateOrder || 0,\n enabled: system.enabled !== false,\n lastUpdateTime: data?.lastUpdateTime || 0\n };\n })\n };\n }\n}\n//# sourceMappingURL=SystemDataCollector.js.map","import { Time } from '../Time';\n/**\n * 性能数据收集器\n */\nexport class PerformanceDataCollector {\n constructor() {\n this.frameTimeHistory = [];\n this.maxHistoryLength = 60;\n this.gcCollections = 0;\n this.lastMemoryCheck = 0;\n }\n /**\n * 收集性能数据\n */\n collectPerformanceData(performanceMonitor) {\n const frameTimeSeconds = Time.deltaTime;\n const engineFrameTimeMs = frameTimeSeconds * 1000;\n const currentFps = frameTimeSeconds > 0 ? Math.round(1 / frameTimeSeconds) : 0;\n const ecsPerformanceData = this.getECSPerformanceData(performanceMonitor);\n const ecsExecutionTimeMs = ecsPerformanceData.totalExecutionTime;\n const ecsPercentage = engineFrameTimeMs > 0 ? (ecsExecutionTimeMs / engineFrameTimeMs * 100) : 0;\n let memoryUsage = 0;\n if (performance.memory) {\n memoryUsage = performance.memory.usedJSHeapSize / 1024 / 1024;\n }\n // 更新ECS执行时间历史记录\n this.frameTimeHistory.push(ecsExecutionTimeMs);\n if (this.frameTimeHistory.length > this.maxHistoryLength) {\n this.frameTimeHistory.shift();\n }\n // 计算ECS执行时间统计\n const history = this.frameTimeHistory.filter((t) => t >= 0);\n const averageECSTime = history.length > 0 ? history.reduce((a, b) => a + b, 0) / history.length : ecsExecutionTimeMs;\n const minECSTime = history.length > 0 ? Math.min(...history) : ecsExecutionTimeMs;\n const maxECSTime = history.length > 0 ? Math.max(...history) : ecsExecutionTimeMs;\n return {\n frameTime: ecsExecutionTimeMs,\n engineFrameTime: engineFrameTimeMs,\n ecsPercentage: ecsPercentage,\n memoryUsage: memoryUsage,\n fps: currentFps,\n averageFrameTime: averageECSTime,\n minFrameTime: minECSTime,\n maxFrameTime: maxECSTime,\n frameTimeHistory: [...this.frameTimeHistory],\n systemPerformance: this.getSystemPerformance(performanceMonitor),\n systemBreakdown: ecsPerformanceData.systemBreakdown,\n memoryDetails: this.getMemoryDetails()\n };\n }\n /**\n * 获取ECS框架整体性能数据\n */\n getECSPerformanceData(performanceMonitor) {\n // 检查性能监视器是否存在\n if (!performanceMonitor) {\n return { totalExecutionTime: 0, systemBreakdown: [] };\n }\n if (!performanceMonitor.enabled) {\n // 尝试启用性能监视器\n try {\n performanceMonitor.enabled = true;\n }\n catch (error) {\n // 如果无法启用,返回默认值\n }\n return { totalExecutionTime: 0, systemBreakdown: [] };\n }\n try {\n let totalTime = 0;\n const systemBreakdown = [];\n const stats = performanceMonitor.getAllSystemStats();\n if (stats.size === 0) {\n return { totalExecutionTime: 0, systemBreakdown: [] };\n }\n // 计算各系统的执行时间\n for (const [systemName, stat] of stats.entries()) {\n // 使用最近的执行时间而不是平均时间,这样更能反映当前状态\n const systemTime = stat.recentTimes && stat.recentTimes.length > 0 ?\n stat.recentTimes[stat.recentTimes.length - 1] :\n (stat.averageTime || 0);\n totalTime += systemTime;\n systemBreakdown.push({\n systemName: systemName,\n executionTime: systemTime,\n percentage: 0 // 后面计算\n });\n }\n // 计算各系统占ECS总时间的百分比\n systemBreakdown.forEach((system) => {\n system.percentage = totalTime > 0 ? (system.executionTime / totalTime * 100) : 0;\n });\n // 按执行时间排序\n systemBreakdown.sort((a, b) => b.executionTime - a.executionTime);\n return {\n totalExecutionTime: totalTime,\n systemBreakdown: systemBreakdown\n };\n }\n catch (error) {\n return { totalExecutionTime: 0, systemBreakdown: [] };\n }\n }\n /**\n * 获取系统性能数据\n */\n getSystemPerformance(performanceMonitor) {\n if (!performanceMonitor) {\n return [];\n }\n try {\n const stats = performanceMonitor.getAllSystemStats();\n const systemData = performanceMonitor.getAllSystemData();\n return Array.from(stats.entries()).map(([systemName, stat]) => {\n const data = systemData.get(systemName);\n return {\n systemName: systemName,\n averageTime: stat.averageTime || 0,\n maxTime: stat.maxTime || 0,\n minTime: stat.minTime === Number.MAX_VALUE ? 0 : (stat.minTime || 0),\n samples: stat.executionCount || 0,\n percentage: 0,\n entityCount: data?.entityCount || 0,\n lastExecutionTime: data?.executionTime || 0\n };\n });\n }\n catch (error) {\n return [];\n }\n }\n /**\n * 获取内存详情\n */\n getMemoryDetails() {\n const memoryInfo = {\n entities: 0,\n components: 0,\n systems: 0,\n pooled: 0,\n totalMemory: 0,\n usedMemory: 0,\n freeMemory: 0,\n gcCollections: this.updateGCCount()\n };\n try {\n if (performance.memory) {\n const perfMemory = performance.memory;\n memoryInfo.totalMemory = perfMemory.jsHeapSizeLimit || 512 * 1024 * 1024;\n memoryInfo.usedMemory = perfMemory.usedJSHeapSize || 0;\n memoryInfo.freeMemory = memoryInfo.totalMemory - memoryInfo.usedMemory;\n // 检测GC:如果使用的内存突然大幅减少,可能发生了GC\n if (this.lastMemoryCheck > 0) {\n const memoryDrop = this.lastMemoryCheck - memoryInfo.usedMemory;\n if (memoryDrop > 1024 * 1024) { // 内存减少超过1MB\n this.gcCollections++;\n }\n }\n this.lastMemoryCheck = memoryInfo.usedMemory;\n }\n else {\n memoryInfo.totalMemory = 512 * 1024 * 1024;\n memoryInfo.freeMemory = 512 * 1024 * 1024;\n }\n }\n catch (error) {\n return {\n totalMemory: 0,\n usedMemory: 0,\n freeMemory: 0,\n entityMemory: 0,\n componentMemory: 0,\n systemMemory: 0,\n pooledMemory: 0,\n gcCollections: this.gcCollections\n };\n }\n return memoryInfo;\n }\n /**\n * 更新GC计数\n */\n updateGCCount() {\n try {\n // 尝试使用PerformanceObserver来检测GC\n if (typeof PerformanceObserver !== 'undefined') {\n // 这是一个简化的GC检测方法\n // 实际的GC检测需要更复杂的逻辑\n return this.gcCollections;\n }\n // 如果有其他GC检测API,可以在这里添加\n if (performance.measureUserAgentSpecificMemory) {\n // 实验性API,可能不可用\n return this.gcCollections;\n }\n return this.gcCollections;\n }\n catch (error) {\n return this.gcCollections;\n }\n }\n}\n//# sourceMappingURL=PerformanceDataCollector.js.map","/**\n * 组件对象池,用于复用组件实例以减少内存分配\n */\nexport class ComponentPool {\n constructor(createFn, resetFn, maxSize = 1000, minSize = 10) {\n this.pool = [];\n this.stats = {\n totalCreated: 0,\n totalAcquired: 0,\n totalReleased: 0\n };\n this.createFn = createFn;\n if (resetFn) {\n this.resetFn = resetFn;\n }\n this.maxSize = maxSize;\n this.minSize = Math.max(1, minSize);\n }\n /**\n * 获取一个组件实例\n */\n acquire() {\n this.stats.totalAcquired++;\n if (this.pool.length > 0) {\n return this.pool.pop();\n }\n this.stats.totalCreated++;\n return this.createFn();\n }\n /**\n * 释放一个组件实例回池中\n */\n release(component) {\n this.stats.totalReleased++;\n if (this.pool.length >= this.maxSize) {\n return;\n }\n if (this.resetFn) {\n this.resetFn(component);\n }\n this.pool.push(component);\n }\n /**\n * 预填充对象池\n */\n prewarm(count) {\n const targetCount = Math.min(count, this.maxSize);\n for (let i = this.pool.length; i < targetCount; i++) {\n const component = this.createFn();\n if (this.resetFn) {\n this.resetFn(component);\n }\n this.pool.push(component);\n this.stats.totalCreated++;\n }\n }\n /**\n * 自动收缩池大小\n */\n shrink() {\n while (this.pool.length > this.minSize) {\n this.pool.pop();\n }\n }\n /**\n * 清空对象池\n */\n clear() {\n this.pool.length = 0;\n }\n /**\n * 获取池中可用对象数量\n */\n getAvailableCount() {\n return this.pool.length;\n }\n /**\n * 获取池的最大容量\n */\n getMaxSize() {\n return this.maxSize;\n }\n /**\n * 获取统计信息\n */\n getStats() {\n const hitRate = this.stats.totalAcquired === 0\n ? 0\n : (this.stats.totalAcquired - this.stats.totalCreated) / this.stats.totalAcquired;\n return {\n totalCreated: this.stats.totalCreated,\n totalAcquired: this.stats.totalAcquired,\n totalReleased: this.stats.totalReleased,\n hitRate: hitRate,\n currentSize: this.pool.length,\n maxSize: this.maxSize,\n minSize: this.minSize,\n utilizationRate: this.pool.length / this.maxSize\n };\n }\n}\n/**\n * 全局组件池管理器\n */\nexport class ComponentPoolManager {\n constructor() {\n this.pools = new Map();\n this.usageTracker = new Map();\n this.autoCleanupInterval = 60000;\n this.lastCleanupTime = 0;\n }\n static getInstance() {\n if (!ComponentPoolManager.instance) {\n ComponentPoolManager.instance = new ComponentPoolManager();\n }\n return ComponentPoolManager.instance;\n }\n /**\n * 注册组件池\n */\n registerPool(componentName, createFn, resetFn, maxSize, minSize) {\n this.pools.set(componentName, new ComponentPool(createFn, resetFn, maxSize, minSize));\n this.usageTracker.set(componentName, {\n createCount: 0,\n releaseCount: 0,\n lastAccessTime: Date.now()\n });\n }\n /**\n * 获取组件实例\n */\n acquireComponent(componentName) {\n const pool = this.pools.get(componentName);\n this.trackUsage(componentName, 'create');\n return pool ? pool.acquire() : null;\n }\n /**\n * 释放组件实例\n */\n releaseComponent(componentName, component) {\n const pool = this.pools.get(componentName);\n this.trackUsage(componentName, 'release');\n if (pool) {\n pool.release(component);\n }\n }\n /**\n * 追踪使用情况\n */\n trackUsage(componentName, action) {\n let tracker = this.usageTracker.get(componentName);\n if (!tracker) {\n tracker = {\n createCount: 0,\n releaseCount: 0,\n lastAccessTime: Date.now()\n };\n this.usageTracker.set(componentName, tracker);\n }\n if (action === 'create') {\n tracker.createCount++;\n }\n else {\n tracker.releaseCount++;\n }\n tracker.lastAccessTime = Date.now();\n }\n /**\n * 自动清理(定期调用)\n */\n update() {\n const now = Date.now();\n if (now - this.lastCleanupTime < this.autoCleanupInterval) {\n return;\n }\n for (const [name, tracker] of this.usageTracker.entries()) {\n const inactive = now - tracker.lastAccessTime > 120000;\n if (inactive) {\n const pool = this.pools.get(name);\n if (pool) {\n pool.shrink();\n }\n }\n }\n this.lastCleanupTime = now;\n }\n /**\n * 获取热点组件列表\n */\n getHotComponents(threshold = 100) {\n return Array.from(this.usageTracker.entries())\n .filter(([_, tracker]) => tracker.createCount > threshold)\n .map(([name]) => name);\n }\n /**\n * 预热所有池\n */\n prewarmAll(count = 100) {\n for (const pool of this.pools.values()) {\n pool.prewarm(count);\n }\n }\n /**\n * 清空所有池\n */\n clearAll() {\n for (const pool of this.pools.values()) {\n pool.clear();\n }\n }\n /**\n * 重置管理器\n */\n reset() {\n this.pools.clear();\n this.usageTracker.clear();\n }\n /**\n * 获取全局统计信息\n */\n getGlobalStats() {\n const stats = [];\n for (const [name, pool] of this.pools.entries()) {\n stats.push({\n componentName: name,\n poolStats: pool.getStats(),\n usage: this.usageTracker.get(name)\n });\n }\n return stats;\n }\n /**\n * 获取池统计信息\n */\n getPoolStats() {\n const stats = new Map();\n for (const [name, pool] of this.pools) {\n stats.set(name, {\n available: pool.getAvailableCount(),\n maxSize: pool.getMaxSize()\n });\n }\n return stats;\n }\n /**\n * 获取池利用率信息\n */\n getPoolUtilization() {\n const utilization = new Map();\n for (const [name, pool] of this.pools) {\n const available = pool.getAvailableCount();\n const maxSize = pool.getMaxSize();\n const used = maxSize - available;\n const utilRate = maxSize > 0 ? (used / maxSize * 100) : 0;\n utilization.set(name, {\n used: used,\n total: maxSize,\n utilization: utilRate\n });\n }\n return utilization;\n }\n /**\n * 获取指定组件的池利用率\n */\n getComponentUtilization(componentName) {\n const pool = this.pools.get(componentName);\n if (!pool)\n return 0;\n const available = pool.getAvailableCount();\n const maxSize = pool.getMaxSize();\n const used = maxSize - available;\n return maxSize > 0 ? (used / maxSize * 100) : 0;\n }\n}\n//# sourceMappingURL=ComponentPool.js.map","import { ComponentPoolManager } from '../../ECS/Core/ComponentPool';\nimport { getComponentInstanceTypeName } from '../../ECS/Decorators';\n/**\n * 组件数据收集器\n */\nexport class ComponentDataCollector {\n /**\n * 收集组件数据(轻量版,不计算实际内存大小)\n * @param scene 场景实例\n */\n collectComponentData(scene) {\n if (!scene) {\n return {\n componentTypes: 0,\n componentInstances: 0,\n componentStats: []\n };\n }\n const entityList = scene.entities;\n if (!entityList?.buffer) {\n return {\n componentTypes: 0,\n componentInstances: 0,\n componentStats: []\n };\n }\n const componentStats = new Map();\n let totalInstances = 0;\n entityList.buffer.forEach((entity) => {\n if (entity.components) {\n entity.components.forEach((component) => {\n const typeName = getComponentInstanceTypeName(component);\n const stats = componentStats.get(typeName) || { count: 0, entities: 0 };\n stats.count++;\n totalInstances++;\n componentStats.set(typeName, stats);\n });\n }\n });\n // 获取池利用率信息\n const poolUtilizations = new Map();\n const poolSizes = new Map();\n try {\n const poolManager = ComponentPoolManager.getInstance();\n const poolStats = poolManager.getPoolStats();\n const utilizations = poolManager.getPoolUtilization();\n for (const [typeName, stats] of poolStats.entries()) {\n poolSizes.set(typeName, stats.maxSize);\n }\n for (const [typeName, util] of utilizations.entries()) {\n poolUtilizations.set(typeName, util.utilization);\n }\n }\n catch (error) {\n // 如果无法获取池信息,使用默认值\n }\n return {\n componentTypes: componentStats.size,\n componentInstances: totalInstances,\n componentStats: Array.from(componentStats.entries()).map(([typeName, stats]) => {\n const poolSize = poolSizes.get(typeName) || 0;\n const poolUtilization = poolUtilizations.get(typeName) || 0;\n // 使用预估的基础内存大小,避免每帧计算\n const memoryPerInstance = this.getEstimatedComponentSize(typeName, scene);\n return {\n typeName,\n instanceCount: stats.count,\n memoryPerInstance: memoryPerInstance,\n totalMemory: stats.count * memoryPerInstance,\n poolSize: poolSize,\n poolUtilization: poolUtilization,\n averagePerEntity: stats.count / entityList.buffer.length\n };\n })\n };\n }\n /**\n * 获取组件类型的估算内存大小(基于预设值,不进行实际计算)\n */\n getEstimatedComponentSize(typeName, scene) {\n if (ComponentDataCollector.componentSizeCache.has(typeName)) {\n return ComponentDataCollector.componentSizeCache.get(typeName);\n }\n if (!scene)\n return 64;\n const entityList = scene.entities;\n if (!entityList?.buffer)\n return 64;\n let calculatedSize = 64;\n try {\n for (const entity of entityList.buffer) {\n if (entity.components) {\n const component = entity.components.find((c) => getComponentInstanceTypeName(c) === typeName);\n if (component) {\n calculatedSize = this.calculateQuickObjectSize(component);\n break;\n }\n }\n }\n }\n catch (error) {\n calculatedSize = 64;\n }\n ComponentDataCollector.componentSizeCache.set(typeName, calculatedSize);\n return calculatedSize;\n }\n calculateQuickObjectSize(obj) {\n if (!obj || typeof obj !== 'object')\n return 8;\n let size = 32;\n const visited = new WeakSet();\n const calculate = (item, depth = 0) => {\n if (!item || typeof item !== 'object' || visited.has(item) || depth > 3) {\n return 0;\n }\n visited.add(item);\n let itemSize = 0;\n try {\n const keys = Object.keys(item);\n for (let i = 0; i < Math.min(keys.length, 20); i++) {\n const key = keys[i];\n if (!key || key === 'entity' || key === '_entity' || key === 'constructor')\n continue;\n const value = item[key];\n itemSize += key.length * 2;\n if (typeof value === 'string') {\n itemSize += Math.min(value.length * 2, 200);\n }\n else if (typeof value === 'number') {\n itemSize += 8;\n }\n else if (typeof value === 'boolean') {\n itemSize += 4;\n }\n else if (typeof value === 'object' && value !== null) {\n itemSize += calculate(value, depth + 1);\n }\n }\n }\n catch (error) {\n return 32;\n }\n return itemSize;\n };\n size += calculate(obj);\n return Math.max(size, 32);\n }\n /**\n * 为内存快照功能提供的详细内存计算\n * 只在用户主动请求内存快照时调用\n * @param typeName 组件类型名称\n * @param scene 场景实例\n */\n calculateDetailedComponentMemory(typeName, scene) {\n if (!scene)\n return this.getEstimatedComponentSize(typeName, scene);\n const entityList = scene.entities;\n if (!entityList?.buffer)\n return this.getEstimatedComponentSize(typeName, scene);\n try {\n // 找到第一个包含此组件的实体,分析组件大小\n for (const entity of entityList.buffer) {\n if (entity.components) {\n const component = entity.components.find((c) => getComponentInstanceTypeName(c) === typeName);\n if (component) {\n return this.estimateObjectSize(component);\n }\n }\n }\n }\n catch (error) {\n // 忽略错误,使用估算值\n }\n return this.getEstimatedComponentSize(typeName, scene);\n }\n /**\n * 估算对象内存大小(仅用于内存快照)\n * 优化版本:减少递归深度,提高性能\n */\n estimateObjectSize(obj, visited = new WeakSet(), depth = 0) {\n if (obj === null || obj === undefined || depth > 10)\n return 0;\n if (visited.has(obj))\n return 0;\n let size = 0;\n const type = typeof obj;\n switch (type) {\n case 'boolean':\n size = 4;\n break;\n case 'number':\n size = 8;\n break;\n case 'string':\n size = 24 + Math.min(obj.length * 2, 1000);\n break;\n case 'object':\n visited.add(obj);\n if (Array.isArray(obj)) {\n size = 40 + (obj.length * 8);\n const maxElements = Math.min(obj.length, 50);\n for (let i = 0; i < maxElements; i++) {\n size += this.estimateObjectSize(obj[i], visited, depth + 1);\n }\n }\n else {\n size = 32;\n try {\n const ownKeys = Object.getOwnPropertyNames(obj);\n const maxProps = Math.min(ownKeys.length, 30);\n for (let i = 0; i < maxProps; i++) {\n const key = ownKeys[i];\n if (!key)\n continue;\n if (key === 'constructor' ||\n key === '__proto__' ||\n key === 'entity' ||\n key === '_entity' ||\n key.startsWith('_cc_') ||\n key.startsWith('__')) {\n continue;\n }\n try {\n size += 16 + (key.length * 2);\n const value = obj[key];\n if (value !== undefined && value !== null) {\n size += this.estimateObjectSize(value, visited, depth + 1);\n }\n }\n catch (error) {\n continue;\n }\n }\n }\n catch (error) {\n size = 128;\n }\n }\n break;\n default:\n size = 8;\n }\n return Math.ceil(size / 8) * 8;\n }\n static clearCache() {\n ComponentDataCollector.componentSizeCache.clear();\n }\n}\nComponentDataCollector.componentSizeCache = new Map();\n//# sourceMappingURL=ComponentDataCollector.js.map","/**\n * 场景数据收集器\n */\nexport class SceneDataCollector {\n constructor() {\n this.sceneStartTime = Date.now();\n }\n /**\n * 收集场景数据\n * @param scene 场景实例\n */\n collectSceneData(scene) {\n if (!scene) {\n return {\n currentSceneName: 'No Scene',\n isInitialized: false,\n sceneRunTime: 0,\n sceneEntityCount: 0,\n sceneSystemCount: 0,\n sceneUptime: 0\n };\n }\n const currentTime = Date.now();\n const runTime = (currentTime - this.sceneStartTime) / 1000;\n const entityList = scene.entities;\n const entityProcessors = scene.entityProcessors;\n return {\n currentSceneName: scene.name || 'Unnamed Scene',\n isInitialized: scene._didSceneBegin || false,\n sceneRunTime: runTime,\n sceneEntityCount: entityList?.buffer?.length || 0,\n sceneSystemCount: entityProcessors?.processors?.length || 0,\n sceneUptime: runTime\n };\n }\n /**\n * 设置场景开始时间\n */\n setSceneStartTime(time) {\n this.sceneStartTime = time;\n }\n}\n//# sourceMappingURL=SceneDataCollector.js.map","/**\n * 性能分析器类型定义\n */\n/**\n * 性能分析类别\n */\nexport var ProfileCategory;\n(function (ProfileCategory) {\n /** ECS 系统 */\n ProfileCategory[\"ECS\"] = \"ECS\";\n /** 渲染相关 */\n ProfileCategory[\"Rendering\"] = \"Rendering\";\n /** 物理系统 */\n ProfileCategory[\"Physics\"] = \"Physics\";\n /** 音频系统 */\n ProfileCategory[\"Audio\"] = \"Audio\";\n /** 网络相关 */\n ProfileCategory[\"Network\"] = \"Network\";\n /** 用户脚本 */\n ProfileCategory[\"Script\"] = \"Script\";\n /** 内存相关 */\n ProfileCategory[\"Memory\"] = \"Memory\";\n /** 动画系统 */\n ProfileCategory[\"Animation\"] = \"Animation\";\n /** AI/行为树 */\n ProfileCategory[\"AI\"] = \"AI\";\n /** 输入处理 */\n ProfileCategory[\"Input\"] = \"Input\";\n /** 资源加载 */\n ProfileCategory[\"Loading\"] = \"Loading\";\n /** 自定义 */\n ProfileCategory[\"Custom\"] = \"Custom\";\n})(ProfileCategory || (ProfileCategory = {}));\n/**\n * 默认配置\n */\nexport const DEFAULT_PROFILER_CONFIG = {\n enabled: false,\n maxFrameHistory: 300,\n maxSampleDepth: 32,\n collectMemory: true,\n memorySampleInterval: 100,\n detectLongTasks: true,\n longTaskThreshold: 50,\n enabledCategories: new Set(Object.values(ProfileCategory))\n};\n//# sourceMappingURL=ProfilerTypes.js.map","/**\n * WebSocket连接管理器\n */\nexport class WebSocketManager {\n constructor(url, autoReconnect = true) {\n this.isConnected = false;\n this.reconnectAttempts = 0;\n this.maxReconnectAttempts = 5;\n this.url = url;\n this.autoReconnect = autoReconnect;\n }\n /**\n * 设置消息处理回调\n */\n setMessageHandler(handler) {\n this.messageHandler = handler;\n }\n /**\n * 连接WebSocket\n */\n connect() {\n return new Promise((resolve, reject) => {\n try {\n this.ws = new WebSocket(this.url);\n this.ws.onopen = (event) => {\n this.handleOpen(event);\n resolve();\n };\n this.ws.onclose = (event) => {\n this.handleClose(event);\n };\n this.ws.onerror = (error) => {\n this.handleError(error);\n reject(error);\n };\n this.ws.onmessage = (event) => {\n this.handleMessage(event);\n };\n }\n catch (error) {\n this.handleConnectionFailure(error);\n reject(error);\n }\n });\n }\n /**\n * 断开连接\n */\n disconnect() {\n if (this.ws) {\n this.autoReconnect = false; // 主动断开时不自动重连\n this.ws.close();\n delete this.ws;\n }\n this.isConnected = false;\n }\n /**\n * 发送数据\n */\n send(data) {\n if (!this.isConnected || !this.ws) {\n return;\n }\n try {\n const message = typeof data === 'string' ? data : JSON.stringify(data);\n this.ws.send(message);\n }\n catch (error) {\n }\n }\n /**\n * 获取连接状态\n */\n getConnectionStatus() {\n return this.isConnected;\n }\n /**\n * 设置最大重连次数\n */\n setMaxReconnectAttempts(attempts) {\n this.maxReconnectAttempts = attempts;\n }\n /**\n * 计划重连\n */\n scheduleReconnect() {\n if (this.reconnectTimer) {\n clearTimeout(this.reconnectTimer);\n }\n const delay = Math.min(1000 * Math.pow(2, this.reconnectAttempts), 30000);\n this.reconnectAttempts++;\n this.reconnectTimer = setTimeout(() => {\n this.connect().catch((_error) => {\n if (this.reconnectAttempts < this.maxReconnectAttempts) {\n this.scheduleReconnect();\n }\n });\n }, delay);\n }\n /**\n * 处理接收到的消息\n */\n handleMessage(event) {\n try {\n const message = JSON.parse(event.data);\n // 调用消息处理回调\n if (this.messageHandler) {\n this.messageHandler(message);\n }\n }\n catch (error) {\n }\n }\n handleOpen(event) {\n this.isConnected = true;\n this.reconnectAttempts = 0;\n if (this.onOpen) {\n this.onOpen(event);\n }\n }\n handleClose(event) {\n this.isConnected = false;\n if (this.onClose) {\n this.onClose(event);\n }\n if (this.autoReconnect && this.reconnectAttempts < this.maxReconnectAttempts) {\n this.scheduleReconnect();\n }\n }\n handleError(error) {\n if (this.onError) {\n this.onError(error);\n }\n }\n handleConnectionFailure(error) {\n if (this.onError) {\n this.onError(error);\n }\n }\n}\n//# sourceMappingURL=WebSocketManager.js.map","/**\n * 性能分析器 SDK\n *\n * 提供统一的性能分析接口,支持:\n * - 手动采样标记\n * - 自动作用域测量\n * - 调用层级追踪\n * - 计数器和仪表\n */\nimport { ProfileCategory, DEFAULT_PROFILER_CONFIG } from './ProfilerTypes';\nlet idCounter = 0;\nfunction generateId() {\n return `sample_${++idCounter}_${Date.now()}`;\n}\n/**\n * 性能分析器 SDK\n */\nexport class ProfilerSDK {\n constructor(config) {\n this.currentFrame = null;\n this.frameHistory = [];\n this.frameNumber = 0;\n this.activeSamples = new Map();\n this.sampleStack = [];\n this.counters = new Map();\n this.callGraph = new Map();\n this.gcCount = 0;\n this.previousHeapSize = 0;\n this.longTasks = [];\n this.performanceObserver = null;\n this.config = { ...DEFAULT_PROFILER_CONFIG, ...config };\n if (this.config.detectLongTasks) {\n this.setupLongTaskObserver();\n }\n }\n /**\n * 获取单例实例\n */\n static getInstance(config) {\n if (!ProfilerSDK.instance) {\n ProfilerSDK.instance = new ProfilerSDK(config);\n }\n return ProfilerSDK.instance;\n }\n /**\n * 重置实例(测试用)\n */\n static resetInstance() {\n if (ProfilerSDK.instance) {\n ProfilerSDK.instance.dispose();\n ProfilerSDK.instance = null;\n }\n }\n /**\n * 开始采样\n */\n static beginSample(name, category = ProfileCategory.Custom) {\n return ProfilerSDK.getInstance().beginSample(name, category);\n }\n /**\n * 结束采样\n */\n static endSample(handle) {\n if (handle) {\n ProfilerSDK.getInstance().endSample(handle);\n }\n }\n /**\n * 测量同步函数执行时间\n */\n static measure(name, fn, category = ProfileCategory.Custom) {\n return ProfilerSDK.getInstance().measure(name, fn, category);\n }\n /**\n * 测量异步函数执行时间\n */\n static async measureAsync(name, fn, category = ProfileCategory.Custom) {\n return ProfilerSDK.getInstance().measureAsync(name, fn, category);\n }\n /**\n * 开始帧\n */\n static beginFrame() {\n ProfilerSDK.getInstance().beginFrame();\n }\n /**\n * 结束帧\n */\n static endFrame() {\n ProfilerSDK.getInstance().endFrame();\n }\n /**\n * 递增计数器\n */\n static incrementCounter(name, value = 1, category = ProfileCategory.Custom) {\n ProfilerSDK.getInstance().incrementCounter(name, value, category);\n }\n /**\n * 设置仪表值\n */\n static setGauge(name, value, category = ProfileCategory.Custom) {\n ProfilerSDK.getInstance().setGauge(name, value, category);\n }\n /**\n * 启用/禁用分析器\n */\n static setEnabled(enabled) {\n ProfilerSDK.getInstance().setEnabled(enabled);\n }\n /**\n * 检查是否启用\n */\n static isEnabled() {\n return ProfilerSDK.getInstance().config.enabled;\n }\n /**\n * 获取当前帧数据\n */\n static getCurrentFrame() {\n return ProfilerSDK.getInstance().currentFrame;\n }\n /**\n * 获取帧历史\n */\n static getFrameHistory() {\n return ProfilerSDK.getInstance().frameHistory;\n }\n /**\n * 获取分析报告\n */\n static getReport(frameCount) {\n return ProfilerSDK.getInstance().generateReport(frameCount);\n }\n /**\n * 重置数据\n */\n static reset() {\n ProfilerSDK.getInstance().reset();\n }\n /**\n * 开始采样\n */\n beginSample(name, category = ProfileCategory.Custom) {\n if (!this.config.enabled || !this.config.enabledCategories.has(category)) {\n return null;\n }\n const parentHandle = this.sampleStack.length > 0\n ? this.sampleStack[this.sampleStack.length - 1]\n : undefined;\n if (parentHandle && this.sampleStack.length >= this.config.maxSampleDepth) {\n return null;\n }\n const handle = {\n id: generateId(),\n name,\n category,\n startTime: performance.now(),\n depth: this.sampleStack.length,\n parentId: parentHandle?.id\n };\n this.activeSamples.set(handle.id, handle);\n this.sampleStack.push(handle);\n return handle;\n }\n /**\n * 结束采样\n */\n endSample(handle) {\n if (!this.config.enabled || !this.activeSamples.has(handle.id)) {\n return;\n }\n const endTime = performance.now();\n const duration = endTime - handle.startTime;\n // 获取父级 handle(在删除当前 handle 之前)\n const parentHandle = handle.parentId ? this.activeSamples.get(handle.parentId) : undefined;\n const sample = {\n id: handle.id,\n name: handle.name,\n category: handle.category,\n startTime: handle.startTime,\n endTime,\n duration,\n selfTime: duration,\n parentId: handle.parentId,\n parentName: parentHandle?.name,\n depth: handle.depth,\n callCount: 1\n };\n if (this.currentFrame) {\n this.currentFrame.samples.push(sample);\n }\n this.updateCallGraph(handle.name, handle.category, duration, parentHandle);\n this.activeSamples.delete(handle.id);\n const stackIndex = this.sampleStack.indexOf(handle);\n if (stackIndex !== -1) {\n this.sampleStack.splice(stackIndex, 1);\n }\n }\n /**\n * 测量同步函数\n */\n measure(name, fn, category = ProfileCategory.Custom) {\n const handle = this.beginSample(name, category);\n try {\n return fn();\n }\n finally {\n if (handle) {\n this.endSample(handle);\n }\n }\n }\n /**\n * 测量异步函数\n */\n async measureAsync(name, fn, category = ProfileCategory.Custom) {\n const handle = this.beginSample(name, category);\n try {\n return await fn();\n }\n finally {\n if (handle) {\n this.endSample(handle);\n }\n }\n }\n /**\n * 开始帧\n */\n beginFrame() {\n if (!this.config.enabled)\n return;\n this.frameNumber++;\n this.currentFrame = {\n frameNumber: this.frameNumber,\n startTime: performance.now(),\n endTime: 0,\n duration: 0,\n samples: [],\n sampleStats: [],\n counters: new Map(this.counters),\n memory: this.captureMemory(),\n categoryStats: new Map()\n };\n this.resetFrameCounters();\n }\n /**\n * 结束帧\n */\n endFrame() {\n if (!this.config.enabled || !this.currentFrame)\n return;\n this.currentFrame.endTime = performance.now();\n this.currentFrame.duration = this.currentFrame.endTime - this.currentFrame.startTime;\n this.calculateSampleStats();\n this.calculateCategoryStats();\n this.frameHistory.push(this.currentFrame);\n while (this.frameHistory.length > this.config.maxFrameHistory) {\n this.frameHistory.shift();\n }\n this.sampleStack = [];\n this.activeSamples.clear();\n }\n /**\n * 递增计数器\n */\n incrementCounter(name, value = 1, category = ProfileCategory.Custom) {\n if (!this.config.enabled)\n return;\n let counter = this.counters.get(name);\n if (!counter) {\n counter = {\n name,\n category,\n value: 0,\n type: 'counter',\n history: []\n };\n this.counters.set(name, counter);\n }\n counter.value += value;\n counter.history.push({ time: performance.now(), value: counter.value });\n if (counter.history.length > 100) {\n counter.history.shift();\n }\n }\n /**\n * 设置仪表值\n */\n setGauge(name, value, category = ProfileCategory.Custom) {\n if (!this.config.enabled)\n return;\n let counter = this.counters.get(name);\n if (!counter) {\n counter = {\n name,\n category,\n value: 0,\n type: 'gauge',\n history: []\n };\n this.counters.set(name, counter);\n }\n counter.value = value;\n counter.history.push({ time: performance.now(), value });\n if (counter.history.length > 100) {\n counter.history.shift();\n }\n }\n /**\n * 设置启用状态\n */\n setEnabled(enabled) {\n this.config.enabled = enabled;\n if (enabled && this.config.detectLongTasks && !this.performanceObserver) {\n this.setupLongTaskObserver();\n }\n }\n /**\n * 重置数据\n */\n reset() {\n this.frameHistory = [];\n this.currentFrame = null;\n this.frameNumber = 0;\n this.activeSamples.clear();\n this.sampleStack = [];\n this.counters.clear();\n this.callGraph.clear();\n this.gcCount = 0;\n this.longTasks = [];\n }\n /**\n * 生成分析报告\n */\n generateReport(frameCount) {\n const frames = frameCount\n ? this.frameHistory.slice(-frameCount)\n : this.frameHistory;\n if (frames.length === 0) {\n return this.createEmptyReport();\n }\n const frameTimes = frames.map((f) => f.duration);\n const sortedTimes = [...frameTimes].sort((a, b) => a - b);\n const aggregatedStats = this.aggregateSampleStats(frames);\n const hotspots = aggregatedStats\n .sort((a, b) => b.inclusiveTime - a.inclusiveTime)\n .slice(0, 20);\n const categoryBreakdown = this.aggregateCategoryStats(frames);\n // 根据帧历史重新计算 callGraph(不使用全局累积的数据)\n const callGraph = this.buildCallGraphFromFrames(frames);\n const firstFrame = frames[0];\n const lastFrame = frames[frames.length - 1];\n return {\n startTime: firstFrame?.startTime ?? 0,\n endTime: lastFrame?.endTime ?? 0,\n totalFrames: frames.length,\n averageFrameTime: frameTimes.reduce((a, b) => a + b, 0) / frameTimes.length,\n minFrameTime: Math.min(...frameTimes),\n maxFrameTime: Math.max(...frameTimes),\n p95FrameTime: sortedTimes[Math.floor(sortedTimes.length * 0.95)] || 0,\n p99FrameTime: sortedTimes[Math.floor(sortedTimes.length * 0.99)] || 0,\n hotspots,\n callGraph,\n categoryBreakdown,\n memoryTrend: frames.map((f) => f.memory),\n longTasks: [...this.longTasks]\n };\n }\n /**\n * 从帧历史构建调用图\n * 注意:totalTime 存储的是平均耗时(总耗时/调用次数),而不是累计总耗时\n */\n buildCallGraphFromFrames(frames) {\n // 临时存储累计数据\n const tempData = new Map();\n for (const frame of frames) {\n for (const sample of frame.samples) {\n // 获取或创建当前函数的节点\n let node = tempData.get(sample.name);\n if (!node) {\n node = {\n category: sample.category,\n callCount: 0,\n totalTime: 0,\n callers: new Map(),\n callees: new Map()\n };\n tempData.set(sample.name, node);\n }\n node.callCount++;\n node.totalTime += sample.duration;\n // 如果有父级,建立调用关系\n if (sample.parentName) {\n // 记录当前函数被谁调用\n const callerData = node.callers.get(sample.parentName) || { count: 0, totalTime: 0 };\n callerData.count++;\n callerData.totalTime += sample.duration;\n node.callers.set(sample.parentName, callerData);\n // 确保父节点存在并记录它调用了谁\n let parentNode = tempData.get(sample.parentName);\n if (!parentNode) {\n parentNode = {\n category: sample.category,\n callCount: 0,\n totalTime: 0,\n callers: new Map(),\n callees: new Map()\n };\n tempData.set(sample.parentName, parentNode);\n }\n const calleeData = parentNode.callees.get(sample.name) || { count: 0, totalTime: 0 };\n calleeData.count++;\n calleeData.totalTime += sample.duration;\n parentNode.callees.set(sample.name, calleeData);\n }\n }\n }\n // 转换为最终结果,将 totalTime 改为平均耗时\n const callGraph = new Map();\n for (const [name, data] of tempData) {\n const avgCallers = new Map();\n for (const [callerName, callerData] of data.callers) {\n avgCallers.set(callerName, {\n count: callerData.count,\n totalTime: callerData.count > 0 ? callerData.totalTime / callerData.count : 0\n });\n }\n const avgCallees = new Map();\n for (const [calleeName, calleeData] of data.callees) {\n avgCallees.set(calleeName, {\n count: calleeData.count,\n totalTime: calleeData.count > 0 ? calleeData.totalTime / calleeData.count : 0\n });\n }\n callGraph.set(name, {\n name,\n category: data.category,\n callCount: data.callCount,\n totalTime: data.callCount > 0 ? data.totalTime / data.callCount : 0,\n callers: avgCallers,\n callees: avgCallees\n });\n }\n return callGraph;\n }\n /**\n * 获取调用图数据\n */\n getCallGraph() {\n return new Map(this.callGraph);\n }\n /**\n * 获取特定函数的调用关系\n */\n getFunctionCallInfo(name) {\n const node = this.callGraph.get(name);\n if (!node)\n return null;\n return {\n callers: Array.from(node.callers.entries()).map(([name, data]) => ({\n name,\n ...data\n })),\n callees: Array.from(node.callees.entries()).map(([name, data]) => ({\n name,\n ...data\n }))\n };\n }\n /**\n * 释放资源\n */\n dispose() {\n if (this.performanceObserver) {\n this.performanceObserver.disconnect();\n this.performanceObserver = null;\n }\n this.reset();\n }\n captureMemory() {\n const now = performance.now();\n let usedHeapSize = 0;\n let totalHeapSize = 0;\n let heapSizeLimit = 0;\n const perfWithMemory = performance;\n if (perfWithMemory.memory) {\n usedHeapSize = perfWithMemory.memory.usedJSHeapSize || 0;\n totalHeapSize = perfWithMemory.memory.totalJSHeapSize || 0;\n heapSizeLimit = perfWithMemory.memory.jsHeapSizeLimit || 0;\n if (this.previousHeapSize > 0 && usedHeapSize < this.previousHeapSize - 1024 * 1024) {\n this.gcCount++;\n }\n this.previousHeapSize = usedHeapSize;\n }\n return {\n timestamp: now,\n usedHeapSize,\n totalHeapSize,\n heapSizeLimit,\n utilizationPercent: heapSizeLimit > 0 ? (usedHeapSize / heapSizeLimit) * 100 : 0,\n gcCount: this.gcCount\n };\n }\n resetFrameCounters() {\n for (const counter of this.counters.values()) {\n if (counter.type === 'counter') {\n counter.value = 0;\n }\n }\n }\n calculateSampleStats() {\n if (!this.currentFrame)\n return;\n const sampleMap = new Map();\n for (const sample of this.currentFrame.samples) {\n let stats = sampleMap.get(sample.name);\n if (!stats) {\n stats = {\n name: sample.name,\n category: sample.category,\n inclusiveTime: 0,\n exclusiveTime: 0,\n callCount: 0,\n averageTime: 0,\n minTime: Number.MAX_VALUE,\n maxTime: 0,\n percentOfFrame: 0,\n percentOfParent: 0,\n children: [],\n depth: sample.depth\n };\n sampleMap.set(sample.name, stats);\n }\n stats.inclusiveTime += sample.duration;\n stats.callCount += 1;\n stats.minTime = Math.min(stats.minTime, sample.duration);\n stats.maxTime = Math.max(stats.maxTime, sample.duration);\n }\n for (const sample of this.currentFrame.samples) {\n if (sample.parentId) {\n const parentSample = this.currentFrame.samples.find((s) => s.id === sample.parentId);\n if (parentSample) {\n const parentStats = sampleMap.get(parentSample.name);\n if (parentStats) {\n parentStats.exclusiveTime = parentStats.inclusiveTime;\n for (const childSample of this.currentFrame.samples) {\n if (childSample.parentId === parentSample.id) {\n parentStats.exclusiveTime -= childSample.duration;\n }\n }\n }\n }\n }\n }\n const frameDuration = this.currentFrame.duration || 1;\n for (const stats of sampleMap.values()) {\n stats.averageTime = stats.inclusiveTime / stats.callCount;\n stats.percentOfFrame = (stats.inclusiveTime / frameDuration) * 100;\n if (stats.exclusiveTime === 0) {\n stats.exclusiveTime = stats.inclusiveTime;\n }\n }\n this.currentFrame.sampleStats = Array.from(sampleMap.values())\n .sort((a, b) => b.inclusiveTime - a.inclusiveTime);\n }\n calculateCategoryStats() {\n if (!this.currentFrame)\n return;\n const categoryMap = new Map();\n for (const sample of this.currentFrame.samples) {\n if (sample.depth === 0) {\n let stats = categoryMap.get(sample.category);\n if (!stats) {\n stats = { totalTime: 0, sampleCount: 0 };\n categoryMap.set(sample.category, stats);\n }\n stats.totalTime += sample.duration;\n stats.sampleCount += 1;\n }\n }\n const frameDuration = this.currentFrame.duration || 1;\n for (const [category, stats] of categoryMap) {\n this.currentFrame.categoryStats.set(category, {\n ...stats,\n percentOfFrame: (stats.totalTime / frameDuration) * 100\n });\n }\n }\n updateCallGraph(name, category, duration, parentHandle) {\n let node = this.callGraph.get(name);\n if (!node) {\n node = {\n name,\n category,\n callCount: 0,\n totalTime: 0,\n callers: new Map(),\n callees: new Map()\n };\n this.callGraph.set(name, node);\n }\n node.callCount++;\n node.totalTime += duration;\n // 如果有父级,建立调用关系\n if (parentHandle) {\n // 记录当前函数被谁调用\n const callerData = node.callers.get(parentHandle.name) || { count: 0, totalTime: 0 };\n callerData.count++;\n callerData.totalTime += duration;\n node.callers.set(parentHandle.name, callerData);\n // 确保父节点存在\n let parentNode = this.callGraph.get(parentHandle.name);\n if (!parentNode) {\n parentNode = {\n name: parentHandle.name,\n category: parentHandle.category,\n callCount: 0,\n totalTime: 0,\n callers: new Map(),\n callees: new Map()\n };\n this.callGraph.set(parentHandle.name, parentNode);\n }\n // 记录父函数调用了谁\n const calleeData = parentNode.callees.get(name) || { count: 0, totalTime: 0 };\n calleeData.count++;\n calleeData.totalTime += duration;\n parentNode.callees.set(name, calleeData);\n }\n }\n aggregateSampleStats(frames) {\n const aggregated = new Map();\n for (const frame of frames) {\n for (const stats of frame.sampleStats) {\n let agg = aggregated.get(stats.name);\n if (!agg) {\n agg = {\n ...stats,\n minTime: Number.MAX_VALUE\n };\n aggregated.set(stats.name, agg);\n }\n else {\n agg.inclusiveTime += stats.inclusiveTime;\n agg.exclusiveTime += stats.exclusiveTime;\n agg.callCount += stats.callCount;\n agg.minTime = Math.min(agg.minTime, stats.minTime);\n agg.maxTime = Math.max(agg.maxTime, stats.maxTime);\n }\n }\n }\n const totalTime = frames.reduce((sum, f) => sum + f.duration, 0);\n for (const stats of aggregated.values()) {\n stats.averageTime = stats.inclusiveTime / stats.callCount;\n stats.percentOfFrame = (stats.inclusiveTime / totalTime) * 100;\n }\n return Array.from(aggregated.values());\n }\n aggregateCategoryStats(frames) {\n const aggregated = new Map();\n for (const frame of frames) {\n for (const [category, stats] of frame.categoryStats) {\n let agg = aggregated.get(category);\n if (!agg) {\n agg = { totalTime: 0, frameCount: 0 };\n aggregated.set(category, agg);\n }\n agg.totalTime += stats.totalTime;\n agg.frameCount++;\n }\n }\n const totalTime = frames.reduce((sum, f) => sum + f.duration, 0);\n const result = new Map();\n for (const [category, agg] of aggregated) {\n result.set(category, {\n totalTime: agg.totalTime,\n averageTime: agg.frameCount > 0 ? agg.totalTime / agg.frameCount : 0,\n percentOfTotal: totalTime > 0 ? (agg.totalTime / totalTime) * 100 : 0\n });\n }\n return result;\n }\n setupLongTaskObserver() {\n if (typeof PerformanceObserver === 'undefined')\n return;\n try {\n this.performanceObserver = new PerformanceObserver((list) => {\n for (const entry of list.getEntries()) {\n if (entry.duration > this.config.longTaskThreshold) {\n this.longTasks.push({\n startTime: entry.startTime,\n duration: entry.duration,\n attribution: entry.attribution?.map((a) => a.name) || []\n });\n if (this.longTasks.length > 100) {\n this.longTasks.shift();\n }\n }\n }\n });\n this.performanceObserver.observe({ entryTypes: ['longtask'] });\n }\n catch {\n // Long Task API not supported\n }\n }\n createEmptyReport() {\n return {\n startTime: 0,\n endTime: 0,\n totalFrames: 0,\n averageFrameTime: 0,\n minFrameTime: 0,\n maxFrameTime: 0,\n p95FrameTime: 0,\n p99FrameTime: 0,\n hotspots: [],\n callGraph: new Map(),\n categoryBreakdown: new Map(),\n memoryTrend: [],\n longTasks: []\n };\n }\n}\nProfilerSDK.instance = null;\n//# sourceMappingURL=ProfilerSDK.js.map","/**\n * 高级性能分析数据收集器\n *\n * 整合 ProfilerSDK 和现有 PerformanceMonitor 的数据,\n * 提供统一的高级性能分析数据接口\n */\nimport { ProfilerSDK } from '../Profiler/ProfilerSDK';\nimport { ProfileCategory } from '../Profiler/ProfilerTypes';\nimport { Time } from '../Time';\n/**\n * 高级性能分析数据收集器\n */\nexport class AdvancedProfilerCollector {\n constructor() {\n this.selectedFunction = null;\n this.peakMemory = 0;\n // ProfilerSDK 通过静态方法访问\n }\n /**\n * 设置选中的函数(用于调用关系视图)\n */\n setSelectedFunction(name) {\n this.selectedFunction = name;\n }\n /**\n * 收集高级性能数据\n */\n collectAdvancedData(performanceMonitor) {\n const frameHistory = ProfilerSDK.getFrameHistory();\n const currentFrame = ProfilerSDK.getCurrentFrame();\n const report = ProfilerSDK.getReport(300);\n const currentMemory = currentFrame?.memory || this.getDefaultMemory();\n if (currentMemory.usedHeapSize > this.peakMemory) {\n this.peakMemory = currentMemory.usedHeapSize;\n }\n return {\n currentFrame: this.buildCurrentFrameData(currentFrame),\n frameTimeHistory: this.buildFrameTimeHistory(frameHistory),\n categoryStats: this.buildCategoryStats(currentFrame, performanceMonitor),\n hotspots: this.buildHotspots(report),\n callGraph: this.buildCallGraph(report),\n longTasks: report.longTasks,\n memoryTrend: this.buildMemoryTrend(report.memoryTrend),\n summary: this.buildSummary(report, currentMemory)\n };\n }\n /**\n * 从现有 PerformanceMonitor 数据构建兼容格式\n */\n collectFromLegacyMonitor(performanceMonitor) {\n if (!performanceMonitor) {\n return this.createEmptyData();\n }\n const systemStats = performanceMonitor.getAllSystemStats?.() || new Map();\n const systemData = performanceMonitor.getAllSystemData?.() || new Map();\n const frameTime = Time.deltaTime * 1000;\n const fps = frameTime > 0 ? Math.round(1000 / frameTime) : 0;\n const categoryStats = this.buildCategoryStatsFromLegacy(systemStats, systemData, frameTime);\n const hotspots = this.buildHotspotsFromLegacy(systemStats, systemData, frameTime);\n return {\n currentFrame: {\n frameNumber: 0,\n frameTime,\n fps,\n memory: this.getCurrentMemory()\n },\n frameTimeHistory: [],\n categoryStats,\n hotspots,\n callGraph: {\n currentFunction: this.selectedFunction,\n callers: [],\n callees: []\n },\n longTasks: [],\n memoryTrend: [],\n summary: {\n totalFrames: 0,\n averageFrameTime: frameTime,\n minFrameTime: frameTime,\n maxFrameTime: frameTime,\n p95FrameTime: frameTime,\n p99FrameTime: frameTime,\n currentMemoryMB: this.getCurrentMemory().usedHeapSize / (1024 * 1024),\n peakMemoryMB: this.peakMemory / (1024 * 1024),\n gcCount: 0,\n longTaskCount: 0\n }\n };\n }\n buildCurrentFrameData(frame) {\n if (!frame) {\n const frameTime = Time.deltaTime * 1000;\n return {\n frameNumber: 0,\n frameTime,\n fps: frameTime > 0 ? Math.round(1000 / frameTime) : 0,\n memory: this.getCurrentMemory()\n };\n }\n return {\n frameNumber: frame.frameNumber,\n frameTime: frame.duration,\n fps: frame.duration > 0 ? Math.round(1000 / frame.duration) : 0,\n memory: frame.memory\n };\n }\n buildFrameTimeHistory(frames) {\n return frames.map(f => ({\n frameNumber: f.frameNumber,\n time: f.startTime,\n duration: f.duration\n }));\n }\n buildCategoryStats(frame, performanceMonitor) {\n const result = [];\n if (frame && frame.categoryStats.size > 0) {\n const frameDuration = frame.duration || 1;\n for (const [category, stats] of frame.categoryStats) {\n const categoryItems = frame.sampleStats\n .filter(s => s.category === category)\n .map(s => ({\n name: s.name,\n inclusiveTime: s.inclusiveTime,\n exclusiveTime: s.exclusiveTime,\n callCount: s.callCount,\n percentOfCategory: stats.totalTime > 0\n ? (s.inclusiveTime / stats.totalTime) * 100\n : 0,\n percentOfFrame: (s.inclusiveTime / frameDuration) * 100\n }))\n .sort((a, b) => b.inclusiveTime - a.inclusiveTime);\n result.push({\n category,\n totalTime: stats.totalTime,\n percentOfFrame: stats.percentOfFrame,\n sampleCount: stats.sampleCount,\n items: categoryItems\n });\n }\n }\n if (performanceMonitor && result.length === 0) {\n const systemStats = performanceMonitor.getAllSystemStats?.() || new Map();\n const systemData = performanceMonitor.getAllSystemData?.() || new Map();\n const frameTime = Time.deltaTime * 1000 || 1;\n return this.buildCategoryStatsFromLegacy(systemStats, systemData, frameTime);\n }\n return result.sort((a, b) => b.totalTime - a.totalTime);\n }\n buildCategoryStatsFromLegacy(systemStats, systemData, frameTime) {\n const ecsItems = [];\n let totalECSTime = 0;\n for (const [name, stats] of systemStats.entries()) {\n const data = systemData.get(name);\n const execTime = data?.executionTime || stats?.averageTime || 0;\n totalECSTime += execTime;\n ecsItems.push({\n name,\n inclusiveTime: execTime,\n exclusiveTime: execTime,\n callCount: 1,\n percentOfCategory: 0,\n percentOfFrame: frameTime > 0 ? (execTime / frameTime) * 100 : 0\n });\n }\n for (const item of ecsItems) {\n item.percentOfCategory = totalECSTime > 0\n ? (item.inclusiveTime / totalECSTime) * 100\n : 0;\n }\n ecsItems.sort((a, b) => b.inclusiveTime - a.inclusiveTime);\n if (ecsItems.length === 0) {\n return [];\n }\n return [{\n category: ProfileCategory.ECS,\n totalTime: totalECSTime,\n percentOfFrame: frameTime > 0 ? (totalECSTime / frameTime) * 100 : 0,\n sampleCount: ecsItems.length,\n items: ecsItems\n }];\n }\n buildHotspots(report) {\n const totalTime = report.hotspots.reduce((sum, h) => sum + h.inclusiveTime, 0) || 1;\n // 使用 callGraph 构建层级结构\n // 找出所有根节点(没有被任何函数调用的,或者是顶层函数)\n const rootFunctions = new Set();\n const childFunctions = new Set();\n for (const [name, node] of report.callGraph) {\n // 如果没有调用者,或者调用者不在 hotspots 中,则是根节点\n if (node.callers.size === 0) {\n rootFunctions.add(name);\n }\n else {\n // 检查是否所有调用者都在 hotspots 之外\n let hasParentInHotspots = false;\n for (const callerName of node.callers.keys()) {\n if (report.callGraph.has(callerName)) {\n hasParentInHotspots = true;\n childFunctions.add(name);\n break;\n }\n }\n if (!hasParentInHotspots) {\n rootFunctions.add(name);\n }\n }\n }\n // 递归构建层级热点数据\n const buildHotspotItem = (name, depth, visited) => {\n if (visited.has(name))\n return null; // 避免循环\n visited.add(name);\n const stats = report.hotspots.find(h => h.name === name);\n const node = report.callGraph.get(name);\n if (!stats && !node)\n return null;\n const inclusiveTime = stats?.inclusiveTime || node?.totalTime || 0;\n const exclusiveTime = stats?.exclusiveTime || inclusiveTime;\n const callCount = stats?.callCount || node?.callCount || 1;\n // 构建子节点\n const children = [];\n if (node && depth < 5) { // 限制深度避免过深\n for (const [calleeName] of node.callees) {\n const child = buildHotspotItem(calleeName, depth + 1, visited);\n if (child) {\n children.push(child);\n }\n }\n // 按耗时排序\n children.sort((a, b) => b.inclusiveTime - a.inclusiveTime);\n }\n return {\n name,\n category: stats?.category || node?.category || ProfileCategory.Custom,\n inclusiveTime,\n inclusiveTimePercent: (inclusiveTime / totalTime) * 100,\n exclusiveTime,\n exclusiveTimePercent: (exclusiveTime / totalTime) * 100,\n callCount,\n avgCallTime: callCount > 0 ? inclusiveTime / callCount : 0,\n depth,\n children: children.length > 0 ? children : undefined\n };\n };\n // 构建根节点列表\n const result = [];\n const visited = new Set();\n for (const rootName of rootFunctions) {\n const item = buildHotspotItem(rootName, 0, visited);\n if (item) {\n result.push(item);\n }\n }\n // 按耗时排序\n result.sort((a, b) => b.inclusiveTime - a.inclusiveTime);\n return result.slice(0, 50);\n }\n buildHotspotsFromLegacy(systemStats, systemData, frameTime) {\n const hotspots = [];\n for (const [name, stats] of systemStats.entries()) {\n const data = systemData.get(name);\n const execTime = data?.executionTime || stats?.averageTime || 0;\n hotspots.push({\n name,\n category: ProfileCategory.ECS,\n inclusiveTime: execTime,\n inclusiveTimePercent: frameTime > 0 ? (execTime / frameTime) * 100 : 0,\n exclusiveTime: execTime,\n exclusiveTimePercent: frameTime > 0 ? (execTime / frameTime) * 100 : 0,\n callCount: stats?.executionCount || 1,\n avgCallTime: stats?.averageTime || execTime,\n depth: 0\n });\n }\n return hotspots.sort((a, b) => b.inclusiveTime - a.inclusiveTime).slice(0, 50);\n }\n buildCallGraph(report) {\n if (!this.selectedFunction) {\n return {\n currentFunction: null,\n callers: [],\n callees: []\n };\n }\n const node = report.callGraph.get(this.selectedFunction);\n if (!node) {\n return {\n currentFunction: this.selectedFunction,\n callers: [],\n callees: []\n };\n }\n // 计算所有调用者的总调用次数(用于计算调用者的百分比)\n let totalCallerCount = 0;\n for (const data of node.callers.values()) {\n totalCallerCount += data.count;\n }\n // Calling Functions(谁调用了我)\n // - totalTime: 该调用者调用当前函数时的平均耗时\n // - percentOfCurrent: 该调用者的调用次数占总调用次数的百分比\n const callers = Array.from(node.callers.entries())\n .map(([name, data]) => ({\n name,\n callCount: data.count,\n totalTime: data.totalTime,\n percentOfCurrent: totalCallerCount > 0 ? (data.count / totalCallerCount) * 100 : 0\n }))\n .sort((a, b) => b.callCount - a.callCount);\n // Called Functions(我调用了谁)\n // - totalTime: 当前函数调用该被调用者时的平均耗时\n // - percentOfCurrent: 该被调用者的耗时占当前函数耗时的百分比\n const callees = Array.from(node.callees.entries())\n .map(([name, data]) => ({\n name,\n callCount: data.count,\n totalTime: data.totalTime,\n percentOfCurrent: node.totalTime > 0 ? (data.totalTime / node.totalTime) * 100 : 0\n }))\n .sort((a, b) => b.totalTime - a.totalTime);\n return {\n currentFunction: this.selectedFunction,\n callers,\n callees\n };\n }\n buildMemoryTrend(snapshots) {\n return snapshots.map(s => ({\n time: s.timestamp,\n usedMB: s.usedHeapSize / (1024 * 1024),\n totalMB: s.totalHeapSize / (1024 * 1024),\n gcCount: s.gcCount\n }));\n }\n buildSummary(report, currentMemory) {\n return {\n totalFrames: report.totalFrames,\n averageFrameTime: report.averageFrameTime,\n minFrameTime: report.minFrameTime,\n maxFrameTime: report.maxFrameTime,\n p95FrameTime: report.p95FrameTime,\n p99FrameTime: report.p99FrameTime,\n currentMemoryMB: currentMemory.usedHeapSize / (1024 * 1024),\n peakMemoryMB: this.peakMemory / (1024 * 1024),\n gcCount: currentMemory.gcCount,\n longTaskCount: report.longTasks.length\n };\n }\n getCurrentMemory() {\n const perfWithMemory = performance;\n const usedHeapSize = perfWithMemory.memory?.usedJSHeapSize || 0;\n const totalHeapSize = perfWithMemory.memory?.totalJSHeapSize || 0;\n const heapSizeLimit = perfWithMemory.memory?.jsHeapSizeLimit || 0;\n return {\n timestamp: performance.now(),\n usedHeapSize,\n totalHeapSize,\n heapSizeLimit,\n utilizationPercent: heapSizeLimit > 0 ? (usedHeapSize / heapSizeLimit) * 100 : 0,\n gcCount: 0\n };\n }\n getDefaultMemory() {\n return {\n timestamp: performance.now(),\n usedHeapSize: 0,\n totalHeapSize: 0,\n heapSizeLimit: 0,\n utilizationPercent: 0,\n gcCount: 0\n };\n }\n createEmptyData() {\n return {\n currentFrame: {\n frameNumber: 0,\n frameTime: 0,\n fps: 0,\n memory: this.getDefaultMemory()\n },\n frameTimeHistory: [],\n categoryStats: [],\n hotspots: [],\n callGraph: {\n currentFunction: null,\n callers: [],\n callees: []\n },\n longTasks: [],\n memoryTrend: [],\n summary: {\n totalFrames: 0,\n averageFrameTime: 0,\n minFrameTime: 0,\n maxFrameTime: 0,\n p95FrameTime: 0,\n p99FrameTime: 0,\n currentMemoryMB: 0,\n peakMemoryMB: 0,\n gcCount: 0,\n longTaskCount: 0\n }\n };\n }\n}\n//# sourceMappingURL=AdvancedProfilerCollector.js.map","/**\n * 位枚举\n */\nexport var SegmentPart;\n(function (SegmentPart) {\n SegmentPart[SegmentPart[\"LOW\"] = 0] = \"LOW\";\n SegmentPart[SegmentPart[\"HIGH\"] = 1] = \"HIGH\";\n})(SegmentPart || (SegmentPart = {}));\nexport class BitMask64Utils {\n /**\n * 根据位索引创建64位掩码\n * @param bitIndex 位索引,范围 [0, 63]\n * @returns 包含指定位设置为1的掩码\n * @throws 当位索引超出范围时抛出错误\n */\n static create(bitIndex) {\n if (bitIndex < 0) {\n throw new Error(`Bit index ${bitIndex} out of range [0, ∞)`);\n }\n const mask = { base: [0, 0] };\n BitMask64Utils.setBit(mask, bitIndex);\n return mask;\n }\n /**\n * 从32位数字创建64位掩码\n * @param value 32位数字值\n * @returns 低32位为输入值、高32位为0的掩码\n */\n static fromNumber(value) {\n return { base: [value >>> 0, 0] };\n }\n /**\n * 检查掩码是否包含任意指定的位\n * @param mask 要检查的掩码\n * @param bits 指定的位模式\n * @returns 如果掩码包含bits中的任意位则返回true\n */\n static hasAny(mask, bits) {\n const bitsBase = bits.base;\n const maskBase = mask.base;\n const bitsSegments = bits.segments;\n const maskSegments = mask.segments;\n const baseHasAny = (maskBase[SegmentPart.LOW] & bitsBase[SegmentPart.LOW]) !== 0 || (maskBase[SegmentPart.HIGH] & bitsBase[SegmentPart.HIGH]) !== 0;\n // 基础区段就包含指定的位,或任意一个参数不含扩展区段,直接短路\n if (baseHasAny || !bitsSegments || !maskSegments)\n return baseHasAny;\n // 额外检查扩展区域是否包含指定的位 - 如果bitsSegments[index]不存在,会被转为NaN,NaN的位运算始终返回0\n return maskSegments.some((seg, index) => {\n const bitsSeg = bitsSegments[index];\n return bitsSeg && ((seg[SegmentPart.LOW] & bitsSeg[SegmentPart.LOW]) !== 0 || (seg[SegmentPart.HIGH] & bitsSeg[SegmentPart.HIGH]) !== 0);\n });\n }\n /**\n * 检查掩码是否包含所有指定的位\n * @param mask 要检查的掩码\n * @param bits 指定的位模式\n * @returns 如果掩码包含bits中的所有位则返回true\n */\n static hasAll(mask, bits) {\n const maskBase = mask.base;\n const bitsBase = bits.base;\n const maskSegments = mask.segments;\n const bitsSegments = bits.segments;\n const baseHasAll = (maskBase[SegmentPart.LOW] & bitsBase[SegmentPart.LOW]) === bitsBase[SegmentPart.LOW] && (maskBase[SegmentPart.HIGH] & bitsBase[SegmentPart.HIGH]) === bitsBase[SegmentPart.HIGH];\n // 基础区域就不包含指定的位,或bits没有扩展区段,直接短路。\n if (!baseHasAll || !bitsSegments)\n return baseHasAll;\n // 扩展区段的hasAll匹配逻辑\n const maskSegmentsLength = maskSegments?.length ?? 0;\n // 对mask/bits中都存在的区段,进行hasAll判断\n if (maskSegments) {\n for (let i = 0; i < Math.min(maskSegmentsLength, bitsSegments.length); i++) {\n const maskSeg = maskSegments[i];\n const bitsSeg = bitsSegments[i];\n if ((maskSeg[SegmentPart.LOW] & bitsSeg[SegmentPart.LOW]) !== bitsSeg[SegmentPart.LOW] || (maskSeg[SegmentPart.HIGH] & bitsSeg[SegmentPart.HIGH]) !== bitsSeg[SegmentPart.HIGH]) {\n // 存在不匹配的位,直接短路\n return false;\n }\n }\n }\n // 对mask中不存在,但bits中存在的区段,进行isZero判断\n for (let i = maskSegmentsLength; i < bitsSegments.length; i++) {\n const bitsSeg = bitsSegments[i];\n if (bitsSeg[SegmentPart.LOW] !== 0 || bitsSeg[SegmentPart.HIGH] !== 0) {\n // 存在不为0的区段,直接短路\n return false;\n }\n }\n return true;\n }\n /**\n * 检查掩码是否不包含任何指定的位\n * @param mask 要检查的掩码\n * @param bits 指定的位模式\n * @returns 如果掩码不包含bits中的任何位则返回true\n */\n static hasNone(mask, bits) {\n const maskBase = mask.base;\n const bitsBase = bits.base;\n const maskSegments = mask.segments;\n const bitsSegments = bits.segments;\n const baseHasNone = (maskBase[SegmentPart.LOW] & bitsBase[SegmentPart.LOW]) === 0 && (maskBase[SegmentPart.HIGH] & bitsBase[SegmentPart.HIGH]) === 0;\n //不含扩展区域,或基础区域就包含指定的位,或bits不含拓展区段,直接短路。\n if (!maskSegments || !baseHasNone || !bitsSegments)\n return baseHasNone;\n // 额外检查扩展区域是否都包含指定的位 - 此时bitsSegments存在,如果bitsSegments[index]不存在,会被转为NaN,NaN的位运算始终返回0\n return maskSegments.every((seg, index) => {\n const bitsSeg = bitsSegments[index];\n if (!bitsSeg)\n return true;\n return (seg[SegmentPart.LOW] & bitsSeg[SegmentPart.LOW]) === 0 && (seg[SegmentPart.HIGH] & bitsSeg[SegmentPart.HIGH]) === 0;\n });\n }\n /**\n * 检查掩码是否为零\n * @param mask 要检查的掩码\n * @returns 如果掩码所有位都为0则返回true\n */\n static isZero(mask) {\n const baseIsZero = mask.base[SegmentPart.LOW] === 0 && mask.base[SegmentPart.HIGH] === 0;\n if (!mask.segments || !baseIsZero) {\n // 不含扩展区域,或基础区域值就不为0,直接短路\n return baseIsZero;\n }\n // 额外检查扩展区域是否都为0\n return mask.segments.every((seg) => seg[SegmentPart.LOW] === 0 && seg[SegmentPart.HIGH] === 0);\n }\n /**\n * 检查两个掩码是否相等\n * @param a 第一个掩码\n * @param b 第二个掩码\n * @returns 如果两个掩码完全相等则返回true\n */\n static equals(a, b) {\n const baseEquals = a.base[SegmentPart.LOW] === b.base[SegmentPart.LOW] && a.base[SegmentPart.HIGH] === b.base[SegmentPart.HIGH];\n // base不相等,或ab都没有扩展区域位,直接返回base比较结果\n if (!baseEquals || (!a.segments && !b.segments))\n return baseEquals;\n // 不能假设a,b的segments都存在或长度相同.\n const aSegments = a.segments ?? [];\n const bSegments = b.segments ?? [];\n for (let i = 0; i < Math.max(aSegments.length, bSegments.length); i++) {\n const aSeg = aSegments[i]; // 可能为undefined\n const bSeg = bSegments[i]; // 可能为undefined\n if (aSeg && !bSeg) {\n //bSeg不存在,则必须要求aSeg全为0\n if (aSeg[SegmentPart.LOW] !== 0 || aSeg[SegmentPart.HIGH] !== 0)\n return false;\n }\n else if (!aSeg && bSeg) {\n //aSeg不存在,则必须要求bSeg全为0\n if (bSeg[SegmentPart.LOW] !== 0 || bSeg[SegmentPart.HIGH] !== 0)\n return false;\n }\n else if (aSeg && bSeg) {\n //理想状态:aSeg/bSeg都存在\n if (aSeg[SegmentPart.LOW] !== bSeg[SegmentPart.LOW] || aSeg[SegmentPart.HIGH] !== bSeg[SegmentPart.HIGH])\n return false;\n }\n }\n return true;\n }\n /**\n * 设置掩码中指定位为1,必要时自动扩展\n * @param mask 要修改的掩码(原地修改)\n * @param bitIndex 位索引,不小于零\n * @throws 当位索引超出范围时抛出错误\n */\n static setBit(mask, bitIndex) {\n if (bitIndex < 0) {\n throw new Error(`Bit index ${bitIndex} out of range [0, 63]`);\n }\n const targetSeg = BitMask64Utils.getSegmentByBitIndex(mask, bitIndex);\n const mod = bitIndex & 63; // bitIndex % 64 优化方案\n if (mod < 32) {\n targetSeg[SegmentPart.LOW] |= (1 << mod);\n }\n else {\n targetSeg[SegmentPart.HIGH] |= (1 << (mod - 32));\n }\n }\n /**\n * 获取掩码中指定位,如果位超出当前掩码的区段长度,则直接返回0\n * @param mask 掩码\n * @param bitIndex 位索引,不小于零\n */\n static getBit(mask, bitIndex) {\n if (bitIndex < 0) {\n return false;\n }\n const targetSeg = BitMask64Utils.getSegmentByBitIndex(mask, bitIndex, false);\n if (!targetSeg)\n return false;\n const mod = bitIndex & 63; // bitIndex % 64 优化方案\n if (mod < 32) {\n return (targetSeg[SegmentPart.LOW] & (1 << mod)) !== 0;\n }\n else {\n return (targetSeg[SegmentPart.HIGH] & (1 << (mod - 32))) !== 0;\n }\n }\n /**\n * 清除掩码中指定位为0,如果位超出当前掩码的区段长度,则什么也不做\n * @param mask 要修改的掩码(原地修改)\n * @param bitIndex 位索引,不小于0\n */\n static clearBit(mask, bitIndex) {\n if (bitIndex < 0) {\n throw new Error(`Bit index ${bitIndex} out of range [0, 63]`);\n }\n const targetSeg = BitMask64Utils.getSegmentByBitIndex(mask, bitIndex, false);\n if (!targetSeg)\n return;\n const mod = bitIndex & 63; // bitIndex % 64 优化方案\n if (mod < 32) {\n targetSeg[SegmentPart.LOW] &= ~(1 << mod);\n }\n else {\n targetSeg[SegmentPart.HIGH] &= ~(1 << (mod - 32));\n }\n }\n /**\n * 对目标掩码执行按位或操作\n * @param target 目标掩码(原地修改)\n * @param other 用于按位或的掩码\n */\n static orInPlace(target, other) {\n target.base[SegmentPart.LOW] |= other.base[SegmentPart.LOW];\n target.base[SegmentPart.HIGH] |= other.base[SegmentPart.HIGH];\n // 处理扩展段\n const otherSegments = other.segments;\n if (otherSegments && otherSegments.length > 0) {\n if (!target.segments) {\n target.segments = [];\n }\n const targetSegments = target.segments;\n // 确保 target 有足够的段\n while (targetSegments.length < otherSegments.length) {\n targetSegments.push([0, 0]);\n }\n // 对每个段执行或操作\n for (let i = 0; i < otherSegments.length; i++) {\n const targetSeg = targetSegments[i];\n const otherSeg = otherSegments[i];\n targetSeg[SegmentPart.LOW] |= otherSeg[SegmentPart.LOW];\n targetSeg[SegmentPart.HIGH] |= otherSeg[SegmentPart.HIGH];\n }\n }\n }\n /**\n * 对目标掩码执行按位与操作\n * @param target 目标掩码(原地修改)\n * @param other 用于按位与的掩码\n */\n static andInPlace(target, other) {\n target.base[SegmentPart.LOW] &= other.base[SegmentPart.LOW];\n target.base[SegmentPart.HIGH] &= other.base[SegmentPart.HIGH];\n // 处理扩展段\n const otherSegments = other.segments;\n if (otherSegments && otherSegments.length > 0) {\n if (!target.segments) {\n target.segments = [];\n }\n const targetSegments = target.segments;\n // 确保 target 有足够的段\n while (targetSegments.length < otherSegments.length) {\n targetSegments.push([0, 0]);\n }\n // 对每个段执行与操作\n for (let i = 0; i < otherSegments.length; i++) {\n const targetSeg = targetSegments[i];\n const otherSeg = otherSegments[i];\n targetSeg[SegmentPart.LOW] &= otherSeg[SegmentPart.LOW];\n targetSeg[SegmentPart.HIGH] &= otherSeg[SegmentPart.HIGH];\n }\n }\n }\n /**\n * 对目标掩码执行按位异或操作\n * @param target 目标掩码(原地修改)\n * @param other 用于按位异或的掩码\n */\n static xorInPlace(target, other) {\n target.base[SegmentPart.LOW] ^= other.base[SegmentPart.LOW];\n target.base[SegmentPart.HIGH] ^= other.base[SegmentPart.HIGH];\n // 处理扩展段\n const otherSegments = other.segments;\n if (!otherSegments || otherSegments.length == 0)\n return;\n if (!target.segments)\n target.segments = [];\n const targetSegments = target.segments;\n // 确保 target 有足够的段\n while (targetSegments.length < otherSegments.length) {\n targetSegments.push([0, 0]);\n }\n // 对每个段执行异或操作\n for (let i = 0; i < otherSegments.length; i++) {\n const targetSeg = targetSegments[i];\n const otherSeg = otherSegments[i];\n targetSeg[SegmentPart.LOW] ^= otherSeg[SegmentPart.LOW];\n targetSeg[SegmentPart.HIGH] ^= otherSeg[SegmentPart.HIGH];\n }\n }\n /**\n * 清除掩码的所有位为0\n * @param mask 要清除的掩码(原地修改)\n */\n static clear(mask) {\n mask.base[SegmentPart.LOW] = 0;\n mask.base[SegmentPart.HIGH] = 0;\n if (mask.segments) {\n for (let i = 0; i < mask.segments.length; i++) {\n const seg = mask.segments[i];\n seg[SegmentPart.LOW] = 0;\n seg[SegmentPart.HIGH] = 0;\n }\n }\n }\n /**\n * 将源掩码的值复制到目标掩码,如果source包含扩展段,则target也会至少扩展到source扩展段的长度\n * @param source 源掩码\n * @param target 目标掩码(原地修改)\n */\n static copy(source, target) {\n BitMask64Utils.clear(target);\n target.base[SegmentPart.LOW] = source.base[SegmentPart.LOW];\n target.base[SegmentPart.HIGH] = source.base[SegmentPart.HIGH];\n // source没有扩展段,直接退出\n if (!source.segments || source.segments.length == 0)\n return;\n // 没有拓展段,则直接复制数组\n if (!target.segments) {\n target.segments = source.segments.map((seg) => [...seg]);\n return;\n }\n // source有扩展段,target扩展段不足,则补充长度\n const copyLength = source.segments.length - target.segments.length;\n for (let i = 0; i < copyLength; i++) {\n target.segments.push([0, 0]);\n }\n // 逐个重写\n const targetSegments = target.segments;\n const sourceSegments = source.segments;\n for (let i = 0; i < sourceSegments.length; i++) {\n const targetSeg = targetSegments[i];\n const sourSeg = sourceSegments[i];\n targetSeg[SegmentPart.LOW] = sourSeg[SegmentPart.LOW];\n targetSeg[SegmentPart.HIGH] = sourSeg[SegmentPart.HIGH];\n }\n }\n /**\n * 创建掩码的深拷贝\n * @param mask 要拷贝的掩码\n * @returns 新的掩码对象,内容与源掩码相同\n */\n static clone(mask) {\n return {\n base: mask.base.slice(),\n ...(mask.segments && { segments: mask.segments.map((seg) => [...seg]) })\n };\n }\n /**\n * 将掩码转换为字符串表示,每个区段之间将使用空格分割。\n * @param mask 要转换的掩码\n * @param radix 进制,支持2(二进制)或16(十六进制),默认为2,其他的值被视为2\n * @param printHead 打印头\n * @returns 掩码的字符串表示,二进制不带前缀,十六进制带0x前缀\n */\n static toString(mask, radix = 2, printHead = false) {\n if (radix != 2 && radix != 16)\n radix = 2;\n const totalLength = mask.segments?.length ?? 0;\n let result = '';\n if (printHead) {\n let paddingLength = 0;\n if (radix === 2) {\n paddingLength = 64 + 1 + 1;\n }\n else {\n paddingLength = 16 + 2 + 1;\n }\n for (let i = 0; i <= totalLength; i++) {\n const title = i === 0 ? '0 (Base):' : `${i} (${64 * i}):`;\n result += title.toString().padEnd(paddingLength);\n }\n result += '\\n';\n }\n for (let i = -1; i < totalLength; i++) {\n let segResult = '';\n const bitMaskData = i == -1 ? mask.base : mask.segments[i];\n const hi = bitMaskData[SegmentPart.HIGH];\n const lo = bitMaskData[SegmentPart.LOW];\n if (radix == 2) {\n const hiBits = hi.toString(2).padStart(32, '0');\n const loBits = lo.toString(2).padStart(32, '0');\n segResult = hiBits + '_' + loBits; //高低位之间使用_隔离\n }\n else {\n let hiBits = hi ? hi.toString(16).toUpperCase() : '';\n if (printHead) {\n // 存在标头,则输出高位之前需要补齐位数\n hiBits = hiBits.padStart(8, '0');\n }\n let loBits = lo.toString(16).toUpperCase();\n if (hiBits) {\n // 存在高位 则输出低位之前需要补齐位数\n loBits = loBits.padStart(8, '0');\n }\n segResult = '0x' + hiBits + loBits;\n }\n if (i === -1)\n result += segResult;\n else\n result += ' ' + segResult; // 不同段之间使用空格隔离\n }\n return result;\n }\n /**\n * 计算掩码中设置为1的位数\n * @param mask 要计算的掩码\n * @returns 掩码中1的位数\n */\n static popCount(mask) {\n let count = 0;\n for (let i = -1; i < (mask.segments?.length ?? 0); i++) {\n const bitMaskData = i == -1 ? mask.base : mask.segments[i];\n let lo = bitMaskData[SegmentPart.LOW];\n let hi = bitMaskData[SegmentPart.HIGH];\n while (lo) {\n lo &= lo - 1;\n count++;\n }\n while (hi) {\n hi &= hi - 1;\n count++;\n }\n }\n return count;\n }\n /**\n * 获取包含目标位的BitMask64Segment\n * @param mask 要操作的掩码\n * @param bitIndex 目标位\n * @param createNewSegment 如果bitIndex超过了当前范围,是否自动补充扩展区域,默认为真\n * @private\n */\n static getSegmentByBitIndex(mask, bitIndex, createNewSegment = true) {\n if (bitIndex <= 63) {\n // 基础位\n return mask.base;\n }\n else {\n // 扩展位\n let segments = mask.segments;\n if (!segments) {\n if (!createNewSegment)\n return null;\n segments = mask.segments = [];\n }\n const targetSegIndex = (bitIndex >> 6) - 1; // Math.floor(bitIndex / 64) - 1的位运算优化\n if (segments.length <= targetSegIndex) {\n if (!createNewSegment)\n return null;\n const diff = targetSegIndex - segments.length + 1;\n for (let i = 0; i < diff; i++) {\n segments.push([0, 0]);\n }\n }\n return segments[targetSegIndex] ?? null;\n }\n }\n}\n/** 零掩码常量,所有位都为0 */\nBitMask64Utils.ZERO = { base: [0, 0] };\n//# sourceMappingURL=BigIntCompatibility.js.map","import { BitMask64Utils } from '../../Utils/BigIntCompatibility';\nimport { createLogger } from '../../../Utils/Logger';\nimport { getComponentTypeName } from '../../Decorators';\n/**\n * 组件注册表\n * 管理组件类型的位掩码分配\n */\nexport class ComponentRegistry {\n /**\n * 注册组件类型并分配位掩码\n * @param componentType 组件类型\n * @returns 分配的位索引\n */\n static register(componentType) {\n const typeName = getComponentTypeName(componentType);\n if (this.componentTypes.has(componentType)) {\n const existingIndex = this.componentTypes.get(componentType);\n return existingIndex;\n }\n // 检查是否有同名但不同类的组件已注册(热更新场景)\n // Check if a component with the same name but different class is registered (hot reload scenario)\n if (this.hotReloadEnabled && this.componentNameToType.has(typeName)) {\n const existingType = this.componentNameToType.get(typeName);\n if (existingType !== componentType) {\n // 热更新:替换旧的类为新的类,复用相同的 bitIndex\n // Hot reload: replace old class with new class, reuse the same bitIndex\n const existingIndex = this.componentTypes.get(existingType);\n // 移除旧类的映射\n // Remove old class mapping\n this.componentTypes.delete(existingType);\n // 用新类更新映射\n // Update mappings with new class\n this.componentTypes.set(componentType, existingIndex);\n this.bitIndexToType.set(existingIndex, componentType);\n this.componentNameToType.set(typeName, componentType);\n console.log(`[ComponentRegistry] Hot reload: replaced component \"${typeName}\"`);\n return existingIndex;\n }\n }\n const bitIndex = this.nextBitIndex++;\n this.componentTypes.set(componentType, bitIndex);\n this.bitIndexToType.set(bitIndex, componentType);\n this.componentNameToType.set(typeName, componentType);\n this.componentNameToId.set(typeName, bitIndex);\n return bitIndex;\n }\n /**\n * 获取组件类型的位掩码\n * @param componentType 组件类型\n * @returns 位掩码\n */\n static getBitMask(componentType) {\n const bitIndex = this.componentTypes.get(componentType);\n if (bitIndex === undefined) {\n const typeName = getComponentTypeName(componentType);\n throw new Error(`Component type ${typeName} is not registered`);\n }\n return BitMask64Utils.create(bitIndex);\n }\n /**\n * 获取组件类型的位索引\n * @param componentType 组件类型\n * @returns 位索引\n */\n static getBitIndex(componentType) {\n const bitIndex = this.componentTypes.get(componentType);\n if (bitIndex === undefined) {\n const typeName = getComponentTypeName(componentType);\n throw new Error(`Component type ${typeName} is not registered`);\n }\n return bitIndex;\n }\n /**\n * 检查组件类型是否已注册\n * @param componentType 组件类型\n * @returns 是否已注册\n */\n static isRegistered(componentType) {\n return this.componentTypes.has(componentType);\n }\n /**\n * 通过位索引获取组件类型\n * @param bitIndex 位索引\n * @returns 组件类型构造函数或null\n */\n static getTypeByBitIndex(bitIndex) {\n return this.bitIndexToType.get(bitIndex) || null;\n }\n /**\n * 获取当前已注册的组件类型数量\n * @returns 已注册数量\n */\n static getRegisteredCount() {\n return this.nextBitIndex;\n }\n /**\n * 通过名称获取组件类型\n * @param componentName 组件名称\n * @returns 组件类型构造函数\n */\n static getComponentType(componentName) {\n return this.componentNameToType.get(componentName) || null;\n }\n /**\n * 获取所有已注册的组件类型\n * @returns 组件类型映射\n */\n static getAllRegisteredTypes() {\n return new Map(this.componentTypes);\n }\n /**\n * 获取所有组件名称到类型的映射\n * @returns 名称到类型的映射\n */\n static getAllComponentNames() {\n return new Map(this.componentNameToType);\n }\n /**\n * 通过名称获取组件类型ID\n * @param componentName 组件名称\n * @returns 组件类型ID\n */\n static getComponentId(componentName) {\n return this.componentNameToId.get(componentName);\n }\n /**\n * 注册组件类型(通过名称)\n * @param componentName 组件名称\n * @returns 分配的组件ID\n */\n static registerComponentByName(componentName) {\n if (this.componentNameToId.has(componentName)) {\n return this.componentNameToId.get(componentName);\n }\n const bitIndex = this.nextBitIndex++;\n this.componentNameToId.set(componentName, bitIndex);\n return bitIndex;\n }\n /**\n * 创建单个组件的掩码\n * @param componentName 组件名称\n * @returns 组件掩码\n */\n static createSingleComponentMask(componentName) {\n const cacheKey = `single:${componentName}`;\n if (this.maskCache.has(cacheKey)) {\n return this.maskCache.get(cacheKey);\n }\n const componentId = this.getComponentId(componentName);\n if (componentId === undefined) {\n throw new Error(`Component type ${componentName} is not registered`);\n }\n const mask = BitMask64Utils.create(componentId);\n this.maskCache.set(cacheKey, mask);\n return mask;\n }\n /**\n * 创建多个组件的掩码\n * @param componentNames 组件名称数组\n * @returns 组合掩码\n */\n static createComponentMask(componentNames) {\n const sortedNames = [...componentNames].sort();\n const cacheKey = `multi:${sortedNames.join(',')}`;\n if (this.maskCache.has(cacheKey)) {\n return this.maskCache.get(cacheKey);\n }\n const mask = BitMask64Utils.clone(BitMask64Utils.ZERO);\n for (const name of componentNames) {\n const componentId = this.getComponentId(name);\n if (componentId !== undefined) {\n const componentMask = BitMask64Utils.create(componentId);\n BitMask64Utils.orInPlace(mask, componentMask);\n }\n }\n this.maskCache.set(cacheKey, mask);\n return mask;\n }\n /**\n * 清除掩码缓存\n */\n static clearMaskCache() {\n this.maskCache.clear();\n }\n /**\n * 启用热更新模式\n * Enable hot reload mode\n * 在编辑器环境中调用以支持脚本热更新\n * Call in editor environment to support script hot reload\n */\n static enableHotReload() {\n this.hotReloadEnabled = true;\n }\n /**\n * 禁用热更新模式\n * Disable hot reload mode\n */\n static disableHotReload() {\n this.hotReloadEnabled = false;\n }\n /**\n * 检查热更新模式是否启用\n * Check if hot reload mode is enabled\n */\n static isHotReloadEnabled() {\n return this.hotReloadEnabled;\n }\n /**\n * 重置注册表(用于测试)\n */\n static reset() {\n this.componentTypes.clear();\n this.bitIndexToType.clear();\n this.componentNameToType.clear();\n this.componentNameToId.clear();\n this.maskCache.clear();\n this.nextBitIndex = 0;\n this.hotReloadEnabled = false;\n }\n}\nComponentRegistry._logger = createLogger('ComponentStorage');\nComponentRegistry.componentTypes = new Map();\nComponentRegistry.bitIndexToType = new Map();\nComponentRegistry.componentNameToType = new Map();\nComponentRegistry.componentNameToId = new Map();\nComponentRegistry.maskCache = new Map();\nComponentRegistry.nextBitIndex = 0;\n/**\n * 热更新模式标志,默认禁用\n * Hot reload mode flag, disabled by default\n * 编辑器环境应启用此选项以支持脚本热更新\n * Editor environment should enable this to support script hot reload\n */\nComponentRegistry.hotReloadEnabled = false;\n//# sourceMappingURL=ComponentRegistry.js.map","import { BitMask64Utils } from '../Utils/BigIntCompatibility';\nimport { SoAStorage } from './SoAStorage';\nimport { createLogger } from '../../Utils/Logger';\nimport { getComponentTypeName } from '../Decorators';\nimport { ComponentRegistry } from './ComponentStorage/ComponentRegistry';\n// 导出核心类型\nexport { ComponentRegistry };\n/**\n * 高性能组件存储器\n */\nexport class ComponentStorage {\n constructor(componentType) {\n this.dense = [];\n this.entityIds = [];\n this.entityToIndex = new Map();\n this.componentType = componentType;\n // 确保组件类型已注册\n if (!ComponentRegistry.isRegistered(componentType)) {\n ComponentRegistry.register(componentType);\n }\n }\n /**\n * 添加组件\n * @param entityId 实体ID\n * @param component 组件实例\n */\n addComponent(entityId, component) {\n // 检查实体是否已有此组件\n if (this.entityToIndex.has(entityId)) {\n throw new Error(`Entity ${entityId} already has component ${getComponentTypeName(this.componentType)}`);\n }\n // 末尾插入到致密数组\n const index = this.dense.length;\n this.dense.push(component);\n this.entityIds.push(entityId);\n this.entityToIndex.set(entityId, index);\n }\n /**\n * 获取组件\n * @param entityId 实体ID\n * @returns 组件实例或null\n */\n getComponent(entityId) {\n const index = this.entityToIndex.get(entityId);\n return index !== undefined ? this.dense[index] : null;\n }\n /**\n * 检查实体是否有此组件\n * @param entityId 实体ID\n * @returns 是否有组件\n */\n hasComponent(entityId) {\n return this.entityToIndex.has(entityId);\n }\n /**\n * 移除组件\n * @param entityId 实体ID\n * @returns 被移除的组件或null\n */\n removeComponent(entityId) {\n const index = this.entityToIndex.get(entityId);\n if (index === undefined) {\n return null;\n }\n const component = this.dense[index];\n const lastIndex = this.dense.length - 1;\n if (index !== lastIndex) {\n // 将末尾元素交换到要删除的位置\n const lastComponent = this.dense[lastIndex];\n const lastEntityId = this.entityIds[lastIndex];\n this.dense[index] = lastComponent;\n this.entityIds[index] = lastEntityId;\n // 更新被交换元素的映射\n this.entityToIndex.set(lastEntityId, index);\n }\n // 移除末尾元素\n this.dense.pop();\n this.entityIds.pop();\n this.entityToIndex.delete(entityId);\n return component;\n }\n /**\n * 高效遍历所有组件\n * @param callback 回调函数\n */\n forEach(callback) {\n for (let i = 0; i < this.dense.length; i++) {\n callback(this.dense[i], this.entityIds[i], i);\n }\n }\n /**\n * 获取所有组件\n * @returns 组件数组\n */\n getDenseArray() {\n return {\n components: [...this.dense],\n entityIds: [...this.entityIds]\n };\n }\n /**\n * 清空所有组件\n */\n clear() {\n this.dense.length = 0;\n this.entityIds.length = 0;\n this.entityToIndex.clear();\n }\n /**\n * 获取组件数量\n */\n get size() {\n return this.dense.length;\n }\n /**\n * 获取组件类型\n */\n get type() {\n return this.componentType;\n }\n /**\n * 获取存储统计信息\n */\n getStats() {\n const totalSlots = this.dense.length;\n const usedSlots = this.dense.length;\n const freeSlots = 0; // 永远无空洞\n const fragmentation = 0; // 永远无碎片\n return {\n totalSlots,\n usedSlots,\n freeSlots,\n fragmentation\n };\n }\n}\n/**\n * 组件存储管理器\n * 管理所有组件类型的存储器\n */\nexport class ComponentStorageManager {\n constructor() {\n this.storages = new Map();\n }\n /**\n * 检查组件类型是否启用SoA存储\n * @param componentType 组件类型\n * @returns 是否为SoA存储\n */\n isSoAStorage(componentType) {\n const storage = this.storages.get(componentType);\n return storage instanceof SoAStorage;\n }\n /**\n * 获取SoA存储器(类型安全)\n * @param componentType 组件类型\n * @returns SoA存储器或null\n */\n getSoAStorage(componentType) {\n const storage = this.getStorage(componentType);\n return storage instanceof SoAStorage ? storage : null;\n }\n /**\n * 直接获取SoA字段数组(类型安全)\n * @param componentType 组件类型\n * @param fieldName 字段名\n * @returns TypedArray或null\n */\n getFieldArray(componentType, fieldName) {\n const soaStorage = this.getSoAStorage(componentType);\n return soaStorage ? soaStorage.getFieldArray(fieldName) : null;\n }\n /**\n * 直接获取SoA字段数组(类型安全,带字段名检查)\n * @param componentType 组件类型\n * @param fieldName 字段名(类型检查)\n * @returns TypedArray或null\n */\n getTypedFieldArray(componentType, fieldName) {\n const soaStorage = this.getSoAStorage(componentType);\n return soaStorage ? soaStorage.getTypedFieldArray(fieldName) : null;\n }\n /**\n * 获取SoA存储的活跃索引\n * @param componentType 组件类型\n * @returns 活跃索引数组或空数组\n */\n getActiveIndices(componentType) {\n const soaStorage = this.getSoAStorage(componentType);\n return soaStorage ? soaStorage.getActiveIndices() : [];\n }\n /**\n * 获取实体在SoA存储中的索引\n * @param componentType 组件类型\n * @param entityId 实体ID\n * @returns 存储索引或undefined\n */\n getEntityIndex(componentType, entityId) {\n const soaStorage = this.getSoAStorage(componentType);\n return soaStorage ? soaStorage.getEntityIndex(entityId) : undefined;\n }\n /**\n * 根据索引获取实体ID\n * @param componentType 组件类型\n * @param index 存储索引\n * @returns 实体ID或undefined\n */\n getEntityIdByIndex(componentType, index) {\n const soaStorage = this.getSoAStorage(componentType);\n return soaStorage ? soaStorage.getEntityIdByIndex(index) : undefined;\n }\n /**\n * 获取或创建组件存储器(默认原始存储)\n * @param componentType 组件类型\n * @returns 组件存储器\n */\n getStorage(componentType) {\n let storage = this.storages.get(componentType);\n if (!storage) {\n // 检查是否启用SoA优化\n const enableSoA = componentType.__enableSoA;\n if (enableSoA) {\n // 使用SoA优化存储\n storage = new SoAStorage(componentType);\n ComponentStorageManager._logger.info(`为 ${getComponentTypeName(componentType)} 启用SoA优化(适用于大规模批量操作)`);\n }\n else {\n // 默认使用原始存储\n storage = new ComponentStorage(componentType);\n }\n this.storages.set(componentType, storage);\n }\n return storage;\n }\n /**\n * 添加组件\n * @param entityId 实体ID\n * @param component 组件实例\n */\n addComponent(entityId, component) {\n const componentType = component.constructor;\n const storage = this.getStorage(componentType);\n storage.addComponent(entityId, component);\n }\n /**\n * 获取组件\n * @param entityId 实体ID\n * @param componentType 组件类型\n * @returns 组件实例或null\n */\n getComponent(entityId, componentType) {\n const storage = this.storages.get(componentType);\n return storage ? storage.getComponent(entityId) : null;\n }\n /**\n * 检查实体是否有组件\n * @param entityId 实体ID\n * @param componentType 组件类型\n * @returns 是否有组件\n */\n hasComponent(entityId, componentType) {\n const storage = this.storages.get(componentType);\n return storage ? storage.hasComponent(entityId) : false;\n }\n /**\n * 移除组件\n * @param entityId 实体ID\n * @param componentType 组件类型\n * @returns 被移除的组件或null\n */\n removeComponent(entityId, componentType) {\n const storage = this.storages.get(componentType);\n return storage ? storage.removeComponent(entityId) : null;\n }\n /**\n * 移除实体的所有组件\n * @param entityId 实体ID\n */\n removeAllComponents(entityId) {\n for (const storage of this.storages.values()) {\n storage.removeComponent(entityId);\n }\n }\n /**\n * 获取实体的组件位掩码\n * @param entityId 实体ID\n * @returns 组件位掩码\n */\n getComponentMask(entityId) {\n const mask = BitMask64Utils.clone(BitMask64Utils.ZERO);\n for (const [componentType, storage] of this.storages.entries()) {\n if (storage.hasComponent(entityId)) {\n const componentMask = ComponentRegistry.getBitMask(componentType);\n BitMask64Utils.orInPlace(mask, componentMask);\n }\n }\n return mask;\n }\n /**\n * 获取所有存储器的统计信息\n */\n getAllStats() {\n const stats = new Map();\n for (const [componentType, storage] of this.storages.entries()) {\n const typeName = getComponentTypeName(componentType);\n stats.set(typeName, storage.getStats());\n }\n return stats;\n }\n /**\n * 清空所有存储器\n */\n clear() {\n for (const storage of this.storages.values()) {\n storage.clear();\n }\n this.storages.clear();\n }\n}\nComponentStorageManager._logger = createLogger('ComponentStorage');\n//# sourceMappingURL=ComponentStorage.js.map","import { ComponentRegistry } from './Core/ComponentStorage';\nimport { BitMask64Utils } from './Utils/BigIntCompatibility';\nimport { createLogger } from '../Utils/Logger';\nimport { getComponentInstanceTypeName, getComponentTypeName } from './Decorators';\n/**\n * 实体比较器\n *\n * 用于比较两个实体的优先级,首先按更新顺序比较,然后按ID比较。\n */\nexport class EntityComparer {\n /**\n * 比较两个实体\n *\n * @param self - 第一个实体\n * @param other - 第二个实体\n * @returns 比较结果,负数表示self优先级更高,正数表示other优先级更高,0表示相等\n */\n compare(self, other) {\n let compare = self.updateOrder - other.updateOrder;\n if (compare == 0)\n compare = self.id - other.id;\n return compare;\n }\n}\n/**\n * 游戏实体类\n *\n * ECS架构中的实体(Entity),作为组件的容器。\n * 实体本身不包含游戏逻辑,所有功能都通过组件来实现。\n *\n * 层级关系通过 HierarchyComponent 和 HierarchySystem 管理,\n * 而非 Entity 内置属性,符合 ECS 组合原则。\n *\n * @example\n * ```typescript\n * // 创建实体\n * const entity = scene.createEntity(\"Player\");\n *\n * // 添加组件\n * const healthComponent = entity.addComponent(new HealthComponent(100));\n *\n * // 获取组件\n * const health = entity.getComponent(HealthComponent);\n *\n * // 层级关系使用 HierarchySystem\n * const hierarchySystem = scene.getSystem(HierarchySystem);\n * hierarchySystem.setParent(childEntity, parentEntity);\n * ```\n */\nexport class Entity {\n /**\n * 构造函数\n *\n * @param name - 实体名称\n * @param id - 实体唯一标识符\n */\n constructor(name, id) {\n /**\n * 所属场景引用\n */\n this.scene = null;\n /**\n * 销毁状态标志\n */\n this._isDestroyed = false;\n /**\n * 激活状态\n */\n this._active = true;\n /**\n * 实体标签\n */\n this._tag = 0;\n /**\n * 启用状态\n */\n this._enabled = true;\n /**\n * 更新顺序\n */\n this._updateOrder = 0;\n /**\n * 组件位掩码(用于快速 hasComponent 检查)\n */\n this._componentMask = BitMask64Utils.clone(BitMask64Utils.ZERO);\n /**\n * 懒加载的组件数组缓存\n */\n this._componentCache = null;\n /**\n * 生命周期策略\n *\n * Lifecycle policy for scene transitions.\n */\n this._lifecyclePolicy = 0 /* EEntityLifecyclePolicy.SceneLocal */;\n this.name = name;\n this.id = id;\n }\n /**\n * 获取生命周期策略\n *\n * Get lifecycle policy.\n */\n get lifecyclePolicy() {\n return this._lifecyclePolicy;\n }\n /**\n * 检查实体是否为持久化实体\n *\n * Check if entity is persistent (survives scene transitions).\n */\n get isPersistent() {\n return this._lifecyclePolicy === 1 /* EEntityLifecyclePolicy.Persistent */;\n }\n /**\n * 设置实体为持久化(跨场景保留)\n *\n * 标记后的实体在场景切换时不会被销毁,会自动迁移到新场景。\n *\n * Mark entity as persistent (survives scene transitions).\n * Persistent entities are automatically migrated to the new scene.\n *\n * @returns this,支持链式调用 | Returns this for chaining\n *\n * @example\n * ```typescript\n * const player = scene.createEntity('Player')\n * .setPersistent()\n * .addComponent(new PlayerComponent());\n * ```\n */\n setPersistent() {\n this._lifecyclePolicy = 1 /* EEntityLifecyclePolicy.Persistent */;\n return this;\n }\n /**\n * 设置实体为场景本地(随场景销毁)\n *\n * 将实体恢复为默认行为。\n *\n * Mark entity as scene-local (destroyed with scene).\n * Restores default behavior.\n *\n * @returns this,支持链式调用 | Returns this for chaining\n */\n setSceneLocal() {\n this._lifecyclePolicy = 0 /* EEntityLifecyclePolicy.SceneLocal */;\n return this;\n }\n /**\n * 获取销毁状态\n * @returns 如果实体已被销毁则返回true\n */\n get isDestroyed() {\n return this._isDestroyed;\n }\n /**\n * 设置销毁状态(内部使用)\n *\n * 此方法供Scene和批量操作使用,以提高性能。\n * 不应在普通业务逻辑中调用,应使用destroy()方法。\n *\n * @internal\n */\n setDestroyedState(destroyed) {\n this._isDestroyed = destroyed;\n }\n /**\n * 获取组件数组(懒加载)\n * @returns 只读的组件数组\n */\n get components() {\n if (this._componentCache === null) {\n this._rebuildComponentCache();\n }\n return this._componentCache;\n }\n /**\n * 从存储重建组件缓存\n */\n _rebuildComponentCache() {\n const components = [];\n if (!this.scene?.componentStorageManager) {\n this._componentCache = components;\n return;\n }\n const mask = this._componentMask;\n const maxBitIndex = ComponentRegistry.getRegisteredCount();\n for (let bitIndex = 0; bitIndex < maxBitIndex; bitIndex++) {\n if (BitMask64Utils.getBit(mask, bitIndex)) {\n const componentType = ComponentRegistry.getTypeByBitIndex(bitIndex);\n if (componentType) {\n const component = this.scene.componentStorageManager.getComponent(this.id, componentType);\n if (component) {\n components.push(component);\n }\n }\n }\n }\n this._componentCache = components;\n }\n /**\n * 获取活跃状态\n *\n * @returns 如果实体处于活跃状态则返回true\n */\n get active() {\n return this._active;\n }\n /**\n * 设置活跃状态\n *\n * @param value - 新的活跃状态\n */\n set active(value) {\n if (this._active !== value) {\n this._active = value;\n this.onActiveChanged();\n }\n }\n /**\n * 获取实体标签\n *\n * @returns 实体的数字标签\n */\n get tag() {\n return this._tag;\n }\n /**\n * 设置实体标签\n *\n * @param value - 新的标签值\n */\n set tag(value) {\n this._tag = value;\n }\n /**\n * 获取启用状态\n *\n * @returns 如果实体已启用则返回true\n */\n get enabled() {\n return this._enabled;\n }\n /**\n * 设置启用状态\n *\n * @param value - 新的启用状态\n */\n set enabled(value) {\n this._enabled = value;\n }\n /**\n * 获取更新顺序\n *\n * @returns 实体的更新顺序值\n */\n get updateOrder() {\n return this._updateOrder;\n }\n /**\n * 设置更新顺序\n *\n * @param value - 新的更新顺序值\n */\n set updateOrder(value) {\n this._updateOrder = value;\n }\n /**\n * 获取组件位掩码\n *\n * @returns 实体的组件位掩码\n */\n get componentMask() {\n return this._componentMask;\n }\n /**\n * 创建并添加组件\n *\n * @param componentType - 组件类型构造函数\n * @param args - 组件构造函数参数\n * @returns 创建的组件实例\n *\n * @example\n * ```typescript\n * const position = entity.createComponent(Position, 100, 200);\n * const health = entity.createComponent(Health, 100);\n * ```\n */\n createComponent(componentType, ...args) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n const component = new componentType(...args);\n return this.addComponent(component);\n }\n /**\n * 内部添加组件方法(不进行重复检查,用于初始化)\n *\n * @param component - 要添加的组件实例\n * @returns 添加的组件实例\n */\n addComponentInternal(component) {\n const componentType = component.constructor;\n if (!ComponentRegistry.isRegistered(componentType)) {\n ComponentRegistry.register(componentType);\n }\n // 更新位掩码\n const componentMask = ComponentRegistry.getBitMask(componentType);\n BitMask64Utils.orInPlace(this._componentMask, componentMask);\n // 使缓存失效\n this._componentCache = null;\n return component;\n }\n /**\n * 通知Scene中的QuerySystem实体组件发生变动\n *\n * Notify the QuerySystem in Scene that entity components have changed\n *\n * @param changedComponentType 变化的组件类型(可选,用于优化通知) | Changed component type (optional, for optimized notification)\n */\n notifyQuerySystems(changedComponentType) {\n if (this.scene && this.scene.querySystem) {\n this.scene.querySystem.updateEntity(this);\n this.scene.clearSystemEntityCaches();\n // 事件驱动:立即通知关心该组件的系统 | Event-driven: notify systems that care about this component\n if (this.scene.notifyEntityComponentChanged) {\n this.scene.notifyEntityComponentChanged(this, changedComponentType);\n }\n }\n }\n /**\n * 添加组件到实体\n *\n * @param component - 要添加的组件实例\n * @returns 添加的组件实例\n * @throws {Error} 如果实体已存在该类型的组件\n *\n * @example\n * ```typescript\n * const position = new Position(100, 200);\n * entity.addComponent(position);\n * ```\n */\n addComponent(component) {\n const componentType = component.constructor;\n if (!this.scene) {\n throw new Error('Entity must be added to Scene before adding components. Use scene.createEntity() instead of new Entity()');\n }\n if (!this.scene.componentStorageManager) {\n throw new Error('Scene does not have componentStorageManager');\n }\n if (this.hasComponent(componentType)) {\n throw new Error(`Entity ${this.name} already has component ${getComponentTypeName(componentType)}`);\n }\n this.addComponentInternal(component);\n this.scene.componentStorageManager.addComponent(this.id, component);\n component.entityId = this.id;\n if (this.scene.referenceTracker) {\n this.scene.referenceTracker.registerEntityScene(this.id, this.scene);\n }\n // 编辑器模式下延迟执行 onAddedToEntity | Defer onAddedToEntity in editor mode\n if (this.scene.isEditorMode) {\n this.scene.queueDeferredComponentCallback(() => {\n component.onAddedToEntity();\n });\n }\n else {\n component.onAddedToEntity();\n }\n if (this.scene && this.scene.eventSystem) {\n this.scene.eventSystem.emitSync('component:added', {\n timestamp: Date.now(),\n source: 'Entity',\n entityId: this.id,\n entityName: this.name,\n entityTag: this.tag?.toString(),\n componentType: getComponentTypeName(componentType),\n component: component\n });\n }\n this.notifyQuerySystems(componentType);\n return component;\n }\n /**\n * 获取指定类型的组件\n *\n * @param type - 组件类型构造函数\n * @returns 组件实例,如果不存在则返回null\n *\n * @example\n * ```typescript\n * const position = entity.getComponent(Position);\n * if (position) {\n * position.x += 10;\n * position.y += 20;\n * }\n * ```\n */\n getComponent(type) {\n // 快速检查:位掩码\n if (!this.hasComponent(type)) {\n return null;\n }\n // 从Scene存储获取\n if (!this.scene?.componentStorageManager) {\n return null;\n }\n const component = this.scene.componentStorageManager.getComponent(this.id, type);\n return component;\n }\n /**\n * 检查实体是否拥有指定类型的组件\n *\n * @param type - 组件类型构造函数\n * @returns 如果实体拥有该组件返回true,否则返回false\n *\n * @example\n * ```typescript\n * if (entity.hasComponent(Position)) {\n * const position = entity.getComponent(Position)!;\n * position.x += 10;\n * }\n * ```\n */\n hasComponent(type) {\n if (!ComponentRegistry.isRegistered(type)) {\n return false;\n }\n const mask = ComponentRegistry.getBitMask(type);\n return BitMask64Utils.hasAny(this._componentMask, mask);\n }\n /**\n * 获取或创建指定类型的组件\n *\n * 如果组件已存在则返回现有组件,否则创建新组件并添加到实体\n *\n * @param type - 组件类型构造函数\n * @param args - 组件构造函数参数(仅在创建新组件时使用)\n * @returns 组件实例\n *\n * @example\n * ```typescript\n * // 确保实体拥有Position组件\n * const position = entity.getOrCreateComponent(Position, 0, 0);\n * position.x = 100;\n * ```\n */\n getOrCreateComponent(type, ...args) {\n let component = this.getComponent(type);\n if (!component) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n component = this.createComponent(type, ...args);\n }\n return component;\n }\n /**\n * 移除指定的组件\n *\n * @param component - 要移除的组件实例\n */\n removeComponent(component) {\n const componentType = component.constructor;\n if (!ComponentRegistry.isRegistered(componentType)) {\n return;\n }\n const bitIndex = ComponentRegistry.getBitIndex(componentType);\n // 更新位掩码\n BitMask64Utils.clearBit(this._componentMask, bitIndex);\n // 使缓存失效\n this._componentCache = null;\n // 从Scene存储移除\n if (this.scene?.componentStorageManager) {\n this.scene.componentStorageManager.removeComponent(this.id, componentType);\n }\n if (this.scene?.referenceTracker) {\n this.scene.referenceTracker.clearComponentReferences(component);\n }\n if (component.onRemovedFromEntity) {\n component.onRemovedFromEntity();\n }\n component.entityId = null;\n if (this.scene && this.scene.eventSystem) {\n this.scene.eventSystem.emitSync('component:removed', {\n timestamp: Date.now(),\n source: 'Entity',\n entityId: this.id,\n entityName: this.name,\n entityTag: this.tag?.toString(),\n componentType: getComponentTypeName(componentType),\n component: component\n });\n }\n this.notifyQuerySystems(componentType);\n }\n /**\n * 移除指定类型的组件\n *\n * @param type - 组件类型\n * @returns 被移除的组件实例或null\n */\n removeComponentByType(type) {\n const component = this.getComponent(type);\n if (component) {\n this.removeComponent(component);\n return component;\n }\n return null;\n }\n /**\n * 移除所有组件\n */\n removeAllComponents() {\n const componentsToRemove = [...this.components];\n // 清除位掩码\n BitMask64Utils.clear(this._componentMask);\n // 使缓存失效\n this._componentCache = null;\n for (const component of componentsToRemove) {\n const componentType = component.constructor;\n if (this.scene?.componentStorageManager) {\n this.scene.componentStorageManager.removeComponent(this.id, componentType);\n }\n component.onRemovedFromEntity();\n }\n this.notifyQuerySystems();\n }\n /**\n * 批量添加组件\n *\n * @param components - 要添加的组件数组\n * @returns 添加的组件数组\n */\n addComponents(components) {\n const addedComponents = [];\n for (const component of components) {\n try {\n addedComponents.push(this.addComponent(component));\n }\n catch (error) {\n Entity._logger.warn(`添加组件失败 ${getComponentInstanceTypeName(component)}:`, error);\n }\n }\n return addedComponents;\n }\n /**\n * 批量移除组件类型\n *\n * @param componentTypes - 要移除的组件类型数组\n * @returns 被移除的组件数组\n */\n removeComponentsByTypes(componentTypes) {\n const removedComponents = [];\n for (const componentType of componentTypes) {\n removedComponents.push(this.removeComponentByType(componentType));\n }\n return removedComponents;\n }\n /**\n * 获取所有指定类型的组件\n *\n * @param type - 组件类型\n * @returns 组件实例数组\n */\n getComponents(type) {\n const result = [];\n for (const component of this.components) {\n if (component instanceof type) {\n result.push(component);\n }\n }\n return result;\n }\n /**\n * 获取指定基类的组件(支持继承查找)\n *\n * 与 getComponent() 不同,此方法使用 instanceof 检查,支持子类查找。\n * 性能比位掩码查询稍慢,但支持继承层次结构。\n *\n * @param baseType - 组件基类类型\n * @returns 第一个匹配的组件实例,如果不存在则返回 null\n *\n * @example\n * ```typescript\n * // 查找 CompositeNodeComponent 或其子类\n * const composite = entity.getComponentByType(CompositeNodeComponent);\n * if (composite) {\n * // composite 可能是 SequenceNode, SelectorNode 等\n * }\n * ```\n */\n getComponentByType(baseType) {\n for (const component of this.components) {\n if (component instanceof baseType) {\n return component;\n }\n }\n return null;\n }\n /**\n * 活跃状态改变时的回调\n */\n onActiveChanged() {\n for (const component of this.components) {\n if ('onActiveChanged' in component && typeof component.onActiveChanged === 'function') {\n component.onActiveChanged();\n }\n }\n if (this.scene && this.scene.eventSystem) {\n this.scene.eventSystem.emitSync('entity:activeChanged', {\n entity: this,\n active: this._active\n });\n }\n }\n /**\n * 销毁实体\n *\n * 移除所有组件并标记为已销毁。\n * 层级关系的清理由 HierarchySystem 处理。\n */\n destroy() {\n if (this._isDestroyed) {\n return;\n }\n this._isDestroyed = true;\n if (this.scene && this.scene.referenceTracker) {\n this.scene.referenceTracker.clearReferencesTo(this.id);\n this.scene.referenceTracker.unregisterEntityScene(this.id);\n }\n this.removeAllComponents();\n if (this.scene) {\n if (this.scene.querySystem) {\n this.scene.querySystem.removeEntity(this);\n }\n if (this.scene.entities) {\n this.scene.entities.remove(this);\n }\n }\n }\n /**\n * 比较实体\n *\n * @param other - 另一个实体\n * @returns 比较结果\n */\n compareTo(other) {\n return EntityComparer.prototype.compare(this, other);\n }\n /**\n * 获取实体的字符串表示\n *\n * @returns 实体的字符串描述\n */\n toString() {\n return `Entity[${this.name}:${this.id}]`;\n }\n /**\n * 获取实体的调试信息(包含组件缓存信息)\n *\n * @returns 包含实体详细信息的对象\n */\n getDebugInfo() {\n return {\n name: this.name,\n id: this.id,\n enabled: this._enabled,\n active: this._active,\n destroyed: this._isDestroyed,\n componentCount: this.components.length,\n componentTypes: this.components.map((c) => getComponentInstanceTypeName(c)),\n componentMask: BitMask64Utils.toString(this._componentMask, 2),\n cacheBuilt: this._componentCache !== null\n };\n }\n}\n/**\n * Entity专用日志器\n */\nEntity._logger = createLogger('Entity');\n/**\n * 实体比较器实例\n */\nEntity.entityComparer = new EntityComparer();\n//# sourceMappingURL=Entity.js.map","/**\n * 高性能实体列表管理器\n * 管理场景中的所有实体,支持快速查找和批量操作\n */\nexport class EntityList {\n get count() {\n return this.buffer.length;\n }\n constructor(scene) {\n this.buffer = [];\n // 索引映射,提升查找性能\n this._idToEntity = new Map();\n this._nameToEntities = new Map();\n // 延迟操作队列\n this._entitiesToAdd = [];\n this._entitiesToRemove = [];\n this._scene = scene;\n }\n /**\n * 添加实体\n * @param entity 要添加的实体\n */\n add(entity) {\n this.addImmediate(entity);\n }\n /**\n * 立即添加实体\n * @param entity 要添加的实体\n */\n addImmediate(entity) {\n // 检查是否已存在\n if (this._idToEntity.has(entity.id)) {\n return;\n }\n this.buffer.push(entity);\n this._idToEntity.set(entity.id, entity);\n // 更新名称索引\n this.updateNameIndex(entity, true);\n }\n /**\n * 移除实体\n * @param entity 要移除的实体\n */\n remove(entity) {\n this.removeImmediate(entity);\n }\n /**\n * 立即移除实体\n * @param entity 要移除的实体\n */\n removeImmediate(entity) {\n const index = this.buffer.indexOf(entity);\n if (index !== -1) {\n this.buffer.splice(index, 1);\n this._idToEntity.delete(entity.id);\n // 更新名称索引\n this.updateNameIndex(entity, false);\n // 回收实体ID到ID池\n if (this._scene && this._scene.identifierPool) {\n this._scene.identifierPool.checkIn(entity.id);\n }\n }\n }\n /**\n * 移除所有实体\n */\n removeAllEntities() {\n // 收集所有实体ID用于回收\n const idsToRecycle = [];\n for (let i = this.buffer.length - 1; i >= 0; i--) {\n idsToRecycle.push(this.buffer[i].id);\n this.buffer[i].destroy();\n }\n // 批量回收ID\n if (this._scene && this._scene.identifierPool) {\n for (const id of idsToRecycle) {\n this._scene.identifierPool.checkIn(id);\n }\n }\n this.buffer.length = 0;\n this._idToEntity.clear();\n this._nameToEntities.clear();\n this._entitiesToAdd.length = 0;\n this._entitiesToRemove.length = 0;\n }\n /**\n * 更新实体列表,处理延迟操作\n */\n updateLists() {\n // 处理延迟添加的实体\n if (this._entitiesToAdd.length > 0) {\n for (const entity of this._entitiesToAdd) {\n this.addImmediate(entity);\n }\n this._entitiesToAdd.length = 0;\n }\n // 处理延迟移除的实体\n if (this._entitiesToRemove.length > 0) {\n for (const entity of this._entitiesToRemove) {\n this.removeImmediate(entity);\n }\n this._entitiesToRemove.length = 0;\n }\n }\n /**\n * 更新实体列表\n *\n * 处理延迟操作(添加/删除实体)\n */\n update() {\n // 处理延迟操作\n this.updateLists();\n }\n /**\n * 根据名称查找实体(使用索引,O(1)复杂度)\n * @param name 实体名称\n * @returns 找到的第一个实体或null\n */\n findEntity(name) {\n const entities = this._nameToEntities.get(name);\n return entities && entities.length > 0 ? entities[0] : null;\n }\n /**\n * 根据名称查找所有实体\n * @param name 实体名称\n * @returns 找到的所有实体数组\n */\n findEntitiesByName(name) {\n return this._nameToEntities.get(name) || [];\n }\n /**\n * 根据ID查找实体(使用索引,O(1)复杂度)\n * @param id 实体ID\n * @returns 找到的实体或null\n */\n findEntityById(id) {\n return this._idToEntity.get(id) || null;\n }\n /**\n * 根据标签查找实体\n * @param tag 标签\n * @returns 找到的所有实体数组\n */\n findEntitiesByTag(tag) {\n const result = [];\n for (const entity of this.buffer) {\n if (entity.tag === tag) {\n result.push(entity);\n }\n }\n return result;\n }\n /**\n * 根据组件类型查找实体\n * @param componentType 组件类型\n * @returns 找到的所有实体数组\n */\n findEntitiesWithComponent(componentType) {\n const result = [];\n for (const entity of this.buffer) {\n if (entity.hasComponent(componentType)) {\n result.push(entity);\n }\n }\n return result;\n }\n /**\n * 批量操作:对所有实体执行指定操作\n * @param action 要执行的操作\n */\n forEach(action) {\n for (const entity of this.buffer) {\n action(entity);\n }\n }\n /**\n * 批量操作:对符合条件的实体执行指定操作\n * @param predicate 筛选条件\n * @param action 要执行的操作\n */\n forEachWhere(predicate, action) {\n for (const entity of this.buffer) {\n if (predicate(entity)) {\n action(entity);\n }\n }\n }\n /**\n * 更新名称索引\n * @param entity 实体\n * @param isAdd 是否为添加操作\n */\n updateNameIndex(entity, isAdd) {\n if (!entity.name) {\n return;\n }\n if (isAdd) {\n let entities = this._nameToEntities.get(entity.name);\n if (!entities) {\n entities = [];\n this._nameToEntities.set(entity.name, entities);\n }\n entities.push(entity);\n }\n else {\n const entities = this._nameToEntities.get(entity.name);\n if (entities) {\n const index = entities.indexOf(entity);\n if (index !== -1) {\n entities.splice(index, 1);\n // 如果数组为空,删除映射\n if (entities.length === 0) {\n this._nameToEntities.delete(entity.name);\n }\n }\n }\n }\n }\n /**\n * 重新排序实体\n * @param entityId 要移动的实体ID\n * @param newIndex 新的索引位置\n */\n reorderEntity(entityId, newIndex) {\n const entity = this._idToEntity.get(entityId);\n if (!entity)\n return;\n const currentIndex = this.buffer.indexOf(entity);\n if (currentIndex === -1 || currentIndex === newIndex)\n return;\n // 限制索引范围\n const clampedIndex = Math.max(0, Math.min(newIndex, this.buffer.length - 1));\n // 从当前位置移除\n this.buffer.splice(currentIndex, 1);\n // 插入到新位置\n this.buffer.splice(clampedIndex, 0, entity);\n }\n /**\n * 获取实体列表的统计信息\n * @returns 统计信息\n */\n getStats() {\n let activeCount = 0;\n for (const entity of this.buffer) {\n if (entity.enabled && !entity.isDestroyed) {\n activeCount++;\n }\n }\n return {\n totalEntities: this.buffer.length,\n activeEntities: activeCount,\n pendingAdd: this._entitiesToAdd.length,\n pendingRemove: this._entitiesToRemove.length,\n nameIndexSize: this._nameToEntities.size\n };\n }\n}\n//# sourceMappingURL=EntityList.js.map","/**\n * 世代式ID池管理器\n *\n * 用于管理实体ID的分配和回收,支持世代版本控制以防止悬空引用问题。\n * 世代式ID由索引和版本组成,当ID被回收时版本会递增,确保旧引用失效。\n *\n * 支持动态扩展,理论上可以支持到65535个索引(16位),每个索引65535个版本(16位)。\n * 总计可以处理超过42亿个独特的ID组合,完全满足ECS大规模实体需求。\n *\n * @example\n * ```typescript\n * const pool = new IdentifierPool();\n *\n * // 分配ID\n * const id = pool.checkOut(); // 例如: 65536 (版本1,索引0)\n *\n * // 回收ID\n * pool.checkIn(id);\n *\n * // 验证ID是否有效\n * const isValid = pool.isValid(id); // false,因为版本已递增\n * ```\n */\nexport class IdentifierPool {\n /**\n * 构造函数\n *\n * @param recycleDelay 延迟回收时间(毫秒),默认为100ms\n * @param expansionBlockSize 内存扩展块大小,默认为1024\n */\n constructor(recycleDelay = 100, expansionBlockSize = 1024) {\n /**\n * 下一个可用的索引\n */\n this._nextAvailableIndex = 0;\n /**\n * 空闲的索引列表\n */\n this._freeIndices = [];\n /**\n * 每个索引对应的世代版本\n * 动态扩展的Map,按需分配内存\n */\n this._generations = new Map();\n /**\n * 延迟回收队列\n * 防止在同一帧内立即重用ID,避免时序问题\n */\n this._pendingRecycle = [];\n /**\n * 延迟回收时间(毫秒)\n */\n this._recycleDelay = 100;\n /**\n * 统计信息\n */\n this._stats = {\n totalAllocated: 0,\n totalRecycled: 0,\n currentActive: 0,\n memoryExpansions: 0\n };\n this._recycleDelay = recycleDelay;\n this._expansionBlockSize = expansionBlockSize;\n // 预分配第一个块的世代信息\n this._preAllocateGenerations(0, this._expansionBlockSize);\n }\n /**\n * 获取一个可用的ID\n *\n * 返回一个32位ID,高16位为世代版本,低16位为索引。\n *\n * @returns 新分配的实体ID\n * @throws {Error} 当达到索引限制时抛出错误\n */\n checkOut() {\n // 处理延迟回收队列\n this._processDelayedRecycle();\n let index;\n if (this._freeIndices.length > 0) {\n // 重用回收的索引\n index = this._freeIndices.pop();\n }\n else {\n // 分配新索引\n if (this._nextAvailableIndex > IdentifierPool.MAX_INDEX) {\n throw new Error(`实体索引已达到框架设计限制 (${IdentifierPool.MAX_INDEX})。` +\n '这意味着您已经分配了超过65535个不同的实体索引。' +\n '这是16位索引设计的限制,考虑优化实体回收策略或升级到64位ID设计。');\n }\n index = this._nextAvailableIndex++;\n // 按需扩展世代存储\n this._ensureGenerationCapacity(index);\n }\n const generation = this._generations.get(index) || 1;\n this._stats.totalAllocated++;\n this._stats.currentActive++;\n return this._packId(index, generation);\n }\n /**\n * 回收一个ID\n *\n * 验证ID的有效性后,将其加入延迟回收队列。\n * ID不会立即可重用,而是在延迟时间后才真正回收。\n *\n * @param id 要回收的实体ID\n * @returns 是否成功回收(ID是否有效且未被重复回收)\n */\n checkIn(id) {\n const index = this._unpackIndex(id);\n const generation = this._unpackGeneration(id);\n // 验证ID有效性\n if (!this._isValidId(index, generation)) {\n return false;\n }\n // 检查是否已经在待回收队列中\n const alreadyPending = this._pendingRecycle.some((item) => item.index === index && item.generation === generation);\n if (alreadyPending) {\n return false; // 已经在回收队列中,拒绝重复回收\n }\n // 加入延迟回收队列\n this._pendingRecycle.push({\n index,\n generation,\n timestamp: Date.now()\n });\n this._stats.currentActive--;\n this._stats.totalRecycled++;\n return true;\n }\n /**\n * 验证ID是否有效\n *\n * 检查ID的索引和世代版本是否匹配当前状态。\n *\n * @param id 要验证的实体ID\n * @returns ID是否有效\n */\n isValid(id) {\n const index = this._unpackIndex(id);\n const generation = this._unpackGeneration(id);\n return this._isValidId(index, generation);\n }\n /**\n * 获取统计信息\n *\n * @returns 池的当前状态统计\n */\n getStats() {\n // 计算平均世代版本\n let totalGeneration = 0;\n let generationCount = 0;\n for (const [index, generation] of this._generations) {\n if (index < this._nextAvailableIndex) {\n totalGeneration += generation;\n generationCount++;\n }\n }\n const averageGeneration = generationCount > 0\n ? totalGeneration / generationCount\n : 1;\n return {\n totalAllocated: this._stats.totalAllocated,\n totalRecycled: this._stats.totalRecycled,\n currentActive: this._stats.currentActive,\n currentlyFree: this._freeIndices.length,\n pendingRecycle: this._pendingRecycle.length,\n maxPossibleEntities: IdentifierPool.MAX_INDEX + 1,\n maxUsedIndex: this._nextAvailableIndex - 1,\n memoryUsage: this._calculateMemoryUsage(),\n memoryExpansions: this._stats.memoryExpansions,\n averageGeneration: Math.round(averageGeneration * 100) / 100,\n generationStorageSize: this._generations.size\n };\n }\n /**\n * 强制执行延迟回收处理\n *\n * 在某些情况下可能需要立即处理延迟回收队列,\n * 比如内存压力大或者需要精确的统计信息时。\n */\n forceProcessDelayedRecycle() {\n this._processDelayedRecycle(true);\n }\n /**\n * 清理过期的延迟回收项\n *\n * 将超过延迟时间的回收项真正回收到空闲列表中。\n *\n * @param forceAll 是否强制处理所有延迟回收项\n * @private\n */\n _processDelayedRecycle(forceAll = false) {\n if (this._pendingRecycle.length === 0)\n return;\n const now = Date.now();\n const readyToRecycle = [];\n const stillPending = [];\n // 分离已到期和未到期的项\n for (const item of this._pendingRecycle) {\n if (forceAll || now - item.timestamp >= this._recycleDelay) {\n readyToRecycle.push(item);\n }\n else {\n stillPending.push(item);\n }\n }\n // 处理到期的回收项\n for (const item of readyToRecycle) {\n // 再次验证ID有效性(防止重复回收)\n if (this._isValidId(item.index, item.generation)) {\n // 递增世代版本\n let newGeneration = item.generation + 1;\n // 防止世代版本溢出\n if (newGeneration > IdentifierPool.MAX_GENERATION) {\n newGeneration = 1; // 重置为1而不是0\n }\n this._generations.set(item.index, newGeneration);\n // 添加到空闲列表\n this._freeIndices.push(item.index);\n }\n }\n // 更新待回收队列\n this._pendingRecycle = stillPending;\n }\n /**\n * 预分配世代信息\n *\n * @param startIndex 起始索引\n * @param count 分配数量\n * @private\n */\n _preAllocateGenerations(startIndex, count) {\n for (let i = 0; i < count; i++) {\n const index = startIndex + i;\n if (index <= IdentifierPool.MAX_INDEX) {\n this._generations.set(index, 1);\n }\n }\n this._stats.memoryExpansions++;\n }\n /**\n * 确保指定索引的世代信息存在\n *\n * @param index 索引\n * @private\n */\n _ensureGenerationCapacity(index) {\n if (!this._generations.has(index)) {\n // 计算需要扩展的起始位置\n const expansionStart = Math.floor(index / this._expansionBlockSize) * this._expansionBlockSize;\n // 预分配一个块\n this._preAllocateGenerations(expansionStart, this._expansionBlockSize);\n }\n }\n /**\n * 计算内存使用量\n *\n * @returns 内存使用字节数\n * @private\n */\n _calculateMemoryUsage() {\n const generationMapSize = this._generations.size * 16; // Map overhead + number pair\n const freeIndicesSize = this._freeIndices.length * 8;\n const pendingRecycleSize = this._pendingRecycle.length * 32;\n return generationMapSize + freeIndicesSize + pendingRecycleSize;\n }\n /**\n * 打包索引和世代为32位ID\n *\n * @param index 索引(16位)\n * @param generation 世代版本(16位)\n * @returns 打包后的32位ID\n * @private\n */\n _packId(index, generation) {\n return (generation << 16) | index;\n }\n /**\n * 从ID中解包索引\n *\n * @param id 32位ID\n * @returns 索引部分(16位)\n * @private\n */\n _unpackIndex(id) {\n return id & 0xFFFF;\n }\n /**\n * 从ID中解包世代版本\n *\n * @param id 32位ID\n * @returns 世代版本部分(16位)\n * @private\n */\n _unpackGeneration(id) {\n return (id >>> 16) & 0xFFFF;\n }\n /**\n * 内部ID有效性检查\n *\n * @param index 索引\n * @param generation 世代版本\n * @returns 是否有效\n * @private\n */\n _isValidId(index, generation) {\n if (index < 0 || index >= this._nextAvailableIndex) {\n return false;\n }\n const currentGeneration = this._generations.get(index);\n return currentGeneration !== undefined && currentGeneration === generation;\n }\n}\n/**\n * 最大索引限制(16位)\n * 这是框架设计选择:16位索引 + 16位版本 = 32位ID,确保高效位操作\n * 不是硬件限制,而是性能和内存效率的权衡\n */\nIdentifierPool.MAX_INDEX = 0xFFFF; // 65535\n/**\n * 最大世代限制(16位)\n */\nIdentifierPool.MAX_GENERATION = 0xFFFF; // 65535\n//# sourceMappingURL=IdentifierPool.js.map","import { createLogger } from '../../Utils/Logger';\nimport { getSystemInstanceTypeName } from '../Decorators';\n/**\n * 实体处理器列表管理器\n * 管理场景中的所有实体系统\n */\nexport class EntityProcessorList {\n constructor() {\n this._processors = [];\n this._isDirty = false;\n }\n /**\n * 设置为脏状态,需要重新排序\n */\n setDirty() {\n this._isDirty = true;\n }\n /**\n * 添加实体处理器\n * @param processor 要添加的处理器\n */\n add(processor) {\n this._processors.push(processor);\n this.setDirty();\n }\n /**\n * 移除实体处理器\n * @param processor 要移除的处理器\n */\n remove(processor) {\n const index = this._processors.indexOf(processor);\n if (index !== -1) {\n this._processors.splice(index, 1);\n }\n }\n /**\n * 获取指定类型的处理器\n * @param type 处理器类型\n */\n getProcessor(type) {\n for (const processor of this._processors) {\n if (processor instanceof type) {\n return processor;\n }\n }\n return null;\n }\n /**\n * 开始处理\n *\n * 对所有处理器进行排序以确保正确的执行顺序。\n */\n begin() {\n this.sortProcessors();\n }\n /**\n * 结束处理\n */\n end() {\n // 清理处理器\n for (const processor of this._processors) {\n try {\n processor.reset();\n }\n catch (error) {\n EntityProcessorList._logger.error(`Error in processor ${getSystemInstanceTypeName(processor)}:`, error);\n }\n }\n this._isDirty = false;\n this._processors.length = 0;\n }\n /**\n * 更新所有处理器\n */\n update() {\n this.sortProcessors();\n for (const processor of this._processors) {\n try {\n processor.update();\n }\n catch (error) {\n EntityProcessorList._logger.error(`Error in processor ${getSystemInstanceTypeName(processor)}:`, error);\n }\n }\n }\n /**\n * 后期更新所有处理器\n */\n lateUpdate() {\n for (const processor of this._processors) {\n processor.lateUpdate();\n }\n }\n /**\n * 排序处理器\n */\n sortProcessors() {\n if (this._isDirty) {\n this._processors.sort((a, b) => a.updateOrder - b.updateOrder);\n this._isDirty = false;\n }\n }\n /** 获取处理器列表 */\n get processors() {\n return this._processors;\n }\n /** 获取处理器数量 */\n get count() {\n return this._processors.length;\n }\n}\nEntityProcessorList._logger = createLogger('EntityProcessorList');\n//# sourceMappingURL=EntityProcessorList.js.map","import { SegmentPart, BitMask64Utils } from './BigIntCompatibility';\n/**\n * 位集合类,用于高效的位操作\n * 支持任意位的位运算操作.\n */\nexport class Bits {\n /**\n * 构造函数,创建位集合\n * @param initialValue 初始值,可以是BitMask64Data对象、数字或字符串\n */\n constructor(initialValue) {\n if (initialValue && typeof initialValue === 'object') {\n this._value = BitMask64Utils.clone(initialValue);\n }\n else if (typeof initialValue === 'number') {\n this._value = BitMask64Utils.fromNumber(initialValue);\n }\n else if (typeof initialValue === 'string') {\n const num = parseInt(initialValue, 10);\n this._value = BitMask64Utils.fromNumber(num);\n }\n else {\n this._value = BitMask64Utils.clone(BitMask64Utils.ZERO);\n }\n }\n /**\n * 设置指定位为1\n * 自动扩展:当索引超过 64 时,自动扩展到 128/256 位\n * @param index 位索引(0-based)\n * @throws 当位索引为负数时抛出错误\n */\n set(index) {\n if (index < 0) {\n throw new Error('Bit index cannot be negative');\n }\n BitMask64Utils.setBit(this._value, index);\n }\n /**\n * 清除指定位为0\n * @param index 位索引\n * @throws 当位索引为负数时抛出错误\n */\n clear(index) {\n if (index < 0) {\n throw new Error('Bit index cannot be negative');\n }\n BitMask64Utils.clearBit(this._value, index);\n }\n /**\n * 获取指定位的值\n * @param index 位索引\n * @returns 如果位被设置为1则返回true,否则返回false\n */\n get(index) {\n return BitMask64Utils.getBit(this._value, index);\n }\n /**\n * 检查是否包含另一个位集合的所有位\n * @param other 另一个位集合\n * @returns 如果包含other的所有设置位则返回true\n */\n containsAll(other) {\n return BitMask64Utils.hasAll(this._value, other._value);\n }\n /**\n * 检查是否与另一个位集合有交集\n * @param other 另一个位集合\n * @returns 如果有共同的设置位则返回true\n */\n intersects(other) {\n return BitMask64Utils.hasAny(this._value, other._value);\n }\n /**\n * 检查是否与另一个位集合没有交集\n * @param other 另一个位集合\n * @returns 如果没有共同的设置位则返回true\n */\n excludes(other) {\n return BitMask64Utils.hasNone(this._value, other._value);\n }\n /**\n * 清除所有位为0\n */\n clearAll() {\n BitMask64Utils.clear(this._value);\n }\n /**\n * 检查位集合是否为空\n * @returns 如果所有位都为0则返回true\n */\n isEmpty() {\n return BitMask64Utils.isZero(this._value);\n }\n /**\n * 计算设置为1的位数\n * @returns 设置位的总数\n */\n cardinality() {\n return BitMask64Utils.popCount(this._value);\n }\n /**\n * 与另一个位集合执行按位与操作\n * @param other 另一个位集合\n * @returns 新的位集合,包含按位与的结果\n */\n and(other) {\n const result = new Bits();\n BitMask64Utils.copy(this._value, result._value);\n BitMask64Utils.andInPlace(result._value, other._value);\n return result;\n }\n /**\n * 与另一个位集合执行按位或操作\n * @param other 另一个位集合\n * @returns 新的位集合,包含按位或的结果\n */\n or(other) {\n const result = new Bits();\n BitMask64Utils.copy(this._value, result._value);\n BitMask64Utils.orInPlace(result._value, other._value);\n return result;\n }\n /**\n * 与另一个位集合执行按位异或操作\n * @param other 另一个位集合\n * @returns 新的位集合,包含按位异或的结果\n */\n xor(other) {\n const result = new Bits();\n BitMask64Utils.copy(this._value, result._value);\n BitMask64Utils.xorInPlace(result._value, other._value);\n return result;\n }\n /**\n * 执行按位取反操作\n * @param maxBits 最大位数,默认为64\n * @returns 新的位集合,包含按位取反的结果\n */\n not(maxBits = 64) {\n if (maxBits > 64) {\n maxBits = 64;\n }\n const result = new Bits();\n BitMask64Utils.copy(this._value, result._value);\n if (maxBits <= 32) {\n const mask = (1 << maxBits) - 1;\n result._value.base[SegmentPart.LOW] = (~result._value.base[SegmentPart.LOW]) & mask;\n result._value.base[SegmentPart.HIGH] = 0;\n }\n else {\n result._value.base[SegmentPart.LOW] = ~result._value.base[SegmentPart.LOW];\n if (maxBits < 64) {\n const remainingBits = maxBits - 32;\n const mask = (1 << remainingBits) - 1;\n result._value.base[SegmentPart.HIGH] = (~result._value.base[SegmentPart.HIGH]) & mask;\n }\n else {\n result._value.base[SegmentPart.HIGH] = ~result._value.base[SegmentPart.HIGH];\n }\n }\n return result;\n }\n /**\n * 从另一个位集合复制值\n * @param other 源位集合\n */\n copyFrom(other) {\n BitMask64Utils.copy(other._value, this._value);\n }\n /**\n * 创建当前位集合的深拷贝\n * @returns 新的位集合,内容与当前位集合相同\n */\n clone() {\n return new Bits(this._value);\n }\n /**\n * 获取内部的64位掩码数据\n * @returns 内部存储的BitMask64Data对象\n */\n getValue() {\n return this._value;\n }\n /**\n * 设置位集合的值\n * @param value 新值,可以是BitMask64Data对象、数字或字符串\n */\n setValue(value) {\n if (typeof value === 'object') {\n BitMask64Utils.copy(value, this._value);\n }\n else if (typeof value === 'number') {\n this._value = BitMask64Utils.fromNumber(value);\n }\n else {\n const num = parseInt(value, 10);\n this._value = BitMask64Utils.fromNumber(num);\n }\n }\n /**\n * 将位集合转换为可读字符串\n * @returns 格式为\"Bits[index1, index2, ...]\"的字符串\n */\n toString() {\n const bits = [];\n for (let i = 0; i < 64; i++) {\n if (this.get(i)) {\n bits.push(i.toString());\n }\n }\n return `Bits[${bits.join(', ')}]`;\n }\n /**\n * 将位集合转换为二进制字符串\n * @param maxBits 最大位数,默认为64\n * @returns 二进制字符串表示,每8位用空格分隔\n */\n toBinaryString(maxBits = 0) {\n if (maxBits == 0) {\n maxBits = 64 + (this._value.segments ? this._value.segments.length * 64 : 0);\n }\n let result = '';\n for (let i = maxBits - 1; i >= 0; i--) {\n result += this.get(i) ? '1' : '0';\n if (i % 8 === 0 && i > 0) {\n result += ' ';\n }\n }\n return result;\n }\n /**\n * 将位集合转换为十六进制字符串\n * @returns 十六进制字符串表示,带0x前缀\n */\n toHexString() {\n return BitMask64Utils.toString(this._value, 16);\n }\n /**\n * 从二进制字符串创建位集合\n * @param binaryString 二进制字符串,可以包含空格\n * @returns 新的位集合对象\n */\n static fromBinaryString(binaryString) {\n const cleanString = binaryString.replace(/\\s/g, '');\n let data;\n if (cleanString.length <= 32) {\n const num = parseInt(cleanString, 2);\n data = { base: [num >>> 0, 0] };\n }\n else {\n const loBits = cleanString.substring(cleanString.length - 32);\n const hiBits = cleanString.substring(0, cleanString.length - 32);\n const lo = parseInt(loBits, 2);\n const hi = parseInt(hiBits, 2);\n data = { base: [lo >>> 0, hi >>> 0] };\n }\n return new Bits(data);\n }\n /**\n * 从十六进制字符串创建位集合\n * @param hexString 十六进制字符串,可以带或不带0x前缀\n * @returns 新的位集合对象\n */\n static fromHexString(hexString) {\n const cleanString = hexString.replace(/^0x/i, '');\n let data;\n if (cleanString.length <= 8) {\n const num = parseInt(cleanString, 16);\n data = { base: [num >>> 0, 0] };\n }\n else {\n const loBits = cleanString.substring(cleanString.length - 8);\n const hiBits = cleanString.substring(0, cleanString.length - 8);\n const lo = parseInt(loBits, 16);\n const hi = parseInt(hiBits, 16);\n data = { base: [lo >>> 0, hi >>> 0] };\n }\n return new Bits(data);\n }\n /**\n * 检查是否与另一个位集合相等\n * @param other 另一个位集合\n * @returns 如果两个位集合完全相同则返回true\n */\n equals(other) {\n return BitMask64Utils.equals(this._value, other._value);\n }\n /**\n * 获取最高位设置位的索引\n * @returns 最高位设置位的索引,如果位集合为空则返回-1\n */\n getHighestBitIndex() {\n if (BitMask64Utils.isZero(this._value)) {\n return -1;\n }\n if (this._value.base[SegmentPart.HIGH] !== 0) {\n for (let i = 31; i >= 0; i--) {\n if ((this._value.base[SegmentPart.HIGH] & (1 << i)) !== 0) {\n return i + 32;\n }\n }\n }\n for (let i = 31; i >= 0; i--) {\n if ((this._value.base[SegmentPart.LOW] & (1 << i)) !== 0) {\n return i;\n }\n }\n return -1;\n }\n /**\n * 获取最低位设置位的索引\n * @returns 最低位设置位的索引,如果位集合为空则返回-1\n */\n getLowestBitIndex() {\n if (BitMask64Utils.isZero(this._value)) {\n return -1;\n }\n for (let i = 0; i < 32; i++) {\n if ((this._value.base[SegmentPart.LOW] & (1 << i)) !== 0) {\n return i;\n }\n }\n for (let i = 0; i < 32; i++) {\n if ((this._value.base[SegmentPart.HIGH] & (1 << i)) !== 0) {\n return i + 32;\n }\n }\n return -1;\n }\n}\n//# sourceMappingURL=Bits.js.map","/**\n * 稀疏集合实现\n *\n * 提供O(1)的插入、删除、查找操作,同时保持数据的紧凑存储。\n * 使用密集数组存储实际数据,稀疏映射提供快速访问\n *\n * @template T 存储的数据类型\n *\n * @example\n * ```typescript\n * const sparseSet = new SparseSet<Entity>();\n *\n * sparseSet.add(entity1);\n * sparseSet.add(entity2);\n *\n * if (sparseSet.has(entity1)) {\n * sparseSet.remove(entity1);\n * }\n *\n * sparseSet.forEach((entity, index) => {\n * console.log(`Entity at index ${index}: ${entity.name}`);\n * });\n * ```\n */\nexport class SparseSet {\n constructor() {\n /**\n * 密集存储数组\n *\n * 连续存储所有有效数据,确保遍历时的缓存友好性。\n */\n this._dense = [];\n /**\n * 稀疏映射表\n *\n * 将数据项映射到密集数组中的索引,提供O(1)的查找性能。\n */\n this._sparse = new Map();\n }\n /**\n * 添加元素到集合\n *\n * @param item 要添加的元素\n * @returns 是否成功添加(false表示元素已存在)\n */\n add(item) {\n if (this._sparse.has(item)) {\n return false; // 元素已存在\n }\n const index = this._dense.length;\n this._dense.push(item);\n this._sparse.set(item, index);\n return true;\n }\n /**\n * 从集合中移除元素\n *\n * 使用swap-and-pop技术保持数组紧凑性:\n * 1. 将要删除的元素与最后一个元素交换\n * 2. 删除最后一个元素\n * 3. 更新映射表\n *\n * @param item 要移除的元素\n * @returns 是否成功移除(false表示元素不存在)\n */\n remove(item) {\n const index = this._sparse.get(item);\n if (index === undefined) {\n return false; // 元素不存在\n }\n const lastIndex = this._dense.length - 1;\n // 如果不是最后一个元素,则与最后一个元素交换\n if (index !== lastIndex) {\n const lastItem = this._dense[lastIndex];\n this._dense[index] = lastItem;\n this._sparse.set(lastItem, index);\n }\n // 移除最后一个元素\n this._dense.pop();\n this._sparse.delete(item);\n return true;\n }\n /**\n * 检查元素是否存在于集合中\n *\n * @param item 要检查的元素\n * @returns 元素是否存在\n */\n has(item) {\n return this._sparse.has(item);\n }\n /**\n * 获取元素在密集数组中的索引\n *\n * @param item 要查询的元素\n * @returns 索引,如果元素不存在则返回undefined\n */\n getIndex(item) {\n return this._sparse.get(item);\n }\n /**\n * 根据索引获取元素\n *\n * @param index 索引\n * @returns 元素,如果索引无效则返回undefined\n */\n getByIndex(index) {\n return this._dense[index];\n }\n /**\n * 获取集合大小\n */\n get size() {\n return this._dense.length;\n }\n /**\n * 检查集合是否为空\n */\n get isEmpty() {\n return this._dense.length === 0;\n }\n /**\n * 遍历集合中的所有元素\n *\n * 保证遍历顺序与添加顺序一致(除非中间有删除操作)。\n * 遍历性能优秀,因为数据在内存中连续存储。\n *\n * @param callback 遍历回调函数\n */\n forEach(callback) {\n for (let i = 0; i < this._dense.length; i++) {\n callback(this._dense[i], i);\n }\n }\n /**\n * 映射集合中的所有元素\n *\n * @param callback 映射回调函数\n * @returns 映射后的新数组\n */\n map(callback) {\n const result = [];\n for (let i = 0; i < this._dense.length; i++) {\n result.push(callback(this._dense[i], i));\n }\n return result;\n }\n /**\n * 过滤集合中的元素\n *\n * @param predicate 过滤条件\n * @returns 满足条件的元素数组\n */\n filter(predicate) {\n const result = [];\n for (let i = 0; i < this._dense.length; i++) {\n if (predicate(this._dense[i], i)) {\n result.push(this._dense[i]);\n }\n }\n return result;\n }\n /**\n * 查找第一个满足条件的元素\n *\n * @param predicate 查找条件\n * @returns 找到的元素,如果没有则返回undefined\n */\n find(predicate) {\n for (let i = 0; i < this._dense.length; i++) {\n if (predicate(this._dense[i], i)) {\n return this._dense[i];\n }\n }\n return undefined;\n }\n /**\n * 检查是否存在满足条件的元素\n *\n * @param predicate 检查条件\n * @returns 是否存在满足条件的元素\n */\n some(predicate) {\n for (let i = 0; i < this._dense.length; i++) {\n if (predicate(this._dense[i], i)) {\n return true;\n }\n }\n return false;\n }\n /**\n * 检查是否所有元素都满足条件\n *\n * @param predicate 检查条件\n * @returns 是否所有元素都满足条件\n */\n every(predicate) {\n for (let i = 0; i < this._dense.length; i++) {\n if (!predicate(this._dense[i], i)) {\n return false;\n }\n }\n return true;\n }\n /**\n * 获取密集数组的只读副本\n *\n * 返回数组的浅拷贝,确保外部无法直接修改内部数据。\n */\n getDenseArray() {\n return [...this._dense];\n }\n /**\n * 获取密集数组的直接引用(内部使用)\n *\n * 警告:直接修改返回的数组会破坏数据结构的完整性。\n * 仅在性能关键场景下使用,并确保不会修改数组内容。\n */\n getDenseArrayUnsafe() {\n return this._dense;\n }\n /**\n * 清空集合\n */\n clear() {\n this._dense.length = 0;\n this._sparse.clear();\n }\n /**\n * 转换为数组\n */\n toArray() {\n return [...this._dense];\n }\n /**\n * 转换为Set\n */\n toSet() {\n return new Set(this._dense);\n }\n /**\n * 获取内存使用统计信息\n */\n getMemoryStats() {\n const denseArraySize = this._dense.length * 8; // 估计每个引用8字节\n const sparseMapSize = this._sparse.size * 16; // 估计每个Map条目16字节\n return {\n denseArraySize,\n sparseMapSize,\n totalMemory: denseArraySize + sparseMapSize\n };\n }\n /**\n * 验证数据结构的完整性\n *\n * 调试用方法,检查内部数据结构是否一致。\n */\n validate() {\n // 检查大小一致性\n if (this._dense.length !== this._sparse.size) {\n return false;\n }\n // 检查映射关系的正确性\n for (let i = 0; i < this._dense.length; i++) {\n const item = this._dense[i];\n const mappedIndex = this._sparse.get(item);\n if (mappedIndex !== i) {\n return false;\n }\n }\n // 检查稀疏映射中的所有项都在密集数组中\n for (const [item, index] of this._sparse) {\n if (index >= this._dense.length || this._dense[index] !== item) {\n return false;\n }\n }\n return true;\n }\n}\n//# sourceMappingURL=SparseSet.js.map","import { ComponentRegistry } from '../Core/ComponentStorage';\nimport { BitMask64Utils } from './BigIntCompatibility';\nimport { SparseSet } from './SparseSet';\nimport { Pool } from '../../Utils/Pool/Pool';\n/**\n * 可池化的实体集合\n *\n * 实现IPoolable接口,支持对象池复用以减少内存分配开销。\n */\nclass PoolableEntitySet extends Set {\n constructor(..._args) {\n super();\n }\n reset() {\n this.clear();\n }\n}\n/**\n * 组件稀疏集合实现\n *\n * 结合通用稀疏集合和组件位掩码\n *\n * 存储结构:\n * - 稀疏集合存储实体\n * - 位掩码数组存储组件信息\n * - 组件类型映射表\n */\nexport class ComponentSparseSet {\n constructor() {\n /**\n * 组件位掩码数组\n *\n * 与实体稀疏集合的密集数组对应,存储每个实体的组件位掩码。\n * 数组索引与稀疏集合的密集数组索引一一对应。\n */\n this._componentMasks = [];\n /**\n * 组件类型到实体集合的映射\n *\n * 维护每个组件类型对应的实体集合,用于快速的单组件查询。\n */\n this._componentToEntities = new Map();\n this._entities = new SparseSet();\n }\n /**\n * 添加实体到组件索引\n *\n * 分析实体的组件组成,生成位掩码,并更新所有相关索引。\n *\n * @param entity 要添加的实体\n */\n addEntity(entity) {\n // 如果实体已存在,先移除旧数据\n if (this._entities.has(entity)) {\n this.removeEntity(entity);\n }\n const componentMask = BitMask64Utils.clone(BitMask64Utils.ZERO);\n const entityComponents = new Set();\n // 分析实体组件并构建位掩码\n for (const component of entity.components) {\n const componentType = component.constructor;\n entityComponents.add(componentType);\n // 确保组件类型已注册\n if (!ComponentRegistry.isRegistered(componentType)) {\n ComponentRegistry.register(componentType);\n }\n // 获取组件位掩码并合并\n const bitMask = ComponentRegistry.getBitMask(componentType);\n BitMask64Utils.orInPlace(componentMask, bitMask);\n }\n // 添加实体到稀疏集合\n this._entities.add(entity);\n const entityIndex = this._entities.getIndex(entity);\n // 确保位掩码数组有足够空间\n while (this._componentMasks.length <= entityIndex) {\n this._componentMasks.push(BitMask64Utils.clone(BitMask64Utils.ZERO));\n }\n this._componentMasks[entityIndex] = componentMask;\n // 更新组件类型到实体的映射\n this.updateComponentMappings(entity, entityComponents, true);\n }\n /**\n * 从组件索引中移除实体\n *\n * 清理实体相关的所有索引数据,保持数据结构的紧凑性。\n *\n * @param entity 要移除的实体\n */\n removeEntity(entity) {\n const entityIndex = this._entities.getIndex(entity);\n if (entityIndex === undefined) {\n return; // 实体不存在\n }\n // 获取实体的组件类型集合\n const entityComponents = this.getEntityComponentTypes(entity);\n // 更新组件类型到实体的映射\n this.updateComponentMappings(entity, entityComponents, false);\n // 从稀疏集合中移除实体\n this._entities.remove(entity);\n // 维护位掩码数组的紧凑性\n const lastIndex = this._componentMasks.length - 1;\n if (entityIndex !== lastIndex) {\n // 将最后一个位掩码移动到当前位置\n this._componentMasks[entityIndex] = this._componentMasks[lastIndex];\n }\n this._componentMasks.pop();\n }\n /**\n * 查询包含指定组件的所有实体\n *\n * @param componentType 组件类型\n * @returns 包含该组件的实体集合\n */\n queryByComponent(componentType) {\n const entities = this._componentToEntities.get(componentType);\n return entities ? new Set(entities) : new Set();\n }\n /**\n * 多组件查询(AND操作)\n *\n * 查找同时包含所有指定组件的实体。\n *\n * @param componentTypes 组件类型数组\n * @returns 满足条件的实体集合\n */\n queryMultipleAnd(componentTypes) {\n if (componentTypes.length === 0) {\n return new Set();\n }\n if (componentTypes.length === 1) {\n return this.queryByComponent(componentTypes[0]);\n }\n // 构建目标位掩码\n const targetMask = BitMask64Utils.clone(BitMask64Utils.ZERO);\n for (const componentType of componentTypes) {\n if (!ComponentRegistry.isRegistered(componentType)) {\n return new Set(); // 未注册的组件类型,结果为空\n }\n const bitMask = ComponentRegistry.getBitMask(componentType);\n BitMask64Utils.orInPlace(targetMask, bitMask);\n }\n const result = ComponentSparseSet._entitySetPool.obtain();\n // 遍历所有实体,检查位掩码匹配\n this._entities.forEach((entity, index) => {\n const entityMask = this._componentMasks[index];\n if (BitMask64Utils.hasAll(entityMask, targetMask)) {\n result.add(entity);\n }\n });\n return result;\n }\n /**\n * 多组件查询(OR操作)\n *\n * 查找包含任意一个指定组件的实体。\n *\n * @param componentTypes 组件类型数组\n * @returns 满足条件的实体集合\n */\n queryMultipleOr(componentTypes) {\n if (componentTypes.length === 0) {\n return new Set();\n }\n if (componentTypes.length === 1) {\n return this.queryByComponent(componentTypes[0]);\n }\n // 构建目标位掩码\n const targetMask = BitMask64Utils.clone(BitMask64Utils.ZERO);\n for (const componentType of componentTypes) {\n if (ComponentRegistry.isRegistered(componentType)) {\n const bitMask = ComponentRegistry.getBitMask(componentType);\n BitMask64Utils.orInPlace(targetMask, bitMask);\n }\n }\n if (BitMask64Utils.equals(targetMask, BitMask64Utils.ZERO)) {\n return new Set(); // 没有有效的组件类型\n }\n const result = ComponentSparseSet._entitySetPool.obtain();\n // 遍历所有实体,检查位掩码匹配\n this._entities.forEach((entity, index) => {\n const entityMask = this._componentMasks[index];\n if (BitMask64Utils.hasAny(entityMask, targetMask)) {\n result.add(entity);\n }\n });\n return result;\n }\n /**\n * 检查实体是否包含指定组件\n *\n * @param entity 实体\n * @param componentType 组件类型\n * @returns 是否包含该组件\n */\n hasComponent(entity, componentType) {\n const entityIndex = this._entities.getIndex(entity);\n if (entityIndex === undefined) {\n return false;\n }\n if (!ComponentRegistry.isRegistered(componentType)) {\n return false;\n }\n const entityMask = this._componentMasks[entityIndex];\n const componentMask = ComponentRegistry.getBitMask(componentType);\n return BitMask64Utils.hasAny(entityMask, componentMask);\n }\n /**\n * 获取实体的组件位掩码\n *\n * @param entity 实体\n * @returns 组件位掩码,如果实体不存在则返回undefined\n */\n getEntityMask(entity) {\n const entityIndex = this._entities.getIndex(entity);\n if (entityIndex === undefined) {\n return undefined;\n }\n return this._componentMasks[entityIndex];\n }\n /**\n * 获取所有实体\n *\n * @returns 所有实体的数组\n */\n getAllEntities() {\n return this._entities.toArray();\n }\n /**\n * 获取实体数量\n */\n get size() {\n return this._entities.size;\n }\n /**\n * 检查是否为空\n */\n get isEmpty() {\n return this._entities.isEmpty;\n }\n /**\n * 遍历所有实体\n *\n * @param callback 遍历回调函数\n */\n forEach(callback) {\n this._entities.forEach((entity, index) => {\n callback(entity, this._componentMasks[index], index);\n });\n }\n /**\n * 清空所有数据\n */\n clear() {\n this._entities.clear();\n this._componentMasks.length = 0;\n // 清理时将所有持有的实体集合返回到池中\n for (const entitySet of this._componentToEntities.values()) {\n ComponentSparseSet._entitySetPool.release(entitySet);\n }\n this._componentToEntities.clear();\n }\n /**\n * 获取内存使用统计\n */\n getMemoryStats() {\n const entitiesStats = this._entities.getMemoryStats();\n const masksMemory = this._componentMasks.length * 16; // 估计每个BigInt 16字节\n let mappingsMemory = this._componentToEntities.size * 16; // Map条目开销\n for (const entitySet of this._componentToEntities.values()) {\n mappingsMemory += entitySet.size * 8; // 每个实体引用8字节\n }\n return {\n entitiesMemory: entitiesStats.totalMemory,\n masksMemory,\n mappingsMemory,\n totalMemory: entitiesStats.totalMemory + masksMemory + mappingsMemory\n };\n }\n /**\n * 验证数据结构完整性\n */\n validate() {\n // 检查稀疏集合的有效性\n if (!this._entities.validate()) {\n return false;\n }\n // 检查位掩码数组长度一致性\n if (this._componentMasks.length !== this._entities.size) {\n return false;\n }\n // 检查组件映射的一致性\n const allMappedEntities = new Set();\n for (const entitySet of this._componentToEntities.values()) {\n for (const entity of entitySet) {\n allMappedEntities.add(entity);\n }\n }\n // 验证映射中的实体都在稀疏集合中\n for (const entity of allMappedEntities) {\n if (!this._entities.has(entity)) {\n return false;\n }\n }\n return true;\n }\n /**\n * 获取实体的组件类型集合\n */\n getEntityComponentTypes(entity) {\n const componentTypes = new Set();\n for (const component of entity.components) {\n componentTypes.add(component.constructor);\n }\n return componentTypes;\n }\n /**\n * 更新组件类型到实体的映射\n */\n updateComponentMappings(entity, componentTypes, add) {\n for (const componentType of componentTypes) {\n let entities = this._componentToEntities.get(componentType);\n if (add) {\n if (!entities) {\n entities = ComponentSparseSet._entitySetPool.obtain();\n this._componentToEntities.set(componentType, entities);\n }\n entities.add(entity);\n }\n else {\n if (entities) {\n entities.delete(entity);\n if (entities.size === 0) {\n this._componentToEntities.delete(componentType);\n ComponentSparseSet._entitySetPool.release(entities);\n }\n }\n }\n }\n }\n}\n/**\n * 实体集合对象池\n *\n * 使用core库的Pool系统来管理PoolableEntitySet对象的复用。\n */\nComponentSparseSet._entitySetPool = Pool.getPool(PoolableEntitySet, 50, 512);\n//# sourceMappingURL=ComponentSparseSet.js.map","// FlatHashMapFast.ts\n/**\n * 高性能 HashMap,使用BitMask64Data作为Key。内部计算两层哈希:\n * - primaryHash: MurmurHash3(seed1) => 定位 bucket\n * - secondaryHash: MurmurHash3(seed2) => 处理 bucket 内碰撞判定\n *\n * 理论上,在1e5数量数据规模下碰撞概率在数学意义上的可忽略。\n * 在本地测试中,一千万次连续/随机BitMask64Data生成未发生一级哈希冲突,考虑到使用场景(原型系统、组件系统等)远达不到此数量级,因此可安全用于生产环境。\n */\nexport class BitMaskHashMap {\n constructor() {\n this.buckets = new Map();\n this._size = 0;\n }\n get size() {\n return this._size;\n }\n get innerBuckets() {\n return this.buckets;\n }\n /** MurmurHash3 (32bit) 简化实现 */\n murmur32(key, seed) {\n let h = seed >>> 0;\n const mix = (k) => {\n k = Math.imul(k, 0xcc9e2d51) >>> 0; // 第一个 32 位魔术常数\n k = (k << 15) | (k >>> 17);\n k = Math.imul(k, 0x1b873593) >>> 0; // 第二个 32 位魔术常数\n h ^= k;\n h = (h << 13) | (h >>> 19);\n h = (Math.imul(h, 5) + 0xe6546b64) >>> 0;\n };\n // base\n mix(key.base[0] >>> 0);\n mix(key.base[1] >>> 0);\n // segments\n if (key.segments) {\n for (const seg of key.segments) {\n mix(seg[0] >>> 0);\n mix(seg[1] >>> 0);\n }\n }\n h ^= (key.segments ? key.segments.length * 8 : 8);\n h ^= h >>> 16;\n h = Math.imul(h, 0x85ebca6b) >>> 0;\n h ^= h >>> 13;\n h = Math.imul(h, 0xc2b2ae35) >>> 0;\n h ^= h >>> 16;\n return h >>> 0;\n }\n /** primaryHash + secondaryHash 计算 */\n getHashes(key) {\n const primary = this.murmur32(key, 0x9747b28c); // seed1\n const secondary = this.murmur32(key, 0x12345678); // seed2\n return [primary, secondary];\n }\n set(key, value) {\n const [primary, secondary] = this.getHashes(key);\n let bucket = this.buckets.get(primary);\n if (!bucket) {\n bucket = [];\n this.buckets.set(primary, bucket);\n }\n // 查找是否存在 secondaryHash\n for (let i = 0; i < bucket.length; i++) {\n if (bucket[i][0] === secondary) {\n bucket[i][1] = value;\n return this;\n }\n }\n // 新增\n bucket.push([secondary, value]);\n this._size++;\n return this;\n }\n get(key) {\n const [primary, secondary] = this.getHashes(key);\n const bucket = this.buckets.get(primary);\n if (!bucket)\n return undefined;\n for (let i = 0; i < bucket.length; i++) {\n if (bucket[i][0] === secondary) {\n return bucket[i][1];\n }\n }\n return undefined;\n }\n has(key) {\n return this.get(key) !== undefined;\n }\n delete(key) {\n const [primary, secondary] = this.getHashes(key);\n const bucket = this.buckets.get(primary);\n if (!bucket)\n return false;\n for (let i = 0; i < bucket.length; i++) {\n if (bucket[i][0] === secondary) {\n bucket.splice(i, 1);\n this._size--;\n if (bucket.length === 0) {\n this.buckets.delete(primary);\n }\n return true;\n }\n }\n return false;\n }\n clear() {\n this.buckets.clear();\n this._size = 0;\n }\n *entries() {\n for (const [_, bucket] of this.buckets) {\n for (const [_secondary, value] of bucket) {\n // 无法还原原始 key(只存二级 hash),所以 entries 返回不了 key\n yield [undefined, value];\n }\n }\n }\n *values() {\n for (const bucket of this.buckets.values()) {\n for (const [_, value] of bucket) {\n yield value;\n }\n }\n }\n}\n//# sourceMappingURL=BitMaskHashMap.js.map","/**\n * 查询条件类型\n */\nexport var QueryConditionType;\n(function (QueryConditionType) {\n /** 必须包含所有指定组件 */\n QueryConditionType[\"ALL\"] = \"all\";\n /** 必须包含任意一个指定组件 */\n QueryConditionType[\"ANY\"] = \"any\";\n /** 不能包含任何指定组件 */\n QueryConditionType[\"NONE\"] = \"none\";\n})(QueryConditionType || (QueryConditionType = {}));\n//# sourceMappingURL=QueryTypes.js.map","import { ComponentRegistry } from './ComponentStorage';\nimport { BitMask64Utils } from '../Utils';\nimport { BitMaskHashMap } from '../Utils/BitMaskHashMap';\n/**\n * Archetype系统\n *\n * 根据实体的组件组合将实体分组到不同的原型中,提供高效的查询性能。\n */\nexport class ArchetypeSystem {\n constructor() {\n /** 所有原型的映射表 */\n this._archetypes = new BitMaskHashMap();\n /** 实体到原型的映射 */\n this._entityToArchetype = new Map();\n /** 组件类型到原型的映射 */\n this._componentToArchetypes = new Map();\n /** 实体组件类型缓存 */\n this._entityComponentTypesCache = new Map();\n /** 所有原型 */\n this._allArchetypes = [];\n }\n /**\n * 添加实体到原型系统\n */\n addEntity(entity) {\n const componentTypes = this.getEntityComponentTypes(entity);\n const archetypeId = this.generateArchetypeId(componentTypes);\n let archetype = this._archetypes.get(archetypeId);\n if (!archetype) {\n archetype = this.createArchetype(componentTypes);\n }\n archetype.entities.add(entity);\n this._entityToArchetype.set(entity, archetype);\n }\n /**\n * 从原型系统中移除实体\n */\n removeEntity(entity) {\n const archetype = this._entityToArchetype.get(entity);\n if (!archetype)\n return;\n archetype.entities.delete(entity);\n // 清理实体相关缓存\n this._entityComponentTypesCache.delete(entity);\n this._entityToArchetype.delete(entity);\n }\n /**\n * 更新实体的原型归属\n *\n * 当实体的组件组合发生变化时调用此方法,将实体从旧原型移动到新原型。\n * 如果新的组件组合对应的原型不存在,将自动创建新原型。\n *\n * @param entity 要更新的实体\n */\n updateEntity(entity) {\n const currentArchetype = this._entityToArchetype.get(entity);\n // 清理实体组件类型缓存,强制重新计算\n this._entityComponentTypesCache.delete(entity);\n const newComponentTypes = this.getEntityComponentTypes(entity);\n const newArchetypeId = this.generateArchetypeId(newComponentTypes);\n // 如果实体已在正确的原型中,无需更新\n if (currentArchetype && currentArchetype.id === newArchetypeId) {\n return;\n }\n // 从旧原型中移除实体\n if (currentArchetype) {\n currentArchetype.entities.delete(entity);\n }\n // 获取或创建新原型\n let newArchetype = this._archetypes.get(newArchetypeId);\n if (!newArchetype) {\n newArchetype = this.createArchetype(newComponentTypes);\n }\n // 将实体添加到新原型\n newArchetype.entities.add(entity);\n this._entityToArchetype.set(entity, newArchetype);\n }\n /**\n * 查询包含指定组件组合的原型\n *\n * @param componentTypes 要查询的组件类型列表\n * @param operation 查询操作类型:'AND'(包含所有)或 'OR'(包含任意)\n * @returns 匹配的原型列表及实体总数\n */\n queryArchetypes(componentTypes, operation = 'AND') {\n const matchingArchetypes = [];\n let totalEntities = 0;\n if (operation === 'AND') {\n if (componentTypes.length === 0) {\n for (const archetype of this._allArchetypes) {\n matchingArchetypes.push(archetype);\n totalEntities += archetype.entities.size;\n }\n return { archetypes: matchingArchetypes, totalEntities };\n }\n if (componentTypes.length === 1) {\n const archetypes = this._componentToArchetypes.get(componentTypes[0]);\n if (archetypes) {\n for (const archetype of archetypes) {\n matchingArchetypes.push(archetype);\n totalEntities += archetype.entities.size;\n }\n }\n return { archetypes: matchingArchetypes, totalEntities };\n }\n let smallestSet;\n let smallestSize = Infinity;\n for (const componentType of componentTypes) {\n const archetypes = this._componentToArchetypes.get(componentType);\n if (!archetypes || archetypes.size === 0) {\n return { archetypes: [], totalEntities: 0 };\n }\n if (archetypes.size < smallestSize) {\n smallestSize = archetypes.size;\n smallestSet = archetypes;\n }\n }\n const queryMask = this.generateArchetypeId(componentTypes);\n if (smallestSet) {\n for (const archetype of smallestSet) {\n if (BitMask64Utils.hasAll(archetype.id, queryMask)) {\n matchingArchetypes.push(archetype);\n totalEntities += archetype.entities.size;\n }\n }\n }\n }\n else {\n const foundArchetypes = new Set();\n for (const componentType of componentTypes) {\n const archetypes = this._componentToArchetypes.get(componentType);\n if (archetypes) {\n for (const archetype of archetypes) {\n foundArchetypes.add(archetype);\n }\n }\n }\n for (const archetype of foundArchetypes) {\n matchingArchetypes.push(archetype);\n totalEntities += archetype.entities.size;\n }\n }\n return {\n archetypes: matchingArchetypes,\n totalEntities\n };\n }\n /**\n * 获取实体所属的原型\n */\n getEntityArchetype(entity) {\n return this._entityToArchetype.get(entity);\n }\n /**\n * 获取所有原型\n */\n getAllArchetypes() {\n return this._allArchetypes.slice();\n }\n /**\n * 获取包含指定组件类型的所有实体\n */\n getEntitiesByComponent(componentType) {\n const archetypes = this._componentToArchetypes.get(componentType);\n if (!archetypes || archetypes.size === 0) {\n return [];\n }\n const entities = [];\n for (const archetype of archetypes) {\n for (const entity of archetype.entities) {\n entities.push(entity);\n }\n }\n return entities;\n }\n /**\n * 清空所有数据\n */\n clear() {\n this._archetypes.clear();\n this._entityToArchetype.clear();\n this._componentToArchetypes.clear();\n this._entityComponentTypesCache.clear();\n this._allArchetypes = [];\n }\n /**\n * 更新所有原型数组\n */\n updateAllArchetypeArrays() {\n this._allArchetypes = [];\n for (const archetype of this._archetypes.values()) {\n this._allArchetypes.push(archetype);\n }\n }\n /**\n * 获取实体的组件类型列表\n */\n getEntityComponentTypes(entity) {\n let componentTypes = this._entityComponentTypesCache.get(entity);\n if (!componentTypes) {\n componentTypes = entity.components.map((component) => component.constructor);\n this._entityComponentTypesCache.set(entity, componentTypes);\n }\n return componentTypes;\n }\n /**\n * 生成原型ID\n * 使用ComponentRegistry确保与Entity.componentMask使用相同的bitIndex\n */\n generateArchetypeId(componentTypes) {\n const mask = BitMask64Utils.clone(BitMask64Utils.ZERO);\n for (const type of componentTypes) {\n if (!ComponentRegistry.isRegistered(type)) {\n ComponentRegistry.register(type);\n }\n const bitMask = ComponentRegistry.getBitMask(type);\n BitMask64Utils.orInPlace(mask, bitMask);\n }\n return mask;\n }\n /**\n * 创建新原型\n */\n createArchetype(componentTypes) {\n const id = this.generateArchetypeId(componentTypes);\n const archetype = {\n id,\n componentTypes: [...componentTypes],\n entities: new Set()\n };\n this._archetypes.set(id, archetype);\n this.updateAllArchetypeArrays();\n for (const componentType of componentTypes) {\n let archetypes = this._componentToArchetypes.get(componentType);\n if (!archetypes) {\n archetypes = new Set();\n this._componentToArchetypes.set(componentType, archetypes);\n }\n archetypes.add(archetype);\n }\n return archetype;\n }\n}\n//# sourceMappingURL=ArchetypeSystem.js.map","import { QueryConditionType } from './QueryTypes';\nimport { BitMask64Utils } from '../Utils/BigIntCompatibility';\nimport { createLogger } from '../../Utils/Logger';\nconst logger = createLogger('ReactiveQuery');\n/**\n * 响应式查询变化类型\n */\nexport var ReactiveQueryChangeType;\n(function (ReactiveQueryChangeType) {\n /** 实体添加到查询结果 */\n ReactiveQueryChangeType[\"ADDED\"] = \"added\";\n /** 实体从查询结果移除 */\n ReactiveQueryChangeType[\"REMOVED\"] = \"removed\";\n /** 查询结果批量更新 */\n ReactiveQueryChangeType[\"BATCH_UPDATE\"] = \"batch_update\";\n})(ReactiveQueryChangeType || (ReactiveQueryChangeType = {}));\n/**\n * 响应式查询类\n *\n * 提供基于事件驱动的实体查询机制,只在实体/组件真正变化时触发通知。\n *\n * 核心特性:\n * - Event-driven: 基于事件的增量更新\n * - 精确通知: 只通知真正匹配的变化\n * - 性能优化: 避免每帧重复查询\n *\n * @example\n * ```typescript\n * // 创建响应式查询\n * const query = new ReactiveQuery(querySystem, {\n * type: QueryConditionType.ALL,\n * componentTypes: [Position, Velocity],\n * mask: createMask([Position, Velocity])\n * });\n *\n * // 订阅变化\n * query.subscribe((change) => {\n * if (change.type === ReactiveQueryChangeType.ADDED) {\n * console.log('新实体:', change.entity);\n * }\n * });\n *\n * // 获取当前结果\n * const entities = query.getEntities();\n * ```\n */\nexport class ReactiveQuery {\n constructor(condition, config = {}) {\n /** 当前查询结果 */\n this._entities = [];\n /** 实体ID集合,用于快速查找 */\n this._entityIdSet = new Set();\n /**\n * 实体数组快照 - 用于安全迭代\n * Entity array snapshot - for safe iteration\n * 只在实体列表变化时才创建新快照,静态场景下所有系统共享同一快照\n * Only create new snapshot when entity list changes, static scenes share the same snapshot\n */\n this._snapshot = null;\n /** 监听器列表 */\n this._listeners = [];\n /** 是否已激活 */\n this._active = true;\n this._condition = condition;\n this._config = {\n enableBatchMode: config.enableBatchMode ?? true,\n batchDelay: config.batchDelay ?? 16, // 默认一帧\n debug: config.debug ?? false\n };\n this._id = this.generateQueryId();\n this._batchChanges = {\n added: [],\n removed: [],\n timer: null\n };\n if (this._config.debug) {\n logger.debug(`创建ReactiveQuery: ${this._id}`);\n }\n }\n /**\n * 生成查询ID\n */\n generateQueryId() {\n const typeStr = this._condition.type;\n const componentsStr = this._condition.componentTypes\n .map((t) => t.name)\n .sort()\n .join(',');\n return `${typeStr}:${componentsStr}`;\n }\n /**\n * 订阅查询变化\n *\n * @param listener 监听器函数\n * @returns 取消订阅的函数\n */\n subscribe(listener) {\n if (!this._active) {\n throw new Error(`Cannot subscribe to disposed ReactiveQuery ${this._id}`);\n }\n if (typeof listener !== 'function') {\n throw new TypeError('Listener must be a function');\n }\n this._listeners.push(listener);\n if (this._config.debug) {\n logger.debug(`订阅ReactiveQuery: ${this._id}, 监听器数量: ${this._listeners.length}`);\n }\n return () => {\n const index = this._listeners.indexOf(listener);\n if (index !== -1) {\n this._listeners.splice(index, 1);\n }\n };\n }\n /**\n * 取消所有订阅\n */\n unsubscribeAll() {\n this._listeners.length = 0;\n }\n /**\n * 获取当前查询结果(返回安全快照)\n * Get current query results (returns safe snapshot)\n *\n * 返回的快照在实体列表变化前保持不变,可安全用于迭代。\n * 静态场景下所有系统共享同一快照,避免每帧创建数组副本。\n *\n * The returned snapshot remains unchanged until entity list changes, safe for iteration.\n * Static scenes share the same snapshot, avoiding array copy every frame.\n */\n getEntities() {\n // 如果快照有效,直接返回 | Return snapshot if valid\n if (this._snapshot !== null) {\n return this._snapshot;\n }\n // 创建新快照 | Create new snapshot\n this._snapshot = [...this._entities];\n return this._snapshot;\n }\n /**\n * 获取查询结果数量\n */\n get count() {\n return this._entities.length;\n }\n /**\n * 检查实体是否匹配查询条件\n *\n * @param entity 要检查的实体\n * @returns 是否匹配\n */\n matches(entity) {\n const entityMask = entity.componentMask;\n switch (this._condition.type) {\n case QueryConditionType.ALL:\n return BitMask64Utils.hasAll(entityMask, this._condition.mask);\n case QueryConditionType.ANY:\n return BitMask64Utils.hasAny(entityMask, this._condition.mask);\n case QueryConditionType.NONE:\n return BitMask64Utils.hasNone(entityMask, this._condition.mask);\n default:\n return false;\n }\n }\n /**\n * 通知实体添加\n *\n * 当Scene中添加实体时调用\n *\n * @param entity 添加的实体\n */\n notifyEntityAdded(entity) {\n if (!this._active)\n return;\n // 检查实体是否匹配查询条件\n if (!this.matches(entity)) {\n return;\n }\n // 检查是否已存在\n if (this._entityIdSet.has(entity.id)) {\n return;\n }\n // 添加到结果集\n this._entities.push(entity);\n this._entityIdSet.add(entity.id);\n this._snapshot = null; // 使快照失效 | Invalidate snapshot\n // 通知监听器\n if (this._config.enableBatchMode) {\n this.addToBatch('added', entity);\n }\n else {\n this.notifyListeners({\n type: ReactiveQueryChangeType.ADDED,\n entity\n });\n }\n if (this._config.debug) {\n logger.debug(`ReactiveQuery ${this._id}: 实体添加 ${entity.name}(${entity.id})`);\n }\n }\n /**\n * 通知实体移除\n *\n * 当Scene中移除实体时调用\n *\n * @param entity 移除的实体\n */\n notifyEntityRemoved(entity) {\n if (!this._active)\n return;\n // 检查是否在结果集中\n if (!this._entityIdSet.has(entity.id)) {\n return;\n }\n // 从结果集移除\n const index = this._entities.indexOf(entity);\n if (index !== -1) {\n this._entities.splice(index, 1);\n }\n this._entityIdSet.delete(entity.id);\n this._snapshot = null; // 使快照失效 | Invalidate snapshot\n // 通知监听器\n if (this._config.enableBatchMode) {\n this.addToBatch('removed', entity);\n }\n else {\n this.notifyListeners({\n type: ReactiveQueryChangeType.REMOVED,\n entity\n });\n }\n if (this._config.debug) {\n logger.debug(`ReactiveQuery ${this._id}: 实体移除 ${entity.name}(${entity.id})`);\n }\n }\n /**\n * 通知实体组件变化\n *\n * 当实体的组件发生变化时调用\n *\n * @param entity 变化的实体\n */\n notifyEntityChanged(entity) {\n if (!this._active)\n return;\n const wasMatching = this._entityIdSet.has(entity.id);\n const isMatching = this.matches(entity);\n if (wasMatching && !isMatching) {\n // 实体不再匹配,从结果集移除\n this.notifyEntityRemoved(entity);\n }\n else if (!wasMatching && isMatching) {\n // 实体现在匹配,添加到结果集\n this.notifyEntityAdded(entity);\n }\n }\n /**\n * 批量初始化查询结果\n *\n * @param entities 初始实体列表\n */\n initializeWith(entities) {\n // 清空现有结果\n this._entities.length = 0;\n this._entityIdSet.clear();\n this._snapshot = null; // 使快照失效 | Invalidate snapshot\n // 筛选匹配的实体\n for (const entity of entities) {\n if (this.matches(entity)) {\n this._entities.push(entity);\n this._entityIdSet.add(entity.id);\n }\n }\n if (this._config.debug) {\n logger.debug(`ReactiveQuery ${this._id}: 初始化 ${this._entities.length} 个实体`);\n }\n }\n /**\n * 添加到批量变化缓存\n */\n addToBatch(type, entity) {\n if (type === 'added') {\n this._batchChanges.added.push(entity);\n }\n else {\n this._batchChanges.removed.push(entity);\n }\n // 启动批量通知定时器\n if (this._batchChanges.timer === null) {\n this._batchChanges.timer = setTimeout(() => {\n this.flushBatchChanges();\n }, this._config.batchDelay);\n }\n }\n /**\n * 刷新批量变化\n */\n flushBatchChanges() {\n if (this._batchChanges.added.length === 0 && this._batchChanges.removed.length === 0) {\n this._batchChanges.timer = null;\n return;\n }\n const added = [...this._batchChanges.added];\n const removed = [...this._batchChanges.removed];\n // 清空缓存\n this._batchChanges.added.length = 0;\n this._batchChanges.removed.length = 0;\n this._batchChanges.timer = null;\n // 通知监听器\n this.notifyListeners({\n type: ReactiveQueryChangeType.BATCH_UPDATE,\n added,\n removed,\n entities: this._entities\n });\n if (this._config.debug) {\n logger.debug(`ReactiveQuery ${this._id}: 批量更新 +${added.length} -${removed.length}`);\n }\n }\n /**\n * 通知所有监听器\n */\n notifyListeners(change) {\n const listeners = [...this._listeners];\n for (const listener of listeners) {\n try {\n listener(change);\n }\n catch (error) {\n logger.error(`ReactiveQuery ${this._id}: 监听器执行出错`, error);\n }\n }\n }\n /**\n * 暂停响应式查询\n *\n * 暂停后不再响应实体变化,但可以继续获取当前结果\n */\n pause() {\n this._active = false;\n // 清空批量变化缓存\n if (this._batchChanges.timer !== null) {\n clearTimeout(this._batchChanges.timer);\n this._batchChanges.timer = null;\n }\n this._batchChanges.added.length = 0;\n this._batchChanges.removed.length = 0;\n }\n /**\n * 恢复响应式查询\n */\n resume() {\n this._active = true;\n }\n /**\n * 销毁响应式查询\n *\n * 释放所有资源,清空监听器和结果集\n */\n dispose() {\n if (this._batchChanges.timer !== null) {\n clearTimeout(this._batchChanges.timer);\n this._batchChanges.timer = null;\n }\n this._batchChanges.added.length = 0;\n this._batchChanges.removed.length = 0;\n this._active = false;\n this.unsubscribeAll();\n this._entities.length = 0;\n this._entityIdSet.clear();\n this._snapshot = null;\n if (this._config.debug) {\n logger.debug(`ReactiveQuery ${this._id}: 已销毁`);\n }\n }\n /**\n * 获取查询条件\n */\n get condition() {\n return this._condition;\n }\n /**\n * 获取查询ID\n */\n get id() {\n return this._id;\n }\n /**\n * 检查是否激活\n */\n get active() {\n return this._active;\n }\n /**\n * 获取监听器数量\n */\n get listenerCount() {\n return this._listeners.length;\n }\n}\n//# sourceMappingURL=ReactiveQuery.js.map","import { ComponentRegistry } from './ComponentStorage';\nimport { BitMask64Utils } from '../Utils/BigIntCompatibility';\nimport { createLogger } from '../../Utils/Logger';\nimport { getComponentTypeName } from '../Decorators';\nimport { ArchetypeSystem } from './ArchetypeSystem';\nimport { ReactiveQuery } from './ReactiveQuery';\nimport { QueryConditionType } from './QueryTypes';\nexport { QueryConditionType };\n/**\n * 高性能实体查询系统\n *\n * 提供快速的实体查询功能,支持按组件类型、标签、名称等多种方式查询实体。\n *\n * @example\n * ```typescript\n * // 查询所有包含Position和Velocity组件的实体\n * const movingEntities = querySystem.queryAll(PositionComponent, VelocityComponent);\n *\n * // 查询特定标签的实体\n * const playerEntities = querySystem.queryByTag(PLAYER_TAG);\n * ```\n */\nexport class QuerySystem {\n constructor() {\n this._logger = createLogger('QuerySystem');\n this._entities = [];\n this._version = 0;\n this._queryCache = new Map();\n this._cacheMaxSize = 1000;\n this._cacheTimeout = 5000;\n this._componentMaskCache = new Map();\n this._queryStats = {\n totalQueries: 0,\n cacheHits: 0,\n indexHits: 0,\n linearScans: 0,\n archetypeHits: 0,\n dirtyChecks: 0\n };\n /**\n * 响应式查询集合(内部使用,作为智能缓存)\n * 传统查询API(queryAll/queryAny/queryNone)内部自动使用响应式查询优化性能\n */\n this._reactiveQueries = new Map();\n /**\n * 按组件类型索引的响应式查询\n * 用于快速定位哪些查询关心某个组件类型\n */\n this._reactiveQueriesByComponent = new Map();\n this._entityIndex = {\n byTag: new Map(),\n byName: new Map()\n };\n this._archetypeSystem = new ArchetypeSystem();\n }\n /**\n * 设置实体列表并重建索引\n *\n * 当实体集合发生大规模变化时调用此方法。\n * 系统将重新构建所有索引以确保查询性能。\n *\n * @param entities 新的实体列表\n */\n setEntities(entities) {\n this._entities = entities;\n this.clearQueryCache();\n this.clearReactiveQueries();\n this.rebuildIndexes();\n }\n /**\n * 添加单个实体到查询系统\n *\n * 将新实体添加到查询系统中,并自动更新相关索引。\n * 为了提高批量添加性能,可以延迟缓存清理。\n *\n * @param entity 要添加的实体\n * @param deferCacheClear 是否延迟缓存清理(用于批量操作)\n */\n addEntity(entity, deferCacheClear = false) {\n if (!this._entities.includes(entity)) {\n this._entities.push(entity);\n this.addEntityToIndexes(entity);\n this._archetypeSystem.addEntity(entity);\n // 通知响应式查询\n this.notifyReactiveQueriesEntityAdded(entity);\n // 只有在非延迟模式下才立即清理缓存\n if (!deferCacheClear) {\n this.clearQueryCache();\n }\n // 更新版本号\n this._version++;\n }\n }\n /**\n * 批量添加实体\n *\n * 高效地批量添加多个实体,减少缓存清理次数。\n * 使用Set来避免O(n)的重复检查。\n *\n * @param entities 要添加的实体列表\n */\n addEntities(entities) {\n if (entities.length === 0)\n return;\n // 使用Set来快速检查重复\n const existingIds = new Set(this._entities.map((e) => e.id));\n let addedCount = 0;\n for (const entity of entities) {\n if (!existingIds.has(entity.id)) {\n this._entities.push(entity);\n this.addEntityToIndexes(entity);\n // 更新索引管理器\n this._archetypeSystem.addEntity(entity);\n existingIds.add(entity.id);\n addedCount++;\n }\n }\n // 只在有实体被添加时才清理缓存\n if (addedCount > 0) {\n this.clearQueryCache();\n }\n }\n /**\n * 批量添加实体(无重复检查版本)\n *\n * 假设所有实体都是新的,跳过重复检查以获得最大性能。\n * 仅在确保没有重复实体时使用。\n *\n * @param entities 要添加的实体列表\n */\n addEntitiesUnchecked(entities) {\n if (entities.length === 0)\n return;\n // 避免调用栈溢出,分批添加\n for (const entity of entities) {\n this._entities.push(entity);\n }\n // 批量更新索引\n for (const entity of entities) {\n this.addEntityToIndexes(entity);\n // 更新索引管理器\n this._archetypeSystem.addEntity(entity);\n }\n // 清理缓存\n this.clearQueryCache();\n }\n /**\n * 从查询系统移除实体\n *\n * 从查询系统中移除指定实体,并清理相关索引。\n *\n * @param entity 要移除的实体\n */\n removeEntity(entity) {\n const index = this._entities.indexOf(entity);\n if (index !== -1) {\n const componentTypes = [];\n for (const component of entity.components) {\n componentTypes.push(component.constructor);\n }\n this._entities.splice(index, 1);\n this.removeEntityFromIndexes(entity);\n this._archetypeSystem.removeEntity(entity);\n if (componentTypes.length > 0) {\n this.notifyReactiveQueriesEntityRemoved(entity, componentTypes);\n }\n else {\n this.notifyReactiveQueriesEntityRemovedFallback(entity);\n }\n this.clearQueryCache();\n this._version++;\n }\n }\n /**\n * 更新实体在查询系统中的索引\n *\n * 当实体的组件组合发生变化时调用此方法,高效地更新实体在查询系统中的索引。\n *\n * @param entity 要更新的实体\n */\n updateEntity(entity) {\n // 检查实体是否在查询系统中\n if (!this._entities.includes(entity)) {\n // 如果实体不在系统中,直接添加\n this.addEntity(entity);\n return;\n }\n // 先从索引中移除实体的旧状态\n this.removeEntityFromIndexes(entity);\n // 更新ArchetypeSystem中的实体状态\n this._archetypeSystem.updateEntity(entity);\n // 重新添加实体到索引(基于新的组件状态)\n this.addEntityToIndexes(entity);\n // 通知响应式查询\n this.notifyReactiveQueriesEntityChanged(entity);\n // 清理查询缓存,因为实体组件状态已改变\n this.clearQueryCache();\n // 更新版本号以使缓存失效\n this._version++;\n }\n /**\n * 将实体添加到各种索引中\n */\n addEntityToIndexes(entity) {\n // 标签索引\n const tag = entity.tag;\n if (tag !== undefined) {\n const tagSet = this._entityIndex.byTag.get(tag) || this.createAndSetTagIndex(tag);\n tagSet.add(entity);\n }\n // 名称索引\n const name = entity.name;\n if (name) {\n const nameSet = this._entityIndex.byName.get(name) || this.createAndSetNameIndex(name);\n nameSet.add(entity);\n }\n }\n createAndSetTagIndex(tag) {\n const set = new Set();\n this._entityIndex.byTag.set(tag, set);\n return set;\n }\n createAndSetNameIndex(name) {\n const set = new Set();\n this._entityIndex.byName.set(name, set);\n return set;\n }\n /**\n * 从各种索引中移除实体\n */\n removeEntityFromIndexes(entity) {\n // 从标签索引移除\n if (entity.tag !== undefined) {\n const tagSet = this._entityIndex.byTag.get(entity.tag);\n if (tagSet) {\n tagSet.delete(entity);\n if (tagSet.size === 0) {\n this._entityIndex.byTag.delete(entity.tag);\n }\n }\n }\n // 从名称索引移除\n if (entity.name) {\n const nameSet = this._entityIndex.byName.get(entity.name);\n if (nameSet) {\n nameSet.delete(entity);\n if (nameSet.size === 0) {\n this._entityIndex.byName.delete(entity.name);\n }\n }\n }\n }\n /**\n * 重建所有索引\n *\n * 清空并重新构建所有查询索引。\n * 通常在大量实体变更后调用以确保索引一致性。\n */\n rebuildIndexes() {\n this._entityIndex.byTag.clear();\n this._entityIndex.byName.clear();\n // 清理ArchetypeSystem和ComponentIndexManager\n this._archetypeSystem.clear();\n for (const entity of this._entities) {\n this.addEntityToIndexes(entity);\n this._archetypeSystem.addEntity(entity);\n }\n }\n /**\n * 查询包含所有指定组件的实体\n *\n * 返回同时包含所有指定组件类型的实体列表。\n * 内部使用响应式查询作为智能缓存,自动跟踪实体变化,性能更优。\n *\n * @param componentTypes 要查询的组件类型列表\n * @returns 查询结果,包含匹配的实体和性能信息\n *\n * @example\n * ```typescript\n * // 查询同时具有位置和速度组件的实体\n * const result = querySystem.queryAll(PositionComponent, VelocityComponent);\n * logger.info(`找到 ${result.count} 个移动实体`);\n * ```\n */\n queryAll(...componentTypes) {\n const startTime = performance.now();\n this._queryStats.totalQueries++;\n // 使用内部响应式查询作为智能缓存\n const reactiveQuery = this.getOrCreateReactiveQuery(QueryConditionType.ALL, componentTypes);\n // 从响应式查询获取结果(永远是最新的)\n const entities = reactiveQuery.getEntities();\n // 统计为缓存命中(响应式查询本质上是永不过期的智能缓存)\n this._queryStats.cacheHits++;\n return {\n entities,\n count: entities.length,\n executionTime: performance.now() - startTime,\n fromCache: true\n };\n }\n /**\n * 查询包含任意指定组件的实体\n *\n * 返回包含任意一个指定组件类型的实体列表。\n * 内部使用响应式查询作为智能缓存,自动跟踪实体变化,性能更优。\n *\n * @param componentTypes 要查询的组件类型列表\n * @returns 查询结果,包含匹配的实体和性能信息\n *\n * @example\n * ```typescript\n * // 查询具有武器或护甲组件的实体\n * const result = querySystem.queryAny(WeaponComponent, ArmorComponent);\n * logger.info(`找到 ${result.count} 个装备实体`);\n * ```\n */\n queryAny(...componentTypes) {\n const startTime = performance.now();\n this._queryStats.totalQueries++;\n // 使用内部响应式查询作为智能缓存\n const reactiveQuery = this.getOrCreateReactiveQuery(QueryConditionType.ANY, componentTypes);\n // 从响应式查询获取结果(永远是最新的)\n const entities = reactiveQuery.getEntities();\n // 统计为缓存命中(响应式查询本质上是永不过期的智能缓存)\n this._queryStats.cacheHits++;\n return {\n entities,\n count: entities.length,\n executionTime: performance.now() - startTime,\n fromCache: true\n };\n }\n /**\n * 查询不包含任何指定组件的实体\n *\n * 返回不包含任何指定组件类型的实体列表。\n * 内部使用响应式查询作为智能缓存,自动跟踪实体变化,性能更优。\n *\n * @param componentTypes 要排除的组件类型列表\n * @returns 查询结果,包含匹配的实体和性能信息\n *\n * @example\n * ```typescript\n * // 查询不具有AI和玩家控制组件的实体(如静态物体)\n * const result = querySystem.queryNone(AIComponent, PlayerControlComponent);\n * logger.info(`找到 ${result.count} 个静态实体`);\n * ```\n */\n queryNone(...componentTypes) {\n const startTime = performance.now();\n this._queryStats.totalQueries++;\n // 使用内部响应式查询作为智能缓存\n const reactiveQuery = this.getOrCreateReactiveQuery(QueryConditionType.NONE, componentTypes);\n // 从响应式查询获取结果(永远是最新的)\n const entities = reactiveQuery.getEntities();\n // 统计为缓存命中(响应式查询本质上是永不过期的智能缓存)\n this._queryStats.cacheHits++;\n return {\n entities,\n count: entities.length,\n executionTime: performance.now() - startTime,\n fromCache: true\n };\n }\n /**\n * 按标签查询实体\n *\n * 返回具有指定标签的所有实体。\n * 标签查询使用专用索引,具有很高的查询性能。\n *\n * @param tag 要查询的标签值\n * @returns 查询结果,包含匹配的实体和性能信息\n *\n * @example\n * ```typescript\n * // 查询所有玩家实体\n * const players = querySystem.queryByTag(PLAYER_TAG);\n * ```\n */\n queryByTag(tag) {\n const startTime = performance.now();\n this._queryStats.totalQueries++;\n const cacheKey = `tag:${tag}`;\n // 检查缓存\n const cached = this.getFromCache(cacheKey);\n if (cached) {\n this._queryStats.cacheHits++;\n return {\n entities: cached,\n count: cached.length,\n executionTime: performance.now() - startTime,\n fromCache: true\n };\n }\n // 使用索引查询\n this._queryStats.indexHits++;\n const entities = Array.from(this._entityIndex.byTag.get(tag) || []);\n // 缓存结果\n this.addToCache(cacheKey, entities);\n return {\n entities,\n count: entities.length,\n executionTime: performance.now() - startTime,\n fromCache: false\n };\n }\n /**\n * 按名称查询实体\n *\n * 返回具有指定名称的所有实体。\n * 名称查询使用专用索引,适用于查找特定的命名实体。\n *\n * @param name 要查询的实体名称\n * @returns 查询结果,包含匹配的实体和性能信息\n *\n * @example\n * ```typescript\n * // 查找名为\"Player\"的实体\n * const player = querySystem.queryByName(\"Player\");\n * ```\n */\n queryByName(name) {\n const startTime = performance.now();\n this._queryStats.totalQueries++;\n const cacheKey = `name:${name}`;\n // 检查缓存\n const cached = this.getFromCache(cacheKey);\n if (cached) {\n this._queryStats.cacheHits++;\n return {\n entities: cached,\n count: cached.length,\n executionTime: performance.now() - startTime,\n fromCache: true\n };\n }\n // 使用索引查询\n this._queryStats.indexHits++;\n const entities = Array.from(this._entityIndex.byName.get(name) || []);\n // 缓存结果\n this.addToCache(cacheKey, entities);\n return {\n entities,\n count: entities.length,\n executionTime: performance.now() - startTime,\n fromCache: false\n };\n }\n /**\n * 按单个组件类型查询实体\n *\n * 返回包含指定组件类型的所有实体。\n * 这是最基础的查询方法,具有最高的查询性能。\n *\n * @param componentType 要查询的组件类型\n * @returns 查询结果,包含匹配的实体和性能信息\n *\n * @example\n * ```typescript\n * // 查询所有具有位置组件的实体\n * const entitiesWithPosition = querySystem.queryByComponent(PositionComponent);\n * ```\n */\n queryByComponent(componentType) {\n const startTime = performance.now();\n this._queryStats.totalQueries++;\n const cacheKey = this.generateCacheKey('component', [componentType]);\n // 检查缓存\n const cached = this.getFromCache(cacheKey);\n if (cached) {\n this._queryStats.cacheHits++;\n return {\n entities: cached,\n count: cached.length,\n executionTime: performance.now() - startTime,\n fromCache: true\n };\n }\n this._queryStats.indexHits++;\n const entities = this._archetypeSystem.getEntitiesByComponent(componentType);\n // 缓存结果\n this.addToCache(cacheKey, entities);\n return {\n entities,\n count: entities.length,\n executionTime: performance.now() - startTime,\n fromCache: false\n };\n }\n /**\n * 从缓存获取查询结果\n */\n getFromCache(cacheKey) {\n const entry = this._queryCache.get(cacheKey);\n if (!entry)\n return null;\n // 检查缓存是否过期或版本过期\n if (Date.now() - entry.timestamp > this._cacheTimeout || entry.version !== this._version) {\n this._queryCache.delete(cacheKey);\n return null;\n }\n entry.hitCount++;\n return entry.entities;\n }\n /**\n * 添加查询结果到缓存\n */\n addToCache(cacheKey, entities) {\n // 如果缓存已满,清理最少使用的条目\n if (this._queryCache.size >= this._cacheMaxSize) {\n this.cleanupCache();\n }\n this._queryCache.set(cacheKey, {\n entities: entities, // 直接使用引用,通过版本号控制失效\n timestamp: Date.now(),\n hitCount: 0,\n version: this._version\n });\n }\n /**\n * 清理缓存\n */\n cleanupCache() {\n // 移除过期的缓存条目\n const now = Date.now();\n for (const [key, entry] of this._queryCache.entries()) {\n if (now - entry.timestamp > this._cacheTimeout) {\n this._queryCache.delete(key);\n }\n }\n // 如果还是太满,移除最少使用的条目\n if (this._queryCache.size >= this._cacheMaxSize) {\n let minHitCount = Infinity;\n let oldestKey = '';\n let oldestTimestamp = Infinity;\n // 单次遍历找到最少使用或最旧的条目\n for (const [key, entry] of this._queryCache.entries()) {\n if (entry.hitCount < minHitCount ||\n (entry.hitCount === minHitCount && entry.timestamp < oldestTimestamp)) {\n minHitCount = entry.hitCount;\n oldestKey = key;\n oldestTimestamp = entry.timestamp;\n }\n }\n if (oldestKey) {\n this._queryCache.delete(oldestKey);\n }\n }\n }\n /**\n * 清除所有查询缓存\n */\n clearQueryCache() {\n this._queryCache.clear();\n this._componentMaskCache.clear();\n }\n /**\n * 清除所有响应式查询\n *\n * 销毁所有响应式查询实例并清理索引\n * 通常在setEntities时调用以确保缓存一致性\n */\n clearReactiveQueries() {\n for (const query of this._reactiveQueries.values()) {\n query.dispose();\n }\n this._reactiveQueries.clear();\n this._reactiveQueriesByComponent.clear();\n }\n /**\n * 高效的缓存键生成\n */\n generateCacheKey(prefix, componentTypes) {\n // 快速路径:单组件查询\n if (componentTypes.length === 1) {\n const name = getComponentTypeName(componentTypes[0]);\n return `${prefix}:${name}`;\n }\n // 多组件查询:使用排序后的类型名称创建键\n const sortKey = componentTypes\n .map((t) => {\n const name = getComponentTypeName(t);\n return name;\n })\n .sort()\n .join(',');\n const fullKey = `${prefix}:${sortKey}`;\n return fullKey;\n }\n /**\n * 清理查询缓存\n *\n * 用于外部调用清理缓存,通常在批量操作后使用。\n * 注意:此方法也会清理响应式查询缓存\n */\n clearCache() {\n this.clearQueryCache();\n this.clearReactiveQueries();\n }\n /**\n * 创建响应式查询\n *\n * 响应式查询会自动跟踪实体/组件的变化,并通过事件通知订阅者。\n * 适合需要实时响应实体变化的场景(如UI更新、AI系统等)。\n *\n * @param componentTypes 查询的组件类型列表\n * @param config 可选的查询配置\n * @returns 响应式查询实例\n *\n * @example\n * ```typescript\n * const query = querySystem.createReactiveQuery([Position, Velocity], {\n * enableBatchMode: true,\n * batchDelay: 16\n * });\n *\n * query.subscribe((change) => {\n * if (change.type === ReactiveQueryChangeType.ADDED) {\n * console.log('新实体:', change.entity);\n * }\n * });\n * ```\n */\n createReactiveQuery(componentTypes, config) {\n if (!componentTypes || componentTypes.length === 0) {\n throw new Error('组件类型列表不能为空');\n }\n const mask = this.createComponentMask(componentTypes);\n const condition = {\n type: QueryConditionType.ALL,\n componentTypes,\n mask\n };\n const query = new ReactiveQuery(condition, config);\n const initialEntities = this.executeTraditionalQuery(QueryConditionType.ALL, componentTypes);\n query.initializeWith(initialEntities);\n const cacheKey = this.generateCacheKey('all', componentTypes);\n this._reactiveQueries.set(cacheKey, query);\n for (const type of componentTypes) {\n let queries = this._reactiveQueriesByComponent.get(type);\n if (!queries) {\n queries = new Set();\n this._reactiveQueriesByComponent.set(type, queries);\n }\n queries.add(query);\n }\n return query;\n }\n /**\n * 销毁响应式查询\n *\n * 清理查询占用的资源,包括监听器和实体引用。\n * 销毁后的查询不应再被使用。\n *\n * @param query 要销毁的响应式查询\n *\n * @example\n * ```typescript\n * const query = querySystem.createReactiveQuery([Position, Velocity]);\n * // ... 使用查询\n * querySystem.destroyReactiveQuery(query);\n * ```\n */\n destroyReactiveQuery(query) {\n if (!query) {\n return;\n }\n const cacheKey = query.id;\n this._reactiveQueries.delete(cacheKey);\n for (const type of query.condition.componentTypes) {\n const queries = this._reactiveQueriesByComponent.get(type);\n if (queries) {\n queries.delete(query);\n if (queries.size === 0) {\n this._reactiveQueriesByComponent.delete(type);\n }\n }\n }\n query.dispose();\n }\n /**\n * 创建组件掩码\n *\n * 根据组件类型列表生成对应的位掩码。\n * 使用缓存避免重复计算。\n * 注意:必须使用ComponentRegistry来确保与Entity.componentMask使用相同的bitIndex\n *\n * @param componentTypes 组件类型列表\n * @returns 生成的位掩码\n */\n createComponentMask(componentTypes) {\n // 生成缓存键\n const cacheKey = componentTypes\n .map((t) => {\n return getComponentTypeName(t);\n })\n .sort()\n .join(',');\n // 检查缓存\n const cached = this._componentMaskCache.get(cacheKey);\n if (cached) {\n return cached;\n }\n // 使用ComponentRegistry而不是ComponentTypeManager,确保bitIndex一致\n const mask = BitMask64Utils.clone(BitMask64Utils.ZERO);\n for (const type of componentTypes) {\n // 确保组件已注册\n if (!ComponentRegistry.isRegistered(type)) {\n ComponentRegistry.register(type);\n }\n const bitMask = ComponentRegistry.getBitMask(type);\n BitMask64Utils.orInPlace(mask, bitMask);\n }\n // 缓存结果\n this._componentMaskCache.set(cacheKey, mask);\n return mask;\n }\n /**\n * 获取当前版本号(用于缓存失效)\n */\n get version() {\n return this._version;\n }\n /**\n * 获取所有实体\n */\n getAllEntities() {\n return this._entities;\n }\n /**\n * 获取系统统计信息\n *\n * 返回查询系统的详细统计信息,包括实体数量、索引状态、\n * 查询性能统计等,用于性能监控和调试。\n *\n * @returns 系统统计信息对象\n */\n getStats() {\n return {\n entityCount: this._entities.length,\n indexStats: {\n componentIndexSize: this._archetypeSystem.getAllArchetypes().length,\n tagIndexSize: this._entityIndex.byTag.size,\n nameIndexSize: this._entityIndex.byName.size\n },\n queryStats: {\n ...this._queryStats,\n cacheHitRate: this._queryStats.totalQueries > 0\n ? ((this._queryStats.cacheHits / this._queryStats.totalQueries) * 100).toFixed(2) + '%'\n : '0%'\n },\n optimizationStats: {\n archetypeSystem: this._archetypeSystem.getAllArchetypes().map((a) => ({\n id: a.id,\n componentTypes: a.componentTypes.map((t) => getComponentTypeName(t)),\n entityCount: a.entities.size\n }))\n },\n cacheStats: {\n size: this._reactiveQueries.size,\n hitRate: this._queryStats.totalQueries > 0\n ? ((this._queryStats.cacheHits / this._queryStats.totalQueries) * 100).toFixed(2) + '%'\n : '0%'\n }\n };\n }\n /**\n * 获取实体所属的原型信息\n *\n * @param entity 要查询的实体\n */\n getEntityArchetype(entity) {\n return this._archetypeSystem.getEntityArchetype(entity);\n }\n /**\n * 获取或创建内部响应式查询(作为智能缓存)\n *\n * @param queryType 查询类型\n * @param componentTypes 组件类型列表\n * @returns 响应式查询实例\n */\n getOrCreateReactiveQuery(queryType, componentTypes) {\n // 生成缓存键(与传统缓存键格式一致)\n const cacheKey = this.generateCacheKey(queryType, componentTypes);\n // 检查是否已存在响应式查询\n let reactiveQuery = this._reactiveQueries.get(cacheKey);\n if (!reactiveQuery) {\n // 创建查询条件\n const mask = this.createComponentMask(componentTypes);\n const condition = {\n type: queryType,\n componentTypes,\n mask\n };\n // 创建响应式查询(禁用批量模式,保持实时性)\n reactiveQuery = new ReactiveQuery(condition, {\n enableBatchMode: false,\n debug: false\n });\n // 初始化查询结果(使用传统方式获取初始数据)\n const initialEntities = this.executeTraditionalQuery(queryType, componentTypes);\n reactiveQuery.initializeWith(initialEntities);\n // 注册响应式查询\n this._reactiveQueries.set(cacheKey, reactiveQuery);\n // 为每个组件类型注册索引\n for (const type of componentTypes) {\n let queries = this._reactiveQueriesByComponent.get(type);\n if (!queries) {\n queries = new Set();\n this._reactiveQueriesByComponent.set(type, queries);\n }\n queries.add(reactiveQuery);\n }\n this._logger.debug(`创建内部响应式查询缓存: ${cacheKey}`);\n }\n return reactiveQuery;\n }\n /**\n * 执行传统查询(内部使用,用于响应式查询初始化)\n *\n * @param queryType 查询类型\n * @param componentTypes 组件类型列表\n * @returns 匹配的实体列表\n */\n executeTraditionalQuery(queryType, componentTypes) {\n switch (queryType) {\n case QueryConditionType.ALL: {\n const archetypeResult = this._archetypeSystem.queryArchetypes(componentTypes, 'AND');\n const entities = [];\n for (const archetype of archetypeResult.archetypes) {\n for (const entity of archetype.entities) {\n entities.push(entity);\n }\n }\n return entities;\n }\n case QueryConditionType.ANY: {\n const archetypeResult = this._archetypeSystem.queryArchetypes(componentTypes, 'OR');\n const entities = [];\n for (const archetype of archetypeResult.archetypes) {\n for (const entity of archetype.entities) {\n entities.push(entity);\n }\n }\n return entities;\n }\n case QueryConditionType.NONE: {\n const mask = this.createComponentMask(componentTypes);\n return this._entities.filter((entity) => BitMask64Utils.hasNone(entity.componentMask, mask));\n }\n default:\n return [];\n }\n }\n /**\n * 通知所有响应式查询实体已添加\n *\n * 使用组件类型索引,只通知关心该实体组件的查询\n *\n * @param entity 添加的实体\n */\n notifyReactiveQueriesEntityAdded(entity) {\n if (this._reactiveQueries.size === 0)\n return;\n const notified = new Set();\n for (const component of entity.components) {\n const componentType = component.constructor;\n const queries = this._reactiveQueriesByComponent.get(componentType);\n if (queries) {\n for (const query of queries) {\n if (!notified.has(query)) {\n query.notifyEntityAdded(entity);\n notified.add(query);\n }\n }\n }\n }\n }\n /**\n * 通知响应式查询实体已移除\n *\n * 使用组件类型索引,只通知关心该实体组件的查询\n *\n * @param entity 移除的实体\n * @param componentTypes 实体移除前的组件类型列表\n */\n notifyReactiveQueriesEntityRemoved(entity, componentTypes) {\n if (this._reactiveQueries.size === 0)\n return;\n const notified = new Set();\n for (const componentType of componentTypes) {\n const queries = this._reactiveQueriesByComponent.get(componentType);\n if (queries) {\n for (const query of queries) {\n if (!notified.has(query)) {\n query.notifyEntityRemoved(entity);\n notified.add(query);\n }\n }\n }\n }\n }\n /**\n * 通知响应式查询实体已移除(后备方案)\n *\n * 当实体已经清空组件时使用,通知所有查询\n *\n * @param entity 移除的实体\n */\n notifyReactiveQueriesEntityRemovedFallback(entity) {\n if (this._reactiveQueries.size === 0)\n return;\n for (const query of this._reactiveQueries.values()) {\n query.notifyEntityRemoved(entity);\n }\n }\n /**\n * 通知响应式查询实体已变化\n *\n * 使用混合策略:\n * 1. 首先通知关心实体当前组件的查询\n * 2. 然后通知所有其他查询(包括那些可能因为组件移除而不再匹配的查询)\n *\n * @param entity 变化的实体\n */\n notifyReactiveQueriesEntityChanged(entity) {\n if (this._reactiveQueries.size === 0) {\n return;\n }\n const notified = new Set();\n for (const component of entity.components) {\n const componentType = component.constructor;\n const queries = this._reactiveQueriesByComponent.get(componentType);\n if (queries) {\n for (const query of queries) {\n if (!notified.has(query)) {\n query.notifyEntityChanged(entity);\n notified.add(query);\n }\n }\n }\n }\n for (const query of this._reactiveQueries.values()) {\n if (!notified.has(query)) {\n query.notifyEntityChanged(entity);\n }\n }\n }\n}\n/**\n * 查询构建器\n *\n * 提供链式API来构建复杂的实体查询条件。\n * 支持组合多种查询条件,创建灵活的查询表达式。\n *\n * @example\n * ```typescript\n * const result = new QueryBuilder(querySystem)\n * .withAll(PositionComponent, VelocityComponent)\n * .without(DeadComponent)\n * .execute();\n * ```\n */\nexport class QueryBuilder {\n constructor(querySystem) {\n this._logger = createLogger('QueryBuilder');\n this.conditions = [];\n this.querySystem = querySystem;\n }\n /**\n * 添加\"必须包含所有组件\"条件\n *\n * @param componentTypes 必须包含的组件类型\n * @returns 查询构建器实例,支持链式调用\n */\n withAll(...componentTypes) {\n this.conditions.push({\n type: QueryConditionType.ALL,\n componentTypes,\n mask: this.createComponentMask(componentTypes)\n });\n return this;\n }\n /**\n * 添加\"必须包含任意组件\"条件\n *\n * @param componentTypes 必须包含其中任意一个的组件类型\n * @returns 查询构建器实例,支持链式调用\n */\n withAny(...componentTypes) {\n this.conditions.push({\n type: QueryConditionType.ANY,\n componentTypes,\n mask: this.createComponentMask(componentTypes)\n });\n return this;\n }\n /**\n * 添加\"不能包含任何组件\"条件\n *\n * @param componentTypes 不能包含的组件类型\n * @returns 查询构建器实例,支持链式调用\n */\n without(...componentTypes) {\n this.conditions.push({\n type: QueryConditionType.NONE,\n componentTypes,\n mask: this.createComponentMask(componentTypes)\n });\n return this;\n }\n /**\n * 执行查询并返回结果\n *\n * 根据已添加的查询条件执行实体查询。\n *\n * @returns 查询结果,包含匹配的实体和性能信息\n */\n execute() {\n const startTime = performance.now();\n // 简化实现:目前只支持单一条件\n if (this.conditions.length === 1) {\n const condition = this.conditions[0];\n switch (condition.type) {\n case QueryConditionType.ALL:\n return this.querySystem.queryAll(...condition.componentTypes);\n case QueryConditionType.ANY:\n return this.querySystem.queryAny(...condition.componentTypes);\n case QueryConditionType.NONE:\n return this.querySystem.queryNone(...condition.componentTypes);\n }\n }\n // 多条件查询的复杂实现留待后续扩展\n return {\n entities: [],\n count: 0,\n executionTime: performance.now() - startTime,\n fromCache: false\n };\n }\n /**\n * 创建组件掩码\n */\n createComponentMask(componentTypes) {\n const mask = BitMask64Utils.clone(BitMask64Utils.ZERO);\n for (const type of componentTypes) {\n try {\n const bitMask = ComponentRegistry.getBitMask(type);\n BitMask64Utils.orInPlace(mask, bitMask);\n }\n catch (error) {\n this._logger.warn(`组件类型 ${getComponentTypeName(type)} 未注册,跳过`);\n }\n }\n return mask;\n }\n /**\n * 重置查询构建器\n *\n * 清除所有已添加的查询条件,重新开始构建查询。\n *\n * @returns 查询构建器实例,支持链式调用\n */\n reset() {\n this.conditions = [];\n return this;\n }\n}\n//# sourceMappingURL=QuerySystem.js.map","import { createLogger } from '../../Utils/Logger';\n/**\n * 类型安全的高性能事件系统\n * 支持同步/异步事件、优先级、批处理等功能\n */\nexport class TypeSafeEventSystem {\n constructor() {\n this.listeners = new Map();\n this.stats = new Map();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this.batchQueue = new Map();\n this.batchTimers = new Map();\n this.batchConfigs = new Map();\n this.nextListenerId = 0;\n this.isEnabled = true;\n this.maxListeners = 100; // 每个事件类型的最大监听器数量\n }\n /**\n * 添加事件监听器\n * @param eventType 事件类型\n * @param handler 事件处理器(同步或异步,根据 config.async 决定)\n * @param config 监听器配置\n * @returns 监听器ID(用于移除)\n */\n on(eventType, handler, config = {}) {\n return this.addListener(eventType, handler, config);\n }\n /**\n * 添加一次性事件监听器\n * @param eventType 事件类型\n * @param handler 事件处理器\n * @param config 监听器配置\n * @returns 监听器ID\n */\n once(eventType, handler, config = {}) {\n return this.addListener(eventType, handler, { ...config, once: true });\n }\n /**\n * 添加异步事件监听器\n * @param eventType 事件类型\n * @param handler 异步事件处理器\n * @param config 监听器配置\n * @returns 监听器ID\n */\n onAsync(eventType, handler, config = {}) {\n return this.addListener(eventType, handler, { ...config, async: true });\n }\n /**\n * 移除事件监听器\n * @param eventType 事件类型\n * @param listenerId 监听器ID\n * @returns 是否成功移除\n */\n off(eventType, listenerId) {\n const listeners = this.listeners.get(eventType);\n if (!listeners)\n return false;\n const index = listeners.findIndex((l) => l.id === listenerId);\n if (index === -1)\n return false;\n listeners.splice(index, 1);\n // 如果没有监听器了,清理相关数据\n if (listeners.length === 0) {\n this.listeners.delete(eventType);\n this.stats.delete(eventType);\n }\n return true;\n }\n /**\n * 移除指定事件类型的所有监听器\n * @param eventType 事件类型\n */\n offAll(eventType) {\n this.listeners.delete(eventType);\n this.stats.delete(eventType);\n this.clearBatch(eventType);\n }\n /**\n * 触发事件\n * @param eventType 事件类型\n * @param event 事件数据\n * @returns Promise(如果有异步监听器)\n */\n async emit(eventType, event) {\n if (!this.isEnabled)\n return;\n // 检查是否启用了批处理\n const batchConfig = this.batchConfigs.get(eventType);\n if (batchConfig?.enabled) {\n this.addToBatch(eventType, event);\n return;\n }\n await this.executeEvent(eventType, event);\n }\n /**\n * 同步触发事件(忽略异步监听器)\n * @param eventType 事件类型\n * @param event 事件数据\n */\n emitSync(eventType, event) {\n if (!this.isEnabled)\n return;\n const listeners = this.listeners.get(eventType);\n if (!listeners || listeners.length === 0)\n return;\n const startTime = performance.now();\n const toRemove = [];\n // 按优先级排序\n const sortedListeners = this.sortListenersByPriority(listeners);\n for (const listener of sortedListeners) {\n if (listener.config.async)\n continue; // 跳过异步监听器\n try {\n if (listener.config.thisArg) {\n listener.handler.call(listener.config.thisArg, event);\n }\n else {\n listener.handler(event);\n }\n if (listener.config.once) {\n toRemove.push(listener.id);\n }\n }\n catch (error) {\n TypeSafeEventSystem._logger.error(`事件处理器执行错误 ${eventType}:`, error);\n }\n }\n // 移除一次性监听器\n this.removeListeners(eventType, toRemove);\n // 更新统计信息\n this.updateStats(eventType, performance.now() - startTime);\n }\n /**\n * 设置事件批处理配置\n * @param eventType 事件类型\n * @param config 批处理配置\n */\n setBatchConfig(eventType, config) {\n this.batchConfigs.set(eventType, config);\n }\n /**\n * 立即处理指定事件类型的批处理队列\n * @param eventType 事件类型\n */\n flushBatch(eventType) {\n const batch = this.batchQueue.get(eventType);\n if (!batch || batch.length === 0)\n return;\n // 清除定时器\n const timer = this.batchTimers.get(eventType);\n if (timer) {\n clearTimeout(timer);\n this.batchTimers.delete(eventType);\n }\n // 处理批处理事件\n this.processBatch(eventType, batch);\n // 清空队列\n this.batchQueue.delete(eventType);\n }\n /**\n * 获取事件统计信息\n * @param eventType 事件类型(可选)\n * @returns 统计信息\n */\n getStats(eventType) {\n if (eventType) {\n return this.stats.get(eventType) || this.createEmptyStats(eventType);\n }\n return new Map(this.stats);\n }\n /**\n * 重置统计信息\n * @param eventType 事件类型(可选,不指定则重置所有)\n */\n resetStats(eventType) {\n if (eventType) {\n this.stats.delete(eventType);\n }\n else {\n this.stats.clear();\n }\n }\n /**\n * 启用/禁用事件系统\n * @param enabled 是否启用\n */\n setEnabled(enabled) {\n this.isEnabled = enabled;\n }\n /**\n * 检查是否有指定事件类型的监听器\n * @param eventType 事件类型\n * @returns 是否有监听器\n */\n hasListeners(eventType) {\n const listeners = this.listeners.get(eventType);\n return listeners ? listeners.length > 0 : false;\n }\n /**\n * 获取指定事件类型的监听器数量\n * @param eventType 事件类型\n * @returns 监听器数量\n */\n getListenerCount(eventType) {\n const listeners = this.listeners.get(eventType);\n return listeners ? listeners.length : 0;\n }\n /**\n * 清空所有事件监听器和数据\n */\n clear() {\n this.listeners.clear();\n this.stats.clear();\n this.clearAllBatches();\n }\n /**\n * 设置每个事件类型的最大监听器数量\n * @param max 最大数量\n */\n setMaxListeners(max) {\n this.maxListeners = max;\n }\n /**\n * 添加监听器的内部实现\n * @param eventType 事件类型\n * @param handler 事件处理器\n * @param config 配置\n * @returns 监听器ID\n */\n addListener(eventType, handler, config) {\n let listeners = this.listeners.get(eventType);\n if (!listeners) {\n listeners = [];\n this.listeners.set(eventType, listeners);\n }\n // 检查监听器数量限制\n if (listeners.length >= this.maxListeners) {\n TypeSafeEventSystem._logger.warn(`事件类型 ${eventType} 的监听器数量超过最大限制 (${this.maxListeners})`);\n return '';\n }\n const listenerId = `listener_${this.nextListenerId++}`;\n const listener = {\n handler,\n config: {\n priority: 0,\n ...config\n },\n id: listenerId\n };\n listeners.push(listener);\n // 初始化统计信息\n if (!this.stats.has(eventType)) {\n this.stats.set(eventType, this.createEmptyStats(eventType));\n }\n return listenerId;\n }\n /**\n * 执行事件的内部实现\n * @param eventType 事件类型\n * @param event 事件数据\n */\n async executeEvent(eventType, event) {\n const listeners = this.listeners.get(eventType);\n if (!listeners || listeners.length === 0)\n return;\n const startTime = performance.now();\n const toRemove = [];\n // 按优先级排序\n const sortedListeners = this.sortListenersByPriority(listeners);\n // 分离同步和异步监听器\n const syncListeners = sortedListeners.filter((l) => !l.config.async);\n const asyncListeners = sortedListeners.filter((l) => l.config.async);\n // 执行同步监听器\n for (const listener of syncListeners) {\n try {\n if (listener.config.thisArg) {\n listener.handler.call(listener.config.thisArg, event);\n }\n else {\n listener.handler(event);\n }\n if (listener.config.once) {\n toRemove.push(listener.id);\n }\n }\n catch (error) {\n TypeSafeEventSystem._logger.error(`同步事件处理器执行错误 ${eventType}:`, error);\n }\n }\n // 执行异步监听器\n const asyncPromises = asyncListeners.map(async (listener) => {\n try {\n if (listener.config.thisArg) {\n await listener.handler.call(listener.config.thisArg, event);\n }\n else {\n await listener.handler(event);\n }\n if (listener.config.once) {\n toRemove.push(listener.id);\n }\n }\n catch (error) {\n TypeSafeEventSystem._logger.error(`异步事件处理器执行错误 ${eventType}:`, error);\n }\n });\n // 等待所有异步监听器完成\n await Promise.all(asyncPromises);\n // 移除一次性监听器\n this.removeListeners(eventType, toRemove);\n // 更新统计信息\n this.updateStats(eventType, performance.now() - startTime);\n }\n /**\n * 按优先级排序监听器\n * @param listeners 监听器数组\n * @returns 排序后的监听器数组\n */\n sortListenersByPriority(listeners) {\n return listeners.slice().sort((a, b) => (b.config.priority || 0) - (a.config.priority || 0));\n }\n /**\n * 移除指定的监听器\n * @param eventType 事件类型\n * @param listenerIds 要移除的监听器ID数组\n */\n removeListeners(eventType, listenerIds) {\n if (listenerIds.length === 0)\n return;\n const listeners = this.listeners.get(eventType);\n if (!listeners)\n return;\n for (const id of listenerIds) {\n const index = listeners.findIndex((l) => l.id === id);\n if (index !== -1) {\n listeners.splice(index, 1);\n }\n }\n // 如果没有监听器了,清理相关数据\n if (listeners.length === 0) {\n this.listeners.delete(eventType);\n this.stats.delete(eventType);\n }\n }\n /**\n * 添加事件到批处理队列\n * @param eventType 事件类型\n * @param event 事件数据\n */\n addToBatch(eventType, event) {\n let batch = this.batchQueue.get(eventType);\n if (!batch) {\n batch = [];\n this.batchQueue.set(eventType, batch);\n }\n batch.push(event);\n const config = this.batchConfigs.get(eventType);\n // 如果达到批处理大小,立即处理\n if (batch.length >= config.batchSize) {\n this.flushBatch(eventType);\n return;\n }\n // 设置延迟处理定时器\n if (!this.batchTimers.has(eventType)) {\n const timer = setTimeout(() => {\n this.flushBatch(eventType);\n }, config.delay);\n this.batchTimers.set(eventType, timer);\n }\n }\n /**\n * 处理批处理事件\n * @param eventType 事件类型\n * @param batch 批处理事件数组\n */\n async processBatch(eventType, batch) {\n // 创建批处理事件对象\n const batchEvent = {\n type: eventType,\n events: batch,\n count: batch.length,\n timestamp: Date.now()\n };\n // 触发批处理事件\n await this.executeEvent(`${eventType}:batch`, batchEvent);\n }\n /**\n * 清除指定事件类型的批处理\n * @param eventType 事件类型\n */\n clearBatch(eventType) {\n this.batchQueue.delete(eventType);\n const timer = this.batchTimers.get(eventType);\n if (timer) {\n clearTimeout(timer);\n this.batchTimers.delete(eventType);\n }\n }\n /**\n * 清除所有批处理\n */\n clearAllBatches() {\n this.batchQueue.clear();\n for (const timer of this.batchTimers.values()) {\n clearTimeout(timer);\n }\n this.batchTimers.clear();\n this.batchConfigs.clear();\n }\n /**\n * 更新事件统计信息\n * @param eventType 事件类型\n * @param executionTime 执行时间\n */\n updateStats(eventType, executionTime) {\n let stats = this.stats.get(eventType);\n if (!stats) {\n stats = this.createEmptyStats(eventType);\n this.stats.set(eventType, stats);\n }\n stats.triggerCount++;\n stats.totalExecutionTime += executionTime;\n stats.averageExecutionTime = stats.totalExecutionTime / stats.triggerCount;\n stats.lastTriggerTime = Date.now();\n stats.listenerCount = this.getListenerCount(eventType);\n }\n /**\n * 创建空的统计信息\n * @param eventType 事件类型\n * @returns 空的统计信息\n */\n createEmptyStats(eventType) {\n return {\n eventType,\n listenerCount: 0,\n triggerCount: 0,\n totalExecutionTime: 0,\n averageExecutionTime: 0,\n lastTriggerTime: 0\n };\n }\n}\nTypeSafeEventSystem._logger = createLogger('EventSystem');\n/**\n * 全局事件系统实例\n */\nexport const GlobalEventSystem = new TypeSafeEventSystem();\n//# sourceMappingURL=EventSystem.js.map","/**\n * 类型安全的Query查询系统\n *\n * 提供完整的TypeScript类型推断,在编译时确保类型安全\n */\nimport { Matcher } from '../../Utils/Matcher';\n/**\n * 类型安全的查询结果\n *\n * 根据查询条件自动推断实体必定拥有的组件类型\n */\nexport class TypedQueryResult {\n constructor(entities, componentTypes) {\n this._entities = entities;\n this._componentTypes = componentTypes;\n }\n /**\n * 获取实体列表\n */\n get entities() {\n return this._entities;\n }\n /**\n * 实体数量\n */\n get length() {\n return this._entities.length;\n }\n /**\n * 遍历所有实体\n *\n * @example\n * ```typescript\n * query.forEach((entity) => {\n * // entity.getComponent返回类型自动推断\n * const pos = entity.getComponent(Position); // Position类型\n * const vel = entity.getComponent(Velocity); // Velocity类型\n * });\n * ```\n */\n forEach(callback) {\n this._entities.forEach(callback);\n }\n /**\n * 映射转换实体\n */\n map(callback) {\n return this._entities.map(callback);\n }\n /**\n * 过滤实体\n */\n filter(predicate) {\n return new TypedQueryResult(this._entities.filter(predicate), this._componentTypes);\n }\n /**\n * 查找第一个匹配的实体\n */\n find(predicate) {\n return this._entities.find(predicate);\n }\n /**\n * 检查是否存在匹配的实体\n */\n some(predicate) {\n return this._entities.some(predicate);\n }\n /**\n * 检查是否所有实体都匹配\n */\n every(predicate) {\n return this._entities.every(predicate);\n }\n /**\n * 获取指定索引的实体\n */\n get(index) {\n return this._entities[index];\n }\n /**\n * 获取第一个实体\n */\n get first() {\n return this._entities[0];\n }\n /**\n * 获取最后一个实体\n */\n get last() {\n return this._entities[this._entities.length - 1];\n }\n /**\n * 检查查询结果是否为空\n */\n get isEmpty() {\n return this._entities.length === 0;\n }\n /**\n * 转换为数组\n */\n toArray() {\n return [...this._entities];\n }\n /**\n * 获取组件类型信息(用于调试)\n */\n getComponentTypes() {\n return this._componentTypes;\n }\n /**\n * 迭代器支持\n */\n [Symbol.iterator]() {\n return this._entities[Symbol.iterator]();\n }\n}\n/**\n * 类型安全的查询构建器\n *\n * 支持链式调用,自动推断查询结果的类型\n *\n * @example\n * ```typescript\n * // 基础查询\n * const query = new TypedQueryBuilder()\n * .withAll(Position, Velocity)\n * .build();\n *\n * // 复杂查询\n * const complexQuery = new TypedQueryBuilder()\n * .withAll(Transform, Renderer)\n * .withAny(BoxCollider, CircleCollider)\n * .withNone(Disabled)\n * .withTag(EntityTags.Enemy)\n * .build();\n * ```\n */\nexport class TypedQueryBuilder {\n constructor(all, any, none, tag, name) {\n this._all = (all || []);\n this._any = (any || []);\n this._none = (none || []);\n if (tag !== undefined) {\n this._tag = tag;\n }\n if (name !== undefined) {\n this._name = name;\n }\n }\n /**\n * 要求实体拥有所有指定的组件\n *\n * @param types 组件类型\n * @returns 新的查询构建器,类型参数更新\n */\n withAll(...types) {\n return new TypedQueryBuilder([...this._all, ...types], this._any, this._none, this._tag, this._name);\n }\n /**\n * 要求实体至少拥有一个指定的组件\n *\n * @param types 组件类型\n * @returns 新的查询构建器\n */\n withAny(...types) {\n return new TypedQueryBuilder(this._all, [...this._any, ...types], this._none, this._tag, this._name);\n }\n /**\n * 排除拥有指定组件的实体\n *\n * @param types 组件类型\n * @returns 新的查询构建器\n */\n withNone(...types) {\n return new TypedQueryBuilder(this._all, this._any, [...this._none, ...types], this._tag, this._name);\n }\n /**\n * 按标签过滤实体\n *\n * @param tag 标签值\n * @returns 新的查询构建器\n */\n withTag(tag) {\n return new TypedQueryBuilder(this._all, this._any, this._none, tag, this._name);\n }\n /**\n * 按名称过滤实体\n *\n * @param name 实体名称\n * @returns 新的查询构建器\n */\n withName(name) {\n return new TypedQueryBuilder(this._all, this._any, this._none, this._tag, name);\n }\n /**\n * 构建Matcher对象\n *\n * @returns Matcher实例,用于传统查询API\n */\n buildMatcher() {\n let matcher = Matcher.complex();\n if (this._all.length > 0) {\n matcher = matcher.all(...this._all);\n }\n if (this._any.length > 0) {\n matcher = matcher.any(...this._any);\n }\n if (this._none.length > 0) {\n matcher = matcher.none(...this._none);\n }\n if (this._tag !== undefined) {\n matcher = matcher.withTag(this._tag);\n }\n if (this._name !== undefined) {\n matcher = matcher.withName(this._name);\n }\n return matcher;\n }\n /**\n * 获取查询条件\n *\n * @returns 查询条件对象\n */\n getCondition() {\n return {\n all: [...this._all],\n any: [...this._any],\n none: [...this._none],\n ...(this._tag !== undefined && { tag: this._tag }),\n ...(this._name !== undefined && { name: this._name })\n };\n }\n /**\n * 获取required组件类型(用于类型推断)\n */\n getRequiredTypes() {\n return this._all;\n }\n /**\n * 克隆查询构建器\n */\n clone() {\n return new TypedQueryBuilder([...this._all], [...this._any], [...this._none], this._tag, this._name);\n }\n}\n/**\n * 创建类型安全的查询构建器\n *\n * @example\n * ```typescript\n * const query = createQuery()\n * .withAll(Position, Velocity)\n * .withNone(Disabled);\n *\n * // 在System或Scene中使用\n * const entities = scene.query(query);\n * entities.forEach(entity => {\n * const pos = entity.getComponent(Position); // 自动推断为Position\n * const vel = entity.getComponent(Velocity); // 自动推断为Velocity\n * });\n * ```\n */\nexport function createQuery() {\n return new TypedQueryBuilder();\n}\n/**\n * 创建单组件查询的便捷方法\n *\n * @param componentType 组件类型\n * @returns 查询构建器\n *\n * @example\n * ```typescript\n * const healthEntities = queryFor(HealthComponent);\n * ```\n */\nexport function queryFor(componentType) {\n return new TypedQueryBuilder([componentType]);\n}\n/**\n * 创建多组件查询的便捷方法\n *\n * @param types 组件类型数组\n * @returns 查询构建器\n *\n * @example\n * ```typescript\n * const movableEntities = queryForAll(Position, Velocity);\n * ```\n */\nexport function queryForAll(...types) {\n return new TypedQueryBuilder(types);\n}\n//# sourceMappingURL=TypedQuery.js.map","/**\n * 组件序列化器\n *\n * 负责组件的序列化和反序列化操作\n */\nimport { getComponentTypeName } from '../Decorators';\nimport { getSerializationMetadata } from './SerializationDecorators';\n/**\n * 组件序列化器类\n */\nexport class ComponentSerializer {\n /**\n * 序列化单个组件\n *\n * @param component 要序列化的组件实例\n * @returns 序列化后的组件数据,如果组件不可序列化则返回null\n */\n static serialize(component) {\n const metadata = getSerializationMetadata(component);\n if (!metadata) {\n // 组件没有使用@Serializable装饰器,不可序列化\n return null;\n }\n const componentType = component.constructor;\n const typeName = metadata.options.typeId || getComponentTypeName(componentType);\n const data = {};\n // 序列化标记的字段\n for (const [fieldName, options] of metadata.fields) {\n const fieldKey = typeof fieldName === 'symbol' ? fieldName.toString() : fieldName;\n const value = component[fieldName];\n // 跳过忽略的字段\n if (metadata.ignoredFields.has(fieldName)) {\n continue;\n }\n // 使用自定义序列化器或默认序列化\n const serializedValue = options.serializer\n ? options.serializer(value)\n : this.serializeValue(value);\n // 使用别名或原始字段名\n const key = options.alias || fieldKey;\n data[key] = serializedValue;\n }\n return {\n type: typeName,\n version: metadata.options.version,\n data\n };\n }\n /**\n * 反序列化组件\n *\n * @param serializedData 序列化的组件数据\n * @param componentRegistry 组件类型注册表 (类型名 -> 构造函数)\n * @returns 反序列化后的组件实例,如果失败则返回null\n */\n static deserialize(serializedData, componentRegistry) {\n const componentClass = componentRegistry.get(serializedData.type);\n if (!componentClass) {\n console.warn(`未找到组件类型: ${serializedData.type}`);\n return null;\n }\n const metadata = getSerializationMetadata(componentClass);\n if (!metadata) {\n console.warn(`组件 ${serializedData.type} 不可序列化`);\n return null;\n }\n // 创建组件实例\n const component = new componentClass();\n // 反序列化字段\n for (const [fieldName, options] of metadata.fields) {\n const fieldKey = typeof fieldName === 'symbol' ? fieldName.toString() : fieldName;\n const key = options.alias || fieldKey;\n const serializedValue = serializedData.data[key];\n if (serializedValue === undefined) {\n continue; // 字段不存在于序列化数据中\n }\n // 使用自定义反序列化器或默认反序列化\n const value = options.deserializer\n ? options.deserializer(serializedValue)\n : this.deserializeValue(serializedValue);\n component[fieldName] = value;\n }\n return component;\n }\n /**\n * 批量序列化组件\n *\n * @param components 组件数组\n * @returns 序列化后的组件数据数组\n */\n static serializeComponents(components) {\n const result = [];\n for (const component of components) {\n const serialized = this.serialize(component);\n if (serialized) {\n result.push(serialized);\n }\n }\n return result;\n }\n /**\n * 批量反序列化组件\n *\n * @param serializedComponents 序列化的组件数据数组\n * @param componentRegistry 组件类型注册表\n * @returns 反序列化后的组件数组\n */\n static deserializeComponents(serializedComponents, componentRegistry) {\n const result = [];\n for (const serialized of serializedComponents) {\n const component = this.deserialize(serialized, componentRegistry);\n if (component) {\n result.push(component);\n }\n }\n return result;\n }\n /**\n * 默认值序列化\n *\n * 处理基本类型、数组、对象等的序列化\n */\n static serializeValue(value) {\n if (value === null || value === undefined) {\n return value;\n }\n // 基本类型\n const type = typeof value;\n if (type === 'string' || type === 'number' || type === 'boolean') {\n return value;\n }\n // 日期\n if (value instanceof Date) {\n return {\n __type: 'Date',\n value: value.toISOString()\n };\n }\n // 数组\n if (Array.isArray(value)) {\n return value.map((item) => this.serializeValue(item));\n }\n // Map (如果没有使用@SerializeMap装饰器)\n if (value instanceof Map) {\n return {\n __type: 'Map',\n value: Array.from(value.entries())\n };\n }\n // Set\n if (value instanceof Set) {\n return {\n __type: 'Set',\n value: Array.from(value)\n };\n }\n // 普通对象\n if (type === 'object' && typeof value === 'object' && !Array.isArray(value)) {\n const result = {};\n const obj = value;\n for (const key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n result[key] = this.serializeValue(obj[key]);\n }\n }\n return result;\n }\n // 其他类型(函数等)不序列化\n return undefined;\n }\n /**\n * 默认值反序列化\n */\n static deserializeValue(value) {\n if (value === null || value === undefined) {\n return value;\n }\n // 基本类型直接返回\n const type = typeof value;\n if (type === 'string' || type === 'number' || type === 'boolean') {\n return value;\n }\n // 处理特殊类型标记\n if (type === 'object' && typeof value === 'object' && '__type' in value) {\n const typedValue = value;\n switch (typedValue.__type) {\n case 'Date':\n return { __type: 'Date', value: typeof typedValue.value === 'string' ? typedValue.value : String(typedValue.value) };\n case 'Map':\n return { __type: 'Map', value: typedValue.value };\n case 'Set':\n return { __type: 'Set', value: typedValue.value };\n }\n }\n // 数组\n if (Array.isArray(value)) {\n return value.map((item) => this.deserializeValue(item));\n }\n // 普通对象\n if (type === 'object' && typeof value === 'object' && !Array.isArray(value)) {\n const result = {};\n const obj = value;\n for (const key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n result[key] = this.deserializeValue(obj[key]);\n }\n }\n return result;\n }\n return value;\n }\n /**\n * 验证序列化数据的版本\n *\n * @param serializedData 序列化数据\n * @param expectedVersion 期望的版本号\n * @returns 版本是否匹配\n */\n static validateVersion(serializedData, expectedVersion) {\n return serializedData.version === expectedVersion;\n }\n /**\n * 获取组件的序列化信息\n *\n * @param component 组件实例或组件类\n * @returns 序列化信息对象,包含类型名、版本、可序列化字段列表\n */\n static getSerializationInfo(component) {\n const metadata = getSerializationMetadata(component);\n if (!metadata) {\n return {\n type: 'unknown',\n version: 0,\n fields: [],\n ignoredFields: [],\n isSerializable: false\n };\n }\n const componentType = typeof component === 'function'\n ? component\n : component.constructor;\n return {\n type: metadata.options.typeId || getComponentTypeName(componentType),\n version: metadata.options.version,\n fields: Array.from(metadata.fields.keys()).map((k) => typeof k === 'symbol' ? k.toString() : k),\n ignoredFields: Array.from(metadata.ignoredFields).map((k) => typeof k === 'symbol' ? k.toString() : k),\n isSerializable: true\n };\n }\n}\n//# sourceMappingURL=ComponentSerializer.js.map","/**\n * 增量序列化器\n *\n * 提供高性能的增量序列化支持,只序列化变更的数据\n * 适用于网络同步、大场景存档、时间回溯等场景\n */\nimport { Entity } from '../Entity';\nimport { ComponentSerializer } from './ComponentSerializer';\nimport { BinarySerializer } from '../../Utils/BinarySerializer';\nimport { HierarchyComponent } from '../Components/HierarchyComponent';\nimport { HierarchySystem } from '../Systems/HierarchySystem';\n/**\n * 变更操作类型\n */\nexport var ChangeOperation;\n(function (ChangeOperation) {\n /** 添加新实体 */\n ChangeOperation[\"EntityAdded\"] = \"entity_added\";\n /** 删除实体 */\n ChangeOperation[\"EntityRemoved\"] = \"entity_removed\";\n /** 实体属性更新 */\n ChangeOperation[\"EntityUpdated\"] = \"entity_updated\";\n /** 添加组件 */\n ChangeOperation[\"ComponentAdded\"] = \"component_added\";\n /** 删除组件 */\n ChangeOperation[\"ComponentRemoved\"] = \"component_removed\";\n /** 组件数据更新 */\n ChangeOperation[\"ComponentUpdated\"] = \"component_updated\";\n /** 场景数据更新 */\n ChangeOperation[\"SceneDataUpdated\"] = \"scene_data_updated\";\n})(ChangeOperation || (ChangeOperation = {}));\n/**\n * 增量序列化器类\n */\nexport class IncrementalSerializer {\n /**\n * 创建场景快照\n *\n * @param scene 要快照的场景\n * @param options 序列化选项\n * @returns 场景快照对象\n */\n static createSnapshot(scene, options) {\n const opts = {\n deepComponentComparison: true,\n trackSceneData: true,\n compressSnapshot: false,\n ...options\n };\n const snapshot = {\n version: ++this.snapshotVersion,\n entityIds: new Set(),\n entities: new Map(),\n components: new Map(),\n sceneData: new Map()\n };\n // 快照所有实体\n for (const entity of scene.entities.buffer) {\n snapshot.entityIds.add(entity.id);\n // 获取层级信息\n const hierarchy = entity.getComponent(HierarchyComponent);\n const parentId = hierarchy?.parentId;\n // 存储实体基本信息\n snapshot.entities.set(entity.id, {\n name: entity.name,\n tag: entity.tag,\n active: entity.active,\n enabled: entity.enabled,\n updateOrder: entity.updateOrder,\n ...(parentId !== null && parentId !== undefined && { parentId })\n });\n // 快照组件\n if (opts.deepComponentComparison) {\n const componentMap = new Map();\n for (const component of entity.components) {\n const serialized = ComponentSerializer.serialize(component);\n if (serialized) {\n // 使用JSON字符串存储,便于后续对比\n componentMap.set(serialized.type, JSON.stringify(serialized.data));\n }\n }\n if (componentMap.size > 0) {\n snapshot.components.set(entity.id, componentMap);\n }\n }\n }\n // 快照场景数据\n if (opts.trackSceneData) {\n for (const [key, value] of scene.sceneData) {\n snapshot.sceneData.set(key, JSON.stringify(value));\n }\n }\n return snapshot;\n }\n /**\n * 计算增量变更\n *\n * @param scene 当前场景\n * @param baseSnapshot 基础快照\n * @param options 序列化选项\n * @returns 增量快照\n */\n static computeIncremental(scene, baseSnapshot, options) {\n const opts = {\n deepComponentComparison: true,\n trackSceneData: true,\n ...options\n };\n const incremental = {\n version: ++this.snapshotVersion,\n timestamp: Date.now(),\n sceneName: scene.name,\n baseVersion: baseSnapshot.version,\n entityChanges: [],\n componentChanges: [],\n sceneDataChanges: []\n };\n const currentEntityIds = new Set();\n // 检测实体变更\n for (const entity of scene.entities.buffer) {\n currentEntityIds.add(entity.id);\n // 获取层级信息\n const hierarchy = entity.getComponent(HierarchyComponent);\n const parentId = hierarchy?.parentId;\n if (!baseSnapshot.entityIds.has(entity.id)) {\n // 新增实体\n incremental.entityChanges.push({\n operation: ChangeOperation.EntityAdded,\n entityId: entity.id,\n entityName: entity.name,\n entityData: {\n id: entity.id,\n name: entity.name,\n tag: entity.tag,\n active: entity.active,\n enabled: entity.enabled,\n updateOrder: entity.updateOrder,\n ...(parentId !== null && parentId !== undefined && { parentId }),\n components: [],\n children: []\n }\n });\n // 新增实体的所有组件都是新增\n for (const component of entity.components) {\n const serialized = ComponentSerializer.serialize(component);\n if (serialized) {\n incremental.componentChanges.push({\n operation: ChangeOperation.ComponentAdded,\n entityId: entity.id,\n componentType: serialized.type,\n componentData: serialized\n });\n }\n }\n }\n else {\n // 检查实体属性变更\n const oldData = baseSnapshot.entities.get(entity.id);\n const entityChanged = oldData.name !== entity.name ||\n oldData.tag !== entity.tag ||\n oldData.active !== entity.active ||\n oldData.enabled !== entity.enabled ||\n oldData.updateOrder !== entity.updateOrder ||\n oldData.parentId !== parentId;\n if (entityChanged) {\n incremental.entityChanges.push({\n operation: ChangeOperation.EntityUpdated,\n entityId: entity.id,\n entityData: {\n name: entity.name,\n tag: entity.tag,\n active: entity.active,\n enabled: entity.enabled,\n updateOrder: entity.updateOrder,\n ...(parentId !== null && parentId !== undefined && { parentId })\n }\n });\n }\n // 检查组件变更\n if (opts.deepComponentComparison) {\n this.detectComponentChanges(entity, baseSnapshot, incremental.componentChanges);\n }\n }\n }\n // 检测删除的实体\n for (const oldEntityId of baseSnapshot.entityIds) {\n if (!currentEntityIds.has(oldEntityId)) {\n incremental.entityChanges.push({\n operation: ChangeOperation.EntityRemoved,\n entityId: oldEntityId\n });\n }\n }\n // 检测场景数据变更\n if (opts.trackSceneData) {\n this.detectSceneDataChanges(scene, baseSnapshot, incremental.sceneDataChanges);\n }\n return incremental;\n }\n /**\n * 检测组件变更\n */\n static detectComponentChanges(entity, baseSnapshot, componentChanges) {\n const oldComponents = baseSnapshot.components.get(entity.id);\n const currentComponents = new Map();\n // 收集当前组件\n for (const component of entity.components) {\n const serialized = ComponentSerializer.serialize(component);\n if (serialized) {\n currentComponents.set(serialized.type, serialized);\n }\n }\n // 检测新增和更新的组件\n for (const [type, serialized] of currentComponents) {\n const currentData = JSON.stringify(serialized.data);\n if (!oldComponents || !oldComponents.has(type)) {\n // 新增组件\n componentChanges.push({\n operation: ChangeOperation.ComponentAdded,\n entityId: entity.id,\n componentType: type,\n componentData: serialized\n });\n }\n else if (oldComponents.get(type) !== currentData) {\n // 组件数据变更\n componentChanges.push({\n operation: ChangeOperation.ComponentUpdated,\n entityId: entity.id,\n componentType: type,\n componentData: serialized\n });\n }\n }\n // 检测删除的组件\n if (oldComponents) {\n for (const oldType of oldComponents.keys()) {\n if (!currentComponents.has(oldType)) {\n componentChanges.push({\n operation: ChangeOperation.ComponentRemoved,\n entityId: entity.id,\n componentType: oldType\n });\n }\n }\n }\n }\n /**\n * 检测场景数据变更\n */\n static detectSceneDataChanges(scene, baseSnapshot, sceneDataChanges) {\n const currentKeys = new Set();\n // 检测新增和更新的场景数据\n for (const [key, value] of scene.sceneData) {\n currentKeys.add(key);\n const currentValue = JSON.stringify(value);\n const oldValue = baseSnapshot.sceneData.get(key);\n if (!oldValue || oldValue !== currentValue) {\n sceneDataChanges.push({\n operation: ChangeOperation.SceneDataUpdated,\n key,\n value\n });\n }\n }\n // 检测删除的场景数据\n for (const oldKey of baseSnapshot.sceneData.keys()) {\n if (!currentKeys.has(oldKey)) {\n sceneDataChanges.push({\n operation: ChangeOperation.SceneDataUpdated,\n key: oldKey,\n value: undefined,\n deleted: true\n });\n }\n }\n }\n /**\n * 应用增量变更到场景\n *\n * @param scene 目标场景\n * @param incremental 增量快照\n * @param componentRegistry 组件类型注册表\n */\n static applyIncremental(scene, incremental, componentRegistry) {\n // 应用实体变更\n for (const change of incremental.entityChanges) {\n switch (change.operation) {\n case ChangeOperation.EntityAdded:\n this.applyEntityAdded(scene, change);\n break;\n case ChangeOperation.EntityRemoved:\n this.applyEntityRemoved(scene, change);\n break;\n case ChangeOperation.EntityUpdated:\n this.applyEntityUpdated(scene, change);\n break;\n }\n }\n // 应用组件变更\n for (const change of incremental.componentChanges) {\n switch (change.operation) {\n case ChangeOperation.ComponentAdded:\n this.applyComponentAdded(scene, change, componentRegistry);\n break;\n case ChangeOperation.ComponentRemoved:\n this.applyComponentRemoved(scene, change, componentRegistry);\n break;\n case ChangeOperation.ComponentUpdated:\n this.applyComponentUpdated(scene, change, componentRegistry);\n break;\n }\n }\n // 应用场景数据变更\n for (const change of incremental.sceneDataChanges) {\n if (change.deleted) {\n scene.sceneData.delete(change.key);\n }\n else {\n scene.sceneData.set(change.key, change.value);\n }\n }\n }\n static applyEntityAdded(scene, change) {\n if (!change.entityData)\n return;\n const entity = new Entity(change.entityName || 'Entity', change.entityId);\n entity.tag = change.entityData.tag || 0;\n entity.active = change.entityData.active ?? true;\n entity.enabled = change.entityData.enabled ?? true;\n entity.updateOrder = change.entityData.updateOrder || 0;\n scene.addEntity(entity);\n }\n static applyEntityRemoved(scene, change) {\n const entity = scene.entities.findEntityById(change.entityId);\n if (entity) {\n entity.destroy();\n }\n }\n static applyEntityUpdated(scene, change) {\n if (!change.entityData)\n return;\n const entity = scene.entities.findEntityById(change.entityId);\n if (!entity)\n return;\n if (change.entityData.name !== undefined)\n entity.name = change.entityData.name;\n if (change.entityData.tag !== undefined)\n entity.tag = change.entityData.tag;\n if (change.entityData.active !== undefined)\n entity.active = change.entityData.active;\n if (change.entityData.enabled !== undefined)\n entity.enabled = change.entityData.enabled;\n if (change.entityData.updateOrder !== undefined)\n entity.updateOrder = change.entityData.updateOrder;\n // 使用 HierarchySystem 更新层级关系\n const hierarchySystem = scene.getSystem(HierarchySystem);\n if (hierarchySystem) {\n const hierarchy = entity.getComponent(HierarchyComponent);\n const currentParentId = hierarchy?.parentId;\n if (change.entityData.parentId !== undefined) {\n const newParent = scene.entities.findEntityById(change.entityData.parentId);\n if (newParent && currentParentId !== change.entityData.parentId) {\n hierarchySystem.setParent(entity, newParent);\n }\n }\n else if (currentParentId !== null && currentParentId !== undefined) {\n hierarchySystem.setParent(entity, null);\n }\n }\n }\n static applyComponentAdded(scene, change, componentRegistry) {\n if (!change.componentData)\n return;\n const entity = scene.entities.findEntityById(change.entityId);\n if (!entity)\n return;\n const component = ComponentSerializer.deserialize(change.componentData, componentRegistry);\n if (component) {\n entity.addComponent(component);\n }\n }\n static applyComponentRemoved(scene, change, componentRegistry) {\n const entity = scene.entities.findEntityById(change.entityId);\n if (!entity)\n return;\n const componentClass = componentRegistry.get(change.componentType);\n if (!componentClass)\n return;\n entity.removeComponentByType(componentClass);\n }\n static applyComponentUpdated(scene, change, componentRegistry) {\n if (!change.componentData)\n return;\n const entity = scene.entities.findEntityById(change.entityId);\n if (!entity)\n return;\n const componentClass = componentRegistry.get(change.componentType);\n if (!componentClass)\n return;\n entity.removeComponentByType(componentClass);\n const component = ComponentSerializer.deserialize(change.componentData, componentRegistry);\n if (component) {\n entity.addComponent(component);\n }\n }\n /**\n * 序列化增量快照\n *\n * @param incremental 增量快照\n * @param options 序列化选项\n * @returns 序列化后的数据(JSON字符串或二进制Uint8Array)\n *\n * @example\n * ```typescript\n * // JSON格式(默认)\n * const jsonData = IncrementalSerializer.serializeIncremental(snapshot);\n *\n * // 二进制格式\n * const binaryData = IncrementalSerializer.serializeIncremental(snapshot, {\n * format: 'binary'\n * });\n *\n * // 美化JSON\n * const prettyJson = IncrementalSerializer.serializeIncremental(snapshot, {\n * format: 'json',\n * pretty: true\n * });\n * ```\n */\n static serializeIncremental(incremental, options) {\n const opts = {\n format: 'json',\n pretty: false,\n ...options\n };\n if (opts.format === 'binary') {\n return BinarySerializer.encode(incremental);\n }\n else {\n return opts.pretty\n ? JSON.stringify(incremental, null, 2)\n : JSON.stringify(incremental);\n }\n }\n /**\n * 反序列化增量快照\n *\n * @param data 序列化的数据(JSON字符串或二进制Uint8Array)\n * @returns 增量快照\n *\n * @example\n * ```typescript\n * // 从JSON反序列化\n * const snapshot = IncrementalSerializer.deserializeIncremental(jsonString);\n *\n * // 从二进制反序列化\n * const snapshot = IncrementalSerializer.deserializeIncremental(buffer);\n * ```\n */\n static deserializeIncremental(data) {\n if (typeof data === 'string') {\n return JSON.parse(data);\n }\n else {\n return BinarySerializer.decode(data);\n }\n }\n /**\n * 获取增量快照的统计信息\n *\n * @param incremental 增量快照\n * @returns 统计信息\n */\n static getIncrementalStats(incremental) {\n return {\n totalChanges: incremental.entityChanges.length +\n incremental.componentChanges.length +\n incremental.sceneDataChanges.length,\n entityChanges: incremental.entityChanges.length,\n componentChanges: incremental.componentChanges.length,\n sceneDataChanges: incremental.sceneDataChanges.length,\n addedEntities: incremental.entityChanges.filter((c) => c.operation === ChangeOperation.EntityAdded).length,\n removedEntities: incremental.entityChanges.filter((c) => c.operation === ChangeOperation.EntityRemoved).length,\n updatedEntities: incremental.entityChanges.filter((c) => c.operation === ChangeOperation.EntityUpdated).length,\n addedComponents: incremental.componentChanges.filter((c) => c.operation === ChangeOperation.ComponentAdded).length,\n removedComponents: incremental.componentChanges.filter((c) => c.operation === ChangeOperation.ComponentRemoved).length,\n updatedComponents: incremental.componentChanges.filter((c) => c.operation === ChangeOperation.ComponentUpdated).length\n };\n }\n /**\n * 重置快照版本号(用于测试)\n */\n static resetVersion() {\n this.snapshotVersion = 0;\n }\n}\n/** 当前快照版本号 */\nIncrementalSerializer.snapshotVersion = 0;\n//# sourceMappingURL=IncrementalSerializer.js.map","/**\n * 实体序列化器\n *\n * 负责实体的序列化和反序列化操作\n */\nimport { Entity } from '../Entity';\nimport { ComponentSerializer } from './ComponentSerializer';\nimport { HierarchyComponent } from '../Components/HierarchyComponent';\n/**\n * 实体序列化器类\n */\nexport class EntitySerializer {\n /**\n * 序列化单个实体\n *\n * @param entity 要序列化的实体\n * @param includeChildren 是否包含子实体(默认true)\n * @param hierarchySystem 层级系统(可选,用于获取层级信息)\n * @returns 序列化后的实体数据\n */\n static serialize(entity, includeChildren = true, hierarchySystem) {\n const serializedComponents = ComponentSerializer.serializeComponents(Array.from(entity.components));\n const serializedEntity = {\n id: entity.id,\n name: entity.name,\n tag: entity.tag,\n active: entity.active,\n enabled: entity.enabled,\n updateOrder: entity.updateOrder,\n components: serializedComponents,\n children: []\n };\n // 通过 HierarchyComponent 获取层级信息\n const hierarchy = entity.getComponent(HierarchyComponent);\n if (hierarchy?.parentId !== null && hierarchy?.parentId !== undefined) {\n serializedEntity.parentId = hierarchy.parentId;\n }\n // 序列化子实体\n // 直接使用 HierarchyComponent.childIds 获取子实体\n if (includeChildren && hierarchy && hierarchy.childIds.length > 0) {\n // 获取场景引用:优先从 hierarchySystem,否则从 entity.scene\n const scene = hierarchySystem?.scene ?? entity.scene;\n if (scene) {\n for (const childId of hierarchy.childIds) {\n const child = scene.findEntityById(childId);\n if (child) {\n serializedEntity.children.push(this.serialize(child, true, hierarchySystem));\n }\n }\n }\n }\n return serializedEntity;\n }\n /**\n * 反序列化实体\n *\n * @param serializedEntity 序列化的实体数据\n * @param componentRegistry 组件类型注册表\n * @param idGenerator 实体ID生成器(用于生成新ID或保持原ID)\n * @param preserveIds 是否保持原始ID(默认false)\n * @param scene 目标场景(可选,用于设置entity.scene以支持添加组件)\n * @param hierarchySystem 层级系统(可选,用于建立层级关系)\n * @returns 反序列化后的实体\n */\n static deserialize(serializedEntity, componentRegistry, idGenerator, preserveIds = false, scene, hierarchySystem, allEntities) {\n // 创建实体(使用原始ID或新生成的ID)\n const entityId = preserveIds ? serializedEntity.id : idGenerator();\n const entity = new Entity(serializedEntity.name, entityId);\n // 将实体添加到收集 Map 中(用于后续添加到场景)\n allEntities?.set(entity.id, entity);\n // 如果提供了scene,先设置entity.scene以支持添加组件\n if (scene) {\n entity.scene = scene;\n }\n // 恢复实体属性\n entity.tag = serializedEntity.tag;\n entity.active = serializedEntity.active;\n entity.enabled = serializedEntity.enabled;\n entity.updateOrder = serializedEntity.updateOrder;\n // 反序列化组件\n const components = ComponentSerializer.deserializeComponents(serializedEntity.components, componentRegistry);\n for (const component of components) {\n entity.addComponent(component);\n }\n // 重要:清除 HierarchyComponent 中的旧 ID\n // 当 preserveIds=false 时,序列化的 parentId 和 childIds 是旧 ID,需要重新建立\n // 通过 hierarchySystem.setParent 会正确设置新的 ID\n const hierarchy = entity.getComponent(HierarchyComponent);\n if (hierarchy) {\n hierarchy.parentId = null;\n hierarchy.childIds = [];\n }\n // 反序列化子实体并建立层级关系\n for (const childData of serializedEntity.children) {\n const childEntity = this.deserialize(childData, componentRegistry, idGenerator, preserveIds, scene, hierarchySystem, allEntities);\n // 使用 HierarchySystem 建立层级关系\n hierarchySystem?.setParent(childEntity, entity);\n }\n return entity;\n }\n /**\n * 批量序列化实体\n *\n * @param entities 实体数组\n * @param includeChildren 是否包含子实体\n * @param hierarchySystem 层级系统(可选,用于获取层级信息)\n * @returns 序列化后的实体数据数组\n */\n static serializeEntities(entities, includeChildren = true, hierarchySystem) {\n const result = [];\n for (const entity of entities) {\n // 只序列化顶层实体(没有父实体的实体)\n // 子实体会在父实体序列化时一并处理\n const hierarchy = entity.getComponent(HierarchyComponent);\n const bHasParent = hierarchy?.parentId !== null && hierarchy?.parentId !== undefined;\n if (!bHasParent || !includeChildren) {\n result.push(this.serialize(entity, includeChildren, hierarchySystem));\n }\n }\n return result;\n }\n /**\n * 批量反序列化实体\n *\n * @param serializedEntities 序列化的实体数据数组\n * @param componentRegistry 组件类型注册表\n * @param idGenerator 实体ID生成器\n * @param preserveIds 是否保持原始ID\n * @param scene 目标场景(可选,用于设置entity.scene以支持添加组件)\n * @param hierarchySystem 层级系统(可选,用于建立层级关系)\n * @returns 反序列化后的实体数组\n */\n static deserializeEntities(serializedEntities, componentRegistry, idGenerator, preserveIds = false, scene, hierarchySystem) {\n const rootEntities = [];\n const allEntities = new Map();\n for (const serialized of serializedEntities) {\n const entity = this.deserialize(serialized, componentRegistry, idGenerator, preserveIds, scene, hierarchySystem, allEntities);\n rootEntities.push(entity);\n }\n return { rootEntities, allEntities };\n }\n /**\n * 创建实体的深拷贝\n *\n * @param entity 要拷贝的实体\n * @param componentRegistry 组件类型注册表\n * @param idGenerator ID生成器\n * @returns 拷贝后的新实体\n */\n static clone(entity, componentRegistry, idGenerator) {\n const serialized = this.serialize(entity, true);\n return this.deserialize(serialized, componentRegistry, idGenerator, false);\n }\n}\n//# sourceMappingURL=EntitySerializer.js.map","/**\n * 二进制序列化器\n * 将对象转换为UTF8字节数组\n */\nexport class BinarySerializer {\n /**\n * 将字符串编码为UTF8字节数组\n */\n static stringToUtf8(str) {\n const len = str.length;\n let pos = 0;\n const bytes = [];\n for (let i = 0; i < len; i++) {\n let code = str.charCodeAt(i);\n if (code >= 0xD800 && code <= 0xDBFF && i + 1 < len) {\n const high = code;\n const low = str.charCodeAt(i + 1);\n if (low >= 0xDC00 && low <= 0xDFFF) {\n code = 0x10000 + ((high - 0xD800) << 10) + (low - 0xDC00);\n i++;\n }\n }\n if (code < 0x80) {\n bytes[pos++] = code;\n }\n else if (code < 0x800) {\n bytes[pos++] = 0xC0 | (code >> 6);\n bytes[pos++] = 0x80 | (code & 0x3F);\n }\n else if (code < 0x10000) {\n bytes[pos++] = 0xE0 | (code >> 12);\n bytes[pos++] = 0x80 | ((code >> 6) & 0x3F);\n bytes[pos++] = 0x80 | (code & 0x3F);\n }\n else {\n bytes[pos++] = 0xF0 | (code >> 18);\n bytes[pos++] = 0x80 | ((code >> 12) & 0x3F);\n bytes[pos++] = 0x80 | ((code >> 6) & 0x3F);\n bytes[pos++] = 0x80 | (code & 0x3F);\n }\n }\n return new Uint8Array(bytes);\n }\n /**\n * 将UTF8字节数组解码为字符串\n */\n static utf8ToString(bytes) {\n const len = bytes.length;\n let str = '';\n let i = 0;\n while (i < len) {\n const byte1 = bytes[i++];\n if (byte1 === undefined)\n break;\n if (byte1 < 0x80) {\n str += String.fromCharCode(byte1);\n }\n else if ((byte1 & 0xE0) === 0xC0) {\n const byte2 = bytes[i++];\n if (byte2 === undefined)\n break;\n str += String.fromCharCode(((byte1 & 0x1F) << 6) | (byte2 & 0x3F));\n }\n else if ((byte1 & 0xF0) === 0xE0) {\n const byte2 = bytes[i++];\n const byte3 = bytes[i++];\n if (byte2 === undefined || byte3 === undefined)\n break;\n str += String.fromCharCode(((byte1 & 0x0F) << 12) | ((byte2 & 0x3F) << 6) | (byte3 & 0x3F));\n }\n else if ((byte1 & 0xF8) === 0xF0) {\n const byte2 = bytes[i++];\n const byte3 = bytes[i++];\n const byte4 = bytes[i++];\n if (byte2 === undefined || byte3 === undefined || byte4 === undefined)\n break;\n let code = ((byte1 & 0x07) << 18) | ((byte2 & 0x3F) << 12) |\n ((byte3 & 0x3F) << 6) | (byte4 & 0x3F);\n code -= 0x10000;\n str += String.fromCharCode(0xD800 + (code >> 10), 0xDC00 + (code & 0x3FF));\n }\n }\n return str;\n }\n /**\n * 将对象编码为二进制数据\n */\n static encode(value) {\n const jsonString = JSON.stringify(value);\n return this.stringToUtf8(jsonString);\n }\n /**\n * 将二进制数据解码为对象\n */\n static decode(bytes) {\n const jsonString = this.utf8ToString(bytes);\n return JSON.parse(jsonString);\n }\n}\n//# sourceMappingURL=BinarySerializer.js.map","/**\n * 场景序列化器\n *\n * 负责整个场景的序列化和反序列化,包括实体、组件等\n */\nimport { ComponentRegistry } from '../Core/ComponentStorage';\nimport { EntitySerializer } from './EntitySerializer';\nimport { getComponentTypeName } from '../Decorators';\nimport { getSerializationMetadata } from './SerializationDecorators';\nimport { BinarySerializer } from '../../Utils/BinarySerializer';\nimport { HierarchySystem } from '../Systems/HierarchySystem';\nimport { HierarchyComponent } from '../Components/HierarchyComponent';\n/**\n * 场景序列化器类\n */\nexport class SceneSerializer {\n /**\n * 序列化场景\n *\n * @param scene 要序列化的场景\n * @param options 序列化选项\n * @returns 序列化后的数据(JSON字符串或二进制Uint8Array)\n */\n static serialize(scene, options) {\n const opts = {\n systems: false,\n format: 'json',\n pretty: true,\n includeMetadata: true,\n ...options\n };\n // 过滤实体和组件\n const entities = this.filterEntities(scene, opts);\n // 获取层级系统用于序列化子实体\n const hierarchySystem = scene.getSystem(HierarchySystem);\n // 序列化实体(传入 hierarchySystem 以正确序列化子实体)\n const serializedEntities = EntitySerializer.serializeEntities(entities, true, hierarchySystem ?? undefined);\n // 收集组件类型信息\n const componentTypeRegistry = this.buildComponentTypeRegistry(entities);\n // 序列化场景自定义数据\n const sceneData = this.serializeSceneData(scene.sceneData);\n // 构建序列化数据\n const serializedScene = {\n name: scene.name,\n version: this.SERIALIZATION_VERSION,\n entities: serializedEntities,\n componentTypeRegistry\n };\n // 添加场景数据(如果有)\n if (sceneData && Object.keys(sceneData).length > 0) {\n serializedScene.sceneData = sceneData;\n }\n // 添加元数据\n if (opts.includeMetadata) {\n serializedScene.timestamp = Date.now();\n serializedScene.metadata = {\n entityCount: serializedEntities.length,\n componentTypeCount: componentTypeRegistry.length,\n serializationOptions: opts\n };\n }\n if (opts.format === 'json') {\n return opts.pretty\n ? JSON.stringify(serializedScene, null, 2)\n : JSON.stringify(serializedScene);\n }\n else {\n return BinarySerializer.encode(serializedScene);\n }\n }\n /**\n * 反序列化场景\n *\n * @param scene 目标场景\n * @param saveData 序列化的数据(JSON字符串或二进制Uint8Array)\n * @param options 反序列化选项\n */\n static deserialize(scene, saveData, options) {\n const opts = {\n strategy: 'replace',\n preserveIds: false,\n ...options\n };\n let serializedScene;\n try {\n if (typeof saveData === 'string') {\n serializedScene = JSON.parse(saveData);\n }\n else {\n serializedScene = BinarySerializer.decode(saveData);\n }\n }\n catch (error) {\n throw new Error(`Failed to parse save data: ${error}`);\n }\n // 版本迁移\n if (opts.migration && serializedScene.version !== this.SERIALIZATION_VERSION) {\n serializedScene = opts.migration(serializedScene.version, this.SERIALIZATION_VERSION, serializedScene);\n }\n // 构建组件注册表\n const componentRegistry = opts.componentRegistry || this.getGlobalComponentRegistry();\n // 根据策略处理场景\n if (opts.strategy === 'replace') {\n // 清空场景\n scene.destroyAllEntities();\n }\n // ID生成器\n const idGenerator = () => scene.identifierPool.checkOut();\n // 获取层级系统\n const hierarchySystem = scene.getSystem(HierarchySystem);\n // 反序列化实体\n const { rootEntities, allEntities } = EntitySerializer.deserializeEntities(serializedScene.entities, componentRegistry, idGenerator, opts.preserveIds || false, scene, hierarchySystem);\n // 将所有实体添加到场景(包括子实体)\n // 先添加根实体,再递归添加子实体\n for (const entity of rootEntities) {\n scene.addEntity(entity, true);\n this.addChildrenRecursively(entity, scene, hierarchySystem, allEntities);\n }\n // 统一清理缓存(批量操作完成后)\n scene.querySystem.clearCache();\n scene.clearSystemEntityCaches();\n // 反序列化场景自定义数据\n if (serializedScene.sceneData) {\n this.deserializeSceneData(serializedScene.sceneData, scene.sceneData);\n }\n // 调用所有组件的 onDeserialized 生命周期方法\n // Call onDeserialized lifecycle method on all components\n const deserializedPromises = [];\n for (const entity of allEntities.values()) {\n this.callOnDeserializedForEntity(entity, deserializedPromises);\n }\n // 如果有异步的 onDeserialized,在后台执行\n if (deserializedPromises.length > 0) {\n Promise.all(deserializedPromises).catch(error => {\n console.error('Error in onDeserialized:', error);\n });\n }\n }\n /**\n * 调用实体所有组件的 onDeserialized 方法(不递归)\n */\n static callOnDeserializedForEntity(entity, promises) {\n for (const component of entity.components) {\n try {\n const result = component.onDeserialized();\n if (result instanceof Promise) {\n promises.push(result);\n }\n }\n catch (error) {\n console.error(`Error calling onDeserialized on component ${component.constructor.name}:`, error);\n }\n }\n }\n /**\n * 递归添加实体的所有子实体到场景\n *\n * 修复反序列化时子实体丢失的问题:\n * EntitySerializer.deserialize会提前设置子实体的scene引用,\n * 导致Entity.addChild的条件判断(!child.scene)跳过scene.addEntity调用。\n * 因此需要在SceneSerializer中统一递归添加所有子实体。\n *\n * @param entity 父实体\n * @param scene 目标场景\n * @param hierarchySystem 层级系统\n */\n static addChildrenRecursively(entity, scene, hierarchySystem, childEntitiesMap) {\n const hierarchy = entity.getComponent(HierarchyComponent);\n if (!hierarchy || hierarchy.childIds.length === 0)\n return;\n // 获取子实体\n // 注意:此时子实体还没有被添加到场景,所以不能用 scene.findEntityById\n // 需要从 childEntitiesMap 中查找(如果提供了的话)\n for (const childId of hierarchy.childIds) {\n // 尝试从 map 中获取,否则从场景获取(用于已添加的情况)\n const child = childEntitiesMap?.get(childId) ?? scene.findEntityById(childId);\n if (child) {\n scene.addEntity(child, true); // 延迟缓存清理\n this.addChildrenRecursively(child, scene, hierarchySystem, childEntitiesMap);\n }\n }\n }\n /**\n * 序列化场景自定义数据\n *\n * 将 Map<string, any> 转换为普通对象\n */\n static serializeSceneData(sceneData) {\n const result = {};\n for (const [key, value] of sceneData) {\n result[key] = this.serializeValue(value);\n }\n return result;\n }\n /**\n * 反序列化场景自定义数据\n *\n * 将普通对象还原为 Map<string, any>\n */\n static deserializeSceneData(data, targetMap) {\n targetMap.clear();\n for (const [key, value] of Object.entries(data)) {\n targetMap.set(key, this.deserializeValue(value));\n }\n }\n /**\n * 序列化单个值\n */\n static serializeValue(value) {\n if (value === null || value === undefined) {\n return value;\n }\n // 基本类型\n const type = typeof value;\n if (type === 'string' || type === 'number' || type === 'boolean') {\n return value;\n }\n // Date\n if (value instanceof Date) {\n return { __type: 'Date', value: value.toISOString() };\n }\n // Map\n if (value instanceof Map) {\n return { __type: 'Map', value: Array.from(value.entries()) };\n }\n // Set\n if (value instanceof Set) {\n return { __type: 'Set', value: Array.from(value) };\n }\n // 数组\n if (Array.isArray(value)) {\n return value.map((item) => this.serializeValue(item));\n }\n // 普通对象\n if (type === 'object') {\n const result = {};\n for (const key in value) {\n if (value.hasOwnProperty(key)) {\n result[key] = this.serializeValue(value[key]);\n }\n }\n return result;\n }\n // 其他类型不序列化\n return undefined;\n }\n /**\n * 反序列化单个值\n */\n static deserializeValue(value) {\n if (value === null || value === undefined) {\n return value;\n }\n // 基本类型\n const type = typeof value;\n if (type === 'string' || type === 'number' || type === 'boolean') {\n return value;\n }\n // 处理特殊类型标记\n if (type === 'object' && value.__type) {\n switch (value.__type) {\n case 'Date':\n return new Date(value.value);\n case 'Map':\n return new Map(value.value);\n case 'Set':\n return new Set(value.value);\n }\n }\n // 数组\n if (Array.isArray(value)) {\n return value.map((item) => this.deserializeValue(item));\n }\n // 普通对象\n if (type === 'object') {\n const result = {};\n for (const key in value) {\n if (value.hasOwnProperty(key)) {\n result[key] = this.deserializeValue(value[key]);\n }\n }\n return result;\n }\n return value;\n }\n /**\n * 过滤要序列化的实体和组件\n */\n static filterEntities(scene, options) {\n const entities = Array.from(scene.entities.buffer);\n // 如果指定了组件类型过滤\n if (options.components && options.components.length > 0) {\n const componentTypeSet = new Set(options.components);\n // 只返回拥有指定组件的实体\n return entities.filter((entity) => {\n return Array.from(entity.components).some((component) => componentTypeSet.has(component.constructor));\n });\n }\n return entities;\n }\n /**\n * 构建组件类型注册表\n */\n static buildComponentTypeRegistry(entities) {\n const registry = new Map();\n for (const entity of entities) {\n for (const component of entity.components) {\n const componentType = component.constructor;\n const typeName = getComponentTypeName(componentType);\n const metadata = getSerializationMetadata(component);\n if (metadata && !registry.has(typeName)) {\n registry.set(typeName, metadata.options.version);\n }\n }\n }\n return Array.from(registry.entries()).map(([typeName, version]) => ({\n typeName,\n version\n }));\n }\n /**\n * 获取全局组件注册表\n *\n * 从所有已注册的组件类型构建注册表\n */\n static getGlobalComponentRegistry() {\n return ComponentRegistry.getAllComponentNames();\n }\n /**\n * 验证保存数据的有效性\n *\n * @param saveData 序列化的数据\n * @returns 验证结果\n */\n static validate(saveData) {\n const errors = [];\n try {\n const data = JSON.parse(saveData);\n if (!data.version) {\n errors.push('Missing version field');\n }\n if (!data.entities || !Array.isArray(data.entities)) {\n errors.push('Missing or invalid entities field');\n }\n if (!data.componentTypeRegistry || !Array.isArray(data.componentTypeRegistry)) {\n errors.push('Missing or invalid componentTypeRegistry field');\n }\n return {\n valid: errors.length === 0,\n version: data.version,\n ...(errors.length > 0 && { errors })\n };\n }\n catch (error) {\n return {\n valid: false,\n errors: [`JSON parse error: ${error}`]\n };\n }\n }\n /**\n * 获取保存数据的信息(不完全反序列化)\n *\n * @param saveData 序列化的数据\n * @returns 保存数据的元信息\n */\n static getInfo(saveData) {\n try {\n const data = JSON.parse(saveData);\n return {\n name: data.name,\n version: data.version,\n ...(data.timestamp !== undefined && { timestamp: data.timestamp }),\n entityCount: data.metadata?.entityCount || data.entities.length,\n componentTypeCount: data.componentTypeRegistry.length\n };\n }\n catch (error) {\n return null;\n }\n }\n}\n/**\n * 当前序列化版本\n */\nSceneSerializer.SERIALIZATION_VERSION = 1;\n//# sourceMappingURL=SceneSerializer.js.map","/**\n * 自动性能分析器\n *\n * 提供自动函数包装和采样分析功能,无需手动埋点即可收集性能数据。\n *\n * 支持三种分析模式:\n * 1. 自动包装模式 - 使用 Proxy 自动包装类的所有方法\n * 2. 采样分析模式 - 定时采样调用栈(需要浏览器支持)\n * 3. 装饰器模式 - 使用 @Profile() 装饰器手动标记方法\n */\nimport { ProfilerSDK } from './ProfilerSDK';\nimport { ProfileCategory } from './ProfilerTypes';\nconst DEFAULT_CONFIG = {\n enabled: true,\n sampleInterval: 10,\n minDuration: 0.1, // 0.1ms\n trackAsync: true,\n excludePatterns: [\n /^_/, // 私有方法\n /^get[A-Z]/, // getter 方法\n /^set[A-Z]/, // setter 方法\n /^is[A-Z]/, // 布尔检查方法\n /^has[A-Z]/, // 存在检查方法\n ],\n maxBufferSize: 10000\n};\n/**\n * 自动性能分析器\n */\nexport class AutoProfiler {\n constructor(config) {\n this.wrappedObjects = new WeakMap();\n this.samplingProfiler = null;\n this.registeredClasses = new Map();\n this.config = { ...DEFAULT_CONFIG, ...config };\n }\n /**\n * 获取单例实例\n */\n static getInstance(config) {\n if (!AutoProfiler.instance) {\n AutoProfiler.instance = new AutoProfiler(config);\n }\n return AutoProfiler.instance;\n }\n /**\n * 重置实例\n */\n static resetInstance() {\n if (AutoProfiler.instance) {\n AutoProfiler.instance.dispose();\n AutoProfiler.instance = null;\n }\n }\n /**\n * 启用/禁用自动分析\n */\n static setEnabled(enabled) {\n AutoProfiler.getInstance().setEnabled(enabled);\n }\n /**\n * 注册类以进行自动分析\n * 该类的所有实例方法都会被自动包装\n */\n static registerClass(constructor, category = ProfileCategory.Custom, className) {\n return AutoProfiler.getInstance().registerClass(constructor, category, className);\n }\n /**\n * 包装对象实例的所有方法\n */\n static wrapInstance(instance, className, category = ProfileCategory.Custom) {\n return AutoProfiler.getInstance().wrapInstance(instance, className, category);\n }\n /**\n * 包装单个函数\n */\n static wrapFunction(fn, name, category = ProfileCategory.Custom) {\n return AutoProfiler.getInstance().wrapFunction(fn, name, category);\n }\n /**\n * 启动采样分析器\n */\n static startSampling() {\n AutoProfiler.getInstance().startSampling();\n }\n /**\n * 停止采样分析器\n */\n static stopSampling() {\n return AutoProfiler.getInstance().stopSampling();\n }\n /**\n * 设置启用状态\n */\n setEnabled(enabled) {\n this.config.enabled = enabled;\n if (!enabled && this.samplingProfiler) {\n this.samplingProfiler.stop();\n }\n }\n /**\n * 注册类以进行自动分析\n */\n registerClass(constructor, category = ProfileCategory.Custom, className) {\n const name = className || constructor.name;\n this.registeredClasses.set(name, { constructor, category });\n // eslint-disable-next-line @typescript-eslint/no-this-alias -- Required for Proxy construct handler\n const self = this;\n // 创建代理类\n const ProxiedClass = new Proxy(constructor, {\n construct(target, args, newTarget) {\n const instance = Reflect.construct(target, args, newTarget);\n if (self.config.enabled) {\n self.wrapInstance(instance, name, category);\n }\n return instance;\n }\n });\n return ProxiedClass;\n }\n /**\n * 包装对象实例的所有方法\n */\n wrapInstance(instance, className, category = ProfileCategory.Custom) {\n if (!this.config.enabled) {\n return instance;\n }\n // 检查是否已经包装过\n if (this.wrappedObjects.has(instance)) {\n return instance;\n }\n const wrapInfoMap = new Map();\n this.wrappedObjects.set(instance, wrapInfoMap);\n // 获取所有方法(包括原型链上的)\n const methodNames = this.getAllMethodNames(instance);\n for (const methodName of methodNames) {\n if (this.shouldExcludeMethod(methodName)) {\n continue;\n }\n const descriptor = this.getPropertyDescriptor(instance, methodName);\n if (!descriptor || typeof descriptor.value !== 'function') {\n continue;\n }\n const original = descriptor.value;\n const wrapped = this.createWrappedMethod(original, className, methodName, category);\n wrapInfoMap.set(methodName, {\n className,\n methodName,\n category,\n original\n });\n try {\n instance[methodName] = wrapped;\n }\n catch {\n // 某些属性可能是只读的\n }\n }\n return instance;\n }\n /**\n * 包装单个函数\n */\n wrapFunction(fn, name, category = ProfileCategory.Custom) {\n if (!this.config.enabled)\n return fn;\n // eslint-disable-next-line @typescript-eslint/no-this-alias -- Required for wrapped function closure\n const self = this;\n const wrapped = function (...args) {\n const handle = ProfilerSDK.beginSample(name, category);\n try {\n const result = fn.apply(this, args);\n // 处理 Promise\n if (self.config.trackAsync && result instanceof Promise) {\n return result.finally(() => {\n ProfilerSDK.endSample(handle);\n });\n }\n // 同步函数,立即结束采样\n ProfilerSDK.endSample(handle);\n return result;\n }\n catch (error) {\n // 发生错误时也要结束采样\n ProfilerSDK.endSample(handle);\n throw error;\n }\n };\n // 保留原函数的属性\n Object.defineProperty(wrapped, 'name', { value: fn.name || name });\n Object.defineProperty(wrapped, 'length', { value: fn.length });\n return wrapped;\n }\n /**\n * 启动采样分析器\n */\n startSampling() {\n if (!this.samplingProfiler) {\n this.samplingProfiler = new SamplingProfiler(this.config);\n }\n this.samplingProfiler.start();\n }\n /**\n * 停止采样分析器\n */\n stopSampling() {\n if (!this.samplingProfiler) {\n return [];\n }\n return this.samplingProfiler.stop();\n }\n /**\n * 释放资源\n */\n dispose() {\n if (this.samplingProfiler) {\n this.samplingProfiler.stop();\n this.samplingProfiler = null;\n }\n this.registeredClasses.clear();\n }\n /**\n * 创建包装后的方法\n */\n createWrappedMethod(original, className, methodName, category) {\n // eslint-disable-next-line @typescript-eslint/no-this-alias -- Required for wrapped method closure\n const self = this;\n const fullName = `${className}.${methodName}`;\n const minDuration = this.config.minDuration;\n return function (...args) {\n if (!self.config.enabled || !ProfilerSDK.isEnabled()) {\n return original.apply(this, args);\n }\n const startTime = performance.now();\n const handle = ProfilerSDK.beginSample(fullName, category);\n try {\n const result = original.apply(this, args);\n // 处理异步方法\n if (self.config.trackAsync && result instanceof Promise) {\n return result.then((value) => {\n const duration = performance.now() - startTime;\n if (duration >= minDuration) {\n ProfilerSDK.endSample(handle);\n }\n return value;\n }, (error) => {\n ProfilerSDK.endSample(handle);\n throw error;\n });\n }\n // 同步方法,检查最小耗时后结束采样\n const duration = performance.now() - startTime;\n if (duration >= minDuration) {\n ProfilerSDK.endSample(handle);\n }\n return result;\n }\n catch (error) {\n // 发生错误时也要结束采样\n ProfilerSDK.endSample(handle);\n throw error;\n }\n };\n }\n /**\n * 获取对象的所有方法名\n */\n getAllMethodNames(obj) {\n const methods = new Set();\n let current = obj;\n while (current && current !== Object.prototype) {\n for (const name of Object.getOwnPropertyNames(current)) {\n if (name !== 'constructor') {\n methods.add(name);\n }\n }\n current = Object.getPrototypeOf(current);\n }\n return Array.from(methods);\n }\n /**\n * 获取属性描述符\n */\n getPropertyDescriptor(obj, name) {\n let current = obj;\n while (current && current !== Object.prototype) {\n const descriptor = Object.getOwnPropertyDescriptor(current, name);\n if (descriptor)\n return descriptor;\n current = Object.getPrototypeOf(current);\n }\n return undefined;\n }\n /**\n * 判断是否应该排除该方法\n */\n shouldExcludeMethod(methodName) {\n // 排除构造函数和内置方法\n if (methodName === 'constructor' || methodName.startsWith('__')) {\n return true;\n }\n // 检查排除模式\n for (const pattern of this.config.excludePatterns) {\n if (pattern.test(methodName)) {\n return true;\n }\n }\n return false;\n }\n}\nAutoProfiler.instance = null;\n/**\n * 采样分析器\n * 使用定时器定期采样调用栈信息\n */\nclass SamplingProfiler {\n constructor(config) {\n this.samples = [];\n this.intervalId = null;\n this.isRunning = false;\n this.config = config;\n }\n /**\n * 开始采样\n */\n start() {\n if (this.isRunning)\n return;\n this.isRunning = true;\n this.samples = [];\n // 使用 requestAnimationFrame 或 setInterval 进行采样\n const sample = () => {\n if (!this.isRunning)\n return;\n const stack = this.captureStack();\n if (stack.length > 0) {\n this.samples.push({\n timestamp: performance.now(),\n stack\n });\n // 限制缓冲区大小\n if (this.samples.length > this.config.maxBufferSize) {\n this.samples.shift();\n }\n }\n // 继续采样\n if (this.config.sampleInterval < 16) {\n // 高频采样使用 setTimeout\n this.intervalId = setTimeout(sample, this.config.sampleInterval);\n }\n else {\n this.intervalId = setTimeout(sample, this.config.sampleInterval);\n }\n };\n sample();\n }\n /**\n * 停止采样并返回数据\n */\n stop() {\n this.isRunning = false;\n if (this.intervalId !== null) {\n clearTimeout(this.intervalId);\n this.intervalId = null;\n }\n return [...this.samples];\n }\n /**\n * 捕获当前调用栈\n */\n captureStack() {\n try {\n // 创建 Error 对象获取调用栈\n const error = new Error();\n const stack = error.stack || '';\n // 解析调用栈\n const lines = stack.split('\\n').slice(3); // 跳过 Error 和 captureStack/sample\n const frames = [];\n for (const line of lines) {\n const frame = this.parseStackFrame(line);\n if (frame && !this.isInternalFrame(frame)) {\n frames.push(frame);\n }\n }\n return frames;\n }\n catch {\n return [];\n }\n }\n /**\n * 解析调用栈帧\n */\n parseStackFrame(line) {\n // Chrome/Edge 格式: \" at functionName (file:line:col)\"\n // Firefox 格式: \"functionName@file:line:col\"\n // Safari 格式: \"functionName@file:line:col\"\n line = line.trim();\n // Chrome 格式\n let match = line.match(/at\\s+(.+?)\\s+\\(/);\n if (match && match[1]) {\n return match[1];\n }\n // Chrome 匿名函数格式\n match = line.match(/at\\s+(.+)/);\n if (match && match[1]) {\n const name = match[1];\n if (!name.includes('(')) {\n return name;\n }\n }\n // Firefox/Safari 格式\n match = line.match(/^(.+?)@/);\n if (match && match[1]) {\n return match[1];\n }\n return null;\n }\n /**\n * 判断是否是内部帧(应该过滤掉)\n */\n isInternalFrame(frame) {\n const internalPatterns = [\n 'SamplingProfiler',\n 'AutoProfiler',\n 'ProfilerSDK',\n 'setTimeout',\n 'setInterval',\n 'requestAnimationFrame',\n '<anonymous>',\n 'eval'\n ];\n return internalPatterns.some(pattern => frame.includes(pattern));\n }\n}\n/**\n * @Profile 装饰器\n * 用于标记需要性能分析的方法\n *\n * @example\n * ```typescript\n * class MySystem extends System {\n * @Profile()\n * update() {\n * // 方法执行时间会被自动记录\n * }\n *\n * @Profile('customName', ProfileCategory.Physics)\n * calculatePhysics() {\n * // 使用自定义名称和分类\n * }\n * }\n * ```\n */\nexport function Profile(name, category = ProfileCategory.Custom) {\n return function (target, propertyKey, descriptor) {\n const original = descriptor.value;\n const methodName = name || `${target.constructor.name}.${String(propertyKey)}`;\n descriptor.value = function (...args) {\n if (!ProfilerSDK.isEnabled()) {\n return original.apply(this, args);\n }\n const handle = ProfilerSDK.beginSample(methodName, category);\n try {\n const result = original.apply(this, args);\n // 处理异步方法\n if (result instanceof Promise) {\n return result.finally(() => {\n ProfilerSDK.endSample(handle);\n });\n }\n // 同步方法,立即结束采样\n ProfilerSDK.endSample(handle);\n return result;\n }\n catch (error) {\n // 发生错误时也要结束采样\n ProfilerSDK.endSample(handle);\n throw error;\n }\n };\n return descriptor;\n };\n}\n/**\n * @ProfileClass 装饰器\n * 用于自动包装类的所有方法\n *\n * @example\n * ```typescript\n * @ProfileClass(ProfileCategory.Physics)\n * class PhysicsSystem extends System {\n * update() { ... } // 自动被包装\n * calculate() { ... } // 自动被包装\n * }\n * ```\n */\nexport function ProfileClass(category = ProfileCategory.Custom) {\n return function (constructor) {\n return AutoProfiler.registerClass(constructor, category);\n };\n}\n//# sourceMappingURL=AutoProfiler.js.map","import { createLogger } from '../Utils/Logger';\nimport { isUpdatable as checkUpdatable, getUpdatableMetadata } from './DI';\nconst logger = createLogger('ServiceContainer');\n/**\n * 服务生命周期\n */\nexport var ServiceLifetime;\n(function (ServiceLifetime) {\n /**\n * 单例模式 - 整个应用生命周期内只有一个实例\n */\n ServiceLifetime[\"Singleton\"] = \"singleton\";\n /**\n * 瞬时模式 - 每次请求都创建新实例\n */\n ServiceLifetime[\"Transient\"] = \"transient\";\n})(ServiceLifetime || (ServiceLifetime = {}));\n/**\n * 服务容器\n *\n * 负责管理所有服务的注册、解析和生命周期。\n * 支持依赖注入和服务定位模式。\n *\n * 特点:\n * - 单例和瞬时两种生命周期\n * - 支持工厂函数注册\n * - 支持实例注册\n * - 类型安全的服务解析\n *\n * @example\n * ```typescript\n * const container = new ServiceContainer();\n *\n * // 注册单例服务\n * container.registerSingleton(TimerManager);\n *\n * // 注册工厂函数\n * container.registerSingleton(Logger, (c) => createLogger('App'));\n *\n * // 注册实例\n * container.registerInstance(Config, new Config());\n *\n * // 解析服务\n * const timer = container.resolve(TimerManager);\n * ```\n */\nexport class ServiceContainer {\n constructor() {\n /**\n * 服务注册表\n */\n this._services = new Map();\n /**\n * 正在解析的服务栈(用于循环依赖检测)\n */\n this._resolving = new Set();\n /**\n * 可更新的服务列表\n *\n * 自动收集所有使用@Updatable装饰器标记的服务,供Core统一更新\n * 按优先级排序(数值越小越先执行)\n */\n this._updatableServices = [];\n }\n /**\n * 注册单例服务\n *\n * @param type - 服务类型\n * @param factory - 可选的工厂函数\n *\n * @example\n * ```typescript\n * // 直接注册类型\n * container.registerSingleton(TimerManager);\n *\n * // 使用工厂函数\n * container.registerSingleton(Logger, (c) => {\n * return createLogger('App');\n * });\n * ```\n */\n registerSingleton(type, factory) {\n if (this._services.has(type)) {\n logger.warn(`Service ${type.name} is already registered`);\n return;\n }\n this._services.set(type, {\n identifier: type,\n type: type,\n ...(factory && { factory: factory }),\n lifetime: ServiceLifetime.Singleton\n });\n logger.debug(`Registered singleton service: ${type.name}`);\n }\n /**\n * 注册瞬时服务\n *\n * 每次解析都会创建新实例。\n *\n * @param type - 服务类型\n * @param factory - 可选的工厂函数\n *\n * @example\n * ```typescript\n * // 每次解析都创建新实例\n * container.registerTransient(Command);\n * ```\n */\n registerTransient(type, factory) {\n if (this._services.has(type)) {\n logger.warn(`Service ${type.name} is already registered`);\n return;\n }\n this._services.set(type, {\n identifier: type,\n type: type,\n ...(factory && { factory: factory }),\n lifetime: ServiceLifetime.Transient\n });\n logger.debug(`Registered transient service: ${type.name}`);\n }\n /**\n * 注册服务实例\n *\n * 直接注册已创建的实例,自动视为单例。\n *\n * @param identifier - 服务标识符(构造函数或 Symbol)\n * @param instance - 服务实例\n *\n * @example\n * ```typescript\n * const config = new Config();\n * container.registerInstance(Config, config);\n *\n * // 使用 Symbol 作为标识符(适用于接口)\n * const IFileSystem = Symbol('IFileSystem');\n * container.registerInstance(IFileSystem, new TauriFileSystem());\n * ```\n */\n registerInstance(identifier, instance) {\n if (this._services.has(identifier)) {\n const name = typeof identifier === 'symbol' ? identifier.description : identifier.name;\n logger.warn(`Service ${name} is already registered`);\n return;\n }\n this._services.set(identifier, {\n identifier,\n instance: instance,\n lifetime: ServiceLifetime.Singleton\n });\n // 如果使用了@Updatable装饰器,添加到可更新列表\n if (typeof identifier !== 'symbol' && checkUpdatable(identifier)) {\n const metadata = getUpdatableMetadata(identifier);\n const priority = metadata?.priority ?? 0;\n this._updatableServices.push({ instance, priority });\n // 按优先级排序(数值越小越先执行)\n this._updatableServices.sort((a, b) => a.priority - b.priority);\n logger.debug(`Service ${identifier.name} is updatable (priority: ${priority}), added to update list`);\n }\n const name = typeof identifier === 'symbol' ? identifier.description : identifier.name;\n logger.debug(`Registered service instance: ${name}`);\n }\n /**\n * 解析服务\n *\n * @param identifier - 服务标识符(构造函数或 Symbol)\n * @returns 服务实例\n * @throws 如果服务未注册或存在循环依赖\n *\n * @example\n * ```typescript\n * const timer = container.resolve(TimerManager);\n *\n * // 使用 Symbol\n * const fileSystem = container.resolve(IFileSystem);\n * ```\n */\n resolve(identifier) {\n const registration = this._services.get(identifier);\n const name = typeof identifier === 'symbol' ? identifier.description : identifier.name;\n if (!registration) {\n throw new Error(`Service ${name} is not registered`);\n }\n // 检测循环依赖\n if (this._resolving.has(identifier)) {\n const chain = Array.from(this._resolving).map((t) => typeof t === 'symbol' ? t.description : t.name).join(' -> ');\n throw new Error(`Circular dependency detected: ${chain} -> ${name}`);\n }\n // 如果是单例且已经有实例,直接返回\n if (registration.lifetime === ServiceLifetime.Singleton && registration.instance) {\n return registration.instance;\n }\n // 添加到解析栈\n this._resolving.add(identifier);\n try {\n // 创建实例\n let instance;\n if (registration.factory) {\n // 使用工厂函数\n instance = registration.factory(this);\n }\n else if (registration.type) {\n // 直接构造\n instance = new (registration.type)();\n }\n else {\n throw new Error(`Service ${name} has no factory or type to construct`);\n }\n // 如果是单例,缓存实例\n if (registration.lifetime === ServiceLifetime.Singleton) {\n registration.instance = instance;\n // 如果使用了@Updatable装饰器,添加到可更新列表\n if (registration.type && checkUpdatable(registration.type)) {\n const metadata = getUpdatableMetadata(registration.type);\n const priority = metadata?.priority ?? 0;\n this._updatableServices.push({ instance, priority });\n // 按优先级排序(数值越小越先执行)\n this._updatableServices.sort((a, b) => a.priority - b.priority);\n logger.debug(`Service ${name} is updatable (priority: ${priority}), added to update list`);\n }\n }\n return instance;\n }\n finally {\n // 从解析栈移除\n this._resolving.delete(identifier);\n }\n }\n /**\n * 尝试解析服务\n *\n * 如果服务未注册,返回null而不是抛出异常。\n *\n * @param identifier - 服务标识符(构造函数或 Symbol)\n * @returns 服务实例或null\n *\n * @example\n * ```typescript\n * const timer = container.tryResolve(TimerManager);\n * if (timer) {\n * timer.schedule(...);\n * }\n * ```\n */\n tryResolve(identifier) {\n try {\n return this.resolve(identifier);\n }\n catch {\n return null;\n }\n }\n /**\n * 检查服务是否已注册\n *\n * @param identifier - 服务标识符(构造函数或 Symbol)\n * @returns 是否已注册\n */\n isRegistered(identifier) {\n return this._services.has(identifier);\n }\n /**\n * 注销服务\n *\n * @param identifier - 服务标识符(构造函数或 Symbol)\n * @returns 是否成功注销\n */\n unregister(identifier) {\n const registration = this._services.get(identifier);\n if (!registration) {\n return false;\n }\n // 如果有单例实例,调用 dispose\n if (registration.instance) {\n // 从可更新列表中移除\n const index = this._updatableServices.findIndex((item) => item.instance === registration.instance);\n if (index !== -1) {\n this._updatableServices.splice(index, 1);\n }\n registration.instance.dispose();\n }\n this._services.delete(identifier);\n const name = typeof identifier === 'symbol' ? identifier.description : identifier.name;\n logger.debug(`Unregistered service: ${name}`);\n return true;\n }\n /**\n * 清空所有服务\n */\n clear() {\n // 清理所有单例实例\n for (const [, registration] of this._services) {\n if (registration.instance) {\n registration.instance.dispose();\n }\n }\n this._services.clear();\n this._updatableServices = [];\n logger.debug('Cleared all services');\n }\n /**\n * 获取所有已注册的服务标识符\n *\n * @returns 服务标识符数组\n */\n getRegisteredServices() {\n return Array.from(this._services.keys());\n }\n /**\n * 更新所有使用@Updatable装饰器标记的服务\n *\n * 此方法会按优先级顺序遍历所有可更新的服务并调用它们的update方法。\n * 所有服务在注册时已经由@Updatable装饰器验证过必须实现IUpdatable接口。\n * 通常在Core的主更新循环中调用。\n *\n * @param deltaTime - 可选的帧时间间隔(秒)\n *\n * @example\n * ```typescript\n * // 在Core的update方法中\n * this._serviceContainer.updateAll(deltaTime);\n * ```\n */\n updateAll(deltaTime) {\n for (const { instance } of this._updatableServices) {\n instance.update(deltaTime);\n }\n }\n /**\n * 获取所有可更新的服务数量\n *\n * @returns 可更新服务的数量\n */\n getUpdatableCount() {\n return this._updatableServices.length;\n }\n /**\n * 获取所有已实例化的服务实例\n *\n * @returns 所有服务实例的数组\n */\n getAll() {\n const instances = [];\n for (const descriptor of this._services.values()) {\n if (descriptor.instance) {\n instances.push(descriptor.instance);\n }\n }\n return instances;\n }\n}\n//# sourceMappingURL=ServiceContainer.js.map","import { Entity } from './Entity';\nimport { EntityList } from './Utils/EntityList';\nimport { IdentifierPool } from './Utils/IdentifierPool';\nimport { EntitySystem } from './Systems/EntitySystem';\nimport { ComponentStorageManager, ComponentRegistry } from './Core/ComponentStorage';\nimport { QuerySystem } from './Core/QuerySystem';\nimport { TypeSafeEventSystem } from './Core/EventSystem';\nimport { ReferenceTracker } from './Core/ReferenceTracker';\nimport { getComponentInstanceTypeName, getSystemInstanceTypeName, getSystemMetadata } from './Decorators';\nimport { TypedQueryBuilder } from './Core/Query/TypedQuery';\nimport { SceneSerializer } from './Serialization/SceneSerializer';\nimport { IncrementalSerializer } from './Serialization/IncrementalSerializer';\nimport { ComponentPoolManager } from './Core/ComponentPool';\nimport { PerformanceMonitor } from '../Utils/PerformanceMonitor';\nimport { ProfilerSDK } from '../Utils/Profiler/ProfilerSDK';\nimport { ProfileCategory } from '../Utils/Profiler/ProfilerTypes';\nimport { AutoProfiler } from '../Utils/Profiler/AutoProfiler';\nimport { ServiceContainer } from '../Core/ServiceContainer';\nimport { createInstance, isInjectable, injectProperties } from '../Core/DI';\nimport { createLogger } from '../Utils/Logger';\n/**\n * 游戏场景默认实现类\n *\n * 实现IScene接口,提供场景的基础功能。\n * 推荐使用组合而非继承的方式来构建自定义场景。\n */\nexport class Scene {\n /**\n * 获取场景中所有已注册的EntitySystem\n *\n * 按updateOrder排序。使用缓存机制,仅在系统变化时重新排序。\n *\n * @returns 系统列表\n */\n get systems() {\n if (!this._systemsOrderDirty && this._cachedSystems) {\n return this._cachedSystems;\n }\n this._cachedSystems = this._rebuildSystemsCache();\n this._systemsOrderDirty = false;\n return this._cachedSystems;\n }\n /**\n * 重新构建系统缓存\n *\n * 从服务容器中提取所有EntitySystem并排序\n */\n _rebuildSystemsCache() {\n const allServices = this._services.getAll();\n const systems = this._filterEntitySystems(allServices);\n return this._sortSystemsByUpdateOrder(systems);\n }\n /**\n * 从服务列表中过滤出EntitySystem实例\n */\n _filterEntitySystems(services) {\n return services.filter((service) => service instanceof EntitySystem);\n }\n /**\n * 按 updateOrder 排序系统,相同时按 addOrder 保证稳定性\n * Sort systems by updateOrder, use addOrder as secondary key for stability\n */\n _sortSystemsByUpdateOrder(systems) {\n return systems.sort((a, b) => {\n const orderDiff = a.updateOrder - b.updateOrder;\n if (orderDiff !== 0)\n return orderDiff;\n return a.addOrder - b.addOrder;\n });\n }\n /**\n * 通过类型获取System实例\n *\n * @param systemType System类型\n * @returns System实例,如果未找到则返回null\n *\n * @example\n * ```typescript\n * const physics = scene.getSystem(PhysicsSystem);\n * if (physics) {\n * physics.doSomething();\n * }\n * ```\n */\n getSystem(systemType) {\n return this._services.tryResolve(systemType);\n }\n /**\n * 标记系统顺序为脏\n *\n * 当系统列表或顺序发生变化时调用,使缓存失效\n */\n markSystemsOrderDirty() {\n this._systemsOrderDirty = true;\n }\n /**\n * 获取场景的服务容器\n *\n * 用于注册和解析场景级别的服务(如EntitySystem)。\n *\n * @example\n * ```typescript\n * // 注册服务\n * scene.services.registerSingleton(PhysicsSystem);\n *\n * // 解析服务\n * const physics = scene.services.resolve(PhysicsSystem);\n * ```\n */\n get services() {\n return this._services;\n }\n /**\n * 创建场景实例\n */\n constructor(config) {\n /**\n * 场景名称\n *\n * 用于标识和调试的友好名称。\n */\n this.name = '';\n /**\n * 场景自定义数据\n *\n * 用于存储场景级别的配置和状态数据。\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this.sceneData = new Map();\n /**\n * 性能监控器缓存\n *\n * 用于监控场景和系统的性能。从 ServiceContainer 获取。\n */\n this._performanceMonitor = null;\n /**\n * 场景是否已开始运行\n */\n this._didSceneBegin = false;\n /**\n * 编辑器模式标志\n *\n * 当为 true 时,组件的生命周期回调(如 onAddedToEntity)会被延迟,\n * 直到调用 begin() 开始运行场景时才会触发。\n *\n * Editor mode flag.\n * When true, component lifecycle callbacks (like onAddedToEntity) are deferred\n * until begin() is called to start running the scene.\n */\n this.isEditorMode = false;\n /**\n * 延迟的组件生命周期回调队列\n *\n * 在编辑器模式下,组件的 onAddedToEntity 回调会被加入此队列,\n * 等到 begin() 调用时统一执行。\n *\n * Deferred component lifecycle callback queue.\n * In editor mode, component's onAddedToEntity callbacks are queued here,\n * and will be executed when begin() is called.\n */\n this._deferredComponentCallbacks = [];\n /**\n * 系统列表缓存\n */\n this._cachedSystems = null;\n /**\n * 系统顺序脏标记\n *\n * 当系统增删或 updateOrder 改变时标记为 true,下次访问 systems 时重新构建缓存\n */\n this._systemsOrderDirty = true;\n /**\n * 系统错误计数器\n *\n * 跟踪每个系统的错误次数,用于自动禁用频繁出错的系统\n */\n this._systemErrorCount = new Map();\n /**\n * 最大允许错误次数\n *\n * 系统错误次数超过此阈值后将被自动禁用\n */\n this._maxErrorCount = 10;\n /**\n * 系统添加计数器\n *\n * 用于为每个添加的系统分配唯一的添加顺序,保证排序稳定性\n * Counter for assigning unique add order to each system for stable sorting\n */\n this._systemAddCounter = 0;\n /**\n * 组件ID到系统的索引映射\n *\n * 用于快速查找关心特定组件的系统,避免遍历所有系统。\n * 使用组件ID(数字)而非ComponentType作为key,避免类引用问题。\n *\n * Component ID to systems index map.\n * Used for fast lookup of systems that care about specific components.\n * Uses component ID (number) instead of ComponentType as key to avoid class reference issues.\n */\n this._componentIdToSystems = new Map();\n /**\n * 需要接收所有组件变化通知的系统集合\n *\n * 包括使用 none 条件、tag/name 查询、或空匹配器的系统。\n * 这些系统无法通过组件ID索引优化,需要在每次组件变化时都检查。\n *\n * Systems that need to receive all component change notifications.\n * Includes systems using none conditions, tag/name queries, or empty matchers.\n * These systems cannot be optimized via component ID indexing.\n */\n this._globalNotifySystems = new Set();\n this.entities = new EntityList(this);\n this.identifierPool = new IdentifierPool();\n this.componentStorageManager = new ComponentStorageManager();\n this.querySystem = new QuerySystem();\n this.eventSystem = new TypeSafeEventSystem();\n this.referenceTracker = new ReferenceTracker();\n this._services = new ServiceContainer();\n this.logger = createLogger('Scene');\n if (config?.name) {\n this.name = config.name;\n }\n }\n /**\n * 获取性能监控器\n *\n * 从 ServiceContainer 获取,如果未注册则创建默认实例(向后兼容)\n */\n get performanceMonitor() {\n if (!this._performanceMonitor) {\n this._performanceMonitor = this._services.tryResolve(PerformanceMonitor) ?? new PerformanceMonitor();\n }\n return this._performanceMonitor;\n }\n /**\n * 初始化场景\n *\n * 在场景创建时调用,子类可以重写此方法来设置初始实体和组件。\n */\n initialize() { }\n /**\n * 场景开始运行时的回调\n *\n * 在场景开始运行时调用,可以在此方法中执行场景启动逻辑。\n */\n onStart() { }\n /**\n * 场景卸载时的回调\n *\n * 在场景被销毁时调用,可以在此方法中执行清理工作。\n */\n unload() { }\n /**\n * 添加延迟的组件生命周期回调\n *\n * 在编辑器模式下,组件的 onAddedToEntity 回调会通过此方法加入队列。\n *\n * Queue a deferred component lifecycle callback.\n * In editor mode, component's onAddedToEntity callbacks are queued via this method.\n *\n * @param callback 要延迟执行的回调 | The callback to defer\n */\n queueDeferredComponentCallback(callback) {\n this._deferredComponentCallbacks.push(callback);\n }\n /**\n * 开始场景,启动实体处理器等\n *\n * 这个方法会启动场景。它将启动实体处理器等,并调用onStart方法。\n * 在编辑器模式下,此方法还会执行所有延迟的组件生命周期回调。\n *\n * This method starts the scene. It will start entity processors and call onStart.\n * In editor mode, this method also executes all deferred component lifecycle callbacks.\n */\n begin() {\n // 标记场景已开始运行\n this._didSceneBegin = true;\n // 执行所有延迟的组件生命周期回调 | Execute all deferred component lifecycle callbacks\n if (this._deferredComponentCallbacks.length > 0) {\n for (const callback of this._deferredComponentCallbacks) {\n try {\n callback();\n }\n catch (error) {\n this.logger.error('Error executing deferred component callback:', error);\n }\n }\n // 清空队列 | Clear the queue\n this._deferredComponentCallbacks = [];\n }\n // 调用onStart方法\n this.onStart();\n }\n /**\n * 结束场景,清除实体、实体处理器等\n *\n * 这个方法会结束场景。它将移除所有实体,结束实体处理器等,并调用unload方法。\n *\n * 执行顺序:\n * 1. 调用 unload() - 用户可以在此访问实体和系统进行清理\n * 2. 清理所有实体\n * 3. 清空服务容器,触发所有系统的 onDestroy()\n *\n * 注意:\n * - onRemoved 回调不会在 Scene.end() 时触发,因为这是批量销毁场景\n * - 用户清理:在 Scene.unload() 中处理(可访问实体和系统)\n * - 系统清理:在 System.onDestroy() 中处理(实体已被清理)\n */\n end() {\n // 标记场景已结束运行\n this._didSceneBegin = false;\n // 先调用用户的卸载方法,此时用户可以访问实体和系统进行清理\n this.unload();\n // 移除所有实体\n this.entities.removeAllEntities();\n // 清理查询系统中的实体引用和缓存\n this.querySystem.setEntities([]);\n // 清空组件存储\n this.componentStorageManager.clear();\n // 清空服务容器(会调用所有服务的dispose方法,包括所有EntitySystem)\n // 系统的 onDestroy 回调会在这里被触发\n this._services.clear();\n // 清空系统缓存\n this._cachedSystems = null;\n this._systemsOrderDirty = true;\n // 清空组件索引 | Clear component indices\n this._componentIdToSystems.clear();\n this._globalNotifySystems.clear();\n }\n /**\n * 更新场景\n */\n update() {\n // 开始性能采样帧\n ProfilerSDK.beginFrame();\n const frameHandle = ProfilerSDK.beginSample('Scene.update', ProfileCategory.ECS);\n try {\n ComponentPoolManager.getInstance().update();\n this.entities.updateLists();\n const systems = this.systems;\n // Update 阶段\n const updateHandle = ProfilerSDK.beginSample('Systems.update', ProfileCategory.ECS);\n try {\n for (const system of systems) {\n if (system.enabled) {\n const systemHandle = ProfilerSDK.beginSample(system.systemName, ProfileCategory.ECS);\n try {\n system.update();\n }\n catch (error) {\n this._handleSystemError(system, 'update', error);\n }\n finally {\n ProfilerSDK.endSample(systemHandle);\n }\n }\n }\n }\n finally {\n ProfilerSDK.endSample(updateHandle);\n }\n // LateUpdate 阶段\n const lateUpdateHandle = ProfilerSDK.beginSample('Systems.lateUpdate', ProfileCategory.ECS);\n try {\n for (const system of systems) {\n if (system.enabled) {\n const systemHandle = ProfilerSDK.beginSample(`${system.systemName}.late`, ProfileCategory.ECS);\n try {\n system.lateUpdate();\n }\n catch (error) {\n this._handleSystemError(system, 'lateUpdate', error);\n }\n finally {\n ProfilerSDK.endSample(systemHandle);\n }\n }\n }\n }\n finally {\n ProfilerSDK.endSample(lateUpdateHandle);\n }\n // 执行所有系统的延迟命令\n // Flush all systems' deferred commands\n this.flushCommandBuffers(systems);\n }\n finally {\n ProfilerSDK.endSample(frameHandle);\n // 结束性能采样帧\n ProfilerSDK.endFrame();\n }\n }\n /**\n * 执行所有系统的延迟命令\n * Flush all systems' deferred commands\n *\n * 在帧末统一执行所有通过 CommandBuffer 提交的延迟操作。\n * Execute all deferred operations submitted via CommandBuffer at end of frame.\n */\n flushCommandBuffers(systems) {\n const flushHandle = ProfilerSDK.beginSample('Scene.flushCommandBuffers', ProfileCategory.ECS);\n try {\n for (const system of systems) {\n try {\n system.flushCommands();\n }\n catch (error) {\n this.logger.error(`Error flushing commands for system ${system.systemName}:`, error);\n }\n }\n }\n finally {\n ProfilerSDK.endSample(flushHandle);\n }\n }\n /**\n * 处理系统执行错误\n *\n * 记录错误信息并跟踪错误次数。当系统错误次数超过阈值时自动禁用该系统。\n *\n * @param system 出错的系统\n * @param phase 错误发生的阶段(update 或 lateUpdate)\n * @param error 错误对象\n */\n _handleSystemError(system, phase, error) {\n const errorCount = (this._systemErrorCount.get(system) || 0) + 1;\n this._systemErrorCount.set(system, errorCount);\n this.logger.error(`Error in system ${system.constructor.name}.${phase}() [${errorCount}/${this._maxErrorCount}]:`, error);\n if (errorCount >= this._maxErrorCount) {\n system.enabled = false;\n this.logger.error(`System ${system.constructor.name} has been disabled due to excessive errors (${errorCount} errors)`);\n }\n }\n /**\n * 将实体添加到此场景,并返回它\n * @param name 实体名称\n */\n createEntity(name) {\n const entity = new Entity(name, this.identifierPool.checkOut());\n this.eventSystem.emitSync('entity:created', { entityName: name, entity, scene: this });\n return this.addEntity(entity);\n }\n /**\n * 清除所有EntitySystem的实体缓存\n * 当实体或组件发生变化时调用\n */\n clearSystemEntityCaches() {\n for (const system of this.systems) {\n system.clearEntityCache();\n }\n }\n /**\n * 通知相关系统实体的组件发生了变化\n *\n * 这是事件驱动设计的核心:当组件被添加或移除时,立即通知相关系统检查该实体是否匹配,\n * 并触发 onAdded/onRemoved 回调。通过组件ID索引优化,只通知关心该组件的系统。\n *\n * This is the core of event-driven design: when a component is added or removed,\n * immediately notify relevant systems to check if the entity matches and trigger\n * onAdded/onRemoved callbacks. Optimized via component ID indexing to only notify\n * systems that care about the changed component.\n *\n * @param entity 组件发生变化的实体 | The entity whose components changed\n * @param changedComponentType 变化的组件类型(可选) | The changed component type (optional)\n */\n notifyEntityComponentChanged(entity, changedComponentType) {\n // 已通知的系统集合,避免重复通知 | Set of notified systems to avoid duplicates\n const notifiedSystems = new Set();\n // 如果提供了组件类型,使用索引优化 | If component type provided, use index optimization\n if (changedComponentType && ComponentRegistry.isRegistered(changedComponentType)) {\n const componentId = ComponentRegistry.getBitIndex(changedComponentType);\n const interestedSystems = this._componentIdToSystems.get(componentId);\n if (interestedSystems) {\n for (const system of interestedSystems) {\n system.handleEntityComponentChanged(entity);\n notifiedSystems.add(system);\n }\n }\n }\n // 通知全局监听系统(none条件、tag/name查询等) | Notify global listener systems\n for (const system of this._globalNotifySystems) {\n if (!notifiedSystems.has(system)) {\n system.handleEntityComponentChanged(entity);\n notifiedSystems.add(system);\n }\n }\n // 如果没有提供组件类型,回退到遍历所有系统 | Fallback to all systems if no component type\n if (!changedComponentType) {\n for (const system of this.systems) {\n if (!notifiedSystems.has(system)) {\n system.handleEntityComponentChanged(entity);\n }\n }\n }\n }\n /**\n * 将系统添加到组件索引\n *\n * 根据系统的 Matcher 条件,将系统注册到相应的组件ID索引中。\n *\n * Index a system by its interested component types.\n * Registers the system to component ID indices based on its Matcher conditions.\n *\n * @param system 要索引的系统 | The system to index\n */\n indexSystemByComponents(system) {\n const matcher = system.matcher;\n if (!matcher) {\n return;\n }\n // nothing 匹配器不需要索引 | Nothing matcher doesn't need indexing\n if (matcher.isNothing()) {\n return;\n }\n const condition = matcher.getCondition();\n // 有 none/tag/name 条件的系统加入全局通知 | Systems with none/tag/name go to global\n if (condition.none.length > 0 || condition.tag !== undefined || condition.name !== undefined) {\n this._globalNotifySystems.add(system);\n }\n // 空匹配器(匹配所有实体)加入全局通知 | Empty matcher (matches all) goes to global\n if (matcher.isEmpty()) {\n this._globalNotifySystems.add(system);\n return;\n }\n // 索引 all 条件中的组件 | Index components in all condition\n for (const componentType of condition.all) {\n this.addSystemToComponentIndex(componentType, system);\n }\n // 索引 any 条件中的组件 | Index components in any condition\n for (const componentType of condition.any) {\n this.addSystemToComponentIndex(componentType, system);\n }\n // 索引单组件查询 | Index single component query\n if (condition.component) {\n this.addSystemToComponentIndex(condition.component, system);\n }\n }\n /**\n * 将系统添加到指定组件的索引\n *\n * Add system to the index for a specific component type.\n *\n * @param componentType 组件类型 | Component type\n * @param system 系统 | System\n */\n addSystemToComponentIndex(componentType, system) {\n if (!ComponentRegistry.isRegistered(componentType)) {\n ComponentRegistry.register(componentType);\n }\n const componentId = ComponentRegistry.getBitIndex(componentType);\n let systems = this._componentIdToSystems.get(componentId);\n if (!systems) {\n systems = new Set();\n this._componentIdToSystems.set(componentId, systems);\n }\n systems.add(system);\n }\n /**\n * 从组件索引中移除系统\n *\n * Remove a system from all component indices.\n *\n * @param system 要移除的系统 | The system to remove\n */\n removeSystemFromIndex(system) {\n // 从全局通知列表移除 | Remove from global notify list\n this._globalNotifySystems.delete(system);\n // 从所有组件索引中移除 | Remove from all component indices\n for (const systems of this._componentIdToSystems.values()) {\n systems.delete(system);\n }\n }\n /**\n * 在场景的实体列表中添加一个实体\n * @param entity 要添加的实体\n * @param deferCacheClear 是否延迟缓存清理(用于批量操作)\n */\n addEntity(entity, deferCacheClear = false) {\n this.entities.add(entity);\n entity.scene = this;\n // 将实体添加到查询系统(可延迟缓存清理)\n this.querySystem.addEntity(entity, deferCacheClear);\n // 清除系统缓存以确保系统能及时发现新实体\n if (!deferCacheClear) {\n this.clearSystemEntityCaches();\n }\n // 触发实体添加事件\n this.eventSystem.emitSync('entity:added', { entity, scene: this });\n return entity;\n }\n /**\n * 批量创建实体(高性能版本)\n * @param count 要创建的实体数量\n * @param namePrefix 实体名称前缀\n * @returns 创建的实体列表\n */\n createEntities(count, namePrefix = 'Entity') {\n const entities = [];\n // 批量创建实体对象,不立即添加到系统\n for (let i = 0; i < count; i++) {\n const entity = new Entity(`${namePrefix}_${i}`, this.identifierPool.checkOut());\n entity.scene = this;\n entities.push(entity);\n }\n // 批量添加到实体列表\n for (const entity of entities) {\n this.entities.add(entity);\n }\n // 批量添加到查询系统(无重复检查,性能最优)\n this.querySystem.addEntitiesUnchecked(entities);\n // 批量触发事件(可选,减少事件开销)\n this.eventSystem.emitSync('entities:batch_added', { entities, scene: this, count });\n return entities;\n }\n /**\n * 批量销毁实体\n */\n destroyEntities(entities) {\n if (entities.length === 0)\n return;\n for (const entity of entities) {\n entity.setDestroyedState(true);\n }\n for (const entity of entities) {\n entity.removeAllComponents();\n }\n for (const entity of entities) {\n this.entities.remove(entity);\n this.querySystem.removeEntity(entity);\n }\n this.querySystem.clearCache();\n this.clearSystemEntityCaches();\n }\n /**\n * 从场景中删除所有实体\n */\n destroyAllEntities() {\n this.entities.removeAllEntities();\n this.querySystem.setEntities([]);\n }\n /**\n * 搜索并返回第一个具有名称的实体\n * @param name 实体名称\n */\n findEntity(name) {\n return this.entities.findEntity(name);\n }\n /**\n * 根据ID查找实体\n * @param id 实体ID\n */\n findEntityById(id) {\n return this.entities.findEntityById(id);\n }\n /**\n * 根据标签查找实体\n * @param tag 实体标签\n */\n findEntitiesByTag(tag) {\n const result = [];\n for (const entity of this.entities.buffer) {\n if (entity.tag === tag) {\n result.push(entity);\n }\n }\n return result;\n }\n /**\n * 查找所有持久化实体\n *\n * Find all persistent entities in this scene.\n *\n * @returns 持久化实体数组 | Array of persistent entities\n */\n findPersistentEntities() {\n return this.entities.buffer.filter(entity => entity.isPersistent);\n }\n /**\n * 提取持久化实体(从场景中分离但不销毁)\n *\n * 用于场景切换时收集需要迁移的实体。\n *\n * Extract persistent entities (detach from scene without destroying).\n * Used during scene transitions to collect entities for migration.\n *\n * @returns 被提取的持久化实体数组 | Array of extracted persistent entities\n *\n * @internal\n */\n extractPersistentEntities() {\n const persistentEntities = this.findPersistentEntities();\n for (const entity of persistentEntities) {\n // 从实体列表移除\n this.entities.remove(entity);\n // 从查询系统移除\n this.querySystem.removeEntity(entity);\n // 清除场景引用(但保留组件数据)\n entity.scene = null;\n }\n return persistentEntities;\n }\n /**\n * 接收迁移的实体\n *\n * 将从其他场景迁移来的实体添加到当前场景。\n *\n * Receive migrated entities from another scene.\n *\n * @param entities 要接收的实体数组 | Entities to receive\n *\n * @internal\n */\n receiveMigratedEntities(entities) {\n for (const entity of entities) {\n // 设置新场景引用\n entity.scene = this;\n // 添加到实体列表\n this.entities.add(entity);\n // 添加到查询系统\n this.querySystem.addEntity(entity);\n // 重新注册组件到新场景的存储\n for (const component of entity.components) {\n this.componentStorageManager.addComponent(entity.id, component);\n this.referenceTracker?.registerEntityScene(entity.id, this);\n }\n }\n // 清除系统缓存\n if (entities.length > 0) {\n this.clearSystemEntityCaches();\n }\n }\n /**\n * 根据名称查找实体(别名方法)\n *\n * @param name 实体名称\n * @deprecated 请使用 findEntity() 代替此方法\n */\n getEntityByName(name) {\n return this.findEntity(name);\n }\n /**\n * 根据标签查找实体(别名方法)\n *\n * @param tag 实体标签\n * @deprecated 请使用 findEntitiesByTag() 代替此方法\n */\n getEntitiesByTag(tag) {\n return this.findEntitiesByTag(tag);\n }\n /**\n * 查询拥有所有指定组件的实体\n *\n * @param componentTypes - 组件类型数组\n * @returns 查询结果\n *\n * @example\n * ```typescript\n * const result = scene.queryAll(Position, Velocity);\n * for (const entity of result.entities) {\n * const pos = entity.getComponent(Position);\n * const vel = entity.getComponent(Velocity);\n * }\n * ```\n */\n queryAll(...componentTypes) {\n return this.querySystem.queryAll(...componentTypes);\n }\n /**\n * 查询拥有任意一个指定组件的实体\n *\n * @param componentTypes - 组件类型数组\n * @returns 查询结果\n */\n queryAny(...componentTypes) {\n return this.querySystem.queryAny(...componentTypes);\n }\n /**\n * 查询不包含指定组件的实体\n *\n * @param componentTypes - 组件类型数组\n * @returns 查询结果\n */\n queryNone(...componentTypes) {\n return this.querySystem.queryNone(...componentTypes);\n }\n /**\n * 创建类型安全的查询构建器\n *\n * @returns 查询构建器,支持链式调用\n *\n * @example\n * ```typescript\n * // 使用查询构建器\n * const matcher = scene.query()\n * .withAll(Position, Velocity)\n * .withNone(Disabled)\n * .buildMatcher();\n *\n * // 在System中使用\n * class MovementSystem extends EntitySystem {\n * constructor() {\n * super(matcher);\n * }\n * }\n * ```\n */\n query() {\n return new TypedQueryBuilder();\n }\n /**\n * 在场景中添加一个EntitySystem处理器\n *\n * 支持两种使用方式:\n * 1. 传入类型(推荐):自动使用DI创建实例,支持@Injectable和@InjectProperty装饰器\n * 2. 传入实例:直接使用提供的实例\n *\n * @param systemTypeOrInstance 系统类型或系统实例\n * @returns 添加的处理器实例\n *\n * @example\n * ```typescript\n * // 方式1:传入类型,自动DI(推荐)\n * @Injectable()\n * class PhysicsSystem extends EntitySystem {\n * @InjectProperty(CollisionSystem)\n * private collision!: CollisionSystem;\n *\n * constructor() {\n * super(Matcher.empty().all(Transform));\n * }\n * }\n * scene.addEntityProcessor(PhysicsSystem);\n *\n * // 方式2:传入实例\n * const system = new MySystem();\n * scene.addEntityProcessor(system);\n * ```\n */\n addEntityProcessor(systemTypeOrInstance) {\n let system;\n let constructor;\n if (typeof systemTypeOrInstance === 'function') {\n constructor = systemTypeOrInstance;\n if (this._services.isRegistered(constructor)) {\n const existingSystem = this._services.resolve(constructor);\n this.logger.debug(`System ${constructor.name} already registered, returning existing instance`);\n return existingSystem;\n }\n if (isInjectable(constructor)) {\n system = createInstance(constructor, this._services);\n }\n else {\n system = new constructor();\n }\n }\n else {\n system = systemTypeOrInstance;\n constructor = system.constructor;\n if (this._services.isRegistered(constructor)) {\n const existingSystem = this._services.resolve(constructor);\n if (existingSystem === system) {\n this.logger.debug(`System ${constructor.name} instance already registered, returning it`);\n return system;\n }\n else {\n this.logger.warn(`Attempting to register a different instance of ${constructor.name}, ` +\n 'but type is already registered. Returning existing instance.');\n return existingSystem;\n }\n }\n }\n system.scene = this;\n // 分配添加顺序,用于稳定排序 | Assign add order for stable sorting\n system.addOrder = this._systemAddCounter++;\n system.setPerformanceMonitor(this.performanceMonitor);\n const metadata = getSystemMetadata(constructor);\n if (metadata?.updateOrder !== undefined) {\n system.setUpdateOrder(metadata.updateOrder);\n }\n if (metadata?.enabled !== undefined) {\n system.enabled = metadata.enabled;\n }\n this._services.registerInstance(constructor, system);\n // 标记系统列表已变化\n this.markSystemsOrderDirty();\n // 建立组件类型到系统的索引 | Build component type to system index\n this.indexSystemByComponents(system);\n injectProperties(system, this._services);\n // 调试模式下自动包装系统方法以收集性能数据(ProfilerSDK 启用时表示调试模式)\n if (ProfilerSDK.isEnabled()) {\n AutoProfiler.wrapInstance(system, system.systemName, ProfileCategory.ECS);\n }\n system.initialize();\n this.logger.debug(`System ${constructor.name} registered and initialized`);\n return system;\n }\n /**\n * 批量注册EntitySystem到场景(使用DI)\n *\n * 自动按照依赖顺序注册多个System。\n * 所有System必须使用@Injectable装饰器标记。\n *\n * @param systemTypes System类型数组\n * @returns 注册的System实例数组\n *\n * @example\n * ```typescript\n * @Injectable()\n * @ECSSystem('Collision', { updateOrder: 5 })\n * class CollisionSystem extends EntitySystem implements IService {\n * constructor() { super(Matcher.empty().all(Collider)); }\n * dispose() {}\n * }\n *\n * @Injectable()\n * @ECSSystem('Physics', { updateOrder: 10 })\n * class PhysicsSystem extends EntitySystem implements IService {\n * @InjectProperty(CollisionSystem)\n * private collision!: CollisionSystem;\n *\n * constructor() {\n * super(Matcher.empty().all(Transform, RigidBody));\n * }\n * dispose() {}\n * }\n *\n * // 批量注册(自动解析依赖顺序)\n * scene.registerSystems([\n * CollisionSystem,\n * PhysicsSystem, // 自动注入CollisionSystem\n * RenderSystem\n * ]);\n * ```\n */\n registerSystems(systemTypes) {\n const registeredSystems = [];\n for (const systemType of systemTypes) {\n const system = this.addEntityProcessor(systemType);\n registeredSystems.push(system);\n }\n return registeredSystems;\n }\n /**\n * 添加系统到场景(addEntityProcessor的别名)\n * @param system 系统\n */\n addSystem(system) {\n return this.addEntityProcessor(system);\n }\n /**\n * 从场景中删除EntitySystem处理器\n * @param processor 要删除的处理器\n */\n removeEntityProcessor(processor) {\n const constructor = processor.constructor;\n // 从ServiceContainer移除\n this._services.unregister(constructor);\n // 标记系统列表已变化\n this.markSystemsOrderDirty();\n // 从组件类型索引中移除 | Remove from component type index\n this.removeSystemFromIndex(processor);\n // 重置System状态\n processor.reset();\n }\n /**\n * 从场景中删除系统(removeEntityProcessor的别名)\n * @param system 系统\n */\n removeSystem(system) {\n this.removeEntityProcessor(system);\n }\n /**\n * 获取指定类型的EntitySystem处理器\n *\n * @deprecated 推荐使用依赖注入代替此方法。使用 `scene.services.resolve(SystemType)` 或使用 `@InjectProperty(SystemType)` 装饰器。\n *\n * @param type 处理器类型\n * @returns 处理器实例,如果未找到则返回null\n *\n * @example\n * ```typescript\n * @Injectable()\n * class MySystem extends EntitySystem {\n * @InjectProperty(PhysicsSystem)\n * private physics!: PhysicsSystem;\n *\n * constructor() {\n * super(Matcher.empty());\n * }\n * }\n * ```\n */\n getEntityProcessor(type) {\n return this._services.tryResolve(type);\n }\n /**\n * 获取场景统计信息\n */\n getStats() {\n return {\n entityCount: this.entities.count,\n processorCount: this.systems.length,\n componentStorageStats: this.componentStorageManager.getAllStats()\n };\n }\n /**\n * 获取场景的调试信息\n */\n getDebugInfo() {\n const systems = this.systems;\n return {\n name: this.name || this.constructor.name,\n entityCount: this.entities.count,\n processorCount: systems.length,\n isRunning: this._didSceneBegin,\n entities: this.entities.buffer.map((entity) => ({\n name: entity.name,\n id: entity.id,\n componentCount: entity.components.length,\n componentTypes: entity.components.map((c) => getComponentInstanceTypeName(c))\n })),\n processors: systems.map((processor) => ({\n name: getSystemInstanceTypeName(processor),\n updateOrder: processor.updateOrder,\n entityCount: processor.entities.length\n })),\n componentStats: this.componentStorageManager.getAllStats()\n };\n }\n /**\n * 序列化场景\n *\n * 将场景及其所有实体、组件序列化为JSON字符串或二进制Uint8Array\n *\n * @param options 序列化选项\n * @returns 序列化后的数据(JSON字符串或二进制Uint8Array)\n *\n * @example\n * ```typescript\n * // JSON格式\n * const jsonData = scene.serialize({\n * format: 'json',\n * pretty: true\n * });\n *\n * // 二进制格式(更小、更快)\n * const binaryData = scene.serialize({\n * format: 'binary'\n * });\n * ```\n */\n serialize(options) {\n return SceneSerializer.serialize(this, options);\n }\n /**\n * 反序列化场景\n *\n * 从序列化数据恢复场景状态\n *\n * @param saveData 序列化的数据(JSON字符串或二进制Uint8Array)\n * @param options 反序列化选项\n *\n * @example\n * ```typescript\n * // 从JSON恢复(自动从ComponentRegistry获取组件类型)\n * scene.deserialize(jsonData, {\n * strategy: 'replace'\n * });\n *\n * // 从二进制恢复\n * scene.deserialize(binaryData, {\n * strategy: 'replace'\n * });\n * ```\n */\n deserialize(saveData, options) {\n SceneSerializer.deserialize(this, saveData, options);\n }\n /**\n * 创建增量序列化的基础快照\n *\n * 在需要进行增量序列化前,先调用此方法创建基础快照\n *\n * @param options 序列化选项\n *\n * @example\n * ```typescript\n * // 创建基础快照\n * scene.createIncrementalSnapshot();\n *\n * // 进行一些修改...\n * entity.addComponent(new PositionComponent(100, 200));\n *\n * // 计算增量变更\n * const incremental = scene.serializeIncremental();\n * ```\n */\n createIncrementalSnapshot(options) {\n this._incrementalBaseSnapshot = IncrementalSerializer.createSnapshot(this, options);\n }\n /**\n * 增量序列化场景\n *\n * 只序列化相对于基础快照的变更部分\n *\n * @param options 序列化选项\n * @returns 增量快照对象\n *\n * @example\n * ```typescript\n * // 创建基础快照\n * scene.createIncrementalSnapshot();\n *\n * // 修改场景\n * const entity = scene.createEntity('NewEntity');\n * entity.addComponent(new PositionComponent(50, 100));\n *\n * // 获取增量变更\n * const incremental = scene.serializeIncremental();\n * console.log(`变更数量: ${incremental.entityChanges.length}`);\n *\n * // 序列化为JSON\n * const json = IncrementalSerializer.serializeIncremental(incremental);\n * ```\n */\n serializeIncremental(options) {\n if (!this._incrementalBaseSnapshot) {\n throw new Error('必须先调用 createIncrementalSnapshot() 创建基础快照');\n }\n return IncrementalSerializer.computeIncremental(this, this._incrementalBaseSnapshot, options);\n }\n /**\n * 应用增量变更到场景\n *\n * @param incremental 增量快照数据(IncrementalSnapshot对象、JSON字符串或二进制Uint8Array)\n * @param componentRegistry 组件类型注册表(可选,默认使用全局注册表)\n *\n * @example\n * ```typescript\n * // 应用增量变更对象\n * scene.applyIncremental(incrementalSnapshot);\n *\n * // 从JSON字符串应用\n * const jsonData = IncrementalSerializer.serializeIncremental(snapshot, { format: 'json' });\n * scene.applyIncremental(jsonData);\n *\n * // 从二进制Uint8Array应用\n * const binaryData = IncrementalSerializer.serializeIncremental(snapshot, { format: 'binary' });\n * scene.applyIncremental(binaryData);\n * ```\n */\n applyIncremental(incremental, componentRegistry) {\n const isSerializedData = typeof incremental === 'string' || incremental instanceof Uint8Array;\n const snapshot = isSerializedData\n ? IncrementalSerializer.deserializeIncremental(incremental)\n : incremental;\n const registry = componentRegistry || ComponentRegistry.getAllComponentNames();\n IncrementalSerializer.applyIncremental(this, snapshot, registry);\n }\n /**\n * 更新增量快照基准\n *\n * 将当前场景状态设为新的增量序列化基准\n *\n * @param options 序列化选项\n *\n * @example\n * ```typescript\n * // 创建初始快照\n * scene.createIncrementalSnapshot();\n *\n * // 进行一些修改并序列化\n * const incremental1 = scene.serializeIncremental();\n *\n * // 更新基准,之后的增量将基于当前状态\n * scene.updateIncrementalSnapshot();\n *\n * // 继续修改\n * const incremental2 = scene.serializeIncremental();\n * ```\n */\n updateIncrementalSnapshot(options) {\n this.createIncrementalSnapshot(options);\n }\n /**\n * 清除增量快照\n *\n * 释放快照占用的内存\n */\n clearIncrementalSnapshot() {\n this._incrementalBaseSnapshot = undefined;\n }\n /**\n * 检查是否有增量快照\n *\n * @returns 如果已创建增量快照返回true\n */\n hasIncrementalSnapshot() {\n return this._incrementalBaseSnapshot !== undefined;\n }\n}\n//# sourceMappingURL=Scene.js.map","import { Entity } from '../../Entity';\nimport { HierarchySystem } from '../../Systems/HierarchySystem';\n/**\n * 实体构建器 - 提供流式API创建和配置实体\n */\nexport class EntityBuilder {\n constructor(scene, storageManager) {\n this.scene = scene;\n this.storageManager = storageManager;\n const id = scene.identifierPool.checkOut();\n this.entity = new Entity('', id);\n this.entity.scene = this.scene;\n }\n /**\n * 设置实体名称\n * @param name 实体名称\n * @returns 实体构建器\n */\n named(name) {\n this.entity.name = name;\n return this;\n }\n /**\n * 设置实体标签\n * @param tag 标签\n * @returns 实体构建器\n */\n tagged(tag) {\n this.entity.tag = tag;\n return this;\n }\n /**\n * 添加组件\n * @param component 组件实例\n * @returns 实体构建器\n */\n with(component) {\n this.entity.addComponent(component);\n return this;\n }\n /**\n * 添加多个组件\n * @param components 组件数组\n * @returns 实体构建器\n */\n withComponents(...components) {\n for (const component of components) {\n this.entity.addComponent(component);\n }\n return this;\n }\n /**\n * 条件性添加组件\n * @param condition 条件\n * @param component 组件实例\n * @returns 实体构建器\n */\n withIf(condition, component) {\n if (condition) {\n this.entity.addComponent(component);\n }\n return this;\n }\n /**\n * 使用工厂函数创建并添加组件\n * @param factory 组件工厂函数\n * @returns 实体构建器\n */\n withFactory(factory) {\n const component = factory();\n this.entity.addComponent(component);\n return this;\n }\n /**\n * 配置组件属性\n * @param componentType 组件类型\n * @param configurator 配置函数\n * @returns 实体构建器\n */\n configure(componentType, configurator) {\n const component = this.entity.getComponent(componentType);\n if (component) {\n configurator(component);\n }\n return this;\n }\n /**\n * 设置实体为启用状态\n * @param enabled 是否启用\n * @returns 实体构建器\n */\n enabled(enabled = true) {\n this.entity.enabled = enabled;\n return this;\n }\n /**\n * 设置实体为活跃状态\n * @param active 是否活跃\n * @returns 实体构建器\n */\n active(active = true) {\n this.entity.active = active;\n return this;\n }\n /**\n * 添加子实体\n * @param childBuilder 子实体构建器\n * @returns 实体构建器\n */\n withChild(childBuilder) {\n const child = childBuilder.build();\n const hierarchySystem = this.scene.getSystem(HierarchySystem);\n hierarchySystem?.setParent(child, this.entity);\n return this;\n }\n /**\n * 批量添加子实体\n * @param childBuilders 子实体构建器数组\n * @returns 实体构建器\n */\n withChildren(...childBuilders) {\n const hierarchySystem = this.scene.getSystem(HierarchySystem);\n for (const childBuilder of childBuilders) {\n const child = childBuilder.build();\n hierarchySystem?.setParent(child, this.entity);\n }\n return this;\n }\n /**\n * 使用工厂函数创建子实体\n * @param childFactory 子实体工厂函数\n * @returns 实体构建器\n */\n withChildFactory(childFactory) {\n const childBuilder = childFactory(this.entity);\n const child = childBuilder.build();\n const hierarchySystem = this.scene.getSystem(HierarchySystem);\n hierarchySystem?.setParent(child, this.entity);\n return this;\n }\n /**\n * 条件性添加子实体\n * @param condition 条件\n * @param childBuilder 子实体构建器\n * @returns 实体构建器\n */\n withChildIf(condition, childBuilder) {\n if (condition) {\n const child = childBuilder.build();\n const hierarchySystem = this.scene.getSystem(HierarchySystem);\n hierarchySystem?.setParent(child, this.entity);\n }\n return this;\n }\n /**\n * 构建并返回实体\n * @returns 构建的实体\n */\n build() {\n return this.entity;\n }\n /**\n * 构建实体并添加到场景\n * @returns 构建的实体\n */\n spawn() {\n this.scene.addEntity(this.entity);\n return this.entity;\n }\n /**\n * 克隆当前构建器\n * @returns 新的实体构建器\n */\n clone() {\n const newBuilder = new EntityBuilder(this.scene, this.storageManager);\n // 这里需要深度克隆实体,简化实现\n newBuilder.entity = this.entity; // 实际应该是深度克隆\n return newBuilder;\n }\n}\n//# sourceMappingURL=EntityBuilder.js.map","import { Scene } from '../../Scene';\nimport { EntityBuilder } from './EntityBuilder';\n/**\n * 场景构建器 - 提供流式API创建和配置场景\n */\nexport class SceneBuilder {\n constructor() {\n this.scene = new Scene();\n }\n /**\n * 设置场景名称\n * @param name 场景名称\n * @returns 场景构建器\n */\n named(name) {\n this.scene.name = name;\n return this;\n }\n /**\n * 添加实体\n * @param entity 实体\n * @returns 场景构建器\n */\n withEntity(entity) {\n this.scene.addEntity(entity);\n return this;\n }\n /**\n * 使用实体构建器添加实体\n * @param builderFn 实体构建器函数\n * @returns 场景构建器\n */\n withEntityBuilder(builderFn) {\n const builder = new EntityBuilder(this.scene, this.scene.componentStorageManager);\n const configuredBuilder = builderFn(builder);\n const entity = configuredBuilder.build();\n this.scene.addEntity(entity);\n return this;\n }\n /**\n * 批量添加实体\n * @param entities 实体数组\n * @returns 场景构建器\n */\n withEntities(...entities) {\n for (const entity of entities) {\n this.scene.addEntity(entity);\n }\n return this;\n }\n /**\n * 添加系统\n * @param system 系统实例\n * @returns 场景构建器\n */\n withSystem(system) {\n this.scene.addSystem(system);\n return this;\n }\n /**\n * 批量添加系统\n * @param systems 系统数组\n * @returns 场景构建器\n */\n withSystems(...systems) {\n for (const system of systems) {\n this.scene.addSystem(system);\n }\n return this;\n }\n /**\n * 构建并返回场景\n * @returns 构建的场景\n */\n build() {\n return this.scene;\n }\n}\n//# sourceMappingURL=SceneBuilder.js.map","/**\n * 组件构建器 - 提供流式API创建组件\n */\nexport class ComponentBuilder {\n constructor(componentClass, ...args) {\n this.component = new componentClass(...args);\n }\n /**\n * 设置组件属性\n * @param property 属性名\n * @param value 属性值\n * @returns 组件构建器\n */\n set(property, value) {\n this.component[property] = value;\n return this;\n }\n /**\n * 使用配置函数设置组件\n * @param configurator 配置函数\n * @returns 组件构建器\n */\n configure(configurator) {\n configurator(this.component);\n return this;\n }\n /**\n * 条件性设置属性\n * @param condition 条件\n * @param property 属性名\n * @param value 属性值\n * @returns 组件构建器\n */\n setIf(condition, property, value) {\n if (condition) {\n this.component[property] = value;\n }\n return this;\n }\n /**\n * 构建并返回组件\n * @returns 构建的组件\n */\n build() {\n return this.component;\n }\n}\n//# sourceMappingURL=ComponentBuilder.js.map","/**\n * 实体批量操作器\n * 提供对多个实体的批量操作\n */\nexport class EntityBatchOperator {\n constructor(entities) {\n this.entities = entities;\n }\n /**\n * 批量添加组件\n * @param component 组件实例\n * @returns 批量操作器\n */\n addComponent(component) {\n for (const entity of this.entities) {\n entity.addComponent(component);\n }\n return this;\n }\n /**\n * 批量移除组件\n * @param componentType 组件类型\n * @returns 批量操作器\n */\n removeComponent(componentType) {\n for (const entity of this.entities) {\n entity.removeComponentByType(componentType);\n }\n return this;\n }\n /**\n * 批量设置活跃状态\n * @param active 是否活跃\n * @returns 批量操作器\n */\n setActive(active) {\n for (const entity of this.entities) {\n entity.active = active;\n }\n return this;\n }\n /**\n * 批量设置标签\n * @param tag 标签\n * @returns 批量操作器\n */\n setTag(tag) {\n for (const entity of this.entities) {\n entity.tag = tag;\n }\n return this;\n }\n /**\n * 批量执行操作\n * @param operation 操作函数\n * @returns 批量操作器\n */\n forEach(operation) {\n this.entities.forEach(operation);\n return this;\n }\n /**\n * 过滤实体\n * @param predicate 过滤条件\n * @returns 新的批量操作器\n */\n filter(predicate) {\n return new EntityBatchOperator(this.entities.filter(predicate));\n }\n /**\n * 获取实体数组\n * @returns 实体数组\n */\n toArray() {\n return this.entities.slice();\n }\n /**\n * 获取实体数量\n * @returns 实体数量\n */\n count() {\n return this.entities.length;\n }\n}\n//# sourceMappingURL=EntityBatchOperator.js.map","import { QueryBuilder } from '../QuerySystem';\nimport { EntityBuilder } from './EntityBuilder';\nimport { SceneBuilder } from './SceneBuilder';\nimport { ComponentBuilder } from './ComponentBuilder';\nimport { EntityBatchOperator } from './EntityBatchOperator';\n/**\n * ECS流式API主入口\n * 提供统一的流式接口\n */\nexport class ECSFluentAPI {\n constructor(scene, querySystem, eventSystem) {\n this.scene = scene;\n this.querySystem = querySystem;\n this.eventSystem = eventSystem;\n }\n /**\n * 创建实体构建器\n * @returns 实体构建器\n */\n createEntity() {\n return new EntityBuilder(this.scene, this.scene.componentStorageManager);\n }\n /**\n * 创建场景构建器\n * @returns 场景构建器\n */\n createScene() {\n return new SceneBuilder();\n }\n /**\n * 创建组件构建器\n * @param componentClass 组件类\n * @param args 构造参数\n * @returns 组件构建器\n */\n createComponent(componentClass, ...args) {\n return new ComponentBuilder(componentClass, ...args);\n }\n /**\n * 创建查询构建器\n * @returns 查询构建器\n */\n query() {\n return new QueryBuilder(this.querySystem);\n }\n /**\n * 查找实体\n * @param componentTypes 组件类型\n * @returns 实体数组\n */\n find(...componentTypes) {\n return this.querySystem.queryAll(...componentTypes).entities;\n }\n /**\n * 查找第一个匹配的实体\n * @param componentTypes 组件类型\n * @returns 实体或null\n */\n findFirst(...componentTypes) {\n const result = this.querySystem.queryAll(...componentTypes);\n return result.entities.length > 0 ? result.entities[0] : null;\n }\n /**\n * 按名称查找实体\n * @param name 实体名称\n * @returns 实体或null\n */\n findByName(name) {\n return this.scene.findEntity(name);\n }\n /**\n * 按标签查找实体\n * @param tag 标签\n * @returns 实体数组\n */\n findByTag(tag) {\n return this.scene.findEntitiesByTag(tag);\n }\n /**\n * 触发事件\n * @param eventType 事件类型\n * @param event 事件数据\n */\n emit(eventType, event) {\n this.eventSystem.emitSync(eventType, event);\n }\n /**\n * 异步触发事件\n * @param eventType 事件类型\n * @param event 事件数据\n */\n async emitAsync(eventType, event) {\n await this.eventSystem.emit(eventType, event);\n }\n /**\n * 监听事件\n * @param eventType 事件类型\n * @param handler 事件处理器\n * @returns 监听器ID\n */\n on(eventType, handler) {\n return this.eventSystem.on(eventType, handler);\n }\n /**\n * 一次性监听事件\n * @param eventType 事件类型\n * @param handler 事件处理器\n * @returns 监听器ID\n */\n once(eventType, handler) {\n return this.eventSystem.once(eventType, handler);\n }\n /**\n * 移除事件监听器\n * @param eventType 事件类型\n * @param listenerId 监听器ID\n */\n off(eventType, listenerId) {\n this.eventSystem.off(eventType, listenerId);\n }\n /**\n * 批量操作实体\n * @param entities 实体数组\n * @returns 批量操作器\n */\n batch(entities) {\n return new EntityBatchOperator(entities);\n }\n /**\n * 获取场景统计信息\n * @returns 统计信息\n */\n getStats() {\n return {\n entityCount: this.scene.entities.count,\n systemCount: this.scene.systems.length,\n componentStats: this.scene.componentStorageManager.getAllStats(),\n queryStats: this.querySystem.getStats(),\n eventStats: this.eventSystem.getStats()\n };\n }\n}\n/**\n * 创建ECS流式API实例\n * @param scene 场景\n * @param querySystem 查询系统\n * @param eventSystem 事件系统\n * @returns ECS流式API实例\n */\nexport function createECSAPI(scene, querySystem, eventSystem) {\n return new ECSFluentAPI(scene, querySystem, eventSystem);\n}\n/**\n * 全局ECS流式API实例(需要在使用前初始化)\n */\nexport let ECS;\n/**\n * 初始化全局ECS API\n * @param scene 场景\n * @param querySystem 查询系统\n * @param eventSystem 事件系统\n */\nexport function initializeECS(scene, querySystem, eventSystem) {\n ECS = createECSAPI(scene, querySystem, eventSystem);\n}\n//# sourceMappingURL=ECSFluentAPI.js.map","import { Scene } from './Scene';\nimport { createLogger } from '../Utils/Logger';\nimport { PerformanceMonitor } from '../Utils/PerformanceMonitor';\nimport { ServiceContainer } from '../Core/ServiceContainer';\nconst logger = createLogger('World');\n/**\n * World类 - ECS世界管理器\n *\n * World是Scene的容器,每个World可以管理多个Scene。\n * World拥有独立的服务容器,用于管理World级别的全局服务。\n *\n * 服务容器层级:\n * - Core.services: 应用程序全局服务\n * - World.services: World级别服务(每个World独立)\n * - Scene.services: Scene级别服务(每个Scene独立)\n *\n * 这种设计允许创建独立的游戏世界,如:\n * - 游戏房间(每个房间一个World)\n * - 不同的游戏模式\n * - 独立的模拟环境\n *\n * @example\n * ```typescript\n * // 创建游戏房间的World\n * const roomWorld = new World({ name: 'Room_001' });\n *\n * // 注册World级别的服务\n * roomWorld.services.registerSingleton(RoomManager);\n *\n * // 在World中创建Scene\n * const gameScene = roomWorld.createScene('game', new Scene());\n * const uiScene = roomWorld.createScene('ui', new Scene());\n *\n * // 在Scene中使用World级别的服务\n * const roomManager = roomWorld.services.resolve(RoomManager);\n *\n * // 更新整个World\n * roomWorld.update(deltaTime);\n * ```\n */\nexport class World {\n constructor(config = {}) {\n this._scenes = new Map();\n this._activeScenes = new Set();\n this._globalSystems = [];\n this._isActive = false;\n this._config = {\n name: 'World',\n debug: false,\n maxScenes: 10,\n autoCleanup: true,\n ...config\n };\n this.name = this._config.name;\n this._createdAt = Date.now();\n this._services = new ServiceContainer();\n }\n /**\n * World级别的服务容器\n * 用于管理World范围内的全局服务\n */\n get services() {\n return this._services;\n }\n /**\n * 创建并添加Scene到World\n */\n createScene(sceneName, sceneInstance) {\n if (!sceneName || typeof sceneName !== 'string' || sceneName.trim() === '') {\n throw new Error('Scene name不能为空');\n }\n if (this._scenes.has(sceneName)) {\n throw new Error(`Scene name '${sceneName}' 已存在于World '${this.name}' 中`);\n }\n if (this._scenes.size >= this._config.maxScenes) {\n throw new Error(`World '${this.name}' 已达到最大Scene数量限制: ${this._config.maxScenes}`);\n }\n // 如果没有提供Scene实例,创建默认Scene\n const scene = sceneInstance || new Scene();\n // 如果配置了 debug,为 Scene 注册并启用 PerformanceMonitor\n if (this._config.debug) {\n const performanceMonitor = new PerformanceMonitor();\n performanceMonitor.enable();\n scene.services.registerInstance(PerformanceMonitor, performanceMonitor);\n }\n // 设置Scene的标识\n if ('id' in scene) {\n scene.id = sceneName;\n }\n if ('name' in scene && !scene.name) {\n scene.name = sceneName;\n }\n this._scenes.set(sceneName, scene);\n // 初始化Scene\n scene.initialize();\n return scene;\n }\n /**\n * 移除Scene\n */\n removeScene(sceneName) {\n const scene = this._scenes.get(sceneName);\n if (!scene) {\n return false;\n }\n // 如果Scene正在运行,先停止它\n if (this._activeScenes.has(sceneName)) {\n this.setSceneActive(sceneName, false);\n }\n // 清理Scene资源\n scene.end();\n this._scenes.delete(sceneName);\n logger.info(`从World '${this.name}' 中移除Scene: ${sceneName}`);\n return true;\n }\n /**\n * 获取Scene\n */\n getScene(sceneName) {\n return this._scenes.get(sceneName) || null;\n }\n /**\n * 获取所有Scene ID\n */\n getSceneIds() {\n return Array.from(this._scenes.keys());\n }\n /**\n * 获取所有Scene\n */\n getAllScenes() {\n return Array.from(this._scenes.values());\n }\n /**\n * 移除所有Scene\n */\n removeAllScenes() {\n const sceneNames = Array.from(this._scenes.keys());\n for (const sceneName of sceneNames) {\n this.removeScene(sceneName);\n }\n logger.info(`从World '${this.name}' 中移除所有Scene`);\n }\n /**\n * 设置Scene激活状态\n */\n setSceneActive(sceneName, active) {\n const scene = this._scenes.get(sceneName);\n if (!scene) {\n logger.warn(`Scene '${sceneName}' 不存在于World '${this.name}' 中`);\n return;\n }\n if (active) {\n this._activeScenes.add(sceneName);\n // 启动Scene\n if (scene.begin) {\n scene.begin();\n }\n logger.debug(`在World '${this.name}' 中激活Scene: ${sceneName}`);\n }\n else {\n this._activeScenes.delete(sceneName);\n // 可选择性地停止Scene,或者让它继续运行但不更新\n logger.debug(`在World '${this.name}' 中停用Scene: ${sceneName}`);\n }\n }\n /**\n * 检查Scene是否激活\n */\n isSceneActive(sceneName) {\n return this._activeScenes.has(sceneName);\n }\n /**\n * 获取活跃Scene数量\n */\n getActiveSceneCount() {\n return this._activeScenes.size;\n }\n /**\n * 添加全局System\n * 全局System会在所有激活Scene之前更新\n */\n addGlobalSystem(system) {\n if (this._globalSystems.includes(system)) {\n return system;\n }\n this._globalSystems.push(system);\n if (system.initialize) {\n system.initialize();\n }\n logger.debug(`在World '${this.name}' 中添加全局System: ${system.name}`);\n return system;\n }\n /**\n * 移除全局System\n */\n removeGlobalSystem(system) {\n const index = this._globalSystems.indexOf(system);\n if (index === -1) {\n return false;\n }\n this._globalSystems.splice(index, 1);\n if (system.reset) {\n system.reset();\n }\n logger.debug(`从World '${this.name}' 中移除全局System: ${system.name}`);\n return true;\n }\n /**\n * 获取全局System\n */\n getGlobalSystem(type) {\n for (const system of this._globalSystems) {\n if (system instanceof type) {\n return system;\n }\n }\n return null;\n }\n /**\n * 启动World\n */\n start() {\n if (this._isActive) {\n return;\n }\n this._isActive = true;\n // 启动所有全局System\n for (const system of this._globalSystems) {\n if (system.initialize) {\n system.initialize();\n }\n }\n logger.info(`启动World: ${this.name}`);\n }\n /**\n * 停止World\n */\n stop() {\n if (!this._isActive) {\n return;\n }\n // 停止所有Scene\n for (const sceneName of this._activeScenes) {\n this.setSceneActive(sceneName, false);\n }\n // 重置所有全局System\n for (const system of this._globalSystems) {\n if (system.reset) {\n system.reset();\n }\n }\n this._isActive = false;\n logger.info(`停止World: ${this.name}`);\n }\n /**\n * 更新World中的全局System\n * 注意:此方法由Core.update()调用,不应直接调用\n */\n updateGlobalSystems() {\n if (!this._isActive) {\n return;\n }\n // 更新全局System\n for (const system of this._globalSystems) {\n if (system.update) {\n system.update();\n }\n }\n }\n /**\n * 更新World中的所有激活Scene\n * 注意:此方法由Core.update()调用,不应直接调用\n */\n updateScenes() {\n if (!this._isActive) {\n return;\n }\n // 更新所有激活的Scene\n for (const sceneName of this._activeScenes) {\n const scene = this._scenes.get(sceneName);\n if (scene && scene.update) {\n scene.update();\n }\n }\n // 自动清理(如果启用)\n if (this._config.autoCleanup && this.shouldAutoCleanup()) {\n this.cleanup();\n }\n }\n /**\n * 销毁World\n */\n destroy() {\n logger.info(`销毁World: ${this.name}`);\n // 停止World\n this.stop();\n // 销毁所有Scene\n const sceneNames = Array.from(this._scenes.keys());\n for (const sceneName of sceneNames) {\n this.removeScene(sceneName);\n }\n // 清理全局System\n for (const system of this._globalSystems) {\n if (system.destroy) {\n system.destroy();\n }\n else if (system.reset) {\n system.reset();\n }\n }\n this._globalSystems.length = 0;\n // 清空服务容器\n this._services.clear();\n this._scenes.clear();\n this._activeScenes.clear();\n }\n /**\n * 获取World状态\n */\n getStatus() {\n return {\n name: this.name,\n isActive: this._isActive,\n sceneCount: this._scenes.size,\n activeSceneCount: this._activeScenes.size,\n globalSystemCount: this._globalSystems.length,\n createdAt: this._createdAt,\n config: { ...this._config },\n scenes: Array.from(this._scenes.keys()).map((sceneName) => ({\n id: sceneName,\n isActive: this._activeScenes.has(sceneName),\n name: this._scenes.get(sceneName)?.name || sceneName\n }))\n };\n }\n /**\n * 获取World统计信息\n */\n getStats() {\n const stats = {\n totalEntities: 0,\n totalSystems: this._globalSystems.length,\n memoryUsage: 0,\n performance: {\n averageUpdateTime: 0,\n maxUpdateTime: 0\n }\n };\n // 统计所有Scene的实体数量\n for (const scene of this._scenes.values()) {\n if (scene.entities) {\n stats.totalEntities += scene.entities.count;\n }\n if (scene.systems) {\n stats.totalSystems += scene.systems.length;\n }\n }\n return stats;\n }\n /**\n * 检查是否应该执行自动清理\n */\n shouldAutoCleanup() {\n // 简单的清理策略:如果有空Scene且超过5分钟没有实体\n const currentTime = Date.now();\n const cleanupThreshold = 5 * 60 * 1000; // 5分钟\n for (const [sceneName, scene] of this._scenes) {\n if (!this._activeScenes.has(sceneName) &&\n scene.entities &&\n scene.entities.count === 0 &&\n (currentTime - this._createdAt) > cleanupThreshold) {\n return true;\n }\n }\n return false;\n }\n /**\n * 执行清理操作\n */\n cleanup() {\n const sceneNames = Array.from(this._scenes.keys());\n const currentTime = Date.now();\n const cleanupThreshold = 5 * 60 * 1000; // 5分钟\n for (const sceneName of sceneNames) {\n const scene = this._scenes.get(sceneName);\n if (scene &&\n !this._activeScenes.has(sceneName) &&\n scene.entities &&\n scene.entities.count === 0 &&\n (currentTime - this._createdAt) > cleanupThreshold) {\n this.removeScene(sceneName);\n logger.debug(`自动清理空Scene: ${sceneName} from World ${this.name}`);\n }\n }\n }\n /**\n * 检查World是否激活\n */\n get isActive() {\n return this._isActive;\n }\n /**\n * 获取Scene数量\n */\n get sceneCount() {\n return this._scenes.size;\n }\n /**\n * 获取创建时间\n */\n get createdAt() {\n return this._createdAt;\n }\n}\n//# sourceMappingURL=World.js.map","/**\n * 插件状态\n */\nexport var PluginState;\n(function (PluginState) {\n /**\n * 未安装\n */\n PluginState[\"NotInstalled\"] = \"not_installed\";\n /**\n * 已安装\n */\n PluginState[\"Installed\"] = \"installed\";\n /**\n * 安装失败\n */\n PluginState[\"Failed\"] = \"failed\";\n})(PluginState || (PluginState = {}));\n//# sourceMappingURL=Plugin.js.map","import { Scene } from './Scene';\nimport { createECSAPI } from './Core/FluentAPI';\nimport { Time } from '../Utils/Time';\nimport { createLogger } from '../Utils/Logger';\nimport { World } from './World';\nimport { PerformanceMonitor } from '../Utils/PerformanceMonitor';\n/**\n * 单场景管理器\n *\n * 适用场景:\n * - 单人游戏\n * - 简单场景切换\n * - 不需要多World隔离的项目\n *\n * 特点:\n * - 轻量级,零额外开销\n * - 简单直观的API\n * - 支持延迟场景切换\n * - 自动管理ECS API\n *\n * @example\n * ```typescript\n * // 初始化Core\n * Core.create({ debug: true });\n *\n * // 创建场景管理器\n * const sceneManager = new SceneManager();\n *\n * // 设置场景\n * class GameScene extends Scene {\n * initialize() {\n * const player = this.createEntity('Player');\n * player.addComponent(new Transform(100, 100));\n * }\n * }\n *\n * sceneManager.setScene(new GameScene());\n *\n * // 游戏循环\n * function gameLoop(deltaTime: number) {\n * Core.update(deltaTime); // 更新全局服务\n * sceneManager.update(); // 更新场景\n * }\n *\n * // 延迟切换场景(下一帧生效)\n * sceneManager.loadScene(new MenuScene());\n * ```\n */\nexport class SceneManager {\n constructor(performanceMonitor) {\n /**\n * 待切换的下一个场景(延迟切换用)\n */\n this._nextScene = null;\n /**\n * ECS流式API\n */\n this._ecsAPI = null;\n /**\n * 日志器\n */\n this._logger = createLogger('SceneManager');\n /**\n * 性能监控器(从 Core 注入)\n */\n this._performanceMonitor = null;\n /**\n * 待迁移的持久化实体\n *\n * Pending persistent entities for migration.\n */\n this._pendingPersistentEntities = [];\n this._defaultWorld = new World({ name: '__default__' });\n this._defaultWorld.start();\n this._performanceMonitor = performanceMonitor || null;\n }\n /**\n * 设置场景切换回调\n *\n * @param callback 场景切换时的回调函数\n * @internal\n */\n setSceneChangedCallback(callback) {\n this._onSceneChangedCallback = callback;\n }\n /**\n * 设置当前场景(立即切换)\n *\n * 会自动处理旧场景的结束和新场景的初始化。\n * 持久化实体会自动迁移到新场景。\n *\n * Set current scene (immediate transition).\n * Automatically handles old scene cleanup and new scene initialization.\n * Persistent entities are automatically migrated to the new scene.\n *\n * @param scene - 要设置的场景实例 | Scene instance to set\n * @returns 返回设置的场景实例,便于链式调用 | Returns the scene for chaining\n *\n * @example\n * ```typescript\n * const gameScene = sceneManager.setScene(new GameScene());\n * console.log(gameScene.name);\n * ```\n */\n setScene(scene) {\n // 从当前场景提取持久化实体\n const currentScene = this.currentScene;\n if (currentScene && currentScene instanceof Scene) {\n this._pendingPersistentEntities = currentScene.extractPersistentEntities();\n if (this._pendingPersistentEntities.length > 0) {\n this._logger.debug(`Extracted ${this._pendingPersistentEntities.length} persistent entities for migration`);\n }\n }\n // 移除旧场景\n this._defaultWorld.removeAllScenes();\n // 注册全局 PerformanceMonitor 到 Scene 的 ServiceContainer\n if (this._performanceMonitor) {\n scene.services.registerInstance(PerformanceMonitor, this._performanceMonitor);\n }\n // 通过 World 创建新场景\n this._defaultWorld.createScene(SceneManager.DEFAULT_SCENE_ID, scene);\n this._defaultWorld.setSceneActive(SceneManager.DEFAULT_SCENE_ID, true);\n // 迁移持久化实体到新场景\n if (this._pendingPersistentEntities.length > 0 && scene instanceof Scene) {\n scene.receiveMigratedEntities(this._pendingPersistentEntities);\n this._logger.debug(`Migrated ${this._pendingPersistentEntities.length} persistent entities to new scene`);\n this._pendingPersistentEntities = [];\n }\n // 重建ECS API\n if (scene.querySystem && scene.eventSystem) {\n this._ecsAPI = createECSAPI(scene, scene.querySystem, scene.eventSystem);\n }\n else {\n this._ecsAPI = null;\n }\n // 触发场景切换回调\n Time.sceneChanged();\n // 通知调试管理器(通过回调)\n if (this._onSceneChangedCallback) {\n this._onSceneChangedCallback();\n }\n this._logger.info(`Scene changed to: ${scene.name}`);\n return scene;\n }\n /**\n * 延迟加载场景(下一帧切换)\n *\n * 场景不会立即切换,而是在下一次调用 update() 时切换。\n * 这对于避免在当前帧的中途切换场景很有用。\n *\n * @param scene - 要加载的场景实例\n *\n * @example\n * ```typescript\n * // 在某个System中触发场景切换\n * class GameOverSystem extends EntitySystem {\n * process(entities: readonly Entity[]) {\n * if (playerHealth <= 0) {\n * sceneManager.loadScene(new GameOverScene());\n * // 当前帧继续执行,场景将在下一帧切换\n * }\n * }\n * }\n * ```\n */\n loadScene(scene) {\n this._nextScene = scene;\n this._logger.info(`Scheduled scene load: ${scene.name}`);\n }\n /**\n * 获取当前活跃的场景\n *\n * @returns 当前场景实例,如果没有场景则返回null\n */\n get currentScene() {\n return this._defaultWorld.getScene(SceneManager.DEFAULT_SCENE_ID);\n }\n /**\n * 获取ECS流式API\n *\n * 提供便捷的实体查询、事件发射等功能。\n *\n * @returns ECS API实例,如果当前没有场景则返回null\n *\n * @example\n * ```typescript\n * const api = sceneManager.api;\n * if (api) {\n * // 查询所有敌人\n * const enemies = api.find(Enemy, Transform);\n *\n * // 发射事件\n * api.emit('game:start', { level: 1 });\n * }\n * ```\n */\n get api() {\n return this._ecsAPI;\n }\n /**\n * 更新场景\n *\n * 应该在每帧的游戏循环中调用。\n * 会自动处理延迟场景切换。\n *\n * @example\n * ```typescript\n * function gameLoop(deltaTime: number) {\n * Core.update(deltaTime);\n * sceneManager.update(); // 每帧调用\n * }\n * ```\n */\n update() {\n // 处理延迟场景切换\n if (this._nextScene) {\n this.setScene(this._nextScene);\n this._nextScene = null;\n }\n // 通过 World 统一更新\n this._defaultWorld.updateGlobalSystems();\n this._defaultWorld.updateScenes();\n }\n /**\n * 销毁场景管理器\n *\n * 会自动结束当前场景并清理所有资源。\n * 通常在应用程序关闭时调用。\n */\n destroy() {\n this._logger.info('SceneManager destroying');\n this._defaultWorld.destroy();\n this._nextScene = null;\n this._ecsAPI = null;\n this._logger.info('SceneManager destroyed');\n }\n /**\n * 检查是否有活跃场景\n *\n * @returns 如果有活跃场景返回true,否则返回false\n */\n get hasScene() {\n return this._defaultWorld.getScene(SceneManager.DEFAULT_SCENE_ID) !== null;\n }\n /**\n * 检查是否有待切换的场景\n *\n * @returns 如果有待切换场景返回true,否则返回false\n */\n get hasPendingScene() {\n return this._nextScene !== null;\n }\n /**\n * 释放资源(IService接口)\n */\n dispose() {\n this.destroy();\n }\n}\n/**\n * 默认场景ID\n */\nSceneManager.DEFAULT_SCENE_ID = '__main__';\n//# sourceMappingURL=SceneManager.js.map","import { __decorate, __metadata } from \"tslib\";\nimport { Injectable } from '../../Core/DI/Decorators';\n/**\n * 调试配置服务\n *\n * 管理调试系统的配置信息\n */\nlet DebugConfigService = class DebugConfigService {\n constructor() {\n this._config = {\n enabled: false,\n websocketUrl: '',\n debugFrameRate: 30,\n autoReconnect: true,\n channels: {\n entities: true,\n systems: true,\n performance: true,\n components: true,\n scenes: true\n }\n };\n }\n setConfig(config) {\n this._config = config;\n }\n getConfig() {\n return this._config;\n }\n isEnabled() {\n return this._config.enabled;\n }\n dispose() {\n // 清理资源\n }\n};\nDebugConfigService = __decorate([\n Injectable(),\n __metadata(\"design:paramtypes\", [])\n], DebugConfigService);\nexport { DebugConfigService };\n//# sourceMappingURL=DebugConfigService.js.map","import { __decorate, __metadata } from \"tslib\";\nimport { EntityDataCollector } from './EntityDataCollector';\nimport { SystemDataCollector } from './SystemDataCollector';\nimport { PerformanceDataCollector } from './PerformanceDataCollector';\nimport { ComponentDataCollector } from './ComponentDataCollector';\nimport { SceneDataCollector } from './SceneDataCollector';\nimport { AdvancedProfilerCollector } from './AdvancedProfilerCollector';\nimport { WebSocketManager } from './WebSocketManager';\nimport { ComponentPoolManager } from '../../ECS/Core/ComponentPool';\nimport { Pool } from '../../Utils/Pool';\nimport { getComponentInstanceTypeName, getSystemInstanceTypeName } from '../../ECS/Decorators';\nimport { SceneManager } from '../../ECS/SceneManager';\nimport { PerformanceMonitor } from '../PerformanceMonitor';\nimport { Injectable, InjectProperty, Updatable } from '../../Core/DI/Decorators';\nimport { DebugConfigService } from './DebugConfigService';\nimport { ProfilerSDK } from '../Profiler/ProfilerSDK';\n/**\n * 调试管理器\n *\n * 整合所有调试数据收集器,负责收集和发送调试数据\n */\nlet DebugManager = class DebugManager {\n constructor() {\n this.frameCounter = 0;\n this.lastSendTime = 0;\n this.sendInterval = 0;\n this.isRunning = false;\n this.originalConsole = {\n log: console.log.bind(console),\n debug: console.debug.bind(console),\n info: console.info.bind(console),\n warn: console.warn.bind(console),\n error: console.error.bind(console)\n };\n }\n onInitialize() {\n this.config = this.configService.getConfig();\n // 初始化数据收集器\n this.entityCollector = new EntityDataCollector();\n this.systemCollector = new SystemDataCollector();\n this.performanceCollector = new PerformanceDataCollector();\n this.componentCollector = new ComponentDataCollector();\n this.sceneCollector = new SceneDataCollector();\n this.advancedProfilerCollector = new AdvancedProfilerCollector();\n // 启用高级性能分析器\n ProfilerSDK.setEnabled(true);\n // 初始化WebSocket管理器\n this.webSocketManager = new WebSocketManager(this.config.websocketUrl, this.config.autoReconnect !== false);\n // 设置消息处理回调\n this.webSocketManager.setMessageHandler(this.handleMessage.bind(this));\n // 计算发送间隔(基于帧率)\n const debugFrameRate = this.config.debugFrameRate || 30;\n this.sendInterval = 1000 / debugFrameRate;\n // 拦截 console 日志\n this.interceptConsole();\n this.start();\n }\n /**\n * 启动调试管理器\n */\n start() {\n if (this.isRunning)\n return;\n this.isRunning = true;\n this.connectWebSocket();\n }\n /**\n * 停止调试管理器\n */\n stop() {\n if (!this.isRunning)\n return;\n this.isRunning = false;\n this.webSocketManager.disconnect();\n }\n /**\n * 拦截 console 日志并转发到编辑器\n */\n interceptConsole() {\n console.log = (...args) => {\n this.sendLog('info', this.formatLogMessage(args));\n this.originalConsole.log(...args);\n };\n console.debug = (...args) => {\n this.sendLog('debug', this.formatLogMessage(args));\n this.originalConsole.debug(...args);\n };\n console.info = (...args) => {\n this.sendLog('info', this.formatLogMessage(args));\n this.originalConsole.info(...args);\n };\n console.warn = (...args) => {\n this.sendLog('warn', this.formatLogMessage(args));\n this.originalConsole.warn(...args);\n };\n console.error = (...args) => {\n this.sendLog('error', this.formatLogMessage(args));\n this.originalConsole.error(...args);\n };\n }\n /**\n * 格式化日志消息\n */\n formatLogMessage(args) {\n return args.map((arg) => {\n if (typeof arg === 'string')\n return arg;\n if (arg instanceof Error)\n return `${arg.name}: ${arg.message}`;\n if (arg === null)\n return 'null';\n if (arg === undefined)\n return 'undefined';\n if (typeof arg === 'object') {\n try {\n return this.safeStringify(arg, 6);\n }\n catch {\n return Object.prototype.toString.call(arg);\n }\n }\n return String(arg);\n }).join(' ');\n }\n /**\n * 安全的 JSON 序列化,支持循环引用和深度限制\n */\n safeStringify(obj, maxDepth = 6) {\n const seen = new WeakSet();\n const stringify = (value, depth) => {\n if (value === null)\n return null;\n if (value === undefined)\n return undefined;\n if (typeof value !== 'object')\n return value;\n if (depth >= maxDepth) {\n return '[Max Depth Reached]';\n }\n if (seen.has(value)) {\n return '[Circular]';\n }\n seen.add(value);\n if (Array.isArray(value)) {\n const result = value.map((item) => stringify(item, depth + 1));\n seen.delete(value);\n return result;\n }\n const result = {};\n for (const key in value) {\n if (Object.prototype.hasOwnProperty.call(value, key)) {\n result[key] = stringify(value[key], depth + 1);\n }\n }\n seen.delete(value);\n return result;\n };\n return JSON.stringify(stringify(obj, 0));\n }\n /**\n * 发送日志到编辑器\n */\n sendLog(level, message) {\n if (!this.webSocketManager.getConnectionStatus()) {\n return;\n }\n try {\n this.webSocketManager.send({\n type: 'log',\n data: {\n level,\n message,\n timestamp: new Date().toISOString()\n }\n });\n }\n catch (error) {\n // 静默失败,避免递归日志\n }\n }\n /**\n * 更新配置\n */\n updateConfig(config) {\n this.config = config;\n // 更新发送间隔\n const debugFrameRate = config.debugFrameRate || 30;\n this.sendInterval = 1000 / debugFrameRate;\n // 重新连接WebSocket(如果URL变化)\n if (this.webSocketManager && config.websocketUrl) {\n this.webSocketManager.disconnect();\n this.webSocketManager = new WebSocketManager(config.websocketUrl, config.autoReconnect !== false);\n this.webSocketManager.setMessageHandler(this.handleMessage.bind(this));\n this.connectWebSocket();\n }\n }\n update(_deltaTime) {\n if (!this.isRunning || !this.config.enabled)\n return;\n this.frameCounter++;\n const currentTime = Date.now();\n if (currentTime - this.lastSendTime >= this.sendInterval) {\n this.sendDebugData();\n this.lastSendTime = currentTime;\n }\n }\n /**\n * 场景变更回调\n */\n onSceneChanged() {\n // 场景变更时立即发送一次数据\n if (this.isRunning && this.config.enabled) {\n this.sendDebugData();\n }\n }\n /**\n * 处理来自调试面板的消息\n */\n handleMessage(message) {\n try {\n switch (message.type) {\n case 'capture_memory_snapshot':\n this.handleMemorySnapshotRequest();\n break;\n case 'config_update':\n if (message.config) {\n this.updateConfig({ ...this.config, ...message.config });\n }\n break;\n case 'expand_lazy_object':\n this.handleExpandLazyObjectRequest(message);\n break;\n case 'get_component_properties':\n this.handleGetComponentPropertiesRequest(message);\n break;\n case 'get_raw_entity_list':\n this.handleGetRawEntityListRequest(message);\n break;\n case 'get_entity_details':\n this.handleGetEntityDetailsRequest(message);\n break;\n case 'get_advanced_profiler_data':\n this.handleGetAdvancedProfilerDataRequest(message);\n break;\n case 'set_profiler_selected_function':\n this.handleSetProfilerSelectedFunction(message);\n break;\n case 'ping':\n this.webSocketManager.send({\n type: 'pong',\n timestamp: Date.now()\n });\n break;\n default:\n // 未知消息类型,忽略\n break;\n }\n }\n catch (error) {\n // console.error('[ECS Debug] 处理消息失败:', error);\n if (message.requestId) {\n this.webSocketManager.send({\n type: 'error_response',\n requestId: message.requestId,\n error: error instanceof Error ? error.message : String(error)\n });\n }\n }\n }\n /**\n * 处理展开懒加载对象请求\n */\n handleExpandLazyObjectRequest(message) {\n try {\n const { entityId, componentIndex, propertyPath, requestId } = message;\n if (entityId === undefined || componentIndex === undefined || !propertyPath) {\n this.webSocketManager.send({\n type: 'expand_lazy_object_response',\n requestId,\n error: '缺少必要参数'\n });\n return;\n }\n const scene = this.sceneManager.currentScene;\n const expandedData = this.entityCollector.expandLazyObject(entityId, componentIndex, propertyPath, scene);\n this.webSocketManager.send({\n type: 'expand_lazy_object_response',\n requestId,\n data: expandedData\n });\n }\n catch (error) {\n this.webSocketManager.send({\n type: 'expand_lazy_object_response',\n requestId: message.requestId,\n error: error instanceof Error ? error.message : String(error)\n });\n }\n }\n /**\n * 处理获取组件属性请求\n */\n handleGetComponentPropertiesRequest(message) {\n try {\n const { entityId, componentIndex, requestId } = message;\n if (entityId === undefined || componentIndex === undefined) {\n this.webSocketManager.send({\n type: 'get_component_properties_response',\n requestId,\n error: '缺少必要参数'\n });\n return;\n }\n const scene = this.sceneManager.currentScene;\n const properties = this.entityCollector.getComponentProperties(entityId, componentIndex, scene);\n this.webSocketManager.send({\n type: 'get_component_properties_response',\n requestId,\n data: properties\n });\n }\n catch (error) {\n this.webSocketManager.send({\n type: 'get_component_properties_response',\n requestId: message.requestId,\n error: error instanceof Error ? error.message : String(error)\n });\n }\n }\n /**\n * 处理获取原始实体列表请求\n */\n handleGetRawEntityListRequest(message) {\n try {\n const { requestId } = message;\n const scene = this.sceneManager.currentScene;\n const rawEntityList = this.entityCollector.getRawEntityList(scene);\n this.webSocketManager.send({\n type: 'get_raw_entity_list_response',\n requestId,\n data: rawEntityList\n });\n }\n catch (error) {\n this.webSocketManager.send({\n type: 'get_raw_entity_list_response',\n requestId: message.requestId,\n error: error instanceof Error ? error.message : String(error)\n });\n }\n }\n /**\n * 处理获取实体详情请求\n */\n handleGetEntityDetailsRequest(message) {\n try {\n const { entityId, requestId } = message;\n if (entityId === undefined) {\n this.webSocketManager.send({\n type: 'get_entity_details_response',\n requestId,\n error: '缺少实体ID参数'\n });\n return;\n }\n const scene = this.sceneManager.currentScene;\n const entityDetails = this.entityCollector.getEntityDetails(entityId, scene);\n this.webSocketManager.send({\n type: 'get_entity_details_response',\n requestId,\n data: entityDetails\n });\n }\n catch (error) {\n this.webSocketManager.send({\n type: 'get_entity_details_response',\n requestId: message.requestId,\n error: error instanceof Error ? error.message : String(error)\n });\n }\n }\n /**\n * 处理获取高级性能分析数据请求\n */\n handleGetAdvancedProfilerDataRequest(message) {\n try {\n const { requestId } = message;\n // 收集高级性能数据\n const advancedData = ProfilerSDK.isEnabled()\n ? this.advancedProfilerCollector.collectAdvancedData(this.performanceMonitor)\n : this.advancedProfilerCollector.collectFromLegacyMonitor(this.performanceMonitor);\n this.webSocketManager.send({\n type: 'get_advanced_profiler_data_response',\n requestId,\n data: advancedData\n });\n }\n catch (error) {\n this.webSocketManager.send({\n type: 'get_advanced_profiler_data_response',\n requestId: message.requestId,\n error: error instanceof Error ? error.message : String(error)\n });\n }\n }\n /**\n * 处理设置性能分析器选中函数请求\n */\n handleSetProfilerSelectedFunction(message) {\n try {\n const { functionName, requestId } = message;\n this.advancedProfilerCollector.setSelectedFunction(functionName || null);\n // 立即发送更新的数据,无需等待下一帧\n this.sendDebugData();\n this.webSocketManager.send({\n type: 'set_profiler_selected_function_response',\n requestId,\n success: true\n });\n }\n catch (error) {\n this.webSocketManager.send({\n type: 'set_profiler_selected_function_response',\n requestId: message.requestId,\n error: error instanceof Error ? error.message : String(error)\n });\n }\n }\n /**\n * 处理内存快照请求\n */\n handleMemorySnapshotRequest() {\n try {\n const memorySnapshot = this.captureMemorySnapshot();\n this.webSocketManager.send({\n type: 'memory_snapshot_response',\n data: memorySnapshot\n });\n }\n catch (error) {\n this.webSocketManager.send({\n type: 'memory_snapshot_error',\n error: error instanceof Error ? error.message : '内存快照捕获失败'\n });\n }\n }\n /**\n * 捕获内存快照\n */\n captureMemorySnapshot() {\n const timestamp = Date.now();\n // 收集其他内存统计\n const baseMemoryInfo = this.collectBaseMemoryInfo();\n const scene = this.sceneManager.currentScene;\n // 使用专门的内存计算方法收集实体数据\n const entityData = this.entityCollector.collectEntityDataWithMemory(scene);\n const componentMemoryStats = scene?.entities ? this.collectComponentMemoryStats(scene.entities) : { totalMemory: 0, componentTypes: 0, totalInstances: 0, breakdown: [] };\n const systemMemoryStats = this.collectSystemMemoryStats();\n const poolMemoryStats = this.collectPoolMemoryStats();\n const performanceStats = this.collectPerformanceStats();\n // 计算总内存使用量\n const totalEntityMemory = entityData.entitiesPerArchetype.reduce((sum, arch) => sum + arch.memory, 0);\n return {\n timestamp,\n version: '2.0',\n summary: {\n totalEntities: entityData.totalEntities,\n totalMemoryUsage: baseMemoryInfo.usedMemory,\n totalMemoryLimit: baseMemoryInfo.totalMemory,\n memoryUtilization: (baseMemoryInfo.usedMemory / baseMemoryInfo.totalMemory * 100),\n gcCollections: baseMemoryInfo.gcCollections,\n entityMemory: totalEntityMemory,\n componentMemory: componentMemoryStats.totalMemory,\n systemMemory: systemMemoryStats.totalMemory,\n poolMemory: poolMemoryStats.totalMemory\n },\n baseMemory: baseMemoryInfo,\n entities: {\n totalMemory: totalEntityMemory,\n entityCount: entityData.totalEntities,\n archetypes: entityData.entitiesPerArchetype,\n largestEntities: entityData.topEntitiesByComponents\n },\n components: componentMemoryStats,\n systems: systemMemoryStats,\n pools: poolMemoryStats,\n performance: performanceStats\n };\n }\n /**\n * 收集基础内存信息\n */\n collectBaseMemoryInfo() {\n const memoryInfo = {\n totalMemory: 0,\n usedMemory: 0,\n freeMemory: 0,\n gcCollections: 0,\n heapInfo: null,\n detailedMemory: undefined\n };\n try {\n // 类型安全的performance memory访问\n const performanceWithMemory = performance;\n if (performanceWithMemory.memory) {\n const perfMemory = performanceWithMemory.memory;\n memoryInfo.totalMemory = perfMemory.jsHeapSizeLimit || 512 * 1024 * 1024;\n memoryInfo.usedMemory = perfMemory.usedJSHeapSize || 0;\n memoryInfo.freeMemory = memoryInfo.totalMemory - memoryInfo.usedMemory;\n memoryInfo.heapInfo = {\n totalJSHeapSize: perfMemory.totalJSHeapSize || 0,\n usedJSHeapSize: perfMemory.usedJSHeapSize || 0,\n jsHeapSizeLimit: perfMemory.jsHeapSizeLimit || 0\n };\n }\n else {\n memoryInfo.totalMemory = 512 * 1024 * 1024;\n memoryInfo.freeMemory = 512 * 1024 * 1024;\n }\n // 尝试获取GC信息\n if (performanceWithMemory.measureUserAgentSpecificMemory) {\n performanceWithMemory.measureUserAgentSpecificMemory().then((result) => {\n memoryInfo.detailedMemory = result;\n }).catch(() => {\n // 忽略错误\n });\n }\n }\n catch (error) {\n // 使用默认值\n }\n return memoryInfo;\n }\n /**\n * 收集组件内存统计(仅用于内存快照)\n */\n collectComponentMemoryStats(entityList) {\n const componentStats = new Map();\n let totalComponentMemory = 0;\n // 首先统计组件类型和数量\n const componentTypeCounts = new Map();\n for (const entity of entityList.buffer) {\n if (!entity || entity.destroyed || !entity.components)\n continue;\n for (const component of entity.components) {\n const typeName = getComponentInstanceTypeName(component);\n componentTypeCounts.set(typeName, (componentTypeCounts.get(typeName) || 0) + 1);\n }\n }\n // 为每种组件类型计算详细内存(只计算一次,然后乘以数量)\n for (const [typeName, count] of componentTypeCounts.entries()) {\n const detailedMemoryPerInstance = this.componentCollector.calculateDetailedComponentMemory(typeName);\n const totalMemoryForType = detailedMemoryPerInstance * count;\n totalComponentMemory += totalMemoryForType;\n // 收集该类型组件的实例信息(用于显示最大的几个实例)\n const instances = [];\n let instanceCount = 0;\n for (const entity of entityList.buffer) {\n if (!entity || entity.destroyed || !entity.components)\n continue;\n for (const component of entity.components) {\n if (getComponentInstanceTypeName(component) === typeName) {\n instances.push({\n entityId: entity.id,\n entityName: entity.name || `Entity_${entity.id}`,\n memory: detailedMemoryPerInstance // 使用统一的详细计算结果\n });\n instanceCount++;\n // 限制收集的实例数量,避免过多数据\n if (instanceCount >= 100)\n break;\n }\n }\n if (instanceCount >= 100)\n break;\n }\n componentStats.set(typeName, {\n count: count,\n totalMemory: totalMemoryForType,\n instances: instances.slice(0, 10) // 只保留前10个实例用于显示\n });\n }\n const componentBreakdown = Array.from(componentStats.entries()).map(([typeName, stats]) => ({\n typeName,\n instanceCount: stats.count,\n totalMemory: stats.totalMemory,\n averageMemory: stats.totalMemory / stats.count,\n percentage: totalComponentMemory > 0 ? (stats.totalMemory / totalComponentMemory * 100) : 0,\n largestInstances: stats.instances.sort((a, b) => b.memory - a.memory).slice(0, 3)\n })).sort((a, b) => b.totalMemory - a.totalMemory);\n return {\n totalMemory: totalComponentMemory,\n componentTypes: componentStats.size,\n totalInstances: Array.from(componentStats.values()).reduce((sum, stats) => sum + stats.count, 0),\n breakdown: componentBreakdown\n };\n }\n collectSystemMemoryStats() {\n const scene = this.sceneManager.currentScene;\n let totalSystemMemory = 0;\n const systemBreakdown = [];\n try {\n const systems = scene?.systems;\n if (systems) {\n const systemTypeMemoryCache = new Map();\n for (const system of systems) {\n const systemTypeName = getSystemInstanceTypeName(system);\n let systemMemory;\n if (systemTypeMemoryCache.has(systemTypeName)) {\n systemMemory = systemTypeMemoryCache.get(systemTypeName);\n }\n else {\n systemMemory = this.calculateQuickSystemSize(system);\n systemTypeMemoryCache.set(systemTypeName, systemMemory);\n }\n totalSystemMemory += systemMemory;\n systemBreakdown.push({\n name: systemTypeName,\n memory: systemMemory,\n enabled: system.enabled !== false,\n updateOrder: system.updateOrder || 0\n });\n }\n }\n }\n catch (error) {\n // 忽略错误\n }\n return {\n totalMemory: totalSystemMemory,\n systemCount: systemBreakdown.length,\n breakdown: systemBreakdown.sort((a, b) => b.memory - a.memory)\n };\n }\n calculateQuickSystemSize(system) {\n if (!system || typeof system !== 'object')\n return 64;\n let size = 128;\n try {\n const keys = Object.keys(system);\n for (let i = 0; i < Math.min(keys.length, 15); i++) {\n const key = keys[i];\n if (!key || key === 'entities' || key === 'scene' || key === 'constructor')\n continue;\n const value = system[key];\n size += key.length * 2;\n if (typeof value === 'string') {\n size += Math.min(value.length * 2, 100);\n }\n else if (typeof value === 'number') {\n size += 8;\n }\n else if (typeof value === 'boolean') {\n size += 4;\n }\n else if (Array.isArray(value)) {\n size += 40 + Math.min(value.length * 8, 200);\n }\n else if (typeof value === 'object' && value !== null) {\n size += 64;\n }\n }\n }\n catch (error) {\n return 128;\n }\n return Math.max(size, 64);\n }\n /**\n * 收集对象池内存统计\n */\n collectPoolMemoryStats() {\n let totalPoolMemory = 0;\n const poolBreakdown = [];\n try {\n // 尝试获取组件池统计\n const poolManager = ComponentPoolManager.getInstance();\n const poolStats = poolManager.getPoolStats();\n for (const [typeName, stats] of poolStats.entries()) {\n const poolData = stats;\n const poolMemory = poolData.maxSize * 32; // 估算每个对象32字节\n totalPoolMemory += poolMemory;\n poolBreakdown.push({\n typeName,\n maxSize: poolData.maxSize,\n currentSize: poolData.currentSize || 0,\n estimatedMemory: poolMemory,\n utilization: poolData.currentSize ? (poolData.currentSize / poolData.maxSize * 100) : 0\n });\n }\n }\n catch (error) {\n // 如果无法获取池信息,使用默认值\n }\n try {\n // 尝试获取通用对象池统计\n const poolStats = Pool.getAllPoolStats();\n for (const [typeName, stats] of Object.entries(poolStats)) {\n const poolData = stats;\n totalPoolMemory += poolData.estimatedMemoryUsage;\n poolBreakdown.push({\n typeName: `Pool_${typeName}`,\n maxSize: poolData.maxSize,\n currentSize: poolData.size,\n estimatedMemory: poolData.estimatedMemoryUsage,\n utilization: poolData.size / poolData.maxSize * 100,\n hitRate: poolData.hitRate * 100\n });\n }\n }\n catch (error) {\n // 忽略错误\n }\n return {\n totalMemory: totalPoolMemory,\n poolCount: poolBreakdown.length,\n breakdown: poolBreakdown.sort((a, b) => b.estimatedMemory - a.estimatedMemory)\n };\n }\n /**\n * 收集性能统计信息\n */\n collectPerformanceStats() {\n try {\n if (!this.performanceMonitor) {\n return { enabled: false };\n }\n const stats = this.performanceMonitor.getAllSystemStats();\n const warnings = this.performanceMonitor.getPerformanceWarnings();\n return {\n enabled: this.performanceMonitor.enabled ?? false,\n systemCount: stats.size,\n warnings: warnings.slice(0, 10), // 最多10个警告\n topSystems: Array.from(stats.entries()).map((entry) => {\n const [name, stat] = entry;\n return {\n name,\n averageTime: stat.averageTime,\n maxTime: stat.maxTime,\n samples: stat.executionCount\n };\n }).sort((a, b) => b.averageTime - a.averageTime).slice(0, 5)\n };\n }\n catch (error) {\n return { enabled: false, error: error instanceof Error ? error.message : String(error) };\n }\n }\n /**\n * 获取调试数据\n */\n getDebugData() {\n const currentTime = Date.now();\n const scene = this.sceneManager.currentScene;\n const debugData = {\n timestamp: currentTime,\n frameworkVersion: '1.0.0', // 可以从package.json读取\n isRunning: this.isRunning,\n frameworkLoaded: true,\n currentScene: scene?.name || 'Unknown'\n };\n // 根据配置收集各种数据\n if (this.config.channels.entities) {\n debugData.entities = this.entityCollector.collectEntityData(scene);\n }\n if (this.config.channels.systems) {\n debugData.systems = this.systemCollector.collectSystemData(this.performanceMonitor, scene);\n }\n if (this.config.channels.performance) {\n debugData.performance = this.performanceCollector.collectPerformanceData(this.performanceMonitor);\n }\n if (this.config.channels.components) {\n debugData.components = this.componentCollector.collectComponentData(scene);\n }\n if (this.config.channels.scenes) {\n debugData.scenes = this.sceneCollector.collectSceneData(scene);\n }\n return debugData;\n }\n /**\n * 连接WebSocket\n */\n async connectWebSocket() {\n try {\n await this.webSocketManager.connect();\n // console.log('[ECS Debug] 调试管理器已连接到调试服务器');\n }\n catch (error) {\n // console.warn('[ECS Debug] 无法连接到调试服务器:', error);\n }\n }\n /**\n * 发送调试数据\n */\n sendDebugData() {\n if (!this.webSocketManager.getConnectionStatus()) {\n return;\n }\n try {\n const debugData = this.getDebugData();\n // 收集高级性能数据(包含 callGraph)\n const isProfilerEnabled = ProfilerSDK.isEnabled();\n const advancedProfilerData = isProfilerEnabled\n ? this.advancedProfilerCollector.collectAdvancedData(this.performanceMonitor)\n : null;\n // 包装成调试面板期望的消息格式\n const message = {\n type: 'debug_data',\n data: debugData,\n advancedProfiler: advancedProfilerData\n };\n this.webSocketManager.send(message);\n }\n catch (error) {\n // console.error('[ECS Debug] 发送调试数据失败:', error);\n }\n }\n /**\n * 释放资源\n */\n dispose() {\n this.stop();\n // 恢复原始 console 方法\n console.log = this.originalConsole.log;\n console.debug = this.originalConsole.debug;\n console.info = this.originalConsole.info;\n console.warn = this.originalConsole.warn;\n console.error = this.originalConsole.error;\n }\n};\n__decorate([\n InjectProperty(SceneManager),\n __metadata(\"design:type\", SceneManager)\n], DebugManager.prototype, \"sceneManager\", void 0);\n__decorate([\n InjectProperty(PerformanceMonitor),\n __metadata(\"design:type\", PerformanceMonitor)\n], DebugManager.prototype, \"performanceMonitor\", void 0);\n__decorate([\n InjectProperty(DebugConfigService),\n __metadata(\"design:type\", DebugConfigService)\n], DebugManager.prototype, \"configService\", void 0);\nDebugManager = __decorate([\n Injectable(),\n Updatable()\n], DebugManager);\nexport { DebugManager };\n//# sourceMappingURL=DebugManager.js.map","import { PluginState } from './Plugin';\nimport { createLogger } from '../Utils/Logger';\nconst logger = createLogger('PluginManager');\n/**\n * 插件管理器\n *\n * 负责插件的注册、安装、卸载和生命周期管理。\n * 支持依赖检查和异步加载。\n *\n * @example\n * ```typescript\n * const core = Core.create();\n * const pluginManager = core.getService(PluginManager);\n *\n * // 注册插件\n * await pluginManager.install(new MyPlugin());\n *\n * // 查询插件\n * const plugin = pluginManager.getPlugin('my-plugin');\n *\n * // 卸载插件\n * await pluginManager.uninstall('my-plugin');\n * ```\n */\nexport class PluginManager {\n constructor() {\n /**\n * 已安装的插件\n */\n this._plugins = new Map();\n /**\n * 插件元数据\n */\n this._metadata = new Map();\n /**\n * Core实例引用\n */\n this._core = null;\n /**\n * 服务容器引用\n */\n this._services = null;\n }\n /**\n * 初始化插件管理器\n *\n * @param core - Core实例\n * @param services - 服务容器\n */\n initialize(core, services) {\n this._core = core;\n this._services = services;\n logger.info('PluginManager initialized');\n }\n /**\n * 安装插件\n *\n * 会自动检查依赖并按正确顺序安装。\n *\n * @param plugin - 插件实例\n * @throws 如果依赖检查失败或安装失败\n */\n async install(plugin) {\n if (!this._core || !this._services) {\n throw new Error('PluginManager not initialized. Call initialize() first.');\n }\n // 检查是否已安装\n if (this._plugins.has(plugin.name)) {\n logger.warn(`Plugin ${plugin.name} is already installed`);\n return;\n }\n // 检查依赖\n if (plugin.dependencies && plugin.dependencies.length > 0) {\n this._checkDependencies(plugin);\n }\n // 创建元数据\n const metadata = {\n name: plugin.name,\n version: plugin.version,\n state: PluginState.NotInstalled,\n installedAt: Date.now()\n };\n this._metadata.set(plugin.name, metadata);\n try {\n // 调用插件的安装方法\n logger.info(`Installing plugin: ${plugin.name} v${plugin.version}`);\n await plugin.install(this._core, this._services);\n // 标记为已安装\n this._plugins.set(plugin.name, plugin);\n metadata.state = PluginState.Installed;\n logger.info(`Plugin ${plugin.name} installed successfully`);\n }\n catch (error) {\n // 安装失败\n metadata.state = PluginState.Failed;\n metadata.error = error instanceof Error ? error.message : String(error);\n logger.error(`Failed to install plugin ${plugin.name}:`, error);\n throw error;\n }\n }\n /**\n * 卸载插件\n *\n * @param name - 插件名称\n * @throws 如果插件未安装或卸载失败\n */\n async uninstall(name) {\n const plugin = this._plugins.get(name);\n if (!plugin) {\n throw new Error(`Plugin ${name} is not installed`);\n }\n // 检查是否有其他插件依赖此插件\n this._checkDependents(name);\n try {\n logger.info(`Uninstalling plugin: ${name}`);\n await plugin.uninstall();\n // 从注册表中移除\n this._plugins.delete(name);\n this._metadata.delete(name);\n logger.info(`Plugin ${name} uninstalled successfully`);\n }\n catch (error) {\n logger.error(`Failed to uninstall plugin ${name}:`, error);\n throw error;\n }\n }\n /**\n * 获取插件实例\n *\n * @param name - 插件名称\n * @returns 插件实例,如果未安装则返回undefined\n */\n getPlugin(name) {\n return this._plugins.get(name);\n }\n /**\n * 获取插件元数据\n *\n * @param name - 插件名称\n * @returns 插件元数据,如果未安装则返回undefined\n */\n getMetadata(name) {\n return this._metadata.get(name);\n }\n /**\n * 获取所有已安装的插件\n *\n * @returns 插件列表\n */\n getAllPlugins() {\n return Array.from(this._plugins.values());\n }\n /**\n * 获取所有插件元数据\n *\n * @returns 元数据列表\n */\n getAllMetadata() {\n return Array.from(this._metadata.values());\n }\n /**\n * 检查插件是否已安装\n *\n * @param name - 插件名称\n * @returns 是否已安装\n */\n isInstalled(name) {\n return this._plugins.has(name);\n }\n /**\n * 检查插件依赖\n *\n * @param plugin - 插件实例\n * @throws 如果依赖未满足\n */\n _checkDependencies(plugin) {\n if (!plugin.dependencies) {\n return;\n }\n const missingDeps = [];\n for (const dep of plugin.dependencies) {\n if (!this._plugins.has(dep)) {\n missingDeps.push(dep);\n }\n }\n if (missingDeps.length > 0) {\n throw new Error(`Plugin ${plugin.name} has unmet dependencies: ${missingDeps.join(', ')}`);\n }\n }\n /**\n * 检查是否有其他插件依赖指定插件\n *\n * @param name - 插件名称\n * @throws 如果有其他插件依赖此插件\n */\n _checkDependents(name) {\n const dependents = [];\n for (const plugin of this._plugins.values()) {\n if (plugin.dependencies && plugin.dependencies.includes(name)) {\n dependents.push(plugin.name);\n }\n }\n if (dependents.length > 0) {\n throw new Error(`Cannot uninstall plugin ${name}: it is required by ${dependents.join(', ')}`);\n }\n }\n /**\n * 释放资源\n */\n dispose() {\n // 卸载所有插件(逆序,先卸载依赖项)\n const plugins = Array.from(this._plugins.values()).reverse();\n for (const plugin of plugins) {\n try {\n logger.info(`Disposing plugin: ${plugin.name}`);\n plugin.uninstall();\n }\n catch (error) {\n logger.error(`Error disposing plugin ${plugin.name}:`, error);\n }\n }\n this._plugins.clear();\n this._metadata.clear();\n this._core = null;\n this._services = null;\n logger.info('PluginManager disposed');\n }\n}\n//# sourceMappingURL=PluginManager.js.map","import { World } from './World';\nimport { createLogger } from '../Utils/Logger';\nconst logger = createLogger('WorldManager');\n/**\n * World管理器 - 管理所有World实例\n *\n * WorldManager负责管理多个独立的World实例。\n * 每个World都是独立的ECS环境,可以包含多个Scene。\n *\n * 适用场景:\n * - MMO游戏的多房间管理\n * - 服务器端的多游戏实例\n * - 需要完全隔离的多个游戏环境\n *\n * @example\n * ```typescript\n * // 创建WorldManager实例\n * const worldManager = new WorldManager({\n * maxWorlds: 100,\n * autoCleanup: true\n * });\n *\n * // 创建游戏房间World\n * const room1 = worldManager.createWorld('room_001', {\n * name: 'GameRoom_001',\n * maxScenes: 5\n * });\n * room1.setActive(true);\n *\n * // 游戏循环\n * function gameLoop(deltaTime: number) {\n * Core.update(deltaTime);\n * worldManager.updateAll(); // 更新所有活跃World\n * }\n * ```\n */\nexport class WorldManager {\n constructor(config = {}) {\n this._worlds = new Map();\n this._isRunning = false;\n this._framesSinceCleanup = 0;\n this._config = {\n maxWorlds: 50,\n autoCleanup: true,\n cleanupFrameInterval: 1800, // 1800帧\n debug: false,\n ...config\n };\n // 默认启动运行状态\n this._isRunning = true;\n logger.info('WorldManager已初始化', {\n maxWorlds: this._config.maxWorlds,\n autoCleanup: this._config.autoCleanup,\n cleanupFrameInterval: this._config.cleanupFrameInterval\n });\n }\n /**\n * 创建新World\n */\n createWorld(worldName, config) {\n if (!worldName || typeof worldName !== 'string' || worldName.trim() === '') {\n throw new Error('World name不能为空');\n }\n if (this._worlds.has(worldName)) {\n throw new Error(`World name '${worldName}' 已存在`);\n }\n if (this._worlds.size >= this._config.maxWorlds) {\n throw new Error(`已达到最大World数量限制: ${this._config.maxWorlds}`);\n }\n // 优先级:config.debug > WorldManager.debug > 默认\n const worldConfig = {\n name: worldName,\n debug: config?.debug ?? this._config.debug ?? false,\n ...(config?.maxScenes !== undefined && { maxScenes: config.maxScenes }),\n ...(config?.autoCleanup !== undefined && { autoCleanup: config.autoCleanup })\n };\n const world = new World(worldConfig);\n this._worlds.set(worldName, world);\n return world;\n }\n /**\n * 移除World\n */\n removeWorld(worldName) {\n const world = this._worlds.get(worldName);\n if (!world) {\n return false;\n }\n // 销毁World\n world.destroy();\n this._worlds.delete(worldName);\n logger.info(`移除World: ${worldName}`);\n return true;\n }\n /**\n * 获取World\n */\n getWorld(worldName) {\n return this._worlds.get(worldName) || null;\n }\n /**\n * 获取所有World ID\n */\n getWorldIds() {\n return Array.from(this._worlds.keys());\n }\n /**\n * 获取所有World\n */\n getAllWorlds() {\n return Array.from(this._worlds.values());\n }\n /**\n * 设置World激活状态\n */\n setWorldActive(worldName, active) {\n const world = this._worlds.get(worldName);\n if (!world) {\n logger.warn(`World '${worldName}' 不存在`);\n return;\n }\n if (active) {\n world.start();\n logger.debug(`激活World: ${worldName}`);\n }\n else {\n world.stop();\n logger.debug(`停用World: ${worldName}`);\n }\n }\n /**\n * 检查World是否激活\n */\n isWorldActive(worldName) {\n const world = this._worlds.get(worldName);\n return world?.isActive ?? false;\n }\n /**\n * 更新所有活跃的World\n *\n * 应该在每帧的游戏循环中调用。\n * 会自动更新所有活跃World的全局系统和场景。\n *\n * @example\n * ```typescript\n * function gameLoop(deltaTime: number) {\n * Core.update(deltaTime); // 更新全局服务\n * worldManager.updateAll(); // 更新所有World\n * }\n * ```\n */\n updateAll() {\n if (!this._isRunning)\n return;\n for (const world of this._worlds.values()) {\n if (world.isActive) {\n // 更新World的全局System\n world.updateGlobalSystems();\n // 更新World中的所有Scene\n world.updateScenes();\n }\n }\n // 基于帧的自动清理\n if (this._config.autoCleanup) {\n this._framesSinceCleanup++;\n if (this._framesSinceCleanup >= this._config.cleanupFrameInterval) {\n this.cleanup();\n this._framesSinceCleanup = 0; // 重置计数器\n if (this._config.debug) {\n logger.debug(`执行定期清理World (间隔: ${this._config.cleanupFrameInterval} 帧)`);\n }\n }\n }\n }\n /**\n * 获取所有激活的World\n */\n getActiveWorlds() {\n const activeWorlds = [];\n for (const world of this._worlds.values()) {\n if (world.isActive) {\n activeWorlds.push(world);\n }\n }\n return activeWorlds;\n }\n /**\n * 启动所有World\n */\n startAll() {\n this._isRunning = true;\n for (const world of this._worlds.values()) {\n world.start();\n }\n logger.info('启动所有World');\n }\n /**\n * 停止所有World\n */\n stopAll() {\n this._isRunning = false;\n for (const world of this._worlds.values()) {\n world.stop();\n }\n logger.info('停止所有World');\n }\n /**\n * 查找满足条件的World\n */\n findWorlds(predicate) {\n const results = [];\n for (const world of this._worlds.values()) {\n if (predicate(world)) {\n results.push(world);\n }\n }\n return results;\n }\n /**\n * 根据名称查找World\n */\n findWorldByName(name) {\n for (const world of this._worlds.values()) {\n if (world.name === name) {\n return world;\n }\n }\n return null;\n }\n /**\n * 获取WorldManager统计信息\n */\n getStats() {\n const stats = {\n totalWorlds: this._worlds.size,\n activeWorlds: this.activeWorldCount,\n totalScenes: 0,\n totalEntities: 0,\n totalSystems: 0,\n memoryUsage: 0,\n isRunning: this._isRunning,\n config: { ...this._config },\n worlds: []\n };\n for (const [worldName, world] of this._worlds) {\n const worldStats = world.getStats();\n stats.totalScenes += worldStats.totalSystems; // World的getStats可能需要调整\n stats.totalEntities += worldStats.totalEntities;\n stats.totalSystems += worldStats.totalSystems;\n stats.worlds.push({\n id: worldName,\n name: world.name,\n isActive: world.isActive,\n sceneCount: world.sceneCount,\n ...worldStats\n });\n }\n return stats;\n }\n /**\n * 获取详细状态信息\n */\n getDetailedStatus() {\n return {\n ...this.getStats(),\n worlds: Array.from(this._worlds.entries()).map(([worldName, world]) => ({\n id: worldName,\n isActive: world.isActive,\n status: world.getStatus()\n }))\n };\n }\n /**\n * 清理空World\n */\n cleanup() {\n const worldsToRemove = [];\n for (const [worldName, world] of this._worlds) {\n if (this.shouldCleanupWorld(world)) {\n worldsToRemove.push(worldName);\n }\n }\n for (const worldName of worldsToRemove) {\n this.removeWorld(worldName);\n }\n if (worldsToRemove.length > 0) {\n logger.debug(`清理了 ${worldsToRemove.length} 个World`);\n }\n return worldsToRemove.length;\n }\n /**\n * 销毁WorldManager\n */\n destroy() {\n logger.info('正在销毁WorldManager...');\n // 停止所有World\n this.stopAll();\n // 销毁所有World\n const worldNames = Array.from(this._worlds.keys());\n for (const worldName of worldNames) {\n this.removeWorld(worldName);\n }\n this._worlds.clear();\n this._isRunning = false;\n logger.info('WorldManager已销毁');\n }\n /**\n * 实现 IService 接口的 dispose 方法\n * 调用 destroy 方法进行清理\n */\n dispose() {\n this.destroy();\n }\n /**\n * 判断World是否应该被清理\n * 清理策略:\n * 1. World未激活\n * 2. 没有Scene或所有Scene都是空的\n * 3. 创建时间超过10分钟\n */\n shouldCleanupWorld(world) {\n if (world.isActive) {\n return false;\n }\n const age = Date.now() - world.createdAt;\n const isOldEnough = age > 10 * 60 * 1000; // 10分钟\n if (world.sceneCount === 0) {\n return isOldEnough;\n }\n // 检查是否所有Scene都是空的\n const allScenes = world.getAllScenes();\n const hasEntities = allScenes.some((scene) => scene.entities && scene.entities.count > 0);\n return !hasEntities && isOldEnough;\n }\n /**\n * 获取World总数\n */\n get worldCount() {\n return this._worlds.size;\n }\n /**\n * 获取激活World数量\n */\n get activeWorldCount() {\n let count = 0;\n for (const world of this._worlds.values()) {\n if (world.isActive)\n count++;\n }\n return count;\n }\n /**\n * 检查是否正在运行\n */\n get isRunning() {\n return this._isRunning;\n }\n /**\n * 获取配置\n */\n get config() {\n return { ...this._config };\n }\n}\n//# sourceMappingURL=WorldManager.js.map","import { TimerManager } from './Utils/Timers/TimerManager';\nimport { Time } from './Utils/Time';\nimport { PerformanceMonitor } from './Utils/PerformanceMonitor';\nimport { PoolManager } from './Utils/Pool/PoolManager';\nimport { DebugManager } from './Utils/Debug';\nimport { createLogger } from './Utils/Logger';\nimport { SceneManager } from './ECS/SceneManager';\nimport { ServiceContainer } from './Core/ServiceContainer';\nimport { PluginManager } from './Core/PluginManager';\nimport { WorldManager } from './ECS/WorldManager';\nimport { DebugConfigService } from './Utils/Debug/DebugConfigService';\nimport { createInstance } from './Core/DI/Decorators';\n/**\n * 游戏引擎核心类\n *\n * 职责:\n * - 提供全局服务(Timer、Performance、Pool等)\n * - 管理场景生命周期(内置SceneManager)\n * - 管理全局管理器的生命周期\n * - 提供统一的游戏循环更新入口\n *\n * @example\n * ```typescript\n * // 初始化并设置场景\n * Core.create({ debug: true });\n * Core.setScene(new GameScene());\n *\n * // 游戏循环(自动更新全局服务和场景)\n * function gameLoop(deltaTime: number) {\n * Core.update(deltaTime);\n * }\n *\n * // 使用定时器\n * Core.schedule(1.0, false, null, (timer) => {\n * console.log(\"1秒后执行\");\n * });\n *\n * // 切换场景\n * Core.loadScene(new MenuScene()); // 延迟切换\n * Core.setScene(new GameScene()); // 立即切换\n *\n * // 获取当前场景\n * const currentScene = Core.scene;\n * ```\n */\nexport class Core {\n /**\n * 创建核心实例\n *\n * @param config - Core配置对象\n */\n constructor(config = {}) {\n Core._instance = this;\n // 保存配置\n this._config = {\n debug: true,\n ...config\n };\n // 初始化服务容器\n this._serviceContainer = new ServiceContainer();\n // 初始化定时器管理器\n this._timerManager = new TimerManager();\n this._serviceContainer.registerInstance(TimerManager, this._timerManager);\n // 初始化性能监控器\n this._performanceMonitor = new PerformanceMonitor();\n this._serviceContainer.registerInstance(PerformanceMonitor, this._performanceMonitor);\n // 在调试模式下启用性能监控\n if (this._config.debug) {\n this._performanceMonitor.enable();\n }\n // 初始化对象池管理器\n this._poolManager = new PoolManager();\n this._serviceContainer.registerInstance(PoolManager, this._poolManager);\n // 初始化场景管理器\n this._sceneManager = new SceneManager(this._performanceMonitor);\n this._serviceContainer.registerInstance(SceneManager, this._sceneManager);\n // 设置场景切换回调,通知调试管理器\n this._sceneManager.setSceneChangedCallback(() => {\n if (this._debugManager) {\n this._debugManager.onSceneChanged();\n }\n });\n // 初始化World管理器\n this._worldManager = new WorldManager({ debug: !!this._config.debug, ...this._config.worldManagerConfig });\n this._serviceContainer.registerInstance(WorldManager, this._worldManager);\n // 初始化插件管理器\n this._pluginManager = new PluginManager();\n this._pluginManager.initialize(this, this._serviceContainer);\n this._serviceContainer.registerInstance(PluginManager, this._pluginManager);\n this.debug = this._config.debug ?? true;\n // 初始化调试管理器\n if (this._config.debugConfig?.enabled) {\n const configService = new DebugConfigService();\n configService.setConfig(this._config.debugConfig);\n this._serviceContainer.registerInstance(DebugConfigService, configService);\n this._serviceContainer.registerSingleton(DebugManager, (c) => createInstance(DebugManager, c));\n this._debugManager = this._serviceContainer.resolve(DebugManager);\n this._debugManager.onInitialize();\n }\n this.initialize();\n }\n /**\n * 获取核心实例\n *\n * @returns 全局核心实例\n */\n static get Instance() {\n return this._instance;\n }\n /**\n * 获取服务容器\n *\n * 用于注册和解析自定义服务。\n *\n * @returns 服务容器实例\n * @throws 如果Core实例未创建\n *\n * @example\n * ```typescript\n * // 注册自定义服务\n * Core.services.registerSingleton(MyService);\n *\n * // 解析服务\n * const myService = Core.services.resolve(MyService);\n * ```\n */\n static get services() {\n if (!this._instance) {\n throw new Error('Core实例未创建,请先调用Core.create()');\n }\n return this._instance._serviceContainer;\n }\n /**\n * 获取World管理器\n *\n * 用于管理多个独立的World实例(高级用户)。\n *\n * @returns WorldManager实例\n * @throws 如果Core实例未创建\n *\n * @example\n * ```typescript\n * // 创建多个游戏房间\n * const wm = Core.worldManager;\n * const room1 = wm.createWorld('room_001');\n * room1.createScene('game', new GameScene());\n * room1.start();\n * ```\n */\n static get worldManager() {\n if (!this._instance) {\n throw new Error('Core实例未创建,请先调用Core.create()');\n }\n return this._instance._worldManager;\n }\n /**\n * 创建Core实例\n *\n * 如果实例已存在,则返回现有实例。\n *\n * @param config - Core配置,也可以直接传入boolean表示debug模式(向后兼容)\n * @returns Core实例\n *\n * @example\n * ```typescript\n * // 方式1:使用配置对象\n * Core.create({\n * debug: true,\n * debugConfig: {\n * enabled: true,\n * websocketUrl: 'ws://localhost:9229'\n * }\n * });\n *\n * // 方式2:简单模式(向后兼容)\n * Core.create(true); // debug = true\n * ```\n */\n static create(config = true) {\n if (this._instance == null) {\n // 向后兼容:如果传入boolean,转换为配置对象\n const coreConfig = typeof config === 'boolean'\n ? { debug: config }\n : config;\n this._instance = new Core(coreConfig);\n }\n else {\n this._logger.warn('Core实例已创建,返回现有实例');\n }\n return this._instance;\n }\n /**\n * 设置当前场景\n *\n * @param scene - 要设置的场景\n * @returns 设置的场景实例\n *\n * @example\n * ```typescript\n * Core.create({ debug: true });\n *\n * // 创建并设置场景\n * const gameScene = new GameScene();\n * Core.setScene(gameScene);\n * ```\n */\n static setScene(scene) {\n if (!this._instance) {\n Core._logger.warn('Core实例未创建,请先调用Core.create()');\n throw new Error('Core实例未创建');\n }\n return this._instance._sceneManager.setScene(scene);\n }\n /**\n * 获取当前场景\n *\n * @returns 当前场景,如果没有场景则返回null\n */\n static get scene() {\n if (!this._instance) {\n return null;\n }\n return this._instance._sceneManager.currentScene;\n }\n /**\n * 获取ECS流式API\n *\n * @returns ECS API实例,如果当前没有场景则返回null\n *\n * @example\n * ```typescript\n * // 使用流式API创建实体\n * const player = Core.ecsAPI?.createEntity('Player')\n * .addComponent(Position, 100, 100)\n * .addComponent(Velocity, 50, 0);\n *\n * // 查询实体\n * const enemies = Core.ecsAPI?.query(Enemy, Transform);\n *\n * // 发射事件\n * Core.ecsAPI?.emit('game:start', { level: 1 });\n * ```\n */\n static get ecsAPI() {\n if (!this._instance) {\n return null;\n }\n return this._instance._sceneManager.api;\n }\n /**\n * 延迟加载场景(下一帧切换)\n *\n * @param scene - 要加载的场景\n *\n * @example\n * ```typescript\n * // 延迟切换场景(在下一帧生效)\n * Core.loadScene(new MenuScene());\n * ```\n */\n static loadScene(scene) {\n if (!this._instance) {\n Core._logger.warn('Core实例未创建,请先调用Core.create()');\n return;\n }\n this._instance._sceneManager.loadScene(scene);\n }\n /**\n * 更新游戏逻辑\n *\n * 此方法应该在游戏引擎的更新循环中调用。\n * 会自动更新全局服务和当前场景。\n *\n * @param deltaTime - 外部引擎提供的帧时间间隔(秒)\n *\n * @example\n * ```typescript\n * // 初始化\n * Core.create({ debug: true });\n * Core.setScene(new GameScene());\n *\n * // Laya引擎集成\n * Laya.timer.frameLoop(1, this, () => {\n * const deltaTime = Laya.timer.delta / 1000;\n * Core.update(deltaTime); // 自动更新全局服务和场景\n * });\n *\n * // Cocos Creator集成\n * update(deltaTime: number) {\n * Core.update(deltaTime); // 自动更新全局服务和场景\n * }\n * ```\n */\n static update(deltaTime) {\n if (!this._instance) {\n Core._logger.warn('Core实例未创建,请先调用Core.create()');\n return;\n }\n this._instance.updateInternal(deltaTime);\n }\n /**\n * 调度定时器\n *\n * 创建一个定时器,在指定时间后执行回调函数。\n *\n * @param timeInSeconds - 延迟时间(秒)\n * @param repeats - 是否重复执行,默认为false\n * @param context - 回调函数的上下文,默认为null\n * @param onTime - 定时器触发时的回调函数\n * @returns 创建的定时器实例\n * @throws 如果Core实例未创建或onTime回调未提供\n *\n * @example\n * ```typescript\n * // 一次性定时器\n * Core.schedule(1.0, false, null, (timer) => {\n * console.log(\"1秒后执行一次\");\n * });\n *\n * // 重复定时器\n * Core.schedule(0.5, true, null, (timer) => {\n * console.log(\"每0.5秒执行一次\");\n * });\n * ```\n */\n static schedule(timeInSeconds, repeats = false, context, onTime) {\n if (!this._instance) {\n throw new Error('Core实例未创建,请先调用Core.create()');\n }\n if (!onTime) {\n throw new Error('onTime callback is required');\n }\n return this._instance._timerManager.schedule(timeInSeconds, repeats, context, onTime);\n }\n /**\n * 启用调试功能\n *\n * @param config 调试配置\n */\n static enableDebug(config) {\n if (!this._instance) {\n Core._logger.warn('Core实例未创建,请先调用Core.create()');\n return;\n }\n if (this._instance._debugManager) {\n this._instance._debugManager.updateConfig(config);\n }\n else {\n const configService = new DebugConfigService();\n configService.setConfig(config);\n this._instance._serviceContainer.registerInstance(DebugConfigService, configService);\n this._instance._serviceContainer.registerSingleton(DebugManager, (c) => createInstance(DebugManager, c));\n this._instance._debugManager = this._instance._serviceContainer.resolve(DebugManager);\n this._instance._debugManager.onInitialize();\n }\n // 更新Core配置\n this._instance._config.debugConfig = config;\n }\n /**\n * 禁用调试功能\n */\n static disableDebug() {\n if (!this._instance)\n return;\n if (this._instance._debugManager) {\n this._instance._debugManager.stop();\n delete this._instance._debugManager;\n }\n // 更新Core配置\n if (this._instance._config.debugConfig) {\n this._instance._config.debugConfig.enabled = false;\n }\n }\n /**\n * 获取调试数据\n *\n * @returns 当前调试数据,如果调试未启用则返回null\n */\n static getDebugData() {\n if (!this._instance?._debugManager) {\n return null;\n }\n return this._instance._debugManager.getDebugData();\n }\n /**\n * 检查调试是否启用\n *\n * @returns 调试状态\n */\n static get isDebugEnabled() {\n return this._instance?._config.debugConfig?.enabled || false;\n }\n /**\n * 获取性能监视器实例\n *\n * @returns 性能监视器,如果Core未初始化则返回null\n */\n static get performanceMonitor() {\n return this._instance?._performanceMonitor || null;\n }\n /**\n * 安装插件\n *\n * @param plugin - 插件实例\n * @throws 如果Core实例未创建或插件安装失败\n *\n * @example\n * ```typescript\n * Core.create({ debug: true });\n *\n * // 安装插件\n * await Core.installPlugin(new MyPlugin());\n * ```\n */\n static async installPlugin(plugin) {\n if (!this._instance) {\n throw new Error('Core实例未创建,请先调用Core.create()');\n }\n await this._instance._pluginManager.install(plugin);\n }\n /**\n * 卸载插件\n *\n * @param name - 插件名称\n * @throws 如果Core实例未创建或插件卸载失败\n *\n * @example\n * ```typescript\n * await Core.uninstallPlugin('my-plugin');\n * ```\n */\n static async uninstallPlugin(name) {\n if (!this._instance) {\n throw new Error('Core实例未创建,请先调用Core.create()');\n }\n await this._instance._pluginManager.uninstall(name);\n }\n /**\n * 获取插件实例\n *\n * @param name - 插件名称\n * @returns 插件实例,如果未安装则返回undefined\n *\n * @example\n * ```typescript\n * const myPlugin = Core.getPlugin('my-plugin');\n * if (myPlugin) {\n * console.log(myPlugin.version);\n * }\n * ```\n */\n static getPlugin(name) {\n if (!this._instance) {\n return undefined;\n }\n return this._instance._pluginManager.getPlugin(name);\n }\n /**\n * 检查插件是否已安装\n *\n * @param name - 插件名称\n * @returns 是否已安装\n *\n * @example\n * ```typescript\n * if (Core.isPluginInstalled('my-plugin')) {\n * console.log('Plugin is installed');\n * }\n * ```\n */\n static isPluginInstalled(name) {\n if (!this._instance) {\n return false;\n }\n return this._instance._pluginManager.isInstalled(name);\n }\n /**\n * 初始化核心系统\n *\n * 执行核心系统的初始化逻辑。\n */\n initialize() {\n // 核心系统初始化\n Core._logger.info('Core initialized', {\n debug: this.debug,\n debugEnabled: this._config.debugConfig?.enabled || false\n });\n }\n /**\n * 内部更新方法\n *\n * @param deltaTime - 帧时间间隔(秒)\n */\n updateInternal(deltaTime) {\n if (Core.paused)\n return;\n // 开始性能监控\n const frameStartTime = this._performanceMonitor.startMonitoring('Core.update');\n // 更新时间系统\n Time.update(deltaTime);\n // 更新FPS监控(如果性能监控器支持)\n if ('updateFPS' in this._performanceMonitor && typeof this._performanceMonitor.updateFPS === 'function') {\n this._performanceMonitor.updateFPS(Time.deltaTime);\n }\n // 更新所有可更新的服务\n const servicesStartTime = this._performanceMonitor.startMonitoring('Services.update');\n this._serviceContainer.updateAll(deltaTime);\n this._performanceMonitor.endMonitoring('Services.update', servicesStartTime, this._serviceContainer.getUpdatableCount());\n // 更新对象池管理器\n this._poolManager.update();\n // 更新默认场景(通过 SceneManager)\n this._sceneManager.update();\n // 更新额外的 WorldManager\n this._worldManager.updateAll();\n // 结束性能监控\n this._performanceMonitor.endMonitoring('Core.update', frameStartTime);\n }\n /**\n * 销毁Core实例\n *\n * 清理所有资源,通常在应用程序关闭时调用。\n */\n static destroy() {\n if (!this._instance)\n return;\n // 停止调试管理器\n if (this._instance._debugManager) {\n this._instance._debugManager.stop();\n }\n // 清理所有服务\n this._instance._serviceContainer.clear();\n Core._logger.info('Core destroyed');\n // 清空实例引用,允许重新创建Core实例\n this._instance = null;\n }\n}\n/**\n * 游戏暂停状态\n *\n * 当设置为true时,游戏循环将暂停执行。\n */\nCore.paused = false;\n/**\n * 全局核心实例\n *\n * 可能为null表示Core尚未初始化或已被销毁\n */\nCore._instance = null;\n/**\n * Core专用日志器\n */\nCore._logger = createLogger('Core');\n//# sourceMappingURL=Core.js.map","import { __decorate, __metadata } from \"tslib\";\nimport { createLogger } from '../Utils/Logger';\nimport { WorldManager } from '../ECS/WorldManager';\nimport { Injectable } from '../Core/DI/Decorators';\nconst logger = createLogger('DebugPlugin');\n/**\n * ECS 调试插件\n *\n * 提供运行时调试功能:\n * - 实时查看实体和组件信息\n * - System 执行统计\n * - 性能监控\n * - 实体查询\n *\n * @example\n * ```typescript\n * const core = Core.create();\n * const debugPlugin = new DebugPlugin({ autoStart: true, updateInterval: 1000 });\n * await core.pluginManager.install(debugPlugin);\n *\n * // 获取调试信息\n * const stats = debugPlugin.getStats();\n * console.log('Total entities:', stats.totalEntities);\n *\n * // 查询实体\n * const entities = debugPlugin.queryEntities({ tag: 1 });\n * ```\n */\nlet DebugPlugin = class DebugPlugin {\n /**\n * 创建调试插件实例\n *\n * @param options - 配置选项\n */\n constructor(options) {\n this.name = '@esengine/debug-plugin';\n this.version = '1.0.0';\n this.worldManager = null;\n this.updateTimer = null;\n this.autoStart = options?.autoStart ?? false;\n this.updateInterval = options?.updateInterval ?? 1000;\n }\n /**\n * 安装插件\n */\n async install(_core, services) {\n this.worldManager = services.resolve(WorldManager);\n logger.info('ECS Debug Plugin installed');\n if (this.autoStart) {\n this.start();\n }\n }\n /**\n * 卸载插件\n */\n async uninstall() {\n this.stop();\n this.worldManager = null;\n logger.info('ECS Debug Plugin uninstalled');\n }\n /**\n * 实现 IService 接口\n */\n dispose() {\n this.stop();\n this.worldManager = null;\n }\n /**\n * 启动调试监控\n */\n start() {\n if (this.updateTimer) {\n logger.warn('Debug monitoring already started');\n return;\n }\n logger.info('Starting debug monitoring');\n this.updateTimer = setInterval(() => {\n this.logStats();\n }, this.updateInterval);\n }\n /**\n * 停止调试监控\n */\n stop() {\n if (this.updateTimer) {\n clearInterval(this.updateTimer);\n this.updateTimer = null;\n logger.info('Debug monitoring stopped');\n }\n }\n /**\n * 获取当前 ECS 统计信息\n */\n getStats() {\n if (!this.worldManager) {\n throw new Error('Plugin not installed');\n }\n const scenes = [];\n let totalEntities = 0;\n let totalSystems = 0;\n const worlds = this.worldManager.getAllWorlds();\n for (const world of worlds) {\n for (const scene of world.getAllScenes()) {\n const sceneInfo = this.getSceneInfo(scene);\n scenes.push(sceneInfo);\n totalEntities += sceneInfo.entityCount;\n totalSystems += sceneInfo.systems.length;\n }\n }\n return {\n scenes,\n totalEntities,\n totalSystems,\n timestamp: Date.now()\n };\n }\n /**\n * 获取场景调试信息\n */\n getSceneInfo(scene) {\n const entities = scene.entities.buffer;\n const systems = scene.systems;\n return {\n name: scene.name,\n entityCount: entities.length,\n systems: systems.map((sys) => this.getSystemInfo(sys)),\n entities: entities.map((entity) => this.getEntityInfo(entity))\n };\n }\n /**\n * 获取系统调试信息\n */\n getSystemInfo(system) {\n const perfStats = system.getPerformanceStats();\n const performance = perfStats ? {\n avgExecutionTime: perfStats.averageTime,\n maxExecutionTime: perfStats.maxTime,\n totalCalls: perfStats.executionCount\n } : undefined;\n return {\n name: system.constructor.name,\n enabled: system.enabled,\n updateOrder: system.updateOrder,\n entityCount: system.entities.length,\n ...(performance !== undefined && { performance })\n };\n }\n /**\n * 获取实体调试信息\n */\n getEntityInfo(entity) {\n const components = entity.components;\n return {\n id: entity.id,\n name: entity.name,\n enabled: entity.enabled,\n tag: entity.tag,\n componentCount: components.length,\n components: components.map((comp) => this.getComponentInfo(comp))\n };\n }\n /**\n * 获取组件调试信息\n */\n getComponentInfo(component) {\n const type = component.constructor.name;\n const data = {};\n for (const key of Object.keys(component)) {\n if (!key.startsWith('_')) {\n const value = component[key];\n if (typeof value !== 'function') {\n data[key] = value;\n }\n }\n }\n return { type, data };\n }\n /**\n * 查询实体\n *\n * @param filter - 查询过滤器\n */\n queryEntities(filter) {\n if (!this.worldManager) {\n throw new Error('Plugin not installed');\n }\n const results = [];\n const worlds = this.worldManager.getAllWorlds();\n for (const world of worlds) {\n for (const scene of world.getAllScenes()) {\n if (filter.sceneName && scene.name !== filter.sceneName) {\n continue;\n }\n for (const entity of scene.entities.buffer) {\n if (filter.tag !== undefined && entity.tag !== filter.tag) {\n continue;\n }\n if (filter.name && !entity.name.includes(filter.name)) {\n continue;\n }\n if (filter.hasComponent) {\n const hasComp = entity.components.some((c) => c.constructor.name === filter.hasComponent);\n if (!hasComp) {\n continue;\n }\n }\n results.push(this.getEntityInfo(entity));\n }\n }\n }\n return results;\n }\n /**\n * 打印统计信息到日志\n */\n logStats() {\n const stats = this.getStats();\n logger.info('=== ECS Debug Stats ===');\n logger.info(`Total Entities: ${stats.totalEntities}`);\n logger.info(`Total Systems: ${stats.totalSystems}`);\n logger.info(`Scenes: ${stats.scenes.length}`);\n for (const scene of stats.scenes) {\n logger.info(`\\n[Scene: ${scene.name}]`);\n logger.info(` Entities: ${scene.entityCount}`);\n logger.info(` Systems: ${scene.systems.length}`);\n for (const system of scene.systems) {\n const perfStr = system.performance\n ? ` | Avg: ${system.performance.avgExecutionTime.toFixed(2)}ms, Max: ${system.performance.maxExecutionTime.toFixed(2)}ms`\n : '';\n logger.info(` - ${system.name} (${system.enabled ? 'enabled' : 'disabled'}) | Entities: ${system.entityCount}${perfStr}`);\n }\n }\n logger.info('========================\\n');\n }\n /**\n * 导出调试数据为 JSON\n */\n exportJSON() {\n const stats = this.getStats();\n return JSON.stringify(stats, null, 2);\n }\n};\nDebugPlugin = __decorate([\n Injectable(),\n __metadata(\"design:paramtypes\", [Object])\n], DebugPlugin);\nexport { DebugPlugin };\n//# sourceMappingURL=DebugPlugin.js.map","/**\n * 用于包装事件的一个小类\n */\nexport class FuncPack {\n constructor(func, context) {\n this.func = func;\n this.context = context;\n }\n}\n/**\n * 用于事件管理\n */\nexport class Emitter {\n constructor() {\n this._messageTable = new Map();\n }\n /**\n * 开始监听项\n * @param eventType 监听类型\n * @param handler 监听函数\n * @param context 监听上下文\n */\n addObserver(eventType, handler, context) {\n let list = this._messageTable.get(eventType);\n if (!list) {\n list = [];\n this._messageTable.set(eventType, list);\n }\n if (!this.hasObserver(eventType, handler)) {\n list.push(new FuncPack(handler, context));\n }\n }\n /**\n * 移除监听项\n * @param eventType 事件类型\n * @param handler 事件函数\n */\n removeObserver(eventType, handler) {\n const messageData = this._messageTable.get(eventType);\n if (messageData) {\n const index = messageData.findIndex((data) => data.func == handler);\n if (index != -1)\n messageData.splice(index, 1);\n }\n }\n /**\n * 触发该事件\n * @param eventType 事件类型\n * @param data 事件数据\n */\n emit(eventType, ...data) {\n const list = this._messageTable.get(eventType);\n if (list) {\n for (const observer of list) {\n observer.func.call(observer.context, ...data);\n }\n }\n }\n /**\n * 判断是否存在该类型的观察者\n * @param eventType 事件类型\n * @param handler 事件函数\n */\n hasObserver(eventType, handler) {\n const list = this._messageTable.get(eventType);\n return list ? list.some((observer) => observer.func === handler) : false;\n }\n /**\n * 移除指定事件类型的所有监听器\n * @param eventType 事件类型\n */\n removeAllObservers(eventType) {\n if (eventType !== undefined) {\n this._messageTable.delete(eventType);\n }\n else {\n this._messageTable.clear();\n }\n }\n /**\n * 释放所有资源,清理所有监听器\n */\n dispose() {\n this._messageTable.clear();\n }\n /**\n * 获取事件类型数量\n */\n getEventTypeCount() {\n return this._messageTable.size;\n }\n /**\n * 获取指定事件类型的监听器数量\n * @param eventType 事件类型\n */\n getObserverCount(eventType) {\n const list = this._messageTable.get(eventType);\n return list ? list.length : 0;\n }\n}\n//# sourceMappingURL=Emitter.js.map","/**\n * ECS事件类型枚举\n * 定义实体组件系统中的所有事件类型\n */\nexport var ECSEventType;\n(function (ECSEventType) {\n // 实体相关事件\n ECSEventType[\"ENTITY_CREATED\"] = \"entity:created\";\n ECSEventType[\"ENTITY_DESTROYED\"] = \"entity:destroyed\";\n ECSEventType[\"ENTITY_ENABLED\"] = \"entity:enabled\";\n ECSEventType[\"ENTITY_DISABLED\"] = \"entity:disabled\";\n ECSEventType[\"ENTITY_TAG_ADDED\"] = \"entity:tag:added\";\n ECSEventType[\"ENTITY_TAG_REMOVED\"] = \"entity:tag:removed\";\n ECSEventType[\"ENTITY_NAME_CHANGED\"] = \"entity:name:changed\";\n // 组件相关事件\n ECSEventType[\"COMPONENT_ADDED\"] = \"component:added\";\n ECSEventType[\"COMPONENT_REMOVED\"] = \"component:removed\";\n ECSEventType[\"COMPONENT_MODIFIED\"] = \"component:modified\";\n ECSEventType[\"COMPONENT_ENABLED\"] = \"component:enabled\";\n ECSEventType[\"COMPONENT_DISABLED\"] = \"component:disabled\";\n // 系统相关事件\n ECSEventType[\"SYSTEM_ADDED\"] = \"system:added\";\n ECSEventType[\"SYSTEM_REMOVED\"] = \"system:removed\";\n ECSEventType[\"SYSTEM_ENABLED\"] = \"system:enabled\";\n ECSEventType[\"SYSTEM_DISABLED\"] = \"system:disabled\";\n ECSEventType[\"SYSTEM_PROCESSING_START\"] = \"system:processing:start\";\n ECSEventType[\"SYSTEM_PROCESSING_END\"] = \"system:processing:end\";\n ECSEventType[\"SYSTEM_ERROR\"] = \"system:error\";\n // 场景相关事件\n ECSEventType[\"SCENE_CREATED\"] = \"scene:created\";\n ECSEventType[\"SCENE_DESTROYED\"] = \"scene:destroyed\";\n ECSEventType[\"SCENE_ACTIVATED\"] = \"scene:activated\";\n ECSEventType[\"SCENE_DEACTIVATED\"] = \"scene:deactivated\";\n ECSEventType[\"SCENE_PAUSED\"] = \"scene:paused\";\n ECSEventType[\"SCENE_RESUMED\"] = \"scene:resumed\";\n // 查询相关事件\n ECSEventType[\"QUERY_EXECUTED\"] = \"query:executed\";\n ECSEventType[\"QUERY_CACHE_HIT\"] = \"query:cache:hit\";\n ECSEventType[\"QUERY_CACHE_MISS\"] = \"query:cache:miss\";\n ECSEventType[\"QUERY_OPTIMIZED\"] = \"query:optimized\";\n // 性能相关事件\n ECSEventType[\"PERFORMANCE_WARNING\"] = \"performance:warning\";\n ECSEventType[\"PERFORMANCE_CRITICAL\"] = \"performance:critical\";\n ECSEventType[\"MEMORY_USAGE_HIGH\"] = \"memory:usage:high\";\n ECSEventType[\"FRAME_RATE_DROP\"] = \"frame:rate:drop\";\n // 索引相关事件\n ECSEventType[\"INDEX_CREATED\"] = \"index:created\";\n ECSEventType[\"INDEX_UPDATED\"] = \"index:updated\";\n ECSEventType[\"INDEX_OPTIMIZED\"] = \"index:optimized\";\n // Archetype相关事件\n ECSEventType[\"ARCHETYPE_CREATED\"] = \"archetype:created\";\n ECSEventType[\"ARCHETYPE_ENTITY_ADDED\"] = \"archetype:entity:added\";\n ECSEventType[\"ARCHETYPE_ENTITY_REMOVED\"] = \"archetype:entity:removed\";\n // 脏标记相关事件\n ECSEventType[\"DIRTY_MARK_ADDED\"] = \"dirty:mark:added\";\n ECSEventType[\"DIRTY_BATCH_PROCESSED\"] = \"dirty:batch:processed\";\n // 错误和警告事件\n ECSEventType[\"ERROR_OCCURRED\"] = \"error:occurred\";\n ECSEventType[\"WARNING_ISSUED\"] = \"warning:issued\";\n // 生命周期事件\n ECSEventType[\"FRAMEWORK_INITIALIZED\"] = \"framework:initialized\";\n ECSEventType[\"FRAMEWORK_SHUTDOWN\"] = \"framework:shutdown\";\n // 调试相关事件\n ECSEventType[\"DEBUG_INFO\"] = \"debug:info\";\n ECSEventType[\"DEBUG_STATS_UPDATED\"] = \"debug:stats:updated\";\n})(ECSEventType || (ECSEventType = {}));\n/**\n * 事件优先级枚举\n * 定义事件处理的优先级级别\n */\nexport var EventPriority;\n(function (EventPriority) {\n EventPriority[EventPriority[\"LOWEST\"] = 0] = \"LOWEST\";\n EventPriority[EventPriority[\"LOW\"] = 25] = \"LOW\";\n EventPriority[EventPriority[\"NORMAL\"] = 50] = \"NORMAL\";\n EventPriority[EventPriority[\"HIGH\"] = 75] = \"HIGH\";\n EventPriority[EventPriority[\"HIGHEST\"] = 100] = \"HIGHEST\";\n EventPriority[EventPriority[\"CRITICAL\"] = 200] = \"CRITICAL\";\n})(EventPriority || (EventPriority = {}));\n/**\n * 预定义的事件类型常量\n * 提供类型安全的事件类型字符串\n */\nexport const EVENT_TYPES = {\n // 实体事件\n ENTITY: {\n CREATED: ECSEventType.ENTITY_CREATED,\n DESTROYED: ECSEventType.ENTITY_DESTROYED,\n ENABLED: ECSEventType.ENTITY_ENABLED,\n DISABLED: ECSEventType.ENTITY_DISABLED,\n TAG_ADDED: ECSEventType.ENTITY_TAG_ADDED,\n TAG_REMOVED: ECSEventType.ENTITY_TAG_REMOVED,\n NAME_CHANGED: ECSEventType.ENTITY_NAME_CHANGED\n },\n // 组件事件\n COMPONENT: {\n ADDED: ECSEventType.COMPONENT_ADDED,\n REMOVED: ECSEventType.COMPONENT_REMOVED,\n MODIFIED: ECSEventType.COMPONENT_MODIFIED,\n ENABLED: ECSEventType.COMPONENT_ENABLED,\n DISABLED: ECSEventType.COMPONENT_DISABLED\n },\n // 系统事件\n SYSTEM: {\n ADDED: ECSEventType.SYSTEM_ADDED,\n REMOVED: ECSEventType.SYSTEM_REMOVED,\n ENABLED: ECSEventType.SYSTEM_ENABLED,\n DISABLED: ECSEventType.SYSTEM_DISABLED,\n PROCESSING_START: ECSEventType.SYSTEM_PROCESSING_START,\n PROCESSING_END: ECSEventType.SYSTEM_PROCESSING_END,\n ERROR: ECSEventType.SYSTEM_ERROR\n },\n // 性能事件\n PERFORMANCE: {\n WARNING: ECSEventType.PERFORMANCE_WARNING,\n CRITICAL: ECSEventType.PERFORMANCE_CRITICAL,\n MEMORY_HIGH: ECSEventType.MEMORY_USAGE_HIGH,\n FRAME_DROP: ECSEventType.FRAME_RATE_DROP\n }\n};\n/**\n * 事件类型验证器\n * 验证事件类型是否有效\n */\nexport class EventTypeValidator {\n /**\n * 验证事件类型是否有效\n * @param eventType 事件类型\n * @returns 是否有效\n */\n static isValid(eventType) {\n return this.validTypes.has(eventType);\n }\n /**\n * 获取所有有效的事件类型\n * @returns 事件类型数组\n */\n static getAllValidTypes() {\n return Array.from(this.validTypes);\n }\n /**\n * 添加自定义事件类型\n * @param eventType 事件类型\n */\n static addCustomType(eventType) {\n this.validTypes.add(eventType);\n }\n /**\n * 移除自定义事件类型\n * @param eventType 事件类型\n */\n static removeCustomType(eventType) {\n this.validTypes.delete(eventType);\n }\n}\nEventTypeValidator.validTypes = new Set([\n ...Object.values(ECSEventType),\n ...Object.values(EVENT_TYPES.ENTITY),\n ...Object.values(EVENT_TYPES.COMPONENT),\n ...Object.values(EVENT_TYPES.SYSTEM),\n ...Object.values(EVENT_TYPES.PERFORMANCE)\n]);\n//# sourceMappingURL=CoreEvents.js.map","/**\n * 全局管理器的基类。所有全局管理器都应该从此类继承。\n */\nexport class GlobalManager {\n constructor() {\n this._enabled = false;\n }\n /**\n * 获取或设置管理器是否启用\n */\n get enabled() {\n return this._enabled;\n }\n set enabled(value) {\n this.setEnabled(value);\n }\n /**\n * 设置管理器是否启用\n * @param isEnabled 如果为true,则启用管理器;否则禁用管理器\n */\n setEnabled(isEnabled) {\n if (this._enabled != isEnabled) {\n this._enabled = isEnabled;\n if (this._enabled) {\n // 如果启用了管理器,则调用onEnabled方法\n this.onEnabled();\n }\n else {\n // 如果禁用了管理器,则调用onDisabled方法\n this.onDisabled();\n }\n }\n }\n /**\n * 在启用管理器时调用的回调方法\n */\n onEnabled() {\n }\n /**\n * 在禁用管理器时调用的回调方法\n */\n onDisabled() {\n }\n /**\n * 更新管理器状态的方法\n */\n update() {\n }\n}\n//# sourceMappingURL=GlobalManager.js.map","import { EntitySystem } from './EntitySystem';\n/**\n * 处理系统抽象类\n * 定义一个处理实体的抽象类,继承自EntitySystem类\n * 子类需要实现processSystem方法,用于实现具体的处理逻辑\n */\nexport class ProcessingSystem extends EntitySystem {\n constructor(matcher) {\n super(matcher);\n }\n /**\n * 处理实体,每帧调用processSystem方法进行处理\n * @param entities 实体数组,未被使用\n */\n process(_entities) {\n // 调用子类实现的processSystem方法进行实体处理\n this.processSystem();\n }\n}\n//# sourceMappingURL=ProcessingSystem.js.map","import { EntitySystem } from './EntitySystem';\n/**\n * 被动实体系统\n * 定义一个被动的实体系统,继承自EntitySystem类\n * 被动的实体系统不会对实体进行任何修改,只会被动地接收实体的变化事件\n */\nexport class PassiveSystem extends EntitySystem {\n constructor(matcher) {\n super(matcher);\n }\n /**\n * 不进行任何处理\n * @param entities 实体数组,未被使用\n */\n process(_entities) {\n // 被动系统不进行任何处理\n }\n}\n//# sourceMappingURL=PassiveSystem.js.map","import { EntitySystem } from './EntitySystem';\nimport { Time } from '../../Utils/Time';\n/**\n * 间隔系统抽象类\n * 定义一个按时间间隔处理的抽象类,继承自EntitySystem类\n * 子类需要实现process方法,用于实现具体的处理逻辑\n */\nexport class IntervalSystem extends EntitySystem {\n /**\n * 构造函数,初始化时间间隔\n * @param interval 时间间隔\n * @param matcher 实体匹配器\n */\n constructor(interval, matcher) {\n super(matcher);\n /** 累积增量以跟踪间隔 */\n this.acc = 0;\n /** 时间间隔的余数,用于计算下一次需要等待的时间 */\n this.intervalRemainder = 0;\n this.interval = interval;\n }\n /**\n * 判断是否需要进行处理\n * 如果需要进行处理,则更新累积增量和时间间隔余数,返回true\n * 否则返回false\n */\n onCheckProcessing() {\n // 更新累积增量\n this.acc += Time.deltaTime;\n // 如果累积增量超过时间间隔,则进行处理\n if (this.acc >= this.interval) {\n // 更新时间间隔余数\n this.intervalRemainder = this.acc - this.interval;\n // 重置累积增量\n this.acc = 0;\n // 返回true,表示需要进行处理\n return true;\n }\n // 返回false,表示不需要进行处理\n return false;\n }\n /**\n * 获取本系统上次处理后的实际delta值\n * 实际delta值等于时间间隔加上时间间隔余数\n */\n getIntervalDelta() {\n return this.interval + this.intervalRemainder;\n }\n}\n//# sourceMappingURL=IntervalSystem.js.map","import { createLogger } from '../Utils/Logger';\n/**\n * 平台管理器\n * 用户需要手动注册平台适配器\n */\nexport class PlatformManager {\n constructor() {\n this.adapter = null;\n this.logger = createLogger('PlatformManager');\n }\n /**\n * 获取单例实例\n */\n static getInstance() {\n if (!PlatformManager.instance) {\n PlatformManager.instance = new PlatformManager();\n }\n return PlatformManager.instance;\n }\n /**\n * 获取当前平台适配器\n */\n getAdapter() {\n if (!this.adapter) {\n throw new Error('平台适配器未注册,请调用 registerAdapter() 注册适配器');\n }\n return this.adapter;\n }\n /**\n * 注册平台适配器\n */\n registerAdapter(adapter) {\n this.adapter = adapter;\n this.logger.info(`平台适配器已注册: ${adapter.name}`, {\n name: adapter.name,\n version: adapter.version,\n supportsWorker: adapter.isWorkerSupported(),\n supportsSharedArrayBuffer: adapter.isSharedArrayBufferSupported(),\n hardwareConcurrency: adapter.getHardwareConcurrency()\n });\n }\n /**\n * 检查是否已注册适配器\n */\n hasAdapter() {\n return this.adapter !== null;\n }\n /**\n * 获取平台适配器信息(用于调试)\n */\n getAdapterInfo() {\n return this.adapter ? {\n name: this.adapter.name,\n version: this.adapter.version,\n config: this.adapter.getPlatformConfig()\n } : null;\n }\n /**\n * 检查当前平台是否支持特定功能\n */\n supportsFeature(feature) {\n if (!this.adapter)\n return false;\n const config = this.adapter.getPlatformConfig();\n switch (feature) {\n case 'worker':\n return this.adapter.isWorkerSupported();\n case 'shared-array-buffer':\n return this.adapter.isSharedArrayBufferSupported();\n case 'transferable-objects':\n return config.supportsTransferableObjects;\n case 'module-worker':\n return config.supportsModuleWorker;\n default:\n return false;\n }\n }\n /**\n * 获取基础的Worker配置信息(不做自动决策)\n * 用户应该根据自己的业务需求来配置Worker参数\n */\n getBasicWorkerConfig() {\n if (!this.adapter) {\n return {\n platformSupportsWorker: false,\n platformSupportsSharedArrayBuffer: false,\n platformMaxWorkerCount: 1,\n platformLimitations: {}\n };\n }\n const config = this.adapter.getPlatformConfig();\n return {\n platformSupportsWorker: this.adapter.isWorkerSupported(),\n platformSupportsSharedArrayBuffer: this.adapter.isSharedArrayBufferSupported(),\n platformMaxWorkerCount: config.maxWorkerCount,\n platformLimitations: config.limitations || {}\n };\n }\n /**\n * 异步获取完整的平台配置信息(包含性能信息)\n */\n async getFullPlatformConfig() {\n if (!this.adapter) {\n throw new Error('平台适配器未注册');\n }\n // 如果适配器支持异步获取配置,使用异步方法\n if (typeof this.adapter.getPlatformConfigAsync === 'function') {\n return await this.adapter.getPlatformConfigAsync();\n }\n // 否则返回同步配置\n return this.adapter.getPlatformConfig();\n }\n}\n//# sourceMappingURL=PlatformManager.js.map","import { EntitySystem } from './EntitySystem';\nimport { Time } from '../../Utils/Time';\nimport { PlatformManager } from '../../Platform/PlatformManager';\nimport { getSystemInstanceTypeName } from '../Decorators';\n/**\n * 支持Worker并行处理的EntitySystem基类\n *\n * 支持传统Worker和SharedArrayBuffer两种优化模式:\n * - 传统模式:数据序列化传输,适用于复杂计算\n * - SharedArrayBuffer模式:零拷贝数据共享,适用于大量简单计算\n *\n * 用户需要实现:\n * 1. extractEntityData - 定义数据提取逻辑\n * 2. workerProcess - 编写处理函数(纯函数,可序列化)\n * 3. applyResult - 定义结果应用逻辑\n * 4. (可选) SharedArrayBuffer相关方法\n *\n * @example\n * ```typescript\n * class PhysicsSystem extends WorkerEntitySystem<PhysicsData> {\n * constructor() {\n * super(Matcher.all(Transform, Velocity), {\n * enableWorker: true,\n * workerCount: 8, // 指定8个worker,系统会自动限制在系统最大值内\n * entitiesPerWorker: 100, // 每个worker处理100个实体\n * useSharedArrayBuffer: true,\n * entityDataSize: 6, // x, y, vx, vy, radius, mass\n * maxEntities: 10000,\n * systemConfig: { gravity: 100, friction: 0.95 }\n * });\n * }\n *\n * protected getDefaultEntityDataSize(): number {\n * return 6; // x, y, vx, vy, radius, mass\n * }\n *\n * protected extractEntityData(entity: Entity): PhysicsData {\n * const transform = entity.getComponent(Transform);\n * const velocity = entity.getComponent(Velocity);\n * const physics = entity.getComponent(PhysicsComponent);\n * return {\n * x: transform.x,\n * y: transform.y,\n * vx: velocity.x,\n * vy: velocity.y,\n * radius: physics.radius,\n * mass: physics.mass\n * };\n * }\n *\n * protected workerProcess(entities: PhysicsData[], deltaTime: number, config: any): PhysicsData[] {\n * return entities.map(entity => {\n * // 应用重力\n * entity.vy += config.gravity * deltaTime;\n *\n * // 更新位置\n * entity.x += entity.vx * deltaTime;\n * entity.y += entity.vy * deltaTime;\n *\n * // 应用摩擦力\n * entity.vx *= config.friction;\n * entity.vy *= config.friction;\n *\n * return entity;\n * });\n * }\n *\n * protected applyResult(entity: Entity, result: PhysicsData): void {\n * const transform = entity.getComponent(Transform);\n * const velocity = entity.getComponent(Velocity);\n *\n * transform.x = result.x;\n * transform.y = result.y;\n * velocity.x = result.vx;\n * velocity.y = result.vy;\n * }\n *\n * // SharedArrayBuffer优化支持\n * protected writeEntityToBuffer(entityData: PhysicsData, offset: number): void {\n * if (!this.sharedFloatArray) return;\n *\n * this.sharedFloatArray[offset] = entityData.x;\n * this.sharedFloatArray[offset + 1] = entityData.y;\n * this.sharedFloatArray[offset + 2] = entityData.vx;\n * this.sharedFloatArray[offset + 3] = entityData.vy;\n * this.sharedFloatArray[offset + 4] = entityData.radius;\n * this.sharedFloatArray[offset + 5] = entityData.mass;\n * }\n *\n * protected readEntityFromBuffer(offset: number): PhysicsData | null {\n * if (!this.sharedFloatArray) return null;\n *\n * return {\n * x: this.sharedFloatArray[offset],\n * y: this.sharedFloatArray[offset + 1],\n * vx: this.sharedFloatArray[offset + 2],\n * vy: this.sharedFloatArray[offset + 3],\n * radius: this.sharedFloatArray[offset + 4],\n * mass: this.sharedFloatArray[offset + 5]\n * };\n * }\n *\n * protected getSharedArrayBufferProcessFunction(): SharedArrayBufferProcessFunction {\n * return function(sharedFloatArray: Float32Array, startIndex: number, endIndex: number, deltaTime: number, config: any) {\n * const entitySize = 6;\n * for (let i = startIndex; i < endIndex; i++) {\n * const offset = i * entitySize;\n *\n * // 读取数据\n * let x = sharedFloatArray[offset];\n * let y = sharedFloatArray[offset + 1];\n * let vx = sharedFloatArray[offset + 2];\n * let vy = sharedFloatArray[offset + 3];\n * const radius = sharedFloatArray[offset + 4];\n * const mass = sharedFloatArray[offset + 5];\n *\n * // 物理计算\n * vy += config.gravity * deltaTime;\n * x += vx * deltaTime;\n * y += vy * deltaTime;\n * vx *= config.friction;\n * vy *= config.friction;\n *\n * // 写回数据\n * sharedFloatArray[offset] = x;\n * sharedFloatArray[offset + 1] = y;\n * sharedFloatArray[offset + 2] = vx;\n * sharedFloatArray[offset + 3] = vy;\n * }\n * };\n * }\n * }\n *\n * interface PhysicsData {\n * x: number;\n * y: number;\n * vx: number;\n * vy: number;\n * radius: number;\n * mass: number;\n * }\n * ```\n */\nexport class WorkerEntitySystem extends EntitySystem {\n constructor(matcher, config = {}) {\n super(matcher);\n this.workerPool = null;\n this.isProcessing = false;\n this.sharedBuffer = null;\n this.sharedFloatArray = null;\n this.hasLoggedSyncMode = false;\n // 获取平台适配器\n this.platformAdapter = PlatformManager.getInstance().getAdapter();\n // 验证和调整 worker 数量,确保不超过系统最大值\n const requestedWorkerCount = config.workerCount ?? this.getMaxSystemWorkerCount();\n const maxSystemWorkerCount = this.getMaxSystemWorkerCount();\n const validatedWorkerCount = Math.min(requestedWorkerCount, maxSystemWorkerCount);\n // 如果用户请求的数量超过系统最大值,给出警告\n if (requestedWorkerCount > maxSystemWorkerCount) {\n this.logger.warn(`请求 ${requestedWorkerCount} 个Worker,但系统最多支持 ${maxSystemWorkerCount} 个。实际使用 ${validatedWorkerCount} 个Worker。`);\n }\n this.config = {\n enableWorker: config.enableWorker ?? true,\n workerCount: validatedWorkerCount,\n systemConfig: config.systemConfig,\n ...(config.entitiesPerWorker !== undefined && { entitiesPerWorker: config.entitiesPerWorker }),\n useSharedArrayBuffer: config.useSharedArrayBuffer ?? this.isSharedArrayBufferSupported(),\n entityDataSize: config.entityDataSize ?? this.getDefaultEntityDataSize(),\n maxEntities: config.maxEntities ?? 10000\n };\n if (this.config.enableWorker && this.isWorkerSupported()) {\n // 先初始化SharedArrayBuffer,再初始化Worker池\n if (this.config.useSharedArrayBuffer) {\n this.initializeSharedArrayBuffer();\n }\n this.initializeWorkerPool();\n }\n }\n /**\n * 检查是否支持Worker\n */\n isWorkerSupported() {\n return this.platformAdapter.isWorkerSupported();\n }\n /**\n * 检查是否支持SharedArrayBuffer\n */\n isSharedArrayBufferSupported() {\n return this.platformAdapter.isSharedArrayBufferSupported();\n }\n /**\n * 获取系统支持的最大Worker数量\n */\n getMaxSystemWorkerCount() {\n const platformConfig = this.platformAdapter.getPlatformConfig();\n return platformConfig.maxWorkerCount;\n }\n /**\n * 初始化SharedArrayBuffer\n */\n initializeSharedArrayBuffer() {\n try {\n // 检查是否支持SharedArrayBuffer\n if (!this.isSharedArrayBufferSupported()) {\n this.logger.warn(`${this.systemName}: 平台不支持SharedArrayBuffer,降级到单Worker模式以保证数据处理完整性`);\n this.config.useSharedArrayBuffer = false;\n // 降级到单Worker模式:确保所有实体在同一个Worker中处理,维持实体间交互的完整性\n this.config.workerCount = 1;\n return;\n }\n // 使用配置的实体数据大小和最大实体数量\n // 预分配缓冲区:maxEntities * entityDataSize * 4字节\n const bufferSize = this.config.maxEntities * this.config.entityDataSize * 4;\n this.sharedBuffer = this.platformAdapter.createSharedArrayBuffer(bufferSize);\n if (this.sharedBuffer) {\n this.sharedFloatArray = new Float32Array(this.sharedBuffer);\n }\n this.logger.info(`${this.systemName}: SharedArrayBuffer初始化成功 (${bufferSize} 字节)`);\n }\n catch (error) {\n this.logger.warn(`${this.systemName}: SharedArrayBuffer初始化失败,降级到单Worker模式以保证数据处理完整性`, error);\n this.config.useSharedArrayBuffer = false;\n this.sharedBuffer = null;\n this.sharedFloatArray = null;\n this.config.workerCount = 1;\n }\n }\n /**\n * 初始化Worker池\n */\n initializeWorkerPool() {\n try {\n const script = this.createWorkerScript();\n // 在WorkerEntitySystem中处理平台相关逻辑\n const workers = [];\n const platformConfig = this.platformAdapter.getPlatformConfig();\n const fullScript = (platformConfig.workerScriptPrefix || '') + script;\n for (let i = 0; i < this.config.workerCount; i++) {\n try {\n const worker = this.platformAdapter.createWorker(fullScript, {\n name: `WorkerEntitySystem-${i}`\n });\n workers.push(worker);\n }\n catch (error) {\n this.logger.error(`创建Worker ${i} 失败:`, error);\n throw error;\n }\n }\n this.workerPool = new PlatformWorkerPool(workers);\n }\n catch (error) {\n this.logger.error(`${this.systemName}: Worker池初始化失败`, error);\n this.config.enableWorker = false;\n }\n }\n /**\n * 创建Worker脚本\n */\n createWorkerScript() {\n // 获取方法字符串并提取函数体\n const methodStr = this.workerProcess.toString();\n // 提取函数体部分(去掉方法签名)\n const functionBodyMatch = methodStr.match(/\\{([\\s\\S]*)\\}/);\n if (!functionBodyMatch) {\n throw new Error('无法解析workerProcess方法');\n }\n const functionBody = functionBodyMatch[1];\n const entityDataSize = this.config.entityDataSize;\n // 获取SharedArrayBuffer处理函数的字符串\n const sharedProcessMethod = this.getSharedArrayBufferProcessFunction?.() || null;\n let sharedProcessFunctionBody = '';\n if (sharedProcessMethod) {\n const sharedMethodStr = sharedProcessMethod.toString();\n const sharedFunctionBodyMatch = sharedMethodStr.match(/\\{([\\s\\S]*)\\}/);\n if (sharedFunctionBodyMatch) {\n sharedProcessFunctionBody = sharedFunctionBodyMatch[1] ?? '';\n }\n }\n return `\n // Worker脚本 - 支持SharedArrayBuffer\n let sharedFloatArray = null;\n const ENTITY_DATA_SIZE = ${entityDataSize};\n\n self.onmessage = function(e) {\n const { type, id, entities, deltaTime, systemConfig, startIndex, endIndex, sharedBuffer } = e.data;\n\n\n try {\n // 处理SharedArrayBuffer初始化\n if (type === 'init' && sharedBuffer) {\n sharedFloatArray = new Float32Array(sharedBuffer);\n self.postMessage({ type: 'init', success: true });\n return;\n }\n\n // 处理SharedArrayBuffer数据\n if (type === 'shared' && sharedFloatArray) {\n processSharedArrayBuffer(startIndex, endIndex, deltaTime, systemConfig);\n self.postMessage({ id, result: null }); // SharedArrayBuffer不需要返回数据\n return;\n }\n\n // 传统处理方式\n if (entities) {\n // 定义处理函数\n function workerProcess(entities, deltaTime, systemConfig) {\n ${functionBody}\n }\n\n // 执行处理\n const result = workerProcess(entities, deltaTime, systemConfig);\n\n // 处理Promise返回值\n if (result && typeof result.then === 'function') {\n result.then(finalResult => {\n self.postMessage({ id, result: finalResult });\n }).catch(error => {\n self.postMessage({ id, error: error.message });\n });\n } else {\n self.postMessage({ id, result });\n }\n }\n } catch (error) {\n self.postMessage({ id, error: error.message });\n }\n };\n\n // SharedArrayBuffer处理函数 - 由子类定义\n function processSharedArrayBuffer(startIndex, endIndex, deltaTime, systemConfig) {\n if (!sharedFloatArray) return;\n\n ${sharedProcessFunctionBody ? `\n // 用户定义的处理函数\n const userProcessFunction = function(sharedFloatArray, startIndex, endIndex, deltaTime, systemConfig) {\n ${sharedProcessFunctionBody}\n };\n userProcessFunction(sharedFloatArray, startIndex, endIndex, deltaTime, systemConfig);\n ` : ''}\n }\n `;\n }\n /**\n * 重写process方法,支持Worker并行处理\n */\n process(entities) {\n if (this.isProcessing)\n return;\n this.isProcessing = true;\n try {\n if (this.config.enableWorker && this.workerPool) {\n // 检查SharedArrayBuffer是否真正可用\n if (this.config.useSharedArrayBuffer && this.sharedFloatArray && this.isSharedArrayBufferSupported()) {\n // 使用SharedArrayBuffer优化的异步处理\n this.processWithSharedArrayBuffer(entities).finally(() => {\n this.isProcessing = false;\n });\n }\n else {\n // 如果配置了SharedArrayBuffer但不可用,记录降级信息\n if (this.config.useSharedArrayBuffer) {\n this.logger.info(`${this.systemName}: 本帧降级到传统Worker模式`);\n }\n // 传统Worker异步处理\n this.processWithWorker(entities).finally(() => {\n this.isProcessing = false;\n });\n }\n }\n else {\n // 同步处理(最后的fallback)\n if (!this.hasLoggedSyncMode) {\n this.logger.info(`${this.systemName}: Worker不可用,使用同步处理`);\n this.hasLoggedSyncMode = true;\n }\n this.processSynchronously(entities);\n this.isProcessing = false;\n }\n }\n catch (error) {\n this.isProcessing = false;\n this.logger.error(`${this.systemName}: 处理失败`, error);\n throw error;\n }\n }\n /**\n * 使用SharedArrayBuffer优化的Worker处理\n */\n async processWithSharedArrayBuffer(entities) {\n if (!this.sharedFloatArray) {\n throw new Error('SharedArrayBuffer not initialized');\n }\n // 1. 将实体数据写入SharedArrayBuffer\n this.writeEntitiesToSharedBuffer(entities);\n // 2. 通知Workers处理数据\n const promises = this.createSharedArrayBufferTasks(entities.length);\n await Promise.all(promises);\n // 3. 从SharedArrayBuffer读取结果并应用\n this.readResultsFromSharedBuffer(entities);\n }\n /**\n * 使用Worker并行处理\n */\n async processWithWorker(entities) {\n // 1. 数据提取阶段\n const entityData = [];\n for (let i = 0; i < entities.length; i++) {\n entityData[i] = this.extractEntityData(entities[i]);\n }\n // 2. 分批处理\n const batches = this.createBatches(entityData);\n const deltaTime = Time.deltaTime;\n // 3. Worker执行阶段\n const promises = batches.map((batch) => this.workerPool.execute({\n entities: batch,\n deltaTime,\n systemConfig: this.config.systemConfig\n }));\n const results = await Promise.all(promises);\n // 4. 结果应用阶段\n let entityIndex = 0;\n for (const batchResult of results) {\n for (const result of batchResult) {\n if (entityIndex < entities.length) {\n const entity = entities[entityIndex];\n // 只对有效实体应用结果\n if (entity && result) {\n this.applyResult(entity, result);\n }\n }\n entityIndex++;\n }\n }\n }\n /**\n * 同步处理(fallback)\n */\n processSynchronously(entities) {\n // 1. 数据提取阶段\n const entityData = entities.map((entity) => this.extractEntityData(entity));\n // 2. 主线程处理阶段\n const deltaTime = Time.deltaTime;\n const results = this.workerProcess(entityData, deltaTime, this.config.systemConfig);\n // 3. 结果应用阶段\n // 处理Promise返回值\n if (results && typeof results.then === 'function') {\n results.then((finalResults) => {\n entities.forEach((entity, index) => {\n this.applyResult(entity, finalResults[index]);\n });\n });\n }\n else {\n entities.forEach((entity, index) => {\n this.applyResult(entity, results[index]);\n });\n }\n }\n /**\n * 创建数据批次 - 支持用户指定每个Worker的实体数量\n */\n createBatches(data) {\n const workerCount = this.config.workerCount;\n const batches = [];\n // 如果用户指定了每个Worker处理的实体数量\n if (this.config.entitiesPerWorker) {\n const entitiesPerWorker = this.config.entitiesPerWorker;\n for (let i = 0; i < data.length; i += entitiesPerWorker) {\n const endIndex = Math.min(i + entitiesPerWorker, data.length);\n batches.push(data.slice(i, endIndex));\n }\n // 限制批次数量不超过Worker数量\n if (batches.length > workerCount) {\n this.logger.warn(`${this.systemName}: 创建了 ${batches.length} 个批次,但只有 ${workerCount} 个Worker。某些Worker将依次处理多个批次。`);\n }\n }\n else {\n // 默认行为:按Worker数量平均分配\n const batchSize = Math.ceil(data.length / workerCount);\n for (let i = 0; i < workerCount; i++) {\n const startIndex = i * batchSize;\n const endIndex = Math.min(startIndex + batchSize, data.length);\n if (startIndex < data.length) {\n batches.push(data.slice(startIndex, endIndex));\n }\n }\n }\n return batches;\n }\n /**\n * 将实体数据写入SharedArrayBuffer\n */\n writeEntitiesToSharedBuffer(entities) {\n if (!this.sharedFloatArray)\n return;\n for (let i = 0; i < entities.length && i < this.config.maxEntities; i++) {\n const entity = entities[i];\n const data = this.extractEntityData(entity);\n const offset = i * this.config.entityDataSize; // 使用配置的数据大小\n // 使用子类提供的数据提取方法,然后转换为标准格式\n this.writeEntityToBuffer(data, offset);\n }\n }\n /**\n * 创建SharedArrayBuffer任务 - 支持用户指定每个Worker的实体数量\n */\n createSharedArrayBufferTasks(entityCount) {\n const promises = [];\n // 如果用户指定了每个Worker处理的实体数量\n if (this.config.entitiesPerWorker) {\n const entitiesPerWorker = this.config.entitiesPerWorker;\n const tasksNeeded = Math.ceil(entityCount / entitiesPerWorker);\n const availableWorkers = this.config.workerCount;\n // 如果任务数超过Worker数量,警告用户\n if (tasksNeeded > availableWorkers) {\n this.logger.warn(`${this.systemName}: 需要 ${tasksNeeded} 个任务处理 ${entityCount} 个实体(每任务 ${entitiesPerWorker} 个),但只有 ${availableWorkers} 个Worker。某些Worker将依次处理多个任务。`);\n }\n for (let i = 0; i < entityCount; i += entitiesPerWorker) {\n const startIndex = i;\n const endIndex = Math.min(i + entitiesPerWorker, entityCount);\n const promise = this.workerPool.executeSharedBuffer({\n startIndex,\n endIndex,\n deltaTime: Time.deltaTime,\n systemConfig: this.config.systemConfig\n });\n promises.push(promise);\n }\n }\n else {\n // 默认行为:按Worker数量平均分配\n const entitiesPerWorker = Math.ceil(entityCount / this.config.workerCount);\n for (let i = 0; i < this.config.workerCount; i++) {\n const startIndex = i * entitiesPerWorker;\n const endIndex = Math.min(startIndex + entitiesPerWorker, entityCount);\n if (startIndex < entityCount) {\n const promise = this.workerPool.executeSharedBuffer({\n startIndex,\n endIndex,\n deltaTime: Time.deltaTime,\n systemConfig: this.config.systemConfig\n });\n promises.push(promise);\n }\n }\n }\n return promises;\n }\n /**\n * 从SharedArrayBuffer读取结果并应用\n */\n readResultsFromSharedBuffer(entities) {\n if (!this.sharedFloatArray)\n return;\n for (let i = 0; i < entities.length && i < this.config.maxEntities; i++) {\n const entity = entities[i];\n const offset = i * this.config.entityDataSize; // 使用配置的数据大小\n // 从SharedArrayBuffer读取数据\n const result = this.readEntityFromBuffer(offset);\n if (result) {\n this.applyResult(entity, result);\n }\n }\n }\n /**\n * 更新Worker配置\n */\n updateConfig(newConfig) {\n const oldConfig = { ...this.config };\n // 如果更新了workerCount,需要验证并调整\n if (newConfig.workerCount !== undefined) {\n const maxSystemWorkerCount = this.getMaxSystemWorkerCount();\n const validatedWorkerCount = Math.min(newConfig.workerCount, maxSystemWorkerCount);\n if (newConfig.workerCount > maxSystemWorkerCount) {\n this.logger.warn(`请求 ${newConfig.workerCount} 个Worker,但系统最多支持 ${maxSystemWorkerCount} 个。实际使用 ${validatedWorkerCount} 个Worker。`);\n }\n newConfig.workerCount = validatedWorkerCount;\n }\n Object.assign(this.config, newConfig);\n // 如果 SharedArrayBuffer 设置发生变化,需要重新初始化\n if (oldConfig.useSharedArrayBuffer !== this.config.useSharedArrayBuffer) {\n this.reinitializeWorkerSystem();\n return;\n }\n // 如果 Worker 数量发生变化,需要重新创建 Worker 池\n if (oldConfig.workerCount !== this.config.workerCount) {\n this.reinitializeWorkerPool();\n return;\n }\n // 如果禁用Worker,清理Worker池\n if (!this.config.enableWorker && this.workerPool) {\n this.workerPool.destroy();\n this.workerPool = null;\n }\n // 如果启用Worker但池不存在,重新创建\n if (this.config.enableWorker && !this.workerPool && this.isWorkerSupported()) {\n this.initializeWorkerPool();\n }\n }\n /**\n * 重新初始化整个 Worker 系统(包括 SharedArrayBuffer)\n */\n reinitializeWorkerSystem() {\n // 清理现有资源\n if (this.workerPool) {\n this.workerPool.destroy();\n this.workerPool = null;\n }\n this.sharedBuffer = null;\n this.sharedFloatArray = null;\n // 如果禁用 SharedArrayBuffer,降级到单 Worker 模式\n if (!this.config.useSharedArrayBuffer) {\n this.config.workerCount = 1;\n }\n // 重新初始化\n if (this.config.enableWorker && this.isWorkerSupported()) {\n if (this.config.useSharedArrayBuffer) {\n this.initializeSharedArrayBuffer();\n }\n this.initializeWorkerPool();\n }\n }\n /**\n * 重新初始化 Worker 池(保持 SharedArrayBuffer)\n */\n reinitializeWorkerPool() {\n if (this.workerPool) {\n this.workerPool.destroy();\n this.workerPool = null;\n }\n if (this.config.enableWorker && this.isWorkerSupported()) {\n this.initializeWorkerPool();\n }\n }\n /**\n * 获取系统性能信息\n */\n getWorkerInfo() {\n let currentMode = 'sync';\n if (this.config.enableWorker && this.workerPool) {\n if (this.config.useSharedArrayBuffer && this.sharedFloatArray && this.isSharedArrayBufferSupported()) {\n currentMode = 'shared-buffer';\n }\n else {\n currentMode = 'worker';\n }\n }\n return {\n enabled: this.config.enableWorker,\n workerCount: this.config.workerCount,\n ...(this.config.entitiesPerWorker !== undefined && { entitiesPerWorker: this.config.entitiesPerWorker }),\n maxSystemWorkerCount: this.getMaxSystemWorkerCount(),\n isProcessing: this.isProcessing,\n sharedArrayBufferSupported: this.isSharedArrayBufferSupported(),\n sharedArrayBufferEnabled: this.config.useSharedArrayBuffer,\n currentMode\n };\n }\n /**\n * 销毁系统时清理Worker池\n */\n onDestroy() {\n super.onDestroy();\n if (this.workerPool) {\n this.workerPool.destroy();\n this.workerPool = null;\n }\n }\n getLoggerName() {\n return getSystemInstanceTypeName(this);\n }\n}\n/**\n * 平台适配的Worker池管理器\n */\nclass PlatformWorkerPool {\n constructor(workers) {\n this.workers = [];\n this.taskQueue = [];\n this.busyWorkers = new Set();\n this.taskCounter = 0;\n this.workers = workers;\n // 为每个Worker设置消息处理器\n for (let i = 0; i < workers.length; i++) {\n const worker = workers[i];\n if (!worker)\n continue;\n // 设置消息处理器\n worker.onMessage((event) => this.handleWorkerMessage(i, event.data));\n worker.onError((error) => this.handleWorkerError(i, error));\n }\n }\n /**\n * 执行SharedArrayBuffer任务\n */\n executeSharedBuffer(data) {\n return new Promise((resolve, reject) => {\n const task = {\n id: `shared-task-${++this.taskCounter}`,\n data: { ...data, type: 'shared' },\n resolve: () => resolve(), // SharedArrayBuffer不需要返回数据\n reject\n };\n this.taskQueue.push(task);\n this.processQueue();\n });\n }\n /**\n * 执行任务\n */\n execute(data) {\n return new Promise((resolve, reject) => {\n const task = {\n id: `task-${++this.taskCounter}`,\n data,\n resolve: (result) => {\n resolve(result);\n },\n reject\n };\n this.taskQueue.push(task);\n this.processQueue();\n });\n }\n /**\n * 处理任务队列\n */\n processQueue() {\n if (this.taskQueue.length === 0)\n return;\n // 找到空闲的Worker\n for (let i = 0; i < this.workers.length; i++) {\n if (!this.busyWorkers.has(i) && this.taskQueue.length > 0) {\n const task = this.taskQueue.shift();\n this.busyWorkers.add(i);\n const worker = this.workers[i];\n worker.postMessage({\n id: task.id,\n ...task.data\n });\n // 存储任务信息以便后续处理\n worker._currentTask = task;\n }\n }\n }\n /**\n * 处理Worker消息\n */\n handleWorkerMessage(workerIndex, data) {\n const worker = this.workers[workerIndex];\n const task = worker._currentTask;\n if (!task)\n return;\n this.busyWorkers.delete(workerIndex);\n worker._currentTask = null;\n if (data.error) {\n task.reject(new Error(data.error));\n }\n else {\n task.resolve(data.result);\n }\n // 处理下一个任务\n this.processQueue();\n }\n /**\n * 处理Worker错误\n */\n handleWorkerError(workerIndex, error) {\n const worker = this.workers[workerIndex];\n const task = worker._currentTask;\n if (task) {\n this.busyWorkers.delete(workerIndex);\n worker._currentTask = null;\n task.reject(new Error(error.message));\n }\n // 处理下一个任务\n this.processQueue();\n }\n /**\n * 销毁Worker池\n */\n destroy() {\n for (const worker of this.workers) {\n worker.terminate();\n }\n this.workers.length = 0;\n this.taskQueue.length = 0;\n this.busyWorkers.clear();\n }\n}\n//# sourceMappingURL=WorkerEntitySystem.js.map","import { createLogger } from '../../Utils/Logger';\nimport { TypeSafeEventSystem } from './EventSystem';\nimport { ECSEventType, EventPriority, EventTypeValidator } from '../CoreEvents';\n/**\n * 增强的事件总线实现\n * 基于TypeSafeEventSystem,提供类型安全的事件发布订阅机制\n */\nexport class EventBus {\n constructor(debugMode = false) {\n this.eventIdCounter = 0;\n this.isDebugMode = false;\n this.eventSystem = new TypeSafeEventSystem();\n this.isDebugMode = debugMode;\n }\n /**\n * 发射事件\n * @param eventType 事件类型\n * @param data 事件数据\n * @param enhance 是否增强事件数据(添加timestamp、eventId等),默认false提升性能\n */\n emit(eventType, data, enhance = false) {\n this.validateEventType(eventType);\n const finalData = enhance ? this.enhanceEventData(eventType, data) : data;\n if (this.isDebugMode) {\n EventBus._logger.info(`发射事件: ${eventType}`, finalData);\n }\n this.eventSystem.emitSync(eventType, finalData);\n }\n /**\n * 异步发射事件\n * @param eventType 事件类型\n * @param data 事件数据\n * @param enhance 是否增强事件数据(添加timestamp、eventId等),默认false提升性能\n */\n async emitAsync(eventType, data, enhance = false) {\n this.validateEventType(eventType);\n const finalData = enhance ? this.enhanceEventData(eventType, data) : data;\n if (this.isDebugMode) {\n EventBus._logger.info(`发射异步事件: ${eventType}`, finalData);\n }\n await this.eventSystem.emit(eventType, finalData);\n }\n /**\n * 监听事件\n * @param eventType 事件类型\n * @param handler 事件处理器\n * @param config 监听器配置\n * @returns 监听器ID\n */\n on(eventType, handler, config = {}) {\n this.validateEventType(eventType);\n const eventConfig = {\n once: config.once || false,\n priority: config.priority || EventPriority.NORMAL,\n async: config.async || false\n };\n if (config.thisArg) {\n eventConfig.thisArg = config.thisArg;\n }\n if (this.isDebugMode) {\n EventBus._logger.info(`添加监听器: ${eventType}`, eventConfig);\n }\n return this.eventSystem.on(eventType, handler, eventConfig);\n }\n /**\n * 监听事件(一次性)\n * @param eventType 事件类型\n * @param handler 事件处理器\n * @param config 监听器配置\n * @returns 监听器ID\n */\n once(eventType, handler, config = {}) {\n return this.on(eventType, handler, { ...config, once: true });\n }\n /**\n * 异步监听事件\n * @param eventType 事件类型\n * @param handler 异步事件处理器\n * @param config 监听器配置\n * @returns 监听器ID\n */\n onAsync(eventType, handler, config = {}) {\n return this.on(eventType, handler, { ...config, async: true });\n }\n /**\n * 移除事件监听器\n * @param eventType 事件类型\n * @param listenerId 监听器ID\n */\n off(eventType, listenerId) {\n if (this.isDebugMode) {\n EventBus._logger.info(`移除监听器: ${listenerId} 事件: ${eventType}`);\n }\n return this.eventSystem.off(eventType, listenerId);\n }\n /**\n * 移除指定事件类型的所有监听器\n * @param eventType 事件类型\n */\n offAll(eventType) {\n if (this.isDebugMode) {\n EventBus._logger.info(`移除所有监听器: ${eventType}`);\n }\n this.eventSystem.offAll(eventType);\n }\n /**\n * 检查是否有指定事件的监听器\n * @param eventType 事件类型\n */\n hasListeners(eventType) {\n return this.eventSystem.hasListeners(eventType);\n }\n /**\n * 获取事件统计信息\n * @param eventType 事件类型(可选)\n */\n getStats(eventType) {\n const stats = this.eventSystem.getStats(eventType);\n if (stats instanceof Map) {\n // 转换Map中的每个EventStats为IEventStats\n const result = new Map();\n stats.forEach((stat, key) => {\n result.set(key, this.convertEventStats(stat));\n });\n return result;\n }\n else {\n return this.convertEventStats(stats);\n }\n }\n /**\n * 清空所有监听器\n */\n clear() {\n if (this.isDebugMode) {\n EventBus._logger.info('清空所有监听器');\n }\n this.eventSystem.clear();\n }\n /**\n * 启用或禁用事件系统\n * @param enabled 是否启用\n */\n setEnabled(enabled) {\n this.eventSystem.setEnabled(enabled);\n }\n /**\n * 设置调试模式\n * @param debug 是否启用调试\n */\n setDebugMode(debug) {\n this.isDebugMode = debug;\n }\n /**\n * 设置最大监听器数量\n * @param max 最大数量\n */\n setMaxListeners(max) {\n this.eventSystem.setMaxListeners(max);\n }\n /**\n * 获取监听器数量\n * @param eventType 事件类型\n */\n getListenerCount(eventType) {\n return this.eventSystem.getListenerCount(eventType);\n }\n /**\n * 设置事件批处理配置\n * @param eventType 事件类型\n * @param batchSize 批处理大小\n * @param delay 延迟时间(毫秒)\n */\n setBatchConfig(eventType, batchSize, delay) {\n this.eventSystem.setBatchConfig(eventType, {\n batchSize,\n delay,\n enabled: true\n });\n }\n /**\n * 刷新指定事件的批处理队列\n * @param eventType 事件类型\n */\n flushBatch(eventType) {\n this.eventSystem.flushBatch(eventType);\n }\n /**\n * 重置事件统计\n * @param eventType 事件类型(可选)\n */\n resetStats(eventType) {\n this.eventSystem.resetStats(eventType);\n }\n // 便捷方法:发射预定义的ECS事件\n /**\n * 发射实体创建事件\n * @param entityData 实体事件数据\n */\n emitEntityCreated(entityData) {\n this.emit(ECSEventType.ENTITY_CREATED, entityData);\n }\n /**\n * 发射实体销毁事件\n * @param entityData 实体事件数据\n */\n emitEntityDestroyed(entityData) {\n this.emit(ECSEventType.ENTITY_DESTROYED, entityData);\n }\n /**\n * 发射组件添加事件\n * @param componentData 组件事件数据\n */\n emitComponentAdded(componentData) {\n this.emit(ECSEventType.COMPONENT_ADDED, componentData);\n }\n /**\n * 发射组件移除事件\n * @param componentData 组件事件数据\n */\n emitComponentRemoved(componentData) {\n this.emit(ECSEventType.COMPONENT_REMOVED, componentData);\n }\n /**\n * 发射系统添加事件\n * @param systemData 系统事件数据\n */\n emitSystemAdded(systemData) {\n this.emit(ECSEventType.SYSTEM_ADDED, systemData);\n }\n /**\n * 发射系统移除事件\n * @param systemData 系统事件数据\n */\n emitSystemRemoved(systemData) {\n this.emit(ECSEventType.SYSTEM_REMOVED, systemData);\n }\n /**\n * 发射场景变化事件\n * @param sceneData 场景事件数据\n */\n emitSceneChanged(sceneData) {\n this.emit(ECSEventType.SCENE_ACTIVATED, sceneData);\n }\n /**\n * 发射性能警告事件\n * @param performanceData 性能事件数据\n */\n emitPerformanceWarning(performanceData) {\n this.emit(ECSEventType.PERFORMANCE_WARNING, performanceData);\n }\n // 便捷方法:监听预定义的ECS事件\n /**\n * 监听实体创建事件\n * @param handler 事件处理器\n * @param config 监听器配置\n */\n onEntityCreated(handler, config) {\n return this.on(ECSEventType.ENTITY_CREATED, handler, config);\n }\n /**\n * 监听组件添加事件\n * @param handler 事件处理器\n * @param config 监听器配置\n */\n onComponentAdded(handler, config) {\n return this.on(ECSEventType.COMPONENT_ADDED, handler, config);\n }\n /**\n * 监听系统错误事件\n * @param handler 事件处理器\n * @param config 监听器配置\n */\n onSystemError(handler, config) {\n return this.on(ECSEventType.SYSTEM_ERROR, handler, config);\n }\n /**\n * 监听性能警告事件\n * @param handler 事件处理器\n * @param config 监听器配置\n */\n onPerformanceWarning(handler, config) {\n return this.on(ECSEventType.PERFORMANCE_WARNING, handler, config);\n }\n // 私有方法\n /**\n * 验证事件类型(仅在debug模式下执行,提升性能)\n * @param eventType 事件类型\n */\n validateEventType(eventType) {\n // 只在debug模式下进行验证,提升生产环境性能\n if (this.isDebugMode) {\n if (!EventTypeValidator.isValid(eventType)) {\n EventBus._logger.warn(`未知事件类型: ${eventType}`);\n // 在调试模式下添加自定义事件类型\n EventTypeValidator.addCustomType(eventType);\n }\n }\n }\n /**\n * 增强事件数据\n * @param eventType 事件类型\n * @param data 原始数据\n */\n enhanceEventData(eventType, data) {\n // 处理null或undefined数据\n if (data === null || data === undefined) {\n return {\n timestamp: Date.now(),\n eventId: `${eventType}_${++this.eventIdCounter}`,\n source: 'EventBus'\n };\n }\n const enhanced = data;\n // 如果数据还没有基础事件属性,添加它们\n if (!enhanced.timestamp) {\n enhanced.timestamp = Date.now();\n }\n if (!enhanced.eventId) {\n enhanced.eventId = `${eventType}_${++this.eventIdCounter}`;\n }\n if (!enhanced.source) {\n enhanced.source = 'EventBus';\n }\n return enhanced;\n }\n /**\n * 转换EventStats为IEventStats\n * @param stats EventStats实例\n */\n convertEventStats(stats) {\n return {\n eventType: stats.eventType,\n listenerCount: stats.listenerCount,\n triggerCount: stats.triggerCount,\n totalExecutionTime: stats.totalExecutionTime,\n averageExecutionTime: stats.averageExecutionTime,\n lastTriggerTime: stats.lastTriggerTime\n };\n }\n}\nEventBus._logger = createLogger('EventBus');\n/**\n * 全局事件总线实例\n * 提供全局访问的事件总线\n */\nexport class GlobalEventBus {\n /**\n * 获取全局事件总线实例\n * @param debugMode 是否启用调试模式\n */\n static getInstance(debugMode = false) {\n if (!this.instance) {\n this.instance = new EventBus(debugMode);\n }\n return this.instance;\n }\n /**\n * 重置全局事件总线实例\n * @param debugMode 是否启用调试模式\n */\n static reset(debugMode = false) {\n if (this.instance) {\n this.instance.clear();\n }\n this.instance = new EventBus(debugMode);\n return this.instance;\n }\n}\n//# sourceMappingURL=EventBus.js.map","/**\n * 版本迁移系统\n *\n * 提供组件和场景数据的版本迁移支持\n */\n/**\n * 版本迁移管理器\n */\nexport class VersionMigrationManager {\n /**\n * 注册组件迁移函数\n *\n * @param componentType 组件类型名称\n * @param fromVersion 源版本号\n * @param toVersion 目标版本号\n * @param migration 迁移函数\n *\n * @example\n * ```typescript\n * // 从版本1迁移到版本2\n * VersionMigrationManager.registerComponentMigration(\n * 'PlayerComponent',\n * 1,\n * 2,\n * (data) => {\n * // 添加新字段\n * data.experience = 0;\n * return data;\n * }\n * );\n * ```\n */\n static registerComponentMigration(componentType, fromVersion, _toVersion, migration) {\n if (!this.componentMigrations.has(componentType)) {\n this.componentMigrations.set(componentType, new Map());\n }\n const versionMap = this.componentMigrations.get(componentType);\n // 使用fromVersion作为key,表示\"从这个版本迁移\"\n versionMap.set(fromVersion, migration);\n }\n /**\n * 注册场景迁移函数\n *\n * @param fromVersion 源版本号\n * @param toVersion 目标版本号\n * @param migration 迁移函数\n *\n * @example\n * ```typescript\n * VersionMigrationManager.registerSceneMigration(\n * 1,\n * 2,\n * (scene) => {\n * // 迁移场景结构\n * scene.metadata = { ...scene.metadata, migratedFrom: 1 };\n * return scene;\n * }\n * );\n * ```\n */\n static registerSceneMigration(fromVersion, _toVersion, migration) {\n this.sceneMigrations.set(fromVersion, migration);\n }\n /**\n * 迁移组件数据\n *\n * @param component 序列化的组件数据\n * @param targetVersion 目标版本号\n * @returns 迁移后的组件数据\n */\n static migrateComponent(component, targetVersion) {\n const currentVersion = component.version;\n if (currentVersion === targetVersion) {\n return component; // 版本相同,无需迁移\n }\n const migrations = this.componentMigrations.get(component.type);\n if (!migrations) {\n console.warn(`No migration path found for component ${component.type}`);\n return component;\n }\n const migratedData = { ...component };\n let version = currentVersion;\n // 执行迁移链\n while (version < targetVersion) {\n const migration = migrations.get(version);\n if (!migration) {\n console.warn(`Missing migration from version ${version} to ${version + 1} for ${component.type}`);\n break;\n }\n migratedData.data = migration(migratedData.data, version, version + 1);\n version++;\n }\n migratedData.version = version;\n return migratedData;\n }\n /**\n * 迁移场景数据\n *\n * @param scene 序列化的场景数据\n * @param targetVersion 目标版本号\n * @returns 迁移后的场景数据\n */\n static migrateScene(scene, targetVersion) {\n const currentVersion = scene.version;\n if (currentVersion === targetVersion) {\n return scene; // 版本相同,无需迁移\n }\n let migratedScene = { ...scene };\n let version = currentVersion;\n // 执行场景级迁移\n while (version < targetVersion) {\n const migration = this.sceneMigrations.get(version);\n if (!migration) {\n console.warn(`Missing scene migration from version ${version} to ${version + 1}`);\n break;\n }\n migratedScene = migration(migratedScene, version, version + 1);\n version++;\n }\n migratedScene.version = version;\n // 迁移所有组件\n migratedScene = this.migrateSceneComponents(migratedScene);\n return migratedScene;\n }\n /**\n * 迁移场景中所有组件的版本\n */\n static migrateSceneComponents(scene) {\n const migratedScene = { ...scene };\n migratedScene.entities = scene.entities.map((entity) => ({\n ...entity,\n components: entity.components.map((component) => {\n // 查找组件的目标版本\n const typeInfo = scene.componentTypeRegistry.find((t) => t.typeName === component.type);\n if (typeInfo && typeInfo.version !== component.version) {\n return this.migrateComponent(component, typeInfo.version);\n }\n return component;\n }),\n children: this.migrateEntitiesComponents(entity.children, scene.componentTypeRegistry)\n }));\n return migratedScene;\n }\n /**\n * 递归迁移实体的组件\n */\n static migrateEntitiesComponents(entities, typeRegistry) {\n return entities.map((entity) => ({\n ...entity,\n components: entity.components.map((component) => {\n const typeInfo = typeRegistry.find((t) => t.typeName === component.type);\n if (typeInfo && typeInfo.version !== component.version) {\n return this.migrateComponent(component, typeInfo.version);\n }\n return component;\n }),\n children: this.migrateEntitiesComponents(entity.children, typeRegistry)\n }));\n }\n /**\n * 清除所有迁移函数\n */\n static clearMigrations() {\n this.componentMigrations.clear();\n this.sceneMigrations.clear();\n }\n /**\n * 获取组件的迁移路径\n *\n * @param componentType 组件类型名称\n * @returns 可用的迁移版本列表\n */\n static getComponentMigrationPath(componentType) {\n const migrations = this.componentMigrations.get(componentType);\n if (!migrations) {\n return [];\n }\n return Array.from(migrations.keys()).sort((a, b) => a - b);\n }\n /**\n * 获取场景的迁移路径\n *\n * @returns 可用的场景迁移版本列表\n */\n static getSceneMigrationPath() {\n return Array.from(this.sceneMigrations.keys()).sort((a, b) => a - b);\n }\n /**\n * 检查是否可以迁移组件\n *\n * @param componentType 组件类型名称\n * @param fromVersion 源版本\n * @param toVersion 目标版本\n * @returns 是否存在完整的迁移路径\n */\n static canMigrateComponent(componentType, fromVersion, toVersion) {\n if (fromVersion === toVersion) {\n return true;\n }\n const migrations = this.componentMigrations.get(componentType);\n if (!migrations) {\n return false;\n }\n // 检查是否存在完整的迁移路径\n for (let v = fromVersion; v < toVersion; v++) {\n if (!migrations.has(v)) {\n return false;\n }\n }\n return true;\n }\n /**\n * 检查是否可以迁移场景\n *\n * @param fromVersion 源版本\n * @param toVersion 目标版本\n * @returns 是否存在完整的迁移路径\n */\n static canMigrateScene(fromVersion, toVersion) {\n if (fromVersion === toVersion) {\n return true;\n }\n // 检查是否存在完整的场景迁移路径\n for (let v = fromVersion; v < toVersion; v++) {\n if (!this.sceneMigrations.has(v)) {\n return false;\n }\n }\n return true;\n }\n}\n/**\n * 组件迁移函数注册表\n * Map<组件类型名, Map<版本号, 迁移函数>>\n */\nVersionMigrationManager.componentMigrations = new Map();\n/**\n * 场景迁移函数注册表\n * Map<版本号, 迁移函数>\n */\nVersionMigrationManager.sceneMigrations = new Map();\n/**\n * 便捷的迁移构建器\n *\n * 提供链式API来定义迁移\n */\nexport class MigrationBuilder {\n constructor() {\n this.fromVersion = 1;\n this.toVersion = 2;\n }\n /**\n * 设置组件类型\n */\n forComponent(componentType) {\n this.componentType = componentType;\n return this;\n }\n /**\n * 设置版本范围\n */\n fromVersionToVersion(from, to) {\n this.fromVersion = from;\n this.toVersion = to;\n return this;\n }\n /**\n * 注册迁移函数\n */\n migrate(migration) {\n if (this.componentType) {\n VersionMigrationManager.registerComponentMigration(this.componentType, this.fromVersion, this.toVersion, migration);\n }\n else {\n VersionMigrationManager.registerSceneMigration(this.fromVersion, this.toVersion, migration);\n }\n }\n}\n//# sourceMappingURL=VersionMigration.js.map","/**\n * 实体标签常量\n *\n * 用于标识特殊类型的实体,如文件夹、摄像机等。\n * 使用位掩码实现,支持多标签组合。\n *\n * @example\n * ```typescript\n * // 创建文件夹实体\n * entity.tag = EntityTags.FOLDER;\n *\n * // 检查是否是文件夹\n * if ((entity.tag & EntityTags.FOLDER) !== 0) {\n * // 是文件夹\n * }\n *\n * // 组合多个标签\n * entity.tag = EntityTags.FOLDER | EntityTags.HIDDEN;\n * ```\n */\nexport const EntityTags = {\n /** 无标签 */\n NONE: 0x0000,\n /** 文件夹实体 - 用于场景层级中的组织分类 */\n FOLDER: 0x1000,\n /** 隐藏实体 - 在编辑器层级中不显示 */\n HIDDEN: 0x2000,\n /** 锁定实体 - 在编辑器中不可选择/编辑 */\n LOCKED: 0x4000,\n /** 编辑器专用实体 - 仅在编辑器中存在,不导出到运行时 */\n EDITOR_ONLY: 0x8000,\n /** 预制件实例 */\n PREFAB_INSTANCE: 0x0100,\n /** 预制件根节点 */\n PREFAB_ROOT: 0x0200\n};\n/**\n * 检查实体是否具有指定标签\n *\n * @param entityTag - 实体的 tag 值\n * @param tag - 要检查的标签\n */\nexport function hasEntityTag(entityTag, tag) {\n return (entityTag & tag) !== 0;\n}\n/**\n * 添加标签到实体\n *\n * @param entityTag - 当前 tag 值\n * @param tag - 要添加的标签\n */\nexport function addEntityTag(entityTag, tag) {\n return entityTag | tag;\n}\n/**\n * 从实体移除标签\n *\n * @param entityTag - 当前 tag 值\n * @param tag - 要移除的标签\n */\nexport function removeEntityTag(entityTag, tag) {\n return entityTag & ~tag;\n}\n/**\n * 检查实体是否是文件夹\n */\nexport function isFolder(entityTag) {\n return hasEntityTag(entityTag, EntityTags.FOLDER);\n}\n/**\n * 检查实体是否隐藏\n */\nexport function isHidden(entityTag) {\n return hasEntityTag(entityTag, EntityTags.HIDDEN);\n}\n/**\n * 检查实体是否锁定\n */\nexport function isLocked(entityTag) {\n return hasEntityTag(entityTag, EntityTags.LOCKED);\n}\n//# sourceMappingURL=EntityTags.js.map","/**\n * Entity类型安全工具函数\n *\n * 提供类型安全的组件操作工具函数,无需修改Entity类\n */\nimport { HierarchySystem } from './Systems/HierarchySystem';\n/**\n * 获取组件,如果不存在则抛出错误\n *\n * @param entity - 实体实例\n * @param componentType - 组件类型构造函数\n * @returns 组件实例(保证非空)\n * @throws {Error} 如果组件不存在\n *\n * @example\n * ```typescript\n * const position = requireComponent(entity, Position);\n * position.x += 10;\n * ```\n */\nexport function requireComponent(entity, componentType) {\n const component = entity.getComponent(componentType);\n if (!component) {\n throw new Error(`Component ${componentType.name} not found on entity ${entity.name} (id: ${entity.id})`);\n }\n return component;\n}\n/**\n * 尝试获取组件\n *\n * @param entity - 实体实例\n * @param componentType - 组件类型构造函数\n * @returns 组件实例或undefined\n *\n * @example\n * ```typescript\n * const health = tryGetComponent(entity, Health);\n * if (health) {\n * health.value -= 10;\n * }\n * ```\n */\nexport function tryGetComponent(entity, componentType) {\n const component = entity.getComponent(componentType);\n return component !== null ? component : undefined;\n}\n/**\n * 批量获取组件\n *\n * @param entity - 实体实例\n * @param types - 组件类型构造函数数组\n * @returns 组件实例元组,每个元素可能为null\n *\n * @example\n * ```typescript\n * const [pos, vel, health] = getComponents(entity, Position, Velocity, Health);\n * if (pos && vel && health) {\n * pos.x += vel.dx;\n * }\n * ```\n */\nexport function getComponents(entity, ...types) {\n return types.map((type) => entity.getComponent(type));\n}\n/**\n * 检查实体是否拥有所有指定的组件\n *\n * @param entity - 实体实例\n * @param types - 组件类型构造函数数组\n * @returns 如果拥有所有组件返回true,否则返回false\n *\n * @example\n * ```typescript\n * if (hasComponents(entity, Position, Velocity)) {\n * const pos = entity.getComponent(Position)!;\n * const vel = entity.getComponent(Velocity)!;\n * }\n * ```\n */\nexport function hasComponents(entity, ...types) {\n return types.every((type) => entity.hasComponent(type));\n}\n/**\n * 检查实体是否拥有至少一个指定的组件\n *\n * @param entity - 实体实例\n * @param types - 组件类型构造函数数组\n * @returns 如果拥有任意一个组件返回true,否则返回false\n */\nexport function hasAnyComponent(entity, ...types) {\n return types.some((type) => entity.hasComponent(type));\n}\n/**\n * 添加组件并立即配置\n *\n * @param entity - 实体实例\n * @param component - 组件实例\n * @param configure - 配置回调函数\n * @returns 实体实例(支持链式调用)\n *\n * @example\n * ```typescript\n * addAndConfigure(entity, new Health(), health => {\n * health.maxValue = 100;\n * health.value = 50;\n * });\n * ```\n */\nexport function addAndConfigure(entity, component, configure) {\n entity.addComponent(component);\n configure(component);\n return entity;\n}\n/**\n * 获取或添加组件\n *\n * 如果组件已存在则返回现有组件,否则通过工厂函数创建并添加\n *\n * @param entity - 实体实例\n * @param componentType - 组件类型构造函数\n * @param factory - 组件工厂函数(仅在组件不存在时调用)\n * @returns 组件实例\n *\n * @example\n * ```typescript\n * const health = getOrAddComponent(entity, Health, () => new Health(100));\n * ```\n */\nexport function getOrAddComponent(entity, componentType, factory) {\n let component = entity.getComponent(componentType);\n if (!component) {\n component = factory();\n entity.addComponent(component);\n }\n return component;\n}\n/**\n * 更新组件的部分字段\n *\n * @param entity - 实体实例\n * @param componentType - 组件类型构造函数\n * @param data - 要更新的部分数据\n * @returns 如果更新成功返回true,组件不存在返回false\n *\n * @example\n * ```typescript\n * updateComponent(entity, Position, { x: 100 });\n * ```\n */\nexport function updateComponent(entity, componentType, data) {\n const component = entity.getComponent(componentType);\n if (!component) {\n return false;\n }\n Object.assign(component, data);\n return true;\n}\n/**\n * 类型安全的实体构建器\n *\n * @example\n * ```typescript\n * const player = buildEntity(scene.createEntity(\"Player\"))\n * .with(new Position(100, 100))\n * .with(new Velocity(0, 0))\n * .withTag(1)\n * .build();\n * ```\n */\nexport class TypedEntityBuilder {\n constructor(entity) {\n this._entity = entity;\n }\n /**\n * 添加组件\n */\n with(component) {\n this._entity.addComponent(component);\n return this;\n }\n /**\n * 添加并配置组件\n */\n withConfigured(component, configure) {\n this._entity.addComponent(component);\n configure(component);\n return this;\n }\n /**\n * 设置标签\n */\n withTag(tag) {\n this._entity.tag = tag;\n return this;\n }\n /**\n * 设置名称\n */\n withName(name) {\n this._entity.name = name;\n return this;\n }\n /**\n * 设置激活状态\n */\n withActive(active) {\n this._entity.active = active;\n return this;\n }\n /**\n * 设置启用状态\n */\n withEnabled(enabled) {\n this._entity.enabled = enabled;\n return this;\n }\n /**\n * 设置更新顺序\n */\n withUpdateOrder(order) {\n this._entity.updateOrder = order;\n return this;\n }\n /**\n * 添加子实体\n */\n withChild(child) {\n const hierarchySystem = this._entity.scene?.getSystem(HierarchySystem);\n hierarchySystem?.setParent(child, this._entity);\n return this;\n }\n /**\n * 完成构建\n */\n build() {\n return this._entity;\n }\n /**\n * 获取正在构建的实体\n */\n get entity() {\n return this._entity;\n }\n}\n/**\n * 创建类型安全的实体构建器\n *\n * @param entity - 要包装的实体\n * @returns 实体构建器\n */\nexport function buildEntity(entity) {\n return new TypedEntityBuilder(entity);\n}\n//# sourceMappingURL=TypedEntity.js.map","/**\n * 类型工具类\n * 提供类型相关的实用方法\n */\nexport class TypeUtils {\n /**\n * 获取对象的类型\n * @param obj 对象\n * @returns 对象的构造函数\n */\n static getType(obj) {\n return obj.constructor;\n }\n}\n//# sourceMappingURL=TypeUtils.js.map","/**\n * 数字扩展工具类\n * 提供数字转换的实用方法\n */\nexport class NumberExtension {\n /**\n * 将值转换为数字\n * @param value 要转换的值\n * @returns 转换后的数字,如果值为undefined则返回0\n */\n static toNumber(value) {\n if (value == undefined)\n return 0;\n return Number(value);\n }\n}\n//# sourceMappingURL=NumberExtension.js.map","/**\n * TypeScript类型工具集\n *\n * 提供高级类型推断和类型安全的工具类型\n */\nimport { Component } from '../ECS/Component';\n/**\n * 组件类型守卫\n */\nexport function isComponentType(value) {\n return typeof value === 'function' && value.prototype instanceof Component;\n}\n/**\n * 类型安全的组件数组守卫\n */\nexport function isComponentArray(value) {\n return value.every(isComponentType);\n}\n//# sourceMappingURL=TypeHelpers.js.map","/**\n * 平台检测器\n * 自动检测当前运行环境并返回对应的平台信息\n */\nexport class PlatformDetector {\n /**\n * 检测当前平台\n */\n static detect() {\n const features = [];\n let platform = 'unknown';\n let confident = false;\n let adapterClass;\n // 检查全局对象和API\n if (typeof globalThis !== 'undefined') {\n features.push('globalThis');\n }\n if (typeof window !== 'undefined') {\n features.push('window');\n }\n if (typeof self !== 'undefined') {\n features.push('self');\n }\n // 检测Node.js环境(优先级最高,因为Node.js可能包含全局对象模拟)\n if (this.isNodeJS()) {\n platform = 'nodejs';\n confident = true;\n adapterClass = 'NodeAdapter';\n features.push('nodejs', 'process', 'require');\n }\n // 检测微信小游戏环境\n else if (this.isWeChatMiniGame()) {\n platform = 'wechat-minigame';\n confident = true;\n adapterClass = 'WeChatMiniGameAdapter';\n features.push('wx', 'wechat-minigame');\n }\n // 检测字节跳动小游戏环境\n else if (this.isByteDanceMiniGame()) {\n platform = 'bytedance-minigame';\n confident = true;\n adapterClass = 'ByteDanceMiniGameAdapter';\n features.push('tt', 'bytedance-minigame');\n }\n // 检测支付宝小游戏环境\n else if (this.isAlipayMiniGame()) {\n platform = 'alipay-minigame';\n confident = true;\n adapterClass = 'AlipayMiniGameAdapter';\n features.push('my', 'alipay-minigame');\n }\n // 检测百度小游戏环境\n else if (this.isBaiduMiniGame()) {\n platform = 'baidu-minigame';\n confident = true;\n adapterClass = 'BaiduMiniGameAdapter';\n features.push('swan', 'baidu-minigame');\n }\n // 检测浏览器环境\n else if (this.isBrowser()) {\n platform = 'browser';\n confident = true;\n adapterClass = 'BrowserAdapter';\n features.push('browser');\n }\n // 添加功能检测特征\n if (typeof Worker !== 'undefined') {\n features.push('Worker');\n }\n if (typeof SharedArrayBuffer !== 'undefined') {\n features.push('SharedArrayBuffer');\n }\n if (typeof navigator !== 'undefined' && navigator.hardwareConcurrency) {\n features.push('hardwareConcurrency');\n }\n if (typeof performance !== 'undefined' && typeof performance.now === 'function') {\n features.push('performance.now');\n }\n if (typeof Blob !== 'undefined') {\n features.push('Blob');\n }\n if (typeof URL !== 'undefined' && typeof URL.createObjectURL === 'function') {\n features.push('URL.createObjectURL');\n }\n return {\n platform,\n confident,\n features,\n ...(adapterClass && { adapterClass })\n };\n }\n /**\n * 检测是否为微信小游戏环境\n */\n static isWeChatMiniGame() {\n // 检查wx全局对象\n if (typeof globalThis.wx !== 'undefined') {\n const wx = globalThis.wx;\n // 检查微信小游戏特有的API\n return !!(wx.getSystemInfo && wx.createCanvas && wx.createImage);\n }\n return false;\n }\n /**\n * 检测是否为字节跳动小游戏环境\n */\n static isByteDanceMiniGame() {\n // 检查tt全局对象\n if (typeof globalThis.tt !== 'undefined') {\n const tt = globalThis.tt;\n // 检查字节跳动小游戏特有的API\n return !!(tt.getSystemInfo && tt.createCanvas && tt.createImage);\n }\n return false;\n }\n /**\n * 检测是否为Node.js环境\n */\n static isNodeJS() {\n try {\n // 检查Node.js特有的全局对象和模块\n return !!(typeof process !== 'undefined' &&\n process.versions &&\n process.versions.node &&\n typeof require !== 'undefined' &&\n typeof module !== 'undefined' &&\n typeof exports !== 'undefined' &&\n // 确保不是在浏览器环境中的Node.js模拟\n typeof window === 'undefined' &&\n typeof document === 'undefined');\n }\n catch {\n return false;\n }\n }\n /**\n * 检测是否为支付宝小游戏环境\n */\n static isAlipayMiniGame() {\n // 检查my全局对象\n if (typeof globalThis.my !== 'undefined') {\n const my = globalThis.my;\n // 检查支付宝小游戏特有的API\n return !!(my.getSystemInfo && my.createCanvas);\n }\n return false;\n }\n /**\n * 检测是否为百度小游戏环境\n */\n static isBaiduMiniGame() {\n // 检查swan全局对象\n if (typeof globalThis.swan !== 'undefined') {\n const swan = globalThis.swan;\n // 检查百度小游戏特有的API\n return !!(swan.getSystemInfo && swan.createCanvas);\n }\n return false;\n }\n /**\n * 检测是否为浏览器环境\n */\n static isBrowser() {\n // 检查浏览器特有的对象和API\n return typeof window !== 'undefined' &&\n typeof document !== 'undefined' &&\n typeof navigator !== 'undefined' &&\n window.location !== undefined;\n }\n /**\n * 检测是否在 Tauri 桌面环境中运行\n * Check if running in Tauri desktop environment\n *\n * 同时支持 Tauri v1 (__TAURI__) 和 v2 (__TAURI_INTERNALS__)\n * Supports both Tauri v1 (__TAURI__) and v2 (__TAURI_INTERNALS__)\n */\n static isTauriEnvironment() {\n if (typeof window === 'undefined') {\n return false;\n }\n // Tauri v1 uses __TAURI__, Tauri v2 uses __TAURI_INTERNALS__\n return '__TAURI__' in window || '__TAURI_INTERNALS__' in window;\n }\n /**\n * 检测是否在编辑器环境中运行\n * Check if running in editor environment\n *\n * 包括 Tauri 桌面应用或带 __ESENGINE_EDITOR__ 标记的环境\n * Includes Tauri desktop app or environments marked with __ESENGINE_EDITOR__\n */\n static isEditorEnvironment() {\n if (typeof window === 'undefined') {\n return false;\n }\n // Tauri desktop app | Tauri 桌面应用\n if (this.isTauriEnvironment()) {\n return true;\n }\n // Editor marker | 编辑器标记\n if ('__ESENGINE_EDITOR__' in window) {\n return true;\n }\n return false;\n }\n /**\n * 获取详细的环境信息(用于调试)\n */\n static getDetailedInfo() {\n const info = {};\n // 基础检测\n info['userAgent'] = typeof navigator !== 'undefined' ? navigator.userAgent : 'unknown';\n info['platform'] = typeof navigator !== 'undefined' ? navigator.platform : 'unknown';\n // 全局对象检测\n info['globalObjects'] = {\n window: typeof window !== 'undefined',\n document: typeof document !== 'undefined',\n navigator: typeof navigator !== 'undefined',\n wx: typeof globalThis.wx !== 'undefined',\n tt: typeof globalThis.tt !== 'undefined',\n my: typeof globalThis.my !== 'undefined',\n swan: typeof globalThis.swan !== 'undefined'\n };\n // Worker相关检测\n info['workerSupport'] = {\n Worker: typeof Worker !== 'undefined',\n SharedWorker: typeof SharedWorker !== 'undefined',\n ServiceWorker: typeof navigator !== 'undefined' && 'serviceWorker' in navigator,\n SharedArrayBuffer: typeof SharedArrayBuffer !== 'undefined',\n crossOriginIsolated: typeof self !== 'undefined' ? self.crossOriginIsolated : false\n };\n // 性能相关检测\n info['performance'] = {\n performanceNow: typeof performance !== 'undefined' && typeof performance.now === 'function',\n hardwareConcurrency: typeof navigator !== 'undefined' ? navigator.hardwareConcurrency : undefined\n };\n // 其他API检测\n info['apiSupport'] = {\n Blob: typeof Blob !== 'undefined',\n URL: typeof URL !== 'undefined',\n createObjectURL: typeof URL !== 'undefined' && typeof URL.createObjectURL === 'function',\n ArrayBuffer: typeof ArrayBuffer !== 'undefined',\n TypedArrays: typeof Float32Array !== 'undefined'\n };\n return info;\n }\n}\n//# sourceMappingURL=PlatformDetector.js.map","/**\n * 平台适配模块导出\n */\n// 平台检测器\nexport { PlatformDetector } from './PlatformDetector';\n// 平台管理器\nexport { PlatformManager } from './PlatformManager';\n// 内部导入用于便利函数\nimport { PlatformManager } from './PlatformManager';\n// 便利函数\nexport function registerPlatformAdapter(adapter) {\n return PlatformManager.getInstance().registerAdapter(adapter);\n}\nexport function getCurrentAdapter() {\n return PlatformManager.getInstance().getAdapter();\n}\nexport function getBasicWorkerConfig() {\n return PlatformManager.getInstance().getBasicWorkerConfig();\n}\nexport function getFullPlatformConfig() {\n return PlatformManager.getInstance().getFullPlatformConfig();\n}\nexport function supportsFeature(feature) {\n return PlatformManager.getInstance().supportsFeature(feature);\n}\nexport function hasAdapter() {\n return PlatformManager.getInstance().hasAdapter();\n}\n//# sourceMappingURL=index.js.map"],"names":["__decorate","decorators","target","key","desc","d","c","arguments","length","r","Object","getOwnPropertyDescriptor","Reflect","decorate","i","defineProperty","__metadata","metadataKey","metadataValue","metadata","SuppressedError","Time","update","deltaTime","this","unscaledDeltaTime","timeScale","unscaledTotalTime","totalTime","frameCount","sceneChanged","checkEvery","interval","lastTime","PerformanceWarningType","Timer","_timeInSeconds","_repeats","_isDone","_elapsedTime","_proto","prototype","getContext","context","reset","stop","tick","_onTime","initialize","timeInsSeconds","repeats","onTime","bind","unload","_createClass","get","injectableMetadata","WeakMap","updatableMetadata","Injectable","existing","set","_extends","injectable","dependencies","properties","Updatable","priority","Error","name","updatable","InjectProperty","serviceType","propertyKey","constructor","Map","isInjectable","_metadata$injectable","createInstance","container","instance","injectProperties","size","_step","_iterator","_createForOfIteratorHelperLoose","done","_step$value","value","service","resolve","isUpdatable","_metadata$updatable","getUpdatableMetadata","TimerManager","_timers","splice","schedule","timeInSeconds","timer","push","dispose","PerformanceMonitor","_systemData","_systemStats","_isEnabled","_maxRecentSamples","enable","disable","startMonitoring","_systemName","performance","now","endMonitoring","systemName","startTime","entityCount","endTime","executionTime","data","averageTimePerEntity","lastUpdateTime","updateStats","stats","averageTime","minTime","Number","MAX_VALUE","maxTime","executionCount","recentTimes","standardDeviation","percentile95","percentile99","Math","min","max","shift","calculateAdvancedStats","mean","reduce","a","b","variance","acc","time","pow","sqrt","sortedTimes","concat","sort","len","floor","getSystemData","getSystemStats","getAllSystemData","getAllSystemStats","getPerformanceReport","lines","Array","from","entries","toFixed","totalCurrentTime","values","sum","join","clear","resetSystem","getPerformanceWarnings","thresholdMs","_step2","warnings","_iterator2","_step2$value","setMaxRecentSamples","maxSamples","_step3","_iterator3","Pool","createFn","maxSize","estimatedObjectSize","_objects","_createFn","_maxSize","_objectSize","_stats","totalCreated","totalObtained","totalReleased","hitRate","estimatedMemoryUsage","getPool","type","pool","_pools","obtain","obj","pop","_updateHitRate","_updateMemoryUsage","release","getStats","compact","targetSize","prewarm","count","actualCount","setMaxSize","getAvailableCount","isEmpty","isFull","getAllPoolTypes","keys","getAllPoolStats","toString","compactAllPools","clearAllPools","_step4","_iterator4","getGlobalStatsString","_i","_Object$entries","_Object$entries$_i","typeName","stat","hits","PoolManager","pools","autoCompactInterval","lastCompactTime","registerPool","Date","createPool","removePool","getPoolNames","getPoolCount","getAllStats","_step3$value","getGlobalStats","totalSize","totalMaxSize","totalMemoryUsage","getStatsString","globalStats","_step5","_iterator5","_step5$value","setAutoCompactInterval","intervalMs","prewarmAllPools","_step6","_iterator6","prewarmCount","COMPONENT_TYPE_NAME","Symbol","COMPONENT_DEPENDENCIES","SYSTEM_TYPE_NAME","ECSComponent","options","requires","getSystemMetadata","systemType","__systemMetadata__","getComponentTypeName","componentType","decoratorName","getSystemTypeName","getComponentInstanceTypeName","component","getSystemInstanceTypeName","system","WeakRefPolyfill","_target","deref","WeakRefImpl","globalThis","WeakRef","global","window","globalEntitySceneMap","getSceneByEntityId","entityId","sceneRef","LogLevel","ReferenceTracker","_references","_proto2","registerReference","entity","id","records","Set","_findRecord","add","unregisterReference","record","clearReferencesTo","validRecords","_validRecords","clearComponentReferences","toDelete","comp","_i2","_toDelete","getReferencesTo","cleanup","entitiesToDelete","_i4","_toDelete2","_i3","_entitiesToDelete","registerEntityScene","scene","unregisterEntityScene","getDebugInfo","_step7","info","_iterator7","_step8","_step7$value","_iterator8","componentId","_step9","_iterator9","Colors","BLACK","RED","GREEN","YELLOW","BLUE","MAGENTA","CYAN","WHITE","BRIGHT_BLACK","BRIGHT_RED","BRIGHT_GREEN","BRIGHT_YELLOW","BRIGHT_BLUE","BRIGHT_MAGENTA","BRIGHT_CYAN","BRIGHT_WHITE","RESET","BOLD","UNDERLINE","ConsoleLogger","config","_config","level","Info","enableTimestamp","enableColors","debug","message","_len","args","_key","log","apply","Debug","_len2","_key2","warn","_len3","_key3","Warn","error","_len4","_key4","fatal","_len5","_key5","Fatal","setLevel","setColors","colors","setPrefix","prefix","formattedMessage","toISOString","toUpperCase","output","_len6","_key6","outputToConsole","getColors","_len7","_key7","_console","_console2","console","_console3","_console4","_console5","_console6","_console7","_console8","_console9","_console0","LoggerManager","_loggers","_defaultLevel","createDefaultLogger","_loggerFactory","getInstance","_instance","getLogger","has","defaultLogger","setLogger","logger","setGlobalLevel","_defaultLogger","createChildLogger","parentName","childName","fullName","setGlobalColors","resetColors","setLoggerFactory","factory","Logger","createLogger","ENTITY_REF_METADATA","ENTITY_REF_VALUES","getValueMap","map","getEntityRefMetadata","root","self","Function","_","functionThis","eval","indirectEvalThis","exporter","makeExporter","previous","configurable","writable","hasOwn","hasOwnProperty","supportsSymbol","toPrimitiveSymbol","toPrimitive","iteratorSymbol","iterator","supportsCreate","create","supportsProto","__proto__","downLevel","HashMap","MakeDictionary","call","undefined","functionPrototype","getPrototypeOf","_Map","CreateMapPolyfill","_Set","CreateSetPolyfill","_WeakMap","CreateWeakMapPolyfill","registrySymbol","metadataRegistry","GetOrCreateMetadataRegistry","metadataProvider","CreateMetadataProvider","attributes","IsUndefined","IsArray","TypeError","IsConstructor","DecorateConstructor","IsObject","IsNull","DecorateProperty","ToPropertyKey","decorator","IsPropertyKey","OrdinaryDefineOwnMetadata","defineMetadata","hasMetadata","OrdinaryHasMetadata","hasOwnMetadata","OrdinaryHasOwnMetadata","getMetadata","OrdinaryGetMetadata","getOwnMetadata","OrdinaryGetOwnMetadata","getMetadataKeys","OrdinaryMetadataKeys","getOwnMetadataKeys","OrdinaryOwnMetadataKeys","deleteMetadata","provider","GetMetadataProvider","OrdinaryDeleteMetadata","decorated","descriptor","MetadataKey","O","P","parent","OrdinaryGetPrototypeOf","ToBoolean","MetadataValue","ownKeys","parentKeys","ownKeys_1","_a","parentKeys_1","Type","x","IsSymbol","ToPrimitive","input","PreferredType","hint","exoticToPrim","GetMethod","result","OrdinaryToPrimitive","valueOf","toString_1","IsCallable","argument","ToString","isArray","SameValueZero","y","V","func","GetIterator","method","IteratorValue","iterResult","IteratorStep","next","IteratorClose","f","proto","prototypeProto","CreateMetadataRegistry","fallback","first","second","rest","CreateFallbackProvider","targetProviderMap","registry","registerProvider","getProvider","setProvider","isExtensible","getProviderNoCache","isProviderFor","providerMap","hasProvider","existingProvider","enumerable","targetMetadata","GetOrCreateMetadataMap","Create","createdTargetMetadata","metadataMap","k","nextValue","e","reflect","metadataOwner","metadataPropertySet","registeredProvider","cacheSentinel","arraySentinel","MapIterator","selector","_index","_keys","_values","_selector","index","_cacheKey","_cacheIndex","_find","getKey","getValue","getEntry","insert","_map","UUID_SIZE","rootKey","CreateUniqueKey","table","GetOrCreateWeakMapTable","CreateUUID","FillRandomBytes","buffer","random","GenRandomBytes","Uint8Array","array","crypto","getRandomValues","msCrypto","offset","byte","toLowerCase","__","PROPERTY_METADATA","SoATypeRegistry","getConstructor","TYPE_CONSTRUCTORS","Float32Array","getBytesPerElement","TYPE_BYTES","getTypeName","Float64Array","Int32Array","Uint32Array","Int16Array","Uint16Array","Int8Array","Uint8ClampedArray","createSameType","source","capacity","extractFieldMetadata","typeWithMeta","decoratorMap","addDecorators","fields","__float64Fields","__float32Fields","__int32Fields","__uint32Fields","__int16Fields","__uint16Fields","__int8Fields","__uint8Fields","__uint8ClampedFields","instanceKeys","filter","_typeWithMeta$__seria","_typeWithMeta$__seria2","_typeWithMeta$__seria3","_typeWithMeta$__deepC","fieldMeta","decoratorType","arrayType","__serializeMapFields","isSerializedMap","__serializeSetFields","isSerializedSet","__serializeArrayFields","isSerializedArray","__deepCopyFields","isDeepCopy","float32","float64","int32","uint32","int16","uint16","int8","uint8","uint8clamped","SoASerializer","serialize","fieldName","isMap","JSON","stringify","isSet","_logger","deserialize","serialized","parsed","parse","deepClone","_this","getTime","item","cloned","Int32","String","SoAStorage","stringFields","serializedFields","complexFields","entityToIndex","indexToEntity","freeIndices","_size","_capacity","fieldTypes","serializeMapFields","serializeSetFields","serializeArrayFields","initializeFields","float64Fields","float32Fields","int32Fields","uint32Fields","int16Fields","uint16Fields","int8Fields","uint8Fields","uint8ClampedFields","decoratedFields","_step0","_iterator0","effectiveType","ArrayConstructor","addComponent","updateComponentAtIndex","resize","complexFieldMap","highPrecisionFields","__highPrecisionFields","deepCopyFields","getComponent","createProxyView","Proxy","prop","propStr","getFieldType","stringArray","serializedArray","fieldType","_self$complexFields$g","_step1","_iterator1","_step10","_iterator10","_step11","_iterator11","_step12","_iterator12","_self$complexFields$g2","getComponentSnapshot","_step13","_iterator13","_step13$value","_step14","_iterator14","_step14$value","_step15","_iterator15","_step15$value","_step16","_iterator16","_step16$value","hasComponent","removeComponent","newCapacity","_step17","_iterator17","_step17$value","oldArray","newArray","_step18","_iterator18","_step18$value","_step19","_iterator19","_step19$value","getActiveIndices","getFieldArray","getTypedFieldArray","getEntityIndex","getEntityIdByIndex","_step20","_iterator20","fill","_step21","_iterator21","_step22","_iterator22","activeEntries","newEntityToIndex","newIndexToEntity","newIndex","entry","oldIndex","_step23","_iterator23","_step24","_iterator24","_step25","_iterator25","_step26","totalMemory","fieldStats","_iterator26","_step26$value","bytesPerElement","memory","usedSlots","fragmentation","memoryUsage","performVectorizedOperation","operation","activeIndices","Component","idGenerator","onAddedToEntity","onRemovedFromEntity","onDeserialized","SERIALIZABLE_METADATA","SERIALIZE_FIELD","SERIALIZE_OPTIONS","Serializable","version","inheritedMetadata","ignoredFields","Serialize","getSerializationMetadata","componentClass","HierarchyComponent","_Component","parentId","childIds","depth","bActiveInHierarchy","bCacheDirty","_inheritsLoose","typeId","CommandType","Matcher","condition","all","any","none","matcher","byTag","tag","withTag","byName","withName","byComponent","withComponent","complex","empty","nothing","matchNothing","_this$condition$all","_this$condition$any","_this$condition$none","exclude","one","withoutTag","withoutName","withoutComponent","getCondition","isNothing","clone","_cloned$condition$all","_cloned$condition$any","_cloned$condition$non","parts","t","EntityCache","_frameCache","_persistentCache","_trackedEntities","getFrame","setFrame","entities","getPersistent","setPersistent","getTracked","addTracked","removeTracked","isTracked","invalidate","clearFrame","clearAll","hasPersistent","hasFrame","_this$_frameCache$len","_this$_frameCache","_this$_persistentCach","_this$_persistentCach2","trackedCount","frameEntityCount","persistentEntityCount","CommandBuffer","_commands","_scene","_debug","setScene","ADD_COMPONENT","REMOVE_COMPONENT","destroyEntity","DESTROY_ENTITY","setEntityActive","active","SET_ENTITY_ACTIVE","flush","commands","cmd","executeCommand","removeComponentByType","destroy","command","EntitySystem","_updateOrder","_addOrder","_enabled","_performanceMonitor","_initialized","_matcher","_eventListeners","_destroyed","_entityIdMap","_entityIdMapVersion","getLoggerName","_entityCache","setPerformanceMonitor","monitor","getPerformanceMonitor","setUpdateOrder","order","_this$_scene","markSystemsOrderDirty","queryEntities","onAdded","onInitialize","clearEntityCache","resetEntityTracking","_this$scene","querySystem","currentEntities","getAllEntities","isSingleCondition","executeSingleConditionQuery","executeComplexQuery","updateEntityTracking","flags","queryByTag","queryByName","queryByComponent","queryAll","queryAny","queryNone","executeComplexQueryWithIdSets","resultIds","tagResult","extractEntityIds","nameIds","intersectIdSets","componentIds","allIds","anyIds","noneResult","noneIds","differenceIdSets","idSetToEntityArray","idSet","setA","setB","smaller","larger","getEntityIdMap","allEntities","_this$scene$querySyst","_this$scene2","currentVersion","rebuildEntityIdMap","entityMap","onCheckProcessing","onBegin","process","lateUpdate","lateProcess","onEnd","flushCommands","_entities","getPerformanceData","getPerformanceStats","resetPerformanceData","perfData","perfInfo","matchesEntity","hasAny","isTracking","handleEntityComponentChanged","wasTracked","nowMatches","onRemoved","currentSet","hasChanged","_entity","cleanupManualEventListeners","onDestroy","addEventListener","eventType","handler","_this$scene3","eventSystem","listenerRef","on","removeEventListener","listenerIndex","findIndex","listener","off","requireComponent","getComponents","components","forEach","processor","filterEntities","predicate","mapEntities","mapper","findEntity","someEntity","everyEntity","frameCache","HierarchySystem","_EntitySystem","dirtyEntities","updateHierarchyCache","setParent","child","_parent$id","childHierarchy","currentParentId","isAncestorOf","oldParent","findEntityById","oldParentHierarchy","idx","indexOf","parentHierarchy","markCacheDirty","insertChildAt","existingIdx","removeChild","removeAllChildren","childId","getParent","_this$scene$findEntit","_this$scene4","hierarchy","getChildren","children","_this$scene5","getChildCount","_hierarchy$childIds$l","hasChildren","ancestor","current","MAX_DEPTH","isDescendantOf","descendant","getRoot","getDepth","isActiveInHierarchy","getRootEntities","roots","findChild","bRecursive","found","findChildrenByTag","forEachChild","callback","flattenHierarchy","expandedIds","_this2","traverse","bHasChildren","bIsExpanded","_this$scene6","_this$scene7","_this$scene8","EntityDataCollector","collectEntityData","getEmptyEntityDebugData","entityList","calculateFallbackEntityStats","totalEntities","activeEntities","pendingAdd","pendingRemove","entitiesPerArchetype","topEntitiesByComponents","entityHierarchy","entityDetailsMap","archetypeData","collectArchetypeData","distribution","topEntities","getRawEntityList","hierarchySystem","getSystem","_hierarchySystem$isAc","_hierarchySystem$getD","_hierarchy$parentId","_hierarchy$childIds","enabled","activeInHierarchy","componentCount","componentTypes","updateOrder","getEntityDetails","_entity$parent","_entity$components","_entity$components2","find","baseDebugInfo","buildFallbackEntityInfo","componentDetails","extractComponentDetails","sceneInfo","getSceneInfo","sceneName","sceneType","trim","_name","_Object$getPrototypeO","sceneClassName","collectEntityDataWithMemory","collectArchetypeDataWithMemory","buildEntityHierarchyTree","buildEntityDetailsMap","_scene$entities","archetypeSystem","getAllArchetypes","extractArchetypeStatistics","entityContainer","getArchetypeDistributionFast","getTopEntitiesByComponentsFast","_entity$components3","signature","_ref","slice","_entity$components4","_scene$entities2","extractArchetypeStatisticsWithMemory","getArchetypeDistributionWithMemory","getTopEntitiesByComponentsWithMemory","archetypes","archetype","_archetype$componentT","_archetype$entities","_entity$components5","_archetype$componentT2","_archetype$entities2","actualMemory","sampleSize","sampleMemory","estimateEntityMemoryUsage","_entity$components6","_entity$components7","isNaN","_ref2","_this3","_entity$components8","isDestroyed","averageComponentsPerEntity","_e$components","_this4","entitySize","calculateObjectSize","componentSize","excludeKeys","visited","WeakSet","calculate","itemSize","maxKeys","includes","startsWith","_this5","rootEntities","hierarchyNode","buildEntityHierarchyNode","nodeA","nodeB","_hierarchySystem$isAc2","_hierarchySystem$getD2","_hierarchy$parentId2","_this6","node","_this7","_parent$name","componentCacheStats","getComponentCacheStats","cachePerformance","cacheStats","_hierarchySystem$isAc3","_hierarchySystem$getD3","_entity$componentMask","_hierarchy$parentId3","_hierarchy$childIds2","_hierarchy$childIds3","destroyed","componentMask","childCount","_this8","propertyValue","formatPropertyValue","getComponentProperties","componentIndex","_this9","_error","substring","formatObjectFirstLevel","createLazyLoadPlaceholder","_this0","sample","_isLazyArray","_arrayLength","_sample","_summary","processedCount","_hasMoreProperties","_totalProperties","_hiddenCount","_obj$constructor","_isLazyObject","_typeName","getObjectSummary","_objectId","generateObjectId","substr","z","g","_obj$node","_obj$node2","nodeName","_id","uuid","_uuid","_unused","expandLazyObject","propertyPath","targetObject","getObjectByPath","path","split","part","arrayName","parseInt","SystemDataCollector","collectSystemData","performanceMonitor","totalSystems","systemsInfo","entityProcessors","systems","processors","systemStats","systemData","_system$entities","minExecutionTime","maxExecutionTime","executionTimeHistory","PerformanceDataCollector","frameTimeHistory","maxHistoryLength","gcCollections","lastMemoryCheck","collectPerformanceData","frameTimeSeconds","engineFrameTimeMs","currentFps","round","ecsPerformanceData","getECSPerformanceData","ecsExecutionTimeMs","totalExecutionTime","ecsPercentage","usedJSHeapSize","history","frameTime","engineFrameTime","fps","averageFrameTime","minFrameTime","maxFrameTime","systemPerformance","getSystemPerformance","systemBreakdown","memoryDetails","getMemoryDetails","systemTime","percentage","samples","lastExecutionTime","memoryInfo","pooled","usedMemory","freeMemory","updateGCCount","perfMemory","jsHeapSizeLimit","entityMemory","componentMemory","systemMemory","pooledMemory","PerformanceObserver","measureUserAgentSpecificMemory","ComponentPool","resetFn","minSize","totalAcquired","acquire","targetCount","shrink","getMaxSize","currentSize","utilizationRate","ComponentPoolManager","usageTracker","autoCleanupInterval","lastCleanupTime","componentName","createCount","releaseCount","lastAccessTime","acquireComponent","trackUsage","releaseComponent","action","tracker","getHotComponents","threshold","prewarmAll","_step4$value","poolStats","usage","getPoolStats","available","getPoolUtilization","utilization","_step6$value","used","utilRate","total","getComponentUtilization","ComponentDataCollector","collectComponentData","componentInstances","componentStats","totalInstances","poolUtilizations","poolSizes","poolManager","utilizations","util","poolSize","poolUtilization","memoryPerInstance","getEstimatedComponentSize","instanceCount","averagePerEntity","componentSizeCache","calculatedSize","calculateQuickObjectSize","calculateDetailedComponentMemory","estimateObjectSize","maxElements","getOwnPropertyNames","maxProps","ceil","clearCache","ProfileCategory","SceneDataCollector","sceneStartTime","collectSceneData","_entityList$buffer","_entityProcessors$pro","currentSceneName","isInitialized","sceneRunTime","sceneEntityCount","sceneSystemCount","sceneUptime","runTime","_didSceneBegin","setSceneStartTime","WebSocketManager","url","autoReconnect","isConnected","reconnectAttempts","maxReconnectAttempts","setMessageHandler","messageHandler","connect","Promise","reject","ws","WebSocket","onopen","event","handleOpen","onclose","handleClose","onerror","handleError","onmessage","handleMessage","handleConnectionFailure","disconnect","close","send","getConnectionStatus","setMaxReconnectAttempts","attempts","scheduleReconnect","reconnectTimer","clearTimeout","delay","setTimeout","onOpen","onClose","onError","DEFAULT_PROFILER_CONFIG","maxFrameHistory","maxSampleDepth","collectMemory","memorySampleInterval","detectLongTasks","longTaskThreshold","enabledCategories","idCounter","ProfilerSDK","currentFrame","frameHistory","frameNumber","activeSamples","sampleStack","counters","callGraph","gcCount","previousHeapSize","longTasks","performanceObserver","setupLongTaskObserver","resetInstance","beginSample","category","Custom","endSample","handle","measure","fn","measureAsync","_measureAsync","_asyncToGenerator","_regenerator","m","_callee","w","_context","n","_x","_x2","_x3","beginFrame","endFrame","incrementCounter","setGauge","setEnabled","isEnabled","getCurrentFrame","getFrameHistory","getReport","generateReport","parentHandle","duration","selfTime","callCount","updateCallGraph","stackIndex","_measureAsync2","_callee2","_context2","p","v","_x4","_x5","_x6","sampleStats","captureMemory","categoryStats","resetFrameCounters","calculateSampleStats","calculateCategoryStats","counter","_firstFrame$startTime","_lastFrame$endTime","frames","createEmptyReport","frameTimes","hotspots","aggregateSampleStats","inclusiveTime","categoryBreakdown","aggregateCategoryStats","buildCallGraphFromFrames","firstFrame","lastFrame","totalFrames","p95FrameTime","p99FrameTime","memoryTrend","tempData","callers","callees","callerData","parentNode","calleeData","avgCallers","callerName","avgCallees","calleeName","getCallGraph","getFunctionCallInfo","usedHeapSize","totalHeapSize","heapSizeLimit","perfWithMemory","totalJSHeapSize","timestamp","utilizationPercent","sampleMap","exclusiveTime","percentOfFrame","percentOfParent","_loop","parentSample","s","parentStats","childSample","frameDuration","categoryMap","sampleCount","_step10$value","aggregated","agg","percentOfTotal","list","getEntries","_entry$attribution","attribution","observe","entryTypes","SegmentPart","AdvancedProfilerCollector","selectedFunction","peakMemory","setSelectedFunction","collectAdvancedData","report","currentMemory","getDefaultMemory","buildCurrentFrameData","buildFrameTimeHistory","buildCategoryStats","buildHotspots","buildCallGraph","buildMemoryTrend","summary","buildSummary","collectFromLegacyMonitor","_performanceMonitor$g","_performanceMonitor$g2","createEmptyData","buildCategoryStatsFromLegacy","buildHotspotsFromLegacy","getCurrentMemory","currentFunction","currentMemoryMB","peakMemoryMB","longTaskCount","frame","categoryItems","percentOfCategory","items","_performanceMonitor$g3","_performanceMonitor$g4","ecsItems","totalECSTime","execTime","_ecsItems","ECS","h","rootFunctions","childFunctions","hasParentInHotspots","buildHotspotItem","inclusiveTimePercent","exclusiveTimePercent","avgCallTime","rootName","totalCallerCount","percentOfCurrent","snapshots","usedMB","totalMB","_perfWithMemory$memor","_perfWithMemory$memor2","_perfWithMemory$memor3","BitMask64Utils","bitIndex","mask","base","setBit","fromNumber","bits","bitsBase","maskBase","bitsSegments","segments","maskSegments","baseHasAny","LOW","HIGH","some","seg","bitsSeg","hasAll","_maskSegments$length","baseHasAll","maskSegmentsLength","maskSeg","hasNone","baseHasNone","every","isZero","baseIsZero","equals","_a$segments","_b$segments","baseEquals","aSegments","bSegments","aSeg","bSeg","targetSeg","getSegmentByBitIndex","mod","getBit","clearBit","orInPlace","other","otherSegments","targetSegments","otherSeg","andInPlace","xorInPlace","copy","copyLength","sourceSegments","sourSeg","radix","printHead","_mask$segments$length","_mask$segments","totalLength","paddingLength","padEnd","segResult","bitMaskData","hi","lo","padStart","hiBits","loBits","popCount","_mask$segments$length2","_mask$segments2","createNewSegment","_segments$targetSegIn","targetSegIndex","diff","ZERO","ComponentRegistry","register","hotReloadEnabled","componentNameToType","existingType","existingIndex","bitIndexToType","nextBitIndex","componentNameToId","getBitMask","getBitIndex","isRegistered","getTypeByBitIndex","getRegisteredCount","getComponentType","getAllRegisteredTypes","getAllComponentNames","getComponentId","registerComponentByName","createSingleComponentMask","cacheKey","maskCache","createComponentMask","componentNames","clearMaskCache","enableHotReload","disableHotReload","isHotReloadEnabled","ComponentStorage","dense","entityIds","lastIndex","lastComponent","lastEntityId","getDenseArray","totalSlots","freeSlots","ComponentStorageManager","storages","isSoAStorage","getSoAStorage","storage","getStorage","soaStorage","__enableSoA","removeAllComponents","getComponentMask","EntityComparer","compare","Entity","_isDestroyed","_active","_tag","_componentMask","_componentCache","_lifecyclePolicy","setSceneLocal","setDestroyedState","_rebuildComponentCache","componentStorageManager","maxBitIndex","createComponent","_construct","addComponentInternal","notifyQuerySystems","changedComponentType","updateEntity","clearSystemEntityCaches","notifyEntityComponentChanged","_this$tag","referenceTracker","isEditorMode","queueDeferredComponentCallback","emitSync","entityName","entityTag","getOrCreateComponent","_this$tag2","componentsToRemove","addComponents","addedComponents","removeComponentsByTypes","removedComponents","getComponentByType","baseType","onActiveChanged","removeEntity","remove","compareTo","cacheBuilt","entityComparer","EntityList","_idToEntity","_nameToEntities","_entitiesToAdd","_entitiesToRemove","addImmediate","updateNameIndex","removeImmediate","identifierPool","checkIn","removeAllEntities","idsToRecycle","updateLists","findEntitiesByName","findEntitiesByTag","findEntitiesWithComponent","forEachWhere","isAdd","reorderEntity","currentIndex","clampedIndex","activeCount","nameIndexSize","IdentifierPool","recycleDelay","expansionBlockSize","_nextAvailableIndex","_freeIndices","_generations","_pendingRecycle","_recycleDelay","totalAllocated","totalRecycled","currentActive","memoryExpansions","_expansionBlockSize","_preAllocateGenerations","checkOut","_processDelayedRecycle","MAX_INDEX","_ensureGenerationCapacity","generation","_packId","_unpackIndex","_unpackGeneration","_isValidId","isValid","totalGeneration","generationCount","averageGeneration","currentlyFree","pendingRecycle","maxPossibleEntities","maxUsedIndex","_calculateMemoryUsage","generationStorageSize","forceProcessDelayedRecycle","forceAll","readyToRecycle","stillPending","_readyToRecycle","newGeneration","MAX_GENERATION","startIndex","expansionStart","currentGeneration","EntityProcessorList","_processors","_isDirty","setDirty","getProcessor","begin","sortProcessors","end","Bits","initialValue","_value","num","containsAll","intersects","excludes","cardinality","and","or","xor","not","maxBits","copyFrom","setValue","toBinaryString","toHexString","fromBinaryString","binaryString","cleanString","replace","fromHexString","hexString","getHighestBitIndex","getLowestBitIndex","SparseSet","_dense","_sparse","lastItem","getIndex","getByIndex","getDenseArrayUnsafe","toArray","toSet","getMemoryStats","denseArraySize","sparseMapSize","validate","PoolableEntitySet","_wrapNativeSuper","ComponentSparseSet","_componentMasks","_componentToEntities","addEntity","entityComponents","bitMask","entityIndex","updateComponentMappings","getEntityComponentTypes","queryMultipleAnd","targetMask","_entitySetPool","entityMask","queryMultipleOr","getEntityMask","entitySet","entitiesStats","masksMemory","mappingsMemory","entitiesMemory","allMappedEntities","QueryConditionType","BitMaskHashMap","buckets","murmur32","seed","mix","imul","getHashes","_this$getHashes","primary","secondary","bucket","_this$getHashes2","_this$getHashes3","ArchetypeSystem","_archetypes","_entityToArchetype","_componentToArchetypes","_entityComponentTypesCache","_allArchetypes","archetypeId","generateArchetypeId","createArchetype","currentArchetype","newComponentTypes","newArchetypeId","newArchetype","queryArchetypes","matchingArchetypes","smallestSet","smallestSize","Infinity","queryMask","foundArchetypes","getEntityArchetype","getEntitiesByComponent","updateAllArchetypeArrays","ReactiveQueryChangeType","ReactiveQuery","_config$enableBatchMo","_config$batchDelay","_config$debug","_entityIdSet","_snapshot","_listeners","_condition","enableBatchMode","batchDelay","generateQueryId","_batchChanges","added","removed","subscribe","unsubscribeAll","getEntities","matches","ALL","ANY","NONE","notifyEntityAdded","addToBatch","notifyListeners","ADDED","notifyEntityRemoved","REMOVED","notifyEntityChanged","wasMatching","isMatching","initializeWith","flushBatchChanges","BATCH_UPDATE","change","pause","resume","QuerySystem","_version","_queryCache","_cacheMaxSize","_cacheTimeout","_componentMaskCache","_queryStats","totalQueries","cacheHits","indexHits","linearScans","archetypeHits","dirtyChecks","_reactiveQueries","_reactiveQueriesByComponent","_entityIndex","_archetypeSystem","setEntities","clearQueryCache","clearReactiveQueries","rebuildIndexes","deferCacheClear","addEntityToIndexes","notifyReactiveQueriesEntityAdded","addEntities","existingIds","addedCount","addEntitiesUnchecked","removeEntityFromIndexes","notifyReactiveQueriesEntityRemoved","notifyReactiveQueriesEntityRemovedFallback","notifyReactiveQueriesEntityChanged","createAndSetTagIndex","createAndSetNameIndex","tagSet","nameSet","getOrCreateReactiveQuery","fromCache","cached","getFromCache","addToCache","generateCacheKey","hitCount","cleanupCache","minHitCount","oldestKey","oldestTimestamp","createReactiveQuery","query","initialEntities","executeTraditionalQuery","queries","destroyReactiveQuery","indexStats","componentIndexSize","tagIndexSize","queryStats","cacheHitRate","optimizationStats","queryType","reactiveQuery","notified","QueryBuilder","conditions","withAll","withAny","without","execute","_this$querySystem","_this$querySystem2","_this$querySystem3","TypeSafeEventSystem","listeners","batchQueue","batchTimers","batchConfigs","nextListenerId","maxListeners","addListener","once","onAsync","async","listenerId","l","offAll","clearBatch","emit","_emit","batchConfig","executeEvent","toRemove","sortListenersByPriority","thisArg","removeListeners","setBatchConfig","flushBatch","batch","processBatch","createEmptyStats","resetStats","hasListeners","getListenerCount","clearAllBatches","setMaxListeners","_executeEvent","_callee3","sortedListeners","syncListeners","asyncListeners","asyncPromises","_context3","_t","listenerIds","batchSize","_processBatch","_callee4","batchEvent","_context4","events","_x7","triggerCount","averageExecutionTime","lastTriggerTime","listenerCount","TypedQueryResult","_componentTypes","getComponentTypes","TypedQueryBuilder","_all","_any","_none","types","withNone","buildMatcher","_matcher2","_matcher3","getRequiredTypes","ChangeOperation","ComponentSerializer","fieldKey","serializedValue","serializer","serializeValue","alias","serializedData","componentRegistry","deserializer","deserializeValue","serializeComponents","deserializeComponents","serializedComponents","__type","typedValue","validateVersion","expectedVersion","getSerializationInfo","isSerializable","EntitySerializer","includeChildren","serializedEntity","_hierarchySystem$scen","preserveIds","childData","childEntity","serializeEntities","deserializeEntities","serializedEntities","BinarySerializer","stringToUtf8","str","pos","bytes","code","charCodeAt","high","low","utf8ToString","byte1","fromCharCode","byte2","byte3","byte4","encode","jsonString","decode","SceneSerializer","opts","format","pretty","includeMetadata","componentTypeRegistry","buildComponentTypeRegistry","sceneData","serializeSceneData","serializedScene","SERIALIZATION_VERSION","componentTypeCount","serializationOptions","saveData","strategy","migration","getGlobalComponentRegistry","destroyAllEntities","_EntitySerializer$des","addChildrenRecursively","deserializeSceneData","deserializedPromises","callOnDeserializedForEntity","promises","childEntitiesMap","_childEntitiesMap$get","targetMap","componentTypeSet","errors","valid","getInfo","_data$metadata","IncrementalSerializer","createSnapshot","deepComponentComparison","trackSceneData","compressSnapshot","snapshot","snapshotVersion","componentMap","computeIncremental","baseSnapshot","incremental","baseVersion","entityChanges","componentChanges","sceneDataChanges","currentEntityIds","oldData","EntityUpdated","entityData","detectComponentChanges","EntityAdded","ComponentAdded","componentData","oldEntityId","EntityRemoved","detectSceneDataChanges","oldComponents","currentComponents","_step8$value","currentData","ComponentUpdated","oldType","ComponentRemoved","currentKeys","_step0$value","currentValue","oldValue","SceneDataUpdated","oldKey","deleted","applyIncremental","applyEntityAdded","applyEntityRemoved","applyEntityUpdated","applyComponentAdded","applyComponentRemoved","applyComponentUpdated","_change$entityData$ac","_change$entityData$en","newParent","serializeIncremental","deserializeIncremental","getIncrementalStats","totalChanges","addedEntities","removedEntities","updatedEntities","updatedComponents","resetVersion","DEFAULT_CONFIG","sampleInterval","minDuration","trackAsync","excludePatterns","maxBufferSize","AutoProfiler","wrappedObjects","samplingProfiler","registeredClasses","registerClass","className","wrapInstance","wrapFunction","startSampling","stopSampling","construct","newTarget","wrapInfoMap","getAllMethodNames","methodName","shouldExcludeMethod","getPropertyDescriptor","original","wrapped","createWrappedMethod","SamplingProfiler","start","then","methods","test","intervalId","isRunning","stack","captureStack","line","parseStackFrame","isInternalFrame","_unused2","match","pattern","ServiceLifetime","ServiceContainer","_services","_resolving","_updatableServices","registerSingleton","identifier","lifetime","Singleton","registerTransient","Transient","registerInstance","description","checkUpdatable","_metadata$priority","registration","chain","_metadata$priority2","tryResolve","unregister","getRegisteredServices","updateAll","getUpdatableCount","getAll","instances","Scene","_deferredComponentCallbacks","_cachedSystems","_systemsOrderDirty","_systemErrorCount","_maxErrorCount","_systemAddCounter","_componentIdToSystems","_globalNotifySystems","_rebuildSystemsCache","allServices","_filterEntitySystems","_sortSystemsByUpdateOrder","services","orderDiff","addOrder","onStart","frameHandle","updateHandle","systemHandle","_handleSystemError","lateUpdateHandle","flushCommandBuffers","flushHandle","phase","errorCount","createEntity","notifiedSystems","interestedSystems","indexSystemByComponents","addSystemToComponentIndex","removeSystemFromIndex","createEntities","namePrefix","destroyEntities","findPersistentEntities","isPersistent","extractPersistentEntities","persistentEntities","receiveMigratedEntities","_this$referenceTracke","getEntityByName","getEntitiesByTag","addEntityProcessor","systemTypeOrInstance","existingSystem","registerSystems","systemTypes","registeredSystems","addSystem","removeEntityProcessor","removeSystem","getEntityProcessor","processorCount","componentStorageStats","createIncrementalSnapshot","_incrementalBaseSnapshot","updateIncrementalSnapshot","clearIncrementalSnapshot","hasIncrementalSnapshot","_this$_services$tryRe","EntityBuilder","storageManager","named","tagged","withComponents","_components","withIf","withFactory","configure","configurator","withChild","childBuilder","build","withChildren","childBuilders","_childBuilders","withChildFactory","childFactory","withChildIf","spawn","newBuilder","SceneBuilder","withEntity","withEntityBuilder","builderFn","withEntities","withSystem","withSystems","_systems","ComponentBuilder","property","setIf","EntityBatchOperator","setActive","setTag","ECSFluentAPI","createScene","findFirst","findByName","findByTag","emitAsync","_emitAsync","systemCount","eventStats","createECSAPI","PluginState","World","_scenes","_activeScenes","_globalSystems","_isActive","maxScenes","autoCleanup","_createdAt","sceneInstance","removeScene","setSceneActive","getScene","getSceneIds","getAllScenes","removeAllScenes","_sceneNames","isSceneActive","getActiveSceneCount","addGlobalSystem","removeGlobalSystem","getGlobalSystem","updateGlobalSystems","updateScenes","shouldAutoCleanup","_sceneNames2","getStatus","isActive","sceneCount","activeSceneCount","globalSystemCount","createdAt","scenes","_this$_scenes$get","averageUpdateTime","maxUpdateTime","currentTime","_step9$value","sceneNames","_sceneNames3","SceneManager","_nextScene","_ecsAPI","_pendingPersistentEntities","_defaultWorld","setSceneChangedCallback","_onSceneChangedCallback","currentScene","DEFAULT_SCENE_ID","loadScene","DebugConfigService","websocketUrl","debugFrameRate","channels","setConfig","getConfig","DebugManager","frameCounter","lastSendTime","sendInterval","originalConsole","configService","entityCollector","systemCollector","performanceCollector","componentCollector","sceneCollector","advancedProfilerCollector","webSocketManager","interceptConsole","connectWebSocket","_this$originalConsole","sendLog","formatLogMessage","_this$originalConsole2","_this$originalConsole3","_this$originalConsole4","_this$originalConsole5","arg","safeStringify","maxDepth","seen","updateConfig","_deltaTime","sendDebugData","onSceneChanged","handleMemorySnapshotRequest","handleExpandLazyObjectRequest","handleGetComponentPropertiesRequest","handleGetRawEntityListRequest","handleGetEntityDetailsRequest","handleGetAdvancedProfilerDataRequest","handleSetProfilerSelectedFunction","requestId","sceneManager","expandedData","rawEntityList","entityDetails","advancedData","functionName","success","memorySnapshot","captureMemorySnapshot","baseMemoryInfo","collectBaseMemoryInfo","componentMemoryStats","collectComponentMemoryStats","breakdown","systemMemoryStats","collectSystemMemoryStats","poolMemoryStats","collectPoolMemoryStats","performanceStats","collectPerformanceStats","totalEntityMemory","arch","totalMemoryLimit","memoryUtilization","poolMemory","baseMemory","largestEntities","heapInfo","detailedMemory","performanceWithMemory","totalComponentMemory","componentTypeCounts","detailedMemoryPerInstance","totalMemoryForType","componentBreakdown","averageMemory","largestInstances","totalSystemMemory","systemTypeMemoryCache","systemTypeName","calculateQuickSystemSize","totalPoolMemory","poolBreakdown","poolData","estimatedMemory","poolCount","_this$performanceMoni","topSystems","getDebugData","debugData","frameworkVersion","frameworkLoaded","_connectWebSocket","advancedProfiler","PluginManager","_plugins","_metadata","_core","core","install","_install","plugin","_checkDependencies","state","NotInstalled","installedAt","Installed","Failed","uninstall","_uninstall","_t2","_checkDependents","getPlugin","getAllPlugins","getAllMetadata","isInstalled","missingDeps","dep","dependents","reverse","WorldManager","_worlds","_isRunning","_framesSinceCleanup","maxWorlds","cleanupFrameInterval","createWorld","worldName","worldConfig","world","removeWorld","getWorld","getWorldIds","getAllWorlds","setWorldActive","isWorldActive","_world$isActive","getActiveWorlds","activeWorlds","startAll","stopAll","findWorlds","results","findWorldByName","totalWorlds","activeWorldCount","totalScenes","worlds","worldStats","getDetailedStatus","status","worldsToRemove","shouldCleanupWorld","_worldsToRemove","_worldNames","isOldEnough","Core","_this$_config$debug","_this$_config$debugCo","_serviceContainer","_timerManager","_poolManager","_sceneManager","_debugManager","_worldManager","worldManagerConfig","_pluginManager","debugConfig","coreConfig","updateInternal","enableDebug","disableDebug","_this$_instance","installPlugin","_installPlugin","uninstallPlugin","_uninstallPlugin","isPluginInstalled","_this$_config$debugCo2","debugEnabled","paused","frameStartTime","updateFPS","servicesStartTime","api","_this$_instance2","_this$_instance3","DebugPlugin","_options$autoStart","_options$updateInterv","worldManager","updateTimer","autoStart","updateInterval","setInterval","logStats","clearInterval","sys","getSystemInfo","getEntityInfo","perfStats","avgExecutionTime","totalCalls","getComponentInfo","_Object$keys","perfStr","exportJSON","ECSEventType","EventPriority","FuncPack","Emitter","_messageTable","addObserver","hasObserver","removeObserver","messageData","_observer$func","observer","removeAllObservers","getEventTypeCount","getObserverCount","GlobalManager","onEnabled","onDisabled","EVENT_TYPES","ENTITY","CREATED","ENTITY_CREATED","DESTROYED","ENTITY_DESTROYED","ENABLED","ENTITY_ENABLED","DISABLED","ENTITY_DISABLED","TAG_ADDED","ENTITY_TAG_ADDED","TAG_REMOVED","ENTITY_TAG_REMOVED","NAME_CHANGED","ENTITY_NAME_CHANGED","COMPONENT","COMPONENT_ADDED","COMPONENT_REMOVED","MODIFIED","COMPONENT_MODIFIED","COMPONENT_ENABLED","COMPONENT_DISABLED","SYSTEM","SYSTEM_ADDED","SYSTEM_REMOVED","SYSTEM_ENABLED","SYSTEM_DISABLED","PROCESSING_START","SYSTEM_PROCESSING_START","PROCESSING_END","SYSTEM_PROCESSING_END","ERROR","SYSTEM_ERROR","PERFORMANCE","WARNING","PERFORMANCE_WARNING","CRITICAL","PERFORMANCE_CRITICAL","MEMORY_HIGH","MEMORY_USAGE_HIGH","FRAME_DROP","FRAME_RATE_DROP","EventTypeValidator","validTypes","getAllValidTypes","addCustomType","removeCustomType","ProcessingSystem","processSystem","PassiveSystem","IntervalSystem","intervalRemainder","getIntervalDelta","PlatformManager","adapter","getAdapter","registerAdapter","supportsWorker","isWorkerSupported","supportsSharedArrayBuffer","isSharedArrayBufferSupported","hardwareConcurrency","getHardwareConcurrency","hasAdapter","getAdapterInfo","getPlatformConfig","supportsFeature","feature","supportsTransferableObjects","supportsModuleWorker","getBasicWorkerConfig","platformSupportsWorker","platformSupportsSharedArrayBuffer","platformMaxWorkerCount","platformLimitations","maxWorkerCount","limitations","getFullPlatformConfig","_getFullPlatformConfig","getPlatformConfigAsync","WorkerEntitySystem","_config$workerCount","_config$enableWorker","_config$useSharedArra","_config$entityDataSiz","_config$maxEntities","workerPool","isProcessing","sharedBuffer","sharedFloatArray","hasLoggedSyncMode","platformAdapter","requestedWorkerCount","workerCount","getMaxSystemWorkerCount","maxSystemWorkerCount","validatedWorkerCount","enableWorker","systemConfig","entitiesPerWorker","useSharedArrayBuffer","entityDataSize","getDefaultEntityDataSize","maxEntities","initializeSharedArrayBuffer","initializeWorkerPool","bufferSize","createSharedArrayBuffer","script","createWorkerScript","workers","fullScript","workerScriptPrefix","worker","createWorker","PlatformWorkerPool","_this$getSharedArrayB","functionBodyMatch","workerProcess","functionBody","sharedProcessMethod","getSharedArrayBufferProcessFunction","sharedProcessFunctionBody","_sharedFunctionBodyMa","sharedFunctionBodyMatch","processWithSharedArrayBuffer","processWithWorker","processSynchronously","_processWithSharedArrayBuffer","writeEntitiesToSharedBuffer","createSharedArrayBufferTasks","readResultsFromSharedBuffer","_processWithWorker","batches","batchResult","extractEntityData","createBatches","applyResult","finalResults","endIndex","writeEntityToBuffer","tasksNeeded","availableWorkers","promise","executeSharedBuffer","readEntityFromBuffer","newConfig","oldConfig","assign","reinitializeWorkerPool","reinitializeWorkerSystem","getWorkerInfo","currentMode","sharedArrayBufferSupported","sharedArrayBufferEnabled","taskQueue","busyWorkers","taskCounter","onMessage","handleWorkerMessage","handleWorkerError","task","processQueue","postMessage","_currentTask","workerIndex","terminate","EventBus","debugMode","eventIdCounter","isDebugMode","enhance","validateEventType","finalData","enhanceEventData","eventConfig","NORMAL","convertEventStats","setDebugMode","emitEntityCreated","emitEntityDestroyed","emitComponentAdded","emitComponentRemoved","emitSystemAdded","emitSystemRemoved","emitSceneChanged","SCENE_ACTIVATED","emitPerformanceWarning","performanceData","onEntityCreated","onComponentAdded","onSystemError","onPerformanceWarning","eventId","enhanced","GlobalEventBus","VersionMigrationManager","registerComponentMigration","fromVersion","_toVersion","componentMigrations","registerSceneMigration","sceneMigrations","migrateComponent","targetVersion","migrations","migratedData","migrateScene","migratedScene","migrateSceneComponents","typeInfo","migrateEntitiesComponents","typeRegistry","clearMigrations","getComponentMigrationPath","getSceneMigrationPath","canMigrateComponent","toVersion","canMigrateScene","MigrationBuilder","forComponent","fromVersionToVersion","to","migrate","EntityTags","FOLDER","HIDDEN","LOCKED","EDITOR_ONLY","PREFAB_INSTANCE","PREFAB_ROOT","hasEntityTag","TypedEntityBuilder","withConfigured","withActive","withEnabled","withUpdateOrder","_this$_entity$scene","TypeUtils","getType","NumberExtension","toNumber","isComponentType","PlatformDetector","detect","adapterClass","features","platform","confident","isNodeJS","isWeChatMiniGame","isByteDanceMiniGame","isAlipayMiniGame","isBaiduMiniGame","isBrowser","Worker","SharedArrayBuffer","navigator","Blob","URL","createObjectURL","wx","createCanvas","createImage","tt","versions","require","module","exports","document","my","swan","location","isTauriEnvironment","isEditorEnvironment","getDetailedInfo","userAgent","SharedWorker","ServiceWorker","crossOriginIsolated","performanceNow","ArrayBuffer","TypedArrays","propKeyString","newValue","valueMap","_newValue$sc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