@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,354 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable no-var */
|
|
3
|
+
/* eslint-disable quotes */
|
|
4
|
+
/* eslint-disable no-useless-escape */
|
|
5
|
+
/* eslint-disable prettier/prettier */
|
|
6
|
+
/****************************************************************************
|
|
7
|
+
Copyright (c) 2013-2016 Chukong Technologies Inc.
|
|
8
|
+
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
|
9
|
+
|
|
10
|
+
https://www.cocos.com/
|
|
11
|
+
|
|
12
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
of this software and associated engine source code (the "Software"), a limited,
|
|
14
|
+
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
|
15
|
+
to use Cocos Creator solely to develop games on your target platforms. You shall
|
|
16
|
+
not use Cocos Creator software for developing other software or tools that's
|
|
17
|
+
used for developing games. You are not granted to publish, distribute,
|
|
18
|
+
sublicense, and/or sell copies of Cocos Creator.
|
|
19
|
+
|
|
20
|
+
The software or tools in this License Agreement are licensed, not sold.
|
|
21
|
+
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
|
22
|
+
|
|
23
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
24
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
25
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
26
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
27
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
28
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
29
|
+
THE SOFTWARE.
|
|
30
|
+
****************************************************************************/
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
exports.HtmlTextParser = void 0;
|
|
33
|
+
var eventRegx = /^(click)(\s)*=|(param)(\s)*=/;
|
|
34
|
+
var imageAttrReg = /(\s)*src(\s)*=|(\s)*height(\s)*=|(\s)*width(\s)*=|(\s)*align(\s)*=|(\s)*offset(\s)*=|(\s)*click(\s)*=|(\s)*param(\s)*=/;
|
|
35
|
+
/**
|
|
36
|
+
* A utils class for parsing HTML texts. The parsed results will be an object array.
|
|
37
|
+
*/
|
|
38
|
+
var HtmlTextParser = function () {
|
|
39
|
+
this._parsedObject = {};
|
|
40
|
+
this._specialSymbolArray = [];
|
|
41
|
+
this._specialSymbolArray.push([/</g, '<']);
|
|
42
|
+
this._specialSymbolArray.push([/>/g, '>']);
|
|
43
|
+
this._specialSymbolArray.push([/&/g, '&']);
|
|
44
|
+
this._specialSymbolArray.push([/"/g, '"']);
|
|
45
|
+
this._specialSymbolArray.push([/'/g, "'"]);
|
|
46
|
+
this._specialSymbolArray.push([/ /g, ' ']);
|
|
47
|
+
};
|
|
48
|
+
exports.HtmlTextParser = HtmlTextParser;
|
|
49
|
+
exports.HtmlTextParser.prototype = {
|
|
50
|
+
constructor: exports.HtmlTextParser,
|
|
51
|
+
parse: function (htmlString) {
|
|
52
|
+
this._resultObjectArray = [];
|
|
53
|
+
if (!htmlString) {
|
|
54
|
+
return this._resultObjectArray;
|
|
55
|
+
}
|
|
56
|
+
this._stack = [];
|
|
57
|
+
var startIndex = 0;
|
|
58
|
+
var length = htmlString.length;
|
|
59
|
+
while (startIndex < length) {
|
|
60
|
+
var tagEndIndex = htmlString.indexOf('>', startIndex);
|
|
61
|
+
var tagBeginIndex = -1;
|
|
62
|
+
if (tagEndIndex >= 0) {
|
|
63
|
+
tagBeginIndex = htmlString.lastIndexOf('<', tagEndIndex);
|
|
64
|
+
var noTagBegin = tagBeginIndex < startIndex - 1;
|
|
65
|
+
if (noTagBegin) {
|
|
66
|
+
tagBeginIndex = htmlString.indexOf('<', tagEndIndex + 1);
|
|
67
|
+
tagEndIndex = htmlString.indexOf('>', tagBeginIndex + 1);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (tagBeginIndex < 0) {
|
|
71
|
+
this._stack.pop();
|
|
72
|
+
this._processResult(htmlString.substring(startIndex));
|
|
73
|
+
startIndex = length;
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
var newStr = htmlString.substring(startIndex, tagBeginIndex);
|
|
77
|
+
var tagStr = htmlString.substring(tagBeginIndex + 1, tagEndIndex);
|
|
78
|
+
if (tagStr === '')
|
|
79
|
+
newStr = htmlString.substring(startIndex, tagEndIndex + 1);
|
|
80
|
+
this._processResult(newStr);
|
|
81
|
+
if (tagEndIndex === -1) {
|
|
82
|
+
// cc.error('The HTML tag is invalid!');
|
|
83
|
+
tagEndIndex = tagBeginIndex;
|
|
84
|
+
}
|
|
85
|
+
else if (htmlString.charAt(tagBeginIndex + 1) === '/') {
|
|
86
|
+
this._stack.pop();
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
this._addToStack(tagStr);
|
|
90
|
+
}
|
|
91
|
+
startIndex = tagEndIndex + 1;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return this._resultObjectArray;
|
|
95
|
+
},
|
|
96
|
+
_attributeToObject: function (attribute) {
|
|
97
|
+
attribute = attribute.trim();
|
|
98
|
+
var obj = {};
|
|
99
|
+
var header = attribute.match(/^(color|size)(\s)*=/);
|
|
100
|
+
var tagName;
|
|
101
|
+
var nextSpace;
|
|
102
|
+
var eventObj;
|
|
103
|
+
var eventHanlderString;
|
|
104
|
+
if (header) {
|
|
105
|
+
tagName = header[0];
|
|
106
|
+
attribute = attribute.substring(tagName.length).trim();
|
|
107
|
+
if (attribute === '')
|
|
108
|
+
return obj;
|
|
109
|
+
//parse color
|
|
110
|
+
nextSpace = attribute.indexOf(' ');
|
|
111
|
+
switch (tagName[0]) {
|
|
112
|
+
case 'c':
|
|
113
|
+
if (nextSpace > -1) {
|
|
114
|
+
obj.color = attribute.substring(0, nextSpace).trim();
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
obj.color = attribute;
|
|
118
|
+
}
|
|
119
|
+
break;
|
|
120
|
+
case 's':
|
|
121
|
+
obj.size = parseInt(attribute);
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
//tag has event arguments
|
|
125
|
+
if (nextSpace > -1) {
|
|
126
|
+
eventHanlderString = attribute.substring(nextSpace + 1).trim();
|
|
127
|
+
eventObj = this._processEventHandler(eventHanlderString);
|
|
128
|
+
obj.event = eventObj;
|
|
129
|
+
}
|
|
130
|
+
return obj;
|
|
131
|
+
}
|
|
132
|
+
header = attribute.match(/^(br(\s)*\/)/);
|
|
133
|
+
if (header && header[0].length > 0) {
|
|
134
|
+
tagName = header[0].trim();
|
|
135
|
+
if (tagName.startsWith('br') && tagName[tagName.length - 1] === '/') {
|
|
136
|
+
obj.isNewLine = true;
|
|
137
|
+
this._resultObjectArray.push({ text: '', style: { newline: true } });
|
|
138
|
+
return obj;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
header = attribute.match(/^(img(\s)*src(\s)*=[^>]+\/)/);
|
|
142
|
+
if (header && header[0].length > 0) {
|
|
143
|
+
tagName = header[0].trim();
|
|
144
|
+
if (tagName.startsWith('img') && tagName[tagName.length - 1] === '/') {
|
|
145
|
+
header = attribute.match(imageAttrReg);
|
|
146
|
+
var tagValue;
|
|
147
|
+
var remainingArgument;
|
|
148
|
+
var isValidImageTag = false;
|
|
149
|
+
while (header) {
|
|
150
|
+
//skip the invalid tags at first
|
|
151
|
+
attribute = attribute.substring(attribute.indexOf(header[0]));
|
|
152
|
+
tagName = attribute.substr(0, header[0].length);
|
|
153
|
+
//remove space and = character
|
|
154
|
+
remainingArgument = attribute.substring(tagName.length).trim();
|
|
155
|
+
nextSpace = remainingArgument.indexOf(' ');
|
|
156
|
+
tagValue = nextSpace > -1 ? remainingArgument.substr(0, nextSpace) : remainingArgument;
|
|
157
|
+
tagName = tagName.replace(/[^a-zA-Z]/g, '').trim();
|
|
158
|
+
tagName = tagName.toLocaleLowerCase();
|
|
159
|
+
attribute = remainingArgument.substring(nextSpace).trim();
|
|
160
|
+
if (tagValue.endsWith('/'))
|
|
161
|
+
tagValue = tagValue.slice(0, -1);
|
|
162
|
+
if (tagName === 'src') {
|
|
163
|
+
switch (tagValue.charCodeAt(0)) {
|
|
164
|
+
case 34: // "
|
|
165
|
+
case 39: // '
|
|
166
|
+
isValidImageTag = true;
|
|
167
|
+
tagValue = tagValue.slice(1, -1);
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
obj.isImage = true;
|
|
171
|
+
obj.src = tagValue;
|
|
172
|
+
}
|
|
173
|
+
else if (tagName === 'height') {
|
|
174
|
+
obj.imageHeight = parseInt(tagValue);
|
|
175
|
+
}
|
|
176
|
+
else if (tagName === 'width') {
|
|
177
|
+
obj.imageWidth = parseInt(tagValue);
|
|
178
|
+
}
|
|
179
|
+
else if (tagName === 'align') {
|
|
180
|
+
switch (tagValue.charCodeAt(0)) {
|
|
181
|
+
case 34: // "
|
|
182
|
+
case 39: // '
|
|
183
|
+
tagValue = tagValue.slice(1, -1);
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
obj.imageAlign = tagValue.toLocaleLowerCase();
|
|
187
|
+
}
|
|
188
|
+
else if (tagName === 'offset') {
|
|
189
|
+
obj.imageOffset = tagValue;
|
|
190
|
+
}
|
|
191
|
+
else if (tagName === 'click') {
|
|
192
|
+
obj.event = this._processEventHandler("".concat(tagName, "=").concat(tagValue));
|
|
193
|
+
}
|
|
194
|
+
if (obj.event && tagName === 'param') {
|
|
195
|
+
obj.event.param = tagValue.replace(/^\"|\"$/g, '');
|
|
196
|
+
}
|
|
197
|
+
header = attribute.match(imageAttrReg);
|
|
198
|
+
}
|
|
199
|
+
if (isValidImageTag && obj.isImage) {
|
|
200
|
+
this._resultObjectArray.push({ text: '', style: obj });
|
|
201
|
+
}
|
|
202
|
+
return {};
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
header = attribute.match(/^(outline(\s)*[^>]*)/);
|
|
206
|
+
if (header) {
|
|
207
|
+
attribute = header[0].substring('outline'.length).trim();
|
|
208
|
+
var defaultOutlineObject = { color: '#ffffff', width: 1 };
|
|
209
|
+
if (attribute) {
|
|
210
|
+
var outlineAttrReg = /(\s)*color(\s)*=|(\s)*width(\s)*=|(\s)*click(\s)*=|(\s)*param(\s)*=/;
|
|
211
|
+
header = attribute.match(outlineAttrReg);
|
|
212
|
+
var tagValue;
|
|
213
|
+
while (header) {
|
|
214
|
+
//skip the invalid tags at first
|
|
215
|
+
attribute = attribute.substring(attribute.indexOf(header[0]));
|
|
216
|
+
tagName = attribute.substr(0, header[0].length);
|
|
217
|
+
//remove space and = character
|
|
218
|
+
remainingArgument = attribute.substring(tagName.length).trim();
|
|
219
|
+
nextSpace = remainingArgument.indexOf(' ');
|
|
220
|
+
if (nextSpace > -1) {
|
|
221
|
+
tagValue = remainingArgument.substr(0, nextSpace);
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
tagValue = remainingArgument;
|
|
225
|
+
}
|
|
226
|
+
tagName = tagName.replace(/[^a-zA-Z]/g, '').trim();
|
|
227
|
+
tagName = tagName.toLocaleLowerCase();
|
|
228
|
+
attribute = remainingArgument.substring(nextSpace).trim();
|
|
229
|
+
if (tagName === 'click') {
|
|
230
|
+
obj.event = this._processEventHandler("".concat(tagName, "=").concat(tagValue));
|
|
231
|
+
}
|
|
232
|
+
else if (tagName === 'color') {
|
|
233
|
+
defaultOutlineObject.color = tagValue;
|
|
234
|
+
}
|
|
235
|
+
else if (tagName === 'width') {
|
|
236
|
+
defaultOutlineObject.width = parseInt(tagValue);
|
|
237
|
+
}
|
|
238
|
+
if (obj.event && tagName === 'param') {
|
|
239
|
+
obj.event.param = tagValue.replace(/^\"|\"$/g, '');
|
|
240
|
+
}
|
|
241
|
+
header = attribute.match(outlineAttrReg);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
obj.outline = defaultOutlineObject;
|
|
245
|
+
}
|
|
246
|
+
header = attribute.match(/^(on|u|b|i)(\s)*/);
|
|
247
|
+
if (header && header[0].length > 0) {
|
|
248
|
+
tagName = header[0];
|
|
249
|
+
attribute = attribute.substring(tagName.length).trim();
|
|
250
|
+
switch (tagName[0]) {
|
|
251
|
+
case 'u':
|
|
252
|
+
obj.underline = true;
|
|
253
|
+
break;
|
|
254
|
+
case 'i':
|
|
255
|
+
obj.italic = true;
|
|
256
|
+
break;
|
|
257
|
+
case 'b':
|
|
258
|
+
obj.bold = true;
|
|
259
|
+
break;
|
|
260
|
+
}
|
|
261
|
+
if (attribute === '') {
|
|
262
|
+
return obj;
|
|
263
|
+
}
|
|
264
|
+
eventObj = this._processEventHandler(attribute);
|
|
265
|
+
obj.event = eventObj;
|
|
266
|
+
}
|
|
267
|
+
return obj;
|
|
268
|
+
},
|
|
269
|
+
_processEventHandler: function (eventString) {
|
|
270
|
+
var index = 0;
|
|
271
|
+
var obj = {};
|
|
272
|
+
var eventNames = eventString.match(eventRegx);
|
|
273
|
+
var isValidTag = false;
|
|
274
|
+
while (eventNames) {
|
|
275
|
+
var eventName = eventNames[0];
|
|
276
|
+
var eventValue = '';
|
|
277
|
+
isValidTag = false;
|
|
278
|
+
eventString = eventString.substring(eventName.length).trim();
|
|
279
|
+
if (eventString.charAt(0) === '"') {
|
|
280
|
+
index = eventString.indexOf('"', 1);
|
|
281
|
+
if (index > -1) {
|
|
282
|
+
eventValue = eventString.substring(1, index).trim();
|
|
283
|
+
isValidTag = true;
|
|
284
|
+
}
|
|
285
|
+
index++;
|
|
286
|
+
}
|
|
287
|
+
else if (eventString.charAt(0) === '\'') {
|
|
288
|
+
index = eventString.indexOf('\'', 1);
|
|
289
|
+
if (index > -1) {
|
|
290
|
+
eventValue = eventString.substring(1, index).trim();
|
|
291
|
+
isValidTag = true;
|
|
292
|
+
}
|
|
293
|
+
index++;
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
//skip the invalid attribute value
|
|
297
|
+
var match = eventString.match(/(\S)+/);
|
|
298
|
+
if (match) {
|
|
299
|
+
eventValue = match[0];
|
|
300
|
+
}
|
|
301
|
+
else {
|
|
302
|
+
eventValue = '';
|
|
303
|
+
}
|
|
304
|
+
index = eventValue.length;
|
|
305
|
+
}
|
|
306
|
+
if (isValidTag) {
|
|
307
|
+
eventName = eventName.substring(0, eventName.length - 1).trim();
|
|
308
|
+
obj[eventName] = eventValue;
|
|
309
|
+
}
|
|
310
|
+
eventString = eventString.substring(index).trim();
|
|
311
|
+
eventNames = eventString.match(eventRegx);
|
|
312
|
+
}
|
|
313
|
+
return obj;
|
|
314
|
+
},
|
|
315
|
+
_addToStack: function (attribute) {
|
|
316
|
+
var obj = this._attributeToObject(attribute);
|
|
317
|
+
if (this._stack.length === 0) {
|
|
318
|
+
this._stack.push(obj);
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
if (obj.isNewLine || obj.isImage) {
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
//for nested tags
|
|
325
|
+
var previousTagObj = this._stack[this._stack.length - 1];
|
|
326
|
+
for (var key in previousTagObj) {
|
|
327
|
+
if (!obj[key]) {
|
|
328
|
+
obj[key] = previousTagObj[key];
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
this._stack.push(obj);
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
_processResult: function (value) {
|
|
335
|
+
if (value === '') {
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
value = this._escapeSpecialSymbol(value);
|
|
339
|
+
if (this._stack.length > 0) {
|
|
340
|
+
this._resultObjectArray.push({ text: value, style: this._stack[this._stack.length - 1] });
|
|
341
|
+
}
|
|
342
|
+
else {
|
|
343
|
+
this._resultObjectArray.push({ text: value });
|
|
344
|
+
}
|
|
345
|
+
},
|
|
346
|
+
_escapeSpecialSymbol: function (str) {
|
|
347
|
+
for (var i = 0; i < this._specialSymbolArray.length; ++i) {
|
|
348
|
+
var key = this._specialSymbolArray[i][0];
|
|
349
|
+
var value = this._specialSymbolArray[i][1];
|
|
350
|
+
str = str.replace(key, value);
|
|
351
|
+
}
|
|
352
|
+
return str;
|
|
353
|
+
},
|
|
354
|
+
};
|
|
@@ -1,189 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
Copyright (c) 2011-2012 cocos2d-x.org
|
|
3
|
-
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
|
4
|
-
Copyright (c) 2014 Shengxiang Chen (Nero Chan)
|
|
5
|
-
|
|
6
|
-
http://www.cocos2d-x.org
|
|
7
|
-
|
|
8
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
10
|
-
in the Software without restriction, including without limitation the rights
|
|
11
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
13
|
-
furnished to do so, subject to the following conditions:
|
|
14
|
-
|
|
15
|
-
The above copyright notice and this permission notice shall be included in
|
|
16
|
-
all copies or substantial portions of the Software.
|
|
17
|
-
|
|
18
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
24
|
-
THE SOFTWARE.
|
|
25
|
-
****************************************************************************/
|
|
26
|
-
/**
|
|
27
|
-
* The main namespace of Spine, all classes, functions, properties and constants of Spine are defined in this namespace
|
|
28
|
-
* @namespace
|
|
29
|
-
* @name
|
|
30
|
-
*/
|
|
31
|
-
/**
|
|
32
|
-
* <p>
|
|
33
|
-
* The skeleton of Spine. <br/>
|
|
34
|
-
* Skeleton has a reference to a SkeletonData and stores the state for skeleton instance,
|
|
35
|
-
* which consists of the current pose's bone SRT, slot colors, and which slot attachments are visible. <br/>
|
|
36
|
-
* Multiple skeletons can use the same SkeletonData (which includes all animations, skins, and attachments). <br/>
|
|
37
|
-
* </p>
|
|
38
|
-
* @class
|
|
39
|
-
* @extends cc.Node
|
|
40
|
-
*/
|
|
41
|
-
export declare class Skeleton extends cc.Node {
|
|
42
|
-
_skeleton: any;
|
|
43
|
-
_rootBone: any;
|
|
44
|
-
_timeScale: number;
|
|
45
|
-
_debugSlots: boolean;
|
|
46
|
-
_debugBones: boolean;
|
|
47
|
-
_premultipliedAlpha: any;
|
|
48
|
-
_ownsSkeletonData: any;
|
|
49
|
-
_atlas: any;
|
|
50
|
-
constructor(skeletonDataFile?: string, atlasFile?: string, scale?: number);
|
|
51
|
-
_createRenderCmd(): any;
|
|
52
|
-
onEnter(): void;
|
|
53
|
-
onExit(): void;
|
|
54
|
-
/**
|
|
55
|
-
* Sets whether open debug slots.
|
|
56
|
-
* @param {boolean} enable true to open, false to close.
|
|
57
|
-
*/
|
|
58
|
-
setDebugSolots(enable: boolean): void;
|
|
59
|
-
/**
|
|
60
|
-
* Sets whether open debug bones.
|
|
61
|
-
* @param {boolean} enable
|
|
62
|
-
*/
|
|
63
|
-
setDebugBones(enable: boolean): void;
|
|
64
|
-
/**
|
|
65
|
-
* Sets whether open debug slots.
|
|
66
|
-
* @param {boolean} enabled true to open, false to close.
|
|
67
|
-
*/
|
|
68
|
-
setDebugSlotsEnabled(enabled: boolean): void;
|
|
69
|
-
/**
|
|
70
|
-
* Gets whether open debug slots.
|
|
71
|
-
* @returns {boolean} true to open, false to close.
|
|
72
|
-
*/
|
|
73
|
-
getDebugSlotsEnabled(): boolean;
|
|
74
|
-
/**
|
|
75
|
-
* Sets whether open debug bones.
|
|
76
|
-
* @param {boolean} enabled
|
|
77
|
-
*/
|
|
78
|
-
setDebugBonesEnabled(enabled: boolean): void;
|
|
79
|
-
/**
|
|
80
|
-
* Gets whether open debug bones.
|
|
81
|
-
* @returns {boolean} true to open, false to close.
|
|
82
|
-
*/
|
|
83
|
-
getDebugBonesEnabled(): boolean;
|
|
84
|
-
/**
|
|
85
|
-
* Sets the time scale of Skeleton.
|
|
86
|
-
* @param {Number} scale
|
|
87
|
-
*/
|
|
88
|
-
setTimeScale(scale: number): void;
|
|
89
|
-
getTimeScale(): number;
|
|
90
|
-
/**
|
|
91
|
-
* Initializes Skeleton with Data.
|
|
92
|
-
* @param {.spine.SkeletonData|String} skeletonDataFile
|
|
93
|
-
* @param {String|spine.Atlas|spine.SkeletonData} atlasFile atlas filename or atlas data or owns SkeletonData
|
|
94
|
-
* @param {Number} [scale] scale can be specified on the JSON or binary loader which will scale the bone positions, image sizes, and animation translations.
|
|
95
|
-
*/
|
|
96
|
-
initWithArgs(skeletonDataFile: string, atlasFile: string, scale?: number): void;
|
|
97
|
-
/**
|
|
98
|
-
* Returns the bounding box of Skeleton.
|
|
99
|
-
* @returns {cc.Rect}
|
|
100
|
-
*/
|
|
101
|
-
getBoundingBox(): cc.Rect;
|
|
102
|
-
/**
|
|
103
|
-
* Computes the world SRT from the local SRT for each bone.
|
|
104
|
-
*/
|
|
105
|
-
updateWorldTransform(): void;
|
|
106
|
-
/**
|
|
107
|
-
* Sets the bones and slots to the setup pose.
|
|
108
|
-
*/
|
|
109
|
-
setToSetupPose(): void;
|
|
110
|
-
/**
|
|
111
|
-
* Sets the bones to the setup pose, using the values from the `BoneData` list in the `SkeletonData`.
|
|
112
|
-
*/
|
|
113
|
-
setBonesToSetupPose(): void;
|
|
114
|
-
/**
|
|
115
|
-
* Sets the slots to the setup pose, using the values from the `SlotData` list in the `SkeletonData`.
|
|
116
|
-
*/
|
|
117
|
-
setSlotsToSetupPose(): void;
|
|
118
|
-
/**
|
|
119
|
-
* Finds a bone by name. This does a string comparison for every bone.
|
|
120
|
-
* @param {String} boneName
|
|
121
|
-
* @returns {.spine.Bone}
|
|
122
|
-
*/
|
|
123
|
-
findBone(boneName: string): any;
|
|
124
|
-
/**
|
|
125
|
-
* Finds a slot by name. This does a string comparison for every slot.
|
|
126
|
-
* @param {String} slotName
|
|
127
|
-
* @returns {.spine.Slot}
|
|
128
|
-
*/
|
|
129
|
-
findSlot(slotName: string): any;
|
|
130
|
-
/**
|
|
131
|
-
* Finds a skin by name and makes it the active skin. This does a string comparison for every skin. Note that setting the skin does not change which attachments are visible.
|
|
132
|
-
* @param {string} skinName
|
|
133
|
-
* @returns {.spine.Skin}
|
|
134
|
-
*/
|
|
135
|
-
setSkin(skinName: string): any;
|
|
136
|
-
/**
|
|
137
|
-
* Returns the attachment for the slot and attachment name. The skeleton looks first in its skin, then in the skeleton data’s default skin.
|
|
138
|
-
* @param {String} slotName
|
|
139
|
-
* @param {String} attachmentName
|
|
140
|
-
* @returns {.spine.Attachment}
|
|
141
|
-
*/
|
|
142
|
-
getAttachment(slotName: string, attachmentName: string): any;
|
|
143
|
-
/**
|
|
144
|
-
* Sets the attachment for the slot and attachment name. The skeleton looks first in its skin, then in the skeleton data’s default skin.
|
|
145
|
-
* @param {String} slotName
|
|
146
|
-
* @param {String} attachmentName
|
|
147
|
-
*/
|
|
148
|
-
setAttachment(slotName: string, attachmentName: string): void;
|
|
149
|
-
/**
|
|
150
|
-
* Sets the premultiplied alpha value to Skeleton.
|
|
151
|
-
* @param {Number} alpha
|
|
152
|
-
*/
|
|
153
|
-
setPremultipliedAlpha(premultiplied: boolean): void;
|
|
154
|
-
/**
|
|
155
|
-
* Returns whether to enable premultiplied alpha.
|
|
156
|
-
* @returns {boolean}
|
|
157
|
-
*/
|
|
158
|
-
isPremultipliedAlpha(): boolean;
|
|
159
|
-
/**
|
|
160
|
-
* Sets skeleton data to Skeleton.
|
|
161
|
-
* @param {.spine.SkeletonData} skeletonData
|
|
162
|
-
* @param {.spine.SkeletonData} ownsSkeletonData
|
|
163
|
-
*/
|
|
164
|
-
setSkeletonData(skeletonData: any, ownsSkeletonData: any): void;
|
|
165
|
-
/**
|
|
166
|
-
* Return the renderer of attachment.
|
|
167
|
-
* @param {.spine.RegionAttachment|.spine.BoundingBoxAttachment} regionAttachment
|
|
168
|
-
* @returns {.spine.TextureAtlasRegion}
|
|
169
|
-
*/
|
|
170
|
-
getTextureAtlas(regionAttachment: any): any;
|
|
171
|
-
/**
|
|
172
|
-
* Returns the blendFunc of Skeleton.
|
|
173
|
-
* @returns {cc.BlendFunc}
|
|
174
|
-
*/
|
|
175
|
-
getBlendFunc(): any;
|
|
176
|
-
/**
|
|
177
|
-
* Sets the blendFunc of Skeleton, it won't have any effect for skeleton, skeleton is using slot's data to determine the blend function.
|
|
178
|
-
* @param {cc.BlendFunc|Number} src
|
|
179
|
-
* @param {Number} [dst]
|
|
180
|
-
*/
|
|
181
|
-
setBlendFunc(src: any, dst?: any): any;
|
|
182
|
-
/**
|
|
183
|
-
* Update will be called automatically every frame if "scheduleUpdate" is called when the node is "live".
|
|
184
|
-
* @param {Number} dt Delta time since last update
|
|
185
|
-
*/
|
|
186
|
-
update(dt: number): void;
|
|
187
|
-
static create(skeletonDataFile: string, atlasFile: string, scale?: number): Skeleton;
|
|
188
|
-
}
|
|
1
|
+
export declare const Skeleton: any;
|
|
189
2
|
//# sourceMappingURL=CCSkeleton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CCSkeleton.d.ts","sourceRoot":"","sources":["../../src/spine/CCSkeleton.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CCSkeleton.d.ts","sourceRoot":"","sources":["../../src/spine/CCSkeleton.ts"],"names":[],"mappings":"AAkaA,eAAO,MAAM,QAAQ,KAAkB,CAAA"}
|