@safe-engine/cocos 2.6.5 → 2.6.9
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/README.md +124 -2
- package/dist/core/NodeComp.d.ts +4 -1
- package/dist/core/NodeComp.d.ts.map +1 -1
- package/dist/core/NodeComp.js +12 -1
- package/dist/core/decorator.d.ts +1 -0
- package/dist/core/decorator.d.ts.map +1 -1
- package/dist/core/decorator.js +3 -0
- package/dist/dragonbones/db-cocos/SimpleMeshNode.d.ts +1 -1
- package/dist/dragonbones/db-cocos/SimpleMeshNode.d.ts.map +1 -1
- package/dist/gui/GUIComponent.d.ts +1 -0
- package/dist/gui/GUIComponent.d.ts.map +1 -1
- package/dist/gui/GUISystem.d.ts.map +1 -1
- package/dist/gui/GUISystem.js +13 -5
- package/dist/gui/SliderComp.d.ts +16 -0
- package/dist/gui/SliderComp.d.ts.map +1 -0
- package/dist/gui/SliderComp.js +32 -0
- package/dist/polyfills.d.ts +20 -0
- package/dist/polyfills.d.ts.map +1 -1
- package/dist/polyfills.js +9 -0
- package/dist/render/RenderComponent.d.ts +1 -0
- package/dist/render/RenderComponent.d.ts.map +1 -1
- package/dist/render/RenderComponent.js +3 -0
- package/dist/render/RenderTextureComp.d.ts +10 -0
- package/dist/render/RenderTextureComp.d.ts.map +1 -0
- package/dist/render/RenderTextureComp.js +13 -0
- package/dist/richtext/RichTextComp.d.ts +1 -0
- package/dist/richtext/RichTextComp.d.ts.map +1 -1
- package/dist/richtext/RichTextSystem.js +4 -4
- package/package.json +3 -3
- package/dist/dragonbones/PixiDragonBonesSprite.d.ts +0 -19
- package/dist/dragonbones/PixiDragonBonesSprite.d.ts.map +0 -1
- package/dist/dragonbones/PixiDragonBonesSprite.js +0 -75
- package/dist/gworld/components/AnimationComponent.d.ts +0 -65
- package/dist/gworld/components/AnimationComponent.d.ts.map +0 -1
- package/dist/gworld/components/AnimationComponent.js +0 -141
- package/dist/gworld/components/CollideComponent.d.ts +0 -64
- package/dist/gworld/components/CollideComponent.d.ts.map +0 -1
- package/dist/gworld/components/CollideComponent.js +0 -269
- package/dist/gworld/components/EnhancedComponent.d.ts +0 -22
- package/dist/gworld/components/EnhancedComponent.d.ts.map +0 -1
- package/dist/gworld/components/EnhancedComponent.js +0 -51
- package/dist/gworld/components/GUIComponent.d.ts +0 -67
- package/dist/gworld/components/GUIComponent.d.ts.map +0 -1
- package/dist/gworld/components/GUIComponent.js +0 -166
- package/dist/gworld/components/NoRenderComponent.d.ts +0 -38
- package/dist/gworld/components/NoRenderComponent.d.ts.map +0 -1
- package/dist/gworld/components/NoRenderComponent.js +0 -81
- package/dist/gworld/components/NodeComp.d.ts +0 -152
- package/dist/gworld/components/NodeComp.d.ts.map +0 -1
- package/dist/gworld/components/NodeComp.js +0 -405
- package/dist/gworld/components/RenderComponent.d.ts +0 -58
- package/dist/gworld/components/RenderComponent.d.ts.map +0 -1
- package/dist/gworld/components/RenderComponent.js +0 -166
- package/dist/gworld/core/NodePool.d.ts +0 -9
- package/dist/gworld/core/NodePool.d.ts.map +0 -1
- package/dist/gworld/core/NodePool.js +0 -30
- package/dist/gworld/core/Scene.d.ts +0 -5
- package/dist/gworld/core/Scene.d.ts.map +0 -1
- package/dist/gworld/core/Scene.js +0 -38
- package/dist/gworld/core/decorator.d.ts +0 -9
- package/dist/gworld/core/decorator.d.ts.map +0 -1
- package/dist/gworld/core/decorator.js +0 -43
- package/dist/gworld/index.d.ts +0 -8
- package/dist/gworld/index.d.ts.map +0 -1
- package/dist/gworld/index.js +0 -43
- package/dist/gworld/systems/AnimationSystem.d.ts +0 -6
- package/dist/gworld/systems/AnimationSystem.d.ts.map +0 -1
- package/dist/gworld/systems/AnimationSystem.js +0 -30
- package/dist/gworld/systems/CollideSystem.d.ts +0 -20
- package/dist/gworld/systems/CollideSystem.d.ts.map +0 -1
- package/dist/gworld/systems/CollideSystem.js +0 -171
- package/dist/gworld/systems/GUISystem.d.ts +0 -15
- package/dist/gworld/systems/GUISystem.d.ts.map +0 -1
- package/dist/gworld/systems/GUISystem.js +0 -123
- package/dist/gworld/systems/NoRenderSystem.d.ts +0 -16
- package/dist/gworld/systems/NoRenderSystem.d.ts.map +0 -1
- package/dist/gworld/systems/NoRenderSystem.js +0 -85
- package/dist/gworld/systems/RenderSystem.d.ts +0 -22
- package/dist/gworld/systems/RenderSystem.d.ts.map +0 -1
- package/dist/gworld/systems/RenderSystem.js +0 -104
- package/dist/helper/NodePool.d.ts +0 -9
- package/dist/helper/NodePool.d.ts.map +0 -1
- package/dist/helper/NodePool.js +0 -29
- package/dist/helper/html-text-parser.d.ts +0 -30
- package/dist/helper/html-text-parser.d.ts.map +0 -1
- package/dist/helper/html-text-parser.js +0 -354
- package/dist/safex.d.ts +0 -10
- package/dist/safex.d.ts.map +0 -1
- package/dist/safex.js +0 -25
- package/dist/spine/CCSkeleton.d.ts +0 -2
- package/dist/spine/CCSkeleton.d.ts.map +0 -1
- package/dist/spine/CCSkeleton.js +0 -344
- package/dist/spine/CCSkeletonAnimation.d.ts +0 -16
- package/dist/spine/CCSkeletonAnimation.d.ts.map +0 -1
- package/dist/spine/CCSkeletonAnimation.js +0 -317
- package/dist/spine/CCSkeletonCanvasRenderCmd.d.ts +0 -2
- package/dist/spine/CCSkeletonCanvasRenderCmd.d.ts.map +0 -1
- package/dist/spine/CCSkeletonCanvasRenderCmd.js +0 -225
- package/dist/spine/CCSkeletonTexture.d.ts +0 -2
- package/dist/spine/CCSkeletonTexture.d.ts.map +0 -1
- package/dist/spine/CCSkeletonTexture.js +0 -62
- package/dist/spine/CCSkeletonWebGLRenderCmd.d.ts +0 -2
- package/dist/spine/CCSkeletonWebGLRenderCmd.d.ts.map +0 -1
- package/dist/spine/CCSkeletonWebGLRenderCmd.js +0 -281
- package/dist/spine/PixiSpineSprite.d.ts +0 -19
- package/dist/spine/PixiSpineSprite.d.ts.map +0 -1
- package/dist/spine/PixiSpineSprite.js +0 -72
|
@@ -1,405 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.NodeComp = void 0;
|
|
7
|
-
var remove_1 = __importDefault(require("lodash/remove"));
|
|
8
|
-
var utils_1 = require("../../helper/utils");
|
|
9
|
-
var polyfills_1 = require("../../polyfills");
|
|
10
|
-
var NoRenderComponent_1 = require("./NoRenderComponent");
|
|
11
|
-
var NodeComp = /** @class */ (function () {
|
|
12
|
-
function NodeComp(instance, entity) {
|
|
13
|
-
this.children = [];
|
|
14
|
-
this._active = true;
|
|
15
|
-
this.entity = entity;
|
|
16
|
-
this.instance = instance;
|
|
17
|
-
}
|
|
18
|
-
Object.defineProperty(NodeComp.prototype, "uuid", {
|
|
19
|
-
get: function () {
|
|
20
|
-
return this.entity.id;
|
|
21
|
-
},
|
|
22
|
-
enumerable: false,
|
|
23
|
-
configurable: true
|
|
24
|
-
});
|
|
25
|
-
Object.defineProperty(NodeComp.prototype, "position", {
|
|
26
|
-
get: function () {
|
|
27
|
-
return (0, polyfills_1.Vec2)(this.instance.getPosition());
|
|
28
|
-
},
|
|
29
|
-
set: function (val) {
|
|
30
|
-
this.instance.setPosition(val.x, val.y);
|
|
31
|
-
},
|
|
32
|
-
enumerable: false,
|
|
33
|
-
configurable: true
|
|
34
|
-
});
|
|
35
|
-
NodeComp.prototype.getPositionX = function () {
|
|
36
|
-
return this.instance.getPositionX();
|
|
37
|
-
};
|
|
38
|
-
NodeComp.prototype.setPositionX = function (val) {
|
|
39
|
-
this.instance.setPositionX(val);
|
|
40
|
-
};
|
|
41
|
-
NodeComp.prototype.getPositionY = function () {
|
|
42
|
-
return this.instance.getPositionY();
|
|
43
|
-
};
|
|
44
|
-
NodeComp.prototype.setPositionY = function (val) {
|
|
45
|
-
this.instance.setPositionY(val);
|
|
46
|
-
};
|
|
47
|
-
Object.defineProperty(NodeComp.prototype, "scale", {
|
|
48
|
-
get: function () {
|
|
49
|
-
return this.instance.getScale();
|
|
50
|
-
},
|
|
51
|
-
set: function (val) {
|
|
52
|
-
this.instance.setScale(val, val);
|
|
53
|
-
},
|
|
54
|
-
enumerable: false,
|
|
55
|
-
configurable: true
|
|
56
|
-
});
|
|
57
|
-
Object.defineProperty(NodeComp.prototype, "scaleX", {
|
|
58
|
-
get: function () {
|
|
59
|
-
return this.instance.getScaleX();
|
|
60
|
-
},
|
|
61
|
-
set: function (val) {
|
|
62
|
-
this.instance.setScaleX(val);
|
|
63
|
-
},
|
|
64
|
-
enumerable: false,
|
|
65
|
-
configurable: true
|
|
66
|
-
});
|
|
67
|
-
Object.defineProperty(NodeComp.prototype, "scaleY", {
|
|
68
|
-
get: function () {
|
|
69
|
-
return this.instance.getScaleY();
|
|
70
|
-
},
|
|
71
|
-
set: function (val) {
|
|
72
|
-
this.instance.setScaleY(val);
|
|
73
|
-
},
|
|
74
|
-
enumerable: false,
|
|
75
|
-
configurable: true
|
|
76
|
-
});
|
|
77
|
-
Object.defineProperty(NodeComp.prototype, "anchorX", {
|
|
78
|
-
get: function () {
|
|
79
|
-
return this.instance.anchorX;
|
|
80
|
-
},
|
|
81
|
-
set: function (val) {
|
|
82
|
-
this.instance.anchorX = val;
|
|
83
|
-
},
|
|
84
|
-
enumerable: false,
|
|
85
|
-
configurable: true
|
|
86
|
-
});
|
|
87
|
-
Object.defineProperty(NodeComp.prototype, "anchorY", {
|
|
88
|
-
get: function () {
|
|
89
|
-
return this.instance.anchorY;
|
|
90
|
-
},
|
|
91
|
-
set: function (val) {
|
|
92
|
-
this.instance.anchorY = val;
|
|
93
|
-
},
|
|
94
|
-
enumerable: false,
|
|
95
|
-
configurable: true
|
|
96
|
-
});
|
|
97
|
-
Object.defineProperty(NodeComp.prototype, "rotation", {
|
|
98
|
-
/**
|
|
99
|
-
* Returns the angle of the node in degrees. 0 is the default rotation angle. Positive values rotate node clockwise.
|
|
100
|
-
* @function
|
|
101
|
-
* @return {Number} The rotation of the node in degrees.
|
|
102
|
-
*/
|
|
103
|
-
get: function () {
|
|
104
|
-
return this.instance.getRotation();
|
|
105
|
-
},
|
|
106
|
-
/**
|
|
107
|
-
*
|
|
108
|
-
* Sets the X angle of the node in degrees which performs a horizontal rotational skew.
|
|
109
|
-
* (support only in WebGL rendering mode)
|
|
110
|
-
* 0 is the default rotation angle.
|
|
111
|
-
* Positive values rotate node clockwise, and negative values for anti-clockwise.
|
|
112
|
-
*
|
|
113
|
-
* @param {Number} degrees The X rotation in degrees which performs a horizontal rotational skew.
|
|
114
|
-
*/
|
|
115
|
-
set: function (val) {
|
|
116
|
-
this.instance.setRotation(val);
|
|
117
|
-
},
|
|
118
|
-
enumerable: false,
|
|
119
|
-
configurable: true
|
|
120
|
-
});
|
|
121
|
-
Object.defineProperty(NodeComp.prototype, "color", {
|
|
122
|
-
get: function () {
|
|
123
|
-
return this.instance.getColor();
|
|
124
|
-
},
|
|
125
|
-
set: function (val) {
|
|
126
|
-
this.instance.setColor(val);
|
|
127
|
-
},
|
|
128
|
-
enumerable: false,
|
|
129
|
-
configurable: true
|
|
130
|
-
});
|
|
131
|
-
Object.defineProperty(NodeComp.prototype, "opacity", {
|
|
132
|
-
get: function () {
|
|
133
|
-
return this.instance.getOpacity();
|
|
134
|
-
},
|
|
135
|
-
set: function (val) {
|
|
136
|
-
this.instance.setOpacity(val);
|
|
137
|
-
},
|
|
138
|
-
enumerable: false,
|
|
139
|
-
configurable: true
|
|
140
|
-
});
|
|
141
|
-
Object.defineProperty(NodeComp.prototype, "active", {
|
|
142
|
-
get: function () {
|
|
143
|
-
if (!cc.sys.isObjectValid(this.instance) || !this._active)
|
|
144
|
-
return false;
|
|
145
|
-
var p = this.parent;
|
|
146
|
-
while (p) {
|
|
147
|
-
if (!p.active)
|
|
148
|
-
return false;
|
|
149
|
-
p = p.parent;
|
|
150
|
-
}
|
|
151
|
-
return true;
|
|
152
|
-
},
|
|
153
|
-
set: function (val) {
|
|
154
|
-
if (!cc.sys.isObjectValid(this.instance)) {
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
this._active = val;
|
|
158
|
-
if (this.instance instanceof ccui.Widget) {
|
|
159
|
-
this.instance.setEnabled(val);
|
|
160
|
-
}
|
|
161
|
-
this.instance.setVisible(val);
|
|
162
|
-
},
|
|
163
|
-
enumerable: false,
|
|
164
|
-
configurable: true
|
|
165
|
-
});
|
|
166
|
-
Object.defineProperty(NodeComp.prototype, "group", {
|
|
167
|
-
get: function () {
|
|
168
|
-
return this._group;
|
|
169
|
-
},
|
|
170
|
-
set: function (val) {
|
|
171
|
-
this._group = val;
|
|
172
|
-
},
|
|
173
|
-
enumerable: false,
|
|
174
|
-
configurable: true
|
|
175
|
-
});
|
|
176
|
-
Object.defineProperty(NodeComp.prototype, "width", {
|
|
177
|
-
get: function () {
|
|
178
|
-
return this.instance.width;
|
|
179
|
-
},
|
|
180
|
-
set: function (val) {
|
|
181
|
-
this.instance.setContentSize(val, this.height);
|
|
182
|
-
},
|
|
183
|
-
enumerable: false,
|
|
184
|
-
configurable: true
|
|
185
|
-
});
|
|
186
|
-
Object.defineProperty(NodeComp.prototype, "height", {
|
|
187
|
-
get: function () {
|
|
188
|
-
return this.instance.height;
|
|
189
|
-
},
|
|
190
|
-
set: function (val) {
|
|
191
|
-
this.instance.setContentSize(val, this.width);
|
|
192
|
-
},
|
|
193
|
-
enumerable: false,
|
|
194
|
-
configurable: true
|
|
195
|
-
});
|
|
196
|
-
Object.defineProperty(NodeComp.prototype, "zIndex", {
|
|
197
|
-
get: function () {
|
|
198
|
-
return this.instance.zIndex;
|
|
199
|
-
},
|
|
200
|
-
set: function (val) {
|
|
201
|
-
this.instance.zIndex = val;
|
|
202
|
-
},
|
|
203
|
-
enumerable: false,
|
|
204
|
-
configurable: true
|
|
205
|
-
});
|
|
206
|
-
Object.defineProperty(NodeComp.prototype, "childrenCount", {
|
|
207
|
-
get: function () {
|
|
208
|
-
return this.children.length;
|
|
209
|
-
},
|
|
210
|
-
enumerable: false,
|
|
211
|
-
configurable: true
|
|
212
|
-
});
|
|
213
|
-
NodeComp.prototype.destroy = function () {
|
|
214
|
-
this.removeFromParent(true);
|
|
215
|
-
};
|
|
216
|
-
NodeComp.prototype.addComponent = function (instance) {
|
|
217
|
-
return this.entity.assign(instance);
|
|
218
|
-
};
|
|
219
|
-
NodeComp.prototype.getComponent = function (component) {
|
|
220
|
-
return this.entity.getComponent(component);
|
|
221
|
-
};
|
|
222
|
-
NodeComp.prototype.getComponentsInChildren = function (component) {
|
|
223
|
-
if (!this.children.length) {
|
|
224
|
-
return [];
|
|
225
|
-
}
|
|
226
|
-
var listHave = this.children.filter(function (child) {
|
|
227
|
-
return child.getComponent(component);
|
|
228
|
-
});
|
|
229
|
-
return listHave.map(function (node) { return node.getComponent(component); });
|
|
230
|
-
};
|
|
231
|
-
NodeComp.prototype.getComponentInChildren = function (component) {
|
|
232
|
-
return this.getComponentsInChildren(component)[0];
|
|
233
|
-
};
|
|
234
|
-
NodeComp.prototype.hasComponentInChildren = function (component) {
|
|
235
|
-
if (!this.children.length) {
|
|
236
|
-
return false;
|
|
237
|
-
}
|
|
238
|
-
return this.children.some(function (child) {
|
|
239
|
-
return child.getComponent(component);
|
|
240
|
-
});
|
|
241
|
-
};
|
|
242
|
-
NodeComp.prototype.getPercent = function () {
|
|
243
|
-
if (this.instance instanceof ccui.LoadingBar) {
|
|
244
|
-
return this.instance.getPercent();
|
|
245
|
-
}
|
|
246
|
-
return 0;
|
|
247
|
-
};
|
|
248
|
-
NodeComp.prototype.setPercent = function (val) {
|
|
249
|
-
if (this.instance instanceof ccui.LoadingBar) {
|
|
250
|
-
return this.instance.setPercent(val);
|
|
251
|
-
}
|
|
252
|
-
};
|
|
253
|
-
NodeComp.prototype.setTouchEnabled = function (enabled) {
|
|
254
|
-
if (!cc.sys.isObjectValid(this.instance)) {
|
|
255
|
-
return;
|
|
256
|
-
}
|
|
257
|
-
if (this.instance instanceof ccui.Widget) {
|
|
258
|
-
this.instance.setTouchEnabled(enabled);
|
|
259
|
-
}
|
|
260
|
-
};
|
|
261
|
-
NodeComp.prototype.addTouchEventListener = function (cb) {
|
|
262
|
-
if (!cc.sys.isObjectValid(this.instance)) {
|
|
263
|
-
return;
|
|
264
|
-
}
|
|
265
|
-
if (this.instance instanceof ccui.Widget) {
|
|
266
|
-
this.instance.addTouchEventListener(cb);
|
|
267
|
-
}
|
|
268
|
-
};
|
|
269
|
-
NodeComp.prototype.convertToNodeSpace = function (point) {
|
|
270
|
-
var _a = this.instance.convertToNodeSpace(point), x = _a.x, y = _a.y;
|
|
271
|
-
return (0, polyfills_1.Vec2)(x, y);
|
|
272
|
-
};
|
|
273
|
-
NodeComp.prototype.convertToNodeSpaceAR = function (point) {
|
|
274
|
-
var _a = this.instance.convertToNodeSpaceAR(point), x = _a.x, y = _a.y;
|
|
275
|
-
return (0, polyfills_1.Vec2)(x, y);
|
|
276
|
-
};
|
|
277
|
-
NodeComp.prototype.convertToWorldSpaceAR = function (point) {
|
|
278
|
-
var _a = this.instance.convertToWorldSpaceAR(point), x = _a.x, y = _a.y;
|
|
279
|
-
return (0, polyfills_1.Vec2)(x, y);
|
|
280
|
-
};
|
|
281
|
-
NodeComp.prototype.getPosition = function () {
|
|
282
|
-
return this.instance.getPosition();
|
|
283
|
-
};
|
|
284
|
-
NodeComp.prototype.setPosition = function (x, y) {
|
|
285
|
-
this.instance.setPosition(x, y);
|
|
286
|
-
};
|
|
287
|
-
NodeComp.prototype.setRotation = function (deg) {
|
|
288
|
-
this.instance.setRotation(deg);
|
|
289
|
-
};
|
|
290
|
-
NodeComp.prototype.getRotation = function () {
|
|
291
|
-
return this.instance.getRotation();
|
|
292
|
-
};
|
|
293
|
-
NodeComp.prototype.setAnchorPoint = function (point, y) {
|
|
294
|
-
this.instance.setAnchorPoint(point, y);
|
|
295
|
-
};
|
|
296
|
-
NodeComp.prototype.getAnchorPoint = function () {
|
|
297
|
-
return this.instance.getAnchorPoint();
|
|
298
|
-
};
|
|
299
|
-
NodeComp.prototype.getBoundingBox = function () {
|
|
300
|
-
var box = this.instance.getBoundingBox();
|
|
301
|
-
box.contains = function (point) {
|
|
302
|
-
return this.x <= point.x && this.x + this.width >= point.x && this.y <= point.y && this.y + this.height >= point.y;
|
|
303
|
-
};
|
|
304
|
-
return box;
|
|
305
|
-
};
|
|
306
|
-
NodeComp.prototype.getContentSize = function () {
|
|
307
|
-
return this.instance.getContentSize();
|
|
308
|
-
};
|
|
309
|
-
NodeComp.prototype.setContentSize = function (size, height) {
|
|
310
|
-
this.instance.setContentSize(size, height);
|
|
311
|
-
if (this.instance instanceof cc.ClippingNode) {
|
|
312
|
-
var hw = (size.width || size) * 0.5;
|
|
313
|
-
var hh = (size.height || height) * 0.5;
|
|
314
|
-
var stencil = new cc.DrawNode();
|
|
315
|
-
var rectangle = [cc.p(-hw, -hh), cc.p(hw, -hh), cc.p(hw, hh), cc.p(-hw, hh)];
|
|
316
|
-
stencil.drawPoly(rectangle, cc.Color.WHITE, 0, cc.Color.WHITE);
|
|
317
|
-
// stencil.drawDot(cc.p(-height * 0.5, -height * 0.5), height, cc.Color.WHITE);
|
|
318
|
-
this.instance.stencil = stencil;
|
|
319
|
-
}
|
|
320
|
-
};
|
|
321
|
-
NodeComp.prototype.setColor = function (color) {
|
|
322
|
-
this.instance.setColor(color);
|
|
323
|
-
};
|
|
324
|
-
NodeComp.prototype.setScale = function (scaleX, scaleY) {
|
|
325
|
-
this.instance.setScale(scaleX, scaleY || scaleX);
|
|
326
|
-
};
|
|
327
|
-
NodeComp.prototype.runAction = function (atc) {
|
|
328
|
-
this.instance.runAction(atc);
|
|
329
|
-
};
|
|
330
|
-
NodeComp.prototype.stopAllActions = function () {
|
|
331
|
-
this.instance.stopAllActions();
|
|
332
|
-
};
|
|
333
|
-
NodeComp.prototype.pauseAllActionsAndSchedule = function () {
|
|
334
|
-
this.instance.pause();
|
|
335
|
-
this.instance.unscheduleUpdate();
|
|
336
|
-
};
|
|
337
|
-
NodeComp.prototype.resumeAllActionsAndSchedule = function () {
|
|
338
|
-
this.instance.resume();
|
|
339
|
-
this.instance.scheduleUpdate();
|
|
340
|
-
};
|
|
341
|
-
NodeComp.prototype.removeFromParent = function (cleanup) {
|
|
342
|
-
var _this = this;
|
|
343
|
-
this.active = false;
|
|
344
|
-
if (this.parent) {
|
|
345
|
-
(0, remove_1.default)(this.parent.children, function (_a) {
|
|
346
|
-
var entity = _a.entity;
|
|
347
|
-
return entity.id === _this.entity.id;
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
|
-
if (cleanup) {
|
|
351
|
-
this.children.forEach(function (child) {
|
|
352
|
-
child.entity.destroy();
|
|
353
|
-
});
|
|
354
|
-
this.parent = null;
|
|
355
|
-
this.entity.destroy();
|
|
356
|
-
this.instance.removeFromParent(cleanup);
|
|
357
|
-
}
|
|
358
|
-
else {
|
|
359
|
-
this.stopAllActions();
|
|
360
|
-
this.instance.removeFromParent();
|
|
361
|
-
}
|
|
362
|
-
};
|
|
363
|
-
NodeComp.prototype.addChild = function (child) {
|
|
364
|
-
child._active = true;
|
|
365
|
-
child.parent = this;
|
|
366
|
-
this.children.push(child);
|
|
367
|
-
this.instance.addChild(child.instance);
|
|
368
|
-
};
|
|
369
|
-
NodeComp.prototype.removeAllChildren = function (cleanup) {
|
|
370
|
-
this.children.forEach(function (child) {
|
|
371
|
-
child.removeFromParent(cleanup);
|
|
372
|
-
});
|
|
373
|
-
};
|
|
374
|
-
NodeComp.prototype.getData = function (key) {
|
|
375
|
-
var data = this.getComponent(NoRenderComponent_1.ExtraDataComp);
|
|
376
|
-
if (!data)
|
|
377
|
-
throw Error('need add ExtraDataComp to Node');
|
|
378
|
-
return data.getData(key);
|
|
379
|
-
};
|
|
380
|
-
NodeComp.prototype.setData = function (key, value) {
|
|
381
|
-
var data = this.getComponent(NoRenderComponent_1.ExtraDataComp);
|
|
382
|
-
if (!data) {
|
|
383
|
-
this.addComponent((0, utils_1.instantiate)(NoRenderComponent_1.ExtraDataComp, { key: key, value: value }));
|
|
384
|
-
}
|
|
385
|
-
else {
|
|
386
|
-
data.setData(key, value);
|
|
387
|
-
}
|
|
388
|
-
};
|
|
389
|
-
NodeComp.prototype.removeData = function (key) {
|
|
390
|
-
var data = this.getComponent(NoRenderComponent_1.ExtraDataComp);
|
|
391
|
-
if (data) {
|
|
392
|
-
data.removeData(key);
|
|
393
|
-
}
|
|
394
|
-
};
|
|
395
|
-
NodeComp.prototype.resolveComponent = function (component) {
|
|
396
|
-
if (component.constructor.hasRender) {
|
|
397
|
-
this.addChild(component.node);
|
|
398
|
-
}
|
|
399
|
-
else {
|
|
400
|
-
this.addComponent(component);
|
|
401
|
-
}
|
|
402
|
-
};
|
|
403
|
-
return NodeComp;
|
|
404
|
-
}());
|
|
405
|
-
exports.NodeComp = NodeComp;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { BaseComponentProps, GraphicsRenderProps, SpineData } from '../../../@types/safex';
|
|
2
|
-
import { ComponentX } from '../core/decorator';
|
|
3
|
-
export declare class NodeRender extends ComponentX {
|
|
4
|
-
nodeName: string;
|
|
5
|
-
}
|
|
6
|
-
interface SpriteRenderProps {
|
|
7
|
-
spriteFrame: string;
|
|
8
|
-
texType?: number;
|
|
9
|
-
type?: number;
|
|
10
|
-
}
|
|
11
|
-
export declare class SpriteRender extends ComponentX<SpriteRenderProps & BaseComponentProps<SpriteRender>, cc.Sprite> {
|
|
12
|
-
get spriteFrame(): string;
|
|
13
|
-
set spriteFrame(frame: string);
|
|
14
|
-
}
|
|
15
|
-
interface MaskRenderProps {
|
|
16
|
-
type?: number;
|
|
17
|
-
segments?: number;
|
|
18
|
-
inverted?: boolean;
|
|
19
|
-
}
|
|
20
|
-
export declare class MaskRender extends ComponentX<MaskRenderProps, cc.ClippingNode> {
|
|
21
|
-
}
|
|
22
|
-
interface ParticleCompProps {
|
|
23
|
-
plistFile: string;
|
|
24
|
-
}
|
|
25
|
-
export declare class ParticleComp extends ComponentX<ParticleCompProps, cc.ParticleSystem> {
|
|
26
|
-
}
|
|
27
|
-
interface SpineSkeletonProps {
|
|
28
|
-
data: SpineData;
|
|
29
|
-
skin?: string;
|
|
30
|
-
animation?: string;
|
|
31
|
-
timeScale?: number;
|
|
32
|
-
loop?: boolean;
|
|
33
|
-
}
|
|
34
|
-
export declare class SpineSkeleton extends ComponentX<SpineSkeletonProps & BaseComponentProps<SpineSkeleton>> {
|
|
35
|
-
data: SpineData;
|
|
36
|
-
skin: string;
|
|
37
|
-
animation: string;
|
|
38
|
-
loop: boolean;
|
|
39
|
-
timeScale: number;
|
|
40
|
-
setAnimation(name: string, loop?: boolean): void;
|
|
41
|
-
setSkeletonData(data: string): void;
|
|
42
|
-
}
|
|
43
|
-
export declare class GraphicsRender extends ComponentX<GraphicsRenderProps & BaseComponentProps<GraphicsRender>, cc.DrawNode> {
|
|
44
|
-
lineWidth: number;
|
|
45
|
-
strokeColor: cc.Color;
|
|
46
|
-
fillColor: cc.Color;
|
|
47
|
-
circle(x: any, y: any, r: any): void;
|
|
48
|
-
clear(): void;
|
|
49
|
-
}
|
|
50
|
-
interface TiledMapProps {
|
|
51
|
-
mapFile: string;
|
|
52
|
-
}
|
|
53
|
-
export declare class TiledMap extends ComponentX<TiledMapProps & {
|
|
54
|
-
$ref?: TiledMap;
|
|
55
|
-
}, cc.TMXTiledMap> {
|
|
56
|
-
}
|
|
57
|
-
export {};
|
|
58
|
-
//# sourceMappingURL=RenderComponent.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RenderComponent.d.ts","sourceRoot":"","sources":["../../../src/gworld/components/RenderComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAE1F,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,qBAAa,UAAW,SAAQ,UAAU;IACxC,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,UAAU,iBAAiB;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,qBAAa,YAAa,SAAQ,UAAU,CAAC,iBAAiB,GAAG,kBAAkB,CAAC,YAAY,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC;IAC3G,IAAI,WAAW,WAEd;IAED,IAAI,WAAW,CAAC,KAAK,QAAA,EAepB;CACF;AACD,UAAU,eAAe;IACvB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AACD,qBAAa,UAAW,SAAQ,UAAU,CAAC,eAAe,EAAE,EAAE,CAAC,YAAY,CAAC;CAAI;AAEhF,UAAU,iBAAiB;IACzB,SAAS,EAAE,MAAM,CAAA;CAClB;AACD,qBAAa,YAAa,SAAQ,UAAU,CAAC,iBAAiB,EAAE,EAAE,CAAC,cAAc,CAAC;CAAI;AAEtF,UAAU,kBAAkB;IAC1B,IAAI,EAAE,SAAS,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AACD,qBAAa,aAAc,SAAQ,UAAU,CAAC,kBAAkB,GAAG,kBAAkB,CAAC,aAAa,CAAC,CAAC;IACnG,IAAI,EAAE,SAAS,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,OAAO,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;IAEjB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,UAAQ;IAOvC,eAAe,CAAC,IAAI,EAAE,MAAM;CAK7B;AAED,qBAAa,cAAe,SAAQ,UAAU,CAAC,mBAAmB,GAAG,kBAAkB,CAAC,cAAc,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC;IACnH,SAAS,SAAI;IACb,WAAW,WAAM;IACjB,SAAS,WAAO;IAEhB,MAAM,CAAC,CAAC,KAAA,EAAE,CAAC,KAAA,EAAE,CAAC,KAAA;IAwDd,KAAK;CAKN;AAED,UAAU,aAAa;IACrB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,qBAAa,QAAS,SAAQ,UAAU,CAAC,aAAa,GAAG;IAAE,IAAI,CAAC,EAAE,QAAQ,CAAA;CAAE,EAAE,EAAE,CAAC,WAAW,CAAC;CAAI"}
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.TiledMap = exports.GraphicsRender = exports.SpineSkeleton = exports.ParticleComp = exports.MaskRender = exports.SpriteRender = exports.NodeRender = void 0;
|
|
19
|
-
var polyfills_1 = require("../../polyfills");
|
|
20
|
-
var decorator_1 = require("../core/decorator");
|
|
21
|
-
var NodeRender = /** @class */ (function (_super) {
|
|
22
|
-
__extends(NodeRender, _super);
|
|
23
|
-
function NodeRender() {
|
|
24
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
25
|
-
}
|
|
26
|
-
return NodeRender;
|
|
27
|
-
}(decorator_1.ComponentX));
|
|
28
|
-
exports.NodeRender = NodeRender;
|
|
29
|
-
var SpriteRender = /** @class */ (function (_super) {
|
|
30
|
-
__extends(SpriteRender, _super);
|
|
31
|
-
function SpriteRender() {
|
|
32
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
33
|
-
}
|
|
34
|
-
Object.defineProperty(SpriteRender.prototype, "spriteFrame", {
|
|
35
|
-
get: function () {
|
|
36
|
-
return this.props.spriteFrame;
|
|
37
|
-
},
|
|
38
|
-
set: function (frame) {
|
|
39
|
-
this.props.spriteFrame = frame;
|
|
40
|
-
if (this.node && this.node.instance instanceof cc.Sprite) {
|
|
41
|
-
this.node.instance.setTexture(frame);
|
|
42
|
-
}
|
|
43
|
-
// } else if (this.node.instance instanceof ccui.ImageView) {
|
|
44
|
-
// if (this.texType) {
|
|
45
|
-
// this.node.instance.loadTexture(frame, this.texType)
|
|
46
|
-
// } else {
|
|
47
|
-
// this.node.instance.loadTexture(frame)
|
|
48
|
-
// }
|
|
49
|
-
// const sprite = new cc.Sprite(frame)
|
|
50
|
-
// this.node.setContentSize(sprite.getContentSize())
|
|
51
|
-
// } else if (this.node.instance instanceof ccui.Button) {
|
|
52
|
-
// this.node.instance.loadTextureNormal(frame)
|
|
53
|
-
},
|
|
54
|
-
enumerable: false,
|
|
55
|
-
configurable: true
|
|
56
|
-
});
|
|
57
|
-
return SpriteRender;
|
|
58
|
-
}(decorator_1.ComponentX));
|
|
59
|
-
exports.SpriteRender = SpriteRender;
|
|
60
|
-
var MaskRender = /** @class */ (function (_super) {
|
|
61
|
-
__extends(MaskRender, _super);
|
|
62
|
-
function MaskRender() {
|
|
63
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
64
|
-
}
|
|
65
|
-
return MaskRender;
|
|
66
|
-
}(decorator_1.ComponentX));
|
|
67
|
-
exports.MaskRender = MaskRender;
|
|
68
|
-
var ParticleComp = /** @class */ (function (_super) {
|
|
69
|
-
__extends(ParticleComp, _super);
|
|
70
|
-
function ParticleComp() {
|
|
71
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
72
|
-
}
|
|
73
|
-
return ParticleComp;
|
|
74
|
-
}(decorator_1.ComponentX));
|
|
75
|
-
exports.ParticleComp = ParticleComp;
|
|
76
|
-
var SpineSkeleton = /** @class */ (function (_super) {
|
|
77
|
-
__extends(SpineSkeleton, _super);
|
|
78
|
-
function SpineSkeleton() {
|
|
79
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
80
|
-
}
|
|
81
|
-
SpineSkeleton.prototype.setAnimation = function (name, loop) {
|
|
82
|
-
if (loop === void 0) { loop = false; }
|
|
83
|
-
var skel = this.node.instance;
|
|
84
|
-
if (skel.setAnimation) {
|
|
85
|
-
skel.setAnimation(0, name, loop);
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
SpineSkeleton.prototype.setSkeletonData = function (data) {
|
|
89
|
-
var skel = this.node.instance;
|
|
90
|
-
var atlas = data.replace('.json', '.atlas');
|
|
91
|
-
skel.initWithArgs(data, atlas, this.node.scale);
|
|
92
|
-
};
|
|
93
|
-
return SpineSkeleton;
|
|
94
|
-
}(decorator_1.ComponentX));
|
|
95
|
-
exports.SpineSkeleton = SpineSkeleton;
|
|
96
|
-
var GraphicsRender = /** @class */ (function (_super) {
|
|
97
|
-
__extends(GraphicsRender, _super);
|
|
98
|
-
function GraphicsRender() {
|
|
99
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
100
|
-
_this.lineWidth = 5;
|
|
101
|
-
_this.strokeColor = polyfills_1.RED;
|
|
102
|
-
_this.fillColor = polyfills_1.BLUE;
|
|
103
|
-
return _this;
|
|
104
|
-
}
|
|
105
|
-
GraphicsRender.prototype.circle = function (x, y, r) {
|
|
106
|
-
if (this.node.instance instanceof cc.DrawNode) {
|
|
107
|
-
this.node.instance.drawDot(cc.p(x, y), r, this.fillColor);
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
// fill() { }
|
|
111
|
-
// stroke() { }
|
|
112
|
-
// drawPoint(position: Vec2, pointSize: Float, color: Color4B, pointType = PointType.Rect) {
|
|
113
|
-
// }
|
|
114
|
-
// // drawPoints(points: Vec2[], color: Color4B) {
|
|
115
|
-
// // }
|
|
116
|
-
// drawLine(origin: Vec2, destination: Vec2, color: Color4B, thickness: Float) {
|
|
117
|
-
// }
|
|
118
|
-
// drawRect(origin: Vec2, destination: Vec2, color: Color4B) {
|
|
119
|
-
// this.node.instance.drawRect(origin, destination, color)
|
|
120
|
-
// }
|
|
121
|
-
// drawSolidRect(origin: Vec2, destination: Vec2, color: Color4B) {
|
|
122
|
-
// }
|
|
123
|
-
// drawCircle(center: Vec2, radius: Float, angle?: Float, segments?: Integer, drawLineToCenter?: boolean, scaleX?: Float, scaleY?: Float, color?: Color4B, thickness?: Float) {
|
|
124
|
-
// this.node.instance.drawCircle(x, y, radius)
|
|
125
|
-
// }
|
|
126
|
-
// drawSolidCircle(origin: Vec2, destination: Vec2, color: Color4B) {
|
|
127
|
-
// }
|
|
128
|
-
// drawQuadBezier(origin: Vec2, destination: Vec2, color: Color4B) {
|
|
129
|
-
// }
|
|
130
|
-
// drawCubicBezier(origin: Vec2, destination: Vec2, color: Color4B) {
|
|
131
|
-
// }
|
|
132
|
-
// drawCardinalSpline(points: Vec2[], color: Color4B) {
|
|
133
|
-
// }
|
|
134
|
-
// drawCatmullRom(points: Vec2[], color: Color4B) {
|
|
135
|
-
// }
|
|
136
|
-
// drawPoly(points: Vec2[], closedPolygon: boolean, color: Color4B, thickness?: Float) {
|
|
137
|
-
// this.node.instance.poly(points, closedPolygon)
|
|
138
|
-
// this.node.instance.fill(color)
|
|
139
|
-
// }
|
|
140
|
-
// drawSolidPoly(points: Vec2[], color: Color4B) {
|
|
141
|
-
// this.node.instance.drawPoly(points, color)
|
|
142
|
-
// }
|
|
143
|
-
// drawDot(points: Vec2[], color: Color4B) {
|
|
144
|
-
// }
|
|
145
|
-
// drawSegment(from: Vec2, to: Vec2, color: Color4B) {
|
|
146
|
-
// }
|
|
147
|
-
// drawTriangle(p1: Vec2, p2: Vec2, p3: Vec2, color: Color4B) {
|
|
148
|
-
// this.node.instance.poly([p1, p2, p3], true)
|
|
149
|
-
// this.node.instance.fill(color)
|
|
150
|
-
// }
|
|
151
|
-
GraphicsRender.prototype.clear = function () {
|
|
152
|
-
if (this.node.instance instanceof cc.DrawNode) {
|
|
153
|
-
this.node.instance.clear();
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
return GraphicsRender;
|
|
157
|
-
}(decorator_1.ComponentX));
|
|
158
|
-
exports.GraphicsRender = GraphicsRender;
|
|
159
|
-
var TiledMap = /** @class */ (function (_super) {
|
|
160
|
-
__extends(TiledMap, _super);
|
|
161
|
-
function TiledMap() {
|
|
162
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
163
|
-
}
|
|
164
|
-
return TiledMap;
|
|
165
|
-
}(decorator_1.ComponentX));
|
|
166
|
-
exports.TiledMap = TiledMap;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NodePool.d.ts","sourceRoot":"","sources":["../../../src/gworld/core/NodePool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAEjD,qBAAa,QAAQ;IACnB,KAAK,EAAE,QAAQ,EAAE,CAAK;IAEtB,GAAG,CAAC,IAAI,EAAE,QAAQ;IAQlB,GAAG,IAAI,QAAQ;IAOf,IAAI;IAIJ,KAAK;CAIN"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NodePool = void 0;
|
|
4
|
-
var NodePool = /** @class */ (function () {
|
|
5
|
-
function NodePool() {
|
|
6
|
-
this.items = [];
|
|
7
|
-
}
|
|
8
|
-
NodePool.prototype.put = function (node) {
|
|
9
|
-
if (node) {
|
|
10
|
-
node.removeFromParent();
|
|
11
|
-
node.entity.immortal = true;
|
|
12
|
-
this.items.push(node);
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
NodePool.prototype.get = function () {
|
|
16
|
-
var node = this.items.pop();
|
|
17
|
-
node.entity.immortal = false;
|
|
18
|
-
node.active = true;
|
|
19
|
-
return node;
|
|
20
|
-
};
|
|
21
|
-
NodePool.prototype.size = function () {
|
|
22
|
-
return this.items.length;
|
|
23
|
-
};
|
|
24
|
-
NodePool.prototype.clear = function () {
|
|
25
|
-
this.items.forEach(function (node) { return node.destroy(); });
|
|
26
|
-
this.items.length = 0;
|
|
27
|
-
};
|
|
28
|
-
return NodePool;
|
|
29
|
-
}());
|
|
30
|
-
exports.NodePool = NodePool;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Scene.d.ts","sourceRoot":"","sources":["../../../src/gworld/core/Scene.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AAGnE,qBAAa,cAAe,SAAQ,iBAAiB;IACnD,MAAM;CASP"}
|