docs: sync updated boardgame-core
This commit is contained in:
@@ -39,11 +39,10 @@ export function bindRegion<TState, TMeta>(
|
||||
container: Phaser.GameObjects.Container,
|
||||
): { cleanup: () => void; objects: Map<string, Phaser.GameObjects.GameObject> } {
|
||||
const objects = new Map<string, Phaser.GameObjects.GameObject>();
|
||||
const effects: DisposeFn[] = [];
|
||||
|
||||
const offset = options.offset ?? { x: 0, y: 0 };
|
||||
|
||||
function syncParts() {
|
||||
const dispose = effect(function(this: { dispose: () => void }) {
|
||||
const parts = partsGetter(state.value);
|
||||
const currentIds = new Set(region.childIds);
|
||||
for (const [id, obj] of objects) {
|
||||
@@ -73,14 +72,11 @@ export function bindRegion<TState, TMeta>(
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const e = effect(syncParts);
|
||||
effects.push(e);
|
||||
});
|
||||
|
||||
return {
|
||||
cleanup: () => {
|
||||
for (const e of effects) e();
|
||||
dispose();
|
||||
for (const [, obj] of objects) obj.destroy();
|
||||
objects.clear();
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user