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,93 +1,83 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
this.
|
|
22
|
-
this.
|
|
23
|
-
this.
|
|
24
|
-
this.
|
|
25
|
-
this.
|
|
26
|
-
this.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
this.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
_ortho: this._ortho,
|
|
85
|
-
_rect: this._rect.toJSON(),
|
|
86
|
-
_renderStages: this._renderStages,
|
|
87
|
-
_alignWithScreen: this._alignWithScreen,
|
|
88
|
-
_id: this._id
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
module.exports = CCCamera;
|
|
1
|
+
import CCComponent from './CCComponent.js';
|
|
2
|
+
import CCColor from './CCColor.js';
|
|
3
|
+
import CCRect from './CCRect.js';
|
|
4
|
+
export default class CCCamera extends CCComponent {
|
|
5
|
+
_cullingMask;
|
|
6
|
+
_clearFlags;
|
|
7
|
+
_backgroundColor;
|
|
8
|
+
_depth;
|
|
9
|
+
_zoomRatio;
|
|
10
|
+
_targetTexture;
|
|
11
|
+
_fov;
|
|
12
|
+
_orthoSize;
|
|
13
|
+
_nearClip;
|
|
14
|
+
_farClip;
|
|
15
|
+
_ortho;
|
|
16
|
+
_rect;
|
|
17
|
+
_renderStages;
|
|
18
|
+
_alignWithScreen;
|
|
19
|
+
constructor() {
|
|
20
|
+
super();
|
|
21
|
+
this.__type__ = 'cc.Camera';
|
|
22
|
+
this._cullingMask = 4294967295;
|
|
23
|
+
this._clearFlags = 7;
|
|
24
|
+
this._backgroundColor = new CCColor(0, 0, 0, 255);
|
|
25
|
+
this._depth = -1;
|
|
26
|
+
this._zoomRatio = 1;
|
|
27
|
+
this._targetTexture = null;
|
|
28
|
+
this._fov = 60;
|
|
29
|
+
this._orthoSize = 10;
|
|
30
|
+
this._nearClip = 1;
|
|
31
|
+
this._farClip = 4096;
|
|
32
|
+
this._ortho = true;
|
|
33
|
+
this._rect = new CCRect(0, 0, 1, 1);
|
|
34
|
+
this._renderStages = 1;
|
|
35
|
+
this._alignWithScreen = true;
|
|
36
|
+
}
|
|
37
|
+
setOrthoSize(size) {
|
|
38
|
+
this._orthoSize = size;
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
41
|
+
setDepth(depth) {
|
|
42
|
+
this._depth = depth;
|
|
43
|
+
return this;
|
|
44
|
+
}
|
|
45
|
+
setBackgroundColor(r, g, b, a = 255) {
|
|
46
|
+
this._backgroundColor.set(r, g, b, a);
|
|
47
|
+
return this;
|
|
48
|
+
}
|
|
49
|
+
toPanelJSON() {
|
|
50
|
+
return {
|
|
51
|
+
...super.getProp(),
|
|
52
|
+
depth: this._depth,
|
|
53
|
+
zoomRatio: this._zoomRatio,
|
|
54
|
+
ortho: this._ortho,
|
|
55
|
+
orthoSize: this._orthoSize,
|
|
56
|
+
backgroundColor: this._backgroundColor ? `#${this._backgroundColor.r.toString(16).padStart(2, '0')}${this._backgroundColor.g.toString(16).padStart(2, '0')}${this._backgroundColor.b.toString(16).padStart(2, '0')}` : '#000000'
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
toJSON() {
|
|
60
|
+
return {
|
|
61
|
+
__type__: this.__type__,
|
|
62
|
+
_name: this._name,
|
|
63
|
+
_objFlags: this._objFlags,
|
|
64
|
+
node: this.node,
|
|
65
|
+
_enabled: this._enabled,
|
|
66
|
+
_cullingMask: this._cullingMask,
|
|
67
|
+
_clearFlags: this._clearFlags,
|
|
68
|
+
_backgroundColor: this._backgroundColor.toJSON(),
|
|
69
|
+
_depth: this._depth,
|
|
70
|
+
_zoomRatio: this._zoomRatio,
|
|
71
|
+
_targetTexture: this._targetTexture,
|
|
72
|
+
_fov: this._fov,
|
|
73
|
+
_orthoSize: this._orthoSize,
|
|
74
|
+
_nearClip: this._nearClip,
|
|
75
|
+
_farClip: this._farClip,
|
|
76
|
+
_ortho: this._ortho,
|
|
77
|
+
_rect: this._rect.toJSON(),
|
|
78
|
+
_renderStages: this._renderStages,
|
|
79
|
+
_alignWithScreen: this._alignWithScreen,
|
|
80
|
+
_id: this._id
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -1,54 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
this.
|
|
11
|
-
|
|
12
|
-
this.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if (props.
|
|
20
|
-
this.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
module.exports = CCCanvas;
|
|
1
|
+
import CCComponent from './CCComponent.js';
|
|
2
|
+
import CCSize from './CCSize.js';
|
|
3
|
+
export default class CCCanvas extends CCComponent {
|
|
4
|
+
_designResolution;
|
|
5
|
+
_fitWidth;
|
|
6
|
+
_fitHeight;
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.__type__ = 'cc.Canvas';
|
|
10
|
+
this._designResolution = new CCSize(960, 640);
|
|
11
|
+
this._fitWidth = false;
|
|
12
|
+
this._fitHeight = true;
|
|
13
|
+
}
|
|
14
|
+
setProp(props) {
|
|
15
|
+
super.setProp(props);
|
|
16
|
+
if (props.designResolution) {
|
|
17
|
+
this._designResolution = new CCSize(props.designResolution.width, props.designResolution.height);
|
|
18
|
+
}
|
|
19
|
+
if (props.fitWidth !== undefined)
|
|
20
|
+
this._fitWidth = props.fitWidth;
|
|
21
|
+
if (props.fitHeight !== undefined)
|
|
22
|
+
this._fitHeight = props.fitHeight;
|
|
23
|
+
return this;
|
|
24
|
+
}
|
|
25
|
+
getProp() {
|
|
26
|
+
return {
|
|
27
|
+
...super.getProp(),
|
|
28
|
+
designResolution: {
|
|
29
|
+
width: this._designResolution?.width ?? 960,
|
|
30
|
+
height: this._designResolution?.height ?? 640
|
|
31
|
+
},
|
|
32
|
+
fitWidth: this._fitWidth,
|
|
33
|
+
fitHeight: this._fitHeight
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
toJSON() {
|
|
37
|
+
return {
|
|
38
|
+
__type__: this.__type__,
|
|
39
|
+
_name: this._name,
|
|
40
|
+
_objFlags: this._objFlags,
|
|
41
|
+
node: this.node,
|
|
42
|
+
_enabled: this._enabled,
|
|
43
|
+
_designResolution: this._designResolution.toJSON(),
|
|
44
|
+
_fitWidth: this._fitWidth,
|
|
45
|
+
_fitHeight: this._fitHeight,
|
|
46
|
+
_id: this._id
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -1,32 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
this.
|
|
9
|
-
this.
|
|
10
|
-
this.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
this.
|
|
16
|
-
this.
|
|
17
|
-
this.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
toJSON() {
|
|
22
|
-
return {
|
|
23
|
-
__type__: this.__type__,
|
|
24
|
-
r: this.r,
|
|
25
|
-
g: this.g,
|
|
26
|
-
b: this.b,
|
|
27
|
-
a: this.a
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
module.exports = CCColor;
|
|
1
|
+
export default class CCColor {
|
|
2
|
+
__type__;
|
|
3
|
+
r;
|
|
4
|
+
g;
|
|
5
|
+
b;
|
|
6
|
+
a;
|
|
7
|
+
constructor(r = 255, g = 255, b = 255, a = 255) {
|
|
8
|
+
this.__type__ = 'cc.Color';
|
|
9
|
+
this.r = r;
|
|
10
|
+
this.g = g;
|
|
11
|
+
this.b = b;
|
|
12
|
+
this.a = a;
|
|
13
|
+
}
|
|
14
|
+
set(r, g, b, a = 255) {
|
|
15
|
+
this.r = r;
|
|
16
|
+
this.g = g;
|
|
17
|
+
this.b = b;
|
|
18
|
+
this.a = a;
|
|
19
|
+
return this;
|
|
20
|
+
}
|
|
21
|
+
toJSON() {
|
|
22
|
+
return {
|
|
23
|
+
__type__: this.__type__,
|
|
24
|
+
r: this.r,
|
|
25
|
+
g: this.g,
|
|
26
|
+
b: this.b,
|
|
27
|
+
a: this.a
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -1,60 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
this.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
this
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return this;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
+
import CCObject from './CCObject.js';
|
|
2
|
+
import { generateId } from '../utils.js';
|
|
3
|
+
export default class CCComponent extends CCObject {
|
|
4
|
+
node;
|
|
5
|
+
_enabled;
|
|
6
|
+
_id;
|
|
7
|
+
constructor() {
|
|
8
|
+
super('');
|
|
9
|
+
this.__type__ = 'cc.Component';
|
|
10
|
+
this.node = null;
|
|
11
|
+
this._enabled = true;
|
|
12
|
+
this._id = generateId();
|
|
13
|
+
}
|
|
14
|
+
setNode(nodeIndex) {
|
|
15
|
+
this.node = { __id__: nodeIndex };
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
18
|
+
getProp() {
|
|
19
|
+
return {
|
|
20
|
+
class: this.__type__,
|
|
21
|
+
enabled: this._enabled
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
setProp(props) {
|
|
25
|
+
if (props.enabled !== undefined)
|
|
26
|
+
this._enabled = props.enabled;
|
|
27
|
+
return this;
|
|
28
|
+
}
|
|
29
|
+
toJSON() {
|
|
30
|
+
return {
|
|
31
|
+
__type__: this.__type__,
|
|
32
|
+
_name: this._name,
|
|
33
|
+
_objFlags: this._objFlags,
|
|
34
|
+
node: this.node,
|
|
35
|
+
_enabled: this._enabled,
|
|
36
|
+
_id: this._id
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|