cocos2d-cli 1.6.5 → 2.0.0

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.
Files changed (61) hide show
  1. package/dist/bin/cocos2d-cli.js +64 -0
  2. package/dist/src/commands/add-component.js +3 -0
  3. package/dist/src/commands/add.js +3 -0
  4. package/dist/src/commands/build.js +6 -0
  5. package/dist/src/commands/create-scene.js +3 -0
  6. package/dist/src/commands/get.js +3 -0
  7. package/dist/src/commands/prefab-create.js +109 -0
  8. package/dist/src/commands/remove-component.js +3 -0
  9. package/dist/src/commands/remove.js +3 -0
  10. package/dist/src/commands/screenshot.js +41 -0
  11. package/dist/src/commands/set-component.js +3 -0
  12. package/dist/src/commands/set.js +3 -0
  13. package/dist/src/commands/tree.js +24 -0
  14. package/{src → dist/src}/lib/cc/CCButton.js +115 -122
  15. package/{src → dist/src}/lib/cc/CCCamera.js +83 -93
  16. package/{src → dist/src}/lib/cc/CCCanvas.js +49 -54
  17. package/{src → dist/src}/lib/cc/CCColor.js +30 -32
  18. package/{src → dist/src}/lib/cc/CCComponent.js +39 -60
  19. package/{src → dist/src}/lib/cc/CCLabel.js +139 -146
  20. package/{src → dist/src}/lib/cc/CCNode.js +190 -256
  21. package/{src → dist/src}/lib/cc/CCObject.js +19 -23
  22. package/{src → dist/src}/lib/cc/CCPrefab.js +219 -242
  23. package/{src → dist/src}/lib/cc/CCRect.js +30 -32
  24. package/{src → dist/src}/lib/cc/CCRichText.js +38 -44
  25. package/{src → dist/src}/lib/cc/CCScene.js +32 -42
  26. package/dist/src/lib/cc/CCSceneAsset.js +242 -0
  27. package/{src → dist/src}/lib/cc/CCSize.js +22 -26
  28. package/{src → dist/src}/lib/cc/CCSprite.js +82 -94
  29. package/{src → dist/src}/lib/cc/CCTrs.js +49 -74
  30. package/{src → dist/src}/lib/cc/CCVec2.js +22 -26
  31. package/{src → dist/src}/lib/cc/CCVec3.js +26 -29
  32. package/{src → dist/src}/lib/cc/CCWidget.js +94 -98
  33. package/dist/src/lib/fire-utils.js +86 -0
  34. package/dist/src/lib/json-parser.js +114 -0
  35. package/dist/src/lib/node-utils.js +131 -0
  36. package/{src → dist/src}/lib/screenshot-core.js +221 -285
  37. package/dist/src/lib/templates.js +17 -0
  38. package/dist/src/lib/utils.js +81 -0
  39. package/package.json +13 -6
  40. package/bin/cocos2d-cli.js +0 -152
  41. package/src/commands/add-component.js +0 -112
  42. package/src/commands/add.js +0 -177
  43. package/src/commands/build.js +0 -78
  44. package/src/commands/create-scene.js +0 -181
  45. package/src/commands/get.js +0 -108
  46. package/src/commands/prefab-create.js +0 -111
  47. package/src/commands/remove-component.js +0 -111
  48. package/src/commands/remove.js +0 -99
  49. package/src/commands/screenshot.js +0 -108
  50. package/src/commands/set-component.js +0 -119
  51. package/src/commands/set.js +0 -107
  52. package/src/commands/tree.js +0 -29
  53. package/src/lib/cc/CCSceneAsset.js +0 -303
  54. package/src/lib/cc/index.js +0 -42
  55. package/src/lib/fire-utils.js +0 -374
  56. package/src/lib/json-parser.js +0 -185
  57. package/src/lib/node-utils.js +0 -395
  58. package/src/lib/screenshot/favicon.ico +0 -0
  59. package/src/lib/screenshot/index.html +0 -30
  60. package/src/lib/templates.js +0 -49
  61. package/src/lib/utils.js +0 -202
@@ -1,242 +1,219 @@
1
- const CCObject = require('./CCObject');
2
- const { generateFileId } = require('../fire-utils');
3
-
4
- /**
5
- * Cocos Creator 预制体类(只是元数据头,不管理节点树)
6
- */
7
- class CCPrefab extends CCObject {
8
- constructor() {
9
- super('');
10
- this.__type__ = 'cc.Prefab';
11
-
12
- this._native = '';
13
- this._root = null; // 根节点引用
14
- this.optimizationPolicy = 0;
15
- this.asyncLoadAssets = false;
16
- this.readonly = false;
17
- }
18
-
19
- setRoot(node) {
20
- this._root = node;
21
- return this;
22
- }
23
-
24
- /**
25
- * JSON 解析
26
- */
27
- static fromJSON(json) {
28
- const prefab = new CCPrefab();
29
- const objects = [];
30
-
31
- // 第一遍:创建所有对象
32
- json.forEach((item, index) => {
33
- objects[index] = createObject(item);
34
- });
35
-
36
- // 第二遍:建立引用关系
37
- json.forEach((item, index) => {
38
- setupReferences(objects[index], item, objects);
39
- });
40
-
41
- prefab._root = objects[1];
42
- return prefab;
43
- }
44
-
45
- /**
46
- * 序列化为 JSON
47
- * 顺序:Prefab头 → 节点树(节点 → 子节点们+PrefabInfo → 组件 → PrefabInfo) → 根PrefabInfo
48
- */
49
- toJSON() {
50
- const result = [];
51
- const indexMap = new Map();
52
-
53
- // 0: Prefab 头
54
- indexMap.set(this, 0);
55
- result.push({
56
- __type__: 'cc.Prefab',
57
- _name: '',
58
- _objFlags: 0,
59
- _native: '',
60
- data: null, // 后面填充
61
- optimizationPolicy: this.optimizationPolicy,
62
- asyncLoadAssets: this.asyncLoadAssets,
63
- readonly: this.readonly
64
- });
65
-
66
- // 递归处理节点
67
- const processNode = (node, isRoot = false) => {
68
- if (!node) return;
69
-
70
- // 添加节点
71
- indexMap.set(node, result.length);
72
- result.push(null); // 占位
73
-
74
- // 递归处理子节点(每个子节点处理完会带上它的 PrefabInfo)
75
- if (node._children) {
76
- node._children.forEach(child => processNode(child, false));
77
- }
78
-
79
- // 添加组件
80
- if (node._components) {
81
- node._components.forEach(comp => {
82
- indexMap.set(comp, result.length);
83
- result.push(componentToJSON(comp, indexMap));
84
- });
85
- }
86
-
87
- // 生成节点 JSON
88
- result[indexMap.get(node)] = {
89
- __type__: 'cc.Node',
90
- _name: node._name,
91
- _objFlags: node._objFlags,
92
- _parent: node._parent ? { __id__: indexMap.get(node._parent) } : null,
93
- _children: (node._children || []).map(c => ({ __id__: indexMap.get(c) })),
94
- _active: node._active,
95
- _components: (node._components || []).map(c => ({ __id__: indexMap.get(c) })),
96
- _prefab: null, // 后面填充
97
- _opacity: node._opacity,
98
- _color: node._color.toJSON(),
99
- _contentSize: node._contentSize.toJSON(),
100
- _anchorPoint: node._anchorPoint.toJSON(),
101
- _trs: node._trs.toJSON(),
102
- _eulerAngles: node._eulerAngles.toJSON(),
103
- _skewX: node._skewX,
104
- _skewY: node._skewY,
105
- _is3DNode: node._is3DNode,
106
- _groupIndex: node._groupIndex,
107
- groupIndex: node.groupIndex,
108
- _id: node._id || ''
109
- };
110
-
111
- // 非根节点:立即添加 PrefabInfo
112
- if (!isRoot) {
113
- const infoIdx = result.length;
114
- result.push({
115
- __type__: 'cc.PrefabInfo',
116
- root: { __id__: indexMap.get(this._root) },
117
- asset: { __id__: 0 },
118
- fileId: generateFileId(),
119
- sync: false
120
- });
121
- result[indexMap.get(node)]._prefab = { __id__: infoIdx };
122
- }
123
- };
124
-
125
- // 处理根节点
126
- processNode(this._root, true);
127
-
128
- // 填充 Prefab 头的 data
129
- result[0].data = { __id__: indexMap.get(this._root) };
130
-
131
- // 最后添加根节点的 PrefabInfo
132
- if (this._root) {
133
- const infoIdx = result.length;
134
- result.push({
135
- __type__: 'cc.PrefabInfo',
136
- root: { __id__: indexMap.get(this._root) },
137
- asset: { __id__: 0 },
138
- fileId: '',
139
- sync: false
140
- });
141
- result[indexMap.get(this._root)]._prefab = { __id__: infoIdx };
142
- }
143
-
144
- return result;
145
- }
146
- }
147
-
148
- function componentToJSON(comp, indexMap) {
149
- const json = {
150
- __type__: comp.__type__,
151
- _name: comp._name || '',
152
- _objFlags: comp._objFlags || 0,
153
- node: { __id__: indexMap.get(comp.node) },
154
- _enabled: comp._enabled !== false
155
- };
156
-
157
- // 其他属性
158
- for (const key of Object.keys(comp)) {
159
- if (['__type__', '_name', '_objFlags', 'node', '_enabled', '_id'].includes(key)) continue;
160
- const val = comp[key];
161
- if (val === undefined) continue;
162
- json[key] = val && typeof val.toJSON === 'function' ? val.toJSON() : val;
163
- }
164
-
165
- // _id 放最后
166
- json._id = comp._id || '';
167
-
168
- return json;
169
- }
170
-
171
- function createObject(item) {
172
- const type = item.__type__;
173
-
174
- if (type === 'cc.Prefab') return null; // 跳过,由 CCPrefab.fromJSON 处理
175
- if (type === 'cc.PrefabInfo') return new CCPrefabInfo();
176
-
177
- if (type === 'cc.Node') {
178
- const CCNode = require('./CCNode');
179
- const node = new CCNode(item._name || 'Node');
180
- node._id = item._id || '';
181
- copyNodeProps(node, item);
182
- return node;
183
- }
184
-
185
- // 组件
186
- const comp = { __type__: type };
187
- for (const key of Object.keys(item)) {
188
- if (['__type__', '_name', '_objFlags', 'node', '_enabled', '_id'].includes(key)) continue;
189
- comp[key] = item[key];
190
- }
191
- return comp;
192
- }
193
-
194
- function copyNodeProps(node, item) {
195
- if (item._active !== undefined) node._active = item._active;
196
- if (item._opacity !== undefined) node._opacity = item._opacity;
197
- if (item._is3DNode !== undefined) node._is3DNode = item._is3DNode;
198
- if (item._groupIndex !== undefined) node._groupIndex = item._groupIndex;
199
- if (item.groupIndex !== undefined) node.groupIndex = item.groupIndex;
200
- if (item._skewX !== undefined) node._skewX = item._skewX;
201
- if (item._skewY !== undefined) node._skewY = item._skewY;
202
-
203
- if (item._color) node._color.set(item._color.r, item._color.g, item._color.b, item._color.a);
204
- if (item._contentSize) node._contentSize.set(item._contentSize.width, item._contentSize.height);
205
- if (item._anchorPoint) node._anchorPoint.set(item._anchorPoint.x, item._anchorPoint.y);
206
- if (item._trs?.array) item._trs.array.forEach((v, i) => node._trs.array[i] = v);
207
- if (item._eulerAngles) node._eulerAngles.set(item._eulerAngles.x, item._eulerAngles.y, item._eulerAngles.z);
208
- }
209
-
210
- function setupReferences(obj, item, objects) {
211
- if (!obj) return;
212
-
213
- if (obj.__type__ === 'cc.Node') {
214
- if (item._parent) obj._parent = objects[item._parent.__id__];
215
- if (item._children) obj._children = item._children.map(c => objects[c.__id__]).filter(Boolean);
216
- if (item._components) {
217
- obj._components = item._components.map(c => objects[c.__id__]).filter(Boolean);
218
- obj._components.forEach(c => { if (c) c.node = obj; });
219
- }
220
- if (item._prefab) obj._prefab = objects[item._prefab.__id__];
221
- } else if (obj.__type__ === 'cc.PrefabInfo') {
222
- if (item.root) obj.root = objects[item.root.__id__];
223
- if (item.asset) obj.asset = objects[item.asset.__id__];
224
- obj.fileId = item.fileId || '';
225
- obj.sync = item.sync || false;
226
- }
227
- }
228
-
229
- /**
230
- * 预制体信息类
231
- */
232
- class CCPrefabInfo {
233
- constructor() {
234
- this.__type__ = 'cc.PrefabInfo';
235
- this.root = null;
236
- this.asset = null;
237
- this.fileId = '';
238
- this.sync = false;
239
- }
240
- }
241
-
242
- module.exports = { CCPrefab, CCPrefabInfo };
1
+ import CCObject from './CCObject.js';
2
+ import { generateFileId } from '../fire-utils.js';
3
+ import CCNode from './CCNode.js';
4
+ class CCPrefab extends CCObject {
5
+ _native;
6
+ _root;
7
+ optimizationPolicy;
8
+ asyncLoadAssets;
9
+ readonly;
10
+ constructor() {
11
+ super('');
12
+ this.__type__ = 'cc.Prefab';
13
+ this._native = '';
14
+ this._root = null;
15
+ this.optimizationPolicy = 0;
16
+ this.asyncLoadAssets = false;
17
+ this.readonly = false;
18
+ }
19
+ setRoot(node) {
20
+ this._root = node;
21
+ return this;
22
+ }
23
+ static fromJSON(json) {
24
+ const prefab = new CCPrefab();
25
+ const objects = [];
26
+ json.forEach((item, index) => {
27
+ objects[index] = createObject(item);
28
+ });
29
+ json.forEach((item, index) => {
30
+ setupReferences(objects[index], item, objects);
31
+ });
32
+ prefab._root = objects[1];
33
+ return prefab;
34
+ }
35
+ toJSON() {
36
+ const result = [];
37
+ const indexMap = new Map();
38
+ indexMap.set(this, 0);
39
+ result.push({
40
+ __type__: 'cc.Prefab',
41
+ _name: '',
42
+ _objFlags: 0,
43
+ _native: '',
44
+ data: null,
45
+ optimizationPolicy: this.optimizationPolicy,
46
+ asyncLoadAssets: this.asyncLoadAssets,
47
+ readonly: this.readonly
48
+ });
49
+ const processNode = (node, isRoot = false) => {
50
+ if (!node)
51
+ return;
52
+ indexMap.set(node, result.length);
53
+ result.push(null);
54
+ if (node._children) {
55
+ node._children.forEach(child => processNode(child, false));
56
+ }
57
+ if (node._components) {
58
+ node._components.forEach(comp => {
59
+ indexMap.set(comp, result.length);
60
+ result.push(componentToJSON(comp, indexMap));
61
+ });
62
+ }
63
+ result[indexMap.get(node)] = {
64
+ __type__: 'cc.Node',
65
+ _name: node._name,
66
+ _objFlags: node._objFlags,
67
+ _parent: node._parent ? { __id__: indexMap.get(node._parent) } : null,
68
+ _children: node._children?.map(c => ({ __id__: indexMap.get(c) })) || [],
69
+ _active: node._active,
70
+ _components: node._components?.map(c => ({ __id__: indexMap.get(c) })) || [],
71
+ _prefab: null,
72
+ _opacity: node._opacity,
73
+ _color: node._color.toJSON(),
74
+ _contentSize: node._contentSize.toJSON(),
75
+ _anchorPoint: node._anchorPoint.toJSON(),
76
+ _trs: node._trs.toJSON(),
77
+ _eulerAngles: node._eulerAngles.toJSON(),
78
+ _skewX: node._skewX,
79
+ _skewY: node._skewY,
80
+ _is3DNode: node._is3DNode,
81
+ _groupIndex: node._groupIndex,
82
+ groupIndex: node.groupIndex,
83
+ _id: node._id || ''
84
+ };
85
+ if (!isRoot) {
86
+ const infoIdx = result.length;
87
+ result.push({
88
+ __type__: 'cc.PrefabInfo',
89
+ root: { __id__: indexMap.get(this._root) },
90
+ asset: { __id__: 0 },
91
+ fileId: generateFileId(),
92
+ sync: false
93
+ });
94
+ result[indexMap.get(node)]._prefab = { __id__: infoIdx };
95
+ }
96
+ };
97
+ if (this._root) {
98
+ processNode(this._root, true);
99
+ }
100
+ if (this._root) {
101
+ result[0].data = { __id__: indexMap.get(this._root) };
102
+ const infoIdx = result.length;
103
+ result.push({
104
+ __type__: 'cc.PrefabInfo',
105
+ root: { __id__: indexMap.get(this._root) },
106
+ asset: { __id__: 0 },
107
+ fileId: '',
108
+ sync: false
109
+ });
110
+ result[indexMap.get(this._root)]._prefab = { __id__: infoIdx };
111
+ }
112
+ return result;
113
+ }
114
+ }
115
+ function componentToJSON(comp, indexMap) {
116
+ const json = {
117
+ __type__: comp.__type__,
118
+ _name: comp._name || '',
119
+ _objFlags: comp._objFlags || 0,
120
+ node: { __id__: indexMap.get(comp.node) },
121
+ _enabled: comp._enabled !== false
122
+ };
123
+ for (const key of Object.keys(comp)) {
124
+ if (['__type__', '_name', '_objFlags', 'node', '_enabled', '_id'].includes(key))
125
+ continue;
126
+ const val = comp[key];
127
+ if (val === undefined)
128
+ continue;
129
+ json[key] = val && typeof val.toJSON === 'function' ? val.toJSON() : val;
130
+ }
131
+ json._id = comp._id || '';
132
+ return json;
133
+ }
134
+ function createObject(item) {
135
+ const type = item.__type__;
136
+ if (type === 'cc.Prefab')
137
+ return null;
138
+ if (type === 'cc.PrefabInfo')
139
+ return new CCPrefabInfo();
140
+ if (type === 'cc.Node') {
141
+ const node = new CCNode(item._name || 'Node');
142
+ node._id = item._id || '';
143
+ copyNodeProps(node, item);
144
+ return node;
145
+ }
146
+ const comp = { __type__: type };
147
+ for (const key of Object.keys(item)) {
148
+ if (['__type__', '_name', '_objFlags', 'node', '_enabled', '_id'].includes(key))
149
+ continue;
150
+ comp[key] = item[key];
151
+ }
152
+ return comp;
153
+ }
154
+ function copyNodeProps(node, item) {
155
+ if (item._active !== undefined)
156
+ node._active = item._active;
157
+ if (item._opacity !== undefined)
158
+ node._opacity = item._opacity;
159
+ if (item._is3DNode !== undefined)
160
+ node._is3DNode = item._is3DNode;
161
+ if (item._groupIndex !== undefined)
162
+ node._groupIndex = item._groupIndex;
163
+ if (item.groupIndex !== undefined)
164
+ node.groupIndex = item.groupIndex;
165
+ if (item._skewX !== undefined)
166
+ node._skewX = item._skewX;
167
+ if (item._skewY !== undefined)
168
+ node._skewY = item._skewY;
169
+ if (item._color)
170
+ node._color.set(item._color.r, item._color.g, item._color.b, item._color.a);
171
+ if (item._contentSize)
172
+ node._contentSize.set(item._contentSize.width, item._contentSize.height);
173
+ if (item._anchorPoint)
174
+ node._anchorPoint.set(item._anchorPoint.x, item._anchorPoint.y);
175
+ if (item._trs?.array)
176
+ item._trs.array.forEach((v, i) => node._trs.array[i] = v);
177
+ if (item._eulerAngles)
178
+ node._eulerAngles.set(item._eulerAngles.x, item._eulerAngles.y, item._eulerAngles.z);
179
+ }
180
+ function setupReferences(obj, item, objects) {
181
+ if (!obj)
182
+ return;
183
+ if (obj.__type__ === 'cc.Node') {
184
+ if (item._parent)
185
+ obj._parent = objects[item._parent.__id__];
186
+ if (item._children)
187
+ obj._children = item._children.map((c) => objects[c.__id__]).filter(Boolean);
188
+ if (item._components) {
189
+ obj._components = item._components.map((c) => objects[c.__id__]).filter(Boolean);
190
+ obj._components.forEach((c) => { if (c)
191
+ c.node = obj; });
192
+ }
193
+ if (item._prefab)
194
+ obj._prefab = objects[item._prefab.__id__];
195
+ }
196
+ else if (obj.__type__ === 'cc.PrefabInfo') {
197
+ if (item.root)
198
+ obj.root = objects[item.root.__id__];
199
+ if (item.asset)
200
+ obj.asset = objects[item.asset.__id__];
201
+ obj.fileId = item.fileId || '';
202
+ obj.sync = item.sync || false;
203
+ }
204
+ }
205
+ class CCPrefabInfo {
206
+ __type__;
207
+ root;
208
+ asset;
209
+ fileId;
210
+ sync;
211
+ constructor() {
212
+ this.__type__ = 'cc.PrefabInfo';
213
+ this.root = null;
214
+ this.asset = null;
215
+ this.fileId = '';
216
+ this.sync = false;
217
+ }
218
+ }
219
+ export { CCPrefab, CCPrefabInfo };
@@ -1,32 +1,30 @@
1
- /**
2
- * Cocos Creator 矩形类
3
- */
4
- class CCRect {
5
- constructor(x = 0, y = 0, width = 0, height = 0) {
6
- this.__type__ = 'cc.Rect';
7
- this.x = x;
8
- this.y = y;
9
- this.width = width;
10
- this.height = height;
11
- }
12
-
13
- set(x, y, width, height) {
14
- this.x = x;
15
- this.y = y;
16
- this.width = width;
17
- this.height = height;
18
- return this;
19
- }
20
-
21
- toJSON() {
22
- return {
23
- __type__: this.__type__,
24
- x: this.x,
25
- y: this.y,
26
- width: this.width,
27
- height: this.height
28
- };
29
- }
30
- }
31
-
32
- module.exports = CCRect;
1
+ export default class CCRect {
2
+ __type__;
3
+ x;
4
+ y;
5
+ width;
6
+ height;
7
+ constructor(x = 0, y = 0, width = 0, height = 0) {
8
+ this.__type__ = 'cc.Rect';
9
+ this.x = x;
10
+ this.y = y;
11
+ this.width = width;
12
+ this.height = height;
13
+ }
14
+ set(x, y, width, height) {
15
+ this.x = x;
16
+ this.y = y;
17
+ this.width = width;
18
+ this.height = height;
19
+ return this;
20
+ }
21
+ toJSON() {
22
+ return {
23
+ __type__: this.__type__,
24
+ x: this.x,
25
+ y: this.y,
26
+ width: this.width,
27
+ height: this.height
28
+ };
29
+ }
30
+ }
@@ -1,44 +1,38 @@
1
- const CCComponent = require('./CCComponent');
2
-
3
- /**
4
- * Cocos Creator RichText 组件
5
- * 支持 BBCode 标签语法:
6
- * <color=#ff0000>红色</color>
7
- * <size=30>大字</size>
8
- * <b>加粗</b> <i>斜体</i> <u>下划线</u>
9
- * <br/> 换行
10
- */
11
- class CCRichText extends CCComponent {
12
- constructor() {
13
- super();
14
- this.__type__ = 'cc.RichText';
15
-
16
- this._string = '';
17
- this._horizontalAlign = 0; // 0=LEFT 1=CENTER 2=RIGHT
18
- this._fontSize = 40;
19
- this._maxWidth = 0;
20
- this._lineHeight = 40;
21
- this._imageAtlas = null;
22
- this._handleTouchEvent = true;
23
- }
24
-
25
- toJSON() {
26
- return {
27
- __type__: this.__type__,
28
- _name: this._name,
29
- _objFlags: this._objFlags,
30
- node: this.node,
31
- _enabled: this._enabled,
32
- _string: this._string,
33
- _horizontalAlign: this._horizontalAlign,
34
- _fontSize: this._fontSize,
35
- _maxWidth: this._maxWidth,
36
- _lineHeight: this._lineHeight,
37
- _imageAtlas: this._imageAtlas,
38
- _handleTouchEvent: this._handleTouchEvent,
39
- _id: this._id
40
- };
41
- }
42
- }
43
-
44
- module.exports = CCRichText;
1
+ import CCComponent from './CCComponent.js';
2
+ export default class CCRichText extends CCComponent {
3
+ _string;
4
+ _horizontalAlign;
5
+ _fontSize;
6
+ _maxWidth;
7
+ _lineHeight;
8
+ _imageAtlas;
9
+ _handleTouchEvent;
10
+ constructor() {
11
+ super();
12
+ this.__type__ = 'cc.RichText';
13
+ this._string = '';
14
+ this._horizontalAlign = 0;
15
+ this._fontSize = 40;
16
+ this._maxWidth = 0;
17
+ this._lineHeight = 40;
18
+ this._imageAtlas = null;
19
+ this._handleTouchEvent = true;
20
+ }
21
+ toJSON() {
22
+ return {
23
+ __type__: this.__type__,
24
+ _name: this._name,
25
+ _objFlags: this._objFlags,
26
+ node: this.node,
27
+ _enabled: this._enabled,
28
+ _string: this._string,
29
+ _horizontalAlign: this._horizontalAlign,
30
+ _fontSize: this._fontSize,
31
+ _maxWidth: this._maxWidth,
32
+ _lineHeight: this._lineHeight,
33
+ _imageAtlas: this._imageAtlas,
34
+ _handleTouchEvent: this._handleTouchEvent,
35
+ _id: this._id
36
+ };
37
+ }
38
+ }