mani-game-engine 1.0.0-pre.33 → 1.0.0-pre.35
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/LICENSE +21 -21
- package/README.md +69 -69
- package/lib/clock.d.ts +55 -55
- package/lib/clock.js +117 -117
- package/lib/ecsInjector.d.ts +28 -26
- package/lib/ecsInjector.js +169 -146
- package/lib/ecsInjector.js.map +1 -1
- package/lib/entity.d.ts +26 -23
- package/lib/entity.js +101 -95
- package/lib/entity.js.map +1 -1
- package/lib/gameEngine.d.ts +83 -83
- package/lib/gameEngine.js +340 -340
- package/lib/gameEngine.js.map +1 -1
- package/lib/index.d.ts +12 -12
- package/lib/index.js +34 -32
- package/lib/index.js.map +1 -1
- package/lib/injector.d.ts +121 -121
- package/lib/injector.js +289 -289
- package/lib/scope/scopeContext.d.ts +57 -57
- package/lib/scope/scopeContext.js +254 -254
- package/lib/scope/scopeContext.js.map +1 -1
- package/lib/systemContext.d.ts +14 -12
- package/lib/systemContext.js +35 -23
- package/lib/systemContext.js.map +1 -1
- package/lib/types.d.ts +73 -73
- package/lib/types.js +17 -17
- package/lib/utils/map2k.d.ts +6 -6
- package/lib/utils/map2k.js +43 -43
- package/package.json +39 -39
- package/src/clock.ts +163 -163
- package/src/ecsInjector.ts +212 -184
- package/src/entity.ts +131 -123
- package/src/gameEngine.ts +433 -433
- package/src/index.ts +32 -32
- package/src/injector.ts +363 -363
- package/src/scope/scopeContext.ts +322 -320
- package/src/systemContext.ts +37 -27
- package/src/types.ts +87 -87
- package/src/utils/map2k.ts +52 -52
package/lib/systemContext.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { System } from './types';
|
|
2
|
-
import { Signal, SignalCallback } from './index';
|
|
3
|
-
export declare
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { System } from './types';
|
|
2
|
+
import { ID, Signal, SignalCallback } from './index';
|
|
3
|
+
export declare const entitySignalHandlers: Map<Object, [string, ID][]>;
|
|
4
|
+
export declare const OnEntitySignal: (id: ID) => (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
|
|
5
|
+
export declare class SystemContext<T extends System = System> {
|
|
6
|
+
readonly entity: Object;
|
|
7
|
+
readonly system: T;
|
|
8
|
+
private signalBindings;
|
|
9
|
+
constructor(entity: Object);
|
|
10
|
+
addSignalById<S>(signalId: string | symbol, callback: SignalCallback<S>, thisArg?: unknown): void;
|
|
11
|
+
addSignal<S>(signal: Signal<S>, callback: SignalCallback<S>, thisArg?: unknown): void;
|
|
12
|
+
addSignalOnce<S>(signal: Signal<S>, callback: SignalCallback<S>, thisArg?: unknown): void;
|
|
13
|
+
dispose(): void;
|
|
14
|
+
}
|
package/lib/systemContext.js
CHANGED
|
@@ -1,24 +1,36 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SystemContext = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SystemContext = exports.OnEntitySignal = exports.entitySignalHandlers = void 0;
|
|
4
|
+
const index_1 = require("./index");
|
|
5
|
+
exports.entitySignalHandlers = new Map();
|
|
6
|
+
const OnEntitySignal = (id) => (target, propertyKey, descriptor) => {
|
|
7
|
+
if (target instanceof Function) {
|
|
8
|
+
throw new Error('only allowed on non static methods');
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
const mappingList = (0, index_1.putIfAbsent)(exports.entitySignalHandlers, target.constructor, () => []);
|
|
12
|
+
mappingList.push([propertyKey, id]);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
exports.OnEntitySignal = OnEntitySignal;
|
|
16
|
+
class SystemContext {
|
|
17
|
+
constructor(entity) {
|
|
18
|
+
this.entity = entity;
|
|
19
|
+
this.signalBindings = [];
|
|
20
|
+
}
|
|
21
|
+
addSignalById(signalId, callback, thisArg) {
|
|
22
|
+
this.signalBindings.push(this.entity.gameEngine.getSignal(signalId).add(callback, thisArg));
|
|
23
|
+
}
|
|
24
|
+
addSignal(signal, callback, thisArg) {
|
|
25
|
+
this.signalBindings.push(signal.add(callback, thisArg));
|
|
26
|
+
}
|
|
27
|
+
addSignalOnce(signal, callback, thisArg) {
|
|
28
|
+
this.signalBindings.push(signal.addOnce(callback, thisArg));
|
|
29
|
+
}
|
|
30
|
+
dispose() {
|
|
31
|
+
for (const binding of this.signalBindings)
|
|
32
|
+
binding.detach();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.SystemContext = SystemContext;
|
|
24
36
|
//# sourceMappingURL=systemContext.js.map
|
package/lib/systemContext.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"systemContext.js","sourceRoot":"","sources":["../src/systemContext.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"systemContext.js","sourceRoot":"","sources":["../src/systemContext.ts"],"names":[],"mappings":";;;AACA,mCAA2F;AAE9E,QAAA,oBAAoB,GAAG,IAAI,GAAG,EAA0B,CAAC;AAC/D,MAAM,cAAc,GAAG,CAAC,EAAM,EAAE,EAAE,CAAC,CAAC,MAAW,EAAE,WAAmB,EAAE,UAA8B,EAAE,EAAE;IAC3G,IAAI,MAAM,YAAY,QAAQ,EAAE;QAC5B,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;KACzD;SAAM;QACH,MAAM,WAAW,GAAG,IAAA,mBAAW,EAAC,4BAAoB,EAAE,MAAM,CAAC,WAAW,EAAE,GAAmB,EAAE,CAAC,EAAE,CAAC,CAAC;QACpG,WAAW,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC;KACvC;AACL,CAAC,CAAC;AAPW,QAAA,cAAc,kBAOzB;AAEF,MAAa,aAAa;IAItB,YAAqB,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;QAF3B,mBAAc,GAAoB,EAAE,CAAC;IAG7C,CAAC;IAGD,aAAa,CAAI,QAAyB,EAAE,QAA2B,EAAE,OAAiB;QACtF,IAAI,CAAC,cAAc,CAAC,IAAI,CAAG,IAAI,CAAC,MAAc,CAAC,UAAyB,CAAC,SAAS,CAAI,QAAQ,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;IAC5H,CAAC;IAED,SAAS,CAAI,MAAiB,EAAE,QAA2B,EAAE,OAAiB;QAC1E,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;IAC5D,CAAC;IAED,aAAa,CAAI,MAAiB,EAAE,QAA2B,EAAE,OAAiB;QAC9E,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;IAChE,CAAC;IAED,OAAO;QACH,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,cAAc;YAAE,OAAO,CAAC,MAAM,EAAE,CAAC;IAChE,CAAC;CACJ;AAvBD,sCAuBC"}
|
package/lib/types.d.ts
CHANGED
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
import { GameEngine } from './gameEngine';
|
|
2
|
-
export interface System {
|
|
3
|
-
[propName: string]: any;
|
|
4
|
-
onPrepare?(): Promise<void>;
|
|
5
|
-
onStart?(): void;
|
|
6
|
-
onEnd?(): void;
|
|
7
|
-
onPreFixedUpdate?(time: number, deltaTime: number): void;
|
|
8
|
-
onFixedUpdate?(time: number, deltaTime: number): void;
|
|
9
|
-
onPhysicsUpdate?(time: number, deltaTime: number): void;
|
|
10
|
-
onUpdate?(time: number, deltaTime: number, alpha: number): void;
|
|
11
|
-
onLateUpdate?(time: number, deltaTime: number, alpha: number): void;
|
|
12
|
-
onPrePhysicsUpdate?(time: number, deltaTime: number): void;
|
|
13
|
-
onPostPhysicsUpdate?(time: number, deltaTime: number): void;
|
|
14
|
-
onLateFixedUpdate?(time: number, deltaTime: number): void;
|
|
15
|
-
onRender?(time: number, deltaTime: number, alpha: number): void;
|
|
16
|
-
}
|
|
17
|
-
export interface Service {
|
|
18
|
-
[propName: string]: any;
|
|
19
|
-
onPrepare?(): Promise<void>;
|
|
20
|
-
onStart?(): void;
|
|
21
|
-
onEnd?(): void;
|
|
22
|
-
onPreFixedUpdate?(time: number, deltaTime: number): void;
|
|
23
|
-
onPostPhysicsUpdate?(time: number, deltaTime: number): void;
|
|
24
|
-
onLateFixedUpdate?(time: number, deltaTime: number): void;
|
|
25
|
-
onFixedUpdate?(time: number, deltaTime: number): void;
|
|
26
|
-
onPhysicsUpdate?(time: number, deltaTime: number): void;
|
|
27
|
-
onPrePhysicsUpdate?(time: number, deltaTime: number): void;
|
|
28
|
-
onUpdate?(time: number, deltaTime: number, alpha: number): void;
|
|
29
|
-
onLateUpdate?(time: number, deltaTime: number, alpha: number): void;
|
|
30
|
-
onRender?(time: number, deltaTime: number, alpha: number): void;
|
|
31
|
-
}
|
|
32
|
-
declare type GameEngineCallback = (gameEngine: GameEngine) => void;
|
|
33
|
-
export interface GameEnginePlugin {
|
|
34
|
-
onPrepare?: GameEngineCallback;
|
|
35
|
-
onStart?: GameEngineCallback;
|
|
36
|
-
}
|
|
37
|
-
export interface CommandClass {
|
|
38
|
-
name?: string;
|
|
39
|
-
new (...args: any[]): any;
|
|
40
|
-
}
|
|
41
|
-
export declare type OnUpdateParams = {
|
|
42
|
-
time: number;
|
|
43
|
-
deltaTime: number;
|
|
44
|
-
alpha: number;
|
|
45
|
-
};
|
|
46
|
-
export declare type OnFixedUpdateParams = {
|
|
47
|
-
time: number;
|
|
48
|
-
deltaTime: number;
|
|
49
|
-
};
|
|
50
|
-
export declare type OnEarlyUpdateParams = {
|
|
51
|
-
time: number;
|
|
52
|
-
deltaTime: number;
|
|
53
|
-
};
|
|
54
|
-
export declare type AsyncAction<T = unknown> = (gameEngine: GameEngine) => Promise<T>;
|
|
55
|
-
export declare type Action<T = any> = (gameEngine: GameEngine) => T;
|
|
56
|
-
export declare type Class<T = any> = {
|
|
57
|
-
new (...args: any[]): T;
|
|
58
|
-
};
|
|
59
|
-
export declare const EngineSignals: {
|
|
60
|
-
OnStart: symbol;
|
|
61
|
-
OnEnd: symbol;
|
|
62
|
-
OnUpdate: symbol;
|
|
63
|
-
OnLateUpdate: symbol;
|
|
64
|
-
OnFixedUpdate: symbol;
|
|
65
|
-
OnPreFixedUpdate: symbol;
|
|
66
|
-
OnPrePhysicsUpdate: symbol;
|
|
67
|
-
OnPhysicsUpdate: symbol;
|
|
68
|
-
OnPostPhysicsUpdate: symbol;
|
|
69
|
-
onLateFixedUpdate: symbol;
|
|
70
|
-
OnRender: symbol;
|
|
71
|
-
OnPrepare: symbol;
|
|
72
|
-
};
|
|
73
|
-
export {};
|
|
1
|
+
import { GameEngine } from './gameEngine';
|
|
2
|
+
export interface System {
|
|
3
|
+
[propName: string]: any;
|
|
4
|
+
onPrepare?(): Promise<void>;
|
|
5
|
+
onStart?(): void;
|
|
6
|
+
onEnd?(): void;
|
|
7
|
+
onPreFixedUpdate?(time: number, deltaTime: number): void;
|
|
8
|
+
onFixedUpdate?(time: number, deltaTime: number): void;
|
|
9
|
+
onPhysicsUpdate?(time: number, deltaTime: number): void;
|
|
10
|
+
onUpdate?(time: number, deltaTime: number, alpha: number): void;
|
|
11
|
+
onLateUpdate?(time: number, deltaTime: number, alpha: number): void;
|
|
12
|
+
onPrePhysicsUpdate?(time: number, deltaTime: number): void;
|
|
13
|
+
onPostPhysicsUpdate?(time: number, deltaTime: number): void;
|
|
14
|
+
onLateFixedUpdate?(time: number, deltaTime: number): void;
|
|
15
|
+
onRender?(time: number, deltaTime: number, alpha: number): void;
|
|
16
|
+
}
|
|
17
|
+
export interface Service {
|
|
18
|
+
[propName: string]: any;
|
|
19
|
+
onPrepare?(): Promise<void>;
|
|
20
|
+
onStart?(): void;
|
|
21
|
+
onEnd?(): void;
|
|
22
|
+
onPreFixedUpdate?(time: number, deltaTime: number): void;
|
|
23
|
+
onPostPhysicsUpdate?(time: number, deltaTime: number): void;
|
|
24
|
+
onLateFixedUpdate?(time: number, deltaTime: number): void;
|
|
25
|
+
onFixedUpdate?(time: number, deltaTime: number): void;
|
|
26
|
+
onPhysicsUpdate?(time: number, deltaTime: number): void;
|
|
27
|
+
onPrePhysicsUpdate?(time: number, deltaTime: number): void;
|
|
28
|
+
onUpdate?(time: number, deltaTime: number, alpha: number): void;
|
|
29
|
+
onLateUpdate?(time: number, deltaTime: number, alpha: number): void;
|
|
30
|
+
onRender?(time: number, deltaTime: number, alpha: number): void;
|
|
31
|
+
}
|
|
32
|
+
declare type GameEngineCallback = (gameEngine: GameEngine) => void;
|
|
33
|
+
export interface GameEnginePlugin {
|
|
34
|
+
onPrepare?: GameEngineCallback;
|
|
35
|
+
onStart?: GameEngineCallback;
|
|
36
|
+
}
|
|
37
|
+
export interface CommandClass {
|
|
38
|
+
name?: string;
|
|
39
|
+
new (...args: any[]): any;
|
|
40
|
+
}
|
|
41
|
+
export declare type OnUpdateParams = {
|
|
42
|
+
time: number;
|
|
43
|
+
deltaTime: number;
|
|
44
|
+
alpha: number;
|
|
45
|
+
};
|
|
46
|
+
export declare type OnFixedUpdateParams = {
|
|
47
|
+
time: number;
|
|
48
|
+
deltaTime: number;
|
|
49
|
+
};
|
|
50
|
+
export declare type OnEarlyUpdateParams = {
|
|
51
|
+
time: number;
|
|
52
|
+
deltaTime: number;
|
|
53
|
+
};
|
|
54
|
+
export declare type AsyncAction<T = unknown> = (gameEngine: GameEngine) => Promise<T>;
|
|
55
|
+
export declare type Action<T = any> = (gameEngine: GameEngine) => T;
|
|
56
|
+
export declare type Class<T = any> = {
|
|
57
|
+
new (...args: any[]): T;
|
|
58
|
+
};
|
|
59
|
+
export declare const EngineSignals: {
|
|
60
|
+
OnStart: symbol;
|
|
61
|
+
OnEnd: symbol;
|
|
62
|
+
OnUpdate: symbol;
|
|
63
|
+
OnLateUpdate: symbol;
|
|
64
|
+
OnFixedUpdate: symbol;
|
|
65
|
+
OnPreFixedUpdate: symbol;
|
|
66
|
+
OnPrePhysicsUpdate: symbol;
|
|
67
|
+
OnPhysicsUpdate: symbol;
|
|
68
|
+
OnPostPhysicsUpdate: symbol;
|
|
69
|
+
onLateFixedUpdate: symbol;
|
|
70
|
+
OnRender: symbol;
|
|
71
|
+
OnPrepare: symbol;
|
|
72
|
+
};
|
|
73
|
+
export {};
|
package/lib/types.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EngineSignals = void 0;
|
|
4
|
-
exports.EngineSignals = {
|
|
5
|
-
OnStart: Symbol('OnStart'),
|
|
6
|
-
OnEnd: Symbol('OnEnd'),
|
|
7
|
-
OnUpdate: Symbol('OnUpdate'),
|
|
8
|
-
OnLateUpdate: Symbol('OnLateUpdate'),
|
|
9
|
-
OnFixedUpdate: Symbol('OnFixedUpdate'),
|
|
10
|
-
OnPreFixedUpdate: Symbol('OnPreFixedUpdate'),
|
|
11
|
-
OnPrePhysicsUpdate: Symbol('OnPrePhysicsUpdate'),
|
|
12
|
-
OnPhysicsUpdate: Symbol('OnPhysicsUpdate'),
|
|
13
|
-
OnPostPhysicsUpdate: Symbol('OnPostPhysicsUpdate'),
|
|
14
|
-
onLateFixedUpdate: Symbol('onLateFixedUpdate'),
|
|
15
|
-
OnRender: Symbol('OnRender'),
|
|
16
|
-
OnPrepare: Symbol('OnPrepare'),
|
|
17
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EngineSignals = void 0;
|
|
4
|
+
exports.EngineSignals = {
|
|
5
|
+
OnStart: Symbol('OnStart'),
|
|
6
|
+
OnEnd: Symbol('OnEnd'),
|
|
7
|
+
OnUpdate: Symbol('OnUpdate'),
|
|
8
|
+
OnLateUpdate: Symbol('OnLateUpdate'),
|
|
9
|
+
OnFixedUpdate: Symbol('OnFixedUpdate'),
|
|
10
|
+
OnPreFixedUpdate: Symbol('OnPreFixedUpdate'),
|
|
11
|
+
OnPrePhysicsUpdate: Symbol('OnPrePhysicsUpdate'),
|
|
12
|
+
OnPhysicsUpdate: Symbol('OnPhysicsUpdate'),
|
|
13
|
+
OnPostPhysicsUpdate: Symbol('OnPostPhysicsUpdate'),
|
|
14
|
+
onLateFixedUpdate: Symbol('onLateFixedUpdate'),
|
|
15
|
+
OnRender: Symbol('OnRender'),
|
|
16
|
+
OnPrepare: Symbol('OnPrepare'),
|
|
17
|
+
};
|
|
18
18
|
//# sourceMappingURL=types.js.map
|
package/lib/utils/map2k.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export declare class Map2k<K, V> {
|
|
2
|
-
map: Map<K, Map<K, V>>;
|
|
3
|
-
set(key1: K, key2: K, value: V): void;
|
|
4
|
-
get(key1: K, key2: K): V | undefined;
|
|
5
|
-
delete(key1: K, key2: K): void;
|
|
6
|
-
}
|
|
1
|
+
export declare class Map2k<K, V> {
|
|
2
|
+
map: Map<K, Map<K, V>>;
|
|
3
|
+
set(key1: K, key2: K, value: V): void;
|
|
4
|
+
get(key1: K, key2: K): V | undefined;
|
|
5
|
+
delete(key1: K, key2: K): void;
|
|
6
|
+
}
|
package/lib/utils/map2k.js
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Map2k = void 0;
|
|
4
|
-
class Map2k {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.map = new Map();
|
|
7
|
-
}
|
|
8
|
-
set(key1, key2, value) {
|
|
9
|
-
let first = this.map.get(key1);
|
|
10
|
-
if (!first) {
|
|
11
|
-
first = new Map();
|
|
12
|
-
this.map.set(key1, first);
|
|
13
|
-
}
|
|
14
|
-
let second = this.map.get(key2);
|
|
15
|
-
if (!second) {
|
|
16
|
-
second = new Map();
|
|
17
|
-
this.map.set(key2, second);
|
|
18
|
-
}
|
|
19
|
-
first.set(key2, value);
|
|
20
|
-
second.set(key1, value);
|
|
21
|
-
}
|
|
22
|
-
get(key1, key2) {
|
|
23
|
-
const first = this.map.get(key1);
|
|
24
|
-
return first && first.get(key2);
|
|
25
|
-
}
|
|
26
|
-
delete(key1, key2) {
|
|
27
|
-
let first = this.map.get(key1);
|
|
28
|
-
if (first) {
|
|
29
|
-
first.delete(key2);
|
|
30
|
-
if (first.size === 0) {
|
|
31
|
-
this.map.delete(key1);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
let second = this.map.get(key2);
|
|
35
|
-
if (second) {
|
|
36
|
-
second.delete(key1);
|
|
37
|
-
if (second.size === 0) {
|
|
38
|
-
this.map.delete(key2);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
exports.Map2k = Map2k;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Map2k = void 0;
|
|
4
|
+
class Map2k {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.map = new Map();
|
|
7
|
+
}
|
|
8
|
+
set(key1, key2, value) {
|
|
9
|
+
let first = this.map.get(key1);
|
|
10
|
+
if (!first) {
|
|
11
|
+
first = new Map();
|
|
12
|
+
this.map.set(key1, first);
|
|
13
|
+
}
|
|
14
|
+
let second = this.map.get(key2);
|
|
15
|
+
if (!second) {
|
|
16
|
+
second = new Map();
|
|
17
|
+
this.map.set(key2, second);
|
|
18
|
+
}
|
|
19
|
+
first.set(key2, value);
|
|
20
|
+
second.set(key1, value);
|
|
21
|
+
}
|
|
22
|
+
get(key1, key2) {
|
|
23
|
+
const first = this.map.get(key1);
|
|
24
|
+
return first && first.get(key2);
|
|
25
|
+
}
|
|
26
|
+
delete(key1, key2) {
|
|
27
|
+
let first = this.map.get(key1);
|
|
28
|
+
if (first) {
|
|
29
|
+
first.delete(key2);
|
|
30
|
+
if (first.size === 0) {
|
|
31
|
+
this.map.delete(key1);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
let second = this.map.get(key2);
|
|
35
|
+
if (second) {
|
|
36
|
+
second.delete(key1);
|
|
37
|
+
if (second.size === 0) {
|
|
38
|
+
this.map.delete(key2);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.Map2k = Map2k;
|
|
44
44
|
//# sourceMappingURL=map2k.js.map
|
package/package.json
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "mani-game-engine",
|
|
3
|
-
"author": "Jan Mankopf",
|
|
4
|
-
"version": "1.0.0-pre.
|
|
5
|
-
"description": "entity component system game engine for typescript",
|
|
6
|
-
"private": false,
|
|
7
|
-
"scripts": {
|
|
8
|
-
"build": "rimraf lib && tsc",
|
|
9
|
-
"watch": "tsc -w",
|
|
10
|
-
"test": "jest",
|
|
11
|
-
"test watch": "jest --watch",
|
|
12
|
-
"do-pre-publish": "npm publish --dry-run",
|
|
13
|
-
"version-up": "npm version prerelease",
|
|
14
|
-
"do-publish": "npm publish"
|
|
15
|
-
},
|
|
16
|
-
"main": "lib/index.js",
|
|
17
|
-
"files": [
|
|
18
|
-
"lib/*",
|
|
19
|
-
"src/*"
|
|
20
|
-
],
|
|
21
|
-
"typings": "lib/index.d.ts",
|
|
22
|
-
"license": "MIT",
|
|
23
|
-
"devDependencies": {
|
|
24
|
-
"@fluffy-spoon/substitute": "^1.208.0",
|
|
25
|
-
"@types/jest": "^27.5.0",
|
|
26
|
-
"jest": "^28.1.0",
|
|
27
|
-
"reflect-metadata": "^0.1.13",
|
|
28
|
-
"rimraf": "^3.0.2",
|
|
29
|
-
"ts-jest": "^28.0.1",
|
|
30
|
-
"ts-node": "^10.7.0",
|
|
31
|
-
"tslib": "^2.4.0",
|
|
32
|
-
"typescript": "^4.6.4",
|
|
33
|
-
"mani-signal": "1.x"
|
|
34
|
-
},
|
|
35
|
-
"peerDependencies": {
|
|
36
|
-
"reflect-metadata": "0.x",
|
|
37
|
-
"mani-signal": "1.x"
|
|
38
|
-
}
|
|
39
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "mani-game-engine",
|
|
3
|
+
"author": "Jan Mankopf",
|
|
4
|
+
"version": "1.0.0-pre.35",
|
|
5
|
+
"description": "entity component system game engine for typescript",
|
|
6
|
+
"private": false,
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "rimraf lib && tsc",
|
|
9
|
+
"watch": "tsc -w",
|
|
10
|
+
"test": "jest",
|
|
11
|
+
"test watch": "jest --watch",
|
|
12
|
+
"do-pre-publish": "npm publish --dry-run",
|
|
13
|
+
"version-up": "npm version prerelease",
|
|
14
|
+
"do-publish": "npm publish"
|
|
15
|
+
},
|
|
16
|
+
"main": "lib/index.js",
|
|
17
|
+
"files": [
|
|
18
|
+
"lib/*",
|
|
19
|
+
"src/*"
|
|
20
|
+
],
|
|
21
|
+
"typings": "lib/index.d.ts",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@fluffy-spoon/substitute": "^1.208.0",
|
|
25
|
+
"@types/jest": "^27.5.0",
|
|
26
|
+
"jest": "^28.1.0",
|
|
27
|
+
"reflect-metadata": "^0.1.13",
|
|
28
|
+
"rimraf": "^3.0.2",
|
|
29
|
+
"ts-jest": "^28.0.1",
|
|
30
|
+
"ts-node": "^10.7.0",
|
|
31
|
+
"tslib": "^2.4.0",
|
|
32
|
+
"typescript": "^4.6.4",
|
|
33
|
+
"mani-signal": "1.x"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"reflect-metadata": "0.x",
|
|
37
|
+
"mani-signal": "1.x"
|
|
38
|
+
}
|
|
39
|
+
}
|