@safe-engine/cocos 1.9.4 → 1.9.6
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/dist/core/NodeComp.d.ts +7 -4
- package/dist/core/NodeComp.d.ts.map +1 -1
- package/dist/core/NodeComp.js +6 -3
- package/dist/helper/action.d.ts +2 -0
- package/dist/helper/action.d.ts.map +1 -1
- package/dist/helper/action.js +6 -0
- package/dist/helper/math.d.ts +1 -0
- package/dist/helper/math.d.ts.map +1 -1
- package/dist/helper/math.js +3 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/polyfills.d.ts +1 -0
- package/dist/polyfills.d.ts.map +1 -1
- package/dist/polyfills.js +3 -0
- package/package.json +3 -1
- package/dist/core/index.d.ts +0 -6
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -5
- package/dist/gworld/EnhancedComponent.d.ts +0 -22
- package/dist/gworld/EnhancedComponent.d.ts.map +0 -1
- package/dist/gworld/EnhancedComponent.js +0 -44
- package/dist/gworld/NodeComp.d.ts +0 -153
- package/dist/gworld/NodeComp.d.ts.map +0 -1
- package/dist/gworld/NodeComp.js +0 -337
- package/dist/gworld/NodePool.d.ts +0 -9
- package/dist/gworld/NodePool.d.ts.map +0 -1
- package/dist/gworld/NodePool.js +0 -23
- package/dist/gworld/Scene.d.ts +0 -5
- package/dist/gworld/Scene.d.ts.map +0 -1
- package/dist/gworld/Scene.js +0 -14
- package/dist/gworld/decorator.d.ts +0 -8
- package/dist/gworld/decorator.d.ts.map +0 -1
- package/dist/gworld/decorator.js +0 -12
- package/dist/gworld/index.d.ts +0 -8
- package/dist/gworld/index.d.ts.map +0 -1
- package/dist/gworld/index.js +0 -14
package/dist/core/NodeComp.d.ts
CHANGED
|
@@ -62,7 +62,9 @@ export declare class NodeComp<C extends cc.Node = cc.Node> {
|
|
|
62
62
|
set zIndex(val: number);
|
|
63
63
|
get childrenCount(): number;
|
|
64
64
|
destroy(): void;
|
|
65
|
-
addComponent<T extends ComponentType>(instance: T
|
|
65
|
+
addComponent<T extends ComponentType>(instance: T & {
|
|
66
|
+
start?: () => void;
|
|
67
|
+
}): T;
|
|
66
68
|
getComponent<T extends ComponentType>(component: Constructor<T>): T;
|
|
67
69
|
getComponentsInChildren<T extends ComponentType>(component: Constructor<T>): T[];
|
|
68
70
|
getComponentInChildren<T extends ComponentType>(component: Constructor<T>): T;
|
|
@@ -85,6 +87,7 @@ export declare class NodeComp<C extends cc.Node = cc.Node> {
|
|
|
85
87
|
dot(other: Vec2): number;
|
|
86
88
|
angle(other: Vec2): number;
|
|
87
89
|
distance(other: /*elided*/ any): number;
|
|
90
|
+
clone(): /*elided*/ any;
|
|
88
91
|
};
|
|
89
92
|
convertToNodeSpaceAR(point: cc.Point): {
|
|
90
93
|
x: number;
|
|
@@ -104,6 +107,7 @@ export declare class NodeComp<C extends cc.Node = cc.Node> {
|
|
|
104
107
|
dot(other: Vec2): number;
|
|
105
108
|
angle(other: Vec2): number;
|
|
106
109
|
distance(other: /*elided*/ any): number;
|
|
110
|
+
clone(): /*elided*/ any;
|
|
107
111
|
};
|
|
108
112
|
convertToWorldSpaceAR(point: cc.Vec2): {
|
|
109
113
|
x: number;
|
|
@@ -123,6 +127,7 @@ export declare class NodeComp<C extends cc.Node = cc.Node> {
|
|
|
123
127
|
dot(other: Vec2): number;
|
|
124
128
|
angle(other: Vec2): number;
|
|
125
129
|
distance(other: /*elided*/ any): number;
|
|
130
|
+
clone(): /*elided*/ any;
|
|
126
131
|
};
|
|
127
132
|
getBoundingBox(): cc.Rect;
|
|
128
133
|
get contentSize(): Size;
|
|
@@ -138,8 +143,6 @@ export declare class NodeComp<C extends cc.Node = cc.Node> {
|
|
|
138
143
|
setData<T extends Integer | Float | string>(key: string, value: T): void;
|
|
139
144
|
get event(): EventRegister;
|
|
140
145
|
removeData(key: string): void;
|
|
141
|
-
resolveComponent(component: EnhancedComponent<object, NodeComp>
|
|
142
|
-
start?: () => void;
|
|
143
|
-
}): void;
|
|
146
|
+
resolveComponent(component: EnhancedComponent<object, NodeComp>): void;
|
|
144
147
|
}
|
|
145
148
|
//# sourceMappingURL=NodeComp.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeComp.d.ts","sourceRoot":"","sources":["../../src/core/NodeComp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAGhD,OAAO,EAAE,aAAa,EAAiB,MAAM,aAAa,CAAA;AAC1D,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAEtE,MAAM,MAAM,iBAAiB,GAAG,CAAC,GAAG,IAAI,OAAA,KAAK,IAAI,CAAA;AACjD,qBAAa,QAAQ,CAAC,CAAC,SAAS,EAAE,CAAC,IAAI,GAAG,EAAE,CAAC,IAAI;IAC/C,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,CAAC,CAAA;IACX,MAAM,EAAE,QAAQ,CAAA;IAChB,QAAQ,EAAE,QAAQ,EAAE,CAAK;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,MAAM,CAAA;IACd,OAAO,CAAC,OAAO,CAAO;gBAEV,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM;IAKvC,IAAI,IAAI,WAEP;IAED,IAAI,QAAQ,IAAI,QAAQ,CAAC,IAAI,CAAC,CAE7B;IAED,IAAI,QAAQ,CAAC,GAAG,EAAE,IAAI,EAErB;IAED,IAAI,EAAE,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAE3B;IAED,IAAI,IAAI,IAIM,MAAM,CAFnB;IAED,IAAI,IAAI,CAAC,GAAG,EAAE,MAAM,EAEnB;IAED,IAAI,IAAI,IAIM,MA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QAAQ,CAAC;CAOhE"}
|
package/dist/core/NodeComp.js
CHANGED
|
@@ -154,7 +154,12 @@ export class NodeComp {
|
|
|
154
154
|
this.removeFromParent(true);
|
|
155
155
|
}
|
|
156
156
|
addComponent(instance) {
|
|
157
|
-
|
|
157
|
+
this.entity.assign(instance);
|
|
158
|
+
if (!instance.constructor.hasRender) {
|
|
159
|
+
if (instance.start)
|
|
160
|
+
instance.start();
|
|
161
|
+
}
|
|
162
|
+
return instance;
|
|
158
163
|
}
|
|
159
164
|
getComponent(component) {
|
|
160
165
|
return this.entity.getComponent(component);
|
|
@@ -291,8 +296,6 @@ export class NodeComp {
|
|
|
291
296
|
}
|
|
292
297
|
else {
|
|
293
298
|
this.addComponent(component);
|
|
294
|
-
if (component.start)
|
|
295
|
-
component.start();
|
|
296
299
|
}
|
|
297
300
|
}
|
|
298
301
|
}
|
package/dist/helper/action.d.ts
CHANGED
|
@@ -5,5 +5,7 @@ export declare function scaleTo(t: number, x: number, y?: number): cc.ScaleTo;
|
|
|
5
5
|
export declare function callFunc(cb: () => void, target?: any, data?: any): cc.CallFunc;
|
|
6
6
|
export declare function sequence(...actions: cc.FiniteTimeAction[]): cc.Sequence;
|
|
7
7
|
export declare function repeatForever(action: cc.FiniteTimeAction): cc.RepeatForever;
|
|
8
|
+
export declare function repeat(action: cc.FiniteTimeAction, times: Integer): cc.Repeat;
|
|
9
|
+
export declare function delayTime(time: Float): cc.DelayTime;
|
|
8
10
|
export declare function easeBackOut(action: cc.ActionInterval): cc.ActionInterval;
|
|
9
11
|
//# sourceMappingURL=action.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../src/helper/action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAEnC,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,aAEzC;AACD,wBAAgB,MAAM,CAAC,CA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AEpC;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC,cAAc,qBAEpD"}
|
package/dist/helper/action.js
CHANGED
|
@@ -16,6 +16,12 @@ export function sequence(...actions) {
|
|
|
16
16
|
export function repeatForever(action) {
|
|
17
17
|
return cc.repeatForever(action);
|
|
18
18
|
}
|
|
19
|
+
export function repeat(action, times) {
|
|
20
|
+
return cc.repeat(action, times);
|
|
21
|
+
}
|
|
22
|
+
export function delayTime(time) {
|
|
23
|
+
return cc.delayTime(time);
|
|
24
|
+
}
|
|
19
25
|
export function easeBackOut(action) {
|
|
20
26
|
return action.easing(cc.easeBackOut());
|
|
21
27
|
}
|
package/dist/helper/math.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare function randomRangeInt(minInclude: Integer, maxExclude: Integer): number;
|
|
2
|
+
export declare function randomRange(minInclude: Float, maxExclude: Float): number;
|
|
2
3
|
export declare const degreesToRadians: typeof cc.degreesToRadians;
|
|
3
4
|
export declare const radiansToDegrees: typeof cc.radiansToDegrees;
|
|
4
5
|
export declare function getMin(arr: number[]): number | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../src/helper/math.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,CAAC,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,UAEtE;AAED,eAAO,MAAM,gBAAgB,4BAAsB,CAAA;AACnD,eAAO,MAAM,gBAAgB,4BAAsB,CAAA;AAEnD,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAUnD;AAED,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAUnD"}
|
|
1
|
+
{"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../src/helper/math.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,CAAC,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,UAEtE;AACD,wBAAgB,WAAW,CAAC,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,UAE/D;AAED,eAAO,MAAM,gBAAgB,4BAAsB,CAAA;AACnD,eAAO,MAAM,gBAAgB,4BAAsB,CAAA;AAEnD,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAUnD;AAED,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAUnD"}
|
package/dist/helper/math.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export function randomRangeInt(minInclude, maxExclude) {
|
|
2
2
|
return Math.round(Math.random() * (maxExclude - minInclude - 1)) + minInclude;
|
|
3
3
|
}
|
|
4
|
+
export function randomRange(minInclude, maxExclude) {
|
|
5
|
+
return Math.random() * (maxExclude - minInclude - 1) + minInclude;
|
|
6
|
+
}
|
|
4
7
|
export const degreesToRadians = cc.degreesToRadians;
|
|
5
8
|
export const radiansToDegrees = cc.radiansToDegrees;
|
|
6
9
|
export function getMin(arr) {
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAA;AACrB,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,0BAA0B,CAAA;AACxC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAA;AACrB,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,0BAA0B,CAAA;AACxC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,cAAc,OAAO,CAAA;AACrB,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAA;AACxC,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA"}
|
package/dist/index.js
CHANGED
package/dist/polyfills.d.ts
CHANGED
package/dist/polyfills.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polyfills.d.ts","sourceRoot":"","sources":["../src/polyfills.ts"],"names":[],"mappings":"AAOA,cAAM,KAAK;IACT,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,MAAM,CAAC,IAAI,MAAA;gBACC,CAAC,GAAE,MAAM,GAAG,MAAU,EAAE,CAAC,SAAI;IAazC,MAAM,CAAC,KAAK,EAAE,KAAK;IAInB,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,GAAG,IAAI,GAAG,KAAK;IAIlC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,GAAG,IAAI,GAAG,KAAK;IAOtC,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,GAAG,IAAI,GAAG,KAAK;IAIlC,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,KAAK;IAI5B,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,KAAK;IAOhC,GAAG,IAAI,MAAM;IAIb,aAAa,IAAI,KAAK;IAOtB,SAAS,IAAI,KAAK;IAIX,KAAK,CAAC,KAAK,EAAE,IAAI;IAGjB,SAAS,CAAC,KAAK,EAAE,IAAI;IAIrB,SAAS;IAGT,GAAG,CAAC,KAAK,EAAE,IAAI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AAA;CACL;AAED,eAAO,MAAM,GAAG,UAA0B,CAAA;AAC1C,eAAO,MAAM,KAAK,UAAwB,CAAA;AAC1C,eAAO,MAAM,KAAK,UAA8B,CAAA;AAChD,eAAO,MAAM,KAAK,UAA0B,CAAA;AAC5C,eAAO,MAAM,IAAI,UAA0B,CAAA;AAY3C,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,YAEjE;AACD,MAAM,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAA;AAEhD,cAAM,KAAK;IACT,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,IAAI,MAAA;gBACC,KAAK,SAAI,EAAE,MAAM,SAAI;CAWlC;AAED,MAAM,MAAM,IAAI,GAAG,KAAK,CAAA;AACxB,wBAAgB,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAEjD;AAED,qBAAa,KAAM,SAAQ,EAAE,CAAC,KAAK;IACzB,WAAW,EAAE,MAAM,IAAI,CAAA;CAChC;AAED,wBAAgB,UAAU,IAAI,IAAI,CAEjC"}
|
package/dist/polyfills.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@safe-engine/cocos",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.6",
|
|
4
4
|
"description": "safe-engine with cocos renderer support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -24,6 +24,8 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@esotericsoftware/spine-core": "^4.2.88",
|
|
26
26
|
"box2d-wasm": "^7.0.0",
|
|
27
|
+
"pixi.js": "5.3.12",
|
|
28
|
+
"pixi5-dragonbones": "5.7.0-2b",
|
|
27
29
|
"entityx-ts": "^2.2.1"
|
|
28
30
|
},
|
|
29
31
|
"author": "",
|
package/dist/core/index.d.ts
DELETED
package/dist/core/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,qBAAqB,CAAA;AACnC,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA"}
|
package/dist/core/index.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Constructor } from 'entityx-ts';
|
|
2
|
-
import { BaseComponentProps } from '../safex';
|
|
3
|
-
import { NodeComp } from './NodeComp';
|
|
4
|
-
export declare class EnhancedComponent<Props = object, N extends NodeComp<any> = NodeComp<any>> {
|
|
5
|
-
static hasRender: boolean;
|
|
6
|
-
props: Props;
|
|
7
|
-
node: N;
|
|
8
|
-
enabled: boolean;
|
|
9
|
-
constructor(data?: BaseComponentProps<EnhancedComponent> & Props);
|
|
10
|
-
init(data?: Props): void;
|
|
11
|
-
addComponent<T extends EnhancedComponent>(instance: T): T;
|
|
12
|
-
getComponent<T extends EnhancedComponent>(component: Constructor<T>): T;
|
|
13
|
-
schedule(callback: (arg: any) => void, interval: number, repeat?: number, delay?: number): void;
|
|
14
|
-
unschedule(callback: (arg: any) => void): void;
|
|
15
|
-
unscheduleAllCallbacks(): void;
|
|
16
|
-
scheduleOnce(callback: (arg: any) => void, delay: number, key?: string): void;
|
|
17
|
-
getComponentsInChildren<T extends ComponentType>(component: Constructor<T>): T[];
|
|
18
|
-
getComponentInChildren<T extends ComponentType>(component: Constructor<T>): T;
|
|
19
|
-
isEqual(other: EnhancedComponent): boolean;
|
|
20
|
-
}
|
|
21
|
-
export type ComponentType = EnhancedComponent | NodeComp;
|
|
22
|
-
//# sourceMappingURL=EnhancedComponent.d.ts.map
|
|
@@ -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AAC,SAAS,aAAa,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC;IAG7E,OAAO,CAAC,KAAK,EAAE,iBAAiB;CAGjC;AAED,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAAG,QAAQ,CAAA"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
export class EnhancedComponent {
|
|
2
|
-
static hasRender = true;
|
|
3
|
-
props = {};
|
|
4
|
-
node;
|
|
5
|
-
enabled = true;
|
|
6
|
-
constructor(data) {
|
|
7
|
-
this.init(data);
|
|
8
|
-
}
|
|
9
|
-
init(data) {
|
|
10
|
-
if (data) {
|
|
11
|
-
// console.log('constructor', this.constructor.name, data)
|
|
12
|
-
Object.keys(data).forEach((key) => {
|
|
13
|
-
this.props[key] = data[key];
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
addComponent(instance) {
|
|
18
|
-
return this.node.addComponent(instance);
|
|
19
|
-
}
|
|
20
|
-
getComponent(component) {
|
|
21
|
-
return this.node.getComponent(component);
|
|
22
|
-
}
|
|
23
|
-
schedule(callback, interval, repeat = cc.macro.REPEAT_FOREVER, delay = 0) {
|
|
24
|
-
this.node.instance.schedule(callback.bind(this), interval, repeat, delay);
|
|
25
|
-
}
|
|
26
|
-
unschedule(callback) {
|
|
27
|
-
this.node.instance.unschedule(callback.bind(this));
|
|
28
|
-
}
|
|
29
|
-
unscheduleAllCallbacks() {
|
|
30
|
-
this.node.instance.unscheduleAllCallbacks();
|
|
31
|
-
}
|
|
32
|
-
scheduleOnce(callback, delay, key) {
|
|
33
|
-
this.node.instance.scheduleOnce(callback, delay, key);
|
|
34
|
-
}
|
|
35
|
-
getComponentsInChildren(component) {
|
|
36
|
-
return this.node.getComponentsInChildren(component);
|
|
37
|
-
}
|
|
38
|
-
getComponentInChildren(component) {
|
|
39
|
-
return this.node.getComponentInChildren(component);
|
|
40
|
-
}
|
|
41
|
-
isEqual(other) {
|
|
42
|
-
return this.node.entity.id === other.node.entity.id;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import { Constructor, Entity } from 'entityx-ts';
|
|
2
|
-
import { Vec2 } from '../polyfills';
|
|
3
|
-
import { ComponentType, EnhancedComponent } from './EnhancedComponent';
|
|
4
|
-
export type EventCallbackType = (...args: any[]) => void;
|
|
5
|
-
export declare class NodeComp<C extends cc.Node = cc.Node> {
|
|
6
|
-
entity: Entity;
|
|
7
|
-
instance: C;
|
|
8
|
-
parent: NodeComp;
|
|
9
|
-
children: NodeComp[];
|
|
10
|
-
name: string;
|
|
11
|
-
private _group;
|
|
12
|
-
private _active;
|
|
13
|
-
constructor(instance: C, entity: Entity);
|
|
14
|
-
get uuid(): number;
|
|
15
|
-
get position(): Readonly<Vec2>;
|
|
16
|
-
set position(val: Vec2);
|
|
17
|
-
set xy(val: [number, number]);
|
|
18
|
-
get posX(): number;
|
|
19
|
-
set posX(val: number);
|
|
20
|
-
get posY(): number;
|
|
21
|
-
set posY(val: number);
|
|
22
|
-
get scale(): number;
|
|
23
|
-
set scale(val: number);
|
|
24
|
-
get scaleX(): number;
|
|
25
|
-
set scaleX(val: number);
|
|
26
|
-
get scaleY(): number;
|
|
27
|
-
set scaleY(val: number);
|
|
28
|
-
get anchorX(): number;
|
|
29
|
-
set anchorX(val: number);
|
|
30
|
-
get anchorY(): number;
|
|
31
|
-
set anchorY(val: number);
|
|
32
|
-
/**
|
|
33
|
-
* Returns the angle of the node in degrees. 0 is the default rotation angle. Positive values rotate node clockwise.
|
|
34
|
-
* @function
|
|
35
|
-
* @return {Number} The rotation of the node in degrees.
|
|
36
|
-
*/
|
|
37
|
-
get rotation(): number;
|
|
38
|
-
/**
|
|
39
|
-
*
|
|
40
|
-
* Sets the X angle of the node in degrees which performs a horizontal rotational skew.
|
|
41
|
-
* (support only in WebGL rendering mode)
|
|
42
|
-
* 0 is the default rotation angle.
|
|
43
|
-
* Positive values rotate node clockwise, and negative values for anti-clockwise.
|
|
44
|
-
*
|
|
45
|
-
* @param {Number} degrees The X rotation in degrees which performs a horizontal rotational skew.
|
|
46
|
-
*/
|
|
47
|
-
set rotation(val: number);
|
|
48
|
-
get color(): cc.Color;
|
|
49
|
-
set color(val: cc.Color);
|
|
50
|
-
get opacity(): number;
|
|
51
|
-
set opacity(val: number);
|
|
52
|
-
get active(): boolean;
|
|
53
|
-
set active(val: boolean);
|
|
54
|
-
get group(): string | number;
|
|
55
|
-
set group(val: string | number);
|
|
56
|
-
get width(): number;
|
|
57
|
-
set width(val: number);
|
|
58
|
-
get height(): number;
|
|
59
|
-
set height(val: number);
|
|
60
|
-
get zIndex(): number;
|
|
61
|
-
set zIndex(val: number);
|
|
62
|
-
get childrenCount(): number;
|
|
63
|
-
destroy(): void;
|
|
64
|
-
addComponent<T extends ComponentType>(instance: T): T;
|
|
65
|
-
getComponent<T extends ComponentType>(component: Constructor<T>): T;
|
|
66
|
-
getComponentsInChildren<T extends ComponentType>(component: Constructor<T>): T[];
|
|
67
|
-
getComponentInChildren<T extends ComponentType>(component: Constructor<T>): T;
|
|
68
|
-
hasComponentInChildren<T extends ComponentType>(component: Constructor<T>): boolean;
|
|
69
|
-
getPercent(): number;
|
|
70
|
-
setPercent(val: number): void;
|
|
71
|
-
setTouchEnabled(enabled: boolean): void;
|
|
72
|
-
addTouchEventListener(cb: any): void;
|
|
73
|
-
convertToNodeSpace(point: cc.Point): {
|
|
74
|
-
x: number;
|
|
75
|
-
y: number;
|
|
76
|
-
equals(other: /*elided*/ any): boolean;
|
|
77
|
-
add(value: cc.Point | Vec2): /*elided*/ any;
|
|
78
|
-
addSelf(value: cc.Point | Vec2): /*elided*/ any;
|
|
79
|
-
sub(value: cc.Point | Vec2): /*elided*/ any;
|
|
80
|
-
mul(multiply: number): /*elided*/ any;
|
|
81
|
-
mulSelf(multiply: number): /*elided*/ any;
|
|
82
|
-
mag(): number;
|
|
83
|
-
normalizeSelf(): /*elided*/ any;
|
|
84
|
-
normalize(): /*elided*/ any;
|
|
85
|
-
cross(other: Vec2): number;
|
|
86
|
-
signAngle(other: Vec2): number;
|
|
87
|
-
lengthSqr(): number;
|
|
88
|
-
dot(other: Vec2): number;
|
|
89
|
-
angle(other: Vec2): number;
|
|
90
|
-
distance(other: /*elided*/ any): number;
|
|
91
|
-
};
|
|
92
|
-
convertToNodeSpaceAR(point: cc.Point): {
|
|
93
|
-
x: number;
|
|
94
|
-
y: number;
|
|
95
|
-
equals(other: /*elided*/ any): boolean;
|
|
96
|
-
add(value: cc.Point | Vec2): /*elided*/ any;
|
|
97
|
-
addSelf(value: cc.Point | Vec2): /*elided*/ any;
|
|
98
|
-
sub(value: cc.Point | Vec2): /*elided*/ any;
|
|
99
|
-
mul(multiply: number): /*elided*/ any;
|
|
100
|
-
mulSelf(multiply: number): /*elided*/ any;
|
|
101
|
-
mag(): number;
|
|
102
|
-
normalizeSelf(): /*elided*/ any;
|
|
103
|
-
normalize(): /*elided*/ any;
|
|
104
|
-
cross(other: Vec2): number;
|
|
105
|
-
signAngle(other: Vec2): number;
|
|
106
|
-
lengthSqr(): number;
|
|
107
|
-
dot(other: Vec2): number;
|
|
108
|
-
angle(other: Vec2): number;
|
|
109
|
-
distance(other: /*elided*/ any): number;
|
|
110
|
-
};
|
|
111
|
-
convertToWorldSpaceAR(point: cc.Vec2): {
|
|
112
|
-
x: number;
|
|
113
|
-
y: number;
|
|
114
|
-
equals(other: /*elided*/ any): boolean;
|
|
115
|
-
add(value: cc.Point | Vec2): /*elided*/ any;
|
|
116
|
-
addSelf(value: cc.Point | Vec2): /*elided*/ any;
|
|
117
|
-
sub(value: cc.Point | Vec2): /*elided*/ any;
|
|
118
|
-
mul(multiply: number): /*elided*/ any;
|
|
119
|
-
mulSelf(multiply: number): /*elided*/ any;
|
|
120
|
-
mag(): number;
|
|
121
|
-
normalizeSelf(): /*elided*/ any;
|
|
122
|
-
normalize(): /*elided*/ any;
|
|
123
|
-
cross(other: Vec2): number;
|
|
124
|
-
signAngle(other: Vec2): number;
|
|
125
|
-
lengthSqr(): number;
|
|
126
|
-
dot(other: Vec2): number;
|
|
127
|
-
angle(other: Vec2): number;
|
|
128
|
-
distance(other: /*elided*/ any): number;
|
|
129
|
-
};
|
|
130
|
-
getPosition(): cc.Point;
|
|
131
|
-
setPosition(x: number | cc.Vec2 | cc.Vec3 | cc.Point, y?: number): void;
|
|
132
|
-
setRotation(deg: number): void;
|
|
133
|
-
getRotation(): number;
|
|
134
|
-
setAnchorPoint(point: number | cc.Point, y?: number): void;
|
|
135
|
-
getAnchorPoint(): cc.Point;
|
|
136
|
-
getBoundingBox(): cc.Rect;
|
|
137
|
-
getContentSize(): cc.Size;
|
|
138
|
-
setContentSize(size: cc.Size | number, height?: number): void;
|
|
139
|
-
setColor(color: cc.Color): void;
|
|
140
|
-
setScale(scaleX: number, scaleY?: number): void;
|
|
141
|
-
runAction(atc: cc.ActionInterval): void;
|
|
142
|
-
stopAllActions(): void;
|
|
143
|
-
pauseAllActionsAndSchedule(): void;
|
|
144
|
-
resumeAllActionsAndSchedule(): void;
|
|
145
|
-
removeFromParent(cleanup?: boolean): void;
|
|
146
|
-
addChild(child: NodeComp, zOrder?: number, tag?: number): any;
|
|
147
|
-
removeAllChildren(cleanup?: any): void;
|
|
148
|
-
getData<T>(key: string): T;
|
|
149
|
-
setData<T extends Integer | Float | string>(key: string, value: T): void;
|
|
150
|
-
removeData(key: string): void;
|
|
151
|
-
resolveComponent(component: EnhancedComponent<object, NodeComp>): void;
|
|
152
|
-
}
|
|
153
|
-
//# sourceMappingURL=NodeComp.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NodeComp.d.ts","sourceRoot":"","sources":["../../src/gworld/NodeComp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAIhD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,aAAa,EAAE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GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAQjE,UAAU,CAAC,GAAG,EAAE,MAAM;IAOtB,gBAAgB,CAAC,SAAS,EAAE,iBAAiB,CAAC,MAAM,EAAE,QAAQ,CAAC;CAOhE"}
|
package/dist/gworld/NodeComp.js
DELETED
|
@@ -1,337 +0,0 @@
|
|
|
1
|
-
import { instantiate } from '../helper/utils';
|
|
2
|
-
import { ExtraDataComp } from '../norender';
|
|
3
|
-
import { Vec2 } from '../polyfills';
|
|
4
|
-
export class NodeComp {
|
|
5
|
-
entity;
|
|
6
|
-
instance;
|
|
7
|
-
parent;
|
|
8
|
-
children = [];
|
|
9
|
-
name;
|
|
10
|
-
_group;
|
|
11
|
-
_active = true;
|
|
12
|
-
constructor(instance, entity) {
|
|
13
|
-
this.entity = entity;
|
|
14
|
-
this.instance = instance;
|
|
15
|
-
}
|
|
16
|
-
get uuid() {
|
|
17
|
-
return this.entity.id;
|
|
18
|
-
}
|
|
19
|
-
get position() {
|
|
20
|
-
return Vec2(this.instance.getPosition());
|
|
21
|
-
}
|
|
22
|
-
set position(val) {
|
|
23
|
-
this.instance.setPosition(val.x, val.y);
|
|
24
|
-
}
|
|
25
|
-
set xy(val) {
|
|
26
|
-
this.instance.setPosition(val[0], val[1]);
|
|
27
|
-
}
|
|
28
|
-
get posX() {
|
|
29
|
-
return this.instance.getPositionX();
|
|
30
|
-
}
|
|
31
|
-
set posX(val) {
|
|
32
|
-
this.instance.setPositionX(val);
|
|
33
|
-
}
|
|
34
|
-
get posY() {
|
|
35
|
-
return this.instance.getPositionY();
|
|
36
|
-
}
|
|
37
|
-
set posY(val) {
|
|
38
|
-
this.instance.setPositionY(val);
|
|
39
|
-
}
|
|
40
|
-
get scale() {
|
|
41
|
-
return this.instance.getScale();
|
|
42
|
-
}
|
|
43
|
-
set scale(val) {
|
|
44
|
-
this.instance.setScale(val, val);
|
|
45
|
-
}
|
|
46
|
-
get scaleX() {
|
|
47
|
-
return this.instance.getScaleX();
|
|
48
|
-
}
|
|
49
|
-
set scaleX(val) {
|
|
50
|
-
this.instance.setScaleX(val);
|
|
51
|
-
}
|
|
52
|
-
get scaleY() {
|
|
53
|
-
return this.instance.getScaleY();
|
|
54
|
-
}
|
|
55
|
-
set scaleY(val) {
|
|
56
|
-
this.instance.setScaleY(val);
|
|
57
|
-
}
|
|
58
|
-
get anchorX() {
|
|
59
|
-
return this.instance.anchorX;
|
|
60
|
-
}
|
|
61
|
-
set anchorX(val) {
|
|
62
|
-
this.instance.anchorX = val;
|
|
63
|
-
}
|
|
64
|
-
get anchorY() {
|
|
65
|
-
return this.instance.anchorY;
|
|
66
|
-
}
|
|
67
|
-
set anchorY(val) {
|
|
68
|
-
this.instance.anchorY = val;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Returns the angle of the node in degrees. 0 is the default rotation angle. Positive values rotate node clockwise.
|
|
72
|
-
* @function
|
|
73
|
-
* @return {Number} The rotation of the node in degrees.
|
|
74
|
-
*/
|
|
75
|
-
get rotation() {
|
|
76
|
-
return this.instance.getRotation();
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
*
|
|
80
|
-
* Sets the X angle of the node in degrees which performs a horizontal rotational skew.
|
|
81
|
-
* (support only in WebGL rendering mode)
|
|
82
|
-
* 0 is the default rotation angle.
|
|
83
|
-
* Positive values rotate node clockwise, and negative values for anti-clockwise.
|
|
84
|
-
*
|
|
85
|
-
* @param {Number} degrees The X rotation in degrees which performs a horizontal rotational skew.
|
|
86
|
-
*/
|
|
87
|
-
set rotation(val) {
|
|
88
|
-
this.instance.setRotation(val);
|
|
89
|
-
}
|
|
90
|
-
get color() {
|
|
91
|
-
return this.instance.getColor();
|
|
92
|
-
}
|
|
93
|
-
set color(val) {
|
|
94
|
-
this.instance.setColor(val);
|
|
95
|
-
}
|
|
96
|
-
get opacity() {
|
|
97
|
-
return this.instance.getOpacity();
|
|
98
|
-
}
|
|
99
|
-
set opacity(val) {
|
|
100
|
-
this.instance.setOpacity(val);
|
|
101
|
-
}
|
|
102
|
-
get active() {
|
|
103
|
-
if (!cc.sys.isObjectValid(this.instance) || !this._active)
|
|
104
|
-
return false;
|
|
105
|
-
let p = this.parent;
|
|
106
|
-
while (p) {
|
|
107
|
-
if (!p.active)
|
|
108
|
-
return false;
|
|
109
|
-
p = p.parent;
|
|
110
|
-
}
|
|
111
|
-
return true;
|
|
112
|
-
}
|
|
113
|
-
set active(val) {
|
|
114
|
-
if (!cc.sys.isObjectValid(this.instance)) {
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
this._active = val;
|
|
118
|
-
if (this.instance instanceof ccui.Widget) {
|
|
119
|
-
this.instance.setEnabled(val);
|
|
120
|
-
}
|
|
121
|
-
this.instance.setVisible(val);
|
|
122
|
-
}
|
|
123
|
-
get group() {
|
|
124
|
-
return this._group;
|
|
125
|
-
}
|
|
126
|
-
set group(val) {
|
|
127
|
-
this._group = val;
|
|
128
|
-
}
|
|
129
|
-
get width() {
|
|
130
|
-
return this.instance.width;
|
|
131
|
-
}
|
|
132
|
-
set width(val) {
|
|
133
|
-
this.instance.setContentSize(val, this.height);
|
|
134
|
-
}
|
|
135
|
-
get height() {
|
|
136
|
-
return this.instance.height;
|
|
137
|
-
}
|
|
138
|
-
set height(val) {
|
|
139
|
-
this.instance.setContentSize(val, this.width);
|
|
140
|
-
}
|
|
141
|
-
get zIndex() {
|
|
142
|
-
return this.instance.zIndex;
|
|
143
|
-
}
|
|
144
|
-
set zIndex(val) {
|
|
145
|
-
this.instance.zIndex = val;
|
|
146
|
-
}
|
|
147
|
-
get childrenCount() {
|
|
148
|
-
return this.children.length;
|
|
149
|
-
}
|
|
150
|
-
destroy() {
|
|
151
|
-
this.removeFromParent(true);
|
|
152
|
-
}
|
|
153
|
-
addComponent(instance) {
|
|
154
|
-
return this.entity.assign(instance);
|
|
155
|
-
}
|
|
156
|
-
getComponent(component) {
|
|
157
|
-
return this.entity.getComponent(component);
|
|
158
|
-
}
|
|
159
|
-
getComponentsInChildren(component) {
|
|
160
|
-
if (!this.children.length) {
|
|
161
|
-
return [];
|
|
162
|
-
}
|
|
163
|
-
const listHave = this.children.filter((child) => {
|
|
164
|
-
return child.getComponent(component);
|
|
165
|
-
});
|
|
166
|
-
return listHave.map((node) => node.getComponent(component));
|
|
167
|
-
}
|
|
168
|
-
getComponentInChildren(component) {
|
|
169
|
-
return this.getComponentsInChildren(component)[0];
|
|
170
|
-
}
|
|
171
|
-
hasComponentInChildren(component) {
|
|
172
|
-
if (!this.children.length) {
|
|
173
|
-
return false;
|
|
174
|
-
}
|
|
175
|
-
return this.children.some((child) => {
|
|
176
|
-
return child.getComponent(component);
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
getPercent() {
|
|
180
|
-
if (this.instance instanceof ccui.LoadingBar) {
|
|
181
|
-
return this.instance.getPercent();
|
|
182
|
-
}
|
|
183
|
-
return 0;
|
|
184
|
-
}
|
|
185
|
-
setPercent(val) {
|
|
186
|
-
if (this.instance instanceof ccui.LoadingBar) {
|
|
187
|
-
return this.instance.setPercent(val);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
setTouchEnabled(enabled) {
|
|
191
|
-
if (!cc.sys.isObjectValid(this.instance)) {
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
if (this.instance instanceof ccui.Widget) {
|
|
195
|
-
this.instance.setTouchEnabled(enabled);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
addTouchEventListener(cb) {
|
|
199
|
-
if (!cc.sys.isObjectValid(this.instance)) {
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
if (this.instance instanceof ccui.Widget) {
|
|
203
|
-
this.instance.addTouchEventListener(cb);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
convertToNodeSpace(point) {
|
|
207
|
-
const { x, y } = this.instance.convertToNodeSpace(point);
|
|
208
|
-
return Vec2(x, y);
|
|
209
|
-
}
|
|
210
|
-
convertToNodeSpaceAR(point) {
|
|
211
|
-
const { x, y } = this.instance.convertToNodeSpaceAR(point);
|
|
212
|
-
return Vec2(x, y);
|
|
213
|
-
}
|
|
214
|
-
convertToWorldSpaceAR(point) {
|
|
215
|
-
const { x, y } = this.instance.convertToWorldSpaceAR(point);
|
|
216
|
-
return Vec2(x, y);
|
|
217
|
-
}
|
|
218
|
-
getPosition() {
|
|
219
|
-
return this.instance.getPosition();
|
|
220
|
-
}
|
|
221
|
-
setPosition(x, y) {
|
|
222
|
-
this.instance.setPosition(x, y);
|
|
223
|
-
}
|
|
224
|
-
setRotation(deg) {
|
|
225
|
-
this.instance.setRotation(deg);
|
|
226
|
-
}
|
|
227
|
-
getRotation() {
|
|
228
|
-
return this.instance.getRotation();
|
|
229
|
-
}
|
|
230
|
-
setAnchorPoint(point, y) {
|
|
231
|
-
this.instance.setAnchorPoint(point, y);
|
|
232
|
-
}
|
|
233
|
-
getAnchorPoint() {
|
|
234
|
-
return this.instance.getAnchorPoint();
|
|
235
|
-
}
|
|
236
|
-
getBoundingBox() {
|
|
237
|
-
const box = this.instance.getBoundingBox();
|
|
238
|
-
box.contains = function (point) {
|
|
239
|
-
return this.x <= point.x && this.x + this.width >= point.x && this.y <= point.y && this.y + this.height >= point.y;
|
|
240
|
-
};
|
|
241
|
-
return box;
|
|
242
|
-
}
|
|
243
|
-
getContentSize() {
|
|
244
|
-
return this.instance.getContentSize();
|
|
245
|
-
}
|
|
246
|
-
setContentSize(size, height) {
|
|
247
|
-
this.instance.setContentSize(size, height);
|
|
248
|
-
if (this.instance instanceof cc.ClippingNode) {
|
|
249
|
-
const hw = (size.width || size) * 0.5;
|
|
250
|
-
const hh = (size.height || height) * 0.5;
|
|
251
|
-
const stencil = new cc.DrawNode();
|
|
252
|
-
const rectangle = [cc.p(-hw, -hh), cc.p(hw, -hh), cc.p(hw, hh), cc.p(-hw, hh)];
|
|
253
|
-
stencil.drawPoly(rectangle, cc.Color.WHITE, 0, cc.Color.WHITE);
|
|
254
|
-
// stencil.drawDot(cc.p(-height * 0.5, -height * 0.5), height, cc.Color.WHITE);
|
|
255
|
-
this.instance.stencil = stencil;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
setColor(color) {
|
|
259
|
-
this.instance.setColor(color);
|
|
260
|
-
}
|
|
261
|
-
setScale(scaleX, scaleY) {
|
|
262
|
-
this.instance.setScale(scaleX, scaleY || scaleX);
|
|
263
|
-
}
|
|
264
|
-
runAction(atc) {
|
|
265
|
-
this.instance.runAction(atc);
|
|
266
|
-
}
|
|
267
|
-
stopAllActions() {
|
|
268
|
-
this.instance.stopAllActions();
|
|
269
|
-
}
|
|
270
|
-
pauseAllActionsAndSchedule() {
|
|
271
|
-
this.instance.pause();
|
|
272
|
-
this.instance.unscheduleUpdate();
|
|
273
|
-
}
|
|
274
|
-
resumeAllActionsAndSchedule() {
|
|
275
|
-
this.instance.resume();
|
|
276
|
-
this.instance.scheduleUpdate();
|
|
277
|
-
}
|
|
278
|
-
removeFromParent(cleanup) {
|
|
279
|
-
this.active = false;
|
|
280
|
-
if (this.parent) {
|
|
281
|
-
this.parent.children = this.parent.children.filter(({ entity }) => entity.id !== this.entity.id);
|
|
282
|
-
}
|
|
283
|
-
if (cleanup) {
|
|
284
|
-
this.children.forEach((child) => {
|
|
285
|
-
child.destroy();
|
|
286
|
-
});
|
|
287
|
-
this.parent = null;
|
|
288
|
-
this.entity.destroy();
|
|
289
|
-
this.stopAllActions();
|
|
290
|
-
this.instance.removeFromParent(cleanup);
|
|
291
|
-
}
|
|
292
|
-
else {
|
|
293
|
-
this.stopAllActions();
|
|
294
|
-
this.instance.removeFromParent();
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
addChild(child) {
|
|
298
|
-
child._active = true;
|
|
299
|
-
child.parent = this;
|
|
300
|
-
this.children.push(child);
|
|
301
|
-
this.instance.addChild(child.instance);
|
|
302
|
-
}
|
|
303
|
-
removeAllChildren(cleanup) {
|
|
304
|
-
this.children.forEach((child) => {
|
|
305
|
-
child.removeFromParent(cleanup);
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
|
-
getData(key) {
|
|
309
|
-
const data = this.getComponent(ExtraDataComp);
|
|
310
|
-
if (!data)
|
|
311
|
-
throw Error('need add ExtraDataComp to Node');
|
|
312
|
-
return data.getData(key);
|
|
313
|
-
}
|
|
314
|
-
setData(key, value) {
|
|
315
|
-
const data = this.getComponent(ExtraDataComp);
|
|
316
|
-
if (!data) {
|
|
317
|
-
this.addComponent(instantiate(ExtraDataComp, { key, value }));
|
|
318
|
-
}
|
|
319
|
-
else {
|
|
320
|
-
data.setData(key, value);
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
removeData(key) {
|
|
324
|
-
const data = this.getComponent(ExtraDataComp);
|
|
325
|
-
if (data) {
|
|
326
|
-
data.removeData(key);
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
resolveComponent(component) {
|
|
330
|
-
if (component.constructor.hasRender) {
|
|
331
|
-
this.addChild(component.node);
|
|
332
|
-
}
|
|
333
|
-
else {
|
|
334
|
-
this.addComponent(component);
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NodePool.d.ts","sourceRoot":"","sources":["../../src/gworld/NodePool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,qBAAa,QAAQ;IACnB,KAAK,EAAE,QAAQ,EAAE,CAAK;IAEtB,GAAG,CAAC,IAAI,EAAE,QAAQ;IAQlB,GAAG,IAAI,QAAQ;IAOf,IAAI;IAIJ,KAAK;CAIN"}
|
package/dist/gworld/NodePool.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export class NodePool {
|
|
2
|
-
items = [];
|
|
3
|
-
put(node) {
|
|
4
|
-
if (node) {
|
|
5
|
-
node.removeFromParent();
|
|
6
|
-
node.entity.immortal = true;
|
|
7
|
-
this.items.push(node);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
get() {
|
|
11
|
-
const node = this.items.pop();
|
|
12
|
-
node.entity.immortal = false;
|
|
13
|
-
node.active = true;
|
|
14
|
-
return node;
|
|
15
|
-
}
|
|
16
|
-
size() {
|
|
17
|
-
return this.items.length;
|
|
18
|
-
}
|
|
19
|
-
clear() {
|
|
20
|
-
this.items.forEach((node) => node.destroy());
|
|
21
|
-
this.items.length = 0;
|
|
22
|
-
}
|
|
23
|
-
}
|
package/dist/gworld/Scene.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Scene.d.ts","sourceRoot":"","sources":["../../src/gworld/Scene.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAGvD,qBAAa,cAAe,SAAQ,iBAAiB;IACnD,MAAM;CASP"}
|
package/dist/gworld/Scene.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { GameWorld } from '.';
|
|
2
|
-
import { EnhancedComponent } from './EnhancedComponent';
|
|
3
|
-
import { NodeComp } from './NodeComp';
|
|
4
|
-
export class SceneComponent extends EnhancedComponent {
|
|
5
|
-
render() {
|
|
6
|
-
const world = GameWorld.Instance;
|
|
7
|
-
world.entities.reset();
|
|
8
|
-
const root = world.entities.create();
|
|
9
|
-
const node = root.assign(new NodeComp(cc.director.getRunningScene(), root));
|
|
10
|
-
const sceneComponent = root.assign(this);
|
|
11
|
-
sceneComponent.node = node;
|
|
12
|
-
return sceneComponent;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { EnhancedComponent, NodeComp } from '.';
|
|
2
|
-
export declare class NoRenderComponentX<Props = object, C extends cc.Node = cc.Node> extends EnhancedComponent<Props, NodeComp<C>> {
|
|
3
|
-
static hasRender: boolean;
|
|
4
|
-
}
|
|
5
|
-
export declare class ComponentX<Props = object, C extends cc.Node = cc.Node> extends EnhancedComponent<Props, NodeComp<C>> {
|
|
6
|
-
render?(): this;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=decorator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decorator.d.ts","sourceRoot":"","sources":["../../src/gworld/decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAa,QAAQ,EAAE,MAAM,GAAG,CAAA;AAE1D,qBAAa,kBAAkB,CAAC,KAAK,GAAG,MAAM,EAAE,CAAC,SAAS,EAAE,CAAC,IAAI,GAAG,EAAE,CAAC,IAAI,CAAE,SAAQ,iBAAiB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IACxH,MAAM,CAAC,SAAS,UAAQ;CACzB;AAED,qBAAa,UAAU,CAAC,KAAK,GAAG,MAAM,EAAE,CAAC,SAAS,EAAE,CAAC,IAAI,GAAG,EAAE,CAAC,IAAI,CAAE,SAAQ,iBAAiB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IAChH,MAAM,CAAC;CAMR"}
|
package/dist/gworld/decorator.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { EnhancedComponent, GameWorld } from '.';
|
|
2
|
-
export class NoRenderComponentX extends EnhancedComponent {
|
|
3
|
-
static hasRender = false;
|
|
4
|
-
}
|
|
5
|
-
export class ComponentX extends EnhancedComponent {
|
|
6
|
-
render() {
|
|
7
|
-
const world = GameWorld.Instance;
|
|
8
|
-
const root = world.entities.create();
|
|
9
|
-
const comp = root.assign(this);
|
|
10
|
-
return comp;
|
|
11
|
-
}
|
|
12
|
-
}
|
package/dist/gworld/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Constructor, System, World } from 'entityx-ts';
|
|
2
|
-
export declare class GameWorld extends World {
|
|
3
|
-
listUpdate: (System | Constructor<System>)[];
|
|
4
|
-
update(dt: number): void;
|
|
5
|
-
private static _instance;
|
|
6
|
-
static get Instance(): GameWorld;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/gworld/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAEvD,qBAAa,SAAU,SAAQ,KAAK;IAClC,UAAU,EAAE,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,EAAE,CAAK;IACjD,MAAM,CAAC,EAAE,EAAE,MAAM;IAMjB,OAAO,CAAC,MAAM,CAAC,SAAS,CAAW;IAEnC,WAAkB,QAAQ,cAGzB;CACF"}
|
package/dist/gworld/index.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { World } from 'entityx-ts';
|
|
2
|
-
export class GameWorld extends World {
|
|
3
|
-
listUpdate = [];
|
|
4
|
-
update(dt) {
|
|
5
|
-
this.listUpdate.forEach((system) => {
|
|
6
|
-
this.systems.update(system, dt);
|
|
7
|
-
});
|
|
8
|
-
}
|
|
9
|
-
static _instance;
|
|
10
|
-
static get Instance() {
|
|
11
|
-
// Do you need arguments? Make it a regular static method instead.
|
|
12
|
-
return this._instance || (this._instance = new this());
|
|
13
|
-
}
|
|
14
|
-
}
|