@combos-fun/engine 0.0.44 → 0.0.46

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@combos-fun/engine",
3
- "version": "0.0.44",
3
+ "version": "0.0.46",
4
4
  "description": "ECS microkernel",
5
5
  "main": "index.js",
6
6
  "module": "dist/engine.esm.js",
@@ -45,7 +45,7 @@
45
45
  "lodash-es": "^4.17.21",
46
46
  "resource-loader": "^4.0.0-rc4",
47
47
  "sprite-timeline": "^1.10.2",
48
- "@combos-fun/inspector-decorator": "0.0.44"
48
+ "@combos-fun/inspector-decorator": "0.0.46"
49
49
  },
50
50
  "devDependencies": {
51
51
  "tsx": "^4.20.3"
@@ -103,16 +103,17 @@ Extend `Renderer` from `plugin-renderer` with `@decorators.componentObserver`.
103
103
 
104
104
  ```ts
105
105
  class MyRenderer extends Renderer {
106
+ renderSystem: RendererSystem;
106
107
  init() {
107
- this.rendererSystem = this.game.getSystem(RendererSystem);
108
- this.rendererSystem.rendererManager.register(this);
108
+ this.renderSystem = this.game.getSystem(RendererSystem);
109
+ this.renderSystem.rendererManager.register(this);
109
110
  }
110
111
  componentChanged(changed: ComponentChanged) {
111
- const container = this.rendererSystem.containerManager.getContainer(
112
+ const container = this.containerManager.getContainer(
112
113
  changed.gameObject.id,
113
114
  );
114
115
  switch (changed.type) {
115
- case OBSERVER_TYPE.ADD: /* create pixi object, container.addChild(obj) */ break;
116
+ case OBSERVER_TYPE.ADD: /* subclass adapter: addChild(graphics); composition: addChild(sprite.sprite) */ break;
116
117
  case OBSERVER_TYPE.CHANGE: /* mutate */ break;
117
118
  case OBSERVER_TYPE.REMOVE: /* destroy + container.removeChild */ break;
118
119
  }
@@ -125,6 +126,8 @@ class MyRenderer extends Renderer {
125
126
 
126
127
  `RendererSystem` must be added before any system calling `getSystem(RendererSystem)` in `init`.
127
128
 
129
+ `@combos-fun/renderer-adapter` has two patterns: subclass adapters (`Graphics`, `Text`, `NinePatch`, `Container`) **are** Pixi display objects (`addChild(graphics)`). Composition adapters (`Sprite`, `TilingSprite`, `SpriteAnimation`) are not — `addChild(sprite.sprite)` / `tilingSprite.tilingSprite` / `animatedSprite`. See `@combos-fun/renderer-adapter/agent-skill`.
130
+
128
131
  ## 3D Three.js `Renderer3D` subclass (`@combos-fun/plugin-renderer-3d`)
129
132
 
130
133
  Extend `Renderer3D` with `@decorators.componentObserver`.
@@ -8,6 +8,8 @@ Open only when the short `agent-skill` card is insufficient for a named symbol o
8
8
 
9
9
  `Game`, `Scene`, `GameObject`, `Component`, `System`, `Transform`, `resource`, `resourceLoader`, `decorators`, `IDEProp`, `componentObserver`, `LOAD_EVENT`, `RESOURCE_TYPE`, `OBSERVER_TYPE`, `LOAD_SCENE_MODE`, `RESOURCE_TYPE_STRATEGY`, `normalizeResourceSrc`, `normalizeSpritesheetData`, `version`, `COMBOS_GAME_PLUGIN_INIT_SUCCESS`, `COMBOS_GAME_READY`, `COMBOS_GAME_SET_PLAYING`, `COMBOS_GAME_STATE_CHANGED`, `postParentPluginInitSuccess`, `postParentGameReady`, `postParentGameState`, `parseSetPlayingMessage`, `DEFAULT_ALLOWED_MESSAGE_HOST_SUFFIXES`, `isAllowedMessageOrigin`, `mergeAllowedMessageOrigins`.
10
10
 
11
+ `IDEProp` (this package) only pushes property **names** onto `constructor.IDEProps` as an **array**. New inspector / Scene Edit fields use `@Field` from `@combos-fun/inspector-decorator` (string key `IDE_PROPERTY_METADATA`). `plugin-development-tool` prefers `@Field`; it ignores the `IDEProp` array. Do not add `@IDEProp` on new components.
12
+
11
13
  ### Types
12
14
 
13
15
  `GameParams`, `PluginStruct`, `TransformParams`, `ComponentChanged`, `UpdateParams`, `ComponentParams`, `ObserverInfo`, `PureObserverInfo`, `ResourceBase`, `ResourceStruct`, `SystemConstructor`, `CombosGamePluginInitSuccessMessage`, `CombosGameReadyMessage`, `CombosGameStateChangedMessage`, `CombosGameSetPlayingMessage`.
@@ -64,7 +66,13 @@ Recommended flow: create the game with `autoStart:false`, wait for `combos-game:
64
66
 
65
67
  ### `Game` methods
66
68
 
67
- `addSystem(system)`, `removeSystem(system | class | string)` (calls `system.destroy()` internally), `getSystem(class | string)`, `loadScene({ scene, mode?, params? })` (`LOAD_SCENE_MODE.SINGLE | MULTI_CANVAS`), `start()`, `pause()`, `resume()`, `setPlaying(playing)` (host bridge: cold-start-or-resume / pause), `destroy()`.
69
+ `addSystem` is **async** (`Promise<T | undefined>`): `await game.addSystem(new XxxSystem(params))`. Duplicate System classes are warned and skipped. `Game({ systems })` already awaits each `init` at bootstrap.
70
+
71
+ A TypeScript overload also types `addSystem(XxxSystem, [params])`, but `Game.ts` does `new S(obj)` **without spreading**. That calls the constructor with the tuple as the first argument. Use the instance form.
72
+
73
+ `removeSystem(system | class | string)` (calls `system.destroy()` internally), `getSystem(class | string)`, `loadScene({ scene, mode?, params? })` (`LOAD_SCENE_MODE.SINGLE | MULTI_CANVAS`), `start()`, `pause()`, `resume()`, `setPlaying(playing)` (host bridge: cold-start-or-resume / pause), `destroy()`.
74
+
75
+ `getSystem` / `removeSystem` string lookup matches `static systemName` (copied onto `system.name` in the constructor), **not** the TypeScript class name. Prefer the class: `game.getSystem(ImgSystem)`. `game.getSystem('Img')` works; `game.getSystem('ImgSystem')` is undefined. 2D render plugins use short names (`'Img'`, `'Sprite'`, `'Event'`); most 3D / physics / audio systems use the class-shaped name (`'Renderer3DSystem'`, `'PhysicsSystem'`). `Transition` is `'transition'` (lowercase).
68
76
 
69
77
  ### `resource` singleton
70
78