@safe-engine/cocos 1.6.5 → 1.8.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.
- package/dist/animation/AnimationComponent.d.ts +1 -1
- package/dist/animation/AnimationComponent.d.ts.map +1 -1
- package/dist/animation/AnimationComponent.js +2 -2
- package/dist/animation/AnimationSystem.js +1 -1
- package/dist/app.d.ts +2 -2
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +39 -29
- package/dist/box2d-wasm/PhysicsComponent.d.ts +3 -1
- package/dist/box2d-wasm/PhysicsComponent.d.ts.map +1 -1
- package/dist/box2d-wasm/PhysicsComponent.js +17 -4
- package/dist/box2d-wasm/PhysicsSprite.d.ts +1 -0
- package/dist/box2d-wasm/PhysicsSprite.d.ts.map +1 -1
- package/dist/box2d-wasm/PhysicsSprite.js +3 -4
- package/dist/box2d-wasm/PhysicsSystem.d.ts +1 -2
- package/dist/box2d-wasm/PhysicsSystem.d.ts.map +1 -1
- package/dist/box2d-wasm/PhysicsSystem.js +33 -29
- package/dist/collider/CollideComponent.d.ts +1 -1
- package/dist/collider/CollideComponent.d.ts.map +1 -1
- package/dist/collider/CollideComponent.js +1 -1
- package/dist/collider/CollideSystem.js +1 -1
- package/dist/collider/index.d.ts +1 -0
- package/dist/collider/index.d.ts.map +1 -1
- package/dist/collider/index.js +1 -0
- package/dist/dragonbones/index.d.ts +1 -1
- package/dist/dragonbones/index.d.ts.map +1 -1
- package/dist/dragonbones/index.js +2 -2
- package/dist/gui/GUIComponent.d.ts +93 -0
- package/dist/gui/GUIComponent.d.ts.map +1 -0
- package/dist/gui/GUIComponent.js +77 -0
- package/dist/gui/GUISystem.d.ts +15 -0
- package/dist/gui/GUISystem.d.ts.map +1 -0
- package/dist/gui/GUISystem.js +112 -0
- package/dist/gui/index.d.ts +3 -0
- package/dist/gui/index.d.ts.map +1 -0
- package/dist/gui/index.js +2 -0
- package/dist/gworld/EnhancedComponent.d.ts +22 -0
- package/dist/gworld/EnhancedComponent.d.ts.map +1 -0
- package/dist/gworld/EnhancedComponent.js +44 -0
- package/dist/gworld/NodeComp.d.ts +153 -0
- package/dist/gworld/NodeComp.d.ts.map +1 -0
- package/dist/gworld/NodeComp.js +337 -0
- package/dist/{helper → gworld}/NodePool.d.ts +1 -1
- package/dist/gworld/NodePool.d.ts.map +1 -0
- package/dist/gworld/NodePool.js +23 -0
- package/dist/gworld/Scene.d.ts +5 -0
- package/dist/gworld/Scene.d.ts.map +1 -0
- package/dist/gworld/Scene.js +14 -0
- package/dist/gworld/components/AnimationComponent.d.ts +2 -2
- package/dist/gworld/components/CollideComponent.d.ts +2 -2
- package/dist/gworld/components/EnhancedComponent.d.ts +2 -2
- package/dist/gworld/components/GUIComponent.d.ts +4 -4
- package/dist/gworld/components/NoRenderComponent.d.ts +3 -3
- package/dist/gworld/components/NodeComp.d.ts +2 -2
- package/dist/gworld/components/RenderComponent.d.ts +4 -4
- package/dist/gworld/core/NodePool.d.ts +1 -1
- package/dist/gworld/core/Scene.d.ts +1 -1
- package/dist/gworld/core/decorator.d.ts +2 -2
- package/dist/gworld/decorator.d.ts +9 -0
- package/dist/gworld/decorator.d.ts.map +1 -0
- package/dist/gworld/decorator.js +13 -0
- package/dist/gworld/index.d.ts +5 -0
- package/dist/gworld/index.d.ts.map +1 -1
- package/dist/gworld/index.js +5 -0
- package/dist/gworld/systems/CollideSystem.d.ts +1 -2
- package/dist/gworld/systems/CollideSystem.d.ts.map +1 -1
- package/dist/gworld/systems/CollideSystem.js +2 -12
- package/dist/index.d.ts +3 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -7
- package/dist/norender/NoRenderComponent.d.ts +37 -0
- package/dist/norender/NoRenderComponent.d.ts.map +1 -0
- package/dist/norender/NoRenderComponent.js +41 -0
- package/dist/norender/NoRenderSystem.d.ts +16 -0
- package/dist/norender/NoRenderSystem.d.ts.map +1 -0
- package/dist/norender/NoRenderSystem.js +75 -0
- package/dist/norender/index.d.ts +3 -0
- package/dist/norender/index.d.ts.map +1 -0
- package/dist/norender/index.js +2 -0
- package/dist/render/RenderComponent.d.ts +48 -0
- package/dist/render/RenderComponent.d.ts.map +1 -0
- package/dist/render/RenderComponent.js +80 -0
- package/dist/render/RenderSystem.d.ts +21 -0
- package/dist/render/RenderSystem.d.ts.map +1 -0
- package/dist/render/RenderSystem.js +74 -0
- package/dist/render/index.d.ts +3 -0
- package/dist/render/index.d.ts.map +1 -0
- package/dist/render/index.js +2 -0
- package/dist/richtext/RichTextComp.d.ts +1 -1
- package/dist/richtext/RichTextComp.d.ts.map +1 -1
- package/dist/richtext/RichTextComp.js +1 -1
- package/package.json +1 -1
- package/dist/dragonbones/cocos/CocosArmatureDisplay.d.ts +0 -77
- package/dist/dragonbones/cocos/CocosArmatureDisplay.d.ts.map +0 -1
- package/dist/dragonbones/cocos/CocosArmatureDisplay.js +0 -227
- package/dist/dragonbones/cocos/CocosFactory.d.ts +0 -128
- package/dist/dragonbones/cocos/CocosFactory.d.ts.map +0 -1
- package/dist/dragonbones/cocos/CocosFactory.js +0 -231
- package/dist/dragonbones/cocos/CocosSlot.d.ts +0 -49
- package/dist/dragonbones/cocos/CocosSlot.d.ts.map +0 -1
- package/dist/dragonbones/cocos/CocosSlot.js +0 -385
- package/dist/dragonbones/cocos/CocosTextureAtlasData.d.ts +0 -53
- package/dist/dragonbones/cocos/CocosTextureAtlasData.d.ts.map +0 -1
- package/dist/dragonbones/cocos/CocosTextureAtlasData.js +0 -158
- package/dist/dragonbones/dragonBones.d.ts +0 -3
- package/dist/dragonbones/dragonBones.d.ts.map +0 -1
- package/dist/dragonbones/dragonBones.js +0 -4788
- package/dist/helper/NodePool.d.ts.map +0 -1
- package/dist/helper/NodePool.js +0 -29
|
@@ -0,0 +1,337 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,14 @@
|
|
|
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,4 +1,4 @@
|
|
|
1
|
-
import { EnhancedComponent } from '
|
|
1
|
+
import { EnhancedComponent } from '../gworld/components/EnhancedComponent';
|
|
2
2
|
export declare namespace AnimationClip {
|
|
3
3
|
interface IEvent {
|
|
4
4
|
frame: number;
|
|
@@ -61,5 +61,5 @@ export declare class AnimationComp extends EnhancedComponent {
|
|
|
61
61
|
resume(): void;
|
|
62
62
|
stop(name?: string): void;
|
|
63
63
|
}
|
|
64
|
-
export {};
|
|
64
|
+
export { };
|
|
65
65
|
//# sourceMappingURL=AnimationComponent.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Constructor } from 'entityx-ts';
|
|
2
|
-
import { BaseComponentProps } from '
|
|
3
|
-
import { NodeComp } from './NodeComp';
|
|
2
|
+
import { BaseComponentProps } from '../safex';
|
|
3
|
+
import { NodeComp } from './components/NodeComp';
|
|
4
4
|
export declare class EnhancedComponent<Props = object, N extends NodeComp<any> = NodeComp<any>> {
|
|
5
5
|
static hasRender: boolean;
|
|
6
6
|
props: Props;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { ComponentX, NoRenderComponentX } from '../gworld/core/decorator';
|
|
2
|
+
import { Color4B, Size, Vec2 } from '../polyfills';
|
|
3
|
+
import { BaseComponentProps, ColorSource } from '../safex';
|
|
4
4
|
export declare const FillType: {
|
|
5
5
|
HORIZONTAL: number;
|
|
6
6
|
VERTICAL: number;
|
|
@@ -89,5 +89,5 @@ export declare class InputComp extends ComponentX<InputCompProps & BaseComponent
|
|
|
89
89
|
}
|
|
90
90
|
export declare class BlockInputEventsComp extends NoRenderComponentX {
|
|
91
91
|
}
|
|
92
|
-
export {};
|
|
92
|
+
export { };
|
|
93
93
|
//# sourceMappingURL=GUIComponent.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Touch } from '../../polyfills';
|
|
2
|
-
import { NoRenderComponentX } from '../
|
|
3
|
-
import { EventCallbackType, NodeComp } from '
|
|
2
|
+
import { NoRenderComponentX } from '../decorator';
|
|
3
|
+
import { EventCallbackType, NodeComp } from '../NodeComp';
|
|
4
4
|
type TouchEVentCallback = (touch?: Touch, node?: NodeComp) => void;
|
|
5
5
|
export interface EventMap {
|
|
6
6
|
[key: string]: [EventCallbackType];
|
|
@@ -34,5 +34,5 @@ export declare class ExtraDataComp extends NoRenderComponentX<ExtraDataProps> {
|
|
|
34
34
|
setData<T>(key: string, val: T): void;
|
|
35
35
|
removeData(key: string): void;
|
|
36
36
|
}
|
|
37
|
-
export {};
|
|
37
|
+
export { };
|
|
38
38
|
//# sourceMappingURL=NoRenderComponent.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Constructor, Entity } from 'entityx-ts';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { ComponentType, EnhancedComponent } from '../EnhancedComponent';
|
|
3
|
+
import { Vec2 } from '../polyfills';
|
|
4
4
|
export type EventCallbackType = (...args: any[]) => void;
|
|
5
5
|
export declare class NodeComp<C extends cc.Node = cc.Node> {
|
|
6
6
|
entity: Entity;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Color4B, Vec2 } from '../../polyfills';
|
|
2
2
|
import { BaseComponentProps, ColorSource } from '../../safex';
|
|
3
|
-
import { ComponentX } from '../
|
|
3
|
+
import { ComponentX } from '../decorator';
|
|
4
4
|
export declare class NodeRender extends ComponentX {
|
|
5
5
|
nodeName: string;
|
|
6
6
|
}
|
|
@@ -36,9 +36,9 @@ export declare class GraphicsRender extends ComponentX<GraphicsRenderProps & Bas
|
|
|
36
36
|
fillColor: cc.Color;
|
|
37
37
|
drawDot(x: any, y: any, r: any): void;
|
|
38
38
|
drawLine(origin: Vec2, destination: Vec2, thickness: Float, color: Color4B): void;
|
|
39
|
-
drawRect(origin: Vec2, destination: Vec2, color
|
|
39
|
+
drawRect(origin: Vec2, destination: Vec2, color?: Color4B): void;
|
|
40
40
|
drawCircle(center: Vec2, radius: Float, angle?: Float, segments?: Integer, drawLineToCenter?: boolean, lineWidth?: Float, color?: Color4B): void;
|
|
41
|
-
drawPoly(points: Vec2[], color
|
|
41
|
+
drawPoly(points: Vec2[], color?: Color4B, thickness?: Float): void;
|
|
42
42
|
clear(): void;
|
|
43
43
|
}
|
|
44
44
|
interface TiledMapProps {
|
|
@@ -48,5 +48,5 @@ export declare class TiledMap extends ComponentX<TiledMapProps & {
|
|
|
48
48
|
$ref?: TiledMap;
|
|
49
49
|
}, cc.TMXTiledMap> {
|
|
50
50
|
}
|
|
51
|
-
export {};
|
|
51
|
+
export { };
|
|
52
52
|
//# sourceMappingURL=RenderComponent.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EnhancedComponent } from '../
|
|
2
|
-
import { NodeComp } from '../
|
|
1
|
+
import { EnhancedComponent } from '../EnhancedComponent';
|
|
2
|
+
import { NodeComp } from '../NodeComp';
|
|
3
3
|
export declare class NoRenderComponentX<Props = object, C extends cc.Node = cc.Node> extends EnhancedComponent<Props, NodeComp<C>> {
|
|
4
4
|
static hasRender: boolean;
|
|
5
5
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { EnhancedComponent } from './EnhancedComponent';
|
|
2
|
+
import { NodeComp } from './NodeComp';
|
|
3
|
+
export declare class NoRenderComponentX<Props = object, C extends cc.Node = cc.Node> extends EnhancedComponent<Props, NodeComp<C>> {
|
|
4
|
+
static hasRender: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare class ComponentX<Props = object, C extends cc.Node = cc.Node> extends EnhancedComponent<Props, NodeComp<C>> {
|
|
7
|
+
render?(): this;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=decorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorator.d.ts","sourceRoot":"","sources":["../../src/gworld/decorator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GameWorld } from '.';
|
|
2
|
+
import { EnhancedComponent } from './EnhancedComponent';
|
|
3
|
+
export class NoRenderComponentX extends EnhancedComponent {
|
|
4
|
+
static hasRender = false;
|
|
5
|
+
}
|
|
6
|
+
export class ComponentX extends EnhancedComponent {
|
|
7
|
+
render() {
|
|
8
|
+
const world = GameWorld.Instance;
|
|
9
|
+
const root = world.entities.create();
|
|
10
|
+
const comp = root.assign(this);
|
|
11
|
+
return comp;
|
|
12
|
+
}
|
|
13
|
+
}
|
package/dist/gworld/index.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { Constructor, System, World } from 'entityx-ts';
|
|
2
|
+
export * from './decorator';
|
|
3
|
+
export * from './EnhancedComponent';
|
|
4
|
+
export * from './NodeComp';
|
|
5
|
+
export * from './NodePool';
|
|
6
|
+
export * from './Scene';
|
|
2
7
|
export declare class GameWorld extends World {
|
|
3
8
|
listUpdate: (System | Constructor<System>)[];
|
|
4
9
|
update(dt: number): void;
|
|
@@ -1 +1 @@
|
|
|
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"}
|
|
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,cAAc,aAAa,CAAA;AAC3B,cAAc,qBAAqB,CAAA;AACnC,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AAEvB,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
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { World } from 'entityx-ts';
|
|
2
|
+
export * from './decorator';
|
|
3
|
+
export * from './EnhancedComponent';
|
|
4
|
+
export * from './NodeComp';
|
|
5
|
+
export * from './NodePool';
|
|
6
|
+
export * from './Scene';
|
|
2
7
|
export class GameWorld extends World {
|
|
3
8
|
listUpdate = [];
|
|
4
9
|
update(dt) {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { EntityManager, EventManager, System } from 'entityx-ts';
|
|
2
|
-
import { Collider, Contract } from '
|
|
3
|
-
export declare function shouldCollider(colA: Collider, colB: Collider): any;
|
|
2
|
+
import { Collider, Contract } from '../components/CollideComponent';
|
|
4
3
|
export declare class CollideSystem implements System {
|
|
5
4
|
listColliders: Collider[];
|
|
6
5
|
_contracts: Contract[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollideSystem.d.ts","sourceRoot":"","sources":["../../../src/gworld/systems/CollideSystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAc,MAAM,EAAE,MAAM,YAAY,CAAA;AAG5E,OAAO,EAA+B,QAAQ,EAAiB,QAAQ,EAAmB,MAAM,gCAAgC,CAAA;AAGhI,
|
|
1
|
+
{"version":3,"file":"CollideSystem.d.ts","sourceRoot":"","sources":["../../../src/gworld/systems/CollideSystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAc,MAAM,EAAE,MAAM,YAAY,CAAA;AAG5E,OAAO,EAA+B,QAAQ,EAAiB,QAAQ,EAAmB,MAAM,gCAAgC,CAAA;AAGhI,qBAAa,aAAc,YAAW,MAAM;IAC1C,aAAa,EAAE,QAAQ,EAAE,CAAK;IAC9B,UAAU,EAAE,QAAQ,EAAE,CAAK;IAC3B,eAAe,QAAK;IACpB,aAAa,EAAE,EAAE,CAAC,QAAQ,CAAA;IAC1B,gBAAgB,UAAQ;IACxB,OAAO,UAAO;IACd,cAAc,cAAW;IAEzB,SAAS,CAAC,aAAa,EAAE,YAAY;IASrC,OAAO,CAAC,aAAa,CAOpB;IAED,OAAO,CAAC,gBAAgB,CAEvB;IAED,MAAM,CAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM;IA2GhE,WAAW,CAAC,QAAQ,EAAE,QAAQ;IAS9B,cAAc,CAAC,QAAQ,EAAE,QAAQ;IAIjC,YAAY,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK;IAK3B,eAAe,CAAC,MAAM,UAAO;CAI9B"}
|
|
@@ -1,20 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CollideSystem = void 0;
|
|
4
|
-
exports.shouldCollider = shouldCollider;
|
|
5
4
|
var entityx_ts_1 = require("entityx-ts");
|
|
6
|
-
var
|
|
5
|
+
var utils_1 = require("../../helper/utils");
|
|
7
6
|
var CollideComponent_1 = require("../components/CollideComponent");
|
|
8
7
|
var NodeComp_1 = require("../components/NodeComp");
|
|
9
|
-
function shouldCollider(colA, colB) {
|
|
10
|
-
var groupA = colA.node.group;
|
|
11
|
-
var groupB = colB.node.group;
|
|
12
|
-
if (groupA === undefined || groupB === undefined) {
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
var colliderMatrix = __1.GameWorld.Instance.systems.get(CollideSystem).colliderMatrix;
|
|
16
|
-
return colliderMatrix[groupA][groupB];
|
|
17
|
-
}
|
|
18
8
|
var CollideSystem = /** @class */ (function () {
|
|
19
9
|
function CollideSystem() {
|
|
20
10
|
var _this = this;
|
|
@@ -157,7 +147,7 @@ var CollideSystem = /** @class */ (function () {
|
|
|
157
147
|
CollideSystem.prototype.addCollider = function (collider) {
|
|
158
148
|
var _this = this;
|
|
159
149
|
this.listColliders.forEach(function (col) {
|
|
160
|
-
if (shouldCollider(col, collider)) {
|
|
150
|
+
if ((0, utils_1.shouldCollider)(col, collider)) {
|
|
161
151
|
_this._contracts.push(new CollideComponent_1.Contract(col, collider));
|
|
162
152
|
}
|
|
163
153
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
export * from './app';
|
|
2
2
|
export * from './collider';
|
|
3
3
|
export * from './dragonbones';
|
|
4
|
+
export * from './gui';
|
|
4
5
|
export * from './gworld';
|
|
5
|
-
export * from './gworld/components/GUIComponent';
|
|
6
|
-
export * from './gworld/components/NodeComp';
|
|
7
|
-
export * from './gworld/components/NoRenderComponent';
|
|
8
|
-
export * from './gworld/components/RenderComponent';
|
|
9
|
-
export * from './gworld/core/decorator';
|
|
10
|
-
export * from './gworld/core/Scene';
|
|
11
|
-
export * from './gworld/systems/GUISystem';
|
|
12
6
|
export * from './helper/action';
|
|
13
7
|
export * from './helper/director';
|
|
14
8
|
export * from './helper/math';
|
|
15
9
|
export * from './helper/utils';
|
|
10
|
+
export * from './norender';
|
|
16
11
|
export * from './polyfills';
|
|
17
12
|
export { type Touch } from './polyfills';
|
|
13
|
+
export * from './render';
|
|
18
14
|
export * from './richtext';
|
|
19
15
|
export * from './safex';
|
|
20
16
|
export * from './spine';
|
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,eAAe,CAAA;AAC7B,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,eAAe,CAAA;AAC7B,cAAc,OAAO,CAAA;AACrB,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,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"}
|