cocos2d-cli 1.6.5 → 2.1.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.
- package/data/script_map.json +25 -25
- package/dist/bin/cocos2d-cli.js +64 -0
- package/dist/src/commands/add-component.js +3 -0
- package/dist/src/commands/add.js +3 -0
- package/dist/src/commands/build.js +6 -0
- package/dist/src/commands/create-scene.js +3 -0
- package/dist/src/commands/get.js +3 -0
- package/dist/src/commands/prefab-create.js +109 -0
- package/dist/src/commands/remove-component.js +3 -0
- package/dist/src/commands/remove.js +3 -0
- package/dist/src/commands/screenshot.js +41 -0
- package/dist/src/commands/set-component.js +3 -0
- package/dist/src/commands/set.js +3 -0
- package/dist/src/commands/tree.js +24 -0
- package/{src → dist/src}/lib/cc/CCButton.js +115 -122
- package/{src → dist/src}/lib/cc/CCCamera.js +83 -93
- package/{src → dist/src}/lib/cc/CCCanvas.js +49 -54
- package/{src → dist/src}/lib/cc/CCColor.js +30 -32
- package/{src → dist/src}/lib/cc/CCComponent.js +39 -60
- package/{src → dist/src}/lib/cc/CCLabel.js +139 -146
- package/{src → dist/src}/lib/cc/CCNode.js +190 -256
- package/{src → dist/src}/lib/cc/CCObject.js +19 -23
- package/{src → dist/src}/lib/cc/CCPrefab.js +219 -242
- package/{src → dist/src}/lib/cc/CCRect.js +30 -32
- package/{src → dist/src}/lib/cc/CCRichText.js +38 -44
- package/{src → dist/src}/lib/cc/CCScene.js +32 -42
- package/dist/src/lib/cc/CCSceneAsset.js +242 -0
- package/{src → dist/src}/lib/cc/CCSize.js +22 -26
- package/{src → dist/src}/lib/cc/CCSprite.js +82 -94
- package/{src → dist/src}/lib/cc/CCTrs.js +49 -74
- package/{src → dist/src}/lib/cc/CCVec2.js +22 -26
- package/{src → dist/src}/lib/cc/CCVec3.js +26 -29
- package/{src → dist/src}/lib/cc/CCWidget.js +94 -98
- package/dist/src/lib/fire-utils.js +86 -0
- package/dist/src/lib/json-parser.js +114 -0
- package/dist/src/lib/node-utils.js +131 -0
- package/{src → dist/src}/lib/screenshot-core.js +242 -285
- package/dist/src/lib/templates.js +17 -0
- package/dist/src/lib/utils.js +81 -0
- package/package.json +40 -33
- package/bin/cocos2d-cli.js +0 -152
- package/src/commands/add-component.js +0 -112
- package/src/commands/add.js +0 -177
- package/src/commands/build.js +0 -78
- package/src/commands/create-scene.js +0 -181
- package/src/commands/get.js +0 -108
- package/src/commands/prefab-create.js +0 -111
- package/src/commands/remove-component.js +0 -111
- package/src/commands/remove.js +0 -99
- package/src/commands/screenshot.js +0 -108
- package/src/commands/set-component.js +0 -119
- package/src/commands/set.js +0 -107
- package/src/commands/tree.js +0 -29
- package/src/lib/cc/CCSceneAsset.js +0 -303
- package/src/lib/cc/index.js +0 -42
- package/src/lib/fire-utils.js +0 -374
- package/src/lib/json-parser.js +0 -185
- package/src/lib/node-utils.js +0 -395
- package/src/lib/screenshot/favicon.ico +0 -0
- package/src/lib/screenshot/index.html +0 -30
- package/src/lib/templates.js +0 -49
- package/src/lib/utils.js +0 -202
|
@@ -1,146 +1,139 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
this.
|
|
25
|
-
this.
|
|
26
|
-
this.
|
|
27
|
-
this.
|
|
28
|
-
this.
|
|
29
|
-
this._N$
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
this.
|
|
37
|
-
this.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
this.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
if (props.
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
_N$cacheMode: this._N$cacheMode,
|
|
141
|
-
_id: this._id
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
module.exports = CCLabel;
|
|
1
|
+
import CCComponent from './CCComponent.js';
|
|
2
|
+
export default class CCLabel extends CCComponent {
|
|
3
|
+
_materials;
|
|
4
|
+
_srcBlendFactor;
|
|
5
|
+
_dstBlendFactor;
|
|
6
|
+
_string;
|
|
7
|
+
_N$string;
|
|
8
|
+
_fontSize;
|
|
9
|
+
_lineHeight;
|
|
10
|
+
_enableWrapText;
|
|
11
|
+
_N$file;
|
|
12
|
+
_isSystemFontUsed;
|
|
13
|
+
_spacingX;
|
|
14
|
+
_batchAsBitmap;
|
|
15
|
+
_styleFlags;
|
|
16
|
+
_underlineHeight;
|
|
17
|
+
_N$horizontalAlign;
|
|
18
|
+
_N$verticalAlign;
|
|
19
|
+
_N$fontFamily;
|
|
20
|
+
_N$overflow;
|
|
21
|
+
_N$cacheMode;
|
|
22
|
+
constructor() {
|
|
23
|
+
super();
|
|
24
|
+
this.__type__ = 'cc.Label';
|
|
25
|
+
this._materials = [{ __uuid__: 'eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432' }];
|
|
26
|
+
this._srcBlendFactor = 770;
|
|
27
|
+
this._dstBlendFactor = 771;
|
|
28
|
+
this._string = '';
|
|
29
|
+
this._N$string = '';
|
|
30
|
+
this._fontSize = 40;
|
|
31
|
+
this._lineHeight = 40;
|
|
32
|
+
this._enableWrapText = true;
|
|
33
|
+
this._N$file = null;
|
|
34
|
+
this._isSystemFontUsed = true;
|
|
35
|
+
this._spacingX = 0;
|
|
36
|
+
this._batchAsBitmap = false;
|
|
37
|
+
this._styleFlags = 0;
|
|
38
|
+
this._underlineHeight = 0;
|
|
39
|
+
this._N$horizontalAlign = 1;
|
|
40
|
+
this._N$verticalAlign = 1;
|
|
41
|
+
this._N$fontFamily = 'Arial';
|
|
42
|
+
this._N$overflow = 0;
|
|
43
|
+
this._N$cacheMode = 0;
|
|
44
|
+
}
|
|
45
|
+
setString(str) {
|
|
46
|
+
this._string = str;
|
|
47
|
+
this._N$string = str;
|
|
48
|
+
return this;
|
|
49
|
+
}
|
|
50
|
+
setFontSize(size) {
|
|
51
|
+
this._fontSize = size;
|
|
52
|
+
this._lineHeight = size;
|
|
53
|
+
return this;
|
|
54
|
+
}
|
|
55
|
+
setFontFamily(family) {
|
|
56
|
+
this._N$fontFamily = family;
|
|
57
|
+
return this;
|
|
58
|
+
}
|
|
59
|
+
getProp() {
|
|
60
|
+
const H_ALIGN = ['LEFT', 'CENTER', 'RIGHT'];
|
|
61
|
+
const V_ALIGN = ['TOP', 'CENTER', 'BOTTOM'];
|
|
62
|
+
const OVERFLOW = ['NONE', 'CLAMP', 'SHRINK', 'RESIZE_HEIGHT'];
|
|
63
|
+
return {
|
|
64
|
+
string: this._string,
|
|
65
|
+
fontSize: this._fontSize,
|
|
66
|
+
lineHeight: this._lineHeight,
|
|
67
|
+
fontFamily: this._N$fontFamily,
|
|
68
|
+
horizontalAlign: H_ALIGN[this._N$horizontalAlign] || this._N$horizontalAlign,
|
|
69
|
+
verticalAlign: V_ALIGN[this._N$verticalAlign] || this._N$verticalAlign,
|
|
70
|
+
overflow: OVERFLOW[this._N$overflow] || this._N$overflow,
|
|
71
|
+
wrap: this._enableWrapText
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
static parseHAlign(value) {
|
|
75
|
+
if (typeof value === 'number')
|
|
76
|
+
return value;
|
|
77
|
+
switch (String(value).toLowerCase()) {
|
|
78
|
+
case 'left': return 0;
|
|
79
|
+
case 'center': return 1;
|
|
80
|
+
case 'right': return 2;
|
|
81
|
+
default: return 1;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
static parseVAlign(value) {
|
|
85
|
+
if (typeof value === 'number')
|
|
86
|
+
return value;
|
|
87
|
+
switch (String(value).toLowerCase()) {
|
|
88
|
+
case 'top': return 0;
|
|
89
|
+
case 'center': return 1;
|
|
90
|
+
case 'bottom': return 2;
|
|
91
|
+
default: return 1;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
setProp(props) {
|
|
95
|
+
super.setProp(props);
|
|
96
|
+
if (props.string !== undefined)
|
|
97
|
+
this.setString(props.string);
|
|
98
|
+
if (props.fontSize !== undefined)
|
|
99
|
+
this.setFontSize(props.fontSize);
|
|
100
|
+
if (props.lineHeight !== undefined)
|
|
101
|
+
this._lineHeight = props.lineHeight;
|
|
102
|
+
if (props.fontFamily !== undefined)
|
|
103
|
+
this.setFontFamily(props.fontFamily);
|
|
104
|
+
if (props.horizontalAlign !== undefined)
|
|
105
|
+
this._N$horizontalAlign = CCLabel.parseHAlign(props.horizontalAlign);
|
|
106
|
+
if (props.verticalAlign !== undefined)
|
|
107
|
+
this._N$verticalAlign = CCLabel.parseVAlign(props.verticalAlign);
|
|
108
|
+
return this;
|
|
109
|
+
}
|
|
110
|
+
toJSON() {
|
|
111
|
+
return {
|
|
112
|
+
__type__: this.__type__,
|
|
113
|
+
_name: this._name,
|
|
114
|
+
_objFlags: this._objFlags,
|
|
115
|
+
node: this.node,
|
|
116
|
+
_enabled: this._enabled,
|
|
117
|
+
_materials: this._materials,
|
|
118
|
+
_srcBlendFactor: this._srcBlendFactor,
|
|
119
|
+
_dstBlendFactor: this._dstBlendFactor,
|
|
120
|
+
_string: this._string,
|
|
121
|
+
_N$string: this._N$string,
|
|
122
|
+
_fontSize: this._fontSize,
|
|
123
|
+
_lineHeight: this._fontSize,
|
|
124
|
+
_enableWrapText: this._enableWrapText,
|
|
125
|
+
_N$file: this._N$file,
|
|
126
|
+
_isSystemFontUsed: this._isSystemFontUsed,
|
|
127
|
+
_spacingX: this._spacingX,
|
|
128
|
+
_batchAsBitmap: this._batchAsBitmap,
|
|
129
|
+
_styleFlags: this._styleFlags,
|
|
130
|
+
_underlineHeight: this._underlineHeight,
|
|
131
|
+
_N$horizontalAlign: this._N$horizontalAlign,
|
|
132
|
+
_N$verticalAlign: this._N$verticalAlign,
|
|
133
|
+
_N$fontFamily: this._N$fontFamily,
|
|
134
|
+
_N$overflow: this._N$overflow,
|
|
135
|
+
_N$cacheMode: this._N$cacheMode,
|
|
136
|
+
_id: this._id
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
}
|