@safe-engine/cocos 2.6.4 → 2.6.5
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/dragonbones/DragonBonesSystem.js +3 -3
- package/dist/dragonbones/PixiDragonBonesSprite.d.ts +18 -8
- package/dist/dragonbones/PixiDragonBonesSprite.d.ts.map +1 -1
- package/dist/dragonbones/PixiDragonBonesSprite.js +41 -48
- package/dist/dragonbones/db-cocos/CocosFactory.d.ts.map +1 -1
- package/dist/dragonbones/db-cocos/CocosFactory.js +2 -1
- package/dist/dragonbones/db-cocos/SimpleMeshNode.d.ts +1 -1
- package/dist/dragonbones/db-cocos/SimpleMeshNode.d.ts.map +1 -1
- package/dist/dragonbones/db-cocos/SimpleMeshNode.js +1 -1
- package/dist/gui/GUISystem.js +1 -1
- package/dist/gworld/components/AnimationComponent.d.ts +65 -0
- package/dist/gworld/components/AnimationComponent.d.ts.map +1 -0
- package/dist/gworld/components/AnimationComponent.js +141 -0
- package/dist/gworld/components/CollideComponent.d.ts +64 -0
- package/dist/gworld/components/CollideComponent.d.ts.map +1 -0
- package/dist/gworld/components/CollideComponent.js +269 -0
- package/dist/gworld/components/EnhancedComponent.d.ts +22 -0
- package/dist/gworld/components/EnhancedComponent.d.ts.map +1 -0
- package/dist/gworld/components/EnhancedComponent.js +51 -0
- package/dist/gworld/components/GUIComponent.d.ts +67 -0
- package/dist/gworld/components/GUIComponent.d.ts.map +1 -0
- package/dist/gworld/components/GUIComponent.js +166 -0
- package/dist/gworld/components/NoRenderComponent.d.ts +38 -0
- package/dist/gworld/components/NoRenderComponent.d.ts.map +1 -0
- package/dist/gworld/components/NoRenderComponent.js +81 -0
- package/dist/gworld/components/NodeComp.d.ts +152 -0
- package/dist/gworld/components/NodeComp.d.ts.map +1 -0
- package/dist/gworld/components/NodeComp.js +405 -0
- package/dist/gworld/components/RenderComponent.d.ts +58 -0
- package/dist/gworld/components/RenderComponent.d.ts.map +1 -0
- package/dist/gworld/components/RenderComponent.js +166 -0
- package/dist/gworld/core/NodePool.d.ts +9 -0
- package/dist/gworld/core/NodePool.d.ts.map +1 -0
- package/dist/gworld/core/NodePool.js +30 -0
- package/dist/gworld/core/Scene.d.ts +5 -0
- package/dist/gworld/core/Scene.d.ts.map +1 -0
- package/dist/gworld/core/Scene.js +38 -0
- package/dist/gworld/core/decorator.d.ts +9 -0
- package/dist/gworld/core/decorator.d.ts.map +1 -0
- package/dist/gworld/core/decorator.js +43 -0
- package/dist/gworld/index.d.ts +8 -0
- package/dist/gworld/index.d.ts.map +1 -0
- package/dist/gworld/index.js +43 -0
- package/dist/gworld/systems/AnimationSystem.d.ts +6 -0
- package/dist/gworld/systems/AnimationSystem.d.ts.map +1 -0
- package/dist/gworld/systems/AnimationSystem.js +30 -0
- package/dist/gworld/systems/CollideSystem.d.ts +20 -0
- package/dist/gworld/systems/CollideSystem.d.ts.map +1 -0
- package/dist/gworld/systems/CollideSystem.js +171 -0
- package/dist/gworld/systems/GUISystem.d.ts +15 -0
- package/dist/gworld/systems/GUISystem.d.ts.map +1 -0
- package/dist/gworld/systems/GUISystem.js +123 -0
- package/dist/gworld/systems/NoRenderSystem.d.ts +16 -0
- package/dist/gworld/systems/NoRenderSystem.d.ts.map +1 -0
- package/dist/gworld/systems/NoRenderSystem.js +85 -0
- package/dist/gworld/systems/RenderSystem.d.ts +22 -0
- package/dist/gworld/systems/RenderSystem.d.ts.map +1 -0
- package/dist/gworld/systems/RenderSystem.js +104 -0
- package/dist/helper/NodePool.d.ts +9 -0
- package/dist/helper/NodePool.d.ts.map +1 -0
- package/dist/helper/NodePool.js +29 -0
- package/dist/helper/html-text-parser.d.ts +30 -0
- package/dist/helper/html-text-parser.d.ts.map +1 -0
- package/dist/helper/html-text-parser.js +354 -0
- package/dist/spine/CCSkeleton.d.ts +1 -188
- package/dist/spine/CCSkeleton.d.ts.map +1 -1
- package/dist/spine/CCSkeleton.js +127 -103
- package/dist/spine/CCSkeletonAnimation.d.ts +6 -136
- package/dist/spine/CCSkeletonAnimation.d.ts.map +1 -1
- package/dist/spine/CCSkeletonAnimation.js +101 -95
- package/dist/spine/CCSkeletonCanvasRenderCmd.d.ts.map +1 -1
- package/dist/spine/CCSkeletonCanvasRenderCmd.js +3 -6
- package/dist/spine/CCSkeletonTexture.d.ts +1 -24
- package/dist/spine/CCSkeletonTexture.d.ts.map +1 -1
- package/dist/spine/CCSkeletonTexture.js +6 -4
- package/dist/spine/CCSkeletonWebGLRenderCmd.d.ts +1 -27
- package/dist/spine/CCSkeletonWebGLRenderCmd.d.ts.map +1 -1
- package/dist/spine/CCSkeletonWebGLRenderCmd.js +247 -243
- package/dist/spine/PixiSpineSprite.d.ts +19 -0
- package/dist/spine/PixiSpineSprite.d.ts.map +1 -0
- package/dist/spine/PixiSpineSprite.js +72 -0
- package/package.json +1 -1
|
@@ -0,0 +1,269 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.Contract = exports.CollisionType = exports.PolygonCollider = exports.CircleCollider = exports.BoxCollider = exports.Collider = void 0;
|
|
22
|
+
var max_1 = __importDefault(require("lodash/max"));
|
|
23
|
+
var min_1 = __importDefault(require("lodash/min"));
|
|
24
|
+
var polyfills_1 = require("../../polyfills");
|
|
25
|
+
var decorator_1 = require("../core/decorator");
|
|
26
|
+
function getNodeToWorldTransformAR(node) {
|
|
27
|
+
var t = node.instance.getNodeToWorldTransform();
|
|
28
|
+
var anchorPointSize = node.instance.getAnchorPointInPoints();
|
|
29
|
+
var transform = cc.affineTransformTranslate(t, anchorPointSize.x, anchorPointSize.y);
|
|
30
|
+
return transform;
|
|
31
|
+
}
|
|
32
|
+
function cloneRect(origin) {
|
|
33
|
+
return cc.rect(origin.x, origin.y, origin.width, origin.height);
|
|
34
|
+
}
|
|
35
|
+
var Collider = /** @class */ (function (_super) {
|
|
36
|
+
__extends(Collider, _super);
|
|
37
|
+
function Collider() {
|
|
38
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
39
|
+
_this._worldPoints = [];
|
|
40
|
+
_this._AABB = cc.rect(0, 0, 0, 0);
|
|
41
|
+
_this._preAabb = cc.rect(0, 0, 0, 0);
|
|
42
|
+
return _this;
|
|
43
|
+
}
|
|
44
|
+
// update(dt: number, draw?: cc.DrawNode) {}
|
|
45
|
+
Collider.prototype.getAABB = function () {
|
|
46
|
+
var collider = this.getComponent(Collider);
|
|
47
|
+
if (collider)
|
|
48
|
+
return collider._AABB;
|
|
49
|
+
return this._AABB;
|
|
50
|
+
};
|
|
51
|
+
Object.defineProperty(Collider.prototype, "world", {
|
|
52
|
+
get: function () {
|
|
53
|
+
return {
|
|
54
|
+
points: this._worldPoints,
|
|
55
|
+
preAabb: this._preAabb,
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
enumerable: false,
|
|
59
|
+
configurable: true
|
|
60
|
+
});
|
|
61
|
+
return Collider;
|
|
62
|
+
}(decorator_1.NoRenderComponentX));
|
|
63
|
+
exports.Collider = Collider;
|
|
64
|
+
var BoxCollider = /** @class */ (function (_super) {
|
|
65
|
+
__extends(BoxCollider, _super);
|
|
66
|
+
function BoxCollider() {
|
|
67
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
68
|
+
}
|
|
69
|
+
Object.defineProperty(BoxCollider.prototype, "size", {
|
|
70
|
+
get: function () {
|
|
71
|
+
return cc.size(this.props.width, this.props.height);
|
|
72
|
+
},
|
|
73
|
+
set: function (s) {
|
|
74
|
+
this.props.width = s.width;
|
|
75
|
+
this.props.height = s.height;
|
|
76
|
+
},
|
|
77
|
+
enumerable: false,
|
|
78
|
+
configurable: true
|
|
79
|
+
});
|
|
80
|
+
BoxCollider.prototype.update = function (dt, draw) {
|
|
81
|
+
if (!this.node) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
var collider = this.getComponent(Collider);
|
|
85
|
+
var _a = collider.props.offset || (0, polyfills_1.Vec2)(0, 0), x = _a.x, y = _a.y;
|
|
86
|
+
var hw = this.props.width * 0.5;
|
|
87
|
+
var hh = this.props.height * 0.5;
|
|
88
|
+
var transform = getNodeToWorldTransformAR(this.node);
|
|
89
|
+
var rect = cc.rect(x - hw, y - hh, this.props.width, this.props.height);
|
|
90
|
+
var rectTrs = cc.rectApplyAffineTransform(rect, transform);
|
|
91
|
+
// cc.log(rectTrs);
|
|
92
|
+
collider._worldPoints[0] = (0, polyfills_1.Vec2)(rectTrs.x, rectTrs.y);
|
|
93
|
+
collider._worldPoints[1] = (0, polyfills_1.Vec2)(rectTrs.x, rectTrs.y + rectTrs.height);
|
|
94
|
+
collider._worldPoints[2] = (0, polyfills_1.Vec2)(rectTrs.x + rectTrs.width, rectTrs.y + rectTrs.height);
|
|
95
|
+
collider._worldPoints[3] = (0, polyfills_1.Vec2)(rectTrs.x + rectTrs.width, rectTrs.y);
|
|
96
|
+
var listX = collider._worldPoints.map(function (_a) {
|
|
97
|
+
var x = _a.x;
|
|
98
|
+
return x;
|
|
99
|
+
});
|
|
100
|
+
var listY = collider._worldPoints.map(function (_a) {
|
|
101
|
+
var y = _a.y;
|
|
102
|
+
return y;
|
|
103
|
+
});
|
|
104
|
+
collider._preAabb = cloneRect(collider._AABB);
|
|
105
|
+
collider._AABB.x = (0, min_1.default)(listX);
|
|
106
|
+
collider._AABB.y = (0, min_1.default)(listY);
|
|
107
|
+
collider._AABB.width = (0, max_1.default)(listX) - collider._AABB.x;
|
|
108
|
+
collider._AABB.height = (0, max_1.default)(listY) - collider._AABB.y;
|
|
109
|
+
if (draw) {
|
|
110
|
+
draw.drawPoly(collider._worldPoints, null, 3, cc.Color.DEBUG_BORDER_COLOR);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
return BoxCollider;
|
|
114
|
+
}(Collider));
|
|
115
|
+
exports.BoxCollider = BoxCollider;
|
|
116
|
+
var CircleCollider = /** @class */ (function (_super) {
|
|
117
|
+
__extends(CircleCollider, _super);
|
|
118
|
+
function CircleCollider() {
|
|
119
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
120
|
+
}
|
|
121
|
+
CircleCollider.prototype.update = function (dt, draw) {
|
|
122
|
+
if (!this.node) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
var transform = getNodeToWorldTransformAR(this.node);
|
|
126
|
+
var collider = this.getComponent(Collider);
|
|
127
|
+
collider._worldRadius = this.props.radius * this.node.scaleX;
|
|
128
|
+
collider._worldPosition = cc.pointApplyAffineTransform(collider.props.offset, transform);
|
|
129
|
+
if (draw) {
|
|
130
|
+
draw.drawDot(collider._worldPosition, collider._worldRadius, cc.Color.DEBUG_FILL_COLOR);
|
|
131
|
+
draw.drawCircle(collider._worldPosition, collider._worldRadius, 0, 64, true, 3, cc.Color.DEBUG_BORDER_COLOR);
|
|
132
|
+
}
|
|
133
|
+
collider._preAabb = cloneRect(collider._AABB);
|
|
134
|
+
collider._AABB.x = collider._worldPosition.x - collider._worldRadius;
|
|
135
|
+
collider._AABB.y = collider._worldPosition.y - collider._worldRadius;
|
|
136
|
+
collider._AABB.width = collider._worldRadius * 2;
|
|
137
|
+
collider._AABB.height = collider._AABB.width;
|
|
138
|
+
// draw.drawRect(cc.p(this._AABB.x, this._AABB.y),
|
|
139
|
+
// cc.p(this._worldPosition.x + this._worldRadius, this._worldPosition.y + this._worldRadius),
|
|
140
|
+
// cc.Color.WHITE, 3, cc.Color.DEBUG_BORDER_COLOR);
|
|
141
|
+
};
|
|
142
|
+
return CircleCollider;
|
|
143
|
+
}(Collider));
|
|
144
|
+
exports.CircleCollider = CircleCollider;
|
|
145
|
+
var PolygonCollider = /** @class */ (function (_super) {
|
|
146
|
+
__extends(PolygonCollider, _super);
|
|
147
|
+
function PolygonCollider() {
|
|
148
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
149
|
+
}
|
|
150
|
+
Object.defineProperty(PolygonCollider.prototype, "points", {
|
|
151
|
+
get: function () {
|
|
152
|
+
var _a = this.props.offset, x = _a.x, y = _a.y;
|
|
153
|
+
var pointsList = this.props.points.map(function (p) { return (0, polyfills_1.Vec2)(p.x + x, p.y + y); });
|
|
154
|
+
return pointsList;
|
|
155
|
+
},
|
|
156
|
+
set: function (points) {
|
|
157
|
+
this.props.points = points;
|
|
158
|
+
},
|
|
159
|
+
enumerable: false,
|
|
160
|
+
configurable: true
|
|
161
|
+
});
|
|
162
|
+
PolygonCollider.prototype.update = function (dt, draw) {
|
|
163
|
+
if (!this.node) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
var transform = getNodeToWorldTransformAR(this.node);
|
|
167
|
+
var collider = this.getComponent(Collider);
|
|
168
|
+
collider._worldPoints = this.points.map(function (p) { return cc.pointApplyAffineTransform(p, transform); });
|
|
169
|
+
// cc.log(polyPoints);
|
|
170
|
+
if (draw) {
|
|
171
|
+
draw.drawPoly(collider._worldPoints, cc.Color.DEBUG_FILL_COLOR, 3, cc.Color.DEBUG_BORDER_COLOR);
|
|
172
|
+
}
|
|
173
|
+
var listX = collider._worldPoints.map(function (_a) {
|
|
174
|
+
var x = _a.x;
|
|
175
|
+
return x;
|
|
176
|
+
});
|
|
177
|
+
var listY = collider._worldPoints.map(function (_a) {
|
|
178
|
+
var y = _a.y;
|
|
179
|
+
return y;
|
|
180
|
+
});
|
|
181
|
+
collider._preAabb = cloneRect(collider._AABB);
|
|
182
|
+
collider._AABB.x = (0, min_1.default)(listX);
|
|
183
|
+
collider._AABB.y = (0, min_1.default)(listY);
|
|
184
|
+
collider._AABB.width = (0, max_1.default)(listX) - collider._AABB.x;
|
|
185
|
+
collider._AABB.height = (0, max_1.default)(listY) - collider._AABB.y;
|
|
186
|
+
// draw.drawRect(cc.p(this._AABB.x, this._AABB.y), cc.p(max(listX), max(listY)),
|
|
187
|
+
// cc.Color.WHITE, 3, cc.Color.DEBUG_BORDER_COLOR);
|
|
188
|
+
};
|
|
189
|
+
return PolygonCollider;
|
|
190
|
+
}(Collider));
|
|
191
|
+
exports.PolygonCollider = PolygonCollider;
|
|
192
|
+
var CollisionType;
|
|
193
|
+
(function (CollisionType) {
|
|
194
|
+
CollisionType[CollisionType["NONE"] = 0] = "NONE";
|
|
195
|
+
CollisionType[CollisionType["ENTER"] = 1] = "ENTER";
|
|
196
|
+
CollisionType[CollisionType["STAY"] = 2] = "STAY";
|
|
197
|
+
CollisionType[CollisionType["EXIT"] = 3] = "EXIT";
|
|
198
|
+
})(CollisionType || (exports.CollisionType = CollisionType = {}));
|
|
199
|
+
function isPolygonCollider(col) {
|
|
200
|
+
return col.getComponent(PolygonCollider) || col.getComponent(BoxCollider);
|
|
201
|
+
}
|
|
202
|
+
function isCircleCollider(col) {
|
|
203
|
+
return col.getComponent(CircleCollider);
|
|
204
|
+
}
|
|
205
|
+
var Contract = /** @class */ (function () {
|
|
206
|
+
function Contract(collider1, collider2) {
|
|
207
|
+
this._collider1 = collider1;
|
|
208
|
+
this._collider2 = collider2;
|
|
209
|
+
var isCollider1Polygon = isPolygonCollider(collider1);
|
|
210
|
+
var isCollider2Polygon = isPolygonCollider(collider2);
|
|
211
|
+
var isCollider1Circle = isCircleCollider(collider1);
|
|
212
|
+
var isCollider2Circle = isCircleCollider(collider2);
|
|
213
|
+
if (isCollider1Polygon && isCollider2Polygon) {
|
|
214
|
+
this._isPolygonPolygon = true;
|
|
215
|
+
}
|
|
216
|
+
else if (isCollider1Circle && isCollider2Circle) {
|
|
217
|
+
this._isCircleCircle = true;
|
|
218
|
+
}
|
|
219
|
+
else if (isCollider1Polygon && isCollider2Circle) {
|
|
220
|
+
this._isPolygonCircle = true;
|
|
221
|
+
}
|
|
222
|
+
else if (isCollider1Circle && isCollider2Polygon) {
|
|
223
|
+
this._isPolygonCircle = true;
|
|
224
|
+
this._collider1 = collider2;
|
|
225
|
+
this._collider2 = collider1;
|
|
226
|
+
}
|
|
227
|
+
// cc.log(this._isPolygonPolygon);
|
|
228
|
+
}
|
|
229
|
+
Contract.prototype.updateState = function () {
|
|
230
|
+
var result = this.test();
|
|
231
|
+
var type = CollisionType.NONE;
|
|
232
|
+
if (result && !this._touching) {
|
|
233
|
+
this._touching = true;
|
|
234
|
+
type = CollisionType.ENTER;
|
|
235
|
+
}
|
|
236
|
+
else if (result && this._touching) {
|
|
237
|
+
type = CollisionType.STAY;
|
|
238
|
+
}
|
|
239
|
+
else if (!result && this._touching) {
|
|
240
|
+
this._touching = false;
|
|
241
|
+
type = CollisionType.EXIT;
|
|
242
|
+
}
|
|
243
|
+
return type;
|
|
244
|
+
};
|
|
245
|
+
Contract.prototype.test = function () {
|
|
246
|
+
// if (!shouldCollider(this._collider1, this._collider2)) {
|
|
247
|
+
// return false;
|
|
248
|
+
// }
|
|
249
|
+
// cc.log(this._collider1.getAABB(), this._collider2.getAABB());
|
|
250
|
+
if (!cc.rectIntersectsRect(this._collider1.getAABB(), this._collider2.getAABB())) {
|
|
251
|
+
return false;
|
|
252
|
+
}
|
|
253
|
+
if (this._isPolygonPolygon) {
|
|
254
|
+
return cc.Intersection.polygonPolygon(this._collider1._worldPoints, this._collider2._worldPoints);
|
|
255
|
+
}
|
|
256
|
+
if (this._isCircleCircle) {
|
|
257
|
+
var p1 = this._collider1;
|
|
258
|
+
var p2 = this._collider2;
|
|
259
|
+
return cc.Intersection.circleCircle(p1._worldPosition, p1._worldRadius, p2._worldPosition, p2._worldRadius);
|
|
260
|
+
}
|
|
261
|
+
if (this._isPolygonCircle) {
|
|
262
|
+
var p2 = this._collider2;
|
|
263
|
+
return cc.Intersection.polygonCircle(this._collider1._worldPoints, p2._worldPosition, p2._worldRadius);
|
|
264
|
+
}
|
|
265
|
+
return false;
|
|
266
|
+
};
|
|
267
|
+
return Contract;
|
|
268
|
+
}());
|
|
269
|
+
exports.Contract = Contract;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Constructor } from 'entityx-ts';
|
|
2
|
+
import { BaseComponentProps } from '../../../@types/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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EnhancedComponent.d.ts","sourceRoot":"","sources":["../../../src/gworld/components/EnhancedComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAExC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,qBAAa,iBAAiB,CAAC,KAAK,GAAG,MAAM,EAAE,CAAC,SAAS,QAAQ,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC;IACpF,MAAM,CAAC,SAAS,UAAO;IACvB,KAAK,EAAE,KAAK,CAAY;IACxB,IAAI,EAAE,CAAC,CAAA;IACP,OAAO,EAAE,OAAO,CAAO;gBACX,IAAI,CAAC,EAAE,kBAAkB,CAAC,iBAAiB,CAAC,GAAG,KAAK;IAGhE,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK;IASjB,YAAY,CAAC,CAAC,SAAS,iBAAiB,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC;IAGzD,YAAY,CAAC,CAAC,SAAS,iBAAiB,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC;IAGvE,QAAQ,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,GAAE,MAAgC,EAAE,KAAK,SAAI;IAG5G,UAAU,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI;IAGvC,sBAAsB;IAGtB,YAAY,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM;IAGtE,uBAAuB,CAAC,CAAC,SAAS,aAAa,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE;IAGhF,sBAAsB,CAAC,CAAC,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"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EnhancedComponent = void 0;
|
|
4
|
+
var EnhancedComponent = /** @class */ (function () {
|
|
5
|
+
function EnhancedComponent(data) {
|
|
6
|
+
this.props = {};
|
|
7
|
+
this.enabled = true;
|
|
8
|
+
this.init(data);
|
|
9
|
+
}
|
|
10
|
+
EnhancedComponent.prototype.init = function (data) {
|
|
11
|
+
var _this = this;
|
|
12
|
+
if (data) {
|
|
13
|
+
// console.log('constructor', this.constructor.name, data)
|
|
14
|
+
Object.keys(data).forEach(function (key) {
|
|
15
|
+
_this.props[key] = data[key];
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
EnhancedComponent.prototype.addComponent = function (instance) {
|
|
20
|
+
return this.node.addComponent(instance);
|
|
21
|
+
};
|
|
22
|
+
EnhancedComponent.prototype.getComponent = function (component) {
|
|
23
|
+
return this.node.getComponent(component);
|
|
24
|
+
};
|
|
25
|
+
EnhancedComponent.prototype.schedule = function (callback, interval, repeat, delay) {
|
|
26
|
+
if (repeat === void 0) { repeat = cc.macro.REPEAT_FOREVER; }
|
|
27
|
+
if (delay === void 0) { delay = 0; }
|
|
28
|
+
this.node.instance.schedule(callback.bind(this), interval, repeat, delay);
|
|
29
|
+
};
|
|
30
|
+
EnhancedComponent.prototype.unschedule = function (callback) {
|
|
31
|
+
this.node.instance.unschedule(callback.bind(this));
|
|
32
|
+
};
|
|
33
|
+
EnhancedComponent.prototype.unscheduleAllCallbacks = function () {
|
|
34
|
+
this.node.instance.unscheduleAllCallbacks();
|
|
35
|
+
};
|
|
36
|
+
EnhancedComponent.prototype.scheduleOnce = function (callback, delay, key) {
|
|
37
|
+
this.node.instance.scheduleOnce(callback, delay, key);
|
|
38
|
+
};
|
|
39
|
+
EnhancedComponent.prototype.getComponentsInChildren = function (component) {
|
|
40
|
+
return this.node.getComponentsInChildren(component);
|
|
41
|
+
};
|
|
42
|
+
EnhancedComponent.prototype.getComponentInChildren = function (component) {
|
|
43
|
+
return this.node.getComponentInChildren(component);
|
|
44
|
+
};
|
|
45
|
+
EnhancedComponent.prototype.isEqual = function (other) {
|
|
46
|
+
return this.node.entity.id === other.node.entity.id;
|
|
47
|
+
};
|
|
48
|
+
EnhancedComponent.hasRender = true;
|
|
49
|
+
return EnhancedComponent;
|
|
50
|
+
}());
|
|
51
|
+
exports.EnhancedComponent = EnhancedComponent;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { BaseComponentProps, LabelCompProps, LabelOutlineCompProps, LabelShadowCompProps, ProgressTimerProps } from '../../../@types/safex';
|
|
2
|
+
import { Color4B, Size, Vec2 } from '../../polyfills';
|
|
3
|
+
import { ComponentX, NoRenderComponentX } from '../core/decorator';
|
|
4
|
+
export declare const FillType: {
|
|
5
|
+
HORIZONTAL: number;
|
|
6
|
+
VERTICAL: number;
|
|
7
|
+
RADIAL: number;
|
|
8
|
+
};
|
|
9
|
+
type Keys = keyof typeof FillType;
|
|
10
|
+
type Values = (typeof FillType)[Keys];
|
|
11
|
+
interface ButtonCompProps {
|
|
12
|
+
normalImage?: string;
|
|
13
|
+
selectedImage?: string;
|
|
14
|
+
disableImage?: string;
|
|
15
|
+
zoomScale?: number;
|
|
16
|
+
onPress?: (target: ButtonComp) => void;
|
|
17
|
+
}
|
|
18
|
+
export declare class ButtonComp extends NoRenderComponentX<ButtonCompProps> {
|
|
19
|
+
texType: ccui.Widget.TextureType;
|
|
20
|
+
clickEvents: any[];
|
|
21
|
+
setOnPress(cb: (target: ButtonComp) => void): void;
|
|
22
|
+
}
|
|
23
|
+
export declare class ProgressTimerComp extends ComponentX<ProgressTimerProps & BaseComponentProps<ProgressTimerComp>, cc.ProgressTimer & cc.Node> {
|
|
24
|
+
spriteFrame: string;
|
|
25
|
+
fillType: Values;
|
|
26
|
+
fillRange: number;
|
|
27
|
+
fillCenter: Vec2;
|
|
28
|
+
isReverse: boolean;
|
|
29
|
+
getFillRange(): number;
|
|
30
|
+
setFillStart(val: number): void;
|
|
31
|
+
setFillRange(val: number): void;
|
|
32
|
+
}
|
|
33
|
+
export declare class LabelComp extends ComponentX<LabelCompProps & BaseComponentProps<LabelComp>, ccui.Text> {
|
|
34
|
+
getString(): string;
|
|
35
|
+
setString(val: string): void;
|
|
36
|
+
}
|
|
37
|
+
export declare class RichTextComp extends ComponentX<LabelCompProps & BaseComponentProps<RichTextComp>, ccui.RichText> {
|
|
38
|
+
get string(): string;
|
|
39
|
+
set string(val: string);
|
|
40
|
+
}
|
|
41
|
+
export declare class LabelOutlineComp extends NoRenderComponentX<LabelOutlineCompProps> {
|
|
42
|
+
color: typeof Color4B;
|
|
43
|
+
width: Float;
|
|
44
|
+
}
|
|
45
|
+
export declare class LabelShadowComp extends NoRenderComponentX<LabelShadowCompProps> {
|
|
46
|
+
color: typeof Color4B;
|
|
47
|
+
blur: Float;
|
|
48
|
+
offset: Size;
|
|
49
|
+
}
|
|
50
|
+
export declare enum ScrollViewDirection {
|
|
51
|
+
NONE,
|
|
52
|
+
HORIZONTAL,
|
|
53
|
+
VERTICAL,
|
|
54
|
+
BOTH
|
|
55
|
+
}
|
|
56
|
+
interface ScrollViewProps {
|
|
57
|
+
viewSize: Size;
|
|
58
|
+
contentSize: Size;
|
|
59
|
+
direction?: ScrollViewDirection;
|
|
60
|
+
}
|
|
61
|
+
export declare class ScrollViewComp extends ComponentX<ScrollViewProps & BaseComponentProps<ScrollViewComp>, cc.ScrollView> {
|
|
62
|
+
zoom(scale: number): void;
|
|
63
|
+
}
|
|
64
|
+
export declare class BlockInputEventsComp extends NoRenderComponentX {
|
|
65
|
+
}
|
|
66
|
+
export {};
|
|
67
|
+
//# sourceMappingURL=GUIComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GUIComponent.d.ts","sourceRoot":"","sources":["../../../src/gworld/components/GUIComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAE3I,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACrD,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAElE,eAAO,MAAM,QAAQ;;;;CAIpB,CAAA;AACD,KAAK,IAAI,GAAG,MAAM,OAAO,QAAQ,CAAA;AACjC,KAAK,MAAM,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAA;AAGrC,UAAU,eAAe;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAA;CACvC;AACD,qBAAa,UAAW,SAAQ,kBAAkB,CAAC,eAAe,CAAC;IACjE,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,CAAA;IAChC,WAAW,QAAK;IAEhB,UAAU,CAAC,EAAE,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI;CAO5C;AAED,qBAAa,iBAAkB,SAAQ,UAAU,CAAC,kBAAkB,GAAG,kBAAkB,CAAC,iBAAiB,CAAC,EAAE,EAAE,CAAC,aAAa,GAAG,EAAE,CAAC,IAAI,CAAC;IACvI,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,IAAI,CAAA;IAChB,SAAS,EAAE,OAAO,CAAA;IAElB,YAAY;IAMZ,YAAY,CAAC,GAAG,EAAE,MAAM;IAMxB,YAAY,CAAC,GAAG,EAAE,MAAM;CAKzB;AAED,qBAAa,SAAU,SAAQ,UAAU,CAAC,cAAc,GAAG,kBAAkB,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC;IAKlG,SAAS;IAIT,SAAS,CAAC,GAAG,EAAE,MAAM;CAMtB;AAED,qBAAa,YAAa,SAAQ,UAAU,CAAC,cAAc,GAAG,kBAAkB,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC;IAC5G,IAAI,MAAM,IAIM,MAAM,CAFrB;IAED,IAAI,MAAM,CAAC,GAAG,EAAE,MAAM,EAoBrB;CACF;AAED,qBAAa,gBAAiB,SAAQ,kBAAkB,CAAC,qBAAqB,CAAC;IAC7E,KAAK,EAAE,OAAO,OAAO,CAAA;IACrB,KAAK,EAAE,KAAK,CAAA;CACb;AAED,qBAAa,eAAgB,SAAQ,kBAAkB,CAAC,oBAAoB,CAAC;IAC3E,KAAK,EAAE,OAAO,OAAO,CAAA;IACrB,IAAI,EAAE,KAAK,CAAA;IACX,MAAM,EAAE,IAAI,CAAA;CACb;AAED,oBAAY,mBAAmB;IAC7B,IAAmC;IACnC,UAA+C;IAC/C,QAA2C;IAC3C,IAAmC;CACpC;AACD,UAAU,eAAe;IACvB,QAAQ,EAAE,IAAI,CAAA;IACd,WAAW,EAAE,IAAI,CAAA;IACjB,SAAS,CAAC,EAAE,mBAAmB,CAAA;CAChC;AACD,qBAAa,cAAe,SAAQ,UAAU,CAAC,eAAe,GAAG,kBAAkB,CAAC,cAAc,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC;IACjH,IAAI,CAAC,KAAK,EAAE,MAAM;CAKnB;AAED,qBAAa,oBAAqB,SAAQ,kBAAkB;CAAI"}
|
|
@@ -0,0 +1,166 @@
|
|
|
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.BlockInputEventsComp = exports.ScrollViewComp = exports.ScrollViewDirection = exports.LabelShadowComp = exports.LabelOutlineComp = exports.RichTextComp = exports.LabelComp = exports.ProgressTimerComp = exports.ButtonComp = exports.FillType = void 0;
|
|
19
|
+
var html_text_parser_1 = require("../../helper/html-text-parser");
|
|
20
|
+
var polyfills_1 = require("../../polyfills");
|
|
21
|
+
var decorator_1 = require("../core/decorator");
|
|
22
|
+
exports.FillType = {
|
|
23
|
+
HORIZONTAL: 0,
|
|
24
|
+
VERTICAL: 1,
|
|
25
|
+
RADIAL: 2,
|
|
26
|
+
};
|
|
27
|
+
var _htmlTextParser = new html_text_parser_1.HtmlTextParser();
|
|
28
|
+
var ButtonComp = /** @class */ (function (_super) {
|
|
29
|
+
__extends(ButtonComp, _super);
|
|
30
|
+
function ButtonComp() {
|
|
31
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
32
|
+
_this.clickEvents = [];
|
|
33
|
+
return _this;
|
|
34
|
+
// setTouchEnabled(val) {
|
|
35
|
+
// this.node.setTouchEnabled(val)
|
|
36
|
+
// }
|
|
37
|
+
}
|
|
38
|
+
ButtonComp.prototype.setOnPress = function (cb) {
|
|
39
|
+
this.props.onPress = cb;
|
|
40
|
+
};
|
|
41
|
+
return ButtonComp;
|
|
42
|
+
}(decorator_1.NoRenderComponentX));
|
|
43
|
+
exports.ButtonComp = ButtonComp;
|
|
44
|
+
var ProgressTimerComp = /** @class */ (function (_super) {
|
|
45
|
+
__extends(ProgressTimerComp, _super);
|
|
46
|
+
function ProgressTimerComp() {
|
|
47
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
48
|
+
}
|
|
49
|
+
ProgressTimerComp.prototype.getFillRange = function () {
|
|
50
|
+
if (this.node.instance instanceof cc.ProgressTimer) {
|
|
51
|
+
return this.node.instance.getPercentage() * 0.01;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
ProgressTimerComp.prototype.setFillStart = function (val) {
|
|
55
|
+
if (this.node.instance instanceof cc.ProgressTimer) {
|
|
56
|
+
this.node.instance.setMidpoint((0, polyfills_1.Vec2)(val, val));
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
ProgressTimerComp.prototype.setFillRange = function (val) {
|
|
60
|
+
if (this.node.instance instanceof cc.ProgressTimer) {
|
|
61
|
+
this.node.instance.setPercentage(val * 100);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
return ProgressTimerComp;
|
|
65
|
+
}(decorator_1.ComponentX));
|
|
66
|
+
exports.ProgressTimerComp = ProgressTimerComp;
|
|
67
|
+
var LabelComp = /** @class */ (function (_super) {
|
|
68
|
+
__extends(LabelComp, _super);
|
|
69
|
+
function LabelComp() {
|
|
70
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
71
|
+
}
|
|
72
|
+
// protected font: string
|
|
73
|
+
// protected string: string
|
|
74
|
+
// protected size: number
|
|
75
|
+
LabelComp.prototype.getString = function () {
|
|
76
|
+
return this.props.string;
|
|
77
|
+
};
|
|
78
|
+
LabelComp.prototype.setString = function (val) {
|
|
79
|
+
this.props.string = val;
|
|
80
|
+
if (this.node.instance instanceof ccui.Text) {
|
|
81
|
+
this.node.instance.setString(val);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
return LabelComp;
|
|
85
|
+
}(decorator_1.ComponentX));
|
|
86
|
+
exports.LabelComp = LabelComp;
|
|
87
|
+
var RichTextComp = /** @class */ (function (_super) {
|
|
88
|
+
__extends(RichTextComp, _super);
|
|
89
|
+
function RichTextComp() {
|
|
90
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
91
|
+
}
|
|
92
|
+
Object.defineProperty(RichTextComp.prototype, "string", {
|
|
93
|
+
get: function () {
|
|
94
|
+
return this.props.string;
|
|
95
|
+
},
|
|
96
|
+
set: function (val) {
|
|
97
|
+
this.props.string = val;
|
|
98
|
+
if (this.node.instance instanceof ccui.RichText) {
|
|
99
|
+
var newTextArray = _htmlTextParser.parse(val);
|
|
100
|
+
console.log(newTextArray);
|
|
101
|
+
this.node.instance._richElements = [];
|
|
102
|
+
this.node.instance._formatTextDirty = true;
|
|
103
|
+
this.node.instance.formatText();
|
|
104
|
+
for (var index = 0; index < newTextArray.length; index++) {
|
|
105
|
+
var _a = newTextArray[index], style = _a.style, text = _a.text;
|
|
106
|
+
var color = style && style.color ? cc.hexToColor(style.color) : cc.Color.WHITE;
|
|
107
|
+
var fontName = cc.path.basename(this.props.font, '.ttf');
|
|
108
|
+
var richText = ccui.RichElementText.create(index, color, 255, text, fontName, this.props.size || 64);
|
|
109
|
+
// if (style && style.newline) {
|
|
110
|
+
// console.log('newline')
|
|
111
|
+
// this.node.instance._addNewLine()
|
|
112
|
+
// }
|
|
113
|
+
this.node.instance.pushBackElement(richText);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
enumerable: false,
|
|
118
|
+
configurable: true
|
|
119
|
+
});
|
|
120
|
+
return RichTextComp;
|
|
121
|
+
}(decorator_1.ComponentX));
|
|
122
|
+
exports.RichTextComp = RichTextComp;
|
|
123
|
+
var LabelOutlineComp = /** @class */ (function (_super) {
|
|
124
|
+
__extends(LabelOutlineComp, _super);
|
|
125
|
+
function LabelOutlineComp() {
|
|
126
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
127
|
+
}
|
|
128
|
+
return LabelOutlineComp;
|
|
129
|
+
}(decorator_1.NoRenderComponentX));
|
|
130
|
+
exports.LabelOutlineComp = LabelOutlineComp;
|
|
131
|
+
var LabelShadowComp = /** @class */ (function (_super) {
|
|
132
|
+
__extends(LabelShadowComp, _super);
|
|
133
|
+
function LabelShadowComp() {
|
|
134
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
135
|
+
}
|
|
136
|
+
return LabelShadowComp;
|
|
137
|
+
}(decorator_1.NoRenderComponentX));
|
|
138
|
+
exports.LabelShadowComp = LabelShadowComp;
|
|
139
|
+
var ScrollViewDirection;
|
|
140
|
+
(function (ScrollViewDirection) {
|
|
141
|
+
ScrollViewDirection[ScrollViewDirection["NONE"] = cc.SCROLLVIEW_DIRECTION_NONE] = "NONE";
|
|
142
|
+
ScrollViewDirection[ScrollViewDirection["HORIZONTAL"] = cc.SCROLLVIEW_DIRECTION_HORIZONTAL] = "HORIZONTAL";
|
|
143
|
+
ScrollViewDirection[ScrollViewDirection["VERTICAL"] = cc.SCROLLVIEW_DIRECTION_VERTICAL] = "VERTICAL";
|
|
144
|
+
ScrollViewDirection[ScrollViewDirection["BOTH"] = cc.SCROLLVIEW_DIRECTION_BOTH] = "BOTH";
|
|
145
|
+
})(ScrollViewDirection || (exports.ScrollViewDirection = ScrollViewDirection = {}));
|
|
146
|
+
var ScrollViewComp = /** @class */ (function (_super) {
|
|
147
|
+
__extends(ScrollViewComp, _super);
|
|
148
|
+
function ScrollViewComp() {
|
|
149
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
150
|
+
}
|
|
151
|
+
ScrollViewComp.prototype.zoom = function (scale) {
|
|
152
|
+
if (this.node.instance instanceof cc.ScrollView) {
|
|
153
|
+
this.node.instance.getContainer().setScale(scale);
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
return ScrollViewComp;
|
|
157
|
+
}(decorator_1.ComponentX));
|
|
158
|
+
exports.ScrollViewComp = ScrollViewComp;
|
|
159
|
+
var BlockInputEventsComp = /** @class */ (function (_super) {
|
|
160
|
+
__extends(BlockInputEventsComp, _super);
|
|
161
|
+
function BlockInputEventsComp() {
|
|
162
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
163
|
+
}
|
|
164
|
+
return BlockInputEventsComp;
|
|
165
|
+
}(decorator_1.NoRenderComponentX));
|
|
166
|
+
exports.BlockInputEventsComp = BlockInputEventsComp;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Touch } from '../../polyfills';
|
|
2
|
+
import { NoRenderComponentX } from '../core/decorator';
|
|
3
|
+
import { EventCallbackType, NodeComp } from './NodeComp';
|
|
4
|
+
type TouchEVentCallback = (touch?: Touch, node?: NodeComp) => void;
|
|
5
|
+
export interface EventMap {
|
|
6
|
+
[key: string]: [EventCallbackType];
|
|
7
|
+
}
|
|
8
|
+
export declare class EventRegister extends NoRenderComponentX {
|
|
9
|
+
events: EventMap;
|
|
10
|
+
on(name: string, callback: EventCallbackType, target?: any): void;
|
|
11
|
+
off(name: string, callback?: EventCallbackType, target?: any): any;
|
|
12
|
+
emit(name: string, ...params: any): void;
|
|
13
|
+
}
|
|
14
|
+
interface TouchEventProps {
|
|
15
|
+
onTouchStart?: TouchEVentCallback;
|
|
16
|
+
onTouchMove?: TouchEVentCallback;
|
|
17
|
+
onTouchEnd?: TouchEVentCallback;
|
|
18
|
+
onTouchCancel?: TouchEVentCallback;
|
|
19
|
+
}
|
|
20
|
+
export declare class TouchEventRegister extends NoRenderComponentX<TouchEventProps> {
|
|
21
|
+
listener: cc.EventListener;
|
|
22
|
+
touch: cc.Touch;
|
|
23
|
+
setEnabled(enabled: boolean): void;
|
|
24
|
+
}
|
|
25
|
+
interface ExtraDataProps {
|
|
26
|
+
key: string;
|
|
27
|
+
value: Integer | Float | string;
|
|
28
|
+
}
|
|
29
|
+
export declare class ExtraDataComp extends NoRenderComponentX<ExtraDataProps> {
|
|
30
|
+
data: {
|
|
31
|
+
[key: string]: any;
|
|
32
|
+
};
|
|
33
|
+
getData<T>(key: string): T;
|
|
34
|
+
setData<T>(key: string, val: T): void;
|
|
35
|
+
removeData(key: string): void;
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=NoRenderComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NoRenderComponent.d.ts","sourceRoot":"","sources":["../../../src/gworld/components/NoRenderComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AACtD,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAExD,KAAK,kBAAkB,GAAG,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,QAAQ,KAAK,IAAI,CAAA;AAElE,MAAM,WAAW,QAAQ;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,iBAAiB,CAAC,CAAA;CACnC;AAED,qBAAa,aAAc,SAAQ,kBAAkB;IACnD,MAAM,EAAE,QAAQ,CAAK;IAErB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,CAAC,EAAE,GAAG;IAS1D,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,iBAAiB,EAAE,MAAM,CAAC,EAAE,GAAG;IAK5D,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG;CAMlC;AAED,UAAU,eAAe;IACvB,YAAY,CAAC,EAAE,kBAAkB,CAAA;IACjC,WAAW,CAAC,EAAE,kBAAkB,CAAA;IAChC,UAAU,CAAC,EAAE,kBAAkB,CAAA;IAC/B,aAAa,CAAC,EAAE,kBAAkB,CAAA;CACnC;AACD,qBAAa,kBAAmB,SAAQ,kBAAkB,CAAC,eAAe,CAAC;IACzE,QAAQ,EAAE,EAAE,CAAC,aAAa,CAAA;IAC1B,KAAK,EAAE,EAAE,CAAC,KAAK,CAAA;IACf,UAAU,CAAC,OAAO,EAAE,OAAO;CAG5B;AAED,UAAU,cAAc;IACtB,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,OAAO,GAAG,KAAK,GAAG,MAAM,CAAA;CAChC;AACD,qBAAa,aAAc,SAAQ,kBAAkB,CAAC,cAAc,CAAC;IACnE,IAAI,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAK;IACjC,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC;IAG1B,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;IAG9B,UAAU,CAAC,GAAG,EAAE,MAAM;CAGvB"}
|