cocos2d-cli 1.6.4 → 1.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.
Files changed (42) hide show
  1. package/bin/cocos2d-cli.js +152 -152
  2. package/data/script_map.json +25 -25
  3. package/package.json +33 -33
  4. package/src/commands/add-component.js +112 -112
  5. package/src/commands/add.js +177 -177
  6. package/src/commands/build.js +78 -78
  7. package/src/commands/create-scene.js +181 -181
  8. package/src/commands/get.js +108 -108
  9. package/src/commands/prefab-create.js +110 -110
  10. package/src/commands/remove-component.js +110 -110
  11. package/src/commands/remove.js +99 -99
  12. package/src/commands/screenshot.js +108 -108
  13. package/src/commands/set-component.js +119 -119
  14. package/src/commands/set.js +107 -107
  15. package/src/commands/tree.js +28 -28
  16. package/src/lib/cc/CCButton.js +122 -122
  17. package/src/lib/cc/CCCamera.js +93 -93
  18. package/src/lib/cc/CCCanvas.js +54 -54
  19. package/src/lib/cc/CCColor.js +32 -32
  20. package/src/lib/cc/CCComponent.js +60 -60
  21. package/src/lib/cc/CCLabel.js +146 -146
  22. package/src/lib/cc/CCNode.js +255 -255
  23. package/src/lib/cc/CCObject.js +23 -23
  24. package/src/lib/cc/CCPrefab.js +242 -242
  25. package/src/lib/cc/CCRect.js +32 -32
  26. package/src/lib/cc/CCRichText.js +44 -44
  27. package/src/lib/cc/CCScene.js +42 -42
  28. package/src/lib/cc/CCSceneAsset.js +302 -302
  29. package/src/lib/cc/CCSize.js +26 -26
  30. package/src/lib/cc/CCSprite.js +94 -94
  31. package/src/lib/cc/CCTrs.js +74 -74
  32. package/src/lib/cc/CCVec2.js +26 -26
  33. package/src/lib/cc/CCVec3.js +29 -29
  34. package/src/lib/cc/CCWidget.js +98 -98
  35. package/src/lib/cc/index.js +42 -42
  36. package/src/lib/fire-utils.js +373 -373
  37. package/src/lib/json-parser.js +185 -185
  38. package/src/lib/node-utils.js +395 -395
  39. package/src/lib/screenshot/index.html +29 -29
  40. package/src/lib/screenshot-core.js +285 -286
  41. package/src/lib/templates.js +49 -49
  42. package/src/lib/utils.js +202 -202
@@ -1,60 +1,60 @@
1
- const CCObject = require('./CCObject');
2
- const { generateId } = require('../utils');
3
-
4
- /**
5
- * Cocos Creator 组件基类
6
- */
7
- class CCComponent extends CCObject {
8
- constructor() {
9
- super('');
10
- this.__type__ = 'cc.Component';
11
-
12
- // 关联的节点
13
- this.node = null;
14
-
15
- // 启用状态
16
- this._enabled = true;
17
-
18
- // 唯一标识(22位压缩格式)
19
- this._id = generateId();
20
- }
21
-
22
- /**
23
- * 设置节点引用
24
- */
25
- setNode(nodeIndex) {
26
- this.node = { __id__: nodeIndex };
27
- return this;
28
- }
29
-
30
- /**
31
- * 获取属性(子类重写)
32
- */
33
- getProp() {
34
- return {
35
- class: this.__type__,
36
- enabled: this._enabled
37
- };
38
- }
39
-
40
- /**
41
- * 设置属性(子类重写)
42
- */
43
- setProp(props) {
44
- if (props.enabled !== undefined) this._enabled = props.enabled;
45
- return this;
46
- }
47
-
48
- toJSON() {
49
- return {
50
- __type__: this.__type__,
51
- _name: this._name,
52
- _objFlags: this._objFlags,
53
- node: this.node,
54
- _enabled: this._enabled,
55
- _id: this._id
56
- };
57
- }
58
- }
59
-
60
- module.exports = CCComponent;
1
+ const CCObject = require('./CCObject');
2
+ const { generateId } = require('../utils');
3
+
4
+ /**
5
+ * Cocos Creator 组件基类
6
+ */
7
+ class CCComponent extends CCObject {
8
+ constructor() {
9
+ super('');
10
+ this.__type__ = 'cc.Component';
11
+
12
+ // 关联的节点
13
+ this.node = null;
14
+
15
+ // 启用状态
16
+ this._enabled = true;
17
+
18
+ // 唯一标识(22位压缩格式)
19
+ this._id = generateId();
20
+ }
21
+
22
+ /**
23
+ * 设置节点引用
24
+ */
25
+ setNode(nodeIndex) {
26
+ this.node = { __id__: nodeIndex };
27
+ return this;
28
+ }
29
+
30
+ /**
31
+ * 获取属性(子类重写)
32
+ */
33
+ getProp() {
34
+ return {
35
+ class: this.__type__,
36
+ enabled: this._enabled
37
+ };
38
+ }
39
+
40
+ /**
41
+ * 设置属性(子类重写)
42
+ */
43
+ setProp(props) {
44
+ if (props.enabled !== undefined) this._enabled = props.enabled;
45
+ return this;
46
+ }
47
+
48
+ toJSON() {
49
+ return {
50
+ __type__: this.__type__,
51
+ _name: this._name,
52
+ _objFlags: this._objFlags,
53
+ node: this.node,
54
+ _enabled: this._enabled,
55
+ _id: this._id
56
+ };
57
+ }
58
+ }
59
+
60
+ module.exports = CCComponent;
@@ -1,146 +1,146 @@
1
- const CCComponent = require('./CCComponent');
2
-
3
- /**
4
- * Cocos Creator Label 组件
5
- */
6
- class CCLabel extends CCComponent {
7
- constructor() {
8
- super();
9
- this.__type__ = 'cc.Label';
10
-
11
- this._materials = [{ __uuid__: 'eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432' }];
12
- this._srcBlendFactor = 770;
13
- this._dstBlendFactor = 771;
14
- this._string = '';
15
- this._N$string = '';
16
- this._fontSize = 40;
17
- this._lineHeight = 40;
18
- this._enableWrapText = true;
19
- this._N$file = null;
20
- this._isSystemFontUsed = true;
21
- this._spacingX = 0;
22
- this._batchAsBitmap = false;
23
- this._styleFlags = 0;
24
- this._underlineHeight = 0;
25
- this._N$horizontalAlign = 1;
26
- this._N$verticalAlign = 1;
27
- this._N$fontFamily = 'Arial';
28
- this._N$overflow = 0;
29
- this._N$cacheMode = 0;
30
- }
31
-
32
- /**
33
- * 设置文本内容
34
- */
35
- setString(str) {
36
- this._string = str;
37
- this._N$string = str;
38
- return this;
39
- }
40
-
41
- /**
42
- * 设置字体大小
43
- */
44
- setFontSize(size) {
45
- this._fontSize = size;
46
- this._lineHeight = size;
47
- return this;
48
- }
49
-
50
- /**
51
- * 设置字体
52
- */
53
- setFontFamily(family) {
54
- this._N$fontFamily = family;
55
- return this;
56
- }
57
-
58
- /**
59
- * 获取属性
60
- */
61
- getProp() {
62
- const H_ALIGN = ['LEFT', 'CENTER', 'RIGHT'];
63
- const V_ALIGN = ['TOP', 'CENTER', 'BOTTOM'];
64
- const OVERFLOW = ['NONE', 'CLAMP', 'SHRINK', 'RESIZE_HEIGHT'];
65
- return {
66
- string: this._string,
67
- fontSize: this._fontSize,
68
- lineHeight: this._lineHeight,
69
- fontFamily: this._N$fontFamily,
70
- horizontalAlign: H_ALIGN[this._N$horizontalAlign] || this._N$horizontalAlign,
71
- verticalAlign: V_ALIGN[this._N$verticalAlign] || this._N$verticalAlign,
72
- overflow: OVERFLOW[this._N$overflow] || this._N$overflow,
73
- wrap: this._enableWrapText
74
- };
75
- }
76
-
77
- /**
78
- * 将语义化对齐字符串转为数字
79
- * horizontalAlign: left=0, center=1, right=2
80
- * verticalAlign: top=0, center=1, bottom=2
81
- */
82
- static parseHAlign(value) {
83
- if (typeof value === 'number') return value;
84
- switch (String(value).toLowerCase()) {
85
- case 'left': return 0;
86
- case 'center': return 1;
87
- case 'right': return 2;
88
- default: return 1;
89
- }
90
- }
91
-
92
- static parseVAlign(value) {
93
- if (typeof value === 'number') return value;
94
- switch (String(value).toLowerCase()) {
95
- case 'top': return 0;
96
- case 'center': return 1;
97
- case 'bottom': return 2;
98
- default: return 1;
99
- }
100
- }
101
-
102
- /**
103
- * 设置属性
104
- */
105
- setProp(props) {
106
- if (props.string !== undefined) this.setString(props.string);
107
- if (props.fontSize !== undefined) this.setFontSize(props.fontSize);
108
- if (props.lineHeight !== undefined) this._lineHeight = props.lineHeight;
109
- if (props.fontFamily !== undefined) this.setFontFamily(props.fontFamily);
110
- if (props.horizontalAlign !== undefined) this._N$horizontalAlign = CCLabel.parseHAlign(props.horizontalAlign);
111
- if (props.verticalAlign !== undefined) this._N$verticalAlign = CCLabel.parseVAlign(props.verticalAlign);
112
- return this;
113
- }
114
-
115
- toJSON() {
116
- return {
117
- __type__: this.__type__,
118
- _name: this._name,
119
- _objFlags: this._objFlags,
120
- node: this.node,
121
- _enabled: this._enabled,
122
- _materials: this._materials,
123
- _srcBlendFactor: this._srcBlendFactor,
124
- _dstBlendFactor: this._dstBlendFactor,
125
- _string: this._string,
126
- _N$string: this._N$string,
127
- _fontSize: this._fontSize,
128
- _lineHeight: this._lineHeight,
129
- _enableWrapText: this._enableWrapText,
130
- _N$file: this._N$file,
131
- _isSystemFontUsed: this._isSystemFontUsed,
132
- _spacingX: this._spacingX,
133
- _batchAsBitmap: this._batchAsBitmap,
134
- _styleFlags: this._styleFlags,
135
- _underlineHeight: this._underlineHeight,
136
- _N$horizontalAlign: this._N$horizontalAlign,
137
- _N$verticalAlign: this._N$verticalAlign,
138
- _N$fontFamily: this._N$fontFamily,
139
- _N$overflow: this._N$overflow,
140
- _N$cacheMode: this._N$cacheMode,
141
- _id: this._id
142
- };
143
- }
144
- }
145
-
146
- module.exports = CCLabel;
1
+ const CCComponent = require('./CCComponent');
2
+
3
+ /**
4
+ * Cocos Creator Label 组件
5
+ */
6
+ class CCLabel extends CCComponent {
7
+ constructor() {
8
+ super();
9
+ this.__type__ = 'cc.Label';
10
+
11
+ this._materials = [{ __uuid__: 'eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432' }];
12
+ this._srcBlendFactor = 770;
13
+ this._dstBlendFactor = 771;
14
+ this._string = '';
15
+ this._N$string = '';
16
+ this._fontSize = 40;
17
+ this._lineHeight = 40;
18
+ this._enableWrapText = true;
19
+ this._N$file = null;
20
+ this._isSystemFontUsed = true;
21
+ this._spacingX = 0;
22
+ this._batchAsBitmap = false;
23
+ this._styleFlags = 0;
24
+ this._underlineHeight = 0;
25
+ this._N$horizontalAlign = 1;
26
+ this._N$verticalAlign = 1;
27
+ this._N$fontFamily = 'Arial';
28
+ this._N$overflow = 0;
29
+ this._N$cacheMode = 0;
30
+ }
31
+
32
+ /**
33
+ * 设置文本内容
34
+ */
35
+ setString(str) {
36
+ this._string = str;
37
+ this._N$string = str;
38
+ return this;
39
+ }
40
+
41
+ /**
42
+ * 设置字体大小
43
+ */
44
+ setFontSize(size) {
45
+ this._fontSize = size;
46
+ this._lineHeight = size;
47
+ return this;
48
+ }
49
+
50
+ /**
51
+ * 设置字体
52
+ */
53
+ setFontFamily(family) {
54
+ this._N$fontFamily = family;
55
+ return this;
56
+ }
57
+
58
+ /**
59
+ * 获取属性
60
+ */
61
+ getProp() {
62
+ const H_ALIGN = ['LEFT', 'CENTER', 'RIGHT'];
63
+ const V_ALIGN = ['TOP', 'CENTER', 'BOTTOM'];
64
+ const OVERFLOW = ['NONE', 'CLAMP', 'SHRINK', 'RESIZE_HEIGHT'];
65
+ return {
66
+ string: this._string,
67
+ fontSize: this._fontSize,
68
+ lineHeight: this._lineHeight,
69
+ fontFamily: this._N$fontFamily,
70
+ horizontalAlign: H_ALIGN[this._N$horizontalAlign] || this._N$horizontalAlign,
71
+ verticalAlign: V_ALIGN[this._N$verticalAlign] || this._N$verticalAlign,
72
+ overflow: OVERFLOW[this._N$overflow] || this._N$overflow,
73
+ wrap: this._enableWrapText
74
+ };
75
+ }
76
+
77
+ /**
78
+ * 将语义化对齐字符串转为数字
79
+ * horizontalAlign: left=0, center=1, right=2
80
+ * verticalAlign: top=0, center=1, bottom=2
81
+ */
82
+ static parseHAlign(value) {
83
+ if (typeof value === 'number') return value;
84
+ switch (String(value).toLowerCase()) {
85
+ case 'left': return 0;
86
+ case 'center': return 1;
87
+ case 'right': return 2;
88
+ default: return 1;
89
+ }
90
+ }
91
+
92
+ static parseVAlign(value) {
93
+ if (typeof value === 'number') return value;
94
+ switch (String(value).toLowerCase()) {
95
+ case 'top': return 0;
96
+ case 'center': return 1;
97
+ case 'bottom': return 2;
98
+ default: return 1;
99
+ }
100
+ }
101
+
102
+ /**
103
+ * 设置属性
104
+ */
105
+ setProp(props) {
106
+ if (props.string !== undefined) this.setString(props.string);
107
+ if (props.fontSize !== undefined) this.setFontSize(props.fontSize);
108
+ if (props.lineHeight !== undefined) this._lineHeight = props.lineHeight;
109
+ if (props.fontFamily !== undefined) this.setFontFamily(props.fontFamily);
110
+ if (props.horizontalAlign !== undefined) this._N$horizontalAlign = CCLabel.parseHAlign(props.horizontalAlign);
111
+ if (props.verticalAlign !== undefined) this._N$verticalAlign = CCLabel.parseVAlign(props.verticalAlign);
112
+ return this;
113
+ }
114
+
115
+ toJSON() {
116
+ return {
117
+ __type__: this.__type__,
118
+ _name: this._name,
119
+ _objFlags: this._objFlags,
120
+ node: this.node,
121
+ _enabled: this._enabled,
122
+ _materials: this._materials,
123
+ _srcBlendFactor: this._srcBlendFactor,
124
+ _dstBlendFactor: this._dstBlendFactor,
125
+ _string: this._string,
126
+ _N$string: this._N$string,
127
+ _fontSize: this._fontSize,
128
+ _lineHeight: this._fontSize,
129
+ _enableWrapText: this._enableWrapText,
130
+ _N$file: this._N$file,
131
+ _isSystemFontUsed: this._isSystemFontUsed,
132
+ _spacingX: this._spacingX,
133
+ _batchAsBitmap: this._batchAsBitmap,
134
+ _styleFlags: this._styleFlags,
135
+ _underlineHeight: this._underlineHeight,
136
+ _N$horizontalAlign: this._N$horizontalAlign,
137
+ _N$verticalAlign: this._N$verticalAlign,
138
+ _N$fontFamily: this._N$fontFamily,
139
+ _N$overflow: this._N$overflow,
140
+ _N$cacheMode: this._N$cacheMode,
141
+ _id: this._id
142
+ };
143
+ }
144
+ }
145
+
146
+ module.exports = CCLabel;